wwdump: -c/-r gate on parse errors
wwdump's -c/-r modes emitted output from a garbage parse silently. Gate on the parse-error count first (the w6c main gate, main.ww:162); wwstage-only — the C wwdump has no -c/-r modes.
This commit is contained in:
@@ -135,6 +135,11 @@ export fn main(argc: i32, argv: **u8) i32 = {
|
||||
let ps: parser;
|
||||
parserinit(&ps, &l);
|
||||
let f: *node = parsefile(&ps);
|
||||
// #52: gate the resolve report on parse-stage errors. Without
|
||||
// this a parse-errored decl is silently dropped from the AST
|
||||
// and the report is printed with rc=0. Mirrors w6c main.ww:162
|
||||
// / cmd/w6c/main.c.
|
||||
if (l.errs > 0 || ps.errs > 0) { return 1; };
|
||||
let tc: tctx;
|
||||
typesinit(&tc);
|
||||
let ck: checker;
|
||||
@@ -158,6 +163,12 @@ export fn main(argc: i32, argv: **u8) i32 = {
|
||||
let ps: parser;
|
||||
parserinit(&ps, &l);
|
||||
let f: *node = parsefile(&ps);
|
||||
// #52: gate cgen on parse-stage errors BEFORE check/cgen.
|
||||
// A parse-errored decl is silently dropped from the AST; the
|
||||
// remaining file would otherwise emit asm with rc=0 (silent
|
||||
// miscompile, and the 994 byte-identity probe ships wrong asm
|
||||
// silently). Mirrors w6c main.ww:162 / cmd/w6c/main.c.
|
||||
if (l.errs > 0 || ps.errs > 0) { return 1; };
|
||||
// #50: mirror w6c — run check before cgen so AST mutations
|
||||
// from #42 (size/align/offset fold) and audit §1.8 (node.type_
|
||||
// population) land before cgen walks. Without this, wwdump -c
|
||||
|
||||
Reference in New Issue
Block a user