Debian Codegraph @

modules/gdscript/tests/scripts/parser/features/advanced_expression_matching.gd

raw
1 func foo(x):
2 match x:
3 1 + 1:
4 print("1+1")
5 [1,2,[1,{1:2,2:var z,..}]]:
6 print("[1,2,[1,{1:2,2:var z,..}]]")
7 print(z)
8 1 if true else 2:
9 print("1 if true else 2")
10 1 < 2:
11 print("1 < 2")
12 1 or 2 and 1:
13 print("1 or 2 and 1")
14 6 | 1:
15 print("1 | 1")
16 1 >> 1:
17 print("1 >> 1")
18 1, 2 or 3, 4:
19 print("1, 2 or 3, 4")
20 _:
21 print("wildcard")
22
23 func test():
24 foo(6 | 1)
25 foo(1 >> 1)
26 foo(2)
27 foo(1)
28 foo(1+1)
29 foo(1 < 2)
30 foo([2, 1])
31 foo(4)
32 foo([1, 2, [1, {1 : 2, 2:3}]])
33 foo([1, 2, [1, {1 : 2, 2:[1,3,5, "123"], 4:2}]])
34 foo([1, 2, [1, {1 : 2}]])