diff options
author | George Marques <george@gmarqu.es> | 2021-03-25 10:36:29 -0300 |
---|---|---|
committer | George Marques <george@gmarqu.es> | 2021-04-28 10:56:16 -0300 |
commit | c6e66a43b0eae569b60c85d3f26009ed52f97861 (patch) | |
tree | 29290c264576ccdd65bd7bdb8aa22f3e07c407f4 /modules/gdscript/gdscript_analyzer.cpp | |
parent | f879a08a621b153c216453b97e2bf48c8ac296d6 (diff) | |
download | redot-engine-c6e66a43b0eae569b60c85d3f26009ed52f97861.tar.gz |
GDScript: Add lambda syntax parsing
Lambda syntax is the same as a the function syntax (using the same
`func` keyword) except that the name is optional and it can be embedded
anywhere an expression is expected. E.g.:
func _ready():
var my_lambda = func(x):
print(x)
my_lambda.call("hello")
Diffstat (limited to 'modules/gdscript/gdscript_analyzer.cpp')
-rw-r--r-- | modules/gdscript/gdscript_analyzer.cpp | 4 |
1 files changed, 4 insertions, 0 deletions
diff --git a/modules/gdscript/gdscript_analyzer.cpp b/modules/gdscript/gdscript_analyzer.cpp index 5da2bb5cc1..e754ba70ec 100644 --- a/modules/gdscript/gdscript_analyzer.cpp +++ b/modules/gdscript/gdscript_analyzer.cpp @@ -872,6 +872,9 @@ void GDScriptAnalyzer::resolve_node(GDScriptParser::Node *p_node) { case GDScriptParser::Node::SIGNAL: // Nothing to do. break; + case GDScriptParser::Node::LAMBDA: + // FIXME: Recurse into lambda. + break; } } @@ -1489,6 +1492,7 @@ void GDScriptAnalyzer::reduce_expression(GDScriptParser::ExpressionNode *p_expre case GDScriptParser::Node::FOR: case GDScriptParser::Node::FUNCTION: case GDScriptParser::Node::IF: + case GDScriptParser::Node::LAMBDA: case GDScriptParser::Node::MATCH: case GDScriptParser::Node::MATCH_BRANCH: case GDScriptParser::Node::PARAMETER: |