slang::ast::Statement::StatementContext struct

Additional information passed along during statement creation.

Public functions

auto tryGetBlock(const ASTContext& context, const syntax::SyntaxNode& syntax) -> const Statement*
void observeTiming(const TimingControl& timing)
auto enterLoop(bool isForLoop = false) -> auto

Public variables

std::span<const StatementBlockSymbol*const > blocks
bitmask<StatementFlags> flags
Tracks various bits of context about where we are in statement creation.
SourceRange lastEventControl
const ASTContext& rootAstContext
The context used for creating statements.

Function documentation

const Statement* slang::ast::Statement::StatementContext::tryGetBlock(const ASTContext& context, const syntax::SyntaxNode& syntax)

Attempts to match up the head of the block list with the given statement syntax node. If they match, the block symbol is popped and returned wrapped inside a BlockStatement. Otherwise nullptr is returned.

void slang::ast::Statement::StatementContext::observeTiming(const TimingControl& timing)

Observes that the given timing control has been created and checks it for correctness given the current statement context.

auto slang::ast::Statement::StatementContext::enterLoop(bool isForLoop = false)

Records that we've entered a loop, and returns a guard that will revert back to the previous state on destruction.

Variable documentation

std::span<const StatementBlockSymbol*const > slang::ast::Statement::StatementContext::blocks

A series of block symbols that are expected to be used, in order, during the creation of the statement tree. Each statement created can pop blocks off the beginning of this list.

SourceRange slang::ast::Statement::StatementContext::lastEventControl

A source range indicating the last event control observed while creating statements. This is only updated in always_ff blocks.