Skip to content

Commit

Permalink
feat: rename all dtype to kind
Browse files Browse the repository at this point in the history
  • Loading branch information
nawetimebomb committed Oct 13, 2024
1 parent 828ed5a commit 8261ba4
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 8 deletions.
10 changes: 5 additions & 5 deletions compiler/frontend.go
Original file line number Diff line number Diff line change
Expand Up @@ -379,11 +379,11 @@ func newVariable(token Token, offset int) (Variable, int) {
vt := parser.previousToken

switch vt.kind {
case TOKEN_BOOL: newVar.dtype = BOOL
case TOKEN_BYTE: newVar.dtype = BYTE
case TOKEN_INT: newVar.dtype = INT
case TOKEN_PTR: newVar.dtype = RAWPOINTER
case TOKEN_STR: newVar.dtype = STRING
case TOKEN_BOOL: newVar.kind = BOOL
case TOKEN_BYTE: newVar.kind = BYTE
case TOKEN_INT: newVar.kind = INT
case TOKEN_PTR: newVar.kind = RAWPOINTER
case TOKEN_STR: newVar.kind = STRING
default:
errorAt(&parser.previousToken, MsgParseVarMissingValue)
ExitWithError(CodeParseError)
Expand Down
2 changes: 1 addition & 1 deletion compiler/ir.go
Original file line number Diff line number Diff line change
Expand Up @@ -129,7 +129,7 @@ type Scope struct {
}

type Variable struct {
dtype ValueKind
kind ValueKind
offset int
word string
}
Expand Down
4 changes: 2 additions & 2 deletions compiler/validate.go
Original file line number Diff line number Diff line change
Expand Up @@ -250,15 +250,15 @@ func ValidateRun() {
case OP_PUSH_VAR_GLOBAL:
for _, v := range TheProgram.variables {
if v.offset == value.(int) {
sim.push(v.dtype)
sim.push(v.kind)
}
}
case OP_PUSH_VAR_GLOBAL_ADDR:
sim.push(RAWPOINTER)
case OP_PUSH_VAR_LOCAL:
for _, v := range function.variables {
if v.offset == value.(int) {
sim.push(v.dtype)
sim.push(v.kind)
}
}
case OP_PUSH_VAR_LOCAL_ADDR:
Expand Down

0 comments on commit 8261ba4

Please sign in to comment.