Debian Codegraph @

rhino/src/org/mozilla/javascript/ast/GeneratorExpressionLoop.java

raw symbols SCIP
1 /* -*- Mode: java; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 4 -*-
2 *
3 * This Source Code Form is subject to the terms of the Mozilla Public
4 * License, v. 2.0. If a copy of the MPL was not distributed with this
5 * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
6
7 package org.mozilla.javascript.ast;
8
9 /**
10 */
11 public class GeneratorExpressionLoop extends ForInLoop {
12
13 public GeneratorExpressionLoop() {
14 }
15
16 public GeneratorExpressionLoop(int pos) {
17 super(pos);
18 }
19
20 public GeneratorExpressionLoop(int pos, int len) {
21 super(pos, len);
22 }
23
24 /**
25 * Returns whether the loop is a for-each loop
26 */
27 @Override
28 public boolean isForEach() {
29 return false;
30 }
31
32 /**
33 * Sets whether the loop is a for-each loop
34 */
35 @Override
36 public void setIsForEach(boolean isForEach) {
37 throw new UnsupportedOperationException("this node type does not support for each");
38 }
39
40 @Override
41 public String toSource(int depth) {
42 return makeIndent(depth)
43 + " for "
44 + (isForEach()?"each ":"")
45 + "("
46 + iterator.toSource(0)
47 + (isForOf()?" of ":" in ")
48 + iteratedObject.toSource(0)
49 + ")";
50 }
51
52 /**
53 * Visits the iterator expression and the iterated object expression.
54 * There is no body-expression for this loop type.
55 */
56 @Override
57 public void visit(NodeVisitor v) {
58 if (v.visit(this)) {
59 iterator.visit(v);
60 iteratedObject.visit(v);
61 }
62 }
63 }