[][src]Macro open_vaf::resolve_hierarchical

macro_rules! resolve_hierarchical {
    ($fold:expr; $name:ident as  $($declaration:ident($id:ident) => $block:block),+) => { ... };
}

A macro that hides the boiler plate required for name resolution of hieraichal Identifiers using the resolver struct It is defined in the name_resolution module but due to limitations of rustdoc can't be shown there in the documentation
If $name wasn't found or doesn't math any SymbolDeclaration::$declaration the appropriate errors are added to $self.errors and execution continuous after the macro

Arguments

  • $fold - identifer refering to an Fold instance

  • $name - The Identifier (type Ident) that should be resolved

The following three arguments can be repeated as often as necessary (like in a match block)

  • $declaration An identifier of an SymbolDeclaration variant which you wish to resolve $nameas

  • $id The identifier under which the ID of the resolved declaration will be available inside the associated `$block

  • $block A block ({statements}) which will be executed when $name is resolved as a SymbolDeclaration::$declaration

Examples

The following tries to resolve ident as a Nature

use OpenVAF::symbol_table::SymbolDeclaration::Net;
use OpenVAF::symbol_table::SymbolDeclaration::Port;

resolve_hierarchical!(fold; ident as
           Net(id) => {
                print!("Resolved net")
           }
           Port(id) => {
                print!("Resolved port")
           }
);

println!("Not found or not a port/net")