use of com.github.anba.es6draft.ast.ComprehensionQualifier in project es6draft by anba.
the class ComprehensionGenerator method visit.
/**
* Runtime Semantics: ComprehensionEvaluation
*/
@Override
public Void visit(Comprehension node, CodeVisitor mv) {
ArrayList<Node> list = new ArrayList<>(node.getList().size() + 1);
list.addAll(node.getList());
list.add(node.getExpression());
elements = list.iterator();
// Create variables early so they'll appear next to each other in the local variable map.
ArrayList<Variable<ScriptIterator<?>>> iters = new ArrayList<>();
for (ComprehensionQualifier e : node.getList()) {
if (e instanceof ComprehensionFor || e instanceof LegacyComprehensionFor) {
Variable<ScriptIterator<?>> iter = mv.newVariable("iter", ScriptIterator.class).uncheckedCast();
iters.add(iter);
}
}
iterators = iters.iterator();
// Start generating code.
elements.next().accept(this, mv);
return null;
}
Aggregations