74177d79c9
Currently array and dictionary expressions cannot be spread over multiple lines in match statements. Adding mutliline push/pop while parsing the pattern for bracket and brace enables the ability for these to be multiline. This enables more complex patterns to be matched without exceeding line limits. Fixes #90372
33 lines
521 B
GDScript
33 lines
521 B
GDScript
func foo(x):
|
|
match x:
|
|
["value1"]:
|
|
print('["value1"]')
|
|
["value1", "value2"]:
|
|
print('["value1", "value2"]')
|
|
|
|
func bar(x):
|
|
match x:
|
|
[
|
|
"value1"
|
|
]:
|
|
print('multiline ["value1"]')
|
|
[
|
|
"value1",
|
|
"value2",
|
|
]:
|
|
print('multiline ["value1", "value2",]')
|
|
[
|
|
"value1",
|
|
[
|
|
"value2",
|
|
..,
|
|
],
|
|
]:
|
|
print('multiline ["value1", ["value2", ..,],]')
|
|
|
|
func test():
|
|
foo(["value1"])
|
|
foo(["value1", "value2"])
|
|
bar(["value1"])
|
|
bar(["value1", "value2"])
|
|
bar(["value1", ["value2", "value3"]])
|