Class Expression
java.lang.Object
org.jfuncmachine.compiler.model.SourceElement
org.jfuncmachine.compiler.model.expr.Expression
- Direct Known Subclasses:
ArrayGet,ArraySet,Binding,BindingRecurse,Block,BooleanConstant,Box,ByteConstant,CallJavaConstructor,CallJavaInterface,CallJavaMethod,CallJavaSpecialMethod,CallJavaStaticMethod,CallJavaSuperConstructor,CallMethod,CallStaticMethod,CallTailCallMethod,CallTailCallStaticMethod,Cast,CharConstant,ClassConstant,DoubleConstant,EnumSwitch,FloatConstant,GetJavaField,GetJavaStaticField,GetValue,If,InitializeEnum,InlineCall,IntConstant,IntSwitch,Invoke,Lambda,LocalRecurse,LongConstant,NewArray,NewArrayWithValues,Noop,NullConstant,ObjectConstant,PartialCall,SetJavaField,SetJavaStaticField,SetValue,ShortConstant,StringConstant,Throw,ToByte,ToChar,ToDouble,ToFloat,ToInt,ToLong,ToShort,ToUnit,TryCatchFinally,TypeSwitch,Unbox
Base class for all JFuncMachine expressions
-
Field Summary
Fields inherited from class org.jfuncmachine.compiler.model.SourceElement
filename, lineNumber -
Constructor Summary
ConstructorsConstructorDescriptionExpression(String filename, int lineNumber) Create an expression associated with a specific filename and line number -
Method Summary
Modifier and TypeMethodDescriptionabstract ExpressionconvertToFullTailCalls(boolean inTailPosition) Converts this expression to one that is compatible with full tail call optimizationabstract voidfindCaptured(Environment env) Search for local variables that would be captured by a lambda.abstract voidgenerate(ClassGenerator generator, Environment env, boolean inTailPosition) Generate the bytecode for this expressionabstract TypegetType()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
-
Constructor Details
-
Expression
Create an expression associated with a specific filename and line number- Parameters:
filename- The source filename this expression occurs in, or nulllineNumber- The line number this expression occurs on
-
-
Method Details
-
getType
Get the type returned by this expression- Returns:
- The type of this expression
-
findCaptured
Search for local variables that would be captured by a lambda. Each expression has its own implementation of this, because each subexpression must be searched.- Parameters:
env- The environment chain to search
-
reset
public void reset()Resets any labels in expressions so that the method can be regenerated -
convertToFullTailCalls
Converts this expression to one that is compatible with full tail call optimization- 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
Generate the bytecode for this expression- 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
-