Class FunctionIsSetGenerator

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

public final class FunctionIsSetGenerator extends AbstractSyntheticGenerator
Generates synthetic IR for the function _isSet (?) operator.

Functions are always "set" by nature - once a function exists, it is callable. There is no meaningful "unset" state for a function. This is in contrast to:

This implementation simply returns true via Boolean._ofTrue().

This is required for functions to work properly in collections (List, Dict, etc.) because the collection's canProcess/isValid checks call _isSet() on items. Without this, the default _isSet() from Any returns false, causing functions to be silently rejected when added to collections.

Boolean _isSet():
  result = CALL_STATIC Boolean._ofTrue()
  return result
  • Constructor Details

  • Method Details

    • generate

      public List<IRInstr> generate(MethodSymbol methodSymbol, FunctionSymbol functionSymbol)
      Generate the _isSet operator IR for the given function.
      Parameters:
      methodSymbol - The _isSet method symbol
      functionSymbol - The function containing the method
      Returns:
      List of IR instructions implementing the method