Fixed some issues in scope

This commit is contained in:
2022-08-15 10:15:24 +01:00
parent 6b834ca6d1
commit 7e01ead6ff
3 changed files with 16 additions and 6 deletions

View File

@@ -304,7 +304,7 @@ static bool execVarDecl(Interpreter* interpreter, bool lng) {
Literal type = interpreter->literalCache.literals[typeIndex];
if (!declareScopeVariable(interpreter->scope, identifier, type)) {
printf("Can't redefine the variable \"");;
printf("Can't redefine the variable \"");
printLiteral(identifier);
printf("\"\n");
return false;
@@ -325,14 +325,14 @@ static bool execVarAssign(Interpreter* interpreter) {
Literal lhs = popLiteralArray(&interpreter->stack);
if (!IS_IDENTIFIER(lhs)) {
printf("Can't assign to a non-variable \"");;
printf("Can't assign to a non-variable \"");
printLiteral(lhs);
printf("\"\n");
return false;
}
if (!isDelcaredScopeVariable(interpreter->scope, lhs)) {
printf("Undeclared variable \"");;
printf("Undeclared variable \"");
printLiteral(lhs);
printf("\"\n");
return false;