1 | import { isEqualNamespace } from './utils';
|
2 | var ScopeChecker = (function () {
|
3 | function ScopeChecker(namespace, isolateModule) {
|
4 | this.namespace = namespace;
|
5 | this.isolateModule = isolateModule;
|
6 | this._namespace = namespace.filter(function (n) { return n.type !== 'selector'; });
|
7 | }
|
8 | |
9 |
|
10 |
|
11 |
|
12 |
|
13 |
|
14 | ScopeChecker.prototype.isDirectlyInScope = function (leaf) {
|
15 | var namespace = this.isolateModule.getNamespace(leaf);
|
16 | if (!namespace) {
|
17 | return false;
|
18 | }
|
19 | if (this._namespace.length > namespace.length ||
|
20 | !isEqualNamespace(this._namespace, namespace.slice(0, this._namespace.length))) {
|
21 | return false;
|
22 | }
|
23 | for (var i = this._namespace.length; i < namespace.length; i++) {
|
24 | if (namespace[i].type === 'total') {
|
25 | return false;
|
26 | }
|
27 | }
|
28 | return true;
|
29 | };
|
30 | return ScopeChecker;
|
31 | }());
|
32 | export { ScopeChecker };
|
33 |
|
\ | No newline at end of file |