mirror of
https://github.com/krgamestudios/Toy.git
synced 2026-04-15 14:54:07 +10:00
Fixed a way to have a bad type, thanks neuf!
This commit is contained in:
@@ -527,6 +527,14 @@ static Literal parseTypeToValue(Interpreter* interpreter, Literal type) {
|
||||
}
|
||||
}
|
||||
|
||||
//BUGFIX: make sure it actually is a type
|
||||
if (!IS_TYPE(type)) {
|
||||
interpreter->errorOutput("Bad type encountered: ");
|
||||
printLiteralCustom(type, interpreter->errorOutput);
|
||||
interpreter->errorOutput("\n");
|
||||
//TODO: would be better to return an int here...
|
||||
}
|
||||
|
||||
return type;
|
||||
}
|
||||
|
||||
|
||||
@@ -239,6 +239,10 @@ bool declareScopeVariable(Scope* scope, Literal key, Literal type) {
|
||||
return false;
|
||||
}
|
||||
|
||||
if (!IS_TYPE(type)) {
|
||||
return false;
|
||||
}
|
||||
|
||||
//store the type, for later checking on assignment
|
||||
setLiteralDictionary(&scope->types, key, type);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user