typescript 5.5.0-dev.20240529 → 5.5.0-dev.20240531
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 +456 -125
- package/lib/typescript.js +464 -154
- package/package.json +11 -11
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-dev.
|
|
21
|
+
var version = `${versionMajorMinor}.0-dev.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,10 @@ 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."),
|
|
6096
6135
|
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
6136
|
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
6137
|
Call_signature_return_types_0_and_1_are_incompatible: diag(
|
|
@@ -8812,12 +8851,7 @@ function createScanner(languageVersion, skipTrivia2, languageVariant = 0 /* Stan
|
|
|
8812
8851
|
}
|
|
8813
8852
|
if (ch === 92 /* backslash */ && !jsxAttributeString) {
|
|
8814
8853
|
result += text.substring(start2, pos);
|
|
8815
|
-
result += scanEscapeSequence(
|
|
8816
|
-
/*shouldEmitInvalidEscapeError*/
|
|
8817
|
-
true,
|
|
8818
|
-
/*isRegularExpression*/
|
|
8819
|
-
false
|
|
8820
|
-
);
|
|
8854
|
+
result += scanEscapeSequence(1 /* String */ | 2 /* ReportErrors */);
|
|
8821
8855
|
start2 = pos;
|
|
8822
8856
|
continue;
|
|
8823
8857
|
}
|
|
@@ -8860,11 +8894,7 @@ function createScanner(languageVersion, skipTrivia2, languageVariant = 0 /* Stan
|
|
|
8860
8894
|
}
|
|
8861
8895
|
if (currChar === 92 /* backslash */) {
|
|
8862
8896
|
contents += text.substring(start2, pos);
|
|
8863
|
-
contents += scanEscapeSequence(
|
|
8864
|
-
shouldEmitInvalidEscapeError,
|
|
8865
|
-
/*isRegularExpression*/
|
|
8866
|
-
false
|
|
8867
|
-
);
|
|
8897
|
+
contents += scanEscapeSequence(1 /* String */ | (shouldEmitInvalidEscapeError ? 2 /* ReportErrors */ : 0));
|
|
8868
8898
|
start2 = pos;
|
|
8869
8899
|
continue;
|
|
8870
8900
|
}
|
|
@@ -8884,7 +8914,7 @@ function createScanner(languageVersion, skipTrivia2, languageVariant = 0 /* Stan
|
|
|
8884
8914
|
tokenValue = contents;
|
|
8885
8915
|
return resultingToken;
|
|
8886
8916
|
}
|
|
8887
|
-
function scanEscapeSequence(
|
|
8917
|
+
function scanEscapeSequence(flags) {
|
|
8888
8918
|
const start2 = pos;
|
|
8889
8919
|
pos++;
|
|
8890
8920
|
if (pos >= end) {
|
|
@@ -8912,9 +8942,11 @@ function createScanner(languageVersion, skipTrivia2, languageVariant = 0 /* Stan
|
|
|
8912
8942
|
pos++;
|
|
8913
8943
|
}
|
|
8914
8944
|
tokenFlags |= 2048 /* ContainsInvalidEscape */;
|
|
8915
|
-
if (
|
|
8945
|
+
if (flags & 6 /* ReportInvalidEscapeErrors */) {
|
|
8916
8946
|
const code = parseInt(text.substring(start2 + 1, pos), 8);
|
|
8917
|
-
if (
|
|
8947
|
+
if (flags & 4 /* RegularExpression */ && !(flags & 32 /* AtomEscape */) && ch !== 48 /* _0 */) {
|
|
8948
|
+
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"));
|
|
8949
|
+
} else {
|
|
8918
8950
|
error(Diagnostics.Octal_escape_sequences_are_not_allowed_Use_the_syntax_0, start2, pos - start2, "\\x" + code.toString(16).padStart(2, "0"));
|
|
8919
8951
|
}
|
|
8920
8952
|
return String.fromCharCode(code);
|
|
@@ -8923,8 +8955,12 @@ function createScanner(languageVersion, skipTrivia2, languageVariant = 0 /* Stan
|
|
|
8923
8955
|
case 56 /* _8 */:
|
|
8924
8956
|
case 57 /* _9 */:
|
|
8925
8957
|
tokenFlags |= 2048 /* ContainsInvalidEscape */;
|
|
8926
|
-
if (
|
|
8927
|
-
|
|
8958
|
+
if (flags & 6 /* ReportInvalidEscapeErrors */) {
|
|
8959
|
+
if (flags & 4 /* RegularExpression */ && !(flags & 32 /* AtomEscape */)) {
|
|
8960
|
+
error(Diagnostics.Decimal_escape_sequences_and_backreferences_are_not_allowed_in_a_character_class, start2, pos - start2);
|
|
8961
|
+
} else {
|
|
8962
|
+
error(Diagnostics.Escape_sequence_0_is_not_allowed, start2, pos - start2, text.substring(start2, pos));
|
|
8963
|
+
}
|
|
8928
8964
|
return String.fromCharCode(ch);
|
|
8929
8965
|
}
|
|
8930
8966
|
return text.substring(start2, pos);
|
|
@@ -8945,14 +8981,14 @@ function createScanner(languageVersion, skipTrivia2, languageVariant = 0 /* Stan
|
|
|
8945
8981
|
case 34 /* doubleQuote */:
|
|
8946
8982
|
return '"';
|
|
8947
8983
|
case 117 /* u */:
|
|
8948
|
-
if (
|
|
8984
|
+
if (flags & 17 /* ScanExtendedUnicodeEscape */ && pos < end && charCodeUnchecked(pos) === 123 /* openBrace */) {
|
|
8949
8985
|
pos -= 2;
|
|
8950
|
-
return scanExtendedUnicodeEscape(!!
|
|
8986
|
+
return scanExtendedUnicodeEscape(!!(flags & 6 /* ReportInvalidEscapeErrors */));
|
|
8951
8987
|
}
|
|
8952
8988
|
for (; pos < start2 + 6; pos++) {
|
|
8953
8989
|
if (!(pos < end && isHexDigit(charCodeUnchecked(pos)))) {
|
|
8954
8990
|
tokenFlags |= 2048 /* ContainsInvalidEscape */;
|
|
8955
|
-
if (
|
|
8991
|
+
if (flags & 6 /* ReportInvalidEscapeErrors */) {
|
|
8956
8992
|
error(Diagnostics.Hexadecimal_digit_expected);
|
|
8957
8993
|
}
|
|
8958
8994
|
return text.substring(start2, pos);
|
|
@@ -8961,7 +8997,7 @@ function createScanner(languageVersion, skipTrivia2, languageVariant = 0 /* Stan
|
|
|
8961
8997
|
tokenFlags |= 1024 /* UnicodeEscape */;
|
|
8962
8998
|
const escapedValue = parseInt(text.substring(start2 + 2, pos), 16);
|
|
8963
8999
|
const escapedValueString = String.fromCharCode(escapedValue);
|
|
8964
|
-
if (
|
|
9000
|
+
if (flags & 16 /* AnyUnicodeMode */ && escapedValue >= 55296 && escapedValue <= 56319 && pos + 6 < end && text.substring(pos, pos + 2) === "\\u" && charCodeUnchecked(pos + 2) !== 123 /* openBrace */) {
|
|
8965
9001
|
const nextStart = pos;
|
|
8966
9002
|
let nextPos = pos + 2;
|
|
8967
9003
|
for (; nextPos < nextStart + 6; nextPos++) {
|
|
@@ -8980,7 +9016,7 @@ function createScanner(languageVersion, skipTrivia2, languageVariant = 0 /* Stan
|
|
|
8980
9016
|
for (; pos < start2 + 4; pos++) {
|
|
8981
9017
|
if (!(pos < end && isHexDigit(charCodeUnchecked(pos)))) {
|
|
8982
9018
|
tokenFlags |= 2048 /* ContainsInvalidEscape */;
|
|
8983
|
-
if (
|
|
9019
|
+
if (flags & 6 /* ReportInvalidEscapeErrors */) {
|
|
8984
9020
|
error(Diagnostics.Hexadecimal_digit_expected);
|
|
8985
9021
|
}
|
|
8986
9022
|
return text.substring(start2, pos);
|
|
@@ -8997,7 +9033,7 @@ function createScanner(languageVersion, skipTrivia2, languageVariant = 0 /* Stan
|
|
|
8997
9033
|
case 8233 /* paragraphSeparator */:
|
|
8998
9034
|
return "";
|
|
8999
9035
|
default:
|
|
9000
|
-
if (
|
|
9036
|
+
if (flags & 16 /* AnyUnicodeMode */ || flags & 4 /* RegularExpression */ && !(flags & 8 /* AnnexB */) && isIdentifierPart(ch, languageVersion)) {
|
|
9001
9037
|
error(Diagnostics.This_character_cannot_be_escaped_in_a_regular_expression, pos - 2, 2);
|
|
9002
9038
|
}
|
|
9003
9039
|
return String.fromCharCode(ch);
|
|
@@ -9696,6 +9732,7 @@ function createScanner(languageVersion, skipTrivia2, languageVariant = 0 /* Stan
|
|
|
9696
9732
|
const startOfRegExpBody = tokenStart + 1;
|
|
9697
9733
|
pos = startOfRegExpBody;
|
|
9698
9734
|
let inEscape = false;
|
|
9735
|
+
let namedCaptureGroups = false;
|
|
9699
9736
|
let inCharacterClass = false;
|
|
9700
9737
|
while (true) {
|
|
9701
9738
|
const ch = charCodeChecked(pos);
|
|
@@ -9713,6 +9750,8 @@ function createScanner(languageVersion, skipTrivia2, languageVariant = 0 /* Stan
|
|
|
9713
9750
|
inEscape = true;
|
|
9714
9751
|
} else if (ch === 93 /* closeBracket */) {
|
|
9715
9752
|
inCharacterClass = false;
|
|
9753
|
+
} 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 */) {
|
|
9754
|
+
namedCaptureGroups = true;
|
|
9716
9755
|
}
|
|
9717
9756
|
pos++;
|
|
9718
9757
|
}
|
|
@@ -9780,7 +9819,8 @@ function createScanner(languageVersion, skipTrivia2, languageVariant = 0 /* Stan
|
|
|
9780
9819
|
scanRegularExpressionWorker(
|
|
9781
9820
|
regExpFlags,
|
|
9782
9821
|
/*annexB*/
|
|
9783
|
-
true
|
|
9822
|
+
true,
|
|
9823
|
+
namedCaptureGroups
|
|
9784
9824
|
);
|
|
9785
9825
|
});
|
|
9786
9826
|
}
|
|
@@ -9790,12 +9830,10 @@ function createScanner(languageVersion, skipTrivia2, languageVariant = 0 /* Stan
|
|
|
9790
9830
|
}
|
|
9791
9831
|
return token;
|
|
9792
9832
|
}
|
|
9793
|
-
function scanRegularExpressionWorker(regExpFlags, annexB) {
|
|
9833
|
+
function scanRegularExpressionWorker(regExpFlags, annexB, namedCaptureGroups) {
|
|
9794
9834
|
var unicodeSetsMode = !!(regExpFlags & 64 /* UnicodeSets */);
|
|
9795
9835
|
var anyUnicodeMode = !!(regExpFlags & 96 /* AnyUnicodeMode */);
|
|
9796
|
-
|
|
9797
|
-
annexB = false;
|
|
9798
|
-
}
|
|
9836
|
+
var anyUnicodeModeOrNonAnnexB = anyUnicodeMode || !annexB;
|
|
9799
9837
|
var mayContainStrings = false;
|
|
9800
9838
|
var numberOfCapturingGroups = 0;
|
|
9801
9839
|
var groupSpecifiers;
|
|
@@ -9850,7 +9888,7 @@ function createScanner(languageVersion, skipTrivia2, languageVariant = 0 /* Stan
|
|
|
9850
9888
|
case 61 /* equals */:
|
|
9851
9889
|
case 33 /* exclamation */:
|
|
9852
9890
|
pos++;
|
|
9853
|
-
isPreviousTermQuantifiable =
|
|
9891
|
+
isPreviousTermQuantifiable = !anyUnicodeModeOrNonAnnexB;
|
|
9854
9892
|
break;
|
|
9855
9893
|
case 60 /* lessThan */:
|
|
9856
9894
|
const groupNameStart = pos;
|
|
@@ -9904,6 +9942,10 @@ function createScanner(languageVersion, skipTrivia2, languageVariant = 0 /* Stan
|
|
|
9904
9942
|
const digitsStart = pos;
|
|
9905
9943
|
scanDigits();
|
|
9906
9944
|
const min2 = tokenValue;
|
|
9945
|
+
if (!anyUnicodeModeOrNonAnnexB && !min2) {
|
|
9946
|
+
isPreviousTermQuantifiable = true;
|
|
9947
|
+
break;
|
|
9948
|
+
}
|
|
9907
9949
|
if (charCodeChecked(pos) === 44 /* comma */) {
|
|
9908
9950
|
pos++;
|
|
9909
9951
|
scanDigits();
|
|
@@ -9912,25 +9954,29 @@ function createScanner(languageVersion, skipTrivia2, languageVariant = 0 /* Stan
|
|
|
9912
9954
|
if (max || charCodeChecked(pos) === 125 /* closeBrace */) {
|
|
9913
9955
|
error(Diagnostics.Incomplete_quantifier_Digit_expected, digitsStart, 0);
|
|
9914
9956
|
} else {
|
|
9915
|
-
|
|
9916
|
-
error(Diagnostics.Unexpected_0_Did_you_mean_to_escape_it_with_backslash, start2, 1, String.fromCharCode(ch));
|
|
9917
|
-
}
|
|
9957
|
+
error(Diagnostics.Unexpected_0_Did_you_mean_to_escape_it_with_backslash, start2, 1, String.fromCharCode(ch));
|
|
9918
9958
|
isPreviousTermQuantifiable = true;
|
|
9919
9959
|
break;
|
|
9920
9960
|
}
|
|
9921
|
-
}
|
|
9922
|
-
if (max && Number.parseInt(min2) > Number.parseInt(max)) {
|
|
9961
|
+
} else if (max && Number.parseInt(min2) > Number.parseInt(max) && (anyUnicodeModeOrNonAnnexB || charCodeChecked(pos) === 125 /* closeBrace */)) {
|
|
9923
9962
|
error(Diagnostics.Numbers_out_of_order_in_quantifier, digitsStart, pos - digitsStart);
|
|
9924
9963
|
}
|
|
9925
9964
|
} else if (!min2) {
|
|
9926
|
-
if (
|
|
9965
|
+
if (anyUnicodeModeOrNonAnnexB) {
|
|
9927
9966
|
error(Diagnostics.Unexpected_0_Did_you_mean_to_escape_it_with_backslash, start2, 1, String.fromCharCode(ch));
|
|
9928
9967
|
}
|
|
9929
9968
|
isPreviousTermQuantifiable = true;
|
|
9930
9969
|
break;
|
|
9931
9970
|
}
|
|
9932
|
-
|
|
9933
|
-
|
|
9971
|
+
if (charCodeChecked(pos) !== 125 /* closeBrace */) {
|
|
9972
|
+
if (anyUnicodeModeOrNonAnnexB) {
|
|
9973
|
+
error(Diagnostics._0_expected, pos, 0, String.fromCharCode(125 /* closeBrace */));
|
|
9974
|
+
pos--;
|
|
9975
|
+
} else {
|
|
9976
|
+
isPreviousTermQuantifiable = true;
|
|
9977
|
+
break;
|
|
9978
|
+
}
|
|
9979
|
+
}
|
|
9934
9980
|
case 42 /* asterisk */:
|
|
9935
9981
|
case 43 /* plus */:
|
|
9936
9982
|
case 63 /* question */:
|
|
@@ -9963,7 +10009,7 @@ function createScanner(languageVersion, skipTrivia2, languageVariant = 0 /* Stan
|
|
|
9963
10009
|
}
|
|
9964
10010
|
case 93 /* closeBracket */:
|
|
9965
10011
|
case 125 /* closeBrace */:
|
|
9966
|
-
if (
|
|
10012
|
+
if (anyUnicodeModeOrNonAnnexB || ch === 41 /* closeParen */) {
|
|
9967
10013
|
error(Diagnostics.Unexpected_0_Did_you_mean_to_escape_it_with_backslash, pos, 1, String.fromCharCode(ch));
|
|
9968
10014
|
}
|
|
9969
10015
|
pos++;
|
|
@@ -10012,7 +10058,7 @@ function createScanner(languageVersion, skipTrivia2, languageVariant = 0 /* Stan
|
|
|
10012
10058
|
true
|
|
10013
10059
|
);
|
|
10014
10060
|
scanExpectedChar(62 /* greaterThan */);
|
|
10015
|
-
} else if (
|
|
10061
|
+
} else if (anyUnicodeModeOrNonAnnexB || namedCaptureGroups) {
|
|
10016
10062
|
error(Diagnostics.k_must_be_followed_by_a_capturing_group_name_enclosed_in_angle_brackets, pos - 2, 2);
|
|
10017
10063
|
}
|
|
10018
10064
|
break;
|
|
@@ -10055,9 +10101,9 @@ function createScanner(languageVersion, skipTrivia2, languageVariant = 0 /* Stan
|
|
|
10055
10101
|
pos++;
|
|
10056
10102
|
return String.fromCharCode(ch & 31);
|
|
10057
10103
|
}
|
|
10058
|
-
if (
|
|
10104
|
+
if (anyUnicodeModeOrNonAnnexB) {
|
|
10059
10105
|
error(Diagnostics.c_must_be_followed_by_an_ASCII_letter, pos - 2, 2);
|
|
10060
|
-
} else if (atomEscape
|
|
10106
|
+
} else if (atomEscape) {
|
|
10061
10107
|
pos--;
|
|
10062
10108
|
return "\\";
|
|
10063
10109
|
}
|
|
@@ -10082,10 +10128,7 @@ function createScanner(languageVersion, skipTrivia2, languageVariant = 0 /* Stan
|
|
|
10082
10128
|
default:
|
|
10083
10129
|
pos--;
|
|
10084
10130
|
return scanEscapeSequence(
|
|
10085
|
-
/*
|
|
10086
|
-
anyUnicodeMode,
|
|
10087
|
-
/*isRegularExpression*/
|
|
10088
|
-
annexB ? "annex-b" : true
|
|
10131
|
+
4 /* RegularExpression */ | (annexB ? 8 /* AnnexB */ : 0) | (anyUnicodeMode ? 16 /* AnyUnicodeMode */ : 0) | (atomEscape ? 32 /* AtomEscape */ : 0)
|
|
10089
10132
|
);
|
|
10090
10133
|
}
|
|
10091
10134
|
}
|
|
@@ -10127,12 +10170,12 @@ function createScanner(languageVersion, skipTrivia2, languageVariant = 0 /* Stan
|
|
|
10127
10170
|
if (isClassContentExit(ch2)) {
|
|
10128
10171
|
return;
|
|
10129
10172
|
}
|
|
10130
|
-
if (!minCharacter &&
|
|
10173
|
+
if (!minCharacter && anyUnicodeModeOrNonAnnexB) {
|
|
10131
10174
|
error(Diagnostics.A_character_class_range_must_not_be_bounded_by_another_character_class, minStart, pos - 1 - minStart);
|
|
10132
10175
|
}
|
|
10133
10176
|
const maxStart = pos;
|
|
10134
10177
|
const maxCharacter = scanClassAtom();
|
|
10135
|
-
if (!maxCharacter &&
|
|
10178
|
+
if (!maxCharacter && anyUnicodeModeOrNonAnnexB) {
|
|
10136
10179
|
error(Diagnostics.A_character_class_range_must_not_be_bounded_by_another_character_class, maxStart, pos - maxStart);
|
|
10137
10180
|
continue;
|
|
10138
10181
|
}
|
|
@@ -10562,8 +10605,11 @@ function createScanner(languageVersion, skipTrivia2, languageVariant = 0 /* Stan
|
|
|
10562
10605
|
if (!anyUnicodeMode) {
|
|
10563
10606
|
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
10607
|
}
|
|
10565
|
-
} else if (
|
|
10608
|
+
} else if (anyUnicodeModeOrNonAnnexB) {
|
|
10566
10609
|
error(Diagnostics._0_must_be_followed_by_a_Unicode_property_value_expression_enclosed_in_braces, pos - 2, 2, String.fromCharCode(ch));
|
|
10610
|
+
} else {
|
|
10611
|
+
pos--;
|
|
10612
|
+
return false;
|
|
10567
10613
|
}
|
|
10568
10614
|
return true;
|
|
10569
10615
|
}
|
|
@@ -10603,11 +10649,11 @@ function createScanner(languageVersion, skipTrivia2, languageVariant = 0 /* Stan
|
|
|
10603
10649
|
}
|
|
10604
10650
|
});
|
|
10605
10651
|
forEach(decimalEscapes, (escape) => {
|
|
10606
|
-
if (
|
|
10652
|
+
if (escape.value > numberOfCapturingGroups) {
|
|
10607
10653
|
if (numberOfCapturingGroups) {
|
|
10608
10654
|
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
10655
|
} else {
|
|
10610
|
-
error(Diagnostics.
|
|
10656
|
+
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
10657
|
}
|
|
10612
10658
|
}
|
|
10613
10659
|
});
|
|
@@ -25486,7 +25532,7 @@ var addDisposableResourceHelper = {
|
|
|
25486
25532
|
var __addDisposableResource = (this && this.__addDisposableResource) || function (env, value, async) {
|
|
25487
25533
|
if (value !== null && value !== void 0) {
|
|
25488
25534
|
if (typeof value !== "object" && typeof value !== "function") throw new TypeError("Object expected.");
|
|
25489
|
-
var dispose;
|
|
25535
|
+
var dispose, inner;
|
|
25490
25536
|
if (async) {
|
|
25491
25537
|
if (!Symbol.asyncDispose) throw new TypeError("Symbol.asyncDispose is not defined.");
|
|
25492
25538
|
dispose = value[Symbol.asyncDispose];
|
|
@@ -25494,8 +25540,10 @@ var addDisposableResourceHelper = {
|
|
|
25494
25540
|
if (dispose === void 0) {
|
|
25495
25541
|
if (!Symbol.dispose) throw new TypeError("Symbol.dispose is not defined.");
|
|
25496
25542
|
dispose = value[Symbol.dispose];
|
|
25543
|
+
if (async) inner = dispose;
|
|
25497
25544
|
}
|
|
25498
25545
|
if (typeof dispose !== "function") throw new TypeError("Object not disposable.");
|
|
25546
|
+
if (inner) dispose = function() { try { inner.call(this); } catch (e) { return Promise.reject(e); } };
|
|
25499
25547
|
env.stack.push({ value: value, dispose: dispose, async: async });
|
|
25500
25548
|
}
|
|
25501
25549
|
else if (async) {
|
|
@@ -35880,7 +35928,7 @@ var commandOptionsWithoutBuild = [
|
|
|
35880
35928
|
showInSimplifiedHelpView: false,
|
|
35881
35929
|
category: Diagnostics.Compiler_Diagnostics,
|
|
35882
35930
|
description: Diagnostics.Disable_full_type_checking_only_critical_parse_and_emit_errors_will_be_reported,
|
|
35883
|
-
transpileOptionValue:
|
|
35931
|
+
transpileOptionValue: true,
|
|
35884
35932
|
defaultValueDescription: false,
|
|
35885
35933
|
affectsSemanticDiagnostics: true,
|
|
35886
35934
|
affectsBuildInfo: true,
|
|
@@ -47674,10 +47722,22 @@ function createTypeChecker(host) {
|
|
|
47674
47722
|
return !!aliasDeclarationLinks.typeOnlyDeclaration;
|
|
47675
47723
|
}
|
|
47676
47724
|
function getTypeOnlyAliasDeclaration(symbol, include) {
|
|
47725
|
+
var _a;
|
|
47677
47726
|
if (!(symbol.flags & 2097152 /* Alias */)) {
|
|
47678
47727
|
return void 0;
|
|
47679
47728
|
}
|
|
47680
47729
|
const links = getSymbolLinks(symbol);
|
|
47730
|
+
if (links.typeOnlyDeclaration === void 0) {
|
|
47731
|
+
links.typeOnlyDeclaration = false;
|
|
47732
|
+
const resolved = resolveSymbol(symbol);
|
|
47733
|
+
markSymbolOfAliasDeclarationIfTypeOnly(
|
|
47734
|
+
(_a = symbol.declarations) == null ? void 0 : _a[0],
|
|
47735
|
+
getDeclarationOfAliasSymbol(symbol) && getImmediateAliasedSymbol(symbol),
|
|
47736
|
+
resolved,
|
|
47737
|
+
/*overwriteEmpty*/
|
|
47738
|
+
true
|
|
47739
|
+
);
|
|
47740
|
+
}
|
|
47681
47741
|
if (include === void 0) {
|
|
47682
47742
|
return links.typeOnlyDeclaration || void 0;
|
|
47683
47743
|
}
|
|
@@ -51420,18 +51480,108 @@ function createTypeChecker(host) {
|
|
|
51420
51480
|
cancellationToken.throwIfCancellationRequested();
|
|
51421
51481
|
}
|
|
51422
51482
|
let hadError = false;
|
|
51483
|
+
const { finalizeBoundary, startRecoveryScope } = createRecoveryBoundary();
|
|
51423
51484
|
const transformed = visitNode(existing, visitExistingNodeTreeSymbols, isTypeNode);
|
|
51424
|
-
if (
|
|
51485
|
+
if (!finalizeBoundary()) {
|
|
51425
51486
|
return void 0;
|
|
51426
51487
|
}
|
|
51427
51488
|
context.approximateLength += existing.end - existing.pos;
|
|
51428
51489
|
return transformed;
|
|
51429
51490
|
function visitExistingNodeTreeSymbols(node) {
|
|
51491
|
+
if (hadError) return node;
|
|
51492
|
+
const recover = startRecoveryScope();
|
|
51430
51493
|
const onExitNewScope = isNewScopeNode(node) ? onEnterNewScope(node) : void 0;
|
|
51431
51494
|
const result = visitExistingNodeTreeSymbolsWorker(node);
|
|
51432
51495
|
onExitNewScope == null ? void 0 : onExitNewScope();
|
|
51496
|
+
if (hadError) {
|
|
51497
|
+
if (isTypeNode(node) && !isTypePredicateNode(node)) {
|
|
51498
|
+
recover();
|
|
51499
|
+
return serializeExistingTypeNode(context, node);
|
|
51500
|
+
}
|
|
51501
|
+
return node;
|
|
51502
|
+
}
|
|
51433
51503
|
return result === node ? setTextRange2(context, factory.cloneNode(result), node) : result;
|
|
51434
51504
|
}
|
|
51505
|
+
function createRecoveryBoundary() {
|
|
51506
|
+
let unreportedErrors;
|
|
51507
|
+
const oldTracker = context.tracker;
|
|
51508
|
+
const oldTrackedSymbols = context.trackedSymbols;
|
|
51509
|
+
context.trackedSymbols = [];
|
|
51510
|
+
const oldEncounteredError = context.encounteredError;
|
|
51511
|
+
context.tracker = new SymbolTrackerImpl(context, {
|
|
51512
|
+
...oldTracker.inner,
|
|
51513
|
+
reportCyclicStructureError() {
|
|
51514
|
+
markError(() => oldTracker.reportCyclicStructureError());
|
|
51515
|
+
},
|
|
51516
|
+
reportInaccessibleThisError() {
|
|
51517
|
+
markError(() => oldTracker.reportInaccessibleThisError());
|
|
51518
|
+
},
|
|
51519
|
+
reportInaccessibleUniqueSymbolError() {
|
|
51520
|
+
markError(() => oldTracker.reportInaccessibleUniqueSymbolError());
|
|
51521
|
+
},
|
|
51522
|
+
reportLikelyUnsafeImportRequiredError(specifier) {
|
|
51523
|
+
markError(() => oldTracker.reportLikelyUnsafeImportRequiredError(specifier));
|
|
51524
|
+
},
|
|
51525
|
+
reportNonSerializableProperty(name) {
|
|
51526
|
+
markError(() => oldTracker.reportNonSerializableProperty(name));
|
|
51527
|
+
},
|
|
51528
|
+
trackSymbol(sym, decl, meaning) {
|
|
51529
|
+
const accessibility = isSymbolAccessible(
|
|
51530
|
+
sym,
|
|
51531
|
+
decl,
|
|
51532
|
+
meaning,
|
|
51533
|
+
/*shouldComputeAliasesToMakeVisible*/
|
|
51534
|
+
false
|
|
51535
|
+
);
|
|
51536
|
+
if (accessibility.accessibility !== 0 /* Accessible */) {
|
|
51537
|
+
(context.trackedSymbols ?? (context.trackedSymbols = [])).push([sym, decl, meaning]);
|
|
51538
|
+
return true;
|
|
51539
|
+
}
|
|
51540
|
+
return false;
|
|
51541
|
+
},
|
|
51542
|
+
moduleResolverHost: context.tracker.moduleResolverHost
|
|
51543
|
+
}, context.tracker.moduleResolverHost);
|
|
51544
|
+
return {
|
|
51545
|
+
startRecoveryScope: startRecoveryScope2,
|
|
51546
|
+
finalizeBoundary: finalizeBoundary2
|
|
51547
|
+
};
|
|
51548
|
+
function markError(unreportedError) {
|
|
51549
|
+
hadError = true;
|
|
51550
|
+
(unreportedErrors ?? (unreportedErrors = [])).push(unreportedError);
|
|
51551
|
+
}
|
|
51552
|
+
function startRecoveryScope2() {
|
|
51553
|
+
var _a;
|
|
51554
|
+
const initialTrackedSymbolsTop = ((_a = context.trackedSymbols) == null ? void 0 : _a.length) ?? 0;
|
|
51555
|
+
const unreportedErrorsTop = (unreportedErrors == null ? void 0 : unreportedErrors.length) ?? 0;
|
|
51556
|
+
return () => {
|
|
51557
|
+
hadError = false;
|
|
51558
|
+
if (context.trackedSymbols) {
|
|
51559
|
+
context.trackedSymbols.length = initialTrackedSymbolsTop;
|
|
51560
|
+
}
|
|
51561
|
+
if (unreportedErrors) {
|
|
51562
|
+
unreportedErrors.length = unreportedErrorsTop;
|
|
51563
|
+
}
|
|
51564
|
+
};
|
|
51565
|
+
}
|
|
51566
|
+
function finalizeBoundary2() {
|
|
51567
|
+
context.tracker = oldTracker;
|
|
51568
|
+
const newTrackedSymbols = context.trackedSymbols;
|
|
51569
|
+
context.trackedSymbols = oldTrackedSymbols;
|
|
51570
|
+
context.encounteredError = oldEncounteredError;
|
|
51571
|
+
unreportedErrors == null ? void 0 : unreportedErrors.forEach((fn) => fn());
|
|
51572
|
+
if (hadError) {
|
|
51573
|
+
return false;
|
|
51574
|
+
}
|
|
51575
|
+
newTrackedSymbols == null ? void 0 : newTrackedSymbols.forEach(
|
|
51576
|
+
([symbol, enclosingDeclaration, meaning]) => context.tracker.trackSymbol(
|
|
51577
|
+
symbol,
|
|
51578
|
+
enclosingDeclaration,
|
|
51579
|
+
meaning
|
|
51580
|
+
)
|
|
51581
|
+
);
|
|
51582
|
+
return true;
|
|
51583
|
+
}
|
|
51584
|
+
}
|
|
51435
51585
|
function onEnterNewScope(node) {
|
|
51436
51586
|
return enterNewScope(context, node, getParametersInScope(node), getTypeParametersInScope(node));
|
|
51437
51587
|
}
|
|
@@ -51705,13 +51855,39 @@ function createTypeChecker(host) {
|
|
|
51705
51855
|
}
|
|
51706
51856
|
function rewriteModuleSpecifier(parent, lit) {
|
|
51707
51857
|
if (context.bundled || context.enclosingFile !== getSourceFileOfNode(lit)) {
|
|
51708
|
-
|
|
51709
|
-
|
|
51710
|
-
|
|
51711
|
-
|
|
51712
|
-
|
|
51858
|
+
let name = lit.text;
|
|
51859
|
+
const nodeSymbol = getNodeLinks(node).resolvedSymbol;
|
|
51860
|
+
const meaning = parent.isTypeOf ? 111551 /* Value */ : 788968 /* Type */;
|
|
51861
|
+
const parentSymbol = nodeSymbol && isSymbolAccessible(
|
|
51862
|
+
nodeSymbol,
|
|
51863
|
+
context.enclosingDeclaration,
|
|
51864
|
+
meaning,
|
|
51865
|
+
/*shouldComputeAliasesToMakeVisible*/
|
|
51866
|
+
false
|
|
51867
|
+
).accessibility === 0 /* Accessible */ && lookupSymbolChain(
|
|
51868
|
+
nodeSymbol,
|
|
51869
|
+
context,
|
|
51870
|
+
meaning,
|
|
51871
|
+
/*yieldModuleSymbol*/
|
|
51872
|
+
true
|
|
51873
|
+
)[0];
|
|
51874
|
+
if (parentSymbol && parentSymbol.flags & 1536 /* Module */) {
|
|
51875
|
+
name = getSpecifierForModuleSymbol(parentSymbol, context);
|
|
51876
|
+
} else {
|
|
51877
|
+
const targetFile = getExternalModuleFileFromDeclaration(parent);
|
|
51878
|
+
if (targetFile) {
|
|
51879
|
+
name = getSpecifierForModuleSymbol(targetFile.symbol, context);
|
|
51713
51880
|
}
|
|
51714
51881
|
}
|
|
51882
|
+
if (name.includes("/node_modules/")) {
|
|
51883
|
+
context.encounteredError = true;
|
|
51884
|
+
if (context.tracker.reportLikelyUnsafeImportRequiredError) {
|
|
51885
|
+
context.tracker.reportLikelyUnsafeImportRequiredError(name);
|
|
51886
|
+
}
|
|
51887
|
+
}
|
|
51888
|
+
if (name !== lit.text) {
|
|
51889
|
+
return setOriginalNode(factory.createStringLiteral(name), lit);
|
|
51890
|
+
}
|
|
51715
51891
|
}
|
|
51716
51892
|
return visitNode(lit, visitExistingNodeTreeSymbols, isStringLiteral);
|
|
51717
51893
|
}
|
|
@@ -59679,7 +59855,6 @@ function createTypeChecker(host) {
|
|
|
59679
59855
|
return links.resolvedType;
|
|
59680
59856
|
}
|
|
59681
59857
|
function getTemplateLiteralType(texts, types) {
|
|
59682
|
-
var _a, _b;
|
|
59683
59858
|
const unionIndex = findIndex(types, (t) => !!(t.flags & (131072 /* Never */ | 1048576 /* Union */)));
|
|
59684
59859
|
if (unionIndex >= 0) {
|
|
59685
59860
|
return checkCrossProductUnion(types) ? mapType(types[unionIndex], (t) => getTemplateLiteralType(texts, replaceElement(types, unionIndex, t))) : errorType;
|
|
@@ -59687,9 +59862,6 @@ function createTypeChecker(host) {
|
|
|
59687
59862
|
if (contains(types, wildcardType)) {
|
|
59688
59863
|
return wildcardType;
|
|
59689
59864
|
}
|
|
59690
|
-
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)) {
|
|
59691
|
-
return types[0];
|
|
59692
|
-
}
|
|
59693
59865
|
const newTypes = [];
|
|
59694
59866
|
const newTexts = [];
|
|
59695
59867
|
let text = texts[0];
|
|
@@ -69179,9 +69351,6 @@ function createTypeChecker(host) {
|
|
|
69179
69351
|
if (isJsxOpeningLikeElement(location) || isJsxOpeningFragment(location)) {
|
|
69180
69352
|
return markJsxAliasReferenced(location);
|
|
69181
69353
|
}
|
|
69182
|
-
if (isFunctionLikeDeclaration(location) || isMethodSignature(location)) {
|
|
69183
|
-
return markAsyncFunctionAliasReferenced(location);
|
|
69184
|
-
}
|
|
69185
69354
|
if (isImportEqualsDeclaration(location)) {
|
|
69186
69355
|
if (isInternalModuleImportEqualsDeclaration(location) || checkExternalImportOrExportDeclaration(location)) {
|
|
69187
69356
|
return markImportEqualsAliasReferenced(location);
|
|
@@ -69191,6 +69360,9 @@ function createTypeChecker(host) {
|
|
|
69191
69360
|
if (isExportSpecifier(location)) {
|
|
69192
69361
|
return markExportSpecifierAliasReferenced(location);
|
|
69193
69362
|
}
|
|
69363
|
+
if (isFunctionLikeDeclaration(location) || isMethodSignature(location)) {
|
|
69364
|
+
markAsyncFunctionAliasReferenced(location);
|
|
69365
|
+
}
|
|
69194
69366
|
if (!compilerOptions.emitDecoratorMetadata) {
|
|
69195
69367
|
return;
|
|
69196
69368
|
}
|
|
@@ -69528,18 +69700,12 @@ function createTypeChecker(host) {
|
|
|
69528
69700
|
}
|
|
69529
69701
|
return type;
|
|
69530
69702
|
}
|
|
69531
|
-
function
|
|
69532
|
-
if (isThisInTypeQuery(node))
|
|
69533
|
-
return checkThisExpression(node);
|
|
69534
|
-
}
|
|
69535
|
-
const symbol = getResolvedSymbol(node);
|
|
69536
|
-
if (symbol === unknownSymbol) {
|
|
69537
|
-
return errorType;
|
|
69538
|
-
}
|
|
69703
|
+
function checkIdentifierCalculateNodeCheckFlags(node, symbol) {
|
|
69704
|
+
if (isThisInTypeQuery(node)) return;
|
|
69539
69705
|
if (symbol === argumentsSymbol) {
|
|
69540
69706
|
if (isInPropertyInitializerOrClassStaticBlock(node)) {
|
|
69541
69707
|
error(node, Diagnostics.arguments_cannot_be_referenced_in_property_initializers);
|
|
69542
|
-
return
|
|
69708
|
+
return;
|
|
69543
69709
|
}
|
|
69544
69710
|
let container = getContainingFunction(node);
|
|
69545
69711
|
if (container) {
|
|
@@ -69558,17 +69724,14 @@ function createTypeChecker(host) {
|
|
|
69558
69724
|
}
|
|
69559
69725
|
}
|
|
69560
69726
|
}
|
|
69561
|
-
return
|
|
69562
|
-
}
|
|
69563
|
-
if (shouldMarkIdentifierAliasReferenced(node)) {
|
|
69564
|
-
markLinkedReferences(node, 1 /* Identifier */);
|
|
69727
|
+
return;
|
|
69565
69728
|
}
|
|
69566
69729
|
const localOrExportSymbol = getExportSymbolOfValueSymbolIfExported(symbol);
|
|
69567
69730
|
const targetSymbol = resolveAliasWithDeprecationCheck(localOrExportSymbol, node);
|
|
69568
69731
|
if (isDeprecatedSymbol(targetSymbol) && isUncalledFunctionReference(node, targetSymbol) && targetSymbol.declarations) {
|
|
69569
69732
|
addDeprecatedSuggestion(node, targetSymbol.declarations, node.escapedText);
|
|
69570
69733
|
}
|
|
69571
|
-
|
|
69734
|
+
const declaration = localOrExportSymbol.valueDeclaration;
|
|
69572
69735
|
if (declaration && localOrExportSymbol.flags & 32 /* Class */) {
|
|
69573
69736
|
if (isClassLike(declaration) && declaration.name !== node) {
|
|
69574
69737
|
let container = getThisContainer(
|
|
@@ -69595,6 +69758,27 @@ function createTypeChecker(host) {
|
|
|
69595
69758
|
}
|
|
69596
69759
|
}
|
|
69597
69760
|
checkNestedBlockScopedBinding(node, symbol);
|
|
69761
|
+
}
|
|
69762
|
+
function checkIdentifier(node, checkMode) {
|
|
69763
|
+
if (isThisInTypeQuery(node)) {
|
|
69764
|
+
return checkThisExpression(node);
|
|
69765
|
+
}
|
|
69766
|
+
const symbol = getResolvedSymbol(node);
|
|
69767
|
+
if (symbol === unknownSymbol) {
|
|
69768
|
+
return errorType;
|
|
69769
|
+
}
|
|
69770
|
+
checkIdentifierCalculateNodeCheckFlags(node, symbol);
|
|
69771
|
+
if (symbol === argumentsSymbol) {
|
|
69772
|
+
if (isInPropertyInitializerOrClassStaticBlock(node)) {
|
|
69773
|
+
return errorType;
|
|
69774
|
+
}
|
|
69775
|
+
return getTypeOfSymbol(symbol);
|
|
69776
|
+
}
|
|
69777
|
+
if (shouldMarkIdentifierAliasReferenced(node)) {
|
|
69778
|
+
markLinkedReferences(node, 1 /* Identifier */);
|
|
69779
|
+
}
|
|
69780
|
+
const localOrExportSymbol = getExportSymbolOfValueSymbolIfExported(symbol);
|
|
69781
|
+
let declaration = localOrExportSymbol.valueDeclaration;
|
|
69598
69782
|
let type = getNarrowedTypeOfSymbol(localOrExportSymbol, node, checkMode);
|
|
69599
69783
|
const assignmentKind = getAssignmentTargetKind(node);
|
|
69600
69784
|
if (assignmentKind) {
|
|
@@ -70260,7 +70444,31 @@ function createTypeChecker(host) {
|
|
|
70260
70444
|
if (!node.asteriskToken && contextualReturnType.flags & 1048576 /* Union */) {
|
|
70261
70445
|
contextualReturnType = filterType(contextualReturnType, (type) => !!getIterationTypeOfGeneratorFunctionReturnType(1 /* Return */, type, isAsyncGenerator));
|
|
70262
70446
|
}
|
|
70263
|
-
|
|
70447
|
+
if (node.asteriskToken) {
|
|
70448
|
+
const iterationTypes = getIterationTypesOfGeneratorFunctionReturnType(contextualReturnType, isAsyncGenerator);
|
|
70449
|
+
const yieldType = (iterationTypes == null ? void 0 : iterationTypes.yieldType) ?? silentNeverType;
|
|
70450
|
+
const returnType = getContextualType(node, contextFlags) ?? silentNeverType;
|
|
70451
|
+
const nextType = (iterationTypes == null ? void 0 : iterationTypes.nextType) ?? unknownType;
|
|
70452
|
+
const generatorType = createGeneratorType(
|
|
70453
|
+
yieldType,
|
|
70454
|
+
returnType,
|
|
70455
|
+
nextType,
|
|
70456
|
+
/*isAsyncGenerator*/
|
|
70457
|
+
false
|
|
70458
|
+
);
|
|
70459
|
+
if (isAsyncGenerator) {
|
|
70460
|
+
const asyncGeneratorType = createGeneratorType(
|
|
70461
|
+
yieldType,
|
|
70462
|
+
returnType,
|
|
70463
|
+
nextType,
|
|
70464
|
+
/*isAsyncGenerator*/
|
|
70465
|
+
true
|
|
70466
|
+
);
|
|
70467
|
+
return getUnionType([generatorType, asyncGeneratorType]);
|
|
70468
|
+
}
|
|
70469
|
+
return generatorType;
|
|
70470
|
+
}
|
|
70471
|
+
return getIterationTypeOfGeneratorFunctionReturnType(0 /* Yield */, contextualReturnType, isAsyncGenerator);
|
|
70264
70472
|
}
|
|
70265
70473
|
}
|
|
70266
70474
|
return void 0;
|
|
@@ -76030,7 +76238,7 @@ function createTypeChecker(host) {
|
|
|
76030
76238
|
if (nextType) nextType = getWidenedType(nextType);
|
|
76031
76239
|
}
|
|
76032
76240
|
if (isGenerator) {
|
|
76033
|
-
return
|
|
76241
|
+
return createGeneratorType(
|
|
76034
76242
|
yieldType || neverType,
|
|
76035
76243
|
returnType || fallbackReturnType,
|
|
76036
76244
|
nextType || getContextualIterationType(2 /* Next */, func) || unknownType,
|
|
@@ -76040,7 +76248,7 @@ function createTypeChecker(host) {
|
|
|
76040
76248
|
return isAsync ? createPromiseType(returnType || fallbackReturnType) : returnType || fallbackReturnType;
|
|
76041
76249
|
}
|
|
76042
76250
|
}
|
|
76043
|
-
function
|
|
76251
|
+
function createGeneratorType(yieldType, returnType, nextType, isAsyncGenerator) {
|
|
76044
76252
|
const resolver = isAsyncGenerator ? asyncIterationTypesResolver : syncIterationTypesResolver;
|
|
76045
76253
|
const globalGeneratorType = resolver.getGlobalGeneratorType(
|
|
76046
76254
|
/*reportErrors*/
|
|
@@ -78425,7 +78633,7 @@ function createTypeChecker(host) {
|
|
|
78425
78633
|
const generatorYieldType = getIterationTypeOfGeneratorFunctionReturnType(0 /* Yield */, returnType, (functionFlags & 2 /* Async */) !== 0) || anyType;
|
|
78426
78634
|
const generatorReturnType = getIterationTypeOfGeneratorFunctionReturnType(1 /* Return */, returnType, (functionFlags & 2 /* Async */) !== 0) || generatorYieldType;
|
|
78427
78635
|
const generatorNextType = getIterationTypeOfGeneratorFunctionReturnType(2 /* Next */, returnType, (functionFlags & 2 /* Async */) !== 0) || unknownType;
|
|
78428
|
-
const generatorInstantiation =
|
|
78636
|
+
const generatorInstantiation = createGeneratorType(generatorYieldType, generatorReturnType, generatorNextType, !!(functionFlags & 2 /* Async */));
|
|
78429
78637
|
return checkTypeAssignableTo(generatorInstantiation, returnType, errorNode);
|
|
78430
78638
|
}
|
|
78431
78639
|
function checkClassForDuplicateDeclarations(node) {
|
|
@@ -84581,7 +84789,6 @@ function createTypeChecker(host) {
|
|
|
84581
84789
|
if (links.isDeclarationWithCollidingName === void 0) {
|
|
84582
84790
|
const container = getEnclosingBlockScopeContainer(symbol.valueDeclaration);
|
|
84583
84791
|
if (isStatementWithLocals(container) || isSymbolOfDestructuredElementOfCatchBinding(symbol)) {
|
|
84584
|
-
const nodeLinks2 = getNodeLinks(symbol.valueDeclaration);
|
|
84585
84792
|
if (resolveName(
|
|
84586
84793
|
container.parent,
|
|
84587
84794
|
symbol.escapedName,
|
|
@@ -84592,8 +84799,8 @@ function createTypeChecker(host) {
|
|
|
84592
84799
|
false
|
|
84593
84800
|
)) {
|
|
84594
84801
|
links.isDeclarationWithCollidingName = true;
|
|
84595
|
-
} else if (
|
|
84596
|
-
const isDeclaredInLoop =
|
|
84802
|
+
} else if (hasNodeCheckFlag(symbol.valueDeclaration, 16384 /* CapturedBlockScopedBinding */)) {
|
|
84803
|
+
const isDeclaredInLoop = hasNodeCheckFlag(symbol.valueDeclaration, 32768 /* BlockScopedBindingInLoop */);
|
|
84597
84804
|
const inLoopInitializer = isIterationStatement(
|
|
84598
84805
|
container,
|
|
84599
84806
|
/*lookInLabeledStatements*/
|
|
@@ -84675,6 +84882,9 @@ function createTypeChecker(host) {
|
|
|
84675
84882
|
if (!symbol) {
|
|
84676
84883
|
return false;
|
|
84677
84884
|
}
|
|
84885
|
+
const container = getSourceFileOfNode(symbol.valueDeclaration);
|
|
84886
|
+
const fileSymbol = container && getSymbolOfDeclaration(container);
|
|
84887
|
+
void resolveExternalModuleSymbol(fileSymbol);
|
|
84678
84888
|
const target = getExportSymbolOfValueSymbolIfExported(resolveAlias(symbol));
|
|
84679
84889
|
if (target === unknownSymbol) {
|
|
84680
84890
|
return !excludeTypeOnlyValues || !getTypeOnlyAliasDeclaration(symbol);
|
|
@@ -84773,6 +84983,108 @@ function createTypeChecker(host) {
|
|
|
84773
84983
|
if (nodeId < 0 || nodeId >= nodeLinks.length) return 0;
|
|
84774
84984
|
return ((_a = nodeLinks[nodeId]) == null ? void 0 : _a.flags) || 0;
|
|
84775
84985
|
}
|
|
84986
|
+
function hasNodeCheckFlag(node, flag) {
|
|
84987
|
+
calculateNodeCheckFlagWorker(node, flag);
|
|
84988
|
+
return !!(getNodeCheckFlags(node) & flag);
|
|
84989
|
+
}
|
|
84990
|
+
function calculateNodeCheckFlagWorker(node, flag) {
|
|
84991
|
+
if (!compilerOptions.noCheck) {
|
|
84992
|
+
return;
|
|
84993
|
+
}
|
|
84994
|
+
const links = getNodeLinks(node);
|
|
84995
|
+
if (links.calculatedFlags & flag) {
|
|
84996
|
+
return;
|
|
84997
|
+
}
|
|
84998
|
+
switch (flag) {
|
|
84999
|
+
case 16 /* SuperInstance */:
|
|
85000
|
+
case 32 /* SuperStatic */:
|
|
85001
|
+
return checkSingleSuperExpression(node);
|
|
85002
|
+
case 128 /* MethodWithSuperPropertyAccessInAsync */:
|
|
85003
|
+
case 256 /* MethodWithSuperPropertyAssignmentInAsync */:
|
|
85004
|
+
case 2097152 /* ContainsSuperPropertyInStaticInitializer */:
|
|
85005
|
+
return checkChildSuperExpressions(node);
|
|
85006
|
+
case 512 /* CaptureArguments */:
|
|
85007
|
+
case 8192 /* ContainsCapturedBlockScopeBinding */:
|
|
85008
|
+
case 65536 /* NeedsLoopOutParameter */:
|
|
85009
|
+
case 262144 /* ContainsConstructorReference */:
|
|
85010
|
+
return checkChildIdentifiers(node);
|
|
85011
|
+
case 536870912 /* ConstructorReference */:
|
|
85012
|
+
return checkSingleIdentifier(node);
|
|
85013
|
+
case 4096 /* LoopWithCapturedBlockScopedBinding */:
|
|
85014
|
+
case 32768 /* BlockScopedBindingInLoop */:
|
|
85015
|
+
case 16384 /* CapturedBlockScopedBinding */:
|
|
85016
|
+
return checkContainingBlockScopeBindingUses(node);
|
|
85017
|
+
default:
|
|
85018
|
+
return Debug.assertNever(flag, `Unhandled node check flag calculation: ${Debug.formatNodeCheckFlags(flag)}`);
|
|
85019
|
+
}
|
|
85020
|
+
function forEachNodeRecursively(root, cb) {
|
|
85021
|
+
const rootResult = cb(root, root.parent);
|
|
85022
|
+
if (rootResult === "skip") return void 0;
|
|
85023
|
+
if (rootResult) return rootResult;
|
|
85024
|
+
return forEachChildRecursively(root, cb);
|
|
85025
|
+
}
|
|
85026
|
+
function checkSuperExpressions(node2) {
|
|
85027
|
+
const links2 = getNodeLinks(node2);
|
|
85028
|
+
if (links2.calculatedFlags & flag) return "skip";
|
|
85029
|
+
links2.calculatedFlags |= 128 /* MethodWithSuperPropertyAccessInAsync */ | 256 /* MethodWithSuperPropertyAssignmentInAsync */ | 2097152 /* ContainsSuperPropertyInStaticInitializer */;
|
|
85030
|
+
checkSingleSuperExpression(node2);
|
|
85031
|
+
return void 0;
|
|
85032
|
+
}
|
|
85033
|
+
function checkChildSuperExpressions(node2) {
|
|
85034
|
+
forEachNodeRecursively(node2, checkSuperExpressions);
|
|
85035
|
+
}
|
|
85036
|
+
function checkSingleSuperExpression(node2) {
|
|
85037
|
+
const nodeLinks2 = getNodeLinks(node2);
|
|
85038
|
+
nodeLinks2.calculatedFlags |= 16 /* SuperInstance */ | 32 /* SuperStatic */;
|
|
85039
|
+
if (node2.kind === 108 /* SuperKeyword */) {
|
|
85040
|
+
checkSuperExpression(node2);
|
|
85041
|
+
}
|
|
85042
|
+
}
|
|
85043
|
+
function checkIdentifiers(node2) {
|
|
85044
|
+
const links2 = getNodeLinks(node2);
|
|
85045
|
+
if (links2.calculatedFlags & flag) return "skip";
|
|
85046
|
+
links2.calculatedFlags |= 512 /* CaptureArguments */ | 8192 /* ContainsCapturedBlockScopeBinding */ | 65536 /* NeedsLoopOutParameter */ | 262144 /* ContainsConstructorReference */;
|
|
85047
|
+
checkSingleIdentifier(node2);
|
|
85048
|
+
return void 0;
|
|
85049
|
+
}
|
|
85050
|
+
function checkChildIdentifiers(node2) {
|
|
85051
|
+
forEachNodeRecursively(node2, checkIdentifiers);
|
|
85052
|
+
}
|
|
85053
|
+
function checkSingleIdentifier(node2) {
|
|
85054
|
+
const nodeLinks2 = getNodeLinks(node2);
|
|
85055
|
+
nodeLinks2.calculatedFlags |= 536870912 /* ConstructorReference */ | 16384 /* CapturedBlockScopedBinding */ | 32768 /* BlockScopedBindingInLoop */;
|
|
85056
|
+
if (isIdentifier(node2) && isExpressionNode(node2) && !(isPropertyAccessExpression(node2.parent) && node2.parent.name === node2)) {
|
|
85057
|
+
const s = getSymbolAtLocation(
|
|
85058
|
+
node2,
|
|
85059
|
+
/*ignoreErrors*/
|
|
85060
|
+
true
|
|
85061
|
+
);
|
|
85062
|
+
if (s && s !== unknownSymbol) {
|
|
85063
|
+
checkIdentifierCalculateNodeCheckFlags(node2, s);
|
|
85064
|
+
}
|
|
85065
|
+
}
|
|
85066
|
+
}
|
|
85067
|
+
function checkBlockScopeBindings(node2) {
|
|
85068
|
+
const links2 = getNodeLinks(node2);
|
|
85069
|
+
if (links2.calculatedFlags & flag) return "skip";
|
|
85070
|
+
links2.calculatedFlags |= 4096 /* LoopWithCapturedBlockScopedBinding */ | 32768 /* BlockScopedBindingInLoop */ | 16384 /* CapturedBlockScopedBinding */;
|
|
85071
|
+
checkSingleBlockScopeBinding(node2);
|
|
85072
|
+
return void 0;
|
|
85073
|
+
}
|
|
85074
|
+
function checkContainingBlockScopeBindingUses(node2) {
|
|
85075
|
+
const scope = getEnclosingBlockScopeContainer(isDeclarationName(node2) ? node2.parent : node2);
|
|
85076
|
+
forEachNodeRecursively(scope, checkBlockScopeBindings);
|
|
85077
|
+
}
|
|
85078
|
+
function checkSingleBlockScopeBinding(node2) {
|
|
85079
|
+
checkSingleIdentifier(node2);
|
|
85080
|
+
if (isComputedPropertyName(node2)) {
|
|
85081
|
+
checkComputedPropertyName(node2);
|
|
85082
|
+
}
|
|
85083
|
+
if (isPrivateIdentifier(node2) && isClassElement(node2.parent)) {
|
|
85084
|
+
setNodeLinksForPrivateIdentifierScope(node2.parent);
|
|
85085
|
+
}
|
|
85086
|
+
}
|
|
85087
|
+
}
|
|
84776
85088
|
function getEnumMemberValue(node) {
|
|
84777
85089
|
computeEnumMemberValues(node.parent);
|
|
84778
85090
|
return getNodeLinks(node).enumMemberValue ?? evaluatorResult(
|
|
@@ -84793,7 +85105,15 @@ function createTypeChecker(host) {
|
|
|
84793
85105
|
if (node.kind === 306 /* EnumMember */) {
|
|
84794
85106
|
return getEnumMemberValue(node).value;
|
|
84795
85107
|
}
|
|
84796
|
-
|
|
85108
|
+
if (!getNodeLinks(node).resolvedSymbol) {
|
|
85109
|
+
void checkExpressionCached(node);
|
|
85110
|
+
}
|
|
85111
|
+
const symbol = getNodeLinks(node).resolvedSymbol || (isEntityNameExpression(node) ? resolveEntityName(
|
|
85112
|
+
node,
|
|
85113
|
+
111551 /* Value */,
|
|
85114
|
+
/*ignoreErrors*/
|
|
85115
|
+
true
|
|
85116
|
+
) : void 0);
|
|
84797
85117
|
if (symbol && symbol.flags & 8 /* EnumMember */) {
|
|
84798
85118
|
const member = symbol.valueDeclaration;
|
|
84799
85119
|
if (isEnumConst(member.parent)) {
|
|
@@ -85144,9 +85464,10 @@ function createTypeChecker(host) {
|
|
|
85144
85464
|
const node = getParseTreeNode(nodeIn);
|
|
85145
85465
|
return node && canCollectSymbolAliasAccessabilityData ? isReferencedAliasDeclaration(node, checkChildren) : true;
|
|
85146
85466
|
},
|
|
85147
|
-
|
|
85467
|
+
hasNodeCheckFlag: (nodeIn, flag) => {
|
|
85148
85468
|
const node = getParseTreeNode(nodeIn);
|
|
85149
|
-
|
|
85469
|
+
if (!node) return false;
|
|
85470
|
+
return hasNodeCheckFlag(node, flag);
|
|
85150
85471
|
},
|
|
85151
85472
|
isTopLevelValueImportEqualsWithEntityName,
|
|
85152
85473
|
isDeclarationVisible,
|
|
@@ -85169,6 +85490,10 @@ function createTypeChecker(host) {
|
|
|
85169
85490
|
return node ? getEnumMemberValue(node) : void 0;
|
|
85170
85491
|
},
|
|
85171
85492
|
collectLinkedAliases,
|
|
85493
|
+
markLinkedReferences: (nodeIn) => {
|
|
85494
|
+
const node = getParseTreeNode(nodeIn);
|
|
85495
|
+
return node && markLinkedReferences(node, 0 /* Unspecified */);
|
|
85496
|
+
},
|
|
85172
85497
|
getReferencedValueDeclaration,
|
|
85173
85498
|
getReferencedValueDeclarations,
|
|
85174
85499
|
getTypeReferenceSerializationKind,
|
|
@@ -92975,7 +93300,7 @@ function transformClassFields(context) {
|
|
|
92975
93300
|
containsInstancePrivateElements || (containsInstancePrivateElements = isPrivateIdentifierClassElementDeclaration(member));
|
|
92976
93301
|
} else if (isPrivateIdentifierClassElementDeclaration(member)) {
|
|
92977
93302
|
containsInstancePrivateElements = true;
|
|
92978
|
-
if (resolver.
|
|
93303
|
+
if (resolver.hasNodeCheckFlag(member, 262144 /* ContainsConstructorReference */)) {
|
|
92979
93304
|
facts |= 2 /* NeedsClassConstructorReference */;
|
|
92980
93305
|
}
|
|
92981
93306
|
} else if (isPropertyDeclaration(member)) {
|
|
@@ -93082,7 +93407,7 @@ function transformClassFields(context) {
|
|
|
93082
93407
|
if ((_b = node.emitNode) == null ? void 0 : _b.classThis) {
|
|
93083
93408
|
getClassLexicalEnvironment().classThis = node.emitNode.classThis;
|
|
93084
93409
|
}
|
|
93085
|
-
const isClassWithConstructorReference = resolver.
|
|
93410
|
+
const isClassWithConstructorReference = resolver.hasNodeCheckFlag(node, 262144 /* ContainsConstructorReference */);
|
|
93086
93411
|
const isExport = hasSyntacticModifier(node, 32 /* Export */);
|
|
93087
93412
|
const isDefault = hasSyntacticModifier(node, 2048 /* Default */);
|
|
93088
93413
|
let modifiers = visitNodes2(node.modifiers, modifierVisitor, isModifier);
|
|
@@ -93144,15 +93469,14 @@ function transformClassFields(context) {
|
|
|
93144
93469
|
var _a, _b, _c;
|
|
93145
93470
|
const isDecoratedClassDeclaration = !!(facts & 1 /* ClassWasDecorated */);
|
|
93146
93471
|
const staticPropertiesOrClassStaticBlocks = getStaticPropertiesAndClassStaticBlock(node);
|
|
93147
|
-
const
|
|
93148
|
-
const
|
|
93472
|
+
const isClassWithConstructorReference = resolver.hasNodeCheckFlag(node, 262144 /* ContainsConstructorReference */);
|
|
93473
|
+
const requiresBlockScopedVar = resolver.hasNodeCheckFlag(node, 32768 /* BlockScopedBindingInLoop */);
|
|
93149
93474
|
let temp;
|
|
93150
93475
|
function createClassTempVar() {
|
|
93151
93476
|
var _a2;
|
|
93152
93477
|
if (shouldTransformPrivateElementsOrClassStaticBlocks && ((_a2 = node.emitNode) == null ? void 0 : _a2.classThis)) {
|
|
93153
93478
|
return getClassLexicalEnvironment().classConstructor = node.emitNode.classThis;
|
|
93154
93479
|
}
|
|
93155
|
-
const requiresBlockScopedVar = classCheckFlags & 32768 /* BlockScopedBindingInLoop */;
|
|
93156
93480
|
const temp2 = factory2.createTempVariable(
|
|
93157
93481
|
requiresBlockScopedVar ? addBlockScopedVariable : hoistVariableDeclaration,
|
|
93158
93482
|
/*reservedInNestedScopes*/
|
|
@@ -93720,7 +94044,7 @@ function transformClassFields(context) {
|
|
|
93720
94044
|
const alreadyTransformed = !!cacheAssignment || isAssignmentExpression(innerExpression) && isGeneratedIdentifier(innerExpression.left);
|
|
93721
94045
|
if (!alreadyTransformed && !inlinable && shouldHoist) {
|
|
93722
94046
|
const generatedName = factory2.getGeneratedNameForNode(name);
|
|
93723
|
-
if (resolver.
|
|
94047
|
+
if (resolver.hasNodeCheckFlag(name, 32768 /* BlockScopedBindingInLoop */)) {
|
|
93724
94048
|
addBlockScopedVariable(generatedName);
|
|
93725
94049
|
} else {
|
|
93726
94050
|
hoistVariableDeclaration(generatedName);
|
|
@@ -93874,7 +94198,7 @@ function transformClassFields(context) {
|
|
|
93874
94198
|
prefix,
|
|
93875
94199
|
suffix
|
|
93876
94200
|
);
|
|
93877
|
-
if (resolver.
|
|
94201
|
+
if (resolver.hasNodeCheckFlag(node, 32768 /* BlockScopedBindingInLoop */)) {
|
|
93878
94202
|
addBlockScopedVariable(identifier);
|
|
93879
94203
|
} else {
|
|
93880
94204
|
hoistVariableDeclaration(identifier);
|
|
@@ -94113,7 +94437,7 @@ function transformClassFields(context) {
|
|
|
94113
94437
|
}
|
|
94114
94438
|
function trySubstituteClassAlias(node) {
|
|
94115
94439
|
if (enabledSubstitutions & 1 /* ClassAliases */) {
|
|
94116
|
-
if (resolver.
|
|
94440
|
+
if (resolver.hasNodeCheckFlag(node, 536870912 /* ConstructorReference */)) {
|
|
94117
94441
|
const declaration = resolver.getReferencedValueDeclaration(node);
|
|
94118
94442
|
if (declaration) {
|
|
94119
94443
|
const classAlias = classAliases[declaration.id];
|
|
@@ -94980,7 +95304,7 @@ function transformLegacyDecorators(context) {
|
|
|
94980
95304
|
}
|
|
94981
95305
|
}
|
|
94982
95306
|
function getClassAliasIfNeeded(node) {
|
|
94983
|
-
if (resolver.
|
|
95307
|
+
if (resolver.hasNodeCheckFlag(node, 262144 /* ContainsConstructorReference */)) {
|
|
94984
95308
|
enableSubstitutionForClassAliases();
|
|
94985
95309
|
const classAlias = factory2.createUniqueName(node.name && !isGeneratedIdentifier(node.name) ? idText(node.name) : "default");
|
|
94986
95310
|
classAliases[getOriginalNodeId(node)] = classAlias;
|
|
@@ -95013,7 +95337,7 @@ function transformLegacyDecorators(context) {
|
|
|
95013
95337
|
}
|
|
95014
95338
|
function trySubstituteClassAlias(node) {
|
|
95015
95339
|
if (classAliases) {
|
|
95016
|
-
if (resolver.
|
|
95340
|
+
if (resolver.hasNodeCheckFlag(node, 536870912 /* ConstructorReference */)) {
|
|
95017
95341
|
const declaration = resolver.getReferencedValueDeclaration(node);
|
|
95018
95342
|
if (declaration) {
|
|
95019
95343
|
const classAlias = classAliases[declaration.id];
|
|
@@ -97322,7 +97646,7 @@ function transformES2017(context) {
|
|
|
97322
97646
|
hasSuperElementAccess = false;
|
|
97323
97647
|
let updated = visitFunctionBody(node.body, visitor, context);
|
|
97324
97648
|
const originalMethod = getOriginalNode(node, isFunctionLikeDeclaration);
|
|
97325
|
-
const emitSuperHelpers = languageVersion >= 2 /* ES2015 */ && resolver.
|
|
97649
|
+
const emitSuperHelpers = languageVersion >= 2 /* ES2015 */ && (resolver.hasNodeCheckFlag(node, 256 /* MethodWithSuperPropertyAssignmentInAsync */) || resolver.hasNodeCheckFlag(node, 128 /* MethodWithSuperPropertyAccessInAsync */)) && (getFunctionFlags(originalMethod) & 3 /* AsyncGenerator */) !== 3 /* AsyncGenerator */;
|
|
97326
97650
|
if (emitSuperHelpers) {
|
|
97327
97651
|
enableSubstitutionForAsyncMethodsWithSuper();
|
|
97328
97652
|
if (capturedSuperProperties.size) {
|
|
@@ -97333,9 +97657,9 @@ function transformES2017(context) {
|
|
|
97333
97657
|
updated = factory2.updateBlock(updated, statements);
|
|
97334
97658
|
}
|
|
97335
97659
|
if (hasSuperElementAccess) {
|
|
97336
|
-
if (resolver.
|
|
97660
|
+
if (resolver.hasNodeCheckFlag(node, 256 /* MethodWithSuperPropertyAssignmentInAsync */)) {
|
|
97337
97661
|
addEmitHelper(updated, advancedAsyncSuperHelper);
|
|
97338
|
-
} else if (resolver.
|
|
97662
|
+
} else if (resolver.hasNodeCheckFlag(node, 128 /* MethodWithSuperPropertyAccessInAsync */)) {
|
|
97339
97663
|
addEmitHelper(updated, asyncSuperHelper);
|
|
97340
97664
|
}
|
|
97341
97665
|
}
|
|
@@ -97402,7 +97726,7 @@ function transformES2017(context) {
|
|
|
97402
97726
|
const promiseConstructor = languageVersion < 2 /* ES2015 */ ? getPromiseConstructor(nodeType) : void 0;
|
|
97403
97727
|
const isArrowFunction2 = node.kind === 219 /* ArrowFunction */;
|
|
97404
97728
|
const savedLexicalArgumentsBinding = lexicalArgumentsBinding;
|
|
97405
|
-
const hasLexicalArguments =
|
|
97729
|
+
const hasLexicalArguments = resolver.hasNodeCheckFlag(node, 512 /* CaptureArguments */);
|
|
97406
97730
|
const captureLexicalArguments = hasLexicalArguments && !lexicalArgumentsBinding;
|
|
97407
97731
|
if (captureLexicalArguments) {
|
|
97408
97732
|
lexicalArgumentsBinding = factory2.createUniqueName("arguments");
|
|
@@ -97457,7 +97781,7 @@ function transformES2017(context) {
|
|
|
97457
97781
|
)
|
|
97458
97782
|
)
|
|
97459
97783
|
);
|
|
97460
|
-
const emitSuperHelpers = languageVersion >= 2 /* ES2015 */ && resolver.
|
|
97784
|
+
const emitSuperHelpers = languageVersion >= 2 /* ES2015 */ && (resolver.hasNodeCheckFlag(node, 256 /* MethodWithSuperPropertyAssignmentInAsync */) || resolver.hasNodeCheckFlag(node, 128 /* MethodWithSuperPropertyAccessInAsync */));
|
|
97461
97785
|
if (emitSuperHelpers) {
|
|
97462
97786
|
enableSubstitutionForAsyncMethodsWithSuper();
|
|
97463
97787
|
if (capturedSuperProperties.size) {
|
|
@@ -97476,9 +97800,9 @@ function transformES2017(context) {
|
|
|
97476
97800
|
);
|
|
97477
97801
|
setTextRange(block, node.body);
|
|
97478
97802
|
if (emitSuperHelpers && hasSuperElementAccess) {
|
|
97479
|
-
if (resolver.
|
|
97803
|
+
if (resolver.hasNodeCheckFlag(node, 256 /* MethodWithSuperPropertyAssignmentInAsync */)) {
|
|
97480
97804
|
addEmitHelper(block, advancedAsyncSuperHelper);
|
|
97481
|
-
} else if (resolver.
|
|
97805
|
+
} else if (resolver.hasNodeCheckFlag(node, 128 /* MethodWithSuperPropertyAccessInAsync */)) {
|
|
97482
97806
|
addEmitHelper(block, asyncSuperHelper);
|
|
97483
97807
|
}
|
|
97484
97808
|
}
|
|
@@ -97537,7 +97861,7 @@ function transformES2017(context) {
|
|
|
97537
97861
|
}
|
|
97538
97862
|
function onEmitNode(hint, node, emitCallback) {
|
|
97539
97863
|
if (enabledSubstitutions & 1 /* AsyncMethodsWithSuper */ && isSuperContainer(node)) {
|
|
97540
|
-
const superContainerFlags = resolver.
|
|
97864
|
+
const superContainerFlags = (resolver.hasNodeCheckFlag(node, 128 /* MethodWithSuperPropertyAccessInAsync */) ? 128 /* MethodWithSuperPropertyAccessInAsync */ : 0) | (resolver.hasNodeCheckFlag(node, 256 /* MethodWithSuperPropertyAssignmentInAsync */) ? 256 /* MethodWithSuperPropertyAssignmentInAsync */ : 0);
|
|
97541
97865
|
if (superContainerFlags !== enclosingSuperContainerFlags) {
|
|
97542
97866
|
const savedEnclosingSuperContainerFlags = enclosingSuperContainerFlags;
|
|
97543
97867
|
enclosingSuperContainerFlags = superContainerFlags;
|
|
@@ -97641,7 +97965,7 @@ function transformES2017(context) {
|
|
|
97641
97965
|
}
|
|
97642
97966
|
}
|
|
97643
97967
|
function createSuperAccessVariableStatement(factory2, resolver, node, names) {
|
|
97644
|
-
const hasBinding =
|
|
97968
|
+
const hasBinding = resolver.hasNodeCheckFlag(node, 256 /* MethodWithSuperPropertyAssignmentInAsync */);
|
|
97645
97969
|
const accessors = [];
|
|
97646
97970
|
names.forEach((_, key) => {
|
|
97647
97971
|
const name = unescapeLeadingUnderscores(key);
|
|
@@ -98736,7 +99060,7 @@ function transformES2018(context) {
|
|
|
98736
99060
|
!!(hierarchyFacts & 1 /* HasLexicalThis */)
|
|
98737
99061
|
)
|
|
98738
99062
|
);
|
|
98739
|
-
const emitSuperHelpers = languageVersion >= 2 /* ES2015 */ && resolver.
|
|
99063
|
+
const emitSuperHelpers = languageVersion >= 2 /* ES2015 */ && (resolver.hasNodeCheckFlag(node, 256 /* MethodWithSuperPropertyAssignmentInAsync */) || resolver.hasNodeCheckFlag(node, 128 /* MethodWithSuperPropertyAccessInAsync */));
|
|
98740
99064
|
if (emitSuperHelpers) {
|
|
98741
99065
|
enableSubstitutionForAsyncMethodsWithSuper();
|
|
98742
99066
|
const variableStatement = createSuperAccessVariableStatement(factory2, resolver, node, capturedSuperProperties);
|
|
@@ -98746,9 +99070,9 @@ function transformES2018(context) {
|
|
|
98746
99070
|
outerStatements.push(returnStatement);
|
|
98747
99071
|
const block = factory2.updateBlock(node.body, outerStatements);
|
|
98748
99072
|
if (emitSuperHelpers && hasSuperElementAccess) {
|
|
98749
|
-
if (resolver.
|
|
99073
|
+
if (resolver.hasNodeCheckFlag(node, 256 /* MethodWithSuperPropertyAssignmentInAsync */)) {
|
|
98750
99074
|
addEmitHelper(block, advancedAsyncSuperHelper);
|
|
98751
|
-
} else if (resolver.
|
|
99075
|
+
} else if (resolver.hasNodeCheckFlag(node, 128 /* MethodWithSuperPropertyAccessInAsync */)) {
|
|
98752
99076
|
addEmitHelper(block, asyncSuperHelper);
|
|
98753
99077
|
}
|
|
98754
99078
|
}
|
|
@@ -98881,7 +99205,7 @@ function transformES2018(context) {
|
|
|
98881
99205
|
}
|
|
98882
99206
|
function onEmitNode(hint, node, emitCallback) {
|
|
98883
99207
|
if (enabledSubstitutions & 1 /* AsyncMethodsWithSuper */ && isSuperContainer(node)) {
|
|
98884
|
-
const superContainerFlags = resolver.
|
|
99208
|
+
const superContainerFlags = (resolver.hasNodeCheckFlag(node, 128 /* MethodWithSuperPropertyAccessInAsync */) ? 128 /* MethodWithSuperPropertyAccessInAsync */ : 0) | (resolver.hasNodeCheckFlag(node, 256 /* MethodWithSuperPropertyAssignmentInAsync */) ? 256 /* MethodWithSuperPropertyAssignmentInAsync */ : 0);
|
|
98885
99209
|
if (superContainerFlags !== enclosingSuperContainerFlags) {
|
|
98886
99210
|
const savedEnclosingSuperContainerFlags = enclosingSuperContainerFlags;
|
|
98887
99211
|
enclosingSuperContainerFlags = superContainerFlags;
|
|
@@ -102586,9 +102910,8 @@ function transformES2015(context) {
|
|
|
102586
102910
|
return createRange(pos, end);
|
|
102587
102911
|
}
|
|
102588
102912
|
function shouldEmitExplicitInitializerForLetDeclaration(node) {
|
|
102589
|
-
const
|
|
102590
|
-
const
|
|
102591
|
-
const isDeclaredInLoop = flags & 32768 /* BlockScopedBindingInLoop */;
|
|
102913
|
+
const isCapturedInFunction = resolver.hasNodeCheckFlag(node, 16384 /* CapturedBlockScopedBinding */);
|
|
102914
|
+
const isDeclaredInLoop = resolver.hasNodeCheckFlag(node, 32768 /* BlockScopedBindingInLoop */);
|
|
102592
102915
|
const emittedAsTopLevel = (hierarchyFacts & 64 /* TopLevel */) !== 0 || isCapturedInFunction && isDeclaredInLoop && (hierarchyFacts & 512 /* IterationStatementBlock */) !== 0;
|
|
102593
102916
|
const emitExplicitInitializer = !emittedAsTopLevel && (hierarchyFacts & 4096 /* ForInOrForOfStatement */) === 0 && (!resolver.isDeclarationWithCollidingName(node) || isDeclaredInLoop && !isCapturedInFunction && (hierarchyFacts & (2048 /* ForStatement */ | 4096 /* ForInOrForOfStatement */)) === 0);
|
|
102594
102917
|
return emitExplicitInitializer;
|
|
@@ -103039,7 +103362,7 @@ function transformES2015(context) {
|
|
|
103039
103362
|
return factory2.inlineExpressions(expressions);
|
|
103040
103363
|
}
|
|
103041
103364
|
function shouldConvertPartOfIterationStatement(node) {
|
|
103042
|
-
return
|
|
103365
|
+
return resolver.hasNodeCheckFlag(node, 8192 /* ContainsCapturedBlockScopeBinding */);
|
|
103043
103366
|
}
|
|
103044
103367
|
function shouldConvertInitializerOfForStatement(node) {
|
|
103045
103368
|
return isForStatement(node) && !!node.initializer && shouldConvertPartOfIterationStatement(node.initializer);
|
|
@@ -103054,7 +103377,7 @@ function transformES2015(context) {
|
|
|
103054
103377
|
return shouldConvertBodyOfIterationStatement(node) || shouldConvertInitializerOfForStatement(node);
|
|
103055
103378
|
}
|
|
103056
103379
|
function shouldConvertBodyOfIterationStatement(node) {
|
|
103057
|
-
return
|
|
103380
|
+
return resolver.hasNodeCheckFlag(node, 4096 /* LoopWithCapturedBlockScopedBinding */);
|
|
103058
103381
|
}
|
|
103059
103382
|
function hoistVariableDeclarationDeclaredInConvertedLoop(state, node) {
|
|
103060
103383
|
if (!state.hoistedLocalVariables) {
|
|
@@ -103603,11 +103926,11 @@ function transformES2015(context) {
|
|
|
103603
103926
|
void 0,
|
|
103604
103927
|
name
|
|
103605
103928
|
));
|
|
103606
|
-
const
|
|
103607
|
-
if (
|
|
103929
|
+
const needsOutParam = resolver.hasNodeCheckFlag(decl, 65536 /* NeedsLoopOutParameter */);
|
|
103930
|
+
if (needsOutParam || hasCapturedBindingsInForHead) {
|
|
103608
103931
|
const outParamName = factory2.createUniqueName("out_" + idText(name));
|
|
103609
103932
|
let flags = 0 /* None */;
|
|
103610
|
-
if (
|
|
103933
|
+
if (needsOutParam) {
|
|
103611
103934
|
flags |= 1 /* Body */;
|
|
103612
103935
|
}
|
|
103613
103936
|
if (isForStatement(container)) {
|
|
@@ -112630,6 +112953,9 @@ function emitFiles(resolver, host, targetSourceFile, { scriptTransformers, decla
|
|
|
112630
112953
|
emitSkipped = true;
|
|
112631
112954
|
return;
|
|
112632
112955
|
}
|
|
112956
|
+
if (compilerOptions.noCheck) {
|
|
112957
|
+
(isSourceFile(sourceFileOrBundle) ? [sourceFileOrBundle] : filter(sourceFileOrBundle.sourceFiles, isSourceFileNotJson)).forEach(markLinkedReferences);
|
|
112958
|
+
}
|
|
112633
112959
|
const transform = transformNodes(
|
|
112634
112960
|
resolver,
|
|
112635
112961
|
host,
|
|
@@ -112764,6 +113090,13 @@ function emitFiles(resolver, host, targetSourceFile, { scriptTransformers, decla
|
|
|
112764
113090
|
}
|
|
112765
113091
|
forEachChild(node, collectLinkedAliases);
|
|
112766
113092
|
}
|
|
113093
|
+
function markLinkedReferences(file) {
|
|
113094
|
+
forEachChildRecursively(file, (n) => {
|
|
113095
|
+
if (isImportEqualsDeclaration(n) && !(getSyntacticModifierFlags(n) & 32 /* Export */)) return "skip";
|
|
113096
|
+
if (isImportDeclaration(n)) return "skip";
|
|
113097
|
+
resolver.markLinkedReferences(n);
|
|
113098
|
+
});
|
|
113099
|
+
}
|
|
112767
113100
|
function printSourceFileOrBundle(jsFilePath, sourceMapFilePath, transform, printer, mapOptions) {
|
|
112768
113101
|
const sourceFileOrBundle = transform.transformed[0];
|
|
112769
113102
|
const bundle = sourceFileOrBundle.kind === 308 /* Bundle */ ? sourceFileOrBundle : void 0;
|
|
@@ -112895,10 +113228,11 @@ var notImplementedResolver = {
|
|
|
112895
113228
|
isValueAliasDeclaration: notImplemented,
|
|
112896
113229
|
isReferencedAliasDeclaration: notImplemented,
|
|
112897
113230
|
isTopLevelValueImportEqualsWithEntityName: notImplemented,
|
|
112898
|
-
|
|
113231
|
+
hasNodeCheckFlag: notImplemented,
|
|
112899
113232
|
isDeclarationVisible: notImplemented,
|
|
112900
113233
|
isLateBound: (_node) => false,
|
|
112901
113234
|
collectLinkedAliases: notImplemented,
|
|
113235
|
+
markLinkedReferences: notImplemented,
|
|
112902
113236
|
isImplementationOfOverload: notImplemented,
|
|
112903
113237
|
requiresAddingImplicitUndefined: notImplemented,
|
|
112904
113238
|
isExpandoFunctionDeclaration: notImplemented,
|
|
@@ -120988,9 +121322,6 @@ function createProgram(rootNamesOrOptions, _options, _host, _oldProgram, _config
|
|
|
120988
121322
|
if (options.noEmit) {
|
|
120989
121323
|
createDiagnosticForOptionName(Diagnostics.Option_0_cannot_be_specified_with_option_1, "noCheck", "noEmit");
|
|
120990
121324
|
}
|
|
120991
|
-
if (!options.emitDeclarationOnly) {
|
|
120992
|
-
createDiagnosticForOptionName(Diagnostics.Option_0_cannot_be_specified_without_specifying_option_1, "noCheck", "emitDeclarationOnly");
|
|
120993
|
-
}
|
|
120994
121325
|
}
|
|
120995
121326
|
if (options.emitDecoratorMetadata && !options.experimentalDecorators) {
|
|
120996
121327
|
createDiagnosticForOptionName(Diagnostics.Option_0_cannot_be_specified_without_specifying_option_1, "emitDecoratorMetadata", "experimentalDecorators");
|