GDScript: Add support for variadic functions

This commit is contained in:
Danil Alexeev 2025-03-30 12:59:05 +03:00
parent 3b963ab8b6
commit ee121ef80e
No known key found for this signature in database
GPG key ID: 5A52F75A8679EC57
33 changed files with 416 additions and 65 deletions

View file

@ -0,0 +1,5 @@
func f(...args, extra_arg):
pass
func test():
pass

View file

@ -0,0 +1,2 @@
GDTEST_PARSER_ERROR
Cannot have parameters after the rest parameter.

View file

@ -0,0 +1,5 @@
func f(...args, ...more_args):
pass
func test():
pass

View file

@ -0,0 +1,2 @@
GDTEST_PARSER_ERROR
Cannot have parameters after the rest parameter.

View file

@ -0,0 +1,5 @@
func f(...args = []):
pass
func test():
pass

View file

@ -0,0 +1,2 @@
GDTEST_PARSER_ERROR
The rest parameter cannot have a default value.

View file

@ -0,0 +1,5 @@
static func _static_init(...args) -> void:
pass
func test():
pass

View file

@ -0,0 +1,2 @@
GDTEST_PARSER_ERROR
Static constructor cannot have parameters.