Record Class ConstrainedTypeShape
java.lang.Object
java.lang.Record
org.ek9lang.compiler.phase7.ConstrainedTypeShape
- Record Components:
constrainedType- the constrained type itself (DrivingAge); the wrapping constructors are called on itconstrainedTypeName- its IR namebaseType- the constraining (base) type (Integer). The delegation bodies call the BASE type's operators, so their call metadata is read off the base operator - never off the cloned operator on the constrained type, which describes a different (wrapper) bodybaseTypeName- its IR nameconstraint- the declaredconstrain asexpression, or null when there is none. The check (a Panic on a breach) is emitted into every constructor and mutating operator
record ConstrainedTypeShape(AggregateSymbol constrainedType, String constrainedTypeName, IAggregateSymbol baseType, String baseTypeName, EK9Parser.ConstrainTypeContext constraint)
extends Record
THE description of the constrained type being generated, built once per type by
ConstrainedTypeDfnGenerator and read by its three parts (ConstraintLowering,
ConstrainedConstruction, ConstrainedDelegation) - never mutable per-type state on a generator.-
Constructor Summary
ConstructorsConstructorDescriptionConstrainedTypeShape(AggregateSymbol constrainedType, String constrainedTypeName, IAggregateSymbol baseType, String baseTypeName, EK9Parser.ConstrainTypeContext constraint) Creates an instance of aConstrainedTypeShaperecord class. -
Method Summary
Modifier and TypeMethodDescription(package private) booleanWhether the base type is an enumeration.baseType()Returns the value of thebaseTyperecord component.Returns the value of thebaseTypeNamerecord component.Returns the value of theconstrainedTyperecord component.Returns the value of theconstrainedTypeNamerecord component.Returns the value of theconstraintrecord component.final booleanIndicates whether some other object is "equal to" this one.(package private) booleanfinal inthashCode()Returns a hash code value for this object.final StringtoString()Returns a string representation of this record class.
-
Constructor Details
-
ConstrainedTypeShape
ConstrainedTypeShape(AggregateSymbol constrainedType, String constrainedTypeName, IAggregateSymbol baseType, String baseTypeName, EK9Parser.ConstrainTypeContext constraint) Creates an instance of aConstrainedTypeShaperecord class.- Parameters:
constrainedType- the value for theconstrainedTyperecord componentconstrainedTypeName- the value for theconstrainedTypeNamerecord componentbaseType- the value for thebaseTyperecord componentbaseTypeName- the value for thebaseTypeNamerecord componentconstraint- the value for theconstraintrecord component
-
-
Method Details
-
baseIsEnum
boolean baseIsEnum()Whether the base type is an enumeration. An enum's#^promotes to its String form (not to the base enum), so for an enum base#^is an ordinary delegation, whereas for every other base#^returns a copy of the base delegate; an enum base'siterator(),#<and#>range over the constrained SUBSET. -
hasConstraint
boolean hasConstraint() -
toString
-
hashCode
-
equals
Indicates whether some other object is "equal to" this one. The objects are equal if the other object is of the same class and if all the record components are equal. All components in this record class are compared withObjects::equals(Object,Object). -
constrainedType
Returns the value of theconstrainedTyperecord component.- Returns:
- the value of the
constrainedTyperecord component
-
constrainedTypeName
Returns the value of theconstrainedTypeNamerecord component.- Returns:
- the value of the
constrainedTypeNamerecord component
-
baseType
-
baseTypeName
Returns the value of thebaseTypeNamerecord component.- Returns:
- the value of the
baseTypeNamerecord component
-
constraint
Returns the value of theconstraintrecord component.- Returns:
- the value of the
constraintrecord component
-