Classes have a name and have an arbitrary number of fields, consisting of a name and a type, and an arbitrary number of super-classes. Fields have exactly one type and no multiplicity (which can be realized with a type of kind 'MultiplicityKind'). Fields have exactly one name which must be unique for the current class (TODO what about same field names in extended class?). The field name is used to identify fields of classes. The order of fields is not defined, i.e. there is no order of fields.

Implements

Constructors

Properties

$name: "ClassKind"
options: Readonly<ClassKindOptions>
services: TypirServices

Methods

  • This method calculates the identifier of a class with the given details. Depending on structural or nominal typing of classes, the fields and methods or the name of the class will be used to compose the resulting identifier. If some types for the properties of the class are missing, an exception will be thrown.

    Design decisions:

    • This method is part of the ClassKind and not part of ClassType, since the ClassKind requires it for 'getClassType'!
    • The kind might use/add additional prefixes for the identifiers to prevent collisions with types of other kinds, which might occur in some applications.

    Type Parameters

    • T

    Parameters

    Returns string

    the new identifier

  • Calculates an identifier for classes which takes only the name of the class into account, regardless of whether the class is structurally or nominally typed. For structurally typed classes, this identifier might be used as well, since these names are usually used for reference in the DSL/AST!

    Type Parameters

    • T

    Parameters

    Returns string

    the identifier based on the class name