Skip to content

Commit bc77a77

Browse files
committed
Reduce warnings in script verifier
1 parent 4dd2db8 commit bc77a77

File tree

1 file changed

+15
-8
lines changed

1 file changed

+15
-8
lines changed

script_checking/OfflineScriptVerifier.gd

Lines changed: 15 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -24,17 +24,24 @@ func _init(new_script_text: String) -> void:
2424

2525
func test() -> void:
2626
if ClassDB.class_exists(PARSE_WRAPPER_CLASS):
27-
var wrap: RefCounted = ClassDB.instantiate(PARSE_WRAPPER_CLASS)
28-
wrap.set_source(_new_script_text)
29-
if wrap.has_errors():
27+
var wrap_instance: RefCounted = ClassDB.instantiate(PARSE_WRAPPER_CLASS)
28+
@warning_ignore("unsafe_method_access")
29+
wrap_instance.set_source(_new_script_text)
30+
@warning_ignore("unsafe_method_access")
31+
if wrap_instance.has_errors():
3032
errors = []
31-
for i in wrap.get_error_count():
32-
var lines := _new_script_text.split("\n")
33-
var error_line: int = clampi(wrap.get_error_line(i) - 1, 0, lines.size()-1)
33+
var lines := _new_script_text.split("\n")
34+
@warning_ignore("unsafe_method_access")
35+
for i: int in wrap_instance.get_error_count():
36+
@warning_ignore("unsafe_method_access")
37+
var error_line: int = wrap_instance.get_error_line(i)
38+
@warning_ignore("unsafe_method_access")
39+
error_line = clampi(error_line - 1, 0, lines.size()-1)
3440
var line_text := lines[error_line]
41+
@warning_ignore("unsafe_method_access")
3542
var error_data := make_error_from_data(
3643
1,
37-
wrap.get_error(i),
44+
wrap_instance.get_error(i) as String,
3845
"gdscript",
3946
-1,
4047
error_line,
@@ -72,7 +79,7 @@ static func make_error_from_data(
7279
"severity": severity,
7380
"message": message,
7481
"source": source,
75-
"code": -1,
82+
"code": code,
7683
"range": {
7784
"start": {
7885
"line": line,

0 commit comments

Comments
 (0)