Unify typing of variables, constants and parameters in GDScript
This commit is contained in:
parent
1d14c054a1
commit
a1d06749f1
17 changed files with 237 additions and 357 deletions
|
|
@ -0,0 +1,6 @@
|
|||
func check(arg: float = 3):
|
||||
return typeof(arg) == typeof(3.0)
|
||||
|
||||
func test():
|
||||
if check():
|
||||
print('ok')
|
||||
|
|
@ -0,0 +1,2 @@
|
|||
GDTEST_OK
|
||||
ok
|
||||
|
|
@ -0,0 +1,32 @@
|
|||
func check(input: int) -> bool:
|
||||
return input == 1
|
||||
|
||||
var recur = null
|
||||
var prop = null
|
||||
|
||||
func check_arg(arg = null) -> void:
|
||||
if arg != null:
|
||||
print(check(arg))
|
||||
|
||||
func check_recur() -> void:
|
||||
if recur != null:
|
||||
print(check(recur))
|
||||
else:
|
||||
recur = 1
|
||||
check_recur()
|
||||
|
||||
func test() -> void:
|
||||
check_arg(1)
|
||||
|
||||
check_recur()
|
||||
|
||||
if prop == null:
|
||||
set('prop', 1)
|
||||
print(check(prop))
|
||||
set('prop', null)
|
||||
|
||||
var loop = null
|
||||
while loop != 2:
|
||||
if loop != null:
|
||||
print(check(loop))
|
||||
loop = 1 if loop == null else 2
|
||||
|
|
@ -0,0 +1,5 @@
|
|||
GDTEST_OK
|
||||
true
|
||||
true
|
||||
true
|
||||
true
|
||||
|
|
@ -0,0 +1,5 @@
|
|||
func test():
|
||||
var bar = 1
|
||||
var foo: float = bar
|
||||
print(typeof(foo))
|
||||
print(foo is float)
|
||||
|
|
@ -0,0 +1,3 @@
|
|||
GDTEST_OK
|
||||
3
|
||||
true
|
||||
Loading…
Add table
Add a link
Reference in a new issue