1
0
mirror of https://github.com/godotengine/godot.git synced 2026-01-06 19:41:11 +00:00

Fix multiline array/dictionary match statements

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
This commit is contained in:
Aiden Storey
2024-04-07 22:13:10 -04:00
committed by Rémi Verschelde
parent b2f425fe68
commit 74177d79c9
5 changed files with 82 additions and 15 deletions

View File

@@ -0,0 +1,33 @@
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"]])