1 package polyglot.ext.coffer.ast; 2 3 import polyglot.ast.*; 4 import polyglot.ext.jl.ast.*; 5 import polyglot.ext.coffer.types.*; 6 import polyglot.ext.coffer.extension.*; 7 import polyglot.types.Flags; 8 import polyglot.types.Package; 9 import polyglot.types.Type; 10 import polyglot.types.Qualifier; 11 import polyglot.util.*; 12 import java.util.*; 13 14 16 public class CofferNodeFactory_c extends NodeFactory_c implements CofferNodeFactory 17 { 18 public CofferNodeFactory_c() { 19 super(new CofferExtFactory_c()); 20 } 21 protected CofferNodeFactory_c(ExtFactory extFact) { 22 super(extFact); 23 } 24 25 public New TrackedNew(Position pos, Expr outer, KeyNode key, TypeNode objectType, List args, ClassBody body) { 26 return New(pos, outer, TrackedTypeNode(key.position(), key, objectType), args, body); 27 28 } 29 30 public Free Free(Position pos, Expr expr) { 31 Free n = new Free_c(pos, expr); 32 n = (Free)n.ext(((CofferExtFactory_c)extFactory()).extFree()); 33 return n; 34 } 35 36 public TrackedTypeNode TrackedTypeNode(Position pos, KeyNode key, TypeNode base) { 37 TrackedTypeNode n = new TrackedTypeNode_c(pos, key, base); 38 n = (TrackedTypeNode)n.ext(((CofferExtFactory_c)extFactory()).extTrackedTypeNode()); 39 return n; 40 } 41 42 public AmbKeySetNode AmbKeySetNode(Position pos, List keys) { 43 AmbKeySetNode n = new AmbKeySetNode_c(pos, keys); 44 n = (AmbKeySetNode)n.ext(((CofferExtFactory_c)extFactory()).extAmbKeySetNode()); 45 return n; 46 } 47 48 public CanonicalKeySetNode CanonicalKeySetNode(Position pos, KeySet keys) { 49 CanonicalKeySetNode n = new CanonicalKeySetNode_c(pos, keys); 50 n = (CanonicalKeySetNode)n.ext(((CofferExtFactory_c)extFactory()).extCanonicalKeySetNode()); 51 return n; 52 } 53 54 public KeyNode KeyNode(Position pos, Key key) { 55 KeyNode n = new KeyNode_c(pos, key); 56 n = (KeyNode)n.ext(((CofferExtFactory_c)extFactory()).extKeyNode()); 57 return n; 58 } 59 60 public ClassDecl ClassDecl(Position pos, Flags flags, String name, 61 TypeNode superClass, List interfaces, 62 ClassBody body) 63 { 64 return CofferClassDecl(pos, flags, name, null, 65 superClass, interfaces, body); 66 } 67 68 public CofferClassDecl CofferClassDecl(Position pos, Flags flags, 69 String name, KeyNode key, 70 TypeNode superClass, List interfaces, 71 ClassBody body) 72 { 73 CofferClassDecl n = new CofferClassDecl_c(pos, flags, name, key, 74 superClass, interfaces, body); 75 n = (CofferClassDecl)n.ext(extFactory().extClassDecl()); 76 return n; 77 } 78 79 public ThrowConstraintNode ThrowConstraintNode(Position pos, TypeNode tn, KeySetNode keys) { 80 ThrowConstraintNode n = new ThrowConstraintNode_c(pos, tn, keys); 81 n = (ThrowConstraintNode)n.ext(((CofferExtFactory_c)extFactory()).extThrowConstraintNode()); 82 return n; 83 } 84 85 public MethodDecl MethodDecl(Position pos, Flags flags, 86 TypeNode returnType, String name, 87 List argTypes, List excTypes, Block body) 88 { 89 List l = new LinkedList(); 90 91 for (Iterator i = excTypes.iterator(); i.hasNext(); ) { 92 TypeNode tn = (TypeNode) i.next(); 93 l.add(ThrowConstraintNode(tn.position(), tn, null)); 94 } 95 96 return CofferMethodDecl(pos, flags, returnType, name, argTypes, 97 null, null, l, body); 98 99 } 100 101 public ConstructorDecl ConstructorDecl(Position pos, Flags flags, 102 String name, List argTypes, 103 List excTypes, Block body) 104 { 105 List l = new LinkedList(); 106 107 for (Iterator i = excTypes.iterator(); i.hasNext(); ) { 108 TypeNode tn = (TypeNode) i.next(); 109 l.add(ThrowConstraintNode(tn.position(), tn, null)); 110 } 111 112 return CofferConstructorDecl(pos, flags, name, argTypes, 113 null, null, l, body); 114 } 115 116 public CofferMethodDecl CofferMethodDecl(Position pos, Flags flags, 117 TypeNode returnType, String name, 118 List argTypes, 119 KeySetNode entryKeys, 120 KeySetNode returnKeys, 121 List throwConstraints, 122 Block body) 123 { 124 CofferMethodDecl n = new CofferMethodDecl_c(pos, flags, returnType, name, argTypes, 125 entryKeys, returnKeys, throwConstraints, body); 126 n = (CofferMethodDecl)n.ext(extFactory().extMethodDecl()); 127 return n; 128 } 129 130 public CofferConstructorDecl CofferConstructorDecl(Position pos, 131 Flags flags, 132 String name, 133 List argTypes, 134 KeySetNode entryKeys, 135 KeySetNode returnKeys, 136 List throwConstraints, 137 Block body) 138 { 139 CofferConstructorDecl n = new CofferConstructorDecl_c(pos, flags, name, argTypes, 140 entryKeys, returnKeys, throwConstraints, body); 141 n = (CofferConstructorDecl)n.ext(extFactory().extConstructorDecl()); 142 return n; 143 } 144 145 public Assign Assign(Position pos, Expr left, Assign.Operator op, Expr right) { 146 return (Assign) super.Assign(pos, left, op, right).del(new AssignDel_c()); 147 } 148 149 } 150 | Popular Tags |