Keyboard shortcuts

Press ← or → to navigate between chapters

Press S or / to search in the book

Press ? to show this help

Press Esc to hide this help

Provisional API: This reference documents current compiler behavior. Compatibility is not yet promised.

src/initializers.x

Brace initializer conversion.

Functions

FunctionSummary
Compiler.convert_compound_literalKeeps a compound literal’s native type definition at its original scope.
Compiler.convert_initializerConverts an initializer using its declared native object for array bounds.
Compiler.initializer_field_pathReturns the initializer path selecting one visible aggregate field.
Compiler.initializer_native_typesReturns native definition/reference types for a compound literal.
Compiler.initializer_rowsReturns (original cases) rows; each case is (native-condition path destination value).
Compiler.initializer_slotSelects a native subobject without evaluating it when used by sizeof.

Compiler

Compiler.convert_compound_literal

List Compiler.convert_compound_literal( Compiler c, List value, Type type, Type native_type)

Keeps a compound literal’s native type definition at its original scope.

Source: src/initializers.x:1037

Compiler.convert_initializer

List Compiler.convert_initializer( Compiler c, List value, Type type, List target)

Converts an initializer using its declared native object for array bounds.

Source: src/initializers.x:29

Compiler.initializer_field_path

List Compiler.initializer_field_path( Compiler c, Type type, List field)

Returns the initializer path selecting one visible aggregate field. Anonymous aggregate members remain explicit path frames, so consumers observe the same member promotion as native initializer conversion.

Source: src/initializers.x:251

Compiler.initializer_native_types

List Compiler.initializer_native_types(Compiler c, Type type)

Returns native definition/reference types for a compound literal. Macro expansion stays in the original cast; named tags let later sizeof expressions reuse that exact layout without a new scope.

Source: src/initializers.x:1050

Compiler.initializer_rows

List Compiler.initializer_rows( Compiler c, Type root, List items, List target)

Returns (original cases) rows; each case is (native-condition path destination value). Explicit braces start a nested walk. Scalar runs map their ordinal through the native dimensions; other inputs retain possible cursor continuations. A NULL condition is unconditional, and a NULL destination is excess.

Source: src/initializers.x:133

Compiler.initializer_slot

List Compiler.initializer_slot(Compiler c, List target, List path)

Selects a native subobject without evaluating it when used by sizeof.

Source: src/initializers.x:427

Design notes

A brace initializer converts each value for the subobject that C’s initialization order gives it. This unit owns that walk over field order and array bounds. A bound only the native compiler knows becomes a condition on an unevaluated *(T *) 0 target, and a value converts under each condition that can select it. expressions.x converts the single values.