1 | 'use strict';
|
2 |
|
3 | Object.defineProperty(exports, "__esModule", {
|
4 | value: true
|
5 | });
|
6 | var schema = exports.schema = [];
|
7 |
|
8 | exports.default = function (context) {
|
9 | var globalScope = void 0;
|
10 |
|
11 |
|
12 |
|
13 | var makeDefined = function makeDefined(ident) {
|
14 | var ii = void 0;
|
15 |
|
16 |
|
17 | for (ii = globalScope.through.length - 1; ii >= 0; ii--) {
|
18 | var ref = globalScope.through[ii];
|
19 |
|
20 | if (ref.identifier.name === ident.name) {
|
21 |
|
22 | globalScope.__defineGeneric(
|
23 | ident.name, globalScope.set, globalScope.variables);
|
24 | var variable = globalScope.set.get(ident.name);
|
25 |
|
26 | variable.writeable = false;
|
27 |
|
28 |
|
29 | globalScope.through.splice(ii, 1);
|
30 | ref.resolved = variable;
|
31 | variable.references.push(ref);
|
32 | }
|
33 | }
|
34 | };
|
35 |
|
36 | return {
|
37 | ClassImplements: function ClassImplements(node) {
|
38 | makeDefined(node.id);
|
39 | },
|
40 | GenericTypeAnnotation: function GenericTypeAnnotation(node) {
|
41 | if (node.id.type === 'Identifier') {
|
42 | makeDefined(node.id);
|
43 | } else if (node.id.type === 'QualifiedTypeIdentifier') {
|
44 | var qid = void 0;
|
45 |
|
46 | qid = node.id;
|
47 | do {
|
48 | qid = qid.qualification;
|
49 | } while (qid.qualification);
|
50 |
|
51 | makeDefined(qid);
|
52 | }
|
53 | },
|
54 | InterfaceDeclaration: function InterfaceDeclaration(node) {
|
55 | makeDefined(node.id);
|
56 | },
|
57 | Program: function Program() {
|
58 | globalScope = context.getScope();
|
59 | },
|
60 | TypeParameterDeclaration: function TypeParameterDeclaration(node) {
|
61 | node.params.forEach(function (param) {
|
62 | makeDefined(param);
|
63 | });
|
64 | }
|
65 | };
|
66 | }; |
\ | No newline at end of file |