Skip to content

Commit 0f266c4

Browse files
committed
Merge pull request godotengine#110523 from StamLord/pattern-guard-warning-fix
Pattern guard warning fix
2 parents 563c226 + ef98bdd commit 0f266c4

File tree

2 files changed

+4
-4
lines changed

2 files changed

+4
-4
lines changed

modules/gdscript/gdscript_analyzer.cpp

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2053,7 +2053,7 @@ void GDScriptAnalyzer::decide_suite_type(GDScriptParser::Node *p_suite, GDScript
20532053
}
20542054
}
20552055

2056-
void GDScriptAnalyzer::resolve_suite(GDScriptParser::SuiteNode *p_suite) {
2056+
void GDScriptAnalyzer::resolve_suite(GDScriptParser::SuiteNode *p_suite, bool p_is_root) {
20572057
for (int i = 0; i < p_suite->statements.size(); i++) {
20582058
GDScriptParser::Node *stmt = p_suite->statements[i];
20592059
// Apply annotations.
@@ -2062,7 +2062,7 @@ void GDScriptAnalyzer::resolve_suite(GDScriptParser::SuiteNode *p_suite) {
20622062
E->apply(parser, stmt, nullptr); // TODO: Provide `p_class`.
20632063
}
20642064

2065-
resolve_node(stmt);
2065+
resolve_node(stmt, p_is_root);
20662066
resolve_pending_lambda_bodies();
20672067
decide_suite_type(p_suite, stmt);
20682068
}
@@ -2424,7 +2424,7 @@ void GDScriptAnalyzer::resolve_match_branch(GDScriptParser::MatchBranchNode *p_m
24242424
}
24252425

24262426
if (p_match_branch->guard_body) {
2427-
resolve_suite(p_match_branch->guard_body);
2427+
resolve_suite(p_match_branch->guard_body, false);
24282428
}
24292429

24302430
resolve_suite(p_match_branch->block);

modules/gdscript/gdscript_analyzer.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -81,7 +81,7 @@ class GDScriptAnalyzer {
8181
void resolve_function_signature(GDScriptParser::FunctionNode *p_function, const GDScriptParser::Node *p_source = nullptr, bool p_is_lambda = false);
8282
void resolve_function_body(GDScriptParser::FunctionNode *p_function, bool p_is_lambda = false);
8383
void resolve_node(GDScriptParser::Node *p_node, bool p_is_root = true);
84-
void resolve_suite(GDScriptParser::SuiteNode *p_suite);
84+
void resolve_suite(GDScriptParser::SuiteNode *p_suite, bool p_is_root = true);
8585
void resolve_assignable(GDScriptParser::AssignableNode *p_assignable, const char *p_kind);
8686
void resolve_variable(GDScriptParser::VariableNode *p_variable, bool p_is_local);
8787
void resolve_constant(GDScriptParser::ConstantNode *p_constant, bool p_is_local);

0 commit comments

Comments
 (0)