Minor bug fixes

This commit is contained in:
Mattia Giambirtone 2022-05-16 19:40:13 +02:00
parent ffee77b6fc
commit e8cbec94bd
3 changed files with 5 additions and 3 deletions

View File

@ -988,6 +988,8 @@ proc expression(self: Compiler, node: Expression) =
# error in self.identifier()
self.error("expression has no type")
case node.kind:
of callExpr:
discard # TODO
of getItemExpr:
discard # TODO
# Note that for setItem and assign we don't convert

View File

@ -103,7 +103,7 @@ proc addOperator(self: OperatorTable, lexeme: string) =
if lexeme in self.tokens:
return # We've already added it!
var prec = Precedence.high()
if lexeme.len() >= 2 and lexeme[^3..^1] in ["->", "~>", "=>"]:
if lexeme.len() >= 2 and lexeme[^2..^1] in ["->", "~>", "=>"]:
prec = Arrow
elif lexeme.endsWith("=") and lexeme[0] notin {'<', '>', '!', '?', '~', '='}:
prec = Assign

View File

@ -109,9 +109,9 @@ proc jumpInstruction(instruction: OpCode, chunk: Chunk, offset: int): int =
## Debugs jumps
var jump: int
case instruction:
of JumpIfFalse, JumpIfTrue, JumpIfFalsePop, JumpForwards, JumpBackwards:
of Jump, JumpIfFalse, JumpIfTrue, JumpIfFalsePop, JumpForwards, JumpBackwards:
jump = [chunk.code[offset + 1], chunk.code[offset + 2]].fromDouble().int()
of LongJumpIfFalse, LongJumpIfTrue, LongJumpIfFalsePop, LongJumpForwards, LongJumpBackwards:
of LongJump, LongJumpIfFalse, LongJumpIfTrue, LongJumpIfFalsePop, LongJumpForwards, LongJumpBackwards:
jump = [chunk.code[offset + 1], chunk.code[offset + 2], chunk.code[offset + 3]].fromTriple().int()
else:
discard # Unreachable