@typescript-deploys/pr-build 5.3.0-pr-56201-9 → 5.3.0-pr-56220-2
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 +525 -431
- package/lib/tsserver.js +854 -623
- package/lib/typescript.d.ts +26 -25
- package/lib/typescript.js +854 -623
- package/lib/typingsInstaller.js +118 -93
- package/package.json +3 -3
package/lib/typescript.js
CHANGED
|
@@ -35,7 +35,7 @@ var ts = (() => {
|
|
|
35
35
|
"src/compiler/corePublic.ts"() {
|
|
36
36
|
"use strict";
|
|
37
37
|
versionMajorMinor = "5.3";
|
|
38
|
-
version = `${versionMajorMinor}.0-insiders.
|
|
38
|
+
version = `${versionMajorMinor}.0-insiders.20231031`;
|
|
39
39
|
Comparison = /* @__PURE__ */ ((Comparison3) => {
|
|
40
40
|
Comparison3[Comparison3["LessThan"] = -1] = "LessThan";
|
|
41
41
|
Comparison3[Comparison3["EqualTo"] = 0] = "EqualTo";
|
|
@@ -3950,32 +3950,43 @@ ${lanes.join("\n")}
|
|
|
3950
3950
|
})(NodeFlags || {});
|
|
3951
3951
|
ModifierFlags = /* @__PURE__ */ ((ModifierFlags3) => {
|
|
3952
3952
|
ModifierFlags3[ModifierFlags3["None"] = 0] = "None";
|
|
3953
|
-
ModifierFlags3[ModifierFlags3["
|
|
3954
|
-
ModifierFlags3[ModifierFlags3["
|
|
3955
|
-
ModifierFlags3[ModifierFlags3["
|
|
3956
|
-
ModifierFlags3[ModifierFlags3["
|
|
3957
|
-
ModifierFlags3[ModifierFlags3["
|
|
3958
|
-
ModifierFlags3[ModifierFlags3["
|
|
3959
|
-
ModifierFlags3[ModifierFlags3["
|
|
3960
|
-
ModifierFlags3[ModifierFlags3["
|
|
3961
|
-
ModifierFlags3[ModifierFlags3["
|
|
3962
|
-
ModifierFlags3[ModifierFlags3["
|
|
3963
|
-
ModifierFlags3[ModifierFlags3["
|
|
3964
|
-
ModifierFlags3[ModifierFlags3["
|
|
3965
|
-
ModifierFlags3[ModifierFlags3["
|
|
3966
|
-
ModifierFlags3[ModifierFlags3["
|
|
3967
|
-
ModifierFlags3[ModifierFlags3["
|
|
3968
|
-
ModifierFlags3[ModifierFlags3["
|
|
3969
|
-
ModifierFlags3[ModifierFlags3["
|
|
3970
|
-
ModifierFlags3[ModifierFlags3["
|
|
3953
|
+
ModifierFlags3[ModifierFlags3["Public"] = 1] = "Public";
|
|
3954
|
+
ModifierFlags3[ModifierFlags3["Private"] = 2] = "Private";
|
|
3955
|
+
ModifierFlags3[ModifierFlags3["Protected"] = 4] = "Protected";
|
|
3956
|
+
ModifierFlags3[ModifierFlags3["Readonly"] = 8] = "Readonly";
|
|
3957
|
+
ModifierFlags3[ModifierFlags3["Override"] = 16] = "Override";
|
|
3958
|
+
ModifierFlags3[ModifierFlags3["Export"] = 32] = "Export";
|
|
3959
|
+
ModifierFlags3[ModifierFlags3["Abstract"] = 64] = "Abstract";
|
|
3960
|
+
ModifierFlags3[ModifierFlags3["Ambient"] = 128] = "Ambient";
|
|
3961
|
+
ModifierFlags3[ModifierFlags3["Static"] = 256] = "Static";
|
|
3962
|
+
ModifierFlags3[ModifierFlags3["Accessor"] = 512] = "Accessor";
|
|
3963
|
+
ModifierFlags3[ModifierFlags3["Async"] = 1024] = "Async";
|
|
3964
|
+
ModifierFlags3[ModifierFlags3["Default"] = 2048] = "Default";
|
|
3965
|
+
ModifierFlags3[ModifierFlags3["Const"] = 4096] = "Const";
|
|
3966
|
+
ModifierFlags3[ModifierFlags3["In"] = 8192] = "In";
|
|
3967
|
+
ModifierFlags3[ModifierFlags3["Out"] = 16384] = "Out";
|
|
3968
|
+
ModifierFlags3[ModifierFlags3["Decorator"] = 32768] = "Decorator";
|
|
3969
|
+
ModifierFlags3[ModifierFlags3["Deprecated"] = 65536] = "Deprecated";
|
|
3970
|
+
ModifierFlags3[ModifierFlags3["JSDocPublic"] = 8388608] = "JSDocPublic";
|
|
3971
|
+
ModifierFlags3[ModifierFlags3["JSDocPrivate"] = 16777216] = "JSDocPrivate";
|
|
3972
|
+
ModifierFlags3[ModifierFlags3["JSDocProtected"] = 33554432] = "JSDocProtected";
|
|
3973
|
+
ModifierFlags3[ModifierFlags3["JSDocReadonly"] = 67108864] = "JSDocReadonly";
|
|
3974
|
+
ModifierFlags3[ModifierFlags3["JSDocOverride"] = 134217728] = "JSDocOverride";
|
|
3975
|
+
ModifierFlags3[ModifierFlags3["SyntacticOrJSDocModifiers"] = 31] = "SyntacticOrJSDocModifiers";
|
|
3976
|
+
ModifierFlags3[ModifierFlags3["SyntacticOnlyModifiers"] = 65504] = "SyntacticOnlyModifiers";
|
|
3977
|
+
ModifierFlags3[ModifierFlags3["SyntacticModifiers"] = 65535] = "SyntacticModifiers";
|
|
3978
|
+
ModifierFlags3[ModifierFlags3["JSDocCacheOnlyModifiers"] = 260046848] = "JSDocCacheOnlyModifiers";
|
|
3979
|
+
ModifierFlags3[ModifierFlags3["JSDocOnlyModifiers"] = 65536 /* Deprecated */] = "JSDocOnlyModifiers";
|
|
3980
|
+
ModifierFlags3[ModifierFlags3["NonCacheOnlyModifiers"] = 131071] = "NonCacheOnlyModifiers";
|
|
3981
|
+
ModifierFlags3[ModifierFlags3["HasComputedJSDocModifiers"] = 268435456] = "HasComputedJSDocModifiers";
|
|
3971
3982
|
ModifierFlags3[ModifierFlags3["HasComputedFlags"] = 536870912] = "HasComputedFlags";
|
|
3972
|
-
ModifierFlags3[ModifierFlags3["AccessibilityModifier"] =
|
|
3973
|
-
ModifierFlags3[ModifierFlags3["ParameterPropertyModifier"] =
|
|
3974
|
-
ModifierFlags3[ModifierFlags3["NonPublicAccessibilityModifier"] =
|
|
3975
|
-
ModifierFlags3[ModifierFlags3["TypeScriptModifier"] =
|
|
3976
|
-
ModifierFlags3[ModifierFlags3["ExportDefault"] =
|
|
3977
|
-
ModifierFlags3[ModifierFlags3["All"] =
|
|
3978
|
-
ModifierFlags3[ModifierFlags3["Modifier"] =
|
|
3983
|
+
ModifierFlags3[ModifierFlags3["AccessibilityModifier"] = 7] = "AccessibilityModifier";
|
|
3984
|
+
ModifierFlags3[ModifierFlags3["ParameterPropertyModifier"] = 31] = "ParameterPropertyModifier";
|
|
3985
|
+
ModifierFlags3[ModifierFlags3["NonPublicAccessibilityModifier"] = 6] = "NonPublicAccessibilityModifier";
|
|
3986
|
+
ModifierFlags3[ModifierFlags3["TypeScriptModifier"] = 28895] = "TypeScriptModifier";
|
|
3987
|
+
ModifierFlags3[ModifierFlags3["ExportDefault"] = 2080] = "ExportDefault";
|
|
3988
|
+
ModifierFlags3[ModifierFlags3["All"] = 131071] = "All";
|
|
3989
|
+
ModifierFlags3[ModifierFlags3["Modifier"] = 98303] = "Modifier";
|
|
3979
3990
|
return ModifierFlags3;
|
|
3980
3991
|
})(ModifierFlags || {});
|
|
3981
3992
|
JsxFlags = /* @__PURE__ */ ((JsxFlags2) => {
|
|
@@ -7943,7 +7954,7 @@ ${lanes.join("\n")}
|
|
|
7943
7954
|
Import_assertion_values_must_be_string_literal_expressions: diag(2837, 1 /* Error */, "Import_assertion_values_must_be_string_literal_expressions_2837", "Import assertion values must be string literal expressions."),
|
|
7944
7955
|
All_declarations_of_0_must_have_identical_constraints: diag(2838, 1 /* Error */, "All_declarations_of_0_must_have_identical_constraints_2838", "All declarations of '{0}' must have identical constraints."),
|
|
7945
7956
|
This_condition_will_always_return_0_since_JavaScript_compares_objects_by_reference_not_value: diag(2839, 1 /* Error */, "This_condition_will_always_return_0_since_JavaScript_compares_objects_by_reference_not_value_2839", "This condition will always return '{0}' since JavaScript compares objects by reference, not value."),
|
|
7946
|
-
|
|
7957
|
+
An_interface_cannot_extend_a_primitive_type_like_0_It_can_only_extend_other_named_object_types: diag(2840, 1 /* Error */, "An_interface_cannot_extend_a_primitive_type_like_0_It_can_only_extend_other_named_object_types_2840", "An interface cannot extend a primitive type like '{0}'. It can only extend other named object types."),
|
|
7947
7958
|
_0_is_an_unused_renaming_of_1_Did_you_intend_to_use_it_as_a_type_annotation: diag(2842, 1 /* Error */, "_0_is_an_unused_renaming_of_1_Did_you_intend_to_use_it_as_a_type_annotation_2842", "'{0}' is an unused renaming of '{1}'. Did you intend to use it as a type annotation?"),
|
|
7948
7959
|
We_can_only_write_a_type_for_0_by_adding_a_type_for_the_entire_parameter_here: diag(2843, 1 /* Error */, "We_can_only_write_a_type_for_0_by_adding_a_type_for_the_entire_parameter_here_2843", "We can only write a type for '{0}' by adding a type for the entire parameter here."),
|
|
7949
7960
|
Type_of_instance_member_variable_0_cannot_reference_identifier_1_declared_in_the_constructor: diag(2844, 1 /* Error */, "Type_of_instance_member_variable_0_cannot_reference_identifier_1_declared_in_the_constructor_2844", "Type of instance member variable '{0}' cannot reference identifier '{1}' declared in the constructor."),
|
|
@@ -7964,6 +7975,8 @@ ${lanes.join("\n")}
|
|
|
7964
7975
|
The_left_hand_side_of_an_instanceof_expression_must_be_assignable_to_the_first_argument_of_the_right_hand_side_s_Symbol_hasInstance_method: diag(2860, 1 /* Error */, "The_left_hand_side_of_an_instanceof_expression_must_be_assignable_to_the_first_argument_of_the_right_2860", "The left-hand side of an 'instanceof' expression must be assignable to the first argument of the right-hand side's '[Symbol.hasInstance]' method."),
|
|
7965
7976
|
An_object_s_Symbol_hasInstance_method_must_return_a_boolean_value_for_it_to_be_used_on_the_right_hand_side_of_an_instanceof_expression: diag(2861, 1 /* Error */, "An_object_s_Symbol_hasInstance_method_must_return_a_boolean_value_for_it_to_be_used_on_the_right_han_2861", "An object's '[Symbol.hasInstance]' method must return a boolean value for it to be used on the right-hand side of an 'instanceof' expression."),
|
|
7966
7977
|
Type_0_is_generic_and_can_only_be_indexed_for_reading: diag(2862, 1 /* Error */, "Type_0_is_generic_and_can_only_be_indexed_for_reading_2862", "Type '{0}' is generic and can only be indexed for reading."),
|
|
7978
|
+
A_class_cannot_extend_a_primitive_type_like_0_Classes_can_only_extend_constructable_values: diag(2863, 1 /* Error */, "A_class_cannot_extend_a_primitive_type_like_0_Classes_can_only_extend_constructable_values_2863", "A class cannot extend a primitive type like '{0}'. Classes can only extend constructable values."),
|
|
7979
|
+
A_class_cannot_implement_a_primitive_type_like_0_It_can_only_implement_other_named_object_types: diag(2864, 1 /* Error */, "A_class_cannot_implement_a_primitive_type_like_0_It_can_only_implement_other_named_object_types_2864", "A class cannot implement a primitive type like '{0}'. It can only implement other named object types."),
|
|
7967
7980
|
Import_declaration_0_is_using_private_name_1: diag(4e3, 1 /* Error */, "Import_declaration_0_is_using_private_name_1_4000", "Import declaration '{0}' is using private name '{1}'."),
|
|
7968
7981
|
Type_parameter_0_of_exported_class_has_or_is_using_private_name_1: diag(4002, 1 /* Error */, "Type_parameter_0_of_exported_class_has_or_is_using_private_name_1_4002", "Type parameter '{0}' of exported class has or is using private name '{1}'."),
|
|
7969
7982
|
Type_parameter_0_of_exported_interface_has_or_is_using_private_name_1: diag(4004, 1 /* Error */, "Type_parameter_0_of_exported_interface_has_or_is_using_private_name_1_4004", "Type parameter '{0}' of exported interface has or is using private name '{1}'."),
|
|
@@ -11476,7 +11489,7 @@ ${lanes.join("\n")}
|
|
|
11476
11489
|
}
|
|
11477
11490
|
}
|
|
11478
11491
|
function isParameterPropertyDeclaration(node, parent2) {
|
|
11479
|
-
return isParameter(node) && hasSyntacticModifier(node,
|
|
11492
|
+
return isParameter(node) && hasSyntacticModifier(node, 31 /* ParameterPropertyModifier */) && parent2.kind === 176 /* Constructor */;
|
|
11480
11493
|
}
|
|
11481
11494
|
function isEmptyBindingPattern(node) {
|
|
11482
11495
|
if (isBindingPattern(node)) {
|
|
@@ -11765,7 +11778,7 @@ ${lanes.join("\n")}
|
|
|
11765
11778
|
}
|
|
11766
11779
|
}
|
|
11767
11780
|
function getModifiers(node) {
|
|
11768
|
-
if (hasSyntacticModifier(node,
|
|
11781
|
+
if (hasSyntacticModifier(node, 98303 /* Modifier */)) {
|
|
11769
11782
|
return filter(node.modifiers, isModifier);
|
|
11770
11783
|
}
|
|
11771
11784
|
}
|
|
@@ -12199,7 +12212,7 @@ ${lanes.join("\n")}
|
|
|
12199
12212
|
return false;
|
|
12200
12213
|
}
|
|
12201
12214
|
function isParameterPropertyModifier(kind) {
|
|
12202
|
-
return !!(modifierToFlag(kind) &
|
|
12215
|
+
return !!(modifierToFlag(kind) & 31 /* ParameterPropertyModifier */);
|
|
12203
12216
|
}
|
|
12204
12217
|
function isClassMemberModifier(idToken) {
|
|
12205
12218
|
return isParameterPropertyModifier(idToken) || idToken === 126 /* StaticKeyword */ || idToken === 164 /* OverrideKeyword */ || idToken === 129 /* AccessorKeyword */;
|
|
@@ -12563,10 +12576,10 @@ ${lanes.join("\n")}
|
|
|
12563
12576
|
return some(statements, isScopeMarker);
|
|
12564
12577
|
}
|
|
12565
12578
|
function needsScopeMarker(result) {
|
|
12566
|
-
return !isAnyImportOrReExport(result) && !isExportAssignment(result) && !hasSyntacticModifier(result,
|
|
12579
|
+
return !isAnyImportOrReExport(result) && !isExportAssignment(result) && !hasSyntacticModifier(result, 32 /* Export */) && !isAmbientModule(result);
|
|
12567
12580
|
}
|
|
12568
12581
|
function isExternalModuleIndicator(result) {
|
|
12569
|
-
return isAnyImportOrReExport(result) || isExportAssignment(result) || hasSyntacticModifier(result,
|
|
12582
|
+
return isAnyImportOrReExport(result) || isExportAssignment(result) || hasSyntacticModifier(result, 32 /* Export */);
|
|
12570
12583
|
}
|
|
12571
12584
|
function isForInOrOfStatement(node) {
|
|
12572
12585
|
return node.kind === 249 /* ForInStatement */ || node.kind === 250 /* ForOfStatement */;
|
|
@@ -13442,7 +13455,7 @@ ${lanes.join("\n")}
|
|
|
13442
13455
|
return false;
|
|
13443
13456
|
}
|
|
13444
13457
|
function isAmbientPropertyDeclaration(node) {
|
|
13445
|
-
return !!(node.flags & 33554432 /* Ambient */) || hasSyntacticModifier(node,
|
|
13458
|
+
return !!(node.flags & 33554432 /* Ambient */) || hasSyntacticModifier(node, 128 /* Ambient */);
|
|
13446
13459
|
}
|
|
13447
13460
|
function isBlockScope(node, parentNode) {
|
|
13448
13461
|
switch (node.kind) {
|
|
@@ -13795,10 +13808,10 @@ ${lanes.join("\n")}
|
|
|
13795
13808
|
return file.scriptKind === 6 /* JSON */;
|
|
13796
13809
|
}
|
|
13797
13810
|
function isEnumConst(node) {
|
|
13798
|
-
return !!(getCombinedModifierFlags(node) &
|
|
13811
|
+
return !!(getCombinedModifierFlags(node) & 4096 /* Const */);
|
|
13799
13812
|
}
|
|
13800
13813
|
function isDeclarationReadonly(declaration) {
|
|
13801
|
-
return !!(getCombinedModifierFlags(declaration) &
|
|
13814
|
+
return !!(getCombinedModifierFlags(declaration) & 8 /* Readonly */ && !isParameterPropertyDeclaration(declaration, declaration.parent));
|
|
13802
13815
|
}
|
|
13803
13816
|
function isVarAwaitUsing(node) {
|
|
13804
13817
|
return (getCombinedNodeFlags(node) & 7 /* BlockScoped */) === 6 /* AwaitUsing */;
|
|
@@ -15527,7 +15540,7 @@ ${lanes.join("\n")}
|
|
|
15527
15540
|
flags |= 1 /* Generator */;
|
|
15528
15541
|
}
|
|
15529
15542
|
case 219 /* ArrowFunction */:
|
|
15530
|
-
if (hasSyntacticModifier(node,
|
|
15543
|
+
if (hasSyntacticModifier(node, 1024 /* Async */)) {
|
|
15531
15544
|
flags |= 2 /* Async */;
|
|
15532
15545
|
}
|
|
15533
15546
|
break;
|
|
@@ -15543,7 +15556,7 @@ ${lanes.join("\n")}
|
|
|
15543
15556
|
case 218 /* FunctionExpression */:
|
|
15544
15557
|
case 219 /* ArrowFunction */:
|
|
15545
15558
|
case 174 /* MethodDeclaration */:
|
|
15546
|
-
return node.body !== void 0 && node.asteriskToken === void 0 && hasSyntacticModifier(node,
|
|
15559
|
+
return node.body !== void 0 && node.asteriskToken === void 0 && hasSyntacticModifier(node, 1024 /* Async */);
|
|
15547
15560
|
}
|
|
15548
15561
|
return false;
|
|
15549
15562
|
}
|
|
@@ -16642,25 +16655,25 @@ ${lanes.join("\n")}
|
|
|
16642
16655
|
return isClassElement(node) && hasStaticModifier(node) || isClassStaticBlockDeclaration(node);
|
|
16643
16656
|
}
|
|
16644
16657
|
function hasStaticModifier(node) {
|
|
16645
|
-
return hasSyntacticModifier(node,
|
|
16658
|
+
return hasSyntacticModifier(node, 256 /* Static */);
|
|
16646
16659
|
}
|
|
16647
16660
|
function hasOverrideModifier(node) {
|
|
16648
|
-
return hasEffectiveModifier(node,
|
|
16661
|
+
return hasEffectiveModifier(node, 16 /* Override */);
|
|
16649
16662
|
}
|
|
16650
16663
|
function hasAbstractModifier(node) {
|
|
16651
|
-
return hasSyntacticModifier(node,
|
|
16664
|
+
return hasSyntacticModifier(node, 64 /* Abstract */);
|
|
16652
16665
|
}
|
|
16653
16666
|
function hasAmbientModifier(node) {
|
|
16654
|
-
return hasSyntacticModifier(node,
|
|
16667
|
+
return hasSyntacticModifier(node, 128 /* Ambient */);
|
|
16655
16668
|
}
|
|
16656
16669
|
function hasAccessorModifier(node) {
|
|
16657
|
-
return hasSyntacticModifier(node,
|
|
16670
|
+
return hasSyntacticModifier(node, 512 /* Accessor */);
|
|
16658
16671
|
}
|
|
16659
16672
|
function hasEffectiveReadonlyModifier(node) {
|
|
16660
|
-
return hasEffectiveModifier(node,
|
|
16673
|
+
return hasEffectiveModifier(node, 8 /* Readonly */);
|
|
16661
16674
|
}
|
|
16662
16675
|
function hasDecorators(node) {
|
|
16663
|
-
return hasSyntacticModifier(node,
|
|
16676
|
+
return hasSyntacticModifier(node, 32768 /* Decorator */);
|
|
16664
16677
|
}
|
|
16665
16678
|
function getSelectedEffectiveModifierFlags(node, flags) {
|
|
16666
16679
|
return getEffectiveModifierFlags(node) & flags;
|
|
@@ -16675,10 +16688,13 @@ ${lanes.join("\n")}
|
|
|
16675
16688
|
if (!(node.modifierFlagsCache & 536870912 /* HasComputedFlags */)) {
|
|
16676
16689
|
node.modifierFlagsCache = getSyntacticModifierFlagsNoCache(node) | 536870912 /* HasComputedFlags */;
|
|
16677
16690
|
}
|
|
16678
|
-
if (
|
|
16679
|
-
node.modifierFlagsCache
|
|
16691
|
+
if (alwaysIncludeJSDoc || includeJSDoc && isInJSFile(node)) {
|
|
16692
|
+
if (!(node.modifierFlagsCache & 268435456 /* HasComputedJSDocModifiers */) && node.parent) {
|
|
16693
|
+
node.modifierFlagsCache |= getRawJSDocModifierFlagsNoCache(node) | 268435456 /* HasComputedJSDocModifiers */;
|
|
16694
|
+
}
|
|
16695
|
+
return selectEffectiveModifierFlags(node.modifierFlagsCache);
|
|
16680
16696
|
}
|
|
16681
|
-
return node.modifierFlagsCache
|
|
16697
|
+
return selectSyntacticModifierFlags(node.modifierFlagsCache);
|
|
16682
16698
|
}
|
|
16683
16699
|
function getEffectiveModifierFlags(node) {
|
|
16684
16700
|
return getModifierFlagsWorker(
|
|
@@ -16703,33 +16719,42 @@ ${lanes.join("\n")}
|
|
|
16703
16719
|
false
|
|
16704
16720
|
);
|
|
16705
16721
|
}
|
|
16706
|
-
function
|
|
16722
|
+
function getRawJSDocModifierFlagsNoCache(node) {
|
|
16707
16723
|
let flags = 0 /* None */;
|
|
16708
16724
|
if (!!node.parent && !isParameter(node)) {
|
|
16709
16725
|
if (isInJSFile(node)) {
|
|
16710
16726
|
if (getJSDocPublicTagNoCache(node))
|
|
16711
|
-
flags |=
|
|
16727
|
+
flags |= 8388608 /* JSDocPublic */;
|
|
16712
16728
|
if (getJSDocPrivateTagNoCache(node))
|
|
16713
|
-
flags |=
|
|
16729
|
+
flags |= 16777216 /* JSDocPrivate */;
|
|
16714
16730
|
if (getJSDocProtectedTagNoCache(node))
|
|
16715
|
-
flags |=
|
|
16731
|
+
flags |= 33554432 /* JSDocProtected */;
|
|
16716
16732
|
if (getJSDocReadonlyTagNoCache(node))
|
|
16717
|
-
flags |=
|
|
16733
|
+
flags |= 67108864 /* JSDocReadonly */;
|
|
16718
16734
|
if (getJSDocOverrideTagNoCache(node))
|
|
16719
|
-
flags |=
|
|
16735
|
+
flags |= 134217728 /* JSDocOverride */;
|
|
16720
16736
|
}
|
|
16721
16737
|
if (getJSDocDeprecatedTagNoCache(node))
|
|
16722
|
-
flags |=
|
|
16738
|
+
flags |= 65536 /* Deprecated */;
|
|
16723
16739
|
}
|
|
16724
16740
|
return flags;
|
|
16725
16741
|
}
|
|
16742
|
+
function selectSyntacticModifierFlags(flags) {
|
|
16743
|
+
return flags & 65535 /* SyntacticModifiers */;
|
|
16744
|
+
}
|
|
16745
|
+
function selectEffectiveModifierFlags(flags) {
|
|
16746
|
+
return flags & 131071 /* NonCacheOnlyModifiers */ | (flags & 260046848 /* JSDocCacheOnlyModifiers */) >>> 23;
|
|
16747
|
+
}
|
|
16748
|
+
function getJSDocModifierFlagsNoCache(node) {
|
|
16749
|
+
return selectEffectiveModifierFlags(getRawJSDocModifierFlagsNoCache(node));
|
|
16750
|
+
}
|
|
16726
16751
|
function getEffectiveModifierFlagsNoCache(node) {
|
|
16727
16752
|
return getSyntacticModifierFlagsNoCache(node) | getJSDocModifierFlagsNoCache(node);
|
|
16728
16753
|
}
|
|
16729
16754
|
function getSyntacticModifierFlagsNoCache(node) {
|
|
16730
16755
|
let flags = canHaveModifiers(node) ? modifiersToFlags(node.modifiers) : 0 /* None */;
|
|
16731
16756
|
if (node.flags & 8 /* NestedNamespace */ || node.kind === 80 /* Identifier */ && node.flags & 4096 /* IdentifierIsInJSDocNamespace */) {
|
|
16732
|
-
flags |=
|
|
16757
|
+
flags |= 32 /* Export */;
|
|
16733
16758
|
}
|
|
16734
16759
|
return flags;
|
|
16735
16760
|
}
|
|
@@ -16745,37 +16770,37 @@ ${lanes.join("\n")}
|
|
|
16745
16770
|
function modifierToFlag(token) {
|
|
16746
16771
|
switch (token) {
|
|
16747
16772
|
case 126 /* StaticKeyword */:
|
|
16748
|
-
return
|
|
16773
|
+
return 256 /* Static */;
|
|
16749
16774
|
case 125 /* PublicKeyword */:
|
|
16750
|
-
return
|
|
16775
|
+
return 1 /* Public */;
|
|
16751
16776
|
case 124 /* ProtectedKeyword */:
|
|
16752
|
-
return
|
|
16777
|
+
return 4 /* Protected */;
|
|
16753
16778
|
case 123 /* PrivateKeyword */:
|
|
16754
|
-
return
|
|
16779
|
+
return 2 /* Private */;
|
|
16755
16780
|
case 128 /* AbstractKeyword */:
|
|
16756
|
-
return
|
|
16781
|
+
return 64 /* Abstract */;
|
|
16757
16782
|
case 129 /* AccessorKeyword */:
|
|
16758
|
-
return
|
|
16783
|
+
return 512 /* Accessor */;
|
|
16759
16784
|
case 95 /* ExportKeyword */:
|
|
16760
|
-
return
|
|
16785
|
+
return 32 /* Export */;
|
|
16761
16786
|
case 138 /* DeclareKeyword */:
|
|
16762
|
-
return
|
|
16787
|
+
return 128 /* Ambient */;
|
|
16763
16788
|
case 87 /* ConstKeyword */:
|
|
16764
|
-
return
|
|
16789
|
+
return 4096 /* Const */;
|
|
16765
16790
|
case 90 /* DefaultKeyword */:
|
|
16766
|
-
return
|
|
16791
|
+
return 2048 /* Default */;
|
|
16767
16792
|
case 134 /* AsyncKeyword */:
|
|
16768
|
-
return
|
|
16793
|
+
return 1024 /* Async */;
|
|
16769
16794
|
case 148 /* ReadonlyKeyword */:
|
|
16770
|
-
return
|
|
16795
|
+
return 8 /* Readonly */;
|
|
16771
16796
|
case 164 /* OverrideKeyword */:
|
|
16772
|
-
return
|
|
16797
|
+
return 16 /* Override */;
|
|
16773
16798
|
case 103 /* InKeyword */:
|
|
16774
|
-
return
|
|
16799
|
+
return 8192 /* In */;
|
|
16775
16800
|
case 147 /* OutKeyword */:
|
|
16776
|
-
return
|
|
16801
|
+
return 16384 /* Out */;
|
|
16777
16802
|
case 170 /* Decorator */:
|
|
16778
|
-
return
|
|
16803
|
+
return 32768 /* Decorator */;
|
|
16779
16804
|
}
|
|
16780
16805
|
return 0 /* None */;
|
|
16781
16806
|
}
|
|
@@ -16915,7 +16940,7 @@ ${lanes.join("\n")}
|
|
|
16915
16940
|
return void 0;
|
|
16916
16941
|
}
|
|
16917
16942
|
function isExportDefaultSymbol(symbol) {
|
|
16918
|
-
return symbol && length(symbol.declarations) > 0 && hasSyntacticModifier(symbol.declarations[0],
|
|
16943
|
+
return symbol && length(symbol.declarations) > 0 && hasSyntacticModifier(symbol.declarations[0], 2048 /* Default */);
|
|
16919
16944
|
}
|
|
16920
16945
|
function tryExtractTSExtension(fileName) {
|
|
16921
16946
|
return find(supportedTSExtensionsForExtractExtension, (extension) => fileExtensionIs(fileName, extension));
|
|
@@ -17195,16 +17220,16 @@ ${lanes.join("\n")}
|
|
|
17195
17220
|
if (s.valueDeclaration) {
|
|
17196
17221
|
const declaration = isWrite && s.declarations && find(s.declarations, isSetAccessorDeclaration) || s.flags & 32768 /* GetAccessor */ && find(s.declarations, isGetAccessorDeclaration) || s.valueDeclaration;
|
|
17197
17222
|
const flags = getCombinedModifierFlags(declaration);
|
|
17198
|
-
return s.parent && s.parent.flags & 32 /* Class */ ? flags : flags & ~
|
|
17223
|
+
return s.parent && s.parent.flags & 32 /* Class */ ? flags : flags & ~7 /* AccessibilityModifier */;
|
|
17199
17224
|
}
|
|
17200
17225
|
if (getCheckFlags(s) & 6 /* Synthetic */) {
|
|
17201
17226
|
const checkFlags = s.links.checkFlags;
|
|
17202
|
-
const accessModifier = checkFlags & 1024 /* ContainsPrivate */ ?
|
|
17203
|
-
const staticModifier = checkFlags & 2048 /* ContainsStatic */ ?
|
|
17227
|
+
const accessModifier = checkFlags & 1024 /* ContainsPrivate */ ? 2 /* Private */ : checkFlags & 256 /* ContainsPublic */ ? 1 /* Public */ : 4 /* Protected */;
|
|
17228
|
+
const staticModifier = checkFlags & 2048 /* ContainsStatic */ ? 256 /* Static */ : 0;
|
|
17204
17229
|
return accessModifier | staticModifier;
|
|
17205
17230
|
}
|
|
17206
17231
|
if (s.flags & 4194304 /* Prototype */) {
|
|
17207
|
-
return
|
|
17232
|
+
return 1 /* Public */ | 256 /* Static */;
|
|
17208
17233
|
}
|
|
17209
17234
|
return 0;
|
|
17210
17235
|
}
|
|
@@ -17303,7 +17328,7 @@ ${lanes.join("\n")}
|
|
|
17303
17328
|
function isAbstractConstructorSymbol(symbol) {
|
|
17304
17329
|
if (symbol.flags & 32 /* Class */) {
|
|
17305
17330
|
const declaration = getClassLikeDeclarationOfSymbol(symbol);
|
|
17306
|
-
return !!declaration && hasSyntacticModifier(declaration,
|
|
17331
|
+
return !!declaration && hasSyntacticModifier(declaration, 64 /* Abstract */);
|
|
17307
17332
|
}
|
|
17308
17333
|
return false;
|
|
17309
17334
|
}
|
|
@@ -18523,7 +18548,7 @@ ${lanes.join("\n")}
|
|
|
18523
18548
|
if (node.kind !== 167 /* ComputedPropertyName */) {
|
|
18524
18549
|
return false;
|
|
18525
18550
|
}
|
|
18526
|
-
if (hasSyntacticModifier(node.parent,
|
|
18551
|
+
if (hasSyntacticModifier(node.parent, 64 /* Abstract */)) {
|
|
18527
18552
|
return true;
|
|
18528
18553
|
}
|
|
18529
18554
|
const containerKind = node.parent.parent.kind;
|
|
@@ -21106,35 +21131,35 @@ ${lanes.join("\n")}
|
|
|
21106
21131
|
}
|
|
21107
21132
|
function createModifiersFromModifierFlags(flags2) {
|
|
21108
21133
|
const result = [];
|
|
21109
|
-
if (flags2 &
|
|
21134
|
+
if (flags2 & 32 /* Export */)
|
|
21110
21135
|
result.push(createModifier(95 /* ExportKeyword */));
|
|
21111
|
-
if (flags2 &
|
|
21136
|
+
if (flags2 & 128 /* Ambient */)
|
|
21112
21137
|
result.push(createModifier(138 /* DeclareKeyword */));
|
|
21113
|
-
if (flags2 &
|
|
21138
|
+
if (flags2 & 2048 /* Default */)
|
|
21114
21139
|
result.push(createModifier(90 /* DefaultKeyword */));
|
|
21115
|
-
if (flags2 &
|
|
21140
|
+
if (flags2 & 4096 /* Const */)
|
|
21116
21141
|
result.push(createModifier(87 /* ConstKeyword */));
|
|
21117
|
-
if (flags2 &
|
|
21142
|
+
if (flags2 & 1 /* Public */)
|
|
21118
21143
|
result.push(createModifier(125 /* PublicKeyword */));
|
|
21119
|
-
if (flags2 &
|
|
21144
|
+
if (flags2 & 2 /* Private */)
|
|
21120
21145
|
result.push(createModifier(123 /* PrivateKeyword */));
|
|
21121
|
-
if (flags2 &
|
|
21146
|
+
if (flags2 & 4 /* Protected */)
|
|
21122
21147
|
result.push(createModifier(124 /* ProtectedKeyword */));
|
|
21123
|
-
if (flags2 &
|
|
21148
|
+
if (flags2 & 64 /* Abstract */)
|
|
21124
21149
|
result.push(createModifier(128 /* AbstractKeyword */));
|
|
21125
|
-
if (flags2 &
|
|
21150
|
+
if (flags2 & 256 /* Static */)
|
|
21126
21151
|
result.push(createModifier(126 /* StaticKeyword */));
|
|
21127
|
-
if (flags2 &
|
|
21152
|
+
if (flags2 & 16 /* Override */)
|
|
21128
21153
|
result.push(createModifier(164 /* OverrideKeyword */));
|
|
21129
|
-
if (flags2 &
|
|
21154
|
+
if (flags2 & 8 /* Readonly */)
|
|
21130
21155
|
result.push(createModifier(148 /* ReadonlyKeyword */));
|
|
21131
|
-
if (flags2 &
|
|
21156
|
+
if (flags2 & 512 /* Accessor */)
|
|
21132
21157
|
result.push(createModifier(129 /* AccessorKeyword */));
|
|
21133
|
-
if (flags2 &
|
|
21158
|
+
if (flags2 & 1024 /* Async */)
|
|
21134
21159
|
result.push(createModifier(134 /* AsyncKeyword */));
|
|
21135
|
-
if (flags2 &
|
|
21160
|
+
if (flags2 & 8192 /* In */)
|
|
21136
21161
|
result.push(createModifier(103 /* InKeyword */));
|
|
21137
|
-
if (flags2 &
|
|
21162
|
+
if (flags2 & 16384 /* Out */)
|
|
21138
21163
|
result.push(createModifier(147 /* OutKeyword */));
|
|
21139
21164
|
return result.length ? result : void 0;
|
|
21140
21165
|
}
|
|
@@ -21183,7 +21208,7 @@ ${lanes.join("\n")}
|
|
|
21183
21208
|
if (isThisIdentifier(node.name)) {
|
|
21184
21209
|
node.transformFlags = 1 /* ContainsTypeScript */;
|
|
21185
21210
|
} else {
|
|
21186
|
-
node.transformFlags = propagateChildrenFlags(node.modifiers) | propagateChildFlags(node.dotDotDotToken) | propagateNameFlags(node.name) | propagateChildFlags(node.questionToken) | propagateChildFlags(node.initializer) | (node.questionToken ?? node.type ? 1 /* ContainsTypeScript */ : 0 /* None */) | (node.dotDotDotToken ?? node.initializer ? 1024 /* ContainsES2015 */ : 0 /* None */) | (modifiersToFlags(node.modifiers) &
|
|
21211
|
+
node.transformFlags = propagateChildrenFlags(node.modifiers) | propagateChildFlags(node.dotDotDotToken) | propagateNameFlags(node.name) | propagateChildFlags(node.questionToken) | propagateChildFlags(node.initializer) | (node.questionToken ?? node.type ? 1 /* ContainsTypeScript */ : 0 /* None */) | (node.dotDotDotToken ?? node.initializer ? 1024 /* ContainsES2015 */ : 0 /* None */) | (modifiersToFlags(node.modifiers) & 31 /* ParameterPropertyModifier */ ? 8192 /* ContainsTypeScriptClassSyntax */ : 0 /* None */);
|
|
21187
21212
|
}
|
|
21188
21213
|
node.jsDoc = void 0;
|
|
21189
21214
|
return node;
|
|
@@ -21232,8 +21257,8 @@ ${lanes.join("\n")}
|
|
|
21232
21257
|
node.exclamationToken = questionOrExclamationToken && isExclamationToken(questionOrExclamationToken) ? questionOrExclamationToken : void 0;
|
|
21233
21258
|
node.type = type;
|
|
21234
21259
|
node.initializer = asInitializer(initializer);
|
|
21235
|
-
const isAmbient = node.flags & 33554432 /* Ambient */ || modifiersToFlags(node.modifiers) &
|
|
21236
|
-
node.transformFlags = propagateChildrenFlags(node.modifiers) | propagateNameFlags(node.name) | propagateChildFlags(node.initializer) | (isAmbient || node.questionToken || node.exclamationToken || node.type ? 1 /* ContainsTypeScript */ : 0 /* None */) | (isComputedPropertyName(node.name) || modifiersToFlags(node.modifiers) &
|
|
21260
|
+
const isAmbient = node.flags & 33554432 /* Ambient */ || modifiersToFlags(node.modifiers) & 128 /* Ambient */;
|
|
21261
|
+
node.transformFlags = propagateChildrenFlags(node.modifiers) | propagateNameFlags(node.name) | propagateChildFlags(node.initializer) | (isAmbient || node.questionToken || node.exclamationToken || node.type ? 1 /* ContainsTypeScript */ : 0 /* None */) | (isComputedPropertyName(node.name) || modifiersToFlags(node.modifiers) & 256 /* Static */ && node.initializer ? 8192 /* ContainsTypeScriptClassSyntax */ : 0 /* None */) | 16777216 /* ContainsClassFields */;
|
|
21237
21262
|
node.jsDoc = void 0;
|
|
21238
21263
|
return node;
|
|
21239
21264
|
}
|
|
@@ -21272,7 +21297,7 @@ ${lanes.join("\n")}
|
|
|
21272
21297
|
if (!node.body) {
|
|
21273
21298
|
node.transformFlags = 1 /* ContainsTypeScript */;
|
|
21274
21299
|
} else {
|
|
21275
|
-
const isAsync = modifiersToFlags(node.modifiers) &
|
|
21300
|
+
const isAsync = modifiersToFlags(node.modifiers) & 1024 /* Async */;
|
|
21276
21301
|
const isGenerator = !!node.asteriskToken;
|
|
21277
21302
|
const isAsyncGenerator = isAsync && isGenerator;
|
|
21278
21303
|
node.transformFlags = propagateChildrenFlags(node.modifiers) | propagateChildFlags(node.asteriskToken) | propagateNameFlags(node.name) | propagateChildFlags(node.questionToken) | propagateChildrenFlags(node.typeParameters) | propagateChildrenFlags(node.parameters) | propagateChildFlags(node.type) | propagateChildFlags(node.body) & ~67108864 /* ContainsPossibleTopLevelAwait */ | (isAsyncGenerator ? 128 /* ContainsES2018 */ : isAsync ? 256 /* ContainsES2017 */ : isGenerator ? 2048 /* ContainsGenerator */ : 0 /* None */) | (node.questionToken || node.typeParameters || node.type ? 1 /* ContainsTypeScript */ : 0 /* None */) | 1024 /* ContainsES2015 */;
|
|
@@ -22015,7 +22040,7 @@ ${lanes.join("\n")}
|
|
|
22015
22040
|
node.parameters = createNodeArray(parameters);
|
|
22016
22041
|
node.type = type;
|
|
22017
22042
|
node.body = body;
|
|
22018
|
-
const isAsync = modifiersToFlags(node.modifiers) &
|
|
22043
|
+
const isAsync = modifiersToFlags(node.modifiers) & 1024 /* Async */;
|
|
22019
22044
|
const isGenerator = !!node.asteriskToken;
|
|
22020
22045
|
const isAsyncGenerator = isAsync && isGenerator;
|
|
22021
22046
|
node.transformFlags = propagateChildrenFlags(node.modifiers) | propagateChildFlags(node.asteriskToken) | propagateNameFlags(node.name) | propagateChildrenFlags(node.typeParameters) | propagateChildrenFlags(node.parameters) | propagateChildFlags(node.type) | propagateChildFlags(node.body) & ~67108864 /* ContainsPossibleTopLevelAwait */ | (isAsyncGenerator ? 128 /* ContainsES2018 */ : isAsync ? 256 /* ContainsES2017 */ : isGenerator ? 2048 /* ContainsGenerator */ : 0 /* None */) | (node.typeParameters || node.type ? 1 /* ContainsTypeScript */ : 0 /* None */) | 4194304 /* ContainsHoistedDeclarationOrCompletion */;
|
|
@@ -22039,7 +22064,7 @@ ${lanes.join("\n")}
|
|
|
22039
22064
|
node.type = type;
|
|
22040
22065
|
node.equalsGreaterThanToken = equalsGreaterThanToken ?? createToken(39 /* EqualsGreaterThanToken */);
|
|
22041
22066
|
node.body = parenthesizerRules().parenthesizeConciseBodyOfArrowFunction(body);
|
|
22042
|
-
const isAsync = modifiersToFlags(node.modifiers) &
|
|
22067
|
+
const isAsync = modifiersToFlags(node.modifiers) & 1024 /* Async */;
|
|
22043
22068
|
node.transformFlags = propagateChildrenFlags(node.modifiers) | propagateChildrenFlags(node.typeParameters) | propagateChildrenFlags(node.parameters) | propagateChildFlags(node.type) | propagateChildFlags(node.equalsGreaterThanToken) | propagateChildFlags(node.body) & ~67108864 /* ContainsPossibleTopLevelAwait */ | (node.typeParameters || node.type ? 1 /* ContainsTypeScript */ : 0 /* None */) | (isAsync ? 256 /* ContainsES2017 */ | 16384 /* ContainsLexicalThis */ : 0 /* None */) | 1024 /* ContainsES2015 */;
|
|
22044
22069
|
node.typeArguments = void 0;
|
|
22045
22070
|
node.jsDoc = void 0;
|
|
@@ -22391,7 +22416,7 @@ ${lanes.join("\n")}
|
|
|
22391
22416
|
node.modifiers = asNodeArray(modifiers);
|
|
22392
22417
|
node.declarationList = isArray(declarationList) ? createVariableDeclarationList(declarationList) : declarationList;
|
|
22393
22418
|
node.transformFlags |= propagateChildrenFlags(node.modifiers) | propagateChildFlags(node.declarationList);
|
|
22394
|
-
if (modifiersToFlags(node.modifiers) &
|
|
22419
|
+
if (modifiersToFlags(node.modifiers) & 128 /* Ambient */) {
|
|
22395
22420
|
node.transformFlags = 1 /* ContainsTypeScript */;
|
|
22396
22421
|
}
|
|
22397
22422
|
node.jsDoc = void 0;
|
|
@@ -22641,10 +22666,10 @@ ${lanes.join("\n")}
|
|
|
22641
22666
|
node.parameters = createNodeArray(parameters);
|
|
22642
22667
|
node.type = type;
|
|
22643
22668
|
node.body = body;
|
|
22644
|
-
if (!node.body || modifiersToFlags(node.modifiers) &
|
|
22669
|
+
if (!node.body || modifiersToFlags(node.modifiers) & 128 /* Ambient */) {
|
|
22645
22670
|
node.transformFlags = 1 /* ContainsTypeScript */;
|
|
22646
22671
|
} else {
|
|
22647
|
-
const isAsync = modifiersToFlags(node.modifiers) &
|
|
22672
|
+
const isAsync = modifiersToFlags(node.modifiers) & 1024 /* Async */;
|
|
22648
22673
|
const isGenerator = !!node.asteriskToken;
|
|
22649
22674
|
const isAsyncGenerator = isAsync && isGenerator;
|
|
22650
22675
|
node.transformFlags = propagateChildrenFlags(node.modifiers) | propagateChildFlags(node.asteriskToken) | propagateNameFlags(node.name) | propagateChildrenFlags(node.typeParameters) | propagateChildrenFlags(node.parameters) | propagateChildFlags(node.type) | propagateChildFlags(node.body) & ~67108864 /* ContainsPossibleTopLevelAwait */ | (isAsyncGenerator ? 128 /* ContainsES2018 */ : isAsync ? 256 /* ContainsES2017 */ : isGenerator ? 2048 /* ContainsGenerator */ : 0 /* None */) | (node.typeParameters || node.type ? 1 /* ContainsTypeScript */ : 0 /* None */) | 4194304 /* ContainsHoistedDeclarationOrCompletion */;
|
|
@@ -22675,7 +22700,7 @@ ${lanes.join("\n")}
|
|
|
22675
22700
|
node.typeParameters = asNodeArray(typeParameters);
|
|
22676
22701
|
node.heritageClauses = asNodeArray(heritageClauses);
|
|
22677
22702
|
node.members = createNodeArray(members);
|
|
22678
|
-
if (modifiersToFlags(node.modifiers) &
|
|
22703
|
+
if (modifiersToFlags(node.modifiers) & 128 /* Ambient */) {
|
|
22679
22704
|
node.transformFlags = 1 /* ContainsTypeScript */;
|
|
22680
22705
|
} else {
|
|
22681
22706
|
node.transformFlags |= propagateChildrenFlags(node.modifiers) | propagateNameFlags(node.name) | propagateChildrenFlags(node.typeParameters) | propagateChildrenFlags(node.heritageClauses) | propagateChildrenFlags(node.members) | (node.typeParameters ? 1 /* ContainsTypeScript */ : 0 /* None */) | 1024 /* ContainsES2015 */;
|
|
@@ -22737,7 +22762,7 @@ ${lanes.join("\n")}
|
|
|
22737
22762
|
node.flags |= flags2 & (32 /* Namespace */ | 8 /* NestedNamespace */ | 2048 /* GlobalAugmentation */);
|
|
22738
22763
|
node.name = name;
|
|
22739
22764
|
node.body = body;
|
|
22740
|
-
if (modifiersToFlags(node.modifiers) &
|
|
22765
|
+
if (modifiersToFlags(node.modifiers) & 128 /* Ambient */) {
|
|
22741
22766
|
node.transformFlags = 1 /* ContainsTypeScript */;
|
|
22742
22767
|
} else {
|
|
22743
22768
|
node.transformFlags |= propagateChildrenFlags(node.modifiers) | propagateChildFlags(node.name) | propagateChildFlags(node.body) | 1 /* ContainsTypeScript */;
|
|
@@ -24168,7 +24193,7 @@ ${lanes.join("\n")}
|
|
|
24168
24193
|
return qualifiedName;
|
|
24169
24194
|
}
|
|
24170
24195
|
function getExternalModuleOrNamespaceExportName(ns, node, allowComments, allowSourceMaps) {
|
|
24171
|
-
if (ns && hasSyntacticModifier(node,
|
|
24196
|
+
if (ns && hasSyntacticModifier(node, 32 /* Export */)) {
|
|
24172
24197
|
return getNamespaceMemberName(ns, getName(node), allowComments, allowSourceMaps);
|
|
24173
24198
|
}
|
|
24174
24199
|
return getExportName(node, allowComments, allowSourceMaps);
|
|
@@ -33823,11 +33848,11 @@ ${lanes.join("\n")}
|
|
|
33823
33848
|
const modifierFlags = modifiersToFlags(modifiers);
|
|
33824
33849
|
parseExpected(100 /* FunctionKeyword */);
|
|
33825
33850
|
const asteriskToken = parseOptionalToken(42 /* AsteriskToken */);
|
|
33826
|
-
const name = modifierFlags &
|
|
33851
|
+
const name = modifierFlags & 2048 /* Default */ ? parseOptionalBindingIdentifier() : parseBindingIdentifier();
|
|
33827
33852
|
const isGenerator = asteriskToken ? 1 /* Yield */ : 0 /* None */;
|
|
33828
|
-
const isAsync = modifierFlags &
|
|
33853
|
+
const isAsync = modifierFlags & 1024 /* Async */ ? 2 /* Await */ : 0 /* None */;
|
|
33829
33854
|
const typeParameters = parseTypeParameters();
|
|
33830
|
-
if (modifierFlags &
|
|
33855
|
+
if (modifierFlags & 32 /* Export */)
|
|
33831
33856
|
setAwaitContext(
|
|
33832
33857
|
/*value*/
|
|
33833
33858
|
true
|
|
@@ -39522,8 +39547,7 @@ ${lanes.join("\n")}
|
|
|
39522
39547
|
if (resolutionMode === 99 /* ESNext */ && (3 /* Node16 */ <= moduleResolution && moduleResolution <= 99 /* NodeNext */)) {
|
|
39523
39548
|
features |= 32 /* EsmMode */;
|
|
39524
39549
|
}
|
|
39525
|
-
const
|
|
39526
|
-
const conditions = features & 8 /* Exports */ ? getConditions(options, useImportCondition) : [];
|
|
39550
|
+
const conditions = features & 8 /* Exports */ ? getConditions(options, resolutionMode) : [];
|
|
39527
39551
|
const diagnostics = [];
|
|
39528
39552
|
const moduleResolutionState = {
|
|
39529
39553
|
compilerOptions: options,
|
|
@@ -39691,16 +39715,16 @@ ${lanes.join("\n")}
|
|
|
39691
39715
|
}
|
|
39692
39716
|
return features;
|
|
39693
39717
|
}
|
|
39694
|
-
function getConditions(options,
|
|
39718
|
+
function getConditions(options, resolutionMode) {
|
|
39695
39719
|
const moduleResolution = getEmitModuleResolutionKind(options);
|
|
39696
|
-
if (
|
|
39720
|
+
if (resolutionMode === void 0) {
|
|
39697
39721
|
if (moduleResolution === 100 /* Bundler */) {
|
|
39698
|
-
|
|
39722
|
+
resolutionMode = 99 /* ESNext */;
|
|
39699
39723
|
} else if (moduleResolution === 2 /* Node10 */) {
|
|
39700
39724
|
return [];
|
|
39701
39725
|
}
|
|
39702
39726
|
}
|
|
39703
|
-
const conditions =
|
|
39727
|
+
const conditions = resolutionMode === 99 /* ESNext */ ? ["import"] : ["require"];
|
|
39704
39728
|
if (!options.noDtsResolution) {
|
|
39705
39729
|
conditions.push("types");
|
|
39706
39730
|
}
|
|
@@ -40149,13 +40173,13 @@ ${lanes.join("\n")}
|
|
|
40149
40173
|
result = nodeNextModuleNameResolver(moduleName, containingFile, compilerOptions, host, cache, redirectedReference, resolutionMode);
|
|
40150
40174
|
break;
|
|
40151
40175
|
case 2 /* Node10 */:
|
|
40152
|
-
result = nodeModuleNameResolver(moduleName, containingFile, compilerOptions, host, cache, redirectedReference, resolutionMode ? getConditions(compilerOptions, resolutionMode
|
|
40176
|
+
result = nodeModuleNameResolver(moduleName, containingFile, compilerOptions, host, cache, redirectedReference, resolutionMode ? getConditions(compilerOptions, resolutionMode) : void 0);
|
|
40153
40177
|
break;
|
|
40154
40178
|
case 1 /* Classic */:
|
|
40155
40179
|
result = classicNameResolver(moduleName, containingFile, compilerOptions, host, cache, redirectedReference);
|
|
40156
40180
|
break;
|
|
40157
40181
|
case 100 /* Bundler */:
|
|
40158
|
-
result = bundlerModuleNameResolver(moduleName, containingFile, compilerOptions, host, cache, redirectedReference, resolutionMode ? getConditions(compilerOptions, resolutionMode
|
|
40182
|
+
result = bundlerModuleNameResolver(moduleName, containingFile, compilerOptions, host, cache, redirectedReference, resolutionMode ? getConditions(compilerOptions, resolutionMode) : void 0);
|
|
40159
40183
|
break;
|
|
40160
40184
|
default:
|
|
40161
40185
|
return Debug.fail(`Unexpected moduleResolution: ${moduleResolution}`);
|
|
@@ -40420,7 +40444,7 @@ ${lanes.join("\n")}
|
|
|
40420
40444
|
const moduleResolution = getEmitModuleResolutionKind(compilerOptions);
|
|
40421
40445
|
conditions ?? (conditions = getConditions(
|
|
40422
40446
|
compilerOptions,
|
|
40423
|
-
moduleResolution === 100 /* Bundler */ || moduleResolution === 2 /* Node10 */ ? void 0 :
|
|
40447
|
+
moduleResolution === 100 /* Bundler */ || moduleResolution === 2 /* Node10 */ ? void 0 : features & 32 /* EsmMode */ ? 99 /* ESNext */ : 1 /* CommonJS */
|
|
40424
40448
|
));
|
|
40425
40449
|
const diagnostics = [];
|
|
40426
40450
|
const state = {
|
|
@@ -40730,15 +40754,7 @@ ${lanes.join("\n")}
|
|
|
40730
40754
|
entrypoints = append(entrypoints, mainResolution == null ? void 0 : mainResolution.path);
|
|
40731
40755
|
if (features & 8 /* Exports */ && packageJsonInfo.contents.packageJsonContent.exports) {
|
|
40732
40756
|
const conditionSets = deduplicate(
|
|
40733
|
-
[getConditions(
|
|
40734
|
-
options,
|
|
40735
|
-
/*esmMode*/
|
|
40736
|
-
true
|
|
40737
|
-
), getConditions(
|
|
40738
|
-
options,
|
|
40739
|
-
/*esmMode*/
|
|
40740
|
-
false
|
|
40741
|
-
)],
|
|
40757
|
+
[getConditions(options, 99 /* ESNext */), getConditions(options, 1 /* CommonJS */)],
|
|
40742
40758
|
arrayIsEqualTo
|
|
40743
40759
|
);
|
|
40744
40760
|
for (const conditions of conditionSets) {
|
|
@@ -41891,7 +41907,7 @@ ${lanes.join("\n")}
|
|
|
41891
41907
|
break;
|
|
41892
41908
|
case 272 /* ImportDeclaration */:
|
|
41893
41909
|
case 271 /* ImportEqualsDeclaration */:
|
|
41894
|
-
if (!hasSyntacticModifier(node,
|
|
41910
|
+
if (!hasSyntacticModifier(node, 32 /* Export */)) {
|
|
41895
41911
|
return 0 /* NonInstantiated */;
|
|
41896
41912
|
}
|
|
41897
41913
|
break;
|
|
@@ -42168,7 +42184,7 @@ ${lanes.join("\n")}
|
|
|
42168
42184
|
}
|
|
42169
42185
|
function declareSymbol(symbolTable, parent3, node, includes, excludes, isReplaceableByMethod, isComputedName) {
|
|
42170
42186
|
Debug.assert(isComputedName || !hasDynamicName(node));
|
|
42171
|
-
const isDefaultExport = hasSyntacticModifier(node,
|
|
42187
|
+
const isDefaultExport = hasSyntacticModifier(node, 2048 /* Default */) || isExportSpecifier(node) && node.name.escapedText === "default";
|
|
42172
42188
|
const name = isComputedName ? "__computed" /* Computed */ : isDefaultExport && parent3 ? "default" /* Default */ : getDeclarationName(node);
|
|
42173
42189
|
let symbol;
|
|
42174
42190
|
if (name === void 0) {
|
|
@@ -42212,7 +42228,7 @@ ${lanes.join("\n")}
|
|
|
42212
42228
|
}
|
|
42213
42229
|
}
|
|
42214
42230
|
const relatedInformation = [];
|
|
42215
|
-
if (isTypeAliasDeclaration(node) && nodeIsMissing(node.type) && hasSyntacticModifier(node,
|
|
42231
|
+
if (isTypeAliasDeclaration(node) && nodeIsMissing(node.type) && hasSyntacticModifier(node, 32 /* Export */) && symbol.flags & (2097152 /* Alias */ | 788968 /* Type */ | 1920 /* Namespace */)) {
|
|
42216
42232
|
relatedInformation.push(createDiagnosticForNode2(node, Diagnostics.Did_you_mean_0, `export type { ${unescapeLeadingUnderscores(node.name.escapedText)} }`));
|
|
42217
42233
|
}
|
|
42218
42234
|
const declarationName = getNameOfDeclaration(node) || node;
|
|
@@ -42241,7 +42257,7 @@ ${lanes.join("\n")}
|
|
|
42241
42257
|
return symbol;
|
|
42242
42258
|
}
|
|
42243
42259
|
function declareModuleMember(node, symbolFlags, symbolExcludes) {
|
|
42244
|
-
const hasExportModifier = !!(getCombinedModifierFlags(node) &
|
|
42260
|
+
const hasExportModifier = !!(getCombinedModifierFlags(node) & 32 /* Export */) || jsdocTreatAsExported(node);
|
|
42245
42261
|
if (symbolFlags & 2097152 /* Alias */) {
|
|
42246
42262
|
if (node.kind === 281 /* ExportSpecifier */ || node.kind === 271 /* ImportEqualsDeclaration */ && hasExportModifier) {
|
|
42247
42263
|
return declareSymbol(container.symbol.exports, container.symbol, node, symbolFlags, symbolExcludes);
|
|
@@ -42260,7 +42276,7 @@ ${lanes.join("\n")}
|
|
|
42260
42276
|
if (isJSDocTypeAlias(node))
|
|
42261
42277
|
Debug.assert(isInJSFile(node));
|
|
42262
42278
|
if (!isAmbientModule(node) && (hasExportModifier || container.flags & 128 /* ExportContext */)) {
|
|
42263
|
-
if (!canHaveLocals(container) || !container.locals || hasSyntacticModifier(node,
|
|
42279
|
+
if (!canHaveLocals(container) || !container.locals || hasSyntacticModifier(node, 2048 /* Default */) && !getDeclarationName(node)) {
|
|
42264
42280
|
return declareSymbol(container.symbol.exports, container.symbol, node, symbolFlags, symbolExcludes);
|
|
42265
42281
|
}
|
|
42266
42282
|
const exportKind = symbolFlags & 111551 /* Value */ ? 1048576 /* ExportValue */ : 0;
|
|
@@ -42301,7 +42317,7 @@ ${lanes.join("\n")}
|
|
|
42301
42317
|
return false;
|
|
42302
42318
|
if (isPropertyAccessEntityNameExpression(declName.parent) && isTopLevelNamespaceAssignment(declName.parent))
|
|
42303
42319
|
return true;
|
|
42304
|
-
if (isDeclaration(declName.parent) && getCombinedModifierFlags(declName.parent) &
|
|
42320
|
+
if (isDeclaration(declName.parent) && getCombinedModifierFlags(declName.parent) & 32 /* Export */)
|
|
42305
42321
|
return true;
|
|
42306
42322
|
return false;
|
|
42307
42323
|
}
|
|
@@ -42332,7 +42348,7 @@ ${lanes.join("\n")}
|
|
|
42332
42348
|
const saveExceptionTarget = currentExceptionTarget;
|
|
42333
42349
|
const saveActiveLabelList = activeLabelList;
|
|
42334
42350
|
const saveHasExplicitReturn = hasExplicitReturn;
|
|
42335
|
-
const isImmediatelyInvoked = containerFlags & 16 /* IsFunctionExpression */ && !hasSyntacticModifier(node,
|
|
42351
|
+
const isImmediatelyInvoked = containerFlags & 16 /* IsFunctionExpression */ && !hasSyntacticModifier(node, 1024 /* Async */) && !node.asteriskToken && !!getImmediatelyInvokedFunctionExpression(node) || node.kind === 175 /* ClassStaticBlockDeclaration */;
|
|
42336
42352
|
if (!isImmediatelyInvoked) {
|
|
42337
42353
|
currentFlow = initFlowNode({ flags: 2 /* Start */ });
|
|
42338
42354
|
if (containerFlags & (16 /* IsFunctionExpression */ | 128 /* IsObjectLiteralOrClassExpressionMethodOrAccessor */)) {
|
|
@@ -43379,7 +43395,7 @@ ${lanes.join("\n")}
|
|
|
43379
43395
|
function bindModuleDeclaration(node) {
|
|
43380
43396
|
setExportContextFlag(node);
|
|
43381
43397
|
if (isAmbientModule(node)) {
|
|
43382
|
-
if (hasSyntacticModifier(node,
|
|
43398
|
+
if (hasSyntacticModifier(node, 32 /* Export */)) {
|
|
43383
43399
|
errorOnFirstToken(node, Diagnostics.export_modifier_cannot_be_applied_to_ambient_modules_and_module_augmentations_since_they_are_always_visible);
|
|
43384
43400
|
}
|
|
43385
43401
|
if (isModuleAugmentationExternal(node)) {
|
|
@@ -44440,7 +44456,7 @@ ${lanes.join("\n")}
|
|
|
44440
44456
|
}
|
|
44441
44457
|
if (!isBindingPattern(node.name)) {
|
|
44442
44458
|
const possibleVariableDecl = node.kind === 260 /* VariableDeclaration */ ? node : node.parent.parent;
|
|
44443
|
-
if (isInJSFile(node) && shouldResolveJsRequire(options) && isVariableDeclarationInitializedToBareOrAccessedRequire(possibleVariableDecl) && !getJSDocTypeTag(node) && !(getCombinedModifierFlags(node) &
|
|
44459
|
+
if (isInJSFile(node) && shouldResolveJsRequire(options) && isVariableDeclarationInitializedToBareOrAccessedRequire(possibleVariableDecl) && !getJSDocTypeTag(node) && !(getCombinedModifierFlags(node) & 32 /* Export */)) {
|
|
44444
44460
|
declareSymbolAndAddToSymbolTable(node, 2097152 /* Alias */, 2097152 /* AliasExcludes */);
|
|
44445
44461
|
} else if (isBlockOrCatchScoped(node)) {
|
|
44446
44462
|
bindBlockScopedDeclaration(node, 2 /* BlockScopedVariable */, 111551 /* BlockScopedVariableExcludes */);
|
|
@@ -44592,7 +44608,7 @@ ${lanes.join("\n")}
|
|
|
44592
44608
|
case 267 /* ModuleDeclaration */:
|
|
44593
44609
|
return getModuleInstanceState(s) !== 1 /* Instantiated */;
|
|
44594
44610
|
case 266 /* EnumDeclaration */:
|
|
44595
|
-
return hasSyntacticModifier(s,
|
|
44611
|
+
return hasSyntacticModifier(s, 4096 /* Const */);
|
|
44596
44612
|
default:
|
|
44597
44613
|
return false;
|
|
44598
44614
|
}
|
|
@@ -45472,7 +45488,7 @@ ${lanes.join("\n")}
|
|
|
45472
45488
|
if (getResolvePackageJsonExports(options)) {
|
|
45473
45489
|
const nodeModulesDirectoryName2 = packageRootPath.substring(parts.topLevelPackageNameIndex + 1);
|
|
45474
45490
|
const packageName2 = getPackageNameFromTypesPackageName(nodeModulesDirectoryName2);
|
|
45475
|
-
const conditions = getConditions(options, importMode
|
|
45491
|
+
const conditions = getConditions(options, importMode);
|
|
45476
45492
|
const fromExports = packageJsonContent.exports ? tryGetModuleNameFromExports(options, path, packageRootPath, packageName2, packageJsonContent.exports, conditions) : void 0;
|
|
45477
45493
|
if (fromExports) {
|
|
45478
45494
|
const withJsExtension = !hasTSFileExtension(fromExports.moduleFileToTry) ? fromExports : { moduleFileToTry: removeFileExtension(fromExports.moduleFileToTry) + tryGetJSExtensionForFile(fromExports.moduleFileToTry, options) };
|
|
@@ -47663,7 +47679,7 @@ ${lanes.join("\n")}
|
|
|
47663
47679
|
if (lastLocation && lastLocation === location.name) {
|
|
47664
47680
|
return false;
|
|
47665
47681
|
}
|
|
47666
|
-
if (location.asteriskToken || hasSyntacticModifier(location,
|
|
47682
|
+
if (location.asteriskToken || hasSyntacticModifier(location, 1024 /* Async */)) {
|
|
47667
47683
|
return true;
|
|
47668
47684
|
}
|
|
47669
47685
|
return !getImmediatelyInvokedFunctionExpression(location);
|
|
@@ -47827,8 +47843,17 @@ ${lanes.join("\n")}
|
|
|
47827
47843
|
function checkAndReportErrorForUsingTypeAsValue(errorLocation, name, meaning) {
|
|
47828
47844
|
if (meaning & 111551 /* Value */) {
|
|
47829
47845
|
if (isPrimitiveTypeName(name)) {
|
|
47830
|
-
|
|
47831
|
-
|
|
47846
|
+
const grandparent = errorLocation.parent.parent;
|
|
47847
|
+
if (grandparent && grandparent.parent && isHeritageClause(grandparent)) {
|
|
47848
|
+
const heritageKind = grandparent.token;
|
|
47849
|
+
const containerKind = grandparent.parent.kind;
|
|
47850
|
+
if (containerKind === 264 /* InterfaceDeclaration */ && heritageKind === 96 /* ExtendsKeyword */) {
|
|
47851
|
+
error2(errorLocation, Diagnostics.An_interface_cannot_extend_a_primitive_type_like_0_It_can_only_extend_other_named_object_types, unescapeLeadingUnderscores(name));
|
|
47852
|
+
} else if (containerKind === 263 /* ClassDeclaration */ && heritageKind === 96 /* ExtendsKeyword */) {
|
|
47853
|
+
error2(errorLocation, Diagnostics.A_class_cannot_extend_a_primitive_type_like_0_Classes_can_only_extend_constructable_values, unescapeLeadingUnderscores(name));
|
|
47854
|
+
} else if (containerKind === 263 /* ClassDeclaration */ && heritageKind === 119 /* ImplementsKeyword */) {
|
|
47855
|
+
error2(errorLocation, Diagnostics.A_class_cannot_implement_a_primitive_type_like_0_It_can_only_implement_other_named_object_types, unescapeLeadingUnderscores(name));
|
|
47856
|
+
}
|
|
47832
47857
|
} else {
|
|
47833
47858
|
error2(errorLocation, Diagnostics._0_only_refers_to_a_type_but_is_being_used_as_a_value_here, unescapeLeadingUnderscores(name));
|
|
47834
47859
|
}
|
|
@@ -47860,16 +47885,6 @@ ${lanes.join("\n")}
|
|
|
47860
47885
|
}
|
|
47861
47886
|
return false;
|
|
47862
47887
|
}
|
|
47863
|
-
function isExtendedByInterface(node) {
|
|
47864
|
-
const grandparent = node.parent.parent;
|
|
47865
|
-
const parentOfGrandparent = grandparent.parent;
|
|
47866
|
-
if (grandparent && parentOfGrandparent) {
|
|
47867
|
-
const isExtending = isHeritageClause(grandparent) && grandparent.token === 96 /* ExtendsKeyword */;
|
|
47868
|
-
const isInterface = isInterfaceDeclaration(parentOfGrandparent);
|
|
47869
|
-
return isExtending && isInterface;
|
|
47870
|
-
}
|
|
47871
|
-
return false;
|
|
47872
|
-
}
|
|
47873
47888
|
function maybeMappedType(node, symbol) {
|
|
47874
47889
|
const container = findAncestor(node.parent, (n) => isComputedPropertyName(n) || isPropertySignature(n) ? false : isTypeLiteralNode(n) || "quit");
|
|
47875
47890
|
if (container && container.members.length === 1) {
|
|
@@ -48048,7 +48063,7 @@ ${lanes.join("\n")}
|
|
|
48048
48063
|
return resolved;
|
|
48049
48064
|
}
|
|
48050
48065
|
function isSyntacticDefault(node) {
|
|
48051
|
-
return isExportAssignment(node) && !node.isExportEquals || hasSyntacticModifier(node,
|
|
48066
|
+
return isExportAssignment(node) && !node.isExportEquals || hasSyntacticModifier(node, 2048 /* Default */) || isExportSpecifier(node) || isNamespaceExport(node);
|
|
48052
48067
|
}
|
|
48053
48068
|
function getUsageModeForExpression(usage) {
|
|
48054
48069
|
return isStringLiteralLike(usage) ? getModeForUsageLocation(getSourceFileOfNode(usage), usage) : void 0;
|
|
@@ -49974,20 +49989,20 @@ ${lanes.join("\n")}
|
|
|
49974
49989
|
var _a, _b;
|
|
49975
49990
|
if (!isDeclarationVisible(declaration)) {
|
|
49976
49991
|
const anyImportSyntax = getAnyImportSyntax(declaration);
|
|
49977
|
-
if (anyImportSyntax && !hasSyntacticModifier(anyImportSyntax,
|
|
49992
|
+
if (anyImportSyntax && !hasSyntacticModifier(anyImportSyntax, 32 /* Export */) && // import clause without export
|
|
49978
49993
|
isDeclarationVisible(anyImportSyntax.parent)) {
|
|
49979
49994
|
return addVisibleAlias(declaration, anyImportSyntax);
|
|
49980
|
-
} else if (isVariableDeclaration(declaration) && isVariableStatement(declaration.parent.parent) && !hasSyntacticModifier(declaration.parent.parent,
|
|
49995
|
+
} else if (isVariableDeclaration(declaration) && isVariableStatement(declaration.parent.parent) && !hasSyntacticModifier(declaration.parent.parent, 32 /* Export */) && // unexported variable statement
|
|
49981
49996
|
isDeclarationVisible(declaration.parent.parent.parent)) {
|
|
49982
49997
|
return addVisibleAlias(declaration, declaration.parent.parent);
|
|
49983
|
-
} else if (isLateVisibilityPaintedStatement(declaration) && !hasSyntacticModifier(declaration,
|
|
49998
|
+
} else if (isLateVisibilityPaintedStatement(declaration) && !hasSyntacticModifier(declaration, 32 /* Export */) && isDeclarationVisible(declaration.parent)) {
|
|
49984
49999
|
return addVisibleAlias(declaration, declaration);
|
|
49985
50000
|
} else if (isBindingElement(declaration)) {
|
|
49986
|
-
if (symbol.flags & 2097152 /* Alias */ && isInJSFile(declaration) && ((_a = declaration.parent) == null ? void 0 : _a.parent) && isVariableDeclaration(declaration.parent.parent) && ((_b = declaration.parent.parent.parent) == null ? void 0 : _b.parent) && isVariableStatement(declaration.parent.parent.parent.parent) && !hasSyntacticModifier(declaration.parent.parent.parent.parent,
|
|
50001
|
+
if (symbol.flags & 2097152 /* Alias */ && isInJSFile(declaration) && ((_a = declaration.parent) == null ? void 0 : _a.parent) && isVariableDeclaration(declaration.parent.parent) && ((_b = declaration.parent.parent.parent) == null ? void 0 : _b.parent) && isVariableStatement(declaration.parent.parent.parent.parent) && !hasSyntacticModifier(declaration.parent.parent.parent.parent, 32 /* Export */) && declaration.parent.parent.parent.parent.parent && isDeclarationVisible(declaration.parent.parent.parent.parent.parent)) {
|
|
49987
50002
|
return addVisibleAlias(declaration, declaration.parent.parent.parent.parent);
|
|
49988
50003
|
} else if (symbol.flags & 2 /* BlockScopedVariable */) {
|
|
49989
50004
|
const variableStatement = findAncestor(declaration, isVariableStatement);
|
|
49990
|
-
if (hasSyntacticModifier(variableStatement,
|
|
50005
|
+
if (hasSyntacticModifier(variableStatement, 32 /* Export */)) {
|
|
49991
50006
|
return true;
|
|
49992
50007
|
}
|
|
49993
50008
|
if (!isDeclarationVisible(variableStatement.parent)) {
|
|
@@ -50210,7 +50225,8 @@ ${lanes.join("\n")}
|
|
|
50210
50225
|
visitedTypes: void 0,
|
|
50211
50226
|
symbolDepth: void 0,
|
|
50212
50227
|
inferTypeParameters: void 0,
|
|
50213
|
-
approximateLength: 0
|
|
50228
|
+
approximateLength: 0,
|
|
50229
|
+
trackedSymbols: void 0
|
|
50214
50230
|
};
|
|
50215
50231
|
context.tracker = new SymbolTrackerImpl(context, tracker, moduleResolverHost);
|
|
50216
50232
|
const resultingNode = cb(context);
|
|
@@ -50664,7 +50680,7 @@ ${lanes.join("\n")}
|
|
|
50664
50680
|
}
|
|
50665
50681
|
}
|
|
50666
50682
|
function visitAndTransformType(type2, transform2) {
|
|
50667
|
-
var _a2, _b2;
|
|
50683
|
+
var _a2, _b2, _c;
|
|
50668
50684
|
const typeId = type2.id;
|
|
50669
50685
|
const isConstructorObject = getObjectFlags(type2) & 16 /* Anonymous */ && type2.symbol && type2.symbol.flags & 32 /* Class */;
|
|
50670
50686
|
const id = getObjectFlags(type2) & 4 /* Reference */ && type2.node ? "N" + getNodeId(type2.node) : type2.flags & 16777216 /* Conditional */ ? "N" + getNodeId(type2.root.node) : type2.symbol ? (isConstructorObject ? "+" : "") + getSymbolId(type2.symbol) : void 0;
|
|
@@ -50681,6 +50697,13 @@ ${lanes.join("\n")}
|
|
|
50681
50697
|
}
|
|
50682
50698
|
const cachedResult = (_a2 = links == null ? void 0 : links.serializedTypes) == null ? void 0 : _a2.get(key);
|
|
50683
50699
|
if (cachedResult) {
|
|
50700
|
+
(_b2 = cachedResult.trackedSymbols) == null ? void 0 : _b2.forEach(
|
|
50701
|
+
([symbol, enclosingDeclaration, meaning]) => context.tracker.trackSymbol(
|
|
50702
|
+
symbol,
|
|
50703
|
+
enclosingDeclaration,
|
|
50704
|
+
meaning
|
|
50705
|
+
)
|
|
50706
|
+
);
|
|
50684
50707
|
if (cachedResult.truncating) {
|
|
50685
50708
|
context.truncating = true;
|
|
50686
50709
|
}
|
|
@@ -50700,7 +50723,12 @@ ${lanes.join("\n")}
|
|
|
50700
50723
|
const result = transform2(type2);
|
|
50701
50724
|
const addedLength = context.approximateLength - startLength;
|
|
50702
50725
|
if (!context.reportedDiagnostic && !context.encounteredError) {
|
|
50703
|
-
(
|
|
50726
|
+
(_c = links == null ? void 0 : links.serializedTypes) == null ? void 0 : _c.set(key, {
|
|
50727
|
+
node: result,
|
|
50728
|
+
truncating: context.truncating,
|
|
50729
|
+
addedLength,
|
|
50730
|
+
trackedSymbols: context.trackedSymbols
|
|
50731
|
+
});
|
|
50704
50732
|
}
|
|
50705
50733
|
context.visitedTypes.delete(typeId);
|
|
50706
50734
|
if (id) {
|
|
@@ -50942,7 +50970,7 @@ ${lanes.join("\n")}
|
|
|
50942
50970
|
if (propertySymbol.flags & 4194304 /* Prototype */) {
|
|
50943
50971
|
continue;
|
|
50944
50972
|
}
|
|
50945
|
-
if (getDeclarationModifierFlagsFromSymbol(propertySymbol) & (
|
|
50973
|
+
if (getDeclarationModifierFlagsFromSymbol(propertySymbol) & (2 /* Private */ | 4 /* Protected */) && context.tracker.reportPrivateInBaseOfClassExpression) {
|
|
50946
50974
|
context.tracker.reportPrivateInBaseOfClassExpression(unescapeLeadingUnderscores(propertySymbol.escapedName));
|
|
50947
50975
|
}
|
|
50948
50976
|
}
|
|
@@ -51245,7 +51273,7 @@ ${lanes.join("\n")}
|
|
|
51245
51273
|
let modifiers = options == null ? void 0 : options.modifiers;
|
|
51246
51274
|
if (kind === 185 /* ConstructorType */ && signature.flags & 4 /* Abstract */) {
|
|
51247
51275
|
const flags = modifiersToFlags(modifiers);
|
|
51248
|
-
modifiers = factory.createModifiersFromModifierFlags(flags |
|
|
51276
|
+
modifiers = factory.createModifiersFromModifierFlags(flags | 64 /* Abstract */);
|
|
51249
51277
|
}
|
|
51250
51278
|
const node = kind === 179 /* CallSignature */ ? factory.createCallSignature(typeParameters, parameters, returnTypeNode) : kind === 180 /* ConstructSignature */ ? factory.createConstructSignature(typeParameters, parameters, returnTypeNode) : kind === 173 /* MethodSignature */ ? factory.createMethodSignature(modifiers, (options == null ? void 0 : options.name) ?? factory.createIdentifier(""), options == null ? void 0 : options.questionToken, typeParameters, parameters, returnTypeNode) : kind === 174 /* MethodDeclaration */ ? factory.createMethodDeclaration(
|
|
51251
51279
|
modifiers,
|
|
@@ -52302,7 +52330,7 @@ ${lanes.join("\n")}
|
|
|
52302
52330
|
const nsIndex = findIndex(statements, isModuleDeclaration);
|
|
52303
52331
|
let ns = nsIndex !== -1 ? statements[nsIndex] : void 0;
|
|
52304
52332
|
if (ns && exportAssignment && exportAssignment.isExportEquals && isIdentifier(exportAssignment.expression) && isIdentifier(ns.name) && idText(ns.name) === idText(exportAssignment.expression) && ns.body && isModuleBlock(ns.body)) {
|
|
52305
|
-
const excessExports = filter(statements, (s) => !!(getEffectiveModifierFlags(s) &
|
|
52333
|
+
const excessExports = filter(statements, (s) => !!(getEffectiveModifierFlags(s) & 32 /* Export */));
|
|
52306
52334
|
const name = ns.name;
|
|
52307
52335
|
let body = ns.body;
|
|
52308
52336
|
if (length(excessExports)) {
|
|
@@ -52336,9 +52364,9 @@ ${lanes.join("\n")}
|
|
|
52336
52364
|
}
|
|
52337
52365
|
if (!find(statements, (s) => s !== ns && nodeHasName(s, name))) {
|
|
52338
52366
|
results = [];
|
|
52339
|
-
const mixinExportFlag = !some(body.statements, (s) => hasSyntacticModifier(s,
|
|
52367
|
+
const mixinExportFlag = !some(body.statements, (s) => hasSyntacticModifier(s, 32 /* Export */) || isExportAssignment(s) || isExportDeclaration(s));
|
|
52340
52368
|
forEach(body.statements, (s) => {
|
|
52341
|
-
addResult(s, mixinExportFlag ?
|
|
52369
|
+
addResult(s, mixinExportFlag ? 32 /* Export */ : 0 /* None */);
|
|
52342
52370
|
});
|
|
52343
52371
|
statements = [...filter(statements, (s) => s !== ns && s !== exportAssignment), ...results];
|
|
52344
52372
|
}
|
|
@@ -52430,11 +52458,11 @@ ${lanes.join("\n")}
|
|
|
52430
52458
|
return statements;
|
|
52431
52459
|
}
|
|
52432
52460
|
function addExportModifier(node) {
|
|
52433
|
-
const flags = (getEffectiveModifierFlags(node) |
|
|
52461
|
+
const flags = (getEffectiveModifierFlags(node) | 32 /* Export */) & ~128 /* Ambient */;
|
|
52434
52462
|
return factory.replaceModifiers(node, flags);
|
|
52435
52463
|
}
|
|
52436
52464
|
function removeExportModifier(node) {
|
|
52437
|
-
const flags = getEffectiveModifierFlags(node) & ~
|
|
52465
|
+
const flags = getEffectiveModifierFlags(node) & ~32 /* Export */;
|
|
52438
52466
|
return factory.replaceModifiers(node, flags);
|
|
52439
52467
|
}
|
|
52440
52468
|
function visitSymbolTable(symbolTable2, suppressNewPrivateContext, propertyAsAlias) {
|
|
@@ -52475,6 +52503,12 @@ ${lanes.join("\n")}
|
|
|
52475
52503
|
if (context.reportedDiagnostic) {
|
|
52476
52504
|
oldcontext.reportedDiagnostic = context.reportedDiagnostic;
|
|
52477
52505
|
}
|
|
52506
|
+
if (context.trackedSymbols) {
|
|
52507
|
+
if (!oldContext.trackedSymbols)
|
|
52508
|
+
oldContext.trackedSymbols = context.trackedSymbols;
|
|
52509
|
+
else
|
|
52510
|
+
Debug.assert(context.trackedSymbols === oldContext.trackedSymbols);
|
|
52511
|
+
}
|
|
52478
52512
|
context = oldContext;
|
|
52479
52513
|
}
|
|
52480
52514
|
}
|
|
@@ -52491,7 +52525,7 @@ ${lanes.join("\n")}
|
|
|
52491
52525
|
if (needsPostExportDefault || needsExportDeclaration) {
|
|
52492
52526
|
isPrivate = true;
|
|
52493
52527
|
}
|
|
52494
|
-
const modifierFlags = (!isPrivate ?
|
|
52528
|
+
const modifierFlags = (!isPrivate ? 32 /* Export */ : 0) | (isDefault && !needsPostExportDefault ? 2048 /* Default */ : 0);
|
|
52495
52529
|
const isConstMergedWithNS = symbol.flags & 1536 /* Module */ && symbol.flags & (2 /* BlockScopedVariable */ | 1 /* FunctionScopedVariable */ | 4 /* Property */) && escapedSymbolName !== "export=" /* ExportEquals */;
|
|
52496
52530
|
const isConstMergedWithNSPrintableAsSignatureMerge = isConstMergedWithNS && isTypeRepresentableAsFunctionNamespaceMerge(getTypeOfSymbol(symbol), symbol);
|
|
52497
52531
|
if (symbol.flags & (16 /* Function */ | 8192 /* Method */) || isConstMergedWithNSPrintableAsSignatureMerge) {
|
|
@@ -52561,7 +52595,7 @@ ${lanes.join("\n")}
|
|
|
52561
52595
|
),
|
|
52562
52596
|
textRange
|
|
52563
52597
|
);
|
|
52564
|
-
addResult(statement, name !== localName ? modifierFlags & ~
|
|
52598
|
+
addResult(statement, name !== localName ? modifierFlags & ~32 /* Export */ : modifierFlags);
|
|
52565
52599
|
if (name !== localName && !isPrivate) {
|
|
52566
52600
|
addResult(
|
|
52567
52601
|
factory.createExportDeclaration(
|
|
@@ -52666,14 +52700,14 @@ ${lanes.join("\n")}
|
|
|
52666
52700
|
if (canHaveModifiers(node)) {
|
|
52667
52701
|
let newModifierFlags = 0 /* None */;
|
|
52668
52702
|
const enclosingDeclaration2 = context.enclosingDeclaration && (isJSDocTypeAlias(context.enclosingDeclaration) ? getSourceFileOfNode(context.enclosingDeclaration) : context.enclosingDeclaration);
|
|
52669
|
-
if (additionalModifierFlags &
|
|
52670
|
-
newModifierFlags |=
|
|
52703
|
+
if (additionalModifierFlags & 32 /* Export */ && enclosingDeclaration2 && (isExportingScope(enclosingDeclaration2) || isModuleDeclaration(enclosingDeclaration2)) && canHaveExportModifier(node)) {
|
|
52704
|
+
newModifierFlags |= 32 /* Export */;
|
|
52671
52705
|
}
|
|
52672
|
-
if (addingDeclare && !(newModifierFlags &
|
|
52673
|
-
newModifierFlags |=
|
|
52706
|
+
if (addingDeclare && !(newModifierFlags & 32 /* Export */) && (!enclosingDeclaration2 || !(enclosingDeclaration2.flags & 33554432 /* Ambient */)) && (isEnumDeclaration(node) || isVariableStatement(node) || isFunctionDeclaration(node) || isClassDeclaration(node) || isModuleDeclaration(node))) {
|
|
52707
|
+
newModifierFlags |= 128 /* Ambient */;
|
|
52674
52708
|
}
|
|
52675
|
-
if (additionalModifierFlags &
|
|
52676
|
-
newModifierFlags |=
|
|
52709
|
+
if (additionalModifierFlags & 2048 /* Default */ && (isClassDeclaration(node) || isInterfaceDeclaration(node) || isFunctionDeclaration(node))) {
|
|
52710
|
+
newModifierFlags |= 2048 /* Default */;
|
|
52677
52711
|
}
|
|
52678
52712
|
if (newModifierFlags) {
|
|
52679
52713
|
node = factory.replaceModifiers(node, newModifierFlags | getEffectiveModifierFlags(node));
|
|
@@ -52795,7 +52829,7 @@ ${lanes.join("\n")}
|
|
|
52795
52829
|
function serializeEnum(symbol, symbolName2, modifierFlags) {
|
|
52796
52830
|
addResult(
|
|
52797
52831
|
factory.createEnumDeclaration(
|
|
52798
|
-
factory.createModifiersFromModifierFlags(isConstEnumSymbol(symbol) ?
|
|
52832
|
+
factory.createModifiersFromModifierFlags(isConstEnumSymbol(symbol) ? 4096 /* Const */ : 0),
|
|
52799
52833
|
getInternalSymbolName(symbol, symbolName2),
|
|
52800
52834
|
map(filter(getPropertiesOfType(getTypeOfSymbol(symbol)), (p) => !!(p.flags & 8 /* EnumMember */)), (p) => {
|
|
52801
52835
|
const initializedValue = p.declarations && p.declarations[0] && isEnumMember(p.declarations[0]) ? getConstantValue2(p.declarations[0]) : void 0;
|
|
@@ -52879,7 +52913,7 @@ ${lanes.join("\n")}
|
|
|
52879
52913
|
factory.createIdentifier("default" /* Default */)
|
|
52880
52914
|
)])
|
|
52881
52915
|
) : d);
|
|
52882
|
-
const exportModifierStripped = every(defaultReplaced, (d) => hasSyntacticModifier(d,
|
|
52916
|
+
const exportModifierStripped = every(defaultReplaced, (d) => hasSyntacticModifier(d, 32 /* Export */)) ? map(defaultReplaced, removeExportModifier) : defaultReplaced;
|
|
52883
52917
|
fakespace = factory.updateModuleDeclaration(
|
|
52884
52918
|
fakespace,
|
|
52885
52919
|
fakespace.modifiers,
|
|
@@ -52982,7 +53016,7 @@ ${lanes.join("\n")}
|
|
|
52982
53016
|
);
|
|
52983
53017
|
const isNonConstructableClassLikeInJsFile = !isClass && !!symbol.valueDeclaration && isInJSFile(symbol.valueDeclaration) && !some(getSignaturesOfType(staticType, 1 /* Construct */));
|
|
52984
53018
|
const constructors = isNonConstructableClassLikeInJsFile ? [factory.createConstructorDeclaration(
|
|
52985
|
-
factory.createModifiersFromModifierFlags(
|
|
53019
|
+
factory.createModifiersFromModifierFlags(2 /* Private */),
|
|
52986
53020
|
[],
|
|
52987
53021
|
/*body*/
|
|
52988
53022
|
void 0
|
|
@@ -53335,7 +53369,7 @@ ${lanes.join("\n")}
|
|
|
53335
53369
|
const varName = getUnusedName(name, symbol);
|
|
53336
53370
|
const typeToSerialize = getWidenedType(getTypeOfSymbol(getMergedSymbol(symbol)));
|
|
53337
53371
|
if (isTypeRepresentableAsFunctionNamespaceMerge(typeToSerialize, symbol)) {
|
|
53338
|
-
serializeAsFunctionNamespaceMerge(typeToSerialize, symbol, varName, isExportAssignmentCompatibleSymbolName ? 0 /* None */ :
|
|
53372
|
+
serializeAsFunctionNamespaceMerge(typeToSerialize, symbol, varName, isExportAssignmentCompatibleSymbolName ? 0 /* None */ : 32 /* Export */);
|
|
53339
53373
|
} else {
|
|
53340
53374
|
const flags = ((_a2 = context.enclosingDeclaration) == null ? void 0 : _a2.kind) === 267 /* ModuleDeclaration */ && (!(symbol.flags & 98304 /* Accessor */) || symbol.flags & 65536 /* SetAccessor */) ? 1 /* Let */ : 2 /* Const */;
|
|
53341
53375
|
const statement = factory.createVariableStatement(
|
|
@@ -53352,7 +53386,7 @@ ${lanes.join("\n")}
|
|
|
53352
53386
|
);
|
|
53353
53387
|
addResult(
|
|
53354
53388
|
statement,
|
|
53355
|
-
target && target.flags & 4 /* Property */ && target.escapedName === "export=" /* ExportEquals */ ?
|
|
53389
|
+
target && target.flags & 4 /* Property */ && target.escapedName === "export=" /* ExportEquals */ ? 128 /* Ambient */ : name === varName ? 32 /* Export */ : 0 /* None */
|
|
53356
53390
|
);
|
|
53357
53391
|
}
|
|
53358
53392
|
if (isExportAssignmentCompatibleSymbolName) {
|
|
@@ -53388,14 +53422,14 @@ ${lanes.join("\n")}
|
|
|
53388
53422
|
return function serializePropertySymbol(p, isStatic2, baseType) {
|
|
53389
53423
|
var _a2, _b, _c, _d, _e;
|
|
53390
53424
|
const modifierFlags = getDeclarationModifierFlagsFromSymbol(p);
|
|
53391
|
-
const isPrivate = !!(modifierFlags &
|
|
53425
|
+
const isPrivate = !!(modifierFlags & 2 /* Private */);
|
|
53392
53426
|
if (isStatic2 && p.flags & (788968 /* Type */ | 1920 /* Namespace */ | 2097152 /* Alias */)) {
|
|
53393
53427
|
return [];
|
|
53394
53428
|
}
|
|
53395
53429
|
if (p.flags & 4194304 /* Prototype */ || p.escapedName === "constructor" || baseType && getPropertyOfType(baseType, p.escapedName) && isReadonlySymbol(getPropertyOfType(baseType, p.escapedName)) === isReadonlySymbol(p) && (p.flags & 16777216 /* Optional */) === (getPropertyOfType(baseType, p.escapedName).flags & 16777216 /* Optional */) && isTypeIdenticalTo(getTypeOfSymbol(p), getTypeOfPropertyOfType(baseType, p.escapedName))) {
|
|
53396
53430
|
return [];
|
|
53397
53431
|
}
|
|
53398
|
-
const flag = modifierFlags & ~
|
|
53432
|
+
const flag = modifierFlags & ~1024 /* Async */ | (isStatic2 ? 256 /* Static */ : 0);
|
|
53399
53433
|
const name = getPropertyNameNodeForSymbol(p, context);
|
|
53400
53434
|
const firstPropertyLikeDecl = (_a2 = p.declarations) == null ? void 0 : _a2.find(or(isPropertyDeclaration, isAccessor, isVariableDeclaration, isPropertySignature, isBinaryExpression, isPropertyAccessExpression));
|
|
53401
53435
|
if (p.flags & 98304 /* Accessor */ && useAccessors) {
|
|
@@ -53437,7 +53471,7 @@ ${lanes.join("\n")}
|
|
|
53437
53471
|
));
|
|
53438
53472
|
}
|
|
53439
53473
|
if (p.flags & 32768 /* GetAccessor */) {
|
|
53440
|
-
const isPrivate2 = modifierFlags &
|
|
53474
|
+
const isPrivate2 = modifierFlags & 2 /* Private */;
|
|
53441
53475
|
result.push(setTextRange(
|
|
53442
53476
|
factory.createGetAccessorDeclaration(
|
|
53443
53477
|
factory.createModifiersFromModifierFlags(flag),
|
|
@@ -53454,7 +53488,7 @@ ${lanes.join("\n")}
|
|
|
53454
53488
|
} else if (p.flags & (4 /* Property */ | 3 /* Variable */ | 98304 /* Accessor */)) {
|
|
53455
53489
|
return setTextRange(
|
|
53456
53490
|
createProperty2(
|
|
53457
|
-
factory.createModifiersFromModifierFlags((isReadonlySymbol(p) ?
|
|
53491
|
+
factory.createModifiersFromModifierFlags((isReadonlySymbol(p) ? 8 /* Readonly */ : 0) | flag),
|
|
53458
53492
|
name,
|
|
53459
53493
|
p.flags & 16777216 /* Optional */ ? factory.createToken(58 /* QuestionToken */) : void 0,
|
|
53460
53494
|
isPrivate ? void 0 : serializeTypeForDeclaration(context, getWriteTypeOfSymbol(p), p, enclosingDeclaration, includePrivateSymbol, bundled),
|
|
@@ -53469,10 +53503,10 @@ ${lanes.join("\n")}
|
|
|
53469
53503
|
if (p.flags & (8192 /* Method */ | 16 /* Function */)) {
|
|
53470
53504
|
const type = getTypeOfSymbol(p);
|
|
53471
53505
|
const signatures = getSignaturesOfType(type, 0 /* Call */);
|
|
53472
|
-
if (flag &
|
|
53506
|
+
if (flag & 2 /* Private */) {
|
|
53473
53507
|
return setTextRange(
|
|
53474
53508
|
createProperty2(
|
|
53475
|
-
factory.createModifiersFromModifierFlags((isReadonlySymbol(p) ?
|
|
53509
|
+
factory.createModifiersFromModifierFlags((isReadonlySymbol(p) ? 8 /* Readonly */ : 0) | flag),
|
|
53476
53510
|
name,
|
|
53477
53511
|
p.flags & 16777216 /* Optional */ ? factory.createToken(58 /* QuestionToken */) : void 0,
|
|
53478
53512
|
/*type*/
|
|
@@ -53548,7 +53582,7 @@ ${lanes.join("\n")}
|
|
|
53548
53582
|
let privateProtected = 0;
|
|
53549
53583
|
for (const s of signatures) {
|
|
53550
53584
|
if (s.declaration) {
|
|
53551
|
-
privateProtected |= getSelectedEffectiveModifierFlags(s.declaration,
|
|
53585
|
+
privateProtected |= getSelectedEffectiveModifierFlags(s.declaration, 2 /* Private */ | 4 /* Protected */);
|
|
53552
53586
|
}
|
|
53553
53587
|
}
|
|
53554
53588
|
if (privateProtected) {
|
|
@@ -53741,10 +53775,10 @@ ${lanes.join("\n")}
|
|
|
53741
53775
|
return result || types;
|
|
53742
53776
|
}
|
|
53743
53777
|
function visibilityToString(flags) {
|
|
53744
|
-
if (flags ===
|
|
53778
|
+
if (flags === 2 /* Private */) {
|
|
53745
53779
|
return "private";
|
|
53746
53780
|
}
|
|
53747
|
-
if (flags ===
|
|
53781
|
+
if (flags === 4 /* Protected */) {
|
|
53748
53782
|
return "protected";
|
|
53749
53783
|
}
|
|
53750
53784
|
return "public";
|
|
@@ -53862,7 +53896,7 @@ ${lanes.join("\n")}
|
|
|
53862
53896
|
return true;
|
|
53863
53897
|
}
|
|
53864
53898
|
const parent2 = getDeclarationContainer(node);
|
|
53865
|
-
if (!(getCombinedModifierFlagsCached(node) &
|
|
53899
|
+
if (!(getCombinedModifierFlagsCached(node) & 32 /* Export */) && !(node.kind !== 271 /* ImportEqualsDeclaration */ && parent2.kind !== 312 /* SourceFile */ && parent2.flags & 33554432 /* Ambient */)) {
|
|
53866
53900
|
return isGlobalSourceFile(parent2);
|
|
53867
53901
|
}
|
|
53868
53902
|
return isDeclarationVisible(parent2);
|
|
@@ -53872,7 +53906,7 @@ ${lanes.join("\n")}
|
|
|
53872
53906
|
case 178 /* SetAccessor */:
|
|
53873
53907
|
case 174 /* MethodDeclaration */:
|
|
53874
53908
|
case 173 /* MethodSignature */:
|
|
53875
|
-
if (hasEffectiveModifier(node,
|
|
53909
|
+
if (hasEffectiveModifier(node, 2 /* Private */ | 4 /* Protected */)) {
|
|
53876
53910
|
return false;
|
|
53877
53911
|
}
|
|
53878
53912
|
case 176 /* Constructor */:
|
|
@@ -54091,7 +54125,7 @@ ${lanes.join("\n")}
|
|
|
54091
54125
|
const unspreadableToRestKeys = [];
|
|
54092
54126
|
for (const prop of getPropertiesOfType(source)) {
|
|
54093
54127
|
const literalTypeFromProperty = getLiteralTypeFromProperty(prop, 8576 /* StringOrNumberLiteralOrUnique */);
|
|
54094
|
-
if (!isTypeAssignableTo(literalTypeFromProperty, omitKeyType) && !(getDeclarationModifierFlagsFromSymbol(prop) & (
|
|
54128
|
+
if (!isTypeAssignableTo(literalTypeFromProperty, omitKeyType) && !(getDeclarationModifierFlagsFromSymbol(prop) & (2 /* Private */ | 4 /* Protected */)) && isSpreadableProperty(prop)) {
|
|
54095
54129
|
spreadableProperties.push(prop);
|
|
54096
54130
|
} else {
|
|
54097
54131
|
unspreadableToRestKeys.push(literalTypeFromProperty);
|
|
@@ -54297,7 +54331,7 @@ ${lanes.join("\n")}
|
|
|
54297
54331
|
if (declaredType) {
|
|
54298
54332
|
return addOptionality(declaredType, isProperty, isOptional);
|
|
54299
54333
|
}
|
|
54300
|
-
if ((noImplicitAny || isInJSFile(declaration)) && isVariableDeclaration(declaration) && !isBindingPattern(declaration.name) && !(getCombinedModifierFlagsCached(declaration) &
|
|
54334
|
+
if ((noImplicitAny || isInJSFile(declaration)) && isVariableDeclaration(declaration) && !isBindingPattern(declaration.name) && !(getCombinedModifierFlagsCached(declaration) & 32 /* Export */) && !(declaration.flags & 33554432 /* Ambient */)) {
|
|
54301
54335
|
if (!(getCombinedNodeFlagsCached(declaration) & 6 /* Constant */) && (!declaration.initializer || isNullOrUndefined3(declaration.initializer))) {
|
|
54302
54336
|
return autoType;
|
|
54303
54337
|
}
|
|
@@ -54345,7 +54379,7 @@ ${lanes.join("\n")}
|
|
|
54345
54379
|
if (isPropertyDeclaration(declaration) && (noImplicitAny || isInJSFile(declaration))) {
|
|
54346
54380
|
if (!hasStaticModifier(declaration)) {
|
|
54347
54381
|
const constructor = findConstructorDeclaration(declaration.parent);
|
|
54348
|
-
const type = constructor ? getFlowTypeInConstructor(declaration.symbol, constructor) : getEffectiveModifierFlags(declaration) &
|
|
54382
|
+
const type = constructor ? getFlowTypeInConstructor(declaration.symbol, constructor) : getEffectiveModifierFlags(declaration) & 128 /* Ambient */ ? getTypeOfPropertyInBaseClass(declaration.symbol) : void 0;
|
|
54349
54383
|
return type && addOptionality(
|
|
54350
54384
|
type,
|
|
54351
54385
|
/*isProperty*/
|
|
@@ -54354,7 +54388,7 @@ ${lanes.join("\n")}
|
|
|
54354
54388
|
);
|
|
54355
54389
|
} else {
|
|
54356
54390
|
const staticBlocks = filter(declaration.parent.members, isClassStaticBlockDeclaration);
|
|
54357
|
-
const type = staticBlocks.length ? getFlowTypeInStaticBlocks(declaration.symbol, staticBlocks) : getEffectiveModifierFlags(declaration) &
|
|
54391
|
+
const type = staticBlocks.length ? getFlowTypeInStaticBlocks(declaration.symbol, staticBlocks) : getEffectiveModifierFlags(declaration) & 128 /* Ambient */ ? getTypeOfPropertyInBaseClass(declaration.symbol) : void 0;
|
|
54358
54392
|
return type && addOptionality(
|
|
54359
54393
|
type,
|
|
54360
54394
|
/*isProperty*/
|
|
@@ -54458,7 +54492,7 @@ ${lanes.join("\n")}
|
|
|
54458
54492
|
return everyType(flowType, isNullableType) ? void 0 : convertAutoToAny(flowType);
|
|
54459
54493
|
}
|
|
54460
54494
|
function getFlowTypeOfProperty(reference, prop) {
|
|
54461
|
-
const initialType = (prop == null ? void 0 : prop.valueDeclaration) && (!isAutoTypedProperty(prop) || getEffectiveModifierFlags(prop.valueDeclaration) &
|
|
54495
|
+
const initialType = (prop == null ? void 0 : prop.valueDeclaration) && (!isAutoTypedProperty(prop) || getEffectiveModifierFlags(prop.valueDeclaration) & 128 /* Ambient */) && getTypeOfPropertyInBaseClass(prop) || undefinedType;
|
|
54462
54496
|
return getFlowTypeOfReference(reference, autoType, initialType);
|
|
54463
54497
|
}
|
|
54464
54498
|
function getWidenedTypeForAssignmentDeclaration(symbol, resolvedSymbol) {
|
|
@@ -55082,6 +55116,9 @@ ${lanes.join("\n")}
|
|
|
55082
55116
|
function getTypeOfAlias(symbol) {
|
|
55083
55117
|
const links = getSymbolLinks(symbol);
|
|
55084
55118
|
if (!links.type) {
|
|
55119
|
+
if (!pushTypeResolution(symbol, 0 /* Type */)) {
|
|
55120
|
+
return errorType;
|
|
55121
|
+
}
|
|
55085
55122
|
const targetSymbol = resolveAlias(symbol);
|
|
55086
55123
|
const exportSymbol = symbol.declarations && getTargetOfAliasDeclaration(
|
|
55087
55124
|
getDeclarationOfAliasSymbol(symbol),
|
|
@@ -55090,6 +55127,10 @@ ${lanes.join("\n")}
|
|
|
55090
55127
|
);
|
|
55091
55128
|
const declaredType = firstDefined(exportSymbol == null ? void 0 : exportSymbol.declarations, (d) => isExportAssignment(d) ? tryGetTypeFromEffectiveTypeNode(d) : void 0);
|
|
55092
55129
|
links.type = (exportSymbol == null ? void 0 : exportSymbol.declarations) && isDuplicatedCommonJSExport(exportSymbol.declarations) && symbol.declarations.length ? getFlowTypeFromCommonJSExport(exportSymbol) : isDuplicatedCommonJSExport(symbol.declarations) ? autoType : declaredType ? declaredType : getSymbolFlags(targetSymbol) & 111551 /* Value */ ? getTypeOfSymbol(targetSymbol) : errorType;
|
|
55130
|
+
if (!popTypeResolution()) {
|
|
55131
|
+
reportCircularityError(exportSymbol ?? symbol);
|
|
55132
|
+
return links.type = errorType;
|
|
55133
|
+
}
|
|
55093
55134
|
}
|
|
55094
55135
|
return links.type;
|
|
55095
55136
|
}
|
|
@@ -55103,12 +55144,19 @@ ${lanes.join("\n")}
|
|
|
55103
55144
|
}
|
|
55104
55145
|
function reportCircularityError(symbol) {
|
|
55105
55146
|
const declaration = symbol.valueDeclaration;
|
|
55106
|
-
if (
|
|
55107
|
-
|
|
55108
|
-
|
|
55109
|
-
|
|
55110
|
-
|
|
55111
|
-
|
|
55147
|
+
if (declaration) {
|
|
55148
|
+
if (getEffectiveTypeAnnotationNode(declaration)) {
|
|
55149
|
+
error2(symbol.valueDeclaration, Diagnostics._0_is_referenced_directly_or_indirectly_in_its_own_type_annotation, symbolToString(symbol));
|
|
55150
|
+
return errorType;
|
|
55151
|
+
}
|
|
55152
|
+
if (noImplicitAny && (declaration.kind !== 169 /* Parameter */ || declaration.initializer)) {
|
|
55153
|
+
error2(symbol.valueDeclaration, Diagnostics._0_implicitly_has_type_any_because_it_does_not_have_a_type_annotation_and_is_referenced_directly_or_indirectly_in_its_own_initializer, symbolToString(symbol));
|
|
55154
|
+
}
|
|
55155
|
+
} else if (symbol.flags & 2097152 /* Alias */) {
|
|
55156
|
+
const node = getDeclarationOfAliasSymbol(symbol);
|
|
55157
|
+
if (node) {
|
|
55158
|
+
error2(node, Diagnostics.Circular_definition_of_import_alias_0, symbolToString(symbol));
|
|
55159
|
+
}
|
|
55112
55160
|
}
|
|
55113
55161
|
return anyType;
|
|
55114
55162
|
}
|
|
@@ -56111,7 +56159,7 @@ ${lanes.join("\n")}
|
|
|
56111
56159
|
const baseConstructorType = getBaseConstructorTypeOfClass(classType);
|
|
56112
56160
|
const baseSignatures = getSignaturesOfType(baseConstructorType, 1 /* Construct */);
|
|
56113
56161
|
const declaration = getClassLikeDeclarationOfSymbol(classType.symbol);
|
|
56114
|
-
const isAbstract = !!declaration && hasSyntacticModifier(declaration,
|
|
56162
|
+
const isAbstract = !!declaration && hasSyntacticModifier(declaration, 64 /* Abstract */);
|
|
56115
56163
|
if (baseSignatures.length === 0) {
|
|
56116
56164
|
return [createSignature(
|
|
56117
56165
|
/*declaration*/
|
|
@@ -56887,7 +56935,7 @@ ${lanes.join("\n")}
|
|
|
56887
56935
|
}
|
|
56888
56936
|
function isConstTypeVariable(type, depth = 0) {
|
|
56889
56937
|
var _a;
|
|
56890
|
-
return depth < 5 && !!(type && (type.flags & 262144 /* TypeParameter */ && some((_a = type.symbol) == null ? void 0 : _a.declarations, (d) => hasSyntacticModifier(d,
|
|
56938
|
+
return depth < 5 && !!(type && (type.flags & 262144 /* TypeParameter */ && some((_a = type.symbol) == null ? void 0 : _a.declarations, (d) => hasSyntacticModifier(d, 4096 /* Const */)) || type.flags & 3145728 /* UnionOrIntersection */ && some(type.types, (t) => isConstTypeVariable(t, depth)) || type.flags & 8388608 /* IndexedAccess */ && isConstTypeVariable(type.objectType, depth + 1) || type.flags & 16777216 /* Conditional */ && isConstTypeVariable(getConstraintOfConditionalType(type), depth + 1) || type.flags & 33554432 /* Substitution */ && isConstTypeVariable(type.baseType, depth) || isGenericTupleType(type) && findIndex(getElementTypes(type), (t, i) => !!(type.target.elementFlags[i] & 8 /* Variadic */) && isConstTypeVariable(t, depth)) >= 0));
|
|
56891
56939
|
}
|
|
56892
56940
|
function getConstraintOfIndexedAccess(type) {
|
|
56893
56941
|
return hasNonCircularBaseConstraint(type) ? getConstraintFromIndexedAccess(type) : void 0;
|
|
@@ -57213,7 +57261,7 @@ ${lanes.join("\n")}
|
|
|
57213
57261
|
} else if (!isUnion && !isReadonlySymbol(prop)) {
|
|
57214
57262
|
checkFlags &= ~8 /* Readonly */;
|
|
57215
57263
|
}
|
|
57216
|
-
checkFlags |= (!(modifiers &
|
|
57264
|
+
checkFlags |= (!(modifiers & 6 /* NonPublicAccessibilityModifier */) ? 256 /* ContainsPublic */ : 0) | (modifiers & 4 /* Protected */ ? 512 /* ContainsProtected */ : 0) | (modifiers & 2 /* Private */ ? 1024 /* ContainsPrivate */ : 0) | (modifiers & 256 /* Static */ ? 2048 /* ContainsStatic */ : 0);
|
|
57217
57265
|
if (!isPrototypeProperty(prop)) {
|
|
57218
57266
|
syntheticFlag = 2 /* SyntheticProperty */;
|
|
57219
57267
|
}
|
|
@@ -57665,7 +57713,7 @@ ${lanes.join("\n")}
|
|
|
57665
57713
|
if (hasRestParameter(declaration) || isInJSFile(declaration) && maybeAddJsSyntheticRestParameter(declaration, parameters)) {
|
|
57666
57714
|
flags |= 1 /* HasRestParameter */;
|
|
57667
57715
|
}
|
|
57668
|
-
if (isConstructorTypeNode(declaration) && hasSyntacticModifier(declaration,
|
|
57716
|
+
if (isConstructorTypeNode(declaration) && hasSyntacticModifier(declaration, 64 /* Abstract */) || isConstructorDeclaration(declaration) && hasSyntacticModifier(declaration.parent, 64 /* Abstract */)) {
|
|
57669
57717
|
flags |= 4 /* Abstract */;
|
|
57670
57718
|
}
|
|
57671
57719
|
links.resolvedSignature = createSignature(
|
|
@@ -58035,7 +58083,7 @@ ${lanes.join("\n")}
|
|
|
58035
58083
|
if (parameter.type) {
|
|
58036
58084
|
forEachType(getTypeFromTypeNode(parameter.type), (keyType) => {
|
|
58037
58085
|
if (isValidIndexKeyType(keyType) && !findIndexInfo(indexInfos, keyType)) {
|
|
58038
|
-
indexInfos.push(createIndexInfo(keyType, declaration.type ? getTypeFromTypeNode(declaration.type) : anyType, hasEffectiveModifier(declaration,
|
|
58086
|
+
indexInfos.push(createIndexInfo(keyType, declaration.type ? getTypeFromTypeNode(declaration.type) : anyType, hasEffectiveModifier(declaration, 8 /* Readonly */), declaration));
|
|
58039
58087
|
}
|
|
58040
58088
|
});
|
|
58041
58089
|
}
|
|
@@ -59860,7 +59908,7 @@ ${lanes.join("\n")}
|
|
|
59860
59908
|
return neverType;
|
|
59861
59909
|
}
|
|
59862
59910
|
function getLiteralTypeFromProperty(prop, include, includeNonPublic) {
|
|
59863
|
-
if (includeNonPublic || !(getDeclarationModifierFlagsFromSymbol(prop) &
|
|
59911
|
+
if (includeNonPublic || !(getDeclarationModifierFlagsFromSymbol(prop) & 6 /* NonPublicAccessibilityModifier */)) {
|
|
59864
59912
|
let type = getSymbolLinks(getLateBoundSymbol(prop)).nameType;
|
|
59865
59913
|
if (!type) {
|
|
59866
59914
|
const name = getNameOfDeclaration(prop.valueDeclaration);
|
|
@@ -60294,7 +60342,7 @@ ${lanes.join("\n")}
|
|
|
60294
60342
|
}
|
|
60295
60343
|
function isPatternLiteralPlaceholderType(type) {
|
|
60296
60344
|
if (type.flags & 2097152 /* Intersection */) {
|
|
60297
|
-
return some(type.types, (t) => !!(t.flags & (2944 /* Literal */ |
|
|
60345
|
+
return !isGenericType(type) && some(type.types, (t) => !!(t.flags & (2944 /* Literal */ | 98304 /* Nullable */)) || isPatternLiteralPlaceholderType(t));
|
|
60298
60346
|
}
|
|
60299
60347
|
return !!(type.flags & (1 /* Any */ | 4 /* String */ | 8 /* Number */ | 64 /* BigInt */)) || isPatternLiteralType(type);
|
|
60300
60348
|
}
|
|
@@ -60805,7 +60853,7 @@ ${lanes.join("\n")}
|
|
|
60805
60853
|
function getAnonymousPartialType(type2) {
|
|
60806
60854
|
const members = createSymbolTable();
|
|
60807
60855
|
for (const prop of getPropertiesOfType(type2)) {
|
|
60808
|
-
if (getDeclarationModifierFlagsFromSymbol(prop) & (
|
|
60856
|
+
if (getDeclarationModifierFlagsFromSymbol(prop) & (2 /* Private */ | 4 /* Protected */)) {
|
|
60809
60857
|
} else if (isSpreadableProperty(prop)) {
|
|
60810
60858
|
const isSetonlyAccessor = prop.flags & 65536 /* SetAccessor */ && !(prop.flags & 32768 /* GetAccessor */);
|
|
60811
60859
|
const flags = 4 /* Property */ | 16777216 /* Optional */;
|
|
@@ -60867,7 +60915,7 @@ ${lanes.join("\n")}
|
|
|
60867
60915
|
const skippedPrivateMembers = /* @__PURE__ */ new Set();
|
|
60868
60916
|
const indexInfos = left === emptyObjectType ? getIndexInfosOfType(right) : getUnionIndexInfos([left, right]);
|
|
60869
60917
|
for (const rightProp of getPropertiesOfType(right)) {
|
|
60870
|
-
if (getDeclarationModifierFlagsFromSymbol(rightProp) & (
|
|
60918
|
+
if (getDeclarationModifierFlagsFromSymbol(rightProp) & (2 /* Private */ | 4 /* Protected */)) {
|
|
60871
60919
|
skippedPrivateMembers.add(rightProp.escapedName);
|
|
60872
60920
|
} else if (isSpreadableProperty(rightProp)) {
|
|
60873
60921
|
members.set(rightProp.escapedName, getSpreadSymbol(rightProp, readonly));
|
|
@@ -64434,25 +64482,25 @@ ${lanes.join("\n")}
|
|
|
64434
64482
|
function propertyRelatedTo(source2, target2, sourceProp, targetProp, getTypeOfSourceProperty, reportErrors2, intersectionState, skipOptional) {
|
|
64435
64483
|
const sourcePropFlags = getDeclarationModifierFlagsFromSymbol(sourceProp);
|
|
64436
64484
|
const targetPropFlags = getDeclarationModifierFlagsFromSymbol(targetProp);
|
|
64437
|
-
if (sourcePropFlags &
|
|
64485
|
+
if (sourcePropFlags & 2 /* Private */ || targetPropFlags & 2 /* Private */) {
|
|
64438
64486
|
if (sourceProp.valueDeclaration !== targetProp.valueDeclaration) {
|
|
64439
64487
|
if (reportErrors2) {
|
|
64440
|
-
if (sourcePropFlags &
|
|
64488
|
+
if (sourcePropFlags & 2 /* Private */ && targetPropFlags & 2 /* Private */) {
|
|
64441
64489
|
reportError(Diagnostics.Types_have_separate_declarations_of_a_private_property_0, symbolToString(targetProp));
|
|
64442
64490
|
} else {
|
|
64443
|
-
reportError(Diagnostics.Property_0_is_private_in_type_1_but_not_in_type_2, symbolToString(targetProp), typeToString(sourcePropFlags &
|
|
64491
|
+
reportError(Diagnostics.Property_0_is_private_in_type_1_but_not_in_type_2, symbolToString(targetProp), typeToString(sourcePropFlags & 2 /* Private */ ? source2 : target2), typeToString(sourcePropFlags & 2 /* Private */ ? target2 : source2));
|
|
64444
64492
|
}
|
|
64445
64493
|
}
|
|
64446
64494
|
return 0 /* False */;
|
|
64447
64495
|
}
|
|
64448
|
-
} else if (targetPropFlags &
|
|
64496
|
+
} else if (targetPropFlags & 4 /* Protected */) {
|
|
64449
64497
|
if (!isValidOverrideOf(sourceProp, targetProp)) {
|
|
64450
64498
|
if (reportErrors2) {
|
|
64451
64499
|
reportError(Diagnostics.Property_0_is_protected_but_type_1_is_not_a_class_derived_from_2, symbolToString(targetProp), typeToString(getDeclaringClass(sourceProp) || source2), typeToString(getDeclaringClass(targetProp) || target2));
|
|
64452
64500
|
}
|
|
64453
64501
|
return 0 /* False */;
|
|
64454
64502
|
}
|
|
64455
|
-
} else if (sourcePropFlags &
|
|
64503
|
+
} else if (sourcePropFlags & 4 /* Protected */) {
|
|
64456
64504
|
if (reportErrors2) {
|
|
64457
64505
|
reportError(Diagnostics.Property_0_is_protected_in_type_1_but_public_in_type_2, symbolToString(targetProp), typeToString(source2), typeToString(target2));
|
|
64458
64506
|
}
|
|
@@ -64982,15 +65030,15 @@ ${lanes.join("\n")}
|
|
|
64982
65030
|
if (!sourceSignature.declaration || !targetSignature.declaration) {
|
|
64983
65031
|
return true;
|
|
64984
65032
|
}
|
|
64985
|
-
const sourceAccessibility = getSelectedEffectiveModifierFlags(sourceSignature.declaration,
|
|
64986
|
-
const targetAccessibility = getSelectedEffectiveModifierFlags(targetSignature.declaration,
|
|
64987
|
-
if (targetAccessibility ===
|
|
65033
|
+
const sourceAccessibility = getSelectedEffectiveModifierFlags(sourceSignature.declaration, 6 /* NonPublicAccessibilityModifier */);
|
|
65034
|
+
const targetAccessibility = getSelectedEffectiveModifierFlags(targetSignature.declaration, 6 /* NonPublicAccessibilityModifier */);
|
|
65035
|
+
if (targetAccessibility === 2 /* Private */) {
|
|
64988
65036
|
return true;
|
|
64989
65037
|
}
|
|
64990
|
-
if (targetAccessibility ===
|
|
65038
|
+
if (targetAccessibility === 4 /* Protected */ && sourceAccessibility !== 2 /* Private */) {
|
|
64991
65039
|
return true;
|
|
64992
65040
|
}
|
|
64993
|
-
if (targetAccessibility !==
|
|
65041
|
+
if (targetAccessibility !== 4 /* Protected */ && !sourceAccessibility) {
|
|
64994
65042
|
return true;
|
|
64995
65043
|
}
|
|
64996
65044
|
if (reportErrors2) {
|
|
@@ -65090,7 +65138,7 @@ ${lanes.join("\n")}
|
|
|
65090
65138
|
const variances = [];
|
|
65091
65139
|
for (const tp of typeParameters) {
|
|
65092
65140
|
const modifiers = getTypeParameterModifiers(tp);
|
|
65093
|
-
let variance = modifiers &
|
|
65141
|
+
let variance = modifiers & 16384 /* Out */ ? modifiers & 8192 /* In */ ? 0 /* Invariant */ : 1 /* Covariant */ : modifiers & 8192 /* In */ ? 2 /* Contravariant */ : void 0;
|
|
65094
65142
|
if (variance === void 0) {
|
|
65095
65143
|
let unmeasurable = false;
|
|
65096
65144
|
let unreliable = false;
|
|
@@ -65138,7 +65186,7 @@ ${lanes.join("\n")}
|
|
|
65138
65186
|
}
|
|
65139
65187
|
function getTypeParameterModifiers(tp) {
|
|
65140
65188
|
var _a;
|
|
65141
|
-
return reduceLeft((_a = tp.symbol) == null ? void 0 : _a.declarations, (modifiers, d) => modifiers | getEffectiveModifierFlags(d), 0 /* None */) & (
|
|
65189
|
+
return reduceLeft((_a = tp.symbol) == null ? void 0 : _a.declarations, (modifiers, d) => modifiers | getEffectiveModifierFlags(d), 0 /* None */) & (8192 /* In */ | 16384 /* Out */ | 4096 /* Const */);
|
|
65142
65190
|
}
|
|
65143
65191
|
function hasCovariantVoidArgument(typeArguments, variances) {
|
|
65144
65192
|
for (let i = 0; i < variances.length; i++) {
|
|
@@ -65223,10 +65271,10 @@ ${lanes.join("\n")}
|
|
|
65223
65271
|
});
|
|
65224
65272
|
}
|
|
65225
65273
|
function isValidOverrideOf(sourceProp, targetProp) {
|
|
65226
|
-
return !forEachProperty2(targetProp, (tp) => getDeclarationModifierFlagsFromSymbol(tp) &
|
|
65274
|
+
return !forEachProperty2(targetProp, (tp) => getDeclarationModifierFlagsFromSymbol(tp) & 4 /* Protected */ ? !isPropertyInClassDerivedFrom(sourceProp, getDeclaringClass(tp)) : false);
|
|
65227
65275
|
}
|
|
65228
65276
|
function isClassDerivedFromDeclaringClasses(checkClass, prop, writing) {
|
|
65229
|
-
return forEachProperty2(prop, (p) => getDeclarationModifierFlagsFromSymbol(p, writing) &
|
|
65277
|
+
return forEachProperty2(prop, (p) => getDeclarationModifierFlagsFromSymbol(p, writing) & 4 /* Protected */ ? !hasBaseType(checkClass, getDeclaringClass(p)) : false) ? void 0 : checkClass;
|
|
65230
65278
|
}
|
|
65231
65279
|
function isDeeplyNestedType(type, stack, depth, maxDepth = 3) {
|
|
65232
65280
|
if (depth >= maxDepth) {
|
|
@@ -65303,8 +65351,8 @@ ${lanes.join("\n")}
|
|
|
65303
65351
|
if (sourceProp === targetProp) {
|
|
65304
65352
|
return -1 /* True */;
|
|
65305
65353
|
}
|
|
65306
|
-
const sourcePropAccessibility = getDeclarationModifierFlagsFromSymbol(sourceProp) &
|
|
65307
|
-
const targetPropAccessibility = getDeclarationModifierFlagsFromSymbol(targetProp) &
|
|
65354
|
+
const sourcePropAccessibility = getDeclarationModifierFlagsFromSymbol(sourceProp) & 6 /* NonPublicAccessibilityModifier */;
|
|
65355
|
+
const targetPropAccessibility = getDeclarationModifierFlagsFromSymbol(targetProp) & 6 /* NonPublicAccessibilityModifier */;
|
|
65308
65356
|
if (sourcePropAccessibility !== targetPropAccessibility) {
|
|
65309
65357
|
return 0 /* False */;
|
|
65310
65358
|
}
|
|
@@ -69298,7 +69346,7 @@ ${lanes.join("\n")}
|
|
|
69298
69346
|
if (languageVersion < 2 /* ES2015 */) {
|
|
69299
69347
|
if (container.kind === 219 /* ArrowFunction */) {
|
|
69300
69348
|
error2(node, Diagnostics.The_arguments_object_cannot_be_referenced_in_an_arrow_function_in_ES3_and_ES5_Consider_using_a_standard_function_expression);
|
|
69301
|
-
} else if (hasSyntacticModifier(container,
|
|
69349
|
+
} else if (hasSyntacticModifier(container, 1024 /* Async */)) {
|
|
69302
69350
|
error2(node, Diagnostics.The_arguments_object_cannot_be_referenced_in_an_async_function_or_method_in_ES3_and_ES5_Consider_using_a_standard_function_or_method);
|
|
69303
69351
|
}
|
|
69304
69352
|
}
|
|
@@ -69711,7 +69759,7 @@ ${lanes.join("\n")}
|
|
|
69711
69759
|
let inAsyncFunction = false;
|
|
69712
69760
|
if (!isCallExpression2) {
|
|
69713
69761
|
while (container && container.kind === 219 /* ArrowFunction */) {
|
|
69714
|
-
if (hasSyntacticModifier(container,
|
|
69762
|
+
if (hasSyntacticModifier(container, 1024 /* Async */))
|
|
69715
69763
|
inAsyncFunction = true;
|
|
69716
69764
|
container = getSuperContainer(
|
|
69717
69765
|
container,
|
|
@@ -69720,7 +69768,7 @@ ${lanes.join("\n")}
|
|
|
69720
69768
|
);
|
|
69721
69769
|
needToCaptureLexicalThis = languageVersion < 2 /* ES2015 */;
|
|
69722
69770
|
}
|
|
69723
|
-
if (container && hasSyntacticModifier(container,
|
|
69771
|
+
if (container && hasSyntacticModifier(container, 1024 /* Async */))
|
|
69724
69772
|
inAsyncFunction = true;
|
|
69725
69773
|
}
|
|
69726
69774
|
let nodeCheckFlag = 0;
|
|
@@ -70052,7 +70100,24 @@ ${lanes.join("\n")}
|
|
|
70052
70100
|
}
|
|
70053
70101
|
const signature = getContextualSignatureForFunctionLikeDeclaration(functionDecl);
|
|
70054
70102
|
if (signature && !isResolvingReturnTypeOfSignature(signature)) {
|
|
70055
|
-
|
|
70103
|
+
const returnType2 = getReturnTypeOfSignature(signature);
|
|
70104
|
+
const functionFlags = getFunctionFlags(functionDecl);
|
|
70105
|
+
if (functionFlags & 1 /* Generator */) {
|
|
70106
|
+
return filterType(returnType2, (t) => {
|
|
70107
|
+
return !!(t.flags & (3 /* AnyOrUnknown */ | 16384 /* Void */ | 58982400 /* InstantiableNonPrimitive */)) || checkGeneratorInstantiationAssignabilityToReturnType(
|
|
70108
|
+
t,
|
|
70109
|
+
functionFlags,
|
|
70110
|
+
/*errorNode*/
|
|
70111
|
+
void 0
|
|
70112
|
+
);
|
|
70113
|
+
});
|
|
70114
|
+
}
|
|
70115
|
+
if (functionFlags & 2 /* Async */) {
|
|
70116
|
+
return filterType(returnType2, (t) => {
|
|
70117
|
+
return !!(t.flags & (3 /* AnyOrUnknown */ | 16384 /* Void */ | 58982400 /* InstantiableNonPrimitive */)) || !!getAwaitedTypeOfPromise(t);
|
|
70118
|
+
});
|
|
70119
|
+
}
|
|
70120
|
+
return returnType2;
|
|
70056
70121
|
}
|
|
70057
70122
|
const iife = getImmediatelyInvokedFunctionExpression(functionDecl);
|
|
70058
70123
|
if (iife) {
|
|
@@ -70265,7 +70330,7 @@ ${lanes.join("\n")}
|
|
|
70265
70330
|
type,
|
|
70266
70331
|
(t) => {
|
|
70267
70332
|
var _a;
|
|
70268
|
-
if (isGenericMappedType(t) &&
|
|
70333
|
+
if (isGenericMappedType(t) && !t.declaration.nameType) {
|
|
70269
70334
|
const constraint = getConstraintTypeFromMappedType(t);
|
|
70270
70335
|
const constraintOfConstraint = getBaseConstraintOfType(constraint) || constraint;
|
|
70271
70336
|
const propertyNameType = nameType || getStringLiteralType(unescapeLeadingUnderscores(name));
|
|
@@ -71908,20 +71973,20 @@ ${lanes.join("\n")}
|
|
|
71908
71973
|
return false;
|
|
71909
71974
|
}
|
|
71910
71975
|
}
|
|
71911
|
-
if (flags &
|
|
71976
|
+
if (flags & 64 /* Abstract */) {
|
|
71912
71977
|
if (errorNode) {
|
|
71913
71978
|
error2(errorNode, Diagnostics.Abstract_method_0_in_class_1_cannot_be_accessed_via_super_expression, symbolToString(prop), typeToString(getDeclaringClass(prop)));
|
|
71914
71979
|
}
|
|
71915
71980
|
return false;
|
|
71916
71981
|
}
|
|
71917
|
-
if (!(flags &
|
|
71982
|
+
if (!(flags & 256 /* Static */) && ((_a = prop.declarations) == null ? void 0 : _a.some(isClassInstanceProperty))) {
|
|
71918
71983
|
if (errorNode) {
|
|
71919
71984
|
error2(errorNode, Diagnostics.Class_field_0_defined_by_the_parent_class_is_not_accessible_in_the_child_class_via_super, symbolToString(prop));
|
|
71920
71985
|
}
|
|
71921
71986
|
return false;
|
|
71922
71987
|
}
|
|
71923
71988
|
}
|
|
71924
|
-
if (flags &
|
|
71989
|
+
if (flags & 64 /* Abstract */ && symbolHasNonMethodDeclaration(prop) && (isThisProperty(location) || isThisInitializedObjectBindingExpression(location) || isObjectBindingPattern(location.parent) && isThisInitializedDeclaration(location.parent.parent))) {
|
|
71925
71990
|
const declaringClassDeclaration = getClassLikeDeclarationOfSymbol(getParentOfSymbol(prop));
|
|
71926
71991
|
if (declaringClassDeclaration && isNodeUsedDuringClassInitialization(location)) {
|
|
71927
71992
|
if (errorNode) {
|
|
@@ -71930,10 +71995,10 @@ ${lanes.join("\n")}
|
|
|
71930
71995
|
return false;
|
|
71931
71996
|
}
|
|
71932
71997
|
}
|
|
71933
|
-
if (!(flags &
|
|
71998
|
+
if (!(flags & 6 /* NonPublicAccessibilityModifier */)) {
|
|
71934
71999
|
return true;
|
|
71935
72000
|
}
|
|
71936
|
-
if (flags &
|
|
72001
|
+
if (flags & 2 /* Private */) {
|
|
71937
72002
|
const declaringClassDeclaration = getClassLikeDeclarationOfSymbol(getParentOfSymbol(prop));
|
|
71938
72003
|
if (!isNodeWithinClass(location, declaringClassDeclaration)) {
|
|
71939
72004
|
if (errorNode) {
|
|
@@ -71953,14 +72018,14 @@ ${lanes.join("\n")}
|
|
|
71953
72018
|
if (!enclosingClass) {
|
|
71954
72019
|
enclosingClass = getEnclosingClassFromThisParameter(location);
|
|
71955
72020
|
enclosingClass = enclosingClass && isClassDerivedFromDeclaringClasses(enclosingClass, prop, writing);
|
|
71956
|
-
if (flags &
|
|
72021
|
+
if (flags & 256 /* Static */ || !enclosingClass) {
|
|
71957
72022
|
if (errorNode) {
|
|
71958
72023
|
error2(errorNode, Diagnostics.Property_0_is_protected_and_only_accessible_within_class_1_and_its_subclasses, symbolToString(prop), typeToString(getDeclaringClass(prop) || containingType));
|
|
71959
72024
|
}
|
|
71960
72025
|
return false;
|
|
71961
72026
|
}
|
|
71962
72027
|
}
|
|
71963
|
-
if (flags &
|
|
72028
|
+
if (flags & 256 /* Static */) {
|
|
71964
72029
|
return true;
|
|
71965
72030
|
}
|
|
71966
72031
|
if (containingType.flags & 262144 /* TypeParameter */) {
|
|
@@ -72380,7 +72445,7 @@ ${lanes.join("\n")}
|
|
|
72380
72445
|
}
|
|
72381
72446
|
let diagnosticMessage;
|
|
72382
72447
|
const declarationName = idText(right);
|
|
72383
|
-
if (isInPropertyInitializerOrClassStaticBlock(node) && !isOptionalPropertyDeclaration(valueDeclaration) && !(isAccessExpression(node) && isAccessExpression(node.expression)) && !isBlockScopedNameDeclaredBeforeUse(valueDeclaration, right) && !(isMethodDeclaration(valueDeclaration) && getCombinedModifierFlagsCached(valueDeclaration) &
|
|
72448
|
+
if (isInPropertyInitializerOrClassStaticBlock(node) && !isOptionalPropertyDeclaration(valueDeclaration) && !(isAccessExpression(node) && isAccessExpression(node.expression)) && !isBlockScopedNameDeclaredBeforeUse(valueDeclaration, right) && !(isMethodDeclaration(valueDeclaration) && getCombinedModifierFlagsCached(valueDeclaration) & 256 /* Static */) && (useDefineForClassFields || !isPropertyDeclaredInAncestorClass(prop))) {
|
|
72384
72449
|
diagnosticMessage = error2(right, Diagnostics.Property_0_is_used_before_its_initialization, declarationName);
|
|
72385
72450
|
} else if (valueDeclaration.kind === 263 /* ClassDeclaration */ && node.parent.kind !== 183 /* TypeReference */ && !(valueDeclaration.flags & 33554432 /* Ambient */) && !isBlockScopedNameDeclaredBeforeUse(valueDeclaration, right)) {
|
|
72386
72451
|
diagnosticMessage = error2(right, Diagnostics.Class_0_used_before_its_declaration, declarationName);
|
|
@@ -72634,7 +72699,7 @@ ${lanes.join("\n")}
|
|
|
72634
72699
|
if (!valueDeclaration) {
|
|
72635
72700
|
return;
|
|
72636
72701
|
}
|
|
72637
|
-
const hasPrivateModifier = hasEffectiveModifier(valueDeclaration,
|
|
72702
|
+
const hasPrivateModifier = hasEffectiveModifier(valueDeclaration, 2 /* Private */);
|
|
72638
72703
|
const hasPrivateIdentifier = prop.valueDeclaration && isNamedDeclaration(prop.valueDeclaration) && isPrivateIdentifier(prop.valueDeclaration.name);
|
|
72639
72704
|
if (!hasPrivateModifier && !hasPrivateIdentifier) {
|
|
72640
72705
|
return;
|
|
@@ -74079,7 +74144,7 @@ ${lanes.join("\n")}
|
|
|
74079
74144
|
return resolveErrorCall(node);
|
|
74080
74145
|
}
|
|
74081
74146
|
const valueDecl = expressionType.symbol && getClassLikeDeclarationOfSymbol(expressionType.symbol);
|
|
74082
|
-
if (valueDecl && hasSyntacticModifier(valueDecl,
|
|
74147
|
+
if (valueDecl && hasSyntacticModifier(valueDecl, 64 /* Abstract */)) {
|
|
74083
74148
|
error2(node, Diagnostics.Cannot_create_an_instance_of_an_abstract_class);
|
|
74084
74149
|
return resolveErrorCall(node);
|
|
74085
74150
|
}
|
|
@@ -74142,7 +74207,7 @@ ${lanes.join("\n")}
|
|
|
74142
74207
|
return true;
|
|
74143
74208
|
}
|
|
74144
74209
|
const declaration = signature.declaration;
|
|
74145
|
-
const modifiers = getSelectedEffectiveModifierFlags(declaration,
|
|
74210
|
+
const modifiers = getSelectedEffectiveModifierFlags(declaration, 6 /* NonPublicAccessibilityModifier */);
|
|
74146
74211
|
if (!modifiers || declaration.kind !== 176 /* Constructor */) {
|
|
74147
74212
|
return true;
|
|
74148
74213
|
}
|
|
@@ -74150,16 +74215,16 @@ ${lanes.join("\n")}
|
|
|
74150
74215
|
const declaringClass = getDeclaredTypeOfSymbol(declaration.parent.symbol);
|
|
74151
74216
|
if (!isNodeWithinClass(node, declaringClassDeclaration)) {
|
|
74152
74217
|
const containingClass = getContainingClass(node);
|
|
74153
|
-
if (containingClass && modifiers &
|
|
74218
|
+
if (containingClass && modifiers & 4 /* Protected */) {
|
|
74154
74219
|
const containingType = getTypeOfNode(containingClass);
|
|
74155
74220
|
if (typeHasProtectedAccessibleBase(declaration.parent.symbol, containingType)) {
|
|
74156
74221
|
return true;
|
|
74157
74222
|
}
|
|
74158
74223
|
}
|
|
74159
|
-
if (modifiers &
|
|
74224
|
+
if (modifiers & 2 /* Private */) {
|
|
74160
74225
|
error2(node, Diagnostics.Constructor_of_class_0_is_private_and_only_accessible_within_the_class_declaration, typeToString(declaringClass));
|
|
74161
74226
|
}
|
|
74162
|
-
if (modifiers &
|
|
74227
|
+
if (modifiers & 4 /* Protected */) {
|
|
74163
74228
|
error2(node, Diagnostics.Constructor_of_class_0_is_protected_and_only_accessible_within_the_class_declaration, typeToString(declaringClass));
|
|
74164
74229
|
}
|
|
74165
74230
|
return false;
|
|
@@ -76136,7 +76201,7 @@ ${lanes.join("\n")}
|
|
|
76136
76201
|
return !setProp;
|
|
76137
76202
|
}
|
|
76138
76203
|
function isReadonlySymbol(symbol) {
|
|
76139
|
-
return !!(getCheckFlags(symbol) & 8 /* Readonly */ || symbol.flags & 4 /* Property */ && getDeclarationModifierFlagsFromSymbol(symbol) &
|
|
76204
|
+
return !!(getCheckFlags(symbol) & 8 /* Readonly */ || symbol.flags & 4 /* Property */ && getDeclarationModifierFlagsFromSymbol(symbol) & 8 /* Readonly */ || symbol.flags & 3 /* Variable */ && getDeclarationNodeFlagsFromSymbol(symbol) & 6 /* Constant */ || symbol.flags & 98304 /* Accessor */ && !(symbol.flags & 65536 /* SetAccessor */) || symbol.flags & 8 /* EnumMember */ || some(symbol.declarations, isReadonlyAssignmentDeclaration));
|
|
76140
76205
|
}
|
|
76141
76206
|
function isAssignmentToReadonlyEntity(expr, symbol, assignmentKind) {
|
|
76142
76207
|
var _a, _b;
|
|
@@ -77253,7 +77318,15 @@ ${lanes.join("\n")}
|
|
|
77253
77318
|
checkExternalEmitHelpers(node, 256 /* Values */);
|
|
77254
77319
|
}
|
|
77255
77320
|
}
|
|
77256
|
-
|
|
77321
|
+
let returnType = getReturnTypeFromAnnotation(func);
|
|
77322
|
+
if (returnType && returnType.flags & 1048576 /* Union */) {
|
|
77323
|
+
returnType = filterType(returnType, (t) => checkGeneratorInstantiationAssignabilityToReturnType(
|
|
77324
|
+
t,
|
|
77325
|
+
functionFlags,
|
|
77326
|
+
/*errorNode*/
|
|
77327
|
+
void 0
|
|
77328
|
+
));
|
|
77329
|
+
}
|
|
77257
77330
|
const iterationTypes = returnType && getIterationTypesOfGeneratorFunctionReturnType(returnType, isAsync);
|
|
77258
77331
|
const signatureYieldType = iterationTypes && iterationTypes.yieldType || anyType;
|
|
77259
77332
|
const signatureNextType = iterationTypes && iterationTypes.nextType || anyType;
|
|
@@ -77874,15 +77947,15 @@ ${lanes.join("\n")}
|
|
|
77874
77947
|
var _a, _b;
|
|
77875
77948
|
if (isInterfaceDeclaration(node.parent) || isClassLike(node.parent) || isTypeAliasDeclaration(node.parent)) {
|
|
77876
77949
|
const typeParameter = getDeclaredTypeOfTypeParameter(getSymbolOfDeclaration(node));
|
|
77877
|
-
const modifiers = getTypeParameterModifiers(typeParameter) & (
|
|
77950
|
+
const modifiers = getTypeParameterModifiers(typeParameter) & (8192 /* In */ | 16384 /* Out */);
|
|
77878
77951
|
if (modifiers) {
|
|
77879
77952
|
const symbol = getSymbolOfDeclaration(node.parent);
|
|
77880
77953
|
if (isTypeAliasDeclaration(node.parent) && !(getObjectFlags(getDeclaredTypeOfSymbol(symbol)) & (16 /* Anonymous */ | 32 /* Mapped */))) {
|
|
77881
77954
|
error2(node, Diagnostics.Variance_annotations_are_only_supported_in_type_aliases_for_object_function_constructor_and_mapped_types);
|
|
77882
|
-
} else if (modifiers ===
|
|
77955
|
+
} else if (modifiers === 8192 /* In */ || modifiers === 16384 /* Out */) {
|
|
77883
77956
|
(_a = tracing) == null ? void 0 : _a.push(tracing.Phase.CheckTypes, "checkTypeParameterDeferred", { parent: getTypeId(getDeclaredTypeOfSymbol(symbol)), id: getTypeId(typeParameter) });
|
|
77884
|
-
const source = createMarkerType(symbol, typeParameter, modifiers ===
|
|
77885
|
-
const target = createMarkerType(symbol, typeParameter, modifiers ===
|
|
77957
|
+
const source = createMarkerType(symbol, typeParameter, modifiers === 16384 /* Out */ ? markerSubTypeForCheck : markerSuperTypeForCheck);
|
|
77958
|
+
const target = createMarkerType(symbol, typeParameter, modifiers === 16384 /* Out */ ? markerSuperTypeForCheck : markerSubTypeForCheck);
|
|
77886
77959
|
const saveVarianceTypeParameter = typeParameter;
|
|
77887
77960
|
varianceTypeParameter = typeParameter;
|
|
77888
77961
|
checkTypeAssignableTo(source, target, node, Diagnostics.Type_0_is_not_assignable_to_type_1_as_implied_by_variance_annotation);
|
|
@@ -77896,7 +77969,7 @@ ${lanes.join("\n")}
|
|
|
77896
77969
|
checkGrammarModifiers(node);
|
|
77897
77970
|
checkVariableLikeDeclaration(node);
|
|
77898
77971
|
const func = getContainingFunction(node);
|
|
77899
|
-
if (hasSyntacticModifier(node,
|
|
77972
|
+
if (hasSyntacticModifier(node, 31 /* ParameterPropertyModifier */)) {
|
|
77900
77973
|
if (!(func.kind === 176 /* Constructor */ && nodeIsPresent(func.body))) {
|
|
77901
77974
|
error2(node, Diagnostics.A_parameter_property_is_only_allowed_in_a_constructor_implementation);
|
|
77902
77975
|
}
|
|
@@ -78066,11 +78139,7 @@ ${lanes.join("\n")}
|
|
|
78066
78139
|
if (returnType === voidType) {
|
|
78067
78140
|
error2(returnTypeErrorLocation, Diagnostics.A_generator_cannot_have_a_void_type_annotation);
|
|
78068
78141
|
} else {
|
|
78069
|
-
|
|
78070
|
-
const generatorReturnType = getIterationTypeOfGeneratorFunctionReturnType(1 /* Return */, returnType, (functionFlags2 & 2 /* Async */) !== 0) || generatorYieldType;
|
|
78071
|
-
const generatorNextType = getIterationTypeOfGeneratorFunctionReturnType(2 /* Next */, returnType, (functionFlags2 & 2 /* Async */) !== 0) || unknownType;
|
|
78072
|
-
const generatorInstantiation = createGeneratorReturnType(generatorYieldType, generatorReturnType, generatorNextType, !!(functionFlags2 & 2 /* Async */));
|
|
78073
|
-
checkTypeAssignableTo(generatorInstantiation, returnType, returnTypeErrorLocation);
|
|
78142
|
+
checkGeneratorInstantiationAssignabilityToReturnType(returnType, functionFlags2, returnTypeErrorLocation);
|
|
78074
78143
|
}
|
|
78075
78144
|
} else if ((functionFlags2 & 3 /* AsyncGenerator */) === 2 /* Async */) {
|
|
78076
78145
|
checkAsyncFunctionReturnType(node, returnTypeNode, returnTypeErrorLocation);
|
|
@@ -78081,6 +78150,13 @@ ${lanes.join("\n")}
|
|
|
78081
78150
|
}
|
|
78082
78151
|
}
|
|
78083
78152
|
}
|
|
78153
|
+
function checkGeneratorInstantiationAssignabilityToReturnType(returnType, functionFlags, errorNode) {
|
|
78154
|
+
const generatorYieldType = getIterationTypeOfGeneratorFunctionReturnType(0 /* Yield */, returnType, (functionFlags & 2 /* Async */) !== 0) || anyType;
|
|
78155
|
+
const generatorReturnType = getIterationTypeOfGeneratorFunctionReturnType(1 /* Return */, returnType, (functionFlags & 2 /* Async */) !== 0) || generatorYieldType;
|
|
78156
|
+
const generatorNextType = getIterationTypeOfGeneratorFunctionReturnType(2 /* Next */, returnType, (functionFlags & 2 /* Async */) !== 0) || unknownType;
|
|
78157
|
+
const generatorInstantiation = createGeneratorReturnType(generatorYieldType, generatorReturnType, generatorNextType, !!(functionFlags & 2 /* Async */));
|
|
78158
|
+
return checkTypeAssignableTo(generatorInstantiation, returnType, errorNode);
|
|
78159
|
+
}
|
|
78084
78160
|
function checkClassForDuplicateDeclarations(node) {
|
|
78085
78161
|
const instanceNames = /* @__PURE__ */ new Map();
|
|
78086
78162
|
const staticNames = /* @__PURE__ */ new Map();
|
|
@@ -78228,7 +78304,7 @@ ${lanes.join("\n")}
|
|
|
78228
78304
|
checkGrammarComputedPropertyName(node.name);
|
|
78229
78305
|
checkVariableLikeDeclaration(node);
|
|
78230
78306
|
setNodeLinksForPrivateIdentifierScope(node);
|
|
78231
|
-
if (hasSyntacticModifier(node,
|
|
78307
|
+
if (hasSyntacticModifier(node, 64 /* Abstract */) && node.kind === 172 /* PropertyDeclaration */ && node.initializer) {
|
|
78232
78308
|
error2(node, Diagnostics.Property_0_cannot_have_an_initializer_because_it_is_marked_abstract, declarationNameToString(node.name));
|
|
78233
78309
|
}
|
|
78234
78310
|
}
|
|
@@ -78245,7 +78321,7 @@ ${lanes.join("\n")}
|
|
|
78245
78321
|
error2(node.name, Diagnostics.Class_constructor_may_not_be_a_generator);
|
|
78246
78322
|
}
|
|
78247
78323
|
checkFunctionOrMethodDeclaration(node);
|
|
78248
|
-
if (hasSyntacticModifier(node,
|
|
78324
|
+
if (hasSyntacticModifier(node, 64 /* Abstract */) && node.kind === 174 /* MethodDeclaration */ && node.body) {
|
|
78249
78325
|
error2(node, Diagnostics.Method_0_cannot_have_an_implementation_because_it_is_marked_abstract, declarationNameToString(node.name));
|
|
78250
78326
|
}
|
|
78251
78327
|
if (isPrivateIdentifier(node.name) && !getContainingClass(node)) {
|
|
@@ -78302,7 +78378,7 @@ ${lanes.join("\n")}
|
|
|
78302
78378
|
if (classExtendsNull) {
|
|
78303
78379
|
error2(superCall, Diagnostics.A_constructor_cannot_contain_a_super_call_when_its_class_extends_null);
|
|
78304
78380
|
}
|
|
78305
|
-
const superCallShouldBeRootLevel = !emitStandardClassFields && (some(node.parent.members, isInstancePropertyWithInitializerOrPrivateIdentifierProperty) || some(node.parameters, (p) => hasSyntacticModifier(p,
|
|
78381
|
+
const superCallShouldBeRootLevel = !emitStandardClassFields && (some(node.parent.members, isInstancePropertyWithInitializerOrPrivateIdentifierProperty) || some(node.parameters, (p) => hasSyntacticModifier(p, 31 /* ParameterPropertyModifier */)));
|
|
78306
78382
|
if (superCallShouldBeRootLevel) {
|
|
78307
78383
|
if (!superCallIsRootLevelInConstructor(superCall, node.body)) {
|
|
78308
78384
|
error2(superCall, Diagnostics.A_super_call_must_be_a_root_level_statement_within_a_constructor_of_a_derived_class_that_contains_initialized_properties_parameter_properties_or_private_identifiers);
|
|
@@ -78371,11 +78447,11 @@ ${lanes.join("\n")}
|
|
|
78371
78447
|
getNodeLinks(getter).flags |= 1 /* TypeChecked */;
|
|
78372
78448
|
const getterFlags = getEffectiveModifierFlags(getter);
|
|
78373
78449
|
const setterFlags = getEffectiveModifierFlags(setter);
|
|
78374
|
-
if ((getterFlags &
|
|
78450
|
+
if ((getterFlags & 64 /* Abstract */) !== (setterFlags & 64 /* Abstract */)) {
|
|
78375
78451
|
error2(getter.name, Diagnostics.Accessors_must_both_be_abstract_or_non_abstract);
|
|
78376
78452
|
error2(setter.name, Diagnostics.Accessors_must_both_be_abstract_or_non_abstract);
|
|
78377
78453
|
}
|
|
78378
|
-
if (getterFlags &
|
|
78454
|
+
if (getterFlags & 4 /* Protected */ && !(setterFlags & (4 /* Protected */ | 2 /* Private */)) || getterFlags & 2 /* Private */ && !(setterFlags & 2 /* Private */)) {
|
|
78379
78455
|
error2(getter.name, Diagnostics.A_get_accessor_must_be_at_least_as_accessible_as_the_setter);
|
|
78380
78456
|
error2(setter.name, Diagnostics.A_get_accessor_must_be_at_least_as_accessible_as_the_setter);
|
|
78381
78457
|
}
|
|
@@ -78555,7 +78631,7 @@ ${lanes.join("\n")}
|
|
|
78555
78631
|
const propertyName = getPropertyNameFromIndex(indexType, accessNode);
|
|
78556
78632
|
if (propertyName) {
|
|
78557
78633
|
const propertySymbol = forEachType(apparentObjectType, (t) => getPropertyOfType(t, propertyName));
|
|
78558
|
-
if (propertySymbol && getDeclarationModifierFlagsFromSymbol(propertySymbol) &
|
|
78634
|
+
if (propertySymbol && getDeclarationModifierFlagsFromSymbol(propertySymbol) & 6 /* NonPublicAccessibilityModifier */) {
|
|
78559
78635
|
error2(accessNode, Diagnostics.Private_or_protected_member_0_cannot_be_accessed_on_a_type_parameter, unescapeLeadingUnderscores(propertyName));
|
|
78560
78636
|
return errorType;
|
|
78561
78637
|
}
|
|
@@ -78653,16 +78729,16 @@ ${lanes.join("\n")}
|
|
|
78653
78729
|
getTypeFromTypeNode(node);
|
|
78654
78730
|
}
|
|
78655
78731
|
function isPrivateWithinAmbient(node) {
|
|
78656
|
-
return (hasEffectiveModifier(node,
|
|
78732
|
+
return (hasEffectiveModifier(node, 2 /* Private */) || isPrivateIdentifierClassElementDeclaration(node)) && !!(node.flags & 33554432 /* Ambient */);
|
|
78657
78733
|
}
|
|
78658
78734
|
function getEffectiveDeclarationFlags(n, flagsToCheck) {
|
|
78659
78735
|
let flags = getCombinedModifierFlagsCached(n);
|
|
78660
78736
|
if (n.parent.kind !== 264 /* InterfaceDeclaration */ && n.parent.kind !== 263 /* ClassDeclaration */ && n.parent.kind !== 231 /* ClassExpression */ && n.flags & 33554432 /* Ambient */) {
|
|
78661
78737
|
const container = getEnclosingContainer(n);
|
|
78662
|
-
if (container && container.flags & 128 /* ExportContext */ && !(flags &
|
|
78663
|
-
flags |=
|
|
78738
|
+
if (container && container.flags & 128 /* ExportContext */ && !(flags & 128 /* Ambient */) && !(isModuleBlock(n.parent) && isModuleDeclaration(n.parent.parent) && isGlobalScopeAugmentation(n.parent.parent))) {
|
|
78739
|
+
flags |= 32 /* Export */;
|
|
78664
78740
|
}
|
|
78665
|
-
flags |=
|
|
78741
|
+
flags |= 128 /* Ambient */;
|
|
78666
78742
|
}
|
|
78667
78743
|
return flags & flagsToCheck;
|
|
78668
78744
|
}
|
|
@@ -78680,13 +78756,13 @@ ${lanes.join("\n")}
|
|
|
78680
78756
|
const canonicalFlags = getEffectiveDeclarationFlags(getCanonicalOverload(overloads, implementation), flagsToCheck2);
|
|
78681
78757
|
forEach(overloads, (o) => {
|
|
78682
78758
|
const deviation = getEffectiveDeclarationFlags(o, flagsToCheck2) ^ canonicalFlags;
|
|
78683
|
-
if (deviation &
|
|
78759
|
+
if (deviation & 32 /* Export */) {
|
|
78684
78760
|
error2(getNameOfDeclaration(o), Diagnostics.Overload_signatures_must_all_be_exported_or_non_exported);
|
|
78685
|
-
} else if (deviation &
|
|
78761
|
+
} else if (deviation & 128 /* Ambient */) {
|
|
78686
78762
|
error2(getNameOfDeclaration(o), Diagnostics.Overload_signatures_must_all_be_ambient_or_non_ambient);
|
|
78687
|
-
} else if (deviation & (
|
|
78763
|
+
} else if (deviation & (2 /* Private */ | 4 /* Protected */)) {
|
|
78688
78764
|
error2(getNameOfDeclaration(o) || o, Diagnostics.Overload_signatures_must_all_be_public_private_or_protected);
|
|
78689
|
-
} else if (deviation &
|
|
78765
|
+
} else if (deviation & 64 /* Abstract */) {
|
|
78690
78766
|
error2(getNameOfDeclaration(o), Diagnostics.Overload_signatures_must_all_be_abstract_or_non_abstract);
|
|
78691
78767
|
}
|
|
78692
78768
|
});
|
|
@@ -78703,7 +78779,7 @@ ${lanes.join("\n")}
|
|
|
78703
78779
|
});
|
|
78704
78780
|
}
|
|
78705
78781
|
}
|
|
78706
|
-
const flagsToCheck =
|
|
78782
|
+
const flagsToCheck = 32 /* Export */ | 128 /* Ambient */ | 2 /* Private */ | 4 /* Protected */ | 64 /* Abstract */;
|
|
78707
78783
|
let someNodeFlags = 0 /* None */;
|
|
78708
78784
|
let allNodeFlags = flagsToCheck;
|
|
78709
78785
|
let someHaveQuestionToken = false;
|
|
@@ -78751,7 +78827,7 @@ ${lanes.join("\n")}
|
|
|
78751
78827
|
if (isConstructor) {
|
|
78752
78828
|
error2(errorNode, Diagnostics.Constructor_implementation_is_missing);
|
|
78753
78829
|
} else {
|
|
78754
|
-
if (hasSyntacticModifier(node,
|
|
78830
|
+
if (hasSyntacticModifier(node, 64 /* Abstract */)) {
|
|
78755
78831
|
error2(errorNode, Diagnostics.All_declarations_of_an_abstract_method_must_be_consecutive);
|
|
78756
78832
|
} else {
|
|
78757
78833
|
error2(errorNode, Diagnostics.Function_implementation_is_missing_or_not_immediately_following_the_declaration);
|
|
@@ -78837,7 +78913,7 @@ ${lanes.join("\n")}
|
|
|
78837
78913
|
}
|
|
78838
78914
|
});
|
|
78839
78915
|
}
|
|
78840
|
-
if (lastSeenNonAmbientDeclaration && !lastSeenNonAmbientDeclaration.body && !hasSyntacticModifier(lastSeenNonAmbientDeclaration,
|
|
78916
|
+
if (lastSeenNonAmbientDeclaration && !lastSeenNonAmbientDeclaration.body && !hasSyntacticModifier(lastSeenNonAmbientDeclaration, 64 /* Abstract */) && !lastSeenNonAmbientDeclaration.questionToken) {
|
|
78841
78917
|
reportImplementationExpectedError(lastSeenNonAmbientDeclaration);
|
|
78842
78918
|
}
|
|
78843
78919
|
if (hasOverloads) {
|
|
@@ -78880,9 +78956,9 @@ ${lanes.join("\n")}
|
|
|
78880
78956
|
let defaultExportedDeclarationSpaces = 0 /* None */;
|
|
78881
78957
|
for (const d of symbol.declarations) {
|
|
78882
78958
|
const declarationSpaces = getDeclarationSpaces(d);
|
|
78883
|
-
const effectiveDeclarationFlags = getEffectiveDeclarationFlags(d,
|
|
78884
|
-
if (effectiveDeclarationFlags &
|
|
78885
|
-
if (effectiveDeclarationFlags &
|
|
78959
|
+
const effectiveDeclarationFlags = getEffectiveDeclarationFlags(d, 32 /* Export */ | 2048 /* Default */);
|
|
78960
|
+
if (effectiveDeclarationFlags & 32 /* Export */) {
|
|
78961
|
+
if (effectiveDeclarationFlags & 2048 /* Default */) {
|
|
78886
78962
|
defaultExportedDeclarationSpaces |= declarationSpaces;
|
|
78887
78963
|
} else {
|
|
78888
78964
|
exportedDeclarationSpaces |= declarationSpaces;
|
|
@@ -79523,6 +79599,12 @@ ${lanes.join("\n")}
|
|
|
79523
79599
|
}
|
|
79524
79600
|
}
|
|
79525
79601
|
}
|
|
79602
|
+
function checkJSDocThisTag(node) {
|
|
79603
|
+
const host2 = getEffectiveJSDocHost(node);
|
|
79604
|
+
if (host2 && isArrowFunction(host2)) {
|
|
79605
|
+
error2(node.tagName, Diagnostics.An_arrow_function_cannot_have_a_this_parameter);
|
|
79606
|
+
}
|
|
79607
|
+
}
|
|
79526
79608
|
function checkJSDocImplementsTag(node) {
|
|
79527
79609
|
const classLike = getEffectiveJSDocHost(node);
|
|
79528
79610
|
if (!classLike || !isClassDeclaration(classLike) && !isClassExpression(classLike)) {
|
|
@@ -79685,13 +79767,13 @@ ${lanes.join("\n")}
|
|
|
79685
79767
|
break;
|
|
79686
79768
|
}
|
|
79687
79769
|
const symbol = getSymbolOfDeclaration(member);
|
|
79688
|
-
if (!symbol.isReferenced && (hasEffectiveModifier(member,
|
|
79770
|
+
if (!symbol.isReferenced && (hasEffectiveModifier(member, 2 /* Private */) || isNamedDeclaration(member) && isPrivateIdentifier(member.name)) && !(member.flags & 33554432 /* Ambient */)) {
|
|
79689
79771
|
addDiagnostic(member, 0 /* Local */, createDiagnosticForNode(member.name, Diagnostics._0_is_declared_but_its_value_is_never_read, symbolToString(symbol)));
|
|
79690
79772
|
}
|
|
79691
79773
|
break;
|
|
79692
79774
|
case 176 /* Constructor */:
|
|
79693
79775
|
for (const parameter of member.parameters) {
|
|
79694
|
-
if (!parameter.symbol.isReferenced && hasSyntacticModifier(parameter,
|
|
79776
|
+
if (!parameter.symbol.isReferenced && hasSyntacticModifier(parameter, 2 /* Private */)) {
|
|
79695
79777
|
addDiagnostic(parameter, 0 /* Local */, createDiagnosticForNode(parameter.name, Diagnostics.Property_0_is_declared_but_its_value_is_never_read, symbolName(parameter.symbol)));
|
|
79696
79778
|
}
|
|
79697
79779
|
}
|
|
@@ -80137,7 +80219,7 @@ ${lanes.join("\n")}
|
|
|
80137
80219
|
}
|
|
80138
80220
|
forEach(node.name.elements, checkSourceElement);
|
|
80139
80221
|
}
|
|
80140
|
-
if (
|
|
80222
|
+
if (node.initializer && isParameterDeclaration(node) && nodeIsMissing(getContainingFunction(node).body)) {
|
|
80141
80223
|
error2(node, Diagnostics.A_parameter_initializer_is_only_allowed_in_a_function_or_constructor_implementation);
|
|
80142
80224
|
return;
|
|
80143
80225
|
}
|
|
@@ -80267,7 +80349,7 @@ ${lanes.join("\n")}
|
|
|
80267
80349
|
if (hasQuestionToken(left) !== hasQuestionToken(right)) {
|
|
80268
80350
|
return false;
|
|
80269
80351
|
}
|
|
80270
|
-
const interestingFlags =
|
|
80352
|
+
const interestingFlags = 2 /* Private */ | 4 /* Protected */ | 1024 /* Async */ | 64 /* Abstract */ | 8 /* Readonly */ | 256 /* Static */;
|
|
80271
80353
|
return getSelectedEffectiveModifierFlags(left, interestingFlags) === getSelectedEffectiveModifierFlags(right, interestingFlags);
|
|
80272
80354
|
}
|
|
80273
80355
|
function checkVariableDeclaration(node) {
|
|
@@ -81595,7 +81677,7 @@ ${lanes.join("\n")}
|
|
|
81595
81677
|
if (legacyDecorators && firstDecorator && some(node.members, (p) => hasStaticModifier(p) && isPrivateIdentifierClassElementDeclaration(p))) {
|
|
81596
81678
|
grammarErrorOnNode(firstDecorator, Diagnostics.Class_decorators_can_t_be_used_with_static_private_identifier_Consider_removing_the_experimental_decorator);
|
|
81597
81679
|
}
|
|
81598
|
-
if (!node.name && !hasSyntacticModifier(node,
|
|
81680
|
+
if (!node.name && !hasSyntacticModifier(node, 2048 /* Default */)) {
|
|
81599
81681
|
grammarErrorOnFirstToken(node, Diagnostics.A_class_declaration_without_the_default_modifier_must_have_a_name);
|
|
81600
81682
|
}
|
|
81601
81683
|
checkClassLikeDeclaration(node);
|
|
@@ -81661,7 +81743,7 @@ ${lanes.join("\n")}
|
|
|
81661
81743
|
error2(node.name || node, Diagnostics.A_mixin_class_must_have_a_constructor_with_a_single_rest_parameter_of_type_any);
|
|
81662
81744
|
} else {
|
|
81663
81745
|
const constructSignatures = getSignaturesOfType(baseConstructorType, 1 /* Construct */);
|
|
81664
|
-
if (constructSignatures.some((signature) => signature.flags & 4 /* Abstract */) && !hasSyntacticModifier(node,
|
|
81746
|
+
if (constructSignatures.some((signature) => signature.flags & 4 /* Abstract */) && !hasSyntacticModifier(node, 64 /* Abstract */)) {
|
|
81665
81747
|
error2(node.name || node, Diagnostics.A_mixin_class_that_extends_from_a_type_variable_containing_an_abstract_construct_signature_must_also_be_declared_abstract);
|
|
81666
81748
|
}
|
|
81667
81749
|
}
|
|
@@ -81875,7 +81957,7 @@ ${lanes.join("\n")}
|
|
|
81875
81957
|
const signatures = getSignaturesOfType(type, 1 /* Construct */);
|
|
81876
81958
|
if (signatures.length) {
|
|
81877
81959
|
const declaration = signatures[0].declaration;
|
|
81878
|
-
if (declaration && hasEffectiveModifier(declaration,
|
|
81960
|
+
if (declaration && hasEffectiveModifier(declaration, 2 /* Private */)) {
|
|
81879
81961
|
const typeClassDeclaration = getClassLikeDeclarationOfSymbol(type.symbol);
|
|
81880
81962
|
if (!isNodeWithinClass(node, typeClassDeclaration)) {
|
|
81881
81963
|
error2(node, Diagnostics.Cannot_extend_a_class_0_Class_constructor_is_marked_as_private, getFullyQualifiedName(type.symbol));
|
|
@@ -81895,7 +81977,7 @@ ${lanes.join("\n")}
|
|
|
81895
81977
|
const baseTypes = baseTypeNode && getBaseTypes(type);
|
|
81896
81978
|
const baseWithThis = (baseTypes == null ? void 0 : baseTypes.length) ? getTypeWithThisArgument(first(baseTypes), type.thisType) : void 0;
|
|
81897
81979
|
const baseStaticType = getBaseConstructorTypeOfClass(type);
|
|
81898
|
-
const memberHasOverrideModifier = member.parent ? hasOverrideModifier(member) : hasSyntacticModifier(member,
|
|
81980
|
+
const memberHasOverrideModifier = member.parent ? hasOverrideModifier(member) : hasSyntacticModifier(member, 16 /* Override */);
|
|
81899
81981
|
return checkMemberForOverrideModifier(
|
|
81900
81982
|
node,
|
|
81901
81983
|
staticType,
|
|
@@ -81936,7 +82018,7 @@ ${lanes.join("\n")}
|
|
|
81936
82018
|
Debug.assert(!!derived, "derived should point to something, even if it is the base class' declaration.");
|
|
81937
82019
|
if (derived === base) {
|
|
81938
82020
|
const derivedClassDecl = getClassLikeDeclarationOfSymbol(type.symbol);
|
|
81939
|
-
if (baseDeclarationFlags &
|
|
82021
|
+
if (baseDeclarationFlags & 64 /* Abstract */ && (!derivedClassDecl || !hasSyntacticModifier(derivedClassDecl, 64 /* Abstract */))) {
|
|
81940
82022
|
for (const otherBaseType of getBaseTypes(type)) {
|
|
81941
82023
|
if (otherBaseType === baseType)
|
|
81942
82024
|
continue;
|
|
@@ -81979,7 +82061,7 @@ ${lanes.join("\n")}
|
|
|
81979
82061
|
}
|
|
81980
82062
|
} else {
|
|
81981
82063
|
const derivedDeclarationFlags = getDeclarationModifierFlagsFromSymbol(derived);
|
|
81982
|
-
if (baseDeclarationFlags &
|
|
82064
|
+
if (baseDeclarationFlags & 2 /* Private */ || derivedDeclarationFlags & 2 /* Private */) {
|
|
81983
82065
|
continue;
|
|
81984
82066
|
}
|
|
81985
82067
|
let errorMessage;
|
|
@@ -81996,7 +82078,7 @@ ${lanes.join("\n")}
|
|
|
81996
82078
|
error2(getNameOfDeclaration(derived.valueDeclaration) || derived.valueDeclaration, errorMessage2, symbolToString(base), typeToString(baseType), typeToString(type));
|
|
81997
82079
|
} else if (useDefineForClassFields) {
|
|
81998
82080
|
const uninitialized = (_c = derived.declarations) == null ? void 0 : _c.find((d) => d.kind === 172 /* PropertyDeclaration */ && !d.initializer);
|
|
81999
|
-
if (uninitialized && !(derived.flags & 33554432 /* Transient */) && !(baseDeclarationFlags &
|
|
82081
|
+
if (uninitialized && !(derived.flags & 33554432 /* Transient */) && !(baseDeclarationFlags & 64 /* Abstract */) && !(derivedDeclarationFlags & 64 /* Abstract */) && !((_d = derived.declarations) == null ? void 0 : _d.some((d) => !!(d.flags & 33554432 /* Ambient */)))) {
|
|
82000
82082
|
const constructor = findConstructorDeclaration(getClassLikeDeclarationOfSymbol(type.symbol));
|
|
82001
82083
|
const propName = uninitialized.name;
|
|
82002
82084
|
if (uninitialized.exclamationToken || !constructor || !isIdentifier(propName) || !strictNullChecks || !isPropertyInitializedInConstructor(propName, type, constructor)) {
|
|
@@ -82023,7 +82105,7 @@ ${lanes.join("\n")}
|
|
|
82023
82105
|
}
|
|
82024
82106
|
}
|
|
82025
82107
|
function isPropertyAbstractOrInterface(declaration, baseDeclarationFlags) {
|
|
82026
|
-
return baseDeclarationFlags &
|
|
82108
|
+
return baseDeclarationFlags & 64 /* Abstract */ && (!isPropertyDeclaration(declaration) || !declaration.initializer) || isInterfaceDeclaration(declaration.parent);
|
|
82027
82109
|
}
|
|
82028
82110
|
function getNonInheritedProperties(type, baseTypes, properties) {
|
|
82029
82111
|
if (!length(baseTypes)) {
|
|
@@ -82088,7 +82170,7 @@ ${lanes.join("\n")}
|
|
|
82088
82170
|
}
|
|
82089
82171
|
const constructor = findConstructorDeclaration(node);
|
|
82090
82172
|
for (const member of node.members) {
|
|
82091
|
-
if (getEffectiveModifierFlags(member) &
|
|
82173
|
+
if (getEffectiveModifierFlags(member) & 128 /* Ambient */) {
|
|
82092
82174
|
continue;
|
|
82093
82175
|
}
|
|
82094
82176
|
if (!isStatic(member) && isPropertyWithoutInitializer(member)) {
|
|
@@ -82675,7 +82757,7 @@ ${lanes.join("\n")}
|
|
|
82675
82757
|
name
|
|
82676
82758
|
);
|
|
82677
82759
|
}
|
|
82678
|
-
if (isType && node.kind === 271 /* ImportEqualsDeclaration */ && hasEffectiveModifier(node,
|
|
82760
|
+
if (isType && node.kind === 271 /* ImportEqualsDeclaration */ && hasEffectiveModifier(node, 32 /* Export */)) {
|
|
82679
82761
|
error2(node, Diagnostics.Cannot_use_export_import_on_a_type_or_type_only_namespace_when_0_is_enabled, isolatedModulesLikeFlagName);
|
|
82680
82762
|
}
|
|
82681
82763
|
break;
|
|
@@ -82797,7 +82879,7 @@ ${lanes.join("\n")}
|
|
|
82797
82879
|
checkGrammarModifiers(node);
|
|
82798
82880
|
if (isInternalModuleImportEqualsDeclaration(node) || checkExternalImportOrExportDeclaration(node)) {
|
|
82799
82881
|
checkImportBinding(node);
|
|
82800
|
-
if (hasSyntacticModifier(node,
|
|
82882
|
+
if (hasSyntacticModifier(node, 32 /* Export */)) {
|
|
82801
82883
|
markExportAsReferenced(node);
|
|
82802
82884
|
}
|
|
82803
82885
|
if (node.moduleReference.kind !== 283 /* ExternalModuleReference */) {
|
|
@@ -83209,6 +83291,8 @@ ${lanes.join("\n")}
|
|
|
83209
83291
|
return checkJSDocAccessibilityModifiers(node);
|
|
83210
83292
|
case 357 /* JSDocSatisfiesTag */:
|
|
83211
83293
|
return checkJSDocSatisfiesTag(node);
|
|
83294
|
+
case 350 /* JSDocThisTag */:
|
|
83295
|
+
return checkJSDocThisTag(node);
|
|
83212
83296
|
case 199 /* IndexedAccessType */:
|
|
83213
83297
|
return checkIndexedAccessType(node);
|
|
83214
83298
|
case 200 /* MappedType */:
|
|
@@ -84435,7 +84519,7 @@ ${lanes.join("\n")}
|
|
|
84435
84519
|
return true;
|
|
84436
84520
|
}
|
|
84437
84521
|
const target = getSymbolLinks(symbol).aliasTarget;
|
|
84438
|
-
if (target && getEffectiveModifierFlags(node) &
|
|
84522
|
+
if (target && getEffectiveModifierFlags(node) & 32 /* Export */ && getSymbolFlags(target) & 111551 /* Value */ && (shouldPreserveConstEnums(compilerOptions) || !isConstEnumOrConstEnumOnlyModule(target))) {
|
|
84439
84523
|
return true;
|
|
84440
84524
|
}
|
|
84441
84525
|
}
|
|
@@ -84460,10 +84544,10 @@ ${lanes.join("\n")}
|
|
|
84460
84544
|
return false;
|
|
84461
84545
|
}
|
|
84462
84546
|
function isRequiredInitializedParameter(parameter) {
|
|
84463
|
-
return !!strictNullChecks && !isOptionalParameter(parameter) && !isJSDocParameterTag(parameter) && !!parameter.initializer && !hasSyntacticModifier(parameter,
|
|
84547
|
+
return !!strictNullChecks && !isOptionalParameter(parameter) && !isJSDocParameterTag(parameter) && !!parameter.initializer && !hasSyntacticModifier(parameter, 31 /* ParameterPropertyModifier */);
|
|
84464
84548
|
}
|
|
84465
84549
|
function isOptionalUninitializedParameterProperty(parameter) {
|
|
84466
|
-
return strictNullChecks && isOptionalParameter(parameter) && !parameter.initializer && hasSyntacticModifier(parameter,
|
|
84550
|
+
return strictNullChecks && isOptionalParameter(parameter) && !parameter.initializer && hasSyntacticModifier(parameter, 31 /* ParameterPropertyModifier */);
|
|
84467
84551
|
}
|
|
84468
84552
|
function isExpandoFunctionDeclaration(node) {
|
|
84469
84553
|
const declaration = getParseTreeNode(node, isFunctionDeclaration);
|
|
@@ -85317,10 +85401,10 @@ ${lanes.join("\n")}
|
|
|
85317
85401
|
return grammarErrorOnFirstToken(node, Diagnostics.Decorators_cannot_be_applied_to_multiple_get_Slashset_accessors_of_the_same_name);
|
|
85318
85402
|
}
|
|
85319
85403
|
}
|
|
85320
|
-
if (flags & ~(
|
|
85404
|
+
if (flags & ~(2080 /* ExportDefault */ | 32768 /* Decorator */)) {
|
|
85321
85405
|
return grammarErrorOnNode(modifier, Diagnostics.Decorators_are_not_valid_here);
|
|
85322
85406
|
}
|
|
85323
|
-
if (hasLeadingDecorators && flags &
|
|
85407
|
+
if (hasLeadingDecorators && flags & 98303 /* Modifier */) {
|
|
85324
85408
|
Debug.assertIsDefined(firstDecorator);
|
|
85325
85409
|
const sourceFile = getSourceFileOfNode(modifier);
|
|
85326
85410
|
if (!hasParseDiagnostics(sourceFile)) {
|
|
@@ -85332,10 +85416,10 @@ ${lanes.join("\n")}
|
|
|
85332
85416
|
}
|
|
85333
85417
|
return false;
|
|
85334
85418
|
}
|
|
85335
|
-
flags |=
|
|
85336
|
-
if (!(flags &
|
|
85419
|
+
flags |= 32768 /* Decorator */;
|
|
85420
|
+
if (!(flags & 98303 /* Modifier */)) {
|
|
85337
85421
|
hasLeadingDecorators = true;
|
|
85338
|
-
} else if (flags &
|
|
85422
|
+
} else if (flags & 32 /* Export */) {
|
|
85339
85423
|
sawExportBeforeDecorators = true;
|
|
85340
85424
|
}
|
|
85341
85425
|
firstDecorator ?? (firstDecorator = modifier);
|
|
@@ -85364,39 +85448,39 @@ ${lanes.join("\n")}
|
|
|
85364
85448
|
}
|
|
85365
85449
|
break;
|
|
85366
85450
|
case 164 /* OverrideKeyword */:
|
|
85367
|
-
if (flags &
|
|
85451
|
+
if (flags & 16 /* Override */) {
|
|
85368
85452
|
return grammarErrorOnNode(modifier, Diagnostics._0_modifier_already_seen, "override");
|
|
85369
|
-
} else if (flags &
|
|
85453
|
+
} else if (flags & 128 /* Ambient */) {
|
|
85370
85454
|
return grammarErrorOnNode(modifier, Diagnostics._0_modifier_cannot_be_used_with_1_modifier, "override", "declare");
|
|
85371
|
-
} else if (flags &
|
|
85455
|
+
} else if (flags & 8 /* Readonly */) {
|
|
85372
85456
|
return grammarErrorOnNode(modifier, Diagnostics._0_modifier_must_precede_1_modifier, "override", "readonly");
|
|
85373
|
-
} else if (flags &
|
|
85457
|
+
} else if (flags & 512 /* Accessor */) {
|
|
85374
85458
|
return grammarErrorOnNode(modifier, Diagnostics._0_modifier_must_precede_1_modifier, "override", "accessor");
|
|
85375
|
-
} else if (flags &
|
|
85459
|
+
} else if (flags & 1024 /* Async */) {
|
|
85376
85460
|
return grammarErrorOnNode(modifier, Diagnostics._0_modifier_must_precede_1_modifier, "override", "async");
|
|
85377
85461
|
}
|
|
85378
|
-
flags |=
|
|
85462
|
+
flags |= 16 /* Override */;
|
|
85379
85463
|
lastOverride = modifier;
|
|
85380
85464
|
break;
|
|
85381
85465
|
case 125 /* PublicKeyword */:
|
|
85382
85466
|
case 124 /* ProtectedKeyword */:
|
|
85383
85467
|
case 123 /* PrivateKeyword */:
|
|
85384
85468
|
const text = visibilityToString(modifierToFlag(modifier.kind));
|
|
85385
|
-
if (flags &
|
|
85469
|
+
if (flags & 7 /* AccessibilityModifier */) {
|
|
85386
85470
|
return grammarErrorOnNode(modifier, Diagnostics.Accessibility_modifier_already_seen);
|
|
85387
|
-
} else if (flags &
|
|
85471
|
+
} else if (flags & 16 /* Override */) {
|
|
85388
85472
|
return grammarErrorOnNode(modifier, Diagnostics._0_modifier_must_precede_1_modifier, text, "override");
|
|
85389
|
-
} else if (flags &
|
|
85473
|
+
} else if (flags & 256 /* Static */) {
|
|
85390
85474
|
return grammarErrorOnNode(modifier, Diagnostics._0_modifier_must_precede_1_modifier, text, "static");
|
|
85391
|
-
} else if (flags &
|
|
85475
|
+
} else if (flags & 512 /* Accessor */) {
|
|
85392
85476
|
return grammarErrorOnNode(modifier, Diagnostics._0_modifier_must_precede_1_modifier, text, "accessor");
|
|
85393
|
-
} else if (flags &
|
|
85477
|
+
} else if (flags & 8 /* Readonly */) {
|
|
85394
85478
|
return grammarErrorOnNode(modifier, Diagnostics._0_modifier_must_precede_1_modifier, text, "readonly");
|
|
85395
|
-
} else if (flags &
|
|
85479
|
+
} else if (flags & 1024 /* Async */) {
|
|
85396
85480
|
return grammarErrorOnNode(modifier, Diagnostics._0_modifier_must_precede_1_modifier, text, "async");
|
|
85397
85481
|
} else if (node.parent.kind === 268 /* ModuleBlock */ || node.parent.kind === 312 /* SourceFile */) {
|
|
85398
85482
|
return grammarErrorOnNode(modifier, Diagnostics._0_modifier_cannot_appear_on_a_module_or_namespace_element, text);
|
|
85399
|
-
} else if (flags &
|
|
85483
|
+
} else if (flags & 64 /* Abstract */) {
|
|
85400
85484
|
if (modifier.kind === 123 /* PrivateKeyword */) {
|
|
85401
85485
|
return grammarErrorOnNode(modifier, Diagnostics._0_modifier_cannot_be_used_with_1_modifier, text, "abstract");
|
|
85402
85486
|
} else {
|
|
@@ -85408,60 +85492,60 @@ ${lanes.join("\n")}
|
|
|
85408
85492
|
flags |= modifierToFlag(modifier.kind);
|
|
85409
85493
|
break;
|
|
85410
85494
|
case 126 /* StaticKeyword */:
|
|
85411
|
-
if (flags &
|
|
85495
|
+
if (flags & 256 /* Static */) {
|
|
85412
85496
|
return grammarErrorOnNode(modifier, Diagnostics._0_modifier_already_seen, "static");
|
|
85413
|
-
} else if (flags &
|
|
85497
|
+
} else if (flags & 8 /* Readonly */) {
|
|
85414
85498
|
return grammarErrorOnNode(modifier, Diagnostics._0_modifier_must_precede_1_modifier, "static", "readonly");
|
|
85415
|
-
} else if (flags &
|
|
85499
|
+
} else if (flags & 1024 /* Async */) {
|
|
85416
85500
|
return grammarErrorOnNode(modifier, Diagnostics._0_modifier_must_precede_1_modifier, "static", "async");
|
|
85417
|
-
} else if (flags &
|
|
85501
|
+
} else if (flags & 512 /* Accessor */) {
|
|
85418
85502
|
return grammarErrorOnNode(modifier, Diagnostics._0_modifier_must_precede_1_modifier, "static", "accessor");
|
|
85419
85503
|
} else if (node.parent.kind === 268 /* ModuleBlock */ || node.parent.kind === 312 /* SourceFile */) {
|
|
85420
85504
|
return grammarErrorOnNode(modifier, Diagnostics._0_modifier_cannot_appear_on_a_module_or_namespace_element, "static");
|
|
85421
85505
|
} else if (node.kind === 169 /* Parameter */) {
|
|
85422
85506
|
return grammarErrorOnNode(modifier, Diagnostics._0_modifier_cannot_appear_on_a_parameter, "static");
|
|
85423
|
-
} else if (flags &
|
|
85507
|
+
} else if (flags & 64 /* Abstract */) {
|
|
85424
85508
|
return grammarErrorOnNode(modifier, Diagnostics._0_modifier_cannot_be_used_with_1_modifier, "static", "abstract");
|
|
85425
|
-
} else if (flags &
|
|
85509
|
+
} else if (flags & 16 /* Override */) {
|
|
85426
85510
|
return grammarErrorOnNode(modifier, Diagnostics._0_modifier_must_precede_1_modifier, "static", "override");
|
|
85427
85511
|
}
|
|
85428
|
-
flags |=
|
|
85512
|
+
flags |= 256 /* Static */;
|
|
85429
85513
|
lastStatic = modifier;
|
|
85430
85514
|
break;
|
|
85431
85515
|
case 129 /* AccessorKeyword */:
|
|
85432
|
-
if (flags &
|
|
85516
|
+
if (flags & 512 /* Accessor */) {
|
|
85433
85517
|
return grammarErrorOnNode(modifier, Diagnostics._0_modifier_already_seen, "accessor");
|
|
85434
|
-
} else if (flags &
|
|
85518
|
+
} else if (flags & 8 /* Readonly */) {
|
|
85435
85519
|
return grammarErrorOnNode(modifier, Diagnostics._0_modifier_cannot_be_used_with_1_modifier, "accessor", "readonly");
|
|
85436
|
-
} else if (flags &
|
|
85520
|
+
} else if (flags & 128 /* Ambient */) {
|
|
85437
85521
|
return grammarErrorOnNode(modifier, Diagnostics._0_modifier_cannot_be_used_with_1_modifier, "accessor", "declare");
|
|
85438
85522
|
} else if (node.kind !== 172 /* PropertyDeclaration */) {
|
|
85439
85523
|
return grammarErrorOnNode(modifier, Diagnostics.accessor_modifier_can_only_appear_on_a_property_declaration);
|
|
85440
85524
|
}
|
|
85441
|
-
flags |=
|
|
85525
|
+
flags |= 512 /* Accessor */;
|
|
85442
85526
|
break;
|
|
85443
85527
|
case 148 /* ReadonlyKeyword */:
|
|
85444
|
-
if (flags &
|
|
85528
|
+
if (flags & 8 /* Readonly */) {
|
|
85445
85529
|
return grammarErrorOnNode(modifier, Diagnostics._0_modifier_already_seen, "readonly");
|
|
85446
85530
|
} else if (node.kind !== 172 /* PropertyDeclaration */ && node.kind !== 171 /* PropertySignature */ && node.kind !== 181 /* IndexSignature */ && node.kind !== 169 /* Parameter */) {
|
|
85447
85531
|
return grammarErrorOnNode(modifier, Diagnostics.readonly_modifier_can_only_appear_on_a_property_declaration_or_index_signature);
|
|
85448
|
-
} else if (flags &
|
|
85532
|
+
} else if (flags & 512 /* Accessor */) {
|
|
85449
85533
|
return grammarErrorOnNode(modifier, Diagnostics._0_modifier_cannot_be_used_with_1_modifier, "readonly", "accessor");
|
|
85450
85534
|
}
|
|
85451
|
-
flags |=
|
|
85535
|
+
flags |= 8 /* Readonly */;
|
|
85452
85536
|
break;
|
|
85453
85537
|
case 95 /* ExportKeyword */:
|
|
85454
85538
|
if (compilerOptions.verbatimModuleSyntax && !(node.flags & 33554432 /* Ambient */) && node.kind !== 265 /* TypeAliasDeclaration */ && node.kind !== 264 /* InterfaceDeclaration */ && // ModuleDeclaration needs to be checked that it is uninstantiated later
|
|
85455
85539
|
node.kind !== 267 /* ModuleDeclaration */ && node.parent.kind === 312 /* SourceFile */ && (moduleKind === 1 /* CommonJS */ || getSourceFileOfNode(node).impliedNodeFormat === 1 /* CommonJS */)) {
|
|
85456
85540
|
return grammarErrorOnNode(modifier, Diagnostics.A_top_level_export_modifier_cannot_be_used_on_value_declarations_in_a_CommonJS_module_when_verbatimModuleSyntax_is_enabled);
|
|
85457
85541
|
}
|
|
85458
|
-
if (flags &
|
|
85542
|
+
if (flags & 32 /* Export */) {
|
|
85459
85543
|
return grammarErrorOnNode(modifier, Diagnostics._0_modifier_already_seen, "export");
|
|
85460
|
-
} else if (flags &
|
|
85544
|
+
} else if (flags & 128 /* Ambient */) {
|
|
85461
85545
|
return grammarErrorOnNode(modifier, Diagnostics._0_modifier_must_precede_1_modifier, "export", "declare");
|
|
85462
|
-
} else if (flags &
|
|
85546
|
+
} else if (flags & 64 /* Abstract */) {
|
|
85463
85547
|
return grammarErrorOnNode(modifier, Diagnostics._0_modifier_must_precede_1_modifier, "export", "abstract");
|
|
85464
|
-
} else if (flags &
|
|
85548
|
+
} else if (flags & 1024 /* Async */) {
|
|
85465
85549
|
return grammarErrorOnNode(modifier, Diagnostics._0_modifier_must_precede_1_modifier, "export", "async");
|
|
85466
85550
|
} else if (isClassLike(node.parent)) {
|
|
85467
85551
|
return grammarErrorOnNode(modifier, Diagnostics._0_modifier_cannot_appear_on_class_elements_of_this_kind, "export");
|
|
@@ -85472,7 +85556,7 @@ ${lanes.join("\n")}
|
|
|
85472
85556
|
} else if (blockScopeKind === 6 /* AwaitUsing */) {
|
|
85473
85557
|
return grammarErrorOnNode(modifier, Diagnostics._0_modifier_cannot_appear_on_an_await_using_declaration, "export");
|
|
85474
85558
|
}
|
|
85475
|
-
flags |=
|
|
85559
|
+
flags |= 32 /* Export */;
|
|
85476
85560
|
break;
|
|
85477
85561
|
case 90 /* DefaultKeyword */:
|
|
85478
85562
|
const container = node.parent.kind === 312 /* SourceFile */ ? node.parent : node.parent.parent;
|
|
@@ -85482,19 +85566,19 @@ ${lanes.join("\n")}
|
|
|
85482
85566
|
return grammarErrorOnNode(modifier, Diagnostics._0_modifier_cannot_appear_on_a_using_declaration, "default");
|
|
85483
85567
|
} else if (blockScopeKind === 6 /* AwaitUsing */) {
|
|
85484
85568
|
return grammarErrorOnNode(modifier, Diagnostics._0_modifier_cannot_appear_on_an_await_using_declaration, "default");
|
|
85485
|
-
} else if (!(flags &
|
|
85569
|
+
} else if (!(flags & 32 /* Export */)) {
|
|
85486
85570
|
return grammarErrorOnNode(modifier, Diagnostics._0_modifier_must_precede_1_modifier, "export", "default");
|
|
85487
85571
|
} else if (sawExportBeforeDecorators) {
|
|
85488
85572
|
return grammarErrorOnNode(firstDecorator, Diagnostics.Decorators_are_not_valid_here);
|
|
85489
85573
|
}
|
|
85490
|
-
flags |=
|
|
85574
|
+
flags |= 2048 /* Default */;
|
|
85491
85575
|
break;
|
|
85492
85576
|
case 138 /* DeclareKeyword */:
|
|
85493
|
-
if (flags &
|
|
85577
|
+
if (flags & 128 /* Ambient */) {
|
|
85494
85578
|
return grammarErrorOnNode(modifier, Diagnostics._0_modifier_already_seen, "declare");
|
|
85495
|
-
} else if (flags &
|
|
85579
|
+
} else if (flags & 1024 /* Async */) {
|
|
85496
85580
|
return grammarErrorOnNode(modifier, Diagnostics._0_modifier_cannot_be_used_in_an_ambient_context, "async");
|
|
85497
|
-
} else if (flags &
|
|
85581
|
+
} else if (flags & 16 /* Override */) {
|
|
85498
85582
|
return grammarErrorOnNode(modifier, Diagnostics._0_modifier_cannot_be_used_in_an_ambient_context, "override");
|
|
85499
85583
|
} else if (isClassLike(node.parent) && !isPropertyDeclaration(node)) {
|
|
85500
85584
|
return grammarErrorOnNode(modifier, Diagnostics._0_modifier_cannot_appear_on_class_elements_of_this_kind, "declare");
|
|
@@ -85508,62 +85592,62 @@ ${lanes.join("\n")}
|
|
|
85508
85592
|
return grammarErrorOnNode(modifier, Diagnostics.A_declare_modifier_cannot_be_used_in_an_already_ambient_context);
|
|
85509
85593
|
} else if (isPrivateIdentifierClassElementDeclaration(node)) {
|
|
85510
85594
|
return grammarErrorOnNode(modifier, Diagnostics._0_modifier_cannot_be_used_with_a_private_identifier, "declare");
|
|
85511
|
-
} else if (flags &
|
|
85595
|
+
} else if (flags & 512 /* Accessor */) {
|
|
85512
85596
|
return grammarErrorOnNode(modifier, Diagnostics._0_modifier_cannot_be_used_with_1_modifier, "declare", "accessor");
|
|
85513
85597
|
}
|
|
85514
|
-
flags |=
|
|
85598
|
+
flags |= 128 /* Ambient */;
|
|
85515
85599
|
lastDeclare = modifier;
|
|
85516
85600
|
break;
|
|
85517
85601
|
case 128 /* AbstractKeyword */:
|
|
85518
|
-
if (flags &
|
|
85602
|
+
if (flags & 64 /* Abstract */) {
|
|
85519
85603
|
return grammarErrorOnNode(modifier, Diagnostics._0_modifier_already_seen, "abstract");
|
|
85520
85604
|
}
|
|
85521
85605
|
if (node.kind !== 263 /* ClassDeclaration */ && node.kind !== 185 /* ConstructorType */) {
|
|
85522
85606
|
if (node.kind !== 174 /* MethodDeclaration */ && node.kind !== 172 /* PropertyDeclaration */ && node.kind !== 177 /* GetAccessor */ && node.kind !== 178 /* SetAccessor */) {
|
|
85523
85607
|
return grammarErrorOnNode(modifier, Diagnostics.abstract_modifier_can_only_appear_on_a_class_method_or_property_declaration);
|
|
85524
85608
|
}
|
|
85525
|
-
if (!(node.parent.kind === 263 /* ClassDeclaration */ && hasSyntacticModifier(node.parent,
|
|
85609
|
+
if (!(node.parent.kind === 263 /* ClassDeclaration */ && hasSyntacticModifier(node.parent, 64 /* Abstract */))) {
|
|
85526
85610
|
const message = node.kind === 172 /* PropertyDeclaration */ ? Diagnostics.Abstract_properties_can_only_appear_within_an_abstract_class : Diagnostics.Abstract_methods_can_only_appear_within_an_abstract_class;
|
|
85527
85611
|
return grammarErrorOnNode(modifier, message);
|
|
85528
85612
|
}
|
|
85529
|
-
if (flags &
|
|
85613
|
+
if (flags & 256 /* Static */) {
|
|
85530
85614
|
return grammarErrorOnNode(modifier, Diagnostics._0_modifier_cannot_be_used_with_1_modifier, "static", "abstract");
|
|
85531
85615
|
}
|
|
85532
|
-
if (flags &
|
|
85616
|
+
if (flags & 2 /* Private */) {
|
|
85533
85617
|
return grammarErrorOnNode(modifier, Diagnostics._0_modifier_cannot_be_used_with_1_modifier, "private", "abstract");
|
|
85534
85618
|
}
|
|
85535
|
-
if (flags &
|
|
85619
|
+
if (flags & 1024 /* Async */ && lastAsync) {
|
|
85536
85620
|
return grammarErrorOnNode(lastAsync, Diagnostics._0_modifier_cannot_be_used_with_1_modifier, "async", "abstract");
|
|
85537
85621
|
}
|
|
85538
|
-
if (flags &
|
|
85622
|
+
if (flags & 16 /* Override */) {
|
|
85539
85623
|
return grammarErrorOnNode(modifier, Diagnostics._0_modifier_must_precede_1_modifier, "abstract", "override");
|
|
85540
85624
|
}
|
|
85541
|
-
if (flags &
|
|
85625
|
+
if (flags & 512 /* Accessor */) {
|
|
85542
85626
|
return grammarErrorOnNode(modifier, Diagnostics._0_modifier_must_precede_1_modifier, "abstract", "accessor");
|
|
85543
85627
|
}
|
|
85544
85628
|
}
|
|
85545
85629
|
if (isNamedDeclaration(node) && node.name.kind === 81 /* PrivateIdentifier */) {
|
|
85546
85630
|
return grammarErrorOnNode(modifier, Diagnostics._0_modifier_cannot_be_used_with_a_private_identifier, "abstract");
|
|
85547
85631
|
}
|
|
85548
|
-
flags |=
|
|
85632
|
+
flags |= 64 /* Abstract */;
|
|
85549
85633
|
break;
|
|
85550
85634
|
case 134 /* AsyncKeyword */:
|
|
85551
|
-
if (flags &
|
|
85635
|
+
if (flags & 1024 /* Async */) {
|
|
85552
85636
|
return grammarErrorOnNode(modifier, Diagnostics._0_modifier_already_seen, "async");
|
|
85553
|
-
} else if (flags &
|
|
85637
|
+
} else if (flags & 128 /* Ambient */ || node.parent.flags & 33554432 /* Ambient */) {
|
|
85554
85638
|
return grammarErrorOnNode(modifier, Diagnostics._0_modifier_cannot_be_used_in_an_ambient_context, "async");
|
|
85555
85639
|
} else if (node.kind === 169 /* Parameter */) {
|
|
85556
85640
|
return grammarErrorOnNode(modifier, Diagnostics._0_modifier_cannot_appear_on_a_parameter, "async");
|
|
85557
85641
|
}
|
|
85558
|
-
if (flags &
|
|
85642
|
+
if (flags & 64 /* Abstract */) {
|
|
85559
85643
|
return grammarErrorOnNode(modifier, Diagnostics._0_modifier_cannot_be_used_with_1_modifier, "async", "abstract");
|
|
85560
85644
|
}
|
|
85561
|
-
flags |=
|
|
85645
|
+
flags |= 1024 /* Async */;
|
|
85562
85646
|
lastAsync = modifier;
|
|
85563
85647
|
break;
|
|
85564
85648
|
case 103 /* InKeyword */:
|
|
85565
85649
|
case 147 /* OutKeyword */:
|
|
85566
|
-
const inOutFlag = modifier.kind === 103 /* InKeyword */ ?
|
|
85650
|
+
const inOutFlag = modifier.kind === 103 /* InKeyword */ ? 8192 /* In */ : 16384 /* Out */;
|
|
85567
85651
|
const inOutText = modifier.kind === 103 /* InKeyword */ ? "in" : "out";
|
|
85568
85652
|
if (node.kind !== 168 /* TypeParameter */ || !(isInterfaceDeclaration(node.parent) || isClassLike(node.parent) || isTypeAliasDeclaration(node.parent))) {
|
|
85569
85653
|
return grammarErrorOnNode(modifier, Diagnostics._0_modifier_can_only_appear_on_a_type_parameter_of_a_class_interface_or_type_alias, inOutText);
|
|
@@ -85571,7 +85655,7 @@ ${lanes.join("\n")}
|
|
|
85571
85655
|
if (flags & inOutFlag) {
|
|
85572
85656
|
return grammarErrorOnNode(modifier, Diagnostics._0_modifier_already_seen, inOutText);
|
|
85573
85657
|
}
|
|
85574
|
-
if (inOutFlag &
|
|
85658
|
+
if (inOutFlag & 8192 /* In */ && flags & 16384 /* Out */) {
|
|
85575
85659
|
return grammarErrorOnNode(modifier, Diagnostics._0_modifier_must_precede_1_modifier, "in", "out");
|
|
85576
85660
|
}
|
|
85577
85661
|
flags |= inOutFlag;
|
|
@@ -85580,24 +85664,24 @@ ${lanes.join("\n")}
|
|
|
85580
85664
|
}
|
|
85581
85665
|
}
|
|
85582
85666
|
if (node.kind === 176 /* Constructor */) {
|
|
85583
|
-
if (flags &
|
|
85667
|
+
if (flags & 256 /* Static */) {
|
|
85584
85668
|
return grammarErrorOnNode(lastStatic, Diagnostics._0_modifier_cannot_appear_on_a_constructor_declaration, "static");
|
|
85585
85669
|
}
|
|
85586
|
-
if (flags &
|
|
85670
|
+
if (flags & 16 /* Override */) {
|
|
85587
85671
|
return grammarErrorOnNode(lastOverride, Diagnostics._0_modifier_cannot_appear_on_a_constructor_declaration, "override");
|
|
85588
85672
|
}
|
|
85589
|
-
if (flags &
|
|
85673
|
+
if (flags & 1024 /* Async */) {
|
|
85590
85674
|
return grammarErrorOnNode(lastAsync, Diagnostics._0_modifier_cannot_appear_on_a_constructor_declaration, "async");
|
|
85591
85675
|
}
|
|
85592
85676
|
return false;
|
|
85593
|
-
} else if ((node.kind === 272 /* ImportDeclaration */ || node.kind === 271 /* ImportEqualsDeclaration */) && flags &
|
|
85677
|
+
} else if ((node.kind === 272 /* ImportDeclaration */ || node.kind === 271 /* ImportEqualsDeclaration */) && flags & 128 /* Ambient */) {
|
|
85594
85678
|
return grammarErrorOnNode(lastDeclare, Diagnostics.A_0_modifier_cannot_be_used_with_an_import_declaration, "declare");
|
|
85595
|
-
} else if (node.kind === 169 /* Parameter */ && flags &
|
|
85679
|
+
} else if (node.kind === 169 /* Parameter */ && flags & 31 /* ParameterPropertyModifier */ && isBindingPattern(node.name)) {
|
|
85596
85680
|
return grammarErrorOnNode(node, Diagnostics.A_parameter_property_may_not_be_declared_using_a_binding_pattern);
|
|
85597
|
-
} else if (node.kind === 169 /* Parameter */ && flags &
|
|
85681
|
+
} else if (node.kind === 169 /* Parameter */ && flags & 31 /* ParameterPropertyModifier */ && node.dotDotDotToken) {
|
|
85598
85682
|
return grammarErrorOnNode(node, Diagnostics.A_parameter_property_cannot_be_declared_using_a_rest_parameter);
|
|
85599
85683
|
}
|
|
85600
|
-
if (flags &
|
|
85684
|
+
if (flags & 1024 /* Async */) {
|
|
85601
85685
|
return checkGrammarAsyncModifier(node, lastAsync);
|
|
85602
85686
|
}
|
|
85603
85687
|
return false;
|
|
@@ -86117,12 +86201,12 @@ ${lanes.join("\n")}
|
|
|
86117
86201
|
if (languageVersion < 2 /* ES2015 */ && isPrivateIdentifier(accessor.name)) {
|
|
86118
86202
|
return grammarErrorOnNode(accessor.name, Diagnostics.Private_identifiers_are_only_available_when_targeting_ECMAScript_2015_and_higher);
|
|
86119
86203
|
}
|
|
86120
|
-
if (accessor.body === void 0 && !hasSyntacticModifier(accessor,
|
|
86204
|
+
if (accessor.body === void 0 && !hasSyntacticModifier(accessor, 64 /* Abstract */)) {
|
|
86121
86205
|
return grammarErrorAtPos(accessor, accessor.end - 1, ";".length, Diagnostics._0_expected, "{");
|
|
86122
86206
|
}
|
|
86123
86207
|
}
|
|
86124
86208
|
if (accessor.body) {
|
|
86125
|
-
if (hasSyntacticModifier(accessor,
|
|
86209
|
+
if (hasSyntacticModifier(accessor, 64 /* Abstract */)) {
|
|
86126
86210
|
return grammarErrorOnNode(accessor, Diagnostics.An_abstract_accessor_cannot_have_an_implementation);
|
|
86127
86211
|
}
|
|
86128
86212
|
if (accessor.parent.kind === 187 /* TypeLiteral */ || accessor.parent.kind === 264 /* InterfaceDeclaration */) {
|
|
@@ -86194,7 +86278,7 @@ ${lanes.join("\n")}
|
|
|
86194
86278
|
}
|
|
86195
86279
|
break;
|
|
86196
86280
|
case 171 /* PropertySignature */:
|
|
86197
|
-
if (!hasSyntacticModifier(parent2,
|
|
86281
|
+
if (!hasSyntacticModifier(parent2, 8 /* Readonly */)) {
|
|
86198
86282
|
return grammarErrorOnNode(parent2.name, Diagnostics.A_property_of_an_interface_or_type_literal_whose_type_is_a_unique_symbol_type_must_be_readonly);
|
|
86199
86283
|
}
|
|
86200
86284
|
break;
|
|
@@ -86364,7 +86448,7 @@ ${lanes.join("\n")}
|
|
|
86364
86448
|
const message = node.initializer ? Diagnostics.Declarations_with_initializers_cannot_also_have_definite_assignment_assertions : !node.type ? Diagnostics.Declarations_with_definite_assignment_assertions_must_also_have_type_annotations : Diagnostics.A_definite_assignment_assertion_is_not_permitted_in_this_context;
|
|
86365
86449
|
return grammarErrorOnNode(node.exclamationToken, message);
|
|
86366
86450
|
}
|
|
86367
|
-
if ((moduleKind < 5 /* ES2015 */ || getSourceFileOfNode(node).impliedNodeFormat === 1 /* CommonJS */) && moduleKind !== 4 /* System */ && !(node.parent.parent.flags & 33554432 /* Ambient */) && hasSyntacticModifier(node.parent.parent,
|
|
86451
|
+
if ((moduleKind < 5 /* ES2015 */ || getSourceFileOfNode(node).impliedNodeFormat === 1 /* CommonJS */) && moduleKind !== 4 /* System */ && !(node.parent.parent.flags & 33554432 /* Ambient */) && hasSyntacticModifier(node.parent.parent, 32 /* Export */)) {
|
|
86368
86452
|
checkESModuleMarker(node.name);
|
|
86369
86453
|
}
|
|
86370
86454
|
return !!blockScopeKind && checkGrammarNameInLetOrConstDeclarations(node.name);
|
|
@@ -86554,7 +86638,7 @@ ${lanes.join("\n")}
|
|
|
86554
86638
|
}
|
|
86555
86639
|
}
|
|
86556
86640
|
function checkGrammarTopLevelElementForRequiredDeclareModifier(node) {
|
|
86557
|
-
if (node.kind === 264 /* InterfaceDeclaration */ || node.kind === 265 /* TypeAliasDeclaration */ || node.kind === 272 /* ImportDeclaration */ || node.kind === 271 /* ImportEqualsDeclaration */ || node.kind === 278 /* ExportDeclaration */ || node.kind === 277 /* ExportAssignment */ || node.kind === 270 /* NamespaceExportDeclaration */ || hasSyntacticModifier(node,
|
|
86641
|
+
if (node.kind === 264 /* InterfaceDeclaration */ || node.kind === 265 /* TypeAliasDeclaration */ || node.kind === 272 /* ImportDeclaration */ || node.kind === 271 /* ImportEqualsDeclaration */ || node.kind === 278 /* ExportDeclaration */ || node.kind === 277 /* ExportAssignment */ || node.kind === 270 /* NamespaceExportDeclaration */ || hasSyntacticModifier(node, 128 /* Ambient */ | 32 /* Export */ | 2048 /* Default */)) {
|
|
86558
86642
|
return false;
|
|
86559
86643
|
}
|
|
86560
86644
|
return grammarErrorOnFirstToken(node, Diagnostics.Top_level_declarations_in_d_ts_files_must_start_with_either_a_declare_or_export_modifier);
|
|
@@ -87000,12 +87084,14 @@ ${lanes.join("\n")}
|
|
|
87000
87084
|
this.canTrackSymbol = !!((_a = this.inner) == null ? void 0 : _a.trackSymbol);
|
|
87001
87085
|
}
|
|
87002
87086
|
trackSymbol(symbol, enclosingDeclaration, meaning) {
|
|
87003
|
-
var _a;
|
|
87087
|
+
var _a, _b;
|
|
87004
87088
|
if (((_a = this.inner) == null ? void 0 : _a.trackSymbol) && !this.disableTrackSymbol) {
|
|
87005
87089
|
if (this.inner.trackSymbol(symbol, enclosingDeclaration, meaning)) {
|
|
87006
87090
|
this.onDiagnosticReported();
|
|
87007
87091
|
return true;
|
|
87008
87092
|
}
|
|
87093
|
+
if (!(symbol.flags & 262144 /* TypeParameter */))
|
|
87094
|
+
((_b = this.context).trackedSymbols ?? (_b.trackedSymbols = [])).push([symbol, enclosingDeclaration, meaning]);
|
|
87009
87095
|
}
|
|
87010
87096
|
return false;
|
|
87011
87097
|
}
|
|
@@ -89068,15 +89154,15 @@ ${lanes.join("\n")}
|
|
|
89068
89154
|
}
|
|
89069
89155
|
break;
|
|
89070
89156
|
case 243 /* VariableStatement */:
|
|
89071
|
-
if (hasSyntacticModifier(node,
|
|
89157
|
+
if (hasSyntacticModifier(node, 32 /* Export */)) {
|
|
89072
89158
|
for (const decl of node.declarationList.declarations) {
|
|
89073
89159
|
exportedNames = collectExportedVariableInfo(decl, uniqueExports, exportedNames, exportedBindings);
|
|
89074
89160
|
}
|
|
89075
89161
|
}
|
|
89076
89162
|
break;
|
|
89077
89163
|
case 262 /* FunctionDeclaration */:
|
|
89078
|
-
if (hasSyntacticModifier(node,
|
|
89079
|
-
if (hasSyntacticModifier(node,
|
|
89164
|
+
if (hasSyntacticModifier(node, 32 /* Export */)) {
|
|
89165
|
+
if (hasSyntacticModifier(node, 2048 /* Default */)) {
|
|
89080
89166
|
if (!hasExportDefault) {
|
|
89081
89167
|
multiMapSparseArrayAdd(exportedBindings, getOriginalNodeId(node), context.factory.getDeclarationName(node));
|
|
89082
89168
|
hasExportDefault = true;
|
|
@@ -89092,8 +89178,8 @@ ${lanes.join("\n")}
|
|
|
89092
89178
|
}
|
|
89093
89179
|
break;
|
|
89094
89180
|
case 263 /* ClassDeclaration */:
|
|
89095
|
-
if (hasSyntacticModifier(node,
|
|
89096
|
-
if (hasSyntacticModifier(node,
|
|
89181
|
+
if (hasSyntacticModifier(node, 32 /* Export */)) {
|
|
89182
|
+
if (hasSyntacticModifier(node, 2048 /* Default */)) {
|
|
89097
89183
|
if (!hasExportDefault) {
|
|
89098
89184
|
multiMapSparseArrayAdd(exportedBindings, getOriginalNodeId(node), context.factory.getDeclarationName(node));
|
|
89099
89185
|
hasExportDefault = true;
|
|
@@ -89983,7 +90069,7 @@ ${lanes.join("\n")}
|
|
|
89983
90069
|
// src/compiler/transformers/namedEvaluation.ts
|
|
89984
90070
|
function getAssignedNameOfIdentifier(factory2, name, expression) {
|
|
89985
90071
|
const original = getOriginalNode(skipOuterExpressions(expression));
|
|
89986
|
-
if ((isClassDeclaration(original) || isFunctionDeclaration(original)) && !original.name && hasSyntacticModifier(original,
|
|
90072
|
+
if ((isClassDeclaration(original) || isFunctionDeclaration(original)) && !original.name && hasSyntacticModifier(original, 2048 /* Default */)) {
|
|
89987
90073
|
return factory2.createStringLiteral("default");
|
|
89988
90074
|
}
|
|
89989
90075
|
return factory2.createStringLiteralFromNode(name);
|
|
@@ -90354,13 +90440,13 @@ ${lanes.join("\n")}
|
|
|
90354
90440
|
break;
|
|
90355
90441
|
case 263 /* ClassDeclaration */:
|
|
90356
90442
|
case 262 /* FunctionDeclaration */:
|
|
90357
|
-
if (hasSyntacticModifier(node,
|
|
90443
|
+
if (hasSyntacticModifier(node, 128 /* Ambient */)) {
|
|
90358
90444
|
break;
|
|
90359
90445
|
}
|
|
90360
90446
|
if (node.name) {
|
|
90361
90447
|
recordEmittedDeclarationInScope(node);
|
|
90362
90448
|
} else {
|
|
90363
|
-
Debug.assert(node.kind === 263 /* ClassDeclaration */ || hasSyntacticModifier(node,
|
|
90449
|
+
Debug.assert(node.kind === 263 /* ClassDeclaration */ || hasSyntacticModifier(node, 2048 /* Default */));
|
|
90364
90450
|
}
|
|
90365
90451
|
break;
|
|
90366
90452
|
}
|
|
@@ -90415,7 +90501,7 @@ ${lanes.join("\n")}
|
|
|
90415
90501
|
function namespaceElementVisitorWorker(node) {
|
|
90416
90502
|
if (node.kind === 278 /* ExportDeclaration */ || node.kind === 272 /* ImportDeclaration */ || node.kind === 273 /* ImportClause */ || node.kind === 271 /* ImportEqualsDeclaration */ && node.moduleReference.kind === 283 /* ExternalModuleReference */) {
|
|
90417
90503
|
return void 0;
|
|
90418
|
-
} else if (node.transformFlags & 1 /* ContainsTypeScript */ || hasSyntacticModifier(node,
|
|
90504
|
+
} else if (node.transformFlags & 1 /* ContainsTypeScript */ || hasSyntacticModifier(node, 32 /* Export */)) {
|
|
90419
90505
|
return visitTypeScript(node);
|
|
90420
90506
|
}
|
|
90421
90507
|
return node;
|
|
@@ -90473,7 +90559,7 @@ ${lanes.join("\n")}
|
|
|
90473
90559
|
function modifierVisitor(node) {
|
|
90474
90560
|
if (isDecorator(node))
|
|
90475
90561
|
return void 0;
|
|
90476
|
-
if (modifierToFlag(node.kind) &
|
|
90562
|
+
if (modifierToFlag(node.kind) & 28895 /* TypeScriptModifier */) {
|
|
90477
90563
|
return void 0;
|
|
90478
90564
|
} else if (currentNamespace && node.kind === 95 /* ExportKeyword */) {
|
|
90479
90565
|
return void 0;
|
|
@@ -90481,7 +90567,7 @@ ${lanes.join("\n")}
|
|
|
90481
90567
|
return node;
|
|
90482
90568
|
}
|
|
90483
90569
|
function visitTypeScript(node) {
|
|
90484
|
-
if (isStatement(node) && hasSyntacticModifier(node,
|
|
90570
|
+
if (isStatement(node) && hasSyntacticModifier(node, 128 /* Ambient */)) {
|
|
90485
90571
|
return factory2.createNotEmittedStatement(node);
|
|
90486
90572
|
}
|
|
90487
90573
|
switch (node.kind) {
|
|
@@ -90971,7 +91057,7 @@ ${lanes.join("\n")}
|
|
|
90971
91057
|
return !nodeIsMissing(node.body);
|
|
90972
91058
|
}
|
|
90973
91059
|
function visitPropertyDeclaration(node, parent2) {
|
|
90974
|
-
const isAmbient = node.flags & 33554432 /* Ambient */ || hasSyntacticModifier(node,
|
|
91060
|
+
const isAmbient = node.flags & 33554432 /* Ambient */ || hasSyntacticModifier(node, 64 /* Abstract */);
|
|
90975
91061
|
if (isAmbient && !(legacyDecorators && hasDecorators(node))) {
|
|
90976
91062
|
return void 0;
|
|
90977
91063
|
}
|
|
@@ -90980,7 +91066,7 @@ ${lanes.join("\n")}
|
|
|
90980
91066
|
if (isAmbient) {
|
|
90981
91067
|
return factory2.updatePropertyDeclaration(
|
|
90982
91068
|
node,
|
|
90983
|
-
concatenate(modifiers, factory2.createModifiersFromModifierFlags(
|
|
91069
|
+
concatenate(modifiers, factory2.createModifiersFromModifierFlags(128 /* Ambient */)),
|
|
90984
91070
|
Debug.checkDefined(visitNode(node.name, visitor, isPropertyName)),
|
|
90985
91071
|
/*questionOrExclamationToken*/
|
|
90986
91072
|
void 0,
|
|
@@ -91143,7 +91229,7 @@ ${lanes.join("\n")}
|
|
|
91143
91229
|
);
|
|
91144
91230
|
}
|
|
91145
91231
|
function shouldEmitAccessorDeclaration(node) {
|
|
91146
|
-
return !(nodeIsMissing(node.body) && hasSyntacticModifier(node,
|
|
91232
|
+
return !(nodeIsMissing(node.body) && hasSyntacticModifier(node, 64 /* Abstract */));
|
|
91147
91233
|
}
|
|
91148
91234
|
function visitGetAccessor(node, parent2) {
|
|
91149
91235
|
if (!(node.transformFlags & 1 /* ContainsTypeScript */)) {
|
|
@@ -91876,16 +91962,16 @@ ${lanes.join("\n")}
|
|
|
91876
91962
|
}
|
|
91877
91963
|
}
|
|
91878
91964
|
function isExportOfNamespace(node) {
|
|
91879
|
-
return currentNamespace !== void 0 && hasSyntacticModifier(node,
|
|
91965
|
+
return currentNamespace !== void 0 && hasSyntacticModifier(node, 32 /* Export */);
|
|
91880
91966
|
}
|
|
91881
91967
|
function isExternalModuleExport(node) {
|
|
91882
|
-
return currentNamespace === void 0 && hasSyntacticModifier(node,
|
|
91968
|
+
return currentNamespace === void 0 && hasSyntacticModifier(node, 32 /* Export */);
|
|
91883
91969
|
}
|
|
91884
91970
|
function isNamedExternalModuleExport(node) {
|
|
91885
|
-
return isExternalModuleExport(node) && !hasSyntacticModifier(node,
|
|
91971
|
+
return isExternalModuleExport(node) && !hasSyntacticModifier(node, 2048 /* Default */);
|
|
91886
91972
|
}
|
|
91887
91973
|
function isDefaultExternalModuleExport(node) {
|
|
91888
|
-
return isExternalModuleExport(node) && hasSyntacticModifier(node,
|
|
91974
|
+
return isExternalModuleExport(node) && hasSyntacticModifier(node, 2048 /* Default */);
|
|
91889
91975
|
}
|
|
91890
91976
|
function createExportMemberAssignmentStatement(node) {
|
|
91891
91977
|
const expression = factory2.createAssignment(
|
|
@@ -93226,8 +93312,8 @@ ${lanes.join("\n")}
|
|
|
93226
93312
|
getClassLexicalEnvironment().classThis = node.emitNode.classThis;
|
|
93227
93313
|
}
|
|
93228
93314
|
const isClassWithConstructorReference = resolver.getNodeCheckFlags(node) & 262144 /* ContainsConstructorReference */;
|
|
93229
|
-
const isExport = hasSyntacticModifier(node,
|
|
93230
|
-
const isDefault = hasSyntacticModifier(node,
|
|
93315
|
+
const isExport = hasSyntacticModifier(node, 32 /* Export */);
|
|
93316
|
+
const isDefault = hasSyntacticModifier(node, 2048 /* Default */);
|
|
93231
93317
|
let modifiers = visitNodes2(node.modifiers, modifierVisitor, isModifier);
|
|
93232
93318
|
const heritageClauses = visitNodes2(node.heritageClauses, heritageClauseVisitor, isHeritageClause);
|
|
93233
93319
|
const { members, prologue } = transformClassMembers(node);
|
|
@@ -93773,7 +93859,7 @@ ${lanes.join("\n")}
|
|
|
93773
93859
|
return void 0;
|
|
93774
93860
|
}
|
|
93775
93861
|
const propertyOriginalNode = getOriginalNode(property);
|
|
93776
|
-
if (hasSyntacticModifier(propertyOriginalNode,
|
|
93862
|
+
if (hasSyntacticModifier(propertyOriginalNode, 64 /* Abstract */)) {
|
|
93777
93863
|
return void 0;
|
|
93778
93864
|
}
|
|
93779
93865
|
let initializer = visitNode(property.initializer, visitor, isExpression);
|
|
@@ -94821,8 +94907,8 @@ ${lanes.join("\n")}
|
|
|
94821
94907
|
return addRange([updated], decorationStatements);
|
|
94822
94908
|
}
|
|
94823
94909
|
function transformClassDeclarationWithClassDecorators(node, name) {
|
|
94824
|
-
const isExport = hasSyntacticModifier(node,
|
|
94825
|
-
const isDefault = hasSyntacticModifier(node,
|
|
94910
|
+
const isExport = hasSyntacticModifier(node, 32 /* Export */);
|
|
94911
|
+
const isDefault = hasSyntacticModifier(node, 2048 /* Default */);
|
|
94826
94912
|
const modifiers = visitNodes2(node.modifiers, (node2) => isExportOrDefaultModifier(node2) || isDecorator(node2) ? void 0 : node2, isModifierLike);
|
|
94827
94913
|
const location = moveRangePastModifiers(node);
|
|
94828
94914
|
const classAlias = getClassAliasIfNeeded(node);
|
|
@@ -94843,7 +94929,7 @@ ${lanes.join("\n")}
|
|
|
94843
94929
|
let members = visitNodes2(node.members, visitor, isClassElement);
|
|
94844
94930
|
let decorationStatements = [];
|
|
94845
94931
|
({ members, decorationStatements } = transformDecoratorsOfClassElements(node, members));
|
|
94846
|
-
const assignClassAliasInStaticBlock = languageVersion >= 9 /* ES2022 */ && !!classAlias && some(members, (member) => isPropertyDeclaration(member) && hasSyntacticModifier(member,
|
|
94932
|
+
const assignClassAliasInStaticBlock = languageVersion >= 9 /* ES2022 */ && !!classAlias && some(members, (member) => isPropertyDeclaration(member) && hasSyntacticModifier(member, 256 /* Static */) || isClassStaticBlockDeclaration(member));
|
|
94847
94933
|
if (assignClassAliasInStaticBlock) {
|
|
94848
94934
|
members = setTextRange(
|
|
94849
94935
|
factory2.createNodeArray([
|
|
@@ -94974,7 +95060,7 @@ ${lanes.join("\n")}
|
|
|
94974
95060
|
);
|
|
94975
95061
|
}
|
|
94976
95062
|
function visitPropertyDeclaration(node) {
|
|
94977
|
-
if (node.flags & 33554432 /* Ambient */ || hasSyntacticModifier(node,
|
|
95063
|
+
if (node.flags & 33554432 /* Ambient */ || hasSyntacticModifier(node, 128 /* Ambient */)) {
|
|
94978
95064
|
return void 0;
|
|
94979
95065
|
}
|
|
94980
95066
|
return finishClassElement(
|
|
@@ -95062,7 +95148,7 @@ ${lanes.join("\n")}
|
|
|
95062
95148
|
const memberName = getExpressionForPropertyName(
|
|
95063
95149
|
member,
|
|
95064
95150
|
/*generateNameForComputedPropertyName*/
|
|
95065
|
-
!hasSyntacticModifier(member,
|
|
95151
|
+
!hasSyntacticModifier(member, 128 /* Ambient */)
|
|
95066
95152
|
);
|
|
95067
95153
|
const descriptor = languageVersion > 0 /* ES3 */ ? isPropertyDeclaration(member) && !hasAccessorModifier(member) ? factory2.createVoidZero() : factory2.createNull() : void 0;
|
|
95068
95154
|
const helper = emitHelpers().createDecorateHelper(
|
|
@@ -95851,8 +95937,8 @@ ${lanes.join("\n")}
|
|
|
95851
95937
|
const statements = [];
|
|
95852
95938
|
const originalClass = getOriginalNode(node, isClassLike) ?? node;
|
|
95853
95939
|
const className = originalClass.name ? factory2.createStringLiteralFromNode(originalClass.name) : factory2.createStringLiteral("default");
|
|
95854
|
-
const isExport = hasSyntacticModifier(node,
|
|
95855
|
-
const isDefault = hasSyntacticModifier(node,
|
|
95940
|
+
const isExport = hasSyntacticModifier(node, 32 /* Export */);
|
|
95941
|
+
const isDefault = hasSyntacticModifier(node, 2048 /* Default */);
|
|
95856
95942
|
if (!node.name) {
|
|
95857
95943
|
node = injectClassNamedEvaluationHelperBlockIfMissing(context, node, className);
|
|
95858
95944
|
}
|
|
@@ -98175,7 +98261,7 @@ ${lanes.join("\n")}
|
|
|
98175
98261
|
return visitEachChild(node, visitor, context);
|
|
98176
98262
|
}
|
|
98177
98263
|
function visitVariableStatement(node) {
|
|
98178
|
-
if (hasSyntacticModifier(node,
|
|
98264
|
+
if (hasSyntacticModifier(node, 32 /* Export */)) {
|
|
98179
98265
|
const savedExportedVariableStatement = exportedVariableStatement;
|
|
98180
98266
|
exportedVariableStatement = true;
|
|
98181
98267
|
const visited = visitEachChild(node, visitor, context);
|
|
@@ -99411,7 +99497,7 @@ ${lanes.join("\n")}
|
|
|
99411
99497
|
addRange(topLevelStatements, endLexicalEnvironment());
|
|
99412
99498
|
if (exportVars.length) {
|
|
99413
99499
|
topLevelStatements.push(factory2.createVariableStatement(
|
|
99414
|
-
factory2.createModifiersFromModifierFlags(
|
|
99500
|
+
factory2.createModifiersFromModifierFlags(32 /* Export */),
|
|
99415
99501
|
factory2.createVariableDeclarationList(
|
|
99416
99502
|
exportVars,
|
|
99417
99503
|
1 /* Let */
|
|
@@ -99708,8 +99794,8 @@ ${lanes.join("\n")}
|
|
|
99708
99794
|
if (!node.name && defaultExportBinding) {
|
|
99709
99795
|
return node;
|
|
99710
99796
|
}
|
|
99711
|
-
const isExported2 = hasSyntacticModifier(node,
|
|
99712
|
-
const isDefault = hasSyntacticModifier(node,
|
|
99797
|
+
const isExported2 = hasSyntacticModifier(node, 32 /* Export */);
|
|
99798
|
+
const isDefault = hasSyntacticModifier(node, 2048 /* Default */);
|
|
99713
99799
|
let expression = factory2.converters.convertToClassExpression(node);
|
|
99714
99800
|
if (node.name) {
|
|
99715
99801
|
hoistBindingIdentifier(
|
|
@@ -99757,7 +99843,7 @@ ${lanes.join("\n")}
|
|
|
99757
99843
|
}
|
|
99758
99844
|
function hoistVariableStatement(node) {
|
|
99759
99845
|
let expressions;
|
|
99760
|
-
const isExported2 = hasSyntacticModifier(node,
|
|
99846
|
+
const isExported2 = hasSyntacticModifier(node, 32 /* Export */);
|
|
99761
99847
|
for (const variable of node.declarationList.declarations) {
|
|
99762
99848
|
hoistBindingElement(variable, isExported2, variable);
|
|
99763
99849
|
if (variable.initializer) {
|
|
@@ -100351,7 +100437,7 @@ ${lanes.join("\n")}
|
|
|
100351
100437
|
}
|
|
100352
100438
|
function transformJsxSpreadAttributeToProps(node) {
|
|
100353
100439
|
if (isObjectLiteralExpression(node.expression) && !hasProto(node.expression)) {
|
|
100354
|
-
return node.expression.properties;
|
|
100440
|
+
return sameMap(node.expression.properties, (p) => Debug.checkDefined(visitNode(p, visitor, isObjectLiteralElementLike)));
|
|
100355
100441
|
}
|
|
100356
100442
|
return factory2.createSpreadAssignment(Debug.checkDefined(visitNode(node.expression, visitor, isExpression)));
|
|
100357
100443
|
}
|
|
@@ -101308,8 +101394,8 @@ ${lanes.join("\n")}
|
|
|
101308
101394
|
setTextRange(statement, node);
|
|
101309
101395
|
startOnNewLine(statement);
|
|
101310
101396
|
statements.push(statement);
|
|
101311
|
-
if (hasSyntacticModifier(node,
|
|
101312
|
-
const exportStatement = hasSyntacticModifier(node,
|
|
101397
|
+
if (hasSyntacticModifier(node, 32 /* Export */)) {
|
|
101398
|
+
const exportStatement = hasSyntacticModifier(node, 2048 /* Default */) ? factory2.createExportDefault(factory2.getLocalName(node)) : factory2.createExternalModuleExport(factory2.getLocalName(node));
|
|
101313
101399
|
setOriginalNode(exportStatement, statement);
|
|
101314
101400
|
statements.push(exportStatement);
|
|
101315
101401
|
}
|
|
@@ -102501,7 +102587,7 @@ ${lanes.join("\n")}
|
|
|
102501
102587
|
return node.declarationList.declarations.length === 1 && !!node.declarationList.declarations[0].initializer && !!(getInternalEmitFlags(node.declarationList.declarations[0].initializer) & 1 /* TypeScriptClassWrapper */);
|
|
102502
102588
|
}
|
|
102503
102589
|
function visitVariableStatement(node) {
|
|
102504
|
-
const ancestorFacts = enterSubtree(0 /* None */, hasSyntacticModifier(node,
|
|
102590
|
+
const ancestorFacts = enterSubtree(0 /* None */, hasSyntacticModifier(node, 32 /* Export */) ? 32 /* ExportedVariableStatement */ : 0 /* None */);
|
|
102505
102591
|
let updated;
|
|
102506
102592
|
if (convertedLoopState && (node.declarationList.flags & 7 /* BlockScoped */) === 0 && !isVariableStatementOfTypeScriptClassWrapper(node)) {
|
|
102507
102593
|
let assignments;
|
|
@@ -107468,7 +107554,7 @@ ${lanes.join("\n")}
|
|
|
107468
107554
|
Debug.assert(isExternalModuleImportEqualsDeclaration(node), "import= for internal module references should be handled in an earlier transformer.");
|
|
107469
107555
|
let statements;
|
|
107470
107556
|
if (moduleKind !== 2 /* AMD */) {
|
|
107471
|
-
if (hasSyntacticModifier(node,
|
|
107557
|
+
if (hasSyntacticModifier(node, 32 /* Export */)) {
|
|
107472
107558
|
statements = append(
|
|
107473
107559
|
statements,
|
|
107474
107560
|
setOriginalNode(
|
|
@@ -107514,7 +107600,7 @@ ${lanes.join("\n")}
|
|
|
107514
107600
|
);
|
|
107515
107601
|
}
|
|
107516
107602
|
} else {
|
|
107517
|
-
if (hasSyntacticModifier(node,
|
|
107603
|
+
if (hasSyntacticModifier(node, 32 /* Export */)) {
|
|
107518
107604
|
statements = append(
|
|
107519
107605
|
statements,
|
|
107520
107606
|
setOriginalNode(
|
|
@@ -107652,7 +107738,7 @@ ${lanes.join("\n")}
|
|
|
107652
107738
|
}
|
|
107653
107739
|
function visitFunctionDeclaration(node) {
|
|
107654
107740
|
let statements;
|
|
107655
|
-
if (hasSyntacticModifier(node,
|
|
107741
|
+
if (hasSyntacticModifier(node, 32 /* Export */)) {
|
|
107656
107742
|
statements = append(
|
|
107657
107743
|
statements,
|
|
107658
107744
|
setOriginalNode(
|
|
@@ -107689,7 +107775,7 @@ ${lanes.join("\n")}
|
|
|
107689
107775
|
}
|
|
107690
107776
|
function visitClassDeclaration(node) {
|
|
107691
107777
|
let statements;
|
|
107692
|
-
if (hasSyntacticModifier(node,
|
|
107778
|
+
if (hasSyntacticModifier(node, 32 /* Export */)) {
|
|
107693
107779
|
statements = append(
|
|
107694
107780
|
statements,
|
|
107695
107781
|
setOriginalNode(
|
|
@@ -107723,7 +107809,7 @@ ${lanes.join("\n")}
|
|
|
107723
107809
|
let statements;
|
|
107724
107810
|
let variables;
|
|
107725
107811
|
let expressions;
|
|
107726
|
-
if (hasSyntacticModifier(node,
|
|
107812
|
+
if (hasSyntacticModifier(node, 32 /* Export */)) {
|
|
107727
107813
|
let modifiers;
|
|
107728
107814
|
let removeCommentsOnExpressions = false;
|
|
107729
107815
|
for (const variable of node.declarationList.declarations) {
|
|
@@ -107909,8 +107995,8 @@ ${lanes.join("\n")}
|
|
|
107909
107995
|
return statements;
|
|
107910
107996
|
}
|
|
107911
107997
|
const seen = new IdentifierNameMap();
|
|
107912
|
-
if (hasSyntacticModifier(decl,
|
|
107913
|
-
const exportName = hasSyntacticModifier(decl,
|
|
107998
|
+
if (hasSyntacticModifier(decl, 32 /* Export */)) {
|
|
107999
|
+
const exportName = hasSyntacticModifier(decl, 2048 /* Default */) ? factory2.createIdentifier("default") : factory2.getDeclarationName(decl);
|
|
107914
108000
|
statements = appendExportStatement(
|
|
107915
108001
|
statements,
|
|
107916
108002
|
seen,
|
|
@@ -108404,7 +108490,7 @@ ${lanes.join("\n")}
|
|
|
108404
108490
|
addRange(statements, hoistedStatements);
|
|
108405
108491
|
insertStatementsAfterStandardPrologue(statements, endLexicalEnvironment());
|
|
108406
108492
|
const exportStarFunction = addExportStarIfNeeded(statements);
|
|
108407
|
-
const modifiers = node.transformFlags & 2097152 /* ContainsAwait */ ? factory2.createModifiersFromModifierFlags(
|
|
108493
|
+
const modifiers = node.transformFlags & 2097152 /* ContainsAwait */ ? factory2.createModifiersFromModifierFlags(1024 /* Async */) : void 0;
|
|
108408
108494
|
const moduleObject = factory2.createObjectLiteralExpression(
|
|
108409
108495
|
[
|
|
108410
108496
|
factory2.createPropertyAssignment("setters", createSettersArray(exportStarFunction, dependencyGroups)),
|
|
@@ -108606,7 +108692,7 @@ ${lanes.join("\n")}
|
|
|
108606
108692
|
factory2.createAssignment(importVariableName, parameterName)
|
|
108607
108693
|
)
|
|
108608
108694
|
);
|
|
108609
|
-
if (hasSyntacticModifier(entry,
|
|
108695
|
+
if (hasSyntacticModifier(entry, 32 /* Export */)) {
|
|
108610
108696
|
statements.push(
|
|
108611
108697
|
factory2.createExpressionStatement(
|
|
108612
108698
|
factory2.createCallExpression(
|
|
@@ -108759,7 +108845,7 @@ ${lanes.join("\n")}
|
|
|
108759
108845
|
);
|
|
108760
108846
|
}
|
|
108761
108847
|
function visitFunctionDeclaration(node) {
|
|
108762
|
-
if (hasSyntacticModifier(node,
|
|
108848
|
+
if (hasSyntacticModifier(node, 32 /* Export */)) {
|
|
108763
108849
|
hoistedStatements = append(
|
|
108764
108850
|
hoistedStatements,
|
|
108765
108851
|
factory2.updateFunctionDeclaration(
|
|
@@ -108846,7 +108932,7 @@ ${lanes.join("\n")}
|
|
|
108846
108932
|
statements = append(statements, factory2.updateVariableStatement(node, modifiers, declarationList));
|
|
108847
108933
|
} else {
|
|
108848
108934
|
let expressions;
|
|
108849
|
-
const isExportedDeclaration = hasSyntacticModifier(node,
|
|
108935
|
+
const isExportedDeclaration = hasSyntacticModifier(node, 32 /* Export */);
|
|
108850
108936
|
for (const variable of node.declarationList.declarations) {
|
|
108851
108937
|
if (variable.initializer) {
|
|
108852
108938
|
expressions = append(expressions, transformInitializedVariable(variable, isExportedDeclaration));
|
|
@@ -108982,8 +109068,8 @@ ${lanes.join("\n")}
|
|
|
108982
109068
|
return statements;
|
|
108983
109069
|
}
|
|
108984
109070
|
let excludeName;
|
|
108985
|
-
if (hasSyntacticModifier(decl,
|
|
108986
|
-
const exportName = hasSyntacticModifier(decl,
|
|
109071
|
+
if (hasSyntacticModifier(decl, 32 /* Export */)) {
|
|
109072
|
+
const exportName = hasSyntacticModifier(decl, 2048 /* Default */) ? factory2.createStringLiteral("default") : decl.name;
|
|
108987
109073
|
statements = appendExportStatement(statements, exportName, factory2.getLocalName(decl));
|
|
108988
109074
|
excludeName = getTextOfIdentifierOrLiteral(exportName);
|
|
108989
109075
|
}
|
|
@@ -109734,7 +109820,7 @@ ${lanes.join("\n")}
|
|
|
109734
109820
|
return singleOrMany(statements);
|
|
109735
109821
|
}
|
|
109736
109822
|
function appendExportsOfImportEqualsDeclaration(statements, node) {
|
|
109737
|
-
if (hasSyntacticModifier(node,
|
|
109823
|
+
if (hasSyntacticModifier(node, 32 /* Export */)) {
|
|
109738
109824
|
statements = append(
|
|
109739
109825
|
statements,
|
|
109740
109826
|
factory2.createExportDeclaration(
|
|
@@ -109956,7 +110042,7 @@ ${lanes.join("\n")}
|
|
|
109956
110042
|
} else if (isConstructSignatureDeclaration(node) || isCallSignatureDeclaration(node) || isMethodDeclaration(node) || isMethodSignature(node) || isFunctionDeclaration(node) || isIndexSignatureDeclaration(node)) {
|
|
109957
110043
|
return getReturnTypeVisibilityError;
|
|
109958
110044
|
} else if (isParameter(node)) {
|
|
109959
|
-
if (isParameterPropertyDeclaration(node, node.parent) && hasSyntacticModifier(node.parent,
|
|
110045
|
+
if (isParameterPropertyDeclaration(node, node.parent) && hasSyntacticModifier(node.parent, 2 /* Private */)) {
|
|
109960
110046
|
return getVariableDeclarationTypeVisibilityError;
|
|
109961
110047
|
}
|
|
109962
110048
|
return getParameterDeclarationTypeVisibilityError;
|
|
@@ -109974,7 +110060,7 @@ ${lanes.join("\n")}
|
|
|
109974
110060
|
function getVariableDeclarationTypeVisibilityDiagnosticMessage(symbolAccessibilityResult) {
|
|
109975
110061
|
if (node.kind === 260 /* VariableDeclaration */ || node.kind === 208 /* BindingElement */) {
|
|
109976
110062
|
return symbolAccessibilityResult.errorModuleName ? symbolAccessibilityResult.accessibility === 2 /* CannotBeNamed */ ? Diagnostics.Exported_variable_0_has_or_is_using_name_1_from_external_module_2_but_cannot_be_named : Diagnostics.Exported_variable_0_has_or_is_using_name_1_from_private_module_2 : Diagnostics.Exported_variable_0_has_or_is_using_private_name_1;
|
|
109977
|
-
} else if (node.kind === 172 /* PropertyDeclaration */ || node.kind === 211 /* PropertyAccessExpression */ || node.kind === 212 /* ElementAccessExpression */ || node.kind === 226 /* BinaryExpression */ || node.kind === 171 /* PropertySignature */ || node.kind === 169 /* Parameter */ && hasSyntacticModifier(node.parent,
|
|
110063
|
+
} else if (node.kind === 172 /* PropertyDeclaration */ || node.kind === 211 /* PropertyAccessExpression */ || node.kind === 212 /* ElementAccessExpression */ || node.kind === 226 /* BinaryExpression */ || node.kind === 171 /* PropertySignature */ || node.kind === 169 /* Parameter */ && hasSyntacticModifier(node.parent, 2 /* Private */)) {
|
|
109978
110064
|
if (isStatic(node)) {
|
|
109979
110065
|
return symbolAccessibilityResult.errorModuleName ? symbolAccessibilityResult.accessibility === 2 /* CannotBeNamed */ ? Diagnostics.Public_static_property_0_of_exported_class_has_or_is_using_name_1_from_external_module_2_but_cannot_be_named : Diagnostics.Public_static_property_0_of_exported_class_has_or_is_using_name_1_from_private_module_2 : Diagnostics.Public_static_property_0_of_exported_class_has_or_is_using_private_name_1;
|
|
109980
110066
|
} else if (node.parent.kind === 263 /* ClassDeclaration */ || node.kind === 169 /* Parameter */) {
|
|
@@ -110700,7 +110786,7 @@ ${lanes.join("\n")}
|
|
|
110700
110786
|
return void 0;
|
|
110701
110787
|
}
|
|
110702
110788
|
function ensureType(node, type, ignorePrivate) {
|
|
110703
|
-
if (!ignorePrivate && hasEffectiveModifier(node,
|
|
110789
|
+
if (!ignorePrivate && hasEffectiveModifier(node, 2 /* Private */)) {
|
|
110704
110790
|
return;
|
|
110705
110791
|
}
|
|
110706
110792
|
if (shouldPrintWithInitializer(node)) {
|
|
@@ -110780,7 +110866,7 @@ ${lanes.join("\n")}
|
|
|
110780
110866
|
}
|
|
110781
110867
|
}
|
|
110782
110868
|
function updateParamsList(node, params, modifierMask) {
|
|
110783
|
-
if (hasEffectiveModifier(node,
|
|
110869
|
+
if (hasEffectiveModifier(node, 2 /* Private */)) {
|
|
110784
110870
|
return factory2.createNodeArray();
|
|
110785
110871
|
}
|
|
110786
110872
|
const newParams = map(params, (p) => ensureParameter(p, modifierMask));
|
|
@@ -110825,7 +110911,7 @@ ${lanes.join("\n")}
|
|
|
110825
110911
|
return factory2.createNodeArray(newParams || emptyArray);
|
|
110826
110912
|
}
|
|
110827
110913
|
function ensureTypeParams(node, params) {
|
|
110828
|
-
return hasEffectiveModifier(node,
|
|
110914
|
+
return hasEffectiveModifier(node, 2 /* Private */) ? void 0 : visitNodes2(params, visitDeclarationSubtree, isTypeParameterDeclaration);
|
|
110829
110915
|
}
|
|
110830
110916
|
function isEnclosingDeclaration(node) {
|
|
110831
110917
|
return isSourceFile(node) || isTypeAliasDeclaration(node) || isModuleDeclaration(node) || isClassDeclaration(node) || isInterfaceDeclaration(node) || isFunctionLike(node) || isIndexSignatureDeclaration(node) || isMappedTypeNode(node);
|
|
@@ -111011,7 +111097,7 @@ ${lanes.join("\n")}
|
|
|
111011
111097
|
const oldWithinObjectLiteralType = suppressNewDiagnosticContexts;
|
|
111012
111098
|
let shouldEnterSuppressNewDiagnosticsContextContext = (input.kind === 187 /* TypeLiteral */ || input.kind === 200 /* MappedType */) && input.parent.kind !== 265 /* TypeAliasDeclaration */;
|
|
111013
111099
|
if (isMethodDeclaration(input) || isMethodSignature(input)) {
|
|
111014
|
-
if (hasEffectiveModifier(input,
|
|
111100
|
+
if (hasEffectiveModifier(input, 2 /* Private */)) {
|
|
111015
111101
|
if (input.symbol && input.symbol.declarations && input.symbol.declarations[0] !== input)
|
|
111016
111102
|
return;
|
|
111017
111103
|
return cleanup(factory2.createPropertyDeclaration(
|
|
@@ -111099,7 +111185,7 @@ ${lanes.join("\n")}
|
|
|
111099
111185
|
input,
|
|
111100
111186
|
ensureModifiers(input),
|
|
111101
111187
|
input.name,
|
|
111102
|
-
updateAccessorParamsList(input, hasEffectiveModifier(input,
|
|
111188
|
+
updateAccessorParamsList(input, hasEffectiveModifier(input, 2 /* Private */)),
|
|
111103
111189
|
ensureType(input, accessorType),
|
|
111104
111190
|
/*body*/
|
|
111105
111191
|
void 0
|
|
@@ -111116,7 +111202,7 @@ ${lanes.join("\n")}
|
|
|
111116
111202
|
input,
|
|
111117
111203
|
ensureModifiers(input),
|
|
111118
111204
|
input.name,
|
|
111119
|
-
updateAccessorParamsList(input, hasEffectiveModifier(input,
|
|
111205
|
+
updateAccessorParamsList(input, hasEffectiveModifier(input, 2 /* Private */)),
|
|
111120
111206
|
/*body*/
|
|
111121
111207
|
void 0
|
|
111122
111208
|
));
|
|
@@ -111273,7 +111359,7 @@ ${lanes.join("\n")}
|
|
|
111273
111359
|
}
|
|
111274
111360
|
}
|
|
111275
111361
|
function isPrivateMethodTypeParameter(node) {
|
|
111276
|
-
return node.parent.kind === 174 /* MethodDeclaration */ && hasEffectiveModifier(node.parent,
|
|
111362
|
+
return node.parent.kind === 174 /* MethodDeclaration */ && hasEffectiveModifier(node.parent, 2 /* Private */);
|
|
111277
111363
|
}
|
|
111278
111364
|
function visitDeclarationStatements(input) {
|
|
111279
111365
|
if (!isPreservedDeclarationStatement(input)) {
|
|
@@ -111332,10 +111418,10 @@ ${lanes.join("\n")}
|
|
|
111332
111418
|
return input;
|
|
111333
111419
|
}
|
|
111334
111420
|
function stripExportModifiers(statement) {
|
|
111335
|
-
if (isImportEqualsDeclaration(statement) || hasEffectiveModifier(statement,
|
|
111421
|
+
if (isImportEqualsDeclaration(statement) || hasEffectiveModifier(statement, 2048 /* Default */) || !canHaveModifiers(statement)) {
|
|
111336
111422
|
return statement;
|
|
111337
111423
|
}
|
|
111338
|
-
const modifiers = factory2.createModifiersFromModifierFlags(getEffectiveModifierFlags(statement) & (
|
|
111424
|
+
const modifiers = factory2.createModifiersFromModifierFlags(getEffectiveModifierFlags(statement) & (131071 /* All */ ^ 32 /* Export */));
|
|
111339
111425
|
return factory2.replaceModifiers(statement, modifiers);
|
|
111340
111426
|
}
|
|
111341
111427
|
function updateModuleDeclarationAndKeyword(node, modifiers, name, body) {
|
|
@@ -111485,10 +111571,10 @@ ${lanes.join("\n")}
|
|
|
111485
111571
|
));
|
|
111486
111572
|
}
|
|
111487
111573
|
const namespaceDecl = factory2.createModuleDeclaration(ensureModifiers(input), input.name, factory2.createModuleBlock(declarations), 32 /* Namespace */);
|
|
111488
|
-
if (!hasEffectiveModifier(clean2,
|
|
111574
|
+
if (!hasEffectiveModifier(clean2, 2048 /* Default */)) {
|
|
111489
111575
|
return [clean2, namespaceDecl];
|
|
111490
111576
|
}
|
|
111491
|
-
const modifiers = factory2.createModifiersFromModifierFlags(getEffectiveModifierFlags(clean2) & ~
|
|
111577
|
+
const modifiers = factory2.createModifiersFromModifierFlags(getEffectiveModifierFlags(clean2) & ~2080 /* ExportDefault */ | 128 /* Ambient */);
|
|
111492
111578
|
const cleanDeclaration = factory2.updateFunctionDeclaration(
|
|
111493
111579
|
clean2,
|
|
111494
111580
|
modifiers,
|
|
@@ -111580,7 +111666,7 @@ ${lanes.join("\n")}
|
|
|
111580
111666
|
if (ctor) {
|
|
111581
111667
|
const oldDiag2 = getSymbolAccessibilityDiagnostic;
|
|
111582
111668
|
parameterProperties = compact(flatMap(ctor.parameters, (param) => {
|
|
111583
|
-
if (!hasSyntacticModifier(param,
|
|
111669
|
+
if (!hasSyntacticModifier(param, 31 /* ParameterPropertyModifier */) || shouldStripInternal(param))
|
|
111584
111670
|
return;
|
|
111585
111671
|
getSymbolAccessibilityDiagnostic = createGetSymbolAccessibilityDiagnosticForNode(param);
|
|
111586
111672
|
if (param.name.kind === 80 /* Identifier */) {
|
|
@@ -111809,11 +111895,11 @@ ${lanes.join("\n")}
|
|
|
111809
111895
|
return factory2.createModifiersFromModifierFlags(newFlags);
|
|
111810
111896
|
}
|
|
111811
111897
|
function ensureModifierFlags(node) {
|
|
111812
|
-
let mask2 =
|
|
111813
|
-
let additions = needsDeclare && !isAlwaysType(node) ?
|
|
111898
|
+
let mask2 = 131071 /* All */ ^ (1 /* Public */ | 1024 /* Async */ | 16 /* Override */);
|
|
111899
|
+
let additions = needsDeclare && !isAlwaysType(node) ? 128 /* Ambient */ : 0 /* None */;
|
|
111814
111900
|
const parentIsFile = node.parent.kind === 312 /* SourceFile */;
|
|
111815
111901
|
if (!parentIsFile || isBundledEmit && parentIsFile && isExternalModule(node.parent)) {
|
|
111816
|
-
mask2 ^=
|
|
111902
|
+
mask2 ^= 128 /* Ambient */;
|
|
111817
111903
|
additions = 0 /* None */;
|
|
111818
111904
|
}
|
|
111819
111905
|
return maskModifierFlags(node, mask2, additions);
|
|
@@ -111855,13 +111941,13 @@ ${lanes.join("\n")}
|
|
|
111855
111941
|
function maskModifiers(factory2, node, modifierMask, modifierAdditions) {
|
|
111856
111942
|
return factory2.createModifiersFromModifierFlags(maskModifierFlags(node, modifierMask, modifierAdditions));
|
|
111857
111943
|
}
|
|
111858
|
-
function maskModifierFlags(node, modifierMask =
|
|
111944
|
+
function maskModifierFlags(node, modifierMask = 131071 /* All */ ^ 1 /* Public */, modifierAdditions = 0 /* None */) {
|
|
111859
111945
|
let flags = getEffectiveModifierFlags(node) & modifierMask | modifierAdditions;
|
|
111860
|
-
if (flags &
|
|
111861
|
-
flags ^=
|
|
111946
|
+
if (flags & 2048 /* Default */ && !(flags & 32 /* Export */)) {
|
|
111947
|
+
flags ^= 32 /* Export */;
|
|
111862
111948
|
}
|
|
111863
|
-
if (flags &
|
|
111864
|
-
flags ^=
|
|
111949
|
+
if (flags & 2048 /* Default */ && flags & 128 /* Ambient */) {
|
|
111950
|
+
flags ^= 128 /* Ambient */;
|
|
111865
111951
|
}
|
|
111866
111952
|
return flags;
|
|
111867
111953
|
}
|
|
@@ -111874,7 +111960,7 @@ ${lanes.join("\n")}
|
|
|
111874
111960
|
switch (node.kind) {
|
|
111875
111961
|
case 172 /* PropertyDeclaration */:
|
|
111876
111962
|
case 171 /* PropertySignature */:
|
|
111877
|
-
return !hasEffectiveModifier(node,
|
|
111963
|
+
return !hasEffectiveModifier(node, 2 /* Private */);
|
|
111878
111964
|
case 169 /* Parameter */:
|
|
111879
111965
|
case 260 /* VariableDeclaration */:
|
|
111880
111966
|
return true;
|
|
@@ -120607,7 +120693,7 @@ ${lanes.join("\n")}
|
|
|
120607
120693
|
}
|
|
120608
120694
|
}
|
|
120609
120695
|
} else if (isModuleDeclaration(node)) {
|
|
120610
|
-
if (isAmbientModule(node) && (inAmbientModule || hasSyntacticModifier(node,
|
|
120696
|
+
if (isAmbientModule(node) && (inAmbientModule || hasSyntacticModifier(node, 128 /* Ambient */) || file.isDeclarationFile)) {
|
|
120611
120697
|
node.name.parent = node;
|
|
120612
120698
|
const nameText = getTextOfIdentifierOrLiteral(node.name);
|
|
120613
120699
|
if (isExternalModuleFile || inAmbientModule && !isExternalModuleNameRelative(nameText)) {
|
|
@@ -129855,7 +129941,7 @@ ${lanes.join("\n")}
|
|
|
129855
129941
|
case 306 /* EnumMember */:
|
|
129856
129942
|
return "enum member" /* enumMemberElement */;
|
|
129857
129943
|
case 169 /* Parameter */:
|
|
129858
|
-
return hasSyntacticModifier(node,
|
|
129944
|
+
return hasSyntacticModifier(node, 31 /* ParameterPropertyModifier */) ? "property" /* memberVariableElement */ : "parameter" /* parameterElement */;
|
|
129859
129945
|
case 271 /* ImportEqualsDeclaration */:
|
|
129860
129946
|
case 276 /* ImportSpecifier */:
|
|
129861
129947
|
case 281 /* ExportSpecifier */:
|
|
@@ -130758,19 +130844,19 @@ ${lanes.join("\n")}
|
|
|
130758
130844
|
function getNodeModifiers(node, excludeFlags = 0 /* None */) {
|
|
130759
130845
|
const result = [];
|
|
130760
130846
|
const flags = isDeclaration(node) ? getCombinedNodeFlagsAlwaysIncludeJSDoc(node) & ~excludeFlags : 0 /* None */;
|
|
130761
|
-
if (flags &
|
|
130847
|
+
if (flags & 2 /* Private */)
|
|
130762
130848
|
result.push("private" /* privateMemberModifier */);
|
|
130763
|
-
if (flags &
|
|
130849
|
+
if (flags & 4 /* Protected */)
|
|
130764
130850
|
result.push("protected" /* protectedMemberModifier */);
|
|
130765
|
-
if (flags &
|
|
130851
|
+
if (flags & 1 /* Public */)
|
|
130766
130852
|
result.push("public" /* publicMemberModifier */);
|
|
130767
|
-
if (flags &
|
|
130853
|
+
if (flags & 256 /* Static */ || isClassStaticBlockDeclaration(node))
|
|
130768
130854
|
result.push("static" /* staticModifier */);
|
|
130769
|
-
if (flags &
|
|
130855
|
+
if (flags & 64 /* Abstract */)
|
|
130770
130856
|
result.push("abstract" /* abstractModifier */);
|
|
130771
|
-
if (flags &
|
|
130857
|
+
if (flags & 32 /* Export */)
|
|
130772
130858
|
result.push("export" /* exportedModifier */);
|
|
130773
|
-
if (flags &
|
|
130859
|
+
if (flags & 65536 /* Deprecated */)
|
|
130774
130860
|
result.push("deprecated" /* deprecatedModifier */);
|
|
130775
130861
|
if (node.flags & 33554432 /* Ambient */)
|
|
130776
130862
|
result.push("declare" /* ambientModifier */);
|
|
@@ -132148,7 +132234,7 @@ ${lanes.join("\n")}
|
|
|
132148
132234
|
return isInJSFile(declaration) || !findAncestor(declaration, (d) => isModuleDeclaration(d) && isGlobalScopeAugmentation(d));
|
|
132149
132235
|
}
|
|
132150
132236
|
function isDeprecatedDeclaration(decl) {
|
|
132151
|
-
return !!(getCombinedNodeFlagsAlwaysIncludeJSDoc(decl) &
|
|
132237
|
+
return !!(getCombinedNodeFlagsAlwaysIncludeJSDoc(decl) & 65536 /* Deprecated */);
|
|
132152
132238
|
}
|
|
132153
132239
|
function shouldUseUriStyleNodeCoreModules(file, program) {
|
|
132154
132240
|
const decisionFromFile = firstDefined(file.imports, (node) => {
|
|
@@ -133832,7 +133918,7 @@ ${lanes.join("\n")}
|
|
|
133832
133918
|
case 241 /* Block */:
|
|
133833
133919
|
case 296 /* CaseClause */:
|
|
133834
133920
|
case 297 /* DefaultClause */:
|
|
133835
|
-
if (modifierFlag &
|
|
133921
|
+
if (modifierFlag & 64 /* Abstract */ && isClassDeclaration(declaration)) {
|
|
133836
133922
|
return [...declaration.members, declaration];
|
|
133837
133923
|
} else {
|
|
133838
133924
|
return container.statements;
|
|
@@ -133846,12 +133932,12 @@ ${lanes.join("\n")}
|
|
|
133846
133932
|
case 264 /* InterfaceDeclaration */:
|
|
133847
133933
|
case 187 /* TypeLiteral */:
|
|
133848
133934
|
const nodes = container.members;
|
|
133849
|
-
if (modifierFlag & (
|
|
133935
|
+
if (modifierFlag & (7 /* AccessibilityModifier */ | 8 /* Readonly */)) {
|
|
133850
133936
|
const constructor = find(container.members, isConstructorDeclaration);
|
|
133851
133937
|
if (constructor) {
|
|
133852
133938
|
return [...nodes, ...constructor.parameters];
|
|
133853
133939
|
}
|
|
133854
|
-
} else if (modifierFlag &
|
|
133940
|
+
} else if (modifierFlag & 64 /* Abstract */) {
|
|
133855
133941
|
return [...nodes, container];
|
|
133856
133942
|
}
|
|
133857
133943
|
return nodes;
|
|
@@ -136345,7 +136431,7 @@ ${lanes.join("\n")}
|
|
|
136345
136431
|
case 218 /* FunctionExpression */:
|
|
136346
136432
|
case 263 /* ClassDeclaration */:
|
|
136347
136433
|
case 231 /* ClassExpression */:
|
|
136348
|
-
if (getSyntacticModifierFlags(node) &
|
|
136434
|
+
if (getSyntacticModifierFlags(node) & 2048 /* Default */) {
|
|
136349
136435
|
return "default";
|
|
136350
136436
|
}
|
|
136351
136437
|
return getFunctionOrClassName(node);
|
|
@@ -136495,7 +136581,7 @@ ${lanes.join("\n")}
|
|
|
136495
136581
|
return nodeText(parent2.left).replace(whiteSpaceRegex, "");
|
|
136496
136582
|
} else if (isPropertyAssignment(parent2)) {
|
|
136497
136583
|
return nodeText(parent2.name);
|
|
136498
|
-
} else if (getSyntacticModifierFlags(node) &
|
|
136584
|
+
} else if (getSyntacticModifierFlags(node) & 2048 /* Default */) {
|
|
136499
136585
|
return "default";
|
|
136500
136586
|
} else if (isClassLike(node)) {
|
|
136501
136587
|
return "<class>";
|
|
@@ -136604,15 +136690,15 @@ ${lanes.join("\n")}
|
|
|
136604
136690
|
const { file, program } = context;
|
|
136605
136691
|
const span = getRefactorContextSpan(context);
|
|
136606
136692
|
const token = getTokenAtPosition(file, span.start);
|
|
136607
|
-
const exportNode = !!(token.parent && getSyntacticModifierFlags(token.parent) &
|
|
136693
|
+
const exportNode = !!(token.parent && getSyntacticModifierFlags(token.parent) & 32 /* Export */) && considerPartialSpans ? token.parent : getParentNodeInSpan(token, file, span);
|
|
136608
136694
|
if (!exportNode || !isSourceFile(exportNode.parent) && !(isModuleBlock(exportNode.parent) && isAmbientModule(exportNode.parent.parent))) {
|
|
136609
136695
|
return { error: getLocaleSpecificMessage(Diagnostics.Could_not_find_export_statement) };
|
|
136610
136696
|
}
|
|
136611
136697
|
const checker = program.getTypeChecker();
|
|
136612
136698
|
const exportingModuleSymbol = getExportingModuleSymbol(exportNode.parent, checker);
|
|
136613
|
-
const flags = getSyntacticModifierFlags(exportNode) || (isExportAssignment(exportNode) && !exportNode.isExportEquals ?
|
|
136614
|
-
const wasDefault = !!(flags &
|
|
136615
|
-
if (!(flags &
|
|
136699
|
+
const flags = getSyntacticModifierFlags(exportNode) || (isExportAssignment(exportNode) && !exportNode.isExportEquals ? 2080 /* ExportDefault */ : 0 /* None */);
|
|
136700
|
+
const wasDefault = !!(flags & 2048 /* Default */);
|
|
136701
|
+
if (!(flags & 32 /* Export */) || !wasDefault && exportingModuleSymbol.exports.has("default" /* Default */)) {
|
|
136616
136702
|
return { error: getLocaleSpecificMessage(Diagnostics.This_file_already_has_a_default_export) };
|
|
136617
136703
|
}
|
|
136618
136704
|
const noSymbolError = (id) => isIdentifier(id) && checker.getSymbolAtLocation(id) ? void 0 : { error: getLocaleSpecificMessage(Diagnostics.Can_only_convert_named_export) };
|
|
@@ -137094,26 +137180,50 @@ ${lanes.join("\n")}
|
|
|
137094
137180
|
const current = getTokenAtPosition(file, startPosition);
|
|
137095
137181
|
const range = createTextRangeFromSpan(getRefactorContextSpan(context));
|
|
137096
137182
|
const cursorRequest = range.pos === range.end && considerEmptySpans;
|
|
137097
|
-
const
|
|
137098
|
-
|
|
137183
|
+
const overlappingRange = nodeOverlapsWithStartEnd(current, file, range.pos, range.end);
|
|
137184
|
+
const firstType = findAncestor(current, (node) => node.parent && isTypeNode(node) && !rangeContainsSkipTrivia(range, node.parent, file) && (cursorRequest || overlappingRange));
|
|
137185
|
+
if (!firstType || !isTypeNode(firstType))
|
|
137099
137186
|
return { error: getLocaleSpecificMessage(Diagnostics.Selection_is_not_a_valid_type_node) };
|
|
137100
137187
|
const checker = context.program.getTypeChecker();
|
|
137101
|
-
const enclosingNode = getEnclosingNode(
|
|
137188
|
+
const enclosingNode = getEnclosingNode(firstType, isJS);
|
|
137102
137189
|
if (enclosingNode === void 0)
|
|
137103
137190
|
return { error: getLocaleSpecificMessage(Diagnostics.No_type_could_be_extracted_from_this_type_node) };
|
|
137191
|
+
const expandedFirstType = getExpandedSelectionNode(firstType, enclosingNode);
|
|
137192
|
+
if (!isTypeNode(expandedFirstType))
|
|
137193
|
+
return { error: getLocaleSpecificMessage(Diagnostics.Selection_is_not_a_valid_type_node) };
|
|
137194
|
+
const typeList = [];
|
|
137195
|
+
if ((isUnionTypeNode(expandedFirstType.parent) || isIntersectionTypeNode(expandedFirstType.parent)) && range.end > firstType.end) {
|
|
137196
|
+
addRange(
|
|
137197
|
+
typeList,
|
|
137198
|
+
expandedFirstType.parent.types.filter((type) => {
|
|
137199
|
+
return nodeOverlapsWithStartEnd(type, file, range.pos, range.end);
|
|
137200
|
+
})
|
|
137201
|
+
);
|
|
137202
|
+
}
|
|
137203
|
+
const selection = typeList.length > 1 ? typeList : expandedFirstType;
|
|
137104
137204
|
const typeParameters = collectTypeParameters(checker, selection, enclosingNode, file);
|
|
137105
137205
|
if (!typeParameters)
|
|
137106
137206
|
return { error: getLocaleSpecificMessage(Diagnostics.No_type_could_be_extracted_from_this_type_node) };
|
|
137107
137207
|
const typeElements = flattenTypeLiteralNodeReference(checker, selection);
|
|
137108
137208
|
return { isJS, selection, enclosingNode, typeParameters, typeElements };
|
|
137109
137209
|
}
|
|
137110
|
-
function flattenTypeLiteralNodeReference(checker,
|
|
137111
|
-
if (!
|
|
137210
|
+
function flattenTypeLiteralNodeReference(checker, selection) {
|
|
137211
|
+
if (!selection)
|
|
137112
137212
|
return void 0;
|
|
137113
|
-
if (
|
|
137213
|
+
if (isArray(selection)) {
|
|
137214
|
+
const result = [];
|
|
137215
|
+
for (const type of selection) {
|
|
137216
|
+
const flattenedTypeMembers = flattenTypeLiteralNodeReference(checker, type);
|
|
137217
|
+
if (!flattenedTypeMembers)
|
|
137218
|
+
return void 0;
|
|
137219
|
+
addRange(result, flattenedTypeMembers);
|
|
137220
|
+
}
|
|
137221
|
+
return result;
|
|
137222
|
+
}
|
|
137223
|
+
if (isIntersectionTypeNode(selection)) {
|
|
137114
137224
|
const result = [];
|
|
137115
137225
|
const seen = /* @__PURE__ */ new Map();
|
|
137116
|
-
for (const type of
|
|
137226
|
+
for (const type of selection.types) {
|
|
137117
137227
|
const flattenedTypeMembers = flattenTypeLiteralNodeReference(checker, type);
|
|
137118
137228
|
if (!flattenedTypeMembers || !flattenedTypeMembers.every((type2) => type2.name && addToSeen(seen, getNameFromPropertyName(type2.name)))) {
|
|
137119
137229
|
return void 0;
|
|
@@ -137121,10 +137231,10 @@ ${lanes.join("\n")}
|
|
|
137121
137231
|
addRange(result, flattenedTypeMembers);
|
|
137122
137232
|
}
|
|
137123
137233
|
return result;
|
|
137124
|
-
} else if (isParenthesizedTypeNode(
|
|
137125
|
-
return flattenTypeLiteralNodeReference(checker,
|
|
137126
|
-
} else if (isTypeLiteralNode(
|
|
137127
|
-
return
|
|
137234
|
+
} else if (isParenthesizedTypeNode(selection)) {
|
|
137235
|
+
return flattenTypeLiteralNodeReference(checker, selection.type);
|
|
137236
|
+
} else if (isTypeLiteralNode(selection)) {
|
|
137237
|
+
return selection.members;
|
|
137128
137238
|
}
|
|
137129
137239
|
return void 0;
|
|
137130
137240
|
}
|
|
@@ -137133,7 +137243,13 @@ ${lanes.join("\n")}
|
|
|
137133
137243
|
}
|
|
137134
137244
|
function collectTypeParameters(checker, selection, enclosingNode, file) {
|
|
137135
137245
|
const result = [];
|
|
137136
|
-
|
|
137246
|
+
const selectionArray = toArray(selection);
|
|
137247
|
+
const selectionRange = { pos: selectionArray[0].pos, end: selectionArray[selectionArray.length - 1].end };
|
|
137248
|
+
for (const t of selectionArray) {
|
|
137249
|
+
if (visitor(t))
|
|
137250
|
+
return void 0;
|
|
137251
|
+
}
|
|
137252
|
+
return result;
|
|
137137
137253
|
function visitor(node) {
|
|
137138
137254
|
if (isTypeReferenceNode(node)) {
|
|
137139
137255
|
if (isIdentifier(node.typeName)) {
|
|
@@ -137147,10 +137263,10 @@ ${lanes.join("\n")}
|
|
|
137147
137263
|
);
|
|
137148
137264
|
for (const decl of (symbol == null ? void 0 : symbol.declarations) || emptyArray) {
|
|
137149
137265
|
if (isTypeParameterDeclaration(decl) && decl.getSourceFile() === file) {
|
|
137150
|
-
if (decl.name.escapedText === typeName.escapedText && rangeContainsSkipTrivia(decl,
|
|
137266
|
+
if (decl.name.escapedText === typeName.escapedText && rangeContainsSkipTrivia(decl, selectionRange, file)) {
|
|
137151
137267
|
return true;
|
|
137152
137268
|
}
|
|
137153
|
-
if (rangeContainsSkipTrivia(enclosingNode, decl, file) && !rangeContainsSkipTrivia(
|
|
137269
|
+
if (rangeContainsSkipTrivia(enclosingNode, decl, file) && !rangeContainsSkipTrivia(selectionRange, decl, file)) {
|
|
137154
137270
|
pushIfUnique(result, decl);
|
|
137155
137271
|
break;
|
|
137156
137272
|
}
|
|
@@ -137159,12 +137275,12 @@ ${lanes.join("\n")}
|
|
|
137159
137275
|
}
|
|
137160
137276
|
} else if (isInferTypeNode(node)) {
|
|
137161
137277
|
const conditionalTypeNode = findAncestor(node, (n) => isConditionalTypeNode(n) && rangeContainsSkipTrivia(n.extendsType, node, file));
|
|
137162
|
-
if (!conditionalTypeNode || !rangeContainsSkipTrivia(
|
|
137278
|
+
if (!conditionalTypeNode || !rangeContainsSkipTrivia(selectionRange, conditionalTypeNode, file)) {
|
|
137163
137279
|
return true;
|
|
137164
137280
|
}
|
|
137165
137281
|
} else if (isTypePredicateNode(node) || isThisTypeNode(node)) {
|
|
137166
137282
|
const functionLikeNode = findAncestor(node.parent, isFunctionLike);
|
|
137167
|
-
if (functionLikeNode && functionLikeNode.type && rangeContainsSkipTrivia(functionLikeNode.type, node, file) && !rangeContainsSkipTrivia(
|
|
137283
|
+
if (functionLikeNode && functionLikeNode.type && rangeContainsSkipTrivia(functionLikeNode.type, node, file) && !rangeContainsSkipTrivia(selectionRange, functionLikeNode, file)) {
|
|
137168
137284
|
return true;
|
|
137169
137285
|
}
|
|
137170
137286
|
} else if (isTypeQueryNode(node)) {
|
|
@@ -137176,11 +137292,11 @@ ${lanes.join("\n")}
|
|
|
137176
137292
|
/*excludeGlobals*/
|
|
137177
137293
|
false
|
|
137178
137294
|
);
|
|
137179
|
-
if ((symbol == null ? void 0 : symbol.valueDeclaration) && rangeContainsSkipTrivia(enclosingNode, symbol.valueDeclaration, file) && !rangeContainsSkipTrivia(
|
|
137295
|
+
if ((symbol == null ? void 0 : symbol.valueDeclaration) && rangeContainsSkipTrivia(enclosingNode, symbol.valueDeclaration, file) && !rangeContainsSkipTrivia(selectionRange, symbol.valueDeclaration, file)) {
|
|
137180
137296
|
return true;
|
|
137181
137297
|
}
|
|
137182
137298
|
} else {
|
|
137183
|
-
if (isThisIdentifier(node.exprName.left) && !rangeContainsSkipTrivia(
|
|
137299
|
+
if (isThisIdentifier(node.exprName.left) && !rangeContainsSkipTrivia(selectionRange, node.parent, file)) {
|
|
137184
137300
|
return true;
|
|
137185
137301
|
}
|
|
137186
137302
|
}
|
|
@@ -137192,8 +137308,9 @@ ${lanes.join("\n")}
|
|
|
137192
137308
|
}
|
|
137193
137309
|
}
|
|
137194
137310
|
function doTypeAliasChange(changes, file, name, info) {
|
|
137195
|
-
const { enclosingNode,
|
|
137196
|
-
const newTypeNode =
|
|
137311
|
+
const { enclosingNode, typeParameters } = info;
|
|
137312
|
+
const { firstTypeNode, lastTypeNode, newTypeNode } = getNodesToEdit(info);
|
|
137313
|
+
const newTypeDeclaration = factory.createTypeAliasDeclaration(
|
|
137197
137314
|
/*modifiers*/
|
|
137198
137315
|
void 0,
|
|
137199
137316
|
name,
|
|
@@ -137205,16 +137322,16 @@ ${lanes.join("\n")}
|
|
|
137205
137322
|
/*defaultType*/
|
|
137206
137323
|
void 0
|
|
137207
137324
|
)),
|
|
137208
|
-
|
|
137325
|
+
newTypeNode
|
|
137209
137326
|
);
|
|
137210
137327
|
changes.insertNodeBefore(
|
|
137211
137328
|
file,
|
|
137212
137329
|
enclosingNode,
|
|
137213
|
-
ignoreSourceNewlines(
|
|
137330
|
+
ignoreSourceNewlines(newTypeDeclaration),
|
|
137214
137331
|
/*blankLineBetween*/
|
|
137215
137332
|
true
|
|
137216
137333
|
);
|
|
137217
|
-
changes.
|
|
137334
|
+
changes.replaceNodeRange(file, firstTypeNode, lastTypeNode, factory.createTypeReferenceNode(name, typeParameters.map((id) => factory.createTypeReferenceNode(
|
|
137218
137335
|
id.name,
|
|
137219
137336
|
/*typeArguments*/
|
|
137220
137337
|
void 0
|
|
@@ -137222,7 +137339,7 @@ ${lanes.join("\n")}
|
|
|
137222
137339
|
}
|
|
137223
137340
|
function doInterfaceChange(changes, file, name, info) {
|
|
137224
137341
|
var _a;
|
|
137225
|
-
const { enclosingNode,
|
|
137342
|
+
const { enclosingNode, typeParameters, typeElements } = info;
|
|
137226
137343
|
const newTypeNode = factory.createInterfaceDeclaration(
|
|
137227
137344
|
/*modifiers*/
|
|
137228
137345
|
void 0,
|
|
@@ -137240,7 +137357,8 @@ ${lanes.join("\n")}
|
|
|
137240
137357
|
/*blankLineBetween*/
|
|
137241
137358
|
true
|
|
137242
137359
|
);
|
|
137243
|
-
|
|
137360
|
+
const { firstTypeNode, lastTypeNode } = getNodesToEdit(info);
|
|
137361
|
+
changes.replaceNodeRange(file, firstTypeNode, lastTypeNode, factory.createTypeReferenceNode(name, typeParameters.map((id) => factory.createTypeReferenceNode(
|
|
137244
137362
|
id.name,
|
|
137245
137363
|
/*typeArguments*/
|
|
137246
137364
|
void 0
|
|
@@ -137248,11 +137366,14 @@ ${lanes.join("\n")}
|
|
|
137248
137366
|
}
|
|
137249
137367
|
function doTypedefChange(changes, context, file, name, info) {
|
|
137250
137368
|
var _a;
|
|
137251
|
-
|
|
137252
|
-
|
|
137369
|
+
toArray(info.selection).forEach((typeNode) => {
|
|
137370
|
+
setEmitFlags(typeNode, 3072 /* NoComments */ | 4096 /* NoNestedComments */);
|
|
137371
|
+
});
|
|
137372
|
+
const { enclosingNode, typeParameters } = info;
|
|
137373
|
+
const { firstTypeNode, lastTypeNode, newTypeNode } = getNodesToEdit(info);
|
|
137253
137374
|
const node = factory.createJSDocTypedefTag(
|
|
137254
137375
|
factory.createIdentifier("typedef"),
|
|
137255
|
-
factory.createJSDocTypeExpression(
|
|
137376
|
+
factory.createJSDocTypeExpression(newTypeNode),
|
|
137256
137377
|
factory.createIdentifier(name)
|
|
137257
137378
|
);
|
|
137258
137379
|
const templates = [];
|
|
@@ -137290,15 +137411,39 @@ ${lanes.join("\n")}
|
|
|
137290
137411
|
true
|
|
137291
137412
|
);
|
|
137292
137413
|
}
|
|
137293
|
-
changes.
|
|
137414
|
+
changes.replaceNodeRange(file, firstTypeNode, lastTypeNode, factory.createTypeReferenceNode(name, typeParameters.map((id) => factory.createTypeReferenceNode(
|
|
137294
137415
|
id.name,
|
|
137295
137416
|
/*typeArguments*/
|
|
137296
137417
|
void 0
|
|
137297
137418
|
))));
|
|
137298
137419
|
}
|
|
137420
|
+
function getNodesToEdit(info) {
|
|
137421
|
+
if (isArray(info.selection)) {
|
|
137422
|
+
return {
|
|
137423
|
+
firstTypeNode: info.selection[0],
|
|
137424
|
+
lastTypeNode: info.selection[info.selection.length - 1],
|
|
137425
|
+
newTypeNode: isUnionTypeNode(info.selection[0].parent) ? factory.createUnionTypeNode(info.selection) : factory.createIntersectionTypeNode(info.selection)
|
|
137426
|
+
};
|
|
137427
|
+
}
|
|
137428
|
+
return {
|
|
137429
|
+
firstTypeNode: info.selection,
|
|
137430
|
+
lastTypeNode: info.selection,
|
|
137431
|
+
newTypeNode: info.selection
|
|
137432
|
+
};
|
|
137433
|
+
}
|
|
137299
137434
|
function getEnclosingNode(node, isJS) {
|
|
137300
137435
|
return findAncestor(node, isStatement) || (isJS ? findAncestor(node, isJSDoc) : void 0);
|
|
137301
137436
|
}
|
|
137437
|
+
function getExpandedSelectionNode(firstType, enclosingNode) {
|
|
137438
|
+
return findAncestor(firstType, (node) => {
|
|
137439
|
+
if (node === enclosingNode)
|
|
137440
|
+
return "quit";
|
|
137441
|
+
if (isUnionTypeNode(node.parent) || isIntersectionTypeNode(node.parent)) {
|
|
137442
|
+
return true;
|
|
137443
|
+
}
|
|
137444
|
+
return false;
|
|
137445
|
+
}) ?? firstType;
|
|
137446
|
+
}
|
|
137302
137447
|
var refactorName3, extractToTypeAliasAction, extractToInterfaceAction, extractToTypeDefAction;
|
|
137303
137448
|
var init_extractType = __esm({
|
|
137304
137449
|
"src/services/refactors/extractType.ts"() {
|
|
@@ -137623,7 +137768,7 @@ ${lanes.join("\n")}
|
|
|
137623
137768
|
if (markSeenTop(top)) {
|
|
137624
137769
|
addExportToChanges(oldFile, top, name, changes, useEsModuleSyntax);
|
|
137625
137770
|
}
|
|
137626
|
-
if (hasSyntacticModifier(decl,
|
|
137771
|
+
if (hasSyntacticModifier(decl, 2048 /* Default */)) {
|
|
137627
137772
|
oldFileDefault = name;
|
|
137628
137773
|
} else {
|
|
137629
137774
|
oldFileNamedImports.push(name.text);
|
|
@@ -137674,14 +137819,13 @@ ${lanes.join("\n")}
|
|
|
137674
137819
|
}
|
|
137675
137820
|
function doChange4(context, oldFile, targetFile, program, toMove, changes, host, preferences) {
|
|
137676
137821
|
const checker = program.getTypeChecker();
|
|
137677
|
-
const usage = getUsageInfo(oldFile, toMove.all, checker);
|
|
137678
137822
|
if (!host.fileExists(targetFile)) {
|
|
137679
|
-
changes.createNewFile(oldFile, targetFile, getNewStatementsAndRemoveFromOldFile2(oldFile, targetFile,
|
|
137823
|
+
changes.createNewFile(oldFile, targetFile, getNewStatementsAndRemoveFromOldFile2(oldFile, targetFile, getUsageInfo(oldFile, toMove.all, checker), changes, toMove, program, host, preferences));
|
|
137680
137824
|
addNewFileToTsconfig(program, changes, oldFile.fileName, targetFile, hostGetCanonicalFileName(host));
|
|
137681
137825
|
} else {
|
|
137682
137826
|
const targetSourceFile = Debug.checkDefined(program.getSourceFile(targetFile));
|
|
137683
137827
|
const importAdder = ts_codefix_exports.createImportAdder(targetSourceFile, context.program, context.preferences, context.host);
|
|
137684
|
-
getNewStatementsAndRemoveFromOldFile2(oldFile, targetSourceFile,
|
|
137828
|
+
getNewStatementsAndRemoveFromOldFile2(oldFile, targetSourceFile, getUsageInfo(oldFile, toMove.all, checker, getExistingImports(targetSourceFile, checker)), changes, toMove, program, host, preferences, importAdder);
|
|
137685
137829
|
}
|
|
137686
137830
|
}
|
|
137687
137831
|
function getNewStatementsAndRemoveFromOldFile2(oldFile, targetFile, usage, changes, toMove, program, host, preferences, importAdder) {
|
|
@@ -137801,7 +137945,7 @@ ${lanes.join("\n")}
|
|
|
137801
137945
|
if (importAdder && checker.isUnknownSymbol(symbol)) {
|
|
137802
137946
|
importAdder.addImportFromExportedSymbol(skipAlias(symbol, checker));
|
|
137803
137947
|
} else {
|
|
137804
|
-
if (hasSyntacticModifier(decl,
|
|
137948
|
+
if (hasSyntacticModifier(decl, 2048 /* Default */)) {
|
|
137805
137949
|
oldFileDefault = name;
|
|
137806
137950
|
} else {
|
|
137807
137951
|
oldFileNamedImports.push(name.text);
|
|
@@ -138041,7 +138185,7 @@ ${lanes.join("\n")}
|
|
|
138041
138185
|
function isExported(sourceFile, decl, useEs6Exports, name) {
|
|
138042
138186
|
var _a;
|
|
138043
138187
|
if (useEs6Exports) {
|
|
138044
|
-
return !isExpressionStatement(decl) && hasSyntacticModifier(decl,
|
|
138188
|
+
return !isExpressionStatement(decl) && hasSyntacticModifier(decl, 32 /* Export */) || !!(name && sourceFile.symbol && ((_a = sourceFile.symbol.exports) == null ? void 0 : _a.has(name.escapedText)));
|
|
138045
138189
|
}
|
|
138046
138190
|
return !!sourceFile.symbol && !!sourceFile.symbol.exports && getNamesToExportInCommonJS(decl).some((name2) => sourceFile.symbol.exports.has(escapeLeadingUnderscores(name2)));
|
|
138047
138191
|
}
|
|
@@ -138336,7 +138480,7 @@ ${lanes.join("\n")}
|
|
|
138336
138480
|
case 272 /* ImportDeclaration */:
|
|
138337
138481
|
return true;
|
|
138338
138482
|
case 271 /* ImportEqualsDeclaration */:
|
|
138339
|
-
return !hasSyntacticModifier(node,
|
|
138483
|
+
return !hasSyntacticModifier(node, 32 /* Export */);
|
|
138340
138484
|
case 243 /* VariableStatement */:
|
|
138341
138485
|
return node.declarationList.declarations.every((d) => !!d.initializer && isRequireCall(
|
|
138342
138486
|
d.initializer,
|
|
@@ -138347,7 +138491,7 @@ ${lanes.join("\n")}
|
|
|
138347
138491
|
return false;
|
|
138348
138492
|
}
|
|
138349
138493
|
}
|
|
138350
|
-
function getUsageInfo(oldFile, toMove, checker) {
|
|
138494
|
+
function getUsageInfo(oldFile, toMove, checker, existingTargetImports = /* @__PURE__ */ new Set()) {
|
|
138351
138495
|
const movedSymbols = /* @__PURE__ */ new Set();
|
|
138352
138496
|
const oldImportsNeededByTargetFile = /* @__PURE__ */ new Map();
|
|
138353
138497
|
const targetFileImportsFromOldFile = /* @__PURE__ */ new Set();
|
|
@@ -138361,10 +138505,16 @@ ${lanes.join("\n")}
|
|
|
138361
138505
|
movedSymbols.add(Debug.checkDefined(isExpressionStatement(decl) ? checker.getSymbolAtLocation(decl.expression.left) : decl.symbol, "Need a symbol here"));
|
|
138362
138506
|
});
|
|
138363
138507
|
}
|
|
138508
|
+
const unusedImportsFromOldFile = /* @__PURE__ */ new Set();
|
|
138364
138509
|
for (const statement of toMove) {
|
|
138365
138510
|
forEachReference(statement, checker, (symbol, isValidTypeOnlyUseSite) => {
|
|
138366
|
-
if (!symbol.declarations)
|
|
138511
|
+
if (!symbol.declarations) {
|
|
138512
|
+
return;
|
|
138513
|
+
}
|
|
138514
|
+
if (existingTargetImports.has(skipAlias(symbol, checker))) {
|
|
138515
|
+
unusedImportsFromOldFile.add(symbol);
|
|
138367
138516
|
return;
|
|
138517
|
+
}
|
|
138368
138518
|
for (const decl of symbol.declarations) {
|
|
138369
138519
|
if (isInImport(decl)) {
|
|
138370
138520
|
const prevIsTypeOnly = oldImportsNeededByTargetFile.get(symbol);
|
|
@@ -138375,7 +138525,9 @@ ${lanes.join("\n")}
|
|
|
138375
138525
|
}
|
|
138376
138526
|
});
|
|
138377
138527
|
}
|
|
138378
|
-
const
|
|
138528
|
+
for (const unusedImport of oldImportsNeededByTargetFile.keys()) {
|
|
138529
|
+
unusedImportsFromOldFile.add(unusedImport);
|
|
138530
|
+
}
|
|
138379
138531
|
const oldFileImportsFromTargetFile = /* @__PURE__ */ new Set();
|
|
138380
138532
|
for (const statement of oldFile.statements) {
|
|
138381
138533
|
if (contains(toMove, statement))
|
|
@@ -138507,7 +138659,7 @@ ${lanes.join("\n")}
|
|
|
138507
138659
|
const checker = program.getTypeChecker();
|
|
138508
138660
|
const targetToSourceExports = /* @__PURE__ */ new Map();
|
|
138509
138661
|
for (const node of toMove.all) {
|
|
138510
|
-
if (isTopLevelDeclarationStatement(node) && hasSyntacticModifier(node,
|
|
138662
|
+
if (isTopLevelDeclarationStatement(node) && hasSyntacticModifier(node, 32 /* Export */)) {
|
|
138511
138663
|
forEachTopLevelDeclaration(node, (declaration) => {
|
|
138512
138664
|
var _a2;
|
|
138513
138665
|
const targetDeclarations = canHaveSymbol(declaration) ? (_a2 = targetExports.get(declaration.symbol.escapedName)) == null ? void 0 : _a2.declarations : void 0;
|
|
@@ -138561,6 +138713,29 @@ ${lanes.join("\n")}
|
|
|
138561
138713
|
}
|
|
138562
138714
|
return void 0;
|
|
138563
138715
|
}
|
|
138716
|
+
function getExistingImports(sourceFile, checker) {
|
|
138717
|
+
const imports = /* @__PURE__ */ new Set();
|
|
138718
|
+
for (const moduleSpecifier of sourceFile.imports) {
|
|
138719
|
+
const declaration = importFromModuleSpecifier(moduleSpecifier);
|
|
138720
|
+
if (isImportDeclaration(declaration) && declaration.importClause && declaration.importClause.namedBindings && isNamedImports(declaration.importClause.namedBindings)) {
|
|
138721
|
+
for (const e of declaration.importClause.namedBindings.elements) {
|
|
138722
|
+
const symbol = checker.getSymbolAtLocation(e.propertyName || e.name);
|
|
138723
|
+
if (symbol) {
|
|
138724
|
+
imports.add(skipAlias(symbol, checker));
|
|
138725
|
+
}
|
|
138726
|
+
}
|
|
138727
|
+
}
|
|
138728
|
+
if (isVariableDeclarationInitializedToRequire(declaration.parent) && isObjectBindingPattern(declaration.parent.name)) {
|
|
138729
|
+
for (const e of declaration.parent.name.elements) {
|
|
138730
|
+
const symbol = checker.getSymbolAtLocation(e.propertyName || e.name);
|
|
138731
|
+
if (symbol) {
|
|
138732
|
+
imports.add(skipAlias(symbol, checker));
|
|
138733
|
+
}
|
|
138734
|
+
}
|
|
138735
|
+
}
|
|
138736
|
+
}
|
|
138737
|
+
return imports;
|
|
138738
|
+
}
|
|
138564
138739
|
var refactorNameForMoveToFile, description2, moveToFileAction;
|
|
138565
138740
|
var init_moveToFile = __esm({
|
|
138566
138741
|
"src/services/refactors/moveToFile.ts"() {
|
|
@@ -139144,7 +139319,7 @@ ${newComment.split("\n").map((c) => ` * ${c}`).join("\n")}
|
|
|
139144
139319
|
const body = convertToBlock(func.body);
|
|
139145
139320
|
const { variableDeclaration, variableDeclarationList, statement, name } = variableInfo;
|
|
139146
139321
|
suppressLeadingTrivia(statement);
|
|
139147
|
-
const modifiersFlags = getCombinedModifierFlags(variableDeclaration) &
|
|
139322
|
+
const modifiersFlags = getCombinedModifierFlags(variableDeclaration) & 32 /* Export */ | getEffectiveModifierFlags(func);
|
|
139148
139323
|
const modifiers = factory.createModifiersFromModifierFlags(modifiersFlags);
|
|
139149
139324
|
const newNode = factory.createFunctionDeclaration(length(modifiers) ? modifiers : void 0, func.asteriskToken, name, func.typeParameters, func.parameters, func.type, body);
|
|
139150
139325
|
if (variableDeclarationList.declarations.length === 1) {
|
|
@@ -140518,7 +140693,7 @@ ${newComment.split("\n").map((c) => ` * ${c}`).join("\n")}
|
|
|
140518
140693
|
}
|
|
140519
140694
|
if (isDeclaration(node2)) {
|
|
140520
140695
|
const declaringNode = node2.kind === 260 /* VariableDeclaration */ ? node2.parent.parent : node2;
|
|
140521
|
-
if (hasSyntacticModifier(declaringNode,
|
|
140696
|
+
if (hasSyntacticModifier(declaringNode, 32 /* Export */)) {
|
|
140522
140697
|
(errors2 || (errors2 = [])).push(createDiagnosticForNode(node2, Messages.cannotExtractExportedEntity));
|
|
140523
140698
|
return true;
|
|
140524
140699
|
}
|
|
@@ -141526,7 +141701,7 @@ ${newComment.split("\n").map((c) => ` * ${c}`).join("\n")}
|
|
|
141526
141701
|
usagesPerScope[i].usages.forEach((value) => {
|
|
141527
141702
|
if (value.usage === 2 /* Write */) {
|
|
141528
141703
|
hasWrite = true;
|
|
141529
|
-
if (value.symbol.flags & 106500 /* ClassMember */ && value.symbol.valueDeclaration && hasEffectiveModifier(value.symbol.valueDeclaration,
|
|
141704
|
+
if (value.symbol.flags & 106500 /* ClassMember */ && value.symbol.valueDeclaration && hasEffectiveModifier(value.symbol.valueDeclaration, 8 /* Readonly */)) {
|
|
141530
141705
|
readonlyClassPropertyWrite = value.symbol.valueDeclaration;
|
|
141531
141706
|
}
|
|
141532
141707
|
}
|
|
@@ -142148,14 +142323,14 @@ ${newComment.split("\n").map((c) => ` * ${c}`).join("\n")}
|
|
|
142148
142323
|
if (decl) {
|
|
142149
142324
|
const modifiers = getCombinedModifierFlags(decl);
|
|
142150
142325
|
const nodeFlags = getCombinedNodeFlags(decl);
|
|
142151
|
-
if (modifiers &
|
|
142326
|
+
if (modifiers & 256 /* Static */) {
|
|
142152
142327
|
modifierSet |= 1 << 1 /* static */;
|
|
142153
142328
|
}
|
|
142154
|
-
if (modifiers &
|
|
142329
|
+
if (modifiers & 1024 /* Async */) {
|
|
142155
142330
|
modifierSet |= 1 << 2 /* async */;
|
|
142156
142331
|
}
|
|
142157
142332
|
if (typeIdx !== 0 /* class */ && typeIdx !== 2 /* interface */) {
|
|
142158
|
-
if (modifiers &
|
|
142333
|
+
if (modifiers & 8 /* Readonly */ || nodeFlags & 2 /* Const */ || symbol.getFlags() & 8 /* EnumMember */) {
|
|
142159
142334
|
modifierSet |= 1 << 3 /* readonly */;
|
|
142160
142335
|
}
|
|
142161
142336
|
}
|
|
@@ -144287,7 +144462,7 @@ ${newComment.split("\n").map((c) => ` * ${c}`).join("\n")}
|
|
|
144287
144462
|
forEachChild(node, visit);
|
|
144288
144463
|
break;
|
|
144289
144464
|
case 169 /* Parameter */:
|
|
144290
|
-
if (!hasSyntacticModifier(node,
|
|
144465
|
+
if (!hasSyntacticModifier(node, 31 /* ParameterPropertyModifier */)) {
|
|
144291
144466
|
break;
|
|
144292
144467
|
}
|
|
144293
144468
|
case 260 /* VariableDeclaration */:
|
|
@@ -144774,7 +144949,7 @@ ${newComment.split("\n").map((c) => ` * ${c}`).join("\n")}
|
|
|
144774
144949
|
if (isBindingPattern(variableDeclaration.name)) {
|
|
144775
144950
|
return spanInBindingPattern(variableDeclaration.name);
|
|
144776
144951
|
}
|
|
144777
|
-
if (hasOnlyExpressionInitializer(variableDeclaration) && variableDeclaration.initializer || hasSyntacticModifier(variableDeclaration,
|
|
144952
|
+
if (hasOnlyExpressionInitializer(variableDeclaration) && variableDeclaration.initializer || hasSyntacticModifier(variableDeclaration, 32 /* Export */) || parent2.parent.kind === 250 /* ForOfStatement */) {
|
|
144778
144953
|
return textSpanFromVariableDeclaration(variableDeclaration);
|
|
144779
144954
|
}
|
|
144780
144955
|
if (isVariableDeclarationList(variableDeclaration.parent) && variableDeclaration.parent.declarations[0] !== variableDeclaration) {
|
|
@@ -144782,7 +144957,7 @@ ${newComment.split("\n").map((c) => ` * ${c}`).join("\n")}
|
|
|
144782
144957
|
}
|
|
144783
144958
|
}
|
|
144784
144959
|
function canHaveSpanInParameterDeclaration(parameter) {
|
|
144785
|
-
return !!parameter.initializer || parameter.dotDotDotToken !== void 0 || hasSyntacticModifier(parameter,
|
|
144960
|
+
return !!parameter.initializer || parameter.dotDotDotToken !== void 0 || hasSyntacticModifier(parameter, 1 /* Public */ | 2 /* Private */);
|
|
144786
144961
|
}
|
|
144787
144962
|
function spanInParameterDeclaration(parameter) {
|
|
144788
144963
|
if (isBindingPattern(parameter.name)) {
|
|
@@ -144801,7 +144976,7 @@ ${newComment.split("\n").map((c) => ` * ${c}`).join("\n")}
|
|
|
144801
144976
|
}
|
|
144802
144977
|
}
|
|
144803
144978
|
function canFunctionHaveSpanInWholeDeclaration(functionDeclaration) {
|
|
144804
|
-
return hasSyntacticModifier(functionDeclaration,
|
|
144979
|
+
return hasSyntacticModifier(functionDeclaration, 32 /* Export */) || functionDeclaration.parent.kind === 263 /* ClassDeclaration */ && functionDeclaration.kind !== 176 /* Constructor */;
|
|
144805
144980
|
}
|
|
144806
144981
|
function spanInFunctionDeclaration(functionDeclaration) {
|
|
144807
144982
|
if (!functionDeclaration.body) {
|
|
@@ -145372,7 +145547,7 @@ ${newComment.split("\n").map((c) => ` * ${c}`).join("\n")}
|
|
|
145372
145547
|
forEach(node.statements, collect);
|
|
145373
145548
|
}
|
|
145374
145549
|
function collectCallSitesOfModuleDeclaration(node, collect) {
|
|
145375
|
-
if (!hasSyntacticModifier(node,
|
|
145550
|
+
if (!hasSyntacticModifier(node, 128 /* Ambient */) && node.body && isModuleBlock(node.body)) {
|
|
145376
145551
|
forEach(node.body.statements, collect);
|
|
145377
145552
|
}
|
|
145378
145553
|
}
|
|
@@ -145679,7 +145854,7 @@ ${newComment.split("\n").map((c) => ` * ${c}`).join("\n")}
|
|
|
145679
145854
|
/*includeTrivia*/
|
|
145680
145855
|
true
|
|
145681
145856
|
),
|
|
145682
|
-
factory.createNodeArray(factory.createModifiersFromModifierFlags(getSyntacticModifierFlags(insertionSite) |
|
|
145857
|
+
factory.createNodeArray(factory.createModifiersFromModifierFlags(getSyntacticModifierFlags(insertionSite) | 1024 /* Async */))
|
|
145683
145858
|
);
|
|
145684
145859
|
changeTracker.replaceNode(
|
|
145685
145860
|
sourceFile,
|
|
@@ -145791,7 +145966,7 @@ ${newComment.split("\n").map((c) => ` * ${c}`).join("\n")}
|
|
|
145791
145966
|
const declaration = tryCast(symbol.valueDeclaration, isVariableDeclaration);
|
|
145792
145967
|
const variableName = declaration && tryCast(declaration.name, isIdentifier);
|
|
145793
145968
|
const variableStatement = getAncestor(declaration, 243 /* VariableStatement */);
|
|
145794
|
-
if (!declaration || !variableStatement || declaration.type || !declaration.initializer || variableStatement.getSourceFile() !== sourceFile || hasSyntacticModifier(variableStatement,
|
|
145969
|
+
if (!declaration || !variableStatement || declaration.type || !declaration.initializer || variableStatement.getSourceFile() !== sourceFile || hasSyntacticModifier(variableStatement, 32 /* Export */) || !variableName || !isInsideAwaitableBody(declaration.initializer)) {
|
|
145795
145970
|
isCompleteFix = false;
|
|
145796
145971
|
continue;
|
|
145797
145972
|
}
|
|
@@ -148581,7 +148756,7 @@ ${newComment.split("\n").map((c) => ` * ${c}`).join("\n")}
|
|
|
148581
148756
|
return Debug.checkDefined(getContainingClass(getTokenAtPosition(sourceFile, pos)), "There should be a containing class");
|
|
148582
148757
|
}
|
|
148583
148758
|
function symbolPointsToNonPrivateMember(symbol) {
|
|
148584
|
-
return !symbol.valueDeclaration || !(getEffectiveModifierFlags(symbol.valueDeclaration) &
|
|
148759
|
+
return !symbol.valueDeclaration || !(getEffectiveModifierFlags(symbol.valueDeclaration) & 2 /* Private */);
|
|
148585
148760
|
}
|
|
148586
148761
|
function addMissingDeclarations(context, implementedTypeNode, sourceFile, classDeclaration, changeTracker, preferences) {
|
|
148587
148762
|
const checker = context.program.getTypeChecker();
|
|
@@ -150609,7 +150784,7 @@ ${newComment.split("\n").map((c) => ` * ${c}`).join("\n")}
|
|
|
150609
150784
|
const tag = findAncestor(node, isJsxOpeningLikeElement);
|
|
150610
150785
|
const props = checker.getContextualTypeForArgumentAtIndex(tag, 0);
|
|
150611
150786
|
suggestedSymbol = checker.getSuggestedSymbolForNonexistentJSXAttribute(node, props);
|
|
150612
|
-
} else if (
|
|
150787
|
+
} else if (hasOverrideModifier(parent2) && isClassElement(parent2) && parent2.name === node) {
|
|
150613
150788
|
const baseDeclaration = findAncestor(node, isClassLike);
|
|
150614
150789
|
const baseTypeNode = baseDeclaration ? getEffectiveBaseTypeNode(baseDeclaration) : void 0;
|
|
150615
150790
|
const baseType = baseTypeNode ? checker.getTypeAtLocation(baseTypeNode) : void 0;
|
|
@@ -150771,7 +150946,7 @@ ${newComment.split("\n").map((c) => ` * ${c}`).join("\n")}
|
|
|
150771
150946
|
if (isFunctionType) {
|
|
150772
150947
|
const sig = checker.getSignatureFromDeclaration(declaration);
|
|
150773
150948
|
if (sig) {
|
|
150774
|
-
if (hasSyntacticModifier(declaration,
|
|
150949
|
+
if (hasSyntacticModifier(declaration, 1024 /* Async */)) {
|
|
150775
150950
|
exprType = checker.createPromiseType(exprType);
|
|
150776
150951
|
}
|
|
150777
150952
|
const newSig = checker.createSignature(
|
|
@@ -151043,13 +151218,13 @@ ${newComment.split("\n").map((c) => ` * ${c}`).join("\n")}
|
|
|
151043
151218
|
const moduleDeclaration = find(symbol.declarations, isModuleDeclaration);
|
|
151044
151219
|
const moduleDeclarationSourceFile = moduleDeclaration == null ? void 0 : moduleDeclaration.getSourceFile();
|
|
151045
151220
|
if (moduleDeclaration && moduleDeclarationSourceFile && !isSourceFileFromLibrary(program, moduleDeclarationSourceFile)) {
|
|
151046
|
-
return { kind: 2 /* Function */, token, call: parent2.parent, sourceFile, modifierFlags:
|
|
151221
|
+
return { kind: 2 /* Function */, token, call: parent2.parent, sourceFile, modifierFlags: 32 /* Export */, parentDeclaration: moduleDeclaration };
|
|
151047
151222
|
}
|
|
151048
151223
|
const moduleSourceFile = find(symbol.declarations, isSourceFile);
|
|
151049
151224
|
if (sourceFile.commonJsModuleIndicator)
|
|
151050
151225
|
return void 0;
|
|
151051
151226
|
if (moduleSourceFile && !isSourceFileFromLibrary(program, moduleSourceFile)) {
|
|
151052
|
-
return { kind: 2 /* Function */, token, call: parent2.parent, sourceFile: moduleSourceFile, modifierFlags:
|
|
151227
|
+
return { kind: 2 /* Function */, token, call: parent2.parent, sourceFile: moduleSourceFile, modifierFlags: 32 /* Export */, parentDeclaration: moduleSourceFile };
|
|
151053
151228
|
}
|
|
151054
151229
|
}
|
|
151055
151230
|
const classDeclaration = find(symbol.declarations, isClassLike);
|
|
@@ -151061,7 +151236,7 @@ ${newComment.split("\n").map((c) => ` * ${c}`).join("\n")}
|
|
|
151061
151236
|
if (makeStatic && (isPrivateIdentifier(token) || isInterfaceDeclaration(declaration)))
|
|
151062
151237
|
return void 0;
|
|
151063
151238
|
const declSourceFile = declaration.getSourceFile();
|
|
151064
|
-
const modifierFlags = isTypeLiteralNode(declaration) ? 0 /* None */ : (makeStatic ?
|
|
151239
|
+
const modifierFlags = isTypeLiteralNode(declaration) ? 0 /* None */ : (makeStatic ? 256 /* Static */ : 0 /* None */) | (startsWithUnderscore(token.text) ? 2 /* Private */ : 0 /* None */);
|
|
151065
151240
|
const isJSFile = isSourceFileJS(declSourceFile);
|
|
151066
151241
|
const call = tryCast(parent2.parent, isCallExpression);
|
|
151067
151242
|
return { kind: 0 /* TypeLikeDeclaration */, token, call, modifierFlags, parentDeclaration: declaration, declSourceFile, isJSFile };
|
|
@@ -151079,11 +151254,11 @@ ${newComment.split("\n").map((c) => ` * ${c}`).join("\n")}
|
|
|
151079
151254
|
if (isInterfaceDeclaration(parentDeclaration) || isTypeLiteralNode(parentDeclaration)) {
|
|
151080
151255
|
return void 0;
|
|
151081
151256
|
}
|
|
151082
|
-
const changes = ts_textChanges_exports.ChangeTracker.with(context, (t) => addMissingMemberInJs(t, declSourceFile, parentDeclaration, token, !!(modifierFlags &
|
|
151257
|
+
const changes = ts_textChanges_exports.ChangeTracker.with(context, (t) => addMissingMemberInJs(t, declSourceFile, parentDeclaration, token, !!(modifierFlags & 256 /* Static */)));
|
|
151083
151258
|
if (changes.length === 0) {
|
|
151084
151259
|
return void 0;
|
|
151085
151260
|
}
|
|
151086
|
-
const diagnostic = modifierFlags &
|
|
151261
|
+
const diagnostic = modifierFlags & 256 /* Static */ ? Diagnostics.Initialize_static_property_0 : isPrivateIdentifier(token) ? Diagnostics.Declare_a_private_field_named_0 : Diagnostics.Initialize_property_0_in_the_constructor;
|
|
151087
151262
|
return createCodeFixAction(fixMissingMember, changes, [diagnostic, token.text], fixMissingMember, Diagnostics.Add_all_missing_members);
|
|
151088
151263
|
}
|
|
151089
151264
|
function addMissingMemberInJs(changeTracker, sourceFile, classDeclaration, token, makeStatic) {
|
|
@@ -151127,15 +151302,15 @@ ${newComment.split("\n").map((c) => ` * ${c}`).join("\n")}
|
|
|
151127
151302
|
}
|
|
151128
151303
|
function createActionsForAddMissingMemberInTypeScriptFile(context, { parentDeclaration, declSourceFile, modifierFlags, token }) {
|
|
151129
151304
|
const memberName = token.text;
|
|
151130
|
-
const isStatic2 = modifierFlags &
|
|
151305
|
+
const isStatic2 = modifierFlags & 256 /* Static */;
|
|
151131
151306
|
const typeNode = getTypeNode2(context.program.getTypeChecker(), parentDeclaration, token);
|
|
151132
151307
|
const addPropertyDeclarationChanges = (modifierFlags2) => ts_textChanges_exports.ChangeTracker.with(context, (t) => addPropertyDeclaration(t, declSourceFile, parentDeclaration, memberName, typeNode, modifierFlags2));
|
|
151133
|
-
const actions2 = [createCodeFixAction(fixMissingMember, addPropertyDeclarationChanges(modifierFlags &
|
|
151308
|
+
const actions2 = [createCodeFixAction(fixMissingMember, addPropertyDeclarationChanges(modifierFlags & 256 /* Static */), [isStatic2 ? Diagnostics.Declare_static_property_0 : Diagnostics.Declare_property_0, memberName], fixMissingMember, Diagnostics.Add_all_missing_members)];
|
|
151134
151309
|
if (isStatic2 || isPrivateIdentifier(token)) {
|
|
151135
151310
|
return actions2;
|
|
151136
151311
|
}
|
|
151137
|
-
if (modifierFlags &
|
|
151138
|
-
actions2.unshift(createCodeFixActionWithoutFixAll(fixMissingMember, addPropertyDeclarationChanges(
|
|
151312
|
+
if (modifierFlags & 2 /* Private */) {
|
|
151313
|
+
actions2.unshift(createCodeFixActionWithoutFixAll(fixMissingMember, addPropertyDeclarationChanges(2 /* Private */), [Diagnostics.Declare_private_property_0, memberName]));
|
|
151139
151314
|
}
|
|
151140
151315
|
actions2.push(createAddIndexSignatureAction(context, declSourceFile, parentDeclaration, token.text, typeNode));
|
|
151141
151316
|
return actions2;
|
|
@@ -151222,9 +151397,9 @@ ${newComment.split("\n").map((c) => ` * ${c}`).join("\n")}
|
|
|
151222
151397
|
}
|
|
151223
151398
|
const methodName = token.text;
|
|
151224
151399
|
const addMethodDeclarationChanges = (modifierFlags2) => ts_textChanges_exports.ChangeTracker.with(context, (t) => addMethodDeclaration(context, t, call, token, modifierFlags2, parentDeclaration, declSourceFile));
|
|
151225
|
-
const actions2 = [createCodeFixAction(fixMissingMember, addMethodDeclarationChanges(modifierFlags &
|
|
151226
|
-
if (modifierFlags &
|
|
151227
|
-
actions2.unshift(createCodeFixActionWithoutFixAll(fixMissingMember, addMethodDeclarationChanges(
|
|
151400
|
+
const actions2 = [createCodeFixAction(fixMissingMember, addMethodDeclarationChanges(modifierFlags & 256 /* Static */), [modifierFlags & 256 /* Static */ ? Diagnostics.Declare_static_method_0 : Diagnostics.Declare_method_0, methodName], fixMissingMember, Diagnostics.Add_all_missing_members)];
|
|
151401
|
+
if (modifierFlags & 2 /* Private */) {
|
|
151402
|
+
actions2.unshift(createCodeFixActionWithoutFixAll(fixMissingMember, addMethodDeclarationChanges(2 /* Private */), [Diagnostics.Declare_private_method_0, methodName]));
|
|
151228
151403
|
}
|
|
151229
151404
|
return actions2;
|
|
151230
151405
|
}
|
|
@@ -151598,13 +151773,13 @@ ${newComment.split("\n").map((c) => ` * ${c}`).join("\n")}
|
|
|
151598
151773
|
continue;
|
|
151599
151774
|
const { parentDeclaration, declSourceFile, modifierFlags, token, call, isJSFile } = info;
|
|
151600
151775
|
if (call && !isPrivateIdentifier(token)) {
|
|
151601
|
-
addMethodDeclaration(context, changes, call, token, modifierFlags &
|
|
151776
|
+
addMethodDeclaration(context, changes, call, token, modifierFlags & 256 /* Static */, parentDeclaration, declSourceFile);
|
|
151602
151777
|
} else {
|
|
151603
151778
|
if (isJSFile && !isInterfaceDeclaration(parentDeclaration) && !isTypeLiteralNode(parentDeclaration)) {
|
|
151604
|
-
addMissingMemberInJs(changes, declSourceFile, parentDeclaration, token, !!(modifierFlags &
|
|
151779
|
+
addMissingMemberInJs(changes, declSourceFile, parentDeclaration, token, !!(modifierFlags & 256 /* Static */));
|
|
151605
151780
|
} else {
|
|
151606
151781
|
const typeNode = getTypeNode2(checker, parentDeclaration, token);
|
|
151607
|
-
addPropertyDeclaration(changes, declSourceFile, parentDeclaration, token.text, typeNode, modifierFlags &
|
|
151782
|
+
addPropertyDeclaration(changes, declSourceFile, parentDeclaration, token.text, typeNode, modifierFlags & 256 /* Static */);
|
|
151608
151783
|
}
|
|
151609
151784
|
}
|
|
151610
151785
|
}
|
|
@@ -151736,7 +151911,7 @@ ${newComment.split("\n").map((c) => ` * ${c}`).join("\n")}
|
|
|
151736
151911
|
}
|
|
151737
151912
|
function symbolPointsToNonPrivateAndAbstractMember(symbol) {
|
|
151738
151913
|
const flags = getSyntacticModifierFlags(first(symbol.getDeclarations()));
|
|
151739
|
-
return !(flags &
|
|
151914
|
+
return !(flags & 2 /* Private */) && !!(flags & 64 /* Abstract */);
|
|
151740
151915
|
}
|
|
151741
151916
|
var errorCodes30, fixId25;
|
|
151742
151917
|
var init_fixClassDoesntImplementInheritedAbstractMember = __esm({
|
|
@@ -154261,10 +154436,10 @@ ${newComment.split("\n").map((c) => ` * ${c}`).join("\n")}
|
|
|
154261
154436
|
const kind = (declaration == null ? void 0 : declaration.kind) ?? 171 /* PropertySignature */;
|
|
154262
154437
|
const declarationName = createDeclarationName(symbol, declaration);
|
|
154263
154438
|
const effectiveModifierFlags = declaration ? getEffectiveModifierFlags(declaration) : 0 /* None */;
|
|
154264
|
-
let modifierFlags = effectiveModifierFlags &
|
|
154265
|
-
modifierFlags |= effectiveModifierFlags &
|
|
154439
|
+
let modifierFlags = effectiveModifierFlags & 256 /* Static */;
|
|
154440
|
+
modifierFlags |= effectiveModifierFlags & 1 /* Public */ ? 1 /* Public */ : effectiveModifierFlags & 4 /* Protected */ ? 4 /* Protected */ : 0 /* None */;
|
|
154266
154441
|
if (declaration && isAutoAccessorPropertyDeclaration(declaration)) {
|
|
154267
|
-
modifierFlags |=
|
|
154442
|
+
modifierFlags |= 512 /* Accessor */;
|
|
154268
154443
|
}
|
|
154269
154444
|
const modifiers = createModifiers();
|
|
154270
154445
|
const type = checker.getWidenedType(checker.getTypeOfSymbolAtLocation(symbol, enclosingDeclaration));
|
|
@@ -154943,24 +155118,24 @@ ${newComment.split("\n").map((c) => ` * ${c}`).join("\n")}
|
|
|
154943
155118
|
return isIdentifier(fieldName) ? factory.createPropertyAccessExpression(leftHead, fieldName) : factory.createElementAccessExpression(leftHead, factory.createStringLiteralFromNode(fieldName));
|
|
154944
155119
|
}
|
|
154945
155120
|
function prepareModifierFlagsForAccessor(modifierFlags) {
|
|
154946
|
-
modifierFlags &= ~
|
|
154947
|
-
modifierFlags &= ~
|
|
154948
|
-
if (!(modifierFlags &
|
|
154949
|
-
modifierFlags |=
|
|
155121
|
+
modifierFlags &= ~8 /* Readonly */;
|
|
155122
|
+
modifierFlags &= ~2 /* Private */;
|
|
155123
|
+
if (!(modifierFlags & 4 /* Protected */)) {
|
|
155124
|
+
modifierFlags |= 1 /* Public */;
|
|
154950
155125
|
}
|
|
154951
155126
|
return modifierFlags;
|
|
154952
155127
|
}
|
|
154953
155128
|
function prepareModifierFlagsForField(modifierFlags) {
|
|
154954
|
-
modifierFlags &= ~
|
|
154955
|
-
modifierFlags &= ~
|
|
154956
|
-
modifierFlags |=
|
|
155129
|
+
modifierFlags &= ~1 /* Public */;
|
|
155130
|
+
modifierFlags &= ~4 /* Protected */;
|
|
155131
|
+
modifierFlags |= 2 /* Private */;
|
|
154957
155132
|
return modifierFlags;
|
|
154958
155133
|
}
|
|
154959
155134
|
function getAccessorConvertiblePropertyAtPosition(file, program, start, end, considerEmptySpans = true) {
|
|
154960
155135
|
const node = getTokenAtPosition(file, start);
|
|
154961
155136
|
const cursorRequest = start === end && considerEmptySpans;
|
|
154962
155137
|
const declaration = findAncestor(node.parent, isAcceptedDeclaration);
|
|
154963
|
-
const meaning =
|
|
155138
|
+
const meaning = 7 /* AccessibilityModifier */ | 256 /* Static */ | 8 /* Readonly */;
|
|
154964
155139
|
if (!declaration || !(nodeOverlapsWithStartEnd(declaration.name, file, start, end) || cursorRequest)) {
|
|
154965
155140
|
return {
|
|
154966
155141
|
error: getLocaleSpecificMessage(Diagnostics.Could_not_find_property_for_which_to_generate_accessor)
|
|
@@ -154971,7 +155146,7 @@ ${newComment.split("\n").map((c) => ` * ${c}`).join("\n")}
|
|
|
154971
155146
|
error: getLocaleSpecificMessage(Diagnostics.Name_is_not_valid)
|
|
154972
155147
|
};
|
|
154973
155148
|
}
|
|
154974
|
-
if ((getEffectiveModifierFlags(declaration) &
|
|
155149
|
+
if ((getEffectiveModifierFlags(declaration) & 98303 /* Modifier */ | meaning) !== meaning) {
|
|
154975
155150
|
return {
|
|
154976
155151
|
error: getLocaleSpecificMessage(Diagnostics.Can_only_convert_property_with_modifier)
|
|
154977
155152
|
};
|
|
@@ -155312,7 +155487,7 @@ ${newComment.split("\n").map((c) => ` * ${c}`).join("\n")}
|
|
|
155312
155487
|
return firstDefined(type.types, (t) => getDefaultValueFromType(checker, t));
|
|
155313
155488
|
} else if (type.isClass()) {
|
|
155314
155489
|
const classDeclaration = getClassLikeDeclarationOfSymbol(type.symbol);
|
|
155315
|
-
if (!classDeclaration || hasSyntacticModifier(classDeclaration,
|
|
155490
|
+
if (!classDeclaration || hasSyntacticModifier(classDeclaration, 64 /* Abstract */))
|
|
155316
155491
|
return void 0;
|
|
155317
155492
|
const constructorDeclaration = getFirstConstructorWithBody(classDeclaration);
|
|
155318
155493
|
if (constructorDeclaration && constructorDeclaration.parameters.length)
|
|
@@ -157229,7 +157404,7 @@ ${newComment.split("\n").map((c) => ` * ${c}`).join("\n")}
|
|
|
157229
157404
|
}
|
|
157230
157405
|
let modifiers = 0 /* None */;
|
|
157231
157406
|
const { modifiers: presentModifiers, range: eraseRange, decorators: presentDecorators } = getPresentModifiers(contextToken, sourceFile, position);
|
|
157232
|
-
const isAbstract = presentModifiers &
|
|
157407
|
+
const isAbstract = presentModifiers & 64 /* Abstract */ && classLikeDeclaration.modifierFlagsCache & 64 /* Abstract */;
|
|
157233
157408
|
let completionNodes = [];
|
|
157234
157409
|
ts_codefix_exports.addNewNodeForMemberSymbol(
|
|
157235
157410
|
symbol,
|
|
@@ -157248,10 +157423,10 @@ ${newComment.split("\n").map((c) => ` * ${c}`).join("\n")}
|
|
|
157248
157423
|
(node) => {
|
|
157249
157424
|
let requiredModifiers = 0 /* None */;
|
|
157250
157425
|
if (isAbstract) {
|
|
157251
|
-
requiredModifiers |=
|
|
157426
|
+
requiredModifiers |= 64 /* Abstract */;
|
|
157252
157427
|
}
|
|
157253
157428
|
if (isClassElement(node) && checker.getMemberOverrideModifierStatus(classLikeDeclaration, node, symbol) === 1 /* NeedsOverride */) {
|
|
157254
|
-
requiredModifiers |=
|
|
157429
|
+
requiredModifiers |= 16 /* Override */;
|
|
157255
157430
|
}
|
|
157256
157431
|
if (!completionNodes.length) {
|
|
157257
157432
|
modifiers = node.modifierFlagsCache | requiredModifiers;
|
|
@@ -157265,21 +157440,21 @@ ${newComment.split("\n").map((c) => ` * ${c}`).join("\n")}
|
|
|
157265
157440
|
);
|
|
157266
157441
|
if (completionNodes.length) {
|
|
157267
157442
|
const isMethod = symbol.flags & 8192 /* Method */;
|
|
157268
|
-
let allowedModifiers = modifiers |
|
|
157443
|
+
let allowedModifiers = modifiers | 16 /* Override */ | 1 /* Public */;
|
|
157269
157444
|
if (!isMethod) {
|
|
157270
|
-
allowedModifiers |=
|
|
157445
|
+
allowedModifiers |= 128 /* Ambient */ | 8 /* Readonly */;
|
|
157271
157446
|
} else {
|
|
157272
|
-
allowedModifiers |=
|
|
157447
|
+
allowedModifiers |= 1024 /* Async */;
|
|
157273
157448
|
}
|
|
157274
157449
|
const allowedAndPresent = presentModifiers & allowedModifiers;
|
|
157275
157450
|
if (presentModifiers & ~allowedModifiers) {
|
|
157276
157451
|
return void 0;
|
|
157277
157452
|
}
|
|
157278
|
-
if (modifiers &
|
|
157279
|
-
modifiers &= ~
|
|
157453
|
+
if (modifiers & 4 /* Protected */ && allowedAndPresent & 1 /* Public */) {
|
|
157454
|
+
modifiers &= ~4 /* Protected */;
|
|
157280
157455
|
}
|
|
157281
|
-
if (allowedAndPresent !== 0 /* None */ && !(allowedAndPresent &
|
|
157282
|
-
modifiers &= ~
|
|
157456
|
+
if (allowedAndPresent !== 0 /* None */ && !(allowedAndPresent & 1 /* Public */)) {
|
|
157457
|
+
modifiers &= ~1 /* Public */;
|
|
157283
157458
|
}
|
|
157284
157459
|
modifiers |= allowedAndPresent;
|
|
157285
157460
|
completionNodes = completionNodes.map((node) => factory.replaceModifiers(node, modifiers));
|
|
@@ -157316,7 +157491,7 @@ ${newComment.split("\n").map((c) => ` * ${c}`).join("\n")}
|
|
|
157316
157491
|
let contextMod;
|
|
157317
157492
|
const range = { pos: position, end: position };
|
|
157318
157493
|
if (isPropertyDeclaration(contextToken.parent) && contextToken.parent.modifiers) {
|
|
157319
|
-
modifiers |= modifiersToFlags(contextToken.parent.modifiers) &
|
|
157494
|
+
modifiers |= modifiersToFlags(contextToken.parent.modifiers) & 98303 /* Modifier */;
|
|
157320
157495
|
decorators = contextToken.parent.modifiers.filter(isDecorator) || [];
|
|
157321
157496
|
range.pos = Math.min(range.pos, contextToken.parent.modifiers.pos);
|
|
157322
157497
|
}
|
|
@@ -158480,57 +158655,109 @@ ${newComment.split("\n").map((c) => ` * ${c}`).join("\n")}
|
|
|
158480
158655
|
function addPropertySymbol(symbol, insertAwait, insertQuestionDot) {
|
|
158481
158656
|
var _a;
|
|
158482
158657
|
const computedPropertyName = firstDefined(symbol.declarations, (decl) => tryCast(getNameOfDeclaration(decl), isComputedPropertyName));
|
|
158483
|
-
if (computedPropertyName) {
|
|
158484
|
-
|
|
158485
|
-
|
|
158486
|
-
|
|
158487
|
-
|
|
158488
|
-
|
|
158489
|
-
|
|
158490
|
-
|
|
158491
|
-
|
|
158492
|
-
|
|
158493
|
-
|
|
158658
|
+
if (!computedPropertyName) {
|
|
158659
|
+
addLiteralSymbol();
|
|
158660
|
+
return;
|
|
158661
|
+
}
|
|
158662
|
+
const computedPropertyNameExpression = computedPropertyName.expression;
|
|
158663
|
+
const name = isEntityName(computedPropertyNameExpression) ? computedPropertyNameExpression : isPropertyAccessExpression(computedPropertyNameExpression) ? computedPropertyNameExpression.name : void 0;
|
|
158664
|
+
const nameSymbol = name && typeChecker.getSymbolAtLocation(name);
|
|
158665
|
+
const nameSymbolId = nameSymbol && getSymbolId(nameSymbol);
|
|
158666
|
+
if (!nameSymbolId) {
|
|
158667
|
+
addLiteralSymbol();
|
|
158668
|
+
return;
|
|
158669
|
+
}
|
|
158670
|
+
if (addToSeen(seenPropertySymbols, nameSymbolId)) {
|
|
158671
|
+
const leftMostName = getLeftMostName(computedPropertyNameExpression);
|
|
158672
|
+
const leftMostNameSymbol = leftMostName && typeChecker.getSymbolAtLocation(leftMostName);
|
|
158673
|
+
const firstAccessibleSymbol = leftMostNameSymbol && getFirstSymbolInChain(leftMostNameSymbol, contextToken, typeChecker);
|
|
158674
|
+
if (!firstAccessibleSymbol) {
|
|
158675
|
+
addLiteralSymbol();
|
|
158676
|
+
return;
|
|
158677
|
+
}
|
|
158678
|
+
const index = symbols.length;
|
|
158679
|
+
symbols.push(nameSymbol);
|
|
158680
|
+
const moduleSymbol = firstAccessibleSymbol.parent;
|
|
158681
|
+
if (!moduleSymbol || !isExternalModuleSymbol(moduleSymbol) || typeChecker.tryGetMemberInModuleExportsAndProperties(firstAccessibleSymbol.name, moduleSymbol) !== firstAccessibleSymbol) {
|
|
158682
|
+
const node2 = preferences.includeCompletionsWithInsertText ? createComputedPropertyAccess(nameSymbol, leftMostNameSymbol, computedPropertyNameExpression) : void 0;
|
|
158683
|
+
if (!node2) {
|
|
158684
|
+
symbols[index] = symbol;
|
|
158494
158685
|
} else {
|
|
158495
|
-
const
|
|
158496
|
-
|
|
158497
|
-
|
|
158498
|
-
|
|
158499
|
-
|
|
158500
|
-
|
|
158501
|
-
|
|
158502
|
-
|
|
158503
|
-
|
|
158504
|
-
|
|
158505
|
-
|
|
158506
|
-
isValidTypeOnlyAliasUseSite(location)
|
|
158507
|
-
) || {};
|
|
158508
|
-
if (moduleSpecifier) {
|
|
158509
|
-
const origin = {
|
|
158510
|
-
kind: getNullableSymbolOriginInfoKind(6 /* SymbolMemberExport */),
|
|
158511
|
-
moduleSymbol,
|
|
158512
|
-
isDefaultExport: false,
|
|
158513
|
-
symbolName: firstAccessibleSymbol.name,
|
|
158514
|
-
exportName: firstAccessibleSymbol.name,
|
|
158515
|
-
fileName,
|
|
158516
|
-
moduleSpecifier
|
|
158517
|
-
};
|
|
158518
|
-
symbolToOriginInfoMap[index] = origin;
|
|
158519
|
-
}
|
|
158686
|
+
const printer = createPrinter({
|
|
158687
|
+
removeComments: true,
|
|
158688
|
+
module: compilerOptions.module,
|
|
158689
|
+
target: compilerOptions.target,
|
|
158690
|
+
omitTrailingSemicolon: true
|
|
158691
|
+
});
|
|
158692
|
+
const origin = {
|
|
158693
|
+
kind: getNullableSymbolOriginInfoKind(2 /* SymbolMemberNoExport */) | 512 /* ComputedPropertyName */,
|
|
158694
|
+
symbolName: printer.printNode(4 /* Unspecified */, node2, contextToken.getSourceFile())
|
|
158695
|
+
};
|
|
158696
|
+
symbolToOriginInfoMap[index] = origin;
|
|
158520
158697
|
}
|
|
158521
|
-
} else
|
|
158522
|
-
|
|
158523
|
-
|
|
158698
|
+
} else {
|
|
158699
|
+
const fileName = isExternalModuleNameRelative(stripQuotes(moduleSymbol.name)) ? (_a = getSourceFileOfModule(moduleSymbol)) == null ? void 0 : _a.fileName : void 0;
|
|
158700
|
+
const { moduleSpecifier } = (importSpecifierResolver || (importSpecifierResolver = ts_codefix_exports.createImportSpecifierResolver(sourceFile, program, host, preferences))).getModuleSpecifierForBestExportInfo(
|
|
158701
|
+
[{
|
|
158702
|
+
exportKind: 0 /* Named */,
|
|
158703
|
+
moduleFileName: fileName,
|
|
158704
|
+
isFromPackageJson: false,
|
|
158705
|
+
moduleSymbol,
|
|
158706
|
+
symbol: firstAccessibleSymbol,
|
|
158707
|
+
targetFlags: skipAlias(firstAccessibleSymbol, typeChecker).flags
|
|
158708
|
+
}],
|
|
158709
|
+
position,
|
|
158710
|
+
isValidTypeOnlyAliasUseSite(location)
|
|
158711
|
+
) || {};
|
|
158712
|
+
if (moduleSpecifier) {
|
|
158713
|
+
const origin = {
|
|
158714
|
+
kind: getNullableSymbolOriginInfoKind(6 /* SymbolMemberExport */),
|
|
158715
|
+
moduleSymbol,
|
|
158716
|
+
isDefaultExport: false,
|
|
158717
|
+
symbolName: firstAccessibleSymbol.name,
|
|
158718
|
+
exportName: firstAccessibleSymbol.name,
|
|
158719
|
+
fileName,
|
|
158720
|
+
moduleSpecifier
|
|
158721
|
+
};
|
|
158722
|
+
symbolToOriginInfoMap[index] = origin;
|
|
158524
158723
|
}
|
|
158525
|
-
addSymbolOriginInfo(symbol);
|
|
158526
|
-
addSymbolSortInfo(symbol);
|
|
158527
|
-
symbols.push(symbol);
|
|
158528
158724
|
}
|
|
158529
|
-
}
|
|
158725
|
+
}
|
|
158726
|
+
function addLiteralSymbol() {
|
|
158530
158727
|
addSymbolOriginInfo(symbol);
|
|
158531
158728
|
addSymbolSortInfo(symbol);
|
|
158532
158729
|
symbols.push(symbol);
|
|
158533
158730
|
}
|
|
158731
|
+
function createComputedPropertyAccess(nameSymbol2, leftMostNameSymbol, computedPropertyNameExpression2) {
|
|
158732
|
+
let node2;
|
|
158733
|
+
if (!isTransientSymbol(nameSymbol2)) {
|
|
158734
|
+
node2 = typeChecker.symbolToEntityName(
|
|
158735
|
+
nameSymbol2,
|
|
158736
|
+
/*meaning*/
|
|
158737
|
+
void 0,
|
|
158738
|
+
contextToken,
|
|
158739
|
+
16384 /* UseAliasDefinedOutsideCurrentScope */
|
|
158740
|
+
);
|
|
158741
|
+
} else {
|
|
158742
|
+
let createPropertyAccess2 = function(n) {
|
|
158743
|
+
if (isIdentifier(n)) {
|
|
158744
|
+
Debug.assertNode(leftMostNodeAccessExpression, isExpression);
|
|
158745
|
+
return leftMostNodeAccessExpression;
|
|
158746
|
+
}
|
|
158747
|
+
return factory.createPropertyAccessExpression(createPropertyAccess2(n.expression), n.name);
|
|
158748
|
+
};
|
|
158749
|
+
var createPropertyAccess = createPropertyAccess2;
|
|
158750
|
+
const leftMostNodeAccessExpression = typeChecker.symbolToNode(
|
|
158751
|
+
leftMostNameSymbol,
|
|
158752
|
+
/*meaning*/
|
|
158753
|
+
void 0,
|
|
158754
|
+
contextToken,
|
|
158755
|
+
16384 /* UseAliasDefinedOutsideCurrentScope */
|
|
158756
|
+
);
|
|
158757
|
+
node2 = createPropertyAccess2(computedPropertyNameExpression2);
|
|
158758
|
+
}
|
|
158759
|
+
return node2;
|
|
158760
|
+
}
|
|
158534
158761
|
function addSymbolSortInfo(symbol2) {
|
|
158535
158762
|
if (isStaticProperty(symbol2)) {
|
|
158536
158763
|
symbolToSortTextMap[getSymbolId(symbol2)] = SortText.LocalDeclarationPriority;
|
|
@@ -159057,24 +159284,24 @@ ${newComment.split("\n").map((c) => ` * ${c}`).join("\n")}
|
|
|
159057
159284
|
if (contextToken.kind === 80 /* Identifier */ && !isCurrentlyEditingNode(contextToken)) {
|
|
159058
159285
|
switch (contextToken.getText()) {
|
|
159059
159286
|
case "private":
|
|
159060
|
-
classElementModifierFlags = classElementModifierFlags |
|
|
159287
|
+
classElementModifierFlags = classElementModifierFlags | 2 /* Private */;
|
|
159061
159288
|
break;
|
|
159062
159289
|
case "static":
|
|
159063
|
-
classElementModifierFlags = classElementModifierFlags |
|
|
159290
|
+
classElementModifierFlags = classElementModifierFlags | 256 /* Static */;
|
|
159064
159291
|
break;
|
|
159065
159292
|
case "override":
|
|
159066
|
-
classElementModifierFlags = classElementModifierFlags |
|
|
159293
|
+
classElementModifierFlags = classElementModifierFlags | 16 /* Override */;
|
|
159067
159294
|
break;
|
|
159068
159295
|
}
|
|
159069
159296
|
}
|
|
159070
159297
|
if (isClassStaticBlockDeclaration(classElement)) {
|
|
159071
|
-
classElementModifierFlags |=
|
|
159298
|
+
classElementModifierFlags |= 256 /* Static */;
|
|
159072
159299
|
}
|
|
159073
|
-
if (!(classElementModifierFlags &
|
|
159074
|
-
const baseTypeNodes = isClassLike(decl) && classElementModifierFlags &
|
|
159300
|
+
if (!(classElementModifierFlags & 2 /* Private */)) {
|
|
159301
|
+
const baseTypeNodes = isClassLike(decl) && classElementModifierFlags & 16 /* Override */ ? singleElementArray(getEffectiveBaseTypeNode(decl)) : getAllSuperTypeNodes(decl);
|
|
159075
159302
|
const baseSymbols = flatMap(baseTypeNodes, (baseTypeNode) => {
|
|
159076
159303
|
const type = typeChecker.getTypeAtLocation(baseTypeNode);
|
|
159077
|
-
return classElementModifierFlags &
|
|
159304
|
+
return classElementModifierFlags & 256 /* Static */ ? (type == null ? void 0 : type.symbol) && typeChecker.getPropertiesOfType(typeChecker.getTypeOfSymbolAtLocation(type.symbol, decl)) : type && typeChecker.getPropertiesOfType(type);
|
|
159078
159305
|
});
|
|
159079
159306
|
symbols = concatenate(symbols, filterClassMembersList(baseSymbols, decl.members, classElementModifierFlags));
|
|
159080
159307
|
forEach(symbols, (symbol, index) => {
|
|
@@ -159377,10 +159604,10 @@ ${newComment.split("\n").map((c) => ` * ${c}`).join("\n")}
|
|
|
159377
159604
|
if (isCurrentlyEditingNode(m)) {
|
|
159378
159605
|
continue;
|
|
159379
159606
|
}
|
|
159380
|
-
if (hasEffectiveModifier(m,
|
|
159607
|
+
if (hasEffectiveModifier(m, 2 /* Private */)) {
|
|
159381
159608
|
continue;
|
|
159382
159609
|
}
|
|
159383
|
-
if (isStatic(m) !== !!(currentClassElementModifierFlags &
|
|
159610
|
+
if (isStatic(m) !== !!(currentClassElementModifierFlags & 256 /* Static */)) {
|
|
159384
159611
|
continue;
|
|
159385
159612
|
}
|
|
159386
159613
|
const existingName = getPropertyNameForPropertyNameNode(m.name);
|
|
@@ -159389,7 +159616,7 @@ ${newComment.split("\n").map((c) => ` * ${c}`).join("\n")}
|
|
|
159389
159616
|
}
|
|
159390
159617
|
}
|
|
159391
159618
|
return baseSymbols.filter(
|
|
159392
|
-
(propertySymbol) => !existingMemberNames.has(propertySymbol.escapedName) && !!propertySymbol.declarations && !(getDeclarationModifierFlagsFromSymbol(propertySymbol) &
|
|
159619
|
+
(propertySymbol) => !existingMemberNames.has(propertySymbol.escapedName) && !!propertySymbol.declarations && !(getDeclarationModifierFlagsFromSymbol(propertySymbol) & 2 /* Private */) && !(propertySymbol.valueDeclaration && isPrivateIdentifierClassElementDeclaration(propertySymbol.valueDeclaration))
|
|
159393
159620
|
);
|
|
159394
159621
|
}
|
|
159395
159622
|
function filterJsxAttributes(symbols2, attributes) {
|
|
@@ -159501,7 +159728,7 @@ ${newComment.split("\n").map((c) => ` * ${c}`).join("\n")}
|
|
|
159501
159728
|
return { name: JSON.stringify(name), needsConvertPropertyAccess: false };
|
|
159502
159729
|
case 2 /* PropertyAccess */:
|
|
159503
159730
|
case 1 /* Global */:
|
|
159504
|
-
return name.charCodeAt(0) === 32 /* space */ ? void 0 : { name, needsConvertPropertyAccess:
|
|
159731
|
+
return name.charCodeAt(0) === 32 /* space */ ? void 0 : { name, needsConvertPropertyAccess: !originIsComputedPropertyName(origin) };
|
|
159505
159732
|
case 5 /* None */:
|
|
159506
159733
|
case 4 /* String */:
|
|
159507
159734
|
return validNameResult;
|
|
@@ -159638,7 +159865,7 @@ ${newComment.split("\n").map((c) => ` * ${c}`).join("\n")}
|
|
|
159638
159865
|
return checker.getAllPossiblePropertiesOfTypes(filter(type.types, (memberType) => !(memberType.flags & 402784252 /* Primitive */ || checker.isArrayLikeType(memberType) || checker.isTypeInvalidDueToUnionDiscriminant(memberType, node) || checker.typeHasCallOrConstructSignatures(memberType) || memberType.isClass() && containsNonPublicProperties(memberType.getApparentProperties()))));
|
|
159639
159866
|
}
|
|
159640
159867
|
function containsNonPublicProperties(props) {
|
|
159641
|
-
return some(props, (p) => !!(getDeclarationModifierFlagsFromSymbol(p) &
|
|
159868
|
+
return some(props, (p) => !!(getDeclarationModifierFlagsFromSymbol(p) & 6 /* NonPublicAccessibilityModifier */));
|
|
159642
159869
|
}
|
|
159643
159870
|
function getPropertiesForCompletion(type, checker) {
|
|
159644
159871
|
return type.isUnion() ? Debug.checkEachDefined(checker.getAllPossiblePropertiesOfTypes(type.types), "getAllPossiblePropertiesOfTypes() should all be defined") : Debug.checkEachDefined(type.getApparentProperties(), "getApparentProperties() should all be defined");
|
|
@@ -159798,7 +160025,7 @@ ${newComment.split("\n").map((c) => ` * ${c}`).join("\n")}
|
|
|
159798
160025
|
return false;
|
|
159799
160026
|
}
|
|
159800
160027
|
function isStaticProperty(symbol) {
|
|
159801
|
-
return !!(symbol.valueDeclaration && getEffectiveModifierFlags(symbol.valueDeclaration) &
|
|
160028
|
+
return !!(symbol.valueDeclaration && getEffectiveModifierFlags(symbol.valueDeclaration) & 256 /* Static */ && isClassLike(symbol.valueDeclaration.parent));
|
|
159802
160029
|
}
|
|
159803
160030
|
function tryGetObjectLiteralContextualType(node, typeChecker) {
|
|
159804
160031
|
const type = typeChecker.getContextualType(node);
|
|
@@ -160664,7 +160891,7 @@ ${newComment.split("\n").map((c) => ` * ${c}`).join("\n")}
|
|
|
160664
160891
|
}
|
|
160665
160892
|
const keys = getOwnKeys(exports);
|
|
160666
160893
|
const fragmentSubpath = components.join("/") + (components.length && hasTrailingDirectorySeparator(fragment) ? "/" : "");
|
|
160667
|
-
const conditions = getConditions(compilerOptions, mode
|
|
160894
|
+
const conditions = getConditions(compilerOptions, mode);
|
|
160668
160895
|
addCompletionEntriesFromPathsOrExports(
|
|
160669
160896
|
result,
|
|
160670
160897
|
fragmentSubpath,
|
|
@@ -161009,7 +161236,7 @@ ${newComment.split("\n").map((c) => ` * ${c}`).join("\n")}
|
|
|
161009
161236
|
handleNamespaceImport(
|
|
161010
161237
|
direct,
|
|
161011
161238
|
direct.name,
|
|
161012
|
-
hasSyntacticModifier(direct,
|
|
161239
|
+
hasSyntacticModifier(direct, 32 /* Export */),
|
|
161013
161240
|
/*alreadyAddedDirect*/
|
|
161014
161241
|
false
|
|
161015
161242
|
);
|
|
@@ -161324,7 +161551,7 @@ ${newComment.split("\n").map((c) => ` * ${c}`).join("\n")}
|
|
|
161324
161551
|
}
|
|
161325
161552
|
} else {
|
|
161326
161553
|
const exportNode = getExportNode(parent2, node);
|
|
161327
|
-
if (exportNode && hasSyntacticModifier(exportNode,
|
|
161554
|
+
if (exportNode && hasSyntacticModifier(exportNode, 32 /* Export */)) {
|
|
161328
161555
|
if (isImportEqualsDeclaration(exportNode) && exportNode.moduleReference === node) {
|
|
161329
161556
|
if (comingFromExport) {
|
|
161330
161557
|
return void 0;
|
|
@@ -161401,7 +161628,7 @@ ${newComment.split("\n").map((c) => ` * ${c}`).join("\n")}
|
|
|
161401
161628
|
return exportInfo2 && { kind: 1 /* Export */, symbol: symbol2, exportInfo: exportInfo2 };
|
|
161402
161629
|
}
|
|
161403
161630
|
function getExportKindForDeclaration(node2) {
|
|
161404
|
-
return hasSyntacticModifier(node2,
|
|
161631
|
+
return hasSyntacticModifier(node2, 2048 /* Default */) ? 1 /* Default */ : 0 /* Named */;
|
|
161405
161632
|
}
|
|
161406
161633
|
}
|
|
161407
161634
|
function getExportEqualsLocalSymbol(importedSymbol, checker) {
|
|
@@ -161545,7 +161772,7 @@ ${newComment.split("\n").map((c) => ` * ${c}`).join("\n")}
|
|
|
161545
161772
|
if (node.parent.name === node || // node is name of declaration, use parent
|
|
161546
161773
|
isConstructorDeclaration(node.parent) || isExportAssignment(node.parent) || // Property name of the import export specifier or binding pattern, use parent
|
|
161547
161774
|
(isImportOrExportSpecifier(node.parent) || isBindingElement(node.parent)) && node.parent.propertyName === node || // Is default export
|
|
161548
|
-
node.kind === 90 /* DefaultKeyword */ && hasSyntacticModifier(node.parent,
|
|
161775
|
+
node.kind === 90 /* DefaultKeyword */ && hasSyntacticModifier(node.parent, 2080 /* ExportDefault */)) {
|
|
161549
161776
|
return getContextNode(node.parent);
|
|
161550
161777
|
}
|
|
161551
161778
|
return void 0;
|
|
@@ -162528,7 +162755,7 @@ ${newComment.split("\n").map((c) => ` * ${c}`).join("\n")}
|
|
|
162528
162755
|
return void 0;
|
|
162529
162756
|
}
|
|
162530
162757
|
if (flags & (4 /* Property */ | 8192 /* Method */)) {
|
|
162531
|
-
const privateDeclaration = find(declarations, (d) => hasEffectiveModifier(d,
|
|
162758
|
+
const privateDeclaration = find(declarations, (d) => hasEffectiveModifier(d, 2 /* Private */) || isPrivateIdentifierClassElementDeclaration(d));
|
|
162532
162759
|
if (privateDeclaration) {
|
|
162533
162760
|
return getAncestor(privateDeclaration, 263 /* ClassDeclaration */);
|
|
162534
162761
|
}
|
|
@@ -163038,7 +163265,7 @@ ${newComment.split("\n").map((c) => ` * ${c}`).join("\n")}
|
|
|
163038
163265
|
if (!searchSpaceNode) {
|
|
163039
163266
|
return void 0;
|
|
163040
163267
|
}
|
|
163041
|
-
let staticFlag =
|
|
163268
|
+
let staticFlag = 256 /* Static */;
|
|
163042
163269
|
switch (searchSpaceNode.kind) {
|
|
163043
163270
|
case 172 /* PropertyDeclaration */:
|
|
163044
163271
|
case 171 /* PropertySignature */:
|
|
@@ -163078,7 +163305,7 @@ ${newComment.split("\n").map((c) => ` * ${c}`).join("\n")}
|
|
|
163078
163305
|
/*includeClassComputedPropertyName*/
|
|
163079
163306
|
false
|
|
163080
163307
|
);
|
|
163081
|
-
let staticFlag =
|
|
163308
|
+
let staticFlag = 256 /* Static */;
|
|
163082
163309
|
switch (searchSpaceNode.kind) {
|
|
163083
163310
|
case 174 /* MethodDeclaration */:
|
|
163084
163311
|
case 173 /* MethodSignature */:
|
|
@@ -163320,7 +163547,7 @@ ${newComment.split("\n").map((c) => ` * ${c}`).join("\n")}
|
|
|
163320
163547
|
if (!symbol.valueDeclaration)
|
|
163321
163548
|
return false;
|
|
163322
163549
|
const modifierFlags = getEffectiveModifierFlags(symbol.valueDeclaration);
|
|
163323
|
-
return !!(modifierFlags &
|
|
163550
|
+
return !!(modifierFlags & 256 /* Static */);
|
|
163324
163551
|
}
|
|
163325
163552
|
function getRelatedSymbol(search, referenceSymbol, referenceLocation, state) {
|
|
163326
163553
|
const { checker } = state;
|
|
@@ -163876,7 +164103,7 @@ ${newComment.split("\n").map((c) => ` * ${c}`).join("\n")}
|
|
|
163876
164103
|
case 177 /* GetAccessor */:
|
|
163877
164104
|
case 178 /* SetAccessor */:
|
|
163878
164105
|
case 174 /* MethodDeclaration */:
|
|
163879
|
-
if (hasEffectiveModifier(declaration,
|
|
164106
|
+
if (hasEffectiveModifier(declaration, 2 /* Private */))
|
|
163880
164107
|
return false;
|
|
163881
164108
|
case 176 /* Constructor */:
|
|
163882
164109
|
case 303 /* PropertyAssignment */:
|
|
@@ -164654,6 +164881,10 @@ ${newComment.split("\n").map((c) => ` * ${c}`).join("\n")}
|
|
|
164654
164881
|
case 345 /* JSDocCallbackTag */:
|
|
164655
164882
|
case 353 /* JSDocTypedefTag */:
|
|
164656
164883
|
return [declaration, declaration.parent];
|
|
164884
|
+
case 330 /* JSDocSignature */:
|
|
164885
|
+
if (isJSDocOverloadTag(declaration.parent)) {
|
|
164886
|
+
return [declaration.parent.parent];
|
|
164887
|
+
}
|
|
164657
164888
|
default:
|
|
164658
164889
|
return getJSDocCommentsAndTags(declaration);
|
|
164659
164890
|
}
|
|
@@ -167076,7 +167307,7 @@ ${newComment.split("\n").map((c) => ` * ${c}`).join("\n")}
|
|
|
167076
167307
|
function getNormalizedSymbolModifiers(symbol) {
|
|
167077
167308
|
if (symbol.declarations && symbol.declarations.length) {
|
|
167078
167309
|
const [declaration, ...declarations] = symbol.declarations;
|
|
167079
|
-
const excludeFlags = length(declarations) && isDeprecatedDeclaration(declaration) && some(declarations, (d) => !isDeprecatedDeclaration(d)) ?
|
|
167310
|
+
const excludeFlags = length(declarations) && isDeprecatedDeclaration(declaration) && some(declarations, (d) => !isDeprecatedDeclaration(d)) ? 65536 /* Deprecated */ : 0 /* None */;
|
|
167080
167311
|
const modifiers = getNodeModifiers(declaration, excludeFlags);
|
|
167081
167312
|
if (modifiers) {
|
|
167082
167313
|
return modifiers.split(",");
|
|
@@ -167352,7 +167583,7 @@ ${newComment.split("\n").map((c) => ` * ${c}`).join("\n")}
|
|
|
167352
167583
|
const resolvedNode = resolvedSymbol.declarations[0];
|
|
167353
167584
|
const declarationName = getNameOfDeclaration(resolvedNode);
|
|
167354
167585
|
if (declarationName && !hasAddedSymbolInfo) {
|
|
167355
|
-
const isExternalModuleDeclaration = isModuleWithStringLiteralName(resolvedNode) && hasSyntacticModifier(resolvedNode,
|
|
167586
|
+
const isExternalModuleDeclaration = isModuleWithStringLiteralName(resolvedNode) && hasSyntacticModifier(resolvedNode, 128 /* Ambient */);
|
|
167356
167587
|
const shouldUseAliasName = symbol.name !== "default" && !isExternalModuleDeclaration;
|
|
167357
167588
|
const resolvedInfo = getSymbolDisplayPartsDocumentationAndSymbolKindWorker(
|
|
167358
167589
|
typeChecker,
|