feat(lang): numbers float - a module whose decimal literals are float
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
parent
e6f565a6c4
commit
3ac0d8d5cb
5 changed files with 36 additions and 0 deletions
|
|
@ -1437,6 +1437,11 @@ function emit_call(e: Node) -> Val {
|
|||
function emit_expr(e: Node) -> Val {
|
||||
if (e == null) { return val("0", "int") }
|
||||
if e.kind == E_INT { return val(itoa(e.ival), "int") }
|
||||
if e.kind == E_FLOAT and is_float_file(e.file) {
|
||||
let ff = val(fp_lit_code(e.s, "float"), "float")
|
||||
ff.lit = e
|
||||
return ff
|
||||
}
|
||||
if e.kind == E_FLOAT { let fv = val(itoa(e.ival), "fixed"); fv.lit = e; return fv }
|
||||
if e.kind == E_PREVAL { return g_prevals[e.ival] }
|
||||
if e.kind == E_BOOL { return val(itoa(e.ival), "bool") }
|
||||
|
|
|
|||
|
|
@ -358,6 +358,7 @@ function static_type(e: Node) -> pointer {
|
|||
}
|
||||
if e.kind == E_STR or e.kind == E_SLICE { return "string" }
|
||||
if e.kind == E_INT { return "int" }
|
||||
if e.kind == E_FLOAT and is_float_file(e.file) { return "float" }
|
||||
if e.kind == E_FLOAT { return "fixed" }
|
||||
if e.kind == E_BOOL { return "bool" }
|
||||
return null
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue