mirror of
https://github.com/godotengine/godot.git
synced 2026-01-03 18:11:19 +03:00
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:
@@ -3,27 +3,32 @@ extends Node
|
||||
func test():
|
||||
var child = Node.new()
|
||||
child.name = "Child"
|
||||
@warning_ignore("unsafe_call_argument")
|
||||
add_child(child)
|
||||
child.owner = self
|
||||
|
||||
var hey = Node.new()
|
||||
hey.name = "Hey"
|
||||
@warning_ignore("unsafe_call_argument")
|
||||
child.add_child(hey)
|
||||
hey.owner = self
|
||||
hey.unique_name_in_owner = true
|
||||
|
||||
var fake_hey = Node.new()
|
||||
fake_hey.name = "Hey"
|
||||
@warning_ignore("unsafe_call_argument")
|
||||
add_child(fake_hey)
|
||||
fake_hey.owner = self
|
||||
|
||||
var sub_child = Node.new()
|
||||
sub_child.name = "SubChild"
|
||||
@warning_ignore("unsafe_call_argument")
|
||||
hey.add_child(sub_child)
|
||||
sub_child.owner = self
|
||||
|
||||
var howdy = Node.new()
|
||||
howdy.name = "Howdy"
|
||||
@warning_ignore("unsafe_call_argument")
|
||||
sub_child.add_child(howdy)
|
||||
howdy.owner = self
|
||||
howdy.unique_name_in_owner = true
|
||||
|
||||
@@ -5,9 +5,11 @@ func test():
|
||||
# Create the required node structure.
|
||||
var hello = Node.new()
|
||||
hello.name = "Hello"
|
||||
@warning_ignore("unsafe_call_argument")
|
||||
add_child(hello)
|
||||
var world = Node.new()
|
||||
world.name = "World"
|
||||
@warning_ignore("unsafe_call_argument")
|
||||
hello.add_child(world)
|
||||
|
||||
# All the ways of writing node paths below with the `$` operator are valid.
|
||||
|
||||
@@ -26,6 +26,7 @@ func test():
|
||||
if true: (v as Callable).call()
|
||||
print()
|
||||
|
||||
@warning_ignore("unsafe_call_argument")
|
||||
other(v)
|
||||
print()
|
||||
|
||||
|
||||
@@ -2,4 +2,5 @@ func foo(x):
|
||||
return x + 1
|
||||
|
||||
func test():
|
||||
@warning_ignore("unsafe_call_argument")
|
||||
print(foo(foo(foo(foo(foo(foo(foo(foo(foo(foo(foo(foo(foo(foo(foo(foo(foo(foo(foo(foo(foo(foo(foo(foo(0)))))))))))))))))))))))))
|
||||
|
||||
@@ -36,6 +36,7 @@ class SayNothing extends Say:
|
||||
print("howdy, see above")
|
||||
|
||||
func say(name):
|
||||
@warning_ignore("unsafe_call_argument")
|
||||
super(name + " super'd")
|
||||
print(prefix, " say nothing... or not? ", name)
|
||||
|
||||
|
||||
@@ -29,6 +29,7 @@ func test():
|
||||
|
||||
const d = 1.1
|
||||
_process(d)
|
||||
@warning_ignore("unsafe_call_argument")
|
||||
print(is_equal_approx(ㄥ, PI + (d * PI)))
|
||||
|
||||
func _process(Δ: float) -> void:
|
||||
|
||||
Reference in New Issue
Block a user