Class UnaryPrecedenceOperatorStaticSemantics
MS-VBAL §5.6.6 Parenthesized Expressions (static semantics), for the parentheses around an operand of an operator: the
"__p()_op" precedence operator (RD-VBAL §5.6.6), which groups the operand.
public sealed record UnaryPrecedenceOperatorStaticSemantics : StaticSemantics, IStaticSemantics, IEquatable<StaticSemantics>, IEquatable<UnaryPrecedenceOperatorStaticSemantics>
- Inheritance
-
UnaryPrecedenceOperatorStaticSemantics
- Implements
- Inherited Members
Remarks
"The declared type of a parenthesized expression is that of the enclosed expression", and it "evaluates to the simple data value of its enclosed
expression": an object in parentheses is its default member's value, even as an operand of an operator that takes an object - (o) Is Nothing
tests what o's default member returns, and ((o)) reads it twice (MS-VBA, recorded in Excel). The operand is evaluated as a value
before this rule is asked for its declared type, which is that value's.
What sets the operator apart from the "__c()_op" let-coercion operator the same parentheses are anywhere else
(UnaryLetCoerceOperatorStaticSemantics) is where it is written, and so what it means to the code that reads it: these parentheses group;
the others make a value of what would otherwise be a variable.
Constructors
UnaryPrecedenceOperatorStaticSemantics()
MS-VBAL §5.6.6 Parenthesized Expressions (static semantics), for the parentheses around an operand of an operator: the
"__p()_op" precedence operator (RD-VBAL §5.6.6), which groups the operand.
public UnaryPrecedenceOperatorStaticSemantics()
Remarks
"The declared type of a parenthesized expression is that of the enclosed expression", and it "evaluates to the simple data value of its enclosed
expression": an object in parentheses is its default member's value, even as an operand of an operator that takes an object - (o) Is Nothing
tests what o's default member returns, and ((o)) reads it twice (MS-VBA, recorded in Excel). The operand is evaluated as a value
before this rule is asked for its declared type, which is that value's.
What sets the operator apart from the "__c()_op" let-coercion operator the same parentheses are anywhere else
(UnaryLetCoerceOperatorStaticSemantics) is where it is written, and so what it means to the code that reads it: these parentheses group;
the others make a value of what would otherwise be a variable.
Methods
DetermineDeclaredType(StaticEvaluationContext, ExpressionNode, params VBType[])
The declared type of the enclosed expression's value.
public override StaticSemanticsEvaluationResult DetermineDeclaredType(StaticEvaluationContext context, ExpressionNode expression, params VBType[] operandDeclaredTypes)
Parameters
contextStaticEvaluationContextThe compile-time context the expression is evaluated against.
expressionExpressionNodeThe parenthesized expression.
operandDeclaredTypesVBType[]The declared type of the enclosed expression's value.