Skip to content

Commit

Permalink
Fix check for subscript chain
Browse files Browse the repository at this point in the history
  • Loading branch information
zjin123 committed Nov 23, 2024
1 parent 4888e75 commit ac7e03b
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 2 deletions.
2 changes: 1 addition & 1 deletion modules/gdscript/gdscript_analyzer.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -4667,7 +4667,7 @@ void GDScriptAnalyzer::reduce_subscript(GDScriptParser::SubscriptNode *p_subscri
if (p_subscript->base->type == GDScriptParser::Node::IDENTIFIER) {
reduce_identifier(static_cast<GDScriptParser::IdentifierNode *>(p_subscript->base), true, p_is_assignment);
} else if (p_subscript->base->type == GDScriptParser::Node::SUBSCRIPT) {
reduce_subscript(static_cast<GDScriptParser::SubscriptNode *>(p_subscript->base), true, p_is_assignment);
reduce_subscript(static_cast<GDScriptParser::SubscriptNode *>(p_subscript->base), true, false);
} else {
reduce_expression(p_subscript->base);
}
Expand Down
4 changes: 4 additions & 0 deletions modules/gdscript/tests/scripts/runtime/access_level.gd
Original file line number Diff line number Diff line change
Expand Up @@ -58,6 +58,8 @@ class Foo:
print("Foo3")

class Bar extends Foo:
readonly var f = Foo.new()

public func bar():
a = 100
print(a)
Expand Down Expand Up @@ -109,3 +111,5 @@ func test():

var t2 = Test.new()
t2.test()

t.f.a = 11111
2 changes: 1 addition & 1 deletion modules/gdscript/tests/scripts/runtime/access_level.out
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
GDTEST_OK
>> WARNING
>> Line: 107
>> Line: 109
>> STATIC_CALLED_ON_INSTANCE
>> The function "Foo()" is a static function but was called from an instance. Instead, it should be directly called from the type: "Bar.Foo()".
1
Expand Down

0 comments on commit ac7e03b

Please sign in to comment.