GDScript: Allow variables in match patterns

To restore an ability available in 3.x and reduce compatibility changes.
This commit is contained in:
George Marques 2023-01-28 19:49:14 -03:00
parent 218bef90af
commit c68b2358d5
No known key found for this signature in database
GPG key ID: 046BD46A3201E43D
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")