/**
* Copyright (c) 2012-2016 André Bargull
* Alle Rechte vorbehalten / All Rights Reserved. Use is subject to license terms.
*
* <https://github.com/anba/es6draft>
*/
package com.github.anba.es6draft.ast;
import java.util.EnumSet;
import java.util.Set;
import com.github.anba.es6draft.ast.scope.BlockScope;
/**
* <h1>13 ECMAScript Language: Statements and Declarations</h1><br>
* <h2>13.7 Iteration Statements</h2>
* <ul>
* <li>Extension: 'for-each' statement
* </ul>
*/
public final class ForEachStatement extends IterationStatement implements ForIterationNode {
private final BlockScope scope;
private final Node head;
private final Expression expression;
private Statement statement;
public ForEachStatement(long beginPosition, long endPosition, BlockScope scope,
EnumSet<Abrupt> abrupt, Set<String> labelSet, Node head, Expression expression,
Statement statement) {
super(beginPosition, endPosition, abrupt, labelSet);
this.scope = scope;
this.head = head;
this.expression = expression;
this.statement = statement;
}
@Override
public BlockScope getScope() {
return scope;
}
@Override
public Node getHead() {
return head;
}
@Override
public Expression getExpression() {
return expression;
}
@Override
public Statement getStatement() {
return statement;
}
@Override
public void setStatement(Statement statement) {
this.statement = statement;
}
@Override
public <R, V> R accept(NodeVisitor<R, V> visitor, V value) {
return visitor.visit(this, value);
}
@Override
public <V> int accept(IntNodeVisitor<V> visitor, V value) {
return visitor.visit(this, value);
}
@Override
public <V> void accept(VoidNodeVisitor<V> visitor, V value) {
visitor.visit(this, value);
}
}