GDScript: Allow variables in match patterns
To restore an ability available in 3.x and reduce compatibility changes.
This commit is contained in:
parent
218bef90af
commit
c68b2358d5
8 changed files with 59 additions and 15 deletions
|
|
@ -0,0 +1,5 @@
|
|||
func test():
|
||||
var dict = { a = 1 }
|
||||
match 2:
|
||||
dict["a"]:
|
||||
print("not allowed")
|
||||
|
|
@ -0,0 +1,2 @@
|
|||
GDTEST_ANALYZER_ERROR
|
||||
Expression in match pattern must be a constant expression, an identifier, or an attribute access ("A.B").
|
||||
|
|
@ -0,0 +1,5 @@
|
|||
func test():
|
||||
var a = 1
|
||||
match 2:
|
||||
a + 2:
|
||||
print("not allowed")
|
||||
|
|
@ -0,0 +1,2 @@
|
|||
GDTEST_ANALYZER_ERROR
|
||||
Expression in match pattern must be a constant expression, an identifier, or an attribute access ("A.B").
|
||||
Loading…
Add table
Add a link
Reference in a new issue