pub enum DefaultValue {
Undefined,
Number(f64),
OmittedNumber {
omitted: f64,
undefined: f64,
},
String(String),
Boolean(bool),
Null,
EmptyArray,
EmptyObject,
GlobalConst(MangledName),
EnumVariant {
enum_mangled: MangledName,
variant: String,
value: EnumVariantValue,
},
}Expand description
Restricted to shapes materializable without re-evaluating arbitrary source.
Re-evaluated per call (matching JS/TS) — a fresh TypedExpr is spliced at each call site.
Variants§
Undefined
Number(f64)
OmittedNumber
A number for an omitted argument that an explicit undefined does not
share, as in JavaScript: splice(1) removes to the end, while
splice(1, undefined) converts undefined to 0 and removes nothing.
String(String)
Boolean(bool)
Null
EmptyArray
[] — the parameter’s resolved type must be Type::Array(_);
signature-time validation checks this.
EmptyObject
{} — the parameter’s resolved type must be Type::Object { .. }. Synthesizes an
empty object literal; absent optional fields serialize away. Used for MCP tools
whose input schema marks nothing required, so a zero-arg call type-checks.
GlobalConst(MangledName)
Codegen emits a GlobalGet at each fill-in site.
EnumVariant
Fields mirror TypedExprKind::{Number,String}EnumMember so the call-site synthesizer can build that node verbatim.