You've already forked godot
mirror of
https://github.com/godotengine/godot.git
synced 2025-11-22 15:06:45 +00:00
GDScript: Fix STANDALONE_EXPRESSION warning for preload()
This commit is contained in:
@@ -4,3 +4,4 @@ func i_return_int() -> int:
|
||||
|
||||
func test():
|
||||
i_return_int()
|
||||
preload("../../utils.notest.gd") # `preload` is a function-like keyword.
|
||||
|
||||
@@ -3,3 +3,7 @@ GDTEST_OK
|
||||
>> Line: 6
|
||||
>> RETURN_VALUE_DISCARDED
|
||||
>> The function "i_return_int()" returns a value that will be discarded if not used.
|
||||
>> WARNING
|
||||
>> Line: 7
|
||||
>> RETURN_VALUE_DISCARDED
|
||||
>> The function "preload()" returns a value that will be discarded if not used.
|
||||
|
||||
@@ -6,3 +6,16 @@ func test():
|
||||
Vector3.ZERO
|
||||
[true, false]
|
||||
float(125)
|
||||
# The following statements should not produce `STANDALONE_EXPRESSION`:
|
||||
var _a = 1
|
||||
_a = 2 # Assignment is a local (or global) side effect.
|
||||
@warning_ignore("redundant_await")
|
||||
await 3 # The `await` operand is usually a coroutine or a signal.
|
||||
absi(4) # A call (in general) can have side effects.
|
||||
@warning_ignore("return_value_discarded")
|
||||
preload("../../utils.notest.gd") # A static initializer may have side effects.
|
||||
"""
|
||||
Python-like "comment".
|
||||
"""
|
||||
@warning_ignore("standalone_ternary")
|
||||
1 if 2 else 3 # Produces `STANDALONE_TERNARY` instead.
|
||||
|
||||
@@ -2,16 +2,16 @@ GDTEST_OK
|
||||
>> WARNING
|
||||
>> Line: 3
|
||||
>> STANDALONE_EXPRESSION
|
||||
>> Standalone expression (the line has no effect).
|
||||
>> Standalone expression (the line may have no effect).
|
||||
>> WARNING
|
||||
>> Line: 4
|
||||
>> STANDALONE_EXPRESSION
|
||||
>> Standalone expression (the line has no effect).
|
||||
>> Standalone expression (the line may have no effect).
|
||||
>> WARNING
|
||||
>> Line: 6
|
||||
>> STANDALONE_EXPRESSION
|
||||
>> Standalone expression (the line has no effect).
|
||||
>> Standalone expression (the line may have no effect).
|
||||
>> WARNING
|
||||
>> Line: 7
|
||||
>> STANDALONE_EXPRESSION
|
||||
>> Standalone expression (the line has no effect).
|
||||
>> Standalone expression (the line may have no effect).
|
||||
|
||||
Reference in New Issue
Block a user