A compilation unit.

There are three kinds of compilation unit:

(Because it is the most commonly used, and also what most people associate with a “compilation unit”, the first kind is simply called CompilationUnit and this abstract class is called AnyCompilationUnit, rather than calling this CompilationUnit and using RegularCompilationUnit or CodeCompilationUnit for regular compilation units.)

Every compilation unit starts with a (possibly empty) list of imports.

Examples (separated by blank lines):

module tmp "1.0.0" {}

package tmp;

void run() {
    print("Hello, World!");
}
Initializer
AnyCompilationUnit()
Attributes
childrenSource Codeshared formal <Import|Declaration|ModuleDescriptor|PackageDescriptor>[] children

The child nodes of this node.

declarationsSource Codeshared formal Declaration[] declarations

The declarations in this compilation unit.

(This attribute is empty for non-regular compilation units.)

importsSource Codeshared formal Import[] imports

The imports of this compilation unit.

moduleDescriptorSource Codeshared formal ModuleDescriptor? moduleDescriptor

The module descriptor in this compilation unit.

(This attribute is null for non-module descriptor compilation units.)

packageDescriptorSource Codeshared formal PackageDescriptor? packageDescriptor

The package descriptor in this compilation unit.

(This attribute is null0for non-package descriptor compilation units.)

Inherited Attributes
Attributes inherited from: Node
Attributes inherited from: Object
Inherited Methods
Methods inherited from: Node
Methods inherited from: Object