File tree Expand file tree Collapse file tree 1 file changed +3
-11
lines changed
src/main/java/org/eclipse/xtend/java2xtend Expand file tree Collapse file tree 1 file changed +3
-11
lines changed Original file line number Diff line number Diff line change @@ -92,6 +92,9 @@ class ConvertingVisitor extends ASTVisitor {
9292 val location = node. locationInParent
9393 try {
9494 if (location instanceof ChildListPropertyDescriptor ) {
95+ // There's a convention in the AST classes:
96+ // For a ChildListPropertyDescriptor.id string value there's a
97+ // corresponding no-arg method for retrieving the list eg. MethodInvocation.arguments().
9598 val method = parent. class. getMethod(location. id)
9699 val list = method. invoke(parent) as List<Object >
97100 val index = list. indexOf(node)
@@ -100,17 +103,6 @@ class ConvertingVisitor extends ASTVisitor {
100103 }else {
101104 throw new IllegalArgumentException (node + " not found in " + list+ " (" + index+ " )" )
102105 }
103- // if (location instanceof ChildListPropertyDescriptor) {
104- // val rewrite = ASTRewrite::create(node.AST)
105- // val rw = rewrite.getListRewrite(parent, location as ChildListPropertyDescriptor)
106- // rw.replace(node, exp, null);
107- // // val parentCall = parent as MethodInvocation
108- // // val index = parentCall.arguments.indexOf(node)
109- // // if (index >= 0) {
110- // // parentCall.arguments.set(index, exp)
111- // // } else {
112- // // throw new RuntimeException("Unable to replace " + node + " in " + parent + " for " + exp)
113- // // }
114106 } else {
115107 parent. setStructuralProperty(location, exp)
116108 }
You can’t perform that action at this time.
0 commit comments