pub enum Constant {
Number(f64),
String(Wtf8),
BigInt {
digits: String,
radix: u32,
},
Function(Box<Function>),
Template {
site: u32,
cooked: Vec<Option<Wtf8>>,
raw: Vec<String>,
},
}Expand description
A constant in the pool.
Variants§
Number(f64)
A number.
String(Wtf8)
A string.
A Wtf8 for the same reason an atom is one: the literal may hold an unpaired
surrogate, and the constant is the literal.
BigInt
A BigInt literal: digits and radix.
Function(Box<Function>)
A nested function, referenced by fclosure.
Template
A template object: one call site’s chunks.
The raw text is carried as well as the cooked text because String.raw reads
it back verbatim, and a tagged template may legally contain an invalid escape
sequence whose cooked form is undefined.
Fields
site: u32A realm-wide identity for this source location.
§13.2.8.1 keys the template registry by parse node, and the runtime needs
something equally stable: two closures made from one function body must share
the template object, while two eval calls of the same text must not. A closure
gets a freshly built CompiledCode in this engine, so the code object cannot be
the key; a counter taken at compile time is stable for every closure of the site
and fresh for every compilation unit.