File: parameter_shadowing.gd

package info (click to toggle)
godot 4.4.1%2Bds-1
  • links: PTS, VCS
  • area: main
  • in suites: sid
  • size: 229,428 kB
  • sloc: cpp: 1,657,504; ansic: 186,969; xml: 153,923; cs: 36,104; java: 29,122; python: 15,230; javascript: 6,211; yacc: 4,115; pascal: 818; objc: 459; sh: 459; makefile: 109
file content (25 lines) | stat: -rw-r--r-- 447 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
# https://github.com/godotengine/godot/pull/69620

var a: int = 1

func shadow_regular_assignment(a: Variant, b: Variant) -> void:
	print(a)
	print(self.a)
	a = b
	print(a)
	print(self.a)


var v := Vector2(0.0, 0.0)

func shadow_subscript_assignment(v: Vector2, x: float) -> void:
	print(v)
	print(self.v)
	v.x += x
	print(v)
	print(self.v)


func test():
	shadow_regular_assignment('a', 'b')
	shadow_subscript_assignment(Vector2(1.0, 1.0), 5.0)