@typescript-deploys/pr-build 6.0.0-pr-62673-3 → 6.0.0-pr-62418-27
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 +217 -260
- package/lib/cs/diagnosticMessages.generated.json +6 -4
- package/lib/de/diagnosticMessages.generated.json +6 -4
- package/lib/es/diagnosticMessages.generated.json +4 -3
- package/lib/fr/diagnosticMessages.generated.json +6 -4
- package/lib/it/diagnosticMessages.generated.json +6 -4
- package/lib/ja/diagnosticMessages.generated.json +6 -4
- package/lib/ko/diagnosticMessages.generated.json +4 -3
- package/lib/pl/diagnosticMessages.generated.json +6 -4
- package/lib/pt-br/diagnosticMessages.generated.json +4 -3
- package/lib/ru/diagnosticMessages.generated.json +6 -4
- package/lib/tr/diagnosticMessages.generated.json +6 -4
- package/lib/typescript.js +229 -244
- package/lib/zh-cn/diagnosticMessages.generated.json +6 -4
- package/lib/zh-tw/diagnosticMessages.generated.json +4 -3
- package/package.json +18 -18
package/lib/_tsc.js
CHANGED
|
@@ -18,7 +18,7 @@ and limitations under the License.
|
|
|
18
18
|
|
|
19
19
|
// src/compiler/corePublic.ts
|
|
20
20
|
var versionMajorMinor = "6.0";
|
|
21
|
-
var version = `${versionMajorMinor}.0-insiders.
|
|
21
|
+
var version = `${versionMajorMinor}.0-insiders.20251124`;
|
|
22
22
|
|
|
23
23
|
// src/compiler/core.ts
|
|
24
24
|
var emptyArray = [];
|
|
@@ -368,20 +368,6 @@ function some(array, predicate) {
|
|
|
368
368
|
}
|
|
369
369
|
return false;
|
|
370
370
|
}
|
|
371
|
-
function getRangesWhere(arr, pred, cb) {
|
|
372
|
-
let start;
|
|
373
|
-
for (let i = 0; i < arr.length; i++) {
|
|
374
|
-
if (pred(arr[i])) {
|
|
375
|
-
start = start === void 0 ? i : start;
|
|
376
|
-
} else {
|
|
377
|
-
if (start !== void 0) {
|
|
378
|
-
cb(start, i);
|
|
379
|
-
start = void 0;
|
|
380
|
-
}
|
|
381
|
-
}
|
|
382
|
-
}
|
|
383
|
-
if (start !== void 0) cb(start, arr.length);
|
|
384
|
-
}
|
|
385
371
|
function concatenate(array1, array2) {
|
|
386
372
|
if (array2 === void 0 || array2.length === 0) return array1;
|
|
387
373
|
if (array1 === void 0 || array1.length === 0) return array2;
|
|
@@ -3362,6 +3348,7 @@ var NodeFlags = /* @__PURE__ */ ((NodeFlags3) => {
|
|
|
3362
3348
|
NodeFlags3[NodeFlags3["JsonFile"] = 134217728] = "JsonFile";
|
|
3363
3349
|
NodeFlags3[NodeFlags3["TypeCached"] = 268435456] = "TypeCached";
|
|
3364
3350
|
NodeFlags3[NodeFlags3["Deprecated"] = 536870912] = "Deprecated";
|
|
3351
|
+
NodeFlags3[NodeFlags3["Unreachable"] = 1073741824] = "Unreachable";
|
|
3365
3352
|
NodeFlags3[NodeFlags3["BlockScoped"] = 7] = "BlockScoped";
|
|
3366
3353
|
NodeFlags3[NodeFlags3["Constant"] = 6] = "Constant";
|
|
3367
3354
|
NodeFlags3[NodeFlags3["ReachabilityCheckFlags"] = 1536] = "ReachabilityCheckFlags";
|
|
@@ -6252,6 +6239,8 @@ var Diagnostics = {
|
|
|
6252
6239
|
Named_imports_from_a_JSON_file_into_an_ECMAScript_module_are_not_allowed_when_module_is_set_to_0: diag(1544, 1 /* Error */, "Named_imports_from_a_JSON_file_into_an_ECMAScript_module_are_not_allowed_when_module_is_set_to_0_1544", "Named imports from a JSON file into an ECMAScript module are not allowed when 'module' is set to '{0}'."),
|
|
6253
6240
|
using_declarations_are_not_allowed_in_ambient_contexts: diag(1545, 1 /* Error */, "using_declarations_are_not_allowed_in_ambient_contexts_1545", "'using' declarations are not allowed in ambient contexts."),
|
|
6254
6241
|
await_using_declarations_are_not_allowed_in_ambient_contexts: diag(1546, 1 /* Error */, "await_using_declarations_are_not_allowed_in_ambient_contexts_1546", "'await using' declarations are not allowed in ambient contexts."),
|
|
6242
|
+
using_declarations_are_not_allowed_in_case_or_default_clauses_unless_contained_within_a_block: diag(1547, 1 /* Error */, "using_declarations_are_not_allowed_in_case_or_default_clauses_unless_contained_within_a_block_1547", "'using' declarations are not allowed in 'case' or 'default' clauses unless contained within a block."),
|
|
6243
|
+
await_using_declarations_are_not_allowed_in_case_or_default_clauses_unless_contained_within_a_block: diag(1548, 1 /* Error */, "await_using_declarations_are_not_allowed_in_case_or_default_clauses_unless_contained_within_a_block_1548", "'await using' declarations are not allowed in 'case' or 'default' clauses unless contained within a block."),
|
|
6255
6244
|
The_types_of_0_are_incompatible_between_these_types: diag(2200, 1 /* Error */, "The_types_of_0_are_incompatible_between_these_types_2200", "The types of '{0}' are incompatible between these types."),
|
|
6256
6245
|
The_types_returned_by_0_are_incompatible_between_these_types: diag(2201, 1 /* Error */, "The_types_returned_by_0_are_incompatible_between_these_types_2201", "The types returned by '{0}' are incompatible between these types."),
|
|
6257
6246
|
Call_signature_return_types_0_and_1_are_incompatible: diag(
|
|
@@ -6947,6 +6936,7 @@ var Diagnostics = {
|
|
|
6947
6936
|
The_current_host_does_not_support_the_0_option: diag(5001, 1 /* Error */, "The_current_host_does_not_support_the_0_option_5001", "The current host does not support the '{0}' option."),
|
|
6948
6937
|
Cannot_find_the_common_subdirectory_path_for_the_input_files: diag(5009, 1 /* Error */, "Cannot_find_the_common_subdirectory_path_for_the_input_files_5009", "Cannot find the common subdirectory path for the input files."),
|
|
6949
6938
|
File_specification_cannot_end_in_a_recursive_directory_wildcard_Asterisk_Asterisk_Colon_0: diag(5010, 1 /* Error */, "File_specification_cannot_end_in_a_recursive_directory_wildcard_Asterisk_Asterisk_Colon_0_5010", "File specification cannot end in a recursive directory wildcard ('**'): '{0}'."),
|
|
6939
|
+
The_common_source_directory_of_0_is_1_The_rootDir_setting_must_be_explicitly_set_to_this_or_another_path_to_adjust_your_output_s_file_layout: diag(5011, 1 /* Error */, "The_common_source_directory_of_0_is_1_The_rootDir_setting_must_be_explicitly_set_to_this_or_another__5011", "The common source directory of '{0}' is '{1}'. The 'rootDir' setting must be explicitly set to this or another path to adjust your output's file layout."),
|
|
6950
6940
|
Cannot_read_file_0_Colon_1: diag(5012, 1 /* Error */, "Cannot_read_file_0_Colon_1_5012", "Cannot read file '{0}': {1}."),
|
|
6951
6941
|
Unknown_compiler_option_0: diag(5023, 1 /* Error */, "Unknown_compiler_option_0_5023", "Unknown compiler option '{0}'."),
|
|
6952
6942
|
Compiler_option_0_requires_a_value_of_type_1: diag(5024, 1 /* Error */, "Compiler_option_0_requires_a_value_of_type_1_5024", "Compiler option '{0}' requires a value of type {1}."),
|
|
@@ -6997,7 +6987,7 @@ var Diagnostics = {
|
|
|
6997
6987
|
Compiler_option_0_may_only_be_used_with_build: diag(5093, 1 /* Error */, "Compiler_option_0_may_only_be_used_with_build_5093", "Compiler option '--{0}' may only be used with '--build'."),
|
|
6998
6988
|
Compiler_option_0_may_not_be_used_with_build: diag(5094, 1 /* Error */, "Compiler_option_0_may_not_be_used_with_build_5094", "Compiler option '--{0}' may not be used with '--build'."),
|
|
6999
6989
|
Option_0_can_only_be_used_when_module_is_set_to_preserve_commonjs_or_es2015_or_later: diag(5095, 1 /* Error */, "Option_0_can_only_be_used_when_module_is_set_to_preserve_commonjs_or_es2015_or_later_5095", "Option '{0}' can only be used when 'module' is set to 'preserve', 'commonjs', or 'es2015' or later."),
|
|
7000
|
-
|
|
6990
|
+
Option_allowImportingTsExtensions_can_only_be_used_when_one_of_noEmit_emitDeclarationOnly_or_rewriteRelativeImportExtensions_is_set: diag(5096, 1 /* Error */, "Option_allowImportingTsExtensions_can_only_be_used_when_one_of_noEmit_emitDeclarationOnly_or_rewrite_5096", "Option 'allowImportingTsExtensions' can only be used when one of 'noEmit', 'emitDeclarationOnly', or 'rewriteRelativeImportExtensions' is set."),
|
|
7001
6991
|
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."),
|
|
7002
6992
|
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'."),
|
|
7003
6993
|
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.`),
|
|
@@ -12484,9 +12474,6 @@ function isDeclaration(node) {
|
|
|
12484
12474
|
function isDeclarationStatement(node) {
|
|
12485
12475
|
return isDeclarationStatementKind(node.kind);
|
|
12486
12476
|
}
|
|
12487
|
-
function isStatementButNotDeclaration(node) {
|
|
12488
|
-
return isStatementKindButNotDeclarationKind(node.kind);
|
|
12489
|
-
}
|
|
12490
12477
|
function isStatement(node) {
|
|
12491
12478
|
const kind = node.kind;
|
|
12492
12479
|
return isStatementKindButNotDeclarationKind(kind) || isDeclarationStatementKind(kind) || isBlockStatement(node);
|
|
@@ -16600,7 +16587,7 @@ function sourceFileMayBeEmitted(sourceFile, host, forceDtsEmit) {
|
|
|
16600
16587
|
if (host.getRedirectFromSourceFile(sourceFile.fileName)) return false;
|
|
16601
16588
|
if (options.outFile) return true;
|
|
16602
16589
|
if (!options.outDir) return false;
|
|
16603
|
-
if (options.rootDir || options.
|
|
16590
|
+
if (options.rootDir || options.configFilePath) {
|
|
16604
16591
|
const commonDir = getNormalizedAbsolutePath(getCommonSourceDirectory(options, () => [], host.getCurrentDirectory(), host.getCanonicalFileName), host.getCurrentDirectory());
|
|
16605
16592
|
const outputPath = getSourceFilePathInNewDirWorker(sourceFile.fileName, options.outDir, host.getCurrentDirectory(), commonDir, host.getCanonicalFileName);
|
|
16606
16593
|
if (comparePaths(sourceFile.fileName, outputPath, host.getCurrentDirectory(), !host.useCaseSensitiveFileNames()) === 0 /* EqualTo */) return false;
|
|
@@ -18225,12 +18212,6 @@ function hasJsonModuleEmitEnabled(options) {
|
|
|
18225
18212
|
}
|
|
18226
18213
|
return true;
|
|
18227
18214
|
}
|
|
18228
|
-
function unreachableCodeIsError(options) {
|
|
18229
|
-
return options.allowUnreachableCode === false;
|
|
18230
|
-
}
|
|
18231
|
-
function unusedLabelIsError(options) {
|
|
18232
|
-
return options.allowUnusedLabels === false;
|
|
18233
|
-
}
|
|
18234
18215
|
function moduleResolutionSupportsPackageJsonExportsAndImports(moduleResolution) {
|
|
18235
18216
|
return moduleResolution >= 3 /* Node16 */ && moduleResolution <= 99 /* NodeNext */ || moduleResolution === 100 /* Bundler */;
|
|
18236
18217
|
}
|
|
@@ -18801,11 +18782,6 @@ function matchPatternOrExact(parsedPatterns, candidate) {
|
|
|
18801
18782
|
}
|
|
18802
18783
|
return findBestPatternMatch(patterns, (_) => _, candidate);
|
|
18803
18784
|
}
|
|
18804
|
-
function sliceAfter(arr, value) {
|
|
18805
|
-
const index = arr.indexOf(value);
|
|
18806
|
-
Debug.assert(index !== -1);
|
|
18807
|
-
return arr.slice(index);
|
|
18808
|
-
}
|
|
18809
18785
|
function addRelatedInfo(diagnostic, ...relatedInformation) {
|
|
18810
18786
|
if (!relatedInformation.length) {
|
|
18811
18787
|
return diagnostic;
|
|
@@ -20155,6 +20131,21 @@ function addEmitFlagsRecursively(node, flag, getChild) {
|
|
|
20155
20131
|
function getFirstChild(node) {
|
|
20156
20132
|
return forEachChild(node, (child) => child);
|
|
20157
20133
|
}
|
|
20134
|
+
function canHaveStatements(node) {
|
|
20135
|
+
return isBlock(node) || isModuleBlock(node) || isSourceFile(node) || isCaseClause(node) || isDefaultClause(node);
|
|
20136
|
+
}
|
|
20137
|
+
function isPotentiallyExecutableNode(node) {
|
|
20138
|
+
if (244 /* FirstStatement */ <= node.kind && node.kind <= 260 /* LastStatement */) {
|
|
20139
|
+
if (isVariableStatement(node)) {
|
|
20140
|
+
if (getCombinedNodeFlags(node.declarationList) & 7 /* BlockScoped */) {
|
|
20141
|
+
return true;
|
|
20142
|
+
}
|
|
20143
|
+
return some(node.declarationList.declarations, (d) => d.initializer !== void 0);
|
|
20144
|
+
}
|
|
20145
|
+
return true;
|
|
20146
|
+
}
|
|
20147
|
+
return isClassDeclaration(node) || isEnumDeclaration(node) || isModuleDeclaration(node);
|
|
20148
|
+
}
|
|
20158
20149
|
|
|
20159
20150
|
// src/compiler/factory/baseNodeFactory.ts
|
|
20160
20151
|
function createBaseNodeFactory() {
|
|
@@ -41732,7 +41723,7 @@ function getLoadModuleFromTargetExportOrImport(extensions, state, cache, redirec
|
|
|
41732
41723
|
if (!state.isConfigLookup && (state.compilerOptions.declarationDir || state.compilerOptions.outDir) && !finalPath.includes("/node_modules/") && (state.compilerOptions.configFile ? containsPath(scope.packageDirectory, toAbsolutePath(state.compilerOptions.configFile.fileName), !useCaseSensitiveFileNames(state)) : true)) {
|
|
41733
41724
|
const getCanonicalFileName = hostGetCanonicalFileName({ useCaseSensitiveFileNames: () => useCaseSensitiveFileNames(state) });
|
|
41734
41725
|
const commonSourceDirGuesses = [];
|
|
41735
|
-
if (state.compilerOptions.rootDir || state.compilerOptions.
|
|
41726
|
+
if (state.compilerOptions.rootDir || state.compilerOptions.configFilePath) {
|
|
41736
41727
|
const commonDir = toAbsolutePath(getCommonSourceDirectory(state.compilerOptions, () => [], ((_b2 = (_a2 = state.host).getCurrentDirectory) == null ? void 0 : _b2.call(_a2)) || "", getCanonicalFileName));
|
|
41737
41728
|
commonSourceDirGuesses.push(commonDir);
|
|
41738
41729
|
} else if (state.requestContainingDirectory) {
|
|
@@ -42370,13 +42361,6 @@ function createBinder() {
|
|
|
42370
42361
|
/*antecedent*/
|
|
42371
42362
|
void 0
|
|
42372
42363
|
);
|
|
42373
|
-
var reportedUnreachableFlow = createFlowNode(
|
|
42374
|
-
1 /* Unreachable */,
|
|
42375
|
-
/*node*/
|
|
42376
|
-
void 0,
|
|
42377
|
-
/*antecedent*/
|
|
42378
|
-
void 0
|
|
42379
|
-
);
|
|
42380
42364
|
var bindBinaryExpressionFlow = createBindBinaryExpressionFlow();
|
|
42381
42365
|
return bindSourceFile2;
|
|
42382
42366
|
function createDiagnosticForNode2(node, message, ...args) {
|
|
@@ -42392,7 +42376,6 @@ function createBinder() {
|
|
|
42392
42376
|
symbolCount = 0;
|
|
42393
42377
|
Symbol13 = objectAllocator.getSymbolConstructor();
|
|
42394
42378
|
Debug.attachFlowNodeDebugInfo(unreachableFlow);
|
|
42395
|
-
Debug.attachFlowNodeDebugInfo(reportedUnreachableFlow);
|
|
42396
42379
|
if (!file.locals) {
|
|
42397
42380
|
(_a = tracing) == null ? void 0 : _a.push(
|
|
42398
42381
|
tracing.Phase.Bind,
|
|
@@ -42765,16 +42748,22 @@ function createBinder() {
|
|
|
42765
42748
|
function bindChildren(node) {
|
|
42766
42749
|
const saveInAssignmentPattern = inAssignmentPattern;
|
|
42767
42750
|
inAssignmentPattern = false;
|
|
42768
|
-
if (
|
|
42769
|
-
|
|
42751
|
+
if (isPotentiallyExecutableNode(node)) {
|
|
42752
|
+
node.flags &= ~1073741824 /* Unreachable */;
|
|
42753
|
+
}
|
|
42754
|
+
if (currentFlow === unreachableFlow) {
|
|
42755
|
+
if (canHaveFlowNode(node)) {
|
|
42770
42756
|
node.flowNode = void 0;
|
|
42771
42757
|
}
|
|
42758
|
+
if (isPotentiallyExecutableNode(node)) {
|
|
42759
|
+
node.flags |= 1073741824 /* Unreachable */;
|
|
42760
|
+
}
|
|
42772
42761
|
bindEachChild(node);
|
|
42773
42762
|
bindJSDoc(node);
|
|
42774
42763
|
inAssignmentPattern = saveInAssignmentPattern;
|
|
42775
42764
|
return;
|
|
42776
42765
|
}
|
|
42777
|
-
if (
|
|
42766
|
+
if (244 /* FirstStatement */ <= node.kind && node.kind <= 260 /* LastStatement */ && canHaveFlowNode(node)) {
|
|
42778
42767
|
node.flowNode = currentFlow;
|
|
42779
42768
|
}
|
|
42780
42769
|
switch (node.kind) {
|
|
@@ -43361,8 +43350,8 @@ function createBinder() {
|
|
|
43361
43350
|
};
|
|
43362
43351
|
bind(node.label);
|
|
43363
43352
|
bind(node.statement);
|
|
43364
|
-
if (!activeLabelList.referenced
|
|
43365
|
-
|
|
43353
|
+
if (!activeLabelList.referenced) {
|
|
43354
|
+
node.label.flags |= 1073741824 /* Unreachable */;
|
|
43366
43355
|
}
|
|
43367
43356
|
activeLabelList = activeLabelList.next;
|
|
43368
43357
|
addAntecedent(postStatementLabel, currentFlow);
|
|
@@ -44139,20 +44128,6 @@ function createBinder() {
|
|
|
44139
44128
|
const span = getSpanOfTokenAtPosition(file, node.pos);
|
|
44140
44129
|
file.bindDiagnostics.push(createFileDiagnostic(file, span.start, span.length, message, ...args));
|
|
44141
44130
|
}
|
|
44142
|
-
function errorOrSuggestionOnNode(isError, node, message) {
|
|
44143
|
-
errorOrSuggestionOnRange(isError, node, node, message);
|
|
44144
|
-
}
|
|
44145
|
-
function errorOrSuggestionOnRange(isError, startNode, endNode, message) {
|
|
44146
|
-
addErrorOrSuggestionDiagnostic(isError, { pos: getTokenPosOfNode(startNode, file), end: endNode.end }, message);
|
|
44147
|
-
}
|
|
44148
|
-
function addErrorOrSuggestionDiagnostic(isError, range, message) {
|
|
44149
|
-
const diag2 = createFileDiagnostic(file, range.pos, range.end - range.pos, message);
|
|
44150
|
-
if (isError) {
|
|
44151
|
-
file.bindDiagnostics.push(diag2);
|
|
44152
|
-
} else {
|
|
44153
|
-
file.bindSuggestionDiagnostics = append(file.bindSuggestionDiagnostics, { ...diag2, category: 2 /* Suggestion */ });
|
|
44154
|
-
}
|
|
44155
|
-
}
|
|
44156
44131
|
function bind(node) {
|
|
44157
44132
|
if (!node) {
|
|
44158
44133
|
return;
|
|
@@ -45039,61 +45014,6 @@ function createBinder() {
|
|
|
45039
45014
|
declareSymbolAndAddToSymbolTable(node, 262144 /* TypeParameter */, 526824 /* TypeParameterExcludes */);
|
|
45040
45015
|
}
|
|
45041
45016
|
}
|
|
45042
|
-
function shouldReportErrorOnModuleDeclaration(node) {
|
|
45043
|
-
const instanceState = getModuleInstanceState(node);
|
|
45044
|
-
return instanceState === 1 /* Instantiated */ || instanceState === 2 /* ConstEnumOnly */ && shouldPreserveConstEnums(options);
|
|
45045
|
-
}
|
|
45046
|
-
function checkUnreachable(node) {
|
|
45047
|
-
if (!(currentFlow.flags & 1 /* Unreachable */)) {
|
|
45048
|
-
return false;
|
|
45049
|
-
}
|
|
45050
|
-
if (currentFlow === unreachableFlow) {
|
|
45051
|
-
const reportError = (
|
|
45052
|
-
// report error on all statements except empty ones
|
|
45053
|
-
isStatementButNotDeclaration(node) && node.kind !== 243 /* EmptyStatement */ || // report error on class declarations
|
|
45054
|
-
node.kind === 264 /* ClassDeclaration */ || // report errors on enums with preserved emit
|
|
45055
|
-
isEnumDeclarationWithPreservedEmit(node, options) || // report error on instantiated modules
|
|
45056
|
-
node.kind === 268 /* ModuleDeclaration */ && shouldReportErrorOnModuleDeclaration(node)
|
|
45057
|
-
);
|
|
45058
|
-
if (reportError) {
|
|
45059
|
-
currentFlow = reportedUnreachableFlow;
|
|
45060
|
-
if (!options.allowUnreachableCode) {
|
|
45061
|
-
const isError = unreachableCodeIsError(options) && !(node.flags & 33554432 /* Ambient */) && (!isVariableStatement(node) || !!(getCombinedNodeFlags(node.declarationList) & 7 /* BlockScoped */) || node.declarationList.declarations.some((d) => !!d.initializer));
|
|
45062
|
-
eachUnreachableRange(node, options, (start, end) => errorOrSuggestionOnRange(isError, start, end, Diagnostics.Unreachable_code_detected));
|
|
45063
|
-
}
|
|
45064
|
-
}
|
|
45065
|
-
}
|
|
45066
|
-
return true;
|
|
45067
|
-
}
|
|
45068
|
-
}
|
|
45069
|
-
function isEnumDeclarationWithPreservedEmit(node, options) {
|
|
45070
|
-
return node.kind === 267 /* EnumDeclaration */ && (!isEnumConst(node) || shouldPreserveConstEnums(options));
|
|
45071
|
-
}
|
|
45072
|
-
function eachUnreachableRange(node, options, cb) {
|
|
45073
|
-
if (isStatement(node) && isExecutableStatement(node) && isBlock(node.parent)) {
|
|
45074
|
-
const { statements } = node.parent;
|
|
45075
|
-
const slice = sliceAfter(statements, node);
|
|
45076
|
-
getRangesWhere(slice, isExecutableStatement, (start, afterEnd) => cb(slice[start], slice[afterEnd - 1]));
|
|
45077
|
-
} else {
|
|
45078
|
-
cb(node, node);
|
|
45079
|
-
}
|
|
45080
|
-
function isExecutableStatement(s) {
|
|
45081
|
-
return !isFunctionDeclaration(s) && !isPurelyTypeDeclaration(s) && // `var x;` may declare a variable used above
|
|
45082
|
-
!(isVariableStatement(s) && !(getCombinedNodeFlags(s) & 7 /* BlockScoped */) && s.declarationList.declarations.some((d) => !d.initializer));
|
|
45083
|
-
}
|
|
45084
|
-
function isPurelyTypeDeclaration(s) {
|
|
45085
|
-
switch (s.kind) {
|
|
45086
|
-
case 265 /* InterfaceDeclaration */:
|
|
45087
|
-
case 266 /* TypeAliasDeclaration */:
|
|
45088
|
-
return true;
|
|
45089
|
-
case 268 /* ModuleDeclaration */:
|
|
45090
|
-
return getModuleInstanceState(s) !== 1 /* Instantiated */;
|
|
45091
|
-
case 267 /* EnumDeclaration */:
|
|
45092
|
-
return !isEnumDeclarationWithPreservedEmit(s, options);
|
|
45093
|
-
default:
|
|
45094
|
-
return false;
|
|
45095
|
-
}
|
|
45096
|
-
}
|
|
45097
45017
|
}
|
|
45098
45018
|
function isExportsOrModuleExportsOrAlias(sourceFile, node) {
|
|
45099
45019
|
let i = 0;
|
|
@@ -46434,6 +46354,8 @@ function createTypeChecker(host) {
|
|
|
46434
46354
|
var currentNode;
|
|
46435
46355
|
var varianceTypeParameter;
|
|
46436
46356
|
var isInferencePartiallyBlocked = false;
|
|
46357
|
+
var withinUnreachableCode = false;
|
|
46358
|
+
var reportedUnreachableNodes;
|
|
46437
46359
|
var emptySymbols = createSymbolTable();
|
|
46438
46360
|
var arrayVariances = [1 /* Covariant */];
|
|
46439
46361
|
var compilerOptions = host.getCompilerOptions();
|
|
@@ -65566,35 +65488,11 @@ function createTypeChecker(host) {
|
|
|
65566
65488
|
/*reportErrors*/
|
|
65567
65489
|
false
|
|
65568
65490
|
) : compareTypesIdentical(s, t);
|
|
65569
|
-
} else
|
|
65570
|
-
|
|
65571
|
-
s,
|
|
65572
|
-
|
|
65573
|
-
|
|
65574
|
-
reportErrors2,
|
|
65575
|
-
/*headMessage*/
|
|
65576
|
-
void 0,
|
|
65577
|
-
intersectionState
|
|
65578
|
-
);
|
|
65579
|
-
} else if (variance === 2 /* Contravariant */) {
|
|
65580
|
-
related = isRelatedTo(
|
|
65581
|
-
t,
|
|
65582
|
-
s,
|
|
65583
|
-
3 /* Both */,
|
|
65584
|
-
reportErrors2,
|
|
65585
|
-
/*headMessage*/
|
|
65586
|
-
void 0,
|
|
65587
|
-
intersectionState
|
|
65588
|
-
);
|
|
65589
|
-
} else if (variance === 3 /* Bivariant */) {
|
|
65590
|
-
related = isRelatedTo(
|
|
65591
|
-
t,
|
|
65592
|
-
s,
|
|
65593
|
-
3 /* Both */,
|
|
65594
|
-
/*reportErrors*/
|
|
65595
|
-
false
|
|
65596
|
-
);
|
|
65597
|
-
if (!related) {
|
|
65491
|
+
} else {
|
|
65492
|
+
if (inVarianceComputation && varianceFlags & 16 /* Unreliable */) {
|
|
65493
|
+
instantiateType(s, reportUnreliableMapper);
|
|
65494
|
+
}
|
|
65495
|
+
if (variance === 1 /* Covariant */) {
|
|
65598
65496
|
related = isRelatedTo(
|
|
65599
65497
|
s,
|
|
65600
65498
|
t,
|
|
@@ -65604,27 +65502,56 @@ function createTypeChecker(host) {
|
|
|
65604
65502
|
void 0,
|
|
65605
65503
|
intersectionState
|
|
65606
65504
|
);
|
|
65607
|
-
}
|
|
65608
|
-
|
|
65609
|
-
|
|
65610
|
-
|
|
65611
|
-
|
|
65612
|
-
|
|
65613
|
-
|
|
65614
|
-
|
|
65615
|
-
|
|
65616
|
-
|
|
65617
|
-
)
|
|
65618
|
-
|
|
65619
|
-
related &= isRelatedTo(
|
|
65505
|
+
} else if (variance === 2 /* Contravariant */) {
|
|
65506
|
+
related = isRelatedTo(
|
|
65507
|
+
t,
|
|
65508
|
+
s,
|
|
65509
|
+
3 /* Both */,
|
|
65510
|
+
reportErrors2,
|
|
65511
|
+
/*headMessage*/
|
|
65512
|
+
void 0,
|
|
65513
|
+
intersectionState
|
|
65514
|
+
);
|
|
65515
|
+
} else if (variance === 3 /* Bivariant */) {
|
|
65516
|
+
related = isRelatedTo(
|
|
65620
65517
|
t,
|
|
65621
65518
|
s,
|
|
65622
65519
|
3 /* Both */,
|
|
65520
|
+
/*reportErrors*/
|
|
65521
|
+
false
|
|
65522
|
+
);
|
|
65523
|
+
if (!related) {
|
|
65524
|
+
related = isRelatedTo(
|
|
65525
|
+
s,
|
|
65526
|
+
t,
|
|
65527
|
+
3 /* Both */,
|
|
65528
|
+
reportErrors2,
|
|
65529
|
+
/*headMessage*/
|
|
65530
|
+
void 0,
|
|
65531
|
+
intersectionState
|
|
65532
|
+
);
|
|
65533
|
+
}
|
|
65534
|
+
} else {
|
|
65535
|
+
related = isRelatedTo(
|
|
65536
|
+
s,
|
|
65537
|
+
t,
|
|
65538
|
+
3 /* Both */,
|
|
65623
65539
|
reportErrors2,
|
|
65624
65540
|
/*headMessage*/
|
|
65625
65541
|
void 0,
|
|
65626
65542
|
intersectionState
|
|
65627
65543
|
);
|
|
65544
|
+
if (related) {
|
|
65545
|
+
related &= isRelatedTo(
|
|
65546
|
+
t,
|
|
65547
|
+
s,
|
|
65548
|
+
3 /* Both */,
|
|
65549
|
+
reportErrors2,
|
|
65550
|
+
/*headMessage*/
|
|
65551
|
+
void 0,
|
|
65552
|
+
intersectionState
|
|
65553
|
+
);
|
|
65554
|
+
}
|
|
65628
65555
|
}
|
|
65629
65556
|
}
|
|
65630
65557
|
if (!related) {
|
|
@@ -70668,18 +70595,22 @@ function createTypeChecker(host) {
|
|
|
70668
70595
|
const symbol = getResolvedSymbol(expr);
|
|
70669
70596
|
if (isConstantVariable(symbol)) {
|
|
70670
70597
|
const declaration = symbol.valueDeclaration;
|
|
70671
|
-
|
|
70672
|
-
|
|
70598
|
+
let initializer = getCandidateVariableDeclarationInitializer(declaration);
|
|
70599
|
+
if (initializer && isAccessExpression(initializer) && isMatchingReference(reference, initializer.expression)) {
|
|
70600
|
+
return initializer;
|
|
70673
70601
|
}
|
|
70674
70602
|
if (isBindingElement(declaration) && !declaration.initializer) {
|
|
70675
|
-
|
|
70676
|
-
if (
|
|
70603
|
+
initializer = getCandidateVariableDeclarationInitializer(declaration.parent.parent);
|
|
70604
|
+
if (initializer && (isIdentifier(initializer) || isAccessExpression(initializer)) && isMatchingReference(reference, initializer)) {
|
|
70677
70605
|
return declaration;
|
|
70678
70606
|
}
|
|
70679
70607
|
}
|
|
70680
70608
|
}
|
|
70681
70609
|
}
|
|
70682
70610
|
return void 0;
|
|
70611
|
+
function getCandidateVariableDeclarationInitializer(node) {
|
|
70612
|
+
return isVariableDeclaration(node) && !node.type && node.initializer ? skipParentheses(node.initializer) : void 0;
|
|
70613
|
+
}
|
|
70683
70614
|
}
|
|
70684
70615
|
function getDiscriminantPropertyAccess(expr, computedType) {
|
|
70685
70616
|
if (declaredType.flags & 1048576 /* Union */ || computedType.flags & 1048576 /* Union */) {
|
|
@@ -71017,7 +70948,7 @@ function createTypeChecker(host) {
|
|
|
71017
70948
|
if (!hasDefaultClause) {
|
|
71018
70949
|
return caseType;
|
|
71019
70950
|
}
|
|
71020
|
-
const defaultType = filterType(type, (t) => !(isUnitLikeType(t) && contains(switchTypes, t.flags & 32768 /* Undefined */ ? undefinedType : getRegularTypeOfLiteralType(extractUnitType(t)))));
|
|
70951
|
+
const defaultType = filterType(type, (t) => !(isUnitLikeType(t) && contains(switchTypes, t.flags & 32768 /* Undefined */ ? undefinedType : getRegularTypeOfLiteralType(extractUnitType(t)), (t1, t2) => isUnitType(t1) && areTypesComparable(t1, t2))));
|
|
71021
70952
|
return caseType.flags & 131072 /* Never */ ? defaultType : getUnionType([caseType, defaultType]);
|
|
71022
70953
|
}
|
|
71023
70954
|
function narrowTypeByTypeName(type, typeName) {
|
|
@@ -71617,26 +71548,9 @@ function createTypeChecker(host) {
|
|
|
71617
71548
|
function markIdentifierAliasReferenced(location) {
|
|
71618
71549
|
const symbol = getResolvedSymbol(location);
|
|
71619
71550
|
if (symbol && symbol !== argumentsSymbol && symbol !== unknownSymbol && !isThisInTypeQuery(location)) {
|
|
71620
|
-
if (isIdentifierInAbstractMemberComputedPropertyName(location)) {
|
|
71621
|
-
return;
|
|
71622
|
-
}
|
|
71623
71551
|
markAliasReferenced(symbol, location);
|
|
71624
71552
|
}
|
|
71625
71553
|
}
|
|
71626
|
-
function isIdentifierInAbstractMemberComputedPropertyName(node) {
|
|
71627
|
-
let parent = node.parent;
|
|
71628
|
-
while (parent) {
|
|
71629
|
-
if (isComputedPropertyName(parent)) {
|
|
71630
|
-
const memberParent = parent.parent;
|
|
71631
|
-
if ((isMethodDeclaration(memberParent) || isMethodSignature(memberParent) || isPropertyDeclaration(memberParent) || isPropertySignature(memberParent)) && hasSyntacticModifier(memberParent, 64 /* Abstract */)) {
|
|
71632
|
-
return true;
|
|
71633
|
-
}
|
|
71634
|
-
return false;
|
|
71635
|
-
}
|
|
71636
|
-
parent = parent.parent;
|
|
71637
|
-
}
|
|
71638
|
-
return false;
|
|
71639
|
-
}
|
|
71640
71554
|
function markPropertyAliasReferenced(location, propSymbol, parentType) {
|
|
71641
71555
|
const left = isPropertyAccessExpression(location) ? location.expression : location.left;
|
|
71642
71556
|
if (isThisIdentifier(left) || !isIdentifier(left)) {
|
|
@@ -78664,6 +78578,9 @@ function createTypeChecker(host) {
|
|
|
78664
78578
|
let fallbackReturnType = voidType;
|
|
78665
78579
|
if (func.body.kind !== 242 /* Block */) {
|
|
78666
78580
|
returnType = checkExpressionCached(func.body, checkMode && checkMode & ~8 /* SkipGenericFunctions */);
|
|
78581
|
+
if (isConstContext(func.body)) {
|
|
78582
|
+
returnType = getRegularTypeOfLiteralType(returnType);
|
|
78583
|
+
}
|
|
78667
78584
|
if (isAsync) {
|
|
78668
78585
|
returnType = unwrapAwaitedType(checkAwaitedType(
|
|
78669
78586
|
returnType,
|
|
@@ -78695,7 +78612,7 @@ function createTypeChecker(host) {
|
|
|
78695
78612
|
/*contextFlags*/
|
|
78696
78613
|
void 0
|
|
78697
78614
|
);
|
|
78698
|
-
const returnType2 = contextualReturnType && (unwrapReturnType(contextualReturnType, functionFlags) || voidType).flags & 32768 /* Undefined */ ? undefinedType : voidType;
|
|
78615
|
+
const returnType2 = contextualReturnType && someType(unwrapReturnType(contextualReturnType, functionFlags) || voidType, (t) => !!(t.flags & 32768 /* Undefined */)) ? undefinedType : voidType;
|
|
78699
78616
|
return functionFlags & 2 /* Async */ ? createPromiseReturnType(func, returnType2) : (
|
|
78700
78617
|
// Async function
|
|
78701
78618
|
returnType2
|
|
@@ -78775,7 +78692,10 @@ function createTypeChecker(host) {
|
|
|
78775
78692
|
const nextTypes = [];
|
|
78776
78693
|
const isAsync = (getFunctionFlags(func) & 2 /* Async */) !== 0;
|
|
78777
78694
|
forEachYieldExpression(func.body, (yieldExpression) => {
|
|
78778
|
-
|
|
78695
|
+
let yieldExpressionType = yieldExpression.expression ? checkExpression(yieldExpression.expression, checkMode) : undefinedWideningType;
|
|
78696
|
+
if (yieldExpression.expression && isConstContext(yieldExpression.expression)) {
|
|
78697
|
+
yieldExpressionType = getRegularTypeOfLiteralType(yieldExpressionType);
|
|
78698
|
+
}
|
|
78779
78699
|
pushIfUnique(yieldTypes, getYieldedTypeOfYieldExpression(yieldExpression, yieldExpressionType, anyType, isAsync));
|
|
78780
78700
|
let nextType;
|
|
78781
78701
|
if (yieldExpression.asteriskToken) {
|
|
@@ -78892,7 +78812,7 @@ function createTypeChecker(host) {
|
|
|
78892
78812
|
if (type.flags & 131072 /* Never */) {
|
|
78893
78813
|
hasReturnOfTypeNever = true;
|
|
78894
78814
|
}
|
|
78895
|
-
pushIfUnique(aggregatedTypes, type);
|
|
78815
|
+
pushIfUnique(aggregatedTypes, isConstContext(expr) ? getRegularTypeOfLiteralType(type) : type);
|
|
78896
78816
|
} else {
|
|
78897
78817
|
hasReturnWithNoExpression = true;
|
|
78898
78818
|
}
|
|
@@ -83969,6 +83889,7 @@ function createTypeChecker(host) {
|
|
|
83969
83889
|
}
|
|
83970
83890
|
function getIterationTypesOfIterable(type, use, errorNode) {
|
|
83971
83891
|
var _a, _b;
|
|
83892
|
+
type = getReducedType(type);
|
|
83972
83893
|
if (type === silentNeverType) {
|
|
83973
83894
|
return silentNeverIterationTypes;
|
|
83974
83895
|
}
|
|
@@ -84042,7 +83963,7 @@ function createTypeChecker(host) {
|
|
|
84042
83963
|
}
|
|
84043
83964
|
let noCache = false;
|
|
84044
83965
|
if (use & 2 /* AllowsAsyncIterablesFlag */) {
|
|
84045
|
-
|
|
83966
|
+
let iterationTypes = getIterationTypesOfIterableCached(type, asyncIterationTypesResolver) || getIterationTypesOfIterableFast(type, asyncIterationTypesResolver);
|
|
84046
83967
|
if (iterationTypes) {
|
|
84047
83968
|
if (iterationTypes === noIterationTypes && errorNode) {
|
|
84048
83969
|
noCache = true;
|
|
@@ -84050,6 +83971,10 @@ function createTypeChecker(host) {
|
|
|
84050
83971
|
return use & 8 /* ForOfFlag */ ? getAsyncFromSyncIterationTypes(iterationTypes, errorNode) : iterationTypes;
|
|
84051
83972
|
}
|
|
84052
83973
|
}
|
|
83974
|
+
iterationTypes = getIterationTypesOfIterableSlow(type, asyncIterationTypesResolver, errorNode, errorOutputContainer, noCache);
|
|
83975
|
+
if (iterationTypes !== noIterationTypes) {
|
|
83976
|
+
return iterationTypes;
|
|
83977
|
+
}
|
|
84053
83978
|
}
|
|
84054
83979
|
if (use & 1 /* AllowsSyncIterablesFlag */) {
|
|
84055
83980
|
let iterationTypes = getIterationTypesOfIterableCached(type, syncIterationTypesResolver) || getIterationTypesOfIterableFast(type, syncIterationTypesResolver);
|
|
@@ -84067,15 +83992,7 @@ function createTypeChecker(host) {
|
|
|
84067
83992
|
}
|
|
84068
83993
|
}
|
|
84069
83994
|
}
|
|
84070
|
-
|
|
84071
|
-
if (use & 2 /* AllowsAsyncIterablesFlag */) {
|
|
84072
|
-
const iterationTypes = getIterationTypesOfIterableSlow(type, asyncIterationTypesResolver, errorNode, errorOutputContainer, noCache);
|
|
84073
|
-
if (iterationTypes !== noIterationTypes) {
|
|
84074
|
-
return iterationTypes;
|
|
84075
|
-
}
|
|
84076
|
-
}
|
|
84077
|
-
if (use & 1 /* AllowsSyncIterablesFlag */) {
|
|
84078
|
-
let iterationTypes = getIterationTypesOfIterableSlow(type, syncIterationTypesResolver, errorNode, errorOutputContainer, noCache);
|
|
83995
|
+
iterationTypes = getIterationTypesOfIterableSlow(type, syncIterationTypesResolver, errorNode, errorOutputContainer, noCache);
|
|
84079
83996
|
if (iterationTypes !== noIterationTypes) {
|
|
84080
83997
|
if (use & 2 /* AllowsAsyncIterablesFlag */) {
|
|
84081
83998
|
iterationTypes = getAsyncFromSyncIterationTypes(iterationTypes, errorNode);
|
|
@@ -84567,6 +84484,9 @@ function createTypeChecker(host) {
|
|
|
84567
84484
|
return false;
|
|
84568
84485
|
});
|
|
84569
84486
|
}
|
|
84487
|
+
if (node.label.flags & 1073741824 /* Unreachable */ && compilerOptions.allowUnusedLabels !== true) {
|
|
84488
|
+
errorOrSuggestion(compilerOptions.allowUnusedLabels === false, node.label, Diagnostics.Unused_label);
|
|
84489
|
+
}
|
|
84570
84490
|
checkSourceElement(node.statement);
|
|
84571
84491
|
}
|
|
84572
84492
|
function checkThrowStatement(node) {
|
|
@@ -86459,10 +86379,12 @@ function createTypeChecker(host) {
|
|
|
86459
86379
|
function checkSourceElement(node) {
|
|
86460
86380
|
if (node) {
|
|
86461
86381
|
const saveCurrentNode = currentNode;
|
|
86382
|
+
const saveWithinUnreachableCode = withinUnreachableCode;
|
|
86462
86383
|
currentNode = node;
|
|
86463
86384
|
instantiationCount = 0;
|
|
86464
86385
|
checkSourceElementWorker(node);
|
|
86465
86386
|
currentNode = saveCurrentNode;
|
|
86387
|
+
withinUnreachableCode = saveWithinUnreachableCode;
|
|
86466
86388
|
}
|
|
86467
86389
|
}
|
|
86468
86390
|
function checkSourceElementWorker(node) {
|
|
@@ -86490,8 +86412,10 @@ function createTypeChecker(host) {
|
|
|
86490
86412
|
cancellationToken.throwIfCancellationRequested();
|
|
86491
86413
|
}
|
|
86492
86414
|
}
|
|
86493
|
-
if (
|
|
86494
|
-
|
|
86415
|
+
if (compilerOptions.allowUnreachableCode !== true && !withinUnreachableCode) {
|
|
86416
|
+
if (checkSourceElementUnreachable(node)) {
|
|
86417
|
+
withinUnreachableCode = true;
|
|
86418
|
+
}
|
|
86495
86419
|
}
|
|
86496
86420
|
switch (kind) {
|
|
86497
86421
|
case 169 /* TypeParameter */:
|
|
@@ -86669,6 +86593,66 @@ function createTypeChecker(host) {
|
|
|
86669
86593
|
return checkMissingDeclaration(node);
|
|
86670
86594
|
}
|
|
86671
86595
|
}
|
|
86596
|
+
function checkSourceElementUnreachable(node) {
|
|
86597
|
+
if (!isPotentiallyExecutableNode(node)) {
|
|
86598
|
+
return false;
|
|
86599
|
+
}
|
|
86600
|
+
if (reportedUnreachableNodes == null ? void 0 : reportedUnreachableNodes.has(node)) {
|
|
86601
|
+
return true;
|
|
86602
|
+
}
|
|
86603
|
+
if (!isSourceElementUnreachable(node)) {
|
|
86604
|
+
return false;
|
|
86605
|
+
}
|
|
86606
|
+
(reportedUnreachableNodes ?? (reportedUnreachableNodes = /* @__PURE__ */ new Set())).add(node);
|
|
86607
|
+
const sourceFile = getSourceFileOfNode(node);
|
|
86608
|
+
let start = node.pos;
|
|
86609
|
+
let end = node.end;
|
|
86610
|
+
const parent = node.parent;
|
|
86611
|
+
if (canHaveStatements(parent)) {
|
|
86612
|
+
const statements = parent.statements;
|
|
86613
|
+
const offset = statements.indexOf(node);
|
|
86614
|
+
if (offset >= 0) {
|
|
86615
|
+
let first2 = offset;
|
|
86616
|
+
for (let i = offset - 1; i >= 0; i--) {
|
|
86617
|
+
const prevNode = statements[i];
|
|
86618
|
+
if (!isPotentiallyExecutableNode(prevNode) || reportedUnreachableNodes.has(prevNode) || !isSourceElementUnreachable(prevNode)) {
|
|
86619
|
+
break;
|
|
86620
|
+
}
|
|
86621
|
+
first2 = i;
|
|
86622
|
+
reportedUnreachableNodes.add(prevNode);
|
|
86623
|
+
}
|
|
86624
|
+
let last2 = offset;
|
|
86625
|
+
for (let i = offset + 1; i < statements.length; i++) {
|
|
86626
|
+
const nextNode = statements[i];
|
|
86627
|
+
if (!isPotentiallyExecutableNode(nextNode) || !isSourceElementUnreachable(nextNode)) {
|
|
86628
|
+
break;
|
|
86629
|
+
}
|
|
86630
|
+
last2 = i;
|
|
86631
|
+
reportedUnreachableNodes.add(nextNode);
|
|
86632
|
+
}
|
|
86633
|
+
start = statements[first2].pos;
|
|
86634
|
+
end = statements[last2].end;
|
|
86635
|
+
}
|
|
86636
|
+
}
|
|
86637
|
+
start = skipTrivia(sourceFile.text, start);
|
|
86638
|
+
addErrorOrSuggestion(compilerOptions.allowUnreachableCode === false, createFileDiagnostic(sourceFile, start, end - start, Diagnostics.Unreachable_code_detected));
|
|
86639
|
+
return true;
|
|
86640
|
+
}
|
|
86641
|
+
function isSourceElementUnreachable(node) {
|
|
86642
|
+
if (node.flags & 1073741824 /* Unreachable */) {
|
|
86643
|
+
switch (node.kind) {
|
|
86644
|
+
case 267 /* EnumDeclaration */:
|
|
86645
|
+
return !isEnumConst(node) || shouldPreserveConstEnums(compilerOptions);
|
|
86646
|
+
case 268 /* ModuleDeclaration */:
|
|
86647
|
+
return isInstantiatedModule(node, shouldPreserveConstEnums(compilerOptions));
|
|
86648
|
+
default:
|
|
86649
|
+
return true;
|
|
86650
|
+
}
|
|
86651
|
+
} else if (canHaveFlowNode(node) && node.flowNode) {
|
|
86652
|
+
return !isReachableFlowNode(node.flowNode);
|
|
86653
|
+
}
|
|
86654
|
+
return false;
|
|
86655
|
+
}
|
|
86672
86656
|
function checkJSDocCommentWorker(node) {
|
|
86673
86657
|
if (isArray(node)) {
|
|
86674
86658
|
forEach(node, (tag) => {
|
|
@@ -86831,6 +86815,7 @@ function createTypeChecker(host) {
|
|
|
86831
86815
|
mark(afterMark);
|
|
86832
86816
|
measure("Check", beforeMark, afterMark);
|
|
86833
86817
|
(_b = tracing) == null ? void 0 : _b.pop();
|
|
86818
|
+
reportedUnreachableNodes = void 0;
|
|
86834
86819
|
}
|
|
86835
86820
|
function unusedIsError(kind, isAmbient) {
|
|
86836
86821
|
if (isAmbient) {
|
|
@@ -89986,6 +89971,11 @@ function createTypeChecker(host) {
|
|
|
89986
89971
|
declarationList,
|
|
89987
89972
|
blockScopeFlags === 4 /* Using */ ? Diagnostics.The_left_hand_side_of_a_for_in_statement_cannot_be_a_using_declaration : Diagnostics.The_left_hand_side_of_a_for_in_statement_cannot_be_an_await_using_declaration
|
|
89988
89973
|
);
|
|
89974
|
+
} else if (isVariableStatement(declarationList.parent) && isCaseOrDefaultClause(declarationList.parent.parent)) {
|
|
89975
|
+
return grammarErrorOnNode(
|
|
89976
|
+
declarationList,
|
|
89977
|
+
blockScopeFlags === 4 /* Using */ ? Diagnostics.using_declarations_are_not_allowed_in_case_or_default_clauses_unless_contained_within_a_block : Diagnostics.await_using_declarations_are_not_allowed_in_case_or_default_clauses_unless_contained_within_a_block
|
|
89978
|
+
);
|
|
89989
89979
|
}
|
|
89990
89980
|
if (declarationList.flags & 33554432 /* Ambient */) {
|
|
89991
89981
|
return grammarErrorOnNode(
|
|
@@ -102824,8 +102814,6 @@ function transformESNext(context) {
|
|
|
102824
102814
|
return visitForStatement(node);
|
|
102825
102815
|
case 251 /* ForOfStatement */:
|
|
102826
102816
|
return visitForOfStatement(node);
|
|
102827
|
-
case 256 /* SwitchStatement */:
|
|
102828
|
-
return visitSwitchStatement(node);
|
|
102829
102817
|
default:
|
|
102830
102818
|
return visitEachChild(node, visitor, context);
|
|
102831
102819
|
}
|
|
@@ -102989,60 +102977,6 @@ function transformESNext(context) {
|
|
|
102989
102977
|
}
|
|
102990
102978
|
return visitEachChild(node, visitor, context);
|
|
102991
102979
|
}
|
|
102992
|
-
function visitCaseOrDefaultClause(node, envBinding) {
|
|
102993
|
-
if (getUsingKindOfStatements(node.statements) !== 0 /* None */) {
|
|
102994
|
-
if (isCaseClause(node)) {
|
|
102995
|
-
return factory2.updateCaseClause(
|
|
102996
|
-
node,
|
|
102997
|
-
visitNode(node.expression, visitor, isExpression),
|
|
102998
|
-
transformUsingDeclarations(
|
|
102999
|
-
node.statements,
|
|
103000
|
-
/*start*/
|
|
103001
|
-
0,
|
|
103002
|
-
node.statements.length,
|
|
103003
|
-
envBinding,
|
|
103004
|
-
/*topLevelStatements*/
|
|
103005
|
-
void 0
|
|
103006
|
-
)
|
|
103007
|
-
);
|
|
103008
|
-
} else {
|
|
103009
|
-
return factory2.updateDefaultClause(
|
|
103010
|
-
node,
|
|
103011
|
-
transformUsingDeclarations(
|
|
103012
|
-
node.statements,
|
|
103013
|
-
/*start*/
|
|
103014
|
-
0,
|
|
103015
|
-
node.statements.length,
|
|
103016
|
-
envBinding,
|
|
103017
|
-
/*topLevelStatements*/
|
|
103018
|
-
void 0
|
|
103019
|
-
)
|
|
103020
|
-
);
|
|
103021
|
-
}
|
|
103022
|
-
}
|
|
103023
|
-
return visitEachChild(node, visitor, context);
|
|
103024
|
-
}
|
|
103025
|
-
function visitSwitchStatement(node) {
|
|
103026
|
-
const usingKind = getUsingKindOfCaseOrDefaultClauses(node.caseBlock.clauses);
|
|
103027
|
-
if (usingKind) {
|
|
103028
|
-
const envBinding = createEnvBinding();
|
|
103029
|
-
return createDownlevelUsingStatements(
|
|
103030
|
-
[
|
|
103031
|
-
factory2.updateSwitchStatement(
|
|
103032
|
-
node,
|
|
103033
|
-
visitNode(node.expression, visitor, isExpression),
|
|
103034
|
-
factory2.updateCaseBlock(
|
|
103035
|
-
node.caseBlock,
|
|
103036
|
-
node.caseBlock.clauses.map((clause) => visitCaseOrDefaultClause(clause, envBinding))
|
|
103037
|
-
)
|
|
103038
|
-
)
|
|
103039
|
-
],
|
|
103040
|
-
envBinding,
|
|
103041
|
-
usingKind === 2 /* Async */
|
|
103042
|
-
);
|
|
103043
|
-
}
|
|
103044
|
-
return visitEachChild(node, visitor, context);
|
|
103045
|
-
}
|
|
103046
102980
|
function transformUsingDeclarations(statementsIn, start, end, envBinding, topLevelStatements) {
|
|
103047
102981
|
const statements = [];
|
|
103048
102982
|
for (let i = start; i < end; i++) {
|
|
@@ -103408,15 +103342,6 @@ function getUsingKindOfStatements(statements) {
|
|
|
103408
103342
|
}
|
|
103409
103343
|
return result;
|
|
103410
103344
|
}
|
|
103411
|
-
function getUsingKindOfCaseOrDefaultClauses(clauses) {
|
|
103412
|
-
let result = 0 /* None */;
|
|
103413
|
-
for (const clause of clauses) {
|
|
103414
|
-
const usingKind = getUsingKindOfStatements(clause.statements);
|
|
103415
|
-
if (usingKind === 2 /* Async */) return 2 /* Async */;
|
|
103416
|
-
if (usingKind > result) result = usingKind;
|
|
103417
|
-
}
|
|
103418
|
-
return result;
|
|
103419
|
-
}
|
|
103420
103345
|
|
|
103421
103346
|
// src/compiler/transformers/jsx.ts
|
|
103422
103347
|
function transformJsx(context) {
|
|
@@ -116034,7 +115959,7 @@ function getCommonSourceDirectory(options, emittedFiles, currentDirectory, getCa
|
|
|
116034
115959
|
if (options.rootDir) {
|
|
116035
115960
|
commonSourceDirectory = getNormalizedAbsolutePath(options.rootDir, currentDirectory);
|
|
116036
115961
|
checkSourceFilesBelongToPath == null ? void 0 : checkSourceFilesBelongToPath(options.rootDir);
|
|
116037
|
-
} else if (options.
|
|
115962
|
+
} else if (options.configFilePath) {
|
|
116038
115963
|
commonSourceDirectory = getDirectoryPath(normalizeSlashes(options.configFilePath));
|
|
116039
115964
|
checkSourceFilesBelongToPath == null ? void 0 : checkSourceFilesBelongToPath(commonSourceDirectory);
|
|
116040
115965
|
} else {
|
|
@@ -116045,6 +115970,13 @@ function getCommonSourceDirectory(options, emittedFiles, currentDirectory, getCa
|
|
|
116045
115970
|
}
|
|
116046
115971
|
return commonSourceDirectory;
|
|
116047
115972
|
}
|
|
115973
|
+
function getComputedCommonSourceDirectory(emittedFiles, currentDirectory, getCanonicalFileName) {
|
|
115974
|
+
let commonSourceDirectory = computeCommonSourceDirectoryOfFilenames(emittedFiles, currentDirectory, getCanonicalFileName);
|
|
115975
|
+
if (commonSourceDirectory && commonSourceDirectory[commonSourceDirectory.length - 1] !== directorySeparator) {
|
|
115976
|
+
commonSourceDirectory += directorySeparator;
|
|
115977
|
+
}
|
|
115978
|
+
return commonSourceDirectory;
|
|
115979
|
+
}
|
|
116048
115980
|
function getCommonSourceDirectoryOfConfig({ options, fileNames }, ignoreCase) {
|
|
116049
115981
|
return getCommonSourceDirectory(
|
|
116050
115982
|
options,
|
|
@@ -124477,6 +124409,31 @@ function createProgram(_rootNamesOrOptions, _options, _host, _oldProgram, _confi
|
|
|
124477
124409
|
createDiagnosticForOptionName(Diagnostics.Cannot_find_the_common_subdirectory_path_for_the_input_files, "outDir");
|
|
124478
124410
|
}
|
|
124479
124411
|
}
|
|
124412
|
+
if (!options.noEmit && !options.composite && !options.rootDir && options.configFilePath && (options.outDir || // there is --outDir specified
|
|
124413
|
+
getEmitDeclarations(options) && options.declarationDir || // there is --declarationDir specified
|
|
124414
|
+
options.outFile)) {
|
|
124415
|
+
const dir = getCommonSourceDirectory2();
|
|
124416
|
+
const emittedFiles = mapDefined(files, (file) => !file.isDeclarationFile && sourceFileMayBeEmitted(file, program) ? file.fileName : void 0);
|
|
124417
|
+
const dir59 = getComputedCommonSourceDirectory(emittedFiles, currentDirectory, getCanonicalFileName);
|
|
124418
|
+
if (dir59 !== "" && getCanonicalFileName(dir) !== getCanonicalFileName(dir59)) {
|
|
124419
|
+
createDiagnosticForOption(
|
|
124420
|
+
/*onKey*/
|
|
124421
|
+
true,
|
|
124422
|
+
options.outFile ? "outFile" : options.outDir ? "outDir" : "declarationDir",
|
|
124423
|
+
!options.outFile && options.outDir ? "declarationDir" : void 0,
|
|
124424
|
+
chainDiagnosticMessages(
|
|
124425
|
+
chainDiagnosticMessages(
|
|
124426
|
+
/*details*/
|
|
124427
|
+
void 0,
|
|
124428
|
+
Diagnostics.Visit_https_Colon_Slash_Slashaka_ms_Slashts6_for_migration_information
|
|
124429
|
+
),
|
|
124430
|
+
Diagnostics.The_common_source_directory_of_0_is_1_The_rootDir_setting_must_be_explicitly_set_to_this_or_another_path_to_adjust_your_output_s_file_layout,
|
|
124431
|
+
getBaseFileName(options.configFilePath),
|
|
124432
|
+
getRelativePathFromFile(options.configFilePath, dir59, getCanonicalFileName)
|
|
124433
|
+
)
|
|
124434
|
+
);
|
|
124435
|
+
}
|
|
124436
|
+
}
|
|
124480
124437
|
if (options.checkJs && !getAllowJSCompilerOption(options)) {
|
|
124481
124438
|
createDiagnosticForOptionName(Diagnostics.Option_0_cannot_be_specified_without_specifying_option_1, "checkJs", "allowJs");
|
|
124482
124439
|
}
|
|
@@ -124529,7 +124486,7 @@ function createProgram(_rootNamesOrOptions, _options, _host, _oldProgram, _confi
|
|
|
124529
124486
|
}
|
|
124530
124487
|
}
|
|
124531
124488
|
if (options.allowImportingTsExtensions && !(options.noEmit || options.emitDeclarationOnly || options.rewriteRelativeImportExtensions)) {
|
|
124532
|
-
createOptionValueDiagnostic("allowImportingTsExtensions", Diagnostics.
|
|
124489
|
+
createOptionValueDiagnostic("allowImportingTsExtensions", Diagnostics.Option_allowImportingTsExtensions_can_only_be_used_when_one_of_noEmit_emitDeclarationOnly_or_rewriteRelativeImportExtensions_is_set);
|
|
124533
124490
|
}
|
|
124534
124491
|
const moduleResolution = getEmitModuleResolutionKind(options);
|
|
124535
124492
|
if (options.resolvePackageJsonExports && !moduleResolutionSupportsPackageJsonExportsAndImports(moduleResolution)) {
|