mirror of
https://github.com/krgamestudios/Toy.git
synced 2026-04-15 23:04:08 +10:00
Store complex types in variables
This commit is contained in:
@@ -1231,7 +1231,14 @@ static void varDecl(Parser* parser, Node** nodeHandle) {
|
||||
//variable definition is an expression
|
||||
Node* expressionNode = NULL;
|
||||
if (match(parser, TOKEN_ASSIGN)) {
|
||||
expression(parser, &expressionNode);
|
||||
//BUGFIX: if reading into a "type" variable, expect a type value
|
||||
if (AS_TYPE(typeLiteral).typeOf == LITERAL_TYPE) { //This may cause issues when reading function returns
|
||||
Literal val = readTypeToLiteral(parser);
|
||||
|
||||
emitNodeLiteral(&expressionNode, val);
|
||||
} else {
|
||||
expression(parser, &expressionNode);
|
||||
}
|
||||
}
|
||||
else {
|
||||
//values are null by default
|
||||
|
||||
Reference in New Issue
Block a user