Skip to content

Commit

Permalink
[fix] Don't resolve name of anonymous class #86
Browse files Browse the repository at this point in the history
Not necessarily a complete solution, this might cause issues
  • Loading branch information
slarse committed Mar 27, 2020
1 parent bc97538 commit 755b27b
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion src/main/java/se/kth/spork/spoon/Spoon3dmMerge.java
Original file line number Diff line number Diff line change
Expand Up @@ -174,7 +174,13 @@ public RoledValues apply(SpoonNode wrapper) {
CtLiteral<?> lit = (CtLiteral<?>) elem;
rvs.add(CtRole.VALUE, lit.getValue());
} else if (elem instanceof CtReference || elem instanceof CtNamedElement) {
rvs.add(CtRole.NAME, elem.getValueByRole(CtRole.NAME));
String name = elem.getValueByRole(CtRole.NAME);
if (!name.matches("\\d+")) {
// Only pick up name if it's not a digit.
// A digit implies anonymous function, see https://github.com/kth/spork/issues/86 for why we don't
// want those.
rvs.add(CtRole.NAME, elem.getValueByRole(CtRole.NAME));
}
} else if (elem instanceof CtBinaryOperator || elem instanceof CtUnaryOperator || elem instanceof CtOperatorAssignment) {
rvs.add(CtRole.OPERATOR_KIND, elem.getValueByRole(CtRole.OPERATOR_KIND));
}
Expand Down

0 comments on commit 755b27b

Please sign in to comment.