Debian Codegraph @

modules/gdscript/tests/scripts/runtime/features/parameter_shadowing.gd

raw
1 # https://github.com/godotengine/godot/pull/69620
2
3 var a: int = 1
4
5 func shadow_regular_assignment(a: Variant, b: Variant) -> void:
6 print(a)
7 print(self.a)
8 a = b
9 print(a)
10 print(self.a)
11
12
13 var v := Vector2(0.0, 0.0)
14
15 func shadow_subscript_assignment(v: Vector2, x: float) -> void:
16 print(v)
17 print(self.v)
18 v.x += x
19 print(v)
20 print(self.v)
21
22
23 func test():
24 shadow_regular_assignment('a', 'b')
25 shadow_subscript_assignment(Vector2(1.0, 1.0), 5.0)