diff options
Diffstat (limited to 'src/compiler')
-rw-r--r-- | src/compiler/ast-tree.c | 19 |
1 files changed, 12 insertions, 7 deletions
diff --git a/src/compiler/ast-tree.c b/src/compiler/ast-tree.c index b03754d..f26d1b5 100644 --- a/src/compiler/ast-tree.c +++ b/src/compiler/ast-tree.c @@ -683,23 +683,28 @@ bool astTreeParseConstant(ParserNode *parserNode, AstTreeVariables **variables, size_t variables_size) { ParserNodeVariableMetadata *node_metadata = parserNode->metadata; - if (node_metadata->value == NULL || node_metadata->type == NULL || + if (node_metadata->value == NULL || node_metadata->name->token != PARSER_TOKEN_IDENTIFIER) { - printLog("Not yet supported"); + printLog("Not supported"); return NULL; } - AstTree *type = astTreeParse(node_metadata->type, variables, variables_size); - if (type == NULL) { - goto RETURN_ERROR; - } - AstTree *value = astTreeParse(node_metadata->value, variables, variables_size); if (value == NULL) { goto RETURN_ERROR; } + AstTree *type; + if (node_metadata->type == NULL) { + type = makeTypeOf(value); + } else { + type = astTreeParse(node_metadata->type, variables, variables_size); + if (type == NULL) { + goto RETURN_ERROR; + } + } + AstTreeVariable *variable = a404m_malloc(sizeof(*variable)); variable->type = type; variable->value = value; |