l0_c_state::CEmitterState class

Defined in module l0_c_state (l0_c_state.py).

Shared analysis, output, diagnostic context, and active source location.

Public static attributes

static AnalysisResult analysis
static str current_module
static CCodeBuilder out

Public functions

auto find_variant_decl(self, str module_name, str enum_name, str variant_name) -> EnumVariant|None
Look up an enum variant's AST declaration.
auto ice(self, str message, object|None node = None) -> NoReturn
Raise an internal compiler error with context.
auto emit_line_directive(self, Node node, str current_module) -> None
Emit #line directive for debugging generated C.
auto restore_active_line_directive(self) -> None
Re-emit the current source line directive after generated helper lines.

Protected functions

auto _get_struct_info(self, StructType struct_type, *bool strict) -> StructInfo|None
Look up resolved metadata for a struct type.
auto _get_enum_info(self, EnumType enum_type, *bool strict) -> EnumInfo|None
Look up resolved metadata for an enum type.

Protected static attributes

static str _active_line_directive

Protected attributes

_active_line_directive

Function documentation

EnumVariant|None l0_c_state::CEmitterState::find_variant_decl(self, str module_name, str enum_name, str variant_name)

Look up an enum variant's AST declaration.

Parameters
module_name Name of the module containing the enum.
enum_name Name of the enum.
variant_name Name of the variant to find.
Returns The EnumVariant node if found, otherwise None.

NoReturn l0_c_state::CEmitterState::ice(self, str message, object|None node = None)

Raise an internal compiler error with context.

Parameters
message Descriptive error message.
node Optional AST node to provide source location information.
Exceptions
InternalCompilerError Always raised with provided context.

None l0_c_state::CEmitterState::emit_line_directive(self, Node node, str current_module)

Emit #line directive for debugging generated C.

Parameters
node AST node with span information.
current_module Name of the current module.

StructInfo|None l0_c_state::CEmitterState::_get_struct_info(self, StructType struct_type, *bool strict) protected

Look up resolved metadata for a struct type.

Parameters
struct_type Struct type whose metadata is needed.
strict Whether a missing entry should raise an internal compiler error.
Returns The matching StructInfo when available, otherwise None.

EnumInfo|None l0_c_state::CEmitterState::_get_enum_info(self, EnumType enum_type, *bool strict) protected

Look up resolved metadata for an enum type.

Parameters
enum_type Enum type whose metadata is needed.
strict Whether a missing entry should raise an internal compiler error.
Returns The matching EnumInfo when available, otherwise None.