Skip to content

declaration statement

Cameron Purdy edited this page Apr 4, 2020 · 4 revisions

A declaration statement is a statement that is used to define part of an Ecstasy type system. Generally speaking, this is how classes and types and their constituent members are declared and defined in Ecstasy. There are eight different specialized forms of a class: module, package, class, const, enum, service, mixin, and interface. Constituent members include classes, properties, constants, methods, functions, and type definitions (typedefs).

A declaration statement always acts as a structural scope. A declaration statement occurring within a method body also acts as capturing scope.

Unlike other statements, a declaration statement is not required to be reachable. A declaration statement completes if and only if it is reachable.

    DeclarationStatement:
        ModuleDeclarationStatement
        PackageDeclarationStatement
        ClassDeclarationStatement
        ConstDeclarationStatement
        EnumDeclarationStatement
        ServiceDeclarationStatement
        MixinDeclarationStatement
        InterfaceDeclarationStatement
        TypedefDeclarationStatement
        PropertyDeclarationStatement
        MethodDeclarationStatement