Skip to main content

Module hir_ext

Module hir_ext 

Source
Expand description

HIR-aware enrichments.

Pure functions over solar’s HIR:

  • build_name_to_page: maps contract names to their MDX page paths.
  • inheritance_links: **Inherits:** line for a contract page.
  • resolve_inheritdoc: pulls natspec from a base contract member.
  • replace_inline_links: rewrites {Ident} to markdown links.

StructsΒ§

InheritedDoc
Collected natspec tags from an inherited base member.
NameToPage
Maps Solidity identifiers and HIR ids to their output MDX page paths relative to pages/.

FunctionsΒ§

build_name_to_page
Build the NameToPage index from HIR by re-deriving each item’s output path.
clean_block_doc_content πŸ”’
Strip the * block-comment line decoration from each line of a /** */ NatSpec item’s content. Solar preserves raw source bytes, so continuation lines look like * text and blank separator lines look like *. This normalises them to plain text / empty lines.
collect_inherited_doc πŸ”’
escape_link_label πŸ”’
Escape a string for use as a markdown link label.
extract_inherited_doc πŸ”’
extract_inherited_doc_var πŸ”’
function_param_types πŸ”’
Extract the parameter type strings (in source order) for a function.
function_signature_anchor πŸ”’
inheritance_links
Returns the **Inherits:** markdown string for a contract, or None if it has no bases.
normalize_sol_type πŸ”’
Canonicalize Solidity type aliases so that e.g. uint[] and uint256[] compare equal during overload matching.
page_link πŸ”’
Produce a vocs-style link from page relative to current_page.
parameter_type_strings
Compute the parameter type strings of a [ParameterList] from the source map.
parse_inline_link πŸ”’
Parse {[xref-]Ident[-part]}[label] starting at offset 0 in s.
replace_inline_links
Replace {Ident} and {xref-Ident} with markdown links using name_to_page.
resolve_inheritdoc
Resolve @inheritdoc BaseContract for a function named fn_name inside contract_id (the current contract). Walks the linearized bases to find a matching function and returns its natspec if found.
resolve_inheritdoc_var
Resolve @inheritdoc BaseContract for a state variable named var_name inside contract_id. Walks the linearised bases to find a matching public variable and returns its natspec if found.
resolve_page πŸ”’
Pick the best candidate page for a given cross-reference lookup.
slug_anchor_segment πŸ”’
source_paths πŸ”’
xref_part_anchor πŸ”’