@typescript-deploys/pr-build 5.1.0-pr-52226-2 → 5.1.0-pr-52845-10
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 +271 -231
- package/lib/tsserver.js +341 -293
- package/lib/tsserverlibrary.d.ts +48 -0
- package/lib/tsserverlibrary.js +342 -293
- package/lib/typescript.d.ts +48 -0
- package/lib/typescript.js +342 -292
- package/lib/typingsInstaller.js +127 -3797
- package/package.json +3 -2
package/lib/tsserver.js
CHANGED
|
@@ -62,7 +62,6 @@ __export(server_exports, {
|
|
|
62
62
|
ContextFlags: () => ContextFlags,
|
|
63
63
|
CoreServicesShimHostAdapter: () => CoreServicesShimHostAdapter,
|
|
64
64
|
Debug: () => Debug,
|
|
65
|
-
DeprecationVersion: () => DeprecationVersion,
|
|
66
65
|
DiagnosticCategory: () => DiagnosticCategory,
|
|
67
66
|
Diagnostics: () => Diagnostics,
|
|
68
67
|
DocumentHighlights: () => DocumentHighlights,
|
|
@@ -2286,7 +2285,7 @@ module.exports = __toCommonJS(server_exports);
|
|
|
2286
2285
|
|
|
2287
2286
|
// src/compiler/corePublic.ts
|
|
2288
2287
|
var versionMajorMinor = "5.1";
|
|
2289
|
-
var version = `${versionMajorMinor}.0-insiders.
|
|
2288
|
+
var version = `${versionMajorMinor}.0-insiders.20230308`;
|
|
2290
2289
|
var Comparison = /* @__PURE__ */ ((Comparison3) => {
|
|
2291
2290
|
Comparison3[Comparison3["LessThan"] = -1] = "LessThan";
|
|
2292
2291
|
Comparison3[Comparison3["EqualTo"] = 0] = "EqualTo";
|
|
@@ -6843,6 +6842,7 @@ function diagnosticCategoryName(d, lowerCase = true) {
|
|
|
6843
6842
|
}
|
|
6844
6843
|
var ModuleResolutionKind = /* @__PURE__ */ ((ModuleResolutionKind3) => {
|
|
6845
6844
|
ModuleResolutionKind3[ModuleResolutionKind3["Classic"] = 1] = "Classic";
|
|
6845
|
+
ModuleResolutionKind3[ModuleResolutionKind3["NodeJs"] = 2] = "NodeJs";
|
|
6846
6846
|
ModuleResolutionKind3[ModuleResolutionKind3["Node10"] = 2] = "Node10";
|
|
6847
6847
|
ModuleResolutionKind3[ModuleResolutionKind3["Node16"] = 3] = "Node16";
|
|
6848
6848
|
ModuleResolutionKind3[ModuleResolutionKind3["NodeNext"] = 99] = "NodeNext";
|
|
@@ -7407,12 +7407,6 @@ var commentPragmas = {
|
|
|
7407
7407
|
kind: 4 /* MultiLine */
|
|
7408
7408
|
}
|
|
7409
7409
|
};
|
|
7410
|
-
var DeprecationVersion = /* @__PURE__ */ ((DeprecationVersion2) => {
|
|
7411
|
-
DeprecationVersion2["v5_0"] = "5.0";
|
|
7412
|
-
DeprecationVersion2["v5_5"] = "5.5";
|
|
7413
|
-
DeprecationVersion2["v6_0"] = "6.0";
|
|
7414
|
-
return DeprecationVersion2;
|
|
7415
|
-
})(DeprecationVersion || {});
|
|
7416
7410
|
|
|
7417
7411
|
// src/compiler/sys.ts
|
|
7418
7412
|
function generateDjb2Hash(data) {
|
|
@@ -10316,12 +10310,14 @@ var Diagnostics = {
|
|
|
10316
10310
|
Option_allowImportingTsExtensions_can_only_be_used_when_either_noEmit_or_emitDeclarationOnly_is_set: diag(5096, 1 /* Error */, "Option_allowImportingTsExtensions_can_only_be_used_when_either_noEmit_or_emitDeclarationOnly_is_set_5096", "Option 'allowImportingTsExtensions' can only be used when either 'noEmit' or 'emitDeclarationOnly' is set."),
|
|
10317
10311
|
An_import_path_can_only_end_with_a_0_extension_when_allowImportingTsExtensions_is_enabled: diag(5097, 1 /* Error */, "An_import_path_can_only_end_with_a_0_extension_when_allowImportingTsExtensions_is_enabled_5097", "An import path can only end with a '{0}' extension when 'allowImportingTsExtensions' is enabled."),
|
|
10318
10312
|
Option_0_can_only_be_used_when_moduleResolution_is_set_to_node16_nodenext_or_bundler: diag(5098, 1 /* Error */, "Option_0_can_only_be_used_when_moduleResolution_is_set_to_node16_nodenext_or_bundler_5098", "Option '{0}' can only be used when 'moduleResolution' is set to 'node16', 'nodenext', or 'bundler'."),
|
|
10319
|
-
|
|
10320
|
-
|
|
10313
|
+
Option_0_is_deprecated_and_will_stop_functioning_in_TypeScript_1_Specify_compilerOption_ignoreDeprecations_Colon_2_to_silence_this_error: diag(5101, 1 /* Error */, "Option_0_is_deprecated_and_will_stop_functioning_in_TypeScript_1_Specify_compilerOption_ignoreDeprec_5101", `Option '{0}' is deprecated and will stop functioning in TypeScript {1}. Specify compilerOption '"ignoreDeprecations": "{2}"' to silence this error.`),
|
|
10314
|
+
Option_0_has_been_removed_Please_remove_it_from_your_configuration: diag(5102, 1 /* Error */, "Option_0_has_been_removed_Please_remove_it_from_your_configuration_5102", "Option '{0}' has been removed. Please remove it from your configuration."),
|
|
10321
10315
|
Invalid_value_for_ignoreDeprecations: diag(5103, 1 /* Error */, "Invalid_value_for_ignoreDeprecations_5103", "Invalid value for '--ignoreDeprecations'."),
|
|
10322
10316
|
Option_0_is_redundant_and_cannot_be_specified_with_option_1: diag(5104, 1 /* Error */, "Option_0_is_redundant_and_cannot_be_specified_with_option_1_5104", "Option '{0}' is redundant and cannot be specified with option '{1}'."),
|
|
10323
10317
|
Option_verbatimModuleSyntax_cannot_be_used_when_module_is_set_to_UMD_AMD_or_System: diag(5105, 1 /* Error */, "Option_verbatimModuleSyntax_cannot_be_used_when_module_is_set_to_UMD_AMD_or_System_5105", "Option 'verbatimModuleSyntax' cannot be used when 'module' is set to 'UMD', 'AMD', or 'System'."),
|
|
10324
10318
|
Use_0_instead: diag(5106, 3 /* Message */, "Use_0_instead_5106", "Use '{0}' instead."),
|
|
10319
|
+
Option_0_1_is_deprecated_and_will_stop_functioning_in_TypeScript_2_Specify_compilerOption_ignoreDeprecations_Colon_3_to_silence_this_error: diag(5107, 1 /* Error */, "Option_0_1_is_deprecated_and_will_stop_functioning_in_TypeScript_2_Specify_compilerOption_ignoreDepr_5107", `Option '{0}={1}' is deprecated and will stop functioning in TypeScript {2}. Specify compilerOption '"ignoreDeprecations": "{3}"' to silence this error.`),
|
|
10320
|
+
Option_0_1_has_been_removed_Please_remove_it_from_your_configuration: diag(5108, 1 /* Error */, "Option_0_1_has_been_removed_Please_remove_it_from_your_configuration_5108", "Option '{0}={1}' has been removed. Please remove it from your configuration."),
|
|
10325
10321
|
Generates_a_sourcemap_for_each_corresponding_d_ts_file: diag(6e3, 3 /* Message */, "Generates_a_sourcemap_for_each_corresponding_d_ts_file_6000", "Generates a sourcemap for each corresponding '.d.ts' file."),
|
|
10326
10322
|
Concatenate_and_emit_output_to_single_file: diag(6001, 3 /* Message */, "Concatenate_and_emit_output_to_single_file_6001", "Concatenate and emit output to single file."),
|
|
10327
10323
|
Generates_corresponding_d_ts_file: diag(6002, 3 /* Message */, "Generates_corresponding_d_ts_file_6002", "Generates corresponding '.d.ts' file."),
|
|
@@ -11916,8 +11912,8 @@ function createScanner(languageVersion, skipTrivia2, languageVariant = 0 /* Stan
|
|
|
11916
11912
|
var text = textInitial;
|
|
11917
11913
|
var pos;
|
|
11918
11914
|
var end;
|
|
11919
|
-
var
|
|
11920
|
-
var
|
|
11915
|
+
var fullStartPos;
|
|
11916
|
+
var tokenStart;
|
|
11921
11917
|
var token;
|
|
11922
11918
|
var tokenValue;
|
|
11923
11919
|
var tokenFlags;
|
|
@@ -11925,11 +11921,14 @@ function createScanner(languageVersion, skipTrivia2, languageVariant = 0 /* Stan
|
|
|
11925
11921
|
var inJSDocType = 0;
|
|
11926
11922
|
setText(text, start2, length2);
|
|
11927
11923
|
var scanner2 = {
|
|
11928
|
-
|
|
11924
|
+
getTokenFullStart: () => fullStartPos,
|
|
11925
|
+
getStartPos: () => fullStartPos,
|
|
11926
|
+
getTokenEnd: () => pos,
|
|
11929
11927
|
getTextPos: () => pos,
|
|
11930
11928
|
getToken: () => token,
|
|
11931
|
-
|
|
11932
|
-
|
|
11929
|
+
getTokenStart: () => tokenStart,
|
|
11930
|
+
getTokenPos: () => tokenStart,
|
|
11931
|
+
getTokenText: () => text.substring(tokenStart, pos),
|
|
11933
11932
|
getTokenValue: () => tokenValue,
|
|
11934
11933
|
hasUnicodeEscape: () => (tokenFlags & 1024 /* UnicodeEscape */) !== 0,
|
|
11935
11934
|
hasExtendedUnicodeEscape: () => (tokenFlags & 8 /* ExtendedUnicodeEscape */) !== 0,
|
|
@@ -11963,7 +11962,8 @@ function createScanner(languageVersion, skipTrivia2, languageVariant = 0 /* Stan
|
|
|
11963
11962
|
setScriptTarget,
|
|
11964
11963
|
setLanguageVariant,
|
|
11965
11964
|
setOnError,
|
|
11966
|
-
|
|
11965
|
+
resetTokenState,
|
|
11966
|
+
setTextPos: resetTokenState,
|
|
11967
11967
|
setInJSDocType,
|
|
11968
11968
|
tryScan,
|
|
11969
11969
|
lookAhead,
|
|
@@ -11973,7 +11973,7 @@ function createScanner(languageVersion, skipTrivia2, languageVariant = 0 /* Stan
|
|
|
11973
11973
|
Object.defineProperty(scanner2, "__debugShowCurrentPositionInText", {
|
|
11974
11974
|
get: () => {
|
|
11975
11975
|
const text2 = scanner2.getText();
|
|
11976
|
-
return text2.slice(0, scanner2.
|
|
11976
|
+
return text2.slice(0, scanner2.getTokenFullStart()) + "\u2551" + text2.slice(scanner2.getTokenFullStart());
|
|
11977
11977
|
}
|
|
11978
11978
|
});
|
|
11979
11979
|
}
|
|
@@ -12496,11 +12496,11 @@ function createScanner(languageVersion, skipTrivia2, languageVariant = 0 /* Stan
|
|
|
12496
12496
|
}
|
|
12497
12497
|
}
|
|
12498
12498
|
function scan() {
|
|
12499
|
-
|
|
12499
|
+
fullStartPos = pos;
|
|
12500
12500
|
tokenFlags = 0 /* None */;
|
|
12501
12501
|
let asteriskSeen = false;
|
|
12502
12502
|
while (true) {
|
|
12503
|
-
|
|
12503
|
+
tokenStart = pos;
|
|
12504
12504
|
if (pos >= end) {
|
|
12505
12505
|
return token = 1 /* EndOfFileToken */;
|
|
12506
12506
|
}
|
|
@@ -12659,9 +12659,9 @@ function createScanner(languageVersion, skipTrivia2, languageVariant = 0 /* Stan
|
|
|
12659
12659
|
}
|
|
12660
12660
|
commentDirectives = appendIfCommentDirective(
|
|
12661
12661
|
commentDirectives,
|
|
12662
|
-
text.slice(
|
|
12662
|
+
text.slice(tokenStart, pos),
|
|
12663
12663
|
commentDirectiveRegExSingleLine,
|
|
12664
|
-
|
|
12664
|
+
tokenStart
|
|
12665
12665
|
);
|
|
12666
12666
|
if (skipTrivia2) {
|
|
12667
12667
|
continue;
|
|
@@ -12675,7 +12675,7 @@ function createScanner(languageVersion, skipTrivia2, languageVariant = 0 /* Stan
|
|
|
12675
12675
|
tokenFlags |= 2 /* PrecedingJSDocComment */;
|
|
12676
12676
|
}
|
|
12677
12677
|
let commentClosed = false;
|
|
12678
|
-
let lastLineStart =
|
|
12678
|
+
let lastLineStart = tokenStart;
|
|
12679
12679
|
while (pos < end) {
|
|
12680
12680
|
const ch2 = text.charCodeAt(pos);
|
|
12681
12681
|
if (ch2 === 42 /* asterisk */ && text.charCodeAt(pos + 1) === 47 /* slash */) {
|
|
@@ -12953,7 +12953,7 @@ function createScanner(languageVersion, skipTrivia2, languageVariant = 0 /* Stan
|
|
|
12953
12953
|
}
|
|
12954
12954
|
function reScanInvalidIdentifier() {
|
|
12955
12955
|
Debug.assert(token === 0 /* Unknown */, "'reScanInvalidIdentifier' should only be called when the current token is 'SyntaxKind.Unknown'.");
|
|
12956
|
-
pos =
|
|
12956
|
+
pos = tokenStart = fullStartPos;
|
|
12957
12957
|
tokenFlags = 0;
|
|
12958
12958
|
const ch = codePointAt(text, pos);
|
|
12959
12959
|
const identifierKind = scanIdentifier(ch, 99 /* ESNext */);
|
|
@@ -12969,7 +12969,7 @@ function createScanner(languageVersion, skipTrivia2, languageVariant = 0 /* Stan
|
|
|
12969
12969
|
pos += charSize(ch);
|
|
12970
12970
|
while (pos < end && isIdentifierPart(ch = codePointAt(text, pos), languageVersion2))
|
|
12971
12971
|
pos += charSize(ch);
|
|
12972
|
-
tokenValue = text.substring(
|
|
12972
|
+
tokenValue = text.substring(tokenStart, pos);
|
|
12973
12973
|
if (ch === 92 /* backslash */) {
|
|
12974
12974
|
tokenValue += scanIdentifierParts();
|
|
12975
12975
|
}
|
|
@@ -13000,12 +13000,12 @@ function createScanner(languageVersion, skipTrivia2, languageVariant = 0 /* Stan
|
|
|
13000
13000
|
}
|
|
13001
13001
|
function reScanAsteriskEqualsToken() {
|
|
13002
13002
|
Debug.assert(token === 66 /* AsteriskEqualsToken */, "'reScanAsteriskEqualsToken' should only be called on a '*='");
|
|
13003
|
-
pos =
|
|
13003
|
+
pos = tokenStart + 1;
|
|
13004
13004
|
return token = 63 /* EqualsToken */;
|
|
13005
13005
|
}
|
|
13006
13006
|
function reScanSlashToken() {
|
|
13007
13007
|
if (token === 43 /* SlashToken */ || token === 68 /* SlashEqualsToken */) {
|
|
13008
|
-
let p =
|
|
13008
|
+
let p = tokenStart + 1;
|
|
13009
13009
|
let inEscape = false;
|
|
13010
13010
|
let inCharacterClass = false;
|
|
13011
13011
|
while (true) {
|
|
@@ -13038,7 +13038,7 @@ function createScanner(languageVersion, skipTrivia2, languageVariant = 0 /* Stan
|
|
|
13038
13038
|
p++;
|
|
13039
13039
|
}
|
|
13040
13040
|
pos = p;
|
|
13041
|
-
tokenValue = text.substring(
|
|
13041
|
+
tokenValue = text.substring(tokenStart, pos);
|
|
13042
13042
|
token = 13 /* RegularExpressionLiteral */;
|
|
13043
13043
|
}
|
|
13044
13044
|
return token;
|
|
@@ -13071,41 +13071,41 @@ function createScanner(languageVersion, skipTrivia2, languageVariant = 0 /* Stan
|
|
|
13071
13071
|
}
|
|
13072
13072
|
function reScanTemplateToken(isTaggedTemplate) {
|
|
13073
13073
|
Debug.assert(token === 19 /* CloseBraceToken */, "'reScanTemplateToken' should only be called on a '}'");
|
|
13074
|
-
pos =
|
|
13074
|
+
pos = tokenStart;
|
|
13075
13075
|
return token = scanTemplateAndSetTokenValue(isTaggedTemplate);
|
|
13076
13076
|
}
|
|
13077
13077
|
function reScanTemplateHeadOrNoSubstitutionTemplate() {
|
|
13078
|
-
pos =
|
|
13078
|
+
pos = tokenStart;
|
|
13079
13079
|
return token = scanTemplateAndSetTokenValue(
|
|
13080
13080
|
/* isTaggedTemplate */
|
|
13081
13081
|
true
|
|
13082
13082
|
);
|
|
13083
13083
|
}
|
|
13084
13084
|
function reScanJsxToken(allowMultilineJsxText = true) {
|
|
13085
|
-
pos =
|
|
13085
|
+
pos = tokenStart = fullStartPos;
|
|
13086
13086
|
return token = scanJsxToken(allowMultilineJsxText);
|
|
13087
13087
|
}
|
|
13088
13088
|
function reScanLessThanToken() {
|
|
13089
13089
|
if (token === 47 /* LessThanLessThanToken */) {
|
|
13090
|
-
pos =
|
|
13090
|
+
pos = tokenStart + 1;
|
|
13091
13091
|
return token = 29 /* LessThanToken */;
|
|
13092
13092
|
}
|
|
13093
13093
|
return token;
|
|
13094
13094
|
}
|
|
13095
13095
|
function reScanHashToken() {
|
|
13096
13096
|
if (token === 80 /* PrivateIdentifier */) {
|
|
13097
|
-
pos =
|
|
13097
|
+
pos = tokenStart + 1;
|
|
13098
13098
|
return token = 62 /* HashToken */;
|
|
13099
13099
|
}
|
|
13100
13100
|
return token;
|
|
13101
13101
|
}
|
|
13102
13102
|
function reScanQuestionToken() {
|
|
13103
13103
|
Debug.assert(token === 60 /* QuestionQuestionToken */, "'reScanQuestionToken' should only be called on a '??'");
|
|
13104
|
-
pos =
|
|
13104
|
+
pos = tokenStart + 1;
|
|
13105
13105
|
return token = 57 /* QuestionToken */;
|
|
13106
13106
|
}
|
|
13107
13107
|
function scanJsxToken(allowMultilineJsxText = true) {
|
|
13108
|
-
|
|
13108
|
+
fullStartPos = tokenStart = pos;
|
|
13109
13109
|
if (pos >= end) {
|
|
13110
13110
|
return token = 1 /* EndOfFileToken */;
|
|
13111
13111
|
}
|
|
@@ -13150,7 +13150,7 @@ function createScanner(languageVersion, skipTrivia2, languageVariant = 0 /* Stan
|
|
|
13150
13150
|
}
|
|
13151
13151
|
pos++;
|
|
13152
13152
|
}
|
|
13153
|
-
tokenValue = text.substring(
|
|
13153
|
+
tokenValue = text.substring(fullStartPos, pos);
|
|
13154
13154
|
return firstNonWhitespace === -1 ? 12 /* JsxTextAllWhiteSpaces */ : 11 /* JsxText */;
|
|
13155
13155
|
}
|
|
13156
13156
|
function scanJsxIdentifier() {
|
|
@@ -13184,7 +13184,7 @@ function createScanner(languageVersion, skipTrivia2, languageVariant = 0 /* Stan
|
|
|
13184
13184
|
return token;
|
|
13185
13185
|
}
|
|
13186
13186
|
function scanJsxAttributeValue() {
|
|
13187
|
-
|
|
13187
|
+
fullStartPos = pos;
|
|
13188
13188
|
switch (text.charCodeAt(pos)) {
|
|
13189
13189
|
case 34 /* doubleQuote */:
|
|
13190
13190
|
case 39 /* singleQuote */:
|
|
@@ -13198,11 +13198,11 @@ function createScanner(languageVersion, skipTrivia2, languageVariant = 0 /* Stan
|
|
|
13198
13198
|
}
|
|
13199
13199
|
}
|
|
13200
13200
|
function reScanJsxAttributeValue() {
|
|
13201
|
-
pos =
|
|
13201
|
+
pos = tokenStart = fullStartPos;
|
|
13202
13202
|
return scanJsxAttributeValue();
|
|
13203
13203
|
}
|
|
13204
13204
|
function scanJsDocToken() {
|
|
13205
|
-
|
|
13205
|
+
fullStartPos = tokenStart = pos;
|
|
13206
13206
|
tokenFlags = 0 /* None */;
|
|
13207
13207
|
if (pos >= end) {
|
|
13208
13208
|
return token = 1 /* EndOfFileToken */;
|
|
@@ -13274,7 +13274,7 @@ function createScanner(languageVersion, skipTrivia2, languageVariant = 0 /* Stan
|
|
|
13274
13274
|
let char = ch;
|
|
13275
13275
|
while (pos < end && isIdentifierPart(char = codePointAt(text, pos), languageVersion) || text.charCodeAt(pos) === 45 /* minus */)
|
|
13276
13276
|
pos += charSize(char);
|
|
13277
|
-
tokenValue = text.substring(
|
|
13277
|
+
tokenValue = text.substring(tokenStart, pos);
|
|
13278
13278
|
if (char === 92 /* backslash */) {
|
|
13279
13279
|
tokenValue += scanIdentifierParts();
|
|
13280
13280
|
}
|
|
@@ -13285,16 +13285,16 @@ function createScanner(languageVersion, skipTrivia2, languageVariant = 0 /* Stan
|
|
|
13285
13285
|
}
|
|
13286
13286
|
function speculationHelper(callback, isLookahead) {
|
|
13287
13287
|
const savePos = pos;
|
|
13288
|
-
const saveStartPos =
|
|
13289
|
-
const saveTokenPos =
|
|
13288
|
+
const saveStartPos = fullStartPos;
|
|
13289
|
+
const saveTokenPos = tokenStart;
|
|
13290
13290
|
const saveToken = token;
|
|
13291
13291
|
const saveTokenValue = tokenValue;
|
|
13292
13292
|
const saveTokenFlags = tokenFlags;
|
|
13293
13293
|
const result = callback();
|
|
13294
13294
|
if (!result || isLookahead) {
|
|
13295
13295
|
pos = savePos;
|
|
13296
|
-
|
|
13297
|
-
|
|
13296
|
+
fullStartPos = saveStartPos;
|
|
13297
|
+
tokenStart = saveTokenPos;
|
|
13298
13298
|
token = saveToken;
|
|
13299
13299
|
tokenValue = saveTokenValue;
|
|
13300
13300
|
tokenFlags = saveTokenFlags;
|
|
@@ -13304,8 +13304,8 @@ function createScanner(languageVersion, skipTrivia2, languageVariant = 0 /* Stan
|
|
|
13304
13304
|
function scanRange(start3, length3, callback) {
|
|
13305
13305
|
const saveEnd = end;
|
|
13306
13306
|
const savePos = pos;
|
|
13307
|
-
const saveStartPos =
|
|
13308
|
-
const saveTokenPos =
|
|
13307
|
+
const saveStartPos = fullStartPos;
|
|
13308
|
+
const saveTokenPos = tokenStart;
|
|
13309
13309
|
const saveToken = token;
|
|
13310
13310
|
const saveTokenValue = tokenValue;
|
|
13311
13311
|
const saveTokenFlags = tokenFlags;
|
|
@@ -13314,8 +13314,8 @@ function createScanner(languageVersion, skipTrivia2, languageVariant = 0 /* Stan
|
|
|
13314
13314
|
const result = callback();
|
|
13315
13315
|
end = saveEnd;
|
|
13316
13316
|
pos = savePos;
|
|
13317
|
-
|
|
13318
|
-
|
|
13317
|
+
fullStartPos = saveStartPos;
|
|
13318
|
+
tokenStart = saveTokenPos;
|
|
13319
13319
|
token = saveToken;
|
|
13320
13320
|
tokenValue = saveTokenValue;
|
|
13321
13321
|
tokenFlags = saveTokenFlags;
|
|
@@ -13345,7 +13345,7 @@ function createScanner(languageVersion, skipTrivia2, languageVariant = 0 /* Stan
|
|
|
13345
13345
|
function setText(newText, start3, length3) {
|
|
13346
13346
|
text = newText || "";
|
|
13347
13347
|
end = length3 === void 0 ? text.length : start3 + length3;
|
|
13348
|
-
|
|
13348
|
+
resetTokenState(start3 || 0);
|
|
13349
13349
|
}
|
|
13350
13350
|
function setOnError(errorCallback) {
|
|
13351
13351
|
onError = errorCallback;
|
|
@@ -13356,11 +13356,11 @@ function createScanner(languageVersion, skipTrivia2, languageVariant = 0 /* Stan
|
|
|
13356
13356
|
function setLanguageVariant(variant) {
|
|
13357
13357
|
languageVariant = variant;
|
|
13358
13358
|
}
|
|
13359
|
-
function
|
|
13360
|
-
Debug.assert(
|
|
13361
|
-
pos =
|
|
13362
|
-
|
|
13363
|
-
|
|
13359
|
+
function resetTokenState(position) {
|
|
13360
|
+
Debug.assert(position >= 0);
|
|
13361
|
+
pos = position;
|
|
13362
|
+
fullStartPos = position;
|
|
13363
|
+
tokenStart = position;
|
|
13364
13364
|
token = 0 /* Unknown */;
|
|
13365
13365
|
tokenValue = void 0;
|
|
13366
13366
|
tokenFlags = 0 /* None */;
|
|
@@ -16112,8 +16112,8 @@ function getSpanOfTokenAtPosition(sourceFile, pos) {
|
|
|
16112
16112
|
pos
|
|
16113
16113
|
);
|
|
16114
16114
|
scanner2.scan();
|
|
16115
|
-
const start2 = scanner2.
|
|
16116
|
-
return createTextSpanFromBounds(start2, scanner2.
|
|
16115
|
+
const start2 = scanner2.getTokenStart();
|
|
16116
|
+
return createTextSpanFromBounds(start2, scanner2.getTokenEnd());
|
|
16117
16117
|
}
|
|
16118
16118
|
function scanTokenAtPosition(sourceFile, pos) {
|
|
16119
16119
|
const scanner2 = createScanner(
|
|
@@ -16143,7 +16143,7 @@ function getErrorSpanForArrowFunction(sourceFile, node) {
|
|
|
16143
16143
|
function getErrorSpanForNode(sourceFile, node) {
|
|
16144
16144
|
let errorNode = node;
|
|
16145
16145
|
switch (node.kind) {
|
|
16146
|
-
case 308 /* SourceFile */:
|
|
16146
|
+
case 308 /* SourceFile */: {
|
|
16147
16147
|
const pos2 = skipTrivia(
|
|
16148
16148
|
sourceFile.text,
|
|
16149
16149
|
0,
|
|
@@ -16154,6 +16154,7 @@ function getErrorSpanForNode(sourceFile, node) {
|
|
|
16154
16154
|
return createTextSpan(0, 0);
|
|
16155
16155
|
}
|
|
16156
16156
|
return getSpanOfTokenAtPosition(sourceFile, pos2);
|
|
16157
|
+
}
|
|
16157
16158
|
case 257 /* VariableDeclaration */:
|
|
16158
16159
|
case 205 /* BindingElement */:
|
|
16159
16160
|
case 260 /* ClassDeclaration */:
|
|
@@ -16176,10 +16177,16 @@ function getErrorSpanForNode(sourceFile, node) {
|
|
|
16176
16177
|
case 216 /* ArrowFunction */:
|
|
16177
16178
|
return getErrorSpanForArrowFunction(sourceFile, node);
|
|
16178
16179
|
case 292 /* CaseClause */:
|
|
16179
|
-
case 293 /* DefaultClause */:
|
|
16180
|
+
case 293 /* DefaultClause */: {
|
|
16180
16181
|
const start2 = skipTrivia(sourceFile.text, node.pos);
|
|
16181
16182
|
const end = node.statements.length > 0 ? node.statements[0].pos : node.end;
|
|
16182
16183
|
return createTextSpanFromBounds(start2, end);
|
|
16184
|
+
}
|
|
16185
|
+
case 250 /* ReturnStatement */:
|
|
16186
|
+
case 226 /* YieldExpression */: {
|
|
16187
|
+
const pos2 = skipTrivia(sourceFile.text, node.pos);
|
|
16188
|
+
return getSpanOfTokenAtPosition(sourceFile, pos2);
|
|
16189
|
+
}
|
|
16183
16190
|
}
|
|
16184
16191
|
if (errorNode === void 0) {
|
|
16185
16192
|
return getSpanOfTokenAtPosition(sourceFile, node.pos);
|
|
@@ -16266,6 +16273,7 @@ function isPartOfTypeNode(node) {
|
|
|
16266
16273
|
case 153 /* SymbolKeyword */:
|
|
16267
16274
|
case 149 /* ObjectKeyword */:
|
|
16268
16275
|
case 155 /* UndefinedKeyword */:
|
|
16276
|
+
case 104 /* NullKeyword */:
|
|
16269
16277
|
case 144 /* NeverKeyword */:
|
|
16270
16278
|
return true;
|
|
16271
16279
|
case 114 /* VoidKeyword */:
|
|
@@ -20977,7 +20985,7 @@ function isValidBigIntString(s, roundTripOnly) {
|
|
|
20977
20985
|
result = scanner2.scan();
|
|
20978
20986
|
}
|
|
20979
20987
|
const flags = scanner2.getTokenFlags();
|
|
20980
|
-
return success && result === 9 /* BigIntLiteral */ && scanner2.
|
|
20988
|
+
return success && result === 9 /* BigIntLiteral */ && scanner2.getTokenEnd() === s.length + 1 && !(flags & 512 /* ContainsSeparator */) && (!roundTripOnly || s === pseudoBigIntToString({ negative, base10Value: parsePseudoBigInt(scanner2.getTokenValue()) }));
|
|
20981
20989
|
}
|
|
20982
20990
|
function isValidTypeOnlyAliasUseSite(useSite) {
|
|
20983
20991
|
return !!(useSite.flags & 16777216 /* Ambient */) || isPartOfTypeQuery(useSite) || isIdentifierInNonEmittingHeritageClause(useSite) || isPartOfPossiblyValidTypeOrAbstractComputedPropertyName(useSite) || !(isExpressionNode(useSite) || isShorthandPropertyNameUseSite(useSite));
|
|
@@ -30664,13 +30672,13 @@ var Parser;
|
|
|
30664
30672
|
speculationHelper(() => {
|
|
30665
30673
|
const savedContextFlags = contextFlags;
|
|
30666
30674
|
contextFlags |= 32768 /* AwaitContext */;
|
|
30667
|
-
scanner2.
|
|
30675
|
+
scanner2.resetTokenState(nextStatement.pos);
|
|
30668
30676
|
nextToken();
|
|
30669
30677
|
while (token() !== 1 /* EndOfFileToken */) {
|
|
30670
|
-
const startPos = scanner2.
|
|
30678
|
+
const startPos = scanner2.getTokenFullStart();
|
|
30671
30679
|
const statement = parseListElement(0 /* SourceElements */, parseStatement);
|
|
30672
30680
|
statements.push(statement);
|
|
30673
|
-
if (startPos === scanner2.
|
|
30681
|
+
if (startPos === scanner2.getTokenFullStart()) {
|
|
30674
30682
|
nextToken();
|
|
30675
30683
|
}
|
|
30676
30684
|
if (pos >= 0) {
|
|
@@ -30858,7 +30866,7 @@ var Parser;
|
|
|
30858
30866
|
return inContext(32768 /* AwaitContext */);
|
|
30859
30867
|
}
|
|
30860
30868
|
function parseErrorAtCurrentToken(message, arg0) {
|
|
30861
|
-
return parseErrorAt(scanner2.
|
|
30869
|
+
return parseErrorAt(scanner2.getTokenStart(), scanner2.getTokenEnd(), message, arg0);
|
|
30862
30870
|
}
|
|
30863
30871
|
function parseErrorAtPosition(start2, length2, message, arg0) {
|
|
30864
30872
|
const lastError = lastOrUndefined(parseDiagnostics);
|
|
@@ -30877,10 +30885,10 @@ var Parser;
|
|
|
30877
30885
|
parseErrorAt(range.pos, range.end, message, arg0);
|
|
30878
30886
|
}
|
|
30879
30887
|
function scanError(message, length2) {
|
|
30880
|
-
parseErrorAtPosition(scanner2.
|
|
30888
|
+
parseErrorAtPosition(scanner2.getTokenEnd(), length2, message);
|
|
30881
30889
|
}
|
|
30882
30890
|
function getNodePos() {
|
|
30883
|
-
return scanner2.
|
|
30891
|
+
return scanner2.getTokenFullStart();
|
|
30884
30892
|
}
|
|
30885
30893
|
function hasPrecedingJSDocComment() {
|
|
30886
30894
|
return scanner2.hasPrecedingJSDocComment();
|
|
@@ -30897,7 +30905,7 @@ var Parser;
|
|
|
30897
30905
|
}
|
|
30898
30906
|
function nextToken() {
|
|
30899
30907
|
if (isKeyword(currentToken) && (scanner2.hasUnicodeEscape() || scanner2.hasExtendedUnicodeEscape())) {
|
|
30900
|
-
parseErrorAt(scanner2.
|
|
30908
|
+
parseErrorAt(scanner2.getTokenStart(), scanner2.getTokenEnd(), Diagnostics.Keywords_cannot_contain_escape_characters);
|
|
30901
30909
|
}
|
|
30902
30910
|
return nextTokenWithoutCheck();
|
|
30903
30911
|
}
|
|
@@ -31010,7 +31018,7 @@ var Parser;
|
|
|
31010
31018
|
parseErrorForInvalidName(Diagnostics.Interface_name_cannot_be_0, Diagnostics.Interface_must_be_given_a_name, 18 /* OpenBraceToken */);
|
|
31011
31019
|
return;
|
|
31012
31020
|
case "is":
|
|
31013
|
-
parseErrorAt(pos, scanner2.
|
|
31021
|
+
parseErrorAt(pos, scanner2.getTokenStart(), Diagnostics.A_type_predicate_is_only_allowed_in_return_type_position_for_functions_and_methods);
|
|
31014
31022
|
return;
|
|
31015
31023
|
case "module":
|
|
31016
31024
|
case "namespace":
|
|
@@ -31165,11 +31173,11 @@ var Parser;
|
|
|
31165
31173
|
}
|
|
31166
31174
|
function createNodeArray(elements, pos, end, hasTrailingComma) {
|
|
31167
31175
|
const array = factoryCreateNodeArray(elements, hasTrailingComma);
|
|
31168
|
-
setTextRangePosEnd(array, pos, end != null ? end : scanner2.
|
|
31176
|
+
setTextRangePosEnd(array, pos, end != null ? end : scanner2.getTokenFullStart());
|
|
31169
31177
|
return array;
|
|
31170
31178
|
}
|
|
31171
31179
|
function finishNode(node, pos, end) {
|
|
31172
|
-
setTextRangePosEnd(node, pos, end != null ? end : scanner2.
|
|
31180
|
+
setTextRangePosEnd(node, pos, end != null ? end : scanner2.getTokenFullStart());
|
|
31173
31181
|
if (contextFlags) {
|
|
31174
31182
|
node.flags |= contextFlags;
|
|
31175
31183
|
}
|
|
@@ -31181,7 +31189,7 @@ var Parser;
|
|
|
31181
31189
|
}
|
|
31182
31190
|
function createMissingNode(kind, reportAtCurrentPosition, diagnosticMessage, arg0) {
|
|
31183
31191
|
if (reportAtCurrentPosition) {
|
|
31184
|
-
parseErrorAtPosition(scanner2.
|
|
31192
|
+
parseErrorAtPosition(scanner2.getTokenFullStart(), 0, diagnosticMessage, arg0);
|
|
31185
31193
|
} else if (diagnosticMessage) {
|
|
31186
31194
|
parseErrorAtCurrentToken(diagnosticMessage, arg0);
|
|
31187
31195
|
}
|
|
@@ -31567,7 +31575,7 @@ var Parser;
|
|
|
31567
31575
|
if (!syntaxCursor || !isReusableParsingContext(parsingContext2) || parseErrorBeforeNextFinishedNode) {
|
|
31568
31576
|
return void 0;
|
|
31569
31577
|
}
|
|
31570
|
-
const node = syntaxCursor.currentNode(pos != null ? pos : scanner2.
|
|
31578
|
+
const node = syntaxCursor.currentNode(pos != null ? pos : scanner2.getTokenFullStart());
|
|
31571
31579
|
if (nodeIsMissing(node) || node.intersectsChange || containsParseError(node)) {
|
|
31572
31580
|
return void 0;
|
|
31573
31581
|
}
|
|
@@ -31584,7 +31592,7 @@ var Parser;
|
|
|
31584
31592
|
return node;
|
|
31585
31593
|
}
|
|
31586
31594
|
function consumeNode(node) {
|
|
31587
|
-
scanner2.
|
|
31595
|
+
scanner2.resetTokenState(node.end);
|
|
31588
31596
|
nextToken();
|
|
31589
31597
|
return node;
|
|
31590
31598
|
}
|
|
@@ -31798,14 +31806,14 @@ var Parser;
|
|
|
31798
31806
|
/*inErrorRecovery*/
|
|
31799
31807
|
false
|
|
31800
31808
|
)) {
|
|
31801
|
-
const startPos = scanner2.
|
|
31809
|
+
const startPos = scanner2.getTokenFullStart();
|
|
31802
31810
|
const result = parseListElement(kind, parseElement);
|
|
31803
31811
|
if (!result) {
|
|
31804
31812
|
parsingContext = saveParsingContext;
|
|
31805
31813
|
return void 0;
|
|
31806
31814
|
}
|
|
31807
31815
|
list.push(result);
|
|
31808
|
-
commaStart = scanner2.
|
|
31816
|
+
commaStart = scanner2.getTokenStart();
|
|
31809
31817
|
if (parseOptional(27 /* CommaToken */)) {
|
|
31810
31818
|
continue;
|
|
31811
31819
|
}
|
|
@@ -31817,7 +31825,7 @@ var Parser;
|
|
|
31817
31825
|
if (considerSemicolonAsDelimiter && token() === 26 /* SemicolonToken */ && !scanner2.hasPrecedingLineBreak()) {
|
|
31818
31826
|
nextToken();
|
|
31819
31827
|
}
|
|
31820
|
-
if (startPos === scanner2.
|
|
31828
|
+
if (startPos === scanner2.getTokenFullStart()) {
|
|
31821
31829
|
nextToken();
|
|
31822
31830
|
}
|
|
31823
31831
|
continue;
|
|
@@ -32646,7 +32654,7 @@ var Parser;
|
|
|
32646
32654
|
}
|
|
32647
32655
|
function parseImportTypeAssertions() {
|
|
32648
32656
|
const pos = getNodePos();
|
|
32649
|
-
const openBracePosition = scanner2.
|
|
32657
|
+
const openBracePosition = scanner2.getTokenStart();
|
|
32650
32658
|
parseExpected(18 /* OpenBraceToken */);
|
|
32651
32659
|
const multiLine = scanner2.hasPrecedingLineBreak();
|
|
32652
32660
|
parseExpected(130 /* AssertKeyword */);
|
|
@@ -33320,7 +33328,7 @@ var Parser;
|
|
|
33320
33328
|
}
|
|
33321
33329
|
}
|
|
33322
33330
|
function parsePossibleParenthesizedArrowFunctionExpression(allowReturnTypeInArrowFunction) {
|
|
33323
|
-
const tokenPos = scanner2.
|
|
33331
|
+
const tokenPos = scanner2.getTokenStart();
|
|
33324
33332
|
if (notParenthesizedArrow == null ? void 0 : notParenthesizedArrow.has(tokenPos)) {
|
|
33325
33333
|
return void 0;
|
|
33326
33334
|
}
|
|
@@ -34219,7 +34227,7 @@ var Parser;
|
|
|
34219
34227
|
}
|
|
34220
34228
|
function parseArrayLiteralExpression() {
|
|
34221
34229
|
const pos = getNodePos();
|
|
34222
|
-
const openBracketPosition = scanner2.
|
|
34230
|
+
const openBracketPosition = scanner2.getTokenStart();
|
|
34223
34231
|
const openBracketParsed = parseExpected(22 /* OpenBracketToken */);
|
|
34224
34232
|
const multiLine = scanner2.hasPrecedingLineBreak();
|
|
34225
34233
|
const elements = parseDelimitedList(15 /* ArrayLiteralMembers */, parseArgumentOrArrayLiteralElement);
|
|
@@ -34279,7 +34287,7 @@ var Parser;
|
|
|
34279
34287
|
}
|
|
34280
34288
|
function parseObjectLiteralExpression() {
|
|
34281
34289
|
const pos = getNodePos();
|
|
34282
|
-
const openBracePosition = scanner2.
|
|
34290
|
+
const openBracePosition = scanner2.getTokenStart();
|
|
34283
34291
|
const openBraceParsed = parseExpected(18 /* OpenBraceToken */);
|
|
34284
34292
|
const multiLine = scanner2.hasPrecedingLineBreak();
|
|
34285
34293
|
const properties = parseDelimitedList(
|
|
@@ -34351,7 +34359,7 @@ var Parser;
|
|
|
34351
34359
|
function parseBlock(ignoreMissingOpenBrace, diagnosticMessage) {
|
|
34352
34360
|
const pos = getNodePos();
|
|
34353
34361
|
const hasJSDoc = hasPrecedingJSDocComment();
|
|
34354
|
-
const openBracePosition = scanner2.
|
|
34362
|
+
const openBracePosition = scanner2.getTokenStart();
|
|
34355
34363
|
const openBraceParsed = parseExpected(18 /* OpenBraceToken */, diagnosticMessage);
|
|
34356
34364
|
if (openBraceParsed || ignoreMissingOpenBrace) {
|
|
34357
34365
|
const multiLine = scanner2.hasPrecedingLineBreak();
|
|
@@ -34408,7 +34416,7 @@ var Parser;
|
|
|
34408
34416
|
const pos = getNodePos();
|
|
34409
34417
|
const hasJSDoc = hasPrecedingJSDocComment();
|
|
34410
34418
|
parseExpected(99 /* IfKeyword */);
|
|
34411
|
-
const openParenPosition = scanner2.
|
|
34419
|
+
const openParenPosition = scanner2.getTokenStart();
|
|
34412
34420
|
const openParenParsed = parseExpected(20 /* OpenParenToken */);
|
|
34413
34421
|
const expression = allowInAnd(parseExpression);
|
|
34414
34422
|
parseExpectedMatchingBrackets(20 /* OpenParenToken */, 21 /* CloseParenToken */, openParenParsed, openParenPosition);
|
|
@@ -34422,7 +34430,7 @@ var Parser;
|
|
|
34422
34430
|
parseExpected(90 /* DoKeyword */);
|
|
34423
34431
|
const statement = parseStatement();
|
|
34424
34432
|
parseExpected(115 /* WhileKeyword */);
|
|
34425
|
-
const openParenPosition = scanner2.
|
|
34433
|
+
const openParenPosition = scanner2.getTokenStart();
|
|
34426
34434
|
const openParenParsed = parseExpected(20 /* OpenParenToken */);
|
|
34427
34435
|
const expression = allowInAnd(parseExpression);
|
|
34428
34436
|
parseExpectedMatchingBrackets(20 /* OpenParenToken */, 21 /* CloseParenToken */, openParenParsed, openParenPosition);
|
|
@@ -34433,7 +34441,7 @@ var Parser;
|
|
|
34433
34441
|
const pos = getNodePos();
|
|
34434
34442
|
const hasJSDoc = hasPrecedingJSDocComment();
|
|
34435
34443
|
parseExpected(115 /* WhileKeyword */);
|
|
34436
|
-
const openParenPosition = scanner2.
|
|
34444
|
+
const openParenPosition = scanner2.getTokenStart();
|
|
34437
34445
|
const openParenParsed = parseExpected(20 /* OpenParenToken */);
|
|
34438
34446
|
const expression = allowInAnd(parseExpression);
|
|
34439
34447
|
parseExpectedMatchingBrackets(20 /* OpenParenToken */, 21 /* CloseParenToken */, openParenParsed, openParenPosition);
|
|
@@ -34500,7 +34508,7 @@ var Parser;
|
|
|
34500
34508
|
const pos = getNodePos();
|
|
34501
34509
|
const hasJSDoc = hasPrecedingJSDocComment();
|
|
34502
34510
|
parseExpected(116 /* WithKeyword */);
|
|
34503
|
-
const openParenPosition = scanner2.
|
|
34511
|
+
const openParenPosition = scanner2.getTokenStart();
|
|
34504
34512
|
const openParenParsed = parseExpected(20 /* OpenParenToken */);
|
|
34505
34513
|
const expression = allowInAnd(parseExpression);
|
|
34506
34514
|
parseExpectedMatchingBrackets(20 /* OpenParenToken */, 21 /* CloseParenToken */, openParenParsed, openParenPosition);
|
|
@@ -35596,7 +35604,7 @@ var Parser;
|
|
|
35596
35604
|
}
|
|
35597
35605
|
function parseImportDeclarationOrImportEqualsDeclaration(pos, hasJSDoc, modifiers) {
|
|
35598
35606
|
parseExpected(100 /* ImportKeyword */);
|
|
35599
|
-
const afterImportPos = scanner2.
|
|
35607
|
+
const afterImportPos = scanner2.getTokenFullStart();
|
|
35600
35608
|
let identifier;
|
|
35601
35609
|
if (isIdentifier2()) {
|
|
35602
35610
|
identifier = parseIdentifier();
|
|
@@ -35640,7 +35648,7 @@ var Parser;
|
|
|
35640
35648
|
if (!skipAssertKeyword) {
|
|
35641
35649
|
parseExpected(130 /* AssertKeyword */);
|
|
35642
35650
|
}
|
|
35643
|
-
const openBracePosition = scanner2.
|
|
35651
|
+
const openBracePosition = scanner2.getTokenStart();
|
|
35644
35652
|
if (parseExpected(18 /* OpenBraceToken */)) {
|
|
35645
35653
|
const multiLine = scanner2.hasPrecedingLineBreak();
|
|
35646
35654
|
const elements = parseDelimitedList(
|
|
@@ -35741,8 +35749,8 @@ var Parser;
|
|
|
35741
35749
|
function parseImportOrExportSpecifier(kind) {
|
|
35742
35750
|
const pos = getNodePos();
|
|
35743
35751
|
let checkIdentifierIsKeyword = isKeyword(token()) && !isIdentifier2();
|
|
35744
|
-
let checkIdentifierStart = scanner2.
|
|
35745
|
-
let checkIdentifierEnd = scanner2.
|
|
35752
|
+
let checkIdentifierStart = scanner2.getTokenStart();
|
|
35753
|
+
let checkIdentifierEnd = scanner2.getTokenEnd();
|
|
35746
35754
|
let isTypeOnly = false;
|
|
35747
35755
|
let propertyName;
|
|
35748
35756
|
let canParseAsKeyword = true;
|
|
@@ -35787,8 +35795,8 @@ var Parser;
|
|
|
35787
35795
|
return finishNode(node, pos);
|
|
35788
35796
|
function parseNameWithKeywordCheck() {
|
|
35789
35797
|
checkIdentifierIsKeyword = isKeyword(token()) && !isIdentifier2();
|
|
35790
|
-
checkIdentifierStart = scanner2.
|
|
35791
|
-
checkIdentifierEnd = scanner2.
|
|
35798
|
+
checkIdentifierStart = scanner2.getTokenStart();
|
|
35799
|
+
checkIdentifierEnd = scanner2.getTokenEnd();
|
|
35792
35800
|
return parseIdentifierName();
|
|
35793
35801
|
}
|
|
35794
35802
|
}
|
|
@@ -36074,8 +36082,8 @@ var Parser;
|
|
|
36074
36082
|
break loop;
|
|
36075
36083
|
case 18 /* OpenBraceToken */:
|
|
36076
36084
|
state = 2 /* SavingComments */;
|
|
36077
|
-
const commentEnd = scanner2.
|
|
36078
|
-
const linkStart = scanner2.
|
|
36085
|
+
const commentEnd = scanner2.getTokenFullStart();
|
|
36086
|
+
const linkStart = scanner2.getTokenEnd() - 1;
|
|
36079
36087
|
const link = parseJSDocLink(linkStart);
|
|
36080
36088
|
if (link) {
|
|
36081
36089
|
if (!linkEnd) {
|
|
@@ -36084,7 +36092,7 @@ var Parser;
|
|
|
36084
36092
|
parts.push(finishNode(factory2.createJSDocText(comments.join("")), linkEnd != null ? linkEnd : start2, commentEnd));
|
|
36085
36093
|
parts.push(link);
|
|
36086
36094
|
comments = [];
|
|
36087
|
-
linkEnd = scanner2.
|
|
36095
|
+
linkEnd = scanner2.getTokenEnd();
|
|
36088
36096
|
break;
|
|
36089
36097
|
}
|
|
36090
36098
|
default:
|
|
@@ -36158,7 +36166,7 @@ var Parser;
|
|
|
36158
36166
|
}
|
|
36159
36167
|
function parseTag(margin) {
|
|
36160
36168
|
Debug.assert(token() === 59 /* AtToken */);
|
|
36161
|
-
const start3 = scanner2.
|
|
36169
|
+
const start3 = scanner2.getTokenStart();
|
|
36162
36170
|
nextTokenJSDoc();
|
|
36163
36171
|
const tagName = parseJSDocIdentifierName(
|
|
36164
36172
|
/*message*/
|
|
@@ -36286,7 +36294,7 @@ var Parser;
|
|
|
36286
36294
|
comments2.push(scanner2.getTokenText());
|
|
36287
36295
|
break;
|
|
36288
36296
|
}
|
|
36289
|
-
scanner2.
|
|
36297
|
+
scanner2.resetTokenState(scanner2.getTokenEnd() - 1);
|
|
36290
36298
|
case 1 /* EndOfFileToken */:
|
|
36291
36299
|
break loop;
|
|
36292
36300
|
case 5 /* WhitespaceTrivia */:
|
|
@@ -36302,14 +36310,14 @@ var Parser;
|
|
|
36302
36310
|
break;
|
|
36303
36311
|
case 18 /* OpenBraceToken */:
|
|
36304
36312
|
state = 2 /* SavingComments */;
|
|
36305
|
-
const commentEnd = scanner2.
|
|
36306
|
-
const linkStart = scanner2.
|
|
36313
|
+
const commentEnd = scanner2.getTokenFullStart();
|
|
36314
|
+
const linkStart = scanner2.getTokenEnd() - 1;
|
|
36307
36315
|
const link = parseJSDocLink(linkStart);
|
|
36308
36316
|
if (link) {
|
|
36309
36317
|
parts2.push(finishNode(factory2.createJSDocText(comments2.join("")), linkEnd2 != null ? linkEnd2 : commentsPos2, commentEnd));
|
|
36310
36318
|
parts2.push(link);
|
|
36311
36319
|
comments2 = [];
|
|
36312
|
-
linkEnd2 = scanner2.
|
|
36320
|
+
linkEnd2 = scanner2.getTokenEnd();
|
|
36313
36321
|
} else {
|
|
36314
36322
|
pushComment(scanner2.getTokenText());
|
|
36315
36323
|
}
|
|
@@ -36344,7 +36352,7 @@ var Parser;
|
|
|
36344
36352
|
if (comments2.length) {
|
|
36345
36353
|
parts2.push(finishNode(factory2.createJSDocText(comments2.join("")), linkEnd2 != null ? linkEnd2 : commentsPos2));
|
|
36346
36354
|
}
|
|
36347
|
-
return createNodeArray(parts2, commentsPos2, scanner2.
|
|
36355
|
+
return createNodeArray(parts2, commentsPos2, scanner2.getTokenEnd());
|
|
36348
36356
|
} else if (comments2.length) {
|
|
36349
36357
|
return comments2.join("");
|
|
36350
36358
|
}
|
|
@@ -36378,7 +36386,7 @@ var Parser;
|
|
|
36378
36386
|
nextTokenJSDoc();
|
|
36379
36387
|
}
|
|
36380
36388
|
const create = linkType === "link" ? factory2.createJSDocLink : linkType === "linkcode" ? factory2.createJSDocLinkCode : factory2.createJSDocLinkPlain;
|
|
36381
|
-
return finishNode(create(name, text.join("")), start3, scanner2.
|
|
36389
|
+
return finishNode(create(name, text.join("")), start3, scanner2.getTokenEnd());
|
|
36382
36390
|
}
|
|
36383
36391
|
function parseJSDocLinkPrefix() {
|
|
36384
36392
|
skipWhitespaceOrAsterisk();
|
|
@@ -36475,14 +36483,14 @@ var Parser;
|
|
|
36475
36483
|
}
|
|
36476
36484
|
function parseReturnTag(start3, tagName, indent3, indentText) {
|
|
36477
36485
|
if (some(tags, isJSDocReturnTag)) {
|
|
36478
|
-
parseErrorAt(tagName.pos, scanner2.
|
|
36486
|
+
parseErrorAt(tagName.pos, scanner2.getTokenStart(), Diagnostics._0_tag_already_specified, tagName.escapedText);
|
|
36479
36487
|
}
|
|
36480
36488
|
const typeExpression = tryParseTypeExpression();
|
|
36481
36489
|
return finishNode(factory2.createJSDocReturnTag(tagName, typeExpression, parseTrailingTagComments(start3, getNodePos(), indent3, indentText)), start3);
|
|
36482
36490
|
}
|
|
36483
36491
|
function parseTypeTag(start3, tagName, indent3, indentText) {
|
|
36484
36492
|
if (some(tags, isJSDocTypeTag)) {
|
|
36485
|
-
parseErrorAt(tagName.pos, scanner2.
|
|
36493
|
+
parseErrorAt(tagName.pos, scanner2.getTokenStart(), Diagnostics._0_tag_already_specified, tagName.escapedText);
|
|
36486
36494
|
}
|
|
36487
36495
|
const typeExpression = parseJSDocTypeExpression(
|
|
36488
36496
|
/*mayOmitBraces*/
|
|
@@ -36505,10 +36513,10 @@ var Parser;
|
|
|
36505
36513
|
function parseAuthorTag(start3, tagName, indent3, indentText) {
|
|
36506
36514
|
const commentStart = getNodePos();
|
|
36507
36515
|
const textOnly = parseAuthorNameAndEmail();
|
|
36508
|
-
let commentEnd = scanner2.
|
|
36516
|
+
let commentEnd = scanner2.getTokenFullStart();
|
|
36509
36517
|
const comments2 = parseTrailingTagComments(start3, commentEnd, indent3, indentText);
|
|
36510
36518
|
if (!comments2) {
|
|
36511
|
-
commentEnd = scanner2.
|
|
36519
|
+
commentEnd = scanner2.getTokenFullStart();
|
|
36512
36520
|
}
|
|
36513
36521
|
const allParts = typeof comments2 !== "string" ? createNodeArray(concatenate([finishNode(textOnly, commentStart, commentEnd)], comments2), commentStart) : textOnly.text + comments2;
|
|
36514
36522
|
return finishNode(factory2.createJSDocAuthorTag(tagName, allParts), start3);
|
|
@@ -36524,7 +36532,7 @@ var Parser;
|
|
|
36524
36532
|
break;
|
|
36525
36533
|
} else if (token2 === 31 /* GreaterThanToken */ && inEmail) {
|
|
36526
36534
|
comments2.push(scanner2.getTokenText());
|
|
36527
|
-
scanner2.
|
|
36535
|
+
scanner2.resetTokenState(scanner2.getTokenEnd());
|
|
36528
36536
|
break;
|
|
36529
36537
|
}
|
|
36530
36538
|
comments2.push(scanner2.getTokenText());
|
|
@@ -36632,7 +36640,7 @@ var Parser;
|
|
|
36632
36640
|
return finishNode(typedefTag, start3, end2);
|
|
36633
36641
|
}
|
|
36634
36642
|
function parseJSDocTypeNameWithNamespace(nested) {
|
|
36635
|
-
const
|
|
36643
|
+
const start3 = scanner2.getTokenStart();
|
|
36636
36644
|
if (!tokenIsIdentifierOrKeyword(token())) {
|
|
36637
36645
|
return void 0;
|
|
36638
36646
|
}
|
|
@@ -36649,7 +36657,7 @@ var Parser;
|
|
|
36649
36657
|
body,
|
|
36650
36658
|
nested ? 4 /* NestedNamespace */ : void 0
|
|
36651
36659
|
);
|
|
36652
|
-
return finishNode(jsDocNamespaceNode,
|
|
36660
|
+
return finishNode(jsDocNamespaceNode, start3);
|
|
36653
36661
|
}
|
|
36654
36662
|
if (nested) {
|
|
36655
36663
|
typeNameOrNamespaceName.flags |= 2048 /* IdentifierIsInJSDocNamespace */;
|
|
@@ -36752,7 +36760,7 @@ var Parser;
|
|
|
36752
36760
|
}
|
|
36753
36761
|
function tryParseChildTag(target, indent3) {
|
|
36754
36762
|
Debug.assert(token() === 59 /* AtToken */);
|
|
36755
|
-
const start3 = scanner2.
|
|
36763
|
+
const start3 = scanner2.getTokenFullStart();
|
|
36756
36764
|
nextTokenJSDoc();
|
|
36757
36765
|
const tagName = parseJSDocIdentifierName();
|
|
36758
36766
|
skipWhitespace();
|
|
@@ -36852,11 +36860,11 @@ var Parser;
|
|
|
36852
36860
|
);
|
|
36853
36861
|
}
|
|
36854
36862
|
identifierCount++;
|
|
36855
|
-
const
|
|
36856
|
-
const end2 = scanner2.
|
|
36863
|
+
const start3 = scanner2.getTokenStart();
|
|
36864
|
+
const end2 = scanner2.getTokenEnd();
|
|
36857
36865
|
const originalKeywordKind = token();
|
|
36858
36866
|
const text = internIdentifier(scanner2.getTokenValue());
|
|
36859
|
-
const result = finishNode(factoryCreateIdentifier(text, originalKeywordKind),
|
|
36867
|
+
const result = finishNode(factoryCreateIdentifier(text, originalKeywordKind), start3, end2);
|
|
36860
36868
|
nextTokenJSDoc();
|
|
36861
36869
|
return result;
|
|
36862
36870
|
}
|
|
@@ -43390,7 +43398,7 @@ function initFlowNode(node) {
|
|
|
43390
43398
|
Debug.attachFlowNodeDebugInfo(node);
|
|
43391
43399
|
return node;
|
|
43392
43400
|
}
|
|
43393
|
-
var binder = createBinder();
|
|
43401
|
+
var binder = /* @__PURE__ */ createBinder();
|
|
43394
43402
|
function bindSourceFile(file, options) {
|
|
43395
43403
|
mark("beforeBind");
|
|
43396
43404
|
perfLogger.logStartBindFile("" + file.fileName);
|
|
@@ -47507,7 +47515,10 @@ function createTypeChecker(host) {
|
|
|
47507
47515
|
createIndexInfo,
|
|
47508
47516
|
getAnyType: () => anyType,
|
|
47509
47517
|
getStringType: () => stringType,
|
|
47518
|
+
getStringLiteralType,
|
|
47510
47519
|
getNumberType: () => numberType,
|
|
47520
|
+
getNumberLiteralType,
|
|
47521
|
+
getBigIntType: () => bigintType,
|
|
47511
47522
|
createPromiseType,
|
|
47512
47523
|
createArrayType,
|
|
47513
47524
|
getElementTypeOfArrayType,
|
|
@@ -56914,9 +56925,14 @@ function createTypeChecker(host) {
|
|
|
56914
56925
|
return result;
|
|
56915
56926
|
}
|
|
56916
56927
|
function addInheritedMembers(symbols, baseSymbols) {
|
|
56917
|
-
for (const
|
|
56918
|
-
if (
|
|
56919
|
-
|
|
56928
|
+
for (const base of baseSymbols) {
|
|
56929
|
+
if (isStaticPrivateIdentifierProperty(base)) {
|
|
56930
|
+
continue;
|
|
56931
|
+
}
|
|
56932
|
+
const derived = symbols.get(base.escapedName);
|
|
56933
|
+
if (!derived || derived.valueDeclaration && isBinaryExpression(derived.valueDeclaration) && !isConstructorDeclaredProperty(derived) && !getContainingClassStaticBlock(derived.valueDeclaration)) {
|
|
56934
|
+
symbols.set(base.escapedName, base);
|
|
56935
|
+
symbols.set(base.escapedName, base);
|
|
56920
56936
|
}
|
|
56921
56937
|
}
|
|
56922
56938
|
}
|
|
@@ -60839,12 +60855,15 @@ function createTypeChecker(host) {
|
|
|
60839
60855
|
function getConstituentCountOfTypes(types) {
|
|
60840
60856
|
return reduceLeft(types, (n, t) => n + getConstituentCount(t), 0);
|
|
60841
60857
|
}
|
|
60858
|
+
function areIntersectedTypesAvoidingPrimitiveReduction(t1, t2) {
|
|
60859
|
+
return !!(t1.flags & (4 /* String */ | 8 /* Number */ | 64 /* BigInt */)) && t2 === emptyTypeLiteralType;
|
|
60860
|
+
}
|
|
60842
60861
|
function getTypeFromIntersectionTypeNode(node) {
|
|
60843
60862
|
const links = getNodeLinks(node);
|
|
60844
60863
|
if (!links.resolvedType) {
|
|
60845
60864
|
const aliasSymbol = getAliasSymbolForTypeNode(node);
|
|
60846
60865
|
const types = map(node.types, getTypeFromTypeNode);
|
|
60847
|
-
const noSupertypeReduction = types.length === 2 &&
|
|
60866
|
+
const noSupertypeReduction = types.length === 2 && (areIntersectedTypesAvoidingPrimitiveReduction(types[0], types[1]) || areIntersectedTypesAvoidingPrimitiveReduction(types[1], types[0]));
|
|
60848
60867
|
links.resolvedType = getIntersectionType(types, aliasSymbol, getTypeArgumentsForAliasSymbol(aliasSymbol), noSupertypeReduction);
|
|
60849
60868
|
}
|
|
60850
60869
|
return links.resolvedType;
|
|
@@ -64217,8 +64236,8 @@ function createTypeChecker(host) {
|
|
|
64217
64236
|
if (prop.valueDeclaration && findAncestor(prop.valueDeclaration, (d) => d === objectLiteralDeclaration) && getSourceFileOfNode(objectLiteralDeclaration) === getSourceFileOfNode(errorNode)) {
|
|
64218
64237
|
const propDeclaration = prop.valueDeclaration;
|
|
64219
64238
|
Debug.assertNode(propDeclaration, isObjectLiteralElementLike);
|
|
64220
|
-
errorNode = propDeclaration;
|
|
64221
64239
|
const name = propDeclaration.name;
|
|
64240
|
+
errorNode = name;
|
|
64222
64241
|
if (isIdentifier(name)) {
|
|
64223
64242
|
suggestion = getSuggestionForNonexistentProperty(name, errorTarget);
|
|
64224
64243
|
}
|
|
@@ -71804,13 +71823,14 @@ function createTypeChecker(host) {
|
|
|
71804
71823
|
const elementFlags = [];
|
|
71805
71824
|
pushCachedContextualType(node);
|
|
71806
71825
|
const inDestructuringPattern = isAssignmentTarget(node);
|
|
71807
|
-
const
|
|
71826
|
+
const isSpreadIntoCallOrNew = isSpreadElement(node.parent) && isCallOrNewExpression(node.parent.parent);
|
|
71827
|
+
const inConstContext = isSpreadIntoCallOrNew || isConstContext(node);
|
|
71808
71828
|
const contextualType = getApparentTypeOfContextualType(
|
|
71809
71829
|
node,
|
|
71810
71830
|
/*contextFlags*/
|
|
71811
71831
|
void 0
|
|
71812
71832
|
);
|
|
71813
|
-
const inTupleContext = !!contextualType && someType(contextualType, isTupleLikeType);
|
|
71833
|
+
const inTupleContext = isSpreadIntoCallOrNew || !!contextualType && someType(contextualType, isTupleLikeType);
|
|
71814
71834
|
let hasOmittedExpression = false;
|
|
71815
71835
|
for (let i = 0; i < elementCount; i++) {
|
|
71816
71836
|
const e = elements[i];
|
|
@@ -78981,7 +79001,7 @@ function createTypeChecker(host) {
|
|
|
78981
79001
|
return !!forEachChild(node, nodeImmediatelyReferencesSuperOrThis);
|
|
78982
79002
|
}
|
|
78983
79003
|
function checkAccessorDeclaration(node) {
|
|
78984
|
-
if (isIdentifier(node.name) && idText(node.name) === "constructor") {
|
|
79004
|
+
if (isIdentifier(node.name) && idText(node.name) === "constructor" && isClassLike(node.parent)) {
|
|
78985
79005
|
error(node.name, Diagnostics.Class_constructor_may_not_be_an_accessor);
|
|
78986
79006
|
}
|
|
78987
79007
|
addLazyDiagnostic(checkAccessorDeclarationDiagnostics);
|
|
@@ -117788,6 +117808,7 @@ function createProgram(rootNamesOrOptions, _options, _host, _oldProgram, _config
|
|
|
117788
117808
|
const createProgramOptions = isArray(rootNamesOrOptions) ? createCreateProgramOptions(rootNamesOrOptions, _options, _host, _oldProgram, _configFileParsingDiagnostics) : rootNamesOrOptions;
|
|
117789
117809
|
const { rootNames, options, configFileParsingDiagnostics, projectReferences, typeScriptVersion: typeScriptVersion3 } = createProgramOptions;
|
|
117790
117810
|
let { oldProgram } = createProgramOptions;
|
|
117811
|
+
const reportInvalidIgnoreDeprecations = memoize(() => createOptionValueDiagnostic("ignoreDeprecations", Diagnostics.Invalid_value_for_ignoreDeprecations));
|
|
117791
117812
|
let processingDefaultLibFiles;
|
|
117792
117813
|
let processingOtherFiles;
|
|
117793
117814
|
let files;
|
|
@@ -120214,127 +120235,131 @@ function createProgram(rootNamesOrOptions, _options, _host, _oldProgram, _config
|
|
|
120214
120235
|
}
|
|
120215
120236
|
}
|
|
120216
120237
|
}
|
|
120217
|
-
function
|
|
120218
|
-
const version2 = typeScriptVersion3 || versionMajorMinor;
|
|
120238
|
+
function getIgnoreDeprecationsVersion() {
|
|
120219
120239
|
const ignoreDeprecations = options.ignoreDeprecations;
|
|
120220
120240
|
if (ignoreDeprecations) {
|
|
120221
|
-
if (ignoreDeprecations === "5.0"
|
|
120222
|
-
return;
|
|
120223
|
-
}
|
|
120224
|
-
|
|
120225
|
-
|
|
120241
|
+
if (ignoreDeprecations === "5.0") {
|
|
120242
|
+
return new Version(ignoreDeprecations);
|
|
120243
|
+
}
|
|
120244
|
+
reportInvalidIgnoreDeprecations();
|
|
120245
|
+
}
|
|
120246
|
+
return Version.zero;
|
|
120247
|
+
}
|
|
120248
|
+
function checkDeprecations(deprecatedIn, removedIn, createDiagnostic, fn) {
|
|
120249
|
+
const deprecatedInVersion = new Version(deprecatedIn);
|
|
120250
|
+
const removedInVersion = new Version(removedIn);
|
|
120251
|
+
const typescriptVersion = new Version(typeScriptVersion3 || versionMajorMinor);
|
|
120252
|
+
const ignoreDeprecationsVersion = getIgnoreDeprecationsVersion();
|
|
120253
|
+
const mustBeRemoved = !(removedInVersion.compareTo(typescriptVersion) === 1 /* GreaterThan */);
|
|
120254
|
+
const canBeSilenced = !mustBeRemoved && ignoreDeprecationsVersion.compareTo(deprecatedInVersion) === -1 /* LessThan */;
|
|
120255
|
+
if (mustBeRemoved || canBeSilenced) {
|
|
120256
|
+
fn((name, value, useInstead) => {
|
|
120257
|
+
if (mustBeRemoved) {
|
|
120258
|
+
if (value === void 0) {
|
|
120259
|
+
createDiagnostic(name, value, useInstead, Diagnostics.Option_0_has_been_removed_Please_remove_it_from_your_configuration, name);
|
|
120260
|
+
} else {
|
|
120261
|
+
createDiagnostic(name, value, useInstead, Diagnostics.Option_0_1_has_been_removed_Please_remove_it_from_your_configuration, name, value);
|
|
120262
|
+
}
|
|
120263
|
+
} else {
|
|
120264
|
+
if (value === void 0) {
|
|
120265
|
+
createDiagnostic(name, value, useInstead, Diagnostics.Option_0_is_deprecated_and_will_stop_functioning_in_TypeScript_1_Specify_compilerOption_ignoreDeprecations_Colon_2_to_silence_this_error, name, removedIn, deprecatedIn);
|
|
120266
|
+
} else {
|
|
120267
|
+
createDiagnostic(name, value, useInstead, Diagnostics.Option_0_1_is_deprecated_and_will_stop_functioning_in_TypeScript_2_Specify_compilerOption_ignoreDeprecations_Colon_3_to_silence_this_error, name, value, removedIn, deprecatedIn);
|
|
120268
|
+
}
|
|
120269
|
+
}
|
|
120270
|
+
});
|
|
120226
120271
|
}
|
|
120227
|
-
return version2;
|
|
120228
120272
|
}
|
|
120229
120273
|
function verifyDeprecatedCompilerOptions() {
|
|
120230
|
-
|
|
120231
|
-
|
|
120232
|
-
|
|
120233
|
-
|
|
120234
|
-
|
|
120235
|
-
|
|
120236
|
-
|
|
120237
|
-
|
|
120238
|
-
|
|
120239
|
-
|
|
120240
|
-
|
|
120241
|
-
|
|
120242
|
-
|
|
120243
|
-
|
|
120244
|
-
|
|
120245
|
-
|
|
120246
|
-
|
|
120247
|
-
|
|
120248
|
-
|
|
120249
|
-
|
|
120250
|
-
|
|
120251
|
-
|
|
120252
|
-
|
|
120253
|
-
|
|
120254
|
-
|
|
120255
|
-
|
|
120256
|
-
|
|
120257
|
-
|
|
120258
|
-
|
|
120259
|
-
}
|
|
120260
|
-
if (options.importsNotUsedAsValues) {
|
|
120261
|
-
createDeprecatedDiagnosticForOption(
|
|
120262
|
-
version2,
|
|
120263
|
-
"importsNotUsedAsValues",
|
|
120264
|
-
/*value*/
|
|
120265
|
-
void 0,
|
|
120266
|
-
"verbatimModuleSyntax"
|
|
120267
|
-
);
|
|
120268
|
-
}
|
|
120269
|
-
if (options.preserveValueImports) {
|
|
120270
|
-
createDeprecatedDiagnosticForOption(
|
|
120271
|
-
version2,
|
|
120272
|
-
"preserveValueImports",
|
|
120273
|
-
/*value*/
|
|
120274
|
-
void 0,
|
|
120275
|
-
"verbatimModuleSyntax"
|
|
120276
|
-
);
|
|
120277
|
-
}
|
|
120278
|
-
}
|
|
120279
|
-
function verifyDeprecatedProjectReference(ref, parentFile, index) {
|
|
120280
|
-
if (ref.prepend) {
|
|
120281
|
-
const version2 = getVersionForDeprecationDiagnostics(
|
|
120282
|
-
/*reportInvalidIgnoreDeprecations*/
|
|
120283
|
-
false
|
|
120284
|
-
);
|
|
120285
|
-
if (version2) {
|
|
120286
|
-
createDeprecatedOptionForVersionDiagnostic(
|
|
120287
|
-
version2,
|
|
120288
|
-
(message, arg0, arg1, arg2) => createDiagnosticForReference(parentFile, index, message, arg0, arg1, arg2),
|
|
120289
|
-
"prepend"
|
|
120274
|
+
function createDiagnostic(name, value, useInstead, message, arg0, arg1, arg2, arg3) {
|
|
120275
|
+
if (useInstead) {
|
|
120276
|
+
const details = chainDiagnosticMessages(
|
|
120277
|
+
/*details*/
|
|
120278
|
+
void 0,
|
|
120279
|
+
Diagnostics.Use_0_instead,
|
|
120280
|
+
useInstead
|
|
120281
|
+
);
|
|
120282
|
+
const chain = chainDiagnosticMessages(details, message, arg0, arg1, arg2, arg3);
|
|
120283
|
+
createDiagnosticForOption(
|
|
120284
|
+
/*onKey*/
|
|
120285
|
+
!value,
|
|
120286
|
+
name,
|
|
120287
|
+
/*option2*/
|
|
120288
|
+
void 0,
|
|
120289
|
+
chain
|
|
120290
|
+
);
|
|
120291
|
+
} else {
|
|
120292
|
+
createDiagnosticForOption(
|
|
120293
|
+
/*onKey*/
|
|
120294
|
+
!value,
|
|
120295
|
+
name,
|
|
120296
|
+
/*option2*/
|
|
120297
|
+
void 0,
|
|
120298
|
+
message,
|
|
120299
|
+
arg0,
|
|
120300
|
+
arg1,
|
|
120301
|
+
arg2,
|
|
120302
|
+
arg3
|
|
120290
120303
|
);
|
|
120291
120304
|
}
|
|
120292
120305
|
}
|
|
120306
|
+
checkDeprecations("5.0", "5.5", createDiagnostic, (createDeprecatedDiagnostic) => {
|
|
120307
|
+
if (options.target === 0 /* ES3 */) {
|
|
120308
|
+
createDeprecatedDiagnostic("target", "ES3");
|
|
120309
|
+
}
|
|
120310
|
+
if (options.noImplicitUseStrict) {
|
|
120311
|
+
createDeprecatedDiagnostic("noImplicitUseStrict");
|
|
120312
|
+
}
|
|
120313
|
+
if (options.keyofStringsOnly) {
|
|
120314
|
+
createDeprecatedDiagnostic("keyofStringsOnly");
|
|
120315
|
+
}
|
|
120316
|
+
if (options.suppressExcessPropertyErrors) {
|
|
120317
|
+
createDeprecatedDiagnostic("suppressExcessPropertyErrors");
|
|
120318
|
+
}
|
|
120319
|
+
if (options.suppressImplicitAnyIndexErrors) {
|
|
120320
|
+
createDeprecatedDiagnostic("suppressImplicitAnyIndexErrors");
|
|
120321
|
+
}
|
|
120322
|
+
if (options.noStrictGenericChecks) {
|
|
120323
|
+
createDeprecatedDiagnostic("noStrictGenericChecks");
|
|
120324
|
+
}
|
|
120325
|
+
if (options.charset) {
|
|
120326
|
+
createDeprecatedDiagnostic("charset");
|
|
120327
|
+
}
|
|
120328
|
+
if (options.out) {
|
|
120329
|
+
createDeprecatedDiagnostic(
|
|
120330
|
+
"out",
|
|
120331
|
+
/*value*/
|
|
120332
|
+
void 0,
|
|
120333
|
+
"outFile"
|
|
120334
|
+
);
|
|
120335
|
+
}
|
|
120336
|
+
if (options.importsNotUsedAsValues) {
|
|
120337
|
+
createDeprecatedDiagnostic(
|
|
120338
|
+
"importsNotUsedAsValues",
|
|
120339
|
+
/*value*/
|
|
120340
|
+
void 0,
|
|
120341
|
+
"verbatimModuleSyntax"
|
|
120342
|
+
);
|
|
120343
|
+
}
|
|
120344
|
+
if (options.preserveValueImports) {
|
|
120345
|
+
createDeprecatedDiagnostic(
|
|
120346
|
+
"preserveValueImports",
|
|
120347
|
+
/*value*/
|
|
120348
|
+
void 0,
|
|
120349
|
+
"verbatimModuleSyntax"
|
|
120350
|
+
);
|
|
120351
|
+
}
|
|
120352
|
+
});
|
|
120293
120353
|
}
|
|
120294
|
-
function
|
|
120295
|
-
|
|
120296
|
-
|
|
120297
|
-
(message, arg0, arg1, arg2) => {
|
|
120298
|
-
if (useInstead) {
|
|
120299
|
-
const details = chainDiagnosticMessages(
|
|
120300
|
-
/*details*/
|
|
120301
|
-
void 0,
|
|
120302
|
-
Diagnostics.Use_0_instead,
|
|
120303
|
-
useInstead
|
|
120304
|
-
);
|
|
120305
|
-
const chain = chainDiagnosticMessages(details, message, arg0, arg1, arg2);
|
|
120306
|
-
createDiagnosticForOption(
|
|
120307
|
-
/*onKey*/
|
|
120308
|
-
!value,
|
|
120309
|
-
name,
|
|
120310
|
-
/*option2*/
|
|
120311
|
-
void 0,
|
|
120312
|
-
chain
|
|
120313
|
-
);
|
|
120314
|
-
} else {
|
|
120315
|
-
createDiagnosticForOption(
|
|
120316
|
-
/*onKey*/
|
|
120317
|
-
!value,
|
|
120318
|
-
name,
|
|
120319
|
-
/*option2*/
|
|
120320
|
-
void 0,
|
|
120321
|
-
message,
|
|
120322
|
-
arg0,
|
|
120323
|
-
arg1,
|
|
120324
|
-
arg2
|
|
120325
|
-
);
|
|
120326
|
-
}
|
|
120327
|
-
},
|
|
120328
|
-
name,
|
|
120329
|
-
value
|
|
120330
|
-
);
|
|
120331
|
-
}
|
|
120332
|
-
function createDeprecatedOptionForVersionDiagnostic(version2, createDiagnostic, name, value) {
|
|
120333
|
-
if (version2 === "6.0" /* v6_0 */) {
|
|
120334
|
-
createDiagnostic(Diagnostics.Flag_0_is_deprecated_Please_remove_it_from_your_configuration, value || name);
|
|
120335
|
-
} else {
|
|
120336
|
-
createDiagnostic(Diagnostics.Flag_0_is_deprecated_and_will_stop_functioning_in_TypeScript_1_Specify_compilerOption_ignoreDeprecations_Colon_2_to_silence_this_error, value || name, "5.5" /* v5_5 */, "5.0" /* v5_0 */);
|
|
120354
|
+
function verifyDeprecatedProjectReference(ref, parentFile, index) {
|
|
120355
|
+
function createDiagnostic(_name, _value, _useInstead, message, arg0, arg1, arg2, arg3) {
|
|
120356
|
+
createDiagnosticForReference(parentFile, index, message, arg0, arg1, arg2, arg3);
|
|
120337
120357
|
}
|
|
120358
|
+
checkDeprecations("5.0", "5.5", createDiagnostic, (createDeprecatedDiagnostic) => {
|
|
120359
|
+
if (ref.prepend) {
|
|
120360
|
+
createDeprecatedDiagnostic("prepend");
|
|
120361
|
+
}
|
|
120362
|
+
});
|
|
120338
120363
|
}
|
|
120339
120364
|
function createDiagnosticExplainingFile(file, fileProcessingReason, diagnostic, args) {
|
|
120340
120365
|
var _a3;
|
|
@@ -120587,25 +120612,25 @@ function createProgram(rootNamesOrOptions, _options, _host, _oldProgram, _config
|
|
|
120587
120612
|
arg1
|
|
120588
120613
|
);
|
|
120589
120614
|
}
|
|
120590
|
-
function createDiagnosticForReference(sourceFile, index, message, arg0, arg1, arg2) {
|
|
120615
|
+
function createDiagnosticForReference(sourceFile, index, message, arg0, arg1, arg2, arg3) {
|
|
120591
120616
|
const referencesSyntax = firstDefined(
|
|
120592
120617
|
getTsConfigPropArray(sourceFile || options.configFile, "references"),
|
|
120593
120618
|
(property) => isArrayLiteralExpression(property.initializer) ? property.initializer : void 0
|
|
120594
120619
|
);
|
|
120595
120620
|
if (referencesSyntax && referencesSyntax.elements.length > index) {
|
|
120596
|
-
programDiagnostics.add(createDiagnosticForNodeInSourceFile(sourceFile || options.configFile, referencesSyntax.elements[index], message, arg0, arg1, arg2));
|
|
120621
|
+
programDiagnostics.add(createDiagnosticForNodeInSourceFile(sourceFile || options.configFile, referencesSyntax.elements[index], message, arg0, arg1, arg2, arg3));
|
|
120597
120622
|
} else {
|
|
120598
|
-
programDiagnostics.add(createCompilerDiagnostic(message, arg0, arg1, arg2));
|
|
120623
|
+
programDiagnostics.add(createCompilerDiagnostic(message, arg0, arg1, arg2, arg3));
|
|
120599
120624
|
}
|
|
120600
120625
|
}
|
|
120601
|
-
function createDiagnosticForOption(onKey, option1, option2, message, arg0, arg1, arg2) {
|
|
120626
|
+
function createDiagnosticForOption(onKey, option1, option2, message, arg0, arg1, arg2, arg3) {
|
|
120602
120627
|
const compilerOptionsObjectLiteralSyntax = getCompilerOptionsObjectLiteralSyntax();
|
|
120603
|
-
const needCompilerDiagnostic = !compilerOptionsObjectLiteralSyntax || !createOptionDiagnosticInObjectLiteralSyntax(compilerOptionsObjectLiteralSyntax, onKey, option1, option2, message, arg0, arg1, arg2);
|
|
120628
|
+
const needCompilerDiagnostic = !compilerOptionsObjectLiteralSyntax || !createOptionDiagnosticInObjectLiteralSyntax(compilerOptionsObjectLiteralSyntax, onKey, option1, option2, message, arg0, arg1, arg2, arg3);
|
|
120604
120629
|
if (needCompilerDiagnostic) {
|
|
120605
120630
|
if ("messageText" in message) {
|
|
120606
120631
|
programDiagnostics.add(createCompilerDiagnosticFromMessageChain(message));
|
|
120607
120632
|
} else {
|
|
120608
|
-
programDiagnostics.add(createCompilerDiagnostic(message, arg0, arg1, arg2));
|
|
120633
|
+
programDiagnostics.add(createCompilerDiagnostic(message, arg0, arg1, arg2, arg3));
|
|
120609
120634
|
}
|
|
120610
120635
|
}
|
|
120611
120636
|
}
|
|
@@ -120624,13 +120649,13 @@ function createProgram(rootNamesOrOptions, _options, _host, _oldProgram, _config
|
|
|
120624
120649
|
}
|
|
120625
120650
|
return _compilerOptionsObjectLiteralSyntax || void 0;
|
|
120626
120651
|
}
|
|
120627
|
-
function createOptionDiagnosticInObjectLiteralSyntax(objectLiteral, onKey, key1, key2, message, arg0, arg1, arg2) {
|
|
120652
|
+
function createOptionDiagnosticInObjectLiteralSyntax(objectLiteral, onKey, key1, key2, message, arg0, arg1, arg2, arg3) {
|
|
120628
120653
|
const props = getPropertyAssignment(objectLiteral, key1, key2);
|
|
120629
120654
|
for (const prop of props) {
|
|
120630
120655
|
if ("messageText" in message) {
|
|
120631
120656
|
programDiagnostics.add(createDiagnosticForNodeFromMessageChain(options.configFile, onKey ? prop.name : prop.initializer, message));
|
|
120632
120657
|
} else {
|
|
120633
|
-
programDiagnostics.add(createDiagnosticForNodeInSourceFile(options.configFile, onKey ? prop.name : prop.initializer, message, arg0, arg1, arg2));
|
|
120658
|
+
programDiagnostics.add(createDiagnosticForNodeInSourceFile(options.configFile, onKey ? prop.name : prop.initializer, message, arg0, arg1, arg2, arg3));
|
|
120634
120659
|
}
|
|
120635
120660
|
}
|
|
120636
120661
|
return !!props.length;
|
|
@@ -128809,12 +128834,15 @@ function isStringOrRegularExpressionOrTemplateLiteral(kind) {
|
|
|
128809
128834
|
}
|
|
128810
128835
|
return false;
|
|
128811
128836
|
}
|
|
128837
|
+
function areIntersectedTypesAvoidingStringReduction(checker, t1, t2) {
|
|
128838
|
+
return !!(t1.flags & 4 /* String */) && checker.isEmptyAnonymousObjectType(t2);
|
|
128839
|
+
}
|
|
128812
128840
|
function isStringAndEmptyAnonymousObjectIntersection(type) {
|
|
128813
128841
|
if (!type.isIntersection()) {
|
|
128814
128842
|
return false;
|
|
128815
128843
|
}
|
|
128816
128844
|
const { types, checker } = type;
|
|
128817
|
-
return types.length === 2 && types[0]
|
|
128845
|
+
return types.length === 2 && (areIntersectedTypesAvoidingStringReduction(checker, types[0], types[1]) || areIntersectedTypesAvoidingStringReduction(checker, types[1], types[0]));
|
|
128818
128846
|
}
|
|
128819
128847
|
function isPunctuation(kind) {
|
|
128820
128848
|
return 18 /* FirstPunctuation */ <= kind && kind <= 78 /* LastPunctuation */;
|
|
@@ -130719,8 +130747,8 @@ function createClassifier() {
|
|
|
130719
130747
|
handleToken();
|
|
130720
130748
|
lastNonTriviaToken = token;
|
|
130721
130749
|
}
|
|
130722
|
-
const end = scanner2.
|
|
130723
|
-
pushEncodedClassification(scanner2.
|
|
130750
|
+
const end = scanner2.getTokenEnd();
|
|
130751
|
+
pushEncodedClassification(scanner2.getTokenStart(), end, offset, classFromKind(token), spans);
|
|
130724
130752
|
if (end >= text.length) {
|
|
130725
130753
|
const end2 = getNewEndOfLineState(scanner2, token, lastOrUndefined(templateStack));
|
|
130726
130754
|
if (end2 !== void 0) {
|
|
@@ -131200,14 +131228,14 @@ function getEncodedSyntacticClassifications(cancellationToken, sourceFile, span)
|
|
|
131200
131228
|
result.push(type);
|
|
131201
131229
|
}
|
|
131202
131230
|
function classifyLeadingTriviaAndGetTokenStart(token) {
|
|
131203
|
-
triviaScanner.
|
|
131231
|
+
triviaScanner.resetTokenState(token.pos);
|
|
131204
131232
|
while (true) {
|
|
131205
|
-
const start2 = triviaScanner.
|
|
131233
|
+
const start2 = triviaScanner.getTokenEnd();
|
|
131206
131234
|
if (!couldStartTrivia(sourceFile.text, start2)) {
|
|
131207
131235
|
return start2;
|
|
131208
131236
|
}
|
|
131209
131237
|
const kind = triviaScanner.scan();
|
|
131210
|
-
const end = triviaScanner.
|
|
131238
|
+
const end = triviaScanner.getTokenEnd();
|
|
131211
131239
|
const width = end - start2;
|
|
131212
131240
|
if (!isTrivia(kind)) {
|
|
131213
131241
|
return start2;
|
|
@@ -131219,7 +131247,7 @@ function getEncodedSyntacticClassifications(cancellationToken, sourceFile, span)
|
|
|
131219
131247
|
case 2 /* SingleLineCommentTrivia */:
|
|
131220
131248
|
case 3 /* MultiLineCommentTrivia */:
|
|
131221
131249
|
classifyComment(token, kind, start2, width);
|
|
131222
|
-
triviaScanner.
|
|
131250
|
+
triviaScanner.resetTokenState(end);
|
|
131223
131251
|
continue;
|
|
131224
131252
|
case 7 /* ConflictMarkerTrivia */:
|
|
131225
131253
|
const text = sourceFile.text;
|
|
@@ -131418,15 +131446,15 @@ function getEncodedSyntacticClassifications(cancellationToken, sourceFile, span)
|
|
|
131418
131446
|
}
|
|
131419
131447
|
}
|
|
131420
131448
|
pushClassification(start2, i - start2, 1 /* comment */);
|
|
131421
|
-
mergeConflictScanner.
|
|
131422
|
-
while (mergeConflictScanner.
|
|
131449
|
+
mergeConflictScanner.resetTokenState(i);
|
|
131450
|
+
while (mergeConflictScanner.getTokenEnd() < end) {
|
|
131423
131451
|
classifyDisabledCodeToken();
|
|
131424
131452
|
}
|
|
131425
131453
|
}
|
|
131426
131454
|
function classifyDisabledCodeToken() {
|
|
131427
|
-
const start2 = mergeConflictScanner.
|
|
131455
|
+
const start2 = mergeConflictScanner.getTokenEnd();
|
|
131428
131456
|
const tokenKind = mergeConflictScanner.scan();
|
|
131429
|
-
const end = mergeConflictScanner.
|
|
131457
|
+
const end = mergeConflictScanner.getTokenEnd();
|
|
131430
131458
|
const type = classifyTokenType(tokenKind);
|
|
131431
131459
|
if (type) {
|
|
131432
131460
|
pushClassification(start2, end - start2, type);
|
|
@@ -132778,7 +132806,7 @@ function preProcessFile(sourceText, readImportFiles = true, detectJavaScriptImpo
|
|
|
132778
132806
|
}
|
|
132779
132807
|
function getFileReference() {
|
|
132780
132808
|
const fileName = scanner.getTokenValue();
|
|
132781
|
-
const pos = scanner.
|
|
132809
|
+
const pos = scanner.getTokenStart();
|
|
132782
132810
|
return { fileName, pos, end: pos + fileName.length };
|
|
132783
132811
|
}
|
|
132784
132812
|
function recordAmbientExternalModule() {
|
|
@@ -134531,10 +134559,10 @@ function createChildren(node, sourceFile) {
|
|
|
134531
134559
|
return children;
|
|
134532
134560
|
}
|
|
134533
134561
|
function addSyntheticNodes(nodes, pos, end, parent2) {
|
|
134534
|
-
scanner.
|
|
134562
|
+
scanner.resetTokenState(pos);
|
|
134535
134563
|
while (pos < end) {
|
|
134536
134564
|
const token = scanner.scan();
|
|
134537
|
-
const textPos = scanner.
|
|
134565
|
+
const textPos = scanner.getTokenEnd();
|
|
134538
134566
|
if (textPos <= end) {
|
|
134539
134567
|
if (token === 79 /* Identifier */) {
|
|
134540
134568
|
if (hasTabstop(parent2)) {
|
|
@@ -145106,7 +145134,7 @@ registerCodeFix({
|
|
|
145106
145134
|
];
|
|
145107
145135
|
}
|
|
145108
145136
|
return [
|
|
145109
|
-
createDeleteFix(ts_textChanges_exports.ChangeTracker.with(context, (t) => t
|
|
145137
|
+
createDeleteFix(ts_textChanges_exports.ChangeTracker.with(context, (t) => deleteDestructuring(context, t, sourceFile, token.parent)), Diagnostics.Remove_unused_destructuring_declaration)
|
|
145110
145138
|
];
|
|
145111
145139
|
}
|
|
145112
145140
|
if (canDeleteEntireVariableStatement(sourceFile, token)) {
|
|
@@ -145239,6 +145267,24 @@ function deleteEntireVariableStatement(changes, sourceFile, node) {
|
|
|
145239
145267
|
function deleteDestructuringElements(changes, sourceFile, node) {
|
|
145240
145268
|
forEach(node.elements, (n) => changes.delete(sourceFile, n));
|
|
145241
145269
|
}
|
|
145270
|
+
function deleteDestructuring(context, changes, sourceFile, { parent: parent2 }) {
|
|
145271
|
+
if (isVariableDeclaration(parent2) && parent2.initializer && isCallLikeExpression(parent2.initializer)) {
|
|
145272
|
+
if (isVariableDeclarationList(parent2.parent) && length(parent2.parent.declarations) > 1) {
|
|
145273
|
+
const varStatement = parent2.parent.parent;
|
|
145274
|
+
const pos = varStatement.getStart(sourceFile);
|
|
145275
|
+
const end = varStatement.end;
|
|
145276
|
+
changes.delete(sourceFile, parent2);
|
|
145277
|
+
changes.insertNodeAt(sourceFile, end, parent2.initializer, {
|
|
145278
|
+
prefix: getNewLineOrDefaultFromHost(context.host, context.formatContext.options) + sourceFile.text.slice(getPrecedingNonSpaceCharacterPosition(sourceFile.text, pos - 1), pos),
|
|
145279
|
+
suffix: probablyUsesSemicolons(sourceFile) ? ";" : ""
|
|
145280
|
+
});
|
|
145281
|
+
} else {
|
|
145282
|
+
changes.replaceNode(sourceFile, parent2.parent, parent2.initializer);
|
|
145283
|
+
}
|
|
145284
|
+
} else {
|
|
145285
|
+
changes.delete(sourceFile, parent2);
|
|
145286
|
+
}
|
|
145287
|
+
}
|
|
145242
145288
|
function tryPrefixDeclaration(changes, errorCode, sourceFile, token) {
|
|
145243
145289
|
if (errorCode === Diagnostics.Property_0_is_declared_but_its_value_is_never_read.code)
|
|
145244
145290
|
return;
|
|
@@ -150400,7 +150446,7 @@ function getCompletionData(program, log, sourceFile, compilerOptions, position,
|
|
|
150400
150446
|
function getTypeScriptMemberSymbols() {
|
|
150401
150447
|
completionKind = 2 /* PropertyAccess */;
|
|
150402
150448
|
const isImportType = isLiteralImportTypeNode(node);
|
|
150403
|
-
const isTypeLocation =
|
|
150449
|
+
const isTypeLocation = isImportType && !node.isTypeOf || isPartOfTypeNode(node.parent) || isPossiblyTypeArgumentPosition(contextToken, sourceFile, typeChecker);
|
|
150404
150450
|
const isRhsOfImportDeclaration = isInRightSideOfInternalImportEqualsDeclaration(node);
|
|
150405
150451
|
if (isEntityName(node) || isImportType || isPropertyAccessExpression(node)) {
|
|
150406
150452
|
const isNamespaceName = isModuleDeclaration(node.parent);
|
|
@@ -150420,13 +150466,13 @@ function getCompletionData(program, log, sourceFile, compilerOptions, position,
|
|
|
150420
150466
|
} : isRhsOfImportDeclaration ? (
|
|
150421
150467
|
// Any kind is allowed when dotting off namespace in internal import equals declaration
|
|
150422
150468
|
(symbol2) => isValidTypeAccess(symbol2) || isValidValueAccess(symbol2)
|
|
150423
|
-
) : isTypeLocation ? isValidTypeAccess : isValidValueAccess;
|
|
150469
|
+
) : isTypeLocation || insideJsDocTagTypeExpression ? isValidTypeAccess : isValidValueAccess;
|
|
150424
150470
|
for (const exportedSymbol of exportedSymbols) {
|
|
150425
150471
|
if (isValidAccess(exportedSymbol)) {
|
|
150426
150472
|
symbols.push(exportedSymbol);
|
|
150427
150473
|
}
|
|
150428
150474
|
}
|
|
150429
|
-
if (!isTypeLocation && symbol.declarations && symbol.declarations.some((d) => d.kind !== 308 /* SourceFile */ && d.kind !== 264 /* ModuleDeclaration */ && d.kind !== 263 /* EnumDeclaration */)) {
|
|
150475
|
+
if (!isTypeLocation && !insideJsDocTagTypeExpression && symbol.declarations && symbol.declarations.some((d) => d.kind !== 308 /* SourceFile */ && d.kind !== 264 /* ModuleDeclaration */ && d.kind !== 263 /* EnumDeclaration */)) {
|
|
150430
150476
|
let type = typeChecker.getTypeOfSymbolAtLocation(symbol, node).getNonOptionalType();
|
|
150431
150477
|
let insertQuestionDot = false;
|
|
150432
150478
|
if (type.isNullableType()) {
|
|
@@ -156547,7 +156593,7 @@ function isNewGroup(sourceFile, decl, scanner2) {
|
|
|
156547
156593
|
const endPos = decl.getStart();
|
|
156548
156594
|
scanner2.setText(sourceFile.text, startPos, endPos - startPos);
|
|
156549
156595
|
let numberOfNewLines = 0;
|
|
156550
|
-
while (scanner2.
|
|
156596
|
+
while (scanner2.getTokenStart() < endPos) {
|
|
156551
156597
|
const tokenKind = scanner2.scan();
|
|
156552
156598
|
if (tokenKind === 4 /* NewLineTrivia */) {
|
|
156553
156599
|
numberOfNewLines++;
|
|
@@ -158378,7 +158424,7 @@ function getNewStatementsAndRemoveFromOldFile(oldFile, usage, changes, toMove, p
|
|
|
158378
158424
|
}
|
|
158379
158425
|
deleteUnusedOldImports(oldFile, toMove.all, changes, usage.unusedImportsFromOldFile, checker);
|
|
158380
158426
|
deleteMovedStatements(oldFile, toMove.ranges, changes);
|
|
158381
|
-
updateImportsInOtherFiles(changes, program, host, oldFile, usage.movedSymbols, newFilename);
|
|
158427
|
+
updateImportsInOtherFiles(changes, program, host, oldFile, usage.movedSymbols, newFilename, quotePreference);
|
|
158382
158428
|
const imports = getNewFileImportsAndAddExportInOldFile(oldFile, usage.oldImportsNeededByNewFile, usage.newFileImportsFromOldFile, changes, checker, program, host, useEsModuleSyntax, quotePreference);
|
|
158383
158429
|
const body = addExports(oldFile, toMove.all, usage.oldFileImportsFromNewFile, useEsModuleSyntax);
|
|
158384
158430
|
if (imports.length && body.length) {
|
|
@@ -158407,7 +158453,7 @@ function deleteUnusedOldImports(oldFile, toMove, changes, toDelete, checker) {
|
|
|
158407
158453
|
forEachImportInStatement(statement, (i) => deleteUnusedImports(oldFile, i, changes, (name) => toDelete.has(checker.getSymbolAtLocation(name))));
|
|
158408
158454
|
}
|
|
158409
158455
|
}
|
|
158410
|
-
function updateImportsInOtherFiles(changes, program, host, oldFile, movedSymbols, newFilename) {
|
|
158456
|
+
function updateImportsInOtherFiles(changes, program, host, oldFile, movedSymbols, newFilename, quotePreference) {
|
|
158411
158457
|
const checker = program.getTypeChecker();
|
|
158412
158458
|
for (const sourceFile of program.getSourceFiles()) {
|
|
158413
158459
|
if (sourceFile === oldFile)
|
|
@@ -158423,12 +158469,12 @@ function updateImportsInOtherFiles(changes, program, host, oldFile, movedSymbols
|
|
|
158423
158469
|
deleteUnusedImports(sourceFile, importNode, changes, shouldMove);
|
|
158424
158470
|
const pathToNewFileWithExtension = resolvePath(getDirectoryPath(oldFile.path), newFilename);
|
|
158425
158471
|
const newModuleSpecifier = getModuleSpecifier(program.getCompilerOptions(), sourceFile, sourceFile.path, pathToNewFileWithExtension, createModuleSpecifierResolutionHost(program, host));
|
|
158426
|
-
const newImportDeclaration = filterImport(importNode,
|
|
158472
|
+
const newImportDeclaration = filterImport(importNode, makeStringLiteral(newModuleSpecifier, quotePreference), shouldMove);
|
|
158427
158473
|
if (newImportDeclaration)
|
|
158428
158474
|
changes.insertNodeAfter(sourceFile, statement, newImportDeclaration);
|
|
158429
158475
|
const ns = getNamespaceLikeImport(importNode);
|
|
158430
158476
|
if (ns)
|
|
158431
|
-
updateNamespaceLikeImport(changes, sourceFile, checker, movedSymbols, newModuleSpecifier, ns, importNode);
|
|
158477
|
+
updateNamespaceLikeImport(changes, sourceFile, checker, movedSymbols, newModuleSpecifier, ns, importNode, quotePreference);
|
|
158432
158478
|
});
|
|
158433
158479
|
}
|
|
158434
158480
|
}
|
|
@@ -158445,7 +158491,7 @@ function getNamespaceLikeImport(node) {
|
|
|
158445
158491
|
return Debug.assertNever(node, `Unexpected node kind ${node.kind}`);
|
|
158446
158492
|
}
|
|
158447
158493
|
}
|
|
158448
|
-
function updateNamespaceLikeImport(changes, sourceFile, checker, movedSymbols, newModuleSpecifier, oldImportId, oldImportNode) {
|
|
158494
|
+
function updateNamespaceLikeImport(changes, sourceFile, checker, movedSymbols, newModuleSpecifier, oldImportId, oldImportNode, quotePreference) {
|
|
158449
158495
|
const preferredNewNamespaceName = ts_codefix_exports.moduleSpecifierToValidIdentifier(newModuleSpecifier, 99 /* ESNext */);
|
|
158450
158496
|
let needUniqueName = false;
|
|
158451
158497
|
const toChange = [];
|
|
@@ -158468,12 +158514,12 @@ function updateNamespaceLikeImport(changes, sourceFile, checker, movedSymbols, n
|
|
|
158468
158514
|
for (const ref of toChange) {
|
|
158469
158515
|
changes.replaceNode(sourceFile, ref, factory.createIdentifier(newNamespaceName));
|
|
158470
158516
|
}
|
|
158471
|
-
changes.insertNodeAfter(sourceFile, oldImportNode, updateNamespaceLikeImportNode(oldImportNode, preferredNewNamespaceName, newModuleSpecifier));
|
|
158517
|
+
changes.insertNodeAfter(sourceFile, oldImportNode, updateNamespaceLikeImportNode(oldImportNode, preferredNewNamespaceName, newModuleSpecifier, quotePreference));
|
|
158472
158518
|
}
|
|
158473
158519
|
}
|
|
158474
|
-
function updateNamespaceLikeImportNode(node, newNamespaceName, newModuleSpecifier) {
|
|
158520
|
+
function updateNamespaceLikeImportNode(node, newNamespaceName, newModuleSpecifier, quotePreference) {
|
|
158475
158521
|
const newNamespaceId = factory.createIdentifier(newNamespaceName);
|
|
158476
|
-
const newModuleString =
|
|
158522
|
+
const newModuleString = makeStringLiteral(newModuleSpecifier, quotePreference);
|
|
158477
158523
|
switch (node.kind) {
|
|
158478
158524
|
case 269 /* ImportDeclaration */:
|
|
158479
158525
|
return factory.createImportDeclaration(
|
|
@@ -158572,7 +158618,7 @@ function makeImportOrRequire(sourceFile, defaultImport, imports, newFileNameWith
|
|
|
158572
158618
|
factory.createObjectBindingPattern(bindingElements),
|
|
158573
158619
|
/*type*/
|
|
158574
158620
|
void 0,
|
|
158575
|
-
createRequireCall(
|
|
158621
|
+
createRequireCall(makeStringLiteral(pathToNewFileWithCorrectExtension, quotePreference))
|
|
158576
158622
|
) : void 0;
|
|
158577
158623
|
}
|
|
158578
158624
|
}
|
|
@@ -165356,7 +165402,7 @@ var jsxScanner = createScanner(
|
|
|
165356
165402
|
function getFormattingScanner(text, languageVariant, startPos, endPos, cb) {
|
|
165357
165403
|
const scanner2 = languageVariant === 1 /* JSX */ ? jsxScanner : standardScanner;
|
|
165358
165404
|
scanner2.setText(text);
|
|
165359
|
-
scanner2.
|
|
165405
|
+
scanner2.resetTokenState(startPos);
|
|
165360
165406
|
let wasNewLine = true;
|
|
165361
165407
|
let leadingTrivia;
|
|
165362
165408
|
let trailingTrivia;
|
|
@@ -165373,9 +165419,13 @@ function getFormattingScanner(text, languageVariant, startPos, endPos, cb) {
|
|
|
165373
165419
|
lastTrailingTriviaWasNewLine: () => wasNewLine,
|
|
165374
165420
|
skipToEndOf,
|
|
165375
165421
|
skipToStartOf,
|
|
165422
|
+
getTokenFullStart: () => {
|
|
165423
|
+
var _a2;
|
|
165424
|
+
return (_a2 = lastTokenInfo == null ? void 0 : lastTokenInfo.token.pos) != null ? _a2 : scanner2.getTokenStart();
|
|
165425
|
+
},
|
|
165376
165426
|
getStartPos: () => {
|
|
165377
165427
|
var _a2;
|
|
165378
|
-
return (_a2 = lastTokenInfo == null ? void 0 : lastTokenInfo.token.pos) != null ? _a2 : scanner2.
|
|
165428
|
+
return (_a2 = lastTokenInfo == null ? void 0 : lastTokenInfo.token.pos) != null ? _a2 : scanner2.getTokenStart();
|
|
165379
165429
|
}
|
|
165380
165430
|
});
|
|
165381
165431
|
lastTokenInfo = void 0;
|
|
@@ -165383,7 +165433,7 @@ function getFormattingScanner(text, languageVariant, startPos, endPos, cb) {
|
|
|
165383
165433
|
return res;
|
|
165384
165434
|
function advance() {
|
|
165385
165435
|
lastTokenInfo = void 0;
|
|
165386
|
-
const isStarted = scanner2.
|
|
165436
|
+
const isStarted = scanner2.getTokenFullStart() !== startPos;
|
|
165387
165437
|
if (isStarted) {
|
|
165388
165438
|
wasNewLine = !!trailingTrivia && last(trailingTrivia).kind === 4 /* NewLineTrivia */;
|
|
165389
165439
|
} else {
|
|
@@ -165391,7 +165441,7 @@ function getFormattingScanner(text, languageVariant, startPos, endPos, cb) {
|
|
|
165391
165441
|
}
|
|
165392
165442
|
leadingTrivia = void 0;
|
|
165393
165443
|
trailingTrivia = void 0;
|
|
165394
|
-
let pos = scanner2.
|
|
165444
|
+
let pos = scanner2.getTokenFullStart();
|
|
165395
165445
|
while (pos < endPos) {
|
|
165396
165446
|
const t = scanner2.getToken();
|
|
165397
165447
|
if (!isTrivia(t)) {
|
|
@@ -165400,13 +165450,13 @@ function getFormattingScanner(text, languageVariant, startPos, endPos, cb) {
|
|
|
165400
165450
|
scanner2.scan();
|
|
165401
165451
|
const item = {
|
|
165402
165452
|
pos,
|
|
165403
|
-
end: scanner2.
|
|
165453
|
+
end: scanner2.getTokenFullStart(),
|
|
165404
165454
|
kind: t
|
|
165405
165455
|
};
|
|
165406
|
-
pos = scanner2.
|
|
165456
|
+
pos = scanner2.getTokenFullStart();
|
|
165407
165457
|
leadingTrivia = append(leadingTrivia, item);
|
|
165408
165458
|
}
|
|
165409
|
-
savedPos = scanner2.
|
|
165459
|
+
savedPos = scanner2.getTokenFullStart();
|
|
165410
165460
|
}
|
|
165411
165461
|
function shouldRescanGreaterThanToken(node) {
|
|
165412
165462
|
switch (node.kind) {
|
|
@@ -165452,28 +165502,28 @@ function getFormattingScanner(text, languageVariant, startPos, endPos, cb) {
|
|
|
165452
165502
|
if (lastTokenInfo && expectedScanAction === lastScanAction) {
|
|
165453
165503
|
return fixTokenKind(lastTokenInfo, n);
|
|
165454
165504
|
}
|
|
165455
|
-
if (scanner2.
|
|
165505
|
+
if (scanner2.getTokenFullStart() !== savedPos) {
|
|
165456
165506
|
Debug.assert(lastTokenInfo !== void 0);
|
|
165457
|
-
scanner2.
|
|
165507
|
+
scanner2.resetTokenState(savedPos);
|
|
165458
165508
|
scanner2.scan();
|
|
165459
165509
|
}
|
|
165460
165510
|
let currentToken = getNextToken(n, expectedScanAction);
|
|
165461
165511
|
const token = createTextRangeWithKind(
|
|
165462
|
-
scanner2.
|
|
165463
|
-
scanner2.
|
|
165512
|
+
scanner2.getTokenFullStart(),
|
|
165513
|
+
scanner2.getTokenEnd(),
|
|
165464
165514
|
currentToken
|
|
165465
165515
|
);
|
|
165466
165516
|
if (trailingTrivia) {
|
|
165467
165517
|
trailingTrivia = void 0;
|
|
165468
165518
|
}
|
|
165469
|
-
while (scanner2.
|
|
165519
|
+
while (scanner2.getTokenFullStart() < endPos) {
|
|
165470
165520
|
currentToken = scanner2.scan();
|
|
165471
165521
|
if (!isTrivia(currentToken)) {
|
|
165472
165522
|
break;
|
|
165473
165523
|
}
|
|
165474
165524
|
const trivia = createTextRangeWithKind(
|
|
165475
|
-
scanner2.
|
|
165476
|
-
scanner2.
|
|
165525
|
+
scanner2.getTokenFullStart(),
|
|
165526
|
+
scanner2.getTokenEnd(),
|
|
165477
165527
|
currentToken
|
|
165478
165528
|
);
|
|
165479
165529
|
if (!trailingTrivia) {
|
|
@@ -165538,7 +165588,7 @@ function getFormattingScanner(text, languageVariant, startPos, endPos, cb) {
|
|
|
165538
165588
|
}
|
|
165539
165589
|
function readEOFTokenRange() {
|
|
165540
165590
|
Debug.assert(isOnEOF());
|
|
165541
|
-
return createTextRangeWithKind(scanner2.
|
|
165591
|
+
return createTextRangeWithKind(scanner2.getTokenFullStart(), scanner2.getTokenEnd(), 1 /* EndOfFileToken */);
|
|
165542
165592
|
}
|
|
165543
165593
|
function isOnToken() {
|
|
165544
165594
|
const current = lastTokenInfo ? lastTokenInfo.token.kind : scanner2.getToken();
|
|
@@ -165555,8 +165605,8 @@ function getFormattingScanner(text, languageVariant, startPos, endPos, cb) {
|
|
|
165555
165605
|
return tokenInfo;
|
|
165556
165606
|
}
|
|
165557
165607
|
function skipToEndOf(node) {
|
|
165558
|
-
scanner2.
|
|
165559
|
-
savedPos = scanner2.
|
|
165608
|
+
scanner2.resetTokenState(node.end);
|
|
165609
|
+
savedPos = scanner2.getTokenFullStart();
|
|
165560
165610
|
lastScanAction = void 0;
|
|
165561
165611
|
lastTokenInfo = void 0;
|
|
165562
165612
|
wasNewLine = false;
|
|
@@ -165564,8 +165614,8 @@ function getFormattingScanner(text, languageVariant, startPos, endPos, cb) {
|
|
|
165564
165614
|
trailingTrivia = void 0;
|
|
165565
165615
|
}
|
|
165566
165616
|
function skipToStartOf(node) {
|
|
165567
|
-
scanner2.
|
|
165568
|
-
savedPos = scanner2.
|
|
165617
|
+
scanner2.resetTokenState(node.pos);
|
|
165618
|
+
savedPos = scanner2.getTokenFullStart();
|
|
165569
165619
|
lastScanAction = void 0;
|
|
165570
165620
|
lastTokenInfo = void 0;
|
|
165571
165621
|
wasNewLine = false;
|
|
@@ -166640,7 +166690,7 @@ function formatSpanWorker(originalRange, enclosingNode, initialIndentation, delt
|
|
|
166640
166690
|
}
|
|
166641
166691
|
}
|
|
166642
166692
|
}
|
|
166643
|
-
if (previousRange && formattingScanner.
|
|
166693
|
+
if (previousRange && formattingScanner.getTokenFullStart() >= originalRange.end) {
|
|
166644
166694
|
const tokenInfo = formattingScanner.isOnEOF() ? formattingScanner.readEOFTokenRange() : formattingScanner.isOnToken() ? formattingScanner.readTokenInfo(enclosingNode).token : void 0;
|
|
166645
166695
|
if (tokenInfo && tokenInfo.pos === previousRangeTriviaEnd) {
|
|
166646
166696
|
const parent2 = ((_a2 = findPrecedingToken(tokenInfo.end, sourceFile, enclosingNode)) == null ? void 0 : _a2.parent) || previousParent;
|
|
@@ -166818,7 +166868,7 @@ function formatSpanWorker(originalRange, enclosingNode, initialIndentation, delt
|
|
|
166818
166868
|
processChildNodes(nodes, node, nodeStartLine, nodeDynamicIndentation);
|
|
166819
166869
|
}
|
|
166820
166870
|
);
|
|
166821
|
-
while (formattingScanner.isOnToken() && formattingScanner.
|
|
166871
|
+
while (formattingScanner.isOnToken() && formattingScanner.getTokenFullStart() < originalRange.end) {
|
|
166822
166872
|
const tokenInfo = formattingScanner.readTokenInfo(node);
|
|
166823
166873
|
if (tokenInfo.token.end > Math.min(node.end, originalRange.end)) {
|
|
166824
166874
|
break;
|
|
@@ -166852,7 +166902,7 @@ function formatSpanWorker(originalRange, enclosingNode, initialIndentation, delt
|
|
|
166852
166902
|
if (child.getFullWidth() === 0) {
|
|
166853
166903
|
return inheritedIndentation;
|
|
166854
166904
|
}
|
|
166855
|
-
while (formattingScanner.isOnToken() && formattingScanner.
|
|
166905
|
+
while (formattingScanner.isOnToken() && formattingScanner.getTokenFullStart() < originalRange.end) {
|
|
166856
166906
|
const tokenInfo = formattingScanner.readTokenInfo(node);
|
|
166857
166907
|
if (tokenInfo.token.end > originalRange.end) {
|
|
166858
166908
|
return inheritedIndentation;
|
|
@@ -166865,7 +166915,7 @@ function formatSpanWorker(originalRange, enclosingNode, initialIndentation, delt
|
|
|
166865
166915
|
}
|
|
166866
166916
|
consumeTokenAndAdvanceScanner(tokenInfo, node, parentDynamicIndentation, node);
|
|
166867
166917
|
}
|
|
166868
|
-
if (!formattingScanner.isOnToken() || formattingScanner.
|
|
166918
|
+
if (!formattingScanner.isOnToken() || formattingScanner.getTokenFullStart() >= originalRange.end) {
|
|
166869
166919
|
return inheritedIndentation;
|
|
166870
166920
|
}
|
|
166871
166921
|
if (isToken(child)) {
|
|
@@ -166898,7 +166948,7 @@ function formatSpanWorker(originalRange, enclosingNode, initialIndentation, delt
|
|
|
166898
166948
|
return;
|
|
166899
166949
|
}
|
|
166900
166950
|
if (listStartToken !== 0 /* Unknown */) {
|
|
166901
|
-
while (formattingScanner.isOnToken() && formattingScanner.
|
|
166951
|
+
while (formattingScanner.isOnToken() && formattingScanner.getTokenFullStart() < originalRange.end) {
|
|
166902
166952
|
const tokenInfo = formattingScanner.readTokenInfo(parent2);
|
|
166903
166953
|
if (tokenInfo.token.end > nodes.pos) {
|
|
166904
166954
|
break;
|
|
@@ -166935,7 +166985,7 @@ function formatSpanWorker(originalRange, enclosingNode, initialIndentation, delt
|
|
|
166935
166985
|
);
|
|
166936
166986
|
}
|
|
166937
166987
|
const listEndToken = getCloseTokenForOpenToken(listStartToken);
|
|
166938
|
-
if (listEndToken !== 0 /* Unknown */ && formattingScanner.isOnToken() && formattingScanner.
|
|
166988
|
+
if (listEndToken !== 0 /* Unknown */ && formattingScanner.isOnToken() && formattingScanner.getTokenFullStart() < originalRange.end) {
|
|
166939
166989
|
let tokenInfo = formattingScanner.readTokenInfo(parent2);
|
|
166940
166990
|
if (tokenInfo.token.kind === 27 /* CommaToken */) {
|
|
166941
166991
|
consumeTokenAndAdvanceScanner(tokenInfo, parent2, listDynamicIndentation, parent2);
|
|
@@ -167951,7 +168001,6 @@ __export(ts_exports3, {
|
|
|
167951
168001
|
ContextFlags: () => ContextFlags,
|
|
167952
168002
|
CoreServicesShimHostAdapter: () => CoreServicesShimHostAdapter,
|
|
167953
168003
|
Debug: () => Debug,
|
|
167954
|
-
DeprecationVersion: () => DeprecationVersion,
|
|
167955
168004
|
DiagnosticCategory: () => DiagnosticCategory,
|
|
167956
168005
|
Diagnostics: () => Diagnostics,
|
|
167957
168006
|
DocumentHighlights: () => DocumentHighlights,
|
|
@@ -181912,7 +181961,6 @@ start(initializeNodeSystem(), require("os").platform());
|
|
|
181912
181961
|
ContextFlags,
|
|
181913
181962
|
CoreServicesShimHostAdapter,
|
|
181914
181963
|
Debug,
|
|
181915
|
-
DeprecationVersion,
|
|
181916
181964
|
DiagnosticCategory,
|
|
181917
181965
|
Diagnostics,
|
|
181918
181966
|
DocumentHighlights,
|