Class ByValArgumentStaticSemantics
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
ByValparameter, of any procedure - the workspace's, a library's, aDeclare'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'sByRefparameter, or of anAs Anyone, it is valid and passes the value where an address goes; - before an argument of a
ByRefparameter of a procedure of the workspace or of a library (the type library declares everyVariantparameter by reference, TypeLibraryByRef), of aParamArray, or of a member called late-bound, it is Type mismatch; of aByRefarray 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
contextStaticEvaluationContextThe compile-time context the call is evaluated against.
calleeExpressionNodeWhat the statement calls.
argumentsImmutableArray<ExpressionNode>The arguments, as written.
calleeTypeVBTypeThe declared type of the callee.
Returns
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
contextStaticEvaluationContextThe compile-time context the call is evaluated against.
callIndexExpressionNodeThe call.
calleeTypeVBTypeThe declared type of the callee: an array's index takes no
ByVal.
Returns
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
contextStaticEvaluationContextThe compile-time context the call is evaluated against; nothing is recorded without its facts.
calleeExpressionNodeWhat the statement calls.
argumentsImmutableArray<ExpressionNode>The arguments, as written.
calleeTypeVBTypeThe 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
contextStaticEvaluationContextThe compile-time context the call is evaluated against; nothing is recorded without its facts.
callIndexExpressionNodeThe call, whose arguments have been evaluated.
calleeTypeVBTypeThe declared type of the callee.