1 package spoon.template; 2 3 import spoon.reflect.code.CtBlock; 4 import spoon.reflect.code.CtStatementList; 5 import spoon.reflect.declaration.CtClass; 6 import spoon.reflect.declaration.CtSimpleType; 7 8 18 public abstract class StatementListTemplateParameter implements 19 TemplateParameterList<Void > { 20 21 24 public StatementListTemplateParameter() { 25 } 26 27 @SuppressWarnings ("unchecked") 28 public CtStatementList<Void > getSubstitution(CtSimpleType<?> targetType) { 29 CtClass<?> c; 30 CtBlock<?> b; 31 c= targetType.getFactory().Template().get(this.getClass()); 32 if(c==null) { 33 c=targetType.getFactory().Class().get(this.getClass()); 34 } 35 CtStatementList<Void > l = targetType.getFactory().Core() 36 .createStatementList(); 37 if (this instanceof Template) { 38 b = Substitution.substitute(targetType, (Template) this, c 39 .getMethod("statements").getBody()); 40 } else { 41 b = targetType.getFactory().Core().clone(c.getMethod("statements") 42 .getBody()); 43 } 44 l.setStatements(b.getStatements()); 45 return l; 46 } 47 48 public Void S() { 49 return null; 50 } 51 52 55 public abstract void statements() throws Throwable ; 56 } 57 | Popular Tags |