@spyglassmc/core 0.1.1 → 0.3.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +7 -0
- package/lib/browser.d.ts +2 -0
- package/lib/browser.js +2 -0
- package/lib/common/Dev.d.ts +11 -0
- package/lib/common/Dev.js +90 -0
- package/lib/{service → common}/Logger.d.ts +0 -0
- package/lib/{service → common}/Logger.js +2 -5
- package/lib/common/Operations.d.ts +12 -0
- package/lib/common/Operations.js +33 -0
- package/lib/common/ReadonlyProxy.d.ts +9 -0
- package/lib/common/ReadonlyProxy.js +23 -0
- package/lib/common/StateProxy.d.ts +35 -0
- package/lib/common/StateProxy.js +69 -0
- package/lib/common/TwoWayMap.d.ts +21 -0
- package/lib/common/TwoWayMap.js +69 -0
- package/lib/common/externals/BrowserExternals.d.ts +3 -0
- package/lib/common/externals/BrowserExternals.js +191 -0
- package/lib/common/externals/NodeJsExternals.d.ts +3 -0
- package/lib/common/externals/NodeJsExternals.js +152 -0
- package/lib/common/externals/downloader.d.ts +31 -0
- package/lib/common/externals/downloader.js +32 -0
- package/lib/common/externals/index.d.ts +96 -0
- package/lib/common/externals/index.js +2 -0
- package/lib/common/index.d.ts +8 -1
- package/lib/common/index.js +8 -13
- package/lib/common/util.d.ts +50 -39
- package/lib/common/util.js +73 -122
- package/lib/index.d.ts +7 -7
- package/lib/index.js +7 -19
- package/lib/node/AstNode.d.ts +12 -11
- package/lib/node/AstNode.js +10 -16
- package/lib/node/BooleanNode.d.ts +2 -2
- package/lib/node/BooleanNode.js +4 -7
- package/lib/node/CommentNode.d.ts +6 -5
- package/lib/node/CommentNode.js +4 -9
- package/lib/node/ErrorNode.d.ts +1 -1
- package/lib/node/ErrorNode.js +2 -5
- package/lib/node/FileNode.d.ts +8 -4
- package/lib/node/FileNode.js +3 -6
- package/lib/node/FloatNode.d.ts +3 -3
- package/lib/node/FloatNode.js +4 -7
- package/lib/node/IntegerNode.d.ts +3 -3
- package/lib/node/IntegerNode.js +4 -7
- package/lib/node/ListNode.d.ts +2 -2
- package/lib/node/ListNode.js +2 -5
- package/lib/node/LiteralNode.d.ts +5 -5
- package/lib/node/LiteralNode.js +5 -8
- package/lib/node/LongNode.d.ts +3 -3
- package/lib/node/LongNode.js +4 -7
- package/lib/node/RecordNode.d.ts +2 -2
- package/lib/node/RecordNode.js +2 -5
- package/lib/node/ResourceLocationNode.d.ts +8 -10
- package/lib/node/ResourceLocationNode.js +9 -12
- package/lib/node/Sequence.d.ts +4 -3
- package/lib/node/Sequence.js +4 -6
- package/lib/node/StringNode.d.ts +5 -5
- package/lib/node/StringNode.js +9 -12
- package/lib/node/SymbolNode.d.ts +5 -5
- package/lib/node/SymbolNode.js +5 -8
- package/lib/node/index.d.ts +15 -15
- package/lib/node/index.js +15 -27
- package/lib/nodejs.d.ts +2 -0
- package/lib/nodejs.js +2 -0
- package/lib/parser/Parser.d.ts +3 -3
- package/lib/parser/Parser.js +1 -4
- package/lib/parser/boolean.d.ts +2 -2
- package/lib/parser/boolean.js +3 -6
- package/lib/parser/comment.d.ts +2 -2
- package/lib/parser/comment.js +5 -9
- package/lib/parser/empty.d.ts +1 -1
- package/lib/parser/empty.js +1 -5
- package/lib/parser/error.d.ts +2 -2
- package/lib/parser/error.js +5 -9
- package/lib/parser/file.d.ts +3 -3
- package/lib/parser/file.js +9 -13
- package/lib/parser/float.d.ts +4 -4
- package/lib/parser/float.js +12 -16
- package/lib/parser/index.d.ts +16 -16
- package/lib/parser/index.js +16 -34
- package/lib/parser/integer.d.ts +4 -4
- package/lib/parser/integer.js +10 -14
- package/lib/parser/list.d.ts +2 -2
- package/lib/parser/list.js +15 -19
- package/lib/parser/literal.d.ts +2 -2
- package/lib/parser/literal.js +5 -9
- package/lib/parser/long.d.ts +4 -4
- package/lib/parser/long.js +10 -14
- package/lib/parser/record.d.ts +3 -3
- package/lib/parser/record.js +20 -24
- package/lib/parser/resourceLocation.d.ts +2 -2
- package/lib/parser/resourceLocation.js +12 -24
- package/lib/parser/string.d.ts +7 -7
- package/lib/parser/string.js +40 -44
- package/lib/parser/symbol.d.ts +3 -3
- package/lib/parser/symbol.js +4 -14
- package/lib/parser/util.d.ts +30 -12
- package/lib/parser/util.js +78 -65
- package/lib/processor/ColorInfoProvider.d.ts +1 -1
- package/lib/processor/ColorInfoProvider.js +6 -9
- package/lib/processor/InlayHintProvider.d.ts +4 -3
- package/lib/processor/InlayHintProvider.js +1 -2
- package/lib/processor/SignatureHelpProvider.d.ts +4 -3
- package/lib/processor/SignatureHelpProvider.js +1 -2
- package/lib/processor/binder/Binder.d.ts +26 -0
- package/lib/processor/binder/Binder.js +18 -0
- package/lib/processor/binder/builtin.d.ts +27 -0
- package/lib/processor/binder/builtin.js +116 -0
- package/lib/processor/binder/index.d.ts +3 -0
- package/lib/processor/binder/index.js +3 -0
- package/lib/processor/checker/Checker.d.ts +2 -2
- package/lib/processor/checker/Checker.js +1 -5
- package/lib/processor/checker/builtin.d.ts +4 -4
- package/lib/processor/checker/builtin.js +22 -33
- package/lib/processor/checker/index.d.ts +2 -2
- package/lib/processor/checker/index.js +2 -27
- package/lib/processor/colorizer/Colorizer.d.ts +6 -5
- package/lib/processor/colorizer/Colorizer.js +8 -11
- package/lib/processor/colorizer/builtin.d.ts +3 -3
- package/lib/processor/colorizer/builtin.js +33 -46
- package/lib/processor/colorizer/index.d.ts +2 -2
- package/lib/processor/colorizer/index.js +2 -27
- package/lib/processor/completer/Completer.d.ts +6 -5
- package/lib/processor/completer/Completer.js +14 -33
- package/lib/processor/completer/builtin.d.ts +10 -9
- package/lib/processor/completer/builtin.js +59 -75
- package/lib/processor/completer/index.d.ts +2 -2
- package/lib/processor/completer/index.js +2 -27
- package/lib/processor/formatter/Formatter.d.ts +4 -3
- package/lib/processor/formatter/Formatter.js +2 -7
- package/lib/processor/formatter/builtin.d.ts +3 -3
- package/lib/processor/formatter/builtin.js +22 -36
- package/lib/processor/formatter/index.d.ts +2 -2
- package/lib/processor/formatter/index.js +2 -27
- package/lib/processor/index.d.ts +10 -9
- package/lib/processor/index.js +10 -21
- package/lib/processor/linter/Linter.d.ts +4 -3
- package/lib/processor/linter/Linter.js +1 -2
- package/lib/processor/linter/builtin/undeclaredSymbol.d.ts +2 -2
- package/lib/processor/linter/builtin/undeclaredSymbol.js +23 -27
- package/lib/processor/linter/builtin.d.ts +4 -3
- package/lib/processor/linter/builtin.js +19 -26
- package/lib/processor/linter/index.d.ts +2 -2
- package/lib/processor/linter/index.js +2 -27
- package/lib/processor/util.d.ts +4 -14
- package/lib/processor/util.js +1 -16
- package/lib/service/CacheService.d.ts +8 -6
- package/lib/service/CacheService.js +35 -56
- package/lib/service/Config.d.ts +17 -16
- package/lib/service/Config.js +56 -51
- package/lib/service/Context.d.ts +24 -21
- package/lib/service/Context.js +40 -36
- package/lib/service/Dependency.js +2 -5
- package/lib/service/Downloader.d.ts +9 -39
- package/lib/service/Downloader.js +37 -106
- package/lib/service/ErrorReporter.d.ts +2 -2
- package/lib/service/ErrorReporter.js +11 -15
- package/lib/service/FileService.d.ts +40 -14
- package/lib/service/FileService.js +107 -81
- package/lib/service/Hover.d.ts +2 -2
- package/lib/service/Hover.js +4 -7
- package/lib/service/MetaRegistry.d.ts +17 -12
- package/lib/service/MetaRegistry.js +81 -73
- package/lib/service/Profiler.d.ts +3 -2
- package/lib/service/Profiler.js +81 -45
- package/lib/service/Project.d.ts +101 -73
- package/lib/service/Project.js +438 -367
- package/lib/service/Service.d.ts +19 -29
- package/lib/service/Service.js +57 -53
- package/lib/service/SymbolLocations.d.ts +3 -3
- package/lib/service/SymbolLocations.js +4 -7
- package/lib/service/SymbolRegistrar.d.ts +1 -1
- package/lib/service/SymbolRegistrar.js +1 -2
- package/lib/service/UriProcessor.d.ts +5 -0
- package/lib/service/UriProcessor.js +2 -0
- package/lib/service/fileUtil.d.ts +21 -41
- package/lib/service/fileUtil.js +59 -129
- package/lib/service/index.d.ts +16 -17
- package/lib/service/index.js +16 -31
- package/lib/source/IndexMap.d.ts +1 -1
- package/lib/source/IndexMap.js +7 -10
- package/lib/source/LanguageError.d.ts +2 -2
- package/lib/source/LanguageError.js +3 -6
- package/lib/source/Location.d.ts +3 -3
- package/lib/source/Location.js +6 -9
- package/lib/source/Offset.d.ts +1 -1
- package/lib/source/Offset.js +4 -7
- package/lib/source/Position.js +2 -5
- package/lib/source/PositionRange.d.ts +2 -2
- package/lib/source/PositionRange.js +14 -17
- package/lib/source/Range.d.ts +1 -1
- package/lib/source/Range.js +7 -10
- package/lib/source/Source.d.ts +9 -4
- package/lib/source/Source.js +58 -31
- package/lib/source/index.d.ts +8 -8
- package/lib/source/index.js +8 -20
- package/lib/symbol/Symbol.d.ts +15 -14
- package/lib/symbol/Symbol.js +53 -68
- package/lib/symbol/SymbolUtil.d.ts +30 -39
- package/lib/symbol/SymbolUtil.js +189 -168
- package/lib/symbol/index.d.ts +2 -3
- package/lib/symbol/index.js +2 -15
- package/package.json +7 -4
- package/lib/service/Operations.d.ts +0 -8
- package/lib/service/Operations.js +0 -26
- package/lib/symbol/UriBinder.d.ts +0 -3
- package/lib/symbol/UriBinder.js +0 -3
package/lib/symbol/SymbolUtil.js
CHANGED
|
@@ -1,72 +1,69 @@
|
|
|
1
|
-
"use strict";
|
|
2
1
|
var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
|
|
3
2
|
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
4
3
|
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
|
5
4
|
else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
|
6
5
|
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
7
6
|
};
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
class SymbolUtil extends events_1.default {
|
|
31
|
-
constructor(global,
|
|
7
|
+
import { TextDocument } from 'vscode-languageserver-textdocument';
|
|
8
|
+
import { Range } from '../source/index.js';
|
|
9
|
+
import { SymbolLocation, SymbolPath, SymbolUsageTypes } from './Symbol.js';
|
|
10
|
+
export class SymbolUtil {
|
|
11
|
+
#global;
|
|
12
|
+
#eventEmitter;
|
|
13
|
+
#eventEmitterConstructor;
|
|
14
|
+
#trimmableSymbols = new Set();
|
|
15
|
+
#cache = Object.create(null);
|
|
16
|
+
#currentContributor;
|
|
17
|
+
/**
|
|
18
|
+
* @internal
|
|
19
|
+
*/
|
|
20
|
+
_delayedOps = [];
|
|
21
|
+
/**
|
|
22
|
+
* @internal
|
|
23
|
+
*/
|
|
24
|
+
_inDelayMode;
|
|
25
|
+
get global() {
|
|
26
|
+
return this.#global;
|
|
27
|
+
}
|
|
28
|
+
constructor(global, eventEmitterConstructor,
|
|
32
29
|
/** @internal */
|
|
33
30
|
_currentContributor,
|
|
34
31
|
/** @internal */
|
|
35
32
|
_inDelayMode = false) {
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
_SymbolUtil_currentContributor.set(this, void 0);
|
|
41
|
-
/**
|
|
42
|
-
* @internal
|
|
43
|
-
*/
|
|
44
|
-
this._delayedOps = [];
|
|
45
|
-
__classPrivateFieldSet(this, _SymbolUtil_global, global, "f");
|
|
46
|
-
__classPrivateFieldSet(this, _SymbolUtil_currentContributor, _currentContributor, "f");
|
|
33
|
+
this.#eventEmitter = new eventEmitterConstructor();
|
|
34
|
+
this.#eventEmitterConstructor = eventEmitterConstructor;
|
|
35
|
+
this.#global = global;
|
|
36
|
+
this.#currentContributor = _currentContributor;
|
|
47
37
|
this._inDelayMode = _inDelayMode;
|
|
48
38
|
this
|
|
49
39
|
.on('symbolCreated', ({ symbol }) => {
|
|
50
|
-
|
|
40
|
+
this.#trimmableSymbols.add(SymbolPath.toString(symbol));
|
|
51
41
|
})
|
|
52
42
|
.on('symbolRemoved', ({ symbol }) => {
|
|
53
|
-
|
|
43
|
+
this.#trimmableSymbols.delete(SymbolPath.toString(symbol));
|
|
54
44
|
})
|
|
55
45
|
.on('symbolLocationCreated', ({ symbol, location }) => {
|
|
56
|
-
|
|
57
|
-
const
|
|
58
|
-
const
|
|
59
|
-
const path = Symbol_1.SymbolPath.toString(symbol);
|
|
46
|
+
const cache = this.#cache[location.contributor ?? 'undefined'] ??= Object.create(null);
|
|
47
|
+
const fileSymbols = cache[location.uri] ??= new Set();
|
|
48
|
+
const path = SymbolPath.toString(symbol);
|
|
60
49
|
fileSymbols.add(path);
|
|
61
|
-
|
|
50
|
+
this.#trimmableSymbols.delete(path);
|
|
62
51
|
})
|
|
63
52
|
.on('symbolLocationRemoved', ({ symbol }) => {
|
|
64
|
-
const path =
|
|
65
|
-
|
|
53
|
+
const path = SymbolPath.toString(symbol);
|
|
54
|
+
this.#trimmableSymbols.add(path);
|
|
66
55
|
});
|
|
67
56
|
}
|
|
68
|
-
|
|
69
|
-
|
|
57
|
+
on(event, callbackFn) {
|
|
58
|
+
this.#eventEmitter.on(event, callbackFn);
|
|
59
|
+
return this;
|
|
60
|
+
}
|
|
61
|
+
once(event, callbackFn) {
|
|
62
|
+
this.#eventEmitter.once(event, callbackFn);
|
|
63
|
+
return this;
|
|
64
|
+
}
|
|
65
|
+
emit(event, ...args) {
|
|
66
|
+
return this.#eventEmitter.emit(event, ...args);
|
|
70
67
|
}
|
|
71
68
|
/**
|
|
72
69
|
* Build the internal cache of the SymbolUtil according to the current global symbol table.
|
|
@@ -87,7 +84,7 @@ class SymbolUtil extends events_1.default {
|
|
|
87
84
|
* `applyDelayedEdits` is called, the original SymbolUtil will also be modified.
|
|
88
85
|
*/
|
|
89
86
|
clone() {
|
|
90
|
-
return new SymbolUtil(
|
|
87
|
+
return new SymbolUtil(this.#global, this.#eventEmitterConstructor, this.#currentContributor, true);
|
|
91
88
|
}
|
|
92
89
|
/**
|
|
93
90
|
* Apply edits done during the delay mode.
|
|
@@ -98,24 +95,24 @@ class SymbolUtil extends events_1.default {
|
|
|
98
95
|
this._inDelayMode = false;
|
|
99
96
|
}
|
|
100
97
|
contributeAs(contributor, fn) {
|
|
101
|
-
const originalValue =
|
|
102
|
-
|
|
98
|
+
const originalValue = this.#currentContributor;
|
|
99
|
+
this.#currentContributor = contributor;
|
|
103
100
|
try {
|
|
104
101
|
fn();
|
|
105
102
|
}
|
|
106
103
|
finally {
|
|
107
|
-
|
|
104
|
+
this.#currentContributor = originalValue;
|
|
108
105
|
}
|
|
109
106
|
return this;
|
|
110
107
|
}
|
|
111
108
|
async contributeAsAsync(contributor, fn) {
|
|
112
|
-
const originalValue =
|
|
113
|
-
|
|
109
|
+
const originalValue = this.#currentContributor;
|
|
110
|
+
this.#currentContributor = contributor;
|
|
114
111
|
try {
|
|
115
112
|
await fn();
|
|
116
113
|
}
|
|
117
114
|
finally {
|
|
118
|
-
|
|
115
|
+
this.#currentContributor = originalValue;
|
|
119
116
|
}
|
|
120
117
|
return this;
|
|
121
118
|
}
|
|
@@ -129,10 +126,10 @@ class SymbolUtil extends events_1.default {
|
|
|
129
126
|
clear({ uri, contributor, predicate = () => true }) {
|
|
130
127
|
const getCaches = () => {
|
|
131
128
|
if (contributor) {
|
|
132
|
-
return
|
|
129
|
+
return this.#cache[contributor] ? [this.#cache[contributor]] : [];
|
|
133
130
|
}
|
|
134
131
|
else {
|
|
135
|
-
return Object.values(
|
|
132
|
+
return Object.values(this.#cache);
|
|
136
133
|
}
|
|
137
134
|
};
|
|
138
135
|
const getPaths = () => {
|
|
@@ -140,12 +137,12 @@ class SymbolUtil extends events_1.default {
|
|
|
140
137
|
const sets = uri
|
|
141
138
|
? caches.map(cache => cache[uri] ?? new Set())
|
|
142
139
|
: caches.map(cache => Object.values(cache)).flat();
|
|
143
|
-
return sets.map(s => [...s]).flat().map(
|
|
140
|
+
return sets.map(s => [...s]).flat().map(SymbolPath.fromString);
|
|
144
141
|
};
|
|
145
142
|
const getTables = () => {
|
|
146
143
|
return uri
|
|
147
|
-
? [
|
|
148
|
-
: [
|
|
144
|
+
? [this.#global]
|
|
145
|
+
: [this.#global];
|
|
149
146
|
};
|
|
150
147
|
const paths = getPaths();
|
|
151
148
|
const tables = getTables();
|
|
@@ -163,6 +160,15 @@ class SymbolUtil extends events_1.default {
|
|
|
163
160
|
}
|
|
164
161
|
}
|
|
165
162
|
lookup(category, path, node) {
|
|
163
|
+
while (node) {
|
|
164
|
+
if (node.locals) {
|
|
165
|
+
const result = SymbolUtil.lookupTable(node.locals, category, path);
|
|
166
|
+
if (result.symbol) {
|
|
167
|
+
return result;
|
|
168
|
+
}
|
|
169
|
+
}
|
|
170
|
+
node = node.parent;
|
|
171
|
+
}
|
|
166
172
|
return SymbolUtil.lookupTable(this.global, category, path);
|
|
167
173
|
}
|
|
168
174
|
query(doc, category, ...path) {
|
|
@@ -172,7 +178,7 @@ class SymbolUtil extends events_1.default {
|
|
|
172
178
|
return new SymbolQuery({
|
|
173
179
|
category,
|
|
174
180
|
doc,
|
|
175
|
-
contributor:
|
|
181
|
+
contributor: this.#currentContributor,
|
|
176
182
|
map: visible ? parentMap : undefined,
|
|
177
183
|
parentSymbol: parentSymbol,
|
|
178
184
|
path,
|
|
@@ -207,14 +213,14 @@ class SymbolUtil extends events_1.default {
|
|
|
207
213
|
trimSymbol(symbol.parentSymbol);
|
|
208
214
|
}
|
|
209
215
|
};
|
|
210
|
-
for (const pathString of
|
|
211
|
-
const path =
|
|
216
|
+
for (const pathString of this.#trimmableSymbols) {
|
|
217
|
+
const path = SymbolPath.fromString(pathString);
|
|
212
218
|
const { symbol } = SymbolUtil.lookupTable(table, path.category, path.path);
|
|
213
219
|
trimSymbol(symbol);
|
|
214
220
|
}
|
|
215
221
|
}
|
|
216
222
|
removeLocationsFromSymbol(symbol, predicate) {
|
|
217
|
-
for (const type of
|
|
223
|
+
for (const type of SymbolUsageTypes) {
|
|
218
224
|
if (!symbol[type]) {
|
|
219
225
|
continue;
|
|
220
226
|
}
|
|
@@ -304,7 +310,7 @@ class SymbolUtil extends events_1.default {
|
|
|
304
310
|
symbol.desc = addition.desc;
|
|
305
311
|
}
|
|
306
312
|
if (addition.relations && Object.keys(addition.relations).length) {
|
|
307
|
-
symbol.relations
|
|
313
|
+
symbol.relations ??= {};
|
|
308
314
|
for (const relationship of Object.keys(addition.relations)) {
|
|
309
315
|
symbol.relations[relationship] = addition.relations[relationship];
|
|
310
316
|
}
|
|
@@ -315,12 +321,12 @@ class SymbolUtil extends events_1.default {
|
|
|
315
321
|
if ('visibility' in addition) {
|
|
316
322
|
// Visibility changes are only accepted if the change wouldn't result in the
|
|
317
323
|
// symbol being stored in a different symbol table.
|
|
318
|
-
const inGlobalTable = (v) => v === undefined || v === 2 /* Public */ || v === 3 /* Restricted */;
|
|
324
|
+
const inGlobalTable = (v) => v === undefined || v === 2 /* SymbolVisibility.Public */ || v === 3 /* SymbolVisibility.Restricted */;
|
|
319
325
|
if (symbol.visibility === addition.visibility || (inGlobalTable(symbol.visibility) && inGlobalTable(addition.visibility))) {
|
|
320
326
|
symbol.visibility = addition.visibility;
|
|
321
327
|
}
|
|
322
328
|
else {
|
|
323
|
-
throw new Error(`Cannot change visibility from ${symbol.visibility} to ${addition.visibility}: ${JSON.stringify(
|
|
329
|
+
throw new Error(`Cannot change visibility from ${symbol.visibility} to ${addition.visibility}: ${JSON.stringify(SymbolPath.fromSymbol(symbol))}`);
|
|
324
330
|
}
|
|
325
331
|
}
|
|
326
332
|
if (addition.visibilityRestriction?.length) {
|
|
@@ -331,9 +337,9 @@ class SymbolUtil extends events_1.default {
|
|
|
331
337
|
amendSymbolUsage(symbol, addition, doc, contributor) {
|
|
332
338
|
if (addition) {
|
|
333
339
|
const type = addition.type ?? 'reference';
|
|
334
|
-
const arr = symbol[type]
|
|
335
|
-
const range =
|
|
336
|
-
const location =
|
|
340
|
+
const arr = symbol[type] ??= [];
|
|
341
|
+
const range = Range.get((SymbolAdditionUsageWithNode.is(addition) ? addition.node : addition.range) ?? 0);
|
|
342
|
+
const location = SymbolLocation.create(doc, range, addition.fullRange, contributor, {
|
|
337
343
|
accessType: addition.accessType,
|
|
338
344
|
skipRenaming: addition.skipRenaming,
|
|
339
345
|
});
|
|
@@ -369,11 +375,11 @@ class SymbolUtil extends events_1.default {
|
|
|
369
375
|
}
|
|
370
376
|
static isVisible(symbol, _uri) {
|
|
371
377
|
switch (symbol.visibility) {
|
|
372
|
-
case 3 /* Restricted */:
|
|
378
|
+
case 3 /* SymbolVisibility.Restricted */:
|
|
373
379
|
return false; // FIXME: check with workspace root URIs.
|
|
374
|
-
case 0 /* Block */:
|
|
375
|
-
case 1 /* File */:
|
|
376
|
-
case 2 /* Public */:
|
|
380
|
+
case 0 /* SymbolVisibility.Block */:
|
|
381
|
+
case 1 /* SymbolVisibility.File */:
|
|
382
|
+
case 2 /* SymbolVisibility.Public */:
|
|
377
383
|
default:
|
|
378
384
|
return true;
|
|
379
385
|
}
|
|
@@ -412,7 +418,7 @@ class SymbolUtil extends events_1.default {
|
|
|
412
418
|
* @throws If the symbol does not have any declarations or definitions.
|
|
413
419
|
*/
|
|
414
420
|
static getDeclaredLocation(symbol) {
|
|
415
|
-
return symbol.declaration?.[0] ?? symbol.definition?.[0] ?? (() => { throw new Error(`Cannot get declared location of ${JSON.stringify(
|
|
421
|
+
return symbol.declaration?.[0] ?? symbol.definition?.[0] ?? (() => { throw new Error(`Cannot get declared location of ${JSON.stringify(SymbolPath.fromSymbol(symbol))}`); })();
|
|
416
422
|
}
|
|
417
423
|
static forEachSymbolInMap(map, fn) {
|
|
418
424
|
for (const symbol of Object.values(map)) {
|
|
@@ -428,20 +434,19 @@ class SymbolUtil extends events_1.default {
|
|
|
428
434
|
}
|
|
429
435
|
}
|
|
430
436
|
static forEachLocationOfSymbol(symbol, fn) {
|
|
431
|
-
for (const type of
|
|
437
|
+
for (const type of SymbolUsageTypes) {
|
|
432
438
|
symbol[type]?.forEach(location => fn({ type, location }));
|
|
433
439
|
}
|
|
434
440
|
}
|
|
435
441
|
static isVisibilityInGlobal(v) {
|
|
436
|
-
return v === undefined || v === 2 /* Public */ || v === 3 /* Restricted */;
|
|
442
|
+
return v === undefined || v === 2 /* SymbolVisibility.Public */ || v === 3 /* SymbolVisibility.Restricted */;
|
|
437
443
|
}
|
|
438
444
|
static areVisibilitiesCompatible(v1, v2) {
|
|
439
445
|
return ((this.isVisibilityInGlobal(v1) && this.isVisibilityInGlobal(v2)) ||
|
|
440
|
-
(v1 === 0 /* Block */ && v2 === 0 /* Block */) ||
|
|
441
|
-
(v1 === 1 /* File */ && v2 === 1 /* File */));
|
|
446
|
+
(v1 === 0 /* SymbolVisibility.Block */ && v2 === 0 /* SymbolVisibility.Block */) ||
|
|
447
|
+
(v1 === 1 /* SymbolVisibility.File */ && v2 === 1 /* SymbolVisibility.File */));
|
|
442
448
|
}
|
|
443
449
|
}
|
|
444
|
-
_SymbolUtil_global = new WeakMap(), _SymbolUtil_trimmableSymbols = new WeakMap(), _SymbolUtil_cache = new WeakMap(), _SymbolUtil_currentContributor = new WeakMap();
|
|
445
450
|
__decorate([
|
|
446
451
|
DelayModeSupport()
|
|
447
452
|
], SymbolUtil.prototype, "clear", null);
|
|
@@ -451,7 +456,6 @@ __decorate([
|
|
|
451
456
|
__decorate([
|
|
452
457
|
DelayModeSupport()
|
|
453
458
|
], SymbolUtil.prototype, "removeLocationsFromSymbol", null);
|
|
454
|
-
exports.SymbolUtil = SymbolUtil;
|
|
455
459
|
var SymbolAdditionUsageWithRange;
|
|
456
460
|
(function (SymbolAdditionUsageWithRange) {
|
|
457
461
|
/* istanbul ignore next */
|
|
@@ -469,65 +473,71 @@ var SymbolAdditionUsageWithNode;
|
|
|
469
473
|
SymbolAdditionUsageWithNode.is = is;
|
|
470
474
|
})(SymbolAdditionUsageWithNode || (SymbolAdditionUsageWithNode = {}));
|
|
471
475
|
/* istanbul ignore next */
|
|
472
|
-
class SymbolQuery {
|
|
476
|
+
export class SymbolQuery {
|
|
477
|
+
category;
|
|
478
|
+
path;
|
|
479
|
+
#doc;
|
|
480
|
+
#node;
|
|
481
|
+
/**
|
|
482
|
+
* If only a string URI (instead of a {@link TextDocument}) is provided when constructing this class.
|
|
483
|
+
*
|
|
484
|
+
* If this is `true`, {@link SymbolAdditionUsageWithRange.range} is ignored and treated as `[0, 0)` when entering symbols through this class.
|
|
485
|
+
*/
|
|
486
|
+
#createdWithUri;
|
|
487
|
+
#currentContributor;
|
|
488
|
+
#hasTriggeredIf = false;
|
|
489
|
+
/**
|
|
490
|
+
* The map where the queried symbol is stored. `undefined` if the map hasn't been created yet.
|
|
491
|
+
*/
|
|
492
|
+
#map;
|
|
493
|
+
#parentSymbol;
|
|
494
|
+
/**
|
|
495
|
+
* The queried symbol. `undefined` if the symbol hasn't been created yet.
|
|
496
|
+
*/
|
|
497
|
+
#symbol;
|
|
498
|
+
/**
|
|
499
|
+
* The {@link SymbolUtil} where this query was created.
|
|
500
|
+
*/
|
|
501
|
+
util;
|
|
502
|
+
get symbol() {
|
|
503
|
+
return this.#symbol;
|
|
504
|
+
}
|
|
505
|
+
get visibleMembers() {
|
|
506
|
+
return SymbolUtil.filterVisibleSymbols(this.#doc.uri, this.path.length === 0 ? this.#map : this.#symbol?.members);
|
|
507
|
+
}
|
|
473
508
|
constructor({ category, contributor, doc, map, parentSymbol, path, symbol, util }) {
|
|
474
|
-
_SymbolQuery_doc.set(this, void 0);
|
|
475
|
-
_SymbolQuery_node.set(this, void 0);
|
|
476
|
-
/**
|
|
477
|
-
* If only a string URI (instead of a {@link TextDocument}) is provided when constructing this class.
|
|
478
|
-
*
|
|
479
|
-
* If this is `true`, {@link SymbolAdditionUsageWithRange.range} is ignored and treated as `[0, 0)` when entering symbols through this class.
|
|
480
|
-
*/
|
|
481
|
-
_SymbolQuery_createdWithUri.set(this, void 0);
|
|
482
|
-
_SymbolQuery_currentContributor.set(this, void 0);
|
|
483
|
-
_SymbolQuery_hasTriggeredIf.set(this, false
|
|
484
|
-
/**
|
|
485
|
-
* The map where the queried symbol is stored. `undefined` if the map hasn't been created yet.
|
|
486
|
-
*/
|
|
487
|
-
);
|
|
488
|
-
/**
|
|
489
|
-
* The map where the queried symbol is stored. `undefined` if the map hasn't been created yet.
|
|
490
|
-
*/
|
|
491
|
-
_SymbolQuery_map.set(this, void 0);
|
|
492
|
-
_SymbolQuery_parentSymbol.set(this, void 0);
|
|
493
|
-
/**
|
|
494
|
-
* The queried symbol. `undefined` if the symbol hasn't been created yet.
|
|
495
|
-
*/
|
|
496
|
-
_SymbolQuery_symbol.set(this, void 0);
|
|
497
509
|
this.category = category;
|
|
498
510
|
this.path = path;
|
|
499
511
|
if (typeof doc === 'string') {
|
|
500
|
-
doc =
|
|
501
|
-
|
|
512
|
+
doc = TextDocument.create(doc, '', 0, '');
|
|
513
|
+
this.#createdWithUri = true;
|
|
502
514
|
}
|
|
503
515
|
else if (isDocAndNode(doc)) {
|
|
504
|
-
|
|
516
|
+
this.#node = doc.node;
|
|
505
517
|
doc = doc.doc;
|
|
506
518
|
}
|
|
507
|
-
|
|
508
|
-
|
|
509
|
-
|
|
510
|
-
|
|
511
|
-
|
|
519
|
+
this.#doc = doc;
|
|
520
|
+
this.#currentContributor = contributor;
|
|
521
|
+
this.#map = map;
|
|
522
|
+
this.#parentSymbol = parentSymbol;
|
|
523
|
+
this.#symbol = symbol;
|
|
512
524
|
this.util = util;
|
|
513
525
|
}
|
|
514
|
-
get symbol() {
|
|
515
|
-
return __classPrivateFieldGet(this, _SymbolQuery_symbol, "f");
|
|
516
|
-
}
|
|
517
|
-
get visibleMembers() {
|
|
518
|
-
return SymbolUtil.filterVisibleSymbols(__classPrivateFieldGet(this, _SymbolQuery_doc, "f").uri, this.path.length === 0 ? __classPrivateFieldGet(this, _SymbolQuery_map, "f") : __classPrivateFieldGet(this, _SymbolQuery_symbol, "f")?.members);
|
|
519
|
-
}
|
|
520
526
|
heyGimmeDaSymbol() {
|
|
521
|
-
return
|
|
527
|
+
return this.#symbol;
|
|
528
|
+
}
|
|
529
|
+
getData(predicate) {
|
|
530
|
+
const data = this.#symbol?.data;
|
|
531
|
+
return predicate(data) ? data : undefined;
|
|
522
532
|
}
|
|
523
533
|
with(fn) {
|
|
524
534
|
fn(this);
|
|
525
535
|
return this;
|
|
526
536
|
}
|
|
527
537
|
if(predicate, fn) {
|
|
528
|
-
if (predicate.call(this,
|
|
529
|
-
fn.call(this,
|
|
530
|
-
|
|
538
|
+
if (predicate.call(this, this.#symbol, this)) {
|
|
539
|
+
fn.call(this, this.#symbol, this);
|
|
540
|
+
this.#hasTriggeredIf = true;
|
|
531
541
|
}
|
|
532
542
|
return this;
|
|
533
543
|
}
|
|
@@ -577,8 +587,8 @@ class SymbolQuery {
|
|
|
577
587
|
* Calls `fn` if none of the former `if` conditions are met.
|
|
578
588
|
*/
|
|
579
589
|
else(fn) {
|
|
580
|
-
if (!
|
|
581
|
-
fn.call(this,
|
|
590
|
+
if (!this.#hasTriggeredIf) {
|
|
591
|
+
fn.call(this, this.#symbol, this);
|
|
582
592
|
}
|
|
583
593
|
return this;
|
|
584
594
|
}
|
|
@@ -597,29 +607,37 @@ class SymbolQuery {
|
|
|
597
607
|
return this.else(() => this.resolveAlias());
|
|
598
608
|
}
|
|
599
609
|
_enter(addition) {
|
|
610
|
+
/**
|
|
611
|
+
* Get a proper visibility from the addition:
|
|
612
|
+
* * If the visibility is specified, use it.
|
|
613
|
+
* * If the visibility is `undefined`, use the visibility of the symbol, or `Public` if unapplicable.
|
|
614
|
+
*/
|
|
615
|
+
const getAdditionVisibility = (addition) => {
|
|
616
|
+
return addition.data?.visibility ?? this.symbol?.visibility ?? 2 /* SymbolVisibility.Public */;
|
|
617
|
+
};
|
|
600
618
|
const getMap = (addition) => {
|
|
601
|
-
|
|
602
|
-
if (
|
|
603
|
-
return
|
|
619
|
+
const additionVisibility = getAdditionVisibility(addition);
|
|
620
|
+
if (this.#map && SymbolUtil.areVisibilitiesCompatible(additionVisibility, this.#symbol?.visibility)) {
|
|
621
|
+
return this.#map;
|
|
604
622
|
}
|
|
605
623
|
if (this.path.length > 1) {
|
|
606
|
-
if (
|
|
607
|
-
if (!SymbolUtil.areVisibilitiesCompatible(
|
|
608
|
-
throw new Error(`Cannot enter member “${this.getPath()}” of ${SymbolFormatter.stringifyVisibility(
|
|
624
|
+
if (this.#parentSymbol) {
|
|
625
|
+
if (!SymbolUtil.areVisibilitiesCompatible(additionVisibility, this.#parentSymbol.visibility)) {
|
|
626
|
+
throw new Error(`Cannot enter member “${this.getPath()}” of ${SymbolFormatter.stringifyVisibility(additionVisibility)} visibility to parent of ${SymbolFormatter.stringifyVisibility(this.#parentSymbol.visibility)} visibility`);
|
|
609
627
|
}
|
|
610
|
-
return
|
|
628
|
+
return this.#parentSymbol.members ??= {};
|
|
611
629
|
}
|
|
612
630
|
}
|
|
613
631
|
else {
|
|
614
632
|
let table;
|
|
615
|
-
if (SymbolUtil.isVisibilityInGlobal(
|
|
633
|
+
if (SymbolUtil.isVisibilityInGlobal(additionVisibility)) {
|
|
616
634
|
table = this.util.global;
|
|
617
635
|
}
|
|
618
|
-
else if (
|
|
619
|
-
if (!
|
|
620
|
-
throw new Error(`Cannot enter “${this.getPath()}” with ${SymbolFormatter.stringifyVisibility(
|
|
636
|
+
else if (additionVisibility === 1 /* SymbolVisibility.File */) {
|
|
637
|
+
if (!this.#node) {
|
|
638
|
+
throw new Error(`Cannot enter “${this.getPath()}” with ${SymbolFormatter.stringifyVisibility(additionVisibility)} visibility as no node is supplied`);
|
|
621
639
|
}
|
|
622
|
-
let node =
|
|
640
|
+
let node = this.#node;
|
|
623
641
|
while (node) {
|
|
624
642
|
if (node.type === 'file') {
|
|
625
643
|
table = node.locals;
|
|
@@ -628,14 +646,14 @@ class SymbolQuery {
|
|
|
628
646
|
node = node.parent;
|
|
629
647
|
}
|
|
630
648
|
if (!table) {
|
|
631
|
-
throw new Error(`Cannot enter “${this.getPath()}” with ${SymbolFormatter.stringifyVisibility(
|
|
649
|
+
throw new Error(`Cannot enter “${this.getPath()}” with ${SymbolFormatter.stringifyVisibility(additionVisibility)} visibility as no file node is supplied`);
|
|
632
650
|
}
|
|
633
651
|
}
|
|
634
652
|
else {
|
|
635
|
-
if (!
|
|
636
|
-
throw new Error(`Cannot enter “${this.getPath()}” with ${SymbolFormatter.stringifyVisibility(
|
|
653
|
+
if (!this.#node) {
|
|
654
|
+
throw new Error(`Cannot enter “${this.getPath()}” with ${SymbolFormatter.stringifyVisibility(additionVisibility)} visibility as no node is supplied`);
|
|
637
655
|
}
|
|
638
|
-
let node =
|
|
656
|
+
let node = this.#node;
|
|
639
657
|
while (node) {
|
|
640
658
|
if (node.locals) {
|
|
641
659
|
table = node.locals;
|
|
@@ -644,22 +662,22 @@ class SymbolQuery {
|
|
|
644
662
|
node = node.parent;
|
|
645
663
|
}
|
|
646
664
|
if (!table) {
|
|
647
|
-
throw new Error(`Cannot enter “${this.getPath()}” with ${SymbolFormatter.stringifyVisibility(
|
|
665
|
+
throw new Error(`Cannot enter “${this.getPath()}” with ${SymbolFormatter.stringifyVisibility(additionVisibility)} visibility as no node with locals is supplied`);
|
|
648
666
|
}
|
|
649
667
|
}
|
|
650
668
|
// TODO: Move part of symbol from global to table.
|
|
651
|
-
return table[
|
|
669
|
+
return table[this.category] ??= {};
|
|
652
670
|
}
|
|
653
671
|
throw new Error(`Cannot create the symbol map for “${this.getPath()}”`);
|
|
654
672
|
};
|
|
655
673
|
// Treat `usage.range` as `[0, 0)` if this class was constructed with a string URI (instead of a `TextDocument`).
|
|
656
|
-
if (
|
|
657
|
-
addition.usage.range =
|
|
674
|
+
if (this.#createdWithUri && SymbolAdditionUsageWithRange.is(addition.usage)) {
|
|
675
|
+
addition.usage.range = Range.create(0, 0);
|
|
658
676
|
}
|
|
659
|
-
|
|
660
|
-
|
|
677
|
+
this.#map = getMap(addition);
|
|
678
|
+
this.#symbol = this.util.enterMap(this.#parentSymbol, this.#map, this.category, this.path, this.path[this.path.length - 1], addition, this.#doc, this.#currentContributor);
|
|
661
679
|
if (addition.usage?.node) {
|
|
662
|
-
addition.usage.node.symbol =
|
|
680
|
+
addition.usage.node.symbol = this.#symbol;
|
|
663
681
|
}
|
|
664
682
|
}
|
|
665
683
|
/**
|
|
@@ -693,13 +711,13 @@ class SymbolQuery {
|
|
|
693
711
|
* after the error is thrown.
|
|
694
712
|
*/
|
|
695
713
|
resolveAlias() {
|
|
696
|
-
if (
|
|
697
|
-
const result = this.util.resolveAlias(
|
|
714
|
+
if (this.#symbol) {
|
|
715
|
+
const result = this.util.resolveAlias(this.#symbol);
|
|
698
716
|
if (!result) {
|
|
699
717
|
throw new Error('The current symbol points to an non-existent symbol.');
|
|
700
718
|
}
|
|
701
|
-
|
|
702
|
-
|
|
719
|
+
this.#symbol = result;
|
|
720
|
+
this.#map = result.parentMap;
|
|
703
721
|
}
|
|
704
722
|
return this;
|
|
705
723
|
}
|
|
@@ -708,7 +726,7 @@ class SymbolQuery {
|
|
|
708
726
|
let doc, identifier, fn;
|
|
709
727
|
if (arguments.length === 2) {
|
|
710
728
|
// Ensure the member query result will not unknowingly have a dummy TextDocument passed down from this class.
|
|
711
|
-
doc =
|
|
729
|
+
doc = this.#createdWithUri ? this.#doc.uri : this.#doc;
|
|
712
730
|
identifier = arguments[0];
|
|
713
731
|
fn = arguments[1];
|
|
714
732
|
}
|
|
@@ -717,20 +735,20 @@ class SymbolQuery {
|
|
|
717
735
|
identifier = arguments[1];
|
|
718
736
|
fn = arguments[2];
|
|
719
737
|
}
|
|
720
|
-
if (
|
|
738
|
+
if (this.#symbol === undefined) {
|
|
721
739
|
throw new Error(`Tried to query member symbol “${identifier}” from an undefined symbol (path “${this.path.join('.')}”)`);
|
|
722
740
|
}
|
|
723
|
-
const memberDoc = typeof doc === 'string' && doc ===
|
|
724
|
-
?
|
|
741
|
+
const memberDoc = typeof doc === 'string' && doc === this.#doc.uri && !this.#createdWithUri
|
|
742
|
+
? this.#doc
|
|
725
743
|
: doc;
|
|
726
|
-
const memberMap =
|
|
744
|
+
const memberMap = this.#symbol.members;
|
|
727
745
|
const memberSymbol = memberMap?.[identifier];
|
|
728
746
|
const memberQueryResult = new SymbolQuery({
|
|
729
747
|
category: this.category,
|
|
730
748
|
doc: memberDoc,
|
|
731
|
-
contributor:
|
|
749
|
+
contributor: this.#currentContributor,
|
|
732
750
|
map: memberMap,
|
|
733
|
-
parentSymbol:
|
|
751
|
+
parentSymbol: this.#symbol,
|
|
734
752
|
path: [...this.path, identifier],
|
|
735
753
|
symbol: memberSymbol,
|
|
736
754
|
util: this.util,
|
|
@@ -755,18 +773,21 @@ class SymbolQuery {
|
|
|
755
773
|
return `${this.category}.${this.path.join('/')}`;
|
|
756
774
|
}
|
|
757
775
|
}
|
|
758
|
-
_SymbolQuery_doc = new WeakMap(), _SymbolQuery_node = new WeakMap(), _SymbolQuery_createdWithUri = new WeakMap(), _SymbolQuery_currentContributor = new WeakMap(), _SymbolQuery_hasTriggeredIf = new WeakMap(), _SymbolQuery_map = new WeakMap(), _SymbolQuery_parentSymbol = new WeakMap(), _SymbolQuery_symbol = new WeakMap();
|
|
759
776
|
__decorate([
|
|
760
777
|
DelayModeSupport((self) => self.util)
|
|
761
778
|
], SymbolQuery.prototype, "_enter", null);
|
|
762
|
-
exports.SymbolQuery = SymbolQuery;
|
|
763
779
|
/* istanbul ignore next */
|
|
764
780
|
/**
|
|
765
781
|
* A series of methods for converting symbol structures to human-readable outputs. Mostly for debug purposes.
|
|
766
782
|
*/
|
|
767
|
-
var SymbolFormatter;
|
|
783
|
+
export var SymbolFormatter;
|
|
768
784
|
(function (SymbolFormatter) {
|
|
769
785
|
const IndentChar = '+ ';
|
|
786
|
+
function assertEqual(a, b) {
|
|
787
|
+
if (a !== b) {
|
|
788
|
+
throw new Error(`Assertion error: ${a} !== ${b}`);
|
|
789
|
+
}
|
|
790
|
+
}
|
|
770
791
|
function stringifySymbolStack(stack) {
|
|
771
792
|
return stack.map(table => stringifySymbolTable(table)).join('\n------------\n');
|
|
772
793
|
}
|
|
@@ -787,7 +808,7 @@ var SymbolFormatter;
|
|
|
787
808
|
const ans = [];
|
|
788
809
|
for (const identifier of Object.keys(map)) {
|
|
789
810
|
const symbol = map[identifier];
|
|
790
|
-
|
|
811
|
+
assertEqual(identifier, symbol.identifier);
|
|
791
812
|
ans.push(stringifySymbol(symbol, indent));
|
|
792
813
|
}
|
|
793
814
|
return ans.join(`\n${indent}------------\n`);
|
|
@@ -798,7 +819,7 @@ var SymbolFormatter;
|
|
|
798
819
|
return 'undefined';
|
|
799
820
|
}
|
|
800
821
|
const ans = [];
|
|
801
|
-
|
|
822
|
+
assertEqual(symbol.path[symbol.path.length - 1], symbol.identifier);
|
|
802
823
|
ans.push(`SYMBOL ${symbol.path.join('.')}` +
|
|
803
824
|
` {${symbol.category}${symbol.subcategory ? ` (${symbol.subcategory})` : ''}}` +
|
|
804
825
|
` [${stringifyVisibility(symbol.visibility, symbol.visibilityRestriction)}]`);
|
|
@@ -808,7 +829,7 @@ var SymbolFormatter;
|
|
|
808
829
|
if (symbol.desc) {
|
|
809
830
|
ans.push(`${IndentChar}description: ${symbol.desc}`);
|
|
810
831
|
}
|
|
811
|
-
for (const type of
|
|
832
|
+
for (const type of SymbolUsageTypes) {
|
|
812
833
|
if (symbol[type]) {
|
|
813
834
|
ans.push(`${IndentChar}${type}:\n${symbol[type].map(v => `${indent}${IndentChar.repeat(2)}${JSON.stringify(v)}`).join(`\n${indent}${IndentChar.repeat(2)}------------\n`)}`);
|
|
814
835
|
}
|
|
@@ -826,13 +847,13 @@ var SymbolFormatter;
|
|
|
826
847
|
let stringVisibility;
|
|
827
848
|
// Const enums cannot be indexed even if `--preserveConstEnums` is on: https://github.com/microsoft/TypeScript/issues/31353
|
|
828
849
|
switch (visibility) {
|
|
829
|
-
case 0 /* Block */:
|
|
850
|
+
case 0 /* SymbolVisibility.Block */:
|
|
830
851
|
stringVisibility = 'Block';
|
|
831
852
|
break;
|
|
832
|
-
case 1 /* File */:
|
|
853
|
+
case 1 /* SymbolVisibility.File */:
|
|
833
854
|
stringVisibility = 'File';
|
|
834
855
|
break;
|
|
835
|
-
case 3 /* Restricted */:
|
|
856
|
+
case 3 /* SymbolVisibility.Restricted */:
|
|
836
857
|
stringVisibility = 'Restricted';
|
|
837
858
|
break;
|
|
838
859
|
default:
|
|
@@ -851,7 +872,7 @@ symbol:
|
|
|
851
872
|
${stringifySymbol(result.symbol, IndentChar)}`;
|
|
852
873
|
}
|
|
853
874
|
SymbolFormatter.stringifyLookupResult = stringifyLookupResult;
|
|
854
|
-
})(SymbolFormatter
|
|
875
|
+
})(SymbolFormatter || (SymbolFormatter = {}));
|
|
855
876
|
/**
|
|
856
877
|
* Make a method support delay mode: if the {@link SymbolUtil} is in delay mode, the actual invocation of the method will be
|
|
857
878
|
* stored to the {@link SymbolUtil._delayedOps} array.
|