| 1 |
|
| 2 |
|
| 3 |
|
| 4 |
|
| 5 |
|
| 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 |
|
| 26 |
|
| 27 |
@Override |
| 28 |
public boolean isForEach() { |
| 29 |
return false; |
| 30 |
} |
| 31 |
|
| 32 |
|
| 33 |
|
| 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 |
|
| 54 |
|
| 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 |
} |