class JNewOp extends JExpression
isStatementExpression, type
compilationUnit, line
Constructor and Description |
---|
JNewOp(int line,
Type type,
ArrayList<JExpression> arguments)
Construct an AST node for a "new" expression.
|
Modifier and Type | Method and Description |
---|---|
JExpression |
analyze(Context context)
To analyze the new operation, we (1) resolve the type, (2) analyze its
arguments, (3) check accessibility of the type, (3) find the appropriate
Constructor.
|
void |
codegen(CLEmitter output)
Generating code for a new operation involves generating the NEW
instruction for creating the object on the stack, then gnerating the code
for the actual arguments, and then code for invoking the constructor (the
initialization method).
|
void |
writeToStdOut(PrettyPrinter p)
Write the information pertaining to this AST to STDOUT.
|
codegen, isStatementExpression, type
line, partialCodegen
public JNewOp(int line, Type type, ArrayList<JExpression> arguments)
line
- the line in which the "new" expression occurs in the source
file.type
- the type being constructed.arguments
- arguments to the constructor.public JExpression analyze(Context context)
analyze
in class JExpression
context
- context in which names are resolved.public void codegen(CLEmitter output)
public void writeToStdOut(PrettyPrinter p)
JAST
writeToStdOut
in class JAST
p
- for pretty printing with indentation.