We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
hcaerof
foreach
1 parent ca26b5e commit 014728aCopy full SHA for 014728a
javascript/extractor/src/com/semmle/js/extractor/CFGExtractor.java
@@ -189,15 +189,10 @@ private static Iterable<Node> foreach(Object nd) {
189
}
190
191
private Iterable<Node> hcaerof(final Object nd) {
192
- if (nd == null) return Collections.<Node>emptySet();
193
- if (nd instanceof Node) return CollectionUtil.singletonIterable((Node) nd);
194
- return new Iterable<Node>() {
195
- @SuppressWarnings("unchecked")
196
- @Override
197
- public Iterator<Node> iterator() {
198
- return CollectionUtil.reverseIterator((List<Node>) nd);
199
- }
200
- };
+ List<Node> list = new ArrayList<>();
+ foreach(nd).forEach(list::add);
+ Collections.reverse(list);
+ return list;
201
202
203
/** Returns a list of all the nodes in a tree of nested lists. */
0 commit comments