@typescript-deploys/pr-build 6.0.0-pr-62669-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 -243
- 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 -227
- 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,19 +65502,8 @@ function createTypeChecker(host) {
|
|
|
65604
65502
|
void 0,
|
|
65605
65503
|
intersectionState
|
|
65606
65504
|
);
|
|
65607
|
-
}
|
|
65608
|
-
|
|
65609
|
-
related = isRelatedTo(
|
|
65610
|
-
s,
|
|
65611
|
-
t,
|
|
65612
|
-
3 /* Both */,
|
|
65613
|
-
reportErrors2,
|
|
65614
|
-
/*headMessage*/
|
|
65615
|
-
void 0,
|
|
65616
|
-
intersectionState
|
|
65617
|
-
);
|
|
65618
|
-
if (related) {
|
|
65619
|
-
related &= isRelatedTo(
|
|
65505
|
+
} else if (variance === 2 /* Contravariant */) {
|
|
65506
|
+
related = isRelatedTo(
|
|
65620
65507
|
t,
|
|
65621
65508
|
s,
|
|
65622
65509
|
3 /* Both */,
|
|
@@ -65625,6 +65512,46 @@ function createTypeChecker(host) {
|
|
|
65625
65512
|
void 0,
|
|
65626
65513
|
intersectionState
|
|
65627
65514
|
);
|
|
65515
|
+
} else if (variance === 3 /* Bivariant */) {
|
|
65516
|
+
related = isRelatedTo(
|
|
65517
|
+
t,
|
|
65518
|
+
s,
|
|
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 */,
|
|
65539
|
+
reportErrors2,
|
|
65540
|
+
/*headMessage*/
|
|
65541
|
+
void 0,
|
|
65542
|
+
intersectionState
|
|
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) {
|
|
@@ -78647,6 +78578,9 @@ function createTypeChecker(host) {
|
|
|
78647
78578
|
let fallbackReturnType = voidType;
|
|
78648
78579
|
if (func.body.kind !== 242 /* Block */) {
|
|
78649
78580
|
returnType = checkExpressionCached(func.body, checkMode && checkMode & ~8 /* SkipGenericFunctions */);
|
|
78581
|
+
if (isConstContext(func.body)) {
|
|
78582
|
+
returnType = getRegularTypeOfLiteralType(returnType);
|
|
78583
|
+
}
|
|
78650
78584
|
if (isAsync) {
|
|
78651
78585
|
returnType = unwrapAwaitedType(checkAwaitedType(
|
|
78652
78586
|
returnType,
|
|
@@ -78678,7 +78612,7 @@ function createTypeChecker(host) {
|
|
|
78678
78612
|
/*contextFlags*/
|
|
78679
78613
|
void 0
|
|
78680
78614
|
);
|
|
78681
|
-
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;
|
|
78682
78616
|
return functionFlags & 2 /* Async */ ? createPromiseReturnType(func, returnType2) : (
|
|
78683
78617
|
// Async function
|
|
78684
78618
|
returnType2
|
|
@@ -78758,7 +78692,10 @@ function createTypeChecker(host) {
|
|
|
78758
78692
|
const nextTypes = [];
|
|
78759
78693
|
const isAsync = (getFunctionFlags(func) & 2 /* Async */) !== 0;
|
|
78760
78694
|
forEachYieldExpression(func.body, (yieldExpression) => {
|
|
78761
|
-
|
|
78695
|
+
let yieldExpressionType = yieldExpression.expression ? checkExpression(yieldExpression.expression, checkMode) : undefinedWideningType;
|
|
78696
|
+
if (yieldExpression.expression && isConstContext(yieldExpression.expression)) {
|
|
78697
|
+
yieldExpressionType = getRegularTypeOfLiteralType(yieldExpressionType);
|
|
78698
|
+
}
|
|
78762
78699
|
pushIfUnique(yieldTypes, getYieldedTypeOfYieldExpression(yieldExpression, yieldExpressionType, anyType, isAsync));
|
|
78763
78700
|
let nextType;
|
|
78764
78701
|
if (yieldExpression.asteriskToken) {
|
|
@@ -78875,7 +78812,7 @@ function createTypeChecker(host) {
|
|
|
78875
78812
|
if (type.flags & 131072 /* Never */) {
|
|
78876
78813
|
hasReturnOfTypeNever = true;
|
|
78877
78814
|
}
|
|
78878
|
-
pushIfUnique(aggregatedTypes, type);
|
|
78815
|
+
pushIfUnique(aggregatedTypes, isConstContext(expr) ? getRegularTypeOfLiteralType(type) : type);
|
|
78879
78816
|
} else {
|
|
78880
78817
|
hasReturnWithNoExpression = true;
|
|
78881
78818
|
}
|
|
@@ -83952,6 +83889,7 @@ function createTypeChecker(host) {
|
|
|
83952
83889
|
}
|
|
83953
83890
|
function getIterationTypesOfIterable(type, use, errorNode) {
|
|
83954
83891
|
var _a, _b;
|
|
83892
|
+
type = getReducedType(type);
|
|
83955
83893
|
if (type === silentNeverType) {
|
|
83956
83894
|
return silentNeverIterationTypes;
|
|
83957
83895
|
}
|
|
@@ -84025,7 +83963,7 @@ function createTypeChecker(host) {
|
|
|
84025
83963
|
}
|
|
84026
83964
|
let noCache = false;
|
|
84027
83965
|
if (use & 2 /* AllowsAsyncIterablesFlag */) {
|
|
84028
|
-
|
|
83966
|
+
let iterationTypes = getIterationTypesOfIterableCached(type, asyncIterationTypesResolver) || getIterationTypesOfIterableFast(type, asyncIterationTypesResolver);
|
|
84029
83967
|
if (iterationTypes) {
|
|
84030
83968
|
if (iterationTypes === noIterationTypes && errorNode) {
|
|
84031
83969
|
noCache = true;
|
|
@@ -84033,6 +83971,10 @@ function createTypeChecker(host) {
|
|
|
84033
83971
|
return use & 8 /* ForOfFlag */ ? getAsyncFromSyncIterationTypes(iterationTypes, errorNode) : iterationTypes;
|
|
84034
83972
|
}
|
|
84035
83973
|
}
|
|
83974
|
+
iterationTypes = getIterationTypesOfIterableSlow(type, asyncIterationTypesResolver, errorNode, errorOutputContainer, noCache);
|
|
83975
|
+
if (iterationTypes !== noIterationTypes) {
|
|
83976
|
+
return iterationTypes;
|
|
83977
|
+
}
|
|
84036
83978
|
}
|
|
84037
83979
|
if (use & 1 /* AllowsSyncIterablesFlag */) {
|
|
84038
83980
|
let iterationTypes = getIterationTypesOfIterableCached(type, syncIterationTypesResolver) || getIterationTypesOfIterableFast(type, syncIterationTypesResolver);
|
|
@@ -84050,15 +83992,7 @@ function createTypeChecker(host) {
|
|
|
84050
83992
|
}
|
|
84051
83993
|
}
|
|
84052
83994
|
}
|
|
84053
|
-
|
|
84054
|
-
if (use & 2 /* AllowsAsyncIterablesFlag */) {
|
|
84055
|
-
const iterationTypes = getIterationTypesOfIterableSlow(type, asyncIterationTypesResolver, errorNode, errorOutputContainer, noCache);
|
|
84056
|
-
if (iterationTypes !== noIterationTypes) {
|
|
84057
|
-
return iterationTypes;
|
|
84058
|
-
}
|
|
84059
|
-
}
|
|
84060
|
-
if (use & 1 /* AllowsSyncIterablesFlag */) {
|
|
84061
|
-
let iterationTypes = getIterationTypesOfIterableSlow(type, syncIterationTypesResolver, errorNode, errorOutputContainer, noCache);
|
|
83995
|
+
iterationTypes = getIterationTypesOfIterableSlow(type, syncIterationTypesResolver, errorNode, errorOutputContainer, noCache);
|
|
84062
83996
|
if (iterationTypes !== noIterationTypes) {
|
|
84063
83997
|
if (use & 2 /* AllowsAsyncIterablesFlag */) {
|
|
84064
83998
|
iterationTypes = getAsyncFromSyncIterationTypes(iterationTypes, errorNode);
|
|
@@ -84550,6 +84484,9 @@ function createTypeChecker(host) {
|
|
|
84550
84484
|
return false;
|
|
84551
84485
|
});
|
|
84552
84486
|
}
|
|
84487
|
+
if (node.label.flags & 1073741824 /* Unreachable */ && compilerOptions.allowUnusedLabels !== true) {
|
|
84488
|
+
errorOrSuggestion(compilerOptions.allowUnusedLabels === false, node.label, Diagnostics.Unused_label);
|
|
84489
|
+
}
|
|
84553
84490
|
checkSourceElement(node.statement);
|
|
84554
84491
|
}
|
|
84555
84492
|
function checkThrowStatement(node) {
|
|
@@ -86442,10 +86379,12 @@ function createTypeChecker(host) {
|
|
|
86442
86379
|
function checkSourceElement(node) {
|
|
86443
86380
|
if (node) {
|
|
86444
86381
|
const saveCurrentNode = currentNode;
|
|
86382
|
+
const saveWithinUnreachableCode = withinUnreachableCode;
|
|
86445
86383
|
currentNode = node;
|
|
86446
86384
|
instantiationCount = 0;
|
|
86447
86385
|
checkSourceElementWorker(node);
|
|
86448
86386
|
currentNode = saveCurrentNode;
|
|
86387
|
+
withinUnreachableCode = saveWithinUnreachableCode;
|
|
86449
86388
|
}
|
|
86450
86389
|
}
|
|
86451
86390
|
function checkSourceElementWorker(node) {
|
|
@@ -86473,8 +86412,10 @@ function createTypeChecker(host) {
|
|
|
86473
86412
|
cancellationToken.throwIfCancellationRequested();
|
|
86474
86413
|
}
|
|
86475
86414
|
}
|
|
86476
|
-
if (
|
|
86477
|
-
|
|
86415
|
+
if (compilerOptions.allowUnreachableCode !== true && !withinUnreachableCode) {
|
|
86416
|
+
if (checkSourceElementUnreachable(node)) {
|
|
86417
|
+
withinUnreachableCode = true;
|
|
86418
|
+
}
|
|
86478
86419
|
}
|
|
86479
86420
|
switch (kind) {
|
|
86480
86421
|
case 169 /* TypeParameter */:
|
|
@@ -86652,6 +86593,66 @@ function createTypeChecker(host) {
|
|
|
86652
86593
|
return checkMissingDeclaration(node);
|
|
86653
86594
|
}
|
|
86654
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
|
+
}
|
|
86655
86656
|
function checkJSDocCommentWorker(node) {
|
|
86656
86657
|
if (isArray(node)) {
|
|
86657
86658
|
forEach(node, (tag) => {
|
|
@@ -86814,6 +86815,7 @@ function createTypeChecker(host) {
|
|
|
86814
86815
|
mark(afterMark);
|
|
86815
86816
|
measure("Check", beforeMark, afterMark);
|
|
86816
86817
|
(_b = tracing) == null ? void 0 : _b.pop();
|
|
86818
|
+
reportedUnreachableNodes = void 0;
|
|
86817
86819
|
}
|
|
86818
86820
|
function unusedIsError(kind, isAmbient) {
|
|
86819
86821
|
if (isAmbient) {
|
|
@@ -89969,6 +89971,11 @@ function createTypeChecker(host) {
|
|
|
89969
89971
|
declarationList,
|
|
89970
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
|
|
89971
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
|
+
);
|
|
89972
89979
|
}
|
|
89973
89980
|
if (declarationList.flags & 33554432 /* Ambient */) {
|
|
89974
89981
|
return grammarErrorOnNode(
|
|
@@ -102807,8 +102814,6 @@ function transformESNext(context) {
|
|
|
102807
102814
|
return visitForStatement(node);
|
|
102808
102815
|
case 251 /* ForOfStatement */:
|
|
102809
102816
|
return visitForOfStatement(node);
|
|
102810
|
-
case 256 /* SwitchStatement */:
|
|
102811
|
-
return visitSwitchStatement(node);
|
|
102812
102817
|
default:
|
|
102813
102818
|
return visitEachChild(node, visitor, context);
|
|
102814
102819
|
}
|
|
@@ -102972,60 +102977,6 @@ function transformESNext(context) {
|
|
|
102972
102977
|
}
|
|
102973
102978
|
return visitEachChild(node, visitor, context);
|
|
102974
102979
|
}
|
|
102975
|
-
function visitCaseOrDefaultClause(node, envBinding) {
|
|
102976
|
-
if (getUsingKindOfStatements(node.statements) !== 0 /* None */) {
|
|
102977
|
-
if (isCaseClause(node)) {
|
|
102978
|
-
return factory2.updateCaseClause(
|
|
102979
|
-
node,
|
|
102980
|
-
visitNode(node.expression, visitor, isExpression),
|
|
102981
|
-
transformUsingDeclarations(
|
|
102982
|
-
node.statements,
|
|
102983
|
-
/*start*/
|
|
102984
|
-
0,
|
|
102985
|
-
node.statements.length,
|
|
102986
|
-
envBinding,
|
|
102987
|
-
/*topLevelStatements*/
|
|
102988
|
-
void 0
|
|
102989
|
-
)
|
|
102990
|
-
);
|
|
102991
|
-
} else {
|
|
102992
|
-
return factory2.updateDefaultClause(
|
|
102993
|
-
node,
|
|
102994
|
-
transformUsingDeclarations(
|
|
102995
|
-
node.statements,
|
|
102996
|
-
/*start*/
|
|
102997
|
-
0,
|
|
102998
|
-
node.statements.length,
|
|
102999
|
-
envBinding,
|
|
103000
|
-
/*topLevelStatements*/
|
|
103001
|
-
void 0
|
|
103002
|
-
)
|
|
103003
|
-
);
|
|
103004
|
-
}
|
|
103005
|
-
}
|
|
103006
|
-
return visitEachChild(node, visitor, context);
|
|
103007
|
-
}
|
|
103008
|
-
function visitSwitchStatement(node) {
|
|
103009
|
-
const usingKind = getUsingKindOfCaseOrDefaultClauses(node.caseBlock.clauses);
|
|
103010
|
-
if (usingKind) {
|
|
103011
|
-
const envBinding = createEnvBinding();
|
|
103012
|
-
return createDownlevelUsingStatements(
|
|
103013
|
-
[
|
|
103014
|
-
factory2.updateSwitchStatement(
|
|
103015
|
-
node,
|
|
103016
|
-
visitNode(node.expression, visitor, isExpression),
|
|
103017
|
-
factory2.updateCaseBlock(
|
|
103018
|
-
node.caseBlock,
|
|
103019
|
-
node.caseBlock.clauses.map((clause) => visitCaseOrDefaultClause(clause, envBinding))
|
|
103020
|
-
)
|
|
103021
|
-
)
|
|
103022
|
-
],
|
|
103023
|
-
envBinding,
|
|
103024
|
-
usingKind === 2 /* Async */
|
|
103025
|
-
);
|
|
103026
|
-
}
|
|
103027
|
-
return visitEachChild(node, visitor, context);
|
|
103028
|
-
}
|
|
103029
102980
|
function transformUsingDeclarations(statementsIn, start, end, envBinding, topLevelStatements) {
|
|
103030
102981
|
const statements = [];
|
|
103031
102982
|
for (let i = start; i < end; i++) {
|
|
@@ -103391,15 +103342,6 @@ function getUsingKindOfStatements(statements) {
|
|
|
103391
103342
|
}
|
|
103392
103343
|
return result;
|
|
103393
103344
|
}
|
|
103394
|
-
function getUsingKindOfCaseOrDefaultClauses(clauses) {
|
|
103395
|
-
let result = 0 /* None */;
|
|
103396
|
-
for (const clause of clauses) {
|
|
103397
|
-
const usingKind = getUsingKindOfStatements(clause.statements);
|
|
103398
|
-
if (usingKind === 2 /* Async */) return 2 /* Async */;
|
|
103399
|
-
if (usingKind > result) result = usingKind;
|
|
103400
|
-
}
|
|
103401
|
-
return result;
|
|
103402
|
-
}
|
|
103403
103345
|
|
|
103404
103346
|
// src/compiler/transformers/jsx.ts
|
|
103405
103347
|
function transformJsx(context) {
|
|
@@ -116017,7 +115959,7 @@ function getCommonSourceDirectory(options, emittedFiles, currentDirectory, getCa
|
|
|
116017
115959
|
if (options.rootDir) {
|
|
116018
115960
|
commonSourceDirectory = getNormalizedAbsolutePath(options.rootDir, currentDirectory);
|
|
116019
115961
|
checkSourceFilesBelongToPath == null ? void 0 : checkSourceFilesBelongToPath(options.rootDir);
|
|
116020
|
-
} else if (options.
|
|
115962
|
+
} else if (options.configFilePath) {
|
|
116021
115963
|
commonSourceDirectory = getDirectoryPath(normalizeSlashes(options.configFilePath));
|
|
116022
115964
|
checkSourceFilesBelongToPath == null ? void 0 : checkSourceFilesBelongToPath(commonSourceDirectory);
|
|
116023
115965
|
} else {
|
|
@@ -116028,6 +115970,13 @@ function getCommonSourceDirectory(options, emittedFiles, currentDirectory, getCa
|
|
|
116028
115970
|
}
|
|
116029
115971
|
return commonSourceDirectory;
|
|
116030
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
|
+
}
|
|
116031
115980
|
function getCommonSourceDirectoryOfConfig({ options, fileNames }, ignoreCase) {
|
|
116032
115981
|
return getCommonSourceDirectory(
|
|
116033
115982
|
options,
|
|
@@ -124460,6 +124409,31 @@ function createProgram(_rootNamesOrOptions, _options, _host, _oldProgram, _confi
|
|
|
124460
124409
|
createDiagnosticForOptionName(Diagnostics.Cannot_find_the_common_subdirectory_path_for_the_input_files, "outDir");
|
|
124461
124410
|
}
|
|
124462
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
|
+
}
|
|
124463
124437
|
if (options.checkJs && !getAllowJSCompilerOption(options)) {
|
|
124464
124438
|
createDiagnosticForOptionName(Diagnostics.Option_0_cannot_be_specified_without_specifying_option_1, "checkJs", "allowJs");
|
|
124465
124439
|
}
|
|
@@ -124512,7 +124486,7 @@ function createProgram(_rootNamesOrOptions, _options, _host, _oldProgram, _confi
|
|
|
124512
124486
|
}
|
|
124513
124487
|
}
|
|
124514
124488
|
if (options.allowImportingTsExtensions && !(options.noEmit || options.emitDeclarationOnly || options.rewriteRelativeImportExtensions)) {
|
|
124515
|
-
createOptionValueDiagnostic("allowImportingTsExtensions", Diagnostics.
|
|
124489
|
+
createOptionValueDiagnostic("allowImportingTsExtensions", Diagnostics.Option_allowImportingTsExtensions_can_only_be_used_when_one_of_noEmit_emitDeclarationOnly_or_rewriteRelativeImportExtensions_is_set);
|
|
124516
124490
|
}
|
|
124517
124491
|
const moduleResolution = getEmitModuleResolutionKind(options);
|
|
124518
124492
|
if (options.resolvePackageJsonExports && !moduleResolutionSupportsPackageJsonExportsAndImports(moduleResolution)) {
|