@Deprecated public class JLDel_c extends java.lang.Object implements JLDel, java.io.Serializable
JL_c
is the super class of JL node delegate objects.
It defines default implementations of the methods which implement compiler
passes, dispatching to the node to perform the actual work of the pass.
Language extensions may subclass JL_c
for individual node
classes or may reimplement all compiler passes in a new class implementing
the JL
interface.Constructor and Description |
---|
JLDel_c()
Deprecated.
Create an uninitialized delegate.
|
Modifier and Type | Method and Description |
---|---|
void |
addDecls(Context c)
Deprecated.
Add any declarations to the context that should be in scope when
visiting later sibling nodes.
|
Node |
buildTypes(TypeBuilder tb)
Deprecated.
Collects classes, methods, and fields from the AST rooted at this node
and constructs type objects for these.
|
NodeVisitor |
buildTypesEnter(TypeBuilder tb)
Deprecated.
Collects classes, methods, and fields from the AST rooted at this node
and constructs type objects for these.
|
Node |
checkConstants(ConstantChecker cc)
Deprecated.
Check if the node is a compile-time constant.
|
Type |
childExpectedType(Expr child,
AscriptionVisitor av)
Deprecated.
Get the expected type of a child expression of
this . |
JLDel |
copy()
Deprecated.
|
Node |
copy(ExtensionInfo extInfo)
Deprecated.
Produce a copy of this node using the given ExtensionInfo.
|
Node |
copy(NodeFactory nf)
Deprecated.
Produce a copy of this node using the given NodeFactory.
|
Node |
disambiguate(AmbiguityRemover ar)
Deprecated.
Remove any remaining ambiguities from the AST.
|
NodeVisitor |
disambiguateEnter(AmbiguityRemover ar)
Deprecated.
Remove any remaining ambiguities from the AST.
|
Node |
disambiguateOverride(Node parent,
AmbiguityRemover ar)
Deprecated.
Disambiguate the AST.
|
void |
dump(Lang lang,
java.io.OutputStream os)
Deprecated.
Dump the AST for debugging.
|
void |
dump(Lang lang,
java.io.Writer w)
Deprecated.
Dump the AST for debugging.
|
void |
dump(java.io.OutputStream os)
Deprecated.
|
void |
dump(java.io.Writer w)
Deprecated.
|
Context |
enterChildScope(Node child,
Context c)
Deprecated.
Push a new scope for visiting the child node
child . |
Context |
enterScope(Context c)
Deprecated.
Push a new scope upon entering this node, and add any declarations to the
context that should be in scope when visiting children of this node.
|
Node |
exceptionCheck(ExceptionChecker ec)
Deprecated.
Check that exceptions are properly propagated throughout the AST.
|
NodeVisitor |
exceptionCheckEnter(ExceptionChecker ec)
Deprecated.
Check that exceptions are properly propagated throughout the AST.
|
Node |
extRewrite(ExtensionRewriter rw)
Deprecated.
Rewrite the AST for the compilation in this language.
|
NodeVisitor |
extRewriteEnter(ExtensionRewriter rw)
Deprecated.
Rewrite the AST for the compilation in this language.
|
void |
init(Node n)
Deprecated.
Initialize the back pointer to the node.
|
NodeOps |
jl()
Deprecated.
The
NodeOps object we dispatch to, by default, the node
itself, but possibly another delegate. |
JLang |
lang()
Deprecated.
The language defined by this NodeOps implementation.
|
Node |
node()
Deprecated.
Pointer back to the node we are delegating for, possibly this.
|
void |
prettyPrint(CodeWriter w,
PrettyPrinter pp)
Deprecated.
Pretty-print the AST using the given
CodeWriter . |
void |
prettyPrint(Lang lang,
java.io.OutputStream os)
Deprecated.
Pretty-print the AST for debugging.
|
void |
prettyPrint(Lang lang,
java.io.Writer w)
Deprecated.
Pretty-print the AST for debugging.
|
void |
prettyPrint(java.io.OutputStream os)
Deprecated.
|
void |
prettyPrint(java.io.Writer w)
Deprecated.
|
java.util.List<Type> |
throwTypes(TypeSystem ts)
Deprecated.
List of Types of exceptions that might get thrown.
|
void |
translate(CodeWriter w,
Translator tr)
Deprecated.
Translate the AST using the given
CodeWriter . |
Node |
typeCheck(TypeChecker tc)
Deprecated.
Type check the AST.
|
NodeVisitor |
typeCheckEnter(TypeChecker tc)
Deprecated.
Type check the AST.
|
Node |
typeCheckOverride(Node parent,
TypeChecker tc)
Deprecated.
Type check the AST.
|
<N extends Node> |
visitChild(N child,
NodeVisitor v)
Deprecated.
Visit a single child of the node.
|
Node |
visitChildren(NodeVisitor v)
Deprecated.
Visit the children of the node.
|
<N extends Node> |
visitList(java.util.List<N> l,
NodeVisitor v)
Deprecated.
Visit all the elements of a list.
|
public static final JLDel instance
public JLDel_c()
public NodeOps jl()
NodeOps
object we dispatch to, by default, the node
itself, but possibly another delegate.public void init(Node n)
JLDel
public Node node()
JLDel
public final JLang lang()
NodeOps
public <N extends Node> N visitChild(N child, NodeVisitor v)
NodeOps
visitChild
in interface NodeOps
child
- The child to visit.v
- The visitor which will traverse/rewrite the AST.child.visit(v)
, or null
if child
was null
.public <N extends Node> java.util.List<N> visitList(java.util.List<N> l, NodeVisitor v)
NodeOps
public Node visitChildren(NodeVisitor v)
NodeOps
visitChildren
in interface NodeOps
v
- The visitor that will traverse/rewrite the AST.this
.public Context enterScope(Context c)
NodeOps
addDecls
when leaving the node
for that.enterScope
in interface NodeOps
c
- the current Context
Context
to be used for visiting this node.public Context enterChildScope(Node child, Context c)
NodeOps
child
.
The default behavior is to delegate the call to the child node, and let
it add appropriate declarations that should be in scope. However,
this method gives parent nodes have the ability to modify this behavior.enterChildScope
in interface NodeOps
child
- the child node about to be entered.c
- the current Context
Context
to be used for visiting node
child
public void addDecls(Context c)
NodeOps
public NodeVisitor buildTypesEnter(TypeBuilder tb) throws SemanticException
NodeOps
TypeSystem
.
This method is called by the enter()
method of the
visitor. The * method should perform work that should be done
before visiting the children of the node. The method may return
this
or a new copy of the node on which
visitChildren()
and leave()
will be
invoked.buildTypesEnter
in interface NodeOps
tb
- The visitor which adds new type objects to the
TypeSystem
.SemanticException
public Node buildTypes(TypeBuilder tb) throws SemanticException
NodeOps
TypeSystem
.
This method is called by the leave()
method of the
visitor. The method should perform work that should be done
after visiting the children of the node. The method may return
this
or a new copy of the node which will be
installed as a child of the node's parent.buildTypes
in interface NodeOps
tb
- The visitor which adds new type objects to the
TypeSystem
.SemanticException
public Node disambiguateOverride(Node parent, AmbiguityRemover ar) throws SemanticException
NodeOps
override()
method of the
visitor. If this method returns non-null, the node's children
will not be visited automatically. Thus, the method should check
both the node this
and it's children, usually by
invoking visitChildren
with tc
or
with another visitor, returning a non-null node. OR, the method
should do nothing and simply return null
to allow
enter
, visitChildren
, and leave
to be invoked on the node.
The default implementation returns null
.
Overriding of this method is discouraged, but sometimes necessary.disambiguateOverride
in interface NodeOps
ar
- The visitor which disambiguates.SemanticException
public NodeVisitor disambiguateEnter(AmbiguityRemover ar) throws SemanticException
NodeOps
enter()
method of the
visitor. The * method should perform work that should be done
before visiting the children of the node. The method may return
this
or a new copy of the node on which
visitChildren()
and leave()
will be
invoked.disambiguateEnter
in interface NodeOps
ar
- The visitor which disambiguates.SemanticException
public Node disambiguate(AmbiguityRemover ar) throws SemanticException
NodeOps
leave()
method of the
visitor. The method should perform work that should be done
after visiting the children of the node. The method may return
this
or a new copy of the node which will be
installed as a child of the node's parent.
The node should not assume that its children have been disambiguated.
If it depends on a child being disambiguated,
it may just return this
without doing any work.disambiguate
in interface NodeOps
ar
- The visitor which disambiguates.SemanticException
public Node typeCheckOverride(Node parent, TypeChecker tc) throws SemanticException
NodeOps
override()
method of the
visitor. If this method returns non-null, the node's children
will not be visited automatically. Thus, the method should check
both the node this
and it's children, usually by
invoking visitChildren
with tc
or
with another visitor, returning a non-null node. OR, the method
should do nothing and simply return null
to allow
enter
, visitChildren
, and leave
to be invoked on the node.
The default implementation returns null
.
Overriding of this method is discouraged, but sometimes necessary.typeCheckOverride
in interface NodeOps
tc
- The type checking visitor.SemanticException
public NodeVisitor typeCheckEnter(TypeChecker tc) throws SemanticException
NodeOps
enter()
method of the
visitor. The * method should perform work that should be done
before visiting the children of the node. The method may return
this
or a new copy of the node on which
visitChildren()
and leave()
will be
invoked.typeCheckEnter
in interface NodeOps
tc
- The type checking visitor.SemanticException
public Node typeCheck(TypeChecker tc) throws SemanticException
NodeOps
leave()
method of the
visitor. The method should perform work that should be done
after visiting the children of the node. The method may return
this
or a new copy of the node which will be
installed as a child of the node's parent.typeCheck
in interface NodeOps
tc
- The type checking visitor.SemanticException
public Type childExpectedType(Expr child, AscriptionVisitor av)
NodeOps
this
.
The expected type is determined by the context in that the child occurs
(e.g., for x = e
, the expected type of e
is
the declared type of x
.
The expected type should impose the least constraints on the child's
type that are allowed by the parent node.childExpectedType
in interface NodeOps
child
- A child expression of this node.av
- An ascription visitor.child
.public Node checkConstants(ConstantChecker cc) throws SemanticException
NodeOps
leave()
method of the
visitor. The method should perform work that should be done
after visiting the children of the node. The method may return
this
or a new copy of the node which will be
installed as a child of the node's parent.checkConstants
in interface NodeOps
cc
- The constant checking visitor.SemanticException
public NodeVisitor exceptionCheckEnter(ExceptionChecker ec) throws SemanticException
NodeOps
enter()
method of the
visitor. The * method should perform work that should be done
before visiting the children of the node. The method may return
this
or a new copy of the node on which
visitChildren()
and leave()
will be
invoked.exceptionCheckEnter
in interface NodeOps
ec
- The visitor.SemanticException
public Node exceptionCheck(ExceptionChecker ec) throws SemanticException
NodeOps
leave()
method of the
visitor. The method should perform work that should be done
after visiting the children of the node. The method may return
this
or a new copy of the node which will be
installed as a child of the node's parent.exceptionCheck
in interface NodeOps
ec
- The visitor.SemanticException
public java.util.List<Type> throwTypes(TypeSystem ts)
NodeOps
throwTypes
in interface NodeOps
public NodeVisitor extRewriteEnter(ExtensionRewriter rw) throws SemanticException
NodeOps
enter()
method of the
visitor. The method should perform work that should be done
before visiting the children of the node. The method may return
this
or a new copy of the node on which
visitChildren()
and leave()
will be
invoked.extRewriteEnter
in interface NodeOps
rw
- The visitor.SemanticException
public Node extRewrite(ExtensionRewriter rw) throws SemanticException
NodeOps
leave()
method of the
visitor. The method should perform work that should be done
after visiting the children of the node. The method may return
this
or a new copy of the node which will be
installed as a child of the node's parent.extRewrite
in interface NodeOps
rw
- The visitor.SemanticException
@Deprecated public void dump(java.io.OutputStream os)
NodeOps
public void dump(Lang lang, java.io.OutputStream os)
NodeOps
@Deprecated public void dump(java.io.Writer w)
NodeOps
public void dump(Lang lang, java.io.Writer w)
NodeOps
@Deprecated public void prettyPrint(java.io.OutputStream os)
NodeOps
prettyPrint
in interface NodeOps
public void prettyPrint(Lang lang, java.io.OutputStream os)
NodeOps
prettyPrint
in interface NodeOps
@Deprecated public void prettyPrint(java.io.Writer w)
NodeOps
prettyPrint
in interface NodeOps
public void prettyPrint(Lang lang, java.io.Writer w)
NodeOps
prettyPrint
in interface NodeOps
public void prettyPrint(CodeWriter w, PrettyPrinter pp)
NodeOps
CodeWriter
.prettyPrint
in interface NodeOps
w
- The code writer to which to write.pp
- The pretty printer. This is not a visitor.public void translate(CodeWriter w, Translator tr)
NodeOps
CodeWriter
.public Node copy(NodeFactory nf)
NodeOps
public Node copy(ExtensionInfo extInfo) throws SemanticException
NodeOps
copy
in interface NodeOps
SemanticException
- If the type information cannot be copied.