Added types and constness

Fixed #144
This commit is contained in:
2024-11-02 11:39:14 +11:00
parent 3ad53c5e0e
commit 7173f7770f
14 changed files with 266 additions and 44 deletions

View File

@@ -261,7 +261,7 @@ static void writeInstructionVarDeclare(Toy_Routine** rt, Toy_AstVarDeclare ast)
EMIT_BYTE(rt, code, TOY_OPCODE_DECLARE);
EMIT_BYTE(rt, code, Toy_getNameStringType(ast.name));
EMIT_BYTE(rt, code, ast.name->length); //quick optimisation to skip a 'strlen()' call
EMIT_BYTE(rt, code, 0);
EMIT_BYTE(rt, code, Toy_getNameStringConstant(ast.name) ? 1 : 0); //check for constness
emitString(rt, ast.name);
}