mirror of
https://github.com/godotengine/godot.git
synced 2025-10-22 17:33:33 +00:00
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")
This commit is contained in:
parent
f879a08a62
commit
c6e66a43b0
6 changed files with 229 additions and 68 deletions
|
@ -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:
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue