Skip to content

Commit 85d6bfe

Browse files
committed
move createCollection to the only place it is used
1 parent ef5ea43 commit 85d6bfe

File tree

1 file changed

+21
-21
lines changed

1 file changed

+21
-21
lines changed

javascript/extractor/src/com/semmle/js/extractor/CFGExtractor.java

Lines changed: 21 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -186,27 +186,6 @@ public CFGExtractor(ASTExtractor astExtractor) {
186186
this.metrics = astExtractor.getMetrics();
187187
}
188188

189-
/**
190-
* Creates an `Collection<Node>` from the one-or-more nodes contained in `nodes`.
191-
* `nodes` is either `null`, a `Node`, or a `Collection<Node>`.
192-
*/
193-
@SuppressWarnings("unchecked")
194-
private static Collection<Node> createCollection(Object nodes) { // TODO: Delete usages.
195-
if (nodes == null) return Collections.<Node>emptySet();
196-
if (nodes instanceof Node) return Collections.<Node>singleton((Node) nodes);
197-
return (Collection<Node>) nodes;
198-
}
199-
200-
/**
201-
* Creates an `Collection<Node>` that iterates the nodes in reverse order from the one-or-more nodes contained in `nodes`.
202-
*/
203-
private static Collection<Node> createReversedCollection(final Object nodes) {
204-
List<Node> list = new ArrayList<>();
205-
createCollection(nodes).forEach(list::add);
206-
Collections.reverse(list);
207-
return list;
208-
}
209-
210189
private static Collection<Node> union(Node x, Node y) {
211190
return union(Collections.singleton(x), Collections.singleton(y));
212191
}
@@ -954,6 +933,27 @@ private Node visitWithSuccessors(Node nd, Collection<Node> successors) {
954933
return First.of(nd);
955934
}
956935

936+
/**
937+
* Creates an `Collection<Node>` from the one-or-more nodes contained in `nodes`.
938+
* `nodes` is either `null`, a `Node`, or a `Collection<Node>`.
939+
*/
940+
@SuppressWarnings("unchecked")
941+
private Collection<Node> createCollection(Object nodes) { // TODO: Delete usages.
942+
if (nodes == null) return Collections.<Node>emptySet();
943+
if (nodes instanceof Node) return Collections.<Node>singleton((Node) nodes);
944+
return (Collection<Node>) nodes;
945+
}
946+
947+
/**
948+
* Creates an `Collection<Node>` that iterates the nodes in reverse order from the one-or-more nodes contained in `nodes`.
949+
*/
950+
private Collection<Node> createReversedCollection(final Object nodes) {
951+
List<Node> list = new ArrayList<>();
952+
createCollection(nodes).forEach(list::add);
953+
Collections.reverse(list);
954+
return list;
955+
}
956+
957957
/**
958958
* Visit each of the `nodes` in reverse order, with the successor of the `i`th node set to the `i+1`th node, such that the `followingCache` for a given node is populated when visiting the previous node.
959959
*

0 commit comments

Comments
 (0)