summaryrefslogtreecommitdiff
path: root/modules/gdscript/tests/scripts/parser/features/match_with_variables.gd
blob: aa38c3bf41469cc5fa1c27df2c40bace346212a9 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
func test():
	var a = 1
	match 1:
		a:
			print("reach 1")

	var dict = { b = 2 }
	match 2:
		dict.b:
			print("reach 2")

	var nested_dict = {
		sub = { c = 3 }
	}
	match 3:
		nested_dict.sub.c:
			print("reach 3")

	var sub_pattern = { d = 4 }
	match [4]:
		[sub_pattern.d]:
			print("reach 4")