diff options
author | RĂ©mi Verschelde <remi@verschelde.fr> | 2022-12-15 07:56:23 +0100 |
---|---|---|
committer | GitHub <noreply@github.com> | 2022-12-15 07:56:23 +0100 |
commit | 6debf86d516f44678730be7621784a3883ab5140 (patch) | |
tree | 63ac74ae6b5ef537ef0f0bc9bab92ca8048ceda7 /modules/gdscript/gdscript_cache.cpp | |
parent | ec4de82ab322504cf1775fe76fe93e77d5f1f71e (diff) | |
parent | 2dfc6d5b698be27469739134ea14d707e14d9a46 (diff) |
Merge pull request #69471 from rune-scape/rune-out-of-order
GDScript: Out of order member resolution
Diffstat (limited to 'modules/gdscript/gdscript_cache.cpp')
-rw-r--r-- | modules/gdscript/gdscript_cache.cpp | 14 |
1 files changed, 10 insertions, 4 deletions
diff --git a/modules/gdscript/gdscript_cache.cpp b/modules/gdscript/gdscript_cache.cpp index d1467eea95..6faf2dde73 100644 --- a/modules/gdscript/gdscript_cache.cpp +++ b/modules/gdscript/gdscript_cache.cpp @@ -50,6 +50,13 @@ GDScriptParser *GDScriptParserRef::get_parser() const { return parser; } +GDScriptAnalyzer *GDScriptParserRef::get_analyzer() { + if (analyzer == nullptr) { + analyzer = memnew(GDScriptAnalyzer(parser)); + } + return analyzer; +} + Error GDScriptParserRef::raise_status(Status p_new_status) { ERR_FAIL_COND_V(parser == nullptr, ERR_INVALID_DATA); @@ -64,23 +71,22 @@ Error GDScriptParserRef::raise_status(Status p_new_status) { result = parser->parse(GDScriptCache::get_source_code(path), path, false); break; case PARSED: { - analyzer = memnew(GDScriptAnalyzer(parser)); status = INHERITANCE_SOLVED; - Error inheritance_result = analyzer->resolve_inheritance(); + Error inheritance_result = get_analyzer()->resolve_inheritance(); if (result == OK) { result = inheritance_result; } } break; case INHERITANCE_SOLVED: { status = INTERFACE_SOLVED; - Error interface_result = analyzer->resolve_interface(); + Error interface_result = get_analyzer()->resolve_interface(); if (result == OK) { result = interface_result; } } break; case INTERFACE_SOLVED: { status = FULLY_SOLVED; - Error body_result = analyzer->resolve_body(); + Error body_result = get_analyzer()->resolve_body(); if (result == OK) { result = body_result; } |