signatures.l0

signatures.l0

Module: signatures

Source: compiler/stage2_l0/src/signatures.l0 Language: Dea/L0

Imports / Includes

  • name_resolver
  • types
  • symbols
  • ast
  • type_resolve
  • driver
  • std.vector
  • std.text
  • util.diag
  • std.string
  • std.hashset
  • std.hashmap

Symbols

Function sig_key

1
func sig_key(module_name: string, name: string) -> string

Build a fully qualified signature-table key.

Parameters:

  • module_name: Defining module name.
  • name: Symbol name.

Returns: Key in module::name form.

Function sig_top_decl_name

1
func sig_top_decl_name(top: TopLevelDecl*) -> string

Return the declared name carried by one top-level AST entry.

Parameters:

  • top: Top-level declaration to inspect.

Returns: Declaration name.

Function sig_top_decl_span

1
func sig_top_decl_span(top: TopLevelDecl*) -> Span

Return the source span carried by one top-level AST entry.

Parameters:

  • top: Top-level declaration to inspect.

Returns: Declaration span.

Function sig_diag_error

1
func sig_diag_error(diags: DiagCollector*, code: string, message: string, filename: string, span: Span)

Emit a signature-resolution error for a source span.

Parameters:

Function sig_type_vec_free

1
func sig_type_vec_free(items: VectorBase*?)

Free a vector of owned types.

Parameters:

  • items: Optional vector of Type* values to free.

Function sig_set_free_opt

1
func sig_set_free_opt(self: StringSet*?)

Free an optional string set.

Parameters:

  • self: Optional string set to free.

Function sig_type_vec_free_opt

1
func sig_type_vec_free_opt(items: VectorBase*?)

Free an optional vector of owned types.

Parameters:

  • items: Optional vector of Type* values to free.

Function sig_struct_field_vec_temp_free

1
func sig_struct_field_vec_temp_free(items: VectorBase*?)

Free a temporary vector of struct-field metadata.

Parameters:

  • items: Optional vector of StructFieldInfo* values to free.

Function sig_enum_variant_vec_temp_free

1
func sig_enum_variant_vec_temp_free(items: VectorBase*?)

Free a temporary vector of enum-variant metadata.

Parameters:

  • items: Optional vector of EnumVariantInfo* values to free.

Function sig_lookup_func_type

1
func sig_lookup_func_type(self: SignatureTables*, module_name: string, name: string) -> Type*?

Look up a resolved function type.

Parameters:

  • self: Signature tables to inspect.
  • module_name: Defining module name.
  • name: Function name.

Returns: Function type, or null if absent.

Function sig_lookup_struct_info

1
func sig_lookup_struct_info(self: SignatureTables*, module_name: string, name: string) -> StructInfo*?

Look up resolved struct metadata.

Parameters:

  • self: Signature tables to inspect.
  • module_name: Defining module name.
  • name: Struct name.

Returns: Struct info, or null if absent.

Function sig_lookup_enum_info

1
func sig_lookup_enum_info(self: SignatureTables*, module_name: string, name: string) -> EnumInfo*?

Look up resolved enum metadata.

Parameters:

  • self: Signature tables to inspect.
  • module_name: Defining module name.
  • name: Enum name.

Returns: Enum info, or null if absent.

Function sig_lookup_let_type

1
func sig_lookup_let_type(self: SignatureTables*, module_name: string, name: string) -> Type*?

Look up a resolved top-level let type.

Parameters:

  • self: Signature tables to inspect.
  • module_name: Defining module name.
  • name: Binding name.

Returns: Resolved type, or null if absent.

Function sig_make_tables

1
func sig_make_tables() -> SignatureTables*

Create empty signature tables.

Returns: New signature tables.

Function sig_resolve_struct

1
func sig_resolve_struct(tables: SignatureTables*, nr: NameResolution*, env: ModuleEnv*, decl: StructDecl*, diags: DiagCollector*)

Resolve one struct declaration into stored signature metadata.

Parameters:

  • tables: Signature tables receiving resolved struct info.
  • nr: Name-resolution data for symbol lookups.
  • env: Module environment owning the declaration.
  • decl: Struct declaration to resolve.
  • diags: Diagnostic collector for resolution failures.

Function sig_resolve_enum

1
func sig_resolve_enum(tables: SignatureTables*, nr: NameResolution*, env: ModuleEnv*, decl: EnumDecl*, diags: DiagCollector*)

Resolve one enum declaration into stored signature metadata.

Parameters:

  • tables: Signature tables receiving resolved enum info.
  • nr: Name-resolution data for symbol lookups.
  • env: Module environment owning the declaration.
  • decl: Enum declaration to resolve.
  • diags: Diagnostic collector for resolution failures.

Function sig_resolve_func

1
func sig_resolve_func(tables: SignatureTables*, nr: NameResolution*, env: ModuleEnv*, decl: FuncDecl*, diags: DiagCollector*)

Resolve one function declaration into a stored function type.

Parameters:

  • tables: Signature tables receiving resolved function types.
  • nr: Name-resolution data for symbol lookups.
  • env: Module environment owning the declaration.
  • decl: Function declaration to resolve.
  • diags: Diagnostic collector for resolution failures.

Function sig_infer_literal_type

1
func sig_infer_literal_type(tables: SignatureTables*, nr: NameResolution*, env: ModuleEnv*, driver_state: DriverState*, expr_id: ExprId) -> Type*?

Infer a top-level literal initializer type without full expression checking.

Parameters:

  • tables: Signature tables available during signature resolution.
  • nr: Name-resolution data for symbol lookups.
  • env: Module environment owning the initializer.
  • driver_state: Driver state providing parsed ASTs.
  • expr_id: Expression id to inspect.

Returns: Inferred literal type, or null when inference is not supported.

Function sig_symbol_is_zero_field_enum_variant

1
func sig_symbol_is_zero_field_enum_variant(sym: Symbol*) -> bool

Report whether one symbol names a zero-field enum variant.

Parameters:

Returns: true when sym is a zero-field enum variant.

Function sig_resolve_let

1
func sig_resolve_let(tables: SignatureTables*, nr: NameResolution*, env: ModuleEnv*, driver_state: DriverState*, decl: LetDecl*, diags: DiagCollector*)

Resolve or infer the type of one top-level let binding.

Parameters:

  • tables: Signature tables receiving resolved let types.
  • nr: Name-resolution data for symbol lookups.
  • env: Module environment owning the declaration.
  • driver_state: Driver state providing parsed ASTs.
  • decl: let declaration to resolve.
  • diags: Diagnostic collector for resolution failures.

Function sig_extract_dependencies

1
func sig_extract_dependencies(ty: Type*, out: StringSet*)

Collect value-type dependencies referenced by a type.

Parameters:

  • ty: Type to inspect.
  • out: Set that receives fully qualified dependency keys.

Function sig_cycle_visit

1
func sig_cycle_visit(tables: SignatureTables*, key: string, visiting: StringSet*, visited: StringSet*, diags: DiagCollector*) -> bool

Visit one value-type node in the cycle-detection graph.

Parameters:

  • tables: Signature tables containing resolved struct and enum metadata.
  • key: Fully qualified type key to visit.
  • visiting: DFS stack set for cycle detection.
  • visited: Set of nodes already proven acyclic.
  • diags: Diagnostic collector for emitted cycle errors.

Returns: true if this visit reaches a value-type cycle.

Function sig_detect_value_type_cycles

1
func sig_detect_value_type_cycles(tables: SignatureTables*, diags: DiagCollector*)

Detect value-type cycles across resolved structs and enums.

Parameters:

  • tables: Signature tables to inspect.
  • diags: Diagnostic collector.

Function sig_resolve

1
func sig_resolve(driver_state: DriverState*, nr: NameResolution*, diags: DiagCollector*) -> SignatureTables*

Resolve top-level type signatures for parsed modules.

Parameters:

  • driver_state: Parsed driver state.
  • nr: Name-resolution result.
  • diags: Diagnostic collector.

Returns: Populated signature tables.