slang::Pattern class

Base class for "patterns", as used in pattern matching conditional statements and expressions.

Public functions

auto bad() const -> bool
Returns true if the pattern had an error and is therefore invalid.
auto eval(EvalContext& context, const ConstantValue& value, CaseStatementCondition conditionKind) const -> ConstantValue

Public variables

PatternKind kind
The kind of pattern represented by this instance.
const SyntaxNode* syntax
The syntax node used to create the pattern, if it came from source code.
SourceRange sourceRange
The source range where this pattern occurs, if it came from source code.

Function documentation

ConstantValue slang::Pattern::eval(EvalContext& context, const ConstantValue& value, CaseStatementCondition conditionKind) const

Evaluates the pattern under the given evaluation context. Any errors that occur will be stored in the evaluation context instead of issued to the compilation.