-
-
Notifications
You must be signed in to change notification settings - Fork 1.4k
/
ReplaceableInitializationVariable.js
36 lines (29 loc) · 1.28 KB
/
ReplaceableInitializationVariable.js
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
import LocalVariable from './LocalVariable';
import { UNKNOWN_ASSIGNMENT } from '../values';
export default class ReplaceableInitializationVariable extends LocalVariable {
constructor ( name, declarator ) {
super( name, declarator, null );
}
getName () {
return this.name;
}
hasEffectsWhenAccessedAtPath ( path, options ) {
return this._getInit( options ).hasEffectsWhenAccessedAtPath( path, options )
|| super.hasEffectsWhenAccessedAtPath( path, options );
}
hasEffectsWhenAssignedAtPath ( path, options ) {
return this._getInit( options ).hasEffectsWhenAssignedAtPath( path, options )
|| super.hasEffectsWhenAssignedAtPath( path, options );
}
hasEffectsWhenCalledAtPath ( path, callOptions, options ) {
return this._getInit( options ).hasEffectsWhenCalledAtPath( path, callOptions, options )
|| super.hasEffectsWhenCalledAtPath( path, callOptions, options );
}
someReturnExpressionWhenCalledAtPath ( path, callOptions, predicateFunction, options ) {
return this._getInit( options ).someReturnExpressionWhenCalledAtPath( path, callOptions, predicateFunction, options )
|| super.someReturnExpressionWhenCalledAtPath( path, callOptions, predicateFunction, options );
}
_getInit ( options ) {
return options.getReplacedVariableInit( this ) || UNKNOWN_ASSIGNMENT;
}
}