Skip to content

Commit

Permalink
Merge pull request #53726 from briansemrau/gd-outer-class
Browse files Browse the repository at this point in the history
GDScript 2.0: Access outer scope classes
  • Loading branch information
vnen authored Oct 14, 2021
2 parents d952a84 + 0ff0f64 commit bf322ba
Show file tree
Hide file tree
Showing 3 changed files with 28 additions and 0 deletions.
5 changes: 5 additions & 0 deletions modules/gdscript/gdscript_analyzer.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2683,6 +2683,11 @@ void GDScriptAnalyzer::reduce_identifier_from_base(GDScriptParser::IdentifierNod
p_identifier->is_constant = false;
return;
} break;
case GDScriptParser::ClassNode::Member::CLASS: {
resolve_class_interface(member.m_class);
p_identifier->set_datatype(member.m_class->get_datatype());
return;
} break;
default:
break;
}
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
class A:
var x = 3

class B:
var x = 4

class C:
var x = 5

class Test:
var a = A.new()
var b: B = B.new()
var c := C.new()

func test():
var test_instance := Test.new()
prints(test_instance.a.x)
prints(test_instance.b.x)
prints(test_instance.c.x)
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
GDTEST_OK
3
4
5

0 comments on commit bf322ba

Please sign in to comment.