summaryrefslogtreecommitdiffstats
path: root/modules/gdscript/gdscript_analyzer.cpp
diff options
context:
space:
mode:
authorRémi Verschelde <rverschelde@gmail.com>2022-12-23 09:20:50 +0100
committerRémi Verschelde <rverschelde@gmail.com>2022-12-23 09:20:50 +0100
commitedfa1e8665564da54bd0090283e5b6c671b70983 (patch)
tree529d6464a9d8b219987d13031efbd4bfe3347c5b /modules/gdscript/gdscript_analyzer.cpp
parent56b828eb82861747b687433c41a8215cfdf8831f (diff)
parent7fc814f69783ee5d3bde040bdbb057730e50bc30 (diff)
downloadredot-engine-edfa1e8665564da54bd0090283e5b6c671b70983.tar.gz
Merge pull request #70220 from adamscott/fix-external-enum
Fix external enums not assignable as constants
Diffstat (limited to 'modules/gdscript/gdscript_analyzer.cpp')
-rw-r--r--modules/gdscript/gdscript_analyzer.cpp10
1 files changed, 9 insertions, 1 deletions
diff --git a/modules/gdscript/gdscript_analyzer.cpp b/modules/gdscript/gdscript_analyzer.cpp
index 5102c54785..fc2e6e94f3 100644
--- a/modules/gdscript/gdscript_analyzer.cpp
+++ b/modules/gdscript/gdscript_analyzer.cpp
@@ -3139,6 +3139,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;
@@ -3152,12 +3158,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: