Class NullConstant
java.lang.Object
org.jfuncmachine.compiler.model.SourceElement
org.jfuncmachine.compiler.model.expr.Expression
org.jfuncmachine.compiler.model.expr.constants.NullConstant
A null constant value.
The expression can have an optional object type, because null can represent
any object type, and if this expression type is needed to derive the type
of some parent expression, the type may need to be explicitly specified.
-
Field Summary
FieldsModifier and TypeFieldDescriptionfinal ObjectTypeThe type of the null, which may be needed to determine expression typesFields inherited from class org.jfuncmachine.compiler.model.SourceElement
filename, lineNumber -
Constructor Summary
ConstructorsConstructorDescriptionCreate a null constant with a type of java.lang.ObjectNullConstant(String filename, int lineNumber) Create a null constant with a type of java.lang.ObjectNullConstant(ObjectType type) Create a null constant with a specific typeNullConstant(ObjectType type, String filename, int lineNumber) Create a null constant with a specific type -
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 gen, Environment env, boolean inTailPosition) Generate the bytecode for this expressiongetType()Get the type returned by this expressionMethods inherited from class org.jfuncmachine.compiler.model.expr.Expression
resetMethods inherited from class org.jfuncmachine.compiler.model.SourceElement
generateException
-
Field Details
-
type
The type of the null, which may be needed to determine expression types
-
-
Constructor Details
-
NullConstant
public NullConstant()Create a null constant with a type of java.lang.Object -
NullConstant
Create a null constant with a specific type- Parameters:
type- The type of this expression
-
NullConstant
Create a null constant with a type of java.lang.Object- Parameters:
filename- The source filename this expression is associated withlineNumber- The source line number this expression is associated with
-
NullConstant
Create a null constant with a specific type- Parameters:
type- The type of this expressionfilename- The source filename this expression is associated withlineNumber- The source line number this expression is associated with
-
-
Method Details
-
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
-
getType
Description copied from class:ExpressionGet the type returned by this expression- Specified by:
getTypein classExpression- Returns:
- The type of this expression
-
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:
gen- 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
-