GDScript: Implement lambdas compilation and runtime

This commit is contained in:
George Marques 2021-03-28 11:03:13 -03:00
parent 3155368093
commit c201b212c7
No known key found for this signature in database
GPG key ID: 046BD46A3201E43D
16 changed files with 364 additions and 39 deletions

View file

@ -4032,11 +4032,11 @@ void GDScriptParser::TreePrinter::print_if(IfNode *p_if, bool p_is_elif) {
void GDScriptParser::TreePrinter::print_lambda(LambdaNode *p_lambda) {
print_function(p_lambda->function, "Lambda");
push_text("| captures [ ");
for (const Map<StringName, IdentifierNode *>::Element *E = p_lambda->captures.front(); E; E = E->next()) {
push_text(E->key().operator String());
if (E->next()) {
for (int i = 0; i < p_lambda->captures.size(); i++) {
if (i > 0) {
push_text(" , ");
}
push_text(p_lambda->captures[i]->name.operator String());
}
push_line(" ]");
}