-
Notifications
You must be signed in to change notification settings - Fork 23
/
index_range_access.ts
43 lines (36 loc) · 1.1 KB
/
index_range_access.ts
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
import { ASTNode } from "../../ast_node";
import { Expression } from "./expression";
export class IndexRangeAccess extends Expression {
/**
* The expression that is accessed e.g. `data` in `data[2:4]`
*/
vBaseExpression: Expression;
/**
* Start index of the range, e.g. `2` in `data[2:4]`.
* Is `undefined` when omitted.
*/
vStartExpression?: Expression;
/**
* End index of the range, e.g. `4` in `data[2:4]`.
* Is `undefined` when omitted.
*/
vEndExpression?: Expression;
constructor(
id: number,
src: string,
typeString: string,
baseExpression: Expression,
startExpression?: Expression,
endExpression?: Expression,
raw?: any
) {
super(id, src, typeString, raw);
this.vBaseExpression = baseExpression;
this.vStartExpression = startExpression;
this.vEndExpression = endExpression;
this.acceptChildren();
}
get children(): readonly ASTNode[] {
return this.pickNodes(this.vBaseExpression, this.vStartExpression, this.vEndExpression);
}
}