1 package polyglot.ext.jl.ast; 2 3 import polyglot.ast.*; 4 5 import polyglot.util.*; 6 import polyglot.types.*; 7 import polyglot.visit.*; 8 9 13 public abstract class TypeNode_c extends Node_c implements TypeNode 14 { 15 protected Type type; 16 17 public TypeNode_c(Position pos) { 18 super(pos); 19 } 20 21 22 public Qualifier qualifier() { 23 return type(); 24 } 25 26 27 public Type type() { 28 return this.type; 29 } 30 31 32 public TypeNode type(Type type) { 33 TypeNode_c n = (TypeNode_c) copy(); 34 n.type = type; 35 return n; 36 } 37 38 public Node buildTypes(TypeBuilder tb) throws SemanticException { 39 if (type == null) { 40 TypeSystem ts = tb.typeSystem(); 41 return type(ts.unknownType(position())); 42 } 43 else { 44 return this; 45 } 46 } 47 48 public String toString() { 49 if (type != null) { 50 return type.toString(); 51 } 52 else { 53 return "<unknown type>"; 54 } 55 } 56 57 public abstract void prettyPrint(CodeWriter w, PrettyPrinter tr); 58 } 59 | Popular Tags |