@typescript-deploys/pr-build 5.5.0-pr-57480-8 → 5.5.0-pr-57421-17
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/lib/tsc.js +478 -115
- package/lib/tsserver.js +500 -143
- package/lib/typescript.js +499 -142
- package/lib/typingsInstaller.js +248 -1
- package/package.json +2 -2
package/lib/tsserver.js
CHANGED
|
@@ -32,6 +32,33 @@ var __copyProps = (to, from, except, desc) => {
|
|
|
32
32
|
return to;
|
|
33
33
|
};
|
|
34
34
|
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
35
|
+
var __decorateClass = (decorators, target, key, kind) => {
|
|
36
|
+
var result = kind > 1 ? void 0 : kind ? __getOwnPropDesc(target, key) : target;
|
|
37
|
+
for (var i = decorators.length - 1, decorator; i >= 0; i--)
|
|
38
|
+
if (decorator = decorators[i])
|
|
39
|
+
result = (kind ? decorator(target, key, result) : decorator(result)) || result;
|
|
40
|
+
if (kind && result)
|
|
41
|
+
__defProp(target, key, result);
|
|
42
|
+
return result;
|
|
43
|
+
};
|
|
44
|
+
var __accessCheck = (obj, member, msg) => {
|
|
45
|
+
if (!member.has(obj))
|
|
46
|
+
throw TypeError("Cannot " + msg);
|
|
47
|
+
};
|
|
48
|
+
var __privateGet = (obj, member, getter) => {
|
|
49
|
+
__accessCheck(obj, member, "read from private field");
|
|
50
|
+
return getter ? getter.call(obj) : member.get(obj);
|
|
51
|
+
};
|
|
52
|
+
var __privateAdd = (obj, member, value) => {
|
|
53
|
+
if (member.has(obj))
|
|
54
|
+
throw TypeError("Cannot add the same private member more than once");
|
|
55
|
+
member instanceof WeakSet ? member.add(obj) : member.set(obj, value);
|
|
56
|
+
};
|
|
57
|
+
var __privateSet = (obj, member, value, setter) => {
|
|
58
|
+
__accessCheck(obj, member, "write to private field");
|
|
59
|
+
setter ? setter.call(obj, value) : member.set(obj, value);
|
|
60
|
+
return value;
|
|
61
|
+
};
|
|
35
62
|
|
|
36
63
|
// src/tsserver/server.ts
|
|
37
64
|
var server_exports = {};
|
|
@@ -125,6 +152,7 @@ __export(server_exports, {
|
|
|
125
152
|
NodeCheckFlags: () => NodeCheckFlags,
|
|
126
153
|
NodeFactoryFlags: () => NodeFactoryFlags,
|
|
127
154
|
NodeFlags: () => NodeFlags,
|
|
155
|
+
NodeLinks: () => NodeLinks,
|
|
128
156
|
NodeResolutionFeatures: () => NodeResolutionFeatures,
|
|
129
157
|
ObjectFlags: () => ObjectFlags,
|
|
130
158
|
OperationCanceledException: () => OperationCanceledException,
|
|
@@ -162,12 +190,14 @@ __export(server_exports, {
|
|
|
162
190
|
SmartSelectionRange: () => ts_SmartSelectionRange_exports,
|
|
163
191
|
SnippetKind: () => SnippetKind,
|
|
164
192
|
SortKind: () => SortKind,
|
|
193
|
+
SpeculatableLinks: () => SpeculatableLinks,
|
|
165
194
|
StructureIsReused: () => StructureIsReused,
|
|
166
195
|
SymbolAccessibility: () => SymbolAccessibility,
|
|
167
196
|
SymbolDisplay: () => ts_SymbolDisplay_exports,
|
|
168
197
|
SymbolDisplayPartKind: () => SymbolDisplayPartKind,
|
|
169
198
|
SymbolFlags: () => SymbolFlags,
|
|
170
199
|
SymbolFormatFlags: () => SymbolFormatFlags,
|
|
200
|
+
SymbolLinks: () => SymbolLinks,
|
|
171
201
|
SyntaxKind: () => SyntaxKind,
|
|
172
202
|
SyntheticSymbolKind: () => SyntheticSymbolKind,
|
|
173
203
|
Ternary: () => Ternary,
|
|
@@ -1992,6 +2022,7 @@ __export(server_exports, {
|
|
|
1992
2022
|
positionIsSynthesized: () => positionIsSynthesized,
|
|
1993
2023
|
positionsAreOnSameLine: () => positionsAreOnSameLine,
|
|
1994
2024
|
preProcessFile: () => preProcessFile,
|
|
2025
|
+
prefixDiagnosticWithMessageChain: () => prefixDiagnosticWithMessageChain,
|
|
1995
2026
|
probablyUsesSemicolons: () => probablyUsesSemicolons,
|
|
1996
2027
|
processCommentPragmas: () => processCommentPragmas,
|
|
1997
2028
|
processPragmasIntoFields: () => processPragmasIntoFields,
|
|
@@ -2325,7 +2356,7 @@ module.exports = __toCommonJS(server_exports);
|
|
|
2325
2356
|
|
|
2326
2357
|
// src/compiler/corePublic.ts
|
|
2327
2358
|
var versionMajorMinor = "5.5";
|
|
2328
|
-
var version = `${versionMajorMinor}.0-insiders.
|
|
2359
|
+
var version = `${versionMajorMinor}.0-insiders.20240305`;
|
|
2329
2360
|
var Comparison = /* @__PURE__ */ ((Comparison3) => {
|
|
2330
2361
|
Comparison3[Comparison3["LessThan"] = -1] = "LessThan";
|
|
2331
2362
|
Comparison3[Comparison3["EqualTo"] = 0] = "EqualTo";
|
|
@@ -6525,11 +6556,6 @@ var SymbolFlags = /* @__PURE__ */ ((SymbolFlags3) => {
|
|
|
6525
6556
|
SymbolFlags3[SymbolFlags3["LateBindingContainer"] = 6256] = "LateBindingContainer";
|
|
6526
6557
|
return SymbolFlags3;
|
|
6527
6558
|
})(SymbolFlags || {});
|
|
6528
|
-
var EnumKind = /* @__PURE__ */ ((EnumKind2) => {
|
|
6529
|
-
EnumKind2[EnumKind2["Numeric"] = 0] = "Numeric";
|
|
6530
|
-
EnumKind2[EnumKind2["Literal"] = 1] = "Literal";
|
|
6531
|
-
return EnumKind2;
|
|
6532
|
-
})(EnumKind || {});
|
|
6533
6559
|
var CheckFlags = /* @__PURE__ */ ((CheckFlags2) => {
|
|
6534
6560
|
CheckFlags2[CheckFlags2["None"] = 0] = "None";
|
|
6535
6561
|
CheckFlags2[CheckFlags2["Instantiated"] = 1] = "Instantiated";
|
|
@@ -18635,15 +18661,34 @@ function getSemanticJsxChildren(children) {
|
|
|
18635
18661
|
}
|
|
18636
18662
|
function createDiagnosticCollection() {
|
|
18637
18663
|
let nonFileDiagnostics = [];
|
|
18638
|
-
|
|
18639
|
-
|
|
18664
|
+
let filesWithDiagnostics = [];
|
|
18665
|
+
let fileDiagnostics = /* @__PURE__ */ new Map();
|
|
18640
18666
|
let hasReadNonFileDiagnostics = false;
|
|
18641
18667
|
return {
|
|
18642
18668
|
add,
|
|
18643
18669
|
lookup,
|
|
18644
18670
|
getGlobalDiagnostics,
|
|
18645
|
-
getDiagnostics: getDiagnostics2
|
|
18671
|
+
getDiagnostics: getDiagnostics2,
|
|
18672
|
+
checkpoint,
|
|
18673
|
+
revert
|
|
18646
18674
|
};
|
|
18675
|
+
function checkpoint() {
|
|
18676
|
+
const c = {
|
|
18677
|
+
nonFileDiagnostics: nonFileDiagnostics.slice(),
|
|
18678
|
+
filesWithDiagnostics: filesWithDiagnostics.slice(),
|
|
18679
|
+
fileDiagnostics: new Map(map(arrayFrom(fileDiagnostics.entries()), ([k, v]) => [k, v.slice()])),
|
|
18680
|
+
hasReadNonFileDiagnostics
|
|
18681
|
+
};
|
|
18682
|
+
return c;
|
|
18683
|
+
}
|
|
18684
|
+
function revert(checkpoint2) {
|
|
18685
|
+
({
|
|
18686
|
+
nonFileDiagnostics,
|
|
18687
|
+
filesWithDiagnostics,
|
|
18688
|
+
fileDiagnostics,
|
|
18689
|
+
hasReadNonFileDiagnostics
|
|
18690
|
+
} = checkpoint2);
|
|
18691
|
+
}
|
|
18647
18692
|
function lookup(diagnostic) {
|
|
18648
18693
|
let diagnostics;
|
|
18649
18694
|
if (diagnostic.file) {
|
|
@@ -20411,6 +20456,17 @@ function createCompilerDiagnosticFromMessageChain(chain, relatedInformation) {
|
|
|
20411
20456
|
relatedInformation
|
|
20412
20457
|
};
|
|
20413
20458
|
}
|
|
20459
|
+
function prefixDiagnosticWithMessageChain(base, chain) {
|
|
20460
|
+
if (!chain)
|
|
20461
|
+
return base;
|
|
20462
|
+
concatenateDiagnosticMessageChains(chain, createDiagnosticMessageChainFromDiagnostic(base));
|
|
20463
|
+
return {
|
|
20464
|
+
...base,
|
|
20465
|
+
code: chain.code,
|
|
20466
|
+
category: chain.category,
|
|
20467
|
+
messageText: chain.next ? chain : chain.messageText
|
|
20468
|
+
};
|
|
20469
|
+
}
|
|
20414
20470
|
function chainDiagnosticMessages(details, message, ...args) {
|
|
20415
20471
|
let text = getLocaleSpecificMessage(message);
|
|
20416
20472
|
if (some(args)) {
|
|
@@ -47912,11 +47968,231 @@ var intrinsicTypeKinds = new Map(Object.entries({
|
|
|
47912
47968
|
Uncapitalize: 3 /* Uncapitalize */,
|
|
47913
47969
|
NoInfer: 4 /* NoInfer */
|
|
47914
47970
|
}));
|
|
47915
|
-
var
|
|
47971
|
+
var SpeculatableCache = (valueOrTarget, _contextOrPropertyKey, descriptor) => {
|
|
47972
|
+
const baseGet = descriptor ? descriptor.get : valueOrTarget.get;
|
|
47973
|
+
const baseSet = descriptor ? descriptor.set : valueOrTarget.set;
|
|
47974
|
+
return {
|
|
47975
|
+
...descriptor,
|
|
47976
|
+
get: readValue,
|
|
47977
|
+
set: setValue,
|
|
47978
|
+
init(v) {
|
|
47979
|
+
const epoch = this.host.getCurrentSpeculativeEpoch();
|
|
47980
|
+
const values = [];
|
|
47981
|
+
const writtenEpochs = [epoch];
|
|
47982
|
+
values[epoch] = v;
|
|
47983
|
+
return {
|
|
47984
|
+
values,
|
|
47985
|
+
writtenEpochs
|
|
47986
|
+
};
|
|
47987
|
+
}
|
|
47988
|
+
};
|
|
47989
|
+
function readValue() {
|
|
47990
|
+
const internals = baseGet.call(this);
|
|
47991
|
+
if (!internals)
|
|
47992
|
+
return void 0;
|
|
47993
|
+
const {
|
|
47994
|
+
values,
|
|
47995
|
+
writtenEpochs
|
|
47996
|
+
} = internals;
|
|
47997
|
+
const discardedSpeculativeEpochs = this.host.getDiscardedSpeculativeEpochs();
|
|
47998
|
+
const hostEpoch = this instanceof SymbolLinks ? this.symbolEpoch : 0;
|
|
47999
|
+
const symbolDiscarded = discardedSpeculativeEpochs.has(hostEpoch);
|
|
48000
|
+
for (let i = writtenEpochs.length - 1; i >= 0; i--) {
|
|
48001
|
+
if (!symbolDiscarded && discardedSpeculativeEpochs.has(writtenEpochs[i])) {
|
|
48002
|
+
delete values[writtenEpochs[i]];
|
|
48003
|
+
writtenEpochs.splice(i, 1);
|
|
48004
|
+
continue;
|
|
48005
|
+
}
|
|
48006
|
+
return values[writtenEpochs[i]];
|
|
48007
|
+
}
|
|
48008
|
+
return void 0;
|
|
48009
|
+
}
|
|
48010
|
+
function setValue(value) {
|
|
48011
|
+
const internals = baseGet.call(this);
|
|
48012
|
+
const currentSpeculativeEpoch = this.host.getCurrentSpeculativeEpoch();
|
|
48013
|
+
if (!internals) {
|
|
48014
|
+
const values2 = [];
|
|
48015
|
+
const writtenEpochs2 = [];
|
|
48016
|
+
writtenEpochs2.push(currentSpeculativeEpoch);
|
|
48017
|
+
values2[currentSpeculativeEpoch] = value;
|
|
48018
|
+
baseSet.call(this, { values: values2, writtenEpochs: writtenEpochs2 });
|
|
48019
|
+
return value;
|
|
48020
|
+
}
|
|
48021
|
+
const {
|
|
48022
|
+
values,
|
|
48023
|
+
writtenEpochs
|
|
48024
|
+
} = internals;
|
|
48025
|
+
writtenEpochs.push(currentSpeculativeEpoch);
|
|
48026
|
+
values[currentSpeculativeEpoch] = value;
|
|
48027
|
+
return value;
|
|
48028
|
+
}
|
|
47916
48029
|
};
|
|
47917
|
-
|
|
47918
|
-
|
|
47919
|
-
|
|
48030
|
+
var EnumKind = /* @__PURE__ */ ((EnumKind2) => {
|
|
48031
|
+
EnumKind2[EnumKind2["Numeric"] = 0] = "Numeric";
|
|
48032
|
+
EnumKind2[EnumKind2["Literal"] = 1] = "Literal";
|
|
48033
|
+
return EnumKind2;
|
|
48034
|
+
})(EnumKind || {});
|
|
48035
|
+
var SpeculatableLinks = class {
|
|
48036
|
+
constructor(host) {
|
|
48037
|
+
this.host = host;
|
|
48038
|
+
}
|
|
48039
|
+
};
|
|
48040
|
+
var _type, _writeType, _nameType;
|
|
48041
|
+
var SymbolLinks = class extends SpeculatableLinks {
|
|
48042
|
+
constructor(host, symbolEpoch = 0) {
|
|
48043
|
+
super(host);
|
|
48044
|
+
this.symbolEpoch = symbolEpoch;
|
|
48045
|
+
__privateAdd(this, _type, void 0);
|
|
48046
|
+
__privateAdd(this, _writeType, void 0);
|
|
48047
|
+
__privateAdd(this, _nameType, void 0);
|
|
48048
|
+
}
|
|
48049
|
+
get type() {
|
|
48050
|
+
return __privateGet(this, _type);
|
|
48051
|
+
}
|
|
48052
|
+
set type(_) {
|
|
48053
|
+
__privateSet(this, _type, _);
|
|
48054
|
+
}
|
|
48055
|
+
get writeType() {
|
|
48056
|
+
return __privateGet(this, _writeType);
|
|
48057
|
+
}
|
|
48058
|
+
set writeType(_) {
|
|
48059
|
+
__privateSet(this, _writeType, _);
|
|
48060
|
+
}
|
|
48061
|
+
get nameType() {
|
|
48062
|
+
return __privateGet(this, _nameType);
|
|
48063
|
+
}
|
|
48064
|
+
set nameType(_) {
|
|
48065
|
+
__privateSet(this, _nameType, _);
|
|
48066
|
+
}
|
|
48067
|
+
};
|
|
48068
|
+
_type = new WeakMap();
|
|
48069
|
+
_writeType = new WeakMap();
|
|
48070
|
+
_nameType = new WeakMap();
|
|
48071
|
+
__decorateClass([
|
|
48072
|
+
SpeculatableCache
|
|
48073
|
+
], SymbolLinks.prototype, "type", 1);
|
|
48074
|
+
__decorateClass([
|
|
48075
|
+
SpeculatableCache
|
|
48076
|
+
], SymbolLinks.prototype, "writeType", 1);
|
|
48077
|
+
__decorateClass([
|
|
48078
|
+
SpeculatableCache
|
|
48079
|
+
], SymbolLinks.prototype, "nameType", 1);
|
|
48080
|
+
var _flags, _resolvedType, _resolvedEnumType, _resolvedSignature, _resolvedSymbol, _resolvedIndexInfo, _effectsSignature, _switchTypes, _contextFreeType, _assertionExpressionType;
|
|
48081
|
+
var NodeLinks = class extends SpeculatableLinks {
|
|
48082
|
+
constructor() {
|
|
48083
|
+
super(...arguments);
|
|
48084
|
+
__privateAdd(this, _flags, 0 /* None */);
|
|
48085
|
+
__privateAdd(this, _resolvedType, void 0);
|
|
48086
|
+
__privateAdd(this, _resolvedEnumType, void 0);
|
|
48087
|
+
__privateAdd(this, _resolvedSignature, void 0);
|
|
48088
|
+
__privateAdd(this, _resolvedSymbol, void 0);
|
|
48089
|
+
__privateAdd(this, _resolvedIndexInfo, void 0);
|
|
48090
|
+
__privateAdd(this, _effectsSignature, void 0);
|
|
48091
|
+
__privateAdd(this, _switchTypes, void 0);
|
|
48092
|
+
__privateAdd(this, _contextFreeType, void 0);
|
|
48093
|
+
__privateAdd(this, _assertionExpressionType, void 0);
|
|
48094
|
+
}
|
|
48095
|
+
get flags() {
|
|
48096
|
+
return __privateGet(this, _flags);
|
|
48097
|
+
}
|
|
48098
|
+
set flags(_) {
|
|
48099
|
+
__privateSet(this, _flags, _);
|
|
48100
|
+
}
|
|
48101
|
+
get resolvedType() {
|
|
48102
|
+
return __privateGet(this, _resolvedType);
|
|
48103
|
+
}
|
|
48104
|
+
set resolvedType(_) {
|
|
48105
|
+
__privateSet(this, _resolvedType, _);
|
|
48106
|
+
}
|
|
48107
|
+
get resolvedEnumType() {
|
|
48108
|
+
return __privateGet(this, _resolvedEnumType);
|
|
48109
|
+
}
|
|
48110
|
+
set resolvedEnumType(_) {
|
|
48111
|
+
__privateSet(this, _resolvedEnumType, _);
|
|
48112
|
+
}
|
|
48113
|
+
get resolvedSignature() {
|
|
48114
|
+
return __privateGet(this, _resolvedSignature);
|
|
48115
|
+
}
|
|
48116
|
+
set resolvedSignature(_) {
|
|
48117
|
+
__privateSet(this, _resolvedSignature, _);
|
|
48118
|
+
}
|
|
48119
|
+
get resolvedSymbol() {
|
|
48120
|
+
return __privateGet(this, _resolvedSymbol);
|
|
48121
|
+
}
|
|
48122
|
+
set resolvedSymbol(_) {
|
|
48123
|
+
__privateSet(this, _resolvedSymbol, _);
|
|
48124
|
+
}
|
|
48125
|
+
get resolvedIndexInfo() {
|
|
48126
|
+
return __privateGet(this, _resolvedIndexInfo);
|
|
48127
|
+
}
|
|
48128
|
+
set resolvedIndexInfo(_) {
|
|
48129
|
+
__privateSet(this, _resolvedIndexInfo, _);
|
|
48130
|
+
}
|
|
48131
|
+
get effectsSignature() {
|
|
48132
|
+
return __privateGet(this, _effectsSignature);
|
|
48133
|
+
}
|
|
48134
|
+
set effectsSignature(_) {
|
|
48135
|
+
__privateSet(this, _effectsSignature, _);
|
|
48136
|
+
}
|
|
48137
|
+
get switchTypes() {
|
|
48138
|
+
return __privateGet(this, _switchTypes);
|
|
48139
|
+
}
|
|
48140
|
+
set switchTypes(_) {
|
|
48141
|
+
__privateSet(this, _switchTypes, _);
|
|
48142
|
+
}
|
|
48143
|
+
get contextFreeType() {
|
|
48144
|
+
return __privateGet(this, _contextFreeType);
|
|
48145
|
+
}
|
|
48146
|
+
set contextFreeType(_) {
|
|
48147
|
+
__privateSet(this, _contextFreeType, _);
|
|
48148
|
+
}
|
|
48149
|
+
get assertionExpressionType() {
|
|
48150
|
+
return __privateGet(this, _assertionExpressionType);
|
|
48151
|
+
}
|
|
48152
|
+
set assertionExpressionType(_) {
|
|
48153
|
+
__privateSet(this, _assertionExpressionType, _);
|
|
48154
|
+
}
|
|
48155
|
+
};
|
|
48156
|
+
_flags = new WeakMap();
|
|
48157
|
+
_resolvedType = new WeakMap();
|
|
48158
|
+
_resolvedEnumType = new WeakMap();
|
|
48159
|
+
_resolvedSignature = new WeakMap();
|
|
48160
|
+
_resolvedSymbol = new WeakMap();
|
|
48161
|
+
_resolvedIndexInfo = new WeakMap();
|
|
48162
|
+
_effectsSignature = new WeakMap();
|
|
48163
|
+
_switchTypes = new WeakMap();
|
|
48164
|
+
_contextFreeType = new WeakMap();
|
|
48165
|
+
_assertionExpressionType = new WeakMap();
|
|
48166
|
+
__decorateClass([
|
|
48167
|
+
SpeculatableCache
|
|
48168
|
+
], NodeLinks.prototype, "flags", 1);
|
|
48169
|
+
__decorateClass([
|
|
48170
|
+
SpeculatableCache
|
|
48171
|
+
], NodeLinks.prototype, "resolvedType", 1);
|
|
48172
|
+
__decorateClass([
|
|
48173
|
+
SpeculatableCache
|
|
48174
|
+
], NodeLinks.prototype, "resolvedEnumType", 1);
|
|
48175
|
+
__decorateClass([
|
|
48176
|
+
SpeculatableCache
|
|
48177
|
+
], NodeLinks.prototype, "resolvedSignature", 1);
|
|
48178
|
+
__decorateClass([
|
|
48179
|
+
SpeculatableCache
|
|
48180
|
+
], NodeLinks.prototype, "resolvedSymbol", 1);
|
|
48181
|
+
__decorateClass([
|
|
48182
|
+
SpeculatableCache
|
|
48183
|
+
], NodeLinks.prototype, "resolvedIndexInfo", 1);
|
|
48184
|
+
__decorateClass([
|
|
48185
|
+
SpeculatableCache
|
|
48186
|
+
], NodeLinks.prototype, "effectsSignature", 1);
|
|
48187
|
+
__decorateClass([
|
|
48188
|
+
SpeculatableCache
|
|
48189
|
+
], NodeLinks.prototype, "switchTypes", 1);
|
|
48190
|
+
__decorateClass([
|
|
48191
|
+
SpeculatableCache
|
|
48192
|
+
], NodeLinks.prototype, "contextFreeType", 1);
|
|
48193
|
+
__decorateClass([
|
|
48194
|
+
SpeculatableCache
|
|
48195
|
+
], NodeLinks.prototype, "assertionExpressionType", 1);
|
|
47920
48196
|
function getNodeId(node) {
|
|
47921
48197
|
if (!node.id) {
|
|
47922
48198
|
node.id = nextNodeId;
|
|
@@ -47936,7 +48212,18 @@ function isInstantiatedModule(node, preserveConstEnums) {
|
|
|
47936
48212
|
return moduleState === 1 /* Instantiated */ || preserveConstEnums && moduleState === 2 /* ConstEnumOnly */;
|
|
47937
48213
|
}
|
|
47938
48214
|
function createTypeChecker(host) {
|
|
47939
|
-
var
|
|
48215
|
+
var speculativeCaches = [];
|
|
48216
|
+
var currentSpeculativeEpoch = 0;
|
|
48217
|
+
var discardedSpeculativeEpochs = /* @__PURE__ */ new Set();
|
|
48218
|
+
var speculationHost = {
|
|
48219
|
+
getCurrentSpeculativeEpoch() {
|
|
48220
|
+
return currentSpeculativeEpoch;
|
|
48221
|
+
},
|
|
48222
|
+
getDiscardedSpeculativeEpochs() {
|
|
48223
|
+
return discardedSpeculativeEpochs;
|
|
48224
|
+
}
|
|
48225
|
+
};
|
|
48226
|
+
var deferredDiagnosticsCallbacks = registerSpeculativeCache([]);
|
|
47940
48227
|
var addLazyDiagnostic = (arg) => {
|
|
47941
48228
|
deferredDiagnosticsCallbacks.push(arg);
|
|
47942
48229
|
};
|
|
@@ -48872,12 +49159,12 @@ function createTypeChecker(host) {
|
|
|
48872
49159
|
var mergedSymbols = [];
|
|
48873
49160
|
var symbolLinks = [];
|
|
48874
49161
|
var nodeLinks = [];
|
|
48875
|
-
var flowLoopCaches = [];
|
|
48876
|
-
var flowLoopNodes = [];
|
|
48877
|
-
var flowLoopKeys = [];
|
|
48878
|
-
var flowLoopTypes = [];
|
|
48879
|
-
var sharedFlowNodes = [];
|
|
48880
|
-
var sharedFlowTypes = [];
|
|
49162
|
+
var flowLoopCaches = registerSpeculativeCache([]);
|
|
49163
|
+
var flowLoopNodes = registerSpeculativeCache([]);
|
|
49164
|
+
var flowLoopKeys = registerSpeculativeCache([]);
|
|
49165
|
+
var flowLoopTypes = registerSpeculativeCache([]);
|
|
49166
|
+
var sharedFlowNodes = registerSpeculativeCache([]);
|
|
49167
|
+
var sharedFlowTypes = registerSpeculativeCache([]);
|
|
48881
49168
|
var flowNodeReachable = [];
|
|
48882
49169
|
var flowNodePostSuper = [];
|
|
48883
49170
|
var potentialThisCollisions = [];
|
|
@@ -48886,17 +49173,17 @@ function createTypeChecker(host) {
|
|
|
48886
49173
|
var potentialReflectCollisions = [];
|
|
48887
49174
|
var potentialUnusedRenamedBindingElementsInTypes = [];
|
|
48888
49175
|
var awaitedTypeStack = [];
|
|
48889
|
-
var diagnostics = createDiagnosticCollection();
|
|
48890
|
-
var suggestionDiagnostics = createDiagnosticCollection();
|
|
49176
|
+
var diagnostics = registerSpeculativeCache(createDiagnosticCollection());
|
|
49177
|
+
var suggestionDiagnostics = registerSpeculativeCache(createDiagnosticCollection());
|
|
48891
49178
|
var typeofType = createTypeofType();
|
|
48892
49179
|
var _jsxNamespace;
|
|
48893
49180
|
var _jsxFactoryEntity;
|
|
48894
|
-
var subtypeRelation = /* @__PURE__ */ new Map();
|
|
48895
|
-
var strictSubtypeRelation = /* @__PURE__ */ new Map();
|
|
48896
|
-
var assignableRelation = /* @__PURE__ */ new Map();
|
|
48897
|
-
var comparableRelation = /* @__PURE__ */ new Map();
|
|
48898
|
-
var identityRelation = /* @__PURE__ */ new Map();
|
|
48899
|
-
var enumRelation = /* @__PURE__ */ new Map();
|
|
49181
|
+
var subtypeRelation = registerSpeculativeCache(/* @__PURE__ */ new Map());
|
|
49182
|
+
var strictSubtypeRelation = registerSpeculativeCache(/* @__PURE__ */ new Map());
|
|
49183
|
+
var assignableRelation = registerSpeculativeCache(/* @__PURE__ */ new Map());
|
|
49184
|
+
var comparableRelation = registerSpeculativeCache(/* @__PURE__ */ new Map());
|
|
49185
|
+
var identityRelation = registerSpeculativeCache(/* @__PURE__ */ new Map());
|
|
49186
|
+
var enumRelation = registerSpeculativeCache(/* @__PURE__ */ new Map());
|
|
48900
49187
|
var builtinGlobals = createSymbolTable();
|
|
48901
49188
|
builtinGlobals.set(undefinedSymbol.escapedName, undefinedSymbol);
|
|
48902
49189
|
var suggestedExtensions = [
|
|
@@ -49075,7 +49362,8 @@ function createTypeChecker(host) {
|
|
|
49075
49362
|
function createSymbol(flags, name, checkFlags) {
|
|
49076
49363
|
symbolCount++;
|
|
49077
49364
|
const symbol = new Symbol47(flags | 33554432 /* Transient */, name);
|
|
49078
|
-
symbol.
|
|
49365
|
+
symbol.epoch = currentSpeculativeEpoch;
|
|
49366
|
+
symbol.links = new SymbolLinks(speculationHost, symbol.epoch);
|
|
49079
49367
|
symbol.links.checkFlags = checkFlags || 0 /* None */;
|
|
49080
49368
|
return symbol;
|
|
49081
49369
|
}
|
|
@@ -49333,11 +49621,11 @@ function createTypeChecker(host) {
|
|
|
49333
49621
|
if (symbol.flags & 33554432 /* Transient */)
|
|
49334
49622
|
return symbol.links;
|
|
49335
49623
|
const id = getSymbolId(symbol);
|
|
49336
|
-
return symbolLinks[id] ?? (symbolLinks[id] = new SymbolLinks());
|
|
49624
|
+
return symbolLinks[id] ?? (symbolLinks[id] = new SymbolLinks(speculationHost));
|
|
49337
49625
|
}
|
|
49338
49626
|
function getNodeLinks(node) {
|
|
49339
49627
|
const nodeId = getNodeId(node);
|
|
49340
|
-
return nodeLinks[nodeId]
|
|
49628
|
+
return nodeLinks[nodeId] ?? (nodeLinks[nodeId] = new NodeLinks(speculationHost));
|
|
49341
49629
|
}
|
|
49342
49630
|
function isGlobalSourceFile(node) {
|
|
49343
49631
|
return node.kind === 307 /* SourceFile */ && !isExternalOrCommonJsModule(node);
|
|
@@ -59233,10 +59521,11 @@ function createTypeChecker(host) {
|
|
|
59233
59521
|
const modifiers = getMappedTypeModifiers(type);
|
|
59234
59522
|
return modifiers & 8 /* ExcludeOptional */ ? -1 : modifiers & 4 /* IncludeOptional */ ? 1 : 0;
|
|
59235
59523
|
}
|
|
59524
|
+
function getModifiersTypeOptionality(type) {
|
|
59525
|
+
return type.flags & 2097152 /* Intersection */ ? Math.max(...map(type.types, getModifiersTypeOptionality)) : getObjectFlags(type) & 32 /* Mapped */ ? getCombinedMappedTypeOptionality(type) : 0;
|
|
59526
|
+
}
|
|
59236
59527
|
function getCombinedMappedTypeOptionality(type) {
|
|
59237
|
-
|
|
59238
|
-
const modifiersType = getModifiersTypeFromMappedType(type);
|
|
59239
|
-
return optionality || (isGenericMappedType(modifiersType) ? getMappedTypeOptionality(modifiersType) : 0);
|
|
59528
|
+
return getMappedTypeOptionality(type) || getModifiersTypeOptionality(getModifiersTypeFromMappedType(type));
|
|
59240
59529
|
}
|
|
59241
59530
|
function isPartialMappedType(type) {
|
|
59242
59531
|
return !!(getObjectFlags(type) & 32 /* Mapped */ && getMappedTypeModifiers(type) & 4 /* IncludeOptional */);
|
|
@@ -63001,7 +63290,13 @@ function createTypeChecker(host) {
|
|
|
63001
63290
|
function substituteIndexedMappedType(objectType, index) {
|
|
63002
63291
|
const mapper = createTypeMapper([getTypeParameterFromMappedType(objectType)], [index]);
|
|
63003
63292
|
const templateMapper = combineTypeMappers(objectType.mapper, mapper);
|
|
63004
|
-
|
|
63293
|
+
const instantiatedTemplateType = instantiateType(getTemplateTypeFromMappedType(objectType.target || objectType), templateMapper);
|
|
63294
|
+
return addOptionality(
|
|
63295
|
+
instantiatedTemplateType,
|
|
63296
|
+
/*isProperty*/
|
|
63297
|
+
true,
|
|
63298
|
+
getCombinedMappedTypeOptionality(objectType) > 0
|
|
63299
|
+
);
|
|
63005
63300
|
}
|
|
63006
63301
|
function getIndexedAccessType(objectType, indexType, accessFlags = 0 /* None */, accessNode, aliasSymbol, aliasTypeArguments) {
|
|
63007
63302
|
return getIndexedAccessTypeOrUndefined(objectType, indexType, accessFlags, accessNode, aliasSymbol, aliasTypeArguments) || (accessNode ? errorType : unknownType);
|
|
@@ -63912,7 +64207,7 @@ function createTypeChecker(host) {
|
|
|
63912
64207
|
function getObjectTypeInstantiation(type, mapper, aliasSymbol, aliasTypeArguments) {
|
|
63913
64208
|
const declaration = type.objectFlags & 4 /* Reference */ ? type.node : type.objectFlags & 8388608 /* InstantiationExpressionType */ ? type.node : type.symbol.declarations[0];
|
|
63914
64209
|
const links = getNodeLinks(declaration);
|
|
63915
|
-
const target = type.objectFlags & 4 /* Reference */ ?
|
|
64210
|
+
const target = type.objectFlags & 4 /* Reference */ ? getTypeFromTypeNode(declaration) : type.objectFlags & 64 /* Instantiated */ ? type.target : type;
|
|
63916
64211
|
let typeParameters = links.outerTypeParameters;
|
|
63917
64212
|
if (!typeParameters) {
|
|
63918
64213
|
let outerTypeParameters = getOuterTypeParameters(
|
|
@@ -76406,8 +76701,8 @@ function createTypeChecker(host) {
|
|
|
76406
76701
|
Debug.assert(candidates.length, "Revert #54442 and add a testcase with whatever triggered this");
|
|
76407
76702
|
const args = getEffectiveCallArguments(node);
|
|
76408
76703
|
const isSingleNonGenericCandidate = candidates.length === 1 && !candidates[0].typeParameters;
|
|
76409
|
-
let argCheckMode = !isDecorator2 && !isSingleNonGenericCandidate && some(args, isContextSensitive) ? 4 /* SkipContextSensitive */ : 0 /* Normal */;
|
|
76410
76704
|
let candidatesForArgumentError;
|
|
76705
|
+
let candidateArgumentErrors;
|
|
76411
76706
|
let candidateForArgumentArityError;
|
|
76412
76707
|
let candidateForTypeArgumentError;
|
|
76413
76708
|
let result;
|
|
@@ -76438,18 +76733,10 @@ function createTypeChecker(host) {
|
|
|
76438
76733
|
if (headMessage) {
|
|
76439
76734
|
chain = chainDiagnosticMessages(chain, headMessage);
|
|
76440
76735
|
}
|
|
76441
|
-
const diags =
|
|
76442
|
-
node,
|
|
76443
|
-
args,
|
|
76444
|
-
last2,
|
|
76445
|
-
assignableRelation,
|
|
76446
|
-
0 /* Normal */,
|
|
76447
|
-
/*reportErrors*/
|
|
76448
|
-
true,
|
|
76449
|
-
() => chain
|
|
76450
|
-
);
|
|
76736
|
+
const diags = candidateArgumentErrors[candidateArgumentErrors.length - 1];
|
|
76451
76737
|
if (diags) {
|
|
76452
|
-
for (
|
|
76738
|
+
for (let d of diags) {
|
|
76739
|
+
d = prefixDiagnosticWithMessageChain(d, chain);
|
|
76453
76740
|
if (last2.declaration && candidatesForArgumentError.length > 3) {
|
|
76454
76741
|
addRelatedInfo(d, createDiagnosticForNode(last2.declaration, Diagnostics.The_last_overload_is_declared_here));
|
|
76455
76742
|
}
|
|
@@ -76474,23 +76761,14 @@ function createTypeChecker(host) {
|
|
|
76474
76761
|
candidates.length,
|
|
76475
76762
|
signatureToString(c)
|
|
76476
76763
|
);
|
|
76477
|
-
const diags2 =
|
|
76478
|
-
node,
|
|
76479
|
-
args,
|
|
76480
|
-
c,
|
|
76481
|
-
assignableRelation,
|
|
76482
|
-
0 /* Normal */,
|
|
76483
|
-
/*reportErrors*/
|
|
76484
|
-
true,
|
|
76485
|
-
chain2
|
|
76486
|
-
);
|
|
76764
|
+
const diags2 = candidateArgumentErrors[i];
|
|
76487
76765
|
if (diags2) {
|
|
76488
76766
|
if (diags2.length <= min2) {
|
|
76489
76767
|
min2 = diags2.length;
|
|
76490
76768
|
minIndex = i;
|
|
76491
76769
|
}
|
|
76492
76770
|
max = Math.max(max, diags2.length);
|
|
76493
|
-
allDiagnostics.push(diags2);
|
|
76771
|
+
allDiagnostics.push(map(diags2, (d) => prefixDiagnosticWithMessageChain(d, chain2())));
|
|
76494
76772
|
} else {
|
|
76495
76773
|
Debug.fail("No error for 3 or fewer overload signatures");
|
|
76496
76774
|
}
|
|
@@ -76539,6 +76817,7 @@ function createTypeChecker(host) {
|
|
|
76539
76817
|
function addImplementationSuccessElaboration(failed, diagnostic) {
|
|
76540
76818
|
var _a, _b;
|
|
76541
76819
|
const oldCandidatesForArgumentError = candidatesForArgumentError;
|
|
76820
|
+
const oldCandidateArgumentErrors = candidateArgumentErrors;
|
|
76542
76821
|
const oldCandidateForArgumentArityError = candidateForArgumentArityError;
|
|
76543
76822
|
const oldCandidateForTypeArgumentError = candidateForTypeArgumentError;
|
|
76544
76823
|
const failedSignatureDeclarations = ((_b = (_a = failed.declaration) == null ? void 0 : _a.symbol) == null ? void 0 : _b.declarations) || emptyArray;
|
|
@@ -76552,11 +76831,13 @@ function createTypeChecker(host) {
|
|
|
76552
76831
|
}
|
|
76553
76832
|
}
|
|
76554
76833
|
candidatesForArgumentError = oldCandidatesForArgumentError;
|
|
76834
|
+
candidateArgumentErrors = oldCandidateArgumentErrors;
|
|
76555
76835
|
candidateForArgumentArityError = oldCandidateForArgumentArityError;
|
|
76556
76836
|
candidateForTypeArgumentError = oldCandidateForTypeArgumentError;
|
|
76557
76837
|
}
|
|
76558
76838
|
function chooseOverload(candidates2, relation, isSingleNonGenericCandidate2, signatureHelpTrailingComma2 = false) {
|
|
76559
76839
|
candidatesForArgumentError = void 0;
|
|
76840
|
+
candidateArgumentErrors = void 0;
|
|
76560
76841
|
candidateForArgumentArityError = void 0;
|
|
76561
76842
|
candidateForTypeArgumentError = void 0;
|
|
76562
76843
|
if (isSingleNonGenericCandidate2) {
|
|
@@ -76564,101 +76845,113 @@ function createTypeChecker(host) {
|
|
|
76564
76845
|
if (some(typeArguments) || !hasCorrectArity(node, args, candidate, signatureHelpTrailingComma2)) {
|
|
76565
76846
|
return void 0;
|
|
76566
76847
|
}
|
|
76567
|
-
|
|
76848
|
+
let diags;
|
|
76849
|
+
if (diags = getSignatureApplicabilityError(
|
|
76568
76850
|
node,
|
|
76569
76851
|
args,
|
|
76570
76852
|
candidate,
|
|
76571
76853
|
relation,
|
|
76572
76854
|
0 /* Normal */,
|
|
76573
76855
|
/*reportErrors*/
|
|
76574
|
-
|
|
76856
|
+
relation === assignableRelation,
|
|
76575
76857
|
/*containingMessageChain*/
|
|
76576
76858
|
void 0
|
|
76577
76859
|
)) {
|
|
76578
76860
|
candidatesForArgumentError = [candidate];
|
|
76861
|
+
candidateArgumentErrors = [diags];
|
|
76579
76862
|
return void 0;
|
|
76580
76863
|
}
|
|
76581
76864
|
return candidate;
|
|
76582
76865
|
}
|
|
76866
|
+
const initialCheckMode = !isDecorator2 && !isSingleNonGenericCandidate2 && some(args, isContextSensitive) ? 4 /* SkipContextSensitive */ : 0 /* Normal */;
|
|
76583
76867
|
for (let candidateIndex = 0; candidateIndex < candidates2.length; candidateIndex++) {
|
|
76584
76868
|
const candidate = candidates2[candidateIndex];
|
|
76585
76869
|
if (!hasCorrectTypeArgumentArity(candidate, typeArguments) || !hasCorrectArity(node, args, candidate, signatureHelpTrailingComma2)) {
|
|
76586
76870
|
continue;
|
|
76587
76871
|
}
|
|
76588
|
-
|
|
76589
|
-
|
|
76590
|
-
|
|
76591
|
-
let
|
|
76592
|
-
if (
|
|
76593
|
-
typeArgumentTypes
|
|
76594
|
-
|
|
76595
|
-
|
|
76596
|
-
|
|
76597
|
-
|
|
76598
|
-
|
|
76599
|
-
|
|
76600
|
-
|
|
76601
|
-
|
|
76872
|
+
const result2 = speculate(() => {
|
|
76873
|
+
let argCheckMode = initialCheckMode;
|
|
76874
|
+
let checkCandidate;
|
|
76875
|
+
let inferenceContext;
|
|
76876
|
+
if (candidate.typeParameters) {
|
|
76877
|
+
let typeArgumentTypes;
|
|
76878
|
+
if (some(typeArguments)) {
|
|
76879
|
+
typeArgumentTypes = checkTypeArguments(
|
|
76880
|
+
candidate,
|
|
76881
|
+
typeArguments,
|
|
76882
|
+
/*reportErrors*/
|
|
76883
|
+
false
|
|
76884
|
+
);
|
|
76885
|
+
if (!typeArgumentTypes) {
|
|
76886
|
+
candidateForTypeArgumentError = candidate;
|
|
76887
|
+
return false;
|
|
76888
|
+
}
|
|
76889
|
+
} else {
|
|
76890
|
+
inferenceContext = createInferenceContext(
|
|
76891
|
+
candidate.typeParameters,
|
|
76892
|
+
candidate,
|
|
76893
|
+
/*flags*/
|
|
76894
|
+
isInJSFile(node) ? 2 /* AnyDefault */ : 0 /* None */
|
|
76895
|
+
);
|
|
76896
|
+
typeArgumentTypes = inferTypeArguments(node, candidate, args, argCheckMode | 8 /* SkipGenericFunctions */, inferenceContext);
|
|
76897
|
+
argCheckMode |= inferenceContext.flags & 4 /* SkippedGenericFunction */ ? 8 /* SkipGenericFunctions */ : 0 /* Normal */;
|
|
76602
76898
|
}
|
|
76603
|
-
|
|
76604
|
-
inferenceContext = createInferenceContext(
|
|
76605
|
-
candidate.typeParameters,
|
|
76606
|
-
candidate,
|
|
76607
|
-
/*flags*/
|
|
76608
|
-
isInJSFile(node) ? 2 /* AnyDefault */ : 0 /* None */
|
|
76609
|
-
);
|
|
76610
|
-
typeArgumentTypes = inferTypeArguments(node, candidate, args, argCheckMode | 8 /* SkipGenericFunctions */, inferenceContext);
|
|
76611
|
-
argCheckMode |= inferenceContext.flags & 4 /* SkippedGenericFunction */ ? 8 /* SkipGenericFunctions */ : 0 /* Normal */;
|
|
76612
|
-
}
|
|
76613
|
-
checkCandidate = getSignatureInstantiation(candidate, typeArgumentTypes, isInJSFile(candidate.declaration), inferenceContext && inferenceContext.inferredTypeParameters);
|
|
76614
|
-
if (getNonArrayRestType(candidate) && !hasCorrectArity(node, args, checkCandidate, signatureHelpTrailingComma2)) {
|
|
76615
|
-
candidateForArgumentArityError = checkCandidate;
|
|
76616
|
-
continue;
|
|
76617
|
-
}
|
|
76618
|
-
} else {
|
|
76619
|
-
checkCandidate = candidate;
|
|
76620
|
-
}
|
|
76621
|
-
if (getSignatureApplicabilityError(
|
|
76622
|
-
node,
|
|
76623
|
-
args,
|
|
76624
|
-
checkCandidate,
|
|
76625
|
-
relation,
|
|
76626
|
-
argCheckMode,
|
|
76627
|
-
/*reportErrors*/
|
|
76628
|
-
false,
|
|
76629
|
-
/*containingMessageChain*/
|
|
76630
|
-
void 0
|
|
76631
|
-
)) {
|
|
76632
|
-
(candidatesForArgumentError || (candidatesForArgumentError = [])).push(checkCandidate);
|
|
76633
|
-
continue;
|
|
76634
|
-
}
|
|
76635
|
-
if (argCheckMode) {
|
|
76636
|
-
argCheckMode = 0 /* Normal */;
|
|
76637
|
-
if (inferenceContext) {
|
|
76638
|
-
const typeArgumentTypes = inferTypeArguments(node, candidate, args, argCheckMode, inferenceContext);
|
|
76639
|
-
checkCandidate = getSignatureInstantiation(candidate, typeArgumentTypes, isInJSFile(candidate.declaration), inferenceContext.inferredTypeParameters);
|
|
76899
|
+
checkCandidate = getSignatureInstantiation(candidate, typeArgumentTypes, isInJSFile(candidate.declaration), inferenceContext && inferenceContext.inferredTypeParameters);
|
|
76640
76900
|
if (getNonArrayRestType(candidate) && !hasCorrectArity(node, args, checkCandidate, signatureHelpTrailingComma2)) {
|
|
76641
76901
|
candidateForArgumentArityError = checkCandidate;
|
|
76642
|
-
|
|
76902
|
+
return false;
|
|
76643
76903
|
}
|
|
76904
|
+
} else {
|
|
76905
|
+
checkCandidate = candidate;
|
|
76644
76906
|
}
|
|
76645
|
-
|
|
76907
|
+
let diags;
|
|
76908
|
+
if (diags = getSignatureApplicabilityError(
|
|
76646
76909
|
node,
|
|
76647
76910
|
args,
|
|
76648
76911
|
checkCandidate,
|
|
76649
76912
|
relation,
|
|
76650
76913
|
argCheckMode,
|
|
76651
76914
|
/*reportErrors*/
|
|
76652
|
-
|
|
76915
|
+
relation === assignableRelation,
|
|
76653
76916
|
/*containingMessageChain*/
|
|
76654
76917
|
void 0
|
|
76655
76918
|
)) {
|
|
76656
76919
|
(candidatesForArgumentError || (candidatesForArgumentError = [])).push(checkCandidate);
|
|
76657
|
-
|
|
76920
|
+
(candidateArgumentErrors || (candidateArgumentErrors = [])).push(diags);
|
|
76921
|
+
return false;
|
|
76658
76922
|
}
|
|
76923
|
+
if (argCheckMode) {
|
|
76924
|
+
argCheckMode = 0 /* Normal */;
|
|
76925
|
+
if (inferenceContext) {
|
|
76926
|
+
const typeArgumentTypes = inferTypeArguments(node, candidate, args, argCheckMode, inferenceContext);
|
|
76927
|
+
checkCandidate = getSignatureInstantiation(candidate, typeArgumentTypes, isInJSFile(candidate.declaration), inferenceContext.inferredTypeParameters);
|
|
76928
|
+
if (getNonArrayRestType(candidate) && !hasCorrectArity(node, args, checkCandidate, signatureHelpTrailingComma2)) {
|
|
76929
|
+
candidateForArgumentArityError = checkCandidate;
|
|
76930
|
+
return false;
|
|
76931
|
+
}
|
|
76932
|
+
}
|
|
76933
|
+
if (diags = getSignatureApplicabilityError(
|
|
76934
|
+
node,
|
|
76935
|
+
args,
|
|
76936
|
+
checkCandidate,
|
|
76937
|
+
relation,
|
|
76938
|
+
argCheckMode,
|
|
76939
|
+
/*reportErrors*/
|
|
76940
|
+
relation === assignableRelation,
|
|
76941
|
+
/*containingMessageChain*/
|
|
76942
|
+
void 0
|
|
76943
|
+
)) {
|
|
76944
|
+
(candidatesForArgumentError || (candidatesForArgumentError = [])).push(checkCandidate);
|
|
76945
|
+
(candidateArgumentErrors || (candidateArgumentErrors = [])).push(diags);
|
|
76946
|
+
return false;
|
|
76947
|
+
}
|
|
76948
|
+
}
|
|
76949
|
+
candidates2[candidateIndex] = checkCandidate;
|
|
76950
|
+
return checkCandidate;
|
|
76951
|
+
});
|
|
76952
|
+
if (result2) {
|
|
76953
|
+
return result2;
|
|
76659
76954
|
}
|
|
76660
|
-
candidates2[candidateIndex] = checkCandidate;
|
|
76661
|
-
return checkCandidate;
|
|
76662
76955
|
}
|
|
76663
76956
|
return void 0;
|
|
76664
76957
|
}
|
|
@@ -87844,6 +88137,78 @@ function createTypeChecker(host) {
|
|
|
87844
88137
|
}
|
|
87845
88138
|
return getDeclarationOfKind(moduleSymbol, 307 /* SourceFile */);
|
|
87846
88139
|
}
|
|
88140
|
+
function speculate(cb) {
|
|
88141
|
+
currentSpeculativeEpoch++;
|
|
88142
|
+
const startEpoch = currentSpeculativeEpoch;
|
|
88143
|
+
const initialState = snapshotCheckerState();
|
|
88144
|
+
const result = cb();
|
|
88145
|
+
const endEpoch = currentSpeculativeEpoch;
|
|
88146
|
+
currentSpeculativeEpoch++;
|
|
88147
|
+
if (!result) {
|
|
88148
|
+
for (let i = startEpoch; i <= endEpoch; i++) {
|
|
88149
|
+
discardedSpeculativeEpochs.add(i);
|
|
88150
|
+
}
|
|
88151
|
+
restoreCheckerState(initialState);
|
|
88152
|
+
return void 0;
|
|
88153
|
+
}
|
|
88154
|
+
return result;
|
|
88155
|
+
}
|
|
88156
|
+
function registerSpeculativeCache(collection) {
|
|
88157
|
+
speculativeCaches.push(collection);
|
|
88158
|
+
return collection;
|
|
88159
|
+
}
|
|
88160
|
+
function snapshotCheckerState() {
|
|
88161
|
+
const state = { restores: map(speculativeCaches, save) };
|
|
88162
|
+
return state;
|
|
88163
|
+
function save(cache) {
|
|
88164
|
+
if (Array.isArray(cache)) {
|
|
88165
|
+
return saveArray(cache);
|
|
88166
|
+
} else if (cache instanceof Map) {
|
|
88167
|
+
return saveMap(cache);
|
|
88168
|
+
} else if (cache instanceof Set) {
|
|
88169
|
+
return saveSet(cache);
|
|
88170
|
+
} else if (cache.add && cache.getDiagnostics) {
|
|
88171
|
+
return saveDiagnosticCollection(cache);
|
|
88172
|
+
}
|
|
88173
|
+
return Debug.fail("Unknown speculative cache type");
|
|
88174
|
+
}
|
|
88175
|
+
function saveArray(cache) {
|
|
88176
|
+
const original = cache.slice();
|
|
88177
|
+
return () => {
|
|
88178
|
+
cache.length = 0;
|
|
88179
|
+
cache.push(...original);
|
|
88180
|
+
};
|
|
88181
|
+
}
|
|
88182
|
+
function saveMap(cache) {
|
|
88183
|
+
const original = arrayFrom(cache.entries());
|
|
88184
|
+
return () => {
|
|
88185
|
+
cache.clear();
|
|
88186
|
+
for (const [k, v] of original) {
|
|
88187
|
+
cache.set(k, v);
|
|
88188
|
+
}
|
|
88189
|
+
};
|
|
88190
|
+
}
|
|
88191
|
+
function saveSet(cache) {
|
|
88192
|
+
const original = arrayFrom(cache.entries());
|
|
88193
|
+
return () => {
|
|
88194
|
+
cache.clear();
|
|
88195
|
+
for (const [_, v] of original) {
|
|
88196
|
+
cache.add(v);
|
|
88197
|
+
}
|
|
88198
|
+
};
|
|
88199
|
+
}
|
|
88200
|
+
function saveDiagnosticCollection(cache) {
|
|
88201
|
+
const c = cache.checkpoint();
|
|
88202
|
+
return () => {
|
|
88203
|
+
cache.revert(c);
|
|
88204
|
+
};
|
|
88205
|
+
}
|
|
88206
|
+
}
|
|
88207
|
+
function restoreCheckerState(state) {
|
|
88208
|
+
for (const restore of state.restores) {
|
|
88209
|
+
restore();
|
|
88210
|
+
}
|
|
88211
|
+
}
|
|
87847
88212
|
function initializeTypeChecker() {
|
|
87848
88213
|
for (const file of host.getSourceFiles()) {
|
|
87849
88214
|
bindSourceFile(file, compilerOptions);
|
|
@@ -136020,7 +136385,7 @@ function createDocumentRegistryInternal(useCaseSensitiveFileNames2, currentDirec
|
|
|
136020
136385
|
let entry = bucketEntry && getDocumentRegistryEntry(bucketEntry, scriptKind);
|
|
136021
136386
|
if (!entry && externalCache) {
|
|
136022
136387
|
const sourceFile = externalCache.getDocument(keyWithMode, path);
|
|
136023
|
-
if (sourceFile) {
|
|
136388
|
+
if (sourceFile && sourceFile.scriptKind === scriptKind && sourceFile.text === getSnapshotText(scriptSnapshot)) {
|
|
136024
136389
|
Debug.assert(acquiring);
|
|
136025
136390
|
entry = {
|
|
136026
136391
|
sourceFile,
|
|
@@ -158476,9 +158841,6 @@ function createCompletionEntry(symbol, sortText, replacementToken, contextToken,
|
|
|
158476
158841
|
const memberCompletionEntry = getEntryForMemberCompletion(host, program, options, preferences, name, symbol, location, position, contextToken, formatContext);
|
|
158477
158842
|
if (memberCompletionEntry) {
|
|
158478
158843
|
({ insertText, filterText, isSnippet, importAdder } = memberCompletionEntry);
|
|
158479
|
-
if (memberCompletionEntry.eraseRange) {
|
|
158480
|
-
replacementSpan = createTextSpanFromBounds(memberCompletionEntry.eraseRange.pos, memberCompletionEntry.eraseRange.end);
|
|
158481
|
-
}
|
|
158482
158844
|
if (importAdder == null ? void 0 : importAdder.hasFixes()) {
|
|
158483
158845
|
hasAction = true;
|
|
158484
158846
|
source = "ClassMemberSnippet/" /* ClassMemberSnippet */;
|
|
@@ -158560,7 +158922,7 @@ function getEntryForMemberCompletion(host, program, options, preferences, name,
|
|
|
158560
158922
|
}
|
|
158561
158923
|
let isSnippet;
|
|
158562
158924
|
let insertText = name;
|
|
158563
|
-
|
|
158925
|
+
const filterText = name;
|
|
158564
158926
|
const checker = program.getTypeChecker();
|
|
158565
158927
|
const sourceFile = location.getSourceFile();
|
|
158566
158928
|
const printer = createSnippetPrinter({
|
|
@@ -158589,10 +158951,7 @@ function getEntryForMemberCompletion(host, program, options, preferences, name,
|
|
|
158589
158951
|
);
|
|
158590
158952
|
}
|
|
158591
158953
|
let modifiers = 0 /* None */;
|
|
158592
|
-
const { modifiers: presentModifiers, range: eraseRange, decorators: presentDecorators
|
|
158593
|
-
if (modifiersFilterText) {
|
|
158594
|
-
filterText = modifiersFilterText + filterText;
|
|
158595
|
-
}
|
|
158954
|
+
const { modifiers: presentModifiers, range: eraseRange, decorators: presentDecorators } = getPresentModifiers(contextToken, sourceFile, position);
|
|
158596
158955
|
const isAbstract = presentModifiers & 64 /* Abstract */ && classLikeDeclaration.modifierFlagsCache & 64 /* Abstract */;
|
|
158597
158956
|
let completionNodes = [];
|
|
158598
158957
|
ts_codefix_exports.addNewNodeForMemberSymbol(
|
|
@@ -158677,31 +159036,21 @@ function getPresentModifiers(contextToken, sourceFile, position) {
|
|
|
158677
159036
|
}
|
|
158678
159037
|
let modifiers = 0 /* None */;
|
|
158679
159038
|
let decorators;
|
|
158680
|
-
let
|
|
158681
|
-
const contextMod = isModifierLike2(contextToken);
|
|
159039
|
+
let contextMod;
|
|
158682
159040
|
const range = { pos: position, end: position };
|
|
158683
159041
|
if (isPropertyDeclaration(contextToken.parent) && contextToken.parent.modifiers) {
|
|
158684
159042
|
modifiers |= modifiersToFlags(contextToken.parent.modifiers) & 98303 /* Modifier */;
|
|
158685
159043
|
decorators = contextToken.parent.modifiers.filter(isDecorator) || [];
|
|
158686
|
-
|
|
158687
|
-
if (firstModifier) {
|
|
158688
|
-
range.pos = Math.min(range.pos, firstModifier.getStart(sourceFile));
|
|
158689
|
-
if (contextToken.parent.name !== contextToken) {
|
|
158690
|
-
filterTextEnd = contextToken.parent.name.getStart(sourceFile);
|
|
158691
|
-
}
|
|
158692
|
-
}
|
|
159044
|
+
range.pos = Math.min(range.pos, contextToken.parent.modifiers.pos);
|
|
158693
159045
|
}
|
|
158694
|
-
if (contextMod) {
|
|
159046
|
+
if (contextMod = isModifierLike2(contextToken)) {
|
|
158695
159047
|
const contextModifierFlag = modifierToFlag(contextMod);
|
|
158696
159048
|
if (!(modifiers & contextModifierFlag)) {
|
|
158697
159049
|
modifiers |= contextModifierFlag;
|
|
158698
|
-
range.pos = Math.min(range.pos, contextToken.
|
|
159050
|
+
range.pos = Math.min(range.pos, contextToken.pos);
|
|
158699
159051
|
}
|
|
158700
159052
|
}
|
|
158701
|
-
|
|
158702
|
-
return { modifiers, decorators };
|
|
158703
|
-
}
|
|
158704
|
-
return { modifiers, decorators, range, filterText: sourceFile.text.slice(range.pos, filterTextEnd ?? position) };
|
|
159053
|
+
return { modifiers, decorators, range: range.pos !== position ? range : void 0 };
|
|
158705
159054
|
}
|
|
158706
159055
|
function isModifierLike2(node) {
|
|
158707
159056
|
if (isModifier(node)) {
|
|
@@ -173279,6 +173628,7 @@ __export(ts_exports2, {
|
|
|
173279
173628
|
NodeCheckFlags: () => NodeCheckFlags,
|
|
173280
173629
|
NodeFactoryFlags: () => NodeFactoryFlags,
|
|
173281
173630
|
NodeFlags: () => NodeFlags,
|
|
173631
|
+
NodeLinks: () => NodeLinks,
|
|
173282
173632
|
NodeResolutionFeatures: () => NodeResolutionFeatures,
|
|
173283
173633
|
ObjectFlags: () => ObjectFlags,
|
|
173284
173634
|
OperationCanceledException: () => OperationCanceledException,
|
|
@@ -173316,12 +173666,14 @@ __export(ts_exports2, {
|
|
|
173316
173666
|
SmartSelectionRange: () => ts_SmartSelectionRange_exports,
|
|
173317
173667
|
SnippetKind: () => SnippetKind,
|
|
173318
173668
|
SortKind: () => SortKind,
|
|
173669
|
+
SpeculatableLinks: () => SpeculatableLinks,
|
|
173319
173670
|
StructureIsReused: () => StructureIsReused,
|
|
173320
173671
|
SymbolAccessibility: () => SymbolAccessibility,
|
|
173321
173672
|
SymbolDisplay: () => ts_SymbolDisplay_exports,
|
|
173322
173673
|
SymbolDisplayPartKind: () => SymbolDisplayPartKind,
|
|
173323
173674
|
SymbolFlags: () => SymbolFlags,
|
|
173324
173675
|
SymbolFormatFlags: () => SymbolFormatFlags,
|
|
173676
|
+
SymbolLinks: () => SymbolLinks,
|
|
173325
173677
|
SyntaxKind: () => SyntaxKind,
|
|
173326
173678
|
SyntheticSymbolKind: () => SyntheticSymbolKind,
|
|
173327
173679
|
Ternary: () => Ternary,
|
|
@@ -175146,6 +175498,7 @@ __export(ts_exports2, {
|
|
|
175146
175498
|
positionIsSynthesized: () => positionIsSynthesized,
|
|
175147
175499
|
positionsAreOnSameLine: () => positionsAreOnSameLine,
|
|
175148
175500
|
preProcessFile: () => preProcessFile,
|
|
175501
|
+
prefixDiagnosticWithMessageChain: () => prefixDiagnosticWithMessageChain,
|
|
175149
175502
|
probablyUsesSemicolons: () => probablyUsesSemicolons,
|
|
175150
175503
|
processCommentPragmas: () => processCommentPragmas,
|
|
175151
175504
|
processPragmasIntoFields: () => processPragmasIntoFields,
|
|
@@ -187516,7 +187869,7 @@ function initializeNodeSystem() {
|
|
|
187516
187869
|
canWrite() {
|
|
187517
187870
|
return this.fd >= 0 || this.traceToConsole;
|
|
187518
187871
|
}
|
|
187519
|
-
write(s,
|
|
187872
|
+
write(s, _type2) {
|
|
187520
187873
|
if (this.fd >= 0) {
|
|
187521
187874
|
const buf = sys2.bufferFrom(s);
|
|
187522
187875
|
fs.writeSync(
|
|
@@ -188054,6 +188407,7 @@ start(initializeNodeSystem(), require("os").platform());
|
|
|
188054
188407
|
NodeCheckFlags,
|
|
188055
188408
|
NodeFactoryFlags,
|
|
188056
188409
|
NodeFlags,
|
|
188410
|
+
NodeLinks,
|
|
188057
188411
|
NodeResolutionFeatures,
|
|
188058
188412
|
ObjectFlags,
|
|
188059
188413
|
OperationCanceledException,
|
|
@@ -188091,12 +188445,14 @@ start(initializeNodeSystem(), require("os").platform());
|
|
|
188091
188445
|
SmartSelectionRange,
|
|
188092
188446
|
SnippetKind,
|
|
188093
188447
|
SortKind,
|
|
188448
|
+
SpeculatableLinks,
|
|
188094
188449
|
StructureIsReused,
|
|
188095
188450
|
SymbolAccessibility,
|
|
188096
188451
|
SymbolDisplay,
|
|
188097
188452
|
SymbolDisplayPartKind,
|
|
188098
188453
|
SymbolFlags,
|
|
188099
188454
|
SymbolFormatFlags,
|
|
188455
|
+
SymbolLinks,
|
|
188100
188456
|
SyntaxKind,
|
|
188101
188457
|
SyntheticSymbolKind,
|
|
188102
188458
|
Ternary,
|
|
@@ -189921,6 +190277,7 @@ start(initializeNodeSystem(), require("os").platform());
|
|
|
189921
190277
|
positionIsSynthesized,
|
|
189922
190278
|
positionsAreOnSameLine,
|
|
189923
190279
|
preProcessFile,
|
|
190280
|
+
prefixDiagnosticWithMessageChain,
|
|
189924
190281
|
probablyUsesSemicolons,
|
|
189925
190282
|
processCommentPragmas,
|
|
189926
190283
|
processPragmasIntoFields,
|