Class EnumIteratorImplInstr
java.lang.Object
org.ek9lang.compiler.ir.instructions.IRInstr
org.ek9lang.compiler.ir.instructions.EnumIteratorImplInstr
- All Implemented Interfaces:
INode
High-level IR instruction for generating enum iterator implementation.
This instruction abstracts the creation of a concrete iterator class for enumerations. Instead of generating detailed IR instructions for List creation, element addition, etc., this instruction tells the backend to generate an efficient iterator implementation appropriate for the target.
The backend is responsible for:
- Generating public static fields for each enum value on the enum class
- Initializing them in the class initializer with correct _ordinal and _name
- Generating an anonymous iterator class extending the parameterized Iterator type
- Implementing hasNext(), next(), and _isSet() methods
- Returning an instance of this anonymous iterator
JVM backend generates an anonymous inner class with static field references. LLVM backend generates struct + functions + static data section.
-
Method Summary
Modifier and TypeMethodDescriptionstatic EnumIteratorImplInstrenumIteratorImpl(EnumIteratorImplDetails details) Create an enum iterator implementation instruction.Get the fully qualified enumeration type name.intGet the number of enum values.Get the enum values in declaration order.Get the fully qualified super type name (parameterized Iterator wrapper).toString()Methods inherited from class IRInstr
accept, addOperand, addOperands, equals, getDebugInfo, getEscapeMetaData, getOpcode, getOperands, getResult, hasEscapeMetaData, hashCode, hasResult, isControlFlow, isLabel, isMemoryManagement, isMethodCall, setEscapeMetaData
-
Method Details
-
enumIteratorImpl
Create an enum iterator implementation instruction.- Parameters:
details- The enum iterator implementation details
-
getEnumTypeName
Get the fully qualified enumeration type name. -
getSuperTypeName
Get the fully qualified super type name (parameterized Iterator wrapper). -
getEnumValues
-
getEnumValueCount
public int getEnumValueCount()Get the number of enum values. -
toString
-