Minor bug fixes
This commit is contained in:
parent
9360aca647
commit
0e22351e35
|
@ -988,6 +988,8 @@ proc expression(self: Compiler, node: Expression) =
|
||||||
# error in self.identifier()
|
# error in self.identifier()
|
||||||
self.error("expression has no type")
|
self.error("expression has no type")
|
||||||
case node.kind:
|
case node.kind:
|
||||||
|
of callExpr:
|
||||||
|
discard # TODO
|
||||||
of getItemExpr:
|
of getItemExpr:
|
||||||
discard # TODO
|
discard # TODO
|
||||||
# Note that for setItem and assign we don't convert
|
# Note that for setItem and assign we don't convert
|
||||||
|
|
|
@ -103,7 +103,7 @@ proc addOperator(self: OperatorTable, lexeme: string) =
|
||||||
if lexeme in self.tokens:
|
if lexeme in self.tokens:
|
||||||
return # We've already added it!
|
return # We've already added it!
|
||||||
var prec = Precedence.high()
|
var prec = Precedence.high()
|
||||||
if lexeme.len() >= 2 and lexeme[^3..^1] in ["->", "~>", "=>"]:
|
if lexeme.len() >= 2 and lexeme[^2..^1] in ["->", "~>", "=>"]:
|
||||||
prec = Arrow
|
prec = Arrow
|
||||||
elif lexeme.endsWith("=") and lexeme[0] notin {'<', '>', '!', '?', '~', '='}:
|
elif lexeme.endsWith("=") and lexeme[0] notin {'<', '>', '!', '?', '~', '='}:
|
||||||
prec = Assign
|
prec = Assign
|
||||||
|
|
|
@ -109,9 +109,9 @@ proc jumpInstruction(instruction: OpCode, chunk: Chunk, offset: int): int =
|
||||||
## Debugs jumps
|
## Debugs jumps
|
||||||
var jump: int
|
var jump: int
|
||||||
case instruction:
|
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()
|
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()
|
jump = [chunk.code[offset + 1], chunk.code[offset + 2], chunk.code[offset + 3]].fromTriple().int()
|
||||||
else:
|
else:
|
||||||
discard # Unreachable
|
discard # Unreachable
|
||||||
|
|
Loading…
Reference in New Issue