-
Notifications
You must be signed in to change notification settings - Fork 23
/
variable_declaration_statement.ts
46 lines (39 loc) · 1.37 KB
/
variable_declaration_statement.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
44
45
46
import { ASTNode } from "../../ast_node";
import { VariableDeclaration } from "../declaration/variable_declaration";
import { Expression } from "../expression/expression";
import { StructuredDocumentation } from "../meta";
import { Statement } from "./statement";
export class VariableDeclarationStatement extends Statement {
/**
* Ids of the variables that are assigned by the statement.
*/
assignments: Array<number | null>;
/**
* An array of variable declarations,
* e.g. `x` and `y` in `(uint x, uint y) = (1,2)` or `z` in `(uint z) = (1);`
*/
vDeclarations: VariableDeclaration[];
/**
* The expression that is evaluated and assigned as an initial value
* for the declared variables.
*/
vInitialValue?: Expression;
constructor(
id: number,
src: string,
assignments: Array<number | null>,
declarations: VariableDeclaration[],
initialValue?: Expression,
documentation?: string | StructuredDocumentation,
raw?: any
) {
super(id, src, documentation, raw);
this.assignments = assignments;
this.vDeclarations = declarations;
this.vInitialValue = initialValue;
this.acceptChildren();
}
get children(): readonly ASTNode[] {
return this.pickNodes(this.documentation, this.vDeclarations, this.vInitialValue);
}
}