Table of Contents

5.6.8 New Expressions

Note

This section describes the implementation of MS-VBAL §5.6.8 New Expressions.

Syntax

Expression AST node
New <class> NewExpressionNode

See RD-VBAL §3.0.2 Node Types.

Static Semantics

The operand of a NewExpressionNode binds under the type binding context, through ISymbolResolver.ResolveType. See RD-VBAL §3.0.3 Binding Contexts and RD-VBAL §2.3.1.3 Name Resolution.

The positional qualified-type-name rule holds wherever a type name appears: an As clause, an As New clause, and the operand of New. In New A.B, the qualifier A is bound as a namespace (ISymbolResolver.ResolveQualifier), and the last part B in the type binding context. See RD-VBAL §3.0.3 Binding Contexts.

Whether a class named by New is creatable is not a name-lookup concern. It is checked once the name is bound.

A class whose VB_Creatable is False (the default instancing mode, Private, and Public Not Creatable) can only be created by the modules of the project that defines it (MS-VBAL §5.2.4.1.1): New of one is a type mismatch from any other project, and valid within its own.


⏮️ RD-VBAL §5.6.7 TypeOf...Is Expressions | ⏭️ RD-VBAL §5.6.9 Operator Expressions