mirror of
https://github.com/godotengine/godot.git
synced 2024-12-09 10:09:20 +08:00
Fix inner class constant assignment
This commit is contained in:
parent
8d52eea52b
commit
2fefcf7329
@ -3148,6 +3148,16 @@ void GDScriptAnalyzer::reduce_identifier_from_base(GDScriptParser::IdentifierNod
|
||||
case GDScriptParser::ClassNode::Member::FUNCTION:
|
||||
p_identifier->set_datatype(make_callable_type(member.function->info));
|
||||
break;
|
||||
case GDScriptParser::ClassNode::Member::CLASS:
|
||||
if (p_base != nullptr && p_base->is_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:
|
||||
break; // Type already set.
|
||||
}
|
||||
|
@ -0,0 +1,7 @@
|
||||
const External = preload("inner_class_constant_assignment_external.notest.gd")
|
||||
const ExternalInnerClass = External.InnerClass
|
||||
|
||||
func test():
|
||||
var inst_external: ExternalInnerClass = ExternalInnerClass.new()
|
||||
inst_external.x = 4.0
|
||||
print(inst_external.x)
|
@ -0,0 +1,2 @@
|
||||
GDTEST_OK
|
||||
4
|
@ -0,0 +1,2 @@
|
||||
class InnerClass:
|
||||
var x: = 3.0
|
Loading…
Reference in New Issue
Block a user