Type checking in place

This commit is contained in:
2022-08-15 03:52:44 +01:00
parent 8d12db7dbe
commit 6b834ca6d1
4 changed files with 76 additions and 9 deletions

View File

@@ -310,7 +310,7 @@ static bool execVarDecl(Interpreter* interpreter, bool lng) {
return false;
}
if (!setScopeVariable(interpreter->scope, identifier, parseIdentifierToValue(interpreter, popLiteralArray(&interpreter->stack)) )) {
if (!setScopeVariable(interpreter->scope, identifier, parseIdentifierToValue(interpreter, popLiteralArray(&interpreter->stack)), false)) {
printf("Incorrect type assigned to variable \"");
printLiteral(identifier);
printf("\"\n");
@@ -338,7 +338,7 @@ static bool execVarAssign(Interpreter* interpreter) {
return false;
}
if (!setScopeVariable(interpreter->scope, lhs, rhs)) {
if (!setScopeVariable(interpreter->scope, lhs, rhs, true)) {
printf("Incorrect type assigned to variable \"");
printLiteral(lhs);
printf("\"\n");