Package jminusminus
Class JExpression
java.lang.Object
jminusminus.JAST
jminusminus.JStatement
jminusminus.JExpression
- Direct Known Subclasses:
JArrayExpression
,JArrayInitializer
,JBinaryExpression
,JCastOp
,JConditionalExpression
,JFieldSelection
,JInstanceOfOp
,JLiteralBoolean
,JLiteralChar
,JLiteralDouble
,JLiteralInt
,JLiteralLong
,JLiteralNull
,JLiteralString
,JMessageExpression
,JNewArrayOp
,JNewOp
,JSuper
,JSuperConstruction
,JThis
,JThisConstruction
,JUnaryExpression
,JVariable
,JWildExpression
The AST node for an expression. The syntax says all expressions are statements, but a semantic check throws some
(those without a side effect) out. Every expression has a type and a flag indicating whether it's a
statement-expression or not.
-
Field Summary
FieldsModifier and TypeFieldDescriptionprotected boolean
Whether this expression is a statement or not.protected Type
Expression type.Fields inherited from class jminusminus.JAST
compilationUnit, line
-
Constructor Summary
ConstructorsModifierConstructorDescriptionprotected
JExpression
(int line) Constructs an AST node for an expression. -
Method Summary
Modifier and TypeMethodDescriptionabstract JExpression
Analyzes and returns a JExpression.void
Performs short-circuit code generation for a boolean expression, given the code emitter, a target label, and whether we branch to that label on true or on false.type()
Returns the expression type.Methods inherited from class jminusminus.JAST
codegen, line, partialCodegen, preAnalyze, toJSON, unescape
-
Field Details
-
type
Expression type. -
isStatementExpression
protected boolean isStatementExpressionWhether this expression is a statement or not.
-
-
Constructor Details
-
JExpression
protected JExpression(int line) Constructs an AST node for an expression.- Parameters:
line
- line in which the expression occurs in the source file.
-
-
Method Details
-
type
Returns the expression type.- Returns:
- the expression type.
-
analyze
Analyzes and returns a JExpression. -
codegen
Performs short-circuit code generation for a boolean expression, given the code emitter, a target label, and whether we branch to that label on true or on false.- Parameters:
output
- the code emitter.targetLabel
- the label to which we should branch.onTrue
- do we branch on true?
-