selfhost/cmd/wcc: stamp typed-suffix N_FLOATLIT (#51b)
cstage cmd/wcc/check.c:702 cexpr N_FLOATLIT arm uses lookup_builtin (n->tsuffix) with fall-through to ty_untyped_float. wwstage's exprtype N_FLOATLIT arm at check.ww L1582 was unconditional untyped_float — the symmetric-stage gap flagged at the tail of #51. New arm: when e.tsuffix is non-empty, mktname+tinfofornode resolves the builtin and stamps e.type_; on nil tinfo fall through to the existing untyped_float path. Same shape as the #51 INTLIT arm one block up. Byte-identity (994/995) is the behavior gate; full make test green at 133/133 confirms.
This commit is contained in:
@@ -8650,6 +8650,18 @@ fn exprtype(c: *checker, e: *node, hint: *node) *node = {
|
|||||||
return tn;
|
return tn;
|
||||||
};
|
};
|
||||||
if (k == nkind.N_FLOATLIT) {
|
if (k == nkind.N_FLOATLIT) {
|
||||||
|
// Typed-float literal (`1.5f32`, `0.0f64`): tsuffix names a
|
||||||
|
// builtin primitive. Mirrors cstage cmd/wcc/check.c:702-709
|
||||||
|
// cexpr's `lookup_builtin(n->tsuffix)`; falls through to
|
||||||
|
// untyped_float when the suffix doesn't resolve.
|
||||||
|
if (e.tsuffix.len > 0) {
|
||||||
|
let suf: *node = mktname(c, e.tsuffix);
|
||||||
|
let ti: *tinfo = tinfofornode(c, suf);
|
||||||
|
if (ti != nil) {
|
||||||
|
e.type_ = ti: *void;
|
||||||
|
return suf;
|
||||||
|
};
|
||||||
|
};
|
||||||
let tn: *node = mktname(c, "untyped_float");
|
let tn: *node = mktname(c, "untyped_float");
|
||||||
e.type_ = tinfofornode(c, tn): *void;
|
e.type_ = tinfofornode(c, tn): *void;
|
||||||
return tn;
|
return tn;
|
||||||
|
|||||||
@@ -1580,6 +1580,18 @@ fn exprtype(c: *checker, e: *node, hint: *node) *node = {
|
|||||||
return tn;
|
return tn;
|
||||||
};
|
};
|
||||||
if (k == nkind.N_FLOATLIT) {
|
if (k == nkind.N_FLOATLIT) {
|
||||||
|
// Typed-float literal (`1.5f32`, `0.0f64`): tsuffix names a
|
||||||
|
// builtin primitive. Mirrors cstage cmd/wcc/check.c:702-709
|
||||||
|
// cexpr's `lookup_builtin(n->tsuffix)`; falls through to
|
||||||
|
// untyped_float when the suffix doesn't resolve.
|
||||||
|
if (e.tsuffix.len > 0) {
|
||||||
|
let suf: *node = mktname(c, e.tsuffix);
|
||||||
|
let ti: *tinfo = tinfofornode(c, suf);
|
||||||
|
if (ti != nil) {
|
||||||
|
e.type_ = ti: *void;
|
||||||
|
return suf;
|
||||||
|
};
|
||||||
|
};
|
||||||
let tn: *node = mktname(c, "untyped_float");
|
let tn: *node = mktname(c, "untyped_float");
|
||||||
e.type_ = tinfofornode(c, tn): *void;
|
e.type_ = tinfofornode(c, tn): *void;
|
||||||
return tn;
|
return tn;
|
||||||
|
|||||||
@@ -8650,6 +8650,18 @@ fn exprtype(c: *checker, e: *node, hint: *node) *node = {
|
|||||||
return tn;
|
return tn;
|
||||||
};
|
};
|
||||||
if (k == nkind.N_FLOATLIT) {
|
if (k == nkind.N_FLOATLIT) {
|
||||||
|
// Typed-float literal (`1.5f32`, `0.0f64`): tsuffix names a
|
||||||
|
// builtin primitive. Mirrors cstage cmd/wcc/check.c:702-709
|
||||||
|
// cexpr's `lookup_builtin(n->tsuffix)`; falls through to
|
||||||
|
// untyped_float when the suffix doesn't resolve.
|
||||||
|
if (e.tsuffix.len > 0) {
|
||||||
|
let suf: *node = mktname(c, e.tsuffix);
|
||||||
|
let ti: *tinfo = tinfofornode(c, suf);
|
||||||
|
if (ti != nil) {
|
||||||
|
e.type_ = ti: *void;
|
||||||
|
return suf;
|
||||||
|
};
|
||||||
|
};
|
||||||
let tn: *node = mktname(c, "untyped_float");
|
let tn: *node = mktname(c, "untyped_float");
|
||||||
e.type_ = tinfofornode(c, tn): *void;
|
e.type_ = tinfofornode(c, tn): *void;
|
||||||
return tn;
|
return tn;
|
||||||
|
|||||||
Reference in New Issue
Block a user