From 1786b7b98d9841aab03703aa682cd41d27708716 Mon Sep 17 00:00:00 2001 From: dec05eba Date: Sat, 9 Mar 2019 14:52:16 +0100 Subject: Temporary remove ast resolving --- src/ast.c | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/src/ast.c b/src/ast.c index 0211d91..5f56419 100644 --- a/src/ast.c +++ b/src/ast.c @@ -175,15 +175,23 @@ static BufferView ast_get_code_reference(Ast *self) { } void ast_resolve(Ast *self, AstCompilerContext *context) { + /* + TODO: Move these to the types that need checks for recursive dependency (function declaration, struct declaration) + For function declaration, it should be marked as resolved when the signature has been resolved + instead of the whole function declaration including the body + because the body can have function call that calls functions that are resolving + or even recursive function call, which should be allowed. + if(self->resolve_status == AST_RESOLVED) { return; } else if(self->resolve_status == AST_RESOLVING) { tokenizer_get_code_reference_index(&context->parser->tokenizer, ast_get_code_reference(self).data); tokenizer_print_error(&context->parser->tokenizer, tokenizer_get_code_reference_index(&context->parser->tokenizer, ast_get_code_reference(self).data), - "Found recursive declaration"); + "Found recursive dependency"); throw(AST_ERR); } + */ self->resolve_status = AST_RESOLVING; switch(self->type) { @@ -213,5 +221,5 @@ void ast_resolve(Ast *self, AstCompilerContext *context) { binop_resolve(self->value.binop, context); break; } - self->resolve_status = AST_RESOLVED; + /*self->resolve_status = AST_RESOLVED;*/ } -- cgit v1.2.3