class JMessageExpression extends JExpression
isStatementExpression, type
compilationUnit, line
Modifier | Constructor and Description |
---|---|
protected |
JMessageExpression(int line,
JExpression target,
AmbiguousName ambiguousPart,
String messageName,
ArrayList<JExpression> arguments)
Construct an AST node for a message expression having an ambiguous part.
|
protected |
JMessageExpression(int line,
JExpression target,
String messageName,
ArrayList<JExpression> arguments)
Construct an AST node for a message expression without an ambiguous part.
|
Modifier and Type | Method and Description |
---|---|
JExpression |
analyze(Context context)
Analysis of a message expression involves: (1) reclassifying any
ambiguous part, (2) analyzing and computing the types for the actual
arguments, (3) determining the type we are currently in (for checking
access), (4) analyzing the target and determining its type, (5) finding
the appropriate Method, (6) checking accessibility, and (7) determining
the result type.
|
void |
codegen(CLEmitter output)
Code generation for a message expression involves generating code for
loading the target onto the stack, generating code to load the actual
arguments onto the stack, and then invoking the named Method.
|
void |
codegen(CLEmitter output,
String targetLabel,
boolean onTrue)
The semantics of j-- require that we implement short-circuiting branching
in implementing message expressions.
|
void |
writeToStdOut(PrettyPrinter p)
Write the information pertaining to this AST to STDOUT.
|
isStatementExpression, type
line, partialCodegen
protected JMessageExpression(int line, JExpression target, String messageName, ArrayList<JExpression> arguments)
line
- line in which the expression occurs in the source file.target
- the target expression.messageName
- the message name.arguments
- the ambiguousPart arguments.protected JMessageExpression(int line, JExpression target, AmbiguousName ambiguousPart, String messageName, ArrayList<JExpression> arguments)
line
- line in which the expression occurs in the source file.target
- the target expression.ambiguousPart
- the ambiguous part.messageName
- the message name.arguments
- the arguments.public JExpression analyze(Context context)
analyze
in class JExpression
context
- context in which names are resolved.public void codegen(CLEmitter output)
public void codegen(CLEmitter output, String targetLabel, boolean onTrue)
codegen
in class JExpression
output
- the code emitter (basically an abstraction for producing the
.class file).targetLabel
- the label to which we should branch.onTrue
- do we branch on true?public void writeToStdOut(PrettyPrinter p)
JAST
writeToStdOut
in class JAST
p
- for pretty printing with indentation.