emit warnings for unused vars

This commit is contained in:
2026-02-20 20:03:12 -06:00
parent bb8536f6c9
commit 3e7b3e9994
2 changed files with 56 additions and 3 deletions

View File

@@ -158,6 +158,7 @@ function analyze(src, filename) {
var line = null
var col = null
var has_errors = _ast.errors != null && length(_ast.errors) > 0
var folded = null
if (has_errors) {
while (_i < length(_ast.errors)) {
e = _ast.errors[_i]
@@ -176,7 +177,17 @@ function analyze(src, filename) {
}
disrupt
}
return fold_mod(_ast)
folded = fold_mod(_ast)
if (!_no_warn && folded._diagnostics != null && length(folded._diagnostics) > 0) {
_i = 0
while (_i < length(folded._diagnostics)) {
e = folded._diagnostics[_i]
os.print(`${filename}:${text(e.line)}:${text(e.col)}: ${e.severity}: ${e.message}\n`)
_i = _i + 1
}
}
folded._diagnostics = null
return folded
}
// Lazy-loaded verify_ir module (loaded on first use)