-
Notifications
You must be signed in to change notification settings - Fork 2k
Expand file tree
/
Copy pathComprehensionExpression.java
More file actions
54 lines (45 loc) · 1.31 KB
/
ComprehensionExpression.java
File metadata and controls
54 lines (45 loc) · 1.31 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
package com.semmle.js.ast;
import java.util.List;
/** A comprehension expression. */
public class ComprehensionExpression extends Expression {
private final Expression body;
private final List<ComprehensionBlock> blocks;
private final Expression filter;
private final boolean generator;
public ComprehensionExpression(
SourceLocation loc,
Expression body,
List<ComprehensionBlock> blocks,
Expression filter,
Boolean generator) {
super("ComprehensionExpression", loc);
this.body = body;
this.blocks = blocks;
this.filter = filter;
this.generator = Boolean.TRUE.equals(generator);
}
@Override
public <Q, A> A accept(Visitor<Q, A> v, Q q) {
return v.visit(this, q);
}
/** The body expression of this comprehension. */
public Expression getBody() {
return body;
}
/** The comprehension blocks of this comprehension. */
public List<ComprehensionBlock> getBlocks() {
return blocks;
}
/** Does this comprehension expression have a filter expression? */
public boolean hasFilter() {
return filter != null;
}
/** The filter expression of this comprehension; may be null. */
public Expression getFilter() {
return filter;
}
/** Is this a generator expression? */
public boolean isGenerator() {
return generator;
}
}