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!");
childrenshared formal <Import|Declaration|ModuleDescriptor|PackageDescriptor>[] children

The child nodes of this node.

declarationsshared formal Declaration[] declarations

The declarations in this compilation unit.

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

importsshared formal Import[] imports

The imports of this compilation unit.

moduleDescriptorshared formal ModuleDescriptor? moduleDescriptor

The module descriptor in this compilation unit.

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

packageDescriptorshared formal PackageDescriptor? packageDescriptor

The package descriptor in this compilation unit.

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

Inherited Attributes
Attributes inherited from: Node
Attributes inherited from: Object
hash, string
Inherited Methods
Methods inherited from: Node
Methods inherited from: Object