diff options
author | George Marques <george@gmarqu.es> | 2021-03-26 09:03:16 -0300 |
---|---|---|
committer | George Marques <george@gmarqu.es> | 2021-04-28 10:56:16 -0300 |
commit | 3155368093875e644b1adbfa29bb584134c52a89 (patch) | |
tree | 1ab3313b8813c6ca9f39cac46c6fcdb347882b61 /modules/gdscript/gdscript_analyzer.h | |
parent | c6e66a43b0eae569b60c85d3f26009ed52f97861 (diff) | |
download | redot-engine-3155368093875e644b1adbfa29bb584134c52a89.tar.gz |
GDScript: Add lambdas to the type analyzer
- Lambdas are always callables (no specific signature match).
- Captures from the current context are evaluated.
Diffstat (limited to 'modules/gdscript/gdscript_analyzer.h')
-rw-r--r-- | modules/gdscript/gdscript_analyzer.h | 3 |
1 files changed, 3 insertions, 0 deletions
diff --git a/modules/gdscript/gdscript_analyzer.h b/modules/gdscript/gdscript_analyzer.h index 8430d3f4a5..7f7e2b8949 100644 --- a/modules/gdscript/gdscript_analyzer.h +++ b/modules/gdscript/gdscript_analyzer.h @@ -42,6 +42,7 @@ class GDScriptAnalyzer { HashMap<String, Ref<GDScriptParserRef>> depended_parsers; const GDScriptParser::EnumNode *current_enum = nullptr; + List<const GDScriptParser::LambdaNode *> lambda_stack; Error resolve_inheritance(GDScriptParser::ClassNode *p_class, bool p_recursive = true); GDScriptParser::DataType resolve_datatype(GDScriptParser::TypeNode *p_type); @@ -82,6 +83,7 @@ class GDScriptAnalyzer { void reduce_get_node(GDScriptParser::GetNodeNode *p_get_node); void reduce_identifier(GDScriptParser::IdentifierNode *p_identifier, bool can_be_builtin = false); void reduce_identifier_from_base(GDScriptParser::IdentifierNode *p_identifier, GDScriptParser::DataType *p_base = nullptr); + void reduce_lambda(GDScriptParser::LambdaNode *p_lambda); void reduce_literal(GDScriptParser::LiteralNode *p_literal); void reduce_preload(GDScriptParser::PreloadNode *p_preload); void reduce_self(GDScriptParser::SelfNode *p_self); @@ -109,6 +111,7 @@ class GDScriptAnalyzer { void mark_node_unsafe(const GDScriptParser::Node *p_node); bool class_exists(const StringName &p_class) const; Ref<GDScriptParserRef> get_parser_for(const String &p_path); + const GDScriptParser::LambdaNode *get_current_lambda() const; #ifdef DEBUG_ENABLED bool is_shadowing(GDScriptParser::IdentifierNode *p_local, const String &p_context); #endif |