derete the fil #2
|
@ -775,6 +775,11 @@ proc inferExprType(self: Compiler, node: ASTNode): ASTNode =
|
|||
## Infers the type of a given expression and
|
||||
## returns it
|
||||
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:
|
||||
return self.inferValueType(UnaryExpr(node).a)
|
||||
of binaryExpr:
|
||||
|
|
|
@ -184,7 +184,7 @@ proc disassembleInstruction*(chunk: Chunk, offset: int): int =
|
|||
|
||||
proc disassembleChunk*(chunk: Chunk, name: string) =
|
||||
## 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
|
||||
while index < chunk.code.len:
|
||||
index = disassembleInstruction(chunk, index)
|
||||
|
|
Loading…
Reference in New Issue