Variables now persist between statements

This commit is contained in:
2022-08-13 21:27:39 +01:00
parent 633df5f376
commit e9ab6f3f96
5 changed files with 34 additions and 18 deletions

View File

@@ -821,6 +821,10 @@ static void varDecl(Parser* parser, Node** nodeHandle) {
if (match(parser, TOKEN_ASSIGN)) {
expression(parser, &expressionNode);
}
else {
//values are null by default
emitNodeLiteral(&expressionNode, TO_NULL_LITERAL);
}
//TODO: static type checking?