Class FunctionIsSetGenerator
java.lang.Object
org.ek9lang.compiler.phase7.synthesis.AbstractSyntheticGenerator
org.ek9lang.compiler.phase7.synthesis.FunctionIsSetGenerator
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:
- Aggregates (
IsSetGenerator) - which check if ANY field is set - Enumerations (
EnumIsSetGenerator) - which check the _isEnumSet field
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
-
Nested Class Summary
Nested classes/interfaces inherited from class AbstractSyntheticGenerator
AbstractSyntheticGenerator.ScopeSetup -
Field Summary
Fields inherited from class AbstractSyntheticGenerator
stackContext -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptiongenerate(MethodSymbol methodSymbol, FunctionSymbol functionSymbol) Generate the _isSet operator IR for the given function.Methods inherited from class AbstractSyntheticGenerator
aggregateHasOperator, createDebugInfo, createSynthesisScope, generateAnyFieldSetGuard, generateBinaryOperatorGuards, generateBooleanBranch, generateBooleanReturnBlock, generateConstructorCall, generateConstructorCall, generateConstructorCall, generateConstructorCallWithArgs, generateFieldLoad, generateFieldLoad, generateFieldSetStatusCheck, generateIsSetGuard, generateIsSetGuard, generateLabelName, generateMethodCall, generateMethodCall, generateMethodCall, generateMethodCall, generateMethodCall, generateMethodCall, generateMethodCall, generateMethodCallNoArg, generateResultReturnBlock, generateResultReturnBlock, generateStringLiteralLoad, generateTempName, generateThisIsSetGuard, generateThisIsSetGuard, generateUnsetReturnBlock, generateUnsetReturnBlockWithLabel, generateUnsetReturnBlockWithLabel, generateVoidMethodCall, getBitsTypeName, getBooleanTypeName, getIntegerTypeName, getReturnBlockHelper, getStringTypeName, getSuperTypeName, getSyntheticFields, getTypeName, getVoidTypeName, initializeScope, initializeScopeNoReturn, isAnyType, isTraitType, superHasOperator
-
Constructor Details
-
FunctionIsSetGenerator
-
-
Method Details
-
generate
Generate the _isSet operator IR for the given function.- Parameters:
methodSymbol- The _isSet method symbolfunctionSymbol- The function containing the method- Returns:
- List of IR instructions implementing the method
-