typescript 5.3.0-dev.20231025 → 5.3.0-dev.20231027
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 +493 -412
- package/lib/tsserver.js +596 -515
- package/lib/typescript.d.ts +26 -25
- package/lib/typescript.js +596 -515
- package/lib/typingsInstaller.js +111 -86
- package/package.json +2 -2
package/lib/tsc.js
CHANGED
|
@@ -18,7 +18,7 @@ and limitations under the License.
|
|
|
18
18
|
|
|
19
19
|
// src/compiler/corePublic.ts
|
|
20
20
|
var versionMajorMinor = "5.3";
|
|
21
|
-
var version = `${versionMajorMinor}.0-dev.
|
|
21
|
+
var version = `${versionMajorMinor}.0-dev.20231027`;
|
|
22
22
|
|
|
23
23
|
// src/compiler/core.ts
|
|
24
24
|
var emptyArray = [];
|
|
@@ -3460,32 +3460,43 @@ var NodeFlags = /* @__PURE__ */ ((NodeFlags3) => {
|
|
|
3460
3460
|
})(NodeFlags || {});
|
|
3461
3461
|
var ModifierFlags = /* @__PURE__ */ ((ModifierFlags3) => {
|
|
3462
3462
|
ModifierFlags3[ModifierFlags3["None"] = 0] = "None";
|
|
3463
|
-
ModifierFlags3[ModifierFlags3["
|
|
3464
|
-
ModifierFlags3[ModifierFlags3["
|
|
3465
|
-
ModifierFlags3[ModifierFlags3["
|
|
3466
|
-
ModifierFlags3[ModifierFlags3["
|
|
3467
|
-
ModifierFlags3[ModifierFlags3["
|
|
3468
|
-
ModifierFlags3[ModifierFlags3["
|
|
3469
|
-
ModifierFlags3[ModifierFlags3["
|
|
3470
|
-
ModifierFlags3[ModifierFlags3["
|
|
3471
|
-
ModifierFlags3[ModifierFlags3["
|
|
3472
|
-
ModifierFlags3[ModifierFlags3["
|
|
3473
|
-
ModifierFlags3[ModifierFlags3["
|
|
3474
|
-
ModifierFlags3[ModifierFlags3["
|
|
3475
|
-
ModifierFlags3[ModifierFlags3["
|
|
3476
|
-
ModifierFlags3[ModifierFlags3["
|
|
3477
|
-
ModifierFlags3[ModifierFlags3["
|
|
3478
|
-
ModifierFlags3[ModifierFlags3["
|
|
3479
|
-
ModifierFlags3[ModifierFlags3["
|
|
3480
|
-
ModifierFlags3[ModifierFlags3["
|
|
3463
|
+
ModifierFlags3[ModifierFlags3["Public"] = 1] = "Public";
|
|
3464
|
+
ModifierFlags3[ModifierFlags3["Private"] = 2] = "Private";
|
|
3465
|
+
ModifierFlags3[ModifierFlags3["Protected"] = 4] = "Protected";
|
|
3466
|
+
ModifierFlags3[ModifierFlags3["Readonly"] = 8] = "Readonly";
|
|
3467
|
+
ModifierFlags3[ModifierFlags3["Override"] = 16] = "Override";
|
|
3468
|
+
ModifierFlags3[ModifierFlags3["Export"] = 32] = "Export";
|
|
3469
|
+
ModifierFlags3[ModifierFlags3["Abstract"] = 64] = "Abstract";
|
|
3470
|
+
ModifierFlags3[ModifierFlags3["Ambient"] = 128] = "Ambient";
|
|
3471
|
+
ModifierFlags3[ModifierFlags3["Static"] = 256] = "Static";
|
|
3472
|
+
ModifierFlags3[ModifierFlags3["Accessor"] = 512] = "Accessor";
|
|
3473
|
+
ModifierFlags3[ModifierFlags3["Async"] = 1024] = "Async";
|
|
3474
|
+
ModifierFlags3[ModifierFlags3["Default"] = 2048] = "Default";
|
|
3475
|
+
ModifierFlags3[ModifierFlags3["Const"] = 4096] = "Const";
|
|
3476
|
+
ModifierFlags3[ModifierFlags3["In"] = 8192] = "In";
|
|
3477
|
+
ModifierFlags3[ModifierFlags3["Out"] = 16384] = "Out";
|
|
3478
|
+
ModifierFlags3[ModifierFlags3["Decorator"] = 32768] = "Decorator";
|
|
3479
|
+
ModifierFlags3[ModifierFlags3["Deprecated"] = 65536] = "Deprecated";
|
|
3480
|
+
ModifierFlags3[ModifierFlags3["JSDocPublic"] = 8388608] = "JSDocPublic";
|
|
3481
|
+
ModifierFlags3[ModifierFlags3["JSDocPrivate"] = 16777216] = "JSDocPrivate";
|
|
3482
|
+
ModifierFlags3[ModifierFlags3["JSDocProtected"] = 33554432] = "JSDocProtected";
|
|
3483
|
+
ModifierFlags3[ModifierFlags3["JSDocReadonly"] = 67108864] = "JSDocReadonly";
|
|
3484
|
+
ModifierFlags3[ModifierFlags3["JSDocOverride"] = 134217728] = "JSDocOverride";
|
|
3485
|
+
ModifierFlags3[ModifierFlags3["SyntacticOrJSDocModifiers"] = 31] = "SyntacticOrJSDocModifiers";
|
|
3486
|
+
ModifierFlags3[ModifierFlags3["SyntacticOnlyModifiers"] = 65504] = "SyntacticOnlyModifiers";
|
|
3487
|
+
ModifierFlags3[ModifierFlags3["SyntacticModifiers"] = 65535] = "SyntacticModifiers";
|
|
3488
|
+
ModifierFlags3[ModifierFlags3["JSDocCacheOnlyModifiers"] = 260046848] = "JSDocCacheOnlyModifiers";
|
|
3489
|
+
ModifierFlags3[ModifierFlags3["JSDocOnlyModifiers"] = 65536 /* Deprecated */] = "JSDocOnlyModifiers";
|
|
3490
|
+
ModifierFlags3[ModifierFlags3["NonCacheOnlyModifiers"] = 131071] = "NonCacheOnlyModifiers";
|
|
3491
|
+
ModifierFlags3[ModifierFlags3["HasComputedJSDocModifiers"] = 268435456] = "HasComputedJSDocModifiers";
|
|
3481
3492
|
ModifierFlags3[ModifierFlags3["HasComputedFlags"] = 536870912] = "HasComputedFlags";
|
|
3482
|
-
ModifierFlags3[ModifierFlags3["AccessibilityModifier"] =
|
|
3483
|
-
ModifierFlags3[ModifierFlags3["ParameterPropertyModifier"] =
|
|
3484
|
-
ModifierFlags3[ModifierFlags3["NonPublicAccessibilityModifier"] =
|
|
3485
|
-
ModifierFlags3[ModifierFlags3["TypeScriptModifier"] =
|
|
3486
|
-
ModifierFlags3[ModifierFlags3["ExportDefault"] =
|
|
3487
|
-
ModifierFlags3[ModifierFlags3["All"] =
|
|
3488
|
-
ModifierFlags3[ModifierFlags3["Modifier"] =
|
|
3493
|
+
ModifierFlags3[ModifierFlags3["AccessibilityModifier"] = 7] = "AccessibilityModifier";
|
|
3494
|
+
ModifierFlags3[ModifierFlags3["ParameterPropertyModifier"] = 31] = "ParameterPropertyModifier";
|
|
3495
|
+
ModifierFlags3[ModifierFlags3["NonPublicAccessibilityModifier"] = 6] = "NonPublicAccessibilityModifier";
|
|
3496
|
+
ModifierFlags3[ModifierFlags3["TypeScriptModifier"] = 28895] = "TypeScriptModifier";
|
|
3497
|
+
ModifierFlags3[ModifierFlags3["ExportDefault"] = 2080] = "ExportDefault";
|
|
3498
|
+
ModifierFlags3[ModifierFlags3["All"] = 131071] = "All";
|
|
3499
|
+
ModifierFlags3[ModifierFlags3["Modifier"] = 98303] = "Modifier";
|
|
3489
3500
|
return ModifierFlags3;
|
|
3490
3501
|
})(ModifierFlags || {});
|
|
3491
3502
|
var RelationComparisonResult = /* @__PURE__ */ ((RelationComparisonResult3) => {
|
|
@@ -6633,7 +6644,7 @@ var Diagnostics = {
|
|
|
6633
6644
|
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."),
|
|
6634
6645
|
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."),
|
|
6635
6646
|
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."),
|
|
6636
|
-
|
|
6647
|
+
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."),
|
|
6637
6648
|
_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?"),
|
|
6638
6649
|
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."),
|
|
6639
6650
|
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."),
|
|
@@ -6654,6 +6665,8 @@ var Diagnostics = {
|
|
|
6654
6665
|
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."),
|
|
6655
6666
|
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."),
|
|
6656
6667
|
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."),
|
|
6668
|
+
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."),
|
|
6669
|
+
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."),
|
|
6657
6670
|
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}'."),
|
|
6658
6671
|
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}'."),
|
|
6659
6672
|
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}'."),
|
|
@@ -10070,7 +10083,7 @@ function createTextChangeRange(span, newLength) {
|
|
|
10070
10083
|
}
|
|
10071
10084
|
var unchangedTextChangeRange = createTextChangeRange(createTextSpan(0, 0), 0);
|
|
10072
10085
|
function isParameterPropertyDeclaration(node, parent) {
|
|
10073
|
-
return isParameter(node) && hasSyntacticModifier(node,
|
|
10086
|
+
return isParameter(node) && hasSyntacticModifier(node, 31 /* ParameterPropertyModifier */) && parent.kind === 176 /* Constructor */;
|
|
10074
10087
|
}
|
|
10075
10088
|
function walkUpBindingElementsAndPatterns(binding) {
|
|
10076
10089
|
let node = binding.parent;
|
|
@@ -10345,7 +10358,7 @@ function getDecorators(node) {
|
|
|
10345
10358
|
}
|
|
10346
10359
|
}
|
|
10347
10360
|
function getModifiers(node) {
|
|
10348
|
-
if (hasSyntacticModifier(node,
|
|
10361
|
+
if (hasSyntacticModifier(node, 98303 /* Modifier */)) {
|
|
10349
10362
|
return filter(node.modifiers, isModifier);
|
|
10350
10363
|
}
|
|
10351
10364
|
}
|
|
@@ -10739,7 +10752,7 @@ function isModifierKind(token) {
|
|
|
10739
10752
|
return false;
|
|
10740
10753
|
}
|
|
10741
10754
|
function isParameterPropertyModifier(kind) {
|
|
10742
|
-
return !!(modifierToFlag(kind) &
|
|
10755
|
+
return !!(modifierToFlag(kind) & 31 /* ParameterPropertyModifier */);
|
|
10743
10756
|
}
|
|
10744
10757
|
function isClassMemberModifier(idToken) {
|
|
10745
10758
|
return isParameterPropertyModifier(idToken) || idToken === 126 /* StaticKeyword */ || idToken === 164 /* OverrideKeyword */ || idToken === 129 /* AccessorKeyword */;
|
|
@@ -11083,10 +11096,10 @@ function hasScopeMarker(statements) {
|
|
|
11083
11096
|
return some(statements, isScopeMarker);
|
|
11084
11097
|
}
|
|
11085
11098
|
function needsScopeMarker(result) {
|
|
11086
|
-
return !isAnyImportOrReExport(result) && !isExportAssignment(result) && !hasSyntacticModifier(result,
|
|
11099
|
+
return !isAnyImportOrReExport(result) && !isExportAssignment(result) && !hasSyntacticModifier(result, 32 /* Export */) && !isAmbientModule(result);
|
|
11087
11100
|
}
|
|
11088
11101
|
function isExternalModuleIndicator(result) {
|
|
11089
|
-
return isAnyImportOrReExport(result) || isExportAssignment(result) || hasSyntacticModifier(result,
|
|
11102
|
+
return isAnyImportOrReExport(result) || isExportAssignment(result) || hasSyntacticModifier(result, 32 /* Export */);
|
|
11090
11103
|
}
|
|
11091
11104
|
function isForInOrOfStatement(node) {
|
|
11092
11105
|
return node.kind === 249 /* ForInStatement */ || node.kind === 250 /* ForOfStatement */;
|
|
@@ -12273,7 +12286,7 @@ function isEffectiveStrictModeSourceFile(node, compilerOptions) {
|
|
|
12273
12286
|
return false;
|
|
12274
12287
|
}
|
|
12275
12288
|
function isAmbientPropertyDeclaration(node) {
|
|
12276
|
-
return !!(node.flags & 33554432 /* Ambient */) || hasSyntacticModifier(node,
|
|
12289
|
+
return !!(node.flags & 33554432 /* Ambient */) || hasSyntacticModifier(node, 128 /* Ambient */);
|
|
12277
12290
|
}
|
|
12278
12291
|
function isBlockScope(node, parentNode) {
|
|
12279
12292
|
switch (node.kind) {
|
|
@@ -12583,10 +12596,10 @@ function isJsonSourceFile(file) {
|
|
|
12583
12596
|
return file.scriptKind === 6 /* JSON */;
|
|
12584
12597
|
}
|
|
12585
12598
|
function isEnumConst(node) {
|
|
12586
|
-
return !!(getCombinedModifierFlags(node) &
|
|
12599
|
+
return !!(getCombinedModifierFlags(node) & 4096 /* Const */);
|
|
12587
12600
|
}
|
|
12588
12601
|
function isDeclarationReadonly(declaration) {
|
|
12589
|
-
return !!(getCombinedModifierFlags(declaration) &
|
|
12602
|
+
return !!(getCombinedModifierFlags(declaration) & 8 /* Readonly */ && !isParameterPropertyDeclaration(declaration, declaration.parent));
|
|
12590
12603
|
}
|
|
12591
12604
|
function isVarAwaitUsing(node) {
|
|
12592
12605
|
return (getCombinedNodeFlags(node) & 7 /* BlockScoped */) === 6 /* AwaitUsing */;
|
|
@@ -14231,7 +14244,7 @@ function getFunctionFlags(node) {
|
|
|
14231
14244
|
flags |= 1 /* Generator */;
|
|
14232
14245
|
}
|
|
14233
14246
|
case 219 /* ArrowFunction */:
|
|
14234
|
-
if (hasSyntacticModifier(node,
|
|
14247
|
+
if (hasSyntacticModifier(node, 1024 /* Async */)) {
|
|
14235
14248
|
flags |= 2 /* Async */;
|
|
14236
14249
|
}
|
|
14237
14250
|
break;
|
|
@@ -14247,7 +14260,7 @@ function isAsyncFunction(node) {
|
|
|
14247
14260
|
case 218 /* FunctionExpression */:
|
|
14248
14261
|
case 219 /* ArrowFunction */:
|
|
14249
14262
|
case 174 /* MethodDeclaration */:
|
|
14250
|
-
return node.body !== void 0 && node.asteriskToken === void 0 && hasSyntacticModifier(node,
|
|
14263
|
+
return node.body !== void 0 && node.asteriskToken === void 0 && hasSyntacticModifier(node, 1024 /* Async */);
|
|
14251
14264
|
}
|
|
14252
14265
|
return false;
|
|
14253
14266
|
}
|
|
@@ -15359,25 +15372,25 @@ function isStatic(node) {
|
|
|
15359
15372
|
return isClassElement(node) && hasStaticModifier(node) || isClassStaticBlockDeclaration(node);
|
|
15360
15373
|
}
|
|
15361
15374
|
function hasStaticModifier(node) {
|
|
15362
|
-
return hasSyntacticModifier(node,
|
|
15375
|
+
return hasSyntacticModifier(node, 256 /* Static */);
|
|
15363
15376
|
}
|
|
15364
15377
|
function hasOverrideModifier(node) {
|
|
15365
|
-
return hasEffectiveModifier(node,
|
|
15378
|
+
return hasEffectiveModifier(node, 16 /* Override */);
|
|
15366
15379
|
}
|
|
15367
15380
|
function hasAbstractModifier(node) {
|
|
15368
|
-
return hasSyntacticModifier(node,
|
|
15381
|
+
return hasSyntacticModifier(node, 64 /* Abstract */);
|
|
15369
15382
|
}
|
|
15370
15383
|
function hasAmbientModifier(node) {
|
|
15371
|
-
return hasSyntacticModifier(node,
|
|
15384
|
+
return hasSyntacticModifier(node, 128 /* Ambient */);
|
|
15372
15385
|
}
|
|
15373
15386
|
function hasAccessorModifier(node) {
|
|
15374
|
-
return hasSyntacticModifier(node,
|
|
15387
|
+
return hasSyntacticModifier(node, 512 /* Accessor */);
|
|
15375
15388
|
}
|
|
15376
15389
|
function hasEffectiveReadonlyModifier(node) {
|
|
15377
|
-
return hasEffectiveModifier(node,
|
|
15390
|
+
return hasEffectiveModifier(node, 8 /* Readonly */);
|
|
15378
15391
|
}
|
|
15379
15392
|
function hasDecorators(node) {
|
|
15380
|
-
return hasSyntacticModifier(node,
|
|
15393
|
+
return hasSyntacticModifier(node, 32768 /* Decorator */);
|
|
15381
15394
|
}
|
|
15382
15395
|
function getSelectedEffectiveModifierFlags(node, flags) {
|
|
15383
15396
|
return getEffectiveModifierFlags(node) & flags;
|
|
@@ -15392,10 +15405,13 @@ function getModifierFlagsWorker(node, includeJSDoc, alwaysIncludeJSDoc) {
|
|
|
15392
15405
|
if (!(node.modifierFlagsCache & 536870912 /* HasComputedFlags */)) {
|
|
15393
15406
|
node.modifierFlagsCache = getSyntacticModifierFlagsNoCache(node) | 536870912 /* HasComputedFlags */;
|
|
15394
15407
|
}
|
|
15395
|
-
if (
|
|
15396
|
-
node.modifierFlagsCache
|
|
15408
|
+
if (alwaysIncludeJSDoc || includeJSDoc && isInJSFile(node)) {
|
|
15409
|
+
if (!(node.modifierFlagsCache & 268435456 /* HasComputedJSDocModifiers */) && node.parent) {
|
|
15410
|
+
node.modifierFlagsCache |= getRawJSDocModifierFlagsNoCache(node) | 268435456 /* HasComputedJSDocModifiers */;
|
|
15411
|
+
}
|
|
15412
|
+
return selectEffectiveModifierFlags(node.modifierFlagsCache);
|
|
15397
15413
|
}
|
|
15398
|
-
return node.modifierFlagsCache
|
|
15414
|
+
return selectSyntacticModifierFlags(node.modifierFlagsCache);
|
|
15399
15415
|
}
|
|
15400
15416
|
function getEffectiveModifierFlags(node) {
|
|
15401
15417
|
return getModifierFlagsWorker(
|
|
@@ -15411,33 +15427,42 @@ function getSyntacticModifierFlags(node) {
|
|
|
15411
15427
|
false
|
|
15412
15428
|
);
|
|
15413
15429
|
}
|
|
15414
|
-
function
|
|
15430
|
+
function getRawJSDocModifierFlagsNoCache(node) {
|
|
15415
15431
|
let flags = 0 /* None */;
|
|
15416
15432
|
if (!!node.parent && !isParameter(node)) {
|
|
15417
15433
|
if (isInJSFile(node)) {
|
|
15418
15434
|
if (getJSDocPublicTagNoCache(node))
|
|
15419
|
-
flags |=
|
|
15435
|
+
flags |= 8388608 /* JSDocPublic */;
|
|
15420
15436
|
if (getJSDocPrivateTagNoCache(node))
|
|
15421
|
-
flags |=
|
|
15437
|
+
flags |= 16777216 /* JSDocPrivate */;
|
|
15422
15438
|
if (getJSDocProtectedTagNoCache(node))
|
|
15423
|
-
flags |=
|
|
15439
|
+
flags |= 33554432 /* JSDocProtected */;
|
|
15424
15440
|
if (getJSDocReadonlyTagNoCache(node))
|
|
15425
|
-
flags |=
|
|
15441
|
+
flags |= 67108864 /* JSDocReadonly */;
|
|
15426
15442
|
if (getJSDocOverrideTagNoCache(node))
|
|
15427
|
-
flags |=
|
|
15443
|
+
flags |= 134217728 /* JSDocOverride */;
|
|
15428
15444
|
}
|
|
15429
15445
|
if (getJSDocDeprecatedTagNoCache(node))
|
|
15430
|
-
flags |=
|
|
15446
|
+
flags |= 65536 /* Deprecated */;
|
|
15431
15447
|
}
|
|
15432
15448
|
return flags;
|
|
15433
15449
|
}
|
|
15450
|
+
function selectSyntacticModifierFlags(flags) {
|
|
15451
|
+
return flags & 65535 /* SyntacticModifiers */;
|
|
15452
|
+
}
|
|
15453
|
+
function selectEffectiveModifierFlags(flags) {
|
|
15454
|
+
return flags & 131071 /* NonCacheOnlyModifiers */ | (flags & 260046848 /* JSDocCacheOnlyModifiers */) >>> 23;
|
|
15455
|
+
}
|
|
15456
|
+
function getJSDocModifierFlagsNoCache(node) {
|
|
15457
|
+
return selectEffectiveModifierFlags(getRawJSDocModifierFlagsNoCache(node));
|
|
15458
|
+
}
|
|
15434
15459
|
function getEffectiveModifierFlagsNoCache(node) {
|
|
15435
15460
|
return getSyntacticModifierFlagsNoCache(node) | getJSDocModifierFlagsNoCache(node);
|
|
15436
15461
|
}
|
|
15437
15462
|
function getSyntacticModifierFlagsNoCache(node) {
|
|
15438
15463
|
let flags = canHaveModifiers(node) ? modifiersToFlags(node.modifiers) : 0 /* None */;
|
|
15439
15464
|
if (node.flags & 8 /* NestedNamespace */ || node.kind === 80 /* Identifier */ && node.flags & 4096 /* IdentifierIsInJSDocNamespace */) {
|
|
15440
|
-
flags |=
|
|
15465
|
+
flags |= 32 /* Export */;
|
|
15441
15466
|
}
|
|
15442
15467
|
return flags;
|
|
15443
15468
|
}
|
|
@@ -15453,37 +15478,37 @@ function modifiersToFlags(modifiers) {
|
|
|
15453
15478
|
function modifierToFlag(token) {
|
|
15454
15479
|
switch (token) {
|
|
15455
15480
|
case 126 /* StaticKeyword */:
|
|
15456
|
-
return
|
|
15481
|
+
return 256 /* Static */;
|
|
15457
15482
|
case 125 /* PublicKeyword */:
|
|
15458
|
-
return
|
|
15483
|
+
return 1 /* Public */;
|
|
15459
15484
|
case 124 /* ProtectedKeyword */:
|
|
15460
|
-
return
|
|
15485
|
+
return 4 /* Protected */;
|
|
15461
15486
|
case 123 /* PrivateKeyword */:
|
|
15462
|
-
return
|
|
15487
|
+
return 2 /* Private */;
|
|
15463
15488
|
case 128 /* AbstractKeyword */:
|
|
15464
|
-
return
|
|
15489
|
+
return 64 /* Abstract */;
|
|
15465
15490
|
case 129 /* AccessorKeyword */:
|
|
15466
|
-
return
|
|
15491
|
+
return 512 /* Accessor */;
|
|
15467
15492
|
case 95 /* ExportKeyword */:
|
|
15468
|
-
return
|
|
15493
|
+
return 32 /* Export */;
|
|
15469
15494
|
case 138 /* DeclareKeyword */:
|
|
15470
|
-
return
|
|
15495
|
+
return 128 /* Ambient */;
|
|
15471
15496
|
case 87 /* ConstKeyword */:
|
|
15472
|
-
return
|
|
15497
|
+
return 4096 /* Const */;
|
|
15473
15498
|
case 90 /* DefaultKeyword */:
|
|
15474
|
-
return
|
|
15499
|
+
return 2048 /* Default */;
|
|
15475
15500
|
case 134 /* AsyncKeyword */:
|
|
15476
|
-
return
|
|
15501
|
+
return 1024 /* Async */;
|
|
15477
15502
|
case 148 /* ReadonlyKeyword */:
|
|
15478
|
-
return
|
|
15503
|
+
return 8 /* Readonly */;
|
|
15479
15504
|
case 164 /* OverrideKeyword */:
|
|
15480
|
-
return
|
|
15505
|
+
return 16 /* Override */;
|
|
15481
15506
|
case 103 /* InKeyword */:
|
|
15482
|
-
return
|
|
15507
|
+
return 8192 /* In */;
|
|
15483
15508
|
case 147 /* OutKeyword */:
|
|
15484
|
-
return
|
|
15509
|
+
return 16384 /* Out */;
|
|
15485
15510
|
case 170 /* Decorator */:
|
|
15486
|
-
return
|
|
15511
|
+
return 32768 /* Decorator */;
|
|
15487
15512
|
}
|
|
15488
15513
|
return 0 /* None */;
|
|
15489
15514
|
}
|
|
@@ -15620,7 +15645,7 @@ function getLocalSymbolForExportDefault(symbol) {
|
|
|
15620
15645
|
return void 0;
|
|
15621
15646
|
}
|
|
15622
15647
|
function isExportDefaultSymbol(symbol) {
|
|
15623
|
-
return symbol && length(symbol.declarations) > 0 && hasSyntacticModifier(symbol.declarations[0],
|
|
15648
|
+
return symbol && length(symbol.declarations) > 0 && hasSyntacticModifier(symbol.declarations[0], 2048 /* Default */);
|
|
15624
15649
|
}
|
|
15625
15650
|
function tryExtractTSExtension(fileName) {
|
|
15626
15651
|
return find(supportedTSExtensionsForExtractExtension, (extension) => fileExtensionIs(fileName, extension));
|
|
@@ -15839,16 +15864,16 @@ function getDeclarationModifierFlagsFromSymbol(s, isWrite = false) {
|
|
|
15839
15864
|
if (s.valueDeclaration) {
|
|
15840
15865
|
const declaration = isWrite && s.declarations && find(s.declarations, isSetAccessorDeclaration) || s.flags & 32768 /* GetAccessor */ && find(s.declarations, isGetAccessorDeclaration) || s.valueDeclaration;
|
|
15841
15866
|
const flags = getCombinedModifierFlags(declaration);
|
|
15842
|
-
return s.parent && s.parent.flags & 32 /* Class */ ? flags : flags & ~
|
|
15867
|
+
return s.parent && s.parent.flags & 32 /* Class */ ? flags : flags & ~7 /* AccessibilityModifier */;
|
|
15843
15868
|
}
|
|
15844
15869
|
if (getCheckFlags(s) & 6 /* Synthetic */) {
|
|
15845
15870
|
const checkFlags = s.links.checkFlags;
|
|
15846
|
-
const accessModifier = checkFlags & 1024 /* ContainsPrivate */ ?
|
|
15847
|
-
const staticModifier = checkFlags & 2048 /* ContainsStatic */ ?
|
|
15871
|
+
const accessModifier = checkFlags & 1024 /* ContainsPrivate */ ? 2 /* Private */ : checkFlags & 256 /* ContainsPublic */ ? 1 /* Public */ : 4 /* Protected */;
|
|
15872
|
+
const staticModifier = checkFlags & 2048 /* ContainsStatic */ ? 256 /* Static */ : 0;
|
|
15848
15873
|
return accessModifier | staticModifier;
|
|
15849
15874
|
}
|
|
15850
15875
|
if (s.flags & 4194304 /* Prototype */) {
|
|
15851
|
-
return
|
|
15876
|
+
return 1 /* Public */ | 256 /* Static */;
|
|
15852
15877
|
}
|
|
15853
15878
|
return 0;
|
|
15854
15879
|
}
|
|
@@ -17110,7 +17135,7 @@ function isPartOfPossiblyValidTypeOrAbstractComputedPropertyName(node) {
|
|
|
17110
17135
|
if (node.kind !== 167 /* ComputedPropertyName */) {
|
|
17111
17136
|
return false;
|
|
17112
17137
|
}
|
|
17113
|
-
if (hasSyntacticModifier(node.parent,
|
|
17138
|
+
if (hasSyntacticModifier(node.parent, 64 /* Abstract */)) {
|
|
17114
17139
|
return true;
|
|
17115
17140
|
}
|
|
17116
17141
|
const containerKind = node.parent.parent.kind;
|
|
@@ -19084,35 +19109,35 @@ function createNodeFactory(flags, baseFactory2) {
|
|
|
19084
19109
|
}
|
|
19085
19110
|
function createModifiersFromModifierFlags(flags2) {
|
|
19086
19111
|
const result = [];
|
|
19087
|
-
if (flags2 &
|
|
19112
|
+
if (flags2 & 32 /* Export */)
|
|
19088
19113
|
result.push(createModifier(95 /* ExportKeyword */));
|
|
19089
|
-
if (flags2 &
|
|
19114
|
+
if (flags2 & 128 /* Ambient */)
|
|
19090
19115
|
result.push(createModifier(138 /* DeclareKeyword */));
|
|
19091
|
-
if (flags2 &
|
|
19116
|
+
if (flags2 & 2048 /* Default */)
|
|
19092
19117
|
result.push(createModifier(90 /* DefaultKeyword */));
|
|
19093
|
-
if (flags2 &
|
|
19118
|
+
if (flags2 & 4096 /* Const */)
|
|
19094
19119
|
result.push(createModifier(87 /* ConstKeyword */));
|
|
19095
|
-
if (flags2 &
|
|
19120
|
+
if (flags2 & 1 /* Public */)
|
|
19096
19121
|
result.push(createModifier(125 /* PublicKeyword */));
|
|
19097
|
-
if (flags2 &
|
|
19122
|
+
if (flags2 & 2 /* Private */)
|
|
19098
19123
|
result.push(createModifier(123 /* PrivateKeyword */));
|
|
19099
|
-
if (flags2 &
|
|
19124
|
+
if (flags2 & 4 /* Protected */)
|
|
19100
19125
|
result.push(createModifier(124 /* ProtectedKeyword */));
|
|
19101
|
-
if (flags2 &
|
|
19126
|
+
if (flags2 & 64 /* Abstract */)
|
|
19102
19127
|
result.push(createModifier(128 /* AbstractKeyword */));
|
|
19103
|
-
if (flags2 &
|
|
19128
|
+
if (flags2 & 256 /* Static */)
|
|
19104
19129
|
result.push(createModifier(126 /* StaticKeyword */));
|
|
19105
|
-
if (flags2 &
|
|
19130
|
+
if (flags2 & 16 /* Override */)
|
|
19106
19131
|
result.push(createModifier(164 /* OverrideKeyword */));
|
|
19107
|
-
if (flags2 &
|
|
19132
|
+
if (flags2 & 8 /* Readonly */)
|
|
19108
19133
|
result.push(createModifier(148 /* ReadonlyKeyword */));
|
|
19109
|
-
if (flags2 &
|
|
19134
|
+
if (flags2 & 512 /* Accessor */)
|
|
19110
19135
|
result.push(createModifier(129 /* AccessorKeyword */));
|
|
19111
|
-
if (flags2 &
|
|
19136
|
+
if (flags2 & 1024 /* Async */)
|
|
19112
19137
|
result.push(createModifier(134 /* AsyncKeyword */));
|
|
19113
|
-
if (flags2 &
|
|
19138
|
+
if (flags2 & 8192 /* In */)
|
|
19114
19139
|
result.push(createModifier(103 /* InKeyword */));
|
|
19115
|
-
if (flags2 &
|
|
19140
|
+
if (flags2 & 16384 /* Out */)
|
|
19116
19141
|
result.push(createModifier(147 /* OutKeyword */));
|
|
19117
19142
|
return result.length ? result : void 0;
|
|
19118
19143
|
}
|
|
@@ -19161,7 +19186,7 @@ function createNodeFactory(flags, baseFactory2) {
|
|
|
19161
19186
|
if (isThisIdentifier(node.name)) {
|
|
19162
19187
|
node.transformFlags = 1 /* ContainsTypeScript */;
|
|
19163
19188
|
} else {
|
|
19164
|
-
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) &
|
|
19189
|
+
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 */);
|
|
19165
19190
|
}
|
|
19166
19191
|
node.jsDoc = void 0;
|
|
19167
19192
|
return node;
|
|
@@ -19210,8 +19235,8 @@ function createNodeFactory(flags, baseFactory2) {
|
|
|
19210
19235
|
node.exclamationToken = questionOrExclamationToken && isExclamationToken(questionOrExclamationToken) ? questionOrExclamationToken : void 0;
|
|
19211
19236
|
node.type = type;
|
|
19212
19237
|
node.initializer = asInitializer(initializer);
|
|
19213
|
-
const isAmbient = node.flags & 33554432 /* Ambient */ || modifiersToFlags(node.modifiers) &
|
|
19214
|
-
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) &
|
|
19238
|
+
const isAmbient = node.flags & 33554432 /* Ambient */ || modifiersToFlags(node.modifiers) & 128 /* Ambient */;
|
|
19239
|
+
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 */;
|
|
19215
19240
|
node.jsDoc = void 0;
|
|
19216
19241
|
return node;
|
|
19217
19242
|
}
|
|
@@ -19250,7 +19275,7 @@ function createNodeFactory(flags, baseFactory2) {
|
|
|
19250
19275
|
if (!node.body) {
|
|
19251
19276
|
node.transformFlags = 1 /* ContainsTypeScript */;
|
|
19252
19277
|
} else {
|
|
19253
|
-
const isAsync = modifiersToFlags(node.modifiers) &
|
|
19278
|
+
const isAsync = modifiersToFlags(node.modifiers) & 1024 /* Async */;
|
|
19254
19279
|
const isGenerator = !!node.asteriskToken;
|
|
19255
19280
|
const isAsyncGenerator = isAsync && isGenerator;
|
|
19256
19281
|
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 */;
|
|
@@ -19993,7 +20018,7 @@ function createNodeFactory(flags, baseFactory2) {
|
|
|
19993
20018
|
node.parameters = createNodeArray(parameters);
|
|
19994
20019
|
node.type = type;
|
|
19995
20020
|
node.body = body;
|
|
19996
|
-
const isAsync = modifiersToFlags(node.modifiers) &
|
|
20021
|
+
const isAsync = modifiersToFlags(node.modifiers) & 1024 /* Async */;
|
|
19997
20022
|
const isGenerator = !!node.asteriskToken;
|
|
19998
20023
|
const isAsyncGenerator = isAsync && isGenerator;
|
|
19999
20024
|
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 */;
|
|
@@ -20017,7 +20042,7 @@ function createNodeFactory(flags, baseFactory2) {
|
|
|
20017
20042
|
node.type = type;
|
|
20018
20043
|
node.equalsGreaterThanToken = equalsGreaterThanToken ?? createToken(39 /* EqualsGreaterThanToken */);
|
|
20019
20044
|
node.body = parenthesizerRules().parenthesizeConciseBodyOfArrowFunction(body);
|
|
20020
|
-
const isAsync = modifiersToFlags(node.modifiers) &
|
|
20045
|
+
const isAsync = modifiersToFlags(node.modifiers) & 1024 /* Async */;
|
|
20021
20046
|
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 */;
|
|
20022
20047
|
node.typeArguments = void 0;
|
|
20023
20048
|
node.jsDoc = void 0;
|
|
@@ -20369,7 +20394,7 @@ function createNodeFactory(flags, baseFactory2) {
|
|
|
20369
20394
|
node.modifiers = asNodeArray(modifiers);
|
|
20370
20395
|
node.declarationList = isArray(declarationList) ? createVariableDeclarationList(declarationList) : declarationList;
|
|
20371
20396
|
node.transformFlags |= propagateChildrenFlags(node.modifiers) | propagateChildFlags(node.declarationList);
|
|
20372
|
-
if (modifiersToFlags(node.modifiers) &
|
|
20397
|
+
if (modifiersToFlags(node.modifiers) & 128 /* Ambient */) {
|
|
20373
20398
|
node.transformFlags = 1 /* ContainsTypeScript */;
|
|
20374
20399
|
}
|
|
20375
20400
|
node.jsDoc = void 0;
|
|
@@ -20619,10 +20644,10 @@ function createNodeFactory(flags, baseFactory2) {
|
|
|
20619
20644
|
node.parameters = createNodeArray(parameters);
|
|
20620
20645
|
node.type = type;
|
|
20621
20646
|
node.body = body;
|
|
20622
|
-
if (!node.body || modifiersToFlags(node.modifiers) &
|
|
20647
|
+
if (!node.body || modifiersToFlags(node.modifiers) & 128 /* Ambient */) {
|
|
20623
20648
|
node.transformFlags = 1 /* ContainsTypeScript */;
|
|
20624
20649
|
} else {
|
|
20625
|
-
const isAsync = modifiersToFlags(node.modifiers) &
|
|
20650
|
+
const isAsync = modifiersToFlags(node.modifiers) & 1024 /* Async */;
|
|
20626
20651
|
const isGenerator = !!node.asteriskToken;
|
|
20627
20652
|
const isAsyncGenerator = isAsync && isGenerator;
|
|
20628
20653
|
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 */;
|
|
@@ -20653,7 +20678,7 @@ function createNodeFactory(flags, baseFactory2) {
|
|
|
20653
20678
|
node.typeParameters = asNodeArray(typeParameters);
|
|
20654
20679
|
node.heritageClauses = asNodeArray(heritageClauses);
|
|
20655
20680
|
node.members = createNodeArray(members);
|
|
20656
|
-
if (modifiersToFlags(node.modifiers) &
|
|
20681
|
+
if (modifiersToFlags(node.modifiers) & 128 /* Ambient */) {
|
|
20657
20682
|
node.transformFlags = 1 /* ContainsTypeScript */;
|
|
20658
20683
|
} else {
|
|
20659
20684
|
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 */;
|
|
@@ -20715,7 +20740,7 @@ function createNodeFactory(flags, baseFactory2) {
|
|
|
20715
20740
|
node.flags |= flags2 & (32 /* Namespace */ | 8 /* NestedNamespace */ | 2048 /* GlobalAugmentation */);
|
|
20716
20741
|
node.name = name;
|
|
20717
20742
|
node.body = body;
|
|
20718
|
-
if (modifiersToFlags(node.modifiers) &
|
|
20743
|
+
if (modifiersToFlags(node.modifiers) & 128 /* Ambient */) {
|
|
20719
20744
|
node.transformFlags = 1 /* ContainsTypeScript */;
|
|
20720
20745
|
} else {
|
|
20721
20746
|
node.transformFlags |= propagateChildrenFlags(node.modifiers) | propagateChildFlags(node.name) | propagateChildFlags(node.body) | 1 /* ContainsTypeScript */;
|
|
@@ -22146,7 +22171,7 @@ function createNodeFactory(flags, baseFactory2) {
|
|
|
22146
22171
|
return qualifiedName;
|
|
22147
22172
|
}
|
|
22148
22173
|
function getExternalModuleOrNamespaceExportName(ns, node, allowComments, allowSourceMaps) {
|
|
22149
|
-
if (ns && hasSyntacticModifier(node,
|
|
22174
|
+
if (ns && hasSyntacticModifier(node, 32 /* Export */)) {
|
|
22150
22175
|
return getNamespaceMemberName(ns, getName(node), allowComments, allowSourceMaps);
|
|
22151
22176
|
}
|
|
22152
22177
|
return getExportName(node, allowComments, allowSourceMaps);
|
|
@@ -31347,11 +31372,11 @@ var Parser;
|
|
|
31347
31372
|
const modifierFlags = modifiersToFlags(modifiers);
|
|
31348
31373
|
parseExpected(100 /* FunctionKeyword */);
|
|
31349
31374
|
const asteriskToken = parseOptionalToken(42 /* AsteriskToken */);
|
|
31350
|
-
const name = modifierFlags &
|
|
31375
|
+
const name = modifierFlags & 2048 /* Default */ ? parseOptionalBindingIdentifier() : parseBindingIdentifier();
|
|
31351
31376
|
const isGenerator = asteriskToken ? 1 /* Yield */ : 0 /* None */;
|
|
31352
|
-
const isAsync = modifierFlags &
|
|
31377
|
+
const isAsync = modifierFlags & 1024 /* Async */ ? 2 /* Await */ : 0 /* None */;
|
|
31353
31378
|
const typeParameters = parseTypeParameters();
|
|
31354
|
-
if (modifierFlags &
|
|
31379
|
+
if (modifierFlags & 32 /* Export */)
|
|
31355
31380
|
setAwaitContext(
|
|
31356
31381
|
/*value*/
|
|
31357
31382
|
true
|
|
@@ -39376,7 +39401,7 @@ function getModuleInstanceStateWorker(node, visited) {
|
|
|
39376
39401
|
break;
|
|
39377
39402
|
case 272 /* ImportDeclaration */:
|
|
39378
39403
|
case 271 /* ImportEqualsDeclaration */:
|
|
39379
|
-
if (!hasSyntacticModifier(node,
|
|
39404
|
+
if (!hasSyntacticModifier(node, 32 /* Export */)) {
|
|
39380
39405
|
return 0 /* NonInstantiated */;
|
|
39381
39406
|
}
|
|
39382
39407
|
break;
|
|
@@ -39654,7 +39679,7 @@ function createBinder() {
|
|
|
39654
39679
|
}
|
|
39655
39680
|
function declareSymbol(symbolTable, parent2, node, includes, excludes, isReplaceableByMethod, isComputedName) {
|
|
39656
39681
|
Debug.assert(isComputedName || !hasDynamicName(node));
|
|
39657
|
-
const isDefaultExport = hasSyntacticModifier(node,
|
|
39682
|
+
const isDefaultExport = hasSyntacticModifier(node, 2048 /* Default */) || isExportSpecifier(node) && node.name.escapedText === "default";
|
|
39658
39683
|
const name = isComputedName ? "__computed" /* Computed */ : isDefaultExport && parent2 ? "default" /* Default */ : getDeclarationName(node);
|
|
39659
39684
|
let symbol;
|
|
39660
39685
|
if (name === void 0) {
|
|
@@ -39698,7 +39723,7 @@ function createBinder() {
|
|
|
39698
39723
|
}
|
|
39699
39724
|
}
|
|
39700
39725
|
const relatedInformation = [];
|
|
39701
|
-
if (isTypeAliasDeclaration(node) && nodeIsMissing(node.type) && hasSyntacticModifier(node,
|
|
39726
|
+
if (isTypeAliasDeclaration(node) && nodeIsMissing(node.type) && hasSyntacticModifier(node, 32 /* Export */) && symbol.flags & (2097152 /* Alias */ | 788968 /* Type */ | 1920 /* Namespace */)) {
|
|
39702
39727
|
relatedInformation.push(createDiagnosticForNode2(node, Diagnostics.Did_you_mean_0, `export type { ${unescapeLeadingUnderscores(node.name.escapedText)} }`));
|
|
39703
39728
|
}
|
|
39704
39729
|
const declarationName = getNameOfDeclaration(node) || node;
|
|
@@ -39727,7 +39752,7 @@ function createBinder() {
|
|
|
39727
39752
|
return symbol;
|
|
39728
39753
|
}
|
|
39729
39754
|
function declareModuleMember(node, symbolFlags, symbolExcludes) {
|
|
39730
|
-
const hasExportModifier = !!(getCombinedModifierFlags(node) &
|
|
39755
|
+
const hasExportModifier = !!(getCombinedModifierFlags(node) & 32 /* Export */) || jsdocTreatAsExported(node);
|
|
39731
39756
|
if (symbolFlags & 2097152 /* Alias */) {
|
|
39732
39757
|
if (node.kind === 281 /* ExportSpecifier */ || node.kind === 271 /* ImportEqualsDeclaration */ && hasExportModifier) {
|
|
39733
39758
|
return declareSymbol(container.symbol.exports, container.symbol, node, symbolFlags, symbolExcludes);
|
|
@@ -39746,7 +39771,7 @@ function createBinder() {
|
|
|
39746
39771
|
if (isJSDocTypeAlias(node))
|
|
39747
39772
|
Debug.assert(isInJSFile(node));
|
|
39748
39773
|
if (!isAmbientModule(node) && (hasExportModifier || container.flags & 128 /* ExportContext */)) {
|
|
39749
|
-
if (!canHaveLocals(container) || !container.locals || hasSyntacticModifier(node,
|
|
39774
|
+
if (!canHaveLocals(container) || !container.locals || hasSyntacticModifier(node, 2048 /* Default */) && !getDeclarationName(node)) {
|
|
39750
39775
|
return declareSymbol(container.symbol.exports, container.symbol, node, symbolFlags, symbolExcludes);
|
|
39751
39776
|
}
|
|
39752
39777
|
const exportKind = symbolFlags & 111551 /* Value */ ? 1048576 /* ExportValue */ : 0;
|
|
@@ -39787,7 +39812,7 @@ function createBinder() {
|
|
|
39787
39812
|
return false;
|
|
39788
39813
|
if (isPropertyAccessEntityNameExpression(declName.parent) && isTopLevelNamespaceAssignment(declName.parent))
|
|
39789
39814
|
return true;
|
|
39790
|
-
if (isDeclaration(declName.parent) && getCombinedModifierFlags(declName.parent) &
|
|
39815
|
+
if (isDeclaration(declName.parent) && getCombinedModifierFlags(declName.parent) & 32 /* Export */)
|
|
39791
39816
|
return true;
|
|
39792
39817
|
return false;
|
|
39793
39818
|
}
|
|
@@ -39818,7 +39843,7 @@ function createBinder() {
|
|
|
39818
39843
|
const saveExceptionTarget = currentExceptionTarget;
|
|
39819
39844
|
const saveActiveLabelList = activeLabelList;
|
|
39820
39845
|
const saveHasExplicitReturn = hasExplicitReturn;
|
|
39821
|
-
const isImmediatelyInvoked = containerFlags & 16 /* IsFunctionExpression */ && !hasSyntacticModifier(node,
|
|
39846
|
+
const isImmediatelyInvoked = containerFlags & 16 /* IsFunctionExpression */ && !hasSyntacticModifier(node, 1024 /* Async */) && !node.asteriskToken && !!getImmediatelyInvokedFunctionExpression(node) || node.kind === 175 /* ClassStaticBlockDeclaration */;
|
|
39822
39847
|
if (!isImmediatelyInvoked) {
|
|
39823
39848
|
currentFlow = initFlowNode({ flags: 2 /* Start */ });
|
|
39824
39849
|
if (containerFlags & (16 /* IsFunctionExpression */ | 128 /* IsObjectLiteralOrClassExpressionMethodOrAccessor */)) {
|
|
@@ -40865,7 +40890,7 @@ function createBinder() {
|
|
|
40865
40890
|
function bindModuleDeclaration(node) {
|
|
40866
40891
|
setExportContextFlag(node);
|
|
40867
40892
|
if (isAmbientModule(node)) {
|
|
40868
|
-
if (hasSyntacticModifier(node,
|
|
40893
|
+
if (hasSyntacticModifier(node, 32 /* Export */)) {
|
|
40869
40894
|
errorOnFirstToken(node, Diagnostics.export_modifier_cannot_be_applied_to_ambient_modules_and_module_augmentations_since_they_are_always_visible);
|
|
40870
40895
|
}
|
|
40871
40896
|
if (isModuleAugmentationExternal(node)) {
|
|
@@ -41926,7 +41951,7 @@ function createBinder() {
|
|
|
41926
41951
|
}
|
|
41927
41952
|
if (!isBindingPattern(node.name)) {
|
|
41928
41953
|
const possibleVariableDecl = node.kind === 260 /* VariableDeclaration */ ? node : node.parent.parent;
|
|
41929
|
-
if (isInJSFile(node) && shouldResolveJsRequire(options) && isVariableDeclarationInitializedToBareOrAccessedRequire(possibleVariableDecl) && !getJSDocTypeTag(node) && !(getCombinedModifierFlags(node) &
|
|
41954
|
+
if (isInJSFile(node) && shouldResolveJsRequire(options) && isVariableDeclarationInitializedToBareOrAccessedRequire(possibleVariableDecl) && !getJSDocTypeTag(node) && !(getCombinedModifierFlags(node) & 32 /* Export */)) {
|
|
41930
41955
|
declareSymbolAndAddToSymbolTable(node, 2097152 /* Alias */, 2097152 /* AliasExcludes */);
|
|
41931
41956
|
} else if (isBlockOrCatchScoped(node)) {
|
|
41932
41957
|
bindBlockScopedDeclaration(node, 2 /* BlockScopedVariable */, 111551 /* BlockScopedVariableExcludes */);
|
|
@@ -42078,7 +42103,7 @@ function isPurelyTypeDeclaration(s) {
|
|
|
42078
42103
|
case 267 /* ModuleDeclaration */:
|
|
42079
42104
|
return getModuleInstanceState(s) !== 1 /* Instantiated */;
|
|
42080
42105
|
case 266 /* EnumDeclaration */:
|
|
42081
|
-
return hasSyntacticModifier(s,
|
|
42106
|
+
return hasSyntacticModifier(s, 4096 /* Const */);
|
|
42082
42107
|
default:
|
|
42083
42108
|
return false;
|
|
42084
42109
|
}
|
|
@@ -45184,7 +45209,7 @@ function createTypeChecker(host) {
|
|
|
45184
45209
|
if (lastLocation && lastLocation === location.name) {
|
|
45185
45210
|
return false;
|
|
45186
45211
|
}
|
|
45187
|
-
if (location.asteriskToken || hasSyntacticModifier(location,
|
|
45212
|
+
if (location.asteriskToken || hasSyntacticModifier(location, 1024 /* Async */)) {
|
|
45188
45213
|
return true;
|
|
45189
45214
|
}
|
|
45190
45215
|
return !getImmediatelyInvokedFunctionExpression(location);
|
|
@@ -45348,8 +45373,17 @@ function createTypeChecker(host) {
|
|
|
45348
45373
|
function checkAndReportErrorForUsingTypeAsValue(errorLocation, name, meaning) {
|
|
45349
45374
|
if (meaning & 111551 /* Value */) {
|
|
45350
45375
|
if (isPrimitiveTypeName(name)) {
|
|
45351
|
-
|
|
45352
|
-
|
|
45376
|
+
const grandparent = errorLocation.parent.parent;
|
|
45377
|
+
if (grandparent && grandparent.parent && isHeritageClause(grandparent)) {
|
|
45378
|
+
const heritageKind = grandparent.token;
|
|
45379
|
+
const containerKind = grandparent.parent.kind;
|
|
45380
|
+
if (containerKind === 264 /* InterfaceDeclaration */ && heritageKind === 96 /* ExtendsKeyword */) {
|
|
45381
|
+
error(errorLocation, Diagnostics.An_interface_cannot_extend_a_primitive_type_like_0_It_can_only_extend_other_named_object_types, unescapeLeadingUnderscores(name));
|
|
45382
|
+
} else if (containerKind === 263 /* ClassDeclaration */ && heritageKind === 96 /* ExtendsKeyword */) {
|
|
45383
|
+
error(errorLocation, Diagnostics.A_class_cannot_extend_a_primitive_type_like_0_Classes_can_only_extend_constructable_values, unescapeLeadingUnderscores(name));
|
|
45384
|
+
} else if (containerKind === 263 /* ClassDeclaration */ && heritageKind === 119 /* ImplementsKeyword */) {
|
|
45385
|
+
error(errorLocation, Diagnostics.A_class_cannot_implement_a_primitive_type_like_0_It_can_only_implement_other_named_object_types, unescapeLeadingUnderscores(name));
|
|
45386
|
+
}
|
|
45353
45387
|
} else {
|
|
45354
45388
|
error(errorLocation, Diagnostics._0_only_refers_to_a_type_but_is_being_used_as_a_value_here, unescapeLeadingUnderscores(name));
|
|
45355
45389
|
}
|
|
@@ -45381,16 +45415,6 @@ function createTypeChecker(host) {
|
|
|
45381
45415
|
}
|
|
45382
45416
|
return false;
|
|
45383
45417
|
}
|
|
45384
|
-
function isExtendedByInterface(node) {
|
|
45385
|
-
const grandparent = node.parent.parent;
|
|
45386
|
-
const parentOfGrandparent = grandparent.parent;
|
|
45387
|
-
if (grandparent && parentOfGrandparent) {
|
|
45388
|
-
const isExtending = isHeritageClause(grandparent) && grandparent.token === 96 /* ExtendsKeyword */;
|
|
45389
|
-
const isInterface = isInterfaceDeclaration(parentOfGrandparent);
|
|
45390
|
-
return isExtending && isInterface;
|
|
45391
|
-
}
|
|
45392
|
-
return false;
|
|
45393
|
-
}
|
|
45394
45418
|
function maybeMappedType(node, symbol) {
|
|
45395
45419
|
const container = findAncestor(node.parent, (n) => isComputedPropertyName(n) || isPropertySignature(n) ? false : isTypeLiteralNode(n) || "quit");
|
|
45396
45420
|
if (container && container.members.length === 1) {
|
|
@@ -45569,7 +45593,7 @@ function createTypeChecker(host) {
|
|
|
45569
45593
|
return resolved;
|
|
45570
45594
|
}
|
|
45571
45595
|
function isSyntacticDefault(node) {
|
|
45572
|
-
return isExportAssignment(node) && !node.isExportEquals || hasSyntacticModifier(node,
|
|
45596
|
+
return isExportAssignment(node) && !node.isExportEquals || hasSyntacticModifier(node, 2048 /* Default */) || isExportSpecifier(node) || isNamespaceExport(node);
|
|
45573
45597
|
}
|
|
45574
45598
|
function getUsageModeForExpression(usage) {
|
|
45575
45599
|
return isStringLiteralLike(usage) ? getModeForUsageLocation(getSourceFileOfNode(usage), usage) : void 0;
|
|
@@ -47495,20 +47519,20 @@ function createTypeChecker(host) {
|
|
|
47495
47519
|
var _a, _b;
|
|
47496
47520
|
if (!isDeclarationVisible(declaration)) {
|
|
47497
47521
|
const anyImportSyntax = getAnyImportSyntax(declaration);
|
|
47498
|
-
if (anyImportSyntax && !hasSyntacticModifier(anyImportSyntax,
|
|
47522
|
+
if (anyImportSyntax && !hasSyntacticModifier(anyImportSyntax, 32 /* Export */) && // import clause without export
|
|
47499
47523
|
isDeclarationVisible(anyImportSyntax.parent)) {
|
|
47500
47524
|
return addVisibleAlias(declaration, anyImportSyntax);
|
|
47501
|
-
} else if (isVariableDeclaration(declaration) && isVariableStatement(declaration.parent.parent) && !hasSyntacticModifier(declaration.parent.parent,
|
|
47525
|
+
} else if (isVariableDeclaration(declaration) && isVariableStatement(declaration.parent.parent) && !hasSyntacticModifier(declaration.parent.parent, 32 /* Export */) && // unexported variable statement
|
|
47502
47526
|
isDeclarationVisible(declaration.parent.parent.parent)) {
|
|
47503
47527
|
return addVisibleAlias(declaration, declaration.parent.parent);
|
|
47504
|
-
} else if (isLateVisibilityPaintedStatement(declaration) && !hasSyntacticModifier(declaration,
|
|
47528
|
+
} else if (isLateVisibilityPaintedStatement(declaration) && !hasSyntacticModifier(declaration, 32 /* Export */) && isDeclarationVisible(declaration.parent)) {
|
|
47505
47529
|
return addVisibleAlias(declaration, declaration);
|
|
47506
47530
|
} else if (isBindingElement(declaration)) {
|
|
47507
|
-
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,
|
|
47531
|
+
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)) {
|
|
47508
47532
|
return addVisibleAlias(declaration, declaration.parent.parent.parent.parent);
|
|
47509
47533
|
} else if (symbol.flags & 2 /* BlockScopedVariable */) {
|
|
47510
47534
|
const variableStatement = findAncestor(declaration, isVariableStatement);
|
|
47511
|
-
if (hasSyntacticModifier(variableStatement,
|
|
47535
|
+
if (hasSyntacticModifier(variableStatement, 32 /* Export */)) {
|
|
47512
47536
|
return true;
|
|
47513
47537
|
}
|
|
47514
47538
|
if (!isDeclarationVisible(variableStatement.parent)) {
|
|
@@ -47731,7 +47755,8 @@ function createTypeChecker(host) {
|
|
|
47731
47755
|
visitedTypes: void 0,
|
|
47732
47756
|
symbolDepth: void 0,
|
|
47733
47757
|
inferTypeParameters: void 0,
|
|
47734
|
-
approximateLength: 0
|
|
47758
|
+
approximateLength: 0,
|
|
47759
|
+
trackedSymbols: void 0
|
|
47735
47760
|
};
|
|
47736
47761
|
context.tracker = new SymbolTrackerImpl(context, tracker, moduleResolverHost);
|
|
47737
47762
|
const resultingNode = cb(context);
|
|
@@ -48185,7 +48210,7 @@ function createTypeChecker(host) {
|
|
|
48185
48210
|
}
|
|
48186
48211
|
}
|
|
48187
48212
|
function visitAndTransformType(type2, transform) {
|
|
48188
|
-
var _a2, _b2;
|
|
48213
|
+
var _a2, _b2, _c;
|
|
48189
48214
|
const typeId = type2.id;
|
|
48190
48215
|
const isConstructorObject = getObjectFlags(type2) & 16 /* Anonymous */ && type2.symbol && type2.symbol.flags & 32 /* Class */;
|
|
48191
48216
|
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;
|
|
@@ -48202,6 +48227,13 @@ function createTypeChecker(host) {
|
|
|
48202
48227
|
}
|
|
48203
48228
|
const cachedResult = (_a2 = links == null ? void 0 : links.serializedTypes) == null ? void 0 : _a2.get(key);
|
|
48204
48229
|
if (cachedResult) {
|
|
48230
|
+
(_b2 = cachedResult.trackedSymbols) == null ? void 0 : _b2.forEach(
|
|
48231
|
+
([symbol, enclosingDeclaration, meaning]) => context.tracker.trackSymbol(
|
|
48232
|
+
symbol,
|
|
48233
|
+
enclosingDeclaration,
|
|
48234
|
+
meaning
|
|
48235
|
+
)
|
|
48236
|
+
);
|
|
48205
48237
|
if (cachedResult.truncating) {
|
|
48206
48238
|
context.truncating = true;
|
|
48207
48239
|
}
|
|
@@ -48221,7 +48253,12 @@ function createTypeChecker(host) {
|
|
|
48221
48253
|
const result = transform(type2);
|
|
48222
48254
|
const addedLength = context.approximateLength - startLength;
|
|
48223
48255
|
if (!context.reportedDiagnostic && !context.encounteredError) {
|
|
48224
|
-
(
|
|
48256
|
+
(_c = links == null ? void 0 : links.serializedTypes) == null ? void 0 : _c.set(key, {
|
|
48257
|
+
node: result,
|
|
48258
|
+
truncating: context.truncating,
|
|
48259
|
+
addedLength,
|
|
48260
|
+
trackedSymbols: context.trackedSymbols
|
|
48261
|
+
});
|
|
48225
48262
|
}
|
|
48226
48263
|
context.visitedTypes.delete(typeId);
|
|
48227
48264
|
if (id) {
|
|
@@ -48463,7 +48500,7 @@ function createTypeChecker(host) {
|
|
|
48463
48500
|
if (propertySymbol.flags & 4194304 /* Prototype */) {
|
|
48464
48501
|
continue;
|
|
48465
48502
|
}
|
|
48466
|
-
if (getDeclarationModifierFlagsFromSymbol(propertySymbol) & (
|
|
48503
|
+
if (getDeclarationModifierFlagsFromSymbol(propertySymbol) & (2 /* Private */ | 4 /* Protected */) && context.tracker.reportPrivateInBaseOfClassExpression) {
|
|
48467
48504
|
context.tracker.reportPrivateInBaseOfClassExpression(unescapeLeadingUnderscores(propertySymbol.escapedName));
|
|
48468
48505
|
}
|
|
48469
48506
|
}
|
|
@@ -48766,7 +48803,7 @@ function createTypeChecker(host) {
|
|
|
48766
48803
|
let modifiers = options == null ? void 0 : options.modifiers;
|
|
48767
48804
|
if (kind === 185 /* ConstructorType */ && signature.flags & 4 /* Abstract */) {
|
|
48768
48805
|
const flags = modifiersToFlags(modifiers);
|
|
48769
|
-
modifiers = factory.createModifiersFromModifierFlags(flags |
|
|
48806
|
+
modifiers = factory.createModifiersFromModifierFlags(flags | 64 /* Abstract */);
|
|
48770
48807
|
}
|
|
48771
48808
|
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(
|
|
48772
48809
|
modifiers,
|
|
@@ -49823,7 +49860,7 @@ function createTypeChecker(host) {
|
|
|
49823
49860
|
const nsIndex = findIndex(statements, isModuleDeclaration);
|
|
49824
49861
|
let ns = nsIndex !== -1 ? statements[nsIndex] : void 0;
|
|
49825
49862
|
if (ns && exportAssignment && exportAssignment.isExportEquals && isIdentifier(exportAssignment.expression) && isIdentifier(ns.name) && idText(ns.name) === idText(exportAssignment.expression) && ns.body && isModuleBlock(ns.body)) {
|
|
49826
|
-
const excessExports = filter(statements, (s) => !!(getEffectiveModifierFlags(s) &
|
|
49863
|
+
const excessExports = filter(statements, (s) => !!(getEffectiveModifierFlags(s) & 32 /* Export */));
|
|
49827
49864
|
const name = ns.name;
|
|
49828
49865
|
let body = ns.body;
|
|
49829
49866
|
if (length(excessExports)) {
|
|
@@ -49857,9 +49894,9 @@ function createTypeChecker(host) {
|
|
|
49857
49894
|
}
|
|
49858
49895
|
if (!find(statements, (s) => s !== ns && nodeHasName(s, name))) {
|
|
49859
49896
|
results = [];
|
|
49860
|
-
const mixinExportFlag = !some(body.statements, (s) => hasSyntacticModifier(s,
|
|
49897
|
+
const mixinExportFlag = !some(body.statements, (s) => hasSyntacticModifier(s, 32 /* Export */) || isExportAssignment(s) || isExportDeclaration(s));
|
|
49861
49898
|
forEach(body.statements, (s) => {
|
|
49862
|
-
addResult(s, mixinExportFlag ?
|
|
49899
|
+
addResult(s, mixinExportFlag ? 32 /* Export */ : 0 /* None */);
|
|
49863
49900
|
});
|
|
49864
49901
|
statements = [...filter(statements, (s) => s !== ns && s !== exportAssignment), ...results];
|
|
49865
49902
|
}
|
|
@@ -49951,11 +49988,11 @@ function createTypeChecker(host) {
|
|
|
49951
49988
|
return statements;
|
|
49952
49989
|
}
|
|
49953
49990
|
function addExportModifier(node) {
|
|
49954
|
-
const flags = (getEffectiveModifierFlags(node) |
|
|
49991
|
+
const flags = (getEffectiveModifierFlags(node) | 32 /* Export */) & ~128 /* Ambient */;
|
|
49955
49992
|
return factory.replaceModifiers(node, flags);
|
|
49956
49993
|
}
|
|
49957
49994
|
function removeExportModifier(node) {
|
|
49958
|
-
const flags = getEffectiveModifierFlags(node) & ~
|
|
49995
|
+
const flags = getEffectiveModifierFlags(node) & ~32 /* Export */;
|
|
49959
49996
|
return factory.replaceModifiers(node, flags);
|
|
49960
49997
|
}
|
|
49961
49998
|
function visitSymbolTable(symbolTable2, suppressNewPrivateContext, propertyAsAlias) {
|
|
@@ -49996,6 +50033,12 @@ function createTypeChecker(host) {
|
|
|
49996
50033
|
if (context.reportedDiagnostic) {
|
|
49997
50034
|
oldcontext.reportedDiagnostic = context.reportedDiagnostic;
|
|
49998
50035
|
}
|
|
50036
|
+
if (context.trackedSymbols) {
|
|
50037
|
+
if (!oldContext.trackedSymbols)
|
|
50038
|
+
oldContext.trackedSymbols = context.trackedSymbols;
|
|
50039
|
+
else
|
|
50040
|
+
Debug.assert(context.trackedSymbols === oldContext.trackedSymbols);
|
|
50041
|
+
}
|
|
49999
50042
|
context = oldContext;
|
|
50000
50043
|
}
|
|
50001
50044
|
}
|
|
@@ -50012,7 +50055,7 @@ function createTypeChecker(host) {
|
|
|
50012
50055
|
if (needsPostExportDefault || needsExportDeclaration) {
|
|
50013
50056
|
isPrivate = true;
|
|
50014
50057
|
}
|
|
50015
|
-
const modifierFlags = (!isPrivate ?
|
|
50058
|
+
const modifierFlags = (!isPrivate ? 32 /* Export */ : 0) | (isDefault && !needsPostExportDefault ? 2048 /* Default */ : 0);
|
|
50016
50059
|
const isConstMergedWithNS = symbol.flags & 1536 /* Module */ && symbol.flags & (2 /* BlockScopedVariable */ | 1 /* FunctionScopedVariable */ | 4 /* Property */) && escapedSymbolName !== "export=" /* ExportEquals */;
|
|
50017
50060
|
const isConstMergedWithNSPrintableAsSignatureMerge = isConstMergedWithNS && isTypeRepresentableAsFunctionNamespaceMerge(getTypeOfSymbol(symbol), symbol);
|
|
50018
50061
|
if (symbol.flags & (16 /* Function */ | 8192 /* Method */) || isConstMergedWithNSPrintableAsSignatureMerge) {
|
|
@@ -50082,7 +50125,7 @@ function createTypeChecker(host) {
|
|
|
50082
50125
|
),
|
|
50083
50126
|
textRange
|
|
50084
50127
|
);
|
|
50085
|
-
addResult(statement, name !== localName ? modifierFlags & ~
|
|
50128
|
+
addResult(statement, name !== localName ? modifierFlags & ~32 /* Export */ : modifierFlags);
|
|
50086
50129
|
if (name !== localName && !isPrivate) {
|
|
50087
50130
|
addResult(
|
|
50088
50131
|
factory.createExportDeclaration(
|
|
@@ -50187,14 +50230,14 @@ function createTypeChecker(host) {
|
|
|
50187
50230
|
if (canHaveModifiers(node)) {
|
|
50188
50231
|
let newModifierFlags = 0 /* None */;
|
|
50189
50232
|
const enclosingDeclaration2 = context.enclosingDeclaration && (isJSDocTypeAlias(context.enclosingDeclaration) ? getSourceFileOfNode(context.enclosingDeclaration) : context.enclosingDeclaration);
|
|
50190
|
-
if (additionalModifierFlags &
|
|
50191
|
-
newModifierFlags |=
|
|
50233
|
+
if (additionalModifierFlags & 32 /* Export */ && enclosingDeclaration2 && (isExportingScope(enclosingDeclaration2) || isModuleDeclaration(enclosingDeclaration2)) && canHaveExportModifier(node)) {
|
|
50234
|
+
newModifierFlags |= 32 /* Export */;
|
|
50192
50235
|
}
|
|
50193
|
-
if (addingDeclare && !(newModifierFlags &
|
|
50194
|
-
newModifierFlags |=
|
|
50236
|
+
if (addingDeclare && !(newModifierFlags & 32 /* Export */) && (!enclosingDeclaration2 || !(enclosingDeclaration2.flags & 33554432 /* Ambient */)) && (isEnumDeclaration(node) || isVariableStatement(node) || isFunctionDeclaration(node) || isClassDeclaration(node) || isModuleDeclaration(node))) {
|
|
50237
|
+
newModifierFlags |= 128 /* Ambient */;
|
|
50195
50238
|
}
|
|
50196
|
-
if (additionalModifierFlags &
|
|
50197
|
-
newModifierFlags |=
|
|
50239
|
+
if (additionalModifierFlags & 2048 /* Default */ && (isClassDeclaration(node) || isInterfaceDeclaration(node) || isFunctionDeclaration(node))) {
|
|
50240
|
+
newModifierFlags |= 2048 /* Default */;
|
|
50198
50241
|
}
|
|
50199
50242
|
if (newModifierFlags) {
|
|
50200
50243
|
node = factory.replaceModifiers(node, newModifierFlags | getEffectiveModifierFlags(node));
|
|
@@ -50316,7 +50359,7 @@ function createTypeChecker(host) {
|
|
|
50316
50359
|
function serializeEnum(symbol, symbolName2, modifierFlags) {
|
|
50317
50360
|
addResult(
|
|
50318
50361
|
factory.createEnumDeclaration(
|
|
50319
|
-
factory.createModifiersFromModifierFlags(isConstEnumSymbol(symbol) ?
|
|
50362
|
+
factory.createModifiersFromModifierFlags(isConstEnumSymbol(symbol) ? 4096 /* Const */ : 0),
|
|
50320
50363
|
getInternalSymbolName(symbol, symbolName2),
|
|
50321
50364
|
map(filter(getPropertiesOfType(getTypeOfSymbol(symbol)), (p) => !!(p.flags & 8 /* EnumMember */)), (p) => {
|
|
50322
50365
|
const initializedValue = p.declarations && p.declarations[0] && isEnumMember(p.declarations[0]) ? getConstantValue2(p.declarations[0]) : void 0;
|
|
@@ -50400,7 +50443,7 @@ function createTypeChecker(host) {
|
|
|
50400
50443
|
factory.createIdentifier("default" /* Default */)
|
|
50401
50444
|
)])
|
|
50402
50445
|
) : d);
|
|
50403
|
-
const exportModifierStripped = every(defaultReplaced, (d) => hasSyntacticModifier(d,
|
|
50446
|
+
const exportModifierStripped = every(defaultReplaced, (d) => hasSyntacticModifier(d, 32 /* Export */)) ? map(defaultReplaced, removeExportModifier) : defaultReplaced;
|
|
50404
50447
|
fakespace = factory.updateModuleDeclaration(
|
|
50405
50448
|
fakespace,
|
|
50406
50449
|
fakespace.modifiers,
|
|
@@ -50503,7 +50546,7 @@ function createTypeChecker(host) {
|
|
|
50503
50546
|
);
|
|
50504
50547
|
const isNonConstructableClassLikeInJsFile = !isClass && !!symbol.valueDeclaration && isInJSFile(symbol.valueDeclaration) && !some(getSignaturesOfType(staticType, 1 /* Construct */));
|
|
50505
50548
|
const constructors = isNonConstructableClassLikeInJsFile ? [factory.createConstructorDeclaration(
|
|
50506
|
-
factory.createModifiersFromModifierFlags(
|
|
50549
|
+
factory.createModifiersFromModifierFlags(2 /* Private */),
|
|
50507
50550
|
[],
|
|
50508
50551
|
/*body*/
|
|
50509
50552
|
void 0
|
|
@@ -50856,7 +50899,7 @@ function createTypeChecker(host) {
|
|
|
50856
50899
|
const varName = getUnusedName(name, symbol);
|
|
50857
50900
|
const typeToSerialize = getWidenedType(getTypeOfSymbol(getMergedSymbol(symbol)));
|
|
50858
50901
|
if (isTypeRepresentableAsFunctionNamespaceMerge(typeToSerialize, symbol)) {
|
|
50859
|
-
serializeAsFunctionNamespaceMerge(typeToSerialize, symbol, varName, isExportAssignmentCompatibleSymbolName ? 0 /* None */ :
|
|
50902
|
+
serializeAsFunctionNamespaceMerge(typeToSerialize, symbol, varName, isExportAssignmentCompatibleSymbolName ? 0 /* None */ : 32 /* Export */);
|
|
50860
50903
|
} else {
|
|
50861
50904
|
const flags = ((_a2 = context.enclosingDeclaration) == null ? void 0 : _a2.kind) === 267 /* ModuleDeclaration */ && (!(symbol.flags & 98304 /* Accessor */) || symbol.flags & 65536 /* SetAccessor */) ? 1 /* Let */ : 2 /* Const */;
|
|
50862
50905
|
const statement = factory.createVariableStatement(
|
|
@@ -50873,7 +50916,7 @@ function createTypeChecker(host) {
|
|
|
50873
50916
|
);
|
|
50874
50917
|
addResult(
|
|
50875
50918
|
statement,
|
|
50876
|
-
target && target.flags & 4 /* Property */ && target.escapedName === "export=" /* ExportEquals */ ?
|
|
50919
|
+
target && target.flags & 4 /* Property */ && target.escapedName === "export=" /* ExportEquals */ ? 128 /* Ambient */ : name === varName ? 32 /* Export */ : 0 /* None */
|
|
50877
50920
|
);
|
|
50878
50921
|
}
|
|
50879
50922
|
if (isExportAssignmentCompatibleSymbolName) {
|
|
@@ -50909,14 +50952,14 @@ function createTypeChecker(host) {
|
|
|
50909
50952
|
return function serializePropertySymbol(p, isStatic2, baseType) {
|
|
50910
50953
|
var _a2, _b, _c, _d, _e;
|
|
50911
50954
|
const modifierFlags = getDeclarationModifierFlagsFromSymbol(p);
|
|
50912
|
-
const isPrivate = !!(modifierFlags &
|
|
50955
|
+
const isPrivate = !!(modifierFlags & 2 /* Private */);
|
|
50913
50956
|
if (isStatic2 && p.flags & (788968 /* Type */ | 1920 /* Namespace */ | 2097152 /* Alias */)) {
|
|
50914
50957
|
return [];
|
|
50915
50958
|
}
|
|
50916
50959
|
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))) {
|
|
50917
50960
|
return [];
|
|
50918
50961
|
}
|
|
50919
|
-
const flag = modifierFlags & ~
|
|
50962
|
+
const flag = modifierFlags & ~1024 /* Async */ | (isStatic2 ? 256 /* Static */ : 0);
|
|
50920
50963
|
const name = getPropertyNameNodeForSymbol(p, context);
|
|
50921
50964
|
const firstPropertyLikeDecl = (_a2 = p.declarations) == null ? void 0 : _a2.find(or(isPropertyDeclaration, isAccessor, isVariableDeclaration, isPropertySignature, isBinaryExpression, isPropertyAccessExpression));
|
|
50922
50965
|
if (p.flags & 98304 /* Accessor */ && useAccessors) {
|
|
@@ -50958,7 +51001,7 @@ function createTypeChecker(host) {
|
|
|
50958
51001
|
));
|
|
50959
51002
|
}
|
|
50960
51003
|
if (p.flags & 32768 /* GetAccessor */) {
|
|
50961
|
-
const isPrivate2 = modifierFlags &
|
|
51004
|
+
const isPrivate2 = modifierFlags & 2 /* Private */;
|
|
50962
51005
|
result.push(setTextRange(
|
|
50963
51006
|
factory.createGetAccessorDeclaration(
|
|
50964
51007
|
factory.createModifiersFromModifierFlags(flag),
|
|
@@ -50975,7 +51018,7 @@ function createTypeChecker(host) {
|
|
|
50975
51018
|
} else if (p.flags & (4 /* Property */ | 3 /* Variable */ | 98304 /* Accessor */)) {
|
|
50976
51019
|
return setTextRange(
|
|
50977
51020
|
createProperty2(
|
|
50978
|
-
factory.createModifiersFromModifierFlags((isReadonlySymbol(p) ?
|
|
51021
|
+
factory.createModifiersFromModifierFlags((isReadonlySymbol(p) ? 8 /* Readonly */ : 0) | flag),
|
|
50979
51022
|
name,
|
|
50980
51023
|
p.flags & 16777216 /* Optional */ ? factory.createToken(58 /* QuestionToken */) : void 0,
|
|
50981
51024
|
isPrivate ? void 0 : serializeTypeForDeclaration(context, getWriteTypeOfSymbol(p), p, enclosingDeclaration, includePrivateSymbol, bundled),
|
|
@@ -50990,10 +51033,10 @@ function createTypeChecker(host) {
|
|
|
50990
51033
|
if (p.flags & (8192 /* Method */ | 16 /* Function */)) {
|
|
50991
51034
|
const type = getTypeOfSymbol(p);
|
|
50992
51035
|
const signatures = getSignaturesOfType(type, 0 /* Call */);
|
|
50993
|
-
if (flag &
|
|
51036
|
+
if (flag & 2 /* Private */) {
|
|
50994
51037
|
return setTextRange(
|
|
50995
51038
|
createProperty2(
|
|
50996
|
-
factory.createModifiersFromModifierFlags((isReadonlySymbol(p) ?
|
|
51039
|
+
factory.createModifiersFromModifierFlags((isReadonlySymbol(p) ? 8 /* Readonly */ : 0) | flag),
|
|
50997
51040
|
name,
|
|
50998
51041
|
p.flags & 16777216 /* Optional */ ? factory.createToken(58 /* QuestionToken */) : void 0,
|
|
50999
51042
|
/*type*/
|
|
@@ -51069,7 +51112,7 @@ function createTypeChecker(host) {
|
|
|
51069
51112
|
let privateProtected = 0;
|
|
51070
51113
|
for (const s of signatures) {
|
|
51071
51114
|
if (s.declaration) {
|
|
51072
|
-
privateProtected |= getSelectedEffectiveModifierFlags(s.declaration,
|
|
51115
|
+
privateProtected |= getSelectedEffectiveModifierFlags(s.declaration, 2 /* Private */ | 4 /* Protected */);
|
|
51073
51116
|
}
|
|
51074
51117
|
}
|
|
51075
51118
|
if (privateProtected) {
|
|
@@ -51262,10 +51305,10 @@ function createTypeChecker(host) {
|
|
|
51262
51305
|
return result || types;
|
|
51263
51306
|
}
|
|
51264
51307
|
function visibilityToString(flags) {
|
|
51265
|
-
if (flags ===
|
|
51308
|
+
if (flags === 2 /* Private */) {
|
|
51266
51309
|
return "private";
|
|
51267
51310
|
}
|
|
51268
|
-
if (flags ===
|
|
51311
|
+
if (flags === 4 /* Protected */) {
|
|
51269
51312
|
return "protected";
|
|
51270
51313
|
}
|
|
51271
51314
|
return "public";
|
|
@@ -51383,7 +51426,7 @@ function createTypeChecker(host) {
|
|
|
51383
51426
|
return true;
|
|
51384
51427
|
}
|
|
51385
51428
|
const parent = getDeclarationContainer(node);
|
|
51386
|
-
if (!(getCombinedModifierFlagsCached(node) &
|
|
51429
|
+
if (!(getCombinedModifierFlagsCached(node) & 32 /* Export */) && !(node.kind !== 271 /* ImportEqualsDeclaration */ && parent.kind !== 312 /* SourceFile */ && parent.flags & 33554432 /* Ambient */)) {
|
|
51387
51430
|
return isGlobalSourceFile(parent);
|
|
51388
51431
|
}
|
|
51389
51432
|
return isDeclarationVisible(parent);
|
|
@@ -51393,7 +51436,7 @@ function createTypeChecker(host) {
|
|
|
51393
51436
|
case 178 /* SetAccessor */:
|
|
51394
51437
|
case 174 /* MethodDeclaration */:
|
|
51395
51438
|
case 173 /* MethodSignature */:
|
|
51396
|
-
if (hasEffectiveModifier(node,
|
|
51439
|
+
if (hasEffectiveModifier(node, 2 /* Private */ | 4 /* Protected */)) {
|
|
51397
51440
|
return false;
|
|
51398
51441
|
}
|
|
51399
51442
|
case 176 /* Constructor */:
|
|
@@ -51612,7 +51655,7 @@ function createTypeChecker(host) {
|
|
|
51612
51655
|
const unspreadableToRestKeys = [];
|
|
51613
51656
|
for (const prop of getPropertiesOfType(source)) {
|
|
51614
51657
|
const literalTypeFromProperty = getLiteralTypeFromProperty(prop, 8576 /* StringOrNumberLiteralOrUnique */);
|
|
51615
|
-
if (!isTypeAssignableTo(literalTypeFromProperty, omitKeyType) && !(getDeclarationModifierFlagsFromSymbol(prop) & (
|
|
51658
|
+
if (!isTypeAssignableTo(literalTypeFromProperty, omitKeyType) && !(getDeclarationModifierFlagsFromSymbol(prop) & (2 /* Private */ | 4 /* Protected */)) && isSpreadableProperty(prop)) {
|
|
51616
51659
|
spreadableProperties.push(prop);
|
|
51617
51660
|
} else {
|
|
51618
51661
|
unspreadableToRestKeys.push(literalTypeFromProperty);
|
|
@@ -51818,7 +51861,7 @@ function createTypeChecker(host) {
|
|
|
51818
51861
|
if (declaredType) {
|
|
51819
51862
|
return addOptionality(declaredType, isProperty, isOptional);
|
|
51820
51863
|
}
|
|
51821
|
-
if ((noImplicitAny || isInJSFile(declaration)) && isVariableDeclaration(declaration) && !isBindingPattern(declaration.name) && !(getCombinedModifierFlagsCached(declaration) &
|
|
51864
|
+
if ((noImplicitAny || isInJSFile(declaration)) && isVariableDeclaration(declaration) && !isBindingPattern(declaration.name) && !(getCombinedModifierFlagsCached(declaration) & 32 /* Export */) && !(declaration.flags & 33554432 /* Ambient */)) {
|
|
51822
51865
|
if (!(getCombinedNodeFlagsCached(declaration) & 6 /* Constant */) && (!declaration.initializer || isNullOrUndefined2(declaration.initializer))) {
|
|
51823
51866
|
return autoType;
|
|
51824
51867
|
}
|
|
@@ -51866,7 +51909,7 @@ function createTypeChecker(host) {
|
|
|
51866
51909
|
if (isPropertyDeclaration(declaration) && (noImplicitAny || isInJSFile(declaration))) {
|
|
51867
51910
|
if (!hasStaticModifier(declaration)) {
|
|
51868
51911
|
const constructor = findConstructorDeclaration(declaration.parent);
|
|
51869
|
-
const type = constructor ? getFlowTypeInConstructor(declaration.symbol, constructor) : getEffectiveModifierFlags(declaration) &
|
|
51912
|
+
const type = constructor ? getFlowTypeInConstructor(declaration.symbol, constructor) : getEffectiveModifierFlags(declaration) & 128 /* Ambient */ ? getTypeOfPropertyInBaseClass(declaration.symbol) : void 0;
|
|
51870
51913
|
return type && addOptionality(
|
|
51871
51914
|
type,
|
|
51872
51915
|
/*isProperty*/
|
|
@@ -51875,7 +51918,7 @@ function createTypeChecker(host) {
|
|
|
51875
51918
|
);
|
|
51876
51919
|
} else {
|
|
51877
51920
|
const staticBlocks = filter(declaration.parent.members, isClassStaticBlockDeclaration);
|
|
51878
|
-
const type = staticBlocks.length ? getFlowTypeInStaticBlocks(declaration.symbol, staticBlocks) : getEffectiveModifierFlags(declaration) &
|
|
51921
|
+
const type = staticBlocks.length ? getFlowTypeInStaticBlocks(declaration.symbol, staticBlocks) : getEffectiveModifierFlags(declaration) & 128 /* Ambient */ ? getTypeOfPropertyInBaseClass(declaration.symbol) : void 0;
|
|
51879
51922
|
return type && addOptionality(
|
|
51880
51923
|
type,
|
|
51881
51924
|
/*isProperty*/
|
|
@@ -51979,7 +52022,7 @@ function createTypeChecker(host) {
|
|
|
51979
52022
|
return everyType(flowType, isNullableType) ? void 0 : convertAutoToAny(flowType);
|
|
51980
52023
|
}
|
|
51981
52024
|
function getFlowTypeOfProperty(reference, prop) {
|
|
51982
|
-
const initialType = (prop == null ? void 0 : prop.valueDeclaration) && (!isAutoTypedProperty(prop) || getEffectiveModifierFlags(prop.valueDeclaration) &
|
|
52025
|
+
const initialType = (prop == null ? void 0 : prop.valueDeclaration) && (!isAutoTypedProperty(prop) || getEffectiveModifierFlags(prop.valueDeclaration) & 128 /* Ambient */) && getTypeOfPropertyInBaseClass(prop) || undefinedType;
|
|
51983
52026
|
return getFlowTypeOfReference(reference, autoType, initialType);
|
|
51984
52027
|
}
|
|
51985
52028
|
function getWidenedTypeForAssignmentDeclaration(symbol, resolvedSymbol) {
|
|
@@ -53632,7 +53675,7 @@ function createTypeChecker(host) {
|
|
|
53632
53675
|
const baseConstructorType = getBaseConstructorTypeOfClass(classType);
|
|
53633
53676
|
const baseSignatures = getSignaturesOfType(baseConstructorType, 1 /* Construct */);
|
|
53634
53677
|
const declaration = getClassLikeDeclarationOfSymbol(classType.symbol);
|
|
53635
|
-
const isAbstract = !!declaration && hasSyntacticModifier(declaration,
|
|
53678
|
+
const isAbstract = !!declaration && hasSyntacticModifier(declaration, 64 /* Abstract */);
|
|
53636
53679
|
if (baseSignatures.length === 0) {
|
|
53637
53680
|
return [createSignature(
|
|
53638
53681
|
/*declaration*/
|
|
@@ -54408,7 +54451,7 @@ function createTypeChecker(host) {
|
|
|
54408
54451
|
}
|
|
54409
54452
|
function isConstTypeVariable(type, depth = 0) {
|
|
54410
54453
|
var _a;
|
|
54411
|
-
return depth < 5 && !!(type && (type.flags & 262144 /* TypeParameter */ && some((_a = type.symbol) == null ? void 0 : _a.declarations, (d) => hasSyntacticModifier(d,
|
|
54454
|
+
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));
|
|
54412
54455
|
}
|
|
54413
54456
|
function getConstraintOfIndexedAccess(type) {
|
|
54414
54457
|
return hasNonCircularBaseConstraint(type) ? getConstraintFromIndexedAccess(type) : void 0;
|
|
@@ -54734,7 +54777,7 @@ function createTypeChecker(host) {
|
|
|
54734
54777
|
} else if (!isUnion && !isReadonlySymbol(prop)) {
|
|
54735
54778
|
checkFlags &= ~8 /* Readonly */;
|
|
54736
54779
|
}
|
|
54737
|
-
checkFlags |= (!(modifiers &
|
|
54780
|
+
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);
|
|
54738
54781
|
if (!isPrototypeProperty(prop)) {
|
|
54739
54782
|
syntheticFlag = 2 /* SyntheticProperty */;
|
|
54740
54783
|
}
|
|
@@ -55186,7 +55229,7 @@ function createTypeChecker(host) {
|
|
|
55186
55229
|
if (hasRestParameter(declaration) || isInJSFile(declaration) && maybeAddJsSyntheticRestParameter(declaration, parameters)) {
|
|
55187
55230
|
flags |= 1 /* HasRestParameter */;
|
|
55188
55231
|
}
|
|
55189
|
-
if (isConstructorTypeNode(declaration) && hasSyntacticModifier(declaration,
|
|
55232
|
+
if (isConstructorTypeNode(declaration) && hasSyntacticModifier(declaration, 64 /* Abstract */) || isConstructorDeclaration(declaration) && hasSyntacticModifier(declaration.parent, 64 /* Abstract */)) {
|
|
55190
55233
|
flags |= 4 /* Abstract */;
|
|
55191
55234
|
}
|
|
55192
55235
|
links.resolvedSignature = createSignature(
|
|
@@ -55556,7 +55599,7 @@ function createTypeChecker(host) {
|
|
|
55556
55599
|
if (parameter.type) {
|
|
55557
55600
|
forEachType(getTypeFromTypeNode(parameter.type), (keyType) => {
|
|
55558
55601
|
if (isValidIndexKeyType(keyType) && !findIndexInfo(indexInfos, keyType)) {
|
|
55559
|
-
indexInfos.push(createIndexInfo(keyType, declaration.type ? getTypeFromTypeNode(declaration.type) : anyType, hasEffectiveModifier(declaration,
|
|
55602
|
+
indexInfos.push(createIndexInfo(keyType, declaration.type ? getTypeFromTypeNode(declaration.type) : anyType, hasEffectiveModifier(declaration, 8 /* Readonly */), declaration));
|
|
55560
55603
|
}
|
|
55561
55604
|
});
|
|
55562
55605
|
}
|
|
@@ -57381,7 +57424,7 @@ function createTypeChecker(host) {
|
|
|
57381
57424
|
return neverType;
|
|
57382
57425
|
}
|
|
57383
57426
|
function getLiteralTypeFromProperty(prop, include, includeNonPublic) {
|
|
57384
|
-
if (includeNonPublic || !(getDeclarationModifierFlagsFromSymbol(prop) &
|
|
57427
|
+
if (includeNonPublic || !(getDeclarationModifierFlagsFromSymbol(prop) & 6 /* NonPublicAccessibilityModifier */)) {
|
|
57385
57428
|
let type = getSymbolLinks(getLateBoundSymbol(prop)).nameType;
|
|
57386
57429
|
if (!type) {
|
|
57387
57430
|
const name = getNameOfDeclaration(prop.valueDeclaration);
|
|
@@ -57815,7 +57858,7 @@ function createTypeChecker(host) {
|
|
|
57815
57858
|
}
|
|
57816
57859
|
function isPatternLiteralPlaceholderType(type) {
|
|
57817
57860
|
if (type.flags & 2097152 /* Intersection */) {
|
|
57818
|
-
return some(type.types, (t) => !!(t.flags & (2944 /* Literal */ |
|
|
57861
|
+
return !isGenericType(type) && some(type.types, (t) => !!(t.flags & (2944 /* Literal */ | 98304 /* Nullable */)) || isPatternLiteralPlaceholderType(t));
|
|
57819
57862
|
}
|
|
57820
57863
|
return !!(type.flags & (1 /* Any */ | 4 /* String */ | 8 /* Number */ | 64 /* BigInt */)) || isPatternLiteralType(type);
|
|
57821
57864
|
}
|
|
@@ -58326,7 +58369,7 @@ function createTypeChecker(host) {
|
|
|
58326
58369
|
function getAnonymousPartialType(type2) {
|
|
58327
58370
|
const members = createSymbolTable();
|
|
58328
58371
|
for (const prop of getPropertiesOfType(type2)) {
|
|
58329
|
-
if (getDeclarationModifierFlagsFromSymbol(prop) & (
|
|
58372
|
+
if (getDeclarationModifierFlagsFromSymbol(prop) & (2 /* Private */ | 4 /* Protected */)) {
|
|
58330
58373
|
} else if (isSpreadableProperty(prop)) {
|
|
58331
58374
|
const isSetonlyAccessor = prop.flags & 65536 /* SetAccessor */ && !(prop.flags & 32768 /* GetAccessor */);
|
|
58332
58375
|
const flags = 4 /* Property */ | 16777216 /* Optional */;
|
|
@@ -58388,7 +58431,7 @@ function createTypeChecker(host) {
|
|
|
58388
58431
|
const skippedPrivateMembers = /* @__PURE__ */ new Set();
|
|
58389
58432
|
const indexInfos = left === emptyObjectType ? getIndexInfosOfType(right) : getUnionIndexInfos([left, right]);
|
|
58390
58433
|
for (const rightProp of getPropertiesOfType(right)) {
|
|
58391
|
-
if (getDeclarationModifierFlagsFromSymbol(rightProp) & (
|
|
58434
|
+
if (getDeclarationModifierFlagsFromSymbol(rightProp) & (2 /* Private */ | 4 /* Protected */)) {
|
|
58392
58435
|
skippedPrivateMembers.add(rightProp.escapedName);
|
|
58393
58436
|
} else if (isSpreadableProperty(rightProp)) {
|
|
58394
58437
|
members.set(rightProp.escapedName, getSpreadSymbol(rightProp, readonly));
|
|
@@ -61955,25 +61998,25 @@ function createTypeChecker(host) {
|
|
|
61955
61998
|
function propertyRelatedTo(source2, target2, sourceProp, targetProp, getTypeOfSourceProperty, reportErrors2, intersectionState, skipOptional) {
|
|
61956
61999
|
const sourcePropFlags = getDeclarationModifierFlagsFromSymbol(sourceProp);
|
|
61957
62000
|
const targetPropFlags = getDeclarationModifierFlagsFromSymbol(targetProp);
|
|
61958
|
-
if (sourcePropFlags &
|
|
62001
|
+
if (sourcePropFlags & 2 /* Private */ || targetPropFlags & 2 /* Private */) {
|
|
61959
62002
|
if (sourceProp.valueDeclaration !== targetProp.valueDeclaration) {
|
|
61960
62003
|
if (reportErrors2) {
|
|
61961
|
-
if (sourcePropFlags &
|
|
62004
|
+
if (sourcePropFlags & 2 /* Private */ && targetPropFlags & 2 /* Private */) {
|
|
61962
62005
|
reportError(Diagnostics.Types_have_separate_declarations_of_a_private_property_0, symbolToString(targetProp));
|
|
61963
62006
|
} else {
|
|
61964
|
-
reportError(Diagnostics.Property_0_is_private_in_type_1_but_not_in_type_2, symbolToString(targetProp), typeToString(sourcePropFlags &
|
|
62007
|
+
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));
|
|
61965
62008
|
}
|
|
61966
62009
|
}
|
|
61967
62010
|
return 0 /* False */;
|
|
61968
62011
|
}
|
|
61969
|
-
} else if (targetPropFlags &
|
|
62012
|
+
} else if (targetPropFlags & 4 /* Protected */) {
|
|
61970
62013
|
if (!isValidOverrideOf(sourceProp, targetProp)) {
|
|
61971
62014
|
if (reportErrors2) {
|
|
61972
62015
|
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));
|
|
61973
62016
|
}
|
|
61974
62017
|
return 0 /* False */;
|
|
61975
62018
|
}
|
|
61976
|
-
} else if (sourcePropFlags &
|
|
62019
|
+
} else if (sourcePropFlags & 4 /* Protected */) {
|
|
61977
62020
|
if (reportErrors2) {
|
|
61978
62021
|
reportError(Diagnostics.Property_0_is_protected_in_type_1_but_public_in_type_2, symbolToString(targetProp), typeToString(source2), typeToString(target2));
|
|
61979
62022
|
}
|
|
@@ -62503,15 +62546,15 @@ function createTypeChecker(host) {
|
|
|
62503
62546
|
if (!sourceSignature.declaration || !targetSignature.declaration) {
|
|
62504
62547
|
return true;
|
|
62505
62548
|
}
|
|
62506
|
-
const sourceAccessibility = getSelectedEffectiveModifierFlags(sourceSignature.declaration,
|
|
62507
|
-
const targetAccessibility = getSelectedEffectiveModifierFlags(targetSignature.declaration,
|
|
62508
|
-
if (targetAccessibility ===
|
|
62549
|
+
const sourceAccessibility = getSelectedEffectiveModifierFlags(sourceSignature.declaration, 6 /* NonPublicAccessibilityModifier */);
|
|
62550
|
+
const targetAccessibility = getSelectedEffectiveModifierFlags(targetSignature.declaration, 6 /* NonPublicAccessibilityModifier */);
|
|
62551
|
+
if (targetAccessibility === 2 /* Private */) {
|
|
62509
62552
|
return true;
|
|
62510
62553
|
}
|
|
62511
|
-
if (targetAccessibility ===
|
|
62554
|
+
if (targetAccessibility === 4 /* Protected */ && sourceAccessibility !== 2 /* Private */) {
|
|
62512
62555
|
return true;
|
|
62513
62556
|
}
|
|
62514
|
-
if (targetAccessibility !==
|
|
62557
|
+
if (targetAccessibility !== 4 /* Protected */ && !sourceAccessibility) {
|
|
62515
62558
|
return true;
|
|
62516
62559
|
}
|
|
62517
62560
|
if (reportErrors2) {
|
|
@@ -62611,7 +62654,7 @@ function createTypeChecker(host) {
|
|
|
62611
62654
|
const variances = [];
|
|
62612
62655
|
for (const tp of typeParameters) {
|
|
62613
62656
|
const modifiers = getTypeParameterModifiers(tp);
|
|
62614
|
-
let variance = modifiers &
|
|
62657
|
+
let variance = modifiers & 16384 /* Out */ ? modifiers & 8192 /* In */ ? 0 /* Invariant */ : 1 /* Covariant */ : modifiers & 8192 /* In */ ? 2 /* Contravariant */ : void 0;
|
|
62615
62658
|
if (variance === void 0) {
|
|
62616
62659
|
let unmeasurable = false;
|
|
62617
62660
|
let unreliable = false;
|
|
@@ -62659,7 +62702,7 @@ function createTypeChecker(host) {
|
|
|
62659
62702
|
}
|
|
62660
62703
|
function getTypeParameterModifiers(tp) {
|
|
62661
62704
|
var _a;
|
|
62662
|
-
return reduceLeft((_a = tp.symbol) == null ? void 0 : _a.declarations, (modifiers, d) => modifiers | getEffectiveModifierFlags(d), 0 /* None */) & (
|
|
62705
|
+
return reduceLeft((_a = tp.symbol) == null ? void 0 : _a.declarations, (modifiers, d) => modifiers | getEffectiveModifierFlags(d), 0 /* None */) & (8192 /* In */ | 16384 /* Out */ | 4096 /* Const */);
|
|
62663
62706
|
}
|
|
62664
62707
|
function hasCovariantVoidArgument(typeArguments, variances) {
|
|
62665
62708
|
for (let i = 0; i < variances.length; i++) {
|
|
@@ -62744,10 +62787,10 @@ function createTypeChecker(host) {
|
|
|
62744
62787
|
});
|
|
62745
62788
|
}
|
|
62746
62789
|
function isValidOverrideOf(sourceProp, targetProp) {
|
|
62747
|
-
return !forEachProperty(targetProp, (tp) => getDeclarationModifierFlagsFromSymbol(tp) &
|
|
62790
|
+
return !forEachProperty(targetProp, (tp) => getDeclarationModifierFlagsFromSymbol(tp) & 4 /* Protected */ ? !isPropertyInClassDerivedFrom(sourceProp, getDeclaringClass(tp)) : false);
|
|
62748
62791
|
}
|
|
62749
62792
|
function isClassDerivedFromDeclaringClasses(checkClass, prop, writing) {
|
|
62750
|
-
return forEachProperty(prop, (p) => getDeclarationModifierFlagsFromSymbol(p, writing) &
|
|
62793
|
+
return forEachProperty(prop, (p) => getDeclarationModifierFlagsFromSymbol(p, writing) & 4 /* Protected */ ? !hasBaseType(checkClass, getDeclaringClass(p)) : false) ? void 0 : checkClass;
|
|
62751
62794
|
}
|
|
62752
62795
|
function isDeeplyNestedType(type, stack, depth, maxDepth = 3) {
|
|
62753
62796
|
if (depth >= maxDepth) {
|
|
@@ -62824,8 +62867,8 @@ function createTypeChecker(host) {
|
|
|
62824
62867
|
if (sourceProp === targetProp) {
|
|
62825
62868
|
return -1 /* True */;
|
|
62826
62869
|
}
|
|
62827
|
-
const sourcePropAccessibility = getDeclarationModifierFlagsFromSymbol(sourceProp) &
|
|
62828
|
-
const targetPropAccessibility = getDeclarationModifierFlagsFromSymbol(targetProp) &
|
|
62870
|
+
const sourcePropAccessibility = getDeclarationModifierFlagsFromSymbol(sourceProp) & 6 /* NonPublicAccessibilityModifier */;
|
|
62871
|
+
const targetPropAccessibility = getDeclarationModifierFlagsFromSymbol(targetProp) & 6 /* NonPublicAccessibilityModifier */;
|
|
62829
62872
|
if (sourcePropAccessibility !== targetPropAccessibility) {
|
|
62830
62873
|
return 0 /* False */;
|
|
62831
62874
|
}
|
|
@@ -66819,7 +66862,7 @@ function createTypeChecker(host) {
|
|
|
66819
66862
|
if (languageVersion < 2 /* ES2015 */) {
|
|
66820
66863
|
if (container.kind === 219 /* ArrowFunction */) {
|
|
66821
66864
|
error(node, Diagnostics.The_arguments_object_cannot_be_referenced_in_an_arrow_function_in_ES3_and_ES5_Consider_using_a_standard_function_expression);
|
|
66822
|
-
} else if (hasSyntacticModifier(container,
|
|
66865
|
+
} else if (hasSyntacticModifier(container, 1024 /* Async */)) {
|
|
66823
66866
|
error(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);
|
|
66824
66867
|
}
|
|
66825
66868
|
}
|
|
@@ -67232,7 +67275,7 @@ function createTypeChecker(host) {
|
|
|
67232
67275
|
let inAsyncFunction = false;
|
|
67233
67276
|
if (!isCallExpression2) {
|
|
67234
67277
|
while (container && container.kind === 219 /* ArrowFunction */) {
|
|
67235
|
-
if (hasSyntacticModifier(container,
|
|
67278
|
+
if (hasSyntacticModifier(container, 1024 /* Async */))
|
|
67236
67279
|
inAsyncFunction = true;
|
|
67237
67280
|
container = getSuperContainer(
|
|
67238
67281
|
container,
|
|
@@ -67241,7 +67284,7 @@ function createTypeChecker(host) {
|
|
|
67241
67284
|
);
|
|
67242
67285
|
needToCaptureLexicalThis = languageVersion < 2 /* ES2015 */;
|
|
67243
67286
|
}
|
|
67244
|
-
if (container && hasSyntacticModifier(container,
|
|
67287
|
+
if (container && hasSyntacticModifier(container, 1024 /* Async */))
|
|
67245
67288
|
inAsyncFunction = true;
|
|
67246
67289
|
}
|
|
67247
67290
|
let nodeCheckFlag = 0;
|
|
@@ -67573,7 +67616,24 @@ function createTypeChecker(host) {
|
|
|
67573
67616
|
}
|
|
67574
67617
|
const signature = getContextualSignatureForFunctionLikeDeclaration(functionDecl);
|
|
67575
67618
|
if (signature && !isResolvingReturnTypeOfSignature(signature)) {
|
|
67576
|
-
|
|
67619
|
+
const returnType2 = getReturnTypeOfSignature(signature);
|
|
67620
|
+
const functionFlags = getFunctionFlags(functionDecl);
|
|
67621
|
+
if (functionFlags & 1 /* Generator */) {
|
|
67622
|
+
return filterType(returnType2, (t) => {
|
|
67623
|
+
return !!(t.flags & (3 /* AnyOrUnknown */ | 16384 /* Void */ | 58982400 /* InstantiableNonPrimitive */)) || checkGeneratorInstantiationAssignabilityToReturnType(
|
|
67624
|
+
t,
|
|
67625
|
+
functionFlags,
|
|
67626
|
+
/*errorNode*/
|
|
67627
|
+
void 0
|
|
67628
|
+
);
|
|
67629
|
+
});
|
|
67630
|
+
}
|
|
67631
|
+
if (functionFlags & 2 /* Async */) {
|
|
67632
|
+
return filterType(returnType2, (t) => {
|
|
67633
|
+
return !!(t.flags & (3 /* AnyOrUnknown */ | 16384 /* Void */ | 58982400 /* InstantiableNonPrimitive */)) || !!getAwaitedTypeOfPromise(t);
|
|
67634
|
+
});
|
|
67635
|
+
}
|
|
67636
|
+
return returnType2;
|
|
67577
67637
|
}
|
|
67578
67638
|
const iife = getImmediatelyInvokedFunctionExpression(functionDecl);
|
|
67579
67639
|
if (iife) {
|
|
@@ -69429,20 +69489,20 @@ function createTypeChecker(host) {
|
|
|
69429
69489
|
return false;
|
|
69430
69490
|
}
|
|
69431
69491
|
}
|
|
69432
|
-
if (flags &
|
|
69492
|
+
if (flags & 64 /* Abstract */) {
|
|
69433
69493
|
if (errorNode) {
|
|
69434
69494
|
error(errorNode, Diagnostics.Abstract_method_0_in_class_1_cannot_be_accessed_via_super_expression, symbolToString(prop), typeToString(getDeclaringClass(prop)));
|
|
69435
69495
|
}
|
|
69436
69496
|
return false;
|
|
69437
69497
|
}
|
|
69438
|
-
if (!(flags &
|
|
69498
|
+
if (!(flags & 256 /* Static */) && ((_a = prop.declarations) == null ? void 0 : _a.some(isClassInstanceProperty))) {
|
|
69439
69499
|
if (errorNode) {
|
|
69440
69500
|
error(errorNode, Diagnostics.Class_field_0_defined_by_the_parent_class_is_not_accessible_in_the_child_class_via_super, symbolToString(prop));
|
|
69441
69501
|
}
|
|
69442
69502
|
return false;
|
|
69443
69503
|
}
|
|
69444
69504
|
}
|
|
69445
|
-
if (flags &
|
|
69505
|
+
if (flags & 64 /* Abstract */ && symbolHasNonMethodDeclaration(prop) && (isThisProperty(location) || isThisInitializedObjectBindingExpression(location) || isObjectBindingPattern(location.parent) && isThisInitializedDeclaration(location.parent.parent))) {
|
|
69446
69506
|
const declaringClassDeclaration = getClassLikeDeclarationOfSymbol(getParentOfSymbol(prop));
|
|
69447
69507
|
if (declaringClassDeclaration && isNodeUsedDuringClassInitialization(location)) {
|
|
69448
69508
|
if (errorNode) {
|
|
@@ -69451,10 +69511,10 @@ function createTypeChecker(host) {
|
|
|
69451
69511
|
return false;
|
|
69452
69512
|
}
|
|
69453
69513
|
}
|
|
69454
|
-
if (!(flags &
|
|
69514
|
+
if (!(flags & 6 /* NonPublicAccessibilityModifier */)) {
|
|
69455
69515
|
return true;
|
|
69456
69516
|
}
|
|
69457
|
-
if (flags &
|
|
69517
|
+
if (flags & 2 /* Private */) {
|
|
69458
69518
|
const declaringClassDeclaration = getClassLikeDeclarationOfSymbol(getParentOfSymbol(prop));
|
|
69459
69519
|
if (!isNodeWithinClass(location, declaringClassDeclaration)) {
|
|
69460
69520
|
if (errorNode) {
|
|
@@ -69474,14 +69534,14 @@ function createTypeChecker(host) {
|
|
|
69474
69534
|
if (!enclosingClass) {
|
|
69475
69535
|
enclosingClass = getEnclosingClassFromThisParameter(location);
|
|
69476
69536
|
enclosingClass = enclosingClass && isClassDerivedFromDeclaringClasses(enclosingClass, prop, writing);
|
|
69477
|
-
if (flags &
|
|
69537
|
+
if (flags & 256 /* Static */ || !enclosingClass) {
|
|
69478
69538
|
if (errorNode) {
|
|
69479
69539
|
error(errorNode, Diagnostics.Property_0_is_protected_and_only_accessible_within_class_1_and_its_subclasses, symbolToString(prop), typeToString(getDeclaringClass(prop) || containingType));
|
|
69480
69540
|
}
|
|
69481
69541
|
return false;
|
|
69482
69542
|
}
|
|
69483
69543
|
}
|
|
69484
|
-
if (flags &
|
|
69544
|
+
if (flags & 256 /* Static */) {
|
|
69485
69545
|
return true;
|
|
69486
69546
|
}
|
|
69487
69547
|
if (containingType.flags & 262144 /* TypeParameter */) {
|
|
@@ -69901,7 +69961,7 @@ function createTypeChecker(host) {
|
|
|
69901
69961
|
}
|
|
69902
69962
|
let diagnosticMessage;
|
|
69903
69963
|
const declarationName = idText(right);
|
|
69904
|
-
if (isInPropertyInitializerOrClassStaticBlock(node) && !isOptionalPropertyDeclaration(valueDeclaration) && !(isAccessExpression(node) && isAccessExpression(node.expression)) && !isBlockScopedNameDeclaredBeforeUse(valueDeclaration, right) && !(isMethodDeclaration(valueDeclaration) && getCombinedModifierFlagsCached(valueDeclaration) &
|
|
69964
|
+
if (isInPropertyInitializerOrClassStaticBlock(node) && !isOptionalPropertyDeclaration(valueDeclaration) && !(isAccessExpression(node) && isAccessExpression(node.expression)) && !isBlockScopedNameDeclaredBeforeUse(valueDeclaration, right) && !(isMethodDeclaration(valueDeclaration) && getCombinedModifierFlagsCached(valueDeclaration) & 256 /* Static */) && (useDefineForClassFields || !isPropertyDeclaredInAncestorClass(prop))) {
|
|
69905
69965
|
diagnosticMessage = error(right, Diagnostics.Property_0_is_used_before_its_initialization, declarationName);
|
|
69906
69966
|
} else if (valueDeclaration.kind === 263 /* ClassDeclaration */ && node.parent.kind !== 183 /* TypeReference */ && !(valueDeclaration.flags & 33554432 /* Ambient */) && !isBlockScopedNameDeclaredBeforeUse(valueDeclaration, right)) {
|
|
69907
69967
|
diagnosticMessage = error(right, Diagnostics.Class_0_used_before_its_declaration, declarationName);
|
|
@@ -70155,7 +70215,7 @@ function createTypeChecker(host) {
|
|
|
70155
70215
|
if (!valueDeclaration) {
|
|
70156
70216
|
return;
|
|
70157
70217
|
}
|
|
70158
|
-
const hasPrivateModifier = hasEffectiveModifier(valueDeclaration,
|
|
70218
|
+
const hasPrivateModifier = hasEffectiveModifier(valueDeclaration, 2 /* Private */);
|
|
70159
70219
|
const hasPrivateIdentifier = prop.valueDeclaration && isNamedDeclaration(prop.valueDeclaration) && isPrivateIdentifier(prop.valueDeclaration.name);
|
|
70160
70220
|
if (!hasPrivateModifier && !hasPrivateIdentifier) {
|
|
70161
70221
|
return;
|
|
@@ -71600,7 +71660,7 @@ function createTypeChecker(host) {
|
|
|
71600
71660
|
return resolveErrorCall(node);
|
|
71601
71661
|
}
|
|
71602
71662
|
const valueDecl = expressionType.symbol && getClassLikeDeclarationOfSymbol(expressionType.symbol);
|
|
71603
|
-
if (valueDecl && hasSyntacticModifier(valueDecl,
|
|
71663
|
+
if (valueDecl && hasSyntacticModifier(valueDecl, 64 /* Abstract */)) {
|
|
71604
71664
|
error(node, Diagnostics.Cannot_create_an_instance_of_an_abstract_class);
|
|
71605
71665
|
return resolveErrorCall(node);
|
|
71606
71666
|
}
|
|
@@ -71663,7 +71723,7 @@ function createTypeChecker(host) {
|
|
|
71663
71723
|
return true;
|
|
71664
71724
|
}
|
|
71665
71725
|
const declaration = signature.declaration;
|
|
71666
|
-
const modifiers = getSelectedEffectiveModifierFlags(declaration,
|
|
71726
|
+
const modifiers = getSelectedEffectiveModifierFlags(declaration, 6 /* NonPublicAccessibilityModifier */);
|
|
71667
71727
|
if (!modifiers || declaration.kind !== 176 /* Constructor */) {
|
|
71668
71728
|
return true;
|
|
71669
71729
|
}
|
|
@@ -71671,16 +71731,16 @@ function createTypeChecker(host) {
|
|
|
71671
71731
|
const declaringClass = getDeclaredTypeOfSymbol(declaration.parent.symbol);
|
|
71672
71732
|
if (!isNodeWithinClass(node, declaringClassDeclaration)) {
|
|
71673
71733
|
const containingClass = getContainingClass(node);
|
|
71674
|
-
if (containingClass && modifiers &
|
|
71734
|
+
if (containingClass && modifiers & 4 /* Protected */) {
|
|
71675
71735
|
const containingType = getTypeOfNode(containingClass);
|
|
71676
71736
|
if (typeHasProtectedAccessibleBase(declaration.parent.symbol, containingType)) {
|
|
71677
71737
|
return true;
|
|
71678
71738
|
}
|
|
71679
71739
|
}
|
|
71680
|
-
if (modifiers &
|
|
71740
|
+
if (modifiers & 2 /* Private */) {
|
|
71681
71741
|
error(node, Diagnostics.Constructor_of_class_0_is_private_and_only_accessible_within_the_class_declaration, typeToString(declaringClass));
|
|
71682
71742
|
}
|
|
71683
|
-
if (modifiers &
|
|
71743
|
+
if (modifiers & 4 /* Protected */) {
|
|
71684
71744
|
error(node, Diagnostics.Constructor_of_class_0_is_protected_and_only_accessible_within_the_class_declaration, typeToString(declaringClass));
|
|
71685
71745
|
}
|
|
71686
71746
|
return false;
|
|
@@ -73657,7 +73717,7 @@ function createTypeChecker(host) {
|
|
|
73657
73717
|
return !setProp;
|
|
73658
73718
|
}
|
|
73659
73719
|
function isReadonlySymbol(symbol) {
|
|
73660
|
-
return !!(getCheckFlags(symbol) & 8 /* Readonly */ || symbol.flags & 4 /* Property */ && getDeclarationModifierFlagsFromSymbol(symbol) &
|
|
73720
|
+
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));
|
|
73661
73721
|
}
|
|
73662
73722
|
function isAssignmentToReadonlyEntity(expr, symbol, assignmentKind) {
|
|
73663
73723
|
var _a, _b;
|
|
@@ -74774,7 +74834,15 @@ function createTypeChecker(host) {
|
|
|
74774
74834
|
checkExternalEmitHelpers(node, 256 /* Values */);
|
|
74775
74835
|
}
|
|
74776
74836
|
}
|
|
74777
|
-
|
|
74837
|
+
let returnType = getReturnTypeFromAnnotation(func);
|
|
74838
|
+
if (returnType && returnType.flags & 1048576 /* Union */) {
|
|
74839
|
+
returnType = filterType(returnType, (t) => checkGeneratorInstantiationAssignabilityToReturnType(
|
|
74840
|
+
t,
|
|
74841
|
+
functionFlags,
|
|
74842
|
+
/*errorNode*/
|
|
74843
|
+
void 0
|
|
74844
|
+
));
|
|
74845
|
+
}
|
|
74778
74846
|
const iterationTypes = returnType && getIterationTypesOfGeneratorFunctionReturnType(returnType, isAsync);
|
|
74779
74847
|
const signatureYieldType = iterationTypes && iterationTypes.yieldType || anyType;
|
|
74780
74848
|
const signatureNextType = iterationTypes && iterationTypes.nextType || anyType;
|
|
@@ -75395,15 +75463,15 @@ function createTypeChecker(host) {
|
|
|
75395
75463
|
var _a, _b;
|
|
75396
75464
|
if (isInterfaceDeclaration(node.parent) || isClassLike(node.parent) || isTypeAliasDeclaration(node.parent)) {
|
|
75397
75465
|
const typeParameter = getDeclaredTypeOfTypeParameter(getSymbolOfDeclaration(node));
|
|
75398
|
-
const modifiers = getTypeParameterModifiers(typeParameter) & (
|
|
75466
|
+
const modifiers = getTypeParameterModifiers(typeParameter) & (8192 /* In */ | 16384 /* Out */);
|
|
75399
75467
|
if (modifiers) {
|
|
75400
75468
|
const symbol = getSymbolOfDeclaration(node.parent);
|
|
75401
75469
|
if (isTypeAliasDeclaration(node.parent) && !(getObjectFlags(getDeclaredTypeOfSymbol(symbol)) & (16 /* Anonymous */ | 32 /* Mapped */))) {
|
|
75402
75470
|
error(node, Diagnostics.Variance_annotations_are_only_supported_in_type_aliases_for_object_function_constructor_and_mapped_types);
|
|
75403
|
-
} else if (modifiers ===
|
|
75471
|
+
} else if (modifiers === 8192 /* In */ || modifiers === 16384 /* Out */) {
|
|
75404
75472
|
(_a = tracing) == null ? void 0 : _a.push(tracing.Phase.CheckTypes, "checkTypeParameterDeferred", { parent: getTypeId(getDeclaredTypeOfSymbol(symbol)), id: getTypeId(typeParameter) });
|
|
75405
|
-
const source = createMarkerType(symbol, typeParameter, modifiers ===
|
|
75406
|
-
const target = createMarkerType(symbol, typeParameter, modifiers ===
|
|
75473
|
+
const source = createMarkerType(symbol, typeParameter, modifiers === 16384 /* Out */ ? markerSubTypeForCheck : markerSuperTypeForCheck);
|
|
75474
|
+
const target = createMarkerType(symbol, typeParameter, modifiers === 16384 /* Out */ ? markerSuperTypeForCheck : markerSubTypeForCheck);
|
|
75407
75475
|
const saveVarianceTypeParameter = typeParameter;
|
|
75408
75476
|
varianceTypeParameter = typeParameter;
|
|
75409
75477
|
checkTypeAssignableTo(source, target, node, Diagnostics.Type_0_is_not_assignable_to_type_1_as_implied_by_variance_annotation);
|
|
@@ -75417,7 +75485,7 @@ function createTypeChecker(host) {
|
|
|
75417
75485
|
checkGrammarModifiers(node);
|
|
75418
75486
|
checkVariableLikeDeclaration(node);
|
|
75419
75487
|
const func = getContainingFunction(node);
|
|
75420
|
-
if (hasSyntacticModifier(node,
|
|
75488
|
+
if (hasSyntacticModifier(node, 31 /* ParameterPropertyModifier */)) {
|
|
75421
75489
|
if (!(func.kind === 176 /* Constructor */ && nodeIsPresent(func.body))) {
|
|
75422
75490
|
error(node, Diagnostics.A_parameter_property_is_only_allowed_in_a_constructor_implementation);
|
|
75423
75491
|
}
|
|
@@ -75587,11 +75655,7 @@ function createTypeChecker(host) {
|
|
|
75587
75655
|
if (returnType === voidType) {
|
|
75588
75656
|
error(returnTypeErrorLocation, Diagnostics.A_generator_cannot_have_a_void_type_annotation);
|
|
75589
75657
|
} else {
|
|
75590
|
-
|
|
75591
|
-
const generatorReturnType = getIterationTypeOfGeneratorFunctionReturnType(1 /* Return */, returnType, (functionFlags2 & 2 /* Async */) !== 0) || generatorYieldType;
|
|
75592
|
-
const generatorNextType = getIterationTypeOfGeneratorFunctionReturnType(2 /* Next */, returnType, (functionFlags2 & 2 /* Async */) !== 0) || unknownType;
|
|
75593
|
-
const generatorInstantiation = createGeneratorReturnType(generatorYieldType, generatorReturnType, generatorNextType, !!(functionFlags2 & 2 /* Async */));
|
|
75594
|
-
checkTypeAssignableTo(generatorInstantiation, returnType, returnTypeErrorLocation);
|
|
75658
|
+
checkGeneratorInstantiationAssignabilityToReturnType(returnType, functionFlags2, returnTypeErrorLocation);
|
|
75595
75659
|
}
|
|
75596
75660
|
} else if ((functionFlags2 & 3 /* AsyncGenerator */) === 2 /* Async */) {
|
|
75597
75661
|
checkAsyncFunctionReturnType(node, returnTypeNode, returnTypeErrorLocation);
|
|
@@ -75602,6 +75666,13 @@ function createTypeChecker(host) {
|
|
|
75602
75666
|
}
|
|
75603
75667
|
}
|
|
75604
75668
|
}
|
|
75669
|
+
function checkGeneratorInstantiationAssignabilityToReturnType(returnType, functionFlags, errorNode) {
|
|
75670
|
+
const generatorYieldType = getIterationTypeOfGeneratorFunctionReturnType(0 /* Yield */, returnType, (functionFlags & 2 /* Async */) !== 0) || anyType;
|
|
75671
|
+
const generatorReturnType = getIterationTypeOfGeneratorFunctionReturnType(1 /* Return */, returnType, (functionFlags & 2 /* Async */) !== 0) || generatorYieldType;
|
|
75672
|
+
const generatorNextType = getIterationTypeOfGeneratorFunctionReturnType(2 /* Next */, returnType, (functionFlags & 2 /* Async */) !== 0) || unknownType;
|
|
75673
|
+
const generatorInstantiation = createGeneratorReturnType(generatorYieldType, generatorReturnType, generatorNextType, !!(functionFlags & 2 /* Async */));
|
|
75674
|
+
return checkTypeAssignableTo(generatorInstantiation, returnType, errorNode);
|
|
75675
|
+
}
|
|
75605
75676
|
function checkClassForDuplicateDeclarations(node) {
|
|
75606
75677
|
const instanceNames = /* @__PURE__ */ new Map();
|
|
75607
75678
|
const staticNames = /* @__PURE__ */ new Map();
|
|
@@ -75749,7 +75820,7 @@ function createTypeChecker(host) {
|
|
|
75749
75820
|
checkGrammarComputedPropertyName(node.name);
|
|
75750
75821
|
checkVariableLikeDeclaration(node);
|
|
75751
75822
|
setNodeLinksForPrivateIdentifierScope(node);
|
|
75752
|
-
if (hasSyntacticModifier(node,
|
|
75823
|
+
if (hasSyntacticModifier(node, 64 /* Abstract */) && node.kind === 172 /* PropertyDeclaration */ && node.initializer) {
|
|
75753
75824
|
error(node, Diagnostics.Property_0_cannot_have_an_initializer_because_it_is_marked_abstract, declarationNameToString(node.name));
|
|
75754
75825
|
}
|
|
75755
75826
|
}
|
|
@@ -75766,7 +75837,7 @@ function createTypeChecker(host) {
|
|
|
75766
75837
|
error(node.name, Diagnostics.Class_constructor_may_not_be_a_generator);
|
|
75767
75838
|
}
|
|
75768
75839
|
checkFunctionOrMethodDeclaration(node);
|
|
75769
|
-
if (hasSyntacticModifier(node,
|
|
75840
|
+
if (hasSyntacticModifier(node, 64 /* Abstract */) && node.kind === 174 /* MethodDeclaration */ && node.body) {
|
|
75770
75841
|
error(node, Diagnostics.Method_0_cannot_have_an_implementation_because_it_is_marked_abstract, declarationNameToString(node.name));
|
|
75771
75842
|
}
|
|
75772
75843
|
if (isPrivateIdentifier(node.name) && !getContainingClass(node)) {
|
|
@@ -75823,7 +75894,7 @@ function createTypeChecker(host) {
|
|
|
75823
75894
|
if (classExtendsNull) {
|
|
75824
75895
|
error(superCall, Diagnostics.A_constructor_cannot_contain_a_super_call_when_its_class_extends_null);
|
|
75825
75896
|
}
|
|
75826
|
-
const superCallShouldBeRootLevel = !emitStandardClassFields && (some(node.parent.members, isInstancePropertyWithInitializerOrPrivateIdentifierProperty) || some(node.parameters, (p) => hasSyntacticModifier(p,
|
|
75897
|
+
const superCallShouldBeRootLevel = !emitStandardClassFields && (some(node.parent.members, isInstancePropertyWithInitializerOrPrivateIdentifierProperty) || some(node.parameters, (p) => hasSyntacticModifier(p, 31 /* ParameterPropertyModifier */)));
|
|
75827
75898
|
if (superCallShouldBeRootLevel) {
|
|
75828
75899
|
if (!superCallIsRootLevelInConstructor(superCall, node.body)) {
|
|
75829
75900
|
error(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);
|
|
@@ -75892,11 +75963,11 @@ function createTypeChecker(host) {
|
|
|
75892
75963
|
getNodeLinks(getter).flags |= 1 /* TypeChecked */;
|
|
75893
75964
|
const getterFlags = getEffectiveModifierFlags(getter);
|
|
75894
75965
|
const setterFlags = getEffectiveModifierFlags(setter);
|
|
75895
|
-
if ((getterFlags &
|
|
75966
|
+
if ((getterFlags & 64 /* Abstract */) !== (setterFlags & 64 /* Abstract */)) {
|
|
75896
75967
|
error(getter.name, Diagnostics.Accessors_must_both_be_abstract_or_non_abstract);
|
|
75897
75968
|
error(setter.name, Diagnostics.Accessors_must_both_be_abstract_or_non_abstract);
|
|
75898
75969
|
}
|
|
75899
|
-
if (getterFlags &
|
|
75970
|
+
if (getterFlags & 4 /* Protected */ && !(setterFlags & (4 /* Protected */ | 2 /* Private */)) || getterFlags & 2 /* Private */ && !(setterFlags & 2 /* Private */)) {
|
|
75900
75971
|
error(getter.name, Diagnostics.A_get_accessor_must_be_at_least_as_accessible_as_the_setter);
|
|
75901
75972
|
error(setter.name, Diagnostics.A_get_accessor_must_be_at_least_as_accessible_as_the_setter);
|
|
75902
75973
|
}
|
|
@@ -76076,7 +76147,7 @@ function createTypeChecker(host) {
|
|
|
76076
76147
|
const propertyName = getPropertyNameFromIndex(indexType, accessNode);
|
|
76077
76148
|
if (propertyName) {
|
|
76078
76149
|
const propertySymbol = forEachType(apparentObjectType, (t) => getPropertyOfType(t, propertyName));
|
|
76079
|
-
if (propertySymbol && getDeclarationModifierFlagsFromSymbol(propertySymbol) &
|
|
76150
|
+
if (propertySymbol && getDeclarationModifierFlagsFromSymbol(propertySymbol) & 6 /* NonPublicAccessibilityModifier */) {
|
|
76080
76151
|
error(accessNode, Diagnostics.Private_or_protected_member_0_cannot_be_accessed_on_a_type_parameter, unescapeLeadingUnderscores(propertyName));
|
|
76081
76152
|
return errorType;
|
|
76082
76153
|
}
|
|
@@ -76174,16 +76245,16 @@ function createTypeChecker(host) {
|
|
|
76174
76245
|
getTypeFromTypeNode(node);
|
|
76175
76246
|
}
|
|
76176
76247
|
function isPrivateWithinAmbient(node) {
|
|
76177
|
-
return (hasEffectiveModifier(node,
|
|
76248
|
+
return (hasEffectiveModifier(node, 2 /* Private */) || isPrivateIdentifierClassElementDeclaration(node)) && !!(node.flags & 33554432 /* Ambient */);
|
|
76178
76249
|
}
|
|
76179
76250
|
function getEffectiveDeclarationFlags(n, flagsToCheck) {
|
|
76180
76251
|
let flags = getCombinedModifierFlagsCached(n);
|
|
76181
76252
|
if (n.parent.kind !== 264 /* InterfaceDeclaration */ && n.parent.kind !== 263 /* ClassDeclaration */ && n.parent.kind !== 231 /* ClassExpression */ && n.flags & 33554432 /* Ambient */) {
|
|
76182
76253
|
const container = getEnclosingContainer(n);
|
|
76183
|
-
if (container && container.flags & 128 /* ExportContext */ && !(flags &
|
|
76184
|
-
flags |=
|
|
76254
|
+
if (container && container.flags & 128 /* ExportContext */ && !(flags & 128 /* Ambient */) && !(isModuleBlock(n.parent) && isModuleDeclaration(n.parent.parent) && isGlobalScopeAugmentation(n.parent.parent))) {
|
|
76255
|
+
flags |= 32 /* Export */;
|
|
76185
76256
|
}
|
|
76186
|
-
flags |=
|
|
76257
|
+
flags |= 128 /* Ambient */;
|
|
76187
76258
|
}
|
|
76188
76259
|
return flags & flagsToCheck;
|
|
76189
76260
|
}
|
|
@@ -76201,13 +76272,13 @@ function createTypeChecker(host) {
|
|
|
76201
76272
|
const canonicalFlags = getEffectiveDeclarationFlags(getCanonicalOverload(overloads, implementation), flagsToCheck2);
|
|
76202
76273
|
forEach(overloads, (o) => {
|
|
76203
76274
|
const deviation = getEffectiveDeclarationFlags(o, flagsToCheck2) ^ canonicalFlags;
|
|
76204
|
-
if (deviation &
|
|
76275
|
+
if (deviation & 32 /* Export */) {
|
|
76205
76276
|
error(getNameOfDeclaration(o), Diagnostics.Overload_signatures_must_all_be_exported_or_non_exported);
|
|
76206
|
-
} else if (deviation &
|
|
76277
|
+
} else if (deviation & 128 /* Ambient */) {
|
|
76207
76278
|
error(getNameOfDeclaration(o), Diagnostics.Overload_signatures_must_all_be_ambient_or_non_ambient);
|
|
76208
|
-
} else if (deviation & (
|
|
76279
|
+
} else if (deviation & (2 /* Private */ | 4 /* Protected */)) {
|
|
76209
76280
|
error(getNameOfDeclaration(o) || o, Diagnostics.Overload_signatures_must_all_be_public_private_or_protected);
|
|
76210
|
-
} else if (deviation &
|
|
76281
|
+
} else if (deviation & 64 /* Abstract */) {
|
|
76211
76282
|
error(getNameOfDeclaration(o), Diagnostics.Overload_signatures_must_all_be_abstract_or_non_abstract);
|
|
76212
76283
|
}
|
|
76213
76284
|
});
|
|
@@ -76224,7 +76295,7 @@ function createTypeChecker(host) {
|
|
|
76224
76295
|
});
|
|
76225
76296
|
}
|
|
76226
76297
|
}
|
|
76227
|
-
const flagsToCheck =
|
|
76298
|
+
const flagsToCheck = 32 /* Export */ | 128 /* Ambient */ | 2 /* Private */ | 4 /* Protected */ | 64 /* Abstract */;
|
|
76228
76299
|
let someNodeFlags = 0 /* None */;
|
|
76229
76300
|
let allNodeFlags = flagsToCheck;
|
|
76230
76301
|
let someHaveQuestionToken = false;
|
|
@@ -76272,7 +76343,7 @@ function createTypeChecker(host) {
|
|
|
76272
76343
|
if (isConstructor) {
|
|
76273
76344
|
error(errorNode, Diagnostics.Constructor_implementation_is_missing);
|
|
76274
76345
|
} else {
|
|
76275
|
-
if (hasSyntacticModifier(node,
|
|
76346
|
+
if (hasSyntacticModifier(node, 64 /* Abstract */)) {
|
|
76276
76347
|
error(errorNode, Diagnostics.All_declarations_of_an_abstract_method_must_be_consecutive);
|
|
76277
76348
|
} else {
|
|
76278
76349
|
error(errorNode, Diagnostics.Function_implementation_is_missing_or_not_immediately_following_the_declaration);
|
|
@@ -76358,7 +76429,7 @@ function createTypeChecker(host) {
|
|
|
76358
76429
|
}
|
|
76359
76430
|
});
|
|
76360
76431
|
}
|
|
76361
|
-
if (lastSeenNonAmbientDeclaration && !lastSeenNonAmbientDeclaration.body && !hasSyntacticModifier(lastSeenNonAmbientDeclaration,
|
|
76432
|
+
if (lastSeenNonAmbientDeclaration && !lastSeenNonAmbientDeclaration.body && !hasSyntacticModifier(lastSeenNonAmbientDeclaration, 64 /* Abstract */) && !lastSeenNonAmbientDeclaration.questionToken) {
|
|
76362
76433
|
reportImplementationExpectedError(lastSeenNonAmbientDeclaration);
|
|
76363
76434
|
}
|
|
76364
76435
|
if (hasOverloads) {
|
|
@@ -76401,9 +76472,9 @@ function createTypeChecker(host) {
|
|
|
76401
76472
|
let defaultExportedDeclarationSpaces = 0 /* None */;
|
|
76402
76473
|
for (const d of symbol.declarations) {
|
|
76403
76474
|
const declarationSpaces = getDeclarationSpaces(d);
|
|
76404
|
-
const effectiveDeclarationFlags = getEffectiveDeclarationFlags(d,
|
|
76405
|
-
if (effectiveDeclarationFlags &
|
|
76406
|
-
if (effectiveDeclarationFlags &
|
|
76475
|
+
const effectiveDeclarationFlags = getEffectiveDeclarationFlags(d, 32 /* Export */ | 2048 /* Default */);
|
|
76476
|
+
if (effectiveDeclarationFlags & 32 /* Export */) {
|
|
76477
|
+
if (effectiveDeclarationFlags & 2048 /* Default */) {
|
|
76407
76478
|
defaultExportedDeclarationSpaces |= declarationSpaces;
|
|
76408
76479
|
} else {
|
|
76409
76480
|
exportedDeclarationSpaces |= declarationSpaces;
|
|
@@ -77044,6 +77115,12 @@ function createTypeChecker(host) {
|
|
|
77044
77115
|
}
|
|
77045
77116
|
}
|
|
77046
77117
|
}
|
|
77118
|
+
function checkJSDocThisTag(node) {
|
|
77119
|
+
const host2 = getEffectiveJSDocHost(node);
|
|
77120
|
+
if (host2 && isArrowFunction(host2)) {
|
|
77121
|
+
error(node.tagName, Diagnostics.An_arrow_function_cannot_have_a_this_parameter);
|
|
77122
|
+
}
|
|
77123
|
+
}
|
|
77047
77124
|
function checkJSDocImplementsTag(node) {
|
|
77048
77125
|
const classLike = getEffectiveJSDocHost(node);
|
|
77049
77126
|
if (!classLike || !isClassDeclaration(classLike) && !isClassExpression(classLike)) {
|
|
@@ -77206,13 +77283,13 @@ function createTypeChecker(host) {
|
|
|
77206
77283
|
break;
|
|
77207
77284
|
}
|
|
77208
77285
|
const symbol = getSymbolOfDeclaration(member);
|
|
77209
|
-
if (!symbol.isReferenced && (hasEffectiveModifier(member,
|
|
77286
|
+
if (!symbol.isReferenced && (hasEffectiveModifier(member, 2 /* Private */) || isNamedDeclaration(member) && isPrivateIdentifier(member.name)) && !(member.flags & 33554432 /* Ambient */)) {
|
|
77210
77287
|
addDiagnostic(member, 0 /* Local */, createDiagnosticForNode(member.name, Diagnostics._0_is_declared_but_its_value_is_never_read, symbolToString(symbol)));
|
|
77211
77288
|
}
|
|
77212
77289
|
break;
|
|
77213
77290
|
case 176 /* Constructor */:
|
|
77214
77291
|
for (const parameter of member.parameters) {
|
|
77215
|
-
if (!parameter.symbol.isReferenced && hasSyntacticModifier(parameter,
|
|
77292
|
+
if (!parameter.symbol.isReferenced && hasSyntacticModifier(parameter, 2 /* Private */)) {
|
|
77216
77293
|
addDiagnostic(parameter, 0 /* Local */, createDiagnosticForNode(parameter.name, Diagnostics.Property_0_is_declared_but_its_value_is_never_read, symbolName(parameter.symbol)));
|
|
77217
77294
|
}
|
|
77218
77295
|
}
|
|
@@ -77788,7 +77865,7 @@ function createTypeChecker(host) {
|
|
|
77788
77865
|
if (hasQuestionToken(left) !== hasQuestionToken(right)) {
|
|
77789
77866
|
return false;
|
|
77790
77867
|
}
|
|
77791
|
-
const interestingFlags =
|
|
77868
|
+
const interestingFlags = 2 /* Private */ | 4 /* Protected */ | 1024 /* Async */ | 64 /* Abstract */ | 8 /* Readonly */ | 256 /* Static */;
|
|
77792
77869
|
return getSelectedEffectiveModifierFlags(left, interestingFlags) === getSelectedEffectiveModifierFlags(right, interestingFlags);
|
|
77793
77870
|
}
|
|
77794
77871
|
function checkVariableDeclaration(node) {
|
|
@@ -79116,7 +79193,7 @@ function createTypeChecker(host) {
|
|
|
79116
79193
|
if (legacyDecorators && firstDecorator && some(node.members, (p) => hasStaticModifier(p) && isPrivateIdentifierClassElementDeclaration(p))) {
|
|
79117
79194
|
grammarErrorOnNode(firstDecorator, Diagnostics.Class_decorators_can_t_be_used_with_static_private_identifier_Consider_removing_the_experimental_decorator);
|
|
79118
79195
|
}
|
|
79119
|
-
if (!node.name && !hasSyntacticModifier(node,
|
|
79196
|
+
if (!node.name && !hasSyntacticModifier(node, 2048 /* Default */)) {
|
|
79120
79197
|
grammarErrorOnFirstToken(node, Diagnostics.A_class_declaration_without_the_default_modifier_must_have_a_name);
|
|
79121
79198
|
}
|
|
79122
79199
|
checkClassLikeDeclaration(node);
|
|
@@ -79182,7 +79259,7 @@ function createTypeChecker(host) {
|
|
|
79182
79259
|
error(node.name || node, Diagnostics.A_mixin_class_must_have_a_constructor_with_a_single_rest_parameter_of_type_any);
|
|
79183
79260
|
} else {
|
|
79184
79261
|
const constructSignatures = getSignaturesOfType(baseConstructorType, 1 /* Construct */);
|
|
79185
|
-
if (constructSignatures.some((signature) => signature.flags & 4 /* Abstract */) && !hasSyntacticModifier(node,
|
|
79262
|
+
if (constructSignatures.some((signature) => signature.flags & 4 /* Abstract */) && !hasSyntacticModifier(node, 64 /* Abstract */)) {
|
|
79186
79263
|
error(node.name || node, Diagnostics.A_mixin_class_that_extends_from_a_type_variable_containing_an_abstract_construct_signature_must_also_be_declared_abstract);
|
|
79187
79264
|
}
|
|
79188
79265
|
}
|
|
@@ -79396,7 +79473,7 @@ function createTypeChecker(host) {
|
|
|
79396
79473
|
const signatures = getSignaturesOfType(type, 1 /* Construct */);
|
|
79397
79474
|
if (signatures.length) {
|
|
79398
79475
|
const declaration = signatures[0].declaration;
|
|
79399
|
-
if (declaration && hasEffectiveModifier(declaration,
|
|
79476
|
+
if (declaration && hasEffectiveModifier(declaration, 2 /* Private */)) {
|
|
79400
79477
|
const typeClassDeclaration = getClassLikeDeclarationOfSymbol(type.symbol);
|
|
79401
79478
|
if (!isNodeWithinClass(node, typeClassDeclaration)) {
|
|
79402
79479
|
error(node, Diagnostics.Cannot_extend_a_class_0_Class_constructor_is_marked_as_private, getFullyQualifiedName(type.symbol));
|
|
@@ -79416,7 +79493,7 @@ function createTypeChecker(host) {
|
|
|
79416
79493
|
const baseTypes = baseTypeNode && getBaseTypes(type);
|
|
79417
79494
|
const baseWithThis = (baseTypes == null ? void 0 : baseTypes.length) ? getTypeWithThisArgument(first(baseTypes), type.thisType) : void 0;
|
|
79418
79495
|
const baseStaticType = getBaseConstructorTypeOfClass(type);
|
|
79419
|
-
const memberHasOverrideModifier = member.parent ? hasOverrideModifier(member) : hasSyntacticModifier(member,
|
|
79496
|
+
const memberHasOverrideModifier = member.parent ? hasOverrideModifier(member) : hasSyntacticModifier(member, 16 /* Override */);
|
|
79420
79497
|
return checkMemberForOverrideModifier(
|
|
79421
79498
|
node,
|
|
79422
79499
|
staticType,
|
|
@@ -79457,7 +79534,7 @@ function createTypeChecker(host) {
|
|
|
79457
79534
|
Debug.assert(!!derived, "derived should point to something, even if it is the base class' declaration.");
|
|
79458
79535
|
if (derived === base) {
|
|
79459
79536
|
const derivedClassDecl = getClassLikeDeclarationOfSymbol(type.symbol);
|
|
79460
|
-
if (baseDeclarationFlags &
|
|
79537
|
+
if (baseDeclarationFlags & 64 /* Abstract */ && (!derivedClassDecl || !hasSyntacticModifier(derivedClassDecl, 64 /* Abstract */))) {
|
|
79461
79538
|
for (const otherBaseType of getBaseTypes(type)) {
|
|
79462
79539
|
if (otherBaseType === baseType)
|
|
79463
79540
|
continue;
|
|
@@ -79500,7 +79577,7 @@ function createTypeChecker(host) {
|
|
|
79500
79577
|
}
|
|
79501
79578
|
} else {
|
|
79502
79579
|
const derivedDeclarationFlags = getDeclarationModifierFlagsFromSymbol(derived);
|
|
79503
|
-
if (baseDeclarationFlags &
|
|
79580
|
+
if (baseDeclarationFlags & 2 /* Private */ || derivedDeclarationFlags & 2 /* Private */) {
|
|
79504
79581
|
continue;
|
|
79505
79582
|
}
|
|
79506
79583
|
let errorMessage;
|
|
@@ -79517,7 +79594,7 @@ function createTypeChecker(host) {
|
|
|
79517
79594
|
error(getNameOfDeclaration(derived.valueDeclaration) || derived.valueDeclaration, errorMessage2, symbolToString(base), typeToString(baseType), typeToString(type));
|
|
79518
79595
|
} else if (useDefineForClassFields) {
|
|
79519
79596
|
const uninitialized = (_c = derived.declarations) == null ? void 0 : _c.find((d) => d.kind === 172 /* PropertyDeclaration */ && !d.initializer);
|
|
79520
|
-
if (uninitialized && !(derived.flags & 33554432 /* Transient */) && !(baseDeclarationFlags &
|
|
79597
|
+
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 */)))) {
|
|
79521
79598
|
const constructor = findConstructorDeclaration(getClassLikeDeclarationOfSymbol(type.symbol));
|
|
79522
79599
|
const propName = uninitialized.name;
|
|
79523
79600
|
if (uninitialized.exclamationToken || !constructor || !isIdentifier(propName) || !strictNullChecks || !isPropertyInitializedInConstructor(propName, type, constructor)) {
|
|
@@ -79544,7 +79621,7 @@ function createTypeChecker(host) {
|
|
|
79544
79621
|
}
|
|
79545
79622
|
}
|
|
79546
79623
|
function isPropertyAbstractOrInterface(declaration, baseDeclarationFlags) {
|
|
79547
|
-
return baseDeclarationFlags &
|
|
79624
|
+
return baseDeclarationFlags & 64 /* Abstract */ && (!isPropertyDeclaration(declaration) || !declaration.initializer) || isInterfaceDeclaration(declaration.parent);
|
|
79548
79625
|
}
|
|
79549
79626
|
function getNonInheritedProperties(type, baseTypes, properties) {
|
|
79550
79627
|
if (!length(baseTypes)) {
|
|
@@ -79609,7 +79686,7 @@ function createTypeChecker(host) {
|
|
|
79609
79686
|
}
|
|
79610
79687
|
const constructor = findConstructorDeclaration(node);
|
|
79611
79688
|
for (const member of node.members) {
|
|
79612
|
-
if (getEffectiveModifierFlags(member) &
|
|
79689
|
+
if (getEffectiveModifierFlags(member) & 128 /* Ambient */) {
|
|
79613
79690
|
continue;
|
|
79614
79691
|
}
|
|
79615
79692
|
if (!isStatic(member) && isPropertyWithoutInitializer(member)) {
|
|
@@ -80196,7 +80273,7 @@ function createTypeChecker(host) {
|
|
|
80196
80273
|
name
|
|
80197
80274
|
);
|
|
80198
80275
|
}
|
|
80199
|
-
if (isType && node.kind === 271 /* ImportEqualsDeclaration */ && hasEffectiveModifier(node,
|
|
80276
|
+
if (isType && node.kind === 271 /* ImportEqualsDeclaration */ && hasEffectiveModifier(node, 32 /* Export */)) {
|
|
80200
80277
|
error(node, Diagnostics.Cannot_use_export_import_on_a_type_or_type_only_namespace_when_0_is_enabled, isolatedModulesLikeFlagName);
|
|
80201
80278
|
}
|
|
80202
80279
|
break;
|
|
@@ -80318,7 +80395,7 @@ function createTypeChecker(host) {
|
|
|
80318
80395
|
checkGrammarModifiers(node);
|
|
80319
80396
|
if (isInternalModuleImportEqualsDeclaration(node) || checkExternalImportOrExportDeclaration(node)) {
|
|
80320
80397
|
checkImportBinding(node);
|
|
80321
|
-
if (hasSyntacticModifier(node,
|
|
80398
|
+
if (hasSyntacticModifier(node, 32 /* Export */)) {
|
|
80322
80399
|
markExportAsReferenced(node);
|
|
80323
80400
|
}
|
|
80324
80401
|
if (node.moduleReference.kind !== 283 /* ExternalModuleReference */) {
|
|
@@ -80730,6 +80807,8 @@ function createTypeChecker(host) {
|
|
|
80730
80807
|
return checkJSDocAccessibilityModifiers(node);
|
|
80731
80808
|
case 357 /* JSDocSatisfiesTag */:
|
|
80732
80809
|
return checkJSDocSatisfiesTag(node);
|
|
80810
|
+
case 350 /* JSDocThisTag */:
|
|
80811
|
+
return checkJSDocThisTag(node);
|
|
80733
80812
|
case 199 /* IndexedAccessType */:
|
|
80734
80813
|
return checkIndexedAccessType(node);
|
|
80735
80814
|
case 200 /* MappedType */:
|
|
@@ -81956,7 +82035,7 @@ function createTypeChecker(host) {
|
|
|
81956
82035
|
return true;
|
|
81957
82036
|
}
|
|
81958
82037
|
const target = getSymbolLinks(symbol).aliasTarget;
|
|
81959
|
-
if (target && getEffectiveModifierFlags(node) &
|
|
82038
|
+
if (target && getEffectiveModifierFlags(node) & 32 /* Export */ && getSymbolFlags(target) & 111551 /* Value */ && (shouldPreserveConstEnums(compilerOptions) || !isConstEnumOrConstEnumOnlyModule(target))) {
|
|
81960
82039
|
return true;
|
|
81961
82040
|
}
|
|
81962
82041
|
}
|
|
@@ -81981,10 +82060,10 @@ function createTypeChecker(host) {
|
|
|
81981
82060
|
return false;
|
|
81982
82061
|
}
|
|
81983
82062
|
function isRequiredInitializedParameter(parameter) {
|
|
81984
|
-
return !!strictNullChecks && !isOptionalParameter(parameter) && !isJSDocParameterTag(parameter) && !!parameter.initializer && !hasSyntacticModifier(parameter,
|
|
82063
|
+
return !!strictNullChecks && !isOptionalParameter(parameter) && !isJSDocParameterTag(parameter) && !!parameter.initializer && !hasSyntacticModifier(parameter, 31 /* ParameterPropertyModifier */);
|
|
81985
82064
|
}
|
|
81986
82065
|
function isOptionalUninitializedParameterProperty(parameter) {
|
|
81987
|
-
return strictNullChecks && isOptionalParameter(parameter) && !parameter.initializer && hasSyntacticModifier(parameter,
|
|
82066
|
+
return strictNullChecks && isOptionalParameter(parameter) && !parameter.initializer && hasSyntacticModifier(parameter, 31 /* ParameterPropertyModifier */);
|
|
81988
82067
|
}
|
|
81989
82068
|
function isExpandoFunctionDeclaration(node) {
|
|
81990
82069
|
const declaration = getParseTreeNode(node, isFunctionDeclaration);
|
|
@@ -82838,10 +82917,10 @@ function createTypeChecker(host) {
|
|
|
82838
82917
|
return grammarErrorOnFirstToken(node, Diagnostics.Decorators_cannot_be_applied_to_multiple_get_Slashset_accessors_of_the_same_name);
|
|
82839
82918
|
}
|
|
82840
82919
|
}
|
|
82841
|
-
if (flags & ~(
|
|
82920
|
+
if (flags & ~(2080 /* ExportDefault */ | 32768 /* Decorator */)) {
|
|
82842
82921
|
return grammarErrorOnNode(modifier, Diagnostics.Decorators_are_not_valid_here);
|
|
82843
82922
|
}
|
|
82844
|
-
if (hasLeadingDecorators && flags &
|
|
82923
|
+
if (hasLeadingDecorators && flags & 98303 /* Modifier */) {
|
|
82845
82924
|
Debug.assertIsDefined(firstDecorator);
|
|
82846
82925
|
const sourceFile = getSourceFileOfNode(modifier);
|
|
82847
82926
|
if (!hasParseDiagnostics(sourceFile)) {
|
|
@@ -82853,10 +82932,10 @@ function createTypeChecker(host) {
|
|
|
82853
82932
|
}
|
|
82854
82933
|
return false;
|
|
82855
82934
|
}
|
|
82856
|
-
flags |=
|
|
82857
|
-
if (!(flags &
|
|
82935
|
+
flags |= 32768 /* Decorator */;
|
|
82936
|
+
if (!(flags & 98303 /* Modifier */)) {
|
|
82858
82937
|
hasLeadingDecorators = true;
|
|
82859
|
-
} else if (flags &
|
|
82938
|
+
} else if (flags & 32 /* Export */) {
|
|
82860
82939
|
sawExportBeforeDecorators = true;
|
|
82861
82940
|
}
|
|
82862
82941
|
firstDecorator ?? (firstDecorator = modifier);
|
|
@@ -82885,39 +82964,39 @@ function createTypeChecker(host) {
|
|
|
82885
82964
|
}
|
|
82886
82965
|
break;
|
|
82887
82966
|
case 164 /* OverrideKeyword */:
|
|
82888
|
-
if (flags &
|
|
82967
|
+
if (flags & 16 /* Override */) {
|
|
82889
82968
|
return grammarErrorOnNode(modifier, Diagnostics._0_modifier_already_seen, "override");
|
|
82890
|
-
} else if (flags &
|
|
82969
|
+
} else if (flags & 128 /* Ambient */) {
|
|
82891
82970
|
return grammarErrorOnNode(modifier, Diagnostics._0_modifier_cannot_be_used_with_1_modifier, "override", "declare");
|
|
82892
|
-
} else if (flags &
|
|
82971
|
+
} else if (flags & 8 /* Readonly */) {
|
|
82893
82972
|
return grammarErrorOnNode(modifier, Diagnostics._0_modifier_must_precede_1_modifier, "override", "readonly");
|
|
82894
|
-
} else if (flags &
|
|
82973
|
+
} else if (flags & 512 /* Accessor */) {
|
|
82895
82974
|
return grammarErrorOnNode(modifier, Diagnostics._0_modifier_must_precede_1_modifier, "override", "accessor");
|
|
82896
|
-
} else if (flags &
|
|
82975
|
+
} else if (flags & 1024 /* Async */) {
|
|
82897
82976
|
return grammarErrorOnNode(modifier, Diagnostics._0_modifier_must_precede_1_modifier, "override", "async");
|
|
82898
82977
|
}
|
|
82899
|
-
flags |=
|
|
82978
|
+
flags |= 16 /* Override */;
|
|
82900
82979
|
lastOverride = modifier;
|
|
82901
82980
|
break;
|
|
82902
82981
|
case 125 /* PublicKeyword */:
|
|
82903
82982
|
case 124 /* ProtectedKeyword */:
|
|
82904
82983
|
case 123 /* PrivateKeyword */:
|
|
82905
82984
|
const text = visibilityToString(modifierToFlag(modifier.kind));
|
|
82906
|
-
if (flags &
|
|
82985
|
+
if (flags & 7 /* AccessibilityModifier */) {
|
|
82907
82986
|
return grammarErrorOnNode(modifier, Diagnostics.Accessibility_modifier_already_seen);
|
|
82908
|
-
} else if (flags &
|
|
82987
|
+
} else if (flags & 16 /* Override */) {
|
|
82909
82988
|
return grammarErrorOnNode(modifier, Diagnostics._0_modifier_must_precede_1_modifier, text, "override");
|
|
82910
|
-
} else if (flags &
|
|
82989
|
+
} else if (flags & 256 /* Static */) {
|
|
82911
82990
|
return grammarErrorOnNode(modifier, Diagnostics._0_modifier_must_precede_1_modifier, text, "static");
|
|
82912
|
-
} else if (flags &
|
|
82991
|
+
} else if (flags & 512 /* Accessor */) {
|
|
82913
82992
|
return grammarErrorOnNode(modifier, Diagnostics._0_modifier_must_precede_1_modifier, text, "accessor");
|
|
82914
|
-
} else if (flags &
|
|
82993
|
+
} else if (flags & 8 /* Readonly */) {
|
|
82915
82994
|
return grammarErrorOnNode(modifier, Diagnostics._0_modifier_must_precede_1_modifier, text, "readonly");
|
|
82916
|
-
} else if (flags &
|
|
82995
|
+
} else if (flags & 1024 /* Async */) {
|
|
82917
82996
|
return grammarErrorOnNode(modifier, Diagnostics._0_modifier_must_precede_1_modifier, text, "async");
|
|
82918
82997
|
} else if (node.parent.kind === 268 /* ModuleBlock */ || node.parent.kind === 312 /* SourceFile */) {
|
|
82919
82998
|
return grammarErrorOnNode(modifier, Diagnostics._0_modifier_cannot_appear_on_a_module_or_namespace_element, text);
|
|
82920
|
-
} else if (flags &
|
|
82999
|
+
} else if (flags & 64 /* Abstract */) {
|
|
82921
83000
|
if (modifier.kind === 123 /* PrivateKeyword */) {
|
|
82922
83001
|
return grammarErrorOnNode(modifier, Diagnostics._0_modifier_cannot_be_used_with_1_modifier, text, "abstract");
|
|
82923
83002
|
} else {
|
|
@@ -82929,60 +83008,60 @@ function createTypeChecker(host) {
|
|
|
82929
83008
|
flags |= modifierToFlag(modifier.kind);
|
|
82930
83009
|
break;
|
|
82931
83010
|
case 126 /* StaticKeyword */:
|
|
82932
|
-
if (flags &
|
|
83011
|
+
if (flags & 256 /* Static */) {
|
|
82933
83012
|
return grammarErrorOnNode(modifier, Diagnostics._0_modifier_already_seen, "static");
|
|
82934
|
-
} else if (flags &
|
|
83013
|
+
} else if (flags & 8 /* Readonly */) {
|
|
82935
83014
|
return grammarErrorOnNode(modifier, Diagnostics._0_modifier_must_precede_1_modifier, "static", "readonly");
|
|
82936
|
-
} else if (flags &
|
|
83015
|
+
} else if (flags & 1024 /* Async */) {
|
|
82937
83016
|
return grammarErrorOnNode(modifier, Diagnostics._0_modifier_must_precede_1_modifier, "static", "async");
|
|
82938
|
-
} else if (flags &
|
|
83017
|
+
} else if (flags & 512 /* Accessor */) {
|
|
82939
83018
|
return grammarErrorOnNode(modifier, Diagnostics._0_modifier_must_precede_1_modifier, "static", "accessor");
|
|
82940
83019
|
} else if (node.parent.kind === 268 /* ModuleBlock */ || node.parent.kind === 312 /* SourceFile */) {
|
|
82941
83020
|
return grammarErrorOnNode(modifier, Diagnostics._0_modifier_cannot_appear_on_a_module_or_namespace_element, "static");
|
|
82942
83021
|
} else if (node.kind === 169 /* Parameter */) {
|
|
82943
83022
|
return grammarErrorOnNode(modifier, Diagnostics._0_modifier_cannot_appear_on_a_parameter, "static");
|
|
82944
|
-
} else if (flags &
|
|
83023
|
+
} else if (flags & 64 /* Abstract */) {
|
|
82945
83024
|
return grammarErrorOnNode(modifier, Diagnostics._0_modifier_cannot_be_used_with_1_modifier, "static", "abstract");
|
|
82946
|
-
} else if (flags &
|
|
83025
|
+
} else if (flags & 16 /* Override */) {
|
|
82947
83026
|
return grammarErrorOnNode(modifier, Diagnostics._0_modifier_must_precede_1_modifier, "static", "override");
|
|
82948
83027
|
}
|
|
82949
|
-
flags |=
|
|
83028
|
+
flags |= 256 /* Static */;
|
|
82950
83029
|
lastStatic = modifier;
|
|
82951
83030
|
break;
|
|
82952
83031
|
case 129 /* AccessorKeyword */:
|
|
82953
|
-
if (flags &
|
|
83032
|
+
if (flags & 512 /* Accessor */) {
|
|
82954
83033
|
return grammarErrorOnNode(modifier, Diagnostics._0_modifier_already_seen, "accessor");
|
|
82955
|
-
} else if (flags &
|
|
83034
|
+
} else if (flags & 8 /* Readonly */) {
|
|
82956
83035
|
return grammarErrorOnNode(modifier, Diagnostics._0_modifier_cannot_be_used_with_1_modifier, "accessor", "readonly");
|
|
82957
|
-
} else if (flags &
|
|
83036
|
+
} else if (flags & 128 /* Ambient */) {
|
|
82958
83037
|
return grammarErrorOnNode(modifier, Diagnostics._0_modifier_cannot_be_used_with_1_modifier, "accessor", "declare");
|
|
82959
83038
|
} else if (node.kind !== 172 /* PropertyDeclaration */) {
|
|
82960
83039
|
return grammarErrorOnNode(modifier, Diagnostics.accessor_modifier_can_only_appear_on_a_property_declaration);
|
|
82961
83040
|
}
|
|
82962
|
-
flags |=
|
|
83041
|
+
flags |= 512 /* Accessor */;
|
|
82963
83042
|
break;
|
|
82964
83043
|
case 148 /* ReadonlyKeyword */:
|
|
82965
|
-
if (flags &
|
|
83044
|
+
if (flags & 8 /* Readonly */) {
|
|
82966
83045
|
return grammarErrorOnNode(modifier, Diagnostics._0_modifier_already_seen, "readonly");
|
|
82967
83046
|
} else if (node.kind !== 172 /* PropertyDeclaration */ && node.kind !== 171 /* PropertySignature */ && node.kind !== 181 /* IndexSignature */ && node.kind !== 169 /* Parameter */) {
|
|
82968
83047
|
return grammarErrorOnNode(modifier, Diagnostics.readonly_modifier_can_only_appear_on_a_property_declaration_or_index_signature);
|
|
82969
|
-
} else if (flags &
|
|
83048
|
+
} else if (flags & 512 /* Accessor */) {
|
|
82970
83049
|
return grammarErrorOnNode(modifier, Diagnostics._0_modifier_cannot_be_used_with_1_modifier, "readonly", "accessor");
|
|
82971
83050
|
}
|
|
82972
|
-
flags |=
|
|
83051
|
+
flags |= 8 /* Readonly */;
|
|
82973
83052
|
break;
|
|
82974
83053
|
case 95 /* ExportKeyword */:
|
|
82975
83054
|
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
|
|
82976
83055
|
node.kind !== 267 /* ModuleDeclaration */ && node.parent.kind === 312 /* SourceFile */ && (moduleKind === 1 /* CommonJS */ || getSourceFileOfNode(node).impliedNodeFormat === 1 /* CommonJS */)) {
|
|
82977
83056
|
return grammarErrorOnNode(modifier, Diagnostics.A_top_level_export_modifier_cannot_be_used_on_value_declarations_in_a_CommonJS_module_when_verbatimModuleSyntax_is_enabled);
|
|
82978
83057
|
}
|
|
82979
|
-
if (flags &
|
|
83058
|
+
if (flags & 32 /* Export */) {
|
|
82980
83059
|
return grammarErrorOnNode(modifier, Diagnostics._0_modifier_already_seen, "export");
|
|
82981
|
-
} else if (flags &
|
|
83060
|
+
} else if (flags & 128 /* Ambient */) {
|
|
82982
83061
|
return grammarErrorOnNode(modifier, Diagnostics._0_modifier_must_precede_1_modifier, "export", "declare");
|
|
82983
|
-
} else if (flags &
|
|
83062
|
+
} else if (flags & 64 /* Abstract */) {
|
|
82984
83063
|
return grammarErrorOnNode(modifier, Diagnostics._0_modifier_must_precede_1_modifier, "export", "abstract");
|
|
82985
|
-
} else if (flags &
|
|
83064
|
+
} else if (flags & 1024 /* Async */) {
|
|
82986
83065
|
return grammarErrorOnNode(modifier, Diagnostics._0_modifier_must_precede_1_modifier, "export", "async");
|
|
82987
83066
|
} else if (isClassLike(node.parent)) {
|
|
82988
83067
|
return grammarErrorOnNode(modifier, Diagnostics._0_modifier_cannot_appear_on_class_elements_of_this_kind, "export");
|
|
@@ -82993,7 +83072,7 @@ function createTypeChecker(host) {
|
|
|
82993
83072
|
} else if (blockScopeKind === 6 /* AwaitUsing */) {
|
|
82994
83073
|
return grammarErrorOnNode(modifier, Diagnostics._0_modifier_cannot_appear_on_an_await_using_declaration, "export");
|
|
82995
83074
|
}
|
|
82996
|
-
flags |=
|
|
83075
|
+
flags |= 32 /* Export */;
|
|
82997
83076
|
break;
|
|
82998
83077
|
case 90 /* DefaultKeyword */:
|
|
82999
83078
|
const container = node.parent.kind === 312 /* SourceFile */ ? node.parent : node.parent.parent;
|
|
@@ -83003,19 +83082,19 @@ function createTypeChecker(host) {
|
|
|
83003
83082
|
return grammarErrorOnNode(modifier, Diagnostics._0_modifier_cannot_appear_on_a_using_declaration, "default");
|
|
83004
83083
|
} else if (blockScopeKind === 6 /* AwaitUsing */) {
|
|
83005
83084
|
return grammarErrorOnNode(modifier, Diagnostics._0_modifier_cannot_appear_on_an_await_using_declaration, "default");
|
|
83006
|
-
} else if (!(flags &
|
|
83085
|
+
} else if (!(flags & 32 /* Export */)) {
|
|
83007
83086
|
return grammarErrorOnNode(modifier, Diagnostics._0_modifier_must_precede_1_modifier, "export", "default");
|
|
83008
83087
|
} else if (sawExportBeforeDecorators) {
|
|
83009
83088
|
return grammarErrorOnNode(firstDecorator, Diagnostics.Decorators_are_not_valid_here);
|
|
83010
83089
|
}
|
|
83011
|
-
flags |=
|
|
83090
|
+
flags |= 2048 /* Default */;
|
|
83012
83091
|
break;
|
|
83013
83092
|
case 138 /* DeclareKeyword */:
|
|
83014
|
-
if (flags &
|
|
83093
|
+
if (flags & 128 /* Ambient */) {
|
|
83015
83094
|
return grammarErrorOnNode(modifier, Diagnostics._0_modifier_already_seen, "declare");
|
|
83016
|
-
} else if (flags &
|
|
83095
|
+
} else if (flags & 1024 /* Async */) {
|
|
83017
83096
|
return grammarErrorOnNode(modifier, Diagnostics._0_modifier_cannot_be_used_in_an_ambient_context, "async");
|
|
83018
|
-
} else if (flags &
|
|
83097
|
+
} else if (flags & 16 /* Override */) {
|
|
83019
83098
|
return grammarErrorOnNode(modifier, Diagnostics._0_modifier_cannot_be_used_in_an_ambient_context, "override");
|
|
83020
83099
|
} else if (isClassLike(node.parent) && !isPropertyDeclaration(node)) {
|
|
83021
83100
|
return grammarErrorOnNode(modifier, Diagnostics._0_modifier_cannot_appear_on_class_elements_of_this_kind, "declare");
|
|
@@ -83029,62 +83108,62 @@ function createTypeChecker(host) {
|
|
|
83029
83108
|
return grammarErrorOnNode(modifier, Diagnostics.A_declare_modifier_cannot_be_used_in_an_already_ambient_context);
|
|
83030
83109
|
} else if (isPrivateIdentifierClassElementDeclaration(node)) {
|
|
83031
83110
|
return grammarErrorOnNode(modifier, Diagnostics._0_modifier_cannot_be_used_with_a_private_identifier, "declare");
|
|
83032
|
-
} else if (flags &
|
|
83111
|
+
} else if (flags & 512 /* Accessor */) {
|
|
83033
83112
|
return grammarErrorOnNode(modifier, Diagnostics._0_modifier_cannot_be_used_with_1_modifier, "declare", "accessor");
|
|
83034
83113
|
}
|
|
83035
|
-
flags |=
|
|
83114
|
+
flags |= 128 /* Ambient */;
|
|
83036
83115
|
lastDeclare = modifier;
|
|
83037
83116
|
break;
|
|
83038
83117
|
case 128 /* AbstractKeyword */:
|
|
83039
|
-
if (flags &
|
|
83118
|
+
if (flags & 64 /* Abstract */) {
|
|
83040
83119
|
return grammarErrorOnNode(modifier, Diagnostics._0_modifier_already_seen, "abstract");
|
|
83041
83120
|
}
|
|
83042
83121
|
if (node.kind !== 263 /* ClassDeclaration */ && node.kind !== 185 /* ConstructorType */) {
|
|
83043
83122
|
if (node.kind !== 174 /* MethodDeclaration */ && node.kind !== 172 /* PropertyDeclaration */ && node.kind !== 177 /* GetAccessor */ && node.kind !== 178 /* SetAccessor */) {
|
|
83044
83123
|
return grammarErrorOnNode(modifier, Diagnostics.abstract_modifier_can_only_appear_on_a_class_method_or_property_declaration);
|
|
83045
83124
|
}
|
|
83046
|
-
if (!(node.parent.kind === 263 /* ClassDeclaration */ && hasSyntacticModifier(node.parent,
|
|
83125
|
+
if (!(node.parent.kind === 263 /* ClassDeclaration */ && hasSyntacticModifier(node.parent, 64 /* Abstract */))) {
|
|
83047
83126
|
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;
|
|
83048
83127
|
return grammarErrorOnNode(modifier, message);
|
|
83049
83128
|
}
|
|
83050
|
-
if (flags &
|
|
83129
|
+
if (flags & 256 /* Static */) {
|
|
83051
83130
|
return grammarErrorOnNode(modifier, Diagnostics._0_modifier_cannot_be_used_with_1_modifier, "static", "abstract");
|
|
83052
83131
|
}
|
|
83053
|
-
if (flags &
|
|
83132
|
+
if (flags & 2 /* Private */) {
|
|
83054
83133
|
return grammarErrorOnNode(modifier, Diagnostics._0_modifier_cannot_be_used_with_1_modifier, "private", "abstract");
|
|
83055
83134
|
}
|
|
83056
|
-
if (flags &
|
|
83135
|
+
if (flags & 1024 /* Async */ && lastAsync) {
|
|
83057
83136
|
return grammarErrorOnNode(lastAsync, Diagnostics._0_modifier_cannot_be_used_with_1_modifier, "async", "abstract");
|
|
83058
83137
|
}
|
|
83059
|
-
if (flags &
|
|
83138
|
+
if (flags & 16 /* Override */) {
|
|
83060
83139
|
return grammarErrorOnNode(modifier, Diagnostics._0_modifier_must_precede_1_modifier, "abstract", "override");
|
|
83061
83140
|
}
|
|
83062
|
-
if (flags &
|
|
83141
|
+
if (flags & 512 /* Accessor */) {
|
|
83063
83142
|
return grammarErrorOnNode(modifier, Diagnostics._0_modifier_must_precede_1_modifier, "abstract", "accessor");
|
|
83064
83143
|
}
|
|
83065
83144
|
}
|
|
83066
83145
|
if (isNamedDeclaration(node) && node.name.kind === 81 /* PrivateIdentifier */) {
|
|
83067
83146
|
return grammarErrorOnNode(modifier, Diagnostics._0_modifier_cannot_be_used_with_a_private_identifier, "abstract");
|
|
83068
83147
|
}
|
|
83069
|
-
flags |=
|
|
83148
|
+
flags |= 64 /* Abstract */;
|
|
83070
83149
|
break;
|
|
83071
83150
|
case 134 /* AsyncKeyword */:
|
|
83072
|
-
if (flags &
|
|
83151
|
+
if (flags & 1024 /* Async */) {
|
|
83073
83152
|
return grammarErrorOnNode(modifier, Diagnostics._0_modifier_already_seen, "async");
|
|
83074
|
-
} else if (flags &
|
|
83153
|
+
} else if (flags & 128 /* Ambient */ || node.parent.flags & 33554432 /* Ambient */) {
|
|
83075
83154
|
return grammarErrorOnNode(modifier, Diagnostics._0_modifier_cannot_be_used_in_an_ambient_context, "async");
|
|
83076
83155
|
} else if (node.kind === 169 /* Parameter */) {
|
|
83077
83156
|
return grammarErrorOnNode(modifier, Diagnostics._0_modifier_cannot_appear_on_a_parameter, "async");
|
|
83078
83157
|
}
|
|
83079
|
-
if (flags &
|
|
83158
|
+
if (flags & 64 /* Abstract */) {
|
|
83080
83159
|
return grammarErrorOnNode(modifier, Diagnostics._0_modifier_cannot_be_used_with_1_modifier, "async", "abstract");
|
|
83081
83160
|
}
|
|
83082
|
-
flags |=
|
|
83161
|
+
flags |= 1024 /* Async */;
|
|
83083
83162
|
lastAsync = modifier;
|
|
83084
83163
|
break;
|
|
83085
83164
|
case 103 /* InKeyword */:
|
|
83086
83165
|
case 147 /* OutKeyword */:
|
|
83087
|
-
const inOutFlag = modifier.kind === 103 /* InKeyword */ ?
|
|
83166
|
+
const inOutFlag = modifier.kind === 103 /* InKeyword */ ? 8192 /* In */ : 16384 /* Out */;
|
|
83088
83167
|
const inOutText = modifier.kind === 103 /* InKeyword */ ? "in" : "out";
|
|
83089
83168
|
if (node.kind !== 168 /* TypeParameter */ || !(isInterfaceDeclaration(node.parent) || isClassLike(node.parent) || isTypeAliasDeclaration(node.parent))) {
|
|
83090
83169
|
return grammarErrorOnNode(modifier, Diagnostics._0_modifier_can_only_appear_on_a_type_parameter_of_a_class_interface_or_type_alias, inOutText);
|
|
@@ -83092,7 +83171,7 @@ function createTypeChecker(host) {
|
|
|
83092
83171
|
if (flags & inOutFlag) {
|
|
83093
83172
|
return grammarErrorOnNode(modifier, Diagnostics._0_modifier_already_seen, inOutText);
|
|
83094
83173
|
}
|
|
83095
|
-
if (inOutFlag &
|
|
83174
|
+
if (inOutFlag & 8192 /* In */ && flags & 16384 /* Out */) {
|
|
83096
83175
|
return grammarErrorOnNode(modifier, Diagnostics._0_modifier_must_precede_1_modifier, "in", "out");
|
|
83097
83176
|
}
|
|
83098
83177
|
flags |= inOutFlag;
|
|
@@ -83101,24 +83180,24 @@ function createTypeChecker(host) {
|
|
|
83101
83180
|
}
|
|
83102
83181
|
}
|
|
83103
83182
|
if (node.kind === 176 /* Constructor */) {
|
|
83104
|
-
if (flags &
|
|
83183
|
+
if (flags & 256 /* Static */) {
|
|
83105
83184
|
return grammarErrorOnNode(lastStatic, Diagnostics._0_modifier_cannot_appear_on_a_constructor_declaration, "static");
|
|
83106
83185
|
}
|
|
83107
|
-
if (flags &
|
|
83186
|
+
if (flags & 16 /* Override */) {
|
|
83108
83187
|
return grammarErrorOnNode(lastOverride, Diagnostics._0_modifier_cannot_appear_on_a_constructor_declaration, "override");
|
|
83109
83188
|
}
|
|
83110
|
-
if (flags &
|
|
83189
|
+
if (flags & 1024 /* Async */) {
|
|
83111
83190
|
return grammarErrorOnNode(lastAsync, Diagnostics._0_modifier_cannot_appear_on_a_constructor_declaration, "async");
|
|
83112
83191
|
}
|
|
83113
83192
|
return false;
|
|
83114
|
-
} else if ((node.kind === 272 /* ImportDeclaration */ || node.kind === 271 /* ImportEqualsDeclaration */) && flags &
|
|
83193
|
+
} else if ((node.kind === 272 /* ImportDeclaration */ || node.kind === 271 /* ImportEqualsDeclaration */) && flags & 128 /* Ambient */) {
|
|
83115
83194
|
return grammarErrorOnNode(lastDeclare, Diagnostics.A_0_modifier_cannot_be_used_with_an_import_declaration, "declare");
|
|
83116
|
-
} else if (node.kind === 169 /* Parameter */ && flags &
|
|
83195
|
+
} else if (node.kind === 169 /* Parameter */ && flags & 31 /* ParameterPropertyModifier */ && isBindingPattern(node.name)) {
|
|
83117
83196
|
return grammarErrorOnNode(node, Diagnostics.A_parameter_property_may_not_be_declared_using_a_binding_pattern);
|
|
83118
|
-
} else if (node.kind === 169 /* Parameter */ && flags &
|
|
83197
|
+
} else if (node.kind === 169 /* Parameter */ && flags & 31 /* ParameterPropertyModifier */ && node.dotDotDotToken) {
|
|
83119
83198
|
return grammarErrorOnNode(node, Diagnostics.A_parameter_property_cannot_be_declared_using_a_rest_parameter);
|
|
83120
83199
|
}
|
|
83121
|
-
if (flags &
|
|
83200
|
+
if (flags & 1024 /* Async */) {
|
|
83122
83201
|
return checkGrammarAsyncModifier(node, lastAsync);
|
|
83123
83202
|
}
|
|
83124
83203
|
return false;
|
|
@@ -83638,12 +83717,12 @@ function createTypeChecker(host) {
|
|
|
83638
83717
|
if (languageVersion < 2 /* ES2015 */ && isPrivateIdentifier(accessor.name)) {
|
|
83639
83718
|
return grammarErrorOnNode(accessor.name, Diagnostics.Private_identifiers_are_only_available_when_targeting_ECMAScript_2015_and_higher);
|
|
83640
83719
|
}
|
|
83641
|
-
if (accessor.body === void 0 && !hasSyntacticModifier(accessor,
|
|
83720
|
+
if (accessor.body === void 0 && !hasSyntacticModifier(accessor, 64 /* Abstract */)) {
|
|
83642
83721
|
return grammarErrorAtPos(accessor, accessor.end - 1, ";".length, Diagnostics._0_expected, "{");
|
|
83643
83722
|
}
|
|
83644
83723
|
}
|
|
83645
83724
|
if (accessor.body) {
|
|
83646
|
-
if (hasSyntacticModifier(accessor,
|
|
83725
|
+
if (hasSyntacticModifier(accessor, 64 /* Abstract */)) {
|
|
83647
83726
|
return grammarErrorOnNode(accessor, Diagnostics.An_abstract_accessor_cannot_have_an_implementation);
|
|
83648
83727
|
}
|
|
83649
83728
|
if (accessor.parent.kind === 187 /* TypeLiteral */ || accessor.parent.kind === 264 /* InterfaceDeclaration */) {
|
|
@@ -83715,7 +83794,7 @@ function createTypeChecker(host) {
|
|
|
83715
83794
|
}
|
|
83716
83795
|
break;
|
|
83717
83796
|
case 171 /* PropertySignature */:
|
|
83718
|
-
if (!hasSyntacticModifier(parent,
|
|
83797
|
+
if (!hasSyntacticModifier(parent, 8 /* Readonly */)) {
|
|
83719
83798
|
return grammarErrorOnNode(parent.name, Diagnostics.A_property_of_an_interface_or_type_literal_whose_type_is_a_unique_symbol_type_must_be_readonly);
|
|
83720
83799
|
}
|
|
83721
83800
|
break;
|
|
@@ -83885,7 +83964,7 @@ function createTypeChecker(host) {
|
|
|
83885
83964
|
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;
|
|
83886
83965
|
return grammarErrorOnNode(node.exclamationToken, message);
|
|
83887
83966
|
}
|
|
83888
|
-
if ((moduleKind < 5 /* ES2015 */ || getSourceFileOfNode(node).impliedNodeFormat === 1 /* CommonJS */) && moduleKind !== 4 /* System */ && !(node.parent.parent.flags & 33554432 /* Ambient */) && hasSyntacticModifier(node.parent.parent,
|
|
83967
|
+
if ((moduleKind < 5 /* ES2015 */ || getSourceFileOfNode(node).impliedNodeFormat === 1 /* CommonJS */) && moduleKind !== 4 /* System */ && !(node.parent.parent.flags & 33554432 /* Ambient */) && hasSyntacticModifier(node.parent.parent, 32 /* Export */)) {
|
|
83889
83968
|
checkESModuleMarker(node.name);
|
|
83890
83969
|
}
|
|
83891
83970
|
return !!blockScopeKind && checkGrammarNameInLetOrConstDeclarations(node.name);
|
|
@@ -84075,7 +84154,7 @@ function createTypeChecker(host) {
|
|
|
84075
84154
|
}
|
|
84076
84155
|
}
|
|
84077
84156
|
function checkGrammarTopLevelElementForRequiredDeclareModifier(node) {
|
|
84078
|
-
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,
|
|
84157
|
+
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 */)) {
|
|
84079
84158
|
return false;
|
|
84080
84159
|
}
|
|
84081
84160
|
return grammarErrorOnFirstToken(node, Diagnostics.Top_level_declarations_in_d_ts_files_must_start_with_either_a_declare_or_export_modifier);
|
|
@@ -84390,12 +84469,14 @@ var SymbolTrackerImpl = class _SymbolTrackerImpl {
|
|
|
84390
84469
|
this.canTrackSymbol = !!((_a = this.inner) == null ? void 0 : _a.trackSymbol);
|
|
84391
84470
|
}
|
|
84392
84471
|
trackSymbol(symbol, enclosingDeclaration, meaning) {
|
|
84393
|
-
var _a;
|
|
84472
|
+
var _a, _b;
|
|
84394
84473
|
if (((_a = this.inner) == null ? void 0 : _a.trackSymbol) && !this.disableTrackSymbol) {
|
|
84395
84474
|
if (this.inner.trackSymbol(symbol, enclosingDeclaration, meaning)) {
|
|
84396
84475
|
this.onDiagnosticReported();
|
|
84397
84476
|
return true;
|
|
84398
84477
|
}
|
|
84478
|
+
if (!(symbol.flags & 262144 /* TypeParameter */))
|
|
84479
|
+
((_b = this.context).trackedSymbols ?? (_b.trackedSymbols = [])).push([symbol, enclosingDeclaration, meaning]);
|
|
84399
84480
|
}
|
|
84400
84481
|
return false;
|
|
84401
84482
|
}
|
|
@@ -86280,15 +86361,15 @@ function collectExternalModuleInfo(context, sourceFile) {
|
|
|
86280
86361
|
}
|
|
86281
86362
|
break;
|
|
86282
86363
|
case 243 /* VariableStatement */:
|
|
86283
|
-
if (hasSyntacticModifier(node,
|
|
86364
|
+
if (hasSyntacticModifier(node, 32 /* Export */)) {
|
|
86284
86365
|
for (const decl of node.declarationList.declarations) {
|
|
86285
86366
|
exportedNames = collectExportedVariableInfo(decl, uniqueExports, exportedNames, exportedBindings);
|
|
86286
86367
|
}
|
|
86287
86368
|
}
|
|
86288
86369
|
break;
|
|
86289
86370
|
case 262 /* FunctionDeclaration */:
|
|
86290
|
-
if (hasSyntacticModifier(node,
|
|
86291
|
-
if (hasSyntacticModifier(node,
|
|
86371
|
+
if (hasSyntacticModifier(node, 32 /* Export */)) {
|
|
86372
|
+
if (hasSyntacticModifier(node, 2048 /* Default */)) {
|
|
86292
86373
|
if (!hasExportDefault) {
|
|
86293
86374
|
multiMapSparseArrayAdd(exportedBindings, getOriginalNodeId(node), context.factory.getDeclarationName(node));
|
|
86294
86375
|
hasExportDefault = true;
|
|
@@ -86304,8 +86385,8 @@ function collectExternalModuleInfo(context, sourceFile) {
|
|
|
86304
86385
|
}
|
|
86305
86386
|
break;
|
|
86306
86387
|
case 263 /* ClassDeclaration */:
|
|
86307
|
-
if (hasSyntacticModifier(node,
|
|
86308
|
-
if (hasSyntacticModifier(node,
|
|
86388
|
+
if (hasSyntacticModifier(node, 32 /* Export */)) {
|
|
86389
|
+
if (hasSyntacticModifier(node, 2048 /* Default */)) {
|
|
86309
86390
|
if (!hasExportDefault) {
|
|
86310
86391
|
multiMapSparseArrayAdd(exportedBindings, getOriginalNodeId(node), context.factory.getDeclarationName(node));
|
|
86311
86392
|
hasExportDefault = true;
|
|
@@ -87170,7 +87251,7 @@ function injectClassThisAssignmentIfMissing(factory2, node, classThis, thisExpre
|
|
|
87170
87251
|
// src/compiler/transformers/namedEvaluation.ts
|
|
87171
87252
|
function getAssignedNameOfIdentifier(factory2, name, expression) {
|
|
87172
87253
|
const original = getOriginalNode(skipOuterExpressions(expression));
|
|
87173
|
-
if ((isClassDeclaration(original) || isFunctionDeclaration(original)) && !original.name && hasSyntacticModifier(original,
|
|
87254
|
+
if ((isClassDeclaration(original) || isFunctionDeclaration(original)) && !original.name && hasSyntacticModifier(original, 2048 /* Default */)) {
|
|
87174
87255
|
return factory2.createStringLiteral("default");
|
|
87175
87256
|
}
|
|
87176
87257
|
return factory2.createStringLiteralFromNode(name);
|
|
@@ -87524,13 +87605,13 @@ function transformTypeScript(context) {
|
|
|
87524
87605
|
break;
|
|
87525
87606
|
case 263 /* ClassDeclaration */:
|
|
87526
87607
|
case 262 /* FunctionDeclaration */:
|
|
87527
|
-
if (hasSyntacticModifier(node,
|
|
87608
|
+
if (hasSyntacticModifier(node, 128 /* Ambient */)) {
|
|
87528
87609
|
break;
|
|
87529
87610
|
}
|
|
87530
87611
|
if (node.name) {
|
|
87531
87612
|
recordEmittedDeclarationInScope(node);
|
|
87532
87613
|
} else {
|
|
87533
|
-
Debug.assert(node.kind === 263 /* ClassDeclaration */ || hasSyntacticModifier(node,
|
|
87614
|
+
Debug.assert(node.kind === 263 /* ClassDeclaration */ || hasSyntacticModifier(node, 2048 /* Default */));
|
|
87534
87615
|
}
|
|
87535
87616
|
break;
|
|
87536
87617
|
}
|
|
@@ -87585,7 +87666,7 @@ function transformTypeScript(context) {
|
|
|
87585
87666
|
function namespaceElementVisitorWorker(node) {
|
|
87586
87667
|
if (node.kind === 278 /* ExportDeclaration */ || node.kind === 272 /* ImportDeclaration */ || node.kind === 273 /* ImportClause */ || node.kind === 271 /* ImportEqualsDeclaration */ && node.moduleReference.kind === 283 /* ExternalModuleReference */) {
|
|
87587
87668
|
return void 0;
|
|
87588
|
-
} else if (node.transformFlags & 1 /* ContainsTypeScript */ || hasSyntacticModifier(node,
|
|
87669
|
+
} else if (node.transformFlags & 1 /* ContainsTypeScript */ || hasSyntacticModifier(node, 32 /* Export */)) {
|
|
87589
87670
|
return visitTypeScript(node);
|
|
87590
87671
|
}
|
|
87591
87672
|
return node;
|
|
@@ -87643,7 +87724,7 @@ function transformTypeScript(context) {
|
|
|
87643
87724
|
function modifierVisitor(node) {
|
|
87644
87725
|
if (isDecorator(node))
|
|
87645
87726
|
return void 0;
|
|
87646
|
-
if (modifierToFlag(node.kind) &
|
|
87727
|
+
if (modifierToFlag(node.kind) & 28895 /* TypeScriptModifier */) {
|
|
87647
87728
|
return void 0;
|
|
87648
87729
|
} else if (currentNamespace && node.kind === 95 /* ExportKeyword */) {
|
|
87649
87730
|
return void 0;
|
|
@@ -87651,7 +87732,7 @@ function transformTypeScript(context) {
|
|
|
87651
87732
|
return node;
|
|
87652
87733
|
}
|
|
87653
87734
|
function visitTypeScript(node) {
|
|
87654
|
-
if (isStatement(node) && hasSyntacticModifier(node,
|
|
87735
|
+
if (isStatement(node) && hasSyntacticModifier(node, 128 /* Ambient */)) {
|
|
87655
87736
|
return factory2.createNotEmittedStatement(node);
|
|
87656
87737
|
}
|
|
87657
87738
|
switch (node.kind) {
|
|
@@ -88141,7 +88222,7 @@ function transformTypeScript(context) {
|
|
|
88141
88222
|
return !nodeIsMissing(node.body);
|
|
88142
88223
|
}
|
|
88143
88224
|
function visitPropertyDeclaration(node, parent) {
|
|
88144
|
-
const isAmbient = node.flags & 33554432 /* Ambient */ || hasSyntacticModifier(node,
|
|
88225
|
+
const isAmbient = node.flags & 33554432 /* Ambient */ || hasSyntacticModifier(node, 64 /* Abstract */);
|
|
88145
88226
|
if (isAmbient && !(legacyDecorators && hasDecorators(node))) {
|
|
88146
88227
|
return void 0;
|
|
88147
88228
|
}
|
|
@@ -88150,7 +88231,7 @@ function transformTypeScript(context) {
|
|
|
88150
88231
|
if (isAmbient) {
|
|
88151
88232
|
return factory2.updatePropertyDeclaration(
|
|
88152
88233
|
node,
|
|
88153
|
-
concatenate(modifiers, factory2.createModifiersFromModifierFlags(
|
|
88234
|
+
concatenate(modifiers, factory2.createModifiersFromModifierFlags(128 /* Ambient */)),
|
|
88154
88235
|
Debug.checkDefined(visitNode(node.name, visitor, isPropertyName)),
|
|
88155
88236
|
/*questionOrExclamationToken*/
|
|
88156
88237
|
void 0,
|
|
@@ -88313,7 +88394,7 @@ function transformTypeScript(context) {
|
|
|
88313
88394
|
);
|
|
88314
88395
|
}
|
|
88315
88396
|
function shouldEmitAccessorDeclaration(node) {
|
|
88316
|
-
return !(nodeIsMissing(node.body) && hasSyntacticModifier(node,
|
|
88397
|
+
return !(nodeIsMissing(node.body) && hasSyntacticModifier(node, 64 /* Abstract */));
|
|
88317
88398
|
}
|
|
88318
88399
|
function visitGetAccessor(node, parent) {
|
|
88319
88400
|
if (!(node.transformFlags & 1 /* ContainsTypeScript */)) {
|
|
@@ -89046,16 +89127,16 @@ function transformTypeScript(context) {
|
|
|
89046
89127
|
}
|
|
89047
89128
|
}
|
|
89048
89129
|
function isExportOfNamespace(node) {
|
|
89049
|
-
return currentNamespace !== void 0 && hasSyntacticModifier(node,
|
|
89130
|
+
return currentNamespace !== void 0 && hasSyntacticModifier(node, 32 /* Export */);
|
|
89050
89131
|
}
|
|
89051
89132
|
function isExternalModuleExport(node) {
|
|
89052
|
-
return currentNamespace === void 0 && hasSyntacticModifier(node,
|
|
89133
|
+
return currentNamespace === void 0 && hasSyntacticModifier(node, 32 /* Export */);
|
|
89053
89134
|
}
|
|
89054
89135
|
function isNamedExternalModuleExport(node) {
|
|
89055
|
-
return isExternalModuleExport(node) && !hasSyntacticModifier(node,
|
|
89136
|
+
return isExternalModuleExport(node) && !hasSyntacticModifier(node, 2048 /* Default */);
|
|
89056
89137
|
}
|
|
89057
89138
|
function isDefaultExternalModuleExport(node) {
|
|
89058
|
-
return isExternalModuleExport(node) && hasSyntacticModifier(node,
|
|
89139
|
+
return isExternalModuleExport(node) && hasSyntacticModifier(node, 2048 /* Default */);
|
|
89059
89140
|
}
|
|
89060
89141
|
function createExportMemberAssignmentStatement(node) {
|
|
89061
89142
|
const expression = factory2.createAssignment(
|
|
@@ -90388,8 +90469,8 @@ function transformClassFields(context) {
|
|
|
90388
90469
|
getClassLexicalEnvironment().classThis = node.emitNode.classThis;
|
|
90389
90470
|
}
|
|
90390
90471
|
const isClassWithConstructorReference = resolver.getNodeCheckFlags(node) & 262144 /* ContainsConstructorReference */;
|
|
90391
|
-
const isExport = hasSyntacticModifier(node,
|
|
90392
|
-
const isDefault = hasSyntacticModifier(node,
|
|
90472
|
+
const isExport = hasSyntacticModifier(node, 32 /* Export */);
|
|
90473
|
+
const isDefault = hasSyntacticModifier(node, 2048 /* Default */);
|
|
90393
90474
|
let modifiers = visitNodes2(node.modifiers, modifierVisitor, isModifier);
|
|
90394
90475
|
const heritageClauses = visitNodes2(node.heritageClauses, heritageClauseVisitor, isHeritageClause);
|
|
90395
90476
|
const { members, prologue } = transformClassMembers(node);
|
|
@@ -90935,7 +91016,7 @@ function transformClassFields(context) {
|
|
|
90935
91016
|
return void 0;
|
|
90936
91017
|
}
|
|
90937
91018
|
const propertyOriginalNode = getOriginalNode(property);
|
|
90938
|
-
if (hasSyntacticModifier(propertyOriginalNode,
|
|
91019
|
+
if (hasSyntacticModifier(propertyOriginalNode, 64 /* Abstract */)) {
|
|
90939
91020
|
return void 0;
|
|
90940
91021
|
}
|
|
90941
91022
|
let initializer = visitNode(property.initializer, visitor, isExpression);
|
|
@@ -91971,8 +92052,8 @@ function transformLegacyDecorators(context) {
|
|
|
91971
92052
|
return addRange([updated], decorationStatements);
|
|
91972
92053
|
}
|
|
91973
92054
|
function transformClassDeclarationWithClassDecorators(node, name) {
|
|
91974
|
-
const isExport = hasSyntacticModifier(node,
|
|
91975
|
-
const isDefault = hasSyntacticModifier(node,
|
|
92055
|
+
const isExport = hasSyntacticModifier(node, 32 /* Export */);
|
|
92056
|
+
const isDefault = hasSyntacticModifier(node, 2048 /* Default */);
|
|
91976
92057
|
const modifiers = visitNodes2(node.modifiers, (node2) => isExportOrDefaultModifier(node2) || isDecorator(node2) ? void 0 : node2, isModifierLike);
|
|
91977
92058
|
const location = moveRangePastModifiers(node);
|
|
91978
92059
|
const classAlias = getClassAliasIfNeeded(node);
|
|
@@ -91993,7 +92074,7 @@ function transformLegacyDecorators(context) {
|
|
|
91993
92074
|
let members = visitNodes2(node.members, visitor, isClassElement);
|
|
91994
92075
|
let decorationStatements = [];
|
|
91995
92076
|
({ members, decorationStatements } = transformDecoratorsOfClassElements(node, members));
|
|
91996
|
-
const assignClassAliasInStaticBlock = languageVersion >= 9 /* ES2022 */ && !!classAlias && some(members, (member) => isPropertyDeclaration(member) && hasSyntacticModifier(member,
|
|
92077
|
+
const assignClassAliasInStaticBlock = languageVersion >= 9 /* ES2022 */ && !!classAlias && some(members, (member) => isPropertyDeclaration(member) && hasSyntacticModifier(member, 256 /* Static */) || isClassStaticBlockDeclaration(member));
|
|
91997
92078
|
if (assignClassAliasInStaticBlock) {
|
|
91998
92079
|
members = setTextRange(
|
|
91999
92080
|
factory2.createNodeArray([
|
|
@@ -92124,7 +92205,7 @@ function transformLegacyDecorators(context) {
|
|
|
92124
92205
|
);
|
|
92125
92206
|
}
|
|
92126
92207
|
function visitPropertyDeclaration(node) {
|
|
92127
|
-
if (node.flags & 33554432 /* Ambient */ || hasSyntacticModifier(node,
|
|
92208
|
+
if (node.flags & 33554432 /* Ambient */ || hasSyntacticModifier(node, 128 /* Ambient */)) {
|
|
92128
92209
|
return void 0;
|
|
92129
92210
|
}
|
|
92130
92211
|
return finishClassElement(
|
|
@@ -92212,7 +92293,7 @@ function transformLegacyDecorators(context) {
|
|
|
92212
92293
|
const memberName = getExpressionForPropertyName(
|
|
92213
92294
|
member,
|
|
92214
92295
|
/*generateNameForComputedPropertyName*/
|
|
92215
|
-
!hasSyntacticModifier(member,
|
|
92296
|
+
!hasSyntacticModifier(member, 128 /* Ambient */)
|
|
92216
92297
|
);
|
|
92217
92298
|
const descriptor = languageVersion > 0 /* ES3 */ ? isPropertyDeclaration(member) && !hasAccessorModifier(member) ? factory2.createVoidZero() : factory2.createNull() : void 0;
|
|
92218
92299
|
const helper = emitHelpers().createDecorateHelper(
|
|
@@ -92995,8 +93076,8 @@ function transformESDecorators(context) {
|
|
|
92995
93076
|
const statements = [];
|
|
92996
93077
|
const originalClass = getOriginalNode(node, isClassLike) ?? node;
|
|
92997
93078
|
const className = originalClass.name ? factory2.createStringLiteralFromNode(originalClass.name) : factory2.createStringLiteral("default");
|
|
92998
|
-
const isExport = hasSyntacticModifier(node,
|
|
92999
|
-
const isDefault = hasSyntacticModifier(node,
|
|
93079
|
+
const isExport = hasSyntacticModifier(node, 32 /* Export */);
|
|
93080
|
+
const isDefault = hasSyntacticModifier(node, 2048 /* Default */);
|
|
93000
93081
|
if (!node.name) {
|
|
93001
93082
|
node = injectClassNamedEvaluationHelperBlockIfMissing(context, node, className);
|
|
93002
93083
|
}
|
|
@@ -95307,7 +95388,7 @@ function transformES2018(context) {
|
|
|
95307
95388
|
return visitEachChild(node, visitor, context);
|
|
95308
95389
|
}
|
|
95309
95390
|
function visitVariableStatement(node) {
|
|
95310
|
-
if (hasSyntacticModifier(node,
|
|
95391
|
+
if (hasSyntacticModifier(node, 32 /* Export */)) {
|
|
95311
95392
|
const savedExportedVariableStatement = exportedVariableStatement;
|
|
95312
95393
|
exportedVariableStatement = true;
|
|
95313
95394
|
const visited = visitEachChild(node, visitor, context);
|
|
@@ -96519,7 +96600,7 @@ function transformESNext(context) {
|
|
|
96519
96600
|
addRange(topLevelStatements, endLexicalEnvironment());
|
|
96520
96601
|
if (exportVars.length) {
|
|
96521
96602
|
topLevelStatements.push(factory2.createVariableStatement(
|
|
96522
|
-
factory2.createModifiersFromModifierFlags(
|
|
96603
|
+
factory2.createModifiersFromModifierFlags(32 /* Export */),
|
|
96523
96604
|
factory2.createVariableDeclarationList(
|
|
96524
96605
|
exportVars,
|
|
96525
96606
|
1 /* Let */
|
|
@@ -96816,8 +96897,8 @@ function transformESNext(context) {
|
|
|
96816
96897
|
if (!node.name && defaultExportBinding) {
|
|
96817
96898
|
return node;
|
|
96818
96899
|
}
|
|
96819
|
-
const isExported = hasSyntacticModifier(node,
|
|
96820
|
-
const isDefault = hasSyntacticModifier(node,
|
|
96900
|
+
const isExported = hasSyntacticModifier(node, 32 /* Export */);
|
|
96901
|
+
const isDefault = hasSyntacticModifier(node, 2048 /* Default */);
|
|
96821
96902
|
let expression = factory2.converters.convertToClassExpression(node);
|
|
96822
96903
|
if (node.name) {
|
|
96823
96904
|
hoistBindingIdentifier(
|
|
@@ -96865,7 +96946,7 @@ function transformESNext(context) {
|
|
|
96865
96946
|
}
|
|
96866
96947
|
function hoistVariableStatement(node) {
|
|
96867
96948
|
let expressions;
|
|
96868
|
-
const isExported = hasSyntacticModifier(node,
|
|
96949
|
+
const isExported = hasSyntacticModifier(node, 32 /* Export */);
|
|
96869
96950
|
for (const variable of node.declarationList.declarations) {
|
|
96870
96951
|
hoistBindingElement(variable, isExported, variable);
|
|
96871
96952
|
if (variable.initializer) {
|
|
@@ -98397,8 +98478,8 @@ function transformES2015(context) {
|
|
|
98397
98478
|
setTextRange(statement, node);
|
|
98398
98479
|
startOnNewLine(statement);
|
|
98399
98480
|
statements.push(statement);
|
|
98400
|
-
if (hasSyntacticModifier(node,
|
|
98401
|
-
const exportStatement = hasSyntacticModifier(node,
|
|
98481
|
+
if (hasSyntacticModifier(node, 32 /* Export */)) {
|
|
98482
|
+
const exportStatement = hasSyntacticModifier(node, 2048 /* Default */) ? factory2.createExportDefault(factory2.getLocalName(node)) : factory2.createExternalModuleExport(factory2.getLocalName(node));
|
|
98402
98483
|
setOriginalNode(exportStatement, statement);
|
|
98403
98484
|
statements.push(exportStatement);
|
|
98404
98485
|
}
|
|
@@ -99590,7 +99671,7 @@ function transformES2015(context) {
|
|
|
99590
99671
|
return node.declarationList.declarations.length === 1 && !!node.declarationList.declarations[0].initializer && !!(getInternalEmitFlags(node.declarationList.declarations[0].initializer) & 1 /* TypeScriptClassWrapper */);
|
|
99591
99672
|
}
|
|
99592
99673
|
function visitVariableStatement(node) {
|
|
99593
|
-
const ancestorFacts = enterSubtree(0 /* None */, hasSyntacticModifier(node,
|
|
99674
|
+
const ancestorFacts = enterSubtree(0 /* None */, hasSyntacticModifier(node, 32 /* Export */) ? 32 /* ExportedVariableStatement */ : 0 /* None */);
|
|
99594
99675
|
let updated;
|
|
99595
99676
|
if (convertedLoopState && (node.declarationList.flags & 7 /* BlockScoped */) === 0 && !isVariableStatementOfTypeScriptClassWrapper(node)) {
|
|
99596
99677
|
let assignments;
|
|
@@ -104539,7 +104620,7 @@ function transformModule(context) {
|
|
|
104539
104620
|
Debug.assert(isExternalModuleImportEqualsDeclaration(node), "import= for internal module references should be handled in an earlier transformer.");
|
|
104540
104621
|
let statements;
|
|
104541
104622
|
if (moduleKind !== 2 /* AMD */) {
|
|
104542
|
-
if (hasSyntacticModifier(node,
|
|
104623
|
+
if (hasSyntacticModifier(node, 32 /* Export */)) {
|
|
104543
104624
|
statements = append(
|
|
104544
104625
|
statements,
|
|
104545
104626
|
setOriginalNode(
|
|
@@ -104585,7 +104666,7 @@ function transformModule(context) {
|
|
|
104585
104666
|
);
|
|
104586
104667
|
}
|
|
104587
104668
|
} else {
|
|
104588
|
-
if (hasSyntacticModifier(node,
|
|
104669
|
+
if (hasSyntacticModifier(node, 32 /* Export */)) {
|
|
104589
104670
|
statements = append(
|
|
104590
104671
|
statements,
|
|
104591
104672
|
setOriginalNode(
|
|
@@ -104723,7 +104804,7 @@ function transformModule(context) {
|
|
|
104723
104804
|
}
|
|
104724
104805
|
function visitFunctionDeclaration(node) {
|
|
104725
104806
|
let statements;
|
|
104726
|
-
if (hasSyntacticModifier(node,
|
|
104807
|
+
if (hasSyntacticModifier(node, 32 /* Export */)) {
|
|
104727
104808
|
statements = append(
|
|
104728
104809
|
statements,
|
|
104729
104810
|
setOriginalNode(
|
|
@@ -104760,7 +104841,7 @@ function transformModule(context) {
|
|
|
104760
104841
|
}
|
|
104761
104842
|
function visitClassDeclaration(node) {
|
|
104762
104843
|
let statements;
|
|
104763
|
-
if (hasSyntacticModifier(node,
|
|
104844
|
+
if (hasSyntacticModifier(node, 32 /* Export */)) {
|
|
104764
104845
|
statements = append(
|
|
104765
104846
|
statements,
|
|
104766
104847
|
setOriginalNode(
|
|
@@ -104794,7 +104875,7 @@ function transformModule(context) {
|
|
|
104794
104875
|
let statements;
|
|
104795
104876
|
let variables;
|
|
104796
104877
|
let expressions;
|
|
104797
|
-
if (hasSyntacticModifier(node,
|
|
104878
|
+
if (hasSyntacticModifier(node, 32 /* Export */)) {
|
|
104798
104879
|
let modifiers;
|
|
104799
104880
|
let removeCommentsOnExpressions = false;
|
|
104800
104881
|
for (const variable of node.declarationList.declarations) {
|
|
@@ -104980,8 +105061,8 @@ function transformModule(context) {
|
|
|
104980
105061
|
return statements;
|
|
104981
105062
|
}
|
|
104982
105063
|
const seen = new IdentifierNameMap();
|
|
104983
|
-
if (hasSyntacticModifier(decl,
|
|
104984
|
-
const exportName = hasSyntacticModifier(decl,
|
|
105064
|
+
if (hasSyntacticModifier(decl, 32 /* Export */)) {
|
|
105065
|
+
const exportName = hasSyntacticModifier(decl, 2048 /* Default */) ? factory2.createIdentifier("default") : factory2.getDeclarationName(decl);
|
|
104985
105066
|
statements = appendExportStatement(
|
|
104986
105067
|
statements,
|
|
104987
105068
|
seen,
|
|
@@ -105468,7 +105549,7 @@ function transformSystemModule(context) {
|
|
|
105468
105549
|
addRange(statements, hoistedStatements);
|
|
105469
105550
|
insertStatementsAfterStandardPrologue(statements, endLexicalEnvironment());
|
|
105470
105551
|
const exportStarFunction = addExportStarIfNeeded(statements);
|
|
105471
|
-
const modifiers = node.transformFlags & 2097152 /* ContainsAwait */ ? factory2.createModifiersFromModifierFlags(
|
|
105552
|
+
const modifiers = node.transformFlags & 2097152 /* ContainsAwait */ ? factory2.createModifiersFromModifierFlags(1024 /* Async */) : void 0;
|
|
105472
105553
|
const moduleObject = factory2.createObjectLiteralExpression(
|
|
105473
105554
|
[
|
|
105474
105555
|
factory2.createPropertyAssignment("setters", createSettersArray(exportStarFunction, dependencyGroups)),
|
|
@@ -105670,7 +105751,7 @@ function transformSystemModule(context) {
|
|
|
105670
105751
|
factory2.createAssignment(importVariableName, parameterName)
|
|
105671
105752
|
)
|
|
105672
105753
|
);
|
|
105673
|
-
if (hasSyntacticModifier(entry,
|
|
105754
|
+
if (hasSyntacticModifier(entry, 32 /* Export */)) {
|
|
105674
105755
|
statements.push(
|
|
105675
105756
|
factory2.createExpressionStatement(
|
|
105676
105757
|
factory2.createCallExpression(
|
|
@@ -105823,7 +105904,7 @@ function transformSystemModule(context) {
|
|
|
105823
105904
|
);
|
|
105824
105905
|
}
|
|
105825
105906
|
function visitFunctionDeclaration(node) {
|
|
105826
|
-
if (hasSyntacticModifier(node,
|
|
105907
|
+
if (hasSyntacticModifier(node, 32 /* Export */)) {
|
|
105827
105908
|
hoistedStatements = append(
|
|
105828
105909
|
hoistedStatements,
|
|
105829
105910
|
factory2.updateFunctionDeclaration(
|
|
@@ -105910,7 +105991,7 @@ function transformSystemModule(context) {
|
|
|
105910
105991
|
statements = append(statements, factory2.updateVariableStatement(node, modifiers, declarationList));
|
|
105911
105992
|
} else {
|
|
105912
105993
|
let expressions;
|
|
105913
|
-
const isExportedDeclaration = hasSyntacticModifier(node,
|
|
105994
|
+
const isExportedDeclaration = hasSyntacticModifier(node, 32 /* Export */);
|
|
105914
105995
|
for (const variable of node.declarationList.declarations) {
|
|
105915
105996
|
if (variable.initializer) {
|
|
105916
105997
|
expressions = append(expressions, transformInitializedVariable(variable, isExportedDeclaration));
|
|
@@ -106046,8 +106127,8 @@ function transformSystemModule(context) {
|
|
|
106046
106127
|
return statements;
|
|
106047
106128
|
}
|
|
106048
106129
|
let excludeName;
|
|
106049
|
-
if (hasSyntacticModifier(decl,
|
|
106050
|
-
const exportName = hasSyntacticModifier(decl,
|
|
106130
|
+
if (hasSyntacticModifier(decl, 32 /* Export */)) {
|
|
106131
|
+
const exportName = hasSyntacticModifier(decl, 2048 /* Default */) ? factory2.createStringLiteral("default") : decl.name;
|
|
106051
106132
|
statements = appendExportStatement(statements, exportName, factory2.getLocalName(decl));
|
|
106052
106133
|
excludeName = getTextOfIdentifierOrLiteral(exportName);
|
|
106053
106134
|
}
|
|
@@ -106792,7 +106873,7 @@ function transformECMAScriptModule(context) {
|
|
|
106792
106873
|
return singleOrMany(statements);
|
|
106793
106874
|
}
|
|
106794
106875
|
function appendExportsOfImportEqualsDeclaration(statements, node) {
|
|
106795
|
-
if (hasSyntacticModifier(node,
|
|
106876
|
+
if (hasSyntacticModifier(node, 32 /* Export */)) {
|
|
106796
106877
|
statements = append(
|
|
106797
106878
|
statements,
|
|
106798
106879
|
factory2.createExportDeclaration(
|
|
@@ -107002,7 +107083,7 @@ function createGetSymbolAccessibilityDiagnosticForNode(node) {
|
|
|
107002
107083
|
} else if (isConstructSignatureDeclaration(node) || isCallSignatureDeclaration(node) || isMethodDeclaration(node) || isMethodSignature(node) || isFunctionDeclaration(node) || isIndexSignatureDeclaration(node)) {
|
|
107003
107084
|
return getReturnTypeVisibilityError;
|
|
107004
107085
|
} else if (isParameter(node)) {
|
|
107005
|
-
if (isParameterPropertyDeclaration(node, node.parent) && hasSyntacticModifier(node.parent,
|
|
107086
|
+
if (isParameterPropertyDeclaration(node, node.parent) && hasSyntacticModifier(node.parent, 2 /* Private */)) {
|
|
107006
107087
|
return getVariableDeclarationTypeVisibilityError;
|
|
107007
107088
|
}
|
|
107008
107089
|
return getParameterDeclarationTypeVisibilityError;
|
|
@@ -107020,7 +107101,7 @@ function createGetSymbolAccessibilityDiagnosticForNode(node) {
|
|
|
107020
107101
|
function getVariableDeclarationTypeVisibilityDiagnosticMessage(symbolAccessibilityResult) {
|
|
107021
107102
|
if (node.kind === 260 /* VariableDeclaration */ || node.kind === 208 /* BindingElement */) {
|
|
107022
107103
|
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;
|
|
107023
|
-
} 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,
|
|
107104
|
+
} 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 */)) {
|
|
107024
107105
|
if (isStatic(node)) {
|
|
107025
107106
|
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;
|
|
107026
107107
|
} else if (node.parent.kind === 263 /* ClassDeclaration */ || node.kind === 169 /* Parameter */) {
|
|
@@ -107741,7 +107822,7 @@ function transformDeclarations(context) {
|
|
|
107741
107822
|
return void 0;
|
|
107742
107823
|
}
|
|
107743
107824
|
function ensureType(node, type, ignorePrivate) {
|
|
107744
|
-
if (!ignorePrivate && hasEffectiveModifier(node,
|
|
107825
|
+
if (!ignorePrivate && hasEffectiveModifier(node, 2 /* Private */)) {
|
|
107745
107826
|
return;
|
|
107746
107827
|
}
|
|
107747
107828
|
if (shouldPrintWithInitializer(node)) {
|
|
@@ -107821,7 +107902,7 @@ function transformDeclarations(context) {
|
|
|
107821
107902
|
}
|
|
107822
107903
|
}
|
|
107823
107904
|
function updateParamsList(node, params, modifierMask) {
|
|
107824
|
-
if (hasEffectiveModifier(node,
|
|
107905
|
+
if (hasEffectiveModifier(node, 2 /* Private */)) {
|
|
107825
107906
|
return factory2.createNodeArray();
|
|
107826
107907
|
}
|
|
107827
107908
|
const newParams = map(params, (p) => ensureParameter(p, modifierMask));
|
|
@@ -107866,7 +107947,7 @@ function transformDeclarations(context) {
|
|
|
107866
107947
|
return factory2.createNodeArray(newParams || emptyArray);
|
|
107867
107948
|
}
|
|
107868
107949
|
function ensureTypeParams(node, params) {
|
|
107869
|
-
return hasEffectiveModifier(node,
|
|
107950
|
+
return hasEffectiveModifier(node, 2 /* Private */) ? void 0 : visitNodes2(params, visitDeclarationSubtree, isTypeParameterDeclaration);
|
|
107870
107951
|
}
|
|
107871
107952
|
function isEnclosingDeclaration(node) {
|
|
107872
107953
|
return isSourceFile(node) || isTypeAliasDeclaration(node) || isModuleDeclaration(node) || isClassDeclaration(node) || isInterfaceDeclaration(node) || isFunctionLike(node) || isIndexSignatureDeclaration(node) || isMappedTypeNode(node);
|
|
@@ -108052,7 +108133,7 @@ function transformDeclarations(context) {
|
|
|
108052
108133
|
const oldWithinObjectLiteralType = suppressNewDiagnosticContexts;
|
|
108053
108134
|
let shouldEnterSuppressNewDiagnosticsContextContext = (input.kind === 187 /* TypeLiteral */ || input.kind === 200 /* MappedType */) && input.parent.kind !== 265 /* TypeAliasDeclaration */;
|
|
108054
108135
|
if (isMethodDeclaration(input) || isMethodSignature(input)) {
|
|
108055
|
-
if (hasEffectiveModifier(input,
|
|
108136
|
+
if (hasEffectiveModifier(input, 2 /* Private */)) {
|
|
108056
108137
|
if (input.symbol && input.symbol.declarations && input.symbol.declarations[0] !== input)
|
|
108057
108138
|
return;
|
|
108058
108139
|
return cleanup(factory2.createPropertyDeclaration(
|
|
@@ -108140,7 +108221,7 @@ function transformDeclarations(context) {
|
|
|
108140
108221
|
input,
|
|
108141
108222
|
ensureModifiers(input),
|
|
108142
108223
|
input.name,
|
|
108143
|
-
updateAccessorParamsList(input, hasEffectiveModifier(input,
|
|
108224
|
+
updateAccessorParamsList(input, hasEffectiveModifier(input, 2 /* Private */)),
|
|
108144
108225
|
ensureType(input, accessorType),
|
|
108145
108226
|
/*body*/
|
|
108146
108227
|
void 0
|
|
@@ -108157,7 +108238,7 @@ function transformDeclarations(context) {
|
|
|
108157
108238
|
input,
|
|
108158
108239
|
ensureModifiers(input),
|
|
108159
108240
|
input.name,
|
|
108160
|
-
updateAccessorParamsList(input, hasEffectiveModifier(input,
|
|
108241
|
+
updateAccessorParamsList(input, hasEffectiveModifier(input, 2 /* Private */)),
|
|
108161
108242
|
/*body*/
|
|
108162
108243
|
void 0
|
|
108163
108244
|
));
|
|
@@ -108314,7 +108395,7 @@ function transformDeclarations(context) {
|
|
|
108314
108395
|
}
|
|
108315
108396
|
}
|
|
108316
108397
|
function isPrivateMethodTypeParameter(node) {
|
|
108317
|
-
return node.parent.kind === 174 /* MethodDeclaration */ && hasEffectiveModifier(node.parent,
|
|
108398
|
+
return node.parent.kind === 174 /* MethodDeclaration */ && hasEffectiveModifier(node.parent, 2 /* Private */);
|
|
108318
108399
|
}
|
|
108319
108400
|
function visitDeclarationStatements(input) {
|
|
108320
108401
|
if (!isPreservedDeclarationStatement(input)) {
|
|
@@ -108373,10 +108454,10 @@ function transformDeclarations(context) {
|
|
|
108373
108454
|
return input;
|
|
108374
108455
|
}
|
|
108375
108456
|
function stripExportModifiers(statement) {
|
|
108376
|
-
if (isImportEqualsDeclaration(statement) || hasEffectiveModifier(statement,
|
|
108457
|
+
if (isImportEqualsDeclaration(statement) || hasEffectiveModifier(statement, 2048 /* Default */) || !canHaveModifiers(statement)) {
|
|
108377
108458
|
return statement;
|
|
108378
108459
|
}
|
|
108379
|
-
const modifiers = factory2.createModifiersFromModifierFlags(getEffectiveModifierFlags(statement) & (
|
|
108460
|
+
const modifiers = factory2.createModifiersFromModifierFlags(getEffectiveModifierFlags(statement) & (131071 /* All */ ^ 32 /* Export */));
|
|
108380
108461
|
return factory2.replaceModifiers(statement, modifiers);
|
|
108381
108462
|
}
|
|
108382
108463
|
function updateModuleDeclarationAndKeyword(node, modifiers, name, body) {
|
|
@@ -108526,10 +108607,10 @@ function transformDeclarations(context) {
|
|
|
108526
108607
|
));
|
|
108527
108608
|
}
|
|
108528
108609
|
const namespaceDecl = factory2.createModuleDeclaration(ensureModifiers(input), input.name, factory2.createModuleBlock(declarations), 32 /* Namespace */);
|
|
108529
|
-
if (!hasEffectiveModifier(clean2,
|
|
108610
|
+
if (!hasEffectiveModifier(clean2, 2048 /* Default */)) {
|
|
108530
108611
|
return [clean2, namespaceDecl];
|
|
108531
108612
|
}
|
|
108532
|
-
const modifiers = factory2.createModifiersFromModifierFlags(getEffectiveModifierFlags(clean2) & ~
|
|
108613
|
+
const modifiers = factory2.createModifiersFromModifierFlags(getEffectiveModifierFlags(clean2) & ~2080 /* ExportDefault */ | 128 /* Ambient */);
|
|
108533
108614
|
const cleanDeclaration = factory2.updateFunctionDeclaration(
|
|
108534
108615
|
clean2,
|
|
108535
108616
|
modifiers,
|
|
@@ -108621,7 +108702,7 @@ function transformDeclarations(context) {
|
|
|
108621
108702
|
if (ctor) {
|
|
108622
108703
|
const oldDiag2 = getSymbolAccessibilityDiagnostic;
|
|
108623
108704
|
parameterProperties = compact(flatMap(ctor.parameters, (param) => {
|
|
108624
|
-
if (!hasSyntacticModifier(param,
|
|
108705
|
+
if (!hasSyntacticModifier(param, 31 /* ParameterPropertyModifier */) || shouldStripInternal(param))
|
|
108625
108706
|
return;
|
|
108626
108707
|
getSymbolAccessibilityDiagnostic = createGetSymbolAccessibilityDiagnosticForNode(param);
|
|
108627
108708
|
if (param.name.kind === 80 /* Identifier */) {
|
|
@@ -108850,11 +108931,11 @@ function transformDeclarations(context) {
|
|
|
108850
108931
|
return factory2.createModifiersFromModifierFlags(newFlags);
|
|
108851
108932
|
}
|
|
108852
108933
|
function ensureModifierFlags(node) {
|
|
108853
|
-
let mask =
|
|
108854
|
-
let additions = needsDeclare && !isAlwaysType(node) ?
|
|
108934
|
+
let mask = 131071 /* All */ ^ (1 /* Public */ | 1024 /* Async */ | 16 /* Override */);
|
|
108935
|
+
let additions = needsDeclare && !isAlwaysType(node) ? 128 /* Ambient */ : 0 /* None */;
|
|
108855
108936
|
const parentIsFile = node.parent.kind === 312 /* SourceFile */;
|
|
108856
108937
|
if (!parentIsFile || isBundledEmit && parentIsFile && isExternalModule(node.parent)) {
|
|
108857
|
-
mask ^=
|
|
108938
|
+
mask ^= 128 /* Ambient */;
|
|
108858
108939
|
additions = 0 /* None */;
|
|
108859
108940
|
}
|
|
108860
108941
|
return maskModifierFlags(node, mask, additions);
|
|
@@ -108896,13 +108977,13 @@ function isAlwaysType(node) {
|
|
|
108896
108977
|
function maskModifiers(factory2, node, modifierMask, modifierAdditions) {
|
|
108897
108978
|
return factory2.createModifiersFromModifierFlags(maskModifierFlags(node, modifierMask, modifierAdditions));
|
|
108898
108979
|
}
|
|
108899
|
-
function maskModifierFlags(node, modifierMask =
|
|
108980
|
+
function maskModifierFlags(node, modifierMask = 131071 /* All */ ^ 1 /* Public */, modifierAdditions = 0 /* None */) {
|
|
108900
108981
|
let flags = getEffectiveModifierFlags(node) & modifierMask | modifierAdditions;
|
|
108901
|
-
if (flags &
|
|
108902
|
-
flags ^=
|
|
108982
|
+
if (flags & 2048 /* Default */ && !(flags & 32 /* Export */)) {
|
|
108983
|
+
flags ^= 32 /* Export */;
|
|
108903
108984
|
}
|
|
108904
|
-
if (flags &
|
|
108905
|
-
flags ^=
|
|
108985
|
+
if (flags & 2048 /* Default */ && flags & 128 /* Ambient */) {
|
|
108986
|
+
flags ^= 128 /* Ambient */;
|
|
108906
108987
|
}
|
|
108907
108988
|
return flags;
|
|
108908
108989
|
}
|
|
@@ -108915,7 +108996,7 @@ function canHaveLiteralInitializer(node) {
|
|
|
108915
108996
|
switch (node.kind) {
|
|
108916
108997
|
case 172 /* PropertyDeclaration */:
|
|
108917
108998
|
case 171 /* PropertySignature */:
|
|
108918
|
-
return !hasEffectiveModifier(node,
|
|
108999
|
+
return !hasEffectiveModifier(node, 2 /* Private */);
|
|
108919
109000
|
case 169 /* Parameter */:
|
|
108920
109001
|
case 260 /* VariableDeclaration */:
|
|
108921
109002
|
return true;
|
|
@@ -117674,7 +117755,7 @@ function createProgram(rootNamesOrOptions, _options, _host, _oldProgram, _config
|
|
|
117674
117755
|
}
|
|
117675
117756
|
}
|
|
117676
117757
|
} else if (isModuleDeclaration(node)) {
|
|
117677
|
-
if (isAmbientModule(node) && (inAmbientModule || hasSyntacticModifier(node,
|
|
117758
|
+
if (isAmbientModule(node) && (inAmbientModule || hasSyntacticModifier(node, 128 /* Ambient */) || file.isDeclarationFile)) {
|
|
117678
117759
|
node.name.parent = node;
|
|
117679
117760
|
const nameText = getTextOfIdentifierOrLiteral(node.name);
|
|
117680
117761
|
if (isExternalModuleFile || inAmbientModule && !isExternalModuleNameRelative(nameText)) {
|