Fix outer class lookup
This commit is contained in:
parent
d44d0cc0fd
commit
1bbb2b4159
3 changed files with 15 additions and 1 deletions
|
@ -3167,7 +3167,7 @@ void GDScriptAnalyzer::reduce_identifier_from_base(GDScriptParser::IdentifierNod
|
|||
// TODO: Allow outer static functions.
|
||||
if (base_class->outer != nullptr) {
|
||||
List<GDScriptParser::ClassNode *> script_classes;
|
||||
get_class_node_current_scope_classes(parser->current_class, &script_classes);
|
||||
get_class_node_current_scope_classes(base_class->outer, &script_classes);
|
||||
for (GDScriptParser::ClassNode *script_class : script_classes) {
|
||||
if (script_class->has_member(name)) {
|
||||
resolve_class_member(script_class, name, p_identifier);
|
||||
|
|
|
@ -0,0 +1,12 @@
|
|||
class A:
|
||||
class B:
|
||||
func test():
|
||||
print(A.B.D)
|
||||
|
||||
class C:
|
||||
class D:
|
||||
pass
|
||||
|
||||
func test():
|
||||
var inst = A.B.new()
|
||||
inst.test()
|
|
@ -0,0 +1,2 @@
|
|||
GDTEST_ANALYZER_ERROR
|
||||
Cannot find member "D" in base "B".
|
Loading…
Reference in a new issue