GDScript: Improve call analysis

* Add missing `UNSAFE_CALL_ARGUMENT` warning.
* Fix `Object` constructor.
* Display an error for non-existent static methods.
This commit is contained in:
Danil Alexeev
2023-09-21 12:42:55 +03:00
parent 59139df16e
commit e8696f9961
25 changed files with 184 additions and 46 deletions

View File

@@ -23,6 +23,7 @@ func test() -> void:
typed = variant()
inferred = variant()
@warning_ignore("unsafe_call_argument") # TODO: Hard vs Weak vs Unknown.
param_weak(typed)
param_typed(typed)
param_inferred(typed)

View File

@@ -6,10 +6,12 @@ var prop = null
func check_arg(arg = null) -> void:
if arg != null:
@warning_ignore("unsafe_call_argument")
print(check(arg))
func check_recur() -> void:
if recur != null:
@warning_ignore("unsafe_call_argument")
print(check(recur))
else:
recur = 1
@@ -22,11 +24,13 @@ func test() -> void:
if prop == null:
set('prop', 1)
@warning_ignore("unsafe_call_argument")
print(check(prop))
set('prop', null)
var loop = null
while loop != 2:
if loop != null:
@warning_ignore("unsafe_call_argument")
print(check(loop))
loop = 1 if loop == null else 2