polyglot.ext.pao.visit
Class PaoBoxer
java.lang.Object
polyglot.visit.NodeVisitor
polyglot.visit.HaltingVisitor
polyglot.visit.ErrorHandlingVisitor
polyglot.visit.ContextVisitor
polyglot.visit.AscriptionVisitor
polyglot.ext.pao.visit.PaoBoxer
- All Implemented Interfaces:
- java.lang.Cloneable, Copy
- public class PaoBoxer
- extends AscriptionVisitor
Visitor that inserts boxing and unboxing code into the AST.
Method Summary |
Expr |
ascribe(Expr e,
Type toType)
The ascribe() method is called for each expression
and is passed the type the expression is used at rather
than the type the type
checker assigns to it. |
Node |
leaveCall(Node old,
Node n,
NodeVisitor v)
Calls ascribe() with the expected type and expression
as appropriate. |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
PaoBoxer
public PaoBoxer(Job job,
TypeSystem ts,
NodeFactory nf)
ascribe
public Expr ascribe(Expr e,
Type toType)
- Description copied from class:
AscriptionVisitor
- The
ascribe()
method is called for each expression
and is passed the type the expression is used at rather
than the type the type
checker assigns to it.
For instance, with the following code:
Object o = new Integer(3);
ascribe()
will be called with expression
new Integer(3)
and type Object
.
- Overrides:
ascribe
in class AscriptionVisitor
- Parameters:
e
- The expression that is being visitedtoType
- The type that the parent node is expecting.
- Returns:
- The new translated Expr node, or if nothing has changed, just
e.
leaveCall
public Node leaveCall(Node old,
Node n,
NodeVisitor v)
throws SemanticException
- Description copied from class:
AscriptionVisitor
- Calls
ascribe() with the expected type and expression
as appropriate. Otherwise functionally the same as the
leaveCall
method in ErrorHandlingVisitor
.
- Overrides:
leaveCall
in class AscriptionVisitor
- Throws:
SemanticException