Types are first-class citizens

This commit is contained in:
2022-08-22 01:59:29 +01:00
parent 9c995830e2
commit df6bd58b1a
10 changed files with 76 additions and 26 deletions

View File

@@ -364,6 +364,8 @@ static bool execVarDecl(Interpreter* interpreter, bool lng) {
Literal identifier = interpreter->literalCache.literals[identifierIndex];
Literal type = interpreter->literalCache.literals[typeIndex];
parseIdentifierToValue(interpreter, &type);
if (!declareScopeVariable(interpreter->scope, identifier, type)) {
printf("Can't redefine the variable \"");
printLiteral(identifier);
@@ -711,7 +713,7 @@ static void execInterpreter(Interpreter* interpreter) {
case OP_VAR_DECL:
case OP_VAR_DECL_LONG:
if (!execVarDecl(interpreter, opcode == OP_LITERAL_LONG)) {
if (!execVarDecl(interpreter, opcode == OP_VAR_DECL_LONG)) {
return;
}
break;