pub enum Lit {
Null,
Bool(bool),
Int(i64),
Number(f64),
Str(Box<str>),
Array(Vec<Lit>),
}Expand description
An AST literal value (LiteralValue, ast.ts:284-289). Its own type — distinct
from the runtime crate::value::OwnedValue — so the AST derives PartialEq
(OwnedValue forbids derived comparison; you must pick compare_values vs
values_equal). The two are bridged at lowering time (builder, 08).
serde-untagged: a JSON null/bool/number/string/array round-trips to
the matching variant. An integer JSON token deserializes into Int (exact,
all 64 bits — design 226 Stage B); a float token into Number (f64). The two
lower identically for every integral value in ±2^53 (number_to_owned already
produced OwnedValue::Int there), so a JS client serializing 5.0 as 5
changes nothing; what Int adds is exactness ABOVE 2^53, where the old
Number(f64) round-trip rounded (the fluent API’s i64 impl was lossy).
Variants§
Null
JSON null.
Bool(bool)
Int(i64)
An exact integer literal (a JSON integer token). Ordered BEFORE Number so
untagged deserialization tries i64 first; a non-integral or out-of-i64-range
number falls through to Number.
Number(f64)
JS number — a single f64.
Str(Box<str>)
Array(Vec<Lit>)
The right-hand side of an IN / NOT IN — a list of scalars.