summaryrefslogtreecommitdiff
path: root/modules/gdscript/tests/scripts/parser/features/nested_match.gd
blob: aaddcc7e83dd556c0ef511035558a621426e2423 (plain)
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
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
func test():
	# 20 levels of nesting (and then some).
	var number = 1234
	match number:
		1234:
			print("1")
			match number:
				1234:
					print("2")
					match number:
						1234:
							print("3")
							continue
						_:
							print("Should also be printed")
							match number:
								1234:
									print("4")
									match number:
										_:
											print("5")
											match number:
												false:
													print("Should not be printed")
												true:
													print("Should not be printed")
												"hello":
													print("Should not be printed")
												1234:
													print("6")
													match number:
														_:
															print("7")
															match number:
																1234:
																	print("8")
																	match number:
																		_:
																			print("9")
																			match number:
																				1234:
																					print("10")
																					match number:
																						_:
																							print("11")
																							match number:
																								1234:
																									print("12")
																									match number:
																										_:
																											print("13")
																											match number:
																												1234:
																													print("14")
																													match number:
																														_:
																															print("15")
																															match number:
																																_:
																																	print("16")
																																	match number:
																																		1234:
																																			print("17")
																																			match number:
																																				_:
																																					print("18")
																																					match number:
																																						1234:
																																							print("19")
																																							match number:
																																								_:
																																									print("20")
																																									match number:
																																										[]:
																																											print("Should not be printed")
				_:
					print("Should not be printed")
		5678:
			print("Should not be printed either")