also derete this #3
|
@ -775,6 +775,11 @@ proc inferExprType(self: Compiler, node: ASTNode): ASTNode =
|
||||||
## Infers the type of a given expression and
|
## Infers the type of a given expression and
|
||||||
## returns it
|
## returns it
|
||||||
case node.kind:
|
case node.kind:
|
||||||
|
of identExpr:
|
||||||
|
var node = IdentExpr(node)
|
||||||
|
if self.getStaticIndex(IdentExpr(node)) == -1:
|
||||||
|
self.error(&"reference to undeclared name '{node.token.lexeme}'")
|
||||||
|
# TODO: Find type of identifier
|
||||||
of unaryExpr:
|
of unaryExpr:
|
||||||
return self.inferValueType(UnaryExpr(node).a)
|
return self.inferValueType(UnaryExpr(node).a)
|
||||||
of binaryExpr:
|
of binaryExpr:
|
||||||
|
|
|
@ -184,7 +184,7 @@ proc disassembleInstruction*(chunk: Chunk, offset: int): int =
|
||||||
|
|
||||||
proc disassembleChunk*(chunk: Chunk, name: string) =
|
proc disassembleChunk*(chunk: Chunk, name: string) =
|
||||||
## Takes a chunk of bytecode, and prints it
|
## Takes a chunk of bytecode, and prints it
|
||||||
echo &"==== JAPL Bytecode Debugger - Chunk '{name}' ====\n"
|
echo &"==== Peon Bytecode Debugger - Chunk '{name}' ====\n"
|
||||||
var index = 0
|
var index = 0
|
||||||
while index < chunk.code.len:
|
while index < chunk.code.len:
|
||||||
index = disassembleInstruction(chunk, index)
|
index = disassembleInstruction(chunk, index)
|
||||||
|
|
Loading…
Reference in New Issue