GDScript: Error when assigning return value of void function
This also makes built-in method calls empty the return value when the method is void, to avoid keeping returning a garbage value in such case.
This commit is contained in:
@@ -0,0 +1,4 @@
|
||||
func test():
|
||||
var obj
|
||||
obj = Node.new()
|
||||
print(obj.free())
|
||||
@@ -0,0 +1,6 @@
|
||||
GDTEST_RUNTIME_ERROR
|
||||
>> SCRIPT ERROR
|
||||
>> on function: test()
|
||||
>> runtime/errors/use_return_value_of_free_call.gd
|
||||
>> 4
|
||||
>> Trying to get a return value of a method that returns "void"
|
||||
+4
@@ -0,0 +1,4 @@
|
||||
func test():
|
||||
var value
|
||||
value = []
|
||||
print(value.reverse())
|
||||
+6
@@ -0,0 +1,6 @@
|
||||
GDTEST_RUNTIME_ERROR
|
||||
>> SCRIPT ERROR
|
||||
>> on function: test()
|
||||
>> runtime/errors/use_return_value_of_void_builtin_method_call.gd
|
||||
>> 4
|
||||
>> Trying to get a return value of a method that returns "void"
|
||||
+4
@@ -0,0 +1,4 @@
|
||||
func test():
|
||||
var obj
|
||||
obj = RefCounted.new()
|
||||
print(obj.notify_property_list_changed())
|
||||
+6
@@ -0,0 +1,6 @@
|
||||
GDTEST_RUNTIME_ERROR
|
||||
>> SCRIPT ERROR
|
||||
>> on function: test()
|
||||
>> runtime/errors/use_return_value_of_void_native_method_call.gd
|
||||
>> 4
|
||||
>> Trying to get a return value of a method that returns "void"
|
||||
Reference in New Issue
Block a user