[−][src]Macro open_vaf::resolve
A macro that hides the boiler plate required for name resolution 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
-
$self
- reference to an ast fold (implementation of theFold
trait) -
$name
- The Identifier (typeIdent
) that should be resolved
The following three arguments can be repeated as often as necessary (like in a match block)
-
$declaration
An identifier of anSymbolDeclaration
variant which you wish to resolve$name
as -
$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 aSymbolDeclaration
::$declaration
Examples
The following tries to resolve ident as a Nature
use OpenVAF::symbol_table::SymbolDeclaration::Nature; use OpenVAF::symbol_table::SymbolDeclaration::Discipline; resolve!(fold; ident as Nature(id) => { println!("Resolved nature") } Discipline(id) => { println!("Resolved a discipline") } ); println!("Not found or not a discipline/nature")