File tree Expand file tree Collapse file tree 1 file changed +7
-3
lines changed Expand file tree Collapse file tree 1 file changed +7
-3
lines changed Original file line number Diff line number Diff line change @@ -235,10 +235,10 @@ func _is_while_loop_infinite(while_token: Dictionary) -> bool:
235235 if condition_vars .size () > 0 :
236236 var modified_vars := _get_modified_variables (while_token .body )
237237 for var_name in condition_vars :
238- if not modified_vars .has (var_name ):
239- return true
238+ if modified_vars .has (var_name ):
239+ return false
240240
241- return false
241+ return true
242242
243243
244244# Extracts variable names from a condition string
@@ -268,6 +268,10 @@ func _get_modified_variables(body: Array) -> Array:
268268 var var_name : String = token .get ("var_name" , "" )
269269 if var_name != "" and not modified .has (var_name ):
270270 modified .append (var_name )
271+ # Also extract the base variable name (before dot) for property assignments
272+ var base_var := var_name .split ("." )[0 ]
273+ if base_var != var_name and not modified .has (base_var ):
274+ modified .append (base_var )
271275
272276 if token .has ("body" ):
273277 var nested_modified := _get_modified_variables (token .body )
You can’t perform that action at this time.
0 commit comments