Table of Contents

Class VBBinaryOperatorExpressionNode

Namespace
RDCore.SDK.Model.AST.Expressions
Assembly
RDCore.SDK.dll

An infix VBOperatorExpression (bound) that accepts a left and a right operand on either of its sides.

public record VBBinaryOperatorExpressionNode : VBOperatorExpression, IEquatable<SyntaxNode>, IExecutableNode, IEquatable<ExpressionNode>, IEquatable<VBOperatorExpression>, IEquatable<VBBinaryOperatorExpressionNode>
Inheritance
VBBinaryOperatorExpressionNode
Implements
Inherited Members
Extension Methods

Remarks

Unless specified otherwise in a derived node type, MS-VBAL 5.6.9 Operator Expressions defines the static and run-time semantics of this node.

Constructors

VBBinaryOperatorExpressionNode(string, SyntaxNodeId, SourceLocation, ExpressionNode, ExpressionNode)

Deserialization path: Left/Right are what the JSON actually carries now (see SyntaxNodeJson) — Children is redundant with them and gets omitted on write, so it can't be relied on to arrive from the wire.

[JsonConstructor]
public VBBinaryOperatorExpressionNode(string token, SyntaxNodeId identity, SourceLocation location, ExpressionNode left, ExpressionNode right)

Parameters

token string
identity SyntaxNodeId
location SourceLocation
left ExpressionNode
right ExpressionNode

VBBinaryOperatorExpressionNode(string, SyntaxNodeId, SourceLocation, ImmutableArray<SyntaxNode>)

public VBBinaryOperatorExpressionNode(string token, SyntaxNodeId identity, SourceLocation location, ImmutableArray<SyntaxNode> children)

Parameters

token string

The operator token (e.g. +, And).

identity SyntaxNodeId

A unique identifier for this specific syntax node.

location SourceLocation

The Location (holds the document Uri and a Range) of the bound expression.

children ImmutableArray<SyntaxNode>

The left and right operands, in that order.

Exceptions

ArgumentException

children is not exactly two ExpressionNode operands: the grammar guarantees a binary operator has two, so this signals a parse-listener desync.

Properties

Left

The left-hand side operand: Children[0].

public ExpressionNode Left { get; }

Property Value

ExpressionNode

OperatorLocation

Where in the document the operator token is written: the + of a + b, where Location is the whole operation.

public SourceLocation? OperatorLocation { get; init; }

Property Value

SourceLocation?

Remarks

A diagnostic about the operator is located here, so that each operator of a chain (a + b + c, whose two operations begin at the same position) has a location of its own. A run-time error of the operation is located at the operation itself. null for an operation the code does not write (one a statement makes of its own operands) and for a node created without one.

Right

The right-hand side operand: Children[1].

public ExpressionNode Right { get; }

Property Value

ExpressionNode

Token

public string Token { get; }

Property Value

string

Methods

PrintMembers(StringBuilder)

protected override bool PrintMembers(StringBuilder builder)

Parameters

builder StringBuilder

Returns

bool