Optional
options: Partial<ClassKindOptions>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:
the details
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!
the details of the class
the identifier based on the class name
Protected
collectOptional
options: Partial<ClassKindOptions>For the use case, that a new type needs to be created in Typir, e.g. for a class declaration. This function ensures, that the same type is created only once, even if this function is called multiple times, if e.g. the same type might be created for different type declaration. Nevertheless, usually a validation should produce an error in this case.
all information needed to create a new class
an initializer which creates and returns the new class type, when all depending types are resolved
For the use case, that a type is used/referenced, e.g. to specify the type of a variable declaration.
all information needed to identify the class
a reference to the class type, which might be resolved in the future, if the class type does not yet exist
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.