| 1 |
|
| 2 |
|
| 3 |
|
| 4 |
|
| 5 |
|
| 6 |
|
| 7 |
package org.mozilla.javascript.ast; |
| 8 |
|
| 9 |
import org.mozilla.javascript.Token; |
| 10 |
|
| 11 |
|
| 12 |
|
| 13 |
|
| 14 |
|
| 15 |
|
| 16 |
|
| 17 |
public class ArrayComprehensionLoop extends ForInLoop { |
| 18 |
|
| 19 |
public ArrayComprehensionLoop() { |
| 20 |
} |
| 21 |
|
| 22 |
public ArrayComprehensionLoop(int pos) { |
| 23 |
super(pos); |
| 24 |
} |
| 25 |
|
| 26 |
public ArrayComprehensionLoop(int pos, int len) { |
| 27 |
super(pos, len); |
| 28 |
} |
| 29 |
|
| 30 |
|
| 31 |
|
| 32 |
|
| 33 |
|
| 34 |
@Override |
| 35 |
public AstNode getBody() { |
| 36 |
return null; |
| 37 |
} |
| 38 |
|
| 39 |
|
| 40 |
|
| 41 |
|
| 42 |
|
| 43 |
|
| 44 |
@Override |
| 45 |
public void setBody(AstNode body) { |
| 46 |
throw new UnsupportedOperationException("this node type has no body"); |
| 47 |
} |
| 48 |
|
| 49 |
@Override |
| 50 |
public String toSource(int depth) { |
| 51 |
return makeIndent(depth) |
| 52 |
+ " for " |
| 53 |
+ (isForEach()?"each ":"") |
| 54 |
+ "(" |
| 55 |
+ iterator.toSource(0) |
| 56 |
+ (isForOf()?" of ":" in ") |
| 57 |
+ iteratedObject.toSource(0) |
| 58 |
+ ")"; |
| 59 |
} |
| 60 |
|
| 61 |
|
| 62 |
|
| 63 |
|
| 64 |
|
| 65 |
@Override |
| 66 |
public void visit(NodeVisitor v) { |
| 67 |
if (v.visit(this)) { |
| 68 |
iterator.visit(v); |
| 69 |
iteratedObject.visit(v); |
| 70 |
} |
| 71 |
} |
| 72 |
} |