Table of Contents

Class ByValArgumentStaticSemantics

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

RD-VBAL §5.6.13.1: where an argument can be written ByVal, as MS-VBA compiles it (recorded in Excel), which is not where MS-VBAL §5.6.13.1 says - only before an argument of an external procedure.

public static class ByValArgumentStaticSemantics
Inheritance
ByValArgumentStaticSemantics
Inherited Members

Remarks

ByVal written before an argument says how the argument is passed, and MS-VBA takes it only where it is so passed already or where it means something:

  • before an argument of a ByVal parameter, of any procedure - the workspace's, a library's, a Declare's - it is valid and changes nothing (RedundantByVal): what is passed is what would be, an object as much as a value;
  • before an argument of a Declare's ByRef parameter, or of an As Any one, it is valid and passes the value where an address goes;
  • before an argument of a ByRef parameter of a procedure of the workspace or of a library (the type library declares every Variant parameter by reference, TypeLibraryByRef), of a ParamArray, or of a member called late-bound, it is Type mismatch; of a ByRef array parameter, Array argument must be ByRef;
  • before an argument of a function MS-VBA compiles inline (the reserved names, InStr, InStrB, StrComp), or before an index of an array, it is a Syntax error.

Methods

Error(StaticEvaluationContext, ExpressionNode, ImmutableArray<ExpressionNode>, VBType?)

The compile error of the first argument of a call written as a statement, without parentheses (Work ByVal x), that is written ByVal where MS-VBA refuses it, or null.

public static VBCompileErrorInfo? Error(StaticEvaluationContext context, ExpressionNode callee, ImmutableArray<ExpressionNode> arguments, VBType? calleeType)

Parameters

context StaticEvaluationContext

The compile-time context the call is evaluated against.

callee ExpressionNode

What the statement calls.

arguments ImmutableArray<ExpressionNode>

The arguments, as written.

calleeType VBType

The declared type of the callee.

Returns

VBCompileErrorInfo

Error(StaticEvaluationContext, IndexExpressionNode, VBType?)

The compile error of the first argument of a call that is written ByVal where MS-VBA refuses it, or null.

public static VBCompileErrorInfo? Error(StaticEvaluationContext context, IndexExpressionNode call, VBType? calleeType)

Parameters

context StaticEvaluationContext

The compile-time context the call is evaluated against.

call IndexExpressionNode

The call.

calleeType VBType

The declared type of the callee: an array's index takes no ByVal.

Returns

VBCompileErrorInfo

MarkRedundant(StaticEvaluationContext, ExpressionNode, ImmutableArray<ExpressionNode>, VBType?)

Flags each argument of a call written as a statement, without parentheses, that is written ByVal for a parameter that is ByVal already (RedundantByVal).

public static void MarkRedundant(StaticEvaluationContext context, ExpressionNode callee, ImmutableArray<ExpressionNode> arguments, VBType? calleeType)

Parameters

context StaticEvaluationContext

The compile-time context the call is evaluated against; nothing is recorded without its facts.

callee ExpressionNode

What the statement calls.

arguments ImmutableArray<ExpressionNode>

The arguments, as written.

calleeType VBType

The declared type of the callee.

MarkRedundant(StaticEvaluationContext, IndexExpressionNode, VBType?)

Flags each argument of a call that is written ByVal for a parameter that is ByVal already (RedundantByVal): a fact of the ByVal argument, where it is written, for an analyzer to say.

public static void MarkRedundant(StaticEvaluationContext context, IndexExpressionNode call, VBType? calleeType)

Parameters

context StaticEvaluationContext

The compile-time context the call is evaluated against; nothing is recorded without its facts.

call IndexExpressionNode

The call, whose arguments have been evaluated.

calleeType VBType

The declared type of the callee.