@typescript-deploys/pr-build 5.5.0-pr-58203-3 → 5.5.0-pr-58264-13
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 +1909 -126
- package/lib/typescript.d.ts +1 -0
- package/lib/typescript.js +1965 -130
- package/package.json +2 -3
package/lib/typescript.js
CHANGED
|
@@ -146,6 +146,7 @@ __export(typescript_exports, {
|
|
|
146
146
|
ProcessLevel: () => ProcessLevel,
|
|
147
147
|
ProgramUpdateLevel: () => ProgramUpdateLevel,
|
|
148
148
|
QuotePreference: () => QuotePreference,
|
|
149
|
+
RegularExpressionFlags: () => RegularExpressionFlags,
|
|
149
150
|
RelationComparisonResult: () => RelationComparisonResult,
|
|
150
151
|
Rename: () => ts_Rename_exports,
|
|
151
152
|
ScriptElementKind: () => ScriptElementKind,
|
|
@@ -274,6 +275,7 @@ __export(typescript_exports, {
|
|
|
274
275
|
changeFullExtension: () => changeFullExtension,
|
|
275
276
|
changesAffectModuleResolution: () => changesAffectModuleResolution,
|
|
276
277
|
changesAffectingProgramStructure: () => changesAffectingProgramStructure,
|
|
278
|
+
characterToRegularExpressionFlag: () => characterToRegularExpressionFlag,
|
|
277
279
|
childIsDecorated: () => childIsDecorated,
|
|
278
280
|
classElementOrClassElementParameterIsDecorated: () => classElementOrClassElementParameterIsDecorated,
|
|
279
281
|
classHasClassThisAssignment: () => classHasClassThisAssignment,
|
|
@@ -419,6 +421,7 @@ __export(typescript_exports, {
|
|
|
419
421
|
createForOfBindingStatement: () => createForOfBindingStatement,
|
|
420
422
|
createFutureSourceFile: () => createFutureSourceFile,
|
|
421
423
|
createGetCanonicalFileName: () => createGetCanonicalFileName,
|
|
424
|
+
createGetIsolatedDeclarationErrors: () => createGetIsolatedDeclarationErrors,
|
|
422
425
|
createGetSourceFile: () => createGetSourceFile,
|
|
423
426
|
createGetSymbolAccessibilityDiagnosticForNode: () => createGetSymbolAccessibilityDiagnosticForNode,
|
|
424
427
|
createGetSymbolAccessibilityDiagnosticForNodeName: () => createGetSymbolAccessibilityDiagnosticForNodeName,
|
|
@@ -473,6 +476,7 @@ __export(typescript_exports, {
|
|
|
473
476
|
createSuperAccessVariableStatement: () => createSuperAccessVariableStatement,
|
|
474
477
|
createSymbolTable: () => createSymbolTable,
|
|
475
478
|
createSymlinkCache: () => createSymlinkCache,
|
|
479
|
+
createSyntacticTypeNodeBuilder: () => createSyntacticTypeNodeBuilder,
|
|
476
480
|
createSystemWatchFunctions: () => createSystemWatchFunctions,
|
|
477
481
|
createTextChange: () => createTextChange,
|
|
478
482
|
createTextChangeFromStartLength: () => createTextChangeFromStartLength,
|
|
@@ -912,6 +916,7 @@ __export(typescript_exports, {
|
|
|
912
916
|
getNameOfDeclaration: () => getNameOfDeclaration,
|
|
913
917
|
getNameOfExpando: () => getNameOfExpando,
|
|
914
918
|
getNameOfJSDocTypedef: () => getNameOfJSDocTypedef,
|
|
919
|
+
getNameOfScriptTarget: () => getNameOfScriptTarget,
|
|
915
920
|
getNameOrArgument: () => getNameOrArgument,
|
|
916
921
|
getNameTable: () => getNameTable,
|
|
917
922
|
getNamesForExportedSymbol: () => getNamesForExportedSymbol,
|
|
@@ -1126,6 +1131,7 @@ __export(typescript_exports, {
|
|
|
1126
1131
|
hasEffectiveReadonlyModifier: () => hasEffectiveReadonlyModifier,
|
|
1127
1132
|
hasExtension: () => hasExtension,
|
|
1128
1133
|
hasIndexSignature: () => hasIndexSignature,
|
|
1134
|
+
hasInferredType: () => hasInferredType,
|
|
1129
1135
|
hasInitializer: () => hasInitializer,
|
|
1130
1136
|
hasInvalidEscape: () => hasInvalidEscape,
|
|
1131
1137
|
hasJSDocNodes: () => hasJSDocNodes,
|
|
@@ -1686,6 +1692,7 @@ __export(typescript_exports, {
|
|
|
1686
1692
|
isPossiblyTypeArgumentPosition: () => isPossiblyTypeArgumentPosition,
|
|
1687
1693
|
isPostfixUnaryExpression: () => isPostfixUnaryExpression,
|
|
1688
1694
|
isPrefixUnaryExpression: () => isPrefixUnaryExpression,
|
|
1695
|
+
isPrimitiveLiteralValue: () => isPrimitiveLiteralValue,
|
|
1689
1696
|
isPrivateIdentifier: () => isPrivateIdentifier,
|
|
1690
1697
|
isPrivateIdentifierClassElementDeclaration: () => isPrivateIdentifierClassElementDeclaration,
|
|
1691
1698
|
isPrivateIdentifierPropertyAccessExpression: () => isPrivateIdentifierPropertyAccessExpression,
|
|
@@ -1852,6 +1859,7 @@ __export(typescript_exports, {
|
|
|
1852
1859
|
isValueSignatureDeclaration: () => isValueSignatureDeclaration,
|
|
1853
1860
|
isVarAwaitUsing: () => isVarAwaitUsing,
|
|
1854
1861
|
isVarConst: () => isVarConst,
|
|
1862
|
+
isVarConstLike: () => isVarConstLike,
|
|
1855
1863
|
isVarUsing: () => isVarUsing,
|
|
1856
1864
|
isVariableDeclaration: () => isVariableDeclaration,
|
|
1857
1865
|
isVariableDeclarationInVariableStatement: () => isVariableDeclarationInVariableStatement,
|
|
@@ -2056,6 +2064,7 @@ __export(typescript_exports, {
|
|
|
2056
2064
|
reducePathComponents: () => reducePathComponents,
|
|
2057
2065
|
refactor: () => ts_refactor_exports,
|
|
2058
2066
|
regExpEscape: () => regExpEscape,
|
|
2067
|
+
regularExpressionFlagToCharacter: () => regularExpressionFlagToCharacter,
|
|
2059
2068
|
relativeComplement: () => relativeComplement,
|
|
2060
2069
|
removeAllComments: () => removeAllComments,
|
|
2061
2070
|
removeEmitHelper: () => removeEmitHelper,
|
|
@@ -2311,6 +2320,7 @@ __export(typescript_exports, {
|
|
|
2311
2320
|
unsetNodeChildren: () => unsetNodeChildren,
|
|
2312
2321
|
unusedLabelIsError: () => unusedLabelIsError,
|
|
2313
2322
|
unwrapInnermostStatementOfLabel: () => unwrapInnermostStatementOfLabel,
|
|
2323
|
+
unwrapParenthesizedExpression: () => unwrapParenthesizedExpression,
|
|
2314
2324
|
updateErrorForNoInputFiles: () => updateErrorForNoInputFiles,
|
|
2315
2325
|
updateLanguageServiceSourceFile: () => updateLanguageServiceSourceFile,
|
|
2316
2326
|
updateMissingFilePathsWatch: () => updateMissingFilePathsWatch,
|
|
@@ -2350,7 +2360,7 @@ module.exports = __toCommonJS(typescript_exports);
|
|
|
2350
2360
|
|
|
2351
2361
|
// src/compiler/corePublic.ts
|
|
2352
2362
|
var versionMajorMinor = "5.5";
|
|
2353
|
-
var version = `${versionMajorMinor}.0-insiders.
|
|
2363
|
+
var version = `${versionMajorMinor}.0-insiders.20240422`;
|
|
2354
2364
|
var Comparison = /* @__PURE__ */ ((Comparison3) => {
|
|
2355
2365
|
Comparison3[Comparison3["LessThan"] = -1] = "LessThan";
|
|
2356
2366
|
Comparison3[Comparison3["EqualTo"] = 0] = "EqualTo";
|
|
@@ -6254,6 +6264,20 @@ var GeneratedIdentifierFlags = /* @__PURE__ */ ((GeneratedIdentifierFlags2) => {
|
|
|
6254
6264
|
GeneratedIdentifierFlags2[GeneratedIdentifierFlags2["AllowNameSubstitution"] = 64] = "AllowNameSubstitution";
|
|
6255
6265
|
return GeneratedIdentifierFlags2;
|
|
6256
6266
|
})(GeneratedIdentifierFlags || {});
|
|
6267
|
+
var RegularExpressionFlags = /* @__PURE__ */ ((RegularExpressionFlags2) => {
|
|
6268
|
+
RegularExpressionFlags2[RegularExpressionFlags2["None"] = 0] = "None";
|
|
6269
|
+
RegularExpressionFlags2[RegularExpressionFlags2["HasIndices"] = 1] = "HasIndices";
|
|
6270
|
+
RegularExpressionFlags2[RegularExpressionFlags2["Global"] = 2] = "Global";
|
|
6271
|
+
RegularExpressionFlags2[RegularExpressionFlags2["IgnoreCase"] = 4] = "IgnoreCase";
|
|
6272
|
+
RegularExpressionFlags2[RegularExpressionFlags2["Multiline"] = 8] = "Multiline";
|
|
6273
|
+
RegularExpressionFlags2[RegularExpressionFlags2["DotAll"] = 16] = "DotAll";
|
|
6274
|
+
RegularExpressionFlags2[RegularExpressionFlags2["Unicode"] = 32] = "Unicode";
|
|
6275
|
+
RegularExpressionFlags2[RegularExpressionFlags2["UnicodeSets"] = 64] = "UnicodeSets";
|
|
6276
|
+
RegularExpressionFlags2[RegularExpressionFlags2["Sticky"] = 128] = "Sticky";
|
|
6277
|
+
RegularExpressionFlags2[RegularExpressionFlags2["UnicodeMode"] = 96] = "UnicodeMode";
|
|
6278
|
+
RegularExpressionFlags2[RegularExpressionFlags2["Modifiers"] = 28] = "Modifiers";
|
|
6279
|
+
return RegularExpressionFlags2;
|
|
6280
|
+
})(RegularExpressionFlags || {});
|
|
6257
6281
|
var TokenFlags = /* @__PURE__ */ ((TokenFlags2) => {
|
|
6258
6282
|
TokenFlags2[TokenFlags2["None"] = 0] = "None";
|
|
6259
6283
|
TokenFlags2[TokenFlags2["PrecedingLineBreak"] = 1] = "PrecedingLineBreak";
|
|
@@ -6389,6 +6413,7 @@ var NodeBuilderFlags = /* @__PURE__ */ ((NodeBuilderFlags2) => {
|
|
|
6389
6413
|
NodeBuilderFlags2[NodeBuilderFlags2["AllowUniqueESSymbolType"] = 1048576] = "AllowUniqueESSymbolType";
|
|
6390
6414
|
NodeBuilderFlags2[NodeBuilderFlags2["AllowEmptyIndexInfoType"] = 2097152] = "AllowEmptyIndexInfoType";
|
|
6391
6415
|
NodeBuilderFlags2[NodeBuilderFlags2["WriteComputedProps"] = 1073741824] = "WriteComputedProps";
|
|
6416
|
+
NodeBuilderFlags2[NodeBuilderFlags2["NoSyntacticPrinter"] = -2147483648] = "NoSyntacticPrinter";
|
|
6392
6417
|
NodeBuilderFlags2[NodeBuilderFlags2["AllowNodeModulesRelativePaths"] = 67108864] = "AllowNodeModulesRelativePaths";
|
|
6393
6418
|
NodeBuilderFlags2[NodeBuilderFlags2["DoNotIncludeSymbolChain"] = 134217728] = "DoNotIncludeSymbolChain";
|
|
6394
6419
|
NodeBuilderFlags2[NodeBuilderFlags2["IgnoreErrors"] = 70221824] = "IgnoreErrors";
|
|
@@ -9753,6 +9778,43 @@ var Diagnostics = {
|
|
|
9753
9778
|
Identifier_string_literal_or_number_literal_expected: diag(1496, 1 /* Error */, "Identifier_string_literal_or_number_literal_expected_1496", "Identifier, string literal, or number literal expected."),
|
|
9754
9779
|
Expression_must_be_enclosed_in_parentheses_to_be_used_as_a_decorator: diag(1497, 1 /* Error */, "Expression_must_be_enclosed_in_parentheses_to_be_used_as_a_decorator_1497", "Expression must be enclosed in parentheses to be used as a decorator."),
|
|
9755
9780
|
Invalid_syntax_in_decorator: diag(1498, 1 /* Error */, "Invalid_syntax_in_decorator_1498", "Invalid syntax in decorator."),
|
|
9781
|
+
Unknown_regular_expression_flag: diag(1499, 1 /* Error */, "Unknown_regular_expression_flag_1499", "Unknown regular expression flag."),
|
|
9782
|
+
Duplicate_regular_expression_flag: diag(1500, 1 /* Error */, "Duplicate_regular_expression_flag_1500", "Duplicate regular expression flag."),
|
|
9783
|
+
This_regular_expression_flag_is_only_available_when_targeting_0_or_later: diag(1501, 1 /* Error */, "This_regular_expression_flag_is_only_available_when_targeting_0_or_later_1501", "This regular expression flag is only available when targeting '{0}' or later."),
|
|
9784
|
+
The_Unicode_u_flag_and_the_Unicode_Sets_v_flag_cannot_be_set_simultaneously: diag(1502, 1 /* Error */, "The_Unicode_u_flag_and_the_Unicode_Sets_v_flag_cannot_be_set_simultaneously_1502", "The Unicode (u) flag and the Unicode Sets (v) flag cannot be set simultaneously."),
|
|
9785
|
+
Named_capturing_groups_are_only_available_when_targeting_ES2018_or_later: diag(1503, 1 /* Error */, "Named_capturing_groups_are_only_available_when_targeting_ES2018_or_later_1503", "Named capturing groups are only available when targeting 'ES2018' or later."),
|
|
9786
|
+
Subpattern_flags_must_be_present_when_there_is_a_minus_sign: diag(1504, 1 /* Error */, "Subpattern_flags_must_be_present_when_there_is_a_minus_sign_1504", "Subpattern flags must be present when there is a minus sign."),
|
|
9787
|
+
Incomplete_quantifier_Digit_expected: diag(1505, 1 /* Error */, "Incomplete_quantifier_Digit_expected_1505", "Incomplete quantifier. Digit expected."),
|
|
9788
|
+
Numbers_out_of_order_in_quantifier: diag(1506, 1 /* Error */, "Numbers_out_of_order_in_quantifier_1506", "Numbers out of order in quantifier."),
|
|
9789
|
+
There_is_nothing_available_for_repetition: diag(1507, 1 /* Error */, "There_is_nothing_available_for_repetition_1507", "There is nothing available for repetition."),
|
|
9790
|
+
Unexpected_0_Did_you_mean_to_escape_it_with_backslash: diag(1508, 1 /* Error */, "Unexpected_0_Did_you_mean_to_escape_it_with_backslash_1508", "Unexpected '{0}'. Did you mean to escape it with backslash?"),
|
|
9791
|
+
This_regular_expression_flag_cannot_be_toggled_within_a_subpattern: diag(1509, 1 /* Error */, "This_regular_expression_flag_cannot_be_toggled_within_a_subpattern_1509", "This regular expression flag cannot be toggled within a subpattern."),
|
|
9792
|
+
k_must_be_followed_by_a_capturing_group_name_enclosed_in_angle_brackets: diag(1510, 1 /* Error */, "k_must_be_followed_by_a_capturing_group_name_enclosed_in_angle_brackets_1510", "'\\k' must be followed by a capturing group name enclosed in angle brackets."),
|
|
9793
|
+
q_is_only_available_inside_character_class: diag(1511, 1 /* Error */, "q_is_only_available_inside_character_class_1511", "'\\q' is only available inside character class."),
|
|
9794
|
+
c_must_be_followed_by_an_ASCII_letter: diag(1512, 1 /* Error */, "c_must_be_followed_by_an_ASCII_letter_1512", "'\\c' must be followed by an ASCII letter."),
|
|
9795
|
+
Undetermined_character_escape: diag(1513, 1 /* Error */, "Undetermined_character_escape_1513", "Undetermined character escape."),
|
|
9796
|
+
Expected_a_capturing_group_name: diag(1514, 1 /* Error */, "Expected_a_capturing_group_name_1514", "Expected a capturing group name."),
|
|
9797
|
+
Named_capturing_groups_with_the_same_name_must_be_mutually_exclusive_to_each_other: diag(1515, 1 /* Error */, "Named_capturing_groups_with_the_same_name_must_be_mutually_exclusive_to_each_other_1515", "Named capturing groups with the same name must be mutually exclusive to each other."),
|
|
9798
|
+
A_character_class_range_must_not_be_bounded_by_another_character_class: diag(1516, 1 /* Error */, "A_character_class_range_must_not_be_bounded_by_another_character_class_1516", "A character class range must not be bounded by another character class."),
|
|
9799
|
+
Range_out_of_order_in_character_class: diag(1517, 1 /* Error */, "Range_out_of_order_in_character_class_1517", "Range out of order in character class."),
|
|
9800
|
+
Anything_that_would_possibly_match_more_than_a_single_character_is_invalid_inside_a_negated_character_class: diag(1518, 1 /* Error */, "Anything_that_would_possibly_match_more_than_a_single_character_is_invalid_inside_a_negated_characte_1518", "Anything that would possibly match more than a single character is invalid inside a negated character class."),
|
|
9801
|
+
Operators_must_not_be_mixed_within_a_character_class_Wrap_it_in_a_nested_class_instead: diag(1519, 1 /* Error */, "Operators_must_not_be_mixed_within_a_character_class_Wrap_it_in_a_nested_class_instead_1519", "Operators must not be mixed within a character class. Wrap it in a nested class instead."),
|
|
9802
|
+
Expected_a_class_set_oprand: diag(1520, 1 /* Error */, "Expected_a_class_set_oprand_1520", "Expected a class set oprand."),
|
|
9803
|
+
q_must_be_followed_by_string_alternatives_enclosed_in_braces: diag(1521, 1 /* Error */, "q_must_be_followed_by_string_alternatives_enclosed_in_braces_1521", "'\\q' must be followed by string alternatives enclosed in braces."),
|
|
9804
|
+
A_character_class_must_not_contain_a_reserved_double_punctuator_Did_you_mean_to_escape_it_with_backslash: diag(1522, 1 /* Error */, "A_character_class_must_not_contain_a_reserved_double_punctuator_Did_you_mean_to_escape_it_with_backs_1522", "A character class must not contain a reserved double punctuator. Did you mean to escape it with backslash?"),
|
|
9805
|
+
Expected_a_Unicode_property_name: diag(1523, 1 /* Error */, "Expected_a_Unicode_property_name_1523", "Expected a Unicode property name."),
|
|
9806
|
+
Unknown_Unicode_property_name: diag(1524, 1 /* Error */, "Unknown_Unicode_property_name_1524", "Unknown Unicode property name."),
|
|
9807
|
+
Expected_a_Unicode_property_value: diag(1525, 1 /* Error */, "Expected_a_Unicode_property_value_1525", "Expected a Unicode property value."),
|
|
9808
|
+
Unknown_Unicode_property_value: diag(1526, 1 /* Error */, "Unknown_Unicode_property_value_1526", "Unknown Unicode property value."),
|
|
9809
|
+
Expected_a_Unicode_property_name_or_value: diag(1527, 1 /* Error */, "Expected_a_Unicode_property_name_or_value_1527", "Expected a Unicode property name or value."),
|
|
9810
|
+
Any_Unicode_property_that_would_possibly_match_more_than_a_single_character_is_only_available_when_the_Unicode_Sets_v_flag_is_set: diag(1528, 1 /* Error */, "Any_Unicode_property_that_would_possibly_match_more_than_a_single_character_is_only_available_when_t_1528", "Any Unicode property that would possibly match more than a single character is only available when the Unicode Sets (v) flag is set."),
|
|
9811
|
+
Unknown_Unicode_property_name_or_value: diag(1529, 1 /* Error */, "Unknown_Unicode_property_name_or_value_1529", "Unknown Unicode property name or value."),
|
|
9812
|
+
Unicode_property_value_expressions_are_only_available_when_the_Unicode_u_flag_or_the_Unicode_Sets_v_flag_is_set: diag(1530, 1 /* Error */, "Unicode_property_value_expressions_are_only_available_when_the_Unicode_u_flag_or_the_Unicode_Sets_v__1530", "Unicode property value expressions are only available when the Unicode (u) flag or the Unicode Sets (v) flag is set."),
|
|
9813
|
+
_0_must_be_followed_by_a_Unicode_property_value_expression_enclosed_in_braces: diag(1531, 1 /* Error */, "_0_must_be_followed_by_a_Unicode_property_value_expression_enclosed_in_braces_1531", "'\\{0}' must be followed by a Unicode property value expression enclosed in braces."),
|
|
9814
|
+
There_is_no_capturing_group_named_0_in_this_regular_expression: diag(1532, 1 /* Error */, "There_is_no_capturing_group_named_0_in_this_regular_expression_1532", "There is no capturing group named '{0}' in this regular expression."),
|
|
9815
|
+
A_decimal_escape_must_refer_to_an_existent_capturing_group_There_are_only_0_capturing_groups_in_this_regular_expression: diag(1533, 1 /* Error */, "A_decimal_escape_must_refer_to_an_existent_capturing_group_There_are_only_0_capturing_groups_in_this_1533", "A decimal escape must refer to an existent capturing group. There are only {0} capturing groups in this regular expression."),
|
|
9816
|
+
Decimal_escapes_are_invalid_when_there_are_no_capturing_groups_in_a_regular_expression: diag(1534, 1 /* Error */, "Decimal_escapes_are_invalid_when_there_are_no_capturing_groups_in_a_regular_expression_1534", "Decimal escapes are invalid when there are no capturing groups in a regular expression."),
|
|
9817
|
+
This_character_cannot_be_escaped_in_a_regular_expression: diag(1535, 1 /* Error */, "This_character_cannot_be_escaped_in_a_regular_expression_1535", "This character cannot be escaped in a regular expression."),
|
|
9756
9818
|
The_types_of_0_are_incompatible_between_these_types: diag(2200, 1 /* Error */, "The_types_of_0_are_incompatible_between_these_types_2200", "The types of '{0}' are incompatible between these types."),
|
|
9757
9819
|
The_types_returned_by_0_are_incompatible_between_these_types: diag(2201, 1 /* Error */, "The_types_returned_by_0_are_incompatible_between_these_types_2201", "The types returned by '{0}' are incompatible between these types."),
|
|
9758
9820
|
Call_signature_return_types_0_and_1_are_incompatible: diag(
|
|
@@ -10998,6 +11060,7 @@ var Diagnostics = {
|
|
|
10998
11060
|
Specify_how_the_TypeScript_watch_mode_works: diag(6715, 3 /* Message */, "Specify_how_the_TypeScript_watch_mode_works_6715", "Specify how the TypeScript watch mode works."),
|
|
10999
11061
|
Require_undeclared_properties_from_index_signatures_to_use_element_accesses: diag(6717, 3 /* Message */, "Require_undeclared_properties_from_index_signatures_to_use_element_accesses_6717", "Require undeclared properties from index signatures to use element accesses."),
|
|
11000
11062
|
Specify_emit_Slashchecking_behavior_for_imports_that_are_only_used_for_types: diag(6718, 3 /* Message */, "Specify_emit_Slashchecking_behavior_for_imports_that_are_only_used_for_types_6718", "Specify emit/checking behavior for imports that are only used for types."),
|
|
11063
|
+
Require_sufficient_annotation_on_exports_so_other_tools_can_trivially_generate_declaration_files: diag(6719, 3 /* Message */, "Require_sufficient_annotation_on_exports_so_other_tools_can_trivially_generate_declaration_files_6719", "Require sufficient annotation on exports so other tools can trivially generate declaration files."),
|
|
11001
11064
|
Default_catch_clause_variables_as_unknown_instead_of_any: diag(6803, 3 /* Message */, "Default_catch_clause_variables_as_unknown_instead_of_any_6803", "Default catch clause variables as 'unknown' instead of 'any'."),
|
|
11002
11065
|
Do_not_transform_or_elide_any_imports_or_exports_not_marked_as_type_only_ensuring_they_are_written_in_the_output_file_s_format_based_on_the_module_setting: diag(6804, 3 /* Message */, "Do_not_transform_or_elide_any_imports_or_exports_not_marked_as_type_only_ensuring_they_are_written_i_6804", "Do not transform or elide any imports or exports not marked as type-only, ensuring they are written in the output file's format based on the 'module' setting."),
|
|
11003
11066
|
one_of_Colon: diag(6900, 3 /* Message */, "one_of_Colon_6900", "one of:"),
|
|
@@ -11139,6 +11202,36 @@ var Diagnostics = {
|
|
|
11139
11202
|
A_JSDoc_template_tag_may_not_follow_a_typedef_callback_or_overload_tag: diag(8039, 1 /* Error */, "A_JSDoc_template_tag_may_not_follow_a_typedef_callback_or_overload_tag_8039", "A JSDoc '@template' tag may not follow a '@typedef', '@callback', or '@overload' tag"),
|
|
11140
11203
|
Declaration_emit_for_this_file_requires_using_private_name_0_An_explicit_type_annotation_may_unblock_declaration_emit: diag(9005, 1 /* Error */, "Declaration_emit_for_this_file_requires_using_private_name_0_An_explicit_type_annotation_may_unblock_9005", "Declaration emit for this file requires using private name '{0}'. An explicit type annotation may unblock declaration emit."),
|
|
11141
11204
|
Declaration_emit_for_this_file_requires_using_private_name_0_from_module_1_An_explicit_type_annotation_may_unblock_declaration_emit: diag(9006, 1 /* Error */, "Declaration_emit_for_this_file_requires_using_private_name_0_from_module_1_An_explicit_type_annotati_9006", "Declaration emit for this file requires using private name '{0}' from module '{1}'. An explicit type annotation may unblock declaration emit."),
|
|
11205
|
+
Function_must_have_an_explicit_return_type_annotation_with_isolatedDeclarations: diag(9007, 1 /* Error */, "Function_must_have_an_explicit_return_type_annotation_with_isolatedDeclarations_9007", "Function must have an explicit return type annotation with --isolatedDeclarations."),
|
|
11206
|
+
Method_must_have_an_explicit_return_type_annotation_with_isolatedDeclarations: diag(9008, 1 /* Error */, "Method_must_have_an_explicit_return_type_annotation_with_isolatedDeclarations_9008", "Method must have an explicit return type annotation with --isolatedDeclarations."),
|
|
11207
|
+
At_least_one_accessor_must_have_an_explicit_return_type_annotation_with_isolatedDeclarations: diag(9009, 1 /* Error */, "At_least_one_accessor_must_have_an_explicit_return_type_annotation_with_isolatedDeclarations_9009", "At least one accessor must have an explicit return type annotation with --isolatedDeclarations."),
|
|
11208
|
+
Variable_must_have_an_explicit_type_annotation_with_isolatedDeclarations: diag(9010, 1 /* Error */, "Variable_must_have_an_explicit_type_annotation_with_isolatedDeclarations_9010", "Variable must have an explicit type annotation with --isolatedDeclarations."),
|
|
11209
|
+
Parameter_must_have_an_explicit_type_annotation_with_isolatedDeclarations: diag(9011, 1 /* Error */, "Parameter_must_have_an_explicit_type_annotation_with_isolatedDeclarations_9011", "Parameter must have an explicit type annotation with --isolatedDeclarations."),
|
|
11210
|
+
Property_must_have_an_explicit_type_annotation_with_isolatedDeclarations: diag(9012, 1 /* Error */, "Property_must_have_an_explicit_type_annotation_with_isolatedDeclarations_9012", "Property must have an explicit type annotation with --isolatedDeclarations."),
|
|
11211
|
+
Expression_type_can_t_be_inferred_with_isolatedDeclarations: diag(9013, 1 /* Error */, "Expression_type_can_t_be_inferred_with_isolatedDeclarations_9013", "Expression type can't be inferred with --isolatedDeclarations."),
|
|
11212
|
+
Computed_properties_must_be_number_or_string_literals_variables_or_dotted_expressions_with_isolatedDeclarations: diag(9014, 1 /* Error */, "Computed_properties_must_be_number_or_string_literals_variables_or_dotted_expressions_with_isolatedD_9014", "Computed properties must be number or string literals, variables or dotted expressions with --isolatedDeclarations."),
|
|
11213
|
+
Objects_that_contain_spread_assignments_can_t_be_inferred_with_isolatedDeclarations: diag(9015, 1 /* Error */, "Objects_that_contain_spread_assignments_can_t_be_inferred_with_isolatedDeclarations_9015", "Objects that contain spread assignments can't be inferred with --isolatedDeclarations."),
|
|
11214
|
+
Objects_that_contain_shorthand_properties_can_t_be_inferred_with_isolatedDeclarations: diag(9016, 1 /* Error */, "Objects_that_contain_shorthand_properties_can_t_be_inferred_with_isolatedDeclarations_9016", "Objects that contain shorthand properties can't be inferred with --isolatedDeclarations."),
|
|
11215
|
+
Only_const_arrays_can_be_inferred_with_isolatedDeclarations: diag(9017, 1 /* Error */, "Only_const_arrays_can_be_inferred_with_isolatedDeclarations_9017", "Only const arrays can be inferred with --isolatedDeclarations."),
|
|
11216
|
+
Arrays_with_spread_elements_can_t_inferred_with_isolatedDeclarations: diag(9018, 1 /* Error */, "Arrays_with_spread_elements_can_t_inferred_with_isolatedDeclarations_9018", "Arrays with spread elements can't inferred with --isolatedDeclarations."),
|
|
11217
|
+
Binding_elements_can_t_be_exported_directly_with_isolatedDeclarations: diag(9019, 1 /* Error */, "Binding_elements_can_t_be_exported_directly_with_isolatedDeclarations_9019", "Binding elements can't be exported directly with --isolatedDeclarations."),
|
|
11218
|
+
Enum_member_initializers_must_be_computable_without_references_to_external_symbols_with_isolatedDeclarations: diag(9020, 1 /* Error */, "Enum_member_initializers_must_be_computable_without_references_to_external_symbols_with_isolatedDecl_9020", "Enum member initializers must be computable without references to external symbols with --isolatedDeclarations."),
|
|
11219
|
+
Extends_clause_can_t_contain_an_expression_with_isolatedDeclarations: diag(9021, 1 /* Error */, "Extends_clause_can_t_contain_an_expression_with_isolatedDeclarations_9021", "Extends clause can't contain an expression with --isolatedDeclarations."),
|
|
11220
|
+
Inference_from_class_expressions_is_not_supported_with_isolatedDeclarations: diag(9022, 1 /* Error */, "Inference_from_class_expressions_is_not_supported_with_isolatedDeclarations_9022", "Inference from class expressions is not supported with --isolatedDeclarations."),
|
|
11221
|
+
Assigning_properties_to_functions_without_declaring_them_is_not_supported_with_isolatedDeclarations_Add_an_explicit_declaration_for_the_properties_assigned_to_this_function: diag(9023, 1 /* Error */, "Assigning_properties_to_functions_without_declaring_them_is_not_supported_with_isolatedDeclarations__9023", "Assigning properties to functions without declaring them is not supported with --isolatedDeclarations. Add an explicit declaration for the properties assigned to this function."),
|
|
11222
|
+
Declaration_emit_for_this_parameter_requires_implicitly_adding_undefined_to_it_s_type_This_is_not_supported_with_isolatedDeclarations: diag(9025, 1 /* Error */, "Declaration_emit_for_this_parameter_requires_implicitly_adding_undefined_to_it_s_type_This_is_not_su_9025", "Declaration emit for this parameter requires implicitly adding undefined to it's type. This is not supported with --isolatedDeclarations."),
|
|
11223
|
+
Declaration_emit_for_this_file_requires_preserving_this_import_for_augmentations_This_is_not_supported_with_isolatedDeclarations: diag(9026, 1 /* Error */, "Declaration_emit_for_this_file_requires_preserving_this_import_for_augmentations_This_is_not_support_9026", "Declaration emit for this file requires preserving this import for augmentations. This is not supported with --isolatedDeclarations."),
|
|
11224
|
+
Add_a_type_annotation_to_the_variable_0: diag(9027, 1 /* Error */, "Add_a_type_annotation_to_the_variable_0_9027", "Add a type annotation to the variable {0}."),
|
|
11225
|
+
Add_a_type_annotation_to_the_parameter_0: diag(9028, 1 /* Error */, "Add_a_type_annotation_to_the_parameter_0_9028", "Add a type annotation to the parameter {0}."),
|
|
11226
|
+
Add_a_type_annotation_to_the_property_0: diag(9029, 1 /* Error */, "Add_a_type_annotation_to_the_property_0_9029", "Add a type annotation to the property {0}."),
|
|
11227
|
+
Add_a_return_type_to_the_function_expression: diag(9030, 1 /* Error */, "Add_a_return_type_to_the_function_expression_9030", "Add a return type to the function expression."),
|
|
11228
|
+
Add_a_return_type_to_the_function_declaration: diag(9031, 1 /* Error */, "Add_a_return_type_to_the_function_declaration_9031", "Add a return type to the function declaration."),
|
|
11229
|
+
Add_a_return_type_to_the_get_accessor_declaration: diag(9032, 1 /* Error */, "Add_a_return_type_to_the_get_accessor_declaration_9032", "Add a return type to the get accessor declaration."),
|
|
11230
|
+
Add_a_type_to_parameter_of_the_set_accessor_declaration: diag(9033, 1 /* Error */, "Add_a_type_to_parameter_of_the_set_accessor_declaration_9033", "Add a type to parameter of the set accessor declaration."),
|
|
11231
|
+
Add_a_return_type_to_the_method: diag(9034, 1 /* Error */, "Add_a_return_type_to_the_method_9034", "Add a return type to the method"),
|
|
11232
|
+
Add_satisfies_and_a_type_assertion_to_this_expression_satisfies_T_as_T_to_make_the_type_explicit: diag(9035, 1 /* Error */, "Add_satisfies_and_a_type_assertion_to_this_expression_satisfies_T_as_T_to_make_the_type_explicit_9035", "Add satisfies and a type assertion to this expression (satisfies T as T) to make the type explicit."),
|
|
11233
|
+
Move_the_expression_in_default_export_to_a_variable_and_add_a_type_annotation_to_it: diag(9036, 1 /* Error */, "Move_the_expression_in_default_export_to_a_variable_and_add_a_type_annotation_to_it_9036", "Move the expression in default export to a variable and add a type annotation to it."),
|
|
11234
|
+
Default_exports_can_t_be_inferred_with_isolatedDeclarations: diag(9037, 1 /* Error */, "Default_exports_can_t_be_inferred_with_isolatedDeclarations_9037", "Default exports can't be inferred with --isolatedDeclarations."),
|
|
11142
11235
|
JSX_attributes_must_only_be_assigned_a_non_empty_expression: diag(17e3, 1 /* Error */, "JSX_attributes_must_only_be_assigned_a_non_empty_expression_17000", "JSX attributes must only be assigned a non-empty 'expression'."),
|
|
11143
11236
|
JSX_elements_cannot_have_multiple_attributes_with_the_same_name: diag(17001, 1 /* Error */, "JSX_elements_cannot_have_multiple_attributes_with_the_same_name_17001", "JSX elements cannot have multiple attributes with the same name."),
|
|
11144
11237
|
Expected_corresponding_JSX_closing_tag_for_0: diag(17002, 1 /* Error */, "Expected_corresponding_JSX_closing_tag_for_0_17002", "Expected corresponding JSX closing tag for '{0}'."),
|
|
@@ -11611,6 +11704,26 @@ var textToToken = new Map(Object.entries({
|
|
|
11611
11704
|
"#": 63 /* HashToken */,
|
|
11612
11705
|
"`": 62 /* BacktickToken */
|
|
11613
11706
|
}));
|
|
11707
|
+
var charToRegExpFlag = new Map(Object.entries({
|
|
11708
|
+
d: 1 /* HasIndices */,
|
|
11709
|
+
g: 2 /* Global */,
|
|
11710
|
+
i: 4 /* IgnoreCase */,
|
|
11711
|
+
m: 8 /* Multiline */,
|
|
11712
|
+
s: 16 /* DotAll */,
|
|
11713
|
+
u: 32 /* Unicode */,
|
|
11714
|
+
v: 64 /* UnicodeSets */,
|
|
11715
|
+
y: 128 /* Sticky */
|
|
11716
|
+
}));
|
|
11717
|
+
var regExpFlagToFirstAvailableLanguageVersion = /* @__PURE__ */ new Map([
|
|
11718
|
+
[1 /* HasIndices */, 9 /* ES2022 */],
|
|
11719
|
+
[2 /* Global */, 0 /* ES3 */],
|
|
11720
|
+
[4 /* IgnoreCase */, 0 /* ES3 */],
|
|
11721
|
+
[8 /* Multiline */, 0 /* ES3 */],
|
|
11722
|
+
[16 /* DotAll */, 5 /* ES2018 */],
|
|
11723
|
+
[32 /* Unicode */, 2 /* ES2015 */],
|
|
11724
|
+
[64 /* UnicodeSets */, 99 /* ESNext */],
|
|
11725
|
+
[128 /* Sticky */, 2 /* ES2015 */]
|
|
11726
|
+
]);
|
|
11614
11727
|
var unicodeES5IdentifierStart = [170, 170, 181, 181, 186, 186, 192, 214, 216, 246, 248, 705, 710, 721, 736, 740, 748, 748, 750, 750, 880, 884, 886, 887, 890, 893, 902, 902, 904, 906, 908, 908, 910, 929, 931, 1013, 1015, 1153, 1162, 1319, 1329, 1366, 1369, 1369, 1377, 1415, 1488, 1514, 1520, 1522, 1568, 1610, 1646, 1647, 1649, 1747, 1749, 1749, 1765, 1766, 1774, 1775, 1786, 1788, 1791, 1791, 1808, 1808, 1810, 1839, 1869, 1957, 1969, 1969, 1994, 2026, 2036, 2037, 2042, 2042, 2048, 2069, 2074, 2074, 2084, 2084, 2088, 2088, 2112, 2136, 2208, 2208, 2210, 2220, 2308, 2361, 2365, 2365, 2384, 2384, 2392, 2401, 2417, 2423, 2425, 2431, 2437, 2444, 2447, 2448, 2451, 2472, 2474, 2480, 2482, 2482, 2486, 2489, 2493, 2493, 2510, 2510, 2524, 2525, 2527, 2529, 2544, 2545, 2565, 2570, 2575, 2576, 2579, 2600, 2602, 2608, 2610, 2611, 2613, 2614, 2616, 2617, 2649, 2652, 2654, 2654, 2674, 2676, 2693, 2701, 2703, 2705, 2707, 2728, 2730, 2736, 2738, 2739, 2741, 2745, 2749, 2749, 2768, 2768, 2784, 2785, 2821, 2828, 2831, 2832, 2835, 2856, 2858, 2864, 2866, 2867, 2869, 2873, 2877, 2877, 2908, 2909, 2911, 2913, 2929, 2929, 2947, 2947, 2949, 2954, 2958, 2960, 2962, 2965, 2969, 2970, 2972, 2972, 2974, 2975, 2979, 2980, 2984, 2986, 2990, 3001, 3024, 3024, 3077, 3084, 3086, 3088, 3090, 3112, 3114, 3123, 3125, 3129, 3133, 3133, 3160, 3161, 3168, 3169, 3205, 3212, 3214, 3216, 3218, 3240, 3242, 3251, 3253, 3257, 3261, 3261, 3294, 3294, 3296, 3297, 3313, 3314, 3333, 3340, 3342, 3344, 3346, 3386, 3389, 3389, 3406, 3406, 3424, 3425, 3450, 3455, 3461, 3478, 3482, 3505, 3507, 3515, 3517, 3517, 3520, 3526, 3585, 3632, 3634, 3635, 3648, 3654, 3713, 3714, 3716, 3716, 3719, 3720, 3722, 3722, 3725, 3725, 3732, 3735, 3737, 3743, 3745, 3747, 3749, 3749, 3751, 3751, 3754, 3755, 3757, 3760, 3762, 3763, 3773, 3773, 3776, 3780, 3782, 3782, 3804, 3807, 3840, 3840, 3904, 3911, 3913, 3948, 3976, 3980, 4096, 4138, 4159, 4159, 4176, 4181, 4186, 4189, 4193, 4193, 4197, 4198, 4206, 4208, 4213, 4225, 4238, 4238, 4256, 4293, 4295, 4295, 4301, 4301, 4304, 4346, 4348, 4680, 4682, 4685, 4688, 4694, 4696, 4696, 4698, 4701, 4704, 4744, 4746, 4749, 4752, 4784, 4786, 4789, 4792, 4798, 4800, 4800, 4802, 4805, 4808, 4822, 4824, 4880, 4882, 4885, 4888, 4954, 4992, 5007, 5024, 5108, 5121, 5740, 5743, 5759, 5761, 5786, 5792, 5866, 5870, 5872, 5888, 5900, 5902, 5905, 5920, 5937, 5952, 5969, 5984, 5996, 5998, 6e3, 6016, 6067, 6103, 6103, 6108, 6108, 6176, 6263, 6272, 6312, 6314, 6314, 6320, 6389, 6400, 6428, 6480, 6509, 6512, 6516, 6528, 6571, 6593, 6599, 6656, 6678, 6688, 6740, 6823, 6823, 6917, 6963, 6981, 6987, 7043, 7072, 7086, 7087, 7098, 7141, 7168, 7203, 7245, 7247, 7258, 7293, 7401, 7404, 7406, 7409, 7413, 7414, 7424, 7615, 7680, 7957, 7960, 7965, 7968, 8005, 8008, 8013, 8016, 8023, 8025, 8025, 8027, 8027, 8029, 8029, 8031, 8061, 8064, 8116, 8118, 8124, 8126, 8126, 8130, 8132, 8134, 8140, 8144, 8147, 8150, 8155, 8160, 8172, 8178, 8180, 8182, 8188, 8305, 8305, 8319, 8319, 8336, 8348, 8450, 8450, 8455, 8455, 8458, 8467, 8469, 8469, 8473, 8477, 8484, 8484, 8486, 8486, 8488, 8488, 8490, 8493, 8495, 8505, 8508, 8511, 8517, 8521, 8526, 8526, 8544, 8584, 11264, 11310, 11312, 11358, 11360, 11492, 11499, 11502, 11506, 11507, 11520, 11557, 11559, 11559, 11565, 11565, 11568, 11623, 11631, 11631, 11648, 11670, 11680, 11686, 11688, 11694, 11696, 11702, 11704, 11710, 11712, 11718, 11720, 11726, 11728, 11734, 11736, 11742, 11823, 11823, 12293, 12295, 12321, 12329, 12337, 12341, 12344, 12348, 12353, 12438, 12445, 12447, 12449, 12538, 12540, 12543, 12549, 12589, 12593, 12686, 12704, 12730, 12784, 12799, 13312, 19893, 19968, 40908, 40960, 42124, 42192, 42237, 42240, 42508, 42512, 42527, 42538, 42539, 42560, 42606, 42623, 42647, 42656, 42735, 42775, 42783, 42786, 42888, 42891, 42894, 42896, 42899, 42912, 42922, 43e3, 43009, 43011, 43013, 43015, 43018, 43020, 43042, 43072, 43123, 43138, 43187, 43250, 43255, 43259, 43259, 43274, 43301, 43312, 43334, 43360, 43388, 43396, 43442, 43471, 43471, 43520, 43560, 43584, 43586, 43588, 43595, 43616, 43638, 43642, 43642, 43648, 43695, 43697, 43697, 43701, 43702, 43705, 43709, 43712, 43712, 43714, 43714, 43739, 43741, 43744, 43754, 43762, 43764, 43777, 43782, 43785, 43790, 43793, 43798, 43808, 43814, 43816, 43822, 43968, 44002, 44032, 55203, 55216, 55238, 55243, 55291, 63744, 64109, 64112, 64217, 64256, 64262, 64275, 64279, 64285, 64285, 64287, 64296, 64298, 64310, 64312, 64316, 64318, 64318, 64320, 64321, 64323, 64324, 64326, 64433, 64467, 64829, 64848, 64911, 64914, 64967, 65008, 65019, 65136, 65140, 65142, 65276, 65313, 65338, 65345, 65370, 65382, 65470, 65474, 65479, 65482, 65487, 65490, 65495, 65498, 65500];
|
|
11615
11728
|
var unicodeES5IdentifierPart = [170, 170, 181, 181, 186, 186, 192, 214, 216, 246, 248, 705, 710, 721, 736, 740, 748, 748, 750, 750, 768, 884, 886, 887, 890, 893, 902, 902, 904, 906, 908, 908, 910, 929, 931, 1013, 1015, 1153, 1155, 1159, 1162, 1319, 1329, 1366, 1369, 1369, 1377, 1415, 1425, 1469, 1471, 1471, 1473, 1474, 1476, 1477, 1479, 1479, 1488, 1514, 1520, 1522, 1552, 1562, 1568, 1641, 1646, 1747, 1749, 1756, 1759, 1768, 1770, 1788, 1791, 1791, 1808, 1866, 1869, 1969, 1984, 2037, 2042, 2042, 2048, 2093, 2112, 2139, 2208, 2208, 2210, 2220, 2276, 2302, 2304, 2403, 2406, 2415, 2417, 2423, 2425, 2431, 2433, 2435, 2437, 2444, 2447, 2448, 2451, 2472, 2474, 2480, 2482, 2482, 2486, 2489, 2492, 2500, 2503, 2504, 2507, 2510, 2519, 2519, 2524, 2525, 2527, 2531, 2534, 2545, 2561, 2563, 2565, 2570, 2575, 2576, 2579, 2600, 2602, 2608, 2610, 2611, 2613, 2614, 2616, 2617, 2620, 2620, 2622, 2626, 2631, 2632, 2635, 2637, 2641, 2641, 2649, 2652, 2654, 2654, 2662, 2677, 2689, 2691, 2693, 2701, 2703, 2705, 2707, 2728, 2730, 2736, 2738, 2739, 2741, 2745, 2748, 2757, 2759, 2761, 2763, 2765, 2768, 2768, 2784, 2787, 2790, 2799, 2817, 2819, 2821, 2828, 2831, 2832, 2835, 2856, 2858, 2864, 2866, 2867, 2869, 2873, 2876, 2884, 2887, 2888, 2891, 2893, 2902, 2903, 2908, 2909, 2911, 2915, 2918, 2927, 2929, 2929, 2946, 2947, 2949, 2954, 2958, 2960, 2962, 2965, 2969, 2970, 2972, 2972, 2974, 2975, 2979, 2980, 2984, 2986, 2990, 3001, 3006, 3010, 3014, 3016, 3018, 3021, 3024, 3024, 3031, 3031, 3046, 3055, 3073, 3075, 3077, 3084, 3086, 3088, 3090, 3112, 3114, 3123, 3125, 3129, 3133, 3140, 3142, 3144, 3146, 3149, 3157, 3158, 3160, 3161, 3168, 3171, 3174, 3183, 3202, 3203, 3205, 3212, 3214, 3216, 3218, 3240, 3242, 3251, 3253, 3257, 3260, 3268, 3270, 3272, 3274, 3277, 3285, 3286, 3294, 3294, 3296, 3299, 3302, 3311, 3313, 3314, 3330, 3331, 3333, 3340, 3342, 3344, 3346, 3386, 3389, 3396, 3398, 3400, 3402, 3406, 3415, 3415, 3424, 3427, 3430, 3439, 3450, 3455, 3458, 3459, 3461, 3478, 3482, 3505, 3507, 3515, 3517, 3517, 3520, 3526, 3530, 3530, 3535, 3540, 3542, 3542, 3544, 3551, 3570, 3571, 3585, 3642, 3648, 3662, 3664, 3673, 3713, 3714, 3716, 3716, 3719, 3720, 3722, 3722, 3725, 3725, 3732, 3735, 3737, 3743, 3745, 3747, 3749, 3749, 3751, 3751, 3754, 3755, 3757, 3769, 3771, 3773, 3776, 3780, 3782, 3782, 3784, 3789, 3792, 3801, 3804, 3807, 3840, 3840, 3864, 3865, 3872, 3881, 3893, 3893, 3895, 3895, 3897, 3897, 3902, 3911, 3913, 3948, 3953, 3972, 3974, 3991, 3993, 4028, 4038, 4038, 4096, 4169, 4176, 4253, 4256, 4293, 4295, 4295, 4301, 4301, 4304, 4346, 4348, 4680, 4682, 4685, 4688, 4694, 4696, 4696, 4698, 4701, 4704, 4744, 4746, 4749, 4752, 4784, 4786, 4789, 4792, 4798, 4800, 4800, 4802, 4805, 4808, 4822, 4824, 4880, 4882, 4885, 4888, 4954, 4957, 4959, 4992, 5007, 5024, 5108, 5121, 5740, 5743, 5759, 5761, 5786, 5792, 5866, 5870, 5872, 5888, 5900, 5902, 5908, 5920, 5940, 5952, 5971, 5984, 5996, 5998, 6e3, 6002, 6003, 6016, 6099, 6103, 6103, 6108, 6109, 6112, 6121, 6155, 6157, 6160, 6169, 6176, 6263, 6272, 6314, 6320, 6389, 6400, 6428, 6432, 6443, 6448, 6459, 6470, 6509, 6512, 6516, 6528, 6571, 6576, 6601, 6608, 6617, 6656, 6683, 6688, 6750, 6752, 6780, 6783, 6793, 6800, 6809, 6823, 6823, 6912, 6987, 6992, 7001, 7019, 7027, 7040, 7155, 7168, 7223, 7232, 7241, 7245, 7293, 7376, 7378, 7380, 7414, 7424, 7654, 7676, 7957, 7960, 7965, 7968, 8005, 8008, 8013, 8016, 8023, 8025, 8025, 8027, 8027, 8029, 8029, 8031, 8061, 8064, 8116, 8118, 8124, 8126, 8126, 8130, 8132, 8134, 8140, 8144, 8147, 8150, 8155, 8160, 8172, 8178, 8180, 8182, 8188, 8204, 8205, 8255, 8256, 8276, 8276, 8305, 8305, 8319, 8319, 8336, 8348, 8400, 8412, 8417, 8417, 8421, 8432, 8450, 8450, 8455, 8455, 8458, 8467, 8469, 8469, 8473, 8477, 8484, 8484, 8486, 8486, 8488, 8488, 8490, 8493, 8495, 8505, 8508, 8511, 8517, 8521, 8526, 8526, 8544, 8584, 11264, 11310, 11312, 11358, 11360, 11492, 11499, 11507, 11520, 11557, 11559, 11559, 11565, 11565, 11568, 11623, 11631, 11631, 11647, 11670, 11680, 11686, 11688, 11694, 11696, 11702, 11704, 11710, 11712, 11718, 11720, 11726, 11728, 11734, 11736, 11742, 11744, 11775, 11823, 11823, 12293, 12295, 12321, 12335, 12337, 12341, 12344, 12348, 12353, 12438, 12441, 12442, 12445, 12447, 12449, 12538, 12540, 12543, 12549, 12589, 12593, 12686, 12704, 12730, 12784, 12799, 13312, 19893, 19968, 40908, 40960, 42124, 42192, 42237, 42240, 42508, 42512, 42539, 42560, 42607, 42612, 42621, 42623, 42647, 42655, 42737, 42775, 42783, 42786, 42888, 42891, 42894, 42896, 42899, 42912, 42922, 43e3, 43047, 43072, 43123, 43136, 43204, 43216, 43225, 43232, 43255, 43259, 43259, 43264, 43309, 43312, 43347, 43360, 43388, 43392, 43456, 43471, 43481, 43520, 43574, 43584, 43597, 43600, 43609, 43616, 43638, 43642, 43643, 43648, 43714, 43739, 43741, 43744, 43759, 43762, 43766, 43777, 43782, 43785, 43790, 43793, 43798, 43808, 43814, 43816, 43822, 43968, 44010, 44012, 44013, 44016, 44025, 44032, 55203, 55216, 55238, 55243, 55291, 63744, 64109, 64112, 64217, 64256, 64262, 64275, 64279, 64285, 64296, 64298, 64310, 64312, 64316, 64318, 64318, 64320, 64321, 64323, 64324, 64326, 64433, 64467, 64829, 64848, 64911, 64914, 64967, 65008, 65019, 65024, 65039, 65056, 65062, 65075, 65076, 65101, 65103, 65136, 65140, 65142, 65276, 65296, 65305, 65313, 65338, 65343, 65343, 65345, 65370, 65382, 65470, 65474, 65479, 65482, 65487, 65490, 65495, 65498, 65500];
|
|
11616
11729
|
var unicodeESNextIdentifierStart = [65, 90, 97, 122, 170, 170, 181, 181, 186, 186, 192, 214, 216, 246, 248, 705, 710, 721, 736, 740, 748, 748, 750, 750, 880, 884, 886, 887, 890, 893, 895, 895, 902, 902, 904, 906, 908, 908, 910, 929, 931, 1013, 1015, 1153, 1162, 1327, 1329, 1366, 1369, 1369, 1376, 1416, 1488, 1514, 1519, 1522, 1568, 1610, 1646, 1647, 1649, 1747, 1749, 1749, 1765, 1766, 1774, 1775, 1786, 1788, 1791, 1791, 1808, 1808, 1810, 1839, 1869, 1957, 1969, 1969, 1994, 2026, 2036, 2037, 2042, 2042, 2048, 2069, 2074, 2074, 2084, 2084, 2088, 2088, 2112, 2136, 2144, 2154, 2208, 2228, 2230, 2237, 2308, 2361, 2365, 2365, 2384, 2384, 2392, 2401, 2417, 2432, 2437, 2444, 2447, 2448, 2451, 2472, 2474, 2480, 2482, 2482, 2486, 2489, 2493, 2493, 2510, 2510, 2524, 2525, 2527, 2529, 2544, 2545, 2556, 2556, 2565, 2570, 2575, 2576, 2579, 2600, 2602, 2608, 2610, 2611, 2613, 2614, 2616, 2617, 2649, 2652, 2654, 2654, 2674, 2676, 2693, 2701, 2703, 2705, 2707, 2728, 2730, 2736, 2738, 2739, 2741, 2745, 2749, 2749, 2768, 2768, 2784, 2785, 2809, 2809, 2821, 2828, 2831, 2832, 2835, 2856, 2858, 2864, 2866, 2867, 2869, 2873, 2877, 2877, 2908, 2909, 2911, 2913, 2929, 2929, 2947, 2947, 2949, 2954, 2958, 2960, 2962, 2965, 2969, 2970, 2972, 2972, 2974, 2975, 2979, 2980, 2984, 2986, 2990, 3001, 3024, 3024, 3077, 3084, 3086, 3088, 3090, 3112, 3114, 3129, 3133, 3133, 3160, 3162, 3168, 3169, 3200, 3200, 3205, 3212, 3214, 3216, 3218, 3240, 3242, 3251, 3253, 3257, 3261, 3261, 3294, 3294, 3296, 3297, 3313, 3314, 3333, 3340, 3342, 3344, 3346, 3386, 3389, 3389, 3406, 3406, 3412, 3414, 3423, 3425, 3450, 3455, 3461, 3478, 3482, 3505, 3507, 3515, 3517, 3517, 3520, 3526, 3585, 3632, 3634, 3635, 3648, 3654, 3713, 3714, 3716, 3716, 3718, 3722, 3724, 3747, 3749, 3749, 3751, 3760, 3762, 3763, 3773, 3773, 3776, 3780, 3782, 3782, 3804, 3807, 3840, 3840, 3904, 3911, 3913, 3948, 3976, 3980, 4096, 4138, 4159, 4159, 4176, 4181, 4186, 4189, 4193, 4193, 4197, 4198, 4206, 4208, 4213, 4225, 4238, 4238, 4256, 4293, 4295, 4295, 4301, 4301, 4304, 4346, 4348, 4680, 4682, 4685, 4688, 4694, 4696, 4696, 4698, 4701, 4704, 4744, 4746, 4749, 4752, 4784, 4786, 4789, 4792, 4798, 4800, 4800, 4802, 4805, 4808, 4822, 4824, 4880, 4882, 4885, 4888, 4954, 4992, 5007, 5024, 5109, 5112, 5117, 5121, 5740, 5743, 5759, 5761, 5786, 5792, 5866, 5870, 5880, 5888, 5900, 5902, 5905, 5920, 5937, 5952, 5969, 5984, 5996, 5998, 6e3, 6016, 6067, 6103, 6103, 6108, 6108, 6176, 6264, 6272, 6312, 6314, 6314, 6320, 6389, 6400, 6430, 6480, 6509, 6512, 6516, 6528, 6571, 6576, 6601, 6656, 6678, 6688, 6740, 6823, 6823, 6917, 6963, 6981, 6987, 7043, 7072, 7086, 7087, 7098, 7141, 7168, 7203, 7245, 7247, 7258, 7293, 7296, 7304, 7312, 7354, 7357, 7359, 7401, 7404, 7406, 7411, 7413, 7414, 7418, 7418, 7424, 7615, 7680, 7957, 7960, 7965, 7968, 8005, 8008, 8013, 8016, 8023, 8025, 8025, 8027, 8027, 8029, 8029, 8031, 8061, 8064, 8116, 8118, 8124, 8126, 8126, 8130, 8132, 8134, 8140, 8144, 8147, 8150, 8155, 8160, 8172, 8178, 8180, 8182, 8188, 8305, 8305, 8319, 8319, 8336, 8348, 8450, 8450, 8455, 8455, 8458, 8467, 8469, 8469, 8472, 8477, 8484, 8484, 8486, 8486, 8488, 8488, 8490, 8505, 8508, 8511, 8517, 8521, 8526, 8526, 8544, 8584, 11264, 11310, 11312, 11358, 11360, 11492, 11499, 11502, 11506, 11507, 11520, 11557, 11559, 11559, 11565, 11565, 11568, 11623, 11631, 11631, 11648, 11670, 11680, 11686, 11688, 11694, 11696, 11702, 11704, 11710, 11712, 11718, 11720, 11726, 11728, 11734, 11736, 11742, 12293, 12295, 12321, 12329, 12337, 12341, 12344, 12348, 12353, 12438, 12443, 12447, 12449, 12538, 12540, 12543, 12549, 12591, 12593, 12686, 12704, 12730, 12784, 12799, 13312, 19893, 19968, 40943, 40960, 42124, 42192, 42237, 42240, 42508, 42512, 42527, 42538, 42539, 42560, 42606, 42623, 42653, 42656, 42735, 42775, 42783, 42786, 42888, 42891, 42943, 42946, 42950, 42999, 43009, 43011, 43013, 43015, 43018, 43020, 43042, 43072, 43123, 43138, 43187, 43250, 43255, 43259, 43259, 43261, 43262, 43274, 43301, 43312, 43334, 43360, 43388, 43396, 43442, 43471, 43471, 43488, 43492, 43494, 43503, 43514, 43518, 43520, 43560, 43584, 43586, 43588, 43595, 43616, 43638, 43642, 43642, 43646, 43695, 43697, 43697, 43701, 43702, 43705, 43709, 43712, 43712, 43714, 43714, 43739, 43741, 43744, 43754, 43762, 43764, 43777, 43782, 43785, 43790, 43793, 43798, 43808, 43814, 43816, 43822, 43824, 43866, 43868, 43879, 43888, 44002, 44032, 55203, 55216, 55238, 55243, 55291, 63744, 64109, 64112, 64217, 64256, 64262, 64275, 64279, 64285, 64285, 64287, 64296, 64298, 64310, 64312, 64316, 64318, 64318, 64320, 64321, 64323, 64324, 64326, 64433, 64467, 64829, 64848, 64911, 64914, 64967, 65008, 65019, 65136, 65140, 65142, 65276, 65313, 65338, 65345, 65370, 65382, 65470, 65474, 65479, 65482, 65487, 65490, 65495, 65498, 65500, 65536, 65547, 65549, 65574, 65576, 65594, 65596, 65597, 65599, 65613, 65616, 65629, 65664, 65786, 65856, 65908, 66176, 66204, 66208, 66256, 66304, 66335, 66349, 66378, 66384, 66421, 66432, 66461, 66464, 66499, 66504, 66511, 66513, 66517, 66560, 66717, 66736, 66771, 66776, 66811, 66816, 66855, 66864, 66915, 67072, 67382, 67392, 67413, 67424, 67431, 67584, 67589, 67592, 67592, 67594, 67637, 67639, 67640, 67644, 67644, 67647, 67669, 67680, 67702, 67712, 67742, 67808, 67826, 67828, 67829, 67840, 67861, 67872, 67897, 67968, 68023, 68030, 68031, 68096, 68096, 68112, 68115, 68117, 68119, 68121, 68149, 68192, 68220, 68224, 68252, 68288, 68295, 68297, 68324, 68352, 68405, 68416, 68437, 68448, 68466, 68480, 68497, 68608, 68680, 68736, 68786, 68800, 68850, 68864, 68899, 69376, 69404, 69415, 69415, 69424, 69445, 69600, 69622, 69635, 69687, 69763, 69807, 69840, 69864, 69891, 69926, 69956, 69956, 69968, 70002, 70006, 70006, 70019, 70066, 70081, 70084, 70106, 70106, 70108, 70108, 70144, 70161, 70163, 70187, 70272, 70278, 70280, 70280, 70282, 70285, 70287, 70301, 70303, 70312, 70320, 70366, 70405, 70412, 70415, 70416, 70419, 70440, 70442, 70448, 70450, 70451, 70453, 70457, 70461, 70461, 70480, 70480, 70493, 70497, 70656, 70708, 70727, 70730, 70751, 70751, 70784, 70831, 70852, 70853, 70855, 70855, 71040, 71086, 71128, 71131, 71168, 71215, 71236, 71236, 71296, 71338, 71352, 71352, 71424, 71450, 71680, 71723, 71840, 71903, 71935, 71935, 72096, 72103, 72106, 72144, 72161, 72161, 72163, 72163, 72192, 72192, 72203, 72242, 72250, 72250, 72272, 72272, 72284, 72329, 72349, 72349, 72384, 72440, 72704, 72712, 72714, 72750, 72768, 72768, 72818, 72847, 72960, 72966, 72968, 72969, 72971, 73008, 73030, 73030, 73056, 73061, 73063, 73064, 73066, 73097, 73112, 73112, 73440, 73458, 73728, 74649, 74752, 74862, 74880, 75075, 77824, 78894, 82944, 83526, 92160, 92728, 92736, 92766, 92880, 92909, 92928, 92975, 92992, 92995, 93027, 93047, 93053, 93071, 93760, 93823, 93952, 94026, 94032, 94032, 94099, 94111, 94176, 94177, 94179, 94179, 94208, 100343, 100352, 101106, 110592, 110878, 110928, 110930, 110948, 110951, 110960, 111355, 113664, 113770, 113776, 113788, 113792, 113800, 113808, 113817, 119808, 119892, 119894, 119964, 119966, 119967, 119970, 119970, 119973, 119974, 119977, 119980, 119982, 119993, 119995, 119995, 119997, 120003, 120005, 120069, 120071, 120074, 120077, 120084, 120086, 120092, 120094, 120121, 120123, 120126, 120128, 120132, 120134, 120134, 120138, 120144, 120146, 120485, 120488, 120512, 120514, 120538, 120540, 120570, 120572, 120596, 120598, 120628, 120630, 120654, 120656, 120686, 120688, 120712, 120714, 120744, 120746, 120770, 120772, 120779, 123136, 123180, 123191, 123197, 123214, 123214, 123584, 123627, 124928, 125124, 125184, 125251, 125259, 125259, 126464, 126467, 126469, 126495, 126497, 126498, 126500, 126500, 126503, 126503, 126505, 126514, 126516, 126519, 126521, 126521, 126523, 126523, 126530, 126530, 126535, 126535, 126537, 126537, 126539, 126539, 126541, 126543, 126545, 126546, 126548, 126548, 126551, 126551, 126553, 126553, 126555, 126555, 126557, 126557, 126559, 126559, 126561, 126562, 126564, 126564, 126567, 126570, 126572, 126578, 126580, 126583, 126585, 126588, 126590, 126590, 126592, 126601, 126603, 126619, 126625, 126627, 126629, 126633, 126635, 126651, 131072, 173782, 173824, 177972, 177984, 178205, 178208, 183969, 183984, 191456, 194560, 195101];
|
|
@@ -11659,6 +11772,13 @@ function tokenToString(t) {
|
|
|
11659
11772
|
function stringToToken(s) {
|
|
11660
11773
|
return textToToken.get(s);
|
|
11661
11774
|
}
|
|
11775
|
+
var regExpFlagChars = makeReverseMap(charToRegExpFlag);
|
|
11776
|
+
function regularExpressionFlagToCharacter(f) {
|
|
11777
|
+
return regExpFlagChars[f];
|
|
11778
|
+
}
|
|
11779
|
+
function characterToRegularExpressionFlag(c) {
|
|
11780
|
+
return charToRegExpFlag.get(c);
|
|
11781
|
+
}
|
|
11662
11782
|
function computeLineStarts(text) {
|
|
11663
11783
|
const result = [];
|
|
11664
11784
|
let pos = 0;
|
|
@@ -11755,8 +11875,11 @@ function isDigit(ch) {
|
|
|
11755
11875
|
function isHexDigit(ch) {
|
|
11756
11876
|
return isDigit(ch) || ch >= 65 /* A */ && ch <= 70 /* F */ || ch >= 97 /* a */ && ch <= 102 /* f */;
|
|
11757
11877
|
}
|
|
11758
|
-
function
|
|
11759
|
-
return
|
|
11878
|
+
function isASCIILetter(ch) {
|
|
11879
|
+
return ch >= 65 /* A */ && ch <= 90 /* Z */ || ch >= 97 /* a */ && ch <= 122 /* z */;
|
|
11880
|
+
}
|
|
11881
|
+
function isWordCharacter(ch) {
|
|
11882
|
+
return isASCIILetter(ch) || isDigit(ch) || ch === 95 /* _ */;
|
|
11760
11883
|
}
|
|
11761
11884
|
function isOctalDigit(ch) {
|
|
11762
11885
|
return ch >= 48 /* _0 */ && ch <= 55 /* _7 */;
|
|
@@ -12095,10 +12218,10 @@ function getShebang(text) {
|
|
|
12095
12218
|
}
|
|
12096
12219
|
}
|
|
12097
12220
|
function isIdentifierStart(ch, languageVersion) {
|
|
12098
|
-
return ch
|
|
12221
|
+
return isASCIILetter(ch) || ch === 36 /* $ */ || ch === 95 /* _ */ || ch > 127 /* maxAsciiCharacter */ && isUnicodeIdentifierStart(ch, languageVersion);
|
|
12099
12222
|
}
|
|
12100
12223
|
function isIdentifierPart(ch, languageVersion, identifierVariant) {
|
|
12101
|
-
return ch
|
|
12224
|
+
return isWordCharacter(ch) || ch === 36 /* $ */ || // "-" and ":" are valid in JSX Identifiers
|
|
12102
12225
|
(identifierVariant === 1 /* JSX */ ? ch === 45 /* minus */ || ch === 58 /* colon */ : false) || ch > 127 /* maxAsciiCharacter */ && isUnicodeIdentifierPart(ch, languageVersion);
|
|
12103
12226
|
}
|
|
12104
12227
|
function isIdentifierText(name, languageVersion, identifierVariant) {
|
|
@@ -12419,7 +12542,9 @@ function createScanner(languageVersion, skipTrivia2, languageVariant = 0 /* Stan
|
|
|
12419
12542
|
result += text.substring(start2, pos);
|
|
12420
12543
|
result += scanEscapeSequence(
|
|
12421
12544
|
/*shouldEmitInvalidEscapeError*/
|
|
12422
|
-
true
|
|
12545
|
+
true,
|
|
12546
|
+
/*isRegularExpression*/
|
|
12547
|
+
false
|
|
12423
12548
|
);
|
|
12424
12549
|
start2 = pos;
|
|
12425
12550
|
continue;
|
|
@@ -12463,7 +12588,11 @@ function createScanner(languageVersion, skipTrivia2, languageVariant = 0 /* Stan
|
|
|
12463
12588
|
}
|
|
12464
12589
|
if (currChar === 92 /* backslash */) {
|
|
12465
12590
|
contents += text.substring(start2, pos);
|
|
12466
|
-
contents += scanEscapeSequence(
|
|
12591
|
+
contents += scanEscapeSequence(
|
|
12592
|
+
shouldEmitInvalidEscapeError,
|
|
12593
|
+
/*isRegularExpression*/
|
|
12594
|
+
false
|
|
12595
|
+
);
|
|
12467
12596
|
start2 = pos;
|
|
12468
12597
|
continue;
|
|
12469
12598
|
}
|
|
@@ -12483,7 +12612,7 @@ function createScanner(languageVersion, skipTrivia2, languageVariant = 0 /* Stan
|
|
|
12483
12612
|
tokenValue = contents;
|
|
12484
12613
|
return resultingToken;
|
|
12485
12614
|
}
|
|
12486
|
-
function scanEscapeSequence(shouldEmitInvalidEscapeError) {
|
|
12615
|
+
function scanEscapeSequence(shouldEmitInvalidEscapeError, isRegularExpression) {
|
|
12487
12616
|
const start2 = pos;
|
|
12488
12617
|
pos++;
|
|
12489
12618
|
if (pos >= end) {
|
|
@@ -12511,7 +12640,7 @@ function createScanner(languageVersion, skipTrivia2, languageVariant = 0 /* Stan
|
|
|
12511
12640
|
pos++;
|
|
12512
12641
|
}
|
|
12513
12642
|
tokenFlags |= 2048 /* ContainsInvalidEscape */;
|
|
12514
|
-
if (shouldEmitInvalidEscapeError) {
|
|
12643
|
+
if (isRegularExpression || shouldEmitInvalidEscapeError) {
|
|
12515
12644
|
const code = parseInt(text.substring(start2 + 1, pos), 8);
|
|
12516
12645
|
error2(Diagnostics.Octal_escape_sequences_are_not_allowed_Use_the_syntax_0, start2, pos - start2, "\\x" + code.toString(16).padStart(2, "0"));
|
|
12517
12646
|
return String.fromCharCode(code);
|
|
@@ -12520,7 +12649,7 @@ function createScanner(languageVersion, skipTrivia2, languageVariant = 0 /* Stan
|
|
|
12520
12649
|
case 56 /* _8 */:
|
|
12521
12650
|
case 57 /* _9 */:
|
|
12522
12651
|
tokenFlags |= 2048 /* ContainsInvalidEscape */;
|
|
12523
|
-
if (shouldEmitInvalidEscapeError) {
|
|
12652
|
+
if (isRegularExpression || shouldEmitInvalidEscapeError) {
|
|
12524
12653
|
error2(Diagnostics.Escape_sequence_0_is_not_allowed, start2, pos - start2, text.substring(start2, pos));
|
|
12525
12654
|
return String.fromCharCode(ch);
|
|
12526
12655
|
}
|
|
@@ -12542,62 +12671,42 @@ function createScanner(languageVersion, skipTrivia2, languageVariant = 0 /* Stan
|
|
|
12542
12671
|
case 34 /* doubleQuote */:
|
|
12543
12672
|
return '"';
|
|
12544
12673
|
case 117 /* u */:
|
|
12545
|
-
if (pos < end && text.charCodeAt(pos) === 123 /* openBrace */) {
|
|
12546
|
-
pos
|
|
12547
|
-
|
|
12548
|
-
1,
|
|
12549
|
-
/*canHaveSeparators*/
|
|
12550
|
-
false
|
|
12551
|
-
);
|
|
12552
|
-
const escapedValue = escapedValueString ? parseInt(escapedValueString, 16) : -1;
|
|
12553
|
-
if (escapedValue < 0) {
|
|
12554
|
-
tokenFlags |= 2048 /* ContainsInvalidEscape */;
|
|
12555
|
-
if (shouldEmitInvalidEscapeError) {
|
|
12556
|
-
error2(Diagnostics.Hexadecimal_digit_expected);
|
|
12557
|
-
}
|
|
12558
|
-
return text.substring(start2, pos);
|
|
12559
|
-
}
|
|
12560
|
-
if (!isCodePoint(escapedValue)) {
|
|
12561
|
-
tokenFlags |= 2048 /* ContainsInvalidEscape */;
|
|
12562
|
-
if (shouldEmitInvalidEscapeError) {
|
|
12563
|
-
error2(Diagnostics.An_extended_Unicode_escape_value_must_be_between_0x0_and_0x10FFFF_inclusive);
|
|
12564
|
-
}
|
|
12565
|
-
return text.substring(start2, pos);
|
|
12566
|
-
}
|
|
12567
|
-
if (pos >= end) {
|
|
12568
|
-
tokenFlags |= 2048 /* ContainsInvalidEscape */;
|
|
12569
|
-
if (shouldEmitInvalidEscapeError) {
|
|
12570
|
-
error2(Diagnostics.Unexpected_end_of_text);
|
|
12571
|
-
}
|
|
12572
|
-
return text.substring(start2, pos);
|
|
12573
|
-
}
|
|
12574
|
-
if (text.charCodeAt(pos) !== 125 /* closeBrace */) {
|
|
12575
|
-
tokenFlags |= 2048 /* ContainsInvalidEscape */;
|
|
12576
|
-
if (shouldEmitInvalidEscapeError) {
|
|
12577
|
-
error2(Diagnostics.Unterminated_Unicode_escape_sequence);
|
|
12578
|
-
}
|
|
12579
|
-
return text.substring(start2, pos);
|
|
12580
|
-
}
|
|
12581
|
-
pos++;
|
|
12582
|
-
tokenFlags |= 8 /* ExtendedUnicodeEscape */;
|
|
12583
|
-
return utf16EncodeAsString(escapedValue);
|
|
12674
|
+
if ((!isRegularExpression || shouldEmitInvalidEscapeError) && pos < end && text.charCodeAt(pos) === 123 /* openBrace */) {
|
|
12675
|
+
pos -= 2;
|
|
12676
|
+
return scanExtendedUnicodeEscape(isRegularExpression || shouldEmitInvalidEscapeError);
|
|
12584
12677
|
}
|
|
12585
12678
|
for (; pos < start2 + 6; pos++) {
|
|
12586
12679
|
if (!(pos < end && isHexDigit(text.charCodeAt(pos)))) {
|
|
12587
12680
|
tokenFlags |= 2048 /* ContainsInvalidEscape */;
|
|
12588
|
-
if (shouldEmitInvalidEscapeError) {
|
|
12681
|
+
if (isRegularExpression || shouldEmitInvalidEscapeError) {
|
|
12589
12682
|
error2(Diagnostics.Hexadecimal_digit_expected);
|
|
12590
12683
|
}
|
|
12591
12684
|
return text.substring(start2, pos);
|
|
12592
12685
|
}
|
|
12593
12686
|
}
|
|
12594
12687
|
tokenFlags |= 1024 /* UnicodeEscape */;
|
|
12595
|
-
|
|
12688
|
+
const escapedValue = parseInt(text.substring(start2 + 2, pos), 16);
|
|
12689
|
+
const escapedValueString = String.fromCharCode(escapedValue);
|
|
12690
|
+
if (isRegularExpression && shouldEmitInvalidEscapeError && escapedValue >= 55296 && escapedValue <= 56319 && pos + 6 < end && text.substring(pos, pos + 2) === "\\u" && text.charCodeAt(pos + 2) !== 123 /* openBrace */) {
|
|
12691
|
+
const nextStart = pos;
|
|
12692
|
+
let nextPos = pos + 2;
|
|
12693
|
+
for (; nextPos < nextStart + 6; nextPos++) {
|
|
12694
|
+
if (!isHexDigit(text.charCodeAt(pos))) {
|
|
12695
|
+
return escapedValueString;
|
|
12696
|
+
}
|
|
12697
|
+
}
|
|
12698
|
+
const nextEscapedValue = parseInt(text.substring(nextStart + 2, nextPos), 16);
|
|
12699
|
+
if (nextEscapedValue >= 56320 && nextEscapedValue <= 57343) {
|
|
12700
|
+
pos = nextPos;
|
|
12701
|
+
return escapedValueString + String.fromCharCode(nextEscapedValue);
|
|
12702
|
+
}
|
|
12703
|
+
}
|
|
12704
|
+
return escapedValueString;
|
|
12596
12705
|
case 120 /* x */:
|
|
12597
12706
|
for (; pos < start2 + 4; pos++) {
|
|
12598
12707
|
if (!(pos < end && isHexDigit(text.charCodeAt(pos)))) {
|
|
12599
12708
|
tokenFlags |= 2048 /* ContainsInvalidEscape */;
|
|
12600
|
-
if (shouldEmitInvalidEscapeError) {
|
|
12709
|
+
if (isRegularExpression || shouldEmitInvalidEscapeError) {
|
|
12601
12710
|
error2(Diagnostics.Hexadecimal_digit_expected);
|
|
12602
12711
|
}
|
|
12603
12712
|
return text.substring(start2, pos);
|
|
@@ -12614,10 +12723,16 @@ function createScanner(languageVersion, skipTrivia2, languageVariant = 0 /* Stan
|
|
|
12614
12723
|
case 8233 /* paragraphSeparator */:
|
|
12615
12724
|
return "";
|
|
12616
12725
|
default:
|
|
12726
|
+
if (isRegularExpression && (shouldEmitInvalidEscapeError || isIdentifierPart(ch, languageVersion))) {
|
|
12727
|
+
error2(Diagnostics.This_character_cannot_be_escaped_in_a_regular_expression, pos - 2, 2);
|
|
12728
|
+
}
|
|
12617
12729
|
return String.fromCharCode(ch);
|
|
12618
12730
|
}
|
|
12619
12731
|
}
|
|
12620
|
-
function scanExtendedUnicodeEscape() {
|
|
12732
|
+
function scanExtendedUnicodeEscape(shouldEmitInvalidEscapeError) {
|
|
12733
|
+
const start2 = pos;
|
|
12734
|
+
pos += 3;
|
|
12735
|
+
const escapedStart = pos;
|
|
12621
12736
|
const escapedValueString = scanMinimumNumberOfHexDigits(
|
|
12622
12737
|
1,
|
|
12623
12738
|
/*canHaveSeparators*/
|
|
@@ -12626,24 +12741,34 @@ function createScanner(languageVersion, skipTrivia2, languageVariant = 0 /* Stan
|
|
|
12626
12741
|
const escapedValue = escapedValueString ? parseInt(escapedValueString, 16) : -1;
|
|
12627
12742
|
let isInvalidExtendedEscape = false;
|
|
12628
12743
|
if (escapedValue < 0) {
|
|
12629
|
-
|
|
12744
|
+
if (shouldEmitInvalidEscapeError) {
|
|
12745
|
+
error2(Diagnostics.Hexadecimal_digit_expected);
|
|
12746
|
+
}
|
|
12630
12747
|
isInvalidExtendedEscape = true;
|
|
12631
12748
|
} else if (escapedValue > 1114111) {
|
|
12632
|
-
|
|
12749
|
+
if (shouldEmitInvalidEscapeError) {
|
|
12750
|
+
error2(Diagnostics.An_extended_Unicode_escape_value_must_be_between_0x0_and_0x10FFFF_inclusive, escapedStart, pos - escapedStart);
|
|
12751
|
+
}
|
|
12633
12752
|
isInvalidExtendedEscape = true;
|
|
12634
12753
|
}
|
|
12635
12754
|
if (pos >= end) {
|
|
12636
|
-
|
|
12755
|
+
if (shouldEmitInvalidEscapeError) {
|
|
12756
|
+
error2(Diagnostics.Unexpected_end_of_text);
|
|
12757
|
+
}
|
|
12637
12758
|
isInvalidExtendedEscape = true;
|
|
12638
12759
|
} else if (text.charCodeAt(pos) === 125 /* closeBrace */) {
|
|
12639
12760
|
pos++;
|
|
12640
12761
|
} else {
|
|
12641
|
-
|
|
12762
|
+
if (shouldEmitInvalidEscapeError) {
|
|
12763
|
+
error2(Diagnostics.Unterminated_Unicode_escape_sequence);
|
|
12764
|
+
}
|
|
12642
12765
|
isInvalidExtendedEscape = true;
|
|
12643
12766
|
}
|
|
12644
12767
|
if (isInvalidExtendedEscape) {
|
|
12645
|
-
|
|
12768
|
+
tokenFlags |= 2048 /* ContainsInvalidEscape */;
|
|
12769
|
+
return text.substring(start2, pos);
|
|
12646
12770
|
}
|
|
12771
|
+
tokenFlags |= 8 /* ExtendedUnicodeEscape */;
|
|
12647
12772
|
return utf16EncodeAsString(escapedValue);
|
|
12648
12773
|
}
|
|
12649
12774
|
function peekUnicodeEscape() {
|
|
@@ -12685,9 +12810,10 @@ function createScanner(languageVersion, skipTrivia2, languageVariant = 0 /* Stan
|
|
|
12685
12810
|
} else if (ch === 92 /* backslash */) {
|
|
12686
12811
|
ch = peekExtendedUnicodeEscape();
|
|
12687
12812
|
if (ch >= 0 && isIdentifierPart(ch, languageVersion)) {
|
|
12688
|
-
|
|
12689
|
-
|
|
12690
|
-
|
|
12813
|
+
result += scanExtendedUnicodeEscape(
|
|
12814
|
+
/*shouldEmitInvalidEscapeError*/
|
|
12815
|
+
true
|
|
12816
|
+
);
|
|
12691
12817
|
start2 = pos;
|
|
12692
12818
|
continue;
|
|
12693
12819
|
}
|
|
@@ -13152,9 +13278,10 @@ function createScanner(languageVersion, skipTrivia2, languageVariant = 0 /* Stan
|
|
|
13152
13278
|
case 92 /* backslash */:
|
|
13153
13279
|
const extendedCookedChar = peekExtendedUnicodeEscape();
|
|
13154
13280
|
if (extendedCookedChar >= 0 && isIdentifierStart(extendedCookedChar, languageVersion)) {
|
|
13155
|
-
|
|
13156
|
-
|
|
13157
|
-
|
|
13281
|
+
tokenValue = scanExtendedUnicodeEscape(
|
|
13282
|
+
/*shouldEmitInvalidEscapeError*/
|
|
13283
|
+
true
|
|
13284
|
+
) + scanIdentifierParts();
|
|
13158
13285
|
return token = getIdentifierToken();
|
|
13159
13286
|
}
|
|
13160
13287
|
const cookedChar = peekUnicodeEscape();
|
|
@@ -13169,7 +13296,7 @@ function createScanner(languageVersion, skipTrivia2, languageVariant = 0 /* Stan
|
|
|
13169
13296
|
return token = 0 /* Unknown */;
|
|
13170
13297
|
case 35 /* hash */:
|
|
13171
13298
|
if (pos !== 0 && text[pos + 1] === "!") {
|
|
13172
|
-
error2(Diagnostics.can_only_be_used_at_the_start_of_a_file);
|
|
13299
|
+
error2(Diagnostics.can_only_be_used_at_the_start_of_a_file, pos, 2);
|
|
13173
13300
|
pos++;
|
|
13174
13301
|
return token = 0 /* Unknown */;
|
|
13175
13302
|
}
|
|
@@ -13178,9 +13305,10 @@ function createScanner(languageVersion, skipTrivia2, languageVariant = 0 /* Stan
|
|
|
13178
13305
|
pos++;
|
|
13179
13306
|
const extendedCookedChar2 = peekExtendedUnicodeEscape();
|
|
13180
13307
|
if (extendedCookedChar2 >= 0 && isIdentifierStart(extendedCookedChar2, languageVersion)) {
|
|
13181
|
-
|
|
13182
|
-
|
|
13183
|
-
|
|
13308
|
+
tokenValue = "#" + scanExtendedUnicodeEscape(
|
|
13309
|
+
/*shouldEmitInvalidEscapeError*/
|
|
13310
|
+
true
|
|
13311
|
+
) + scanIdentifierParts();
|
|
13184
13312
|
return token = 81 /* PrivateIdentifier */;
|
|
13185
13313
|
}
|
|
13186
13314
|
const cookedChar2 = peekUnicodeEscape();
|
|
@@ -13321,14 +13449,841 @@ function createScanner(languageVersion, skipTrivia2, languageVariant = 0 /* Stan
|
|
|
13321
13449
|
}
|
|
13322
13450
|
p++;
|
|
13323
13451
|
}
|
|
13324
|
-
|
|
13452
|
+
const isUnterminated = !!(tokenFlags & 4 /* Unterminated */);
|
|
13453
|
+
const endOfBody = p - (isUnterminated ? 0 : 1);
|
|
13454
|
+
let regExpFlags = 0 /* None */;
|
|
13455
|
+
while (p < end) {
|
|
13456
|
+
const ch = text.charCodeAt(p);
|
|
13457
|
+
if (!isIdentifierPart(ch, languageVersion)) {
|
|
13458
|
+
break;
|
|
13459
|
+
}
|
|
13460
|
+
const flag = characterToRegularExpressionFlag(String.fromCharCode(ch));
|
|
13461
|
+
if (flag === void 0) {
|
|
13462
|
+
error2(Diagnostics.Unknown_regular_expression_flag, p, 1);
|
|
13463
|
+
} else if (regExpFlags & flag) {
|
|
13464
|
+
error2(Diagnostics.Duplicate_regular_expression_flag, p, 1);
|
|
13465
|
+
} else if (((regExpFlags | flag) & 96 /* UnicodeMode */) === 96 /* UnicodeMode */) {
|
|
13466
|
+
error2(Diagnostics.The_Unicode_u_flag_and_the_Unicode_Sets_v_flag_cannot_be_set_simultaneously, p, 1);
|
|
13467
|
+
} else {
|
|
13468
|
+
regExpFlags |= flag;
|
|
13469
|
+
const availableFrom = regExpFlagToFirstAvailableLanguageVersion.get(flag);
|
|
13470
|
+
if (languageVersion < availableFrom) {
|
|
13471
|
+
error2(Diagnostics.This_regular_expression_flag_is_only_available_when_targeting_0_or_later, p, 1, getNameOfScriptTarget(availableFrom));
|
|
13472
|
+
}
|
|
13473
|
+
}
|
|
13325
13474
|
p++;
|
|
13326
13475
|
}
|
|
13327
|
-
pos =
|
|
13476
|
+
pos = tokenStart + 1;
|
|
13477
|
+
const saveTokenPos = tokenStart;
|
|
13478
|
+
const saveTokenFlags = tokenFlags;
|
|
13479
|
+
scanRegularExpressionWorker(text, endOfBody, regExpFlags, isUnterminated);
|
|
13480
|
+
if (!isUnterminated) {
|
|
13481
|
+
pos = p;
|
|
13482
|
+
}
|
|
13483
|
+
tokenStart = saveTokenPos;
|
|
13484
|
+
tokenFlags = saveTokenFlags;
|
|
13328
13485
|
tokenValue = text.substring(tokenStart, pos);
|
|
13329
13486
|
token = 14 /* RegularExpressionLiteral */;
|
|
13330
13487
|
}
|
|
13331
13488
|
return token;
|
|
13489
|
+
function scanRegularExpressionWorker(text2, end2, regExpFlags, isUnterminated) {
|
|
13490
|
+
const unicodeMode = !!(regExpFlags & 96 /* UnicodeMode */);
|
|
13491
|
+
const unicodeSetsMode = !!(regExpFlags & 64 /* UnicodeSets */);
|
|
13492
|
+
let mayContainStrings = false;
|
|
13493
|
+
let numberOfCapturingGroups = 0;
|
|
13494
|
+
const groupSpecifiers = /* @__PURE__ */ new Set();
|
|
13495
|
+
const groupNameReferences = [];
|
|
13496
|
+
const decimalEscapes = [];
|
|
13497
|
+
const namedCapturingGroups = [];
|
|
13498
|
+
function scanDisjunction(isInGroup) {
|
|
13499
|
+
while (true) {
|
|
13500
|
+
namedCapturingGroups.push(/* @__PURE__ */ new Set());
|
|
13501
|
+
scanAlternative(isInGroup);
|
|
13502
|
+
namedCapturingGroups.pop();
|
|
13503
|
+
if (text2.charCodeAt(pos) !== 124 /* bar */) {
|
|
13504
|
+
return;
|
|
13505
|
+
}
|
|
13506
|
+
pos++;
|
|
13507
|
+
}
|
|
13508
|
+
}
|
|
13509
|
+
function scanAlternative(isInGroup) {
|
|
13510
|
+
let isPreviousTermQuantifiable = false;
|
|
13511
|
+
while (pos < end2) {
|
|
13512
|
+
const start2 = pos;
|
|
13513
|
+
const ch = text2.charCodeAt(pos);
|
|
13514
|
+
switch (ch) {
|
|
13515
|
+
case 94 /* caret */:
|
|
13516
|
+
case 36 /* $ */:
|
|
13517
|
+
pos++;
|
|
13518
|
+
isPreviousTermQuantifiable = false;
|
|
13519
|
+
break;
|
|
13520
|
+
case 92 /* backslash */:
|
|
13521
|
+
pos++;
|
|
13522
|
+
switch (text2.charCodeAt(pos)) {
|
|
13523
|
+
case 98 /* b */:
|
|
13524
|
+
case 66 /* B */:
|
|
13525
|
+
pos++;
|
|
13526
|
+
isPreviousTermQuantifiable = false;
|
|
13527
|
+
break;
|
|
13528
|
+
default:
|
|
13529
|
+
scanAtomEscape();
|
|
13530
|
+
isPreviousTermQuantifiable = true;
|
|
13531
|
+
break;
|
|
13532
|
+
}
|
|
13533
|
+
break;
|
|
13534
|
+
case 40 /* openParen */:
|
|
13535
|
+
pos++;
|
|
13536
|
+
if (text2.charCodeAt(pos) === 63 /* question */) {
|
|
13537
|
+
pos++;
|
|
13538
|
+
switch (text2.charCodeAt(pos)) {
|
|
13539
|
+
case 61 /* equals */:
|
|
13540
|
+
case 33 /* exclamation */:
|
|
13541
|
+
pos++;
|
|
13542
|
+
isPreviousTermQuantifiable = false;
|
|
13543
|
+
break;
|
|
13544
|
+
case 60 /* lessThan */:
|
|
13545
|
+
const groupNameStart = pos;
|
|
13546
|
+
pos++;
|
|
13547
|
+
switch (text2.charCodeAt(pos)) {
|
|
13548
|
+
case 61 /* equals */:
|
|
13549
|
+
case 33 /* exclamation */:
|
|
13550
|
+
pos++;
|
|
13551
|
+
isPreviousTermQuantifiable = false;
|
|
13552
|
+
break;
|
|
13553
|
+
default:
|
|
13554
|
+
scanGroupName(
|
|
13555
|
+
/*isReference*/
|
|
13556
|
+
false
|
|
13557
|
+
);
|
|
13558
|
+
scanExpectedChar(62 /* greaterThan */);
|
|
13559
|
+
if (languageVersion < 5 /* ES2018 */) {
|
|
13560
|
+
error2(Diagnostics.Named_capturing_groups_are_only_available_when_targeting_ES2018_or_later, groupNameStart, pos - groupNameStart);
|
|
13561
|
+
}
|
|
13562
|
+
numberOfCapturingGroups++;
|
|
13563
|
+
isPreviousTermQuantifiable = true;
|
|
13564
|
+
break;
|
|
13565
|
+
}
|
|
13566
|
+
break;
|
|
13567
|
+
default:
|
|
13568
|
+
const start3 = pos;
|
|
13569
|
+
const setFlags = scanPatternModifiers(0 /* None */);
|
|
13570
|
+
if (text2.charCodeAt(pos) === 45 /* minus */) {
|
|
13571
|
+
pos++;
|
|
13572
|
+
scanPatternModifiers(setFlags);
|
|
13573
|
+
if (pos === start3 + 1) {
|
|
13574
|
+
error2(Diagnostics.Subpattern_flags_must_be_present_when_there_is_a_minus_sign, start3, pos - start3);
|
|
13575
|
+
}
|
|
13576
|
+
}
|
|
13577
|
+
scanExpectedChar(58 /* colon */);
|
|
13578
|
+
isPreviousTermQuantifiable = true;
|
|
13579
|
+
break;
|
|
13580
|
+
}
|
|
13581
|
+
} else {
|
|
13582
|
+
numberOfCapturingGroups++;
|
|
13583
|
+
isPreviousTermQuantifiable = true;
|
|
13584
|
+
}
|
|
13585
|
+
scanDisjunction(
|
|
13586
|
+
/*isInGroup*/
|
|
13587
|
+
true
|
|
13588
|
+
);
|
|
13589
|
+
scanExpectedChar(41 /* closeParen */);
|
|
13590
|
+
break;
|
|
13591
|
+
case 123 /* openBrace */:
|
|
13592
|
+
pos++;
|
|
13593
|
+
const digitsStart = pos;
|
|
13594
|
+
scanDigits();
|
|
13595
|
+
const min2 = tokenValue;
|
|
13596
|
+
if (text2.charCodeAt(pos) === 44 /* comma */) {
|
|
13597
|
+
pos++;
|
|
13598
|
+
scanDigits();
|
|
13599
|
+
const max = tokenValue;
|
|
13600
|
+
if (!min2) {
|
|
13601
|
+
if (max || text2.charCodeAt(pos) === 125 /* closeBrace */) {
|
|
13602
|
+
error2(Diagnostics.Incomplete_quantifier_Digit_expected, digitsStart, 0);
|
|
13603
|
+
} else {
|
|
13604
|
+
if (unicodeMode) {
|
|
13605
|
+
error2(Diagnostics.Unexpected_0_Did_you_mean_to_escape_it_with_backslash, start2, 1, String.fromCharCode(ch));
|
|
13606
|
+
}
|
|
13607
|
+
isPreviousTermQuantifiable = true;
|
|
13608
|
+
break;
|
|
13609
|
+
}
|
|
13610
|
+
}
|
|
13611
|
+
if (max && Number.parseInt(min2) > Number.parseInt(max)) {
|
|
13612
|
+
error2(Diagnostics.Numbers_out_of_order_in_quantifier, digitsStart, pos - digitsStart);
|
|
13613
|
+
}
|
|
13614
|
+
} else if (!min2) {
|
|
13615
|
+
if (unicodeMode) {
|
|
13616
|
+
error2(Diagnostics.Unexpected_0_Did_you_mean_to_escape_it_with_backslash, start2, 1, String.fromCharCode(ch));
|
|
13617
|
+
}
|
|
13618
|
+
isPreviousTermQuantifiable = true;
|
|
13619
|
+
break;
|
|
13620
|
+
}
|
|
13621
|
+
scanExpectedChar(125 /* closeBrace */);
|
|
13622
|
+
pos--;
|
|
13623
|
+
case 42 /* asterisk */:
|
|
13624
|
+
case 43 /* plus */:
|
|
13625
|
+
case 63 /* question */:
|
|
13626
|
+
pos++;
|
|
13627
|
+
if (text2.charCodeAt(pos) === 63 /* question */) {
|
|
13628
|
+
pos++;
|
|
13629
|
+
}
|
|
13630
|
+
if (!isPreviousTermQuantifiable) {
|
|
13631
|
+
error2(Diagnostics.There_is_nothing_available_for_repetition, start2, pos - start2);
|
|
13632
|
+
}
|
|
13633
|
+
isPreviousTermQuantifiable = false;
|
|
13634
|
+
break;
|
|
13635
|
+
case 46 /* dot */:
|
|
13636
|
+
pos++;
|
|
13637
|
+
isPreviousTermQuantifiable = true;
|
|
13638
|
+
break;
|
|
13639
|
+
case 91 /* openBracket */:
|
|
13640
|
+
pos++;
|
|
13641
|
+
if (unicodeSetsMode) {
|
|
13642
|
+
scanClassSetExpression();
|
|
13643
|
+
} else {
|
|
13644
|
+
scanClassRanges();
|
|
13645
|
+
}
|
|
13646
|
+
scanExpectedChar(93 /* closeBracket */);
|
|
13647
|
+
isPreviousTermQuantifiable = true;
|
|
13648
|
+
break;
|
|
13649
|
+
case 41 /* closeParen */:
|
|
13650
|
+
if (isInGroup) {
|
|
13651
|
+
return;
|
|
13652
|
+
}
|
|
13653
|
+
case 93 /* closeBracket */:
|
|
13654
|
+
case 125 /* closeBrace */:
|
|
13655
|
+
if (isUnterminated && !isInGroup) {
|
|
13656
|
+
return;
|
|
13657
|
+
}
|
|
13658
|
+
if (unicodeMode || ch === 41 /* closeParen */) {
|
|
13659
|
+
error2(Diagnostics.Unexpected_0_Did_you_mean_to_escape_it_with_backslash, pos, 1, String.fromCharCode(ch));
|
|
13660
|
+
}
|
|
13661
|
+
pos++;
|
|
13662
|
+
isPreviousTermQuantifiable = true;
|
|
13663
|
+
break;
|
|
13664
|
+
case 47 /* slash */:
|
|
13665
|
+
case 124 /* bar */:
|
|
13666
|
+
return;
|
|
13667
|
+
default:
|
|
13668
|
+
scanSourceCharacter();
|
|
13669
|
+
isPreviousTermQuantifiable = true;
|
|
13670
|
+
break;
|
|
13671
|
+
}
|
|
13672
|
+
}
|
|
13673
|
+
}
|
|
13674
|
+
function scanPatternModifiers(currFlags) {
|
|
13675
|
+
while (pos < end2) {
|
|
13676
|
+
const ch = text2.charCodeAt(pos);
|
|
13677
|
+
if (!isIdentifierPart(ch, languageVersion)) {
|
|
13678
|
+
break;
|
|
13679
|
+
}
|
|
13680
|
+
const flag = characterToRegularExpressionFlag(String.fromCharCode(ch));
|
|
13681
|
+
if (flag === void 0) {
|
|
13682
|
+
error2(Diagnostics.Unknown_regular_expression_flag, pos, 1);
|
|
13683
|
+
} else if (currFlags & flag) {
|
|
13684
|
+
error2(Diagnostics.Duplicate_regular_expression_flag, pos, 1);
|
|
13685
|
+
} else if (!(flag & 28 /* Modifiers */)) {
|
|
13686
|
+
error2(Diagnostics.This_regular_expression_flag_cannot_be_toggled_within_a_subpattern, pos, 1);
|
|
13687
|
+
} else {
|
|
13688
|
+
currFlags |= flag;
|
|
13689
|
+
const availableFrom = regExpFlagToFirstAvailableLanguageVersion.get(flag);
|
|
13690
|
+
if (languageVersion < availableFrom) {
|
|
13691
|
+
error2(Diagnostics.This_regular_expression_flag_is_only_available_when_targeting_0_or_later, pos, 1, getNameOfScriptTarget(availableFrom));
|
|
13692
|
+
}
|
|
13693
|
+
}
|
|
13694
|
+
pos++;
|
|
13695
|
+
}
|
|
13696
|
+
return currFlags;
|
|
13697
|
+
}
|
|
13698
|
+
function scanAtomEscape() {
|
|
13699
|
+
Debug.assertEqual(text2.charCodeAt(pos - 1), 92 /* backslash */);
|
|
13700
|
+
switch (text2.charCodeAt(pos)) {
|
|
13701
|
+
case 107 /* k */:
|
|
13702
|
+
pos++;
|
|
13703
|
+
if (text2.charCodeAt(pos) === 60 /* lessThan */) {
|
|
13704
|
+
pos++;
|
|
13705
|
+
scanGroupName(
|
|
13706
|
+
/*isReference*/
|
|
13707
|
+
true
|
|
13708
|
+
);
|
|
13709
|
+
scanExpectedChar(62 /* greaterThan */);
|
|
13710
|
+
} else if (unicodeMode) {
|
|
13711
|
+
error2(Diagnostics.k_must_be_followed_by_a_capturing_group_name_enclosed_in_angle_brackets, pos - 2, 2);
|
|
13712
|
+
}
|
|
13713
|
+
break;
|
|
13714
|
+
case 113 /* q */:
|
|
13715
|
+
if (unicodeSetsMode) {
|
|
13716
|
+
pos++;
|
|
13717
|
+
error2(Diagnostics.q_is_only_available_inside_character_class, pos - 2, 2);
|
|
13718
|
+
break;
|
|
13719
|
+
}
|
|
13720
|
+
default:
|
|
13721
|
+
Debug.assert(scanCharacterClassEscape() || scanDecimalEscape() || scanCharacterEscape());
|
|
13722
|
+
break;
|
|
13723
|
+
}
|
|
13724
|
+
}
|
|
13725
|
+
function scanDecimalEscape() {
|
|
13726
|
+
Debug.assertEqual(text2.charCodeAt(pos - 1), 92 /* backslash */);
|
|
13727
|
+
const ch = text2.charCodeAt(pos);
|
|
13728
|
+
if (ch >= 49 /* _1 */ && ch <= 57 /* _9 */) {
|
|
13729
|
+
const start2 = pos;
|
|
13730
|
+
scanDigits();
|
|
13731
|
+
decimalEscapes.push({ pos: start2, end: pos, value: +tokenValue });
|
|
13732
|
+
return true;
|
|
13733
|
+
}
|
|
13734
|
+
return false;
|
|
13735
|
+
}
|
|
13736
|
+
function scanCharacterEscape() {
|
|
13737
|
+
Debug.assertEqual(text2.charCodeAt(pos - 1), 92 /* backslash */);
|
|
13738
|
+
let ch = text2.charCodeAt(pos);
|
|
13739
|
+
switch (ch) {
|
|
13740
|
+
case 99 /* c */:
|
|
13741
|
+
pos++;
|
|
13742
|
+
ch = text2.charCodeAt(pos);
|
|
13743
|
+
if (isASCIILetter(ch)) {
|
|
13744
|
+
pos++;
|
|
13745
|
+
return String.fromCharCode(ch & 31);
|
|
13746
|
+
}
|
|
13747
|
+
if (unicodeMode) {
|
|
13748
|
+
error2(Diagnostics.c_must_be_followed_by_an_ASCII_letter, pos - 2, 2);
|
|
13749
|
+
}
|
|
13750
|
+
return String.fromCharCode(ch);
|
|
13751
|
+
case 94 /* caret */:
|
|
13752
|
+
case 36 /* $ */:
|
|
13753
|
+
case 47 /* slash */:
|
|
13754
|
+
case 92 /* backslash */:
|
|
13755
|
+
case 46 /* dot */:
|
|
13756
|
+
case 42 /* asterisk */:
|
|
13757
|
+
case 43 /* plus */:
|
|
13758
|
+
case 63 /* question */:
|
|
13759
|
+
case 40 /* openParen */:
|
|
13760
|
+
case 41 /* closeParen */:
|
|
13761
|
+
case 91 /* openBracket */:
|
|
13762
|
+
case 93 /* closeBracket */:
|
|
13763
|
+
case 123 /* openBrace */:
|
|
13764
|
+
case 125 /* closeBrace */:
|
|
13765
|
+
case 124 /* bar */:
|
|
13766
|
+
pos++;
|
|
13767
|
+
return String.fromCharCode(ch);
|
|
13768
|
+
default:
|
|
13769
|
+
if (pos >= end2) {
|
|
13770
|
+
error2(Diagnostics.Undetermined_character_escape, pos - 1, 1, ch);
|
|
13771
|
+
return "\\";
|
|
13772
|
+
}
|
|
13773
|
+
pos--;
|
|
13774
|
+
return scanEscapeSequence(
|
|
13775
|
+
/*shouldEmitInvalidEscapeError*/
|
|
13776
|
+
unicodeMode,
|
|
13777
|
+
/*isRegularExpression*/
|
|
13778
|
+
true
|
|
13779
|
+
);
|
|
13780
|
+
}
|
|
13781
|
+
}
|
|
13782
|
+
function scanGroupName(isReference) {
|
|
13783
|
+
Debug.assertEqual(text2.charCodeAt(pos - 1), 60 /* lessThan */);
|
|
13784
|
+
tokenStart = pos;
|
|
13785
|
+
scanIdentifier(codePointAt(text2, pos), languageVersion);
|
|
13786
|
+
if (pos === tokenStart) {
|
|
13787
|
+
error2(Diagnostics.Expected_a_capturing_group_name);
|
|
13788
|
+
} else if (isReference) {
|
|
13789
|
+
groupNameReferences.push({ pos: tokenStart, end: pos, name: tokenValue });
|
|
13790
|
+
} else if (namedCapturingGroups.some((group2) => group2.has(tokenValue))) {
|
|
13791
|
+
error2(Diagnostics.Named_capturing_groups_with_the_same_name_must_be_mutually_exclusive_to_each_other, tokenStart, pos - tokenStart);
|
|
13792
|
+
} else {
|
|
13793
|
+
last(namedCapturingGroups).add(tokenValue);
|
|
13794
|
+
groupSpecifiers.add(tokenValue);
|
|
13795
|
+
}
|
|
13796
|
+
}
|
|
13797
|
+
function isClassContentExit(ch) {
|
|
13798
|
+
return ch === 93 /* closeBracket */ || pos >= end2;
|
|
13799
|
+
}
|
|
13800
|
+
function scanClassRanges() {
|
|
13801
|
+
Debug.assertEqual(text2.charCodeAt(pos - 1), 91 /* openBracket */);
|
|
13802
|
+
if (text2.charCodeAt(pos) === 94 /* caret */) {
|
|
13803
|
+
pos++;
|
|
13804
|
+
}
|
|
13805
|
+
while (pos < end2) {
|
|
13806
|
+
const ch = text2.charCodeAt(pos);
|
|
13807
|
+
if (isClassContentExit(ch)) {
|
|
13808
|
+
return;
|
|
13809
|
+
}
|
|
13810
|
+
const minStart = pos;
|
|
13811
|
+
const minCharacter = scanClassAtom();
|
|
13812
|
+
if (text2.charCodeAt(pos) === 45 /* minus */) {
|
|
13813
|
+
pos++;
|
|
13814
|
+
const ch2 = text2.charCodeAt(pos);
|
|
13815
|
+
if (isClassContentExit(ch2)) {
|
|
13816
|
+
return;
|
|
13817
|
+
}
|
|
13818
|
+
if (!minCharacter) {
|
|
13819
|
+
error2(Diagnostics.A_character_class_range_must_not_be_bounded_by_another_character_class, minStart, pos - 1 - minStart);
|
|
13820
|
+
}
|
|
13821
|
+
const maxStart = pos;
|
|
13822
|
+
const maxCharacter = scanClassAtom();
|
|
13823
|
+
if (!maxCharacter) {
|
|
13824
|
+
error2(Diagnostics.A_character_class_range_must_not_be_bounded_by_another_character_class, maxStart, pos - maxStart);
|
|
13825
|
+
continue;
|
|
13826
|
+
}
|
|
13827
|
+
if (!minCharacter) {
|
|
13828
|
+
continue;
|
|
13829
|
+
}
|
|
13830
|
+
const minCharacterValue = codePointAt(minCharacter, 0);
|
|
13831
|
+
const maxCharacterValue = codePointAt(maxCharacter, 0);
|
|
13832
|
+
if (minCharacter.length === charSize(minCharacterValue) && maxCharacter.length === charSize(maxCharacterValue) && minCharacterValue > maxCharacterValue) {
|
|
13833
|
+
error2(Diagnostics.Range_out_of_order_in_character_class, minStart, pos - minStart);
|
|
13834
|
+
}
|
|
13835
|
+
}
|
|
13836
|
+
}
|
|
13837
|
+
}
|
|
13838
|
+
function scanClassSetExpression() {
|
|
13839
|
+
Debug.assertEqual(text2.charCodeAt(pos - 1), 91 /* openBracket */);
|
|
13840
|
+
let isCharacterComplement = false;
|
|
13841
|
+
if (text2.charCodeAt(pos) === 94 /* caret */) {
|
|
13842
|
+
pos++;
|
|
13843
|
+
isCharacterComplement = true;
|
|
13844
|
+
}
|
|
13845
|
+
let expressionMayContainStrings = false;
|
|
13846
|
+
let ch = text2.charCodeAt(pos);
|
|
13847
|
+
if (isClassContentExit(ch)) {
|
|
13848
|
+
return;
|
|
13849
|
+
}
|
|
13850
|
+
let start2 = pos;
|
|
13851
|
+
let oprand;
|
|
13852
|
+
switch (text2.slice(pos, pos + 2)) {
|
|
13853
|
+
case "--":
|
|
13854
|
+
case "&&":
|
|
13855
|
+
error2(Diagnostics.Expected_a_class_set_oprand);
|
|
13856
|
+
mayContainStrings = false;
|
|
13857
|
+
break;
|
|
13858
|
+
default:
|
|
13859
|
+
oprand = scanClassSetOprand();
|
|
13860
|
+
break;
|
|
13861
|
+
}
|
|
13862
|
+
switch (text2.charCodeAt(pos)) {
|
|
13863
|
+
case 45 /* minus */:
|
|
13864
|
+
if (text2.charCodeAt(pos + 1) === 45 /* minus */) {
|
|
13865
|
+
if (isCharacterComplement && mayContainStrings) {
|
|
13866
|
+
error2(Diagnostics.Anything_that_would_possibly_match_more_than_a_single_character_is_invalid_inside_a_negated_character_class, start2, pos - start2);
|
|
13867
|
+
}
|
|
13868
|
+
expressionMayContainStrings = mayContainStrings;
|
|
13869
|
+
scanClassSetSubExpression(3 /* ClassSubtraction */);
|
|
13870
|
+
mayContainStrings = !isCharacterComplement && expressionMayContainStrings;
|
|
13871
|
+
return;
|
|
13872
|
+
}
|
|
13873
|
+
break;
|
|
13874
|
+
case 38 /* ampersand */:
|
|
13875
|
+
if (text2.charCodeAt(pos + 1) === 38 /* ampersand */) {
|
|
13876
|
+
scanClassSetSubExpression(2 /* ClassIntersection */);
|
|
13877
|
+
if (isCharacterComplement && mayContainStrings) {
|
|
13878
|
+
error2(Diagnostics.Anything_that_would_possibly_match_more_than_a_single_character_is_invalid_inside_a_negated_character_class, start2, pos - start2);
|
|
13879
|
+
}
|
|
13880
|
+
expressionMayContainStrings = mayContainStrings;
|
|
13881
|
+
mayContainStrings = !isCharacterComplement && expressionMayContainStrings;
|
|
13882
|
+
return;
|
|
13883
|
+
} else {
|
|
13884
|
+
error2(Diagnostics.Unexpected_0_Did_you_mean_to_escape_it_with_backslash, pos, 1, String.fromCharCode(ch));
|
|
13885
|
+
}
|
|
13886
|
+
break;
|
|
13887
|
+
default:
|
|
13888
|
+
if (isCharacterComplement && mayContainStrings) {
|
|
13889
|
+
error2(Diagnostics.Anything_that_would_possibly_match_more_than_a_single_character_is_invalid_inside_a_negated_character_class, start2, pos - start2);
|
|
13890
|
+
}
|
|
13891
|
+
expressionMayContainStrings = mayContainStrings;
|
|
13892
|
+
break;
|
|
13893
|
+
}
|
|
13894
|
+
while (pos < end2) {
|
|
13895
|
+
ch = text2.charCodeAt(pos);
|
|
13896
|
+
switch (ch) {
|
|
13897
|
+
case 45 /* minus */:
|
|
13898
|
+
pos++;
|
|
13899
|
+
ch = text2.charCodeAt(pos);
|
|
13900
|
+
if (isClassContentExit(ch)) {
|
|
13901
|
+
mayContainStrings = !isCharacterComplement && expressionMayContainStrings;
|
|
13902
|
+
return;
|
|
13903
|
+
}
|
|
13904
|
+
if (ch === 45 /* minus */) {
|
|
13905
|
+
pos++;
|
|
13906
|
+
error2(Diagnostics.Operators_must_not_be_mixed_within_a_character_class_Wrap_it_in_a_nested_class_instead, pos - 2, 2);
|
|
13907
|
+
start2 = pos - 2;
|
|
13908
|
+
oprand = text2.slice(start2, pos);
|
|
13909
|
+
continue;
|
|
13910
|
+
} else {
|
|
13911
|
+
if (!oprand) {
|
|
13912
|
+
error2(Diagnostics.A_character_class_range_must_not_be_bounded_by_another_character_class, start2, pos - 1 - start2);
|
|
13913
|
+
}
|
|
13914
|
+
const secondStart = pos;
|
|
13915
|
+
const secondOprand = scanClassSetOprand();
|
|
13916
|
+
if (isCharacterComplement && mayContainStrings) {
|
|
13917
|
+
error2(Diagnostics.Anything_that_would_possibly_match_more_than_a_single_character_is_invalid_inside_a_negated_character_class, secondStart, pos - secondStart);
|
|
13918
|
+
}
|
|
13919
|
+
expressionMayContainStrings || (expressionMayContainStrings = mayContainStrings);
|
|
13920
|
+
if (!secondOprand) {
|
|
13921
|
+
error2(Diagnostics.A_character_class_range_must_not_be_bounded_by_another_character_class, secondStart, pos - secondStart);
|
|
13922
|
+
break;
|
|
13923
|
+
}
|
|
13924
|
+
if (!oprand) {
|
|
13925
|
+
break;
|
|
13926
|
+
}
|
|
13927
|
+
const minCharacterValue = codePointAt(oprand, 0);
|
|
13928
|
+
const maxCharacterValue = codePointAt(secondOprand, 0);
|
|
13929
|
+
if (oprand.length === charSize(minCharacterValue) && secondOprand.length === charSize(maxCharacterValue) && minCharacterValue > maxCharacterValue) {
|
|
13930
|
+
error2(Diagnostics.Range_out_of_order_in_character_class, start2, pos - start2);
|
|
13931
|
+
}
|
|
13932
|
+
}
|
|
13933
|
+
break;
|
|
13934
|
+
case 38 /* ampersand */:
|
|
13935
|
+
start2 = pos;
|
|
13936
|
+
pos++;
|
|
13937
|
+
if (text2.charCodeAt(pos) === 38 /* ampersand */) {
|
|
13938
|
+
pos++;
|
|
13939
|
+
error2(Diagnostics.Operators_must_not_be_mixed_within_a_character_class_Wrap_it_in_a_nested_class_instead, pos - 2, 2);
|
|
13940
|
+
if (text2.charCodeAt(pos) === 38 /* ampersand */) {
|
|
13941
|
+
error2(Diagnostics.Unexpected_0_Did_you_mean_to_escape_it_with_backslash, pos, 1, String.fromCharCode(ch));
|
|
13942
|
+
pos++;
|
|
13943
|
+
}
|
|
13944
|
+
} else {
|
|
13945
|
+
error2(Diagnostics.Unexpected_0_Did_you_mean_to_escape_it_with_backslash, pos - 1, 1, String.fromCharCode(ch));
|
|
13946
|
+
}
|
|
13947
|
+
oprand = text2.slice(start2, pos);
|
|
13948
|
+
continue;
|
|
13949
|
+
}
|
|
13950
|
+
if (isClassContentExit(text2.charCodeAt(pos))) {
|
|
13951
|
+
break;
|
|
13952
|
+
}
|
|
13953
|
+
start2 = pos;
|
|
13954
|
+
switch (text2.slice(pos, pos + 2)) {
|
|
13955
|
+
case "--":
|
|
13956
|
+
case "&&":
|
|
13957
|
+
error2(Diagnostics.Operators_must_not_be_mixed_within_a_character_class_Wrap_it_in_a_nested_class_instead, pos, 2);
|
|
13958
|
+
pos += 2;
|
|
13959
|
+
oprand = text2.slice(start2, pos);
|
|
13960
|
+
break;
|
|
13961
|
+
default:
|
|
13962
|
+
oprand = scanClassSetOprand();
|
|
13963
|
+
break;
|
|
13964
|
+
}
|
|
13965
|
+
}
|
|
13966
|
+
mayContainStrings = !isCharacterComplement && expressionMayContainStrings;
|
|
13967
|
+
}
|
|
13968
|
+
function scanClassSetSubExpression(expressionType) {
|
|
13969
|
+
let expressionMayContainStrings = mayContainStrings;
|
|
13970
|
+
while (pos < end2) {
|
|
13971
|
+
let ch = text2.charCodeAt(pos);
|
|
13972
|
+
if (isClassContentExit(ch)) {
|
|
13973
|
+
break;
|
|
13974
|
+
}
|
|
13975
|
+
switch (ch) {
|
|
13976
|
+
case 45 /* minus */:
|
|
13977
|
+
pos++;
|
|
13978
|
+
if (text2.charCodeAt(pos) === 45 /* minus */) {
|
|
13979
|
+
pos++;
|
|
13980
|
+
if (expressionType !== 3 /* ClassSubtraction */) {
|
|
13981
|
+
error2(Diagnostics.Operators_must_not_be_mixed_within_a_character_class_Wrap_it_in_a_nested_class_instead, pos - 2, 2);
|
|
13982
|
+
}
|
|
13983
|
+
} else {
|
|
13984
|
+
error2(Diagnostics.Operators_must_not_be_mixed_within_a_character_class_Wrap_it_in_a_nested_class_instead, pos - 1, 1);
|
|
13985
|
+
}
|
|
13986
|
+
break;
|
|
13987
|
+
case 38 /* ampersand */:
|
|
13988
|
+
pos++;
|
|
13989
|
+
if (text2.charCodeAt(pos) === 38 /* ampersand */) {
|
|
13990
|
+
pos++;
|
|
13991
|
+
if (expressionType !== 2 /* ClassIntersection */) {
|
|
13992
|
+
error2(Diagnostics.Operators_must_not_be_mixed_within_a_character_class_Wrap_it_in_a_nested_class_instead, pos - 2, 2);
|
|
13993
|
+
}
|
|
13994
|
+
if (text2.charCodeAt(pos) === 38 /* ampersand */) {
|
|
13995
|
+
error2(Diagnostics.Unexpected_0_Did_you_mean_to_escape_it_with_backslash, pos, 1, String.fromCharCode(ch));
|
|
13996
|
+
pos++;
|
|
13997
|
+
}
|
|
13998
|
+
} else {
|
|
13999
|
+
error2(Diagnostics.Unexpected_0_Did_you_mean_to_escape_it_with_backslash, pos - 1, 1, String.fromCharCode(ch));
|
|
14000
|
+
}
|
|
14001
|
+
break;
|
|
14002
|
+
default:
|
|
14003
|
+
switch (expressionType) {
|
|
14004
|
+
case 3 /* ClassSubtraction */:
|
|
14005
|
+
error2(Diagnostics._0_expected, pos, 0, "--");
|
|
14006
|
+
break;
|
|
14007
|
+
case 2 /* ClassIntersection */:
|
|
14008
|
+
error2(Diagnostics._0_expected, pos, 0, "&&");
|
|
14009
|
+
break;
|
|
14010
|
+
default:
|
|
14011
|
+
break;
|
|
14012
|
+
}
|
|
14013
|
+
break;
|
|
14014
|
+
}
|
|
14015
|
+
ch = text2.charCodeAt(pos);
|
|
14016
|
+
if (isClassContentExit(ch)) {
|
|
14017
|
+
error2(Diagnostics.Expected_a_class_set_oprand);
|
|
14018
|
+
break;
|
|
14019
|
+
}
|
|
14020
|
+
scanClassSetOprand();
|
|
14021
|
+
expressionMayContainStrings && (expressionMayContainStrings = mayContainStrings);
|
|
14022
|
+
}
|
|
14023
|
+
mayContainStrings = expressionMayContainStrings;
|
|
14024
|
+
}
|
|
14025
|
+
function scanClassSetOprand() {
|
|
14026
|
+
mayContainStrings = false;
|
|
14027
|
+
switch (text2.charCodeAt(pos)) {
|
|
14028
|
+
case 91 /* openBracket */:
|
|
14029
|
+
pos++;
|
|
14030
|
+
scanClassSetExpression();
|
|
14031
|
+
scanExpectedChar(93 /* closeBracket */);
|
|
14032
|
+
return "";
|
|
14033
|
+
case 92 /* backslash */:
|
|
14034
|
+
pos++;
|
|
14035
|
+
if (scanCharacterClassEscape()) {
|
|
14036
|
+
return "";
|
|
14037
|
+
} else if (text2.charCodeAt(pos) === 113 /* q */) {
|
|
14038
|
+
pos++;
|
|
14039
|
+
if (text2.charCodeAt(pos) === 123 /* openBrace */) {
|
|
14040
|
+
pos++;
|
|
14041
|
+
scanClassStringDisjunctionContents();
|
|
14042
|
+
scanExpectedChar(125 /* closeBrace */);
|
|
14043
|
+
return "";
|
|
14044
|
+
} else {
|
|
14045
|
+
error2(Diagnostics.q_must_be_followed_by_string_alternatives_enclosed_in_braces, pos - 2, 2);
|
|
14046
|
+
return "q";
|
|
14047
|
+
}
|
|
14048
|
+
}
|
|
14049
|
+
pos--;
|
|
14050
|
+
default:
|
|
14051
|
+
return scanClassSetCharacter();
|
|
14052
|
+
}
|
|
14053
|
+
}
|
|
14054
|
+
function scanClassStringDisjunctionContents() {
|
|
14055
|
+
Debug.assertEqual(text2.charCodeAt(pos - 1), 123 /* openBrace */);
|
|
14056
|
+
let characterCount = 0;
|
|
14057
|
+
while (pos < end2) {
|
|
14058
|
+
const ch = text2.charCodeAt(pos);
|
|
14059
|
+
switch (ch) {
|
|
14060
|
+
case 125 /* closeBrace */:
|
|
14061
|
+
if (characterCount !== 1) {
|
|
14062
|
+
mayContainStrings = true;
|
|
14063
|
+
}
|
|
14064
|
+
return;
|
|
14065
|
+
case 124 /* bar */:
|
|
14066
|
+
if (characterCount !== 1) {
|
|
14067
|
+
mayContainStrings = true;
|
|
14068
|
+
}
|
|
14069
|
+
pos++;
|
|
14070
|
+
start = pos;
|
|
14071
|
+
characterCount = 0;
|
|
14072
|
+
break;
|
|
14073
|
+
default:
|
|
14074
|
+
scanClassSetCharacter();
|
|
14075
|
+
characterCount++;
|
|
14076
|
+
break;
|
|
14077
|
+
}
|
|
14078
|
+
}
|
|
14079
|
+
}
|
|
14080
|
+
function scanClassSetCharacter() {
|
|
14081
|
+
const ch = text2.charCodeAt(pos);
|
|
14082
|
+
if (ch === 92 /* backslash */) {
|
|
14083
|
+
pos++;
|
|
14084
|
+
const ch2 = text2.charCodeAt(pos);
|
|
14085
|
+
switch (ch2) {
|
|
14086
|
+
case 98 /* b */:
|
|
14087
|
+
pos++;
|
|
14088
|
+
return "\b";
|
|
14089
|
+
case 38 /* ampersand */:
|
|
14090
|
+
case 45 /* minus */:
|
|
14091
|
+
case 33 /* exclamation */:
|
|
14092
|
+
case 35 /* hash */:
|
|
14093
|
+
case 37 /* percent */:
|
|
14094
|
+
case 44 /* comma */:
|
|
14095
|
+
case 58 /* colon */:
|
|
14096
|
+
case 59 /* semicolon */:
|
|
14097
|
+
case 60 /* lessThan */:
|
|
14098
|
+
case 61 /* equals */:
|
|
14099
|
+
case 62 /* greaterThan */:
|
|
14100
|
+
case 64 /* at */:
|
|
14101
|
+
case 96 /* backtick */:
|
|
14102
|
+
case 126 /* tilde */:
|
|
14103
|
+
pos++;
|
|
14104
|
+
return String.fromCharCode(ch2);
|
|
14105
|
+
default:
|
|
14106
|
+
return scanCharacterEscape();
|
|
14107
|
+
}
|
|
14108
|
+
} else if (ch === text2.charCodeAt(pos + 1)) {
|
|
14109
|
+
switch (ch) {
|
|
14110
|
+
case 38 /* ampersand */:
|
|
14111
|
+
case 33 /* exclamation */:
|
|
14112
|
+
case 35 /* hash */:
|
|
14113
|
+
case 37 /* percent */:
|
|
14114
|
+
case 42 /* asterisk */:
|
|
14115
|
+
case 43 /* plus */:
|
|
14116
|
+
case 44 /* comma */:
|
|
14117
|
+
case 46 /* dot */:
|
|
14118
|
+
case 58 /* colon */:
|
|
14119
|
+
case 59 /* semicolon */:
|
|
14120
|
+
case 60 /* lessThan */:
|
|
14121
|
+
case 61 /* equals */:
|
|
14122
|
+
case 62 /* greaterThan */:
|
|
14123
|
+
case 63 /* question */:
|
|
14124
|
+
case 64 /* at */:
|
|
14125
|
+
case 96 /* backtick */:
|
|
14126
|
+
case 126 /* tilde */:
|
|
14127
|
+
error2(Diagnostics.A_character_class_must_not_contain_a_reserved_double_punctuator_Did_you_mean_to_escape_it_with_backslash, pos, 2);
|
|
14128
|
+
pos += 2;
|
|
14129
|
+
return text2.substring(pos - 2, pos);
|
|
14130
|
+
}
|
|
14131
|
+
}
|
|
14132
|
+
switch (ch) {
|
|
14133
|
+
case 47 /* slash */:
|
|
14134
|
+
case 40 /* openParen */:
|
|
14135
|
+
case 41 /* closeParen */:
|
|
14136
|
+
case 91 /* openBracket */:
|
|
14137
|
+
case 93 /* closeBracket */:
|
|
14138
|
+
case 123 /* openBrace */:
|
|
14139
|
+
case 125 /* closeBrace */:
|
|
14140
|
+
case 45 /* minus */:
|
|
14141
|
+
case 124 /* bar */:
|
|
14142
|
+
error2(Diagnostics.Unexpected_0_Did_you_mean_to_escape_it_with_backslash, pos, 1, String.fromCharCode(ch));
|
|
14143
|
+
pos++;
|
|
14144
|
+
return String.fromCharCode(ch);
|
|
14145
|
+
}
|
|
14146
|
+
return scanSourceCharacter();
|
|
14147
|
+
}
|
|
14148
|
+
function scanClassAtom() {
|
|
14149
|
+
if (text2.charCodeAt(pos) === 92 /* backslash */) {
|
|
14150
|
+
pos++;
|
|
14151
|
+
const ch = text2.charCodeAt(pos);
|
|
14152
|
+
switch (ch) {
|
|
14153
|
+
case 98 /* b */:
|
|
14154
|
+
pos++;
|
|
14155
|
+
return "\b";
|
|
14156
|
+
case 45 /* minus */:
|
|
14157
|
+
pos++;
|
|
14158
|
+
return String.fromCharCode(ch);
|
|
14159
|
+
default:
|
|
14160
|
+
if (scanCharacterClassEscape()) {
|
|
14161
|
+
return "";
|
|
14162
|
+
}
|
|
14163
|
+
return scanCharacterEscape();
|
|
14164
|
+
}
|
|
14165
|
+
} else {
|
|
14166
|
+
return scanSourceCharacter();
|
|
14167
|
+
}
|
|
14168
|
+
}
|
|
14169
|
+
function scanCharacterClassEscape() {
|
|
14170
|
+
Debug.assertEqual(text2.charCodeAt(pos - 1), 92 /* backslash */);
|
|
14171
|
+
let isCharacterComplement = false;
|
|
14172
|
+
const start2 = pos - 1;
|
|
14173
|
+
const ch = text2.charCodeAt(pos);
|
|
14174
|
+
switch (ch) {
|
|
14175
|
+
case 100 /* d */:
|
|
14176
|
+
case 68 /* D */:
|
|
14177
|
+
case 115 /* s */:
|
|
14178
|
+
case 83 /* S */:
|
|
14179
|
+
case 119 /* w */:
|
|
14180
|
+
case 87 /* W */:
|
|
14181
|
+
pos++;
|
|
14182
|
+
return true;
|
|
14183
|
+
case 80 /* P */:
|
|
14184
|
+
isCharacterComplement = true;
|
|
14185
|
+
case 112 /* p */:
|
|
14186
|
+
pos++;
|
|
14187
|
+
if (text2.charCodeAt(pos) === 123 /* openBrace */) {
|
|
14188
|
+
pos++;
|
|
14189
|
+
const propertyNameOrValueStart = pos;
|
|
14190
|
+
const propertyNameOrValue = scanWordCharacters();
|
|
14191
|
+
if (text2.charCodeAt(pos) === 61 /* equals */) {
|
|
14192
|
+
const propertyName = nonBinaryUnicodeProperties.get(propertyNameOrValue);
|
|
14193
|
+
if (pos === propertyNameOrValueStart) {
|
|
14194
|
+
error2(Diagnostics.Expected_a_Unicode_property_name);
|
|
14195
|
+
} else if (propertyName === void 0) {
|
|
14196
|
+
error2(Diagnostics.Unknown_Unicode_property_name, propertyNameOrValueStart, pos - propertyNameOrValueStart);
|
|
14197
|
+
const suggestion = getSpellingSuggestion(propertyNameOrValue, nonBinaryUnicodeProperties.keys(), identity);
|
|
14198
|
+
if (suggestion) {
|
|
14199
|
+
error2(Diagnostics.Did_you_mean_0, propertyNameOrValueStart, pos - propertyNameOrValueStart, suggestion);
|
|
14200
|
+
}
|
|
14201
|
+
}
|
|
14202
|
+
pos++;
|
|
14203
|
+
const propertyValueStart = pos;
|
|
14204
|
+
const propertyValue = scanWordCharacters();
|
|
14205
|
+
if (pos === propertyValueStart) {
|
|
14206
|
+
error2(Diagnostics.Expected_a_Unicode_property_value);
|
|
14207
|
+
} else if (propertyName !== void 0 && !valuesOfNonBinaryUnicodeProperties[propertyName].has(propertyValue)) {
|
|
14208
|
+
error2(Diagnostics.Unknown_Unicode_property_value, propertyValueStart, pos - propertyValueStart);
|
|
14209
|
+
const suggestion = getSpellingSuggestion(propertyValue, valuesOfNonBinaryUnicodeProperties[propertyName], identity);
|
|
14210
|
+
if (suggestion) {
|
|
14211
|
+
error2(Diagnostics.Did_you_mean_0, propertyValueStart, pos - propertyValueStart, suggestion);
|
|
14212
|
+
}
|
|
14213
|
+
}
|
|
14214
|
+
} else {
|
|
14215
|
+
if (pos === propertyNameOrValueStart) {
|
|
14216
|
+
error2(Diagnostics.Expected_a_Unicode_property_name_or_value);
|
|
14217
|
+
} else if (binaryUnicodePropertiesOfStrings.has(propertyNameOrValue)) {
|
|
14218
|
+
if (!unicodeSetsMode) {
|
|
14219
|
+
error2(Diagnostics.Any_Unicode_property_that_would_possibly_match_more_than_a_single_character_is_only_available_when_the_Unicode_Sets_v_flag_is_set, propertyNameOrValueStart, pos - propertyNameOrValueStart);
|
|
14220
|
+
} else if (isCharacterComplement) {
|
|
14221
|
+
error2(Diagnostics.Anything_that_would_possibly_match_more_than_a_single_character_is_invalid_inside_a_negated_character_class, propertyNameOrValueStart, pos - propertyNameOrValueStart);
|
|
14222
|
+
} else {
|
|
14223
|
+
mayContainStrings = true;
|
|
14224
|
+
}
|
|
14225
|
+
} else if (!valuesOfNonBinaryUnicodeProperties.General_Category.has(propertyNameOrValue) && !binaryUnicodeProperties.has(propertyNameOrValue)) {
|
|
14226
|
+
error2(Diagnostics.Unknown_Unicode_property_name_or_value, propertyNameOrValueStart, pos - propertyNameOrValueStart);
|
|
14227
|
+
const suggestion = getSpellingSuggestion(propertyNameOrValue, [...valuesOfNonBinaryUnicodeProperties.General_Category, ...binaryUnicodeProperties, ...binaryUnicodePropertiesOfStrings], identity);
|
|
14228
|
+
if (suggestion) {
|
|
14229
|
+
error2(Diagnostics.Did_you_mean_0, propertyNameOrValueStart, pos - propertyNameOrValueStart, suggestion);
|
|
14230
|
+
}
|
|
14231
|
+
}
|
|
14232
|
+
}
|
|
14233
|
+
scanExpectedChar(125 /* closeBrace */);
|
|
14234
|
+
if (!unicodeMode) {
|
|
14235
|
+
error2(Diagnostics.Unicode_property_value_expressions_are_only_available_when_the_Unicode_u_flag_or_the_Unicode_Sets_v_flag_is_set, start2, pos - start2);
|
|
14236
|
+
}
|
|
14237
|
+
} else if (unicodeMode) {
|
|
14238
|
+
error2(Diagnostics._0_must_be_followed_by_a_Unicode_property_value_expression_enclosed_in_braces, pos - 2, 2, String.fromCharCode(ch));
|
|
14239
|
+
}
|
|
14240
|
+
return true;
|
|
14241
|
+
}
|
|
14242
|
+
return false;
|
|
14243
|
+
}
|
|
14244
|
+
function scanWordCharacters() {
|
|
14245
|
+
let value = "";
|
|
14246
|
+
while (pos < end2) {
|
|
14247
|
+
const ch = text2.charCodeAt(pos);
|
|
14248
|
+
if (!isWordCharacter(ch)) {
|
|
14249
|
+
break;
|
|
14250
|
+
}
|
|
14251
|
+
value += String.fromCharCode(ch);
|
|
14252
|
+
pos++;
|
|
14253
|
+
}
|
|
14254
|
+
return value;
|
|
14255
|
+
}
|
|
14256
|
+
function scanSourceCharacter() {
|
|
14257
|
+
const size = unicodeMode ? charSize(codePointAt(text2, pos)) : 1;
|
|
14258
|
+
pos += size;
|
|
14259
|
+
return text2.substring(pos - size, pos);
|
|
14260
|
+
}
|
|
14261
|
+
function scanExpectedChar(ch) {
|
|
14262
|
+
if (text2.charCodeAt(pos) === ch) {
|
|
14263
|
+
pos++;
|
|
14264
|
+
} else {
|
|
14265
|
+
error2(Diagnostics._0_expected, pos, 0, String.fromCharCode(ch));
|
|
14266
|
+
}
|
|
14267
|
+
}
|
|
14268
|
+
scanDisjunction(
|
|
14269
|
+
/*isInGroup*/
|
|
14270
|
+
false
|
|
14271
|
+
);
|
|
14272
|
+
forEach(groupNameReferences, (reference) => {
|
|
14273
|
+
if (!groupSpecifiers.has(reference.name)) {
|
|
14274
|
+
error2(Diagnostics.There_is_no_capturing_group_named_0_in_this_regular_expression, reference.pos, reference.end - reference.pos, reference.name);
|
|
14275
|
+
}
|
|
14276
|
+
});
|
|
14277
|
+
forEach(decimalEscapes, (escape) => {
|
|
14278
|
+
if (escape.value > numberOfCapturingGroups) {
|
|
14279
|
+
if (numberOfCapturingGroups) {
|
|
14280
|
+
error2(Diagnostics.A_decimal_escape_must_refer_to_an_existent_capturing_group_There_are_only_0_capturing_groups_in_this_regular_expression, escape.pos, escape.end - escape.pos, numberOfCapturingGroups);
|
|
14281
|
+
} else {
|
|
14282
|
+
error2(Diagnostics.Decimal_escapes_are_invalid_when_there_are_no_capturing_groups_in_a_regular_expression, escape.pos, escape.end - escape.pos);
|
|
14283
|
+
}
|
|
14284
|
+
}
|
|
14285
|
+
});
|
|
14286
|
+
}
|
|
13332
14287
|
}
|
|
13333
14288
|
function appendIfCommentDirective(commentDirectives2, text2, commentDirectiveRegEx, lineStart) {
|
|
13334
14289
|
const type = getDirectiveFromComment(text2.trimStart(), commentDirectiveRegEx);
|
|
@@ -13555,9 +14510,10 @@ function createScanner(languageVersion, skipTrivia2, languageVariant = 0 /* Stan
|
|
|
13555
14510
|
pos--;
|
|
13556
14511
|
const extendedCookedChar = peekExtendedUnicodeEscape();
|
|
13557
14512
|
if (extendedCookedChar >= 0 && isIdentifierStart(extendedCookedChar, languageVersion)) {
|
|
13558
|
-
|
|
13559
|
-
|
|
13560
|
-
|
|
14513
|
+
tokenValue = scanExtendedUnicodeEscape(
|
|
14514
|
+
/*shouldEmitInvalidEscapeError*/
|
|
14515
|
+
true
|
|
14516
|
+
) + scanIdentifierParts();
|
|
13561
14517
|
return token = getIdentifierToken();
|
|
13562
14518
|
}
|
|
13563
14519
|
const cookedChar = peekUnicodeEscape();
|
|
@@ -13697,6 +14653,22 @@ var utf16EncodeAsStringWorker = String.fromCodePoint ? (codePoint) => String.fro
|
|
|
13697
14653
|
function utf16EncodeAsString(codePoint) {
|
|
13698
14654
|
return utf16EncodeAsStringWorker(codePoint);
|
|
13699
14655
|
}
|
|
14656
|
+
var nonBinaryUnicodeProperties = new Map(Object.entries({
|
|
14657
|
+
General_Category: "General_Category",
|
|
14658
|
+
gc: "General_Category",
|
|
14659
|
+
Script: "Script",
|
|
14660
|
+
sc: "Script",
|
|
14661
|
+
Script_Extensions: "Script_Extensions",
|
|
14662
|
+
scx: "Script_Extensions"
|
|
14663
|
+
}));
|
|
14664
|
+
var binaryUnicodeProperties = /* @__PURE__ */ new Set(["ASCII", "ASCII_Hex_Digit", "AHex", "Alphabetic", "Alpha", "Any", "Assigned", "Bidi_Control", "Bidi_C", "Bidi_Mirrored", "Bidi_M", "Case_Ignorable", "CI", "Cased", "Changes_When_Casefolded", "CWCF", "Changes_When_Casemapped", "CWCM", "Changes_When_Lowercased", "CWL", "Changes_When_NFKC_Casefolded", "CWKCF", "Changes_When_Titlecased", "CWT", "Changes_When_Uppercased", "CWU", "Dash", "Default_Ignorable_Code_Point", "DI", "Deprecated", "Dep", "Diacritic", "Dia", "Emoji", "Emoji_Component", "EComp", "Emoji_Modifier", "EMod", "Emoji_Modifier_Base", "EBase", "Emoji_Presentation", "EPres", "Extended_Pictographic", "ExtPict", "Extender", "Ext", "Grapheme_Base", "Gr_Base", "Grapheme_Extend", "Gr_Ext", "Hex_Digit", "Hex", "IDS_Binary_Operator", "IDSB", "IDS_Trinary_Operator", "IDST", "ID_Continue", "IDC", "ID_Start", "IDS", "Ideographic", "Ideo", "Join_Control", "Join_C", "Logical_Order_Exception", "LOE", "Lowercase", "Lower", "Math", "Noncharacter_Code_Point", "NChar", "Pattern_Syntax", "Pat_Syn", "Pattern_White_Space", "Pat_WS", "Quotation_Mark", "QMark", "Radical", "Regional_Indicator", "RI", "Sentence_Terminal", "STerm", "Soft_Dotted", "SD", "Terminal_Punctuation", "Term", "Unified_Ideograph", "UIdeo", "Uppercase", "Upper", "Variation_Selector", "VS", "White_Space", "space", "XID_Continue", "XIDC", "XID_Start", "XIDS"]);
|
|
14665
|
+
var binaryUnicodePropertiesOfStrings = /* @__PURE__ */ new Set(["Basic_Emoji", "Emoji_Keycap_Sequence", "RGI_Emoji_Modifier_Sequence", "RGI_Emoji_Flag_Sequence", "RGI_Emoji_Tag_Sequence", "RGI_Emoji_ZWJ_Sequence", "RGI_Emoji"]);
|
|
14666
|
+
var valuesOfNonBinaryUnicodeProperties = {
|
|
14667
|
+
General_Category: /* @__PURE__ */ new Set(["C", "Other", "Cc", "Control", "cntrl", "Cf", "Format", "Cn", "Unassigned", "Co", "Private_Use", "Cs", "Surrogate", "L", "Letter", "LC", "Cased_Letter", "Ll", "Lowercase_Letter", "Lm", "Modifier_Letter", "Lo", "Other_Letter", "Lt", "Titlecase_Letter", "Lu", "Uppercase_Letter", "M", "Mark", "Combining_Mark", "Mc", "Spacing_Mark", "Me", "Enclosing_Mark", "Mn", "Nonspacing_Mark", "N", "Number", "Nd", "Decimal_Number", "digit", "Nl", "Letter_Number", "No", "Other_Number", "P", "Punctuation", "punct", "Pc", "Connector_Punctuation", "Pd", "Dash_Punctuation", "Pe", "Close_Punctuation", "Pf", "Final_Punctuation", "Pi", "Initial_Punctuation", "Po", "Other_Punctuation", "Ps", "Open_Punctuation", "S", "Symbol", "Sc", "Currency_Symbol", "Sk", "Modifier_Symbol", "Sm", "Math_Symbol", "So", "Other_Symbol", "Z", "Separator", "Zl", "Line_Separator", "Zp", "Paragraph_Separator", "Zs", "Space_Separator"]),
|
|
14668
|
+
Script: /* @__PURE__ */ new Set(["Adlm", "Adlam", "Aghb", "Caucasian_Albanian", "Ahom", "Ahom", "Arab", "Arabic", "Armi", "Imperial_Aramaic", "Armn", "Armenian", "Avst", "Avestan", "Bali", "Balinese", "Bamu", "Bamum", "Bass", "Bassa_Vah", "Batk", "Batak", "Beng", "Bengali", "Bhks", "Bhaiksuki", "Bopo", "Bopomofo", "Brah", "Brahmi", "Brai", "Braille", "Bugi", "Buginese", "Buhd", "Buhid", "Cakm", "Chakma", "Cans", "Canadian_Aboriginal", "Cari", "Carian", "Cham", "Cham", "Cher", "Cherokee", "Chrs", "Chorasmian", "Copt", "Coptic", "Qaac", "Cpmn", "Cypro_Minoan", "Cprt", "Cypriot", "Cyrl", "Cyrillic", "Deva", "Devanagari", "Diak", "Dives_Akuru", "Dogr", "Dogra", "Dsrt", "Deseret", "Dupl", "Duployan", "Egyp", "Egyptian_Hieroglyphs", "Elba", "Elbasan", "Elym", "Elymaic", "Ethi", "Ethiopic", "Geor", "Georgian", "Glag", "Glagolitic", "Gong", "Gunjala_Gondi", "Gonm", "Masaram_Gondi", "Goth", "Gothic", "Gran", "Grantha", "Grek", "Greek", "Gujr", "Gujarati", "Guru", "Gurmukhi", "Hang", "Hangul", "Hani", "Han", "Hano", "Hanunoo", "Hatr", "Hatran", "Hebr", "Hebrew", "Hira", "Hiragana", "Hluw", "Anatolian_Hieroglyphs", "Hmng", "Pahawh_Hmong", "Hmnp", "Nyiakeng_Puachue_Hmong", "Hrkt", "Katakana_Or_Hiragana", "Hung", "Old_Hungarian", "Ital", "Old_Italic", "Java", "Javanese", "Kali", "Kayah_Li", "Kana", "Katakana", "Kawi", "Kawi", "Khar", "Kharoshthi", "Khmr", "Khmer", "Khoj", "Khojki", "Kits", "Khitan_Small_Script", "Knda", "Kannada", "Kthi", "Kaithi", "Lana", "Tai_Tham", "Laoo", "Lao", "Latn", "Latin", "Lepc", "Lepcha", "Limb", "Limbu", "Lina", "Linear_A", "Linb", "Linear_B", "Lisu", "Lisu", "Lyci", "Lycian", "Lydi", "Lydian", "Mahj", "Mahajani", "Maka", "Makasar", "Mand", "Mandaic", "Mani", "Manichaean", "Marc", "Marchen", "Medf", "Medefaidrin", "Mend", "Mende_Kikakui", "Merc", "Meroitic_Cursive", "Mero", "Meroitic_Hieroglyphs", "Mlym", "Malayalam", "Modi", "Modi", "Mong", "Mongolian", "Mroo", "Mro", "Mtei", "Meetei_Mayek", "Mult", "Multani", "Mymr", "Myanmar", "Nagm", "Nag_Mundari", "Nand", "Nandinagari", "Narb", "Old_North_Arabian", "Nbat", "Nabataean", "Newa", "Newa", "Nkoo", "Nko", "Nshu", "Nushu", "Ogam", "Ogham", "Olck", "Ol_Chiki", "Orkh", "Old_Turkic", "Orya", "Oriya", "Osge", "Osage", "Osma", "Osmanya", "Ougr", "Old_Uyghur", "Palm", "Palmyrene", "Pauc", "Pau_Cin_Hau", "Perm", "Old_Permic", "Phag", "Phags_Pa", "Phli", "Inscriptional_Pahlavi", "Phlp", "Psalter_Pahlavi", "Phnx", "Phoenician", "Plrd", "Miao", "Prti", "Inscriptional_Parthian", "Rjng", "Rejang", "Rohg", "Hanifi_Rohingya", "Runr", "Runic", "Samr", "Samaritan", "Sarb", "Old_South_Arabian", "Saur", "Saurashtra", "Sgnw", "SignWriting", "Shaw", "Shavian", "Shrd", "Sharada", "Sidd", "Siddham", "Sind", "Khudawadi", "Sinh", "Sinhala", "Sogd", "Sogdian", "Sogo", "Old_Sogdian", "Sora", "Sora_Sompeng", "Soyo", "Soyombo", "Sund", "Sundanese", "Sylo", "Syloti_Nagri", "Syrc", "Syriac", "Tagb", "Tagbanwa", "Takr", "Takri", "Tale", "Tai_Le", "Talu", "New_Tai_Lue", "Taml", "Tamil", "Tang", "Tangut", "Tavt", "Tai_Viet", "Telu", "Telugu", "Tfng", "Tifinagh", "Tglg", "Tagalog", "Thaa", "Thaana", "Thai", "Thai", "Tibt", "Tibetan", "Tirh", "Tirhuta", "Tnsa", "Tangsa", "Toto", "Toto", "Ugar", "Ugaritic", "Vaii", "Vai", "Vith", "Vithkuqi", "Wara", "Warang_Citi", "Wcho", "Wancho", "Xpeo", "Old_Persian", "Xsux", "Cuneiform", "Yezi", "Yezidi", "Yiii", "Yi", "Zanb", "Zanabazar_Square", "Zinh", "Inherited", "Qaai", "Zyyy", "Common", "Zzzz", "Unknown"]),
|
|
14669
|
+
Script_Extensions: /* @__PURE__ */ new Set()
|
|
14670
|
+
// Currently empty
|
|
14671
|
+
};
|
|
13700
14672
|
|
|
13701
14673
|
// src/compiler/utilitiesPublic.ts
|
|
13702
14674
|
function isExternalModuleNameRelative(moduleName) {
|
|
@@ -16611,6 +17583,10 @@ function isVarUsing(node) {
|
|
|
16611
17583
|
function isVarConst(node) {
|
|
16612
17584
|
return (getCombinedNodeFlags(node) & 7 /* BlockScoped */) === 2 /* Const */;
|
|
16613
17585
|
}
|
|
17586
|
+
function isVarConstLike(node) {
|
|
17587
|
+
const blockScopeKind = getCombinedNodeFlags(node) & 7 /* BlockScoped */;
|
|
17588
|
+
return blockScopeKind === 2 /* Const */ || blockScopeKind === 4 /* Using */ || blockScopeKind === 6 /* AwaitUsing */;
|
|
17589
|
+
}
|
|
16614
17590
|
function isLet(node) {
|
|
16615
17591
|
return (getCombinedNodeFlags(node) & 7 /* BlockScoped */) === 1 /* Let */;
|
|
16616
17592
|
}
|
|
@@ -20941,6 +21917,9 @@ function moduleResolutionSupportsPackageJsonExportsAndImports(moduleResolution)
|
|
|
20941
21917
|
function getStrictOptionValue(compilerOptions, flag) {
|
|
20942
21918
|
return compilerOptions[flag] === void 0 ? !!compilerOptions.strict : !!compilerOptions[flag];
|
|
20943
21919
|
}
|
|
21920
|
+
function getNameOfScriptTarget(scriptTarget) {
|
|
21921
|
+
return forEachEntry(targetOptionDeclaration.type, (value, key) => value === scriptTarget ? key : void 0);
|
|
21922
|
+
}
|
|
20944
21923
|
function getEmitStandardClassFields(compilerOptions) {
|
|
20945
21924
|
return compilerOptions.useDefineForClassFields !== false && getEmitScriptTarget(compilerOptions) >= 9 /* ES2022 */;
|
|
20946
21925
|
}
|
|
@@ -22049,26 +23028,28 @@ function replaceFirstStar(s, replacement) {
|
|
|
22049
23028
|
function getNameFromImportAttribute(node) {
|
|
22050
23029
|
return isIdentifier(node.name) ? node.name.escapedText : escapeLeadingUnderscores(node.name.text);
|
|
22051
23030
|
}
|
|
22052
|
-
function evaluatorResult(value, isSyntacticallyString = false, resolvedOtherFiles = false) {
|
|
22053
|
-
return { value, isSyntacticallyString, resolvedOtherFiles };
|
|
23031
|
+
function evaluatorResult(value, isSyntacticallyString = false, resolvedOtherFiles = false, hasExternalReferences = false) {
|
|
23032
|
+
return { value, isSyntacticallyString, resolvedOtherFiles, hasExternalReferences };
|
|
22054
23033
|
}
|
|
22055
23034
|
function createEvaluator({ evaluateElementAccessExpression, evaluateEntityNameExpression }) {
|
|
22056
23035
|
function evaluate(expr, location) {
|
|
22057
23036
|
let isSyntacticallyString = false;
|
|
22058
23037
|
let resolvedOtherFiles = false;
|
|
23038
|
+
let hasExternalReferences = false;
|
|
22059
23039
|
expr = skipParentheses(expr);
|
|
22060
23040
|
switch (expr.kind) {
|
|
22061
23041
|
case 224 /* PrefixUnaryExpression */:
|
|
22062
23042
|
const result = evaluate(expr.operand, location);
|
|
22063
23043
|
resolvedOtherFiles = result.resolvedOtherFiles;
|
|
23044
|
+
hasExternalReferences = result.hasExternalReferences;
|
|
22064
23045
|
if (typeof result.value === "number") {
|
|
22065
23046
|
switch (expr.operator) {
|
|
22066
23047
|
case 40 /* PlusToken */:
|
|
22067
|
-
return evaluatorResult(result.value, isSyntacticallyString, resolvedOtherFiles);
|
|
23048
|
+
return evaluatorResult(result.value, isSyntacticallyString, resolvedOtherFiles, hasExternalReferences);
|
|
22068
23049
|
case 41 /* MinusToken */:
|
|
22069
|
-
return evaluatorResult(-result.value, isSyntacticallyString, resolvedOtherFiles);
|
|
23050
|
+
return evaluatorResult(-result.value, isSyntacticallyString, resolvedOtherFiles, hasExternalReferences);
|
|
22070
23051
|
case 55 /* TildeToken */:
|
|
22071
|
-
return evaluatorResult(~result.value, isSyntacticallyString, resolvedOtherFiles);
|
|
23052
|
+
return evaluatorResult(~result.value, isSyntacticallyString, resolvedOtherFiles, hasExternalReferences);
|
|
22072
23053
|
}
|
|
22073
23054
|
}
|
|
22074
23055
|
break;
|
|
@@ -22077,38 +23058,40 @@ function createEvaluator({ evaluateElementAccessExpression, evaluateEntityNameEx
|
|
|
22077
23058
|
const right = evaluate(expr.right, location);
|
|
22078
23059
|
isSyntacticallyString = (left.isSyntacticallyString || right.isSyntacticallyString) && expr.operatorToken.kind === 40 /* PlusToken */;
|
|
22079
23060
|
resolvedOtherFiles = left.resolvedOtherFiles || right.resolvedOtherFiles;
|
|
23061
|
+
hasExternalReferences = left.hasExternalReferences || right.hasExternalReferences;
|
|
22080
23062
|
if (typeof left.value === "number" && typeof right.value === "number") {
|
|
22081
23063
|
switch (expr.operatorToken.kind) {
|
|
22082
23064
|
case 52 /* BarToken */:
|
|
22083
|
-
return evaluatorResult(left.value | right.value, isSyntacticallyString, resolvedOtherFiles);
|
|
23065
|
+
return evaluatorResult(left.value | right.value, isSyntacticallyString, resolvedOtherFiles, hasExternalReferences);
|
|
22084
23066
|
case 51 /* AmpersandToken */:
|
|
22085
|
-
return evaluatorResult(left.value & right.value, isSyntacticallyString, resolvedOtherFiles);
|
|
23067
|
+
return evaluatorResult(left.value & right.value, isSyntacticallyString, resolvedOtherFiles, hasExternalReferences);
|
|
22086
23068
|
case 49 /* GreaterThanGreaterThanToken */:
|
|
22087
|
-
return evaluatorResult(left.value >> right.value, isSyntacticallyString, resolvedOtherFiles);
|
|
23069
|
+
return evaluatorResult(left.value >> right.value, isSyntacticallyString, resolvedOtherFiles, hasExternalReferences);
|
|
22088
23070
|
case 50 /* GreaterThanGreaterThanGreaterThanToken */:
|
|
22089
|
-
return evaluatorResult(left.value >>> right.value, isSyntacticallyString, resolvedOtherFiles);
|
|
23071
|
+
return evaluatorResult(left.value >>> right.value, isSyntacticallyString, resolvedOtherFiles, hasExternalReferences);
|
|
22090
23072
|
case 48 /* LessThanLessThanToken */:
|
|
22091
|
-
return evaluatorResult(left.value << right.value, isSyntacticallyString, resolvedOtherFiles);
|
|
23073
|
+
return evaluatorResult(left.value << right.value, isSyntacticallyString, resolvedOtherFiles, hasExternalReferences);
|
|
22092
23074
|
case 53 /* CaretToken */:
|
|
22093
|
-
return evaluatorResult(left.value ^ right.value, isSyntacticallyString, resolvedOtherFiles);
|
|
23075
|
+
return evaluatorResult(left.value ^ right.value, isSyntacticallyString, resolvedOtherFiles, hasExternalReferences);
|
|
22094
23076
|
case 42 /* AsteriskToken */:
|
|
22095
|
-
return evaluatorResult(left.value * right.value, isSyntacticallyString, resolvedOtherFiles);
|
|
23077
|
+
return evaluatorResult(left.value * right.value, isSyntacticallyString, resolvedOtherFiles, hasExternalReferences);
|
|
22096
23078
|
case 44 /* SlashToken */:
|
|
22097
|
-
return evaluatorResult(left.value / right.value, isSyntacticallyString, resolvedOtherFiles);
|
|
23079
|
+
return evaluatorResult(left.value / right.value, isSyntacticallyString, resolvedOtherFiles, hasExternalReferences);
|
|
22098
23080
|
case 40 /* PlusToken */:
|
|
22099
|
-
return evaluatorResult(left.value + right.value, isSyntacticallyString, resolvedOtherFiles);
|
|
23081
|
+
return evaluatorResult(left.value + right.value, isSyntacticallyString, resolvedOtherFiles, hasExternalReferences);
|
|
22100
23082
|
case 41 /* MinusToken */:
|
|
22101
|
-
return evaluatorResult(left.value - right.value, isSyntacticallyString, resolvedOtherFiles);
|
|
23083
|
+
return evaluatorResult(left.value - right.value, isSyntacticallyString, resolvedOtherFiles, hasExternalReferences);
|
|
22102
23084
|
case 45 /* PercentToken */:
|
|
22103
|
-
return evaluatorResult(left.value % right.value, isSyntacticallyString, resolvedOtherFiles);
|
|
23085
|
+
return evaluatorResult(left.value % right.value, isSyntacticallyString, resolvedOtherFiles, hasExternalReferences);
|
|
22104
23086
|
case 43 /* AsteriskAsteriskToken */:
|
|
22105
|
-
return evaluatorResult(left.value ** right.value, isSyntacticallyString, resolvedOtherFiles);
|
|
23087
|
+
return evaluatorResult(left.value ** right.value, isSyntacticallyString, resolvedOtherFiles, hasExternalReferences);
|
|
22106
23088
|
}
|
|
22107
23089
|
} else if ((typeof left.value === "string" || typeof left.value === "number") && (typeof right.value === "string" || typeof right.value === "number") && expr.operatorToken.kind === 40 /* PlusToken */) {
|
|
22108
23090
|
return evaluatorResult(
|
|
22109
23091
|
"" + left.value + right.value,
|
|
22110
23092
|
isSyntacticallyString,
|
|
22111
|
-
resolvedOtherFiles
|
|
23093
|
+
resolvedOtherFiles,
|
|
23094
|
+
hasExternalReferences
|
|
22112
23095
|
);
|
|
22113
23096
|
}
|
|
22114
23097
|
break;
|
|
@@ -22138,12 +23121,14 @@ function createEvaluator({ evaluateElementAccessExpression, evaluateEntityNameEx
|
|
|
22138
23121
|
/*value*/
|
|
22139
23122
|
void 0,
|
|
22140
23123
|
isSyntacticallyString,
|
|
22141
|
-
resolvedOtherFiles
|
|
23124
|
+
resolvedOtherFiles,
|
|
23125
|
+
hasExternalReferences
|
|
22142
23126
|
);
|
|
22143
23127
|
}
|
|
22144
23128
|
function evaluateTemplateExpression(expr, location) {
|
|
22145
23129
|
let result = expr.head.text;
|
|
22146
23130
|
let resolvedOtherFiles = false;
|
|
23131
|
+
let hasExternalReferences = false;
|
|
22147
23132
|
for (const span of expr.templateSpans) {
|
|
22148
23133
|
const spanResult = evaluate(span.expression, location);
|
|
22149
23134
|
if (spanResult.value === void 0) {
|
|
@@ -22157,12 +23142,14 @@ function createEvaluator({ evaluateElementAccessExpression, evaluateEntityNameEx
|
|
|
22157
23142
|
result += spanResult.value;
|
|
22158
23143
|
result += span.literal.text;
|
|
22159
23144
|
resolvedOtherFiles || (resolvedOtherFiles = spanResult.resolvedOtherFiles);
|
|
23145
|
+
hasExternalReferences || (hasExternalReferences = spanResult.hasExternalReferences);
|
|
22160
23146
|
}
|
|
22161
23147
|
return evaluatorResult(
|
|
22162
23148
|
result,
|
|
22163
23149
|
/*isSyntacticallyString*/
|
|
22164
23150
|
true,
|
|
22165
|
-
resolvedOtherFiles
|
|
23151
|
+
resolvedOtherFiles,
|
|
23152
|
+
hasExternalReferences
|
|
22166
23153
|
);
|
|
22167
23154
|
}
|
|
22168
23155
|
return evaluate;
|
|
@@ -22541,6 +23528,55 @@ function createNameResolver({
|
|
|
22541
23528
|
return false;
|
|
22542
23529
|
}
|
|
22543
23530
|
}
|
|
23531
|
+
function isPrimitiveLiteralValue(node, includeBigInt = true) {
|
|
23532
|
+
Debug.type(node);
|
|
23533
|
+
switch (node.kind) {
|
|
23534
|
+
case 112 /* TrueKeyword */:
|
|
23535
|
+
case 97 /* FalseKeyword */:
|
|
23536
|
+
case 9 /* NumericLiteral */:
|
|
23537
|
+
case 11 /* StringLiteral */:
|
|
23538
|
+
case 15 /* NoSubstitutionTemplateLiteral */:
|
|
23539
|
+
return true;
|
|
23540
|
+
case 10 /* BigIntLiteral */:
|
|
23541
|
+
return includeBigInt;
|
|
23542
|
+
case 224 /* PrefixUnaryExpression */:
|
|
23543
|
+
if (node.operator === 41 /* MinusToken */) {
|
|
23544
|
+
return isNumericLiteral(node.operand) || includeBigInt && isBigIntLiteral(node.operand);
|
|
23545
|
+
}
|
|
23546
|
+
if (node.operator === 40 /* PlusToken */) {
|
|
23547
|
+
return isNumericLiteral(node.operand);
|
|
23548
|
+
}
|
|
23549
|
+
return false;
|
|
23550
|
+
default:
|
|
23551
|
+
assertType(node);
|
|
23552
|
+
return false;
|
|
23553
|
+
}
|
|
23554
|
+
}
|
|
23555
|
+
function unwrapParenthesizedExpression(o) {
|
|
23556
|
+
while (o.kind === 217 /* ParenthesizedExpression */) {
|
|
23557
|
+
o = o.expression;
|
|
23558
|
+
}
|
|
23559
|
+
return o;
|
|
23560
|
+
}
|
|
23561
|
+
function hasInferredType(node) {
|
|
23562
|
+
Debug.type(node);
|
|
23563
|
+
switch (node.kind) {
|
|
23564
|
+
case 169 /* Parameter */:
|
|
23565
|
+
case 171 /* PropertySignature */:
|
|
23566
|
+
case 172 /* PropertyDeclaration */:
|
|
23567
|
+
case 208 /* BindingElement */:
|
|
23568
|
+
case 211 /* PropertyAccessExpression */:
|
|
23569
|
+
case 212 /* ElementAccessExpression */:
|
|
23570
|
+
case 226 /* BinaryExpression */:
|
|
23571
|
+
case 260 /* VariableDeclaration */:
|
|
23572
|
+
case 277 /* ExportAssignment */:
|
|
23573
|
+
case 303 /* PropertyAssignment */:
|
|
23574
|
+
return true;
|
|
23575
|
+
default:
|
|
23576
|
+
assertType(node);
|
|
23577
|
+
return false;
|
|
23578
|
+
}
|
|
23579
|
+
}
|
|
22544
23580
|
|
|
22545
23581
|
// src/compiler/factory/baseNodeFactory.ts
|
|
22546
23582
|
function createBaseNodeFactory() {
|
|
@@ -31941,7 +32977,10 @@ var Parser;
|
|
|
31941
32977
|
function parseErrorAtPosition(start, length2, message, ...args) {
|
|
31942
32978
|
const lastError = lastOrUndefined(parseDiagnostics);
|
|
31943
32979
|
let result;
|
|
31944
|
-
if (
|
|
32980
|
+
if (message.category === 3 /* Message */ && lastError && start === lastError.start && length2 === lastError.length) {
|
|
32981
|
+
result = createDetachedDiagnostic(fileName, sourceText, start, length2, message, ...args);
|
|
32982
|
+
addRelatedInfo(lastError, result);
|
|
32983
|
+
} else if (!lastError || start !== lastError.start) {
|
|
31945
32984
|
result = createDetachedDiagnostic(fileName, sourceText, start, length2, message, ...args);
|
|
31946
32985
|
parseDiagnostics.push(result);
|
|
31947
32986
|
}
|
|
@@ -32097,7 +33136,7 @@ var Parser;
|
|
|
32097
33136
|
parseErrorForInvalidName(Diagnostics.Type_alias_name_cannot_be_0, Diagnostics.Type_alias_must_be_given_a_name, 64 /* EqualsToken */);
|
|
32098
33137
|
return;
|
|
32099
33138
|
}
|
|
32100
|
-
const suggestion = getSpellingSuggestion(expressionText, viableKeywordSuggestions,
|
|
33139
|
+
const suggestion = getSpellingSuggestion(expressionText, viableKeywordSuggestions, identity) ?? getSpaceSuggestion(expressionText);
|
|
32101
33140
|
if (suggestion) {
|
|
32102
33141
|
parseErrorAt(pos, node.end, Diagnostics.Unknown_keyword_or_identifier_Did_you_mean_0, suggestion);
|
|
32103
33142
|
return;
|
|
@@ -39463,6 +40502,15 @@ var commandOptionsWithoutBuild = [
|
|
|
39463
40502
|
description: Diagnostics.Do_not_transform_or_elide_any_imports_or_exports_not_marked_as_type_only_ensuring_they_are_written_in_the_output_file_s_format_based_on_the_module_setting,
|
|
39464
40503
|
defaultValueDescription: false
|
|
39465
40504
|
},
|
|
40505
|
+
{
|
|
40506
|
+
name: "isolatedDeclarations",
|
|
40507
|
+
type: "boolean",
|
|
40508
|
+
category: Diagnostics.Interop_Constraints,
|
|
40509
|
+
description: Diagnostics.Require_sufficient_annotation_on_exports_so_other_tools_can_trivially_generate_declaration_files,
|
|
40510
|
+
defaultValueDescription: false,
|
|
40511
|
+
affectsBuildInfo: true,
|
|
40512
|
+
affectsSemanticDiagnostics: true
|
|
40513
|
+
},
|
|
39466
40514
|
// Strict Type Checks
|
|
39467
40515
|
{
|
|
39468
40516
|
name: "strict",
|
|
@@ -49060,6 +50108,17 @@ function createTypeChecker(host) {
|
|
|
49060
50108
|
var checkBinaryExpression = createCheckBinaryExpression();
|
|
49061
50109
|
var emitResolver = createResolver();
|
|
49062
50110
|
var nodeBuilder = createNodeBuilder();
|
|
50111
|
+
var syntacticNodeBuilder = createSyntacticTypeNodeBuilder(compilerOptions, {
|
|
50112
|
+
isEntityNameVisible,
|
|
50113
|
+
isExpandoFunctionDeclaration,
|
|
50114
|
+
isNonNarrowedBindableName,
|
|
50115
|
+
getAllAccessorDeclarations: getAllAccessorDeclarationsForDeclaration,
|
|
50116
|
+
requiresAddingImplicitUndefined,
|
|
50117
|
+
isUndefinedIdentifierExpression(node) {
|
|
50118
|
+
Debug.assert(isExpressionNode(node));
|
|
50119
|
+
return getSymbolAtLocation(node) === undefinedSymbol;
|
|
50120
|
+
}
|
|
50121
|
+
});
|
|
49063
50122
|
var evaluate = createEvaluator({
|
|
49064
50123
|
evaluateElementAccessExpression,
|
|
49065
50124
|
evaluateEntityNameExpression
|
|
@@ -53086,7 +54145,7 @@ function createTypeChecker(host) {
|
|
|
53086
54145
|
}
|
|
53087
54146
|
return meaning;
|
|
53088
54147
|
}
|
|
53089
|
-
function isEntityNameVisible(entityName, enclosingDeclaration) {
|
|
54148
|
+
function isEntityNameVisible(entityName, enclosingDeclaration, shouldComputeAliasToMakeVisible = true) {
|
|
53090
54149
|
const meaning = getMeaningOfEntityNameReference(entityName);
|
|
53091
54150
|
const firstIdentifier = getFirstIdentifier(entityName);
|
|
53092
54151
|
const symbol = resolveName(
|
|
@@ -53116,11 +54175,7 @@ function createTypeChecker(host) {
|
|
|
53116
54175
|
).accessibility === 0 /* Accessible */) {
|
|
53117
54176
|
return { accessibility: 0 /* Accessible */ };
|
|
53118
54177
|
}
|
|
53119
|
-
return symbol && hasVisibleDeclarations(
|
|
53120
|
-
symbol,
|
|
53121
|
-
/*shouldComputeAliasToMakeVisible*/
|
|
53122
|
-
true
|
|
53123
|
-
) || {
|
|
54178
|
+
return symbol && hasVisibleDeclarations(symbol, shouldComputeAliasToMakeVisible) || {
|
|
53124
54179
|
accessibility: 1 /* NotAccessible */,
|
|
53125
54180
|
errorSymbolName: getTextOfNode(firstIdentifier),
|
|
53126
54181
|
errorNode: firstIdentifier
|
|
@@ -53269,6 +54324,16 @@ function createTypeChecker(host) {
|
|
|
53269
54324
|
return setTextRange(setOriginalNode(range, location), location);
|
|
53270
54325
|
}
|
|
53271
54326
|
function expressionOrTypeToTypeNode(context, expr, type, addUndefined) {
|
|
54327
|
+
const oldFlags = context.flags;
|
|
54328
|
+
if (expr && !(context.flags & -2147483648 /* NoSyntacticPrinter */)) {
|
|
54329
|
+
syntacticNodeBuilder.serializeTypeOfExpression(expr, context, addUndefined);
|
|
54330
|
+
}
|
|
54331
|
+
context.flags |= -2147483648 /* NoSyntacticPrinter */;
|
|
54332
|
+
const result = expressionOrTypeToTypeNodeHelper(context, expr, type, addUndefined);
|
|
54333
|
+
context.flags = oldFlags;
|
|
54334
|
+
return result;
|
|
54335
|
+
}
|
|
54336
|
+
function expressionOrTypeToTypeNodeHelper(context, expr, type, addUndefined) {
|
|
53272
54337
|
if (expr) {
|
|
53273
54338
|
const typeNode = isAssertionExpression(expr) ? expr.type : isJSDocTypeAssertion(expr) ? getJSDocTypeAssertionType(expr) : void 0;
|
|
53274
54339
|
if (typeNode && !isConstTypeReference(typeNode)) {
|
|
@@ -55213,6 +56278,10 @@ function createTypeChecker(host) {
|
|
|
55213
56278
|
}
|
|
55214
56279
|
const decl = declaration ?? symbol.valueDeclaration ?? ((_a = symbol.declarations) == null ? void 0 : _a[0]);
|
|
55215
56280
|
const expr = decl && isDeclarationWithPossibleInnerTypeNodeReuse(decl) ? getPossibleTypeNodeReuseExpression(decl) : void 0;
|
|
56281
|
+
if (decl && hasInferredType(decl) && !(context.flags & -2147483648 /* NoSyntacticPrinter */)) {
|
|
56282
|
+
syntacticNodeBuilder.serializeTypeOfDeclaration(decl, context);
|
|
56283
|
+
}
|
|
56284
|
+
context.flags |= -2147483648 /* NoSyntacticPrinter */;
|
|
55216
56285
|
const result = expressionOrTypeToTypeNode(context, expr, type, addUndefined);
|
|
55217
56286
|
context.flags = oldFlags;
|
|
55218
56287
|
return result;
|
|
@@ -55234,6 +56303,10 @@ function createTypeChecker(host) {
|
|
|
55234
56303
|
let returnTypeNode;
|
|
55235
56304
|
const returnType = getReturnTypeOfSignature(signature);
|
|
55236
56305
|
if (returnType && !(suppressAny && isTypeAny(returnType))) {
|
|
56306
|
+
if (signature.declaration && !(context.flags & -2147483648 /* NoSyntacticPrinter */)) {
|
|
56307
|
+
syntacticNodeBuilder.serializeReturnTypeForSignature(signature.declaration, context);
|
|
56308
|
+
}
|
|
56309
|
+
context.flags |= -2147483648 /* NoSyntacticPrinter */;
|
|
55237
56310
|
returnTypeNode = serializeReturnTypeForSignatureWorker(context, signature);
|
|
55238
56311
|
} else if (!suppressAny) {
|
|
55239
56312
|
returnTypeNode = factory.createKeywordTypeNode(133 /* AnyKeyword */);
|
|
@@ -71837,7 +72910,7 @@ function createTypeChecker(host) {
|
|
|
71837
72910
|
case 206 /* ObjectBindingPattern */:
|
|
71838
72911
|
case 207 /* ArrayBindingPattern */:
|
|
71839
72912
|
const rootDeclaration = getRootDeclaration(node.parent);
|
|
71840
|
-
return isParameter(rootDeclaration) || isCatchClauseVariableDeclaration(rootDeclaration) ? !isSomeSymbolAssigned(rootDeclaration) : isVariableDeclaration(rootDeclaration) &&
|
|
72913
|
+
return isParameter(rootDeclaration) || isCatchClauseVariableDeclaration(rootDeclaration) ? !isSomeSymbolAssigned(rootDeclaration) : isVariableDeclaration(rootDeclaration) && isVarConstLike2(rootDeclaration);
|
|
71841
72914
|
}
|
|
71842
72915
|
return false;
|
|
71843
72916
|
}
|
|
@@ -71976,7 +73049,7 @@ function createTypeChecker(host) {
|
|
|
71976
73049
|
if (!isReachableFlowNode(flow)) {
|
|
71977
73050
|
return unreachableNeverType;
|
|
71978
73051
|
}
|
|
71979
|
-
if (isVariableDeclaration(node) && (isInJSFile(node) ||
|
|
73052
|
+
if (isVariableDeclaration(node) && (isInJSFile(node) || isVarConstLike2(node))) {
|
|
71980
73053
|
const init = getDeclaredExpandoInitializer(node);
|
|
71981
73054
|
if (init && (init.kind === 218 /* FunctionExpression */ || init.kind === 219 /* ArrowFunction */)) {
|
|
71982
73055
|
return getTypeAtFlowNode(flow.antecedent);
|
|
@@ -78463,7 +79536,7 @@ function createTypeChecker(host) {
|
|
|
78463
79536
|
let name;
|
|
78464
79537
|
let decl;
|
|
78465
79538
|
if (isVariableDeclaration(node.parent) && node.parent.initializer === node) {
|
|
78466
|
-
if (!isInJSFile(node) && !(
|
|
79539
|
+
if (!isInJSFile(node) && !(isVarConstLike2(node.parent) && isFunctionLikeDeclaration(node))) {
|
|
78467
79540
|
return void 0;
|
|
78468
79541
|
}
|
|
78469
79542
|
name = node.parent.name;
|
|
@@ -80744,7 +81817,7 @@ function createTypeChecker(host) {
|
|
|
80744
81817
|
parent2 = parent2.parent;
|
|
80745
81818
|
}
|
|
80746
81819
|
if (operator === 56 /* AmpersandAmpersandToken */ || isIfStatement(parent2)) {
|
|
80747
|
-
|
|
81820
|
+
checkTestingKnownTruthyCallableOrAwaitableOrEnumMemberType(node.left, leftType, isIfStatement(parent2) ? parent2.thenStatement : void 0);
|
|
80748
81821
|
}
|
|
80749
81822
|
checkTruthinessOfType(leftType, node.left);
|
|
80750
81823
|
}
|
|
@@ -81302,7 +82375,7 @@ function createTypeChecker(host) {
|
|
|
81302
82375
|
}
|
|
81303
82376
|
function checkConditionalExpression(node, checkMode) {
|
|
81304
82377
|
const type = checkTruthinessExpression(node.condition, checkMode);
|
|
81305
|
-
|
|
82378
|
+
checkTestingKnownTruthyCallableOrAwaitableOrEnumMemberType(node.condition, type, node.whenTrue);
|
|
81306
82379
|
const type1 = checkExpression(node.whenTrue, checkMode);
|
|
81307
82380
|
const type2 = checkExpression(node.whenFalse, checkMode);
|
|
81308
82381
|
return getUnionType([type1, type2], 2 /* Subtype */);
|
|
@@ -84350,14 +85423,14 @@ function createTypeChecker(host) {
|
|
|
84350
85423
|
function checkIfStatement(node) {
|
|
84351
85424
|
checkGrammarStatementInAmbientContext(node);
|
|
84352
85425
|
const type = checkTruthinessExpression(node.expression);
|
|
84353
|
-
|
|
85426
|
+
checkTestingKnownTruthyCallableOrAwaitableOrEnumMemberType(node.expression, type, node.thenStatement);
|
|
84354
85427
|
checkSourceElement(node.thenStatement);
|
|
84355
85428
|
if (node.thenStatement.kind === 242 /* EmptyStatement */) {
|
|
84356
85429
|
error2(node.thenStatement, Diagnostics.The_body_of_an_if_statement_cannot_be_the_empty_statement);
|
|
84357
85430
|
}
|
|
84358
85431
|
checkSourceElement(node.elseStatement);
|
|
84359
85432
|
}
|
|
84360
|
-
function
|
|
85433
|
+
function checkTestingKnownTruthyCallableOrAwaitableOrEnumMemberType(condExpr, condType, body) {
|
|
84361
85434
|
if (!strictNullChecks)
|
|
84362
85435
|
return;
|
|
84363
85436
|
bothHelper(condExpr, body);
|
|
@@ -84379,6 +85452,10 @@ function createTypeChecker(host) {
|
|
|
84379
85452
|
return;
|
|
84380
85453
|
}
|
|
84381
85454
|
const type = location === condExpr2 ? condType : checkTruthinessExpression(location);
|
|
85455
|
+
if (type.flags & 1024 /* EnumLiteral */ && isPropertyAccessExpression(location) && (getNodeLinks(location.expression).resolvedSymbol ?? unknownSymbol).flags & 384 /* Enum */) {
|
|
85456
|
+
error2(location, Diagnostics.This_condition_will_always_return_0, !!type.value ? "true" : "false");
|
|
85457
|
+
return;
|
|
85458
|
+
}
|
|
84382
85459
|
const isPropertyExpressionCast = isPropertyAccessExpression(location) && isTypeAssertion(location.expression);
|
|
84383
85460
|
if (!hasTypeFacts(type, 4194304 /* Truthy */) || isPropertyExpressionCast)
|
|
84384
85461
|
return;
|
|
@@ -86339,10 +87416,18 @@ function createTypeChecker(host) {
|
|
|
86339
87416
|
/*isSyntacticallyString*/
|
|
86340
87417
|
false,
|
|
86341
87418
|
/*resolvedOtherFiles*/
|
|
87419
|
+
true,
|
|
87420
|
+
/*hasExternalReferences*/
|
|
86342
87421
|
true
|
|
86343
87422
|
);
|
|
86344
87423
|
}
|
|
86345
|
-
return
|
|
87424
|
+
return evaluatorResult(
|
|
87425
|
+
result.value,
|
|
87426
|
+
result.isSyntacticallyString,
|
|
87427
|
+
result.resolvedOtherFiles,
|
|
87428
|
+
/*hasExternalReferences*/
|
|
87429
|
+
true
|
|
87430
|
+
);
|
|
86346
87431
|
}
|
|
86347
87432
|
}
|
|
86348
87433
|
return evaluatorResult(
|
|
@@ -86389,7 +87474,17 @@ function createTypeChecker(host) {
|
|
|
86389
87474
|
0
|
|
86390
87475
|
);
|
|
86391
87476
|
}
|
|
86392
|
-
|
|
87477
|
+
const value = getEnumMemberValue(declaration);
|
|
87478
|
+
if (location.parent !== declaration.parent) {
|
|
87479
|
+
return evaluatorResult(
|
|
87480
|
+
value.value,
|
|
87481
|
+
value.isSyntacticallyString,
|
|
87482
|
+
value.resolvedOtherFiles,
|
|
87483
|
+
/*hasExternalReferences*/
|
|
87484
|
+
true
|
|
87485
|
+
);
|
|
87486
|
+
}
|
|
87487
|
+
return value;
|
|
86393
87488
|
}
|
|
86394
87489
|
function checkEnumDeclaration(node) {
|
|
86395
87490
|
addLazyDiagnostic(() => checkEnumDeclarationWorker(node));
|
|
@@ -88500,12 +89595,24 @@ function createTypeChecker(host) {
|
|
|
88500
89595
|
return strictNullChecks && isOptionalParameter(parameter) && (isJSDocParameterTag(parameter) || !parameter.initializer) && hasSyntacticModifier(parameter, 31 /* ParameterPropertyModifier */);
|
|
88501
89596
|
}
|
|
88502
89597
|
function isExpandoFunctionDeclaration(node) {
|
|
88503
|
-
const declaration = getParseTreeNode(node, isFunctionDeclaration);
|
|
89598
|
+
const declaration = getParseTreeNode(node, (n) => isFunctionDeclaration(n) || isVariableDeclaration(n));
|
|
88504
89599
|
if (!declaration) {
|
|
88505
89600
|
return false;
|
|
88506
89601
|
}
|
|
88507
|
-
|
|
88508
|
-
if (
|
|
89602
|
+
let symbol;
|
|
89603
|
+
if (isVariableDeclaration(declaration)) {
|
|
89604
|
+
if (declaration.type || !isInJSFile(declaration) && !isVarConstLike2(declaration)) {
|
|
89605
|
+
return false;
|
|
89606
|
+
}
|
|
89607
|
+
const initializer = getDeclaredExpandoInitializer(declaration);
|
|
89608
|
+
if (!initializer || !canHaveSymbol(initializer)) {
|
|
89609
|
+
return false;
|
|
89610
|
+
}
|
|
89611
|
+
symbol = getSymbolOfDeclaration(initializer);
|
|
89612
|
+
} else {
|
|
89613
|
+
symbol = getSymbolOfDeclaration(declaration);
|
|
89614
|
+
}
|
|
89615
|
+
if (!symbol || !(symbol.flags & 16 /* Function */ | 3 /* Variable */)) {
|
|
88509
89616
|
return false;
|
|
88510
89617
|
}
|
|
88511
89618
|
return !!forEachEntry(getExportsOfSymbol(symbol), (p) => p.flags & 111551 /* Value */ && isExpandoPropertyDeclaration(p.valueDeclaration));
|
|
@@ -88809,11 +89916,27 @@ function createTypeChecker(host) {
|
|
|
88809
89916
|
return void 0;
|
|
88810
89917
|
}
|
|
88811
89918
|
function isLiteralConstDeclaration(node) {
|
|
88812
|
-
if (isDeclarationReadonly(node) || isVariableDeclaration(node) &&
|
|
89919
|
+
if (isDeclarationReadonly(node) || isVariableDeclaration(node) && isVarConstLike2(node)) {
|
|
88813
89920
|
return isFreshLiteralType(getTypeOfSymbol(getSymbolOfDeclaration(node)));
|
|
88814
89921
|
}
|
|
88815
89922
|
return false;
|
|
88816
89923
|
}
|
|
89924
|
+
function isNonNarrowedBindableName(node) {
|
|
89925
|
+
if (!hasBindableName(node.parent)) {
|
|
89926
|
+
return false;
|
|
89927
|
+
}
|
|
89928
|
+
const expression = node.expression;
|
|
89929
|
+
if (!isEntityNameExpression(expression)) {
|
|
89930
|
+
return true;
|
|
89931
|
+
}
|
|
89932
|
+
const type = getTypeOfExpression(expression);
|
|
89933
|
+
const symbol = getSymbolAtLocation(expression);
|
|
89934
|
+
if (!symbol) {
|
|
89935
|
+
return false;
|
|
89936
|
+
}
|
|
89937
|
+
const declaredType = getTypeOfSymbol(symbol);
|
|
89938
|
+
return declaredType === type;
|
|
89939
|
+
}
|
|
88817
89940
|
function literalTypeToNode(type, enclosing, tracker) {
|
|
88818
89941
|
const enumResult = type.flags & 1056 /* EnumLike */ ? nodeBuilder.symbolToExpression(
|
|
88819
89942
|
type.symbol,
|
|
@@ -88933,6 +90056,7 @@ function createTypeChecker(host) {
|
|
|
88933
90056
|
return node && getExternalModuleFileFromDeclaration(node);
|
|
88934
90057
|
},
|
|
88935
90058
|
isLiteralConstDeclaration,
|
|
90059
|
+
isNonNarrowedBindableName,
|
|
88936
90060
|
isLateBound: (nodeIn) => {
|
|
88937
90061
|
const node = getParseTreeNode(nodeIn, isDeclaration);
|
|
88938
90062
|
const symbol = node && getSymbolOfDeclaration(node);
|
|
@@ -90304,7 +91428,7 @@ function createTypeChecker(host) {
|
|
|
90304
91428
|
const initializer = node.initializer;
|
|
90305
91429
|
if (initializer) {
|
|
90306
91430
|
const isInvalidInitializer = !(isStringOrNumberLiteralExpression(initializer) || isSimpleLiteralEnumReference(initializer) || initializer.kind === 112 /* TrueKeyword */ || initializer.kind === 97 /* FalseKeyword */ || isBigIntLiteralExpression(initializer));
|
|
90307
|
-
const isConstOrReadonly = isDeclarationReadonly(node) || isVariableDeclaration(node) &&
|
|
91431
|
+
const isConstOrReadonly = isDeclarationReadonly(node) || isVariableDeclaration(node) && isVarConstLike2(node);
|
|
90308
91432
|
if (isConstOrReadonly && !node.type) {
|
|
90309
91433
|
if (isInvalidInitializer) {
|
|
90310
91434
|
return grammarErrorOnNode(initializer, Diagnostics.A_const_initializer_in_an_ambient_context_must_be_a_string_or_numeric_literal_or_literal_enum_reference);
|
|
@@ -90769,7 +91893,7 @@ function createTypeChecker(host) {
|
|
|
90769
91893
|
lastGetCombinedNodeFlagsResult = getCombinedNodeFlags(node);
|
|
90770
91894
|
return lastGetCombinedNodeFlagsResult;
|
|
90771
91895
|
}
|
|
90772
|
-
function
|
|
91896
|
+
function isVarConstLike2(node) {
|
|
90773
91897
|
const blockScopeKind = getCombinedNodeFlagsCached(node) & 7 /* BlockScoped */;
|
|
90774
91898
|
return blockScopeKind === 2 /* Const */ || blockScopeKind === 4 /* Using */ || blockScopeKind === 6 /* AwaitUsing */;
|
|
90775
91899
|
}
|
|
@@ -90923,6 +92047,12 @@ var SymbolTrackerImpl = class _SymbolTrackerImpl {
|
|
|
90923
92047
|
onDiagnosticReported() {
|
|
90924
92048
|
this.context.reportedDiagnostic = true;
|
|
90925
92049
|
}
|
|
92050
|
+
reportInferenceFallback(node) {
|
|
92051
|
+
var _a;
|
|
92052
|
+
if ((_a = this.inner) == null ? void 0 : _a.reportInferenceFallback) {
|
|
92053
|
+
this.inner.reportInferenceFallback(node);
|
|
92054
|
+
}
|
|
92055
|
+
}
|
|
90926
92056
|
};
|
|
90927
92057
|
|
|
90928
92058
|
// src/compiler/visitorPublic.ts
|
|
@@ -95152,7 +96282,7 @@ function transformTypeScript(context) {
|
|
|
95152
96282
|
}
|
|
95153
96283
|
function visitParenthesizedExpression(node) {
|
|
95154
96284
|
const innerExpression = skipOuterExpressions(node.expression, ~6 /* Assertions */);
|
|
95155
|
-
if (isAssertionExpression(innerExpression)) {
|
|
96285
|
+
if (isAssertionExpression(innerExpression) || isSatisfiesExpression(innerExpression)) {
|
|
95156
96286
|
const expression = visitNode(node.expression, visitor, isExpression);
|
|
95157
96287
|
Debug.assert(expression);
|
|
95158
96288
|
return factory2.createPartiallyEmittedExpression(expression, node);
|
|
@@ -114075,6 +115205,194 @@ function createGetSymbolAccessibilityDiagnosticForNode(node) {
|
|
|
114075
115205
|
};
|
|
114076
115206
|
}
|
|
114077
115207
|
}
|
|
115208
|
+
function createGetIsolatedDeclarationErrors(resolver) {
|
|
115209
|
+
const relatedSuggestionByDeclarationKind = {
|
|
115210
|
+
[219 /* ArrowFunction */]: Diagnostics.Add_a_return_type_to_the_function_expression,
|
|
115211
|
+
[218 /* FunctionExpression */]: Diagnostics.Add_a_return_type_to_the_function_expression,
|
|
115212
|
+
[174 /* MethodDeclaration */]: Diagnostics.Add_a_return_type_to_the_method,
|
|
115213
|
+
[177 /* GetAccessor */]: Diagnostics.Add_a_return_type_to_the_get_accessor_declaration,
|
|
115214
|
+
[178 /* SetAccessor */]: Diagnostics.Add_a_type_to_parameter_of_the_set_accessor_declaration,
|
|
115215
|
+
[262 /* FunctionDeclaration */]: Diagnostics.Add_a_return_type_to_the_function_declaration,
|
|
115216
|
+
[180 /* ConstructSignature */]: Diagnostics.Add_a_return_type_to_the_function_declaration,
|
|
115217
|
+
[169 /* Parameter */]: Diagnostics.Add_a_type_annotation_to_the_parameter_0,
|
|
115218
|
+
[260 /* VariableDeclaration */]: Diagnostics.Add_a_type_annotation_to_the_variable_0,
|
|
115219
|
+
[172 /* PropertyDeclaration */]: Diagnostics.Add_a_type_annotation_to_the_property_0,
|
|
115220
|
+
[171 /* PropertySignature */]: Diagnostics.Add_a_type_annotation_to_the_property_0,
|
|
115221
|
+
[277 /* ExportAssignment */]: Diagnostics.Move_the_expression_in_default_export_to_a_variable_and_add_a_type_annotation_to_it
|
|
115222
|
+
};
|
|
115223
|
+
const errorByDeclarationKind = {
|
|
115224
|
+
[218 /* FunctionExpression */]: Diagnostics.Function_must_have_an_explicit_return_type_annotation_with_isolatedDeclarations,
|
|
115225
|
+
[262 /* FunctionDeclaration */]: Diagnostics.Function_must_have_an_explicit_return_type_annotation_with_isolatedDeclarations,
|
|
115226
|
+
[219 /* ArrowFunction */]: Diagnostics.Function_must_have_an_explicit_return_type_annotation_with_isolatedDeclarations,
|
|
115227
|
+
[174 /* MethodDeclaration */]: Diagnostics.Method_must_have_an_explicit_return_type_annotation_with_isolatedDeclarations,
|
|
115228
|
+
[180 /* ConstructSignature */]: Diagnostics.Method_must_have_an_explicit_return_type_annotation_with_isolatedDeclarations,
|
|
115229
|
+
[177 /* GetAccessor */]: Diagnostics.At_least_one_accessor_must_have_an_explicit_return_type_annotation_with_isolatedDeclarations,
|
|
115230
|
+
[178 /* SetAccessor */]: Diagnostics.At_least_one_accessor_must_have_an_explicit_return_type_annotation_with_isolatedDeclarations,
|
|
115231
|
+
[169 /* Parameter */]: Diagnostics.Parameter_must_have_an_explicit_type_annotation_with_isolatedDeclarations,
|
|
115232
|
+
[260 /* VariableDeclaration */]: Diagnostics.Variable_must_have_an_explicit_type_annotation_with_isolatedDeclarations,
|
|
115233
|
+
[172 /* PropertyDeclaration */]: Diagnostics.Property_must_have_an_explicit_type_annotation_with_isolatedDeclarations,
|
|
115234
|
+
[171 /* PropertySignature */]: Diagnostics.Property_must_have_an_explicit_type_annotation_with_isolatedDeclarations,
|
|
115235
|
+
[167 /* ComputedPropertyName */]: Diagnostics.Computed_properties_must_be_number_or_string_literals_variables_or_dotted_expressions_with_isolatedDeclarations,
|
|
115236
|
+
[305 /* SpreadAssignment */]: Diagnostics.Objects_that_contain_spread_assignments_can_t_be_inferred_with_isolatedDeclarations,
|
|
115237
|
+
[304 /* ShorthandPropertyAssignment */]: Diagnostics.Objects_that_contain_shorthand_properties_can_t_be_inferred_with_isolatedDeclarations,
|
|
115238
|
+
[209 /* ArrayLiteralExpression */]: Diagnostics.Only_const_arrays_can_be_inferred_with_isolatedDeclarations,
|
|
115239
|
+
[277 /* ExportAssignment */]: Diagnostics.Default_exports_can_t_be_inferred_with_isolatedDeclarations,
|
|
115240
|
+
[230 /* SpreadElement */]: Diagnostics.Arrays_with_spread_elements_can_t_inferred_with_isolatedDeclarations
|
|
115241
|
+
};
|
|
115242
|
+
return getDiagnostic2;
|
|
115243
|
+
function getDiagnostic2(node) {
|
|
115244
|
+
const heritageClause = findAncestor(node, isHeritageClause);
|
|
115245
|
+
if (heritageClause) {
|
|
115246
|
+
return createDiagnosticForNode(node, Diagnostics.Extends_clause_can_t_contain_an_expression_with_isolatedDeclarations);
|
|
115247
|
+
}
|
|
115248
|
+
Debug.type(node);
|
|
115249
|
+
switch (node.kind) {
|
|
115250
|
+
case 177 /* GetAccessor */:
|
|
115251
|
+
case 178 /* SetAccessor */:
|
|
115252
|
+
return createAccessorTypeError(node);
|
|
115253
|
+
case 167 /* ComputedPropertyName */:
|
|
115254
|
+
case 304 /* ShorthandPropertyAssignment */:
|
|
115255
|
+
case 305 /* SpreadAssignment */:
|
|
115256
|
+
return createObjectLiteralError(node);
|
|
115257
|
+
case 209 /* ArrayLiteralExpression */:
|
|
115258
|
+
case 230 /* SpreadElement */:
|
|
115259
|
+
return createArrayLiteralError(node);
|
|
115260
|
+
case 174 /* MethodDeclaration */:
|
|
115261
|
+
case 180 /* ConstructSignature */:
|
|
115262
|
+
case 218 /* FunctionExpression */:
|
|
115263
|
+
case 219 /* ArrowFunction */:
|
|
115264
|
+
case 262 /* FunctionDeclaration */:
|
|
115265
|
+
return createReturnTypeError(node);
|
|
115266
|
+
case 208 /* BindingElement */:
|
|
115267
|
+
return createBindingElementError(node);
|
|
115268
|
+
case 172 /* PropertyDeclaration */:
|
|
115269
|
+
case 260 /* VariableDeclaration */:
|
|
115270
|
+
return createVariableOrPropertyError(node);
|
|
115271
|
+
case 169 /* Parameter */:
|
|
115272
|
+
return createParameterError(node);
|
|
115273
|
+
case 303 /* PropertyAssignment */:
|
|
115274
|
+
return createExpressionError(node.initializer);
|
|
115275
|
+
case 231 /* ClassExpression */:
|
|
115276
|
+
return createClassExpressionError(node);
|
|
115277
|
+
default:
|
|
115278
|
+
assertType(node);
|
|
115279
|
+
return createExpressionError(node);
|
|
115280
|
+
}
|
|
115281
|
+
}
|
|
115282
|
+
function findNearestDeclaration(node) {
|
|
115283
|
+
const result = findAncestor(node, (n) => isExportAssignment(n) || (isStatement(n) ? "quit" : isVariableDeclaration(n) || isPropertyDeclaration(n) || isParameter(n)));
|
|
115284
|
+
return result;
|
|
115285
|
+
}
|
|
115286
|
+
function createAccessorTypeError(node) {
|
|
115287
|
+
const { getAccessor, setAccessor } = getAllAccessorDeclarations(node.symbol.declarations, node);
|
|
115288
|
+
const targetNode = (isSetAccessor(node) ? node.parameters[0] : node) ?? node;
|
|
115289
|
+
const diag2 = createDiagnosticForNode(targetNode, errorByDeclarationKind[node.kind]);
|
|
115290
|
+
if (setAccessor) {
|
|
115291
|
+
addRelatedInfo(diag2, createDiagnosticForNode(setAccessor, relatedSuggestionByDeclarationKind[setAccessor.kind]));
|
|
115292
|
+
}
|
|
115293
|
+
if (getAccessor) {
|
|
115294
|
+
addRelatedInfo(diag2, createDiagnosticForNode(getAccessor, relatedSuggestionByDeclarationKind[getAccessor.kind]));
|
|
115295
|
+
}
|
|
115296
|
+
return diag2;
|
|
115297
|
+
}
|
|
115298
|
+
function createObjectLiteralError(node) {
|
|
115299
|
+
const diag2 = createDiagnosticForNode(node, errorByDeclarationKind[node.kind]);
|
|
115300
|
+
const parentDeclaration = findNearestDeclaration(node);
|
|
115301
|
+
if (parentDeclaration) {
|
|
115302
|
+
const targetStr = isExportAssignment(parentDeclaration) ? "" : getTextOfNode(
|
|
115303
|
+
parentDeclaration.name,
|
|
115304
|
+
/*includeTrivia*/
|
|
115305
|
+
false
|
|
115306
|
+
);
|
|
115307
|
+
addRelatedInfo(diag2, createDiagnosticForNode(parentDeclaration, relatedSuggestionByDeclarationKind[parentDeclaration.kind], targetStr));
|
|
115308
|
+
}
|
|
115309
|
+
return diag2;
|
|
115310
|
+
}
|
|
115311
|
+
function createArrayLiteralError(node) {
|
|
115312
|
+
const diag2 = createDiagnosticForNode(node, errorByDeclarationKind[node.kind]);
|
|
115313
|
+
const parentDeclaration = findNearestDeclaration(node);
|
|
115314
|
+
if (parentDeclaration) {
|
|
115315
|
+
const targetStr = isExportAssignment(parentDeclaration) ? "" : getTextOfNode(
|
|
115316
|
+
parentDeclaration.name,
|
|
115317
|
+
/*includeTrivia*/
|
|
115318
|
+
false
|
|
115319
|
+
);
|
|
115320
|
+
addRelatedInfo(diag2, createDiagnosticForNode(parentDeclaration, relatedSuggestionByDeclarationKind[parentDeclaration.kind], targetStr));
|
|
115321
|
+
}
|
|
115322
|
+
return diag2;
|
|
115323
|
+
}
|
|
115324
|
+
function createReturnTypeError(node) {
|
|
115325
|
+
const diag2 = createDiagnosticForNode(node, errorByDeclarationKind[node.kind]);
|
|
115326
|
+
const parentDeclaration = findNearestDeclaration(node);
|
|
115327
|
+
if (parentDeclaration) {
|
|
115328
|
+
const targetStr = isExportAssignment(parentDeclaration) ? "" : getTextOfNode(
|
|
115329
|
+
parentDeclaration.name,
|
|
115330
|
+
/*includeTrivia*/
|
|
115331
|
+
false
|
|
115332
|
+
);
|
|
115333
|
+
addRelatedInfo(diag2, createDiagnosticForNode(parentDeclaration, relatedSuggestionByDeclarationKind[parentDeclaration.kind], targetStr));
|
|
115334
|
+
}
|
|
115335
|
+
addRelatedInfo(diag2, createDiagnosticForNode(node, relatedSuggestionByDeclarationKind[node.kind]));
|
|
115336
|
+
return diag2;
|
|
115337
|
+
}
|
|
115338
|
+
function createBindingElementError(node) {
|
|
115339
|
+
return createDiagnosticForNode(node, Diagnostics.Binding_elements_can_t_be_exported_directly_with_isolatedDeclarations);
|
|
115340
|
+
}
|
|
115341
|
+
function createVariableOrPropertyError(node) {
|
|
115342
|
+
const diag2 = createDiagnosticForNode(node, errorByDeclarationKind[node.kind]);
|
|
115343
|
+
const targetStr = getTextOfNode(
|
|
115344
|
+
node.name,
|
|
115345
|
+
/*includeTrivia*/
|
|
115346
|
+
false
|
|
115347
|
+
);
|
|
115348
|
+
addRelatedInfo(diag2, createDiagnosticForNode(node, relatedSuggestionByDeclarationKind[node.kind], targetStr));
|
|
115349
|
+
return diag2;
|
|
115350
|
+
}
|
|
115351
|
+
function createParameterError(node) {
|
|
115352
|
+
if (isSetAccessor(node.parent)) {
|
|
115353
|
+
return createAccessorTypeError(node.parent);
|
|
115354
|
+
}
|
|
115355
|
+
const addUndefined = resolver.requiresAddingImplicitUndefined(node);
|
|
115356
|
+
if (!addUndefined && node.initializer) {
|
|
115357
|
+
return createExpressionError(node.initializer);
|
|
115358
|
+
}
|
|
115359
|
+
const message = addUndefined ? Diagnostics.Declaration_emit_for_this_parameter_requires_implicitly_adding_undefined_to_it_s_type_This_is_not_supported_with_isolatedDeclarations : errorByDeclarationKind[node.kind];
|
|
115360
|
+
const diag2 = createDiagnosticForNode(node, message);
|
|
115361
|
+
const targetStr = getTextOfNode(
|
|
115362
|
+
node.name,
|
|
115363
|
+
/*includeTrivia*/
|
|
115364
|
+
false
|
|
115365
|
+
);
|
|
115366
|
+
addRelatedInfo(diag2, createDiagnosticForNode(node, relatedSuggestionByDeclarationKind[node.kind], targetStr));
|
|
115367
|
+
return diag2;
|
|
115368
|
+
}
|
|
115369
|
+
function createClassExpressionError(node) {
|
|
115370
|
+
return createExpressionError(node, Diagnostics.Inference_from_class_expressions_is_not_supported_with_isolatedDeclarations);
|
|
115371
|
+
}
|
|
115372
|
+
function createExpressionError(node, diagnosticMessage) {
|
|
115373
|
+
const parentDeclaration = findNearestDeclaration(node);
|
|
115374
|
+
let diag2;
|
|
115375
|
+
if (parentDeclaration) {
|
|
115376
|
+
const targetStr = isExportAssignment(parentDeclaration) ? "" : getTextOfNode(
|
|
115377
|
+
parentDeclaration.name,
|
|
115378
|
+
/*includeTrivia*/
|
|
115379
|
+
false
|
|
115380
|
+
);
|
|
115381
|
+
const parent2 = findAncestor(node.parent, (n) => isExportAssignment(n) || (isStatement(n) ? "quit" : !isParenthesizedExpression(n) && !isTypeAssertionExpression(n) && !isAsExpression(n)));
|
|
115382
|
+
if (parentDeclaration === parent2) {
|
|
115383
|
+
diag2 = createDiagnosticForNode(node, diagnosticMessage ?? errorByDeclarationKind[parentDeclaration.kind]);
|
|
115384
|
+
addRelatedInfo(diag2, createDiagnosticForNode(parentDeclaration, relatedSuggestionByDeclarationKind[parentDeclaration.kind], targetStr));
|
|
115385
|
+
} else {
|
|
115386
|
+
diag2 = createDiagnosticForNode(node, diagnosticMessage ?? Diagnostics.Expression_type_can_t_be_inferred_with_isolatedDeclarations);
|
|
115387
|
+
addRelatedInfo(diag2, createDiagnosticForNode(parentDeclaration, relatedSuggestionByDeclarationKind[parentDeclaration.kind], targetStr));
|
|
115388
|
+
addRelatedInfo(diag2, createDiagnosticForNode(node, Diagnostics.Add_satisfies_and_a_type_assertion_to_this_expression_satisfies_T_as_T_to_make_the_type_explicit));
|
|
115389
|
+
}
|
|
115390
|
+
} else {
|
|
115391
|
+
diag2 = createDiagnosticForNode(node, diagnosticMessage ?? Diagnostics.Expression_type_can_t_be_inferred_with_isolatedDeclarations);
|
|
115392
|
+
}
|
|
115393
|
+
return diag2;
|
|
115394
|
+
}
|
|
115395
|
+
}
|
|
114078
115396
|
|
|
114079
115397
|
// src/compiler/transformers/declarations.ts
|
|
114080
115398
|
function getDeclarationDiagnostics(host, resolver, file) {
|
|
@@ -114116,7 +115434,8 @@ function transformDeclarations(context) {
|
|
|
114116
115434
|
reportTruncationError,
|
|
114117
115435
|
moduleResolverHost: host,
|
|
114118
115436
|
reportNonlocalAugmentation,
|
|
114119
|
-
reportNonSerializableProperty
|
|
115437
|
+
reportNonSerializableProperty,
|
|
115438
|
+
reportInferenceFallback
|
|
114120
115439
|
};
|
|
114121
115440
|
let errorNameNode;
|
|
114122
115441
|
let errorFallbackNode;
|
|
@@ -114126,8 +115445,29 @@ function transformDeclarations(context) {
|
|
|
114126
115445
|
let rawLibReferenceDirectives;
|
|
114127
115446
|
const resolver = context.getEmitResolver();
|
|
114128
115447
|
const options = context.getCompilerOptions();
|
|
114129
|
-
const
|
|
115448
|
+
const getIsolatedDeclarationError = createGetIsolatedDeclarationErrors(resolver);
|
|
115449
|
+
const { stripInternal, isolatedDeclarations } = options;
|
|
114130
115450
|
return transformRoot;
|
|
115451
|
+
function reportExpandoFunctionErrors(node) {
|
|
115452
|
+
resolver.getPropertiesOfContainerFunction(node).forEach((p) => {
|
|
115453
|
+
if (isExpandoPropertyDeclaration(p.valueDeclaration)) {
|
|
115454
|
+
const errorTarget = isBinaryExpression(p.valueDeclaration) ? p.valueDeclaration.left : p.valueDeclaration;
|
|
115455
|
+
context.addDiagnostic(createDiagnosticForNode(
|
|
115456
|
+
errorTarget,
|
|
115457
|
+
Diagnostics.Assigning_properties_to_functions_without_declaring_them_is_not_supported_with_isolatedDeclarations_Add_an_explicit_declaration_for_the_properties_assigned_to_this_function
|
|
115458
|
+
));
|
|
115459
|
+
}
|
|
115460
|
+
});
|
|
115461
|
+
}
|
|
115462
|
+
function reportInferenceFallback(node) {
|
|
115463
|
+
if (!isolatedDeclarations || isSourceFileJS(currentSourceFile))
|
|
115464
|
+
return;
|
|
115465
|
+
if (isVariableDeclaration(node) && resolver.isExpandoFunctionDeclaration(node)) {
|
|
115466
|
+
reportExpandoFunctionErrors(node);
|
|
115467
|
+
} else {
|
|
115468
|
+
context.addDiagnostic(getIsolatedDeclarationError(node));
|
|
115469
|
+
}
|
|
115470
|
+
}
|
|
114131
115471
|
function handleSymbolAccessibilityError(symbolAccessibilityResult) {
|
|
114132
115472
|
if (symbolAccessibilityResult.accessibility === 0 /* Accessible */) {
|
|
114133
115473
|
if (symbolAccessibilityResult.aliasesToMakeVisible) {
|
|
@@ -114431,7 +115771,8 @@ function transformDeclarations(context) {
|
|
|
114431
115771
|
elem.dotDotDotToken,
|
|
114432
115772
|
elem.propertyName,
|
|
114433
115773
|
filterBindingPatternInitializers(elem.name),
|
|
114434
|
-
|
|
115774
|
+
/*initializer*/
|
|
115775
|
+
void 0
|
|
114435
115776
|
);
|
|
114436
115777
|
}
|
|
114437
115778
|
}
|
|
@@ -114462,11 +115803,15 @@ function transformDeclarations(context) {
|
|
|
114462
115803
|
return newParam;
|
|
114463
115804
|
}
|
|
114464
115805
|
function shouldPrintWithInitializer(node) {
|
|
114465
|
-
return canHaveLiteralInitializer(node) && resolver.isLiteralConstDeclaration(getParseTreeNode(node));
|
|
115806
|
+
return canHaveLiteralInitializer(node) && !!node.initializer && resolver.isLiteralConstDeclaration(getParseTreeNode(node));
|
|
114466
115807
|
}
|
|
114467
115808
|
function ensureNoInitializer(node) {
|
|
114468
115809
|
if (shouldPrintWithInitializer(node)) {
|
|
114469
|
-
|
|
115810
|
+
const unwrappedInitializer = unwrapParenthesizedExpression(node.initializer);
|
|
115811
|
+
if (!isPrimitiveLiteralValue(unwrappedInitializer)) {
|
|
115812
|
+
reportInferenceFallback(node);
|
|
115813
|
+
}
|
|
115814
|
+
return resolver.createLiteralConstValue(getParseTreeNode(node, canHaveLiteralInitializer), symbolTracker);
|
|
114470
115815
|
}
|
|
114471
115816
|
return void 0;
|
|
114472
115817
|
}
|
|
@@ -114708,6 +116053,9 @@ function transformDeclarations(context) {
|
|
|
114708
116053
|
);
|
|
114709
116054
|
}
|
|
114710
116055
|
if (resolver.isImportRequiredByAugmentation(decl)) {
|
|
116056
|
+
if (isolatedDeclarations) {
|
|
116057
|
+
context.addDiagnostic(createDiagnosticForNode(decl, Diagnostics.Declaration_emit_for_this_file_requires_preserving_this_import_for_augmentations_This_is_not_supported_with_isolatedDeclarations));
|
|
116058
|
+
}
|
|
114711
116059
|
return factory2.updateImportDeclaration(
|
|
114712
116060
|
decl,
|
|
114713
116061
|
decl.modifiers,
|
|
@@ -114762,6 +116110,9 @@ function transformDeclarations(context) {
|
|
|
114762
116110
|
if (isDeclarationAndNotVisible(input))
|
|
114763
116111
|
return;
|
|
114764
116112
|
if (hasDynamicName(input) && !resolver.isLateBound(getParseTreeNode(input))) {
|
|
116113
|
+
if (isolatedDeclarations && isClassDeclaration(input.parent) && isEntityNameExpression(input.name.expression) && resolver.isEntityNameVisible(input.name.expression, input.parent).accessibility === 0 /* Accessible */ && !resolver.isNonNarrowedBindableName(input.name)) {
|
|
116114
|
+
context.addDiagnostic(createDiagnosticForNode(input, Diagnostics.Computed_properties_must_be_number_or_string_literals_variables_or_dotted_expressions_with_isolatedDeclarations));
|
|
116115
|
+
}
|
|
114765
116116
|
return;
|
|
114766
116117
|
}
|
|
114767
116118
|
}
|
|
@@ -115202,6 +116553,9 @@ function transformDeclarations(context) {
|
|
|
115202
116553
|
));
|
|
115203
116554
|
if (clean2 && resolver.isExpandoFunctionDeclaration(input) && shouldEmitFunctionProperties(input)) {
|
|
115204
116555
|
const props = resolver.getPropertiesOfContainerFunction(input);
|
|
116556
|
+
if (isolatedDeclarations) {
|
|
116557
|
+
reportExpandoFunctionErrors(input);
|
|
116558
|
+
}
|
|
115205
116559
|
const fakespace = parseNodeFactory.createModuleDeclaration(
|
|
115206
116560
|
/*modifiers*/
|
|
115207
116561
|
void 0,
|
|
@@ -115222,7 +116576,7 @@ function transformDeclarations(context) {
|
|
|
115222
116576
|
return void 0;
|
|
115223
116577
|
}
|
|
115224
116578
|
getSymbolAccessibilityDiagnostic = createGetSymbolAccessibilityDiagnosticForNode(p.valueDeclaration);
|
|
115225
|
-
const type = resolver.createTypeOfDeclaration(p.valueDeclaration, fakespace, declarationEmitNodeBuilderFlags
|
|
116579
|
+
const type = resolver.createTypeOfDeclaration(p.valueDeclaration, fakespace, declarationEmitNodeBuilderFlags | -2147483648 /* NoSyntacticPrinter */, symbolTracker);
|
|
115226
116580
|
getSymbolAccessibilityDiagnostic = oldDiag;
|
|
115227
116581
|
const isNonContextualKeywordName = isStringANonContextualKeyword(nameStr);
|
|
115228
116582
|
const name = isNonContextualKeywordName ? factory2.getGeneratedNameForNode(p.valueDeclaration) : factory2.createIdentifier(nameStr);
|
|
@@ -115476,7 +116830,12 @@ function transformDeclarations(context) {
|
|
|
115476
116830
|
factory2.createNodeArray(mapDefined(input.members, (m) => {
|
|
115477
116831
|
if (shouldStripInternal(m))
|
|
115478
116832
|
return;
|
|
115479
|
-
const
|
|
116833
|
+
const enumValue = resolver.getEnumMemberValue(m);
|
|
116834
|
+
const constValue = enumValue == null ? void 0 : enumValue.value;
|
|
116835
|
+
if (isolatedDeclarations && m.initializer && (enumValue == null ? void 0 : enumValue.hasExternalReferences) && // This will be its own compiler error instead, so don't report.
|
|
116836
|
+
!isComputedPropertyName(m.name)) {
|
|
116837
|
+
context.addDiagnostic(createDiagnosticForNode(m, Diagnostics.Enum_member_initializers_must_be_computable_without_references_to_external_symbols_with_isolatedDeclarations));
|
|
116838
|
+
}
|
|
115480
116839
|
const newInitializer = constValue === void 0 ? void 0 : typeof constValue === "string" ? factory2.createStringLiteral(constValue) : constValue < 0 ? factory2.createPrefixUnaryExpression(41 /* MinusToken */, factory2.createNumericLiteral(-constValue)) : factory2.createNumericLiteral(constValue);
|
|
115481
116840
|
return preserveJsDoc(factory2.updateEnumMember(m, m.name, newInitializer), m);
|
|
115482
116841
|
}))
|
|
@@ -116723,6 +118082,7 @@ var notImplementedResolver = {
|
|
|
116723
118082
|
isArgumentsLocalBinding: notImplemented,
|
|
116724
118083
|
getExternalModuleFileFromDeclaration: notImplemented,
|
|
116725
118084
|
isLiteralConstDeclaration: notImplemented,
|
|
118085
|
+
isNonNarrowedBindableName: notImplemented,
|
|
116726
118086
|
getJsxFactoryEntity: notImplemented,
|
|
116727
118087
|
getJsxFragmentFactoryEntity: notImplemented,
|
|
116728
118088
|
isBindingCapturedByNode: notImplemented,
|
|
@@ -124746,6 +126106,14 @@ function createProgram(rootNamesOrOptions, _options, _host, _oldProgram, _config
|
|
|
124746
126106
|
createDiagnosticForOptionName(Diagnostics.Option_0_cannot_be_specified_with_option_1, "outFile", options.verbatimModuleSyntax ? "verbatimModuleSyntax" : "isolatedModules");
|
|
124747
126107
|
}
|
|
124748
126108
|
}
|
|
126109
|
+
if (options.isolatedDeclarations) {
|
|
126110
|
+
if (getAllowJSCompilerOption(options)) {
|
|
126111
|
+
createDiagnosticForOptionName(Diagnostics.Option_0_cannot_be_specified_with_option_1, "allowJs", "isolatedDeclarations");
|
|
126112
|
+
}
|
|
126113
|
+
if (!getEmitDeclarations(options)) {
|
|
126114
|
+
createDiagnosticForOptionName(Diagnostics.Option_0_cannot_be_specified_without_specifying_option_1_or_option_2, "isolatedDeclarations", "declaration", "composite");
|
|
126115
|
+
}
|
|
126116
|
+
}
|
|
124749
126117
|
if (options.inlineSourceMap) {
|
|
124750
126118
|
if (options.sourceMap) {
|
|
124751
126119
|
createDiagnosticForOptionName(Diagnostics.Option_0_cannot_be_specified_with_option_1, "sourceMap", "inlineSourceMap");
|
|
@@ -125249,7 +126617,7 @@ function createProgram(rootNamesOrOptions, _options, _host, _oldProgram, _config
|
|
|
125249
126617
|
message = Diagnostics.File_is_library_specified_here;
|
|
125250
126618
|
break;
|
|
125251
126619
|
}
|
|
125252
|
-
const target =
|
|
126620
|
+
const target = getNameOfScriptTarget(getEmitScriptTarget(options));
|
|
125253
126621
|
configFileNode = target ? getOptionsSyntaxByValue("target", target) : void 0;
|
|
125254
126622
|
message = Diagnostics.File_is_default_library_for_target_specified_here;
|
|
125255
126623
|
break;
|
|
@@ -128971,7 +130339,7 @@ function fileIncludeReasonToDiagnostics(program, reason, fileNameConvertor) {
|
|
|
128971
130339
|
Diagnostics.Library_0_specified_in_compilerOptions,
|
|
128972
130340
|
options.lib[reason.index]
|
|
128973
130341
|
);
|
|
128974
|
-
const target =
|
|
130342
|
+
const target = getNameOfScriptTarget(getEmitScriptTarget(options));
|
|
128975
130343
|
const messageAndArgs = target ? [Diagnostics.Default_library_for_target_0, target] : [Diagnostics.Default_library];
|
|
128976
130344
|
return chainDiagnosticMessages(
|
|
128977
130345
|
/*details*/
|
|
@@ -133052,6 +134420,443 @@ function writeConfigFile(sys2, reportDiagnostic, options, fileNames) {
|
|
|
133052
134420
|
return;
|
|
133053
134421
|
}
|
|
133054
134422
|
|
|
134423
|
+
// src/compiler/expressionToTypeNode.ts
|
|
134424
|
+
function createSyntacticTypeNodeBuilder(options, resolver) {
|
|
134425
|
+
const strictNullChecks = getStrictOptionValue(options, "strictNullChecks");
|
|
134426
|
+
return {
|
|
134427
|
+
typeFromExpression,
|
|
134428
|
+
serializeTypeOfDeclaration,
|
|
134429
|
+
serializeReturnTypeForSignature,
|
|
134430
|
+
serializeTypeOfExpression
|
|
134431
|
+
};
|
|
134432
|
+
function serializeExistingTypeAnnotation(type) {
|
|
134433
|
+
return type === void 0 ? void 0 : !type.parent || !isParameter(type.parent) || !resolver.requiresAddingImplicitUndefined(type.parent) || canAddUndefined(type);
|
|
134434
|
+
}
|
|
134435
|
+
function serializeTypeOfExpression(expr, context, addUndefined, preserveLiterals) {
|
|
134436
|
+
return typeFromExpression(
|
|
134437
|
+
expr,
|
|
134438
|
+
context,
|
|
134439
|
+
/*isConstContext*/
|
|
134440
|
+
false,
|
|
134441
|
+
addUndefined,
|
|
134442
|
+
preserveLiterals
|
|
134443
|
+
) ?? inferExpressionType(expr, context);
|
|
134444
|
+
}
|
|
134445
|
+
function serializeTypeOfDeclaration(node, context) {
|
|
134446
|
+
switch (node.kind) {
|
|
134447
|
+
case 171 /* PropertySignature */:
|
|
134448
|
+
return serializeExistingTypeAnnotation(getEffectiveTypeAnnotationNode(node));
|
|
134449
|
+
case 169 /* Parameter */:
|
|
134450
|
+
return typeFromParameter(node, context);
|
|
134451
|
+
case 260 /* VariableDeclaration */:
|
|
134452
|
+
return typeFromVariable(node, context);
|
|
134453
|
+
case 172 /* PropertyDeclaration */:
|
|
134454
|
+
return typeFromProperty(node, context);
|
|
134455
|
+
case 208 /* BindingElement */:
|
|
134456
|
+
return inferTypeOfDeclaration(node, context);
|
|
134457
|
+
case 277 /* ExportAssignment */:
|
|
134458
|
+
return serializeTypeOfExpression(
|
|
134459
|
+
node.expression,
|
|
134460
|
+
context,
|
|
134461
|
+
/*addUndefined*/
|
|
134462
|
+
void 0,
|
|
134463
|
+
/*preserveLiterals*/
|
|
134464
|
+
true
|
|
134465
|
+
);
|
|
134466
|
+
case 211 /* PropertyAccessExpression */:
|
|
134467
|
+
case 212 /* ElementAccessExpression */:
|
|
134468
|
+
case 226 /* BinaryExpression */:
|
|
134469
|
+
return serializeExistingTypeAnnotation(getEffectiveTypeAnnotationNode(node)) || inferTypeOfDeclaration(node, context);
|
|
134470
|
+
case 303 /* PropertyAssignment */:
|
|
134471
|
+
return typeFromExpression(node.initializer, context) || inferTypeOfDeclaration(node, context);
|
|
134472
|
+
default:
|
|
134473
|
+
Debug.assertNever(node, `Node needs to be an inferrable node, found ${Debug.formatSyntaxKind(node.kind)}`);
|
|
134474
|
+
}
|
|
134475
|
+
}
|
|
134476
|
+
function serializeReturnTypeForSignature(node, context) {
|
|
134477
|
+
switch (node.kind) {
|
|
134478
|
+
case 177 /* GetAccessor */:
|
|
134479
|
+
return typeFromAccessor(node, context);
|
|
134480
|
+
case 174 /* MethodDeclaration */:
|
|
134481
|
+
case 262 /* FunctionDeclaration */:
|
|
134482
|
+
case 180 /* ConstructSignature */:
|
|
134483
|
+
case 173 /* MethodSignature */:
|
|
134484
|
+
case 179 /* CallSignature */:
|
|
134485
|
+
case 176 /* Constructor */:
|
|
134486
|
+
case 178 /* SetAccessor */:
|
|
134487
|
+
case 181 /* IndexSignature */:
|
|
134488
|
+
case 184 /* FunctionType */:
|
|
134489
|
+
case 185 /* ConstructorType */:
|
|
134490
|
+
case 218 /* FunctionExpression */:
|
|
134491
|
+
case 219 /* ArrowFunction */:
|
|
134492
|
+
case 317 /* JSDocFunctionType */:
|
|
134493
|
+
case 323 /* JSDocSignature */:
|
|
134494
|
+
return createReturnFromSignature(node, context);
|
|
134495
|
+
default:
|
|
134496
|
+
Debug.assertNever(node, `Node needs to be an inferrable node, found ${Debug.formatSyntaxKind(node.kind)}`);
|
|
134497
|
+
}
|
|
134498
|
+
}
|
|
134499
|
+
function getTypeAnnotationFromAccessor2(accessor) {
|
|
134500
|
+
if (accessor) {
|
|
134501
|
+
return accessor.kind === 177 /* GetAccessor */ ? getEffectiveReturnTypeNode(accessor) : accessor.parameters.length > 0 ? getEffectiveTypeAnnotationNode(accessor.parameters[0]) : void 0;
|
|
134502
|
+
}
|
|
134503
|
+
}
|
|
134504
|
+
function getTypeAnnotationFromAllAccessorDeclarations(node, accessors) {
|
|
134505
|
+
let accessorType = getTypeAnnotationFromAccessor2(node);
|
|
134506
|
+
if (!accessorType && node !== accessors.firstAccessor) {
|
|
134507
|
+
accessorType = getTypeAnnotationFromAccessor2(accessors.firstAccessor);
|
|
134508
|
+
}
|
|
134509
|
+
if (!accessorType && accessors.secondAccessor && node !== accessors.secondAccessor) {
|
|
134510
|
+
accessorType = getTypeAnnotationFromAccessor2(accessors.secondAccessor);
|
|
134511
|
+
}
|
|
134512
|
+
return accessorType;
|
|
134513
|
+
}
|
|
134514
|
+
function typeFromAccessor(node, context) {
|
|
134515
|
+
const accessorDeclarations = resolver.getAllAccessorDeclarations(node);
|
|
134516
|
+
const accessorType = getTypeAnnotationFromAllAccessorDeclarations(node, accessorDeclarations);
|
|
134517
|
+
if (accessorType) {
|
|
134518
|
+
return serializeExistingTypeAnnotation(accessorType);
|
|
134519
|
+
}
|
|
134520
|
+
if (accessorDeclarations.getAccessor) {
|
|
134521
|
+
return createReturnFromSignature(accessorDeclarations.getAccessor, context);
|
|
134522
|
+
}
|
|
134523
|
+
return false;
|
|
134524
|
+
}
|
|
134525
|
+
function typeFromVariable(node, context) {
|
|
134526
|
+
const declaredType = getEffectiveTypeAnnotationNode(node);
|
|
134527
|
+
if (declaredType) {
|
|
134528
|
+
return serializeExistingTypeAnnotation(declaredType);
|
|
134529
|
+
}
|
|
134530
|
+
let resultType;
|
|
134531
|
+
if (node.initializer) {
|
|
134532
|
+
if (!resolver.isExpandoFunctionDeclaration(node)) {
|
|
134533
|
+
resultType = typeFromExpression(
|
|
134534
|
+
node.initializer,
|
|
134535
|
+
context,
|
|
134536
|
+
/*isConstContext*/
|
|
134537
|
+
void 0,
|
|
134538
|
+
/*requiresAddingUndefined*/
|
|
134539
|
+
void 0,
|
|
134540
|
+
isVarConstLike(node)
|
|
134541
|
+
);
|
|
134542
|
+
}
|
|
134543
|
+
}
|
|
134544
|
+
return resultType ?? inferTypeOfDeclaration(node, context);
|
|
134545
|
+
}
|
|
134546
|
+
function typeFromParameter(node, context) {
|
|
134547
|
+
const parent2 = node.parent;
|
|
134548
|
+
if (parent2.kind === 178 /* SetAccessor */) {
|
|
134549
|
+
return typeFromAccessor(parent2, context);
|
|
134550
|
+
}
|
|
134551
|
+
const declaredType = getEffectiveTypeAnnotationNode(node);
|
|
134552
|
+
const addUndefined = resolver.requiresAddingImplicitUndefined(node);
|
|
134553
|
+
let resultType;
|
|
134554
|
+
if (!addUndefined) {
|
|
134555
|
+
if (declaredType) {
|
|
134556
|
+
return serializeExistingTypeAnnotation(declaredType);
|
|
134557
|
+
}
|
|
134558
|
+
if (node.initializer && isIdentifier(node.name)) {
|
|
134559
|
+
resultType = typeFromExpression(node.initializer, context);
|
|
134560
|
+
}
|
|
134561
|
+
}
|
|
134562
|
+
return resultType ?? inferTypeOfDeclaration(node, context);
|
|
134563
|
+
}
|
|
134564
|
+
function typeFromProperty(node, context) {
|
|
134565
|
+
const declaredType = getEffectiveTypeAnnotationNode(node);
|
|
134566
|
+
if (declaredType) {
|
|
134567
|
+
return serializeExistingTypeAnnotation(declaredType);
|
|
134568
|
+
}
|
|
134569
|
+
let resultType;
|
|
134570
|
+
if (node.initializer) {
|
|
134571
|
+
const isReadonly = isDeclarationReadonly(node);
|
|
134572
|
+
resultType = typeFromExpression(
|
|
134573
|
+
node.initializer,
|
|
134574
|
+
context,
|
|
134575
|
+
/*isConstContext*/
|
|
134576
|
+
void 0,
|
|
134577
|
+
/*requiresAddingUndefined*/
|
|
134578
|
+
void 0,
|
|
134579
|
+
isReadonly
|
|
134580
|
+
);
|
|
134581
|
+
}
|
|
134582
|
+
return resultType ?? inferTypeOfDeclaration(node, context);
|
|
134583
|
+
}
|
|
134584
|
+
function inferTypeOfDeclaration(node, context) {
|
|
134585
|
+
context.tracker.reportInferenceFallback(node);
|
|
134586
|
+
return false;
|
|
134587
|
+
}
|
|
134588
|
+
function inferExpressionType(node, context) {
|
|
134589
|
+
context.tracker.reportInferenceFallback(node);
|
|
134590
|
+
return false;
|
|
134591
|
+
}
|
|
134592
|
+
function inferReturnTypeOfSignatureSignature(node, context) {
|
|
134593
|
+
context.tracker.reportInferenceFallback(node);
|
|
134594
|
+
return false;
|
|
134595
|
+
}
|
|
134596
|
+
function inferAccessorType(node, allAccessors, context) {
|
|
134597
|
+
if (node.kind === 177 /* GetAccessor */) {
|
|
134598
|
+
return createReturnFromSignature(node, context);
|
|
134599
|
+
} else {
|
|
134600
|
+
context.tracker.reportInferenceFallback(node);
|
|
134601
|
+
return false;
|
|
134602
|
+
}
|
|
134603
|
+
}
|
|
134604
|
+
function typeFromTypeAssertion(expression, type, context, requiresAddingUndefined) {
|
|
134605
|
+
if (isConstTypeReference(type)) {
|
|
134606
|
+
return typeFromExpression(
|
|
134607
|
+
expression,
|
|
134608
|
+
context,
|
|
134609
|
+
/*isConstContext*/
|
|
134610
|
+
true,
|
|
134611
|
+
requiresAddingUndefined
|
|
134612
|
+
);
|
|
134613
|
+
}
|
|
134614
|
+
if (requiresAddingUndefined && !canAddUndefined(type)) {
|
|
134615
|
+
context.tracker.reportInferenceFallback(type);
|
|
134616
|
+
}
|
|
134617
|
+
return serializeExistingTypeAnnotation(type);
|
|
134618
|
+
}
|
|
134619
|
+
function typeFromExpression(node, context, isConstContext = false, requiresAddingUndefined = false, preserveLiterals = false) {
|
|
134620
|
+
switch (node.kind) {
|
|
134621
|
+
case 217 /* ParenthesizedExpression */:
|
|
134622
|
+
if (isJSDocTypeAssertion(node)) {
|
|
134623
|
+
return typeFromTypeAssertion(node.expression, getJSDocTypeAssertionType(node), context, requiresAddingUndefined);
|
|
134624
|
+
}
|
|
134625
|
+
return typeFromExpression(node.expression, context, isConstContext, requiresAddingUndefined);
|
|
134626
|
+
case 80 /* Identifier */:
|
|
134627
|
+
if (resolver.isUndefinedIdentifierExpression(node)) {
|
|
134628
|
+
return true;
|
|
134629
|
+
}
|
|
134630
|
+
break;
|
|
134631
|
+
case 106 /* NullKeyword */:
|
|
134632
|
+
return true;
|
|
134633
|
+
case 219 /* ArrowFunction */:
|
|
134634
|
+
case 218 /* FunctionExpression */:
|
|
134635
|
+
return typeFromFunctionLikeExpression(node, context);
|
|
134636
|
+
case 216 /* TypeAssertionExpression */:
|
|
134637
|
+
case 234 /* AsExpression */:
|
|
134638
|
+
const asExpression = node;
|
|
134639
|
+
return typeFromTypeAssertion(asExpression.expression, asExpression.type, context, requiresAddingUndefined);
|
|
134640
|
+
case 224 /* PrefixUnaryExpression */:
|
|
134641
|
+
const unaryExpression = node;
|
|
134642
|
+
if (isPrimitiveLiteralValue(unaryExpression)) {
|
|
134643
|
+
if (unaryExpression.operand.kind === 10 /* BigIntLiteral */) {
|
|
134644
|
+
return typeFromPrimitiveLiteral();
|
|
134645
|
+
}
|
|
134646
|
+
if (unaryExpression.operand.kind === 9 /* NumericLiteral */) {
|
|
134647
|
+
return typeFromPrimitiveLiteral();
|
|
134648
|
+
}
|
|
134649
|
+
}
|
|
134650
|
+
break;
|
|
134651
|
+
case 9 /* NumericLiteral */:
|
|
134652
|
+
return typeFromPrimitiveLiteral();
|
|
134653
|
+
case 228 /* TemplateExpression */:
|
|
134654
|
+
if (!isConstContext && !preserveLiterals) {
|
|
134655
|
+
return true;
|
|
134656
|
+
}
|
|
134657
|
+
break;
|
|
134658
|
+
case 15 /* NoSubstitutionTemplateLiteral */:
|
|
134659
|
+
case 11 /* StringLiteral */:
|
|
134660
|
+
return typeFromPrimitiveLiteral();
|
|
134661
|
+
case 10 /* BigIntLiteral */:
|
|
134662
|
+
return typeFromPrimitiveLiteral();
|
|
134663
|
+
case 112 /* TrueKeyword */:
|
|
134664
|
+
case 97 /* FalseKeyword */:
|
|
134665
|
+
return typeFromPrimitiveLiteral();
|
|
134666
|
+
case 209 /* ArrayLiteralExpression */:
|
|
134667
|
+
return typeFromArrayLiteral(node, context, isConstContext);
|
|
134668
|
+
case 210 /* ObjectLiteralExpression */:
|
|
134669
|
+
return typeFromObjectLiteral(node, context, isConstContext);
|
|
134670
|
+
case 231 /* ClassExpression */:
|
|
134671
|
+
return inferExpressionType(node, context);
|
|
134672
|
+
}
|
|
134673
|
+
return void 0;
|
|
134674
|
+
}
|
|
134675
|
+
function typeFromFunctionLikeExpression(fnNode, context) {
|
|
134676
|
+
const returnType = serializeExistingTypeAnnotation(fnNode.type) ?? createReturnFromSignature(fnNode, context);
|
|
134677
|
+
const typeParameters = reuseTypeParameters(fnNode.typeParameters);
|
|
134678
|
+
const parameters = fnNode.parameters.every((p) => ensureParameter(p, context));
|
|
134679
|
+
return returnType && typeParameters && parameters;
|
|
134680
|
+
}
|
|
134681
|
+
function canGetTypeFromArrayLiteral(arrayLiteral, context, isConstContext) {
|
|
134682
|
+
if (!isConstContext) {
|
|
134683
|
+
context.tracker.reportInferenceFallback(arrayLiteral);
|
|
134684
|
+
return false;
|
|
134685
|
+
}
|
|
134686
|
+
for (const element of arrayLiteral.elements) {
|
|
134687
|
+
if (element.kind === 230 /* SpreadElement */) {
|
|
134688
|
+
context.tracker.reportInferenceFallback(element);
|
|
134689
|
+
return false;
|
|
134690
|
+
}
|
|
134691
|
+
}
|
|
134692
|
+
return true;
|
|
134693
|
+
}
|
|
134694
|
+
function typeFromArrayLiteral(arrayLiteral, context, isConstContext) {
|
|
134695
|
+
if (!canGetTypeFromArrayLiteral(arrayLiteral, context, isConstContext)) {
|
|
134696
|
+
return false;
|
|
134697
|
+
}
|
|
134698
|
+
let canInferArray = true;
|
|
134699
|
+
for (const element of arrayLiteral.elements) {
|
|
134700
|
+
Debug.assert(element.kind !== 230 /* SpreadElement */);
|
|
134701
|
+
if (element.kind !== 232 /* OmittedExpression */) {
|
|
134702
|
+
canInferArray = (typeFromExpression(element, context, isConstContext) ?? inferExpressionType(element, context)) && canInferArray;
|
|
134703
|
+
}
|
|
134704
|
+
}
|
|
134705
|
+
return true;
|
|
134706
|
+
}
|
|
134707
|
+
function canGetTypeFromObjectLiteral(objectLiteral, context) {
|
|
134708
|
+
let result = true;
|
|
134709
|
+
for (const prop of objectLiteral.properties) {
|
|
134710
|
+
if (prop.flags & 262144 /* ThisNodeHasError */) {
|
|
134711
|
+
result = false;
|
|
134712
|
+
break;
|
|
134713
|
+
}
|
|
134714
|
+
if (prop.kind === 304 /* ShorthandPropertyAssignment */ || prop.kind === 305 /* SpreadAssignment */) {
|
|
134715
|
+
context.tracker.reportInferenceFallback(prop);
|
|
134716
|
+
result = false;
|
|
134717
|
+
} else if (prop.name.flags & 262144 /* ThisNodeHasError */) {
|
|
134718
|
+
result = false;
|
|
134719
|
+
break;
|
|
134720
|
+
} else if (prop.name.kind === 81 /* PrivateIdentifier */) {
|
|
134721
|
+
result = false;
|
|
134722
|
+
} else if (prop.name.kind === 167 /* ComputedPropertyName */) {
|
|
134723
|
+
const expression = prop.name.expression;
|
|
134724
|
+
if (!isPrimitiveLiteralValue(
|
|
134725
|
+
expression,
|
|
134726
|
+
/*includeBigInt*/
|
|
134727
|
+
false
|
|
134728
|
+
) && !isEntityNameExpression(expression)) {
|
|
134729
|
+
context.tracker.reportInferenceFallback(prop.name);
|
|
134730
|
+
result = false;
|
|
134731
|
+
}
|
|
134732
|
+
}
|
|
134733
|
+
}
|
|
134734
|
+
return result;
|
|
134735
|
+
}
|
|
134736
|
+
function typeFromObjectLiteral(objectLiteral, context, isConstContext) {
|
|
134737
|
+
if (!canGetTypeFromObjectLiteral(objectLiteral, context))
|
|
134738
|
+
return false;
|
|
134739
|
+
let canInferObjectLiteral = true;
|
|
134740
|
+
for (const prop of objectLiteral.properties) {
|
|
134741
|
+
Debug.assert(!isShorthandPropertyAssignment(prop) && !isSpreadAssignment(prop));
|
|
134742
|
+
const name = prop.name;
|
|
134743
|
+
if (prop.name.kind === 167 /* ComputedPropertyName */) {
|
|
134744
|
+
if (!resolver.isNonNarrowedBindableName(prop.name)) {
|
|
134745
|
+
context.tracker.reportInferenceFallback(prop.name);
|
|
134746
|
+
} else if (isEntityNameExpression(prop.name.expression)) {
|
|
134747
|
+
const visibilityResult = resolver.isEntityNameVisible(
|
|
134748
|
+
prop.name.expression,
|
|
134749
|
+
context.enclosingDeclaration,
|
|
134750
|
+
/*shouldComputeAliasToMakeVisible*/
|
|
134751
|
+
false
|
|
134752
|
+
);
|
|
134753
|
+
if (visibilityResult.accessibility !== 0 /* Accessible */) {
|
|
134754
|
+
context.tracker.reportInferenceFallback(prop.name);
|
|
134755
|
+
}
|
|
134756
|
+
}
|
|
134757
|
+
}
|
|
134758
|
+
switch (prop.kind) {
|
|
134759
|
+
case 174 /* MethodDeclaration */:
|
|
134760
|
+
canInferObjectLiteral = !!typeFromObjectLiteralMethod(prop, name, context) && canInferObjectLiteral;
|
|
134761
|
+
break;
|
|
134762
|
+
case 303 /* PropertyAssignment */:
|
|
134763
|
+
canInferObjectLiteral = !!typeFromObjectLiteralPropertyAssignment(prop, name, context, isConstContext) && canInferObjectLiteral;
|
|
134764
|
+
break;
|
|
134765
|
+
case 178 /* SetAccessor */:
|
|
134766
|
+
case 177 /* GetAccessor */:
|
|
134767
|
+
canInferObjectLiteral = !!typeFromObjectLiteralAccessor(prop, name, context) && canInferObjectLiteral;
|
|
134768
|
+
break;
|
|
134769
|
+
}
|
|
134770
|
+
}
|
|
134771
|
+
return canInferObjectLiteral;
|
|
134772
|
+
}
|
|
134773
|
+
function typeFromObjectLiteralPropertyAssignment(prop, name, context, isConstContext) {
|
|
134774
|
+
return typeFromExpression(prop.initializer, context, isConstContext) ?? inferTypeOfDeclaration(prop, context);
|
|
134775
|
+
}
|
|
134776
|
+
function ensureParameter(p, context) {
|
|
134777
|
+
return typeFromParameter(p, context);
|
|
134778
|
+
}
|
|
134779
|
+
function reuseTypeParameters(typeParameters) {
|
|
134780
|
+
return (typeParameters == null ? void 0 : typeParameters.every(
|
|
134781
|
+
(tp) => serializeExistingTypeAnnotation(tp.constraint) && serializeExistingTypeAnnotation(tp.default)
|
|
134782
|
+
)) ?? true;
|
|
134783
|
+
}
|
|
134784
|
+
function typeFromObjectLiteralMethod(method, name, context) {
|
|
134785
|
+
const returnType = createReturnFromSignature(method, context);
|
|
134786
|
+
const typeParameters = reuseTypeParameters(method.typeParameters);
|
|
134787
|
+
const parameters = method.parameters.every((p) => ensureParameter(p, context));
|
|
134788
|
+
return returnType && typeParameters && parameters;
|
|
134789
|
+
}
|
|
134790
|
+
function typeFromObjectLiteralAccessor(accessor, name, context) {
|
|
134791
|
+
const allAccessors = resolver.getAllAccessorDeclarations(accessor);
|
|
134792
|
+
const getAccessorType = allAccessors.getAccessor && getTypeAnnotationFromAccessor2(allAccessors.getAccessor);
|
|
134793
|
+
const setAccessorType = allAccessors.setAccessor && getTypeAnnotationFromAccessor2(allAccessors.setAccessor);
|
|
134794
|
+
if (getAccessorType !== void 0 && setAccessorType !== void 0) {
|
|
134795
|
+
const parameters = accessor.parameters.every((p) => ensureParameter(p, context));
|
|
134796
|
+
if (isGetAccessor(accessor)) {
|
|
134797
|
+
return parameters && serializeExistingTypeAnnotation(getAccessorType);
|
|
134798
|
+
} else {
|
|
134799
|
+
return parameters;
|
|
134800
|
+
}
|
|
134801
|
+
} else if (allAccessors.firstAccessor === accessor) {
|
|
134802
|
+
const foundType = getAccessorType ?? setAccessorType;
|
|
134803
|
+
const propertyType = foundType ? serializeExistingTypeAnnotation(foundType) : inferAccessorType(accessor, allAccessors, context);
|
|
134804
|
+
return propertyType;
|
|
134805
|
+
}
|
|
134806
|
+
return false;
|
|
134807
|
+
}
|
|
134808
|
+
function typeFromPrimitiveLiteral() {
|
|
134809
|
+
return true;
|
|
134810
|
+
}
|
|
134811
|
+
function canAddUndefined(node) {
|
|
134812
|
+
if (!strictNullChecks)
|
|
134813
|
+
return true;
|
|
134814
|
+
if (isKeyword(node.kind) || node.kind === 201 /* LiteralType */ || node.kind === 184 /* FunctionType */ || node.kind === 185 /* ConstructorType */ || node.kind === 188 /* ArrayType */ || node.kind === 189 /* TupleType */ || node.kind === 187 /* TypeLiteral */ || node.kind === 203 /* TemplateLiteralType */ || node.kind === 197 /* ThisType */) {
|
|
134815
|
+
return true;
|
|
134816
|
+
}
|
|
134817
|
+
if (node.kind === 196 /* ParenthesizedType */) {
|
|
134818
|
+
return canAddUndefined(node.type);
|
|
134819
|
+
}
|
|
134820
|
+
if (node.kind === 192 /* UnionType */ || node.kind === 193 /* IntersectionType */) {
|
|
134821
|
+
return node.types.every(canAddUndefined);
|
|
134822
|
+
}
|
|
134823
|
+
return false;
|
|
134824
|
+
}
|
|
134825
|
+
function createReturnFromSignature(fn, context) {
|
|
134826
|
+
let returnType;
|
|
134827
|
+
const returnTypeNode = getEffectiveReturnTypeNode(fn);
|
|
134828
|
+
if (returnTypeNode) {
|
|
134829
|
+
returnType = serializeExistingTypeAnnotation(returnTypeNode);
|
|
134830
|
+
}
|
|
134831
|
+
if (!returnType && isValueSignatureDeclaration(fn)) {
|
|
134832
|
+
returnType = typeFromSingleReturnExpression(fn, context);
|
|
134833
|
+
}
|
|
134834
|
+
return returnType ?? inferReturnTypeOfSignatureSignature(fn, context);
|
|
134835
|
+
}
|
|
134836
|
+
function typeFromSingleReturnExpression(declaration, context) {
|
|
134837
|
+
let candidateExpr;
|
|
134838
|
+
if (declaration && !nodeIsMissing(declaration.body)) {
|
|
134839
|
+
const body = declaration.body;
|
|
134840
|
+
if (body && isBlock(body)) {
|
|
134841
|
+
forEachReturnStatement(body, (s) => {
|
|
134842
|
+
if (!candidateExpr) {
|
|
134843
|
+
candidateExpr = s.expression;
|
|
134844
|
+
} else {
|
|
134845
|
+
candidateExpr = void 0;
|
|
134846
|
+
return true;
|
|
134847
|
+
}
|
|
134848
|
+
});
|
|
134849
|
+
} else {
|
|
134850
|
+
candidateExpr = body;
|
|
134851
|
+
}
|
|
134852
|
+
}
|
|
134853
|
+
if (candidateExpr) {
|
|
134854
|
+
return typeFromExpression(candidateExpr, context);
|
|
134855
|
+
}
|
|
134856
|
+
return void 0;
|
|
134857
|
+
}
|
|
134858
|
+
}
|
|
134859
|
+
|
|
133055
134860
|
// src/jsTyping/_namespaces/ts.JsTyping.ts
|
|
133056
134861
|
var ts_JsTyping_exports = {};
|
|
133057
134862
|
__export(ts_JsTyping_exports, {
|
|
@@ -165049,7 +166854,7 @@ function isPathRelativeToScript(path) {
|
|
|
165049
166854
|
}
|
|
165050
166855
|
return false;
|
|
165051
166856
|
}
|
|
165052
|
-
var tripleSlashDirectiveFragmentRegex = /^(\/\/\/\s*<reference\s+(path|types)\s*=\s*(?:'|"))([^\
|
|
166857
|
+
var tripleSlashDirectiveFragmentRegex = /^(\/\/\/\s*<reference\s+(path|types)\s*=\s*(?:'|"))([^\x03"]*)$/;
|
|
165053
166858
|
var nodeModulesDependencyKeys = ["dependencies", "devDependencies", "peerDependencies", "optionalDependencies"];
|
|
165054
166859
|
function containsSlash(fragment) {
|
|
165055
166860
|
return fragment.includes(directorySeparator);
|
|
@@ -167947,9 +169752,13 @@ function isExpandoDeclaration(node) {
|
|
|
167947
169752
|
}
|
|
167948
169753
|
function getDefinitionFromSymbol(typeChecker, symbol, node, failedAliasResolution, excludeDeclaration) {
|
|
167949
169754
|
const filteredDeclarations = filter(symbol.declarations, (d) => d !== excludeDeclaration);
|
|
169755
|
+
const signatureDefinition = getConstructSignatureDefinition() || getCallSignatureDefinition();
|
|
169756
|
+
if (signatureDefinition) {
|
|
169757
|
+
return signatureDefinition;
|
|
169758
|
+
}
|
|
167950
169759
|
const withoutExpandos = filter(filteredDeclarations, (d) => !isExpandoDeclaration(d));
|
|
167951
169760
|
const results = some(withoutExpandos) ? withoutExpandos : filteredDeclarations;
|
|
167952
|
-
return
|
|
169761
|
+
return map(results, (declaration) => createDefinitionInfo(
|
|
167953
169762
|
declaration,
|
|
167954
169763
|
typeChecker,
|
|
167955
169764
|
symbol,
|
|
@@ -167960,8 +169769,8 @@ function getDefinitionFromSymbol(typeChecker, symbol, node, failedAliasResolutio
|
|
|
167960
169769
|
));
|
|
167961
169770
|
function getConstructSignatureDefinition() {
|
|
167962
169771
|
if (symbol.flags & 32 /* Class */ && !(symbol.flags & (16 /* Function */ | 3 /* Variable */)) && (isNewExpressionTarget(node) || node.kind === 137 /* ConstructorKeyword */)) {
|
|
167963
|
-
const cls = find(filteredDeclarations, isClassLike)
|
|
167964
|
-
return getSignatureDefinition(
|
|
169772
|
+
const cls = find(filteredDeclarations, isClassLike);
|
|
169773
|
+
return cls && getSignatureDefinition(
|
|
167965
169774
|
cls.members,
|
|
167966
169775
|
/*selectConstructors*/
|
|
167967
169776
|
true
|
|
@@ -170615,6 +172424,9 @@ function getArgumentOrParameterListInfo(node, position, sourceFile, checker) {
|
|
|
170615
172424
|
return void 0;
|
|
170616
172425
|
const { list, argumentIndex } = info;
|
|
170617
172426
|
const argumentCount = getArgumentCount(checker, list);
|
|
172427
|
+
if (argumentIndex !== 0) {
|
|
172428
|
+
Debug.assertLessThan(argumentIndex, argumentCount);
|
|
172429
|
+
}
|
|
170618
172430
|
const argumentsSpan = getApplicableSpanForArguments(list, sourceFile);
|
|
170619
172431
|
return { list, argumentIndex, argumentCount, argumentsSpan };
|
|
170620
172432
|
}
|
|
@@ -170893,6 +172705,9 @@ function createSignatureHelpItems(candidates, resolvedSignature, { isTypeParamet
|
|
|
170893
172705
|
void 0
|
|
170894
172706
|
) : emptyArray;
|
|
170895
172707
|
const items = map(candidates, (candidateSignature) => getSignatureHelpItem(candidateSignature, callTargetDisplayParts, isTypeParameterList, typeChecker, enclosingDeclaration, sourceFile));
|
|
172708
|
+
if (argumentIndex !== 0) {
|
|
172709
|
+
Debug.assertLessThan(argumentIndex, argumentCount);
|
|
172710
|
+
}
|
|
170896
172711
|
let selectedItemIndex = 0;
|
|
170897
172712
|
let itemsSeen = 0;
|
|
170898
172713
|
for (let i = 0; i < items.length; i++) {
|
|
@@ -176083,6 +177898,7 @@ __export(ts_exports2, {
|
|
|
176083
177898
|
ProcessLevel: () => ProcessLevel,
|
|
176084
177899
|
ProgramUpdateLevel: () => ProgramUpdateLevel,
|
|
176085
177900
|
QuotePreference: () => QuotePreference,
|
|
177901
|
+
RegularExpressionFlags: () => RegularExpressionFlags,
|
|
176086
177902
|
RelationComparisonResult: () => RelationComparisonResult,
|
|
176087
177903
|
Rename: () => ts_Rename_exports,
|
|
176088
177904
|
ScriptElementKind: () => ScriptElementKind,
|
|
@@ -176211,6 +178027,7 @@ __export(ts_exports2, {
|
|
|
176211
178027
|
changeFullExtension: () => changeFullExtension,
|
|
176212
178028
|
changesAffectModuleResolution: () => changesAffectModuleResolution,
|
|
176213
178029
|
changesAffectingProgramStructure: () => changesAffectingProgramStructure,
|
|
178030
|
+
characterToRegularExpressionFlag: () => characterToRegularExpressionFlag,
|
|
176214
178031
|
childIsDecorated: () => childIsDecorated,
|
|
176215
178032
|
classElementOrClassElementParameterIsDecorated: () => classElementOrClassElementParameterIsDecorated,
|
|
176216
178033
|
classHasClassThisAssignment: () => classHasClassThisAssignment,
|
|
@@ -176356,6 +178173,7 @@ __export(ts_exports2, {
|
|
|
176356
178173
|
createForOfBindingStatement: () => createForOfBindingStatement,
|
|
176357
178174
|
createFutureSourceFile: () => createFutureSourceFile,
|
|
176358
178175
|
createGetCanonicalFileName: () => createGetCanonicalFileName,
|
|
178176
|
+
createGetIsolatedDeclarationErrors: () => createGetIsolatedDeclarationErrors,
|
|
176359
178177
|
createGetSourceFile: () => createGetSourceFile,
|
|
176360
178178
|
createGetSymbolAccessibilityDiagnosticForNode: () => createGetSymbolAccessibilityDiagnosticForNode,
|
|
176361
178179
|
createGetSymbolAccessibilityDiagnosticForNodeName: () => createGetSymbolAccessibilityDiagnosticForNodeName,
|
|
@@ -176410,6 +178228,7 @@ __export(ts_exports2, {
|
|
|
176410
178228
|
createSuperAccessVariableStatement: () => createSuperAccessVariableStatement,
|
|
176411
178229
|
createSymbolTable: () => createSymbolTable,
|
|
176412
178230
|
createSymlinkCache: () => createSymlinkCache,
|
|
178231
|
+
createSyntacticTypeNodeBuilder: () => createSyntacticTypeNodeBuilder,
|
|
176413
178232
|
createSystemWatchFunctions: () => createSystemWatchFunctions,
|
|
176414
178233
|
createTextChange: () => createTextChange,
|
|
176415
178234
|
createTextChangeFromStartLength: () => createTextChangeFromStartLength,
|
|
@@ -176849,6 +178668,7 @@ __export(ts_exports2, {
|
|
|
176849
178668
|
getNameOfDeclaration: () => getNameOfDeclaration,
|
|
176850
178669
|
getNameOfExpando: () => getNameOfExpando,
|
|
176851
178670
|
getNameOfJSDocTypedef: () => getNameOfJSDocTypedef,
|
|
178671
|
+
getNameOfScriptTarget: () => getNameOfScriptTarget,
|
|
176852
178672
|
getNameOrArgument: () => getNameOrArgument,
|
|
176853
178673
|
getNameTable: () => getNameTable,
|
|
176854
178674
|
getNamesForExportedSymbol: () => getNamesForExportedSymbol,
|
|
@@ -177063,6 +178883,7 @@ __export(ts_exports2, {
|
|
|
177063
178883
|
hasEffectiveReadonlyModifier: () => hasEffectiveReadonlyModifier,
|
|
177064
178884
|
hasExtension: () => hasExtension,
|
|
177065
178885
|
hasIndexSignature: () => hasIndexSignature,
|
|
178886
|
+
hasInferredType: () => hasInferredType,
|
|
177066
178887
|
hasInitializer: () => hasInitializer,
|
|
177067
178888
|
hasInvalidEscape: () => hasInvalidEscape,
|
|
177068
178889
|
hasJSDocNodes: () => hasJSDocNodes,
|
|
@@ -177623,6 +179444,7 @@ __export(ts_exports2, {
|
|
|
177623
179444
|
isPossiblyTypeArgumentPosition: () => isPossiblyTypeArgumentPosition,
|
|
177624
179445
|
isPostfixUnaryExpression: () => isPostfixUnaryExpression,
|
|
177625
179446
|
isPrefixUnaryExpression: () => isPrefixUnaryExpression,
|
|
179447
|
+
isPrimitiveLiteralValue: () => isPrimitiveLiteralValue,
|
|
177626
179448
|
isPrivateIdentifier: () => isPrivateIdentifier,
|
|
177627
179449
|
isPrivateIdentifierClassElementDeclaration: () => isPrivateIdentifierClassElementDeclaration,
|
|
177628
179450
|
isPrivateIdentifierPropertyAccessExpression: () => isPrivateIdentifierPropertyAccessExpression,
|
|
@@ -177789,6 +179611,7 @@ __export(ts_exports2, {
|
|
|
177789
179611
|
isValueSignatureDeclaration: () => isValueSignatureDeclaration,
|
|
177790
179612
|
isVarAwaitUsing: () => isVarAwaitUsing,
|
|
177791
179613
|
isVarConst: () => isVarConst,
|
|
179614
|
+
isVarConstLike: () => isVarConstLike,
|
|
177792
179615
|
isVarUsing: () => isVarUsing,
|
|
177793
179616
|
isVariableDeclaration: () => isVariableDeclaration,
|
|
177794
179617
|
isVariableDeclarationInVariableStatement: () => isVariableDeclarationInVariableStatement,
|
|
@@ -177993,6 +179816,7 @@ __export(ts_exports2, {
|
|
|
177993
179816
|
reducePathComponents: () => reducePathComponents,
|
|
177994
179817
|
refactor: () => ts_refactor_exports,
|
|
177995
179818
|
regExpEscape: () => regExpEscape,
|
|
179819
|
+
regularExpressionFlagToCharacter: () => regularExpressionFlagToCharacter,
|
|
177996
179820
|
relativeComplement: () => relativeComplement,
|
|
177997
179821
|
removeAllComments: () => removeAllComments,
|
|
177998
179822
|
removeEmitHelper: () => removeEmitHelper,
|
|
@@ -178248,6 +180072,7 @@ __export(ts_exports2, {
|
|
|
178248
180072
|
unsetNodeChildren: () => unsetNodeChildren,
|
|
178249
180073
|
unusedLabelIsError: () => unusedLabelIsError,
|
|
178250
180074
|
unwrapInnermostStatementOfLabel: () => unwrapInnermostStatementOfLabel,
|
|
180075
|
+
unwrapParenthesizedExpression: () => unwrapParenthesizedExpression,
|
|
178251
180076
|
updateErrorForNoInputFiles: () => updateErrorForNoInputFiles,
|
|
178252
180077
|
updateLanguageServiceSourceFile: () => updateLanguageServiceSourceFile,
|
|
178253
180078
|
updateMissingFilePathsWatch: () => updateMissingFilePathsWatch,
|
|
@@ -190499,6 +192324,7 @@ if (typeof console !== "undefined") {
|
|
|
190499
192324
|
ProcessLevel,
|
|
190500
192325
|
ProgramUpdateLevel,
|
|
190501
192326
|
QuotePreference,
|
|
192327
|
+
RegularExpressionFlags,
|
|
190502
192328
|
RelationComparisonResult,
|
|
190503
192329
|
Rename,
|
|
190504
192330
|
ScriptElementKind,
|
|
@@ -190627,6 +192453,7 @@ if (typeof console !== "undefined") {
|
|
|
190627
192453
|
changeFullExtension,
|
|
190628
192454
|
changesAffectModuleResolution,
|
|
190629
192455
|
changesAffectingProgramStructure,
|
|
192456
|
+
characterToRegularExpressionFlag,
|
|
190630
192457
|
childIsDecorated,
|
|
190631
192458
|
classElementOrClassElementParameterIsDecorated,
|
|
190632
192459
|
classHasClassThisAssignment,
|
|
@@ -190772,6 +192599,7 @@ if (typeof console !== "undefined") {
|
|
|
190772
192599
|
createForOfBindingStatement,
|
|
190773
192600
|
createFutureSourceFile,
|
|
190774
192601
|
createGetCanonicalFileName,
|
|
192602
|
+
createGetIsolatedDeclarationErrors,
|
|
190775
192603
|
createGetSourceFile,
|
|
190776
192604
|
createGetSymbolAccessibilityDiagnosticForNode,
|
|
190777
192605
|
createGetSymbolAccessibilityDiagnosticForNodeName,
|
|
@@ -190826,6 +192654,7 @@ if (typeof console !== "undefined") {
|
|
|
190826
192654
|
createSuperAccessVariableStatement,
|
|
190827
192655
|
createSymbolTable,
|
|
190828
192656
|
createSymlinkCache,
|
|
192657
|
+
createSyntacticTypeNodeBuilder,
|
|
190829
192658
|
createSystemWatchFunctions,
|
|
190830
192659
|
createTextChange,
|
|
190831
192660
|
createTextChangeFromStartLength,
|
|
@@ -191265,6 +193094,7 @@ if (typeof console !== "undefined") {
|
|
|
191265
193094
|
getNameOfDeclaration,
|
|
191266
193095
|
getNameOfExpando,
|
|
191267
193096
|
getNameOfJSDocTypedef,
|
|
193097
|
+
getNameOfScriptTarget,
|
|
191268
193098
|
getNameOrArgument,
|
|
191269
193099
|
getNameTable,
|
|
191270
193100
|
getNamesForExportedSymbol,
|
|
@@ -191479,6 +193309,7 @@ if (typeof console !== "undefined") {
|
|
|
191479
193309
|
hasEffectiveReadonlyModifier,
|
|
191480
193310
|
hasExtension,
|
|
191481
193311
|
hasIndexSignature,
|
|
193312
|
+
hasInferredType,
|
|
191482
193313
|
hasInitializer,
|
|
191483
193314
|
hasInvalidEscape,
|
|
191484
193315
|
hasJSDocNodes,
|
|
@@ -192039,6 +193870,7 @@ if (typeof console !== "undefined") {
|
|
|
192039
193870
|
isPossiblyTypeArgumentPosition,
|
|
192040
193871
|
isPostfixUnaryExpression,
|
|
192041
193872
|
isPrefixUnaryExpression,
|
|
193873
|
+
isPrimitiveLiteralValue,
|
|
192042
193874
|
isPrivateIdentifier,
|
|
192043
193875
|
isPrivateIdentifierClassElementDeclaration,
|
|
192044
193876
|
isPrivateIdentifierPropertyAccessExpression,
|
|
@@ -192205,6 +194037,7 @@ if (typeof console !== "undefined") {
|
|
|
192205
194037
|
isValueSignatureDeclaration,
|
|
192206
194038
|
isVarAwaitUsing,
|
|
192207
194039
|
isVarConst,
|
|
194040
|
+
isVarConstLike,
|
|
192208
194041
|
isVarUsing,
|
|
192209
194042
|
isVariableDeclaration,
|
|
192210
194043
|
isVariableDeclarationInVariableStatement,
|
|
@@ -192409,6 +194242,7 @@ if (typeof console !== "undefined") {
|
|
|
192409
194242
|
reducePathComponents,
|
|
192410
194243
|
refactor,
|
|
192411
194244
|
regExpEscape,
|
|
194245
|
+
regularExpressionFlagToCharacter,
|
|
192412
194246
|
relativeComplement,
|
|
192413
194247
|
removeAllComments,
|
|
192414
194248
|
removeEmitHelper,
|
|
@@ -192664,6 +194498,7 @@ if (typeof console !== "undefined") {
|
|
|
192664
194498
|
unsetNodeChildren,
|
|
192665
194499
|
unusedLabelIsError,
|
|
192666
194500
|
unwrapInnermostStatementOfLabel,
|
|
194501
|
+
unwrapParenthesizedExpression,
|
|
192667
194502
|
updateErrorForNoInputFiles,
|
|
192668
194503
|
updateLanguageServiceSourceFile,
|
|
192669
194504
|
updateMissingFilePathsWatch,
|