Table of Contents

5.6.15 With Expressions

Note

This section describes the implementation of MS-VBAL §5.6.15 With Expressions.

A with-expression is a .Member or !member expression inside a With block. It refers to the target of the innermost enclosing With statement. See RD-VBAL §5.4.2.21 With Statement.

Static Semantics

At compile time, the declared type of the innermost enclosing With block's target is carried by StaticEvaluationContext.EnclosingWithTargetType. See RD-VBAL §5.0 Semantics.

Runtime Semantics

For a .Member or !member with-expression, the EnclosingWithTarget resolution of RuntimeExpressionEvaluator yields the target stored by the innermost enclosing With statement.

With-expression target resolution does not depend on how control reached the instruction; it holds when control arrives through GoTo:

  1. The With statement stores its evaluated target on the activation (RD-VBAL §5.4.2.21 With Statement).
  2. Every Simple and ConditionalBranch instruction's RuntimeEvaluationContext is recomputed before each dispatch, from Instruction.EnclosingWith, which is a purely lexical property of the instruction (RD-VBAL §3.5.4 Execution).
  3. The with-expression resolves against RuntimeEvaluationContext.EnclosingWithTarget.

⏮️ RD-VBAL §5.6.14 Dictionary Access Expressions | ⏭️ RD-VBAL §5.6.16 Constrained Expressions