slang::Statement::StatementContext struct

Additional information passed along during statement binding.

Contents

Public functions

auto tryGetBlock(Compilation& compilation, const SyntaxNode& syntax) -> BlockStatement*
auto enterLoop() -> auto

Public variables

span<const StatementBlockSymbol*const > blocks
bool inLoop

Function documentation

BlockStatement* slang::Statement::StatementContext::tryGetBlock(Compilation& compilation, const 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.

auto slang::Statement::StatementContext::enterLoop()

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

Variable documentation

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

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

bool slang::Statement::StatementContext::inLoop

Tracks whether we're currently within a loop (which can control, for example, whether a break or continue statement is allowed).