class JArrayExpression extends JExpression implements JLhs
isStatementExpression, type
compilationUnit, line
Constructor and Description |
---|
JArrayExpression(int line,
JExpression theArray,
JExpression indexExpr)
Construct an AST node for an array indexing operation.
|
Modifier and Type | Method and Description |
---|---|
JExpression |
analyze(Context context)
Perform semantic analysis on an array indexing expression
such as A[i].
|
JExpression |
analyzeLhs(Context context)
Analyzing the array expression as an Lvalue is like
analyzing it for its Rvalue.
|
void |
codegen(CLEmitter output)
Perform code generation from the JArrayExpression using
the specified code emitter.
|
void |
codegenDuplicateRvalue(CLEmitter output)
Generate the code required for duplicating the Rvalue that
is on the stack becuase it is to be used in a surrounding
expression, as in a[i] = x =
|
void |
codegenLoadLhsLvalue(CLEmitter output)
Generate the code required for setting up an Lvalue, eg
for use in an assignment.
|
void |
codegenLoadLhsRvalue(CLEmitter output)
Generate the code required for loading an Rvalue for this
variable, eg for use in a +=.
|
void |
codegenStore(CLEmitter output)
Generate the code required for doing the actual
assignment.
|
void |
writeToStdOut(PrettyPrinter p)
Write the information pertaining to this AST to STDOUT.
|
codegen, isStatementExpression, type
line, partialCodegen
public JArrayExpression(int line, JExpression theArray, JExpression indexExpr)
line
- line in which the operation occurs in the
source file.theArray
- the array we're indexing.indexExpr
- the index expression.public JExpression analyze(Context context)
analyze
in class JExpression
context
- context in which names are resolved.public JExpression analyzeLhs(Context context)
analyzeLhs
in interface JLhs
context
- context in which names are resolved.public void codegen(CLEmitter output)
public void codegenLoadLhsLvalue(CLEmitter output)
codegenLoadLhsLvalue
in interface JLhs
output
- the code emitter (basically an abstraction
for producing the .class file).public void codegenLoadLhsRvalue(CLEmitter output)
codegenLoadLhsRvalue
in interface JLhs
output
- the code emitter (basically an abstraction
for producing the .class file).public void codegenDuplicateRvalue(CLEmitter output)
codegenDuplicateRvalue
in interface JLhs
output
- the code emitter (basically an abstraction
for producing the .class file).public void codegenStore(CLEmitter output)
codegenStore
in interface JLhs
output
- the code emitter (basically an abstraction
for producing the .class file).public void writeToStdOut(PrettyPrinter p)
JAST
writeToStdOut
in class JAST
p
- for pretty printing with indentation.