slang::ast::OpInfo class

Various utility methods for dealing with operators.

Public static functions

static bool isBitwise(BinaryOperator op)
Determines if the given binary operator is a bitwise operator.
static bool isComparison(BinaryOperator op)
Determines if the given binary operator is a comparison operator.
static bool isShift(BinaryOperator op)
Determines if the given binary operator is a shift operator.
static bool isArithmetic(BinaryOperator op)
Determines if the given binary operator is an arithmetic operator.
static bool isRelational(BinaryOperator op)
Determines if the given binary operator is a relational operator.
static bool isLValue(UnaryOperator op)
Determines if the given unary operator acts as an lvalue.
static bool isShortCircuit(BinaryOperator op)
Determines if the given binary operator is a short-circuiting operator.
static std::string_view getText(BinaryOperator op)
Gets the string representation of the given binary operator.
static int getPrecedence(BinaryOperator op)
Gets the precedence of the given binary operator.
static UnaryOperator getUnary(syntax::SyntaxKind kind)
Gets the UnaryOperator represented by the given syntax kind.
static BinaryOperator getBinary(syntax::SyntaxKind kind)
Gets the BinaryOperator represented by the given syntax kind.
static const Type* binaryType(Compilation& compilation, const Type* lt, const Type* rt, bool forceFourState, bool signednessFromRt = false)
Determines the resulting type of a binary operation between two types.
static ConstantValue eval(BinaryOperator op, const ConstantValue& cvl, const ConstantValue& cvr)
Evaluates the given binary operator on the two constant values.

Function documentation

static std::string_view slang::ast::OpInfo::getText(BinaryOperator op)

Gets the string representation of the given binary operator.

For example, BinaryOperator::Add returns "+".