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.
LocalMembers
Members of the contract page currently being rendered.
NameToPage
Maps Solidity identifiers and HIR ids to their output MDX page paths relative to pages/.

EnumsΒ§

InheritedContract πŸ”’

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 canonical ABI parameter type strings (in source order) for a function.
function_signature_anchor πŸ”’
function_source_param_types πŸ”’
Extract function parameter types exactly as spelled in source.
inheritance_links
Returns the **Inherits:** markdown string for a contract, or None if it has no bases.
insert_function_anchors πŸ”’
Record the heading and exact signature anchor for a rendered Solidity function.
normalize_sol_type πŸ”’
Canonicalize Solidity type aliases for generated anchors and source fallbacks.
page_link πŸ”’
Produce a vocs-style link from page relative to current_page.
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 πŸ”’