From de48503aef098d855754ab6f85558402130188d7 Mon Sep 17 00:00:00 2001 From: dec05eba Date: Sun, 25 Aug 2019 11:38:32 +0200 Subject: Find tokenizer by code reference instead of using scope parser --- include/ast.h | 2 -- include/compiler.h | 1 + 2 files changed, 1 insertion(+), 2 deletions(-) (limited to 'include') diff --git a/include/ast.h b/include/ast.h index bdab6c3..edf225b 100644 --- a/include/ast.h +++ b/include/ast.h @@ -130,8 +130,6 @@ struct Scope { Buffer/**/ ast_objects; HashMapType(BufferView, Ast*) named_objects; /* Value is always an Ast* with type LhsExpr */ Scope *parent; - /* Is null unless the scope is a file scope, in which case this is the parser that owns the scope */ - Parser *parser; FunctionSignature *function_signature; /* Borrowed from FunctionDecl. Only used if the scope belongs to FunctionDecl */ }; diff --git a/include/compiler.h b/include/compiler.h index 3e3cc92..1ed98f3 100644 --- a/include/compiler.h +++ b/include/compiler.h @@ -70,6 +70,7 @@ CHECK_RESULT int amal_compiler_internal_load_file(amal_compiler *self, const cha /* Returns a reference to the parsers tokenizer that contains the code reference, or NULL. Note: The lifetime of the tokenizer returned is the same as the lifetime of the parser that owns it. + Should only be called once code has been parsed (in AST stage or later), in which case it's thread-safe. */ Tokenizer* amal_compiler_find_tokenizer_by_code_reference(amal_compiler *self, const char *code_ref); -- cgit v1.2.3