Package jminusminus
Interface JLhs
- All Known Implementing Classes:
JArrayExpression,JFieldSelection,JVariable
interface JLhs
The type of any expression that can appear on the lhs of an assignment statement: JVariable,
JFieldSelection, and JArrayExpression.
-
Method Summary
Modifier and TypeMethodDescriptionanalyzeLhs(Context context) Analyzes the lhs of an assignment.voidcodegenDuplicateRvalue(CLEmitter output) Generates the code to duplicate the Rvalue that is on the stack because it is to be used in a surrounding expression, as in a[i] = x--.voidcodegenLoadLhsLvalue(CLEmitter output) Generates code to load onto the stack any part of the lhs that must be there, as in a[i] = x.voidcodegenLoadLhsRvalue(CLEmitter output) Generates code to load an Rvalue of the lhs, as in a += x.voidcodegenStore(CLEmitter output) Generates the code to do the actual assignment.
-
Method Details
-
analyzeLhs
Analyzes the lhs of an assignment. This is very much like the analyze() methods, but perhaps a little more selective here and there.- Parameters:
context- context in which names are resolved.- Returns:
- the analyzed (and possibly rewritten) AST subtree.
-
codegenLoadLhsLvalue
Generates code to load onto the stack any part of the lhs that must be there, as in a[i] = x.- Parameters:
output- the code emitter.
-
codegenLoadLhsRvalue
Generates code to load an Rvalue of the lhs, as in a += x.- Parameters:
output- the code emitter.
-
codegenDuplicateRvalue
Generates the code to duplicate the Rvalue that is on the stack because it is to be used in a surrounding expression, as in a[i] = x--.- Parameters:
output- the code emitter.
-
codegenStore
Generates the code to do the actual assignment.- Parameters:
output- the code emitter.
-