Class NameClassificationStaticSemantics
What a name is classified as when it is no value (MS-VBAL §5.6.10, §5.6.12): a project, a procedural module, an
enumeration. Each qualifies the names of what it declares (VBA.Len, Strings.Left, Color.Red), and none is a value, a variable or a
procedure by itself.
public static class NameClassificationStaticSemantics
- Inheritance
-
NameClassificationStaticSemantics
- Inherited Members
Remarks
MS-VBA's error is the classification, wherever such a name is written as an expression (Excel-verified, oracle\s29): an argument, an assignment, the
target of a Let or a Set, the operand of Not or of a negation, a condition, a statement by itself. A few places report it as what
they require instead: the operand of a binary operator, and the value a Set assigns, are a type mismatch; what Len and LenB measure
is a variable; what a With block is about, and what a For Each loop iterates, have their own errors. Those places recognize the error with
IsNotAValue(ExpressionNode, VBCompileErrorInfo?).
Methods
EnumerationOf(StaticEvaluationContext, ExpressionNode)
The enumeration an expression names - Color, or Globals.Color - classified by what the name resolves to, which the owner of a member
access is (Color.Red), and which no value is.
public static VBEnumType? EnumerationOf(StaticEvaluationContext context, ExpressionNode expression)
Parameters
contextStaticEvaluationContextThe compile-time context the expression is evaluated against.
expressionExpressionNodeThe expression.
Returns
- VBEnumType
The enumeration's type, or null when the expression names none.
IsNotAValue(ExpressionNode, VBCompileErrorInfo?)
Whether error is the error of expression being a name that is no value: the name itself, bare or qualified, and
not some expression it is part of.
public static bool IsNotAValue(ExpressionNode expression, VBCompileErrorInfo? error)
Parameters
expressionExpressionNodeThe expression the error is of.
errorVBCompileErrorInfoIts error, or null.
Returns
NameOf(ExpressionNode)
The name a simple name or a member access is written with: the member's, of a member access.
public static string NameOf(ExpressionNode name)
Parameters
nameExpressionNodeThe expression.
Returns
- string
The name, or an empty string for any other expression.
NotAValueError(Symbol, SourceLocation, string)
The error of a name that resolves to symbol, written where an expression is: null when the symbol is a value.
public static VBCompileErrorInfo? NotAValueError(Symbol symbol, SourceLocation location, string name)
Parameters
symbolSymbolWhat the name resolves to.
locationSourceLocationWhere the name is written.
namestringThe name as written.