Skip to content

Commit

Permalink
Remove dead code
Browse files Browse the repository at this point in the history
  • Loading branch information
kniazkov committed Oct 13, 2022
1 parent 93718eb commit 9d22880
Showing 1 changed file with 4 additions and 29 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -496,14 +496,16 @@ private String formatHoleExtractor(final Hole hole, final int index) {
destination,
hole.getValue()
);
if (hole.getAttribute() == HoleAttribute.ELLIPSIS && index == 0) {
final HoleAttribute attribute = hole.getAttribute();
assert attribute != HoleAttribute.TYPED;
if (attribute == HoleAttribute.ELLIPSIS && index == 0) {
result =
String.format(
"children.put(%s.%s, node.getChildrenList());\n",
this.klass.getName(),
destination
);
} else if (hole.getAttribute() == HoleAttribute.ELLIPSIS) {
} else if (attribute == HoleAttribute.ELLIPSIS) {
this.alist = true;
final List<String> code = Arrays.asList(
"final int count = node.getChildCount();",
Expand All @@ -521,33 +523,6 @@ private String formatHoleExtractor(final Hole hole, final int index) {
)
);
result = String.join("\n", code);
} else if (hole.getAttribute() == HoleAttribute.TYPED) {
this.alist = true;
final String capacity;
if (index == 0) {
capacity = "count";
} else {
capacity = String.format("count - %d", index);
}
final List<String> code = Arrays.asList(
"final int count = node.getChildCount();",
String.format("final List<Node> list = new ArrayList<>(%s);", capacity),
String.format(
"for (int index = %d; index < count; index = index + 1) {",
index
),
"final Node child = node.getChild(index);",
String.format("if (\"%s\".equals(child.getTypeName())) {", hole.getType()),
"list.add(child);",
"}",
"}",
String.format(
"children.put(%s.%s, list);\n",
this.klass.getName(),
destination
)
);
result = String.join("\n", code);
} else {
this.collections = true;
final String srclbl = this.children.getLabel();
Expand Down

0 comments on commit 9d22880

Please sign in to comment.