Add new GDScript type checker

This commit is contained in:
George Marques 2020-06-10 19:53:25 -03:00
parent 17cd6347ba
commit 9a76ab8b6a
No known key found for this signature in database
GPG key ID: 046BD46A3201E43D
7 changed files with 2413 additions and 113 deletions

View file

@ -33,6 +33,7 @@
#include "core/engine.h"
#include "core/global_constants.h"
#include "core/os/file_access.h"
#include "gdscript_analyzer.h"
#include "gdscript_compiler.h"
#include "gdscript_parser.h"
#include "gdscript_tokenizer.h"
@ -130,6 +131,7 @@ static void get_function_names_recursively(const GDScriptParser::ClassNode *p_cl
bool GDScriptLanguage::validate(const String &p_script, int &r_line_error, int &r_col_error, String &r_test_error, const String &p_path, List<String> *r_functions, List<ScriptLanguage::Warning> *r_warnings, Set<int> *r_safe_lines) const {
GDScriptParser parser;
GDScriptAnalyzer analyzer(&parser);
Error err = parser.parse(p_script, p_path, false);
#ifdef DEBUG_ENABLED
@ -146,6 +148,9 @@ bool GDScriptLanguage::validate(const String &p_script, int &r_line_error, int &
// }
// }
#endif
if (err == OK) {
err = analyzer.analyze();
}
if (err) {
GDScriptParser::ParserError parse_error = parser.get_errors().front()->get();
r_line_error = parse_error.line;