Class EnumIsSetGenerator

java.lang.Object
org.ek9lang.compiler.phase7.synthesis.AbstractSyntheticGenerator
org.ek9lang.compiler.phase7.synthesis.EnumIsSetGenerator

final class EnumIsSetGenerator extends AbstractSyntheticGenerator
Generates synthetic IR for the enum _isSet (?) operator.

An enum is "set" when its _isEnumSet boolean field is true. This field is a Java primitive boolean that defaults to false (unset) and is set to true when a valid enum value is assigned.

Using a primitive boolean eliminates the NPE risk when _isSet() is called on an unset enum - previously calling _ordinal._isSet() on a null _ordinal caused NPE.

Boolean _isSet():
  isSetValue = LOAD_FIELD this._isEnumSet (boolean primitive)
  result = CALL Boolean._of(isSetValue)
  return result