Table of Contents

5.4.2.1 Call Statement

Note

This section describes the implementation of MS-VBAL §5.4.2.1 Call Statement.

Syntax

AST node Instruction kind(s) Notes
CallStatementNode Simple A Call statement or a bare call.

See RD-VBAL §3.4.2 Simple Statements and RD-VBAL §3.5.2 Instruction.

Runtime Semantics

A Call statement or a bare-call statement whose callee is a bare name (Foo, Foo(...), Call Foo(...)) invokes it through a callable binding (ICallableBindingFactory):

Callee Invoked through
A procedure of the workspace IProcedureInvoker
A member with an external target (a standard-library member) IExternalDispatcher (RD-VBAL §6.0 Standard Library)

The unparenthesized argument form of a bare-call statement (Foo 1, 2, p.Grow 2) and a callee reached through a member access (obj.Foo, Call obj.Foo(1)) are invoked the same way: a member of an object, of a module (Strings.LenB) or of a project (VBA.LenB) is a callee like any other (RD-VBAL §5.6.12).

A bare reference to a Sub, Function or Property Get invokes a procedure the same way (RD-VBAL §5.3.1.11 Procedure Invocation Argument Processing, RD-VBAL §5.6.10 Simple Name Expressions).

A callee's run-time error propagates like any other run-time error. The callee's error result (RuntimeSemanticsEvaluationResult) is converted back into an Error outcome by the caller's ExecuteCall.

Implementation

  • A Simple instruction is dispatched by its statement type through RDCore.Runtime.Semantics.Statements.IStatementRuntimeSemanticsProvider (RD-VBAL §3.5.4 Execution); ExecuteCall handles a CallStatementNode.
  • RDCore.Runtime.Execution.RuntimeProcedureInvoker is the IProcedureInvoker implementation.
  • RDCore.Runtime.Execution.RuntimeCallableBindingFactory is the ICallableBindingFactory implementation. A member that carries SymbolProperties.ExternalTarget is bound to the external dispatcher; any other member is bound to the procedure invoker.

⏮️ RD-VBAL §5.4.2 Control Statements | ⏭️ RD-VBAL §5.4.2.2 While Statement