polyglot.visit
Class TypedTranslator

java.lang.Object
  extended by polyglot.visit.PrettyPrinter
      extended by polyglot.visit.Translator
          extended by polyglot.visit.TypedTranslator
All Implemented Interfaces:
java.lang.Cloneable, Copy

public class TypedTranslator
extends Translator

TypedTranslator extends Translator for type-directed code generation. The base Translator uses types only to generate more readable code. If an ambiguous or untyped AST node is encountered, code generation continues. In contrast, with TypedTranslator, encountering an ambiguous or untyped node is considered internal compiler error. TypedTranslator should be used when the output AST is expected to be (or required to be) type-checked before code generation.


Field Summary
 
Fields inherited from class polyglot.visit.Translator
context, job, nf, tf, ts
 
Fields inherited from class polyglot.visit.PrettyPrinter
appendSemicolon, printType
 
Constructor Summary
TypedTranslator(Job job, TypeSystem ts, NodeFactory nf, TargetFactory tf)
           
 
Method Summary
 void print(Node parent, Node child, CodeWriter w)
          Print an ast node using the given code writer.
 
Methods inherited from class polyglot.visit.Translator
context, context, copy, exports, job, nodeFactory, toString, translate, translateSource, translateTopLevelDecl, typeSystem, writeHeader
 
Methods inherited from class polyglot.visit.PrettyPrinter
appendSemicolon, appendSemicolon, printAst, printType, printType
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

TypedTranslator

public TypedTranslator(Job job,
                       TypeSystem ts,
                       NodeFactory nf,
                       TargetFactory tf)
Method Detail

print

public void print(Node parent,
                  Node child,
                  CodeWriter w)
Description copied from class: Translator
Print an ast node using the given code writer. This method should not be called directly to translate a source file AST; use translate(Node) instead. This method should only be called by nodes to print their children.

Overrides:
print in class Translator