@typescript-deploys/pr-build 5.5.0-pr-57842-28 → 5.5.0-pr-58007-11
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 +645 -320
- package/lib/typescript.d.ts +24 -48
- package/lib/typescript.js +706 -720
- package/package.json +10 -10
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 = "5.5";
|
|
21
|
-
var version = `${versionMajorMinor}.0-insiders.
|
|
21
|
+
var version = `${versionMajorMinor}.0-insiders.20240531`;
|
|
22
22
|
|
|
23
23
|
// src/compiler/core.ts
|
|
24
24
|
var emptyArray = [];
|
|
@@ -1518,6 +1518,15 @@ Node ${formatSyntaxKind(node.kind)} was unexpected.`,
|
|
|
1518
1518
|
);
|
|
1519
1519
|
}
|
|
1520
1520
|
Debug2.formatNodeFlags = formatNodeFlags;
|
|
1521
|
+
function formatNodeCheckFlags(flags) {
|
|
1522
|
+
return formatEnum(
|
|
1523
|
+
flags,
|
|
1524
|
+
NodeCheckFlags,
|
|
1525
|
+
/*isFlags*/
|
|
1526
|
+
true
|
|
1527
|
+
);
|
|
1528
|
+
}
|
|
1529
|
+
Debug2.formatNodeCheckFlags = formatNodeCheckFlags;
|
|
1521
1530
|
function formatModifierFlags(flags) {
|
|
1522
1531
|
return formatEnum(
|
|
1523
1532
|
flags,
|
|
@@ -3530,6 +3539,34 @@ var SymbolFlags = /* @__PURE__ */ ((SymbolFlags2) => {
|
|
|
3530
3539
|
SymbolFlags2[SymbolFlags2["LateBindingContainer"] = 6256] = "LateBindingContainer";
|
|
3531
3540
|
return SymbolFlags2;
|
|
3532
3541
|
})(SymbolFlags || {});
|
|
3542
|
+
var NodeCheckFlags = /* @__PURE__ */ ((NodeCheckFlags3) => {
|
|
3543
|
+
NodeCheckFlags3[NodeCheckFlags3["None"] = 0] = "None";
|
|
3544
|
+
NodeCheckFlags3[NodeCheckFlags3["TypeChecked"] = 1] = "TypeChecked";
|
|
3545
|
+
NodeCheckFlags3[NodeCheckFlags3["LexicalThis"] = 2] = "LexicalThis";
|
|
3546
|
+
NodeCheckFlags3[NodeCheckFlags3["CaptureThis"] = 4] = "CaptureThis";
|
|
3547
|
+
NodeCheckFlags3[NodeCheckFlags3["CaptureNewTarget"] = 8] = "CaptureNewTarget";
|
|
3548
|
+
NodeCheckFlags3[NodeCheckFlags3["SuperInstance"] = 16] = "SuperInstance";
|
|
3549
|
+
NodeCheckFlags3[NodeCheckFlags3["SuperStatic"] = 32] = "SuperStatic";
|
|
3550
|
+
NodeCheckFlags3[NodeCheckFlags3["ContextChecked"] = 64] = "ContextChecked";
|
|
3551
|
+
NodeCheckFlags3[NodeCheckFlags3["MethodWithSuperPropertyAccessInAsync"] = 128] = "MethodWithSuperPropertyAccessInAsync";
|
|
3552
|
+
NodeCheckFlags3[NodeCheckFlags3["MethodWithSuperPropertyAssignmentInAsync"] = 256] = "MethodWithSuperPropertyAssignmentInAsync";
|
|
3553
|
+
NodeCheckFlags3[NodeCheckFlags3["CaptureArguments"] = 512] = "CaptureArguments";
|
|
3554
|
+
NodeCheckFlags3[NodeCheckFlags3["EnumValuesComputed"] = 1024] = "EnumValuesComputed";
|
|
3555
|
+
NodeCheckFlags3[NodeCheckFlags3["LexicalModuleMergesWithClass"] = 2048] = "LexicalModuleMergesWithClass";
|
|
3556
|
+
NodeCheckFlags3[NodeCheckFlags3["LoopWithCapturedBlockScopedBinding"] = 4096] = "LoopWithCapturedBlockScopedBinding";
|
|
3557
|
+
NodeCheckFlags3[NodeCheckFlags3["ContainsCapturedBlockScopeBinding"] = 8192] = "ContainsCapturedBlockScopeBinding";
|
|
3558
|
+
NodeCheckFlags3[NodeCheckFlags3["CapturedBlockScopedBinding"] = 16384] = "CapturedBlockScopedBinding";
|
|
3559
|
+
NodeCheckFlags3[NodeCheckFlags3["BlockScopedBindingInLoop"] = 32768] = "BlockScopedBindingInLoop";
|
|
3560
|
+
NodeCheckFlags3[NodeCheckFlags3["NeedsLoopOutParameter"] = 65536] = "NeedsLoopOutParameter";
|
|
3561
|
+
NodeCheckFlags3[NodeCheckFlags3["AssignmentsMarked"] = 131072] = "AssignmentsMarked";
|
|
3562
|
+
NodeCheckFlags3[NodeCheckFlags3["ContainsConstructorReference"] = 262144] = "ContainsConstructorReference";
|
|
3563
|
+
NodeCheckFlags3[NodeCheckFlags3["ConstructorReference"] = 536870912] = "ConstructorReference";
|
|
3564
|
+
NodeCheckFlags3[NodeCheckFlags3["ContainsClassWithPrivateIdentifiers"] = 1048576] = "ContainsClassWithPrivateIdentifiers";
|
|
3565
|
+
NodeCheckFlags3[NodeCheckFlags3["ContainsSuperPropertyInStaticInitializer"] = 2097152] = "ContainsSuperPropertyInStaticInitializer";
|
|
3566
|
+
NodeCheckFlags3[NodeCheckFlags3["InCheckIdentifier"] = 4194304] = "InCheckIdentifier";
|
|
3567
|
+
NodeCheckFlags3[NodeCheckFlags3["LazyFlags"] = 539358128] = "LazyFlags";
|
|
3568
|
+
return NodeCheckFlags3;
|
|
3569
|
+
})(NodeCheckFlags || {});
|
|
3533
3570
|
var TypeFlags = /* @__PURE__ */ ((TypeFlags2) => {
|
|
3534
3571
|
TypeFlags2[TypeFlags2["Any"] = 1] = "Any";
|
|
3535
3572
|
TypeFlags2[TypeFlags2["Unknown"] = 2] = "Unknown";
|
|
@@ -6091,8 +6128,22 @@ var Diagnostics = {
|
|
|
6091
6128
|
_0_must_be_followed_by_a_Unicode_property_value_expression_enclosed_in_braces: diag(1531, 1 /* Error */, "_0_must_be_followed_by_a_Unicode_property_value_expression_enclosed_in_braces_1531", "'\\{0}' must be followed by a Unicode property value expression enclosed in braces."),
|
|
6092
6129
|
There_is_no_capturing_group_named_0_in_this_regular_expression: diag(1532, 1 /* Error */, "There_is_no_capturing_group_named_0_in_this_regular_expression_1532", "There is no capturing group named '{0}' in this regular expression."),
|
|
6093
6130
|
This_backreference_refers_to_a_group_that_does_not_exist_There_are_only_0_capturing_groups_in_this_regular_expression: diag(1533, 1 /* Error */, "This_backreference_refers_to_a_group_that_does_not_exist_There_are_only_0_capturing_groups_in_this_r_1533", "This backreference refers to a group that does not exist. There are only {0} capturing groups in this regular expression."),
|
|
6094
|
-
|
|
6131
|
+
This_backreference_refers_to_a_group_that_does_not_exist_There_are_no_capturing_groups_in_this_regular_expression: diag(1534, 1 /* Error */, "This_backreference_refers_to_a_group_that_does_not_exist_There_are_no_capturing_groups_in_this_regul_1534", "This backreference refers to a group that does not exist. There are no capturing groups in this regular expression."),
|
|
6095
6132
|
This_character_cannot_be_escaped_in_a_regular_expression: diag(1535, 1 /* Error */, "This_character_cannot_be_escaped_in_a_regular_expression_1535", "This character cannot be escaped in a regular expression."),
|
|
6133
|
+
Octal_escape_sequences_and_backreferences_are_not_allowed_in_a_character_class_If_this_was_intended_as_an_escape_sequence_use_the_syntax_0_instead: diag(1536, 1 /* Error */, "Octal_escape_sequences_and_backreferences_are_not_allowed_in_a_character_class_If_this_was_intended__1536", "Octal escape sequences and backreferences are not allowed in a character class. If this was intended as an escape sequence, use the syntax '{0}' instead."),
|
|
6134
|
+
Decimal_escape_sequences_and_backreferences_are_not_allowed_in_a_character_class: diag(1537, 1 /* Error */, "Decimal_escape_sequences_and_backreferences_are_not_allowed_in_a_character_class_1537", "Decimal escape sequences and backreferences are not allowed in a character class."),
|
|
6135
|
+
A_namespace_declaration_should_not_be_declared_using_the_module_keyword_Please_use_the_namespace_keyword_instead: diag(
|
|
6136
|
+
1538,
|
|
6137
|
+
2 /* Suggestion */,
|
|
6138
|
+
"A_namespace_declaration_should_not_be_declared_using_the_module_keyword_Please_use_the_namespace_key_1538",
|
|
6139
|
+
"A namespace declaration should not be declared using the module keyword. Please use the namespace keyword instead.",
|
|
6140
|
+
/*reportsUnnecessary*/
|
|
6141
|
+
void 0,
|
|
6142
|
+
/*elidedInCompatabilityPyramid*/
|
|
6143
|
+
void 0,
|
|
6144
|
+
/*reportsDeprecated*/
|
|
6145
|
+
true
|
|
6146
|
+
),
|
|
6096
6147
|
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."),
|
|
6097
6148
|
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."),
|
|
6098
6149
|
Call_signature_return_types_0_and_1_are_incompatible: diag(
|
|
@@ -8812,12 +8863,7 @@ function createScanner(languageVersion, skipTrivia2, languageVariant = 0 /* Stan
|
|
|
8812
8863
|
}
|
|
8813
8864
|
if (ch === 92 /* backslash */ && !jsxAttributeString) {
|
|
8814
8865
|
result += text.substring(start2, pos);
|
|
8815
|
-
result += scanEscapeSequence(
|
|
8816
|
-
/*shouldEmitInvalidEscapeError*/
|
|
8817
|
-
true,
|
|
8818
|
-
/*isRegularExpression*/
|
|
8819
|
-
false
|
|
8820
|
-
);
|
|
8866
|
+
result += scanEscapeSequence(1 /* String */ | 2 /* ReportErrors */);
|
|
8821
8867
|
start2 = pos;
|
|
8822
8868
|
continue;
|
|
8823
8869
|
}
|
|
@@ -8860,11 +8906,7 @@ function createScanner(languageVersion, skipTrivia2, languageVariant = 0 /* Stan
|
|
|
8860
8906
|
}
|
|
8861
8907
|
if (currChar === 92 /* backslash */) {
|
|
8862
8908
|
contents += text.substring(start2, pos);
|
|
8863
|
-
contents += scanEscapeSequence(
|
|
8864
|
-
shouldEmitInvalidEscapeError,
|
|
8865
|
-
/*isRegularExpression*/
|
|
8866
|
-
false
|
|
8867
|
-
);
|
|
8909
|
+
contents += scanEscapeSequence(1 /* String */ | (shouldEmitInvalidEscapeError ? 2 /* ReportErrors */ : 0));
|
|
8868
8910
|
start2 = pos;
|
|
8869
8911
|
continue;
|
|
8870
8912
|
}
|
|
@@ -8884,7 +8926,7 @@ function createScanner(languageVersion, skipTrivia2, languageVariant = 0 /* Stan
|
|
|
8884
8926
|
tokenValue = contents;
|
|
8885
8927
|
return resultingToken;
|
|
8886
8928
|
}
|
|
8887
|
-
function scanEscapeSequence(
|
|
8929
|
+
function scanEscapeSequence(flags) {
|
|
8888
8930
|
const start2 = pos;
|
|
8889
8931
|
pos++;
|
|
8890
8932
|
if (pos >= end) {
|
|
@@ -8912,9 +8954,11 @@ function createScanner(languageVersion, skipTrivia2, languageVariant = 0 /* Stan
|
|
|
8912
8954
|
pos++;
|
|
8913
8955
|
}
|
|
8914
8956
|
tokenFlags |= 2048 /* ContainsInvalidEscape */;
|
|
8915
|
-
if (
|
|
8957
|
+
if (flags & 6 /* ReportInvalidEscapeErrors */) {
|
|
8916
8958
|
const code = parseInt(text.substring(start2 + 1, pos), 8);
|
|
8917
|
-
if (
|
|
8959
|
+
if (flags & 4 /* RegularExpression */ && !(flags & 32 /* AtomEscape */) && ch !== 48 /* _0 */) {
|
|
8960
|
+
error(Diagnostics.Octal_escape_sequences_and_backreferences_are_not_allowed_in_a_character_class_If_this_was_intended_as_an_escape_sequence_use_the_syntax_0_instead, start2, pos - start2, "\\x" + code.toString(16).padStart(2, "0"));
|
|
8961
|
+
} else {
|
|
8918
8962
|
error(Diagnostics.Octal_escape_sequences_are_not_allowed_Use_the_syntax_0, start2, pos - start2, "\\x" + code.toString(16).padStart(2, "0"));
|
|
8919
8963
|
}
|
|
8920
8964
|
return String.fromCharCode(code);
|
|
@@ -8923,8 +8967,12 @@ function createScanner(languageVersion, skipTrivia2, languageVariant = 0 /* Stan
|
|
|
8923
8967
|
case 56 /* _8 */:
|
|
8924
8968
|
case 57 /* _9 */:
|
|
8925
8969
|
tokenFlags |= 2048 /* ContainsInvalidEscape */;
|
|
8926
|
-
if (
|
|
8927
|
-
|
|
8970
|
+
if (flags & 6 /* ReportInvalidEscapeErrors */) {
|
|
8971
|
+
if (flags & 4 /* RegularExpression */ && !(flags & 32 /* AtomEscape */)) {
|
|
8972
|
+
error(Diagnostics.Decimal_escape_sequences_and_backreferences_are_not_allowed_in_a_character_class, start2, pos - start2);
|
|
8973
|
+
} else {
|
|
8974
|
+
error(Diagnostics.Escape_sequence_0_is_not_allowed, start2, pos - start2, text.substring(start2, pos));
|
|
8975
|
+
}
|
|
8928
8976
|
return String.fromCharCode(ch);
|
|
8929
8977
|
}
|
|
8930
8978
|
return text.substring(start2, pos);
|
|
@@ -8945,14 +8993,14 @@ function createScanner(languageVersion, skipTrivia2, languageVariant = 0 /* Stan
|
|
|
8945
8993
|
case 34 /* doubleQuote */:
|
|
8946
8994
|
return '"';
|
|
8947
8995
|
case 117 /* u */:
|
|
8948
|
-
if (
|
|
8996
|
+
if (flags & 17 /* ScanExtendedUnicodeEscape */ && pos < end && charCodeUnchecked(pos) === 123 /* openBrace */) {
|
|
8949
8997
|
pos -= 2;
|
|
8950
|
-
return scanExtendedUnicodeEscape(!!
|
|
8998
|
+
return scanExtendedUnicodeEscape(!!(flags & 6 /* ReportInvalidEscapeErrors */));
|
|
8951
8999
|
}
|
|
8952
9000
|
for (; pos < start2 + 6; pos++) {
|
|
8953
9001
|
if (!(pos < end && isHexDigit(charCodeUnchecked(pos)))) {
|
|
8954
9002
|
tokenFlags |= 2048 /* ContainsInvalidEscape */;
|
|
8955
|
-
if (
|
|
9003
|
+
if (flags & 6 /* ReportInvalidEscapeErrors */) {
|
|
8956
9004
|
error(Diagnostics.Hexadecimal_digit_expected);
|
|
8957
9005
|
}
|
|
8958
9006
|
return text.substring(start2, pos);
|
|
@@ -8961,7 +9009,7 @@ function createScanner(languageVersion, skipTrivia2, languageVariant = 0 /* Stan
|
|
|
8961
9009
|
tokenFlags |= 1024 /* UnicodeEscape */;
|
|
8962
9010
|
const escapedValue = parseInt(text.substring(start2 + 2, pos), 16);
|
|
8963
9011
|
const escapedValueString = String.fromCharCode(escapedValue);
|
|
8964
|
-
if (
|
|
9012
|
+
if (flags & 16 /* AnyUnicodeMode */ && escapedValue >= 55296 && escapedValue <= 56319 && pos + 6 < end && text.substring(pos, pos + 2) === "\\u" && charCodeUnchecked(pos + 2) !== 123 /* openBrace */) {
|
|
8965
9013
|
const nextStart = pos;
|
|
8966
9014
|
let nextPos = pos + 2;
|
|
8967
9015
|
for (; nextPos < nextStart + 6; nextPos++) {
|
|
@@ -8980,7 +9028,7 @@ function createScanner(languageVersion, skipTrivia2, languageVariant = 0 /* Stan
|
|
|
8980
9028
|
for (; pos < start2 + 4; pos++) {
|
|
8981
9029
|
if (!(pos < end && isHexDigit(charCodeUnchecked(pos)))) {
|
|
8982
9030
|
tokenFlags |= 2048 /* ContainsInvalidEscape */;
|
|
8983
|
-
if (
|
|
9031
|
+
if (flags & 6 /* ReportInvalidEscapeErrors */) {
|
|
8984
9032
|
error(Diagnostics.Hexadecimal_digit_expected);
|
|
8985
9033
|
}
|
|
8986
9034
|
return text.substring(start2, pos);
|
|
@@ -8997,7 +9045,7 @@ function createScanner(languageVersion, skipTrivia2, languageVariant = 0 /* Stan
|
|
|
8997
9045
|
case 8233 /* paragraphSeparator */:
|
|
8998
9046
|
return "";
|
|
8999
9047
|
default:
|
|
9000
|
-
if (
|
|
9048
|
+
if (flags & 16 /* AnyUnicodeMode */ || flags & 4 /* RegularExpression */ && !(flags & 8 /* AnnexB */) && isIdentifierPart(ch, languageVersion)) {
|
|
9001
9049
|
error(Diagnostics.This_character_cannot_be_escaped_in_a_regular_expression, pos - 2, 2);
|
|
9002
9050
|
}
|
|
9003
9051
|
return String.fromCharCode(ch);
|
|
@@ -9696,6 +9744,7 @@ function createScanner(languageVersion, skipTrivia2, languageVariant = 0 /* Stan
|
|
|
9696
9744
|
const startOfRegExpBody = tokenStart + 1;
|
|
9697
9745
|
pos = startOfRegExpBody;
|
|
9698
9746
|
let inEscape = false;
|
|
9747
|
+
let namedCaptureGroups = false;
|
|
9699
9748
|
let inCharacterClass = false;
|
|
9700
9749
|
while (true) {
|
|
9701
9750
|
const ch = charCodeChecked(pos);
|
|
@@ -9713,6 +9762,8 @@ function createScanner(languageVersion, skipTrivia2, languageVariant = 0 /* Stan
|
|
|
9713
9762
|
inEscape = true;
|
|
9714
9763
|
} else if (ch === 93 /* closeBracket */) {
|
|
9715
9764
|
inCharacterClass = false;
|
|
9765
|
+
} else if (!inCharacterClass && ch === 40 /* openParen */ && charCodeChecked(pos + 1) === 63 /* question */ && charCodeChecked(pos + 2) === 60 /* lessThan */ && charCodeChecked(pos + 3) !== 61 /* equals */ && charCodeChecked(pos + 3) !== 33 /* exclamation */) {
|
|
9766
|
+
namedCaptureGroups = true;
|
|
9716
9767
|
}
|
|
9717
9768
|
pos++;
|
|
9718
9769
|
}
|
|
@@ -9780,7 +9831,8 @@ function createScanner(languageVersion, skipTrivia2, languageVariant = 0 /* Stan
|
|
|
9780
9831
|
scanRegularExpressionWorker(
|
|
9781
9832
|
regExpFlags,
|
|
9782
9833
|
/*annexB*/
|
|
9783
|
-
true
|
|
9834
|
+
true,
|
|
9835
|
+
namedCaptureGroups
|
|
9784
9836
|
);
|
|
9785
9837
|
});
|
|
9786
9838
|
}
|
|
@@ -9790,12 +9842,10 @@ function createScanner(languageVersion, skipTrivia2, languageVariant = 0 /* Stan
|
|
|
9790
9842
|
}
|
|
9791
9843
|
return token;
|
|
9792
9844
|
}
|
|
9793
|
-
function scanRegularExpressionWorker(regExpFlags, annexB) {
|
|
9845
|
+
function scanRegularExpressionWorker(regExpFlags, annexB, namedCaptureGroups) {
|
|
9794
9846
|
var unicodeSetsMode = !!(regExpFlags & 64 /* UnicodeSets */);
|
|
9795
9847
|
var anyUnicodeMode = !!(regExpFlags & 96 /* AnyUnicodeMode */);
|
|
9796
|
-
|
|
9797
|
-
annexB = false;
|
|
9798
|
-
}
|
|
9848
|
+
var anyUnicodeModeOrNonAnnexB = anyUnicodeMode || !annexB;
|
|
9799
9849
|
var mayContainStrings = false;
|
|
9800
9850
|
var numberOfCapturingGroups = 0;
|
|
9801
9851
|
var groupSpecifiers;
|
|
@@ -9850,7 +9900,7 @@ function createScanner(languageVersion, skipTrivia2, languageVariant = 0 /* Stan
|
|
|
9850
9900
|
case 61 /* equals */:
|
|
9851
9901
|
case 33 /* exclamation */:
|
|
9852
9902
|
pos++;
|
|
9853
|
-
isPreviousTermQuantifiable =
|
|
9903
|
+
isPreviousTermQuantifiable = !anyUnicodeModeOrNonAnnexB;
|
|
9854
9904
|
break;
|
|
9855
9905
|
case 60 /* lessThan */:
|
|
9856
9906
|
const groupNameStart = pos;
|
|
@@ -9904,6 +9954,10 @@ function createScanner(languageVersion, skipTrivia2, languageVariant = 0 /* Stan
|
|
|
9904
9954
|
const digitsStart = pos;
|
|
9905
9955
|
scanDigits();
|
|
9906
9956
|
const min2 = tokenValue;
|
|
9957
|
+
if (!anyUnicodeModeOrNonAnnexB && !min2) {
|
|
9958
|
+
isPreviousTermQuantifiable = true;
|
|
9959
|
+
break;
|
|
9960
|
+
}
|
|
9907
9961
|
if (charCodeChecked(pos) === 44 /* comma */) {
|
|
9908
9962
|
pos++;
|
|
9909
9963
|
scanDigits();
|
|
@@ -9912,25 +9966,29 @@ function createScanner(languageVersion, skipTrivia2, languageVariant = 0 /* Stan
|
|
|
9912
9966
|
if (max || charCodeChecked(pos) === 125 /* closeBrace */) {
|
|
9913
9967
|
error(Diagnostics.Incomplete_quantifier_Digit_expected, digitsStart, 0);
|
|
9914
9968
|
} else {
|
|
9915
|
-
|
|
9916
|
-
error(Diagnostics.Unexpected_0_Did_you_mean_to_escape_it_with_backslash, start2, 1, String.fromCharCode(ch));
|
|
9917
|
-
}
|
|
9969
|
+
error(Diagnostics.Unexpected_0_Did_you_mean_to_escape_it_with_backslash, start2, 1, String.fromCharCode(ch));
|
|
9918
9970
|
isPreviousTermQuantifiable = true;
|
|
9919
9971
|
break;
|
|
9920
9972
|
}
|
|
9921
|
-
}
|
|
9922
|
-
if (max && Number.parseInt(min2) > Number.parseInt(max)) {
|
|
9973
|
+
} else if (max && Number.parseInt(min2) > Number.parseInt(max) && (anyUnicodeModeOrNonAnnexB || charCodeChecked(pos) === 125 /* closeBrace */)) {
|
|
9923
9974
|
error(Diagnostics.Numbers_out_of_order_in_quantifier, digitsStart, pos - digitsStart);
|
|
9924
9975
|
}
|
|
9925
9976
|
} else if (!min2) {
|
|
9926
|
-
if (
|
|
9977
|
+
if (anyUnicodeModeOrNonAnnexB) {
|
|
9927
9978
|
error(Diagnostics.Unexpected_0_Did_you_mean_to_escape_it_with_backslash, start2, 1, String.fromCharCode(ch));
|
|
9928
9979
|
}
|
|
9929
9980
|
isPreviousTermQuantifiable = true;
|
|
9930
9981
|
break;
|
|
9931
9982
|
}
|
|
9932
|
-
|
|
9933
|
-
|
|
9983
|
+
if (charCodeChecked(pos) !== 125 /* closeBrace */) {
|
|
9984
|
+
if (anyUnicodeModeOrNonAnnexB) {
|
|
9985
|
+
error(Diagnostics._0_expected, pos, 0, String.fromCharCode(125 /* closeBrace */));
|
|
9986
|
+
pos--;
|
|
9987
|
+
} else {
|
|
9988
|
+
isPreviousTermQuantifiable = true;
|
|
9989
|
+
break;
|
|
9990
|
+
}
|
|
9991
|
+
}
|
|
9934
9992
|
case 42 /* asterisk */:
|
|
9935
9993
|
case 43 /* plus */:
|
|
9936
9994
|
case 63 /* question */:
|
|
@@ -9963,7 +10021,7 @@ function createScanner(languageVersion, skipTrivia2, languageVariant = 0 /* Stan
|
|
|
9963
10021
|
}
|
|
9964
10022
|
case 93 /* closeBracket */:
|
|
9965
10023
|
case 125 /* closeBrace */:
|
|
9966
|
-
if (
|
|
10024
|
+
if (anyUnicodeModeOrNonAnnexB || ch === 41 /* closeParen */) {
|
|
9967
10025
|
error(Diagnostics.Unexpected_0_Did_you_mean_to_escape_it_with_backslash, pos, 1, String.fromCharCode(ch));
|
|
9968
10026
|
}
|
|
9969
10027
|
pos++;
|
|
@@ -10012,7 +10070,7 @@ function createScanner(languageVersion, skipTrivia2, languageVariant = 0 /* Stan
|
|
|
10012
10070
|
true
|
|
10013
10071
|
);
|
|
10014
10072
|
scanExpectedChar(62 /* greaterThan */);
|
|
10015
|
-
} else if (
|
|
10073
|
+
} else if (anyUnicodeModeOrNonAnnexB || namedCaptureGroups) {
|
|
10016
10074
|
error(Diagnostics.k_must_be_followed_by_a_capturing_group_name_enclosed_in_angle_brackets, pos - 2, 2);
|
|
10017
10075
|
}
|
|
10018
10076
|
break;
|
|
@@ -10055,9 +10113,9 @@ function createScanner(languageVersion, skipTrivia2, languageVariant = 0 /* Stan
|
|
|
10055
10113
|
pos++;
|
|
10056
10114
|
return String.fromCharCode(ch & 31);
|
|
10057
10115
|
}
|
|
10058
|
-
if (
|
|
10116
|
+
if (anyUnicodeModeOrNonAnnexB) {
|
|
10059
10117
|
error(Diagnostics.c_must_be_followed_by_an_ASCII_letter, pos - 2, 2);
|
|
10060
|
-
} else if (atomEscape
|
|
10118
|
+
} else if (atomEscape) {
|
|
10061
10119
|
pos--;
|
|
10062
10120
|
return "\\";
|
|
10063
10121
|
}
|
|
@@ -10082,10 +10140,7 @@ function createScanner(languageVersion, skipTrivia2, languageVariant = 0 /* Stan
|
|
|
10082
10140
|
default:
|
|
10083
10141
|
pos--;
|
|
10084
10142
|
return scanEscapeSequence(
|
|
10085
|
-
/*
|
|
10086
|
-
anyUnicodeMode,
|
|
10087
|
-
/*isRegularExpression*/
|
|
10088
|
-
annexB ? "annex-b" : true
|
|
10143
|
+
4 /* RegularExpression */ | (annexB ? 8 /* AnnexB */ : 0) | (anyUnicodeMode ? 16 /* AnyUnicodeMode */ : 0) | (atomEscape ? 32 /* AtomEscape */ : 0)
|
|
10089
10144
|
);
|
|
10090
10145
|
}
|
|
10091
10146
|
}
|
|
@@ -10127,12 +10182,12 @@ function createScanner(languageVersion, skipTrivia2, languageVariant = 0 /* Stan
|
|
|
10127
10182
|
if (isClassContentExit(ch2)) {
|
|
10128
10183
|
return;
|
|
10129
10184
|
}
|
|
10130
|
-
if (!minCharacter &&
|
|
10185
|
+
if (!minCharacter && anyUnicodeModeOrNonAnnexB) {
|
|
10131
10186
|
error(Diagnostics.A_character_class_range_must_not_be_bounded_by_another_character_class, minStart, pos - 1 - minStart);
|
|
10132
10187
|
}
|
|
10133
10188
|
const maxStart = pos;
|
|
10134
10189
|
const maxCharacter = scanClassAtom();
|
|
10135
|
-
if (!maxCharacter &&
|
|
10190
|
+
if (!maxCharacter && anyUnicodeModeOrNonAnnexB) {
|
|
10136
10191
|
error(Diagnostics.A_character_class_range_must_not_be_bounded_by_another_character_class, maxStart, pos - maxStart);
|
|
10137
10192
|
continue;
|
|
10138
10193
|
}
|
|
@@ -10562,8 +10617,11 @@ function createScanner(languageVersion, skipTrivia2, languageVariant = 0 /* Stan
|
|
|
10562
10617
|
if (!anyUnicodeMode) {
|
|
10563
10618
|
error(Diagnostics.Unicode_property_value_expressions_are_only_available_when_the_Unicode_u_flag_or_the_Unicode_Sets_v_flag_is_set, start2, pos - start2);
|
|
10564
10619
|
}
|
|
10565
|
-
} else if (
|
|
10620
|
+
} else if (anyUnicodeModeOrNonAnnexB) {
|
|
10566
10621
|
error(Diagnostics._0_must_be_followed_by_a_Unicode_property_value_expression_enclosed_in_braces, pos - 2, 2, String.fromCharCode(ch));
|
|
10622
|
+
} else {
|
|
10623
|
+
pos--;
|
|
10624
|
+
return false;
|
|
10567
10625
|
}
|
|
10568
10626
|
return true;
|
|
10569
10627
|
}
|
|
@@ -10603,11 +10661,11 @@ function createScanner(languageVersion, skipTrivia2, languageVariant = 0 /* Stan
|
|
|
10603
10661
|
}
|
|
10604
10662
|
});
|
|
10605
10663
|
forEach(decimalEscapes, (escape) => {
|
|
10606
|
-
if (
|
|
10664
|
+
if (escape.value > numberOfCapturingGroups) {
|
|
10607
10665
|
if (numberOfCapturingGroups) {
|
|
10608
10666
|
error(Diagnostics.This_backreference_refers_to_a_group_that_does_not_exist_There_are_only_0_capturing_groups_in_this_regular_expression, escape.pos, escape.end - escape.pos, numberOfCapturingGroups);
|
|
10609
10667
|
} else {
|
|
10610
|
-
error(Diagnostics.
|
|
10668
|
+
error(Diagnostics.This_backreference_refers_to_a_group_that_does_not_exist_There_are_no_capturing_groups_in_this_regular_expression, escape.pos, escape.end - escape.pos);
|
|
10611
10669
|
}
|
|
10612
10670
|
}
|
|
10613
10671
|
});
|
|
@@ -11047,8 +11105,8 @@ function textSpanIsEmpty(span) {
|
|
|
11047
11105
|
function textSpanContainsPosition(span, position) {
|
|
11048
11106
|
return position >= span.start && position < textSpanEnd(span);
|
|
11049
11107
|
}
|
|
11050
|
-
function textRangeContainsPositionInclusive(
|
|
11051
|
-
return position >=
|
|
11108
|
+
function textRangeContainsPositionInclusive(span, position) {
|
|
11109
|
+
return position >= span.pos && position <= span.end;
|
|
11052
11110
|
}
|
|
11053
11111
|
function createTextSpan(start, length2) {
|
|
11054
11112
|
if (start < 0) {
|
|
@@ -12724,6 +12782,13 @@ function getTokenPosOfNode(node, sourceFile, includeJsDoc) {
|
|
|
12724
12782
|
isInJSDoc(node)
|
|
12725
12783
|
);
|
|
12726
12784
|
}
|
|
12785
|
+
function getNonModifierTokenPosOfNode(node, sourceFile) {
|
|
12786
|
+
const lastModifier = !nodeIsMissing(node) && canHaveModifiers(node) && node.modifiers ? last(node.modifiers) : void 0;
|
|
12787
|
+
if (!lastModifier) {
|
|
12788
|
+
return getTokenPosOfNode(node, sourceFile);
|
|
12789
|
+
}
|
|
12790
|
+
return skipTrivia((sourceFile || getSourceFileOfNode(node)).text, lastModifier.end);
|
|
12791
|
+
}
|
|
12727
12792
|
function getSourceTextOfNodeFromSourceFile(sourceFile, node, includeTrivia = false) {
|
|
12728
12793
|
return getTextOfNodeFromSourceText(sourceFile.text, node, includeTrivia);
|
|
12729
12794
|
}
|
|
@@ -18254,13 +18319,6 @@ function rangeOfTypeParameters(sourceFile, typeParameters) {
|
|
|
18254
18319
|
function skipTypeChecking(sourceFile, options, host) {
|
|
18255
18320
|
return options.skipLibCheck && sourceFile.isDeclarationFile || options.skipDefaultLibCheck && sourceFile.hasNoDefaultLib || options.noCheck || host.isSourceOfProjectReferenceRedirect(sourceFile.fileName);
|
|
18256
18321
|
}
|
|
18257
|
-
function shouldIncludeBindAndCheckDiagnostics(sourceFile, options) {
|
|
18258
|
-
const isJs = sourceFile.scriptKind === 1 /* JS */ || sourceFile.scriptKind === 2 /* JSX */;
|
|
18259
|
-
const isCheckJs = isJs && isCheckJsEnabledForFile(sourceFile, options);
|
|
18260
|
-
const isPlainJs = isPlainJsFile(sourceFile, options.checkJs);
|
|
18261
|
-
const isTsNoCheck = !!sourceFile.checkJsDirective && sourceFile.checkJsDirective.enabled === false;
|
|
18262
|
-
return !isTsNoCheck && (sourceFile.scriptKind === 3 /* TS */ || sourceFile.scriptKind === 4 /* TSX */ || sourceFile.scriptKind === 5 /* External */ || isPlainJs || isCheckJs || sourceFile.scriptKind === 7 /* Deferred */);
|
|
18263
|
-
}
|
|
18264
18322
|
function isJsonEqual(a, b) {
|
|
18265
18323
|
return a === b || typeof a === "object" && a !== null && typeof b === "object" && b !== null && equalOwnProperties(a, b, isJsonEqual);
|
|
18266
18324
|
}
|
|
@@ -25493,7 +25551,7 @@ var addDisposableResourceHelper = {
|
|
|
25493
25551
|
var __addDisposableResource = (this && this.__addDisposableResource) || function (env, value, async) {
|
|
25494
25552
|
if (value !== null && value !== void 0) {
|
|
25495
25553
|
if (typeof value !== "object" && typeof value !== "function") throw new TypeError("Object expected.");
|
|
25496
|
-
var dispose;
|
|
25554
|
+
var dispose, inner;
|
|
25497
25555
|
if (async) {
|
|
25498
25556
|
if (!Symbol.asyncDispose) throw new TypeError("Symbol.asyncDispose is not defined.");
|
|
25499
25557
|
dispose = value[Symbol.asyncDispose];
|
|
@@ -25501,8 +25559,10 @@ var addDisposableResourceHelper = {
|
|
|
25501
25559
|
if (dispose === void 0) {
|
|
25502
25560
|
if (!Symbol.dispose) throw new TypeError("Symbol.dispose is not defined.");
|
|
25503
25561
|
dispose = value[Symbol.dispose];
|
|
25562
|
+
if (async) inner = dispose;
|
|
25504
25563
|
}
|
|
25505
25564
|
if (typeof dispose !== "function") throw new TypeError("Object not disposable.");
|
|
25565
|
+
if (inner) dispose = function() { try { inner.call(this); } catch (e) { return Promise.reject(e); } };
|
|
25506
25566
|
env.stack.push({ value: value, dispose: dispose, async: async });
|
|
25507
25567
|
}
|
|
25508
25568
|
else if (async) {
|
|
@@ -35887,7 +35947,7 @@ var commandOptionsWithoutBuild = [
|
|
|
35887
35947
|
showInSimplifiedHelpView: false,
|
|
35888
35948
|
category: Diagnostics.Compiler_Diagnostics,
|
|
35889
35949
|
description: Diagnostics.Disable_full_type_checking_only_critical_parse_and_emit_errors_will_be_reported,
|
|
35890
|
-
transpileOptionValue:
|
|
35950
|
+
transpileOptionValue: true,
|
|
35891
35951
|
defaultValueDescription: false,
|
|
35892
35952
|
affectsSemanticDiagnostics: true,
|
|
35893
35953
|
affectsBuildInfo: true,
|
|
@@ -45039,9 +45099,6 @@ function createTypeChecker(host) {
|
|
|
45039
45099
|
deferredDiagnosticsCallbacks.push(arg);
|
|
45040
45100
|
};
|
|
45041
45101
|
var cancellationToken;
|
|
45042
|
-
var requestedExternalEmitHelperNames = /* @__PURE__ */ new Set();
|
|
45043
|
-
var requestedExternalEmitHelpers;
|
|
45044
|
-
var externalHelpersModule;
|
|
45045
45102
|
var scanner;
|
|
45046
45103
|
var Symbol12 = objectAllocator.getSymbolConstructor();
|
|
45047
45104
|
var Type7 = objectAllocator.getTypeConstructor();
|
|
@@ -45336,6 +45393,7 @@ function createTypeChecker(host) {
|
|
|
45336
45393
|
getImmediateAliasedSymbol,
|
|
45337
45394
|
getAliasedSymbol: resolveAlias,
|
|
45338
45395
|
getEmitResolver,
|
|
45396
|
+
requiresAddingImplicitUndefined,
|
|
45339
45397
|
getExportsOfModule: getExportsOfModuleAsArray,
|
|
45340
45398
|
getExportsAndPropertiesOfModule,
|
|
45341
45399
|
forEachExportAndPropertyOfModule,
|
|
@@ -47684,10 +47742,22 @@ function createTypeChecker(host) {
|
|
|
47684
47742
|
return !!aliasDeclarationLinks.typeOnlyDeclaration;
|
|
47685
47743
|
}
|
|
47686
47744
|
function getTypeOnlyAliasDeclaration(symbol, include) {
|
|
47745
|
+
var _a;
|
|
47687
47746
|
if (!(symbol.flags & 2097152 /* Alias */)) {
|
|
47688
47747
|
return void 0;
|
|
47689
47748
|
}
|
|
47690
47749
|
const links = getSymbolLinks(symbol);
|
|
47750
|
+
if (links.typeOnlyDeclaration === void 0) {
|
|
47751
|
+
links.typeOnlyDeclaration = false;
|
|
47752
|
+
const resolved = resolveSymbol(symbol);
|
|
47753
|
+
markSymbolOfAliasDeclarationIfTypeOnly(
|
|
47754
|
+
(_a = symbol.declarations) == null ? void 0 : _a[0],
|
|
47755
|
+
getDeclarationOfAliasSymbol(symbol) && getImmediateAliasedSymbol(symbol),
|
|
47756
|
+
resolved,
|
|
47757
|
+
/*overwriteEmpty*/
|
|
47758
|
+
true
|
|
47759
|
+
);
|
|
47760
|
+
}
|
|
47691
47761
|
if (include === void 0) {
|
|
47692
47762
|
return links.typeOnlyDeclaration || void 0;
|
|
47693
47763
|
}
|
|
@@ -51430,21 +51500,136 @@ function createTypeChecker(host) {
|
|
|
51430
51500
|
cancellationToken.throwIfCancellationRequested();
|
|
51431
51501
|
}
|
|
51432
51502
|
let hadError = false;
|
|
51503
|
+
const { finalizeBoundary, startRecoveryScope } = createRecoveryBoundary();
|
|
51433
51504
|
const transformed = visitNode(existing, visitExistingNodeTreeSymbols, isTypeNode);
|
|
51434
|
-
if (
|
|
51505
|
+
if (!finalizeBoundary()) {
|
|
51435
51506
|
return void 0;
|
|
51436
51507
|
}
|
|
51437
51508
|
context.approximateLength += existing.end - existing.pos;
|
|
51438
51509
|
return transformed;
|
|
51439
51510
|
function visitExistingNodeTreeSymbols(node) {
|
|
51511
|
+
if (hadError) return node;
|
|
51512
|
+
const recover = startRecoveryScope();
|
|
51440
51513
|
const onExitNewScope = isNewScopeNode(node) ? onEnterNewScope(node) : void 0;
|
|
51441
51514
|
const result = visitExistingNodeTreeSymbolsWorker(node);
|
|
51442
51515
|
onExitNewScope == null ? void 0 : onExitNewScope();
|
|
51516
|
+
if (hadError) {
|
|
51517
|
+
if (isTypeNode(node) && !isTypePredicateNode(node)) {
|
|
51518
|
+
recover();
|
|
51519
|
+
return serializeExistingTypeNode(context, node);
|
|
51520
|
+
}
|
|
51521
|
+
return node;
|
|
51522
|
+
}
|
|
51443
51523
|
return result === node ? setTextRange2(context, factory.cloneNode(result), node) : result;
|
|
51444
51524
|
}
|
|
51525
|
+
function createRecoveryBoundary() {
|
|
51526
|
+
let unreportedErrors;
|
|
51527
|
+
const oldTracker = context.tracker;
|
|
51528
|
+
const oldTrackedSymbols = context.trackedSymbols;
|
|
51529
|
+
context.trackedSymbols = [];
|
|
51530
|
+
const oldEncounteredError = context.encounteredError;
|
|
51531
|
+
context.tracker = new SymbolTrackerImpl(context, {
|
|
51532
|
+
...oldTracker.inner,
|
|
51533
|
+
reportCyclicStructureError() {
|
|
51534
|
+
markError(() => oldTracker.reportCyclicStructureError());
|
|
51535
|
+
},
|
|
51536
|
+
reportInaccessibleThisError() {
|
|
51537
|
+
markError(() => oldTracker.reportInaccessibleThisError());
|
|
51538
|
+
},
|
|
51539
|
+
reportInaccessibleUniqueSymbolError() {
|
|
51540
|
+
markError(() => oldTracker.reportInaccessibleUniqueSymbolError());
|
|
51541
|
+
},
|
|
51542
|
+
reportLikelyUnsafeImportRequiredError(specifier) {
|
|
51543
|
+
markError(() => oldTracker.reportLikelyUnsafeImportRequiredError(specifier));
|
|
51544
|
+
},
|
|
51545
|
+
reportNonSerializableProperty(name) {
|
|
51546
|
+
markError(() => oldTracker.reportNonSerializableProperty(name));
|
|
51547
|
+
},
|
|
51548
|
+
trackSymbol(sym, decl, meaning) {
|
|
51549
|
+
const accessibility = isSymbolAccessible(
|
|
51550
|
+
sym,
|
|
51551
|
+
decl,
|
|
51552
|
+
meaning,
|
|
51553
|
+
/*shouldComputeAliasesToMakeVisible*/
|
|
51554
|
+
false
|
|
51555
|
+
);
|
|
51556
|
+
if (accessibility.accessibility !== 0 /* Accessible */) {
|
|
51557
|
+
(context.trackedSymbols ?? (context.trackedSymbols = [])).push([sym, decl, meaning]);
|
|
51558
|
+
return true;
|
|
51559
|
+
}
|
|
51560
|
+
return false;
|
|
51561
|
+
},
|
|
51562
|
+
moduleResolverHost: context.tracker.moduleResolverHost
|
|
51563
|
+
}, context.tracker.moduleResolverHost);
|
|
51564
|
+
return {
|
|
51565
|
+
startRecoveryScope: startRecoveryScope2,
|
|
51566
|
+
finalizeBoundary: finalizeBoundary2
|
|
51567
|
+
};
|
|
51568
|
+
function markError(unreportedError) {
|
|
51569
|
+
hadError = true;
|
|
51570
|
+
(unreportedErrors ?? (unreportedErrors = [])).push(unreportedError);
|
|
51571
|
+
}
|
|
51572
|
+
function startRecoveryScope2() {
|
|
51573
|
+
var _a;
|
|
51574
|
+
const initialTrackedSymbolsTop = ((_a = context.trackedSymbols) == null ? void 0 : _a.length) ?? 0;
|
|
51575
|
+
const unreportedErrorsTop = (unreportedErrors == null ? void 0 : unreportedErrors.length) ?? 0;
|
|
51576
|
+
return () => {
|
|
51577
|
+
hadError = false;
|
|
51578
|
+
if (context.trackedSymbols) {
|
|
51579
|
+
context.trackedSymbols.length = initialTrackedSymbolsTop;
|
|
51580
|
+
}
|
|
51581
|
+
if (unreportedErrors) {
|
|
51582
|
+
unreportedErrors.length = unreportedErrorsTop;
|
|
51583
|
+
}
|
|
51584
|
+
};
|
|
51585
|
+
}
|
|
51586
|
+
function finalizeBoundary2() {
|
|
51587
|
+
context.tracker = oldTracker;
|
|
51588
|
+
const newTrackedSymbols = context.trackedSymbols;
|
|
51589
|
+
context.trackedSymbols = oldTrackedSymbols;
|
|
51590
|
+
context.encounteredError = oldEncounteredError;
|
|
51591
|
+
unreportedErrors == null ? void 0 : unreportedErrors.forEach((fn) => fn());
|
|
51592
|
+
if (hadError) {
|
|
51593
|
+
return false;
|
|
51594
|
+
}
|
|
51595
|
+
newTrackedSymbols == null ? void 0 : newTrackedSymbols.forEach(
|
|
51596
|
+
([symbol, enclosingDeclaration, meaning]) => context.tracker.trackSymbol(
|
|
51597
|
+
symbol,
|
|
51598
|
+
enclosingDeclaration,
|
|
51599
|
+
meaning
|
|
51600
|
+
)
|
|
51601
|
+
);
|
|
51602
|
+
return true;
|
|
51603
|
+
}
|
|
51604
|
+
}
|
|
51445
51605
|
function onEnterNewScope(node) {
|
|
51446
51606
|
return enterNewScope(context, node, getParametersInScope(node), getTypeParametersInScope(node));
|
|
51447
51607
|
}
|
|
51608
|
+
function tryVisitTypeReference(node) {
|
|
51609
|
+
if (canReuseTypeNode(context, node)) {
|
|
51610
|
+
const { introducesError, node: newName } = trackExistingEntityName(node.typeName, context);
|
|
51611
|
+
const typeArguments = visitNodes2(node.typeArguments, visitExistingNodeTreeSymbols, isTypeNode);
|
|
51612
|
+
if (!introducesError) {
|
|
51613
|
+
const updated = factory.updateTypeReferenceNode(
|
|
51614
|
+
node,
|
|
51615
|
+
newName,
|
|
51616
|
+
typeArguments
|
|
51617
|
+
);
|
|
51618
|
+
return setTextRange2(context, updated, node);
|
|
51619
|
+
} else {
|
|
51620
|
+
const serializedName = serializeTypeName(
|
|
51621
|
+
context,
|
|
51622
|
+
node.typeName,
|
|
51623
|
+
/*isTypeOf*/
|
|
51624
|
+
false,
|
|
51625
|
+
typeArguments
|
|
51626
|
+
);
|
|
51627
|
+
if (serializedName) {
|
|
51628
|
+
return setTextRange2(context, serializedName, node.typeName);
|
|
51629
|
+
}
|
|
51630
|
+
}
|
|
51631
|
+
}
|
|
51632
|
+
}
|
|
51448
51633
|
function visitExistingNodeTreeSymbolsWorker(node) {
|
|
51449
51634
|
if (isJSDocTypeExpression(node)) {
|
|
51450
51635
|
return visitNode(node.type, visitExistingNodeTreeSymbols, isTypeNode);
|
|
@@ -51541,7 +51726,8 @@ function createTypeChecker(host) {
|
|
|
51541
51726
|
if (canReuseTypeNode(context, node)) {
|
|
51542
51727
|
return node;
|
|
51543
51728
|
}
|
|
51544
|
-
|
|
51729
|
+
hadError = true;
|
|
51730
|
+
return node;
|
|
51545
51731
|
}
|
|
51546
51732
|
if (isTypeParameterDeclaration(node)) {
|
|
51547
51733
|
return factory.updateTypeParameterDeclaration(
|
|
@@ -51552,31 +51738,21 @@ function createTypeChecker(host) {
|
|
|
51552
51738
|
visitNode(node.default, visitExistingNodeTreeSymbols, isTypeNode)
|
|
51553
51739
|
);
|
|
51554
51740
|
}
|
|
51741
|
+
if (isIndexedAccessTypeNode(node) && isTypeReferenceNode(node.objectType)) {
|
|
51742
|
+
const objectType = tryVisitTypeReference(node.objectType);
|
|
51743
|
+
if (!objectType) {
|
|
51744
|
+
hadError = true;
|
|
51745
|
+
return node;
|
|
51746
|
+
}
|
|
51747
|
+
return factory.updateIndexedAccessTypeNode(node, objectType, visitNode(node.indexType, visitExistingNodeTreeSymbols, isTypeNode));
|
|
51748
|
+
}
|
|
51555
51749
|
if (isTypeReferenceNode(node)) {
|
|
51556
|
-
|
|
51557
|
-
|
|
51558
|
-
|
|
51559
|
-
if (!introducesError) {
|
|
51560
|
-
const updated = factory.updateTypeReferenceNode(
|
|
51561
|
-
node,
|
|
51562
|
-
newName,
|
|
51563
|
-
typeArguments
|
|
51564
|
-
);
|
|
51565
|
-
return setTextRange2(context, updated, node);
|
|
51566
|
-
} else {
|
|
51567
|
-
const serializedName = serializeTypeName(
|
|
51568
|
-
context,
|
|
51569
|
-
node.typeName,
|
|
51570
|
-
/*isTypeOf*/
|
|
51571
|
-
false,
|
|
51572
|
-
typeArguments
|
|
51573
|
-
);
|
|
51574
|
-
if (serializedName) {
|
|
51575
|
-
return setTextRange2(context, serializedName, node.typeName);
|
|
51576
|
-
}
|
|
51577
|
-
}
|
|
51750
|
+
const result = tryVisitTypeReference(node);
|
|
51751
|
+
if (result) {
|
|
51752
|
+
return result;
|
|
51578
51753
|
}
|
|
51579
|
-
|
|
51754
|
+
hadError = true;
|
|
51755
|
+
return node;
|
|
51580
51756
|
}
|
|
51581
51757
|
if (isLiteralImportTypeNode(node)) {
|
|
51582
51758
|
const nodeSymbol = getNodeLinks(node).resolvedSymbol;
|
|
@@ -51627,7 +51803,8 @@ function createTypeChecker(host) {
|
|
|
51627
51803
|
if (serializedName) {
|
|
51628
51804
|
return setTextRange2(context, serializedName, node.exprName);
|
|
51629
51805
|
}
|
|
51630
|
-
|
|
51806
|
+
hadError = true;
|
|
51807
|
+
return node;
|
|
51631
51808
|
}
|
|
51632
51809
|
return factory.updateTypeQueryNode(
|
|
51633
51810
|
node,
|
|
@@ -51696,9 +51873,21 @@ function createTypeChecker(host) {
|
|
|
51696
51873
|
falseType2
|
|
51697
51874
|
);
|
|
51698
51875
|
}
|
|
51699
|
-
if (isTypeOperatorNode(node)
|
|
51700
|
-
if (
|
|
51701
|
-
|
|
51876
|
+
if (isTypeOperatorNode(node)) {
|
|
51877
|
+
if (node.operator === 158 /* UniqueKeyword */ && node.type.kind === 155 /* SymbolKeyword */) {
|
|
51878
|
+
if (!canReuseTypeNode(context, node)) {
|
|
51879
|
+
hadError = true;
|
|
51880
|
+
return node;
|
|
51881
|
+
}
|
|
51882
|
+
} else if (node.operator === 143 /* KeyOfKeyword */) {
|
|
51883
|
+
if (isTypeReferenceNode(node.type)) {
|
|
51884
|
+
const type = tryVisitTypeReference(node.type);
|
|
51885
|
+
if (!type) {
|
|
51886
|
+
hadError = true;
|
|
51887
|
+
return node;
|
|
51888
|
+
}
|
|
51889
|
+
return factory.updateTypeOperatorNode(node, type);
|
|
51890
|
+
}
|
|
51702
51891
|
}
|
|
51703
51892
|
}
|
|
51704
51893
|
return visitEachChild(
|
|
@@ -51715,13 +51904,39 @@ function createTypeChecker(host) {
|
|
|
51715
51904
|
}
|
|
51716
51905
|
function rewriteModuleSpecifier(parent, lit) {
|
|
51717
51906
|
if (context.bundled || context.enclosingFile !== getSourceFileOfNode(lit)) {
|
|
51718
|
-
|
|
51719
|
-
|
|
51720
|
-
|
|
51721
|
-
|
|
51722
|
-
|
|
51907
|
+
let name = lit.text;
|
|
51908
|
+
const nodeSymbol = getNodeLinks(node).resolvedSymbol;
|
|
51909
|
+
const meaning = parent.isTypeOf ? 111551 /* Value */ : 788968 /* Type */;
|
|
51910
|
+
const parentSymbol = nodeSymbol && isSymbolAccessible(
|
|
51911
|
+
nodeSymbol,
|
|
51912
|
+
context.enclosingDeclaration,
|
|
51913
|
+
meaning,
|
|
51914
|
+
/*shouldComputeAliasesToMakeVisible*/
|
|
51915
|
+
false
|
|
51916
|
+
).accessibility === 0 /* Accessible */ && lookupSymbolChain(
|
|
51917
|
+
nodeSymbol,
|
|
51918
|
+
context,
|
|
51919
|
+
meaning,
|
|
51920
|
+
/*yieldModuleSymbol*/
|
|
51921
|
+
true
|
|
51922
|
+
)[0];
|
|
51923
|
+
if (parentSymbol && parentSymbol.flags & 1536 /* Module */) {
|
|
51924
|
+
name = getSpecifierForModuleSymbol(parentSymbol, context);
|
|
51925
|
+
} else {
|
|
51926
|
+
const targetFile = getExternalModuleFileFromDeclaration(parent);
|
|
51927
|
+
if (targetFile) {
|
|
51928
|
+
name = getSpecifierForModuleSymbol(targetFile.symbol, context);
|
|
51929
|
+
}
|
|
51930
|
+
}
|
|
51931
|
+
if (name.includes("/node_modules/")) {
|
|
51932
|
+
context.encounteredError = true;
|
|
51933
|
+
if (context.tracker.reportLikelyUnsafeImportRequiredError) {
|
|
51934
|
+
context.tracker.reportLikelyUnsafeImportRequiredError(name);
|
|
51723
51935
|
}
|
|
51724
51936
|
}
|
|
51937
|
+
if (name !== lit.text) {
|
|
51938
|
+
return setOriginalNode(factory.createStringLiteral(name), lit);
|
|
51939
|
+
}
|
|
51725
51940
|
}
|
|
51726
51941
|
return visitNode(lit, visitExistingNodeTreeSymbols, isStringLiteral);
|
|
51727
51942
|
}
|
|
@@ -59689,7 +59904,6 @@ function createTypeChecker(host) {
|
|
|
59689
59904
|
return links.resolvedType;
|
|
59690
59905
|
}
|
|
59691
59906
|
function getTemplateLiteralType(texts, types) {
|
|
59692
|
-
var _a, _b;
|
|
59693
59907
|
const unionIndex = findIndex(types, (t) => !!(t.flags & (131072 /* Never */ | 1048576 /* Union */)));
|
|
59694
59908
|
if (unionIndex >= 0) {
|
|
59695
59909
|
return checkCrossProductUnion(types) ? mapType(types[unionIndex], (t) => getTemplateLiteralType(texts, replaceElement(types, unionIndex, t))) : errorType;
|
|
@@ -59697,9 +59911,6 @@ function createTypeChecker(host) {
|
|
|
59697
59911
|
if (contains(types, wildcardType)) {
|
|
59698
59912
|
return wildcardType;
|
|
59699
59913
|
}
|
|
59700
|
-
if (texts.length === 2 && texts[0] === "" && texts[1] === "" && !(types[0].flags & 2944 /* Literal */) && !((_b = (_a = types[0].symbol) == null ? void 0 : _a.declarations) == null ? void 0 : _b.some((d) => d.parent.kind === 195 /* InferType */)) && isTypeAssignableTo(types[0], stringType)) {
|
|
59701
|
-
return types[0];
|
|
59702
|
-
}
|
|
59703
59914
|
const newTypes = [];
|
|
59704
59915
|
const newTexts = [];
|
|
59705
59916
|
let text = texts[0];
|
|
@@ -69124,6 +69335,9 @@ function createTypeChecker(host) {
|
|
|
69124
69335
|
return contextualType && !isGenericType(contextualType);
|
|
69125
69336
|
}
|
|
69126
69337
|
function getNarrowableTypeForReference(type, reference, checkMode) {
|
|
69338
|
+
if (isNoInferType(type)) {
|
|
69339
|
+
type = type.baseType;
|
|
69340
|
+
}
|
|
69127
69341
|
const substituteConstraints = !(checkMode && checkMode & 2 /* Inferential */) && someType(type, isGenericTypeWithUnionConstraint) && (isConstraintPosition(type, reference) || hasContextualTypeWithNoGenericTypes(reference, checkMode));
|
|
69128
69342
|
return substituteConstraints ? mapType(type, getBaseConstraintOrType) : type;
|
|
69129
69343
|
}
|
|
@@ -69189,9 +69403,6 @@ function createTypeChecker(host) {
|
|
|
69189
69403
|
if (isJsxOpeningLikeElement(location) || isJsxOpeningFragment(location)) {
|
|
69190
69404
|
return markJsxAliasReferenced(location);
|
|
69191
69405
|
}
|
|
69192
|
-
if (isFunctionLikeDeclaration(location) || isMethodSignature(location)) {
|
|
69193
|
-
return markAsyncFunctionAliasReferenced(location);
|
|
69194
|
-
}
|
|
69195
69406
|
if (isImportEqualsDeclaration(location)) {
|
|
69196
69407
|
if (isInternalModuleImportEqualsDeclaration(location) || checkExternalImportOrExportDeclaration(location)) {
|
|
69197
69408
|
return markImportEqualsAliasReferenced(location);
|
|
@@ -69201,6 +69412,9 @@ function createTypeChecker(host) {
|
|
|
69201
69412
|
if (isExportSpecifier(location)) {
|
|
69202
69413
|
return markExportSpecifierAliasReferenced(location);
|
|
69203
69414
|
}
|
|
69415
|
+
if (isFunctionLikeDeclaration(location) || isMethodSignature(location)) {
|
|
69416
|
+
markAsyncFunctionAliasReferenced(location);
|
|
69417
|
+
}
|
|
69204
69418
|
if (!compilerOptions.emitDecoratorMetadata) {
|
|
69205
69419
|
return;
|
|
69206
69420
|
}
|
|
@@ -69538,18 +69752,12 @@ function createTypeChecker(host) {
|
|
|
69538
69752
|
}
|
|
69539
69753
|
return type;
|
|
69540
69754
|
}
|
|
69541
|
-
function
|
|
69542
|
-
if (isThisInTypeQuery(node))
|
|
69543
|
-
return checkThisExpression(node);
|
|
69544
|
-
}
|
|
69545
|
-
const symbol = getResolvedSymbol(node);
|
|
69546
|
-
if (symbol === unknownSymbol) {
|
|
69547
|
-
return errorType;
|
|
69548
|
-
}
|
|
69755
|
+
function checkIdentifierCalculateNodeCheckFlags(node, symbol) {
|
|
69756
|
+
if (isThisInTypeQuery(node)) return;
|
|
69549
69757
|
if (symbol === argumentsSymbol) {
|
|
69550
69758
|
if (isInPropertyInitializerOrClassStaticBlock(node)) {
|
|
69551
69759
|
error(node, Diagnostics.arguments_cannot_be_referenced_in_property_initializers);
|
|
69552
|
-
return
|
|
69760
|
+
return;
|
|
69553
69761
|
}
|
|
69554
69762
|
let container = getContainingFunction(node);
|
|
69555
69763
|
if (container) {
|
|
@@ -69568,17 +69776,14 @@ function createTypeChecker(host) {
|
|
|
69568
69776
|
}
|
|
69569
69777
|
}
|
|
69570
69778
|
}
|
|
69571
|
-
return
|
|
69572
|
-
}
|
|
69573
|
-
if (shouldMarkIdentifierAliasReferenced(node)) {
|
|
69574
|
-
markLinkedReferences(node, 1 /* Identifier */);
|
|
69779
|
+
return;
|
|
69575
69780
|
}
|
|
69576
69781
|
const localOrExportSymbol = getExportSymbolOfValueSymbolIfExported(symbol);
|
|
69577
69782
|
const targetSymbol = resolveAliasWithDeprecationCheck(localOrExportSymbol, node);
|
|
69578
69783
|
if (isDeprecatedSymbol(targetSymbol) && isUncalledFunctionReference(node, targetSymbol) && targetSymbol.declarations) {
|
|
69579
69784
|
addDeprecatedSuggestion(node, targetSymbol.declarations, node.escapedText);
|
|
69580
69785
|
}
|
|
69581
|
-
|
|
69786
|
+
const declaration = localOrExportSymbol.valueDeclaration;
|
|
69582
69787
|
if (declaration && localOrExportSymbol.flags & 32 /* Class */) {
|
|
69583
69788
|
if (isClassLike(declaration) && declaration.name !== node) {
|
|
69584
69789
|
let container = getThisContainer(
|
|
@@ -69605,6 +69810,27 @@ function createTypeChecker(host) {
|
|
|
69605
69810
|
}
|
|
69606
69811
|
}
|
|
69607
69812
|
checkNestedBlockScopedBinding(node, symbol);
|
|
69813
|
+
}
|
|
69814
|
+
function checkIdentifier(node, checkMode) {
|
|
69815
|
+
if (isThisInTypeQuery(node)) {
|
|
69816
|
+
return checkThisExpression(node);
|
|
69817
|
+
}
|
|
69818
|
+
const symbol = getResolvedSymbol(node);
|
|
69819
|
+
if (symbol === unknownSymbol) {
|
|
69820
|
+
return errorType;
|
|
69821
|
+
}
|
|
69822
|
+
checkIdentifierCalculateNodeCheckFlags(node, symbol);
|
|
69823
|
+
if (symbol === argumentsSymbol) {
|
|
69824
|
+
if (isInPropertyInitializerOrClassStaticBlock(node)) {
|
|
69825
|
+
return errorType;
|
|
69826
|
+
}
|
|
69827
|
+
return getTypeOfSymbol(symbol);
|
|
69828
|
+
}
|
|
69829
|
+
if (shouldMarkIdentifierAliasReferenced(node)) {
|
|
69830
|
+
markLinkedReferences(node, 1 /* Identifier */);
|
|
69831
|
+
}
|
|
69832
|
+
const localOrExportSymbol = getExportSymbolOfValueSymbolIfExported(symbol);
|
|
69833
|
+
let declaration = localOrExportSymbol.valueDeclaration;
|
|
69608
69834
|
let type = getNarrowedTypeOfSymbol(localOrExportSymbol, node, checkMode);
|
|
69609
69835
|
const assignmentKind = getAssignmentTargetKind(node);
|
|
69610
69836
|
if (assignmentKind) {
|
|
@@ -70270,7 +70496,31 @@ function createTypeChecker(host) {
|
|
|
70270
70496
|
if (!node.asteriskToken && contextualReturnType.flags & 1048576 /* Union */) {
|
|
70271
70497
|
contextualReturnType = filterType(contextualReturnType, (type) => !!getIterationTypeOfGeneratorFunctionReturnType(1 /* Return */, type, isAsyncGenerator));
|
|
70272
70498
|
}
|
|
70273
|
-
|
|
70499
|
+
if (node.asteriskToken) {
|
|
70500
|
+
const iterationTypes = getIterationTypesOfGeneratorFunctionReturnType(contextualReturnType, isAsyncGenerator);
|
|
70501
|
+
const yieldType = (iterationTypes == null ? void 0 : iterationTypes.yieldType) ?? silentNeverType;
|
|
70502
|
+
const returnType = getContextualType(node, contextFlags) ?? silentNeverType;
|
|
70503
|
+
const nextType = (iterationTypes == null ? void 0 : iterationTypes.nextType) ?? unknownType;
|
|
70504
|
+
const generatorType = createGeneratorType(
|
|
70505
|
+
yieldType,
|
|
70506
|
+
returnType,
|
|
70507
|
+
nextType,
|
|
70508
|
+
/*isAsyncGenerator*/
|
|
70509
|
+
false
|
|
70510
|
+
);
|
|
70511
|
+
if (isAsyncGenerator) {
|
|
70512
|
+
const asyncGeneratorType = createGeneratorType(
|
|
70513
|
+
yieldType,
|
|
70514
|
+
returnType,
|
|
70515
|
+
nextType,
|
|
70516
|
+
/*isAsyncGenerator*/
|
|
70517
|
+
true
|
|
70518
|
+
);
|
|
70519
|
+
return getUnionType([generatorType, asyncGeneratorType]);
|
|
70520
|
+
}
|
|
70521
|
+
return generatorType;
|
|
70522
|
+
}
|
|
70523
|
+
return getIterationTypeOfGeneratorFunctionReturnType(0 /* Yield */, contextualReturnType, isAsyncGenerator);
|
|
70274
70524
|
}
|
|
70275
70525
|
}
|
|
70276
70526
|
return void 0;
|
|
@@ -76040,7 +76290,7 @@ function createTypeChecker(host) {
|
|
|
76040
76290
|
if (nextType) nextType = getWidenedType(nextType);
|
|
76041
76291
|
}
|
|
76042
76292
|
if (isGenerator) {
|
|
76043
|
-
return
|
|
76293
|
+
return createGeneratorType(
|
|
76044
76294
|
yieldType || neverType,
|
|
76045
76295
|
returnType || fallbackReturnType,
|
|
76046
76296
|
nextType || getContextualIterationType(2 /* Next */, func) || unknownType,
|
|
@@ -76050,7 +76300,7 @@ function createTypeChecker(host) {
|
|
|
76050
76300
|
return isAsync ? createPromiseType(returnType || fallbackReturnType) : returnType || fallbackReturnType;
|
|
76051
76301
|
}
|
|
76052
76302
|
}
|
|
76053
|
-
function
|
|
76303
|
+
function createGeneratorType(yieldType, returnType, nextType, isAsyncGenerator) {
|
|
76054
76304
|
const resolver = isAsyncGenerator ? asyncIterationTypesResolver : syncIterationTypesResolver;
|
|
76055
76305
|
const globalGeneratorType = resolver.getGlobalGeneratorType(
|
|
76056
76306
|
/*reportErrors*/
|
|
@@ -78435,7 +78685,7 @@ function createTypeChecker(host) {
|
|
|
78435
78685
|
const generatorYieldType = getIterationTypeOfGeneratorFunctionReturnType(0 /* Yield */, returnType, (functionFlags & 2 /* Async */) !== 0) || anyType;
|
|
78436
78686
|
const generatorReturnType = getIterationTypeOfGeneratorFunctionReturnType(1 /* Return */, returnType, (functionFlags & 2 /* Async */) !== 0) || generatorYieldType;
|
|
78437
78687
|
const generatorNextType = getIterationTypeOfGeneratorFunctionReturnType(2 /* Next */, returnType, (functionFlags & 2 /* Async */) !== 0) || unknownType;
|
|
78438
|
-
const generatorInstantiation =
|
|
78688
|
+
const generatorInstantiation = createGeneratorType(generatorYieldType, generatorReturnType, generatorNextType, !!(functionFlags & 2 /* Async */));
|
|
78439
78689
|
return checkTypeAssignableTo(generatorInstantiation, returnType, errorNode);
|
|
78440
78690
|
}
|
|
78441
78691
|
function checkClassForDuplicateDeclarations(node) {
|
|
@@ -82753,6 +83003,14 @@ function createTypeChecker(host) {
|
|
|
82753
83003
|
}
|
|
82754
83004
|
if (isIdentifier(node.name)) {
|
|
82755
83005
|
checkCollisionsForDeclarationName(node, node.name);
|
|
83006
|
+
if (!(node.flags & (32 /* Namespace */ | 2048 /* GlobalAugmentation */))) {
|
|
83007
|
+
const sourceFile = getSourceFileOfNode(node);
|
|
83008
|
+
const pos = getNonModifierTokenPosOfNode(node);
|
|
83009
|
+
const span = getSpanOfTokenAtPosition(sourceFile, pos);
|
|
83010
|
+
suggestionDiagnostics.add(
|
|
83011
|
+
createFileDiagnostic(sourceFile, span.start, span.length, Diagnostics.A_namespace_declaration_should_not_be_declared_using_the_module_keyword_Please_use_the_namespace_keyword_instead)
|
|
83012
|
+
);
|
|
83013
|
+
}
|
|
82756
83014
|
}
|
|
82757
83015
|
checkExportsOnMergedDeclarations(node);
|
|
82758
83016
|
const symbol = getSymbolOfDeclaration(node);
|
|
@@ -83369,9 +83627,6 @@ function createTypeChecker(host) {
|
|
|
83369
83627
|
}
|
|
83370
83628
|
}
|
|
83371
83629
|
function checkSourceElementWorker(node) {
|
|
83372
|
-
if (getNodeCheckFlags(node) & 8388608 /* PartiallyTypeChecked */) {
|
|
83373
|
-
return;
|
|
83374
|
-
}
|
|
83375
83630
|
if (canHaveJSDoc(node)) {
|
|
83376
83631
|
forEach(node.jsDoc, ({ comment, tags }) => {
|
|
83377
83632
|
checkJSDocCommentWorker(comment);
|
|
@@ -83715,21 +83970,19 @@ function createTypeChecker(host) {
|
|
|
83715
83970
|
currentNode = saveCurrentNode;
|
|
83716
83971
|
(_b = tracing) == null ? void 0 : _b.pop();
|
|
83717
83972
|
}
|
|
83718
|
-
function checkSourceFile(node
|
|
83973
|
+
function checkSourceFile(node) {
|
|
83719
83974
|
var _a, _b;
|
|
83720
83975
|
(_a = tracing) == null ? void 0 : _a.push(
|
|
83721
83976
|
tracing.Phase.Check,
|
|
83722
|
-
|
|
83977
|
+
"checkSourceFile",
|
|
83723
83978
|
{ path: node.path },
|
|
83724
83979
|
/*separateBeginAndEnd*/
|
|
83725
83980
|
true
|
|
83726
83981
|
);
|
|
83727
|
-
|
|
83728
|
-
|
|
83729
|
-
mark(
|
|
83730
|
-
|
|
83731
|
-
mark(afterMark);
|
|
83732
|
-
measure("Check", beforeMark, afterMark);
|
|
83982
|
+
mark("beforeCheck");
|
|
83983
|
+
checkSourceFileWorker(node);
|
|
83984
|
+
mark("afterCheck");
|
|
83985
|
+
measure("Check", "beforeCheck", "afterCheck");
|
|
83733
83986
|
(_b = tracing) == null ? void 0 : _b.pop();
|
|
83734
83987
|
}
|
|
83735
83988
|
function unusedIsError(kind, isAmbient) {
|
|
@@ -83760,13 +84013,6 @@ function createTypeChecker(host) {
|
|
|
83760
84013
|
clear(potentialWeakMapSetCollisions);
|
|
83761
84014
|
clear(potentialReflectCollisions);
|
|
83762
84015
|
clear(potentialUnusedRenamedBindingElementsInTypes);
|
|
83763
|
-
if (links.flags & 8388608 /* PartiallyTypeChecked */) {
|
|
83764
|
-
potentialThisCollisions = links.potentialThisCollisions;
|
|
83765
|
-
potentialNewTargetCollisions = links.potentialNewTargetCollisions;
|
|
83766
|
-
potentialWeakMapSetCollisions = links.potentialWeakMapSetCollisions;
|
|
83767
|
-
potentialReflectCollisions = links.potentialReflectCollisions;
|
|
83768
|
-
potentialUnusedRenamedBindingElementsInTypes = links.potentialUnusedRenamedBindingElementsInTypes;
|
|
83769
|
-
}
|
|
83770
84016
|
forEach(node.statements, checkSourceElement);
|
|
83771
84017
|
checkSourceElement(node.endOfFileToken);
|
|
83772
84018
|
checkDeferredNodes(node);
|
|
@@ -83807,38 +84053,10 @@ function createTypeChecker(host) {
|
|
|
83807
84053
|
links.flags |= 1 /* TypeChecked */;
|
|
83808
84054
|
}
|
|
83809
84055
|
}
|
|
83810
|
-
function
|
|
83811
|
-
const links = getNodeLinks(file);
|
|
83812
|
-
if (!(links.flags & 1 /* TypeChecked */)) {
|
|
83813
|
-
if (skipTypeChecking(file, compilerOptions, host)) {
|
|
83814
|
-
return;
|
|
83815
|
-
}
|
|
83816
|
-
checkGrammarSourceFile(file);
|
|
83817
|
-
clear(potentialThisCollisions);
|
|
83818
|
-
clear(potentialNewTargetCollisions);
|
|
83819
|
-
clear(potentialWeakMapSetCollisions);
|
|
83820
|
-
clear(potentialReflectCollisions);
|
|
83821
|
-
clear(potentialUnusedRenamedBindingElementsInTypes);
|
|
83822
|
-
forEach(nodes, checkSourceElement);
|
|
83823
|
-
checkDeferredNodes(file);
|
|
83824
|
-
(links.potentialThisCollisions || (links.potentialThisCollisions = [])).push(...potentialThisCollisions);
|
|
83825
|
-
(links.potentialNewTargetCollisions || (links.potentialNewTargetCollisions = [])).push(...potentialNewTargetCollisions);
|
|
83826
|
-
(links.potentialWeakMapSetCollisions || (links.potentialWeakMapSetCollisions = [])).push(...potentialWeakMapSetCollisions);
|
|
83827
|
-
(links.potentialReflectCollisions || (links.potentialReflectCollisions = [])).push(...potentialReflectCollisions);
|
|
83828
|
-
(links.potentialUnusedRenamedBindingElementsInTypes || (links.potentialUnusedRenamedBindingElementsInTypes = [])).push(
|
|
83829
|
-
...potentialUnusedRenamedBindingElementsInTypes
|
|
83830
|
-
);
|
|
83831
|
-
links.flags |= 8388608 /* PartiallyTypeChecked */;
|
|
83832
|
-
for (const node of nodes) {
|
|
83833
|
-
const nodeLinks2 = getNodeLinks(node);
|
|
83834
|
-
nodeLinks2.flags |= 8388608 /* PartiallyTypeChecked */;
|
|
83835
|
-
}
|
|
83836
|
-
}
|
|
83837
|
-
}
|
|
83838
|
-
function getDiagnostics(sourceFile, ct, nodesToCheck) {
|
|
84056
|
+
function getDiagnostics(sourceFile, ct) {
|
|
83839
84057
|
try {
|
|
83840
84058
|
cancellationToken = ct;
|
|
83841
|
-
return getDiagnosticsWorker(sourceFile
|
|
84059
|
+
return getDiagnosticsWorker(sourceFile);
|
|
83842
84060
|
} finally {
|
|
83843
84061
|
cancellationToken = void 0;
|
|
83844
84062
|
}
|
|
@@ -83849,23 +84067,20 @@ function createTypeChecker(host) {
|
|
|
83849
84067
|
}
|
|
83850
84068
|
deferredDiagnosticsCallbacks = [];
|
|
83851
84069
|
}
|
|
83852
|
-
function checkSourceFileWithEagerDiagnostics(sourceFile
|
|
84070
|
+
function checkSourceFileWithEagerDiagnostics(sourceFile) {
|
|
83853
84071
|
ensurePendingDiagnosticWorkComplete();
|
|
83854
84072
|
const oldAddLazyDiagnostics = addLazyDiagnostic;
|
|
83855
84073
|
addLazyDiagnostic = (cb) => cb();
|
|
83856
|
-
checkSourceFile(sourceFile
|
|
84074
|
+
checkSourceFile(sourceFile);
|
|
83857
84075
|
addLazyDiagnostic = oldAddLazyDiagnostics;
|
|
83858
84076
|
}
|
|
83859
|
-
function getDiagnosticsWorker(sourceFile
|
|
84077
|
+
function getDiagnosticsWorker(sourceFile) {
|
|
83860
84078
|
if (sourceFile) {
|
|
83861
84079
|
ensurePendingDiagnosticWorkComplete();
|
|
83862
84080
|
const previousGlobalDiagnostics = diagnostics.getGlobalDiagnostics();
|
|
83863
84081
|
const previousGlobalDiagnosticsSize = previousGlobalDiagnostics.length;
|
|
83864
|
-
checkSourceFileWithEagerDiagnostics(sourceFile
|
|
84082
|
+
checkSourceFileWithEagerDiagnostics(sourceFile);
|
|
83865
84083
|
const semanticDiagnostics = diagnostics.getDiagnostics(sourceFile.fileName);
|
|
83866
|
-
if (nodesToCheck) {
|
|
83867
|
-
return semanticDiagnostics;
|
|
83868
|
-
}
|
|
83869
84084
|
const currentGlobalDiagnostics = diagnostics.getGlobalDiagnostics();
|
|
83870
84085
|
if (currentGlobalDiagnostics !== previousGlobalDiagnostics) {
|
|
83871
84086
|
const deferredGlobalDiagnostics = relativeComplement(previousGlobalDiagnostics, currentGlobalDiagnostics, compareDiagnostics);
|
|
@@ -83875,7 +84090,7 @@ function createTypeChecker(host) {
|
|
|
83875
84090
|
}
|
|
83876
84091
|
return semanticDiagnostics;
|
|
83877
84092
|
}
|
|
83878
|
-
forEach(host.getSourceFiles(),
|
|
84093
|
+
forEach(host.getSourceFiles(), checkSourceFileWithEagerDiagnostics);
|
|
83879
84094
|
return diagnostics.getDiagnostics();
|
|
83880
84095
|
}
|
|
83881
84096
|
function getGlobalDiagnostics() {
|
|
@@ -84634,7 +84849,6 @@ function createTypeChecker(host) {
|
|
|
84634
84849
|
if (links.isDeclarationWithCollidingName === void 0) {
|
|
84635
84850
|
const container = getEnclosingBlockScopeContainer(symbol.valueDeclaration);
|
|
84636
84851
|
if (isStatementWithLocals(container) || isSymbolOfDestructuredElementOfCatchBinding(symbol)) {
|
|
84637
|
-
const nodeLinks2 = getNodeLinks(symbol.valueDeclaration);
|
|
84638
84852
|
if (resolveName(
|
|
84639
84853
|
container.parent,
|
|
84640
84854
|
symbol.escapedName,
|
|
@@ -84645,8 +84859,8 @@ function createTypeChecker(host) {
|
|
|
84645
84859
|
false
|
|
84646
84860
|
)) {
|
|
84647
84861
|
links.isDeclarationWithCollidingName = true;
|
|
84648
|
-
} else if (
|
|
84649
|
-
const isDeclaredInLoop =
|
|
84862
|
+
} else if (hasNodeCheckFlag(symbol.valueDeclaration, 16384 /* CapturedBlockScopedBinding */)) {
|
|
84863
|
+
const isDeclaredInLoop = hasNodeCheckFlag(symbol.valueDeclaration, 32768 /* BlockScopedBindingInLoop */);
|
|
84650
84864
|
const inLoopInitializer = isIterationStatement(
|
|
84651
84865
|
container,
|
|
84652
84866
|
/*lookInLabeledStatements*/
|
|
@@ -84728,6 +84942,9 @@ function createTypeChecker(host) {
|
|
|
84728
84942
|
if (!symbol) {
|
|
84729
84943
|
return false;
|
|
84730
84944
|
}
|
|
84945
|
+
const container = getSourceFileOfNode(symbol.valueDeclaration);
|
|
84946
|
+
const fileSymbol = container && getSymbolOfDeclaration(container);
|
|
84947
|
+
void resolveExternalModuleSymbol(fileSymbol);
|
|
84731
84948
|
const target = getExportSymbolOfValueSymbolIfExported(resolveAlias(symbol));
|
|
84732
84949
|
if (target === unknownSymbol) {
|
|
84733
84950
|
return !excludeTypeOnlyValues || !getTypeOnlyAliasDeclaration(symbol);
|
|
@@ -84826,6 +85043,108 @@ function createTypeChecker(host) {
|
|
|
84826
85043
|
if (nodeId < 0 || nodeId >= nodeLinks.length) return 0;
|
|
84827
85044
|
return ((_a = nodeLinks[nodeId]) == null ? void 0 : _a.flags) || 0;
|
|
84828
85045
|
}
|
|
85046
|
+
function hasNodeCheckFlag(node, flag) {
|
|
85047
|
+
calculateNodeCheckFlagWorker(node, flag);
|
|
85048
|
+
return !!(getNodeCheckFlags(node) & flag);
|
|
85049
|
+
}
|
|
85050
|
+
function calculateNodeCheckFlagWorker(node, flag) {
|
|
85051
|
+
if (!compilerOptions.noCheck) {
|
|
85052
|
+
return;
|
|
85053
|
+
}
|
|
85054
|
+
const links = getNodeLinks(node);
|
|
85055
|
+
if (links.calculatedFlags & flag) {
|
|
85056
|
+
return;
|
|
85057
|
+
}
|
|
85058
|
+
switch (flag) {
|
|
85059
|
+
case 16 /* SuperInstance */:
|
|
85060
|
+
case 32 /* SuperStatic */:
|
|
85061
|
+
return checkSingleSuperExpression(node);
|
|
85062
|
+
case 128 /* MethodWithSuperPropertyAccessInAsync */:
|
|
85063
|
+
case 256 /* MethodWithSuperPropertyAssignmentInAsync */:
|
|
85064
|
+
case 2097152 /* ContainsSuperPropertyInStaticInitializer */:
|
|
85065
|
+
return checkChildSuperExpressions(node);
|
|
85066
|
+
case 512 /* CaptureArguments */:
|
|
85067
|
+
case 8192 /* ContainsCapturedBlockScopeBinding */:
|
|
85068
|
+
case 65536 /* NeedsLoopOutParameter */:
|
|
85069
|
+
case 262144 /* ContainsConstructorReference */:
|
|
85070
|
+
return checkChildIdentifiers(node);
|
|
85071
|
+
case 536870912 /* ConstructorReference */:
|
|
85072
|
+
return checkSingleIdentifier(node);
|
|
85073
|
+
case 4096 /* LoopWithCapturedBlockScopedBinding */:
|
|
85074
|
+
case 32768 /* BlockScopedBindingInLoop */:
|
|
85075
|
+
case 16384 /* CapturedBlockScopedBinding */:
|
|
85076
|
+
return checkContainingBlockScopeBindingUses(node);
|
|
85077
|
+
default:
|
|
85078
|
+
return Debug.assertNever(flag, `Unhandled node check flag calculation: ${Debug.formatNodeCheckFlags(flag)}`);
|
|
85079
|
+
}
|
|
85080
|
+
function forEachNodeRecursively(root, cb) {
|
|
85081
|
+
const rootResult = cb(root, root.parent);
|
|
85082
|
+
if (rootResult === "skip") return void 0;
|
|
85083
|
+
if (rootResult) return rootResult;
|
|
85084
|
+
return forEachChildRecursively(root, cb);
|
|
85085
|
+
}
|
|
85086
|
+
function checkSuperExpressions(node2) {
|
|
85087
|
+
const links2 = getNodeLinks(node2);
|
|
85088
|
+
if (links2.calculatedFlags & flag) return "skip";
|
|
85089
|
+
links2.calculatedFlags |= 128 /* MethodWithSuperPropertyAccessInAsync */ | 256 /* MethodWithSuperPropertyAssignmentInAsync */ | 2097152 /* ContainsSuperPropertyInStaticInitializer */;
|
|
85090
|
+
checkSingleSuperExpression(node2);
|
|
85091
|
+
return void 0;
|
|
85092
|
+
}
|
|
85093
|
+
function checkChildSuperExpressions(node2) {
|
|
85094
|
+
forEachNodeRecursively(node2, checkSuperExpressions);
|
|
85095
|
+
}
|
|
85096
|
+
function checkSingleSuperExpression(node2) {
|
|
85097
|
+
const nodeLinks2 = getNodeLinks(node2);
|
|
85098
|
+
nodeLinks2.calculatedFlags |= 16 /* SuperInstance */ | 32 /* SuperStatic */;
|
|
85099
|
+
if (node2.kind === 108 /* SuperKeyword */) {
|
|
85100
|
+
checkSuperExpression(node2);
|
|
85101
|
+
}
|
|
85102
|
+
}
|
|
85103
|
+
function checkIdentifiers(node2) {
|
|
85104
|
+
const links2 = getNodeLinks(node2);
|
|
85105
|
+
if (links2.calculatedFlags & flag) return "skip";
|
|
85106
|
+
links2.calculatedFlags |= 512 /* CaptureArguments */ | 8192 /* ContainsCapturedBlockScopeBinding */ | 65536 /* NeedsLoopOutParameter */ | 262144 /* ContainsConstructorReference */;
|
|
85107
|
+
checkSingleIdentifier(node2);
|
|
85108
|
+
return void 0;
|
|
85109
|
+
}
|
|
85110
|
+
function checkChildIdentifiers(node2) {
|
|
85111
|
+
forEachNodeRecursively(node2, checkIdentifiers);
|
|
85112
|
+
}
|
|
85113
|
+
function checkSingleIdentifier(node2) {
|
|
85114
|
+
const nodeLinks2 = getNodeLinks(node2);
|
|
85115
|
+
nodeLinks2.calculatedFlags |= 536870912 /* ConstructorReference */ | 16384 /* CapturedBlockScopedBinding */ | 32768 /* BlockScopedBindingInLoop */;
|
|
85116
|
+
if (isIdentifier(node2) && isExpressionNode(node2) && !(isPropertyAccessExpression(node2.parent) && node2.parent.name === node2)) {
|
|
85117
|
+
const s = getSymbolAtLocation(
|
|
85118
|
+
node2,
|
|
85119
|
+
/*ignoreErrors*/
|
|
85120
|
+
true
|
|
85121
|
+
);
|
|
85122
|
+
if (s && s !== unknownSymbol) {
|
|
85123
|
+
checkIdentifierCalculateNodeCheckFlags(node2, s);
|
|
85124
|
+
}
|
|
85125
|
+
}
|
|
85126
|
+
}
|
|
85127
|
+
function checkBlockScopeBindings(node2) {
|
|
85128
|
+
const links2 = getNodeLinks(node2);
|
|
85129
|
+
if (links2.calculatedFlags & flag) return "skip";
|
|
85130
|
+
links2.calculatedFlags |= 4096 /* LoopWithCapturedBlockScopedBinding */ | 32768 /* BlockScopedBindingInLoop */ | 16384 /* CapturedBlockScopedBinding */;
|
|
85131
|
+
checkSingleBlockScopeBinding(node2);
|
|
85132
|
+
return void 0;
|
|
85133
|
+
}
|
|
85134
|
+
function checkContainingBlockScopeBindingUses(node2) {
|
|
85135
|
+
const scope = getEnclosingBlockScopeContainer(isDeclarationName(node2) ? node2.parent : node2);
|
|
85136
|
+
forEachNodeRecursively(scope, checkBlockScopeBindings);
|
|
85137
|
+
}
|
|
85138
|
+
function checkSingleBlockScopeBinding(node2) {
|
|
85139
|
+
checkSingleIdentifier(node2);
|
|
85140
|
+
if (isComputedPropertyName(node2)) {
|
|
85141
|
+
checkComputedPropertyName(node2);
|
|
85142
|
+
}
|
|
85143
|
+
if (isPrivateIdentifier(node2) && isClassElement(node2.parent)) {
|
|
85144
|
+
setNodeLinksForPrivateIdentifierScope(node2.parent);
|
|
85145
|
+
}
|
|
85146
|
+
}
|
|
85147
|
+
}
|
|
84829
85148
|
function getEnumMemberValue(node) {
|
|
84830
85149
|
computeEnumMemberValues(node.parent);
|
|
84831
85150
|
return getNodeLinks(node).enumMemberValue ?? evaluatorResult(
|
|
@@ -84846,7 +85165,15 @@ function createTypeChecker(host) {
|
|
|
84846
85165
|
if (node.kind === 306 /* EnumMember */) {
|
|
84847
85166
|
return getEnumMemberValue(node).value;
|
|
84848
85167
|
}
|
|
84849
|
-
|
|
85168
|
+
if (!getNodeLinks(node).resolvedSymbol) {
|
|
85169
|
+
void checkExpressionCached(node);
|
|
85170
|
+
}
|
|
85171
|
+
const symbol = getNodeLinks(node).resolvedSymbol || (isEntityNameExpression(node) ? resolveEntityName(
|
|
85172
|
+
node,
|
|
85173
|
+
111551 /* Value */,
|
|
85174
|
+
/*ignoreErrors*/
|
|
85175
|
+
true
|
|
85176
|
+
) : void 0);
|
|
84850
85177
|
if (symbol && symbol.flags & 8 /* EnumMember */) {
|
|
84851
85178
|
const member = symbol.valueDeclaration;
|
|
84852
85179
|
if (isEnumConst(member.parent)) {
|
|
@@ -85197,9 +85524,10 @@ function createTypeChecker(host) {
|
|
|
85197
85524
|
const node = getParseTreeNode(nodeIn);
|
|
85198
85525
|
return node && canCollectSymbolAliasAccessabilityData ? isReferencedAliasDeclaration(node, checkChildren) : true;
|
|
85199
85526
|
},
|
|
85200
|
-
|
|
85527
|
+
hasNodeCheckFlag: (nodeIn, flag) => {
|
|
85201
85528
|
const node = getParseTreeNode(nodeIn);
|
|
85202
|
-
|
|
85529
|
+
if (!node) return false;
|
|
85530
|
+
return hasNodeCheckFlag(node, flag);
|
|
85203
85531
|
},
|
|
85204
85532
|
isTopLevelValueImportEqualsWithEntityName,
|
|
85205
85533
|
isDeclarationVisible,
|
|
@@ -85222,6 +85550,10 @@ function createTypeChecker(host) {
|
|
|
85222
85550
|
return node ? getEnumMemberValue(node) : void 0;
|
|
85223
85551
|
},
|
|
85224
85552
|
collectLinkedAliases,
|
|
85553
|
+
markLinkedReferences: (nodeIn) => {
|
|
85554
|
+
const node = getParseTreeNode(nodeIn);
|
|
85555
|
+
return node && markLinkedReferences(node, 0 /* Unspecified */);
|
|
85556
|
+
},
|
|
85225
85557
|
getReferencedValueDeclaration,
|
|
85226
85558
|
getReferencedValueDeclarations,
|
|
85227
85559
|
getTypeReferenceSerializationKind,
|
|
@@ -85468,38 +85800,40 @@ function createTypeChecker(host) {
|
|
|
85468
85800
|
amalgamatedDuplicates = void 0;
|
|
85469
85801
|
}
|
|
85470
85802
|
function checkExternalEmitHelpers(location, helpers) {
|
|
85471
|
-
if (
|
|
85803
|
+
if (compilerOptions.importHelpers) {
|
|
85472
85804
|
const sourceFile = getSourceFileOfNode(location);
|
|
85473
85805
|
if (isEffectiveExternalModule(sourceFile, compilerOptions) && !(location.flags & 33554432 /* Ambient */)) {
|
|
85474
85806
|
const helpersModule = resolveHelpersModule(sourceFile, location);
|
|
85475
85807
|
if (helpersModule !== unknownSymbol) {
|
|
85476
|
-
const
|
|
85477
|
-
|
|
85478
|
-
|
|
85479
|
-
|
|
85480
|
-
|
|
85481
|
-
|
|
85482
|
-
const
|
|
85483
|
-
|
|
85484
|
-
|
|
85485
|
-
|
|
85486
|
-
if (
|
|
85487
|
-
|
|
85488
|
-
|
|
85489
|
-
|
|
85490
|
-
if (
|
|
85491
|
-
|
|
85492
|
-
|
|
85493
|
-
|
|
85494
|
-
if (
|
|
85495
|
-
|
|
85808
|
+
const links = getSymbolLinks(helpersModule);
|
|
85809
|
+
links.requestedExternalEmitHelpers ?? (links.requestedExternalEmitHelpers = 0);
|
|
85810
|
+
if ((links.requestedExternalEmitHelpers & helpers) !== helpers) {
|
|
85811
|
+
const uncheckedHelpers = helpers & ~links.requestedExternalEmitHelpers;
|
|
85812
|
+
for (let helper = 1 /* FirstEmitHelper */; helper <= 16777216 /* LastEmitHelper */; helper <<= 1) {
|
|
85813
|
+
if (uncheckedHelpers & helper) {
|
|
85814
|
+
for (const name of getHelperNames(helper)) {
|
|
85815
|
+
const symbol = resolveSymbol(getSymbol(getExportsOfModule(helpersModule), escapeLeadingUnderscores(name), 111551 /* Value */));
|
|
85816
|
+
if (!symbol) {
|
|
85817
|
+
error(location, Diagnostics.This_syntax_requires_an_imported_helper_named_1_which_does_not_exist_in_0_Consider_upgrading_your_version_of_0, externalHelpersModuleNameText, name);
|
|
85818
|
+
} else if (helper & 524288 /* ClassPrivateFieldGet */) {
|
|
85819
|
+
if (!some(getSignaturesOfSymbol(symbol), (signature) => getParameterCount(signature) > 3)) {
|
|
85820
|
+
error(location, Diagnostics.This_syntax_requires_an_imported_helper_named_1_with_2_parameters_which_is_not_compatible_with_the_one_in_0_Consider_upgrading_your_version_of_0, externalHelpersModuleNameText, name, 4);
|
|
85821
|
+
}
|
|
85822
|
+
} else if (helper & 1048576 /* ClassPrivateFieldSet */) {
|
|
85823
|
+
if (!some(getSignaturesOfSymbol(symbol), (signature) => getParameterCount(signature) > 4)) {
|
|
85824
|
+
error(location, Diagnostics.This_syntax_requires_an_imported_helper_named_1_with_2_parameters_which_is_not_compatible_with_the_one_in_0_Consider_upgrading_your_version_of_0, externalHelpersModuleNameText, name, 5);
|
|
85825
|
+
}
|
|
85826
|
+
} else if (helper & 1024 /* SpreadArray */) {
|
|
85827
|
+
if (!some(getSignaturesOfSymbol(symbol), (signature) => getParameterCount(signature) > 2)) {
|
|
85828
|
+
error(location, Diagnostics.This_syntax_requires_an_imported_helper_named_1_with_2_parameters_which_is_not_compatible_with_the_one_in_0_Consider_upgrading_your_version_of_0, externalHelpersModuleNameText, name, 3);
|
|
85829
|
+
}
|
|
85496
85830
|
}
|
|
85497
85831
|
}
|
|
85498
85832
|
}
|
|
85499
85833
|
}
|
|
85500
85834
|
}
|
|
85835
|
+
links.requestedExternalEmitHelpers |= helpers;
|
|
85501
85836
|
}
|
|
85502
|
-
requestedExternalEmitHelpers |= helpers;
|
|
85503
85837
|
}
|
|
85504
85838
|
}
|
|
85505
85839
|
}
|
|
@@ -85560,10 +85894,11 @@ function createTypeChecker(host) {
|
|
|
85560
85894
|
}
|
|
85561
85895
|
}
|
|
85562
85896
|
function resolveHelpersModule(file, errorNode) {
|
|
85563
|
-
|
|
85564
|
-
|
|
85897
|
+
const links = getNodeLinks(file);
|
|
85898
|
+
if (!links.externalHelpersModule) {
|
|
85899
|
+
links.externalHelpersModule = resolveExternalModule(getImportHelpersImportSpecifier(file), externalHelpersModuleNameText, Diagnostics.This_syntax_requires_an_imported_helper_but_module_0_cannot_be_found, errorNode) || unknownSymbol;
|
|
85565
85900
|
}
|
|
85566
|
-
return externalHelpersModule;
|
|
85901
|
+
return links.externalHelpersModule;
|
|
85567
85902
|
}
|
|
85568
85903
|
function checkGrammarModifiers(node) {
|
|
85569
85904
|
var _a;
|
|
@@ -86356,7 +86691,6 @@ function createTypeChecker(host) {
|
|
|
86356
86691
|
return true;
|
|
86357
86692
|
}
|
|
86358
86693
|
}
|
|
86359
|
-
return false;
|
|
86360
86694
|
}
|
|
86361
86695
|
}
|
|
86362
86696
|
if (isForOfStatement(forInOrOfStatement) && !(forInOrOfStatement.flags & 65536 /* AwaitContext */) && isIdentifier(forInOrOfStatement.initializer) && forInOrOfStatement.initializer.escapedText === "async") {
|
|
@@ -88953,8 +89287,8 @@ function collectExternalModuleInfo(context, sourceFile) {
|
|
|
88953
89287
|
const exportSpecifiers = new IdentifierNameMultiMap();
|
|
88954
89288
|
const exportedBindings = [];
|
|
88955
89289
|
const uniqueExports = /* @__PURE__ */ new Map();
|
|
89290
|
+
const exportedFunctions = /* @__PURE__ */ new Set();
|
|
88956
89291
|
let exportedNames;
|
|
88957
|
-
let exportedFunctions;
|
|
88958
89292
|
let hasExportDefault = false;
|
|
88959
89293
|
let exportEquals;
|
|
88960
89294
|
let hasExportStarsToExportValues = false;
|
|
@@ -89014,19 +89348,12 @@ function collectExternalModuleInfo(context, sourceFile) {
|
|
|
89014
89348
|
break;
|
|
89015
89349
|
case 262 /* FunctionDeclaration */:
|
|
89016
89350
|
if (hasSyntacticModifier(node, 32 /* Export */)) {
|
|
89017
|
-
|
|
89018
|
-
|
|
89019
|
-
|
|
89020
|
-
|
|
89021
|
-
|
|
89022
|
-
|
|
89023
|
-
} else {
|
|
89024
|
-
const name = node.name;
|
|
89025
|
-
if (!uniqueExports.get(idText(name))) {
|
|
89026
|
-
multiMapSparseArrayAdd(exportedBindings, getOriginalNodeId(node), name);
|
|
89027
|
-
uniqueExports.set(idText(name), true);
|
|
89028
|
-
}
|
|
89029
|
-
}
|
|
89351
|
+
addExportedFunctionDeclaration(
|
|
89352
|
+
node,
|
|
89353
|
+
/*name*/
|
|
89354
|
+
void 0,
|
|
89355
|
+
hasSyntacticModifier(node, 2048 /* Default */)
|
|
89356
|
+
);
|
|
89030
89357
|
}
|
|
89031
89358
|
break;
|
|
89032
89359
|
case 263 /* ClassDeclaration */:
|
|
@@ -89062,6 +89389,10 @@ function collectExternalModuleInfo(context, sourceFile) {
|
|
|
89062
89389
|
}
|
|
89063
89390
|
const decl = resolver.getReferencedImportDeclaration(name) || resolver.getReferencedValueDeclaration(name);
|
|
89064
89391
|
if (decl) {
|
|
89392
|
+
if (decl.kind === 262 /* FunctionDeclaration */) {
|
|
89393
|
+
addExportedFunctionDeclaration(decl, specifier.name, specifier.name.escapedText === "default" /* Default */);
|
|
89394
|
+
continue;
|
|
89395
|
+
}
|
|
89065
89396
|
multiMapSparseArrayAdd(exportedBindings, getOriginalNodeId(decl), specifier.name);
|
|
89066
89397
|
}
|
|
89067
89398
|
uniqueExports.set(idText(specifier.name), true);
|
|
@@ -89069,6 +89400,21 @@ function collectExternalModuleInfo(context, sourceFile) {
|
|
|
89069
89400
|
}
|
|
89070
89401
|
}
|
|
89071
89402
|
}
|
|
89403
|
+
function addExportedFunctionDeclaration(node, name, isDefault) {
|
|
89404
|
+
exportedFunctions.add(node);
|
|
89405
|
+
if (isDefault) {
|
|
89406
|
+
if (!hasExportDefault) {
|
|
89407
|
+
multiMapSparseArrayAdd(exportedBindings, getOriginalNodeId(node), name ?? context.factory.getDeclarationName(node));
|
|
89408
|
+
hasExportDefault = true;
|
|
89409
|
+
}
|
|
89410
|
+
} else {
|
|
89411
|
+
name ?? (name = node.name);
|
|
89412
|
+
if (!uniqueExports.get(idText(name))) {
|
|
89413
|
+
multiMapSparseArrayAdd(exportedBindings, getOriginalNodeId(node), name);
|
|
89414
|
+
uniqueExports.set(idText(name), true);
|
|
89415
|
+
}
|
|
89416
|
+
}
|
|
89417
|
+
}
|
|
89072
89418
|
}
|
|
89073
89419
|
function collectExportedVariableInfo(decl, uniqueExports, exportedNames, exportedBindings) {
|
|
89074
89420
|
if (isBindingPattern(decl.name)) {
|
|
@@ -93013,7 +93359,7 @@ function transformClassFields(context) {
|
|
|
93013
93359
|
containsInstancePrivateElements || (containsInstancePrivateElements = isPrivateIdentifierClassElementDeclaration(member));
|
|
93014
93360
|
} else if (isPrivateIdentifierClassElementDeclaration(member)) {
|
|
93015
93361
|
containsInstancePrivateElements = true;
|
|
93016
|
-
if (resolver.
|
|
93362
|
+
if (resolver.hasNodeCheckFlag(member, 262144 /* ContainsConstructorReference */)) {
|
|
93017
93363
|
facts |= 2 /* NeedsClassConstructorReference */;
|
|
93018
93364
|
}
|
|
93019
93365
|
} else if (isPropertyDeclaration(member)) {
|
|
@@ -93120,7 +93466,7 @@ function transformClassFields(context) {
|
|
|
93120
93466
|
if ((_b = node.emitNode) == null ? void 0 : _b.classThis) {
|
|
93121
93467
|
getClassLexicalEnvironment().classThis = node.emitNode.classThis;
|
|
93122
93468
|
}
|
|
93123
|
-
const isClassWithConstructorReference = resolver.
|
|
93469
|
+
const isClassWithConstructorReference = resolver.hasNodeCheckFlag(node, 262144 /* ContainsConstructorReference */);
|
|
93124
93470
|
const isExport = hasSyntacticModifier(node, 32 /* Export */);
|
|
93125
93471
|
const isDefault = hasSyntacticModifier(node, 2048 /* Default */);
|
|
93126
93472
|
let modifiers = visitNodes2(node.modifiers, modifierVisitor, isModifier);
|
|
@@ -93182,15 +93528,14 @@ function transformClassFields(context) {
|
|
|
93182
93528
|
var _a, _b, _c;
|
|
93183
93529
|
const isDecoratedClassDeclaration = !!(facts & 1 /* ClassWasDecorated */);
|
|
93184
93530
|
const staticPropertiesOrClassStaticBlocks = getStaticPropertiesAndClassStaticBlock(node);
|
|
93185
|
-
const
|
|
93186
|
-
const
|
|
93531
|
+
const isClassWithConstructorReference = resolver.hasNodeCheckFlag(node, 262144 /* ContainsConstructorReference */);
|
|
93532
|
+
const requiresBlockScopedVar = resolver.hasNodeCheckFlag(node, 32768 /* BlockScopedBindingInLoop */);
|
|
93187
93533
|
let temp;
|
|
93188
93534
|
function createClassTempVar() {
|
|
93189
93535
|
var _a2;
|
|
93190
93536
|
if (shouldTransformPrivateElementsOrClassStaticBlocks && ((_a2 = node.emitNode) == null ? void 0 : _a2.classThis)) {
|
|
93191
93537
|
return getClassLexicalEnvironment().classConstructor = node.emitNode.classThis;
|
|
93192
93538
|
}
|
|
93193
|
-
const requiresBlockScopedVar = classCheckFlags & 32768 /* BlockScopedBindingInLoop */;
|
|
93194
93539
|
const temp2 = factory2.createTempVariable(
|
|
93195
93540
|
requiresBlockScopedVar ? addBlockScopedVariable : hoistVariableDeclaration,
|
|
93196
93541
|
/*reservedInNestedScopes*/
|
|
@@ -93758,7 +94103,7 @@ function transformClassFields(context) {
|
|
|
93758
94103
|
const alreadyTransformed = !!cacheAssignment || isAssignmentExpression(innerExpression) && isGeneratedIdentifier(innerExpression.left);
|
|
93759
94104
|
if (!alreadyTransformed && !inlinable && shouldHoist) {
|
|
93760
94105
|
const generatedName = factory2.getGeneratedNameForNode(name);
|
|
93761
|
-
if (resolver.
|
|
94106
|
+
if (resolver.hasNodeCheckFlag(name, 32768 /* BlockScopedBindingInLoop */)) {
|
|
93762
94107
|
addBlockScopedVariable(generatedName);
|
|
93763
94108
|
} else {
|
|
93764
94109
|
hoistVariableDeclaration(generatedName);
|
|
@@ -93912,7 +94257,7 @@ function transformClassFields(context) {
|
|
|
93912
94257
|
prefix,
|
|
93913
94258
|
suffix
|
|
93914
94259
|
);
|
|
93915
|
-
if (resolver.
|
|
94260
|
+
if (resolver.hasNodeCheckFlag(node, 32768 /* BlockScopedBindingInLoop */)) {
|
|
93916
94261
|
addBlockScopedVariable(identifier);
|
|
93917
94262
|
} else {
|
|
93918
94263
|
hoistVariableDeclaration(identifier);
|
|
@@ -94151,7 +94496,7 @@ function transformClassFields(context) {
|
|
|
94151
94496
|
}
|
|
94152
94497
|
function trySubstituteClassAlias(node) {
|
|
94153
94498
|
if (enabledSubstitutions & 1 /* ClassAliases */) {
|
|
94154
|
-
if (resolver.
|
|
94499
|
+
if (resolver.hasNodeCheckFlag(node, 536870912 /* ConstructorReference */)) {
|
|
94155
94500
|
const declaration = resolver.getReferencedValueDeclaration(node);
|
|
94156
94501
|
if (declaration) {
|
|
94157
94502
|
const classAlias = classAliases[declaration.id];
|
|
@@ -95018,7 +95363,7 @@ function transformLegacyDecorators(context) {
|
|
|
95018
95363
|
}
|
|
95019
95364
|
}
|
|
95020
95365
|
function getClassAliasIfNeeded(node) {
|
|
95021
|
-
if (resolver.
|
|
95366
|
+
if (resolver.hasNodeCheckFlag(node, 262144 /* ContainsConstructorReference */)) {
|
|
95022
95367
|
enableSubstitutionForClassAliases();
|
|
95023
95368
|
const classAlias = factory2.createUniqueName(node.name && !isGeneratedIdentifier(node.name) ? idText(node.name) : "default");
|
|
95024
95369
|
classAliases[getOriginalNodeId(node)] = classAlias;
|
|
@@ -95051,7 +95396,7 @@ function transformLegacyDecorators(context) {
|
|
|
95051
95396
|
}
|
|
95052
95397
|
function trySubstituteClassAlias(node) {
|
|
95053
95398
|
if (classAliases) {
|
|
95054
|
-
if (resolver.
|
|
95399
|
+
if (resolver.hasNodeCheckFlag(node, 536870912 /* ConstructorReference */)) {
|
|
95055
95400
|
const declaration = resolver.getReferencedValueDeclaration(node);
|
|
95056
95401
|
if (declaration) {
|
|
95057
95402
|
const classAlias = classAliases[declaration.id];
|
|
@@ -97360,7 +97705,7 @@ function transformES2017(context) {
|
|
|
97360
97705
|
hasSuperElementAccess = false;
|
|
97361
97706
|
let updated = visitFunctionBody(node.body, visitor, context);
|
|
97362
97707
|
const originalMethod = getOriginalNode(node, isFunctionLikeDeclaration);
|
|
97363
|
-
const emitSuperHelpers = languageVersion >= 2 /* ES2015 */ && resolver.
|
|
97708
|
+
const emitSuperHelpers = languageVersion >= 2 /* ES2015 */ && (resolver.hasNodeCheckFlag(node, 256 /* MethodWithSuperPropertyAssignmentInAsync */) || resolver.hasNodeCheckFlag(node, 128 /* MethodWithSuperPropertyAccessInAsync */)) && (getFunctionFlags(originalMethod) & 3 /* AsyncGenerator */) !== 3 /* AsyncGenerator */;
|
|
97364
97709
|
if (emitSuperHelpers) {
|
|
97365
97710
|
enableSubstitutionForAsyncMethodsWithSuper();
|
|
97366
97711
|
if (capturedSuperProperties.size) {
|
|
@@ -97371,9 +97716,9 @@ function transformES2017(context) {
|
|
|
97371
97716
|
updated = factory2.updateBlock(updated, statements);
|
|
97372
97717
|
}
|
|
97373
97718
|
if (hasSuperElementAccess) {
|
|
97374
|
-
if (resolver.
|
|
97719
|
+
if (resolver.hasNodeCheckFlag(node, 256 /* MethodWithSuperPropertyAssignmentInAsync */)) {
|
|
97375
97720
|
addEmitHelper(updated, advancedAsyncSuperHelper);
|
|
97376
|
-
} else if (resolver.
|
|
97721
|
+
} else if (resolver.hasNodeCheckFlag(node, 128 /* MethodWithSuperPropertyAccessInAsync */)) {
|
|
97377
97722
|
addEmitHelper(updated, asyncSuperHelper);
|
|
97378
97723
|
}
|
|
97379
97724
|
}
|
|
@@ -97440,7 +97785,7 @@ function transformES2017(context) {
|
|
|
97440
97785
|
const promiseConstructor = languageVersion < 2 /* ES2015 */ ? getPromiseConstructor(nodeType) : void 0;
|
|
97441
97786
|
const isArrowFunction2 = node.kind === 219 /* ArrowFunction */;
|
|
97442
97787
|
const savedLexicalArgumentsBinding = lexicalArgumentsBinding;
|
|
97443
|
-
const hasLexicalArguments =
|
|
97788
|
+
const hasLexicalArguments = resolver.hasNodeCheckFlag(node, 512 /* CaptureArguments */);
|
|
97444
97789
|
const captureLexicalArguments = hasLexicalArguments && !lexicalArgumentsBinding;
|
|
97445
97790
|
if (captureLexicalArguments) {
|
|
97446
97791
|
lexicalArgumentsBinding = factory2.createUniqueName("arguments");
|
|
@@ -97495,7 +97840,7 @@ function transformES2017(context) {
|
|
|
97495
97840
|
)
|
|
97496
97841
|
)
|
|
97497
97842
|
);
|
|
97498
|
-
const emitSuperHelpers = languageVersion >= 2 /* ES2015 */ && resolver.
|
|
97843
|
+
const emitSuperHelpers = languageVersion >= 2 /* ES2015 */ && (resolver.hasNodeCheckFlag(node, 256 /* MethodWithSuperPropertyAssignmentInAsync */) || resolver.hasNodeCheckFlag(node, 128 /* MethodWithSuperPropertyAccessInAsync */));
|
|
97499
97844
|
if (emitSuperHelpers) {
|
|
97500
97845
|
enableSubstitutionForAsyncMethodsWithSuper();
|
|
97501
97846
|
if (capturedSuperProperties.size) {
|
|
@@ -97514,9 +97859,9 @@ function transformES2017(context) {
|
|
|
97514
97859
|
);
|
|
97515
97860
|
setTextRange(block, node.body);
|
|
97516
97861
|
if (emitSuperHelpers && hasSuperElementAccess) {
|
|
97517
|
-
if (resolver.
|
|
97862
|
+
if (resolver.hasNodeCheckFlag(node, 256 /* MethodWithSuperPropertyAssignmentInAsync */)) {
|
|
97518
97863
|
addEmitHelper(block, advancedAsyncSuperHelper);
|
|
97519
|
-
} else if (resolver.
|
|
97864
|
+
} else if (resolver.hasNodeCheckFlag(node, 128 /* MethodWithSuperPropertyAccessInAsync */)) {
|
|
97520
97865
|
addEmitHelper(block, asyncSuperHelper);
|
|
97521
97866
|
}
|
|
97522
97867
|
}
|
|
@@ -97575,7 +97920,7 @@ function transformES2017(context) {
|
|
|
97575
97920
|
}
|
|
97576
97921
|
function onEmitNode(hint, node, emitCallback) {
|
|
97577
97922
|
if (enabledSubstitutions & 1 /* AsyncMethodsWithSuper */ && isSuperContainer(node)) {
|
|
97578
|
-
const superContainerFlags = resolver.
|
|
97923
|
+
const superContainerFlags = (resolver.hasNodeCheckFlag(node, 128 /* MethodWithSuperPropertyAccessInAsync */) ? 128 /* MethodWithSuperPropertyAccessInAsync */ : 0) | (resolver.hasNodeCheckFlag(node, 256 /* MethodWithSuperPropertyAssignmentInAsync */) ? 256 /* MethodWithSuperPropertyAssignmentInAsync */ : 0);
|
|
97579
97924
|
if (superContainerFlags !== enclosingSuperContainerFlags) {
|
|
97580
97925
|
const savedEnclosingSuperContainerFlags = enclosingSuperContainerFlags;
|
|
97581
97926
|
enclosingSuperContainerFlags = superContainerFlags;
|
|
@@ -97679,7 +98024,7 @@ function transformES2017(context) {
|
|
|
97679
98024
|
}
|
|
97680
98025
|
}
|
|
97681
98026
|
function createSuperAccessVariableStatement(factory2, resolver, node, names) {
|
|
97682
|
-
const hasBinding =
|
|
98027
|
+
const hasBinding = resolver.hasNodeCheckFlag(node, 256 /* MethodWithSuperPropertyAssignmentInAsync */);
|
|
97683
98028
|
const accessors = [];
|
|
97684
98029
|
names.forEach((_, key) => {
|
|
97685
98030
|
const name = unescapeLeadingUnderscores(key);
|
|
@@ -98774,7 +99119,7 @@ function transformES2018(context) {
|
|
|
98774
99119
|
!!(hierarchyFacts & 1 /* HasLexicalThis */)
|
|
98775
99120
|
)
|
|
98776
99121
|
);
|
|
98777
|
-
const emitSuperHelpers = languageVersion >= 2 /* ES2015 */ && resolver.
|
|
99122
|
+
const emitSuperHelpers = languageVersion >= 2 /* ES2015 */ && (resolver.hasNodeCheckFlag(node, 256 /* MethodWithSuperPropertyAssignmentInAsync */) || resolver.hasNodeCheckFlag(node, 128 /* MethodWithSuperPropertyAccessInAsync */));
|
|
98778
99123
|
if (emitSuperHelpers) {
|
|
98779
99124
|
enableSubstitutionForAsyncMethodsWithSuper();
|
|
98780
99125
|
const variableStatement = createSuperAccessVariableStatement(factory2, resolver, node, capturedSuperProperties);
|
|
@@ -98784,9 +99129,9 @@ function transformES2018(context) {
|
|
|
98784
99129
|
outerStatements.push(returnStatement);
|
|
98785
99130
|
const block = factory2.updateBlock(node.body, outerStatements);
|
|
98786
99131
|
if (emitSuperHelpers && hasSuperElementAccess) {
|
|
98787
|
-
if (resolver.
|
|
99132
|
+
if (resolver.hasNodeCheckFlag(node, 256 /* MethodWithSuperPropertyAssignmentInAsync */)) {
|
|
98788
99133
|
addEmitHelper(block, advancedAsyncSuperHelper);
|
|
98789
|
-
} else if (resolver.
|
|
99134
|
+
} else if (resolver.hasNodeCheckFlag(node, 128 /* MethodWithSuperPropertyAccessInAsync */)) {
|
|
98790
99135
|
addEmitHelper(block, asyncSuperHelper);
|
|
98791
99136
|
}
|
|
98792
99137
|
}
|
|
@@ -98919,7 +99264,7 @@ function transformES2018(context) {
|
|
|
98919
99264
|
}
|
|
98920
99265
|
function onEmitNode(hint, node, emitCallback) {
|
|
98921
99266
|
if (enabledSubstitutions & 1 /* AsyncMethodsWithSuper */ && isSuperContainer(node)) {
|
|
98922
|
-
const superContainerFlags = resolver.
|
|
99267
|
+
const superContainerFlags = (resolver.hasNodeCheckFlag(node, 128 /* MethodWithSuperPropertyAccessInAsync */) ? 128 /* MethodWithSuperPropertyAccessInAsync */ : 0) | (resolver.hasNodeCheckFlag(node, 256 /* MethodWithSuperPropertyAssignmentInAsync */) ? 256 /* MethodWithSuperPropertyAssignmentInAsync */ : 0);
|
|
98923
99268
|
if (superContainerFlags !== enclosingSuperContainerFlags) {
|
|
98924
99269
|
const savedEnclosingSuperContainerFlags = enclosingSuperContainerFlags;
|
|
98925
99270
|
enclosingSuperContainerFlags = superContainerFlags;
|
|
@@ -99550,10 +99895,10 @@ function transformESNext(context) {
|
|
|
99550
99895
|
function visitForOfStatement(node) {
|
|
99551
99896
|
if (isUsingVariableDeclarationList(node.initializer)) {
|
|
99552
99897
|
const forInitializer = node.initializer;
|
|
99553
|
-
|
|
99554
|
-
|
|
99555
|
-
|
|
99556
|
-
|
|
99898
|
+
const forDecl = firstOrUndefined(forInitializer.declarations) || factory2.createVariableDeclaration(factory2.createTempVariable(
|
|
99899
|
+
/*recordTempVariable*/
|
|
99900
|
+
void 0
|
|
99901
|
+
));
|
|
99557
99902
|
const isAwaitUsing = getUsingKindOfVariableDeclarationList(forInitializer) === 2 /* Async */;
|
|
99558
99903
|
const temp = factory2.getGeneratedNameForNode(forDecl.name);
|
|
99559
99904
|
const usingVar = factory2.updateVariableDeclaration(
|
|
@@ -102624,9 +102969,8 @@ function transformES2015(context) {
|
|
|
102624
102969
|
return createRange(pos, end);
|
|
102625
102970
|
}
|
|
102626
102971
|
function shouldEmitExplicitInitializerForLetDeclaration(node) {
|
|
102627
|
-
const
|
|
102628
|
-
const
|
|
102629
|
-
const isDeclaredInLoop = flags & 32768 /* BlockScopedBindingInLoop */;
|
|
102972
|
+
const isCapturedInFunction = resolver.hasNodeCheckFlag(node, 16384 /* CapturedBlockScopedBinding */);
|
|
102973
|
+
const isDeclaredInLoop = resolver.hasNodeCheckFlag(node, 32768 /* BlockScopedBindingInLoop */);
|
|
102630
102974
|
const emittedAsTopLevel = (hierarchyFacts & 64 /* TopLevel */) !== 0 || isCapturedInFunction && isDeclaredInLoop && (hierarchyFacts & 512 /* IterationStatementBlock */) !== 0;
|
|
102631
102975
|
const emitExplicitInitializer = !emittedAsTopLevel && (hierarchyFacts & 4096 /* ForInOrForOfStatement */) === 0 && (!resolver.isDeclarationWithCollidingName(node) || isDeclaredInLoop && !isCapturedInFunction && (hierarchyFacts & (2048 /* ForStatement */ | 4096 /* ForInOrForOfStatement */)) === 0);
|
|
102632
102976
|
return emitExplicitInitializer;
|
|
@@ -103077,7 +103421,7 @@ function transformES2015(context) {
|
|
|
103077
103421
|
return factory2.inlineExpressions(expressions);
|
|
103078
103422
|
}
|
|
103079
103423
|
function shouldConvertPartOfIterationStatement(node) {
|
|
103080
|
-
return
|
|
103424
|
+
return resolver.hasNodeCheckFlag(node, 8192 /* ContainsCapturedBlockScopeBinding */);
|
|
103081
103425
|
}
|
|
103082
103426
|
function shouldConvertInitializerOfForStatement(node) {
|
|
103083
103427
|
return isForStatement(node) && !!node.initializer && shouldConvertPartOfIterationStatement(node.initializer);
|
|
@@ -103092,7 +103436,7 @@ function transformES2015(context) {
|
|
|
103092
103436
|
return shouldConvertBodyOfIterationStatement(node) || shouldConvertInitializerOfForStatement(node);
|
|
103093
103437
|
}
|
|
103094
103438
|
function shouldConvertBodyOfIterationStatement(node) {
|
|
103095
|
-
return
|
|
103439
|
+
return resolver.hasNodeCheckFlag(node, 4096 /* LoopWithCapturedBlockScopedBinding */);
|
|
103096
103440
|
}
|
|
103097
103441
|
function hoistVariableDeclarationDeclaredInConvertedLoop(state, node) {
|
|
103098
103442
|
if (!state.hoistedLocalVariables) {
|
|
@@ -103641,11 +103985,11 @@ function transformES2015(context) {
|
|
|
103641
103985
|
void 0,
|
|
103642
103986
|
name
|
|
103643
103987
|
));
|
|
103644
|
-
const
|
|
103645
|
-
if (
|
|
103988
|
+
const needsOutParam = resolver.hasNodeCheckFlag(decl, 65536 /* NeedsLoopOutParameter */);
|
|
103989
|
+
if (needsOutParam || hasCapturedBindingsInForHead) {
|
|
103646
103990
|
const outParamName = factory2.createUniqueName("out_" + idText(name));
|
|
103647
103991
|
let flags = 0 /* None */;
|
|
103648
|
-
if (
|
|
103992
|
+
if (needsOutParam) {
|
|
103649
103993
|
flags |= 1 /* Body */;
|
|
103650
103994
|
}
|
|
103651
103995
|
if (isForStatement(container)) {
|
|
@@ -106351,10 +106695,8 @@ function transformModule(context) {
|
|
|
106351
106695
|
);
|
|
106352
106696
|
}
|
|
106353
106697
|
}
|
|
106354
|
-
|
|
106355
|
-
|
|
106356
|
-
appendExportsOfHoistedDeclaration(statements, f);
|
|
106357
|
-
}
|
|
106698
|
+
for (const f of currentModuleInfo.exportedFunctions) {
|
|
106699
|
+
appendExportsOfHoistedDeclaration(statements, f);
|
|
106358
106700
|
}
|
|
106359
106701
|
append(statements, visitNode(currentModuleInfo.externalHelpersImportDeclaration, topLevelVisitor, isStatement));
|
|
106360
106702
|
addRange(statements, visitNodes2(node.statements, topLevelVisitor, isStatement, statementOffset));
|
|
@@ -106671,10 +107013,8 @@ function transformModule(context) {
|
|
|
106671
107013
|
if (some(currentModuleInfo.exportedNames)) {
|
|
106672
107014
|
append(statements, factory2.createExpressionStatement(reduceLeft(currentModuleInfo.exportedNames, (prev, nextId) => factory2.createAssignment(factory2.createPropertyAccessExpression(factory2.createIdentifier("exports"), factory2.createIdentifier(idText(nextId))), prev), factory2.createVoidZero())));
|
|
106673
107015
|
}
|
|
106674
|
-
|
|
106675
|
-
|
|
106676
|
-
appendExportsOfHoistedDeclaration(statements, f);
|
|
106677
|
-
}
|
|
107016
|
+
for (const f of currentModuleInfo.exportedFunctions) {
|
|
107017
|
+
appendExportsOfHoistedDeclaration(statements, f);
|
|
106678
107018
|
}
|
|
106679
107019
|
append(statements, visitNode(currentModuleInfo.externalHelpersImportDeclaration, topLevelVisitor, isStatement));
|
|
106680
107020
|
if (moduleKind === 2 /* AMD */) {
|
|
@@ -108388,7 +108728,7 @@ function transformSystemModule(context) {
|
|
|
108388
108728
|
if (!moduleInfo.hasExportStarsToExportValues) {
|
|
108389
108729
|
return;
|
|
108390
108730
|
}
|
|
108391
|
-
if (!some(moduleInfo.exportedNames) &&
|
|
108731
|
+
if (!some(moduleInfo.exportedNames) && moduleInfo.exportedFunctions.size === 0 && moduleInfo.exportSpecifiers.size === 0) {
|
|
108392
108732
|
let hasExportDeclarationWithExportClause = false;
|
|
108393
108733
|
for (const externalImport of moduleInfo.externalImports) {
|
|
108394
108734
|
if (externalImport.kind === 278 /* ExportDeclaration */ && externalImport.exportClause) {
|
|
@@ -108419,19 +108759,17 @@ function transformSystemModule(context) {
|
|
|
108419
108759
|
);
|
|
108420
108760
|
}
|
|
108421
108761
|
}
|
|
108422
|
-
|
|
108423
|
-
|
|
108424
|
-
|
|
108425
|
-
continue;
|
|
108426
|
-
}
|
|
108427
|
-
Debug.assert(!!f.name);
|
|
108428
|
-
exportedNames.push(
|
|
108429
|
-
factory2.createPropertyAssignment(
|
|
108430
|
-
factory2.createStringLiteralFromNode(f.name),
|
|
108431
|
-
factory2.createTrue()
|
|
108432
|
-
)
|
|
108433
|
-
);
|
|
108762
|
+
for (const f of moduleInfo.exportedFunctions) {
|
|
108763
|
+
if (hasSyntacticModifier(f, 2048 /* Default */)) {
|
|
108764
|
+
continue;
|
|
108434
108765
|
}
|
|
108766
|
+
Debug.assert(!!f.name);
|
|
108767
|
+
exportedNames.push(
|
|
108768
|
+
factory2.createPropertyAssignment(
|
|
108769
|
+
factory2.createStringLiteralFromNode(f.name),
|
|
108770
|
+
factory2.createTrue()
|
|
108771
|
+
)
|
|
108772
|
+
);
|
|
108435
108773
|
}
|
|
108436
108774
|
const exportedNamesStorageRef = factory2.createUniqueName("exportedNames");
|
|
108437
108775
|
statements.push(
|
|
@@ -112674,6 +113012,9 @@ function emitFiles(resolver, host, targetSourceFile, { scriptTransformers, decla
|
|
|
112674
113012
|
emitSkipped = true;
|
|
112675
113013
|
return;
|
|
112676
113014
|
}
|
|
113015
|
+
if (compilerOptions.noCheck) {
|
|
113016
|
+
(isSourceFile(sourceFileOrBundle) ? [sourceFileOrBundle] : filter(sourceFileOrBundle.sourceFiles, isSourceFileNotJson)).forEach(markLinkedReferences);
|
|
113017
|
+
}
|
|
112677
113018
|
const transform = transformNodes(
|
|
112678
113019
|
resolver,
|
|
112679
113020
|
host,
|
|
@@ -112808,6 +113149,13 @@ function emitFiles(resolver, host, targetSourceFile, { scriptTransformers, decla
|
|
|
112808
113149
|
}
|
|
112809
113150
|
forEachChild(node, collectLinkedAliases);
|
|
112810
113151
|
}
|
|
113152
|
+
function markLinkedReferences(file) {
|
|
113153
|
+
forEachChildRecursively(file, (n) => {
|
|
113154
|
+
if (isImportEqualsDeclaration(n) && !(getSyntacticModifierFlags(n) & 32 /* Export */)) return "skip";
|
|
113155
|
+
if (isImportDeclaration(n)) return "skip";
|
|
113156
|
+
resolver.markLinkedReferences(n);
|
|
113157
|
+
});
|
|
113158
|
+
}
|
|
112811
113159
|
function printSourceFileOrBundle(jsFilePath, sourceMapFilePath, transform, printer, mapOptions) {
|
|
112812
113160
|
const sourceFileOrBundle = transform.transformed[0];
|
|
112813
113161
|
const bundle = sourceFileOrBundle.kind === 308 /* Bundle */ ? sourceFileOrBundle : void 0;
|
|
@@ -112939,10 +113287,11 @@ var notImplementedResolver = {
|
|
|
112939
113287
|
isValueAliasDeclaration: notImplemented,
|
|
112940
113288
|
isReferencedAliasDeclaration: notImplemented,
|
|
112941
113289
|
isTopLevelValueImportEqualsWithEntityName: notImplemented,
|
|
112942
|
-
|
|
113290
|
+
hasNodeCheckFlag: notImplemented,
|
|
112943
113291
|
isDeclarationVisible: notImplemented,
|
|
112944
113292
|
isLateBound: (_node) => false,
|
|
112945
113293
|
collectLinkedAliases: notImplemented,
|
|
113294
|
+
markLinkedReferences: notImplemented,
|
|
112946
113295
|
isImplementationOfOverload: notImplemented,
|
|
112947
113296
|
requiresAddingImplicitUndefined: notImplemented,
|
|
112948
113297
|
isExpandoFunctionDeclaration: notImplemented,
|
|
@@ -119702,24 +120051,15 @@ function createProgram(rootNamesOrOptions, _options, _host, _oldProgram, _config
|
|
|
119702
120051
|
function getSyntacticDiagnostics(sourceFile, cancellationToken) {
|
|
119703
120052
|
return getDiagnosticsHelper(sourceFile, getSyntacticDiagnosticsForFile, cancellationToken);
|
|
119704
120053
|
}
|
|
119705
|
-
function getSemanticDiagnostics(sourceFile, cancellationToken
|
|
119706
|
-
return getDiagnosticsHelper(
|
|
119707
|
-
sourceFile,
|
|
119708
|
-
(sourceFile2, cancellationToken2) => getSemanticDiagnosticsForFile(sourceFile2, cancellationToken2, nodesToCheck),
|
|
119709
|
-
cancellationToken
|
|
119710
|
-
);
|
|
120054
|
+
function getSemanticDiagnostics(sourceFile, cancellationToken) {
|
|
120055
|
+
return getDiagnosticsHelper(sourceFile, getSemanticDiagnosticsForFile, cancellationToken);
|
|
119711
120056
|
}
|
|
119712
120057
|
function getCachedSemanticDiagnostics(sourceFile) {
|
|
119713
120058
|
var _a2;
|
|
119714
120059
|
return sourceFile ? (_a2 = cachedBindAndCheckDiagnosticsForFile.perFile) == null ? void 0 : _a2.get(sourceFile.path) : cachedBindAndCheckDiagnosticsForFile.allDiagnostics;
|
|
119715
120060
|
}
|
|
119716
120061
|
function getBindAndCheckDiagnostics(sourceFile, cancellationToken) {
|
|
119717
|
-
return getBindAndCheckDiagnosticsForFile(
|
|
119718
|
-
sourceFile,
|
|
119719
|
-
cancellationToken,
|
|
119720
|
-
/*nodesToCheck*/
|
|
119721
|
-
void 0
|
|
119722
|
-
);
|
|
120062
|
+
return getBindAndCheckDiagnosticsForFile(sourceFile, cancellationToken);
|
|
119723
120063
|
}
|
|
119724
120064
|
function getProgramDiagnostics(sourceFile) {
|
|
119725
120065
|
var _a2;
|
|
@@ -119759,19 +120099,16 @@ function createProgram(rootNamesOrOptions, _options, _host, _oldProgram, _config
|
|
|
119759
120099
|
throw e;
|
|
119760
120100
|
}
|
|
119761
120101
|
}
|
|
119762
|
-
function getSemanticDiagnosticsForFile(sourceFile, cancellationToken
|
|
120102
|
+
function getSemanticDiagnosticsForFile(sourceFile, cancellationToken) {
|
|
119763
120103
|
return concatenate(
|
|
119764
|
-
filterSemanticDiagnostics(getBindAndCheckDiagnosticsForFile(sourceFile, cancellationToken
|
|
120104
|
+
filterSemanticDiagnostics(getBindAndCheckDiagnosticsForFile(sourceFile, cancellationToken), options),
|
|
119765
120105
|
getProgramDiagnostics(sourceFile)
|
|
119766
120106
|
);
|
|
119767
120107
|
}
|
|
119768
|
-
function getBindAndCheckDiagnosticsForFile(sourceFile, cancellationToken
|
|
119769
|
-
if (nodesToCheck) {
|
|
119770
|
-
return getBindAndCheckDiagnosticsForFileNoCache(sourceFile, cancellationToken, nodesToCheck);
|
|
119771
|
-
}
|
|
120108
|
+
function getBindAndCheckDiagnosticsForFile(sourceFile, cancellationToken) {
|
|
119772
120109
|
return getAndCacheDiagnostics(sourceFile, cancellationToken, cachedBindAndCheckDiagnosticsForFile, getBindAndCheckDiagnosticsForFileNoCache);
|
|
119773
120110
|
}
|
|
119774
|
-
function getBindAndCheckDiagnosticsForFileNoCache(sourceFile, cancellationToken
|
|
120111
|
+
function getBindAndCheckDiagnosticsForFileNoCache(sourceFile, cancellationToken) {
|
|
119775
120112
|
return runWithCancellationToken(() => {
|
|
119776
120113
|
if (skipTypeChecking(sourceFile, options, program)) {
|
|
119777
120114
|
return emptyArray;
|
|
@@ -119779,35 +120116,26 @@ function createProgram(rootNamesOrOptions, _options, _host, _oldProgram, _config
|
|
|
119779
120116
|
const typeChecker2 = getTypeChecker();
|
|
119780
120117
|
Debug.assert(!!sourceFile.bindDiagnostics);
|
|
119781
120118
|
const isJs = sourceFile.scriptKind === 1 /* JS */ || sourceFile.scriptKind === 2 /* JSX */;
|
|
119782
|
-
const isPlainJs = isPlainJsFile(sourceFile, options.checkJs);
|
|
119783
120119
|
const isCheckJs = isJs && isCheckJsEnabledForFile(sourceFile, options);
|
|
119784
|
-
const
|
|
120120
|
+
const isPlainJs = isPlainJsFile(sourceFile, options.checkJs);
|
|
120121
|
+
const isTsNoCheck = !!sourceFile.checkJsDirective && sourceFile.checkJsDirective.enabled === false;
|
|
120122
|
+
const includeBindAndCheckDiagnostics = !isTsNoCheck && (sourceFile.scriptKind === 3 /* TS */ || sourceFile.scriptKind === 4 /* TSX */ || sourceFile.scriptKind === 5 /* External */ || isPlainJs || isCheckJs || sourceFile.scriptKind === 7 /* Deferred */);
|
|
119785
120123
|
let bindDiagnostics = includeBindAndCheckDiagnostics ? sourceFile.bindDiagnostics : emptyArray;
|
|
119786
|
-
let checkDiagnostics = includeBindAndCheckDiagnostics ? typeChecker2.getDiagnostics(sourceFile, cancellationToken
|
|
120124
|
+
let checkDiagnostics = includeBindAndCheckDiagnostics ? typeChecker2.getDiagnostics(sourceFile, cancellationToken) : emptyArray;
|
|
119787
120125
|
if (isPlainJs) {
|
|
119788
120126
|
bindDiagnostics = filter(bindDiagnostics, (d) => plainJSErrors.has(d.code));
|
|
119789
120127
|
checkDiagnostics = filter(checkDiagnostics, (d) => plainJSErrors.has(d.code));
|
|
119790
120128
|
}
|
|
119791
|
-
return getMergedBindAndCheckDiagnostics(
|
|
119792
|
-
sourceFile,
|
|
119793
|
-
includeBindAndCheckDiagnostics && !isPlainJs,
|
|
119794
|
-
!!nodesToCheck,
|
|
119795
|
-
bindDiagnostics,
|
|
119796
|
-
checkDiagnostics,
|
|
119797
|
-
isCheckJs ? sourceFile.jsDocDiagnostics : void 0
|
|
119798
|
-
);
|
|
120129
|
+
return getMergedBindAndCheckDiagnostics(sourceFile, includeBindAndCheckDiagnostics && !isPlainJs, bindDiagnostics, checkDiagnostics, isCheckJs ? sourceFile.jsDocDiagnostics : void 0);
|
|
119799
120130
|
});
|
|
119800
120131
|
}
|
|
119801
|
-
function getMergedBindAndCheckDiagnostics(sourceFile, includeBindAndCheckDiagnostics,
|
|
120132
|
+
function getMergedBindAndCheckDiagnostics(sourceFile, includeBindAndCheckDiagnostics, ...allDiagnostics) {
|
|
119802
120133
|
var _a2;
|
|
119803
120134
|
const flatDiagnostics = flatten(allDiagnostics);
|
|
119804
120135
|
if (!includeBindAndCheckDiagnostics || !((_a2 = sourceFile.commentDirectives) == null ? void 0 : _a2.length)) {
|
|
119805
120136
|
return flatDiagnostics;
|
|
119806
120137
|
}
|
|
119807
120138
|
const { diagnostics, directives } = getDiagnosticsWithPrecedingDirectives(sourceFile, sourceFile.commentDirectives, flatDiagnostics);
|
|
119808
|
-
if (partialCheck) {
|
|
119809
|
-
return diagnostics;
|
|
119810
|
-
}
|
|
119811
120139
|
for (const errorExpectation of directives.getUnusedExpectations()) {
|
|
119812
120140
|
diagnostics.push(createDiagnosticForRange(sourceFile, errorExpectation.range, Diagnostics.Unused_ts_expect_error_directive));
|
|
119813
120141
|
}
|
|
@@ -121053,9 +121381,6 @@ function createProgram(rootNamesOrOptions, _options, _host, _oldProgram, _config
|
|
|
121053
121381
|
if (options.noEmit) {
|
|
121054
121382
|
createDiagnosticForOptionName(Diagnostics.Option_0_cannot_be_specified_with_option_1, "noCheck", "noEmit");
|
|
121055
121383
|
}
|
|
121056
|
-
if (!options.emitDeclarationOnly) {
|
|
121057
|
-
createDiagnosticForOptionName(Diagnostics.Option_0_cannot_be_specified_without_specifying_option_1, "noCheck", "emitDeclarationOnly");
|
|
121058
|
-
}
|
|
121059
121384
|
}
|
|
121060
121385
|
if (options.emitDecoratorMetadata && !options.experimentalDecorators) {
|
|
121061
121386
|
createDiagnosticForOptionName(Diagnostics.Option_0_cannot_be_specified_without_specifying_option_1, "emitDecoratorMetadata", "experimentalDecorators");
|