slang::Statement class

The base class for all statements in SystemVerilog.

Derived classes

class BlockStatement
Represents a sequential or parallel block statement.
class EmptyStatement
Represents an empty statement, used as a placeholder or an anchor for attributes.
class InvalidStatement
class StatementList
Represents a list of statements.

Public types

struct StatementContext
Additional information passed along during statement binding.
enum class EvalResult { Fail, Success, Return, Break, Continue, Disable }
Specifies possible results of evaluating a statement.

Public static functions

static auto bind(const StatementSyntax& syntax, const BindContext& context, StatementContext& stmtCtx, bool inList = false, bool labelHandled = false) -> const Statement&
Binds a statement tree from the given syntax nodes.

Public functions

auto bad() const -> bool
Indicates whether the statement is invalid.
auto eval(EvalContext& context) const -> EvalResult
Evaluates the statement under the given evaluation context.
auto verifyConstant(EvalContext& context) const -> bool

Public variables

StatementKind kind
The kind of statement; indicates the type of derived class.
const StatementSyntax* syntax
The syntax used to create this statement, if it was parsed from a source file.
SourceRange sourceRange
The source range of this statement, if it originated from source code.

Enum documentation

enum class slang::Statement::EvalResult

Specifies possible results of evaluating a statement.


Evaluation totally failed and we should give up on any further processing.


Evaluation succeeded.


A return statement was invoked; we should exit the current function.


A break statement was invoked; we should exit the current loop.


A continue statement was invoked; we should continue the current loop.


A disable statement was invoked; we should exit blocks until we find the target.

Function documentation

bool slang::Statement::verifyConstant(EvalContext& context) const

Verifies that this statement is valid in a constant function. If it's not, appropriate diagnostics will be issued.