diff options
author | Adam Scott <ascott.ca@gmail.com> | 2022-12-17 16:19:18 -0500 |
---|---|---|
committer | Adam Scott <ascott.ca@gmail.com> | 2022-12-17 17:59:38 -0500 |
commit | 7fc814f69783ee5d3bde040bdbb057730e50bc30 (patch) | |
tree | 36b80456726d92f6c5e1b1e173574bfc9200ddee /modules/gdscript/gdscript_analyzer.cpp | |
parent | 10bc1d8710e8d6a3f58f2c4f5cc09604ef3ec51f (diff) |
Fix external enums not assignable as constants
- Add external enums test
- Rename external inner class test
- Clean up `GDScriptAnalyzer::reduce_identifier_from_base` class
behavior
Diffstat (limited to 'modules/gdscript/gdscript_analyzer.cpp')
-rw-r--r-- | modules/gdscript/gdscript_analyzer.cpp | 10 |
1 files changed, 9 insertions, 1 deletions
diff --git a/modules/gdscript/gdscript_analyzer.cpp b/modules/gdscript/gdscript_analyzer.cpp index 3bbe71fb90..efc74a0702 100644 --- a/modules/gdscript/gdscript_analyzer.cpp +++ b/modules/gdscript/gdscript_analyzer.cpp @@ -3137,6 +3137,12 @@ void GDScriptAnalyzer::reduce_identifier_from_base(GDScriptParser::IdentifierNod p_identifier->reduced_value = member.enum_value.value; p_identifier->source = GDScriptParser::IdentifierNode::MEMBER_CONSTANT; break; + case GDScriptParser::ClassNode::Member::ENUM: + if (p_base != nullptr && p_base->is_constant) { + p_identifier->is_constant = true; + p_identifier->source = GDScriptParser::IdentifierNode::MEMBER_CONSTANT; + } + break; case GDScriptParser::ClassNode::Member::VARIABLE: p_identifier->source = GDScriptParser::IdentifierNode::MEMBER_VARIABLE; p_identifier->variable_source = member.variable; @@ -3150,12 +3156,14 @@ void GDScriptAnalyzer::reduce_identifier_from_base(GDScriptParser::IdentifierNod break; case GDScriptParser::ClassNode::Member::CLASS: if (p_base != nullptr && p_base->is_constant) { + p_identifier->is_constant = true; + p_identifier->source = GDScriptParser::IdentifierNode::MEMBER_CONSTANT; + Error err = OK; GDScript *scr = GDScriptCache::get_full_script(base.script_path, err).ptr(); ERR_FAIL_COND_MSG(err != OK, "Error while getting subscript full script."); scr = scr->find_class(p_identifier->get_datatype().class_type->fqcn); p_identifier->reduced_value = scr; - p_identifier->is_constant = true; } break; default: |