1 | "use strict";Object.defineProperty(exports, "__esModule", {value: true});var _tokenizer = require('../parser/tokenizer');
|
2 | var _types = require('../parser/tokenizer/types');
|
3 |
|
4 |
|
5 |
|
6 |
|
7 |
|
8 |
|
9 |
|
10 | const EMPTY_DECLARATION_INFO = {
|
11 | typeDeclarations: new Set(),
|
12 | valueDeclarations: new Set(),
|
13 | }; exports.EMPTY_DECLARATION_INFO = EMPTY_DECLARATION_INFO;
|
14 |
|
15 |
|
16 |
|
17 |
|
18 |
|
19 |
|
20 |
|
21 |
|
22 |
|
23 |
|
24 |
|
25 |
|
26 | function getDeclarationInfo(tokens) {
|
27 | const typeDeclarations = new Set();
|
28 | const valueDeclarations = new Set();
|
29 | for (let i = 0; i < tokens.tokens.length; i++) {
|
30 | const token = tokens.tokens[i];
|
31 | if (token.type === _types.TokenType.name && _tokenizer.isTopLevelDeclaration.call(void 0, token)) {
|
32 | if (token.isType) {
|
33 | typeDeclarations.add(tokens.identifierNameForToken(token));
|
34 | } else {
|
35 | valueDeclarations.add(tokens.identifierNameForToken(token));
|
36 | }
|
37 | }
|
38 | }
|
39 | return {typeDeclarations, valueDeclarations};
|
40 | } exports.default = getDeclarationInfo;
|