Merge pull request #72285 from vnen/gdscript-variable-match

GDScript: Allow variables in match patterns
This commit is contained in:
Rémi Verschelde 2023-01-29 02:45:48 +01:00 committed by GitHub
commit a3dae9e548
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
8 changed files with 59 additions and 15 deletions

View file

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

View file

@ -0,0 +1,5 @@
GDTEST_OK
reach 1
reach 2
reach 3
reach 4