1 package polyglot.visit; 2 3 import polyglot.ast.*; 4 import polyglot.types.*; 5 import polyglot.util.*; 6 import polyglot.frontend.Job; 7 import polyglot.types.Package; 8 9 10 public class TypeChecker extends ContextVisitor 11 { 12 public TypeChecker(Job job, TypeSystem ts, NodeFactory nf) { 13 super(job, ts, nf); 14 } 15 16 protected NodeVisitor enterCall(Node parent, Node n) throws SemanticException { 17 return n.del().typeCheckEnter(this); 18 } 19 20 protected Node leaveCall(Node old, Node n, NodeVisitor v) throws SemanticException { 21 Node m = n.del().typeCheck((TypeChecker) v); 22 23 if (m instanceof Expr && ((Expr) m).type() == null) { 24 throw new InternalCompilerError("Null type for " + m, m.position()); 25 } 26 27 return m; 28 } 29 } 30 | Popular Tags |