Class ExpressionEquivalence
- Namespace
- RDCore.SDK.Model.AST.Expressions
- Assembly
- RDCore.SDK.dll
Whether two expressions of the syntax tree are the same expression, written in two places: the targets of the two assignments of
If c Then flags(i) = True Else flags(i) = False, or two call sites of one extracted method.
public static class ExpressionEquivalence
- Inheritance
-
ExpressionEquivalence
- Inherited Members
Remarks
Two expressions are the same when they are made of the same operations on the same operands, the way VBA reads them: names compare without regard to
case (A.B(1) and a.b( 1 )), and literals by their type and value (&HFF and 255). Where they are written, and the
blanks, comments and line continuations between their parts, are not part of what they are.
How a name is written is part of it: s$ is not s, and [A1] is not A1. Every pair of parentheses is an operation of its own
(MS-VBAL §5.6.6), so (x) is not x: as an argument it passes x by value, and it reads an object's default member.
A member accessed in a With block (.Enabled) is not the member of a named object (b.Enabled), even of the object the block is
on. An expression of a kind it does not compare (Write(ExpressionNode) writes none of them either) is the same as no other.
Methods
AreEquivalent(ExpressionNode?, ExpressionNode?)
Whether two expressions are the same expression.
public static bool AreEquivalent(ExpressionNode? left, ExpressionNode? right)
Parameters
leftExpressionNodeAn expression, or null.
rightExpressionNodeAnother expression, or null.