l0_c_state.py

l0_c_state.py

Module: l0_c_state

Source: compiler/stage1_py/l0_c_state.py Language: Python

Symbols

Namespace l0_c_state

Class l0_c_state::CEmitterState

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

Member Data l0_c_state.CEmitterState.analysis

1
AnalysisResult analysis

Member Data l0_c_state.CEmitterState.current_module

1
str current_module

Member Data l0_c_state.CEmitterState.out

1
CCodeBuilder out

Member Data l0_c_state.CEmitterState._active_line_directive

1
str _active_line_directive

Member Data l0_c_state.CEmitterState._active_line_directive

1
l0_c_state.CEmitterState::_active_line_directive

Function l0_c_state.CEmitterState.find_variant_decl

1
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.

Function l0_c_state.CEmitterState.ice

1
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.

    Function l0_c_state.CEmitterState.emit_line_directive

1
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.

    Function l0_c_state.CEmitterState.restore_active_line_directive

1
None l0_c_state.CEmitterState.restore_active_line_directive(self)

Re-emit the current source line directive after generated helper lines.

Function l0_c_state.CEmitterState._get_struct_info

1
StructInfo | None l0_c_state.CEmitterState._get_struct_info(self, StructType struct_type, *bool strict)

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.

See also:

  • emit_struct_cleanup: Requires strict struct metadata during emission.

    Function l0_c_state.CEmitterState._get_enum_info

1
EnumInfo | None l0_c_state.CEmitterState._get_enum_info(self, EnumType enum_type, *bool strict)

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.

See also:

  • _emit_enum_cleanup_switch: Uses enum metadata to enumerate payload fields.