@Override public <T> void visitCtLocalVariable(final CtLocalVariable<T> localVariable) { CtLocalVariable<T> r = localVariable.clone(); r.setDefaultExpression(evaluate(localVariable.getDefaultExpression())); setResult(r); }
/** * Creates a local variable declaration. * * @param <T> * the local variable type * @param type * the reference to the type * @param name * the name of the variable * @param defaultExpression * the assigned default expression * @return a new local variable declaration */ public <T> CtLocalVariable<T> createLocalVariable(CtTypeReference<T> type, String name, CtExpression<T> defaultExpression) { return factory.Core().<T>createLocalVariable().<CtLocalVariable<T>>setSimpleName(name).<CtLocalVariable<T>>setType(type).setDefaultExpression(defaultExpression); }
public <T> void visitCtLocalVariable(final spoon.reflect.code.CtLocalVariable<T> localVariable) { spoon.reflect.code.CtLocalVariable<T> aCtLocalVariable = localVariable.getFactory().Core().createLocalVariable(); this.builder.copy(localVariable, aCtLocalVariable); aCtLocalVariable.setAnnotations(this.cloneHelper.clone(localVariable.getAnnotations())); aCtLocalVariable.setType(this.cloneHelper.clone(localVariable.getType())); aCtLocalVariable.setDefaultExpression(this.cloneHelper.clone(localVariable.getDefaultExpression())); aCtLocalVariable.setComments(this.cloneHelper.clone(localVariable.getComments())); this.cloneHelper.tailor(localVariable, aCtLocalVariable); this.other = aCtLocalVariable; }
public static <T> CtLocalVariable<T> newLocalVariable(Factory factory, Class<T> aClass, String variableName, CtExpression<T> defaultValue) { CtLocalVariable<T> variable = newLocalVariable(factory, aClass, variableName); variable.setDefaultExpression(defaultValue); return variable; }
/** * Creates a local variable declaration. * * @param <T> * the local variable type * @param type * the reference to the type * @param name * the name of the variable * @param defaultExpression * the assigned default expression * @return a new local variable declaration */ public <T> CtLocalVariable<T> createLocalVariable(CtTypeReference<T> type, String name, CtExpression<T> defaultExpression) { return factory.Core().<T>createLocalVariable().<CtLocalVariable<T>>setSimpleName(name).<CtLocalVariable<T>>setType(type).setDefaultExpression(defaultExpression); }
public <T> void visitCtLocalVariable(final CtLocalVariable<T> localVariable) { // if (localVariable.getParent(CtBlock.class)!=null) { // // List<CtVariableAccess> res = Query.getElements(localVariable // .getParent(CtBlock.class), new TypeFilter<CtVariableAccess>( // CtVariableAccess.class) { // @Override // public boolean matches(CtVariableAccess element) { // boolean ret = super.matches(element) // && element.getVariable().getSimpleName().equals( // localVariable.getSimpleName()); // return ret; // } // }); // if (res.size() != 0) CtLocalVariable<T> r = localVariable.getFactory().Core().clone(localVariable); r.setDefaultExpression(evaluate(r, localVariable.getDefaultExpression())); setResult(r); }