Class InitializeEnum
java.lang.Object
org.jfuncmachine.compiler.model.SourceElement
org.jfuncmachine.compiler.model.expr.Expression
org.jfuncmachine.compiler.model.expr.InitializeEnum
An expression that is the static initializer for an enum
-
Field Summary
FieldsModifier and TypeFieldDescriptionfinal StringThe name of the enum classfinal ClassField[]The class fields representing the enum valuesfinal EnumInitializer[]The initializers for each enum valueFields inherited from class org.jfuncmachine.compiler.model.SourceElement
filename, lineNumber -
Constructor Summary
ConstructorsConstructorDescriptionInitializeEnum(String enumClass, ClassField[] enumInstanceFields, EnumInitializer[] initializers) Create a static method invocationInitializeEnum(String enumClass, ClassField[] enumInstanceFields, EnumInitializer[] initializers, String filename, int lineNumber) Create a static method invocation -
Method Summary
Modifier and TypeMethodDescriptionconvertToFullTailCalls(boolean inTailPosition) Converts this expression to one that is compatible with full tail call optimizationvoidfindCaptured(Environment env) Search for local variables that would be captured by a lambda.voidgenerate(ClassGenerator generator, Environment env, boolean inTailPosition) Generate the bytecode for this expressiongetType()Get the type returned by this expressionvoidreset()Resets any labels in expressions so that the method can be regeneratedMethods inherited from class org.jfuncmachine.compiler.model.SourceElement
generateException
-
Field Details
-
enumClass
The name of the enum class -
enumInstanceFields
The class fields representing the enum values -
initializers
The initializers for each enum value
-
-
Constructor Details
-
InitializeEnum
public InitializeEnum(String enumClass, ClassField[] enumInstanceFields, EnumInitializer[] initializers) Create a static method invocation- Parameters:
enumClass- The class name of the enum being initializedenumInstanceFields- The non-static fields of the enum classinitializers- The initializers for each enum value
-
InitializeEnum
public InitializeEnum(String enumClass, ClassField[] enumInstanceFields, EnumInitializer[] initializers, String filename, int lineNumber) Create a static method invocation- Parameters:
enumClass- The class name of the enum being initializedenumInstanceFields- The non-static fields of the enum classinitializers- The initializers for each enum valuefilename- The source file where this initializer occurslineNumber- The line number in the source file where this initializer occurs
-
-
Method Details
-
getType
Description copied from class:ExpressionGet the type returned by this expression- Specified by:
getTypein classExpression- Returns:
- The type of this expression
-
reset
public void reset()Description copied from class:ExpressionResets any labels in expressions so that the method can be regenerated- Overrides:
resetin classExpression
-
findCaptured
Description copied from class:ExpressionSearch for local variables that would be captured by a lambda. Each expression has its own implementation of this, because each subexpression must be searched.- Specified by:
findCapturedin classExpression- Parameters:
env- The environment chain to search
-
convertToFullTailCalls
Description copied from class:ExpressionConverts this expression to one that is compatible with full tail call optimization- Specified by:
convertToFullTailCallsin classExpression- Parameters:
inTailPosition- True if this expression is called from the tail position- Returns:
- A version of this expression whose types are compatible with full tail call optimization
-
generate
Description copied from class:ExpressionGenerate the bytecode for this expression- Specified by:
generatein classExpression- Parameters:
generator- The generator for generating instructions and additional declarationsenv- The environment containing the local variables currently visible to this expressioninTailPosition- True if this expression is being generated from the tail position of the method
-