You've already forked godot
mirror of
https://github.com/godotengine/godot.git
synced 2025-11-12 13:20:55 +00:00
GDScript: Add @warning_ignore_start and @warning_ignore_restore annotations
This commit is contained in:
@@ -0,0 +1,5 @@
|
||||
@warning_ignore_start("unreachable_code")
|
||||
@warning_ignore_start("unreachable_code")
|
||||
|
||||
func test():
|
||||
pass
|
||||
@@ -0,0 +1,2 @@
|
||||
GDTEST_PARSER_ERROR
|
||||
Warning "UNREACHABLE_CODE" is already being ignored by "@warning_ignore_start" at line 1.
|
||||
@@ -0,0 +1,4 @@
|
||||
@warning_ignore_restore("unreachable_code")
|
||||
|
||||
func test():
|
||||
pass
|
||||
@@ -0,0 +1,2 @@
|
||||
GDTEST_PARSER_ERROR
|
||||
Warning "UNREACHABLE_CODE" is not being ignored by "@warning_ignore_start".
|
||||
@@ -1,6 +1,6 @@
|
||||
# https://github.com/godotengine/godot/issues/50285
|
||||
|
||||
@warning_ignore("unused_local_constant")
|
||||
@warning_ignore_start("unused_local_constant")
|
||||
func test():
|
||||
const CONST_INNER_DICTIONARY = { "key": true }
|
||||
const CONST_NESTED_DICTIONARY_OLD_WORKAROUND = {
|
||||
|
||||
@@ -1,3 +1,5 @@
|
||||
@warning_ignore_start("unused_signal")
|
||||
|
||||
# No parentheses.
|
||||
signal a
|
||||
|
||||
@@ -17,12 +19,5 @@ signal d(
|
||||
# With type hints.
|
||||
signal e(a: int, b: Variant, c: Node)
|
||||
|
||||
func no_exec():
|
||||
a.emit()
|
||||
b.emit()
|
||||
c.emit()
|
||||
d.emit()
|
||||
e.emit()
|
||||
|
||||
func test():
|
||||
print("Ok")
|
||||
|
||||
@@ -0,0 +1,26 @@
|
||||
@warning_ignore_start("unreachable_code", "narrowing_conversion")
|
||||
|
||||
var _a = 1
|
||||
@warning_ignore_start("unused_private_class_variable")
|
||||
var _b = 2
|
||||
var _c = 3
|
||||
@warning_ignore_restore("unused_private_class_variable")
|
||||
var _d = 4
|
||||
|
||||
func test():
|
||||
return
|
||||
|
||||
var a = 1
|
||||
@warning_ignore_start("unused_variable")
|
||||
var b = 2
|
||||
var c = 3
|
||||
@warning_ignore_restore("unused_variable")
|
||||
var d = 4
|
||||
|
||||
var _x: int = 1.0
|
||||
@warning_ignore_restore("narrowing_conversion")
|
||||
var _y: int = 1.0
|
||||
|
||||
func test_2():
|
||||
return
|
||||
print(42)
|
||||
@@ -0,0 +1,6 @@
|
||||
GDTEST_OK
|
||||
~~ WARNING at line 3: (UNUSED_PRIVATE_CLASS_VARIABLE) The class variable "_a" is declared but never used in the class.
|
||||
~~ WARNING at line 8: (UNUSED_PRIVATE_CLASS_VARIABLE) The class variable "_d" is declared but never used in the class.
|
||||
~~ WARNING at line 13: (UNUSED_VARIABLE) The local variable "a" is declared but never used in the block. If this is intended, prefix it with an underscore: "_a".
|
||||
~~ WARNING at line 18: (UNUSED_VARIABLE) The local variable "d" is declared but never used in the block. If this is intended, prefix it with an underscore: "_d".
|
||||
~~ WARNING at line 22: (NARROWING_CONVERSION) Narrowing conversion (float is converted to int and loses precision).
|
||||
Reference in New Issue
Block a user