1
0
mirror of https://github.com/godotengine/godot.git synced 2025-11-04 12:00:25 +00:00

GDScript: Add lambdas to the type analyzer

- Lambdas are always callables (no specific signature match).
- Captures from the current context are evaluated.
This commit is contained in:
George Marques
2021-03-26 09:03:16 -03:00
parent c6e66a43b0
commit 3155368093
5 changed files with 122 additions and 24 deletions

View File

@@ -118,6 +118,18 @@ static void test_parser(const String &p_code, const String &p_script_path, const
print_line(vformat("%02d:%02d: %s", error.line, error.column, error.message));
}
}
GDScriptAnalyzer analyzer(&parser);
analyzer.analyze();
if (err != OK) {
const List<GDScriptParser::ParserError> &errors = parser.get_errors();
for (const List<GDScriptParser::ParserError>::Element *E = errors.front(); E != nullptr; E = E->next()) {
const GDScriptParser::ParserError &error = E->get();
print_line(vformat("%02d:%02d: %s", error.line, error.column, error.message));
}
}
#ifdef TOOLS_ENABLED
GDScriptParser::TreePrinter printer;
printer.print_tree(parser);