UNPKG

627 BJavaScriptView Raw
1export class Reference {
2 constructor ( node, scope, statement ) {
3 this.node = node;
4 this.scope = scope;
5 this.statement = statement;
6
7 this.declaration = null; // bound later
8
9 this.parts = [];
10
11 let root = node;
12 while ( root.type === 'MemberExpression' ) {
13 this.parts.unshift( root.property.name );
14 root = root.object;
15 }
16
17 this.name = root.name;
18
19 this.start = node.start;
20 this.end = node.start + this.name.length; // can be overridden in the case of namespace members
21 this.rewritten = false;
22 }
23}
24
25export class SyntheticReference {
26 constructor ( name ) {
27 this.name = name;
28 this.parts = [];
29 }
30}