Skip to main content

Module default_node

Module default_node 

Source
Expand description

The value a Node (plain JavaScript) member takes when the stream does not carry it.

Table 9 of DDS-XTypes 1.3, as JavaScript. crate::default_lua is the nearest sibling — a dynamically-typed target needs no class and no constructor for an aggregate default, a plain literal is the value — and this is a further derivation and deliberately not a call into it or into crate::default_typescript: the columns are compared against each other, and a shared helper would make them agree about a mistake.

§The Node spellings, where they differ from Lua’s

An @optional member is a key left out, exactly as in Lua, and for the same clause — §7.2.2.4.4.4.8’s “Implementations shall not provide a default value” is the absence, and in a JavaScript object literal the absence of a value is the absence of the key.

A char and a wchar are the code point, as a one-character string. crate::emit::node’s module documentation carries why this column keeps crate::typescript’s value model rather than Lua’s or Zig’s integer one: Table 9’s zero is therefore "\0" (Literal::Char('\0')), not 0.

The three sixty-four-bit primitives are bigint literals. 0n, spelled through zerodds_lang_cst::node::Expr::Literal with the trailing n crate::emit::node::Node::wide_signed and crate::emit::typescript’s own overrides already carry.

A long double is the decimal text "0". A JavaScript number is a binary64; the member holds the decimal exactly as runtime/node/zdwire.js’s float128FromDecimalString takes it.

An enumeration’s default is read out of the flattened declaration through CodecTarget::enumerator_constant, so the file that declared the value is the file this reads it from, exactly as every sibling column reads it.

Functions§

default_into
place = zd_def_<T>();.
defaulter_from_decoder
The defaulter that goes with a decoder, by name: the two schemes differ in one word because both are built from the same key.
defaulter_name
The defaulter function name for a type — keyed like crate::emit::decode::decoder_name, by the IDL kind for a primitive: the walk needs one function per wire shape and a name built from the JavaScript holder would give a long and an octet one defaulter, because both are number.
member_default
One member’s default: its @default, or its type’s. §7.2.2.4.4.4.9 puts the explicit one first.
node_defaulters_called_by
The defaulters decls call, and exactly those, read off the emitted calls rather than derived a second time from the model — the same closure discipline crate::default_python and crate::default_c state at length.
node_defaulters_over
Build the defaulter for each of types, once per name.