Table of Contents

Class ExpressionFact

Namespace
RDCore.SDK.Semantics
Assembly
RDCore.SDK.dll

What the static pass found out about one expression.

public sealed record ExpressionFact : IEquatable<ExpressionFact>
Inheritance
ExpressionFact
Implements
Inherited Members

Remarks

A fact is a description of the expression, not an opinion of it: whether a late-bound member, a name written in the wrong case or a constant condition is worth a diagnostic is for an analyzer to say.

Constructors

ExpressionFact(SyntaxNodeId, SourceLocation, VBType?, ExpressionClassification, SemanticId?, ValueExpressionSemanticFlags, VBCompileErrorInfo?)

What the static pass found out about one expression.

public ExpressionFact(SyntaxNodeId Node, SourceLocation Location, VBType? DeclaredType, ExpressionClassification Classification, SemanticId? Binding, ValueExpressionSemanticFlags Flags, VBCompileErrorInfo? Error = null)

Parameters

Node SyntaxNodeId

The expression the fact describes.

Location SourceLocation

Where the expression is written.

DeclaredType VBType

The declared type of the expression (RD-VBAL §5.0.1), or null when it is an error.

Classification ExpressionClassification

What the expression names.

Binding SemanticId?

The symbol the expression refers to, when it refers to one that resolved.

Flags ValueExpressionSemanticFlags

What else is the case of it.

Error VBCompileErrorInfo

The compile error of the expression itself or of the first of its operands that has one, when it has.

Remarks

A fact is a description of the expression, not an opinion of it: whether a late-bound member, a name written in the wrong case or a constant condition is worth a diagnostic is for an analyzer to say.

Properties

Accessors

The accessors of the property the expression names (MS-VBAL §5.3.1.7): those its module declares under the name, or, for a member of an object, those its class declares. None for an expression that names no property.

public PropertyAccessors Accessors { get; init; }

Property Value

PropertyAccessors

Binding

The symbol the expression refers to, when it refers to one that resolved.

public SemanticId? Binding { get; init; }

Property Value

SemanticId?

Classification

What the expression names.

public ExpressionClassification Classification { get; init; }

Property Value

ExpressionClassification

ConstantValue

The constant binding of the constant the expression names (MS-VBAL §5.2.3.2): the value of its constant expression, Let-coerced to its declared type. DEV is 1 with Const DEV = 1, and True with Const DEV As Boolean = 1. It is known where the constant expression is a literal, a negated literal, or the name of another constant whose binding is known. null for an expression that names no constant, and for a constant whose binding is not known.

public VBTypedValue? ConstantValue { get; init; }

Property Value

VBTypedValue

Creates

The class of the object the expression creates, when it is a CreateObject call given a constant programmatic identifier of a class that is described: a fact for tooling only, never a declaration (ObjectCreationFact). null otherwise.

public ObjectCreationFact? Creates { get; init; }

Property Value

ObjectCreationFact

DeclaredType

The declared type of the expression (RD-VBAL §5.0.1), or null when it is an error.

public VBType? DeclaredType { get; init; }

Property Value

VBType

DefaultMember

The default member of the class the expression's declared type is (DefaultMemberFact); null for an expression of any other type, and of a class that has no default member.

public DefaultMemberFact? DefaultMember { get; init; }

Property Value

DefaultMemberFact

Error

The compile error of the expression itself or of the first of its operands that has one, when it has.

public VBCompileErrorInfo? Error { get; init; }

Property Value

VBCompileErrorInfo

Flags

What else is the case of it.

public ValueExpressionSemanticFlags Flags { get; init; }

Property Value

ValueExpressionSemanticFlags

IsLetCoerced

Whether the expression's value is taken and Let-coerced to a declared type (MS-VBAL §5.5.1.1): it is an operand of an operator other than Is, the value of a Let assignment, or an argument given to a parameter declared with a value type. An object stands there for the value of its default member. An argument given to a parameter declared Variant is passed as it is, and a variable of a ByRef parameter's own type is passed by reference (MS-VBAL §5.3.1.11): neither is Let-coerced.

public bool IsLetCoerced { get; init; }

Property Value

bool

LetValueType

The declared type of the value parameter of the Property Let of the property the expression names: its last parameter, which a Let of the property gives the value. null for an expression that names no property with a Property Let.

public VBType? LetValueType { get; init; }

Property Value

VBType

Location

Where the expression is written.

public SourceLocation Location { get; init; }

Property Value

SourceLocation

NativeCall

For an expression bound to a procedure declared by a Declare statement (MS-VBAL §5.2.3.5), the platforms the expression is compiled on and those the procedure is declared on, in all and by each of its statements (CompiledOn, StatementsCompiledOn). An analyzer of the module the call is in needs both, and is given neither the module the procedure is declared in nor its #If blocks.

public NativeCallPlatforms? NativeCall { get; init; }

Property Value

NativeCallPlatforms?

Remarks

The host finds both as it finds CompiledOn: by evaluating the #If and #ElseIf conditions of each module once for each platform of Each, with that platform's predefined constants, not only under the constants of the session that analyzed the code. null for an expression bound to anything else, and where a condition either depends on cannot be evaluated.

Node

The expression the fact describes.

public SyntaxNodeId Node { get; init; }

Property Value

SyntaxNodeId