-
Notifications
You must be signed in to change notification settings - Fork 41
/
Copy pathSuper.ts
38 lines (32 loc) · 1.16 KB
/
Super.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
import type { InclusionContext } from '../ExecutionContext';
import type { NodeInteraction } from '../NodeInteractions';
import type { EntityPathTracker, ObjectPath } from '../utils/PathTracker';
import { EMPTY_PATH } from '../utils/PathTracker';
import type Variable from '../variables/Variable';
import type * as NodeType from './NodeType';
import { NodeBase } from './shared/Node';
export default class Super extends NodeBase {
declare type: NodeType.tSuper;
declare variable: Variable;
bind(): void {
this.variable = this.scope.findVariable('this');
}
deoptimizeArgumentsOnInteractionAtPath(
interaction: NodeInteraction,
path: ObjectPath,
recursionTracker: EntityPathTracker
) {
this.variable.deoptimizeArgumentsOnInteractionAtPath(interaction, path, recursionTracker);
}
deoptimizePath(path: ObjectPath): void {
this.variable.deoptimizePath(path);
}
include(context: InclusionContext): void {
if (!this.included) this.includeNode(context);
}
includeNode(context: InclusionContext) {
this.included = true;
if (!this.deoptimized) this.applyDeoptimizations();
this.scope.context.includeVariableInModule(this.variable, EMPTY_PATH, context);
}
}