diff --git a/bin/tsc.js b/bin/tsc.js index 0b8dd882716..627c8fc508f 100644 --- a/bin/tsc.js +++ b/bin/tsc.js @@ -134,7 +134,8 @@ var ts; const_declarations_must_be_initialized: { code: 1155, category: 1 /* Error */, key: "'const' declarations must be initialized" }, const_declarations_can_only_be_declared_inside_a_block: { code: 1156, category: 1 /* Error */, key: "'const' declarations can only be declared inside a block." }, let_declarations_can_only_be_declared_inside_a_block: { code: 1157, category: 1 /* Error */, key: "'let' declarations can only be declared inside a block." }, - Aliased_type_cannot_be_an_object_type_literal_Use_an_interface_declaration_instead: { code: 1158, category: 1 /* Error */, key: "Aliased type cannot be an object type literal. Use an interface declaration instead." }, + Invalid_template_literal_expected: { code: 1158, category: 1 /* Error */, key: "Invalid template literal; expected '}'" }, + Tagged_templates_are_only_available_when_targeting_ECMAScript_6_and_higher: { code: 1159, category: 1 /* Error */, key: "Tagged templates are only available when targeting ECMAScript 6 and higher." }, Duplicate_identifier_0: { code: 2300, category: 1 /* Error */, key: "Duplicate identifier '{0}'." }, Initializer_of_instance_member_variable_0_cannot_reference_identifier_1_declared_in_the_constructor: { code: 2301, category: 1 /* Error */, key: "Initializer of instance member variable '{0}' cannot reference identifier '{1}' declared in the constructor." }, Static_members_cannot_reference_class_type_parameters: { code: 2302, category: 1 /* Error */, key: "Static members cannot reference class type parameters." }, @@ -282,6 +283,7 @@ var ts; The_type_argument_for_type_parameter_0_cannot_be_inferred_from_the_usage_Consider_specifying_the_type_arguments_explicitly: { code: 2453, category: 1 /* Error */, key: "The type argument for type parameter '{0}' cannot be inferred from the usage. Consider specifying the type arguments explicitly." }, Type_argument_candidate_1_is_not_a_valid_type_argument_because_it_is_not_a_supertype_of_candidate_0: { code: 2455, category: 1 /* Error */, key: "Type argument candidate '{1}' is not a valid type argument because it is not a supertype of candidate '{0}'." }, Type_alias_0_circularly_references_itself: { code: 2456, category: 1 /* Error */, key: "Type alias '{0}' circularly references itself." }, + Type_alias_name_cannot_be_0: { code: 2457, category: 1 /* Error */, key: "Type alias name cannot be '{0}'" }, Import_declaration_0_is_using_private_name_1: { code: 4000, category: 1 /* Error */, key: "Import declaration '{0}' is using private name '{1}'." }, Type_parameter_0_of_exported_class_has_or_is_using_name_1_from_private_module_2: { code: 4001, category: 1 /* Error */, key: "Type parameter '{0}' of exported class has or is using name '{1}' from private module '{2}'." }, Type_parameter_0_of_exported_class_has_or_is_using_private_name_1: { code: 4002, category: 1 /* Error */, key: "Type parameter '{0}' of exported class has or is using private name '{1}'." }, @@ -364,6 +366,12 @@ var ts; Exported_type_alias_0_has_or_is_using_name_1_from_external_module_2_but_cannot_be_named: { code: 4079, category: 1 /* Error */, key: "Exported type alias '{0}' has or is using name '{1}' from external module {2} but cannot be named." }, Exported_type_alias_0_has_or_is_using_name_1_from_private_module_2: { code: 4080, category: 1 /* Error */, key: "Exported type alias '{0}' has or is using name '{1}' from private module '{2}'." }, Exported_type_alias_0_has_or_is_using_private_name_1: { code: 4081, category: 1 /* Error */, key: "Exported type alias '{0}' has or is using private name '{1}'." }, + Enum_declarations_must_all_be_const_or_non_const: { code: 4082, category: 1 /* Error */, key: "Enum declarations must all be const or non-const." }, + In_const_enum_declarations_member_initializer_must_be_constant_expression: { code: 4083, category: 1 /* Error */, key: "In 'const' enum declarations member initializer must be constant expression.", isEarly: true }, + const_enums_can_only_be_used_in_property_or_index_access_expressions_or_the_right_hand_side_of_an_import_declaration_or_export_assignment: { code: 4084, category: 1 /* Error */, key: "'const' enums can only be used in property or index access expressions or the right hand side of an import declaration or export assignment." }, + Index_expression_arguments_in_const_enums_must_be_of_type_string: { code: 4085, category: 1 /* Error */, key: "Index expression arguments in 'const' enums must be of type 'string'." }, + const_enum_member_initializer_was_evaluated_to_a_non_finite_value: { code: 4086, category: 1 /* Error */, key: "'const' enum member initializer was evaluated to a non-finite value." }, + const_enum_member_initializer_was_evaluated_to_disallowed_value_NaN: { code: 4087, category: 1 /* Error */, key: "'const' enum member initializer was evaluated to disallowed value 'NaN'." }, The_current_host_does_not_support_the_0_option: { code: 5001, category: 1 /* Error */, key: "The current host does not support the '{0}' option." }, Cannot_find_the_common_subdirectory_path_for_the_input_files: { code: 5009, category: 1 /* Error */, key: "Cannot find the common subdirectory path for the input files." }, Cannot_read_file_0_Colon_1: { code: 5012, category: 1 /* Error */, key: "Cannot read file '{0}': {1}" }, @@ -378,6 +386,7 @@ var ts; Specifies_the_location_where_debugger_should_locate_TypeScript_files_instead_of_source_locations: { code: 6004, category: 2 /* Message */, key: "Specifies the location where debugger should locate TypeScript files instead of source locations." }, Watch_input_files: { code: 6005, category: 2 /* Message */, key: "Watch input files." }, Redirect_output_structure_to_the_directory: { code: 6006, category: 2 /* Message */, key: "Redirect output structure to the directory." }, + Do_not_erase_const_enum_declarations_in_generated_code: { code: 6007, category: 2 /* Message */, key: "Do not erase const enum declarations in generated code." }, Do_not_emit_comments_to_output: { code: 6009, category: 2 /* Message */, key: "Do not emit comments to output." }, Specify_ECMAScript_target_version_Colon_ES3_default_ES5_or_ES6_experimental: { code: 6015, category: 2 /* Message */, key: "Specify ECMAScript target version: 'ES3' (default), 'ES5', or 'ES6' (experimental)" }, Specify_module_code_generation_Colon_commonjs_or_amd: { code: 6016, category: 2 /* Message */, key: "Specify module code generation: 'commonjs' or 'amd'" }, @@ -431,112 +440,112 @@ var ts; var ts; (function (ts) { var textToToken = { - "any": 105 /* AnyKeyword */, - "boolean": 106 /* BooleanKeyword */, - "break": 60 /* BreakKeyword */, - "case": 61 /* CaseKeyword */, - "catch": 62 /* CatchKeyword */, - "class": 63 /* ClassKeyword */, - "continue": 65 /* ContinueKeyword */, - "const": 64 /* ConstKeyword */, - "constructor": 107 /* ConstructorKeyword */, - "debugger": 66 /* DebuggerKeyword */, - "declare": 108 /* DeclareKeyword */, - "default": 67 /* DefaultKeyword */, - "delete": 68 /* DeleteKeyword */, - "do": 69 /* DoKeyword */, - "else": 70 /* ElseKeyword */, - "enum": 71 /* EnumKeyword */, - "export": 72 /* ExportKeyword */, - "extends": 73 /* ExtendsKeyword */, - "false": 74 /* FalseKeyword */, - "finally": 75 /* FinallyKeyword */, - "for": 76 /* ForKeyword */, - "function": 77 /* FunctionKeyword */, - "get": 109 /* GetKeyword */, - "if": 78 /* IfKeyword */, - "implements": 96 /* ImplementsKeyword */, - "import": 79 /* ImportKeyword */, - "in": 80 /* InKeyword */, - "instanceof": 81 /* InstanceOfKeyword */, - "interface": 97 /* InterfaceKeyword */, - "let": 98 /* LetKeyword */, - "module": 110 /* ModuleKeyword */, - "new": 82 /* NewKeyword */, - "null": 83 /* NullKeyword */, - "number": 112 /* NumberKeyword */, - "package": 99 /* PackageKeyword */, - "private": 100 /* PrivateKeyword */, - "protected": 101 /* ProtectedKeyword */, - "public": 102 /* PublicKeyword */, - "require": 111 /* RequireKeyword */, - "return": 84 /* ReturnKeyword */, - "set": 113 /* SetKeyword */, - "static": 103 /* StaticKeyword */, - "string": 114 /* StringKeyword */, - "super": 85 /* SuperKeyword */, - "switch": 86 /* SwitchKeyword */, - "this": 87 /* ThisKeyword */, - "throw": 88 /* ThrowKeyword */, - "true": 89 /* TrueKeyword */, - "try": 90 /* TryKeyword */, - "type": 115 /* TypeKeyword */, - "typeof": 91 /* TypeOfKeyword */, - "var": 92 /* VarKeyword */, - "void": 93 /* VoidKeyword */, - "while": 94 /* WhileKeyword */, - "with": 95 /* WithKeyword */, - "yield": 104 /* YieldKeyword */, - "{": 9 /* OpenBraceToken */, - "}": 10 /* CloseBraceToken */, - "(": 11 /* OpenParenToken */, - ")": 12 /* CloseParenToken */, - "[": 13 /* OpenBracketToken */, - "]": 14 /* CloseBracketToken */, - ".": 15 /* DotToken */, - "...": 16 /* DotDotDotToken */, - ";": 17 /* SemicolonToken */, - ",": 18 /* CommaToken */, - "<": 19 /* LessThanToken */, - ">": 20 /* GreaterThanToken */, - "<=": 21 /* LessThanEqualsToken */, - ">=": 22 /* GreaterThanEqualsToken */, - "==": 23 /* EqualsEqualsToken */, - "!=": 24 /* ExclamationEqualsToken */, - "===": 25 /* EqualsEqualsEqualsToken */, - "!==": 26 /* ExclamationEqualsEqualsToken */, - "=>": 27 /* EqualsGreaterThanToken */, - "+": 28 /* PlusToken */, - "-": 29 /* MinusToken */, - "*": 30 /* AsteriskToken */, - "/": 31 /* SlashToken */, - "%": 32 /* PercentToken */, - "++": 33 /* PlusPlusToken */, - "--": 34 /* MinusMinusToken */, - "<<": 35 /* LessThanLessThanToken */, - ">>": 36 /* GreaterThanGreaterThanToken */, - ">>>": 37 /* GreaterThanGreaterThanGreaterThanToken */, - "&": 38 /* AmpersandToken */, - "|": 39 /* BarToken */, - "^": 40 /* CaretToken */, - "!": 41 /* ExclamationToken */, - "~": 42 /* TildeToken */, - "&&": 43 /* AmpersandAmpersandToken */, - "||": 44 /* BarBarToken */, - "?": 45 /* QuestionToken */, - ":": 46 /* ColonToken */, - "=": 47 /* EqualsToken */, - "+=": 48 /* PlusEqualsToken */, - "-=": 49 /* MinusEqualsToken */, - "*=": 50 /* AsteriskEqualsToken */, - "/=": 51 /* SlashEqualsToken */, - "%=": 52 /* PercentEqualsToken */, - "<<=": 53 /* LessThanLessThanEqualsToken */, - ">>=": 54 /* GreaterThanGreaterThanEqualsToken */, - ">>>=": 55 /* GreaterThanGreaterThanGreaterThanEqualsToken */, - "&=": 56 /* AmpersandEqualsToken */, - "|=": 57 /* BarEqualsToken */, - "^=": 58 /* CaretEqualsToken */ + "any": 109 /* AnyKeyword */, + "boolean": 110 /* BooleanKeyword */, + "break": 64 /* BreakKeyword */, + "case": 65 /* CaseKeyword */, + "catch": 66 /* CatchKeyword */, + "class": 67 /* ClassKeyword */, + "continue": 69 /* ContinueKeyword */, + "const": 68 /* ConstKeyword */, + "constructor": 111 /* ConstructorKeyword */, + "debugger": 70 /* DebuggerKeyword */, + "declare": 112 /* DeclareKeyword */, + "default": 71 /* DefaultKeyword */, + "delete": 72 /* DeleteKeyword */, + "do": 73 /* DoKeyword */, + "else": 74 /* ElseKeyword */, + "enum": 75 /* EnumKeyword */, + "export": 76 /* ExportKeyword */, + "extends": 77 /* ExtendsKeyword */, + "false": 78 /* FalseKeyword */, + "finally": 79 /* FinallyKeyword */, + "for": 80 /* ForKeyword */, + "function": 81 /* FunctionKeyword */, + "get": 113 /* GetKeyword */, + "if": 82 /* IfKeyword */, + "implements": 100 /* ImplementsKeyword */, + "import": 83 /* ImportKeyword */, + "in": 84 /* InKeyword */, + "instanceof": 85 /* InstanceOfKeyword */, + "interface": 101 /* InterfaceKeyword */, + "let": 102 /* LetKeyword */, + "module": 114 /* ModuleKeyword */, + "new": 86 /* NewKeyword */, + "null": 87 /* NullKeyword */, + "number": 116 /* NumberKeyword */, + "package": 103 /* PackageKeyword */, + "private": 104 /* PrivateKeyword */, + "protected": 105 /* ProtectedKeyword */, + "public": 106 /* PublicKeyword */, + "require": 115 /* RequireKeyword */, + "return": 88 /* ReturnKeyword */, + "set": 117 /* SetKeyword */, + "static": 107 /* StaticKeyword */, + "string": 118 /* StringKeyword */, + "super": 89 /* SuperKeyword */, + "switch": 90 /* SwitchKeyword */, + "this": 91 /* ThisKeyword */, + "throw": 92 /* ThrowKeyword */, + "true": 93 /* TrueKeyword */, + "try": 94 /* TryKeyword */, + "type": 119 /* TypeKeyword */, + "typeof": 95 /* TypeOfKeyword */, + "var": 96 /* VarKeyword */, + "void": 97 /* VoidKeyword */, + "while": 98 /* WhileKeyword */, + "with": 99 /* WithKeyword */, + "yield": 108 /* YieldKeyword */, + "{": 13 /* OpenBraceToken */, + "}": 14 /* CloseBraceToken */, + "(": 15 /* OpenParenToken */, + ")": 16 /* CloseParenToken */, + "[": 17 /* OpenBracketToken */, + "]": 18 /* CloseBracketToken */, + ".": 19 /* DotToken */, + "...": 20 /* DotDotDotToken */, + ";": 21 /* SemicolonToken */, + ",": 22 /* CommaToken */, + "<": 23 /* LessThanToken */, + ">": 24 /* GreaterThanToken */, + "<=": 25 /* LessThanEqualsToken */, + ">=": 26 /* GreaterThanEqualsToken */, + "==": 27 /* EqualsEqualsToken */, + "!=": 28 /* ExclamationEqualsToken */, + "===": 29 /* EqualsEqualsEqualsToken */, + "!==": 30 /* ExclamationEqualsEqualsToken */, + "=>": 31 /* EqualsGreaterThanToken */, + "+": 32 /* PlusToken */, + "-": 33 /* MinusToken */, + "*": 34 /* AsteriskToken */, + "/": 35 /* SlashToken */, + "%": 36 /* PercentToken */, + "++": 37 /* PlusPlusToken */, + "--": 38 /* MinusMinusToken */, + "<<": 39 /* LessThanLessThanToken */, + ">>": 40 /* GreaterThanGreaterThanToken */, + ">>>": 41 /* GreaterThanGreaterThanGreaterThanToken */, + "&": 42 /* AmpersandToken */, + "|": 43 /* BarToken */, + "^": 44 /* CaretToken */, + "!": 45 /* ExclamationToken */, + "~": 46 /* TildeToken */, + "&&": 47 /* AmpersandAmpersandToken */, + "||": 48 /* BarBarToken */, + "?": 49 /* QuestionToken */, + ":": 50 /* ColonToken */, + "=": 51 /* EqualsToken */, + "+=": 52 /* PlusEqualsToken */, + "-=": 53 /* MinusEqualsToken */, + "*=": 54 /* AsteriskEqualsToken */, + "/=": 55 /* SlashEqualsToken */, + "%=": 56 /* PercentEqualsToken */, + "<<=": 57 /* LessThanLessThanEqualsToken */, + ">>=": 58 /* GreaterThanGreaterThanEqualsToken */, + ">>>=": 59 /* GreaterThanGreaterThanGreaterThanEqualsToken */, + "&=": 60 /* AmpersandEqualsToken */, + "|=": 61 /* BarEqualsToken */, + "^=": 62 /* CaretEqualsToken */ }; var unicodeES3IdentifierStart = [170, 170, 181, 181, 186, 186, 192, 214, 216, 246, 248, 543, 546, 563, 592, 685, 688, 696, 699, 705, 720, 721, 736, 740, 750, 750, 890, 890, 902, 902, 904, 906, 908, 908, 910, 929, 931, 974, 976, 983, 986, 1011, 1024, 1153, 1164, 1220, 1223, 1224, 1227, 1228, 1232, 1269, 1272, 1273, 1329, 1366, 1369, 1369, 1377, 1415, 1488, 1514, 1520, 1522, 1569, 1594, 1600, 1610, 1649, 1747, 1749, 1749, 1765, 1766, 1786, 1788, 1808, 1808, 1810, 1836, 1920, 1957, 2309, 2361, 2365, 2365, 2384, 2384, 2392, 2401, 2437, 2444, 2447, 2448, 2451, 2472, 2474, 2480, 2482, 2482, 2486, 2489, 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, 2699, 2701, 2701, 2703, 2705, 2707, 2728, 2730, 2736, 2738, 2739, 2741, 2745, 2749, 2749, 2768, 2768, 2784, 2784, 2821, 2828, 2831, 2832, 2835, 2856, 2858, 2864, 2866, 2867, 2870, 2873, 2877, 2877, 2908, 2909, 2911, 2913, 2949, 2954, 2958, 2960, 2962, 2965, 2969, 2970, 2972, 2972, 2974, 2975, 2979, 2980, 2984, 2986, 2990, 2997, 2999, 3001, 3077, 3084, 3086, 3088, 3090, 3112, 3114, 3123, 3125, 3129, 3168, 3169, 3205, 3212, 3214, 3216, 3218, 3240, 3242, 3251, 3253, 3257, 3294, 3294, 3296, 3297, 3333, 3340, 3342, 3344, 3346, 3368, 3370, 3385, 3424, 3425, 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, 3805, 3840, 3840, 3904, 3911, 3913, 3946, 3976, 3979, 4096, 4129, 4131, 4135, 4137, 4138, 4176, 4181, 4256, 4293, 4304, 4342, 4352, 4441, 4447, 4514, 4520, 4601, 4608, 4614, 4616, 4678, 4680, 4680, 4682, 4685, 4688, 4694, 4696, 4696, 4698, 4701, 4704, 4742, 4744, 4744, 4746, 4749, 4752, 4782, 4784, 4784, 4786, 4789, 4792, 4798, 4800, 4800, 4802, 4805, 4808, 4814, 4816, 4822, 4824, 4846, 4848, 4878, 4880, 4880, 4882, 4885, 4888, 4894, 4896, 4934, 4936, 4954, 5024, 5108, 5121, 5740, 5743, 5750, 5761, 5786, 5792, 5866, 6016, 6067, 6176, 6263, 6272, 6312, 7680, 7835, 7840, 7929, 7936, 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, 8319, 8319, 8450, 8450, 8455, 8455, 8458, 8467, 8469, 8469, 8473, 8477, 8484, 8484, 8486, 8486, 8488, 8488, 8490, 8493, 8495, 8497, 8499, 8505, 8544, 8579, 12293, 12295, 12321, 12329, 12337, 12341, 12344, 12346, 12353, 12436, 12445, 12446, 12449, 12538, 12540, 12542, 12549, 12588, 12593, 12686, 12704, 12727, 13312, 19893, 19968, 40869, 40960, 42124, 44032, 55203, 63744, 64045, 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, 65138, 65140, 65140, 65142, 65276, 65313, 65338, 65345, 65370, 65382, 65470, 65474, 65479, 65482, 65487, 65490, 65495, 65498, 65500,]; var unicodeES3IdentifierPart = [170, 170, 181, 181, 186, 186, 192, 214, 216, 246, 248, 543, 546, 563, 592, 685, 688, 696, 699, 705, 720, 721, 736, 740, 750, 750, 768, 846, 864, 866, 890, 890, 902, 902, 904, 906, 908, 908, 910, 929, 931, 974, 976, 983, 986, 1011, 1024, 1153, 1155, 1158, 1164, 1220, 1223, 1224, 1227, 1228, 1232, 1269, 1272, 1273, 1329, 1366, 1369, 1369, 1377, 1415, 1425, 1441, 1443, 1465, 1467, 1469, 1471, 1471, 1473, 1474, 1476, 1476, 1488, 1514, 1520, 1522, 1569, 1594, 1600, 1621, 1632, 1641, 1648, 1747, 1749, 1756, 1759, 1768, 1770, 1773, 1776, 1788, 1808, 1836, 1840, 1866, 1920, 1968, 2305, 2307, 2309, 2361, 2364, 2381, 2384, 2388, 2392, 2403, 2406, 2415, 2433, 2435, 2437, 2444, 2447, 2448, 2451, 2472, 2474, 2480, 2482, 2482, 2486, 2489, 2492, 2492, 2494, 2500, 2503, 2504, 2507, 2509, 2519, 2519, 2524, 2525, 2527, 2531, 2534, 2545, 2562, 2562, 2565, 2570, 2575, 2576, 2579, 2600, 2602, 2608, 2610, 2611, 2613, 2614, 2616, 2617, 2620, 2620, 2622, 2626, 2631, 2632, 2635, 2637, 2649, 2652, 2654, 2654, 2662, 2676, 2689, 2691, 2693, 2699, 2701, 2701, 2703, 2705, 2707, 2728, 2730, 2736, 2738, 2739, 2741, 2745, 2748, 2757, 2759, 2761, 2763, 2765, 2768, 2768, 2784, 2784, 2790, 2799, 2817, 2819, 2821, 2828, 2831, 2832, 2835, 2856, 2858, 2864, 2866, 2867, 2870, 2873, 2876, 2883, 2887, 2888, 2891, 2893, 2902, 2903, 2908, 2909, 2911, 2913, 2918, 2927, 2946, 2947, 2949, 2954, 2958, 2960, 2962, 2965, 2969, 2970, 2972, 2972, 2974, 2975, 2979, 2980, 2984, 2986, 2990, 2997, 2999, 3001, 3006, 3010, 3014, 3016, 3018, 3021, 3031, 3031, 3047, 3055, 3073, 3075, 3077, 3084, 3086, 3088, 3090, 3112, 3114, 3123, 3125, 3129, 3134, 3140, 3142, 3144, 3146, 3149, 3157, 3158, 3168, 3169, 3174, 3183, 3202, 3203, 3205, 3212, 3214, 3216, 3218, 3240, 3242, 3251, 3253, 3257, 3262, 3268, 3270, 3272, 3274, 3277, 3285, 3286, 3294, 3294, 3296, 3297, 3302, 3311, 3330, 3331, 3333, 3340, 3342, 3344, 3346, 3368, 3370, 3385, 3390, 3395, 3398, 3400, 3402, 3405, 3415, 3415, 3424, 3425, 3430, 3439, 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, 3805, 3840, 3840, 3864, 3865, 3872, 3881, 3893, 3893, 3895, 3895, 3897, 3897, 3902, 3911, 3913, 3946, 3953, 3972, 3974, 3979, 3984, 3991, 3993, 4028, 4038, 4038, 4096, 4129, 4131, 4135, 4137, 4138, 4140, 4146, 4150, 4153, 4160, 4169, 4176, 4185, 4256, 4293, 4304, 4342, 4352, 4441, 4447, 4514, 4520, 4601, 4608, 4614, 4616, 4678, 4680, 4680, 4682, 4685, 4688, 4694, 4696, 4696, 4698, 4701, 4704, 4742, 4744, 4744, 4746, 4749, 4752, 4782, 4784, 4784, 4786, 4789, 4792, 4798, 4800, 4800, 4802, 4805, 4808, 4814, 4816, 4822, 4824, 4846, 4848, 4878, 4880, 4880, 4882, 4885, 4888, 4894, 4896, 4934, 4936, 4954, 4969, 4977, 5024, 5108, 5121, 5740, 5743, 5750, 5761, 5786, 5792, 5866, 6016, 6099, 6112, 6121, 6160, 6169, 6176, 6263, 6272, 6313, 7680, 7835, 7840, 7929, 7936, 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, 8255, 8256, 8319, 8319, 8400, 8412, 8417, 8417, 8450, 8450, 8455, 8455, 8458, 8467, 8469, 8469, 8473, 8477, 8484, 8484, 8486, 8486, 8488, 8488, 8490, 8493, 8495, 8497, 8499, 8505, 8544, 8579, 12293, 12295, 12321, 12335, 12337, 12341, 12344, 12346, 12353, 12436, 12441, 12442, 12445, 12446, 12449, 12542, 12549, 12588, 12593, 12686, 12704, 12727, 13312, 19893, 19968, 40869, 40960, 42124, 44032, 55203, 63744, 64045, 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, 65056, 65059, 65075, 65076, 65101, 65103, 65136, 65138, 65140, 65140, 65142, 65276, 65296, 65305, 65313, 65338, 65343, 65343, 65345, 65370, 65381, 65470, 65474, 65479, 65482, 65487, 65490, 65495, 65498, 65500,]; @@ -838,10 +847,10 @@ var ts; } return +(text.substring(start, pos)); } - function scanHexDigits(count, exact) { + function scanHexDigits(count, mustMatchCount) { var digits = 0; var value = 0; - while (digits < count || !exact) { + while (digits < count || !mustMatchCount) { var ch = text.charCodeAt(pos); if (ch >= 48 /* _0 */ && ch <= 57 /* _9 */) { value = value * 16 + ch - 48 /* _0 */; @@ -881,61 +890,7 @@ var ts; } if (ch === 92 /* backslash */) { result += text.substring(start, pos); - pos++; - if (pos >= len) { - error(ts.Diagnostics.Unexpected_end_of_text); - break; - } - ch = text.charCodeAt(pos++); - switch (ch) { - case 48 /* _0 */: - result += "\0"; - break; - case 98 /* b */: - result += "\b"; - break; - case 116 /* t */: - result += "\t"; - break; - case 110 /* n */: - result += "\n"; - break; - case 118 /* v */: - result += "\v"; - break; - case 102 /* f */: - result += "\f"; - break; - case 114 /* r */: - result += "\r"; - break; - case 39 /* singleQuote */: - result += "\'"; - break; - case 34 /* doubleQuote */: - result += "\""; - break; - case 120 /* x */: - case 117 /* u */: - var ch = scanHexDigits(ch === 120 /* x */ ? 2 : 4, true); - if (ch >= 0) { - result += String.fromCharCode(ch); - } - else { - error(ts.Diagnostics.Hexadecimal_digit_expected); - } - break; - case 13 /* carriageReturn */: - if (pos < len && text.charCodeAt(pos) === 10 /* lineFeed */) - pos++; - break; - case 10 /* lineFeed */: - case 8232 /* lineSeparator */: - case 8233 /* paragraphSeparator */: - break; - default: - result += String.fromCharCode(ch); - } + result += scanEscapeSequence(); start = pos; continue; } @@ -948,6 +903,102 @@ var ts; } return result; } + function scanTemplateAndSetTokenValue() { + var startedWithBacktick = text.charCodeAt(pos) === 96 /* backtick */; + pos++; + var start = pos; + var contents = ""; + var resultingToken; + while (true) { + if (pos >= len) { + contents += text.substring(start, pos); + error(ts.Diagnostics.Unexpected_end_of_text); + resultingToken = startedWithBacktick ? 9 /* NoSubstitutionTemplateLiteral */ : 12 /* TemplateTail */; + break; + } + var currChar = text.charCodeAt(pos); + if (currChar === 96 /* backtick */) { + contents += text.substring(start, pos); + pos++; + resultingToken = startedWithBacktick ? 9 /* NoSubstitutionTemplateLiteral */ : 12 /* TemplateTail */; + break; + } + if (currChar === 36 /* $ */ && pos + 1 < len && text.charCodeAt(pos + 1) === 123 /* openBrace */) { + contents += text.substring(start, pos); + pos += 2; + resultingToken = startedWithBacktick ? 10 /* TemplateHead */ : 11 /* TemplateMiddle */; + break; + } + if (currChar === 92 /* backslash */) { + contents += text.substring(start, pos); + contents += scanEscapeSequence(); + start = pos; + continue; + } + if (currChar === 13 /* carriageReturn */) { + contents += text.substring(start, pos); + if (pos + 1 < len && text.charCodeAt(pos + 1) === 10 /* lineFeed */) { + pos++; + } + pos++; + contents += "\n"; + start = pos; + continue; + } + pos++; + } + ts.Debug.assert(resultingToken !== undefined); + tokenValue = contents; + return resultingToken; + } + function scanEscapeSequence() { + pos++; + if (pos >= len) { + error(ts.Diagnostics.Unexpected_end_of_text); + return ""; + } + var ch = text.charCodeAt(pos++); + switch (ch) { + case 48 /* _0 */: + return "\0"; + case 98 /* b */: + return "\b"; + case 116 /* t */: + return "\t"; + case 110 /* n */: + return "\n"; + case 118 /* v */: + return "\v"; + case 102 /* f */: + return "\f"; + case 114 /* r */: + return "\r"; + case 39 /* singleQuote */: + return "\'"; + case 34 /* doubleQuote */: + return "\""; + case 120 /* x */: + case 117 /* u */: + var ch = scanHexDigits(ch === 120 /* x */ ? 2 : 4, true); + if (ch >= 0) { + return String.fromCharCode(ch); + } + else { + error(ts.Diagnostics.Hexadecimal_digit_expected); + return ""; + } + case 13 /* carriageReturn */: + if (pos < len && text.charCodeAt(pos) === 10 /* lineFeed */) { + pos++; + } + case 10 /* lineFeed */: + case 8232 /* lineSeparator */: + case 8233 /* paragraphSeparator */: + return ""; + default: + return String.fromCharCode(ch); + } + } function peekUnicodeEscape() { if (pos + 5 < len && text.charCodeAt(pos + 1) === 117 /* u */) { var start = pos; @@ -991,7 +1042,7 @@ var ts; return token = textToToken[tokenValue]; } } - return token = 59 /* Identifier */; + return token = 63 /* Identifier */; } function scan() { startPos = pos; @@ -1036,64 +1087,66 @@ var ts; case 33 /* exclamation */: if (text.charCodeAt(pos + 1) === 61 /* equals */) { if (text.charCodeAt(pos + 2) === 61 /* equals */) { - return pos += 3, token = 26 /* ExclamationEqualsEqualsToken */; + return pos += 3, token = 30 /* ExclamationEqualsEqualsToken */; } - return pos += 2, token = 24 /* ExclamationEqualsToken */; + return pos += 2, token = 28 /* ExclamationEqualsToken */; } - return pos++, token = 41 /* ExclamationToken */; + return pos++, token = 45 /* ExclamationToken */; case 34 /* doubleQuote */: case 39 /* singleQuote */: tokenValue = scanString(); return token = 7 /* StringLiteral */; + case 96 /* backtick */: + return token = scanTemplateAndSetTokenValue(); case 37 /* percent */: if (text.charCodeAt(pos + 1) === 61 /* equals */) { - return pos += 2, token = 52 /* PercentEqualsToken */; + return pos += 2, token = 56 /* PercentEqualsToken */; } - return pos++, token = 32 /* PercentToken */; + return pos++, token = 36 /* PercentToken */; case 38 /* ampersand */: if (text.charCodeAt(pos + 1) === 38 /* ampersand */) { - return pos += 2, token = 43 /* AmpersandAmpersandToken */; + return pos += 2, token = 47 /* AmpersandAmpersandToken */; } if (text.charCodeAt(pos + 1) === 61 /* equals */) { - return pos += 2, token = 56 /* AmpersandEqualsToken */; + return pos += 2, token = 60 /* AmpersandEqualsToken */; } - return pos++, token = 38 /* AmpersandToken */; + return pos++, token = 42 /* AmpersandToken */; case 40 /* openParen */: - return pos++, token = 11 /* OpenParenToken */; + return pos++, token = 15 /* OpenParenToken */; case 41 /* closeParen */: - return pos++, token = 12 /* CloseParenToken */; + return pos++, token = 16 /* CloseParenToken */; case 42 /* asterisk */: if (text.charCodeAt(pos + 1) === 61 /* equals */) { - return pos += 2, token = 50 /* AsteriskEqualsToken */; + return pos += 2, token = 54 /* AsteriskEqualsToken */; } - return pos++, token = 30 /* AsteriskToken */; + return pos++, token = 34 /* AsteriskToken */; case 43 /* plus */: if (text.charCodeAt(pos + 1) === 43 /* plus */) { - return pos += 2, token = 33 /* PlusPlusToken */; + return pos += 2, token = 37 /* PlusPlusToken */; } if (text.charCodeAt(pos + 1) === 61 /* equals */) { - return pos += 2, token = 48 /* PlusEqualsToken */; + return pos += 2, token = 52 /* PlusEqualsToken */; } - return pos++, token = 28 /* PlusToken */; + return pos++, token = 32 /* PlusToken */; case 44 /* comma */: - return pos++, token = 18 /* CommaToken */; + return pos++, token = 22 /* CommaToken */; case 45 /* minus */: if (text.charCodeAt(pos + 1) === 45 /* minus */) { - return pos += 2, token = 34 /* MinusMinusToken */; + return pos += 2, token = 38 /* MinusMinusToken */; } if (text.charCodeAt(pos + 1) === 61 /* equals */) { - return pos += 2, token = 49 /* MinusEqualsToken */; + return pos += 2, token = 53 /* MinusEqualsToken */; } - return pos++, token = 29 /* MinusToken */; + return pos++, token = 33 /* MinusToken */; case 46 /* dot */: if (isDigit(text.charCodeAt(pos + 1))) { tokenValue = "" + scanNumber(); return token = 6 /* NumericLiteral */; } if (text.charCodeAt(pos + 1) === 46 /* dot */ && text.charCodeAt(pos + 2) === 46 /* dot */) { - return pos += 3, token = 16 /* DotDotDotToken */; + return pos += 3, token = 20 /* DotDotDotToken */; } - return pos++, token = 15 /* DotToken */; + return pos++, token = 19 /* DotToken */; case 47 /* slash */: if (text.charCodeAt(pos + 1) === 47 /* slash */) { pos += 2; @@ -1142,9 +1195,9 @@ var ts; } } if (text.charCodeAt(pos + 1) === 61 /* equals */) { - return pos += 2, token = 51 /* SlashEqualsToken */; + return pos += 2, token = 55 /* SlashEqualsToken */; } - return pos++, token = 31 /* SlashToken */; + return pos++, token = 35 /* SlashToken */; case 48 /* _0 */: if (pos + 2 < len && (text.charCodeAt(pos + 1) === 88 /* X */ || text.charCodeAt(pos + 1) === 120 /* x */)) { pos += 2; @@ -1172,58 +1225,58 @@ var ts; tokenValue = "" + scanNumber(); return token = 6 /* NumericLiteral */; case 58 /* colon */: - return pos++, token = 46 /* ColonToken */; + return pos++, token = 50 /* ColonToken */; case 59 /* semicolon */: - return pos++, token = 17 /* SemicolonToken */; + return pos++, token = 21 /* SemicolonToken */; case 60 /* lessThan */: if (text.charCodeAt(pos + 1) === 60 /* lessThan */) { if (text.charCodeAt(pos + 2) === 61 /* equals */) { - return pos += 3, token = 53 /* LessThanLessThanEqualsToken */; + return pos += 3, token = 57 /* LessThanLessThanEqualsToken */; } - return pos += 2, token = 35 /* LessThanLessThanToken */; + return pos += 2, token = 39 /* LessThanLessThanToken */; } if (text.charCodeAt(pos + 1) === 61 /* equals */) { - return pos += 2, token = 21 /* LessThanEqualsToken */; + return pos += 2, token = 25 /* LessThanEqualsToken */; } - return pos++, token = 19 /* LessThanToken */; + return pos++, token = 23 /* LessThanToken */; case 61 /* equals */: if (text.charCodeAt(pos + 1) === 61 /* equals */) { if (text.charCodeAt(pos + 2) === 61 /* equals */) { - return pos += 3, token = 25 /* EqualsEqualsEqualsToken */; + return pos += 3, token = 29 /* EqualsEqualsEqualsToken */; } - return pos += 2, token = 23 /* EqualsEqualsToken */; + return pos += 2, token = 27 /* EqualsEqualsToken */; } if (text.charCodeAt(pos + 1) === 62 /* greaterThan */) { - return pos += 2, token = 27 /* EqualsGreaterThanToken */; + return pos += 2, token = 31 /* EqualsGreaterThanToken */; } - return pos++, token = 47 /* EqualsToken */; + return pos++, token = 51 /* EqualsToken */; case 62 /* greaterThan */: - return pos++, token = 20 /* GreaterThanToken */; + return pos++, token = 24 /* GreaterThanToken */; case 63 /* question */: - return pos++, token = 45 /* QuestionToken */; + return pos++, token = 49 /* QuestionToken */; case 91 /* openBracket */: - return pos++, token = 13 /* OpenBracketToken */; + return pos++, token = 17 /* OpenBracketToken */; case 93 /* closeBracket */: - return pos++, token = 14 /* CloseBracketToken */; + return pos++, token = 18 /* CloseBracketToken */; case 94 /* caret */: if (text.charCodeAt(pos + 1) === 61 /* equals */) { - return pos += 2, token = 58 /* CaretEqualsToken */; + return pos += 2, token = 62 /* CaretEqualsToken */; } - return pos++, token = 40 /* CaretToken */; + return pos++, token = 44 /* CaretToken */; case 123 /* openBrace */: - return pos++, token = 9 /* OpenBraceToken */; + return pos++, token = 13 /* OpenBraceToken */; case 124 /* bar */: if (text.charCodeAt(pos + 1) === 124 /* bar */) { - return pos += 2, token = 44 /* BarBarToken */; + return pos += 2, token = 48 /* BarBarToken */; } if (text.charCodeAt(pos + 1) === 61 /* equals */) { - return pos += 2, token = 57 /* BarEqualsToken */; + return pos += 2, token = 61 /* BarEqualsToken */; } - return pos++, token = 39 /* BarToken */; + return pos++, token = 43 /* BarToken */; case 125 /* closeBrace */: - return pos++, token = 10 /* CloseBraceToken */; + return pos++, token = 14 /* CloseBraceToken */; case 126 /* tilde */: - return pos++, token = 42 /* TildeToken */; + return pos++, token = 46 /* TildeToken */; case 92 /* backslash */: var ch = peekUnicodeEscape(); if (ch >= 0 && isIdentifierStart(ch)) { @@ -1259,27 +1312,27 @@ var ts; } } function reScanGreaterToken() { - if (token === 20 /* GreaterThanToken */) { + if (token === 24 /* GreaterThanToken */) { if (text.charCodeAt(pos) === 62 /* greaterThan */) { if (text.charCodeAt(pos + 1) === 62 /* greaterThan */) { if (text.charCodeAt(pos + 2) === 61 /* equals */) { - return pos += 3, token = 55 /* GreaterThanGreaterThanGreaterThanEqualsToken */; + return pos += 3, token = 59 /* GreaterThanGreaterThanGreaterThanEqualsToken */; } - return pos += 2, token = 37 /* GreaterThanGreaterThanGreaterThanToken */; + return pos += 2, token = 41 /* GreaterThanGreaterThanGreaterThanToken */; } if (text.charCodeAt(pos + 1) === 61 /* equals */) { - return pos += 2, token = 54 /* GreaterThanGreaterThanEqualsToken */; + return pos += 2, token = 58 /* GreaterThanGreaterThanEqualsToken */; } - return pos++, token = 36 /* GreaterThanGreaterThanToken */; + return pos++, token = 40 /* GreaterThanGreaterThanToken */; } if (text.charCodeAt(pos) === 61 /* equals */) { - return pos++, token = 22 /* GreaterThanEqualsToken */; + return pos++, token = 26 /* GreaterThanEqualsToken */; } } return token; } function reScanSlashToken() { - if (token === 31 /* SlashToken */ || token === 51 /* SlashEqualsToken */) { + if (token === 35 /* SlashToken */ || token === 55 /* SlashEqualsToken */) { var p = tokenPos + 1; var inEscape = false; var inCharacterClass = false; @@ -1318,6 +1371,11 @@ var ts; } return token; } + function reScanTemplateToken() { + ts.Debug.assert(token === 14 /* CloseBraceToken */, "'reScanTemplateToken' should only be called on a '}'"); + pos = tokenPos; + return token = scanTemplateAndSetTokenValue(); + } function tryScan(callback) { var savePos = pos; var saveStartPos = startPos; @@ -1357,10 +1415,11 @@ var ts; getTokenText: function () { return text.substring(tokenPos, pos); }, getTokenValue: function () { return tokenValue; }, hasPrecedingLineBreak: function () { return precedingLineBreak; }, - isIdentifier: function () { return token === 59 /* Identifier */ || token > ts.SyntaxKind.LastReservedWord; }, + isIdentifier: function () { return token === 63 /* Identifier */ || token > ts.SyntaxKind.LastReservedWord; }, isReservedWord: function () { return token >= ts.SyntaxKind.FirstReservedWord && token <= ts.SyntaxKind.LastReservedWord; }, reScanGreaterToken: reScanGreaterToken, reScanSlashToken: reScanSlashToken, + reScanTemplateToken: reScanTemplateToken, scan: scan, setText: setText, setTextPos: setTextPos, @@ -1381,187 +1440,194 @@ var ts; SyntaxKind[SyntaxKind["NumericLiteral"] = 6] = "NumericLiteral"; SyntaxKind[SyntaxKind["StringLiteral"] = 7] = "StringLiteral"; SyntaxKind[SyntaxKind["RegularExpressionLiteral"] = 8] = "RegularExpressionLiteral"; - SyntaxKind[SyntaxKind["OpenBraceToken"] = 9] = "OpenBraceToken"; - SyntaxKind[SyntaxKind["CloseBraceToken"] = 10] = "CloseBraceToken"; - SyntaxKind[SyntaxKind["OpenParenToken"] = 11] = "OpenParenToken"; - SyntaxKind[SyntaxKind["CloseParenToken"] = 12] = "CloseParenToken"; - SyntaxKind[SyntaxKind["OpenBracketToken"] = 13] = "OpenBracketToken"; - SyntaxKind[SyntaxKind["CloseBracketToken"] = 14] = "CloseBracketToken"; - SyntaxKind[SyntaxKind["DotToken"] = 15] = "DotToken"; - SyntaxKind[SyntaxKind["DotDotDotToken"] = 16] = "DotDotDotToken"; - SyntaxKind[SyntaxKind["SemicolonToken"] = 17] = "SemicolonToken"; - SyntaxKind[SyntaxKind["CommaToken"] = 18] = "CommaToken"; - SyntaxKind[SyntaxKind["LessThanToken"] = 19] = "LessThanToken"; - SyntaxKind[SyntaxKind["GreaterThanToken"] = 20] = "GreaterThanToken"; - SyntaxKind[SyntaxKind["LessThanEqualsToken"] = 21] = "LessThanEqualsToken"; - SyntaxKind[SyntaxKind["GreaterThanEqualsToken"] = 22] = "GreaterThanEqualsToken"; - SyntaxKind[SyntaxKind["EqualsEqualsToken"] = 23] = "EqualsEqualsToken"; - SyntaxKind[SyntaxKind["ExclamationEqualsToken"] = 24] = "ExclamationEqualsToken"; - SyntaxKind[SyntaxKind["EqualsEqualsEqualsToken"] = 25] = "EqualsEqualsEqualsToken"; - SyntaxKind[SyntaxKind["ExclamationEqualsEqualsToken"] = 26] = "ExclamationEqualsEqualsToken"; - SyntaxKind[SyntaxKind["EqualsGreaterThanToken"] = 27] = "EqualsGreaterThanToken"; - SyntaxKind[SyntaxKind["PlusToken"] = 28] = "PlusToken"; - SyntaxKind[SyntaxKind["MinusToken"] = 29] = "MinusToken"; - SyntaxKind[SyntaxKind["AsteriskToken"] = 30] = "AsteriskToken"; - SyntaxKind[SyntaxKind["SlashToken"] = 31] = "SlashToken"; - SyntaxKind[SyntaxKind["PercentToken"] = 32] = "PercentToken"; - SyntaxKind[SyntaxKind["PlusPlusToken"] = 33] = "PlusPlusToken"; - SyntaxKind[SyntaxKind["MinusMinusToken"] = 34] = "MinusMinusToken"; - SyntaxKind[SyntaxKind["LessThanLessThanToken"] = 35] = "LessThanLessThanToken"; - SyntaxKind[SyntaxKind["GreaterThanGreaterThanToken"] = 36] = "GreaterThanGreaterThanToken"; - SyntaxKind[SyntaxKind["GreaterThanGreaterThanGreaterThanToken"] = 37] = "GreaterThanGreaterThanGreaterThanToken"; - SyntaxKind[SyntaxKind["AmpersandToken"] = 38] = "AmpersandToken"; - SyntaxKind[SyntaxKind["BarToken"] = 39] = "BarToken"; - SyntaxKind[SyntaxKind["CaretToken"] = 40] = "CaretToken"; - SyntaxKind[SyntaxKind["ExclamationToken"] = 41] = "ExclamationToken"; - SyntaxKind[SyntaxKind["TildeToken"] = 42] = "TildeToken"; - SyntaxKind[SyntaxKind["AmpersandAmpersandToken"] = 43] = "AmpersandAmpersandToken"; - SyntaxKind[SyntaxKind["BarBarToken"] = 44] = "BarBarToken"; - SyntaxKind[SyntaxKind["QuestionToken"] = 45] = "QuestionToken"; - SyntaxKind[SyntaxKind["ColonToken"] = 46] = "ColonToken"; - SyntaxKind[SyntaxKind["EqualsToken"] = 47] = "EqualsToken"; - SyntaxKind[SyntaxKind["PlusEqualsToken"] = 48] = "PlusEqualsToken"; - SyntaxKind[SyntaxKind["MinusEqualsToken"] = 49] = "MinusEqualsToken"; - SyntaxKind[SyntaxKind["AsteriskEqualsToken"] = 50] = "AsteriskEqualsToken"; - SyntaxKind[SyntaxKind["SlashEqualsToken"] = 51] = "SlashEqualsToken"; - SyntaxKind[SyntaxKind["PercentEqualsToken"] = 52] = "PercentEqualsToken"; - SyntaxKind[SyntaxKind["LessThanLessThanEqualsToken"] = 53] = "LessThanLessThanEqualsToken"; - SyntaxKind[SyntaxKind["GreaterThanGreaterThanEqualsToken"] = 54] = "GreaterThanGreaterThanEqualsToken"; - SyntaxKind[SyntaxKind["GreaterThanGreaterThanGreaterThanEqualsToken"] = 55] = "GreaterThanGreaterThanGreaterThanEqualsToken"; - SyntaxKind[SyntaxKind["AmpersandEqualsToken"] = 56] = "AmpersandEqualsToken"; - SyntaxKind[SyntaxKind["BarEqualsToken"] = 57] = "BarEqualsToken"; - SyntaxKind[SyntaxKind["CaretEqualsToken"] = 58] = "CaretEqualsToken"; - SyntaxKind[SyntaxKind["Identifier"] = 59] = "Identifier"; - SyntaxKind[SyntaxKind["BreakKeyword"] = 60] = "BreakKeyword"; - SyntaxKind[SyntaxKind["CaseKeyword"] = 61] = "CaseKeyword"; - SyntaxKind[SyntaxKind["CatchKeyword"] = 62] = "CatchKeyword"; - SyntaxKind[SyntaxKind["ClassKeyword"] = 63] = "ClassKeyword"; - SyntaxKind[SyntaxKind["ConstKeyword"] = 64] = "ConstKeyword"; - SyntaxKind[SyntaxKind["ContinueKeyword"] = 65] = "ContinueKeyword"; - SyntaxKind[SyntaxKind["DebuggerKeyword"] = 66] = "DebuggerKeyword"; - SyntaxKind[SyntaxKind["DefaultKeyword"] = 67] = "DefaultKeyword"; - SyntaxKind[SyntaxKind["DeleteKeyword"] = 68] = "DeleteKeyword"; - SyntaxKind[SyntaxKind["DoKeyword"] = 69] = "DoKeyword"; - SyntaxKind[SyntaxKind["ElseKeyword"] = 70] = "ElseKeyword"; - SyntaxKind[SyntaxKind["EnumKeyword"] = 71] = "EnumKeyword"; - SyntaxKind[SyntaxKind["ExportKeyword"] = 72] = "ExportKeyword"; - SyntaxKind[SyntaxKind["ExtendsKeyword"] = 73] = "ExtendsKeyword"; - SyntaxKind[SyntaxKind["FalseKeyword"] = 74] = "FalseKeyword"; - SyntaxKind[SyntaxKind["FinallyKeyword"] = 75] = "FinallyKeyword"; - SyntaxKind[SyntaxKind["ForKeyword"] = 76] = "ForKeyword"; - SyntaxKind[SyntaxKind["FunctionKeyword"] = 77] = "FunctionKeyword"; - SyntaxKind[SyntaxKind["IfKeyword"] = 78] = "IfKeyword"; - SyntaxKind[SyntaxKind["ImportKeyword"] = 79] = "ImportKeyword"; - SyntaxKind[SyntaxKind["InKeyword"] = 80] = "InKeyword"; - SyntaxKind[SyntaxKind["InstanceOfKeyword"] = 81] = "InstanceOfKeyword"; - SyntaxKind[SyntaxKind["NewKeyword"] = 82] = "NewKeyword"; - SyntaxKind[SyntaxKind["NullKeyword"] = 83] = "NullKeyword"; - SyntaxKind[SyntaxKind["ReturnKeyword"] = 84] = "ReturnKeyword"; - SyntaxKind[SyntaxKind["SuperKeyword"] = 85] = "SuperKeyword"; - SyntaxKind[SyntaxKind["SwitchKeyword"] = 86] = "SwitchKeyword"; - SyntaxKind[SyntaxKind["ThisKeyword"] = 87] = "ThisKeyword"; - SyntaxKind[SyntaxKind["ThrowKeyword"] = 88] = "ThrowKeyword"; - SyntaxKind[SyntaxKind["TrueKeyword"] = 89] = "TrueKeyword"; - SyntaxKind[SyntaxKind["TryKeyword"] = 90] = "TryKeyword"; - SyntaxKind[SyntaxKind["TypeOfKeyword"] = 91] = "TypeOfKeyword"; - SyntaxKind[SyntaxKind["VarKeyword"] = 92] = "VarKeyword"; - SyntaxKind[SyntaxKind["VoidKeyword"] = 93] = "VoidKeyword"; - SyntaxKind[SyntaxKind["WhileKeyword"] = 94] = "WhileKeyword"; - SyntaxKind[SyntaxKind["WithKeyword"] = 95] = "WithKeyword"; - SyntaxKind[SyntaxKind["ImplementsKeyword"] = 96] = "ImplementsKeyword"; - SyntaxKind[SyntaxKind["InterfaceKeyword"] = 97] = "InterfaceKeyword"; - SyntaxKind[SyntaxKind["LetKeyword"] = 98] = "LetKeyword"; - SyntaxKind[SyntaxKind["PackageKeyword"] = 99] = "PackageKeyword"; - SyntaxKind[SyntaxKind["PrivateKeyword"] = 100] = "PrivateKeyword"; - SyntaxKind[SyntaxKind["ProtectedKeyword"] = 101] = "ProtectedKeyword"; - SyntaxKind[SyntaxKind["PublicKeyword"] = 102] = "PublicKeyword"; - SyntaxKind[SyntaxKind["StaticKeyword"] = 103] = "StaticKeyword"; - SyntaxKind[SyntaxKind["YieldKeyword"] = 104] = "YieldKeyword"; - SyntaxKind[SyntaxKind["AnyKeyword"] = 105] = "AnyKeyword"; - SyntaxKind[SyntaxKind["BooleanKeyword"] = 106] = "BooleanKeyword"; - SyntaxKind[SyntaxKind["ConstructorKeyword"] = 107] = "ConstructorKeyword"; - SyntaxKind[SyntaxKind["DeclareKeyword"] = 108] = "DeclareKeyword"; - SyntaxKind[SyntaxKind["GetKeyword"] = 109] = "GetKeyword"; - SyntaxKind[SyntaxKind["ModuleKeyword"] = 110] = "ModuleKeyword"; - SyntaxKind[SyntaxKind["RequireKeyword"] = 111] = "RequireKeyword"; - SyntaxKind[SyntaxKind["NumberKeyword"] = 112] = "NumberKeyword"; - SyntaxKind[SyntaxKind["SetKeyword"] = 113] = "SetKeyword"; - SyntaxKind[SyntaxKind["StringKeyword"] = 114] = "StringKeyword"; - SyntaxKind[SyntaxKind["TypeKeyword"] = 115] = "TypeKeyword"; - SyntaxKind[SyntaxKind["Missing"] = 116] = "Missing"; - SyntaxKind[SyntaxKind["QualifiedName"] = 117] = "QualifiedName"; - SyntaxKind[SyntaxKind["TypeParameter"] = 118] = "TypeParameter"; - SyntaxKind[SyntaxKind["Parameter"] = 119] = "Parameter"; - SyntaxKind[SyntaxKind["Property"] = 120] = "Property"; - SyntaxKind[SyntaxKind["Method"] = 121] = "Method"; - SyntaxKind[SyntaxKind["Constructor"] = 122] = "Constructor"; - SyntaxKind[SyntaxKind["GetAccessor"] = 123] = "GetAccessor"; - SyntaxKind[SyntaxKind["SetAccessor"] = 124] = "SetAccessor"; - SyntaxKind[SyntaxKind["CallSignature"] = 125] = "CallSignature"; - SyntaxKind[SyntaxKind["ConstructSignature"] = 126] = "ConstructSignature"; - SyntaxKind[SyntaxKind["IndexSignature"] = 127] = "IndexSignature"; - SyntaxKind[SyntaxKind["TypeReference"] = 128] = "TypeReference"; - SyntaxKind[SyntaxKind["TypeQuery"] = 129] = "TypeQuery"; - SyntaxKind[SyntaxKind["TypeLiteral"] = 130] = "TypeLiteral"; - SyntaxKind[SyntaxKind["ArrayType"] = 131] = "ArrayType"; - SyntaxKind[SyntaxKind["TupleType"] = 132] = "TupleType"; - SyntaxKind[SyntaxKind["UnionType"] = 133] = "UnionType"; - SyntaxKind[SyntaxKind["ParenType"] = 134] = "ParenType"; - SyntaxKind[SyntaxKind["ArrayLiteral"] = 135] = "ArrayLiteral"; - SyntaxKind[SyntaxKind["ObjectLiteral"] = 136] = "ObjectLiteral"; - SyntaxKind[SyntaxKind["PropertyAssignment"] = 137] = "PropertyAssignment"; - SyntaxKind[SyntaxKind["PropertyAccess"] = 138] = "PropertyAccess"; - SyntaxKind[SyntaxKind["IndexedAccess"] = 139] = "IndexedAccess"; - SyntaxKind[SyntaxKind["CallExpression"] = 140] = "CallExpression"; - SyntaxKind[SyntaxKind["NewExpression"] = 141] = "NewExpression"; - SyntaxKind[SyntaxKind["TypeAssertion"] = 142] = "TypeAssertion"; - SyntaxKind[SyntaxKind["ParenExpression"] = 143] = "ParenExpression"; - SyntaxKind[SyntaxKind["FunctionExpression"] = 144] = "FunctionExpression"; - SyntaxKind[SyntaxKind["ArrowFunction"] = 145] = "ArrowFunction"; - SyntaxKind[SyntaxKind["PrefixOperator"] = 146] = "PrefixOperator"; - SyntaxKind[SyntaxKind["PostfixOperator"] = 147] = "PostfixOperator"; - SyntaxKind[SyntaxKind["BinaryExpression"] = 148] = "BinaryExpression"; - SyntaxKind[SyntaxKind["ConditionalExpression"] = 149] = "ConditionalExpression"; - SyntaxKind[SyntaxKind["OmittedExpression"] = 150] = "OmittedExpression"; - SyntaxKind[SyntaxKind["Block"] = 151] = "Block"; - SyntaxKind[SyntaxKind["VariableStatement"] = 152] = "VariableStatement"; - SyntaxKind[SyntaxKind["EmptyStatement"] = 153] = "EmptyStatement"; - SyntaxKind[SyntaxKind["ExpressionStatement"] = 154] = "ExpressionStatement"; - SyntaxKind[SyntaxKind["IfStatement"] = 155] = "IfStatement"; - SyntaxKind[SyntaxKind["DoStatement"] = 156] = "DoStatement"; - SyntaxKind[SyntaxKind["WhileStatement"] = 157] = "WhileStatement"; - SyntaxKind[SyntaxKind["ForStatement"] = 158] = "ForStatement"; - SyntaxKind[SyntaxKind["ForInStatement"] = 159] = "ForInStatement"; - SyntaxKind[SyntaxKind["ContinueStatement"] = 160] = "ContinueStatement"; - SyntaxKind[SyntaxKind["BreakStatement"] = 161] = "BreakStatement"; - SyntaxKind[SyntaxKind["ReturnStatement"] = 162] = "ReturnStatement"; - SyntaxKind[SyntaxKind["WithStatement"] = 163] = "WithStatement"; - SyntaxKind[SyntaxKind["SwitchStatement"] = 164] = "SwitchStatement"; - SyntaxKind[SyntaxKind["CaseClause"] = 165] = "CaseClause"; - SyntaxKind[SyntaxKind["DefaultClause"] = 166] = "DefaultClause"; - SyntaxKind[SyntaxKind["LabeledStatement"] = 167] = "LabeledStatement"; - SyntaxKind[SyntaxKind["ThrowStatement"] = 168] = "ThrowStatement"; - SyntaxKind[SyntaxKind["TryStatement"] = 169] = "TryStatement"; - SyntaxKind[SyntaxKind["TryBlock"] = 170] = "TryBlock"; - SyntaxKind[SyntaxKind["CatchBlock"] = 171] = "CatchBlock"; - SyntaxKind[SyntaxKind["FinallyBlock"] = 172] = "FinallyBlock"; - SyntaxKind[SyntaxKind["DebuggerStatement"] = 173] = "DebuggerStatement"; - SyntaxKind[SyntaxKind["VariableDeclaration"] = 174] = "VariableDeclaration"; - SyntaxKind[SyntaxKind["FunctionDeclaration"] = 175] = "FunctionDeclaration"; - SyntaxKind[SyntaxKind["FunctionBlock"] = 176] = "FunctionBlock"; - SyntaxKind[SyntaxKind["ClassDeclaration"] = 177] = "ClassDeclaration"; - SyntaxKind[SyntaxKind["InterfaceDeclaration"] = 178] = "InterfaceDeclaration"; - SyntaxKind[SyntaxKind["TypeAliasDeclaration"] = 179] = "TypeAliasDeclaration"; - SyntaxKind[SyntaxKind["EnumDeclaration"] = 180] = "EnumDeclaration"; - SyntaxKind[SyntaxKind["ModuleDeclaration"] = 181] = "ModuleDeclaration"; - SyntaxKind[SyntaxKind["ModuleBlock"] = 182] = "ModuleBlock"; - SyntaxKind[SyntaxKind["ImportDeclaration"] = 183] = "ImportDeclaration"; - SyntaxKind[SyntaxKind["ExportAssignment"] = 184] = "ExportAssignment"; - SyntaxKind[SyntaxKind["EnumMember"] = 185] = "EnumMember"; - SyntaxKind[SyntaxKind["SourceFile"] = 186] = "SourceFile"; - SyntaxKind[SyntaxKind["Program"] = 187] = "Program"; - SyntaxKind[SyntaxKind["SyntaxList"] = 188] = "SyntaxList"; - SyntaxKind[SyntaxKind["Count"] = 189] = "Count"; + SyntaxKind[SyntaxKind["NoSubstitutionTemplateLiteral"] = 9] = "NoSubstitutionTemplateLiteral"; + SyntaxKind[SyntaxKind["TemplateHead"] = 10] = "TemplateHead"; + SyntaxKind[SyntaxKind["TemplateMiddle"] = 11] = "TemplateMiddle"; + SyntaxKind[SyntaxKind["TemplateTail"] = 12] = "TemplateTail"; + SyntaxKind[SyntaxKind["OpenBraceToken"] = 13] = "OpenBraceToken"; + SyntaxKind[SyntaxKind["CloseBraceToken"] = 14] = "CloseBraceToken"; + SyntaxKind[SyntaxKind["OpenParenToken"] = 15] = "OpenParenToken"; + SyntaxKind[SyntaxKind["CloseParenToken"] = 16] = "CloseParenToken"; + SyntaxKind[SyntaxKind["OpenBracketToken"] = 17] = "OpenBracketToken"; + SyntaxKind[SyntaxKind["CloseBracketToken"] = 18] = "CloseBracketToken"; + SyntaxKind[SyntaxKind["DotToken"] = 19] = "DotToken"; + SyntaxKind[SyntaxKind["DotDotDotToken"] = 20] = "DotDotDotToken"; + SyntaxKind[SyntaxKind["SemicolonToken"] = 21] = "SemicolonToken"; + SyntaxKind[SyntaxKind["CommaToken"] = 22] = "CommaToken"; + SyntaxKind[SyntaxKind["LessThanToken"] = 23] = "LessThanToken"; + SyntaxKind[SyntaxKind["GreaterThanToken"] = 24] = "GreaterThanToken"; + SyntaxKind[SyntaxKind["LessThanEqualsToken"] = 25] = "LessThanEqualsToken"; + SyntaxKind[SyntaxKind["GreaterThanEqualsToken"] = 26] = "GreaterThanEqualsToken"; + SyntaxKind[SyntaxKind["EqualsEqualsToken"] = 27] = "EqualsEqualsToken"; + SyntaxKind[SyntaxKind["ExclamationEqualsToken"] = 28] = "ExclamationEqualsToken"; + SyntaxKind[SyntaxKind["EqualsEqualsEqualsToken"] = 29] = "EqualsEqualsEqualsToken"; + SyntaxKind[SyntaxKind["ExclamationEqualsEqualsToken"] = 30] = "ExclamationEqualsEqualsToken"; + SyntaxKind[SyntaxKind["EqualsGreaterThanToken"] = 31] = "EqualsGreaterThanToken"; + SyntaxKind[SyntaxKind["PlusToken"] = 32] = "PlusToken"; + SyntaxKind[SyntaxKind["MinusToken"] = 33] = "MinusToken"; + SyntaxKind[SyntaxKind["AsteriskToken"] = 34] = "AsteriskToken"; + SyntaxKind[SyntaxKind["SlashToken"] = 35] = "SlashToken"; + SyntaxKind[SyntaxKind["PercentToken"] = 36] = "PercentToken"; + SyntaxKind[SyntaxKind["PlusPlusToken"] = 37] = "PlusPlusToken"; + SyntaxKind[SyntaxKind["MinusMinusToken"] = 38] = "MinusMinusToken"; + SyntaxKind[SyntaxKind["LessThanLessThanToken"] = 39] = "LessThanLessThanToken"; + SyntaxKind[SyntaxKind["GreaterThanGreaterThanToken"] = 40] = "GreaterThanGreaterThanToken"; + SyntaxKind[SyntaxKind["GreaterThanGreaterThanGreaterThanToken"] = 41] = "GreaterThanGreaterThanGreaterThanToken"; + SyntaxKind[SyntaxKind["AmpersandToken"] = 42] = "AmpersandToken"; + SyntaxKind[SyntaxKind["BarToken"] = 43] = "BarToken"; + SyntaxKind[SyntaxKind["CaretToken"] = 44] = "CaretToken"; + SyntaxKind[SyntaxKind["ExclamationToken"] = 45] = "ExclamationToken"; + SyntaxKind[SyntaxKind["TildeToken"] = 46] = "TildeToken"; + SyntaxKind[SyntaxKind["AmpersandAmpersandToken"] = 47] = "AmpersandAmpersandToken"; + SyntaxKind[SyntaxKind["BarBarToken"] = 48] = "BarBarToken"; + SyntaxKind[SyntaxKind["QuestionToken"] = 49] = "QuestionToken"; + SyntaxKind[SyntaxKind["ColonToken"] = 50] = "ColonToken"; + SyntaxKind[SyntaxKind["EqualsToken"] = 51] = "EqualsToken"; + SyntaxKind[SyntaxKind["PlusEqualsToken"] = 52] = "PlusEqualsToken"; + SyntaxKind[SyntaxKind["MinusEqualsToken"] = 53] = "MinusEqualsToken"; + SyntaxKind[SyntaxKind["AsteriskEqualsToken"] = 54] = "AsteriskEqualsToken"; + SyntaxKind[SyntaxKind["SlashEqualsToken"] = 55] = "SlashEqualsToken"; + SyntaxKind[SyntaxKind["PercentEqualsToken"] = 56] = "PercentEqualsToken"; + SyntaxKind[SyntaxKind["LessThanLessThanEqualsToken"] = 57] = "LessThanLessThanEqualsToken"; + SyntaxKind[SyntaxKind["GreaterThanGreaterThanEqualsToken"] = 58] = "GreaterThanGreaterThanEqualsToken"; + SyntaxKind[SyntaxKind["GreaterThanGreaterThanGreaterThanEqualsToken"] = 59] = "GreaterThanGreaterThanGreaterThanEqualsToken"; + SyntaxKind[SyntaxKind["AmpersandEqualsToken"] = 60] = "AmpersandEqualsToken"; + SyntaxKind[SyntaxKind["BarEqualsToken"] = 61] = "BarEqualsToken"; + SyntaxKind[SyntaxKind["CaretEqualsToken"] = 62] = "CaretEqualsToken"; + SyntaxKind[SyntaxKind["Identifier"] = 63] = "Identifier"; + SyntaxKind[SyntaxKind["BreakKeyword"] = 64] = "BreakKeyword"; + SyntaxKind[SyntaxKind["CaseKeyword"] = 65] = "CaseKeyword"; + SyntaxKind[SyntaxKind["CatchKeyword"] = 66] = "CatchKeyword"; + SyntaxKind[SyntaxKind["ClassKeyword"] = 67] = "ClassKeyword"; + SyntaxKind[SyntaxKind["ConstKeyword"] = 68] = "ConstKeyword"; + SyntaxKind[SyntaxKind["ContinueKeyword"] = 69] = "ContinueKeyword"; + SyntaxKind[SyntaxKind["DebuggerKeyword"] = 70] = "DebuggerKeyword"; + SyntaxKind[SyntaxKind["DefaultKeyword"] = 71] = "DefaultKeyword"; + SyntaxKind[SyntaxKind["DeleteKeyword"] = 72] = "DeleteKeyword"; + SyntaxKind[SyntaxKind["DoKeyword"] = 73] = "DoKeyword"; + SyntaxKind[SyntaxKind["ElseKeyword"] = 74] = "ElseKeyword"; + SyntaxKind[SyntaxKind["EnumKeyword"] = 75] = "EnumKeyword"; + SyntaxKind[SyntaxKind["ExportKeyword"] = 76] = "ExportKeyword"; + SyntaxKind[SyntaxKind["ExtendsKeyword"] = 77] = "ExtendsKeyword"; + SyntaxKind[SyntaxKind["FalseKeyword"] = 78] = "FalseKeyword"; + SyntaxKind[SyntaxKind["FinallyKeyword"] = 79] = "FinallyKeyword"; + SyntaxKind[SyntaxKind["ForKeyword"] = 80] = "ForKeyword"; + SyntaxKind[SyntaxKind["FunctionKeyword"] = 81] = "FunctionKeyword"; + SyntaxKind[SyntaxKind["IfKeyword"] = 82] = "IfKeyword"; + SyntaxKind[SyntaxKind["ImportKeyword"] = 83] = "ImportKeyword"; + SyntaxKind[SyntaxKind["InKeyword"] = 84] = "InKeyword"; + SyntaxKind[SyntaxKind["InstanceOfKeyword"] = 85] = "InstanceOfKeyword"; + SyntaxKind[SyntaxKind["NewKeyword"] = 86] = "NewKeyword"; + SyntaxKind[SyntaxKind["NullKeyword"] = 87] = "NullKeyword"; + SyntaxKind[SyntaxKind["ReturnKeyword"] = 88] = "ReturnKeyword"; + SyntaxKind[SyntaxKind["SuperKeyword"] = 89] = "SuperKeyword"; + SyntaxKind[SyntaxKind["SwitchKeyword"] = 90] = "SwitchKeyword"; + SyntaxKind[SyntaxKind["ThisKeyword"] = 91] = "ThisKeyword"; + SyntaxKind[SyntaxKind["ThrowKeyword"] = 92] = "ThrowKeyword"; + SyntaxKind[SyntaxKind["TrueKeyword"] = 93] = "TrueKeyword"; + SyntaxKind[SyntaxKind["TryKeyword"] = 94] = "TryKeyword"; + SyntaxKind[SyntaxKind["TypeOfKeyword"] = 95] = "TypeOfKeyword"; + SyntaxKind[SyntaxKind["VarKeyword"] = 96] = "VarKeyword"; + SyntaxKind[SyntaxKind["VoidKeyword"] = 97] = "VoidKeyword"; + SyntaxKind[SyntaxKind["WhileKeyword"] = 98] = "WhileKeyword"; + SyntaxKind[SyntaxKind["WithKeyword"] = 99] = "WithKeyword"; + SyntaxKind[SyntaxKind["ImplementsKeyword"] = 100] = "ImplementsKeyword"; + SyntaxKind[SyntaxKind["InterfaceKeyword"] = 101] = "InterfaceKeyword"; + SyntaxKind[SyntaxKind["LetKeyword"] = 102] = "LetKeyword"; + SyntaxKind[SyntaxKind["PackageKeyword"] = 103] = "PackageKeyword"; + SyntaxKind[SyntaxKind["PrivateKeyword"] = 104] = "PrivateKeyword"; + SyntaxKind[SyntaxKind["ProtectedKeyword"] = 105] = "ProtectedKeyword"; + SyntaxKind[SyntaxKind["PublicKeyword"] = 106] = "PublicKeyword"; + SyntaxKind[SyntaxKind["StaticKeyword"] = 107] = "StaticKeyword"; + SyntaxKind[SyntaxKind["YieldKeyword"] = 108] = "YieldKeyword"; + SyntaxKind[SyntaxKind["AnyKeyword"] = 109] = "AnyKeyword"; + SyntaxKind[SyntaxKind["BooleanKeyword"] = 110] = "BooleanKeyword"; + SyntaxKind[SyntaxKind["ConstructorKeyword"] = 111] = "ConstructorKeyword"; + SyntaxKind[SyntaxKind["DeclareKeyword"] = 112] = "DeclareKeyword"; + SyntaxKind[SyntaxKind["GetKeyword"] = 113] = "GetKeyword"; + SyntaxKind[SyntaxKind["ModuleKeyword"] = 114] = "ModuleKeyword"; + SyntaxKind[SyntaxKind["RequireKeyword"] = 115] = "RequireKeyword"; + SyntaxKind[SyntaxKind["NumberKeyword"] = 116] = "NumberKeyword"; + SyntaxKind[SyntaxKind["SetKeyword"] = 117] = "SetKeyword"; + SyntaxKind[SyntaxKind["StringKeyword"] = 118] = "StringKeyword"; + SyntaxKind[SyntaxKind["TypeKeyword"] = 119] = "TypeKeyword"; + SyntaxKind[SyntaxKind["Missing"] = 120] = "Missing"; + SyntaxKind[SyntaxKind["QualifiedName"] = 121] = "QualifiedName"; + SyntaxKind[SyntaxKind["TypeParameter"] = 122] = "TypeParameter"; + SyntaxKind[SyntaxKind["Parameter"] = 123] = "Parameter"; + SyntaxKind[SyntaxKind["Property"] = 124] = "Property"; + SyntaxKind[SyntaxKind["Method"] = 125] = "Method"; + SyntaxKind[SyntaxKind["Constructor"] = 126] = "Constructor"; + SyntaxKind[SyntaxKind["GetAccessor"] = 127] = "GetAccessor"; + SyntaxKind[SyntaxKind["SetAccessor"] = 128] = "SetAccessor"; + SyntaxKind[SyntaxKind["CallSignature"] = 129] = "CallSignature"; + SyntaxKind[SyntaxKind["ConstructSignature"] = 130] = "ConstructSignature"; + SyntaxKind[SyntaxKind["IndexSignature"] = 131] = "IndexSignature"; + SyntaxKind[SyntaxKind["TypeReference"] = 132] = "TypeReference"; + SyntaxKind[SyntaxKind["TypeQuery"] = 133] = "TypeQuery"; + SyntaxKind[SyntaxKind["TypeLiteral"] = 134] = "TypeLiteral"; + SyntaxKind[SyntaxKind["ArrayType"] = 135] = "ArrayType"; + SyntaxKind[SyntaxKind["TupleType"] = 136] = "TupleType"; + SyntaxKind[SyntaxKind["UnionType"] = 137] = "UnionType"; + SyntaxKind[SyntaxKind["ParenType"] = 138] = "ParenType"; + SyntaxKind[SyntaxKind["ArrayLiteral"] = 139] = "ArrayLiteral"; + SyntaxKind[SyntaxKind["ObjectLiteral"] = 140] = "ObjectLiteral"; + SyntaxKind[SyntaxKind["PropertyAssignment"] = 141] = "PropertyAssignment"; + SyntaxKind[SyntaxKind["PropertyAccess"] = 142] = "PropertyAccess"; + SyntaxKind[SyntaxKind["IndexedAccess"] = 143] = "IndexedAccess"; + SyntaxKind[SyntaxKind["CallExpression"] = 144] = "CallExpression"; + SyntaxKind[SyntaxKind["NewExpression"] = 145] = "NewExpression"; + SyntaxKind[SyntaxKind["TaggedTemplateExpression"] = 146] = "TaggedTemplateExpression"; + SyntaxKind[SyntaxKind["TypeAssertion"] = 147] = "TypeAssertion"; + SyntaxKind[SyntaxKind["ParenExpression"] = 148] = "ParenExpression"; + SyntaxKind[SyntaxKind["FunctionExpression"] = 149] = "FunctionExpression"; + SyntaxKind[SyntaxKind["ArrowFunction"] = 150] = "ArrowFunction"; + SyntaxKind[SyntaxKind["PrefixOperator"] = 151] = "PrefixOperator"; + SyntaxKind[SyntaxKind["PostfixOperator"] = 152] = "PostfixOperator"; + SyntaxKind[SyntaxKind["BinaryExpression"] = 153] = "BinaryExpression"; + SyntaxKind[SyntaxKind["ConditionalExpression"] = 154] = "ConditionalExpression"; + SyntaxKind[SyntaxKind["TemplateExpression"] = 155] = "TemplateExpression"; + SyntaxKind[SyntaxKind["TemplateSpan"] = 156] = "TemplateSpan"; + SyntaxKind[SyntaxKind["OmittedExpression"] = 157] = "OmittedExpression"; + SyntaxKind[SyntaxKind["Block"] = 158] = "Block"; + SyntaxKind[SyntaxKind["VariableStatement"] = 159] = "VariableStatement"; + SyntaxKind[SyntaxKind["EmptyStatement"] = 160] = "EmptyStatement"; + SyntaxKind[SyntaxKind["ExpressionStatement"] = 161] = "ExpressionStatement"; + SyntaxKind[SyntaxKind["IfStatement"] = 162] = "IfStatement"; + SyntaxKind[SyntaxKind["DoStatement"] = 163] = "DoStatement"; + SyntaxKind[SyntaxKind["WhileStatement"] = 164] = "WhileStatement"; + SyntaxKind[SyntaxKind["ForStatement"] = 165] = "ForStatement"; + SyntaxKind[SyntaxKind["ForInStatement"] = 166] = "ForInStatement"; + SyntaxKind[SyntaxKind["ContinueStatement"] = 167] = "ContinueStatement"; + SyntaxKind[SyntaxKind["BreakStatement"] = 168] = "BreakStatement"; + SyntaxKind[SyntaxKind["ReturnStatement"] = 169] = "ReturnStatement"; + SyntaxKind[SyntaxKind["WithStatement"] = 170] = "WithStatement"; + SyntaxKind[SyntaxKind["SwitchStatement"] = 171] = "SwitchStatement"; + SyntaxKind[SyntaxKind["CaseClause"] = 172] = "CaseClause"; + SyntaxKind[SyntaxKind["DefaultClause"] = 173] = "DefaultClause"; + SyntaxKind[SyntaxKind["LabeledStatement"] = 174] = "LabeledStatement"; + SyntaxKind[SyntaxKind["ThrowStatement"] = 175] = "ThrowStatement"; + SyntaxKind[SyntaxKind["TryStatement"] = 176] = "TryStatement"; + SyntaxKind[SyntaxKind["TryBlock"] = 177] = "TryBlock"; + SyntaxKind[SyntaxKind["CatchBlock"] = 178] = "CatchBlock"; + SyntaxKind[SyntaxKind["FinallyBlock"] = 179] = "FinallyBlock"; + SyntaxKind[SyntaxKind["DebuggerStatement"] = 180] = "DebuggerStatement"; + SyntaxKind[SyntaxKind["VariableDeclaration"] = 181] = "VariableDeclaration"; + SyntaxKind[SyntaxKind["FunctionDeclaration"] = 182] = "FunctionDeclaration"; + SyntaxKind[SyntaxKind["FunctionBlock"] = 183] = "FunctionBlock"; + SyntaxKind[SyntaxKind["ClassDeclaration"] = 184] = "ClassDeclaration"; + SyntaxKind[SyntaxKind["InterfaceDeclaration"] = 185] = "InterfaceDeclaration"; + SyntaxKind[SyntaxKind["TypeAliasDeclaration"] = 186] = "TypeAliasDeclaration"; + SyntaxKind[SyntaxKind["EnumDeclaration"] = 187] = "EnumDeclaration"; + SyntaxKind[SyntaxKind["ModuleDeclaration"] = 188] = "ModuleDeclaration"; + SyntaxKind[SyntaxKind["ModuleBlock"] = 189] = "ModuleBlock"; + SyntaxKind[SyntaxKind["ImportDeclaration"] = 190] = "ImportDeclaration"; + SyntaxKind[SyntaxKind["ExportAssignment"] = 191] = "ExportAssignment"; + SyntaxKind[SyntaxKind["EnumMember"] = 192] = "EnumMember"; + SyntaxKind[SyntaxKind["SourceFile"] = 193] = "SourceFile"; + SyntaxKind[SyntaxKind["Program"] = 194] = "Program"; + SyntaxKind[SyntaxKind["SyntaxList"] = 195] = "SyntaxList"; + SyntaxKind[SyntaxKind["Count"] = 196] = "Count"; SyntaxKind[SyntaxKind["FirstAssignment"] = SyntaxKind.EqualsToken] = "FirstAssignment"; SyntaxKind[SyntaxKind["LastAssignment"] = SyntaxKind.CaretEqualsToken] = "LastAssignment"; SyntaxKind[SyntaxKind["FirstReservedWord"] = SyntaxKind.BreakKeyword] = "FirstReservedWord"; @@ -1578,6 +1644,10 @@ var ts; SyntaxKind[SyntaxKind["LastToken"] = SyntaxKind.TypeKeyword] = "LastToken"; SyntaxKind[SyntaxKind["FirstTriviaToken"] = SyntaxKind.SingleLineCommentTrivia] = "FirstTriviaToken"; SyntaxKind[SyntaxKind["LastTriviaToken"] = SyntaxKind.WhitespaceTrivia] = "LastTriviaToken"; + SyntaxKind[SyntaxKind["FirstLiteralToken"] = SyntaxKind.NumericLiteral] = "FirstLiteralToken"; + SyntaxKind[SyntaxKind["LastLiteralToken"] = SyntaxKind.NoSubstitutionTemplateLiteral] = "LastLiteralToken"; + SyntaxKind[SyntaxKind["FirstTemplateToken"] = SyntaxKind.NoSubstitutionTemplateLiteral] = "FirstTemplateToken"; + SyntaxKind[SyntaxKind["LastTemplateToken"] = SyntaxKind.TemplateTail] = "LastTemplateToken"; })(ts.SyntaxKind || (ts.SyntaxKind = {})); var SyntaxKind = ts.SyntaxKind; (function (NodeFlags) { @@ -1639,29 +1709,31 @@ var ts; SymbolFlags[SymbolFlags["Function"] = 0x00000010] = "Function"; SymbolFlags[SymbolFlags["Class"] = 0x00000020] = "Class"; SymbolFlags[SymbolFlags["Interface"] = 0x00000040] = "Interface"; - SymbolFlags[SymbolFlags["Enum"] = 0x00000080] = "Enum"; - SymbolFlags[SymbolFlags["ValueModule"] = 0x00000100] = "ValueModule"; - SymbolFlags[SymbolFlags["NamespaceModule"] = 0x00000200] = "NamespaceModule"; - SymbolFlags[SymbolFlags["TypeLiteral"] = 0x00000400] = "TypeLiteral"; - SymbolFlags[SymbolFlags["ObjectLiteral"] = 0x00000800] = "ObjectLiteral"; - SymbolFlags[SymbolFlags["Method"] = 0x00001000] = "Method"; - SymbolFlags[SymbolFlags["Constructor"] = 0x00002000] = "Constructor"; - SymbolFlags[SymbolFlags["GetAccessor"] = 0x00004000] = "GetAccessor"; - SymbolFlags[SymbolFlags["SetAccessor"] = 0x00008000] = "SetAccessor"; - SymbolFlags[SymbolFlags["CallSignature"] = 0x00010000] = "CallSignature"; - SymbolFlags[SymbolFlags["ConstructSignature"] = 0x00020000] = "ConstructSignature"; - SymbolFlags[SymbolFlags["IndexSignature"] = 0x00040000] = "IndexSignature"; - SymbolFlags[SymbolFlags["TypeParameter"] = 0x00080000] = "TypeParameter"; - SymbolFlags[SymbolFlags["TypeAlias"] = 0x00100000] = "TypeAlias"; - SymbolFlags[SymbolFlags["ExportValue"] = 0x00200000] = "ExportValue"; - SymbolFlags[SymbolFlags["ExportType"] = 0x00400000] = "ExportType"; - SymbolFlags[SymbolFlags["ExportNamespace"] = 0x00800000] = "ExportNamespace"; - SymbolFlags[SymbolFlags["Import"] = 0x01000000] = "Import"; - SymbolFlags[SymbolFlags["Instantiated"] = 0x02000000] = "Instantiated"; - SymbolFlags[SymbolFlags["Merged"] = 0x04000000] = "Merged"; - SymbolFlags[SymbolFlags["Transient"] = 0x08000000] = "Transient"; - SymbolFlags[SymbolFlags["Prototype"] = 0x10000000] = "Prototype"; - SymbolFlags[SymbolFlags["UnionProperty"] = 0x20000000] = "UnionProperty"; + SymbolFlags[SymbolFlags["ConstEnum"] = 0x00000080] = "ConstEnum"; + SymbolFlags[SymbolFlags["RegularEnum"] = 0x00000100] = "RegularEnum"; + SymbolFlags[SymbolFlags["ValueModule"] = 0x00000200] = "ValueModule"; + SymbolFlags[SymbolFlags["NamespaceModule"] = 0x00000400] = "NamespaceModule"; + SymbolFlags[SymbolFlags["TypeLiteral"] = 0x00000800] = "TypeLiteral"; + SymbolFlags[SymbolFlags["ObjectLiteral"] = 0x00001000] = "ObjectLiteral"; + SymbolFlags[SymbolFlags["Method"] = 0x00002000] = "Method"; + SymbolFlags[SymbolFlags["Constructor"] = 0x00004000] = "Constructor"; + SymbolFlags[SymbolFlags["GetAccessor"] = 0x00008000] = "GetAccessor"; + SymbolFlags[SymbolFlags["SetAccessor"] = 0x00010000] = "SetAccessor"; + SymbolFlags[SymbolFlags["CallSignature"] = 0x00020000] = "CallSignature"; + SymbolFlags[SymbolFlags["ConstructSignature"] = 0x00040000] = "ConstructSignature"; + SymbolFlags[SymbolFlags["IndexSignature"] = 0x00080000] = "IndexSignature"; + SymbolFlags[SymbolFlags["TypeParameter"] = 0x00100000] = "TypeParameter"; + SymbolFlags[SymbolFlags["TypeAlias"] = 0x00200000] = "TypeAlias"; + SymbolFlags[SymbolFlags["ExportValue"] = 0x00400000] = "ExportValue"; + SymbolFlags[SymbolFlags["ExportType"] = 0x00800000] = "ExportType"; + SymbolFlags[SymbolFlags["ExportNamespace"] = 0x01000000] = "ExportNamespace"; + SymbolFlags[SymbolFlags["Import"] = 0x02000000] = "Import"; + SymbolFlags[SymbolFlags["Instantiated"] = 0x04000000] = "Instantiated"; + SymbolFlags[SymbolFlags["Merged"] = 0x08000000] = "Merged"; + SymbolFlags[SymbolFlags["Transient"] = 0x10000000] = "Transient"; + SymbolFlags[SymbolFlags["Prototype"] = 0x20000000] = "Prototype"; + SymbolFlags[SymbolFlags["UnionProperty"] = 0x40000000] = "UnionProperty"; + SymbolFlags[SymbolFlags["Enum"] = SymbolFlags.RegularEnum | SymbolFlags.ConstEnum] = "Enum"; SymbolFlags[SymbolFlags["Variable"] = SymbolFlags.FunctionScopedVariable | SymbolFlags.BlockScopedVariable] = "Variable"; SymbolFlags[SymbolFlags["Value"] = SymbolFlags.Variable | SymbolFlags.Property | SymbolFlags.EnumMember | SymbolFlags.Function | SymbolFlags.Class | SymbolFlags.Enum | SymbolFlags.ValueModule | SymbolFlags.Method | SymbolFlags.GetAccessor | SymbolFlags.SetAccessor] = "Value"; SymbolFlags[SymbolFlags["Type"] = SymbolFlags.Class | SymbolFlags.Interface | SymbolFlags.Enum | SymbolFlags.TypeLiteral | SymbolFlags.ObjectLiteral | SymbolFlags.TypeParameter | SymbolFlags.TypeAlias] = "Type"; @@ -1677,8 +1749,9 @@ var ts; SymbolFlags[SymbolFlags["FunctionExcludes"] = SymbolFlags.Value & ~(SymbolFlags.Function | SymbolFlags.ValueModule)] = "FunctionExcludes"; SymbolFlags[SymbolFlags["ClassExcludes"] = (SymbolFlags.Value | SymbolFlags.Type) & ~SymbolFlags.ValueModule] = "ClassExcludes"; SymbolFlags[SymbolFlags["InterfaceExcludes"] = SymbolFlags.Type & ~SymbolFlags.Interface] = "InterfaceExcludes"; - SymbolFlags[SymbolFlags["EnumExcludes"] = (SymbolFlags.Value | SymbolFlags.Type) & ~(SymbolFlags.Enum | SymbolFlags.ValueModule)] = "EnumExcludes"; - SymbolFlags[SymbolFlags["ValueModuleExcludes"] = SymbolFlags.Value & ~(SymbolFlags.Function | SymbolFlags.Class | SymbolFlags.Enum | SymbolFlags.ValueModule)] = "ValueModuleExcludes"; + SymbolFlags[SymbolFlags["RegularEnumExcludes"] = (SymbolFlags.Value | SymbolFlags.Type) & ~(SymbolFlags.RegularEnum | SymbolFlags.ValueModule)] = "RegularEnumExcludes"; + SymbolFlags[SymbolFlags["ConstEnumExcludes"] = (SymbolFlags.Value | SymbolFlags.Type) & ~SymbolFlags.ConstEnum] = "ConstEnumExcludes"; + SymbolFlags[SymbolFlags["ValueModuleExcludes"] = SymbolFlags.Value & ~(SymbolFlags.Function | SymbolFlags.Class | SymbolFlags.RegularEnum | SymbolFlags.ValueModule)] = "ValueModuleExcludes"; SymbolFlags[SymbolFlags["NamespaceModuleExcludes"] = 0] = "NamespaceModuleExcludes"; SymbolFlags[SymbolFlags["MethodExcludes"] = SymbolFlags.Value & ~SymbolFlags.Method] = "MethodExcludes"; SymbolFlags[SymbolFlags["GetAccessorExcludes"] = SymbolFlags.Value & ~SymbolFlags.SetAccessor] = "GetAccessorExcludes"; @@ -1855,6 +1928,7 @@ var ts; CharacterCodes[CharacterCodes["asterisk"] = 0x2A] = "asterisk"; CharacterCodes[CharacterCodes["at"] = 0x40] = "at"; CharacterCodes[CharacterCodes["backslash"] = 0x5C] = "backslash"; + CharacterCodes[CharacterCodes["backtick"] = 0x60] = "backtick"; CharacterCodes[CharacterCodes["bar"] = 0x7C] = "bar"; CharacterCodes[CharacterCodes["caret"] = 0x5E] = "caret"; CharacterCodes[CharacterCodes["closeBrace"] = 0x7D] = "closeBrace"; @@ -1889,6 +1963,18 @@ var ts; })(ts || (ts = {})); var ts; (function (ts) { + (function (Ternary) { + Ternary[Ternary["False"] = 0] = "False"; + Ternary[Ternary["Maybe"] = 1] = "Maybe"; + Ternary[Ternary["True"] = -1] = "True"; + })(ts.Ternary || (ts.Ternary = {})); + var Ternary = ts.Ternary; + (function (Comparison) { + Comparison[Comparison["LessThan"] = -1] = "LessThan"; + Comparison[Comparison["EqualTo"] = 0] = "EqualTo"; + Comparison[Comparison["GreaterThan"] = 1] = "GreaterThan"; + })(ts.Comparison || (ts.Comparison = {})); + var Comparison = ts.Comparison; function forEach(array, callback) { var result; if (array) { @@ -2161,12 +2247,12 @@ var ts; ts.flattenDiagnosticChain = flattenDiagnosticChain; function compareValues(a, b) { if (a === b) - return 0; + return 0 /* EqualTo */; if (a === undefined) - return -1; + return -1 /* LessThan */; if (b === undefined) - return 1; - return a < b ? -1 : 1; + return 1 /* GreaterThan */; + return a < b ? -1 /* LessThan */ : 1 /* GreaterThan */; } ts.compareValues = compareValues; function getDiagnosticFilename(diagnostic) { @@ -2184,7 +2270,7 @@ var ts; var previousDiagnostic = diagnostics[0]; for (var i = 1; i < diagnostics.length; i++) { var currentDiagnostic = diagnostics[i]; - var isDupe = compareDiagnostics(currentDiagnostic, previousDiagnostic) === 0; + var isDupe = compareDiagnostics(currentDiagnostic, previousDiagnostic) === 0 /* EqualTo */; if (!isDupe) { newDiagnostics.push(currentDiagnostic); previousDiagnostic = currentDiagnostic; @@ -2640,7 +2726,7 @@ var sys = (function () { })(); var ts; (function (ts) { - var nodeConstructors = new Array(189 /* Count */); + var nodeConstructors = new Array(196 /* Count */); function getNodeConstructor(kind) { return nodeConstructors[kind] || (nodeConstructors[kind] = ts.objectAllocator.getNodeConstructor(kind)); } @@ -2653,7 +2739,7 @@ var ts; return node; } function getSourceFileOfNode(node) { - while (node && node.kind !== 186 /* SourceFile */) + while (node && node.kind !== 193 /* SourceFile */) node = node.parent; return node; } @@ -2690,81 +2776,13 @@ var ts; } ts.unescapeIdentifier = unescapeIdentifier; function identifierToString(identifier) { - return identifier.kind === 116 /* Missing */ ? "(Missing)" : getTextOfNode(identifier); + return identifier.kind === 120 /* Missing */ ? "(Missing)" : getTextOfNode(identifier); } ts.identifierToString = identifierToString; - function isExpression(node) { - switch (node.kind) { - case 87 /* ThisKeyword */: - case 85 /* SuperKeyword */: - case 83 /* NullKeyword */: - case 89 /* TrueKeyword */: - case 74 /* FalseKeyword */: - case 8 /* RegularExpressionLiteral */: - case 135 /* ArrayLiteral */: - case 136 /* ObjectLiteral */: - case 138 /* PropertyAccess */: - case 139 /* IndexedAccess */: - case 140 /* CallExpression */: - case 141 /* NewExpression */: - case 142 /* TypeAssertion */: - case 143 /* ParenExpression */: - case 144 /* FunctionExpression */: - case 145 /* ArrowFunction */: - case 146 /* PrefixOperator */: - case 147 /* PostfixOperator */: - case 148 /* BinaryExpression */: - case 149 /* ConditionalExpression */: - case 150 /* OmittedExpression */: - return true; - case 117 /* QualifiedName */: - while (node.parent.kind === 117 /* QualifiedName */) - node = node.parent; - return node.parent.kind === 129 /* TypeQuery */; - case 59 /* Identifier */: - if (node.parent.kind === 129 /* TypeQuery */) { - return true; - } - case 6 /* NumericLiteral */: - case 7 /* StringLiteral */: - var parent = node.parent; - switch (parent.kind) { - case 174 /* VariableDeclaration */: - case 119 /* Parameter */: - case 120 /* Property */: - case 185 /* EnumMember */: - case 137 /* PropertyAssignment */: - return parent.initializer === node; - case 154 /* ExpressionStatement */: - case 155 /* IfStatement */: - case 156 /* DoStatement */: - case 157 /* WhileStatement */: - case 162 /* ReturnStatement */: - case 163 /* WithStatement */: - case 164 /* SwitchStatement */: - case 165 /* CaseClause */: - case 168 /* ThrowStatement */: - case 164 /* SwitchStatement */: - return parent.expression === node; - case 158 /* ForStatement */: - return parent.initializer === node || parent.condition === node || parent.iterator === node; - case 159 /* ForInStatement */: - return parent.variable === node || parent.expression === node; - case 142 /* TypeAssertion */: - return node === parent.operand; - default: - if (isExpression(parent)) { - return true; - } - } - } - return false; - } - ts.isExpression = isExpression; function createDiagnosticForNode(node, message, arg0, arg1, arg2) { node = getErrorSpanForNode(node); var file = getSourceFileOfNode(node); - var start = node.kind === 116 /* Missing */ ? node.pos : ts.skipTrivia(file.text, node.pos); + var start = node.kind === 120 /* Missing */ ? node.pos : ts.skipTrivia(file.text, node.pos); var length = node.end - start; return ts.createFileDiagnostic(file, start, length, message, arg0, arg1, arg2); } @@ -2780,12 +2798,12 @@ var ts; function getErrorSpanForNode(node) { var errorSpan; switch (node.kind) { - case 174 /* VariableDeclaration */: - case 177 /* ClassDeclaration */: - case 178 /* InterfaceDeclaration */: - case 181 /* ModuleDeclaration */: - case 180 /* EnumDeclaration */: - case 185 /* EnumMember */: + case 181 /* VariableDeclaration */: + case 184 /* ClassDeclaration */: + case 185 /* InterfaceDeclaration */: + case 188 /* ModuleDeclaration */: + case 187 /* EnumDeclaration */: + case 192 /* EnumMember */: errorSpan = node.name; break; } @@ -2800,12 +2818,16 @@ var ts; return (file.flags & 1024 /* DeclarationFile */) !== 0; } ts.isDeclarationFile = isDeclarationFile; + function isConstEnumDeclaration(node) { + return (node.flags & 4096 /* Const */) !== 0; + } + ts.isConstEnumDeclaration = isConstEnumDeclaration; function isPrologueDirective(node) { - return node.kind === 154 /* ExpressionStatement */ && node.expression.kind === 7 /* StringLiteral */; + return node.kind === 161 /* ExpressionStatement */ && node.expression.kind === 7 /* StringLiteral */; } ts.isPrologueDirective = isPrologueDirective; function isEvalOrArgumentsIdentifier(node) { - return node.kind === 59 /* Identifier */ && node.text && (node.text === "eval" || node.text === "arguments"); + return node.kind === 63 /* Identifier */ && node.text && (node.text === "eval" || node.text === "arguments"); } function isUseStrictPrologueDirective(node) { ts.Debug.assert(isPrologueDirective(node)); @@ -2813,7 +2835,7 @@ var ts; } function getLeadingCommentRangesOfNode(node, sourceFileOfNode) { sourceFileOfNode = sourceFileOfNode || getSourceFileOfNode(node); - if (node.kind === 119 /* Parameter */ || node.kind === 118 /* TypeParameter */) { + if (node.kind === 123 /* Parameter */ || node.kind === 122 /* TypeParameter */) { return ts.concatenate(ts.getTrailingCommentRanges(sourceFileOfNode.text, node.pos), ts.getLeadingCommentRanges(sourceFileOfNode.text, node.pos)); } else { @@ -2849,122 +2871,128 @@ var ts; if (!node) return; switch (node.kind) { - case 117 /* QualifiedName */: + case 121 /* QualifiedName */: return child(node.left) || child(node.right); - case 118 /* TypeParameter */: + case 122 /* TypeParameter */: return child(node.name) || child(node.constraint); - case 119 /* Parameter */: + case 123 /* Parameter */: return child(node.name) || child(node.type) || child(node.initializer); - case 120 /* Property */: - case 137 /* PropertyAssignment */: + case 124 /* Property */: + case 141 /* PropertyAssignment */: return child(node.name) || child(node.type) || child(node.initializer); - case 125 /* CallSignature */: - case 126 /* ConstructSignature */: - case 127 /* IndexSignature */: + case 129 /* CallSignature */: + case 130 /* ConstructSignature */: + case 131 /* IndexSignature */: return children(node.typeParameters) || children(node.parameters) || child(node.type); - case 121 /* Method */: - case 122 /* Constructor */: - case 123 /* GetAccessor */: - case 124 /* SetAccessor */: - case 144 /* FunctionExpression */: - case 175 /* FunctionDeclaration */: - case 145 /* ArrowFunction */: + case 125 /* Method */: + case 126 /* Constructor */: + case 127 /* GetAccessor */: + case 128 /* SetAccessor */: + case 149 /* FunctionExpression */: + case 182 /* FunctionDeclaration */: + case 150 /* ArrowFunction */: return child(node.name) || children(node.typeParameters) || children(node.parameters) || child(node.type) || child(node.body); - case 128 /* TypeReference */: + case 132 /* TypeReference */: return child(node.typeName) || children(node.typeArguments); - case 129 /* TypeQuery */: + case 133 /* TypeQuery */: return child(node.exprName); - case 130 /* TypeLiteral */: + case 134 /* TypeLiteral */: return children(node.members); - case 131 /* ArrayType */: + case 135 /* ArrayType */: return child(node.elementType); - case 132 /* TupleType */: + case 136 /* TupleType */: return children(node.elementTypes); - case 133 /* UnionType */: + case 137 /* UnionType */: return children(node.types); - case 134 /* ParenType */: + case 138 /* ParenType */: return child(node.type); - case 135 /* ArrayLiteral */: + case 139 /* ArrayLiteral */: return children(node.elements); - case 136 /* ObjectLiteral */: + case 140 /* ObjectLiteral */: return children(node.properties); - case 138 /* PropertyAccess */: + case 142 /* PropertyAccess */: return child(node.left) || child(node.right); - case 139 /* IndexedAccess */: + case 143 /* IndexedAccess */: return child(node.object) || child(node.index); - case 140 /* CallExpression */: - case 141 /* NewExpression */: + case 144 /* CallExpression */: + case 145 /* NewExpression */: return child(node.func) || children(node.typeArguments) || children(node.arguments); - case 142 /* TypeAssertion */: + case 146 /* TaggedTemplateExpression */: + return child(node.tag) || child(node.template); + case 147 /* TypeAssertion */: return child(node.type) || child(node.operand); - case 143 /* ParenExpression */: + case 148 /* ParenExpression */: return child(node.expression); - case 146 /* PrefixOperator */: - case 147 /* PostfixOperator */: + case 151 /* PrefixOperator */: + case 152 /* PostfixOperator */: return child(node.operand); - case 148 /* BinaryExpression */: + case 153 /* BinaryExpression */: return child(node.left) || child(node.right); - case 149 /* ConditionalExpression */: + case 154 /* ConditionalExpression */: return child(node.condition) || child(node.whenTrue) || child(node.whenFalse); - case 151 /* Block */: - case 170 /* TryBlock */: - case 172 /* FinallyBlock */: - case 176 /* FunctionBlock */: - case 182 /* ModuleBlock */: - case 186 /* SourceFile */: + case 158 /* Block */: + case 177 /* TryBlock */: + case 179 /* FinallyBlock */: + case 183 /* FunctionBlock */: + case 189 /* ModuleBlock */: + case 193 /* SourceFile */: return children(node.statements); - case 152 /* VariableStatement */: + case 159 /* VariableStatement */: return children(node.declarations); - case 154 /* ExpressionStatement */: + case 161 /* ExpressionStatement */: return child(node.expression); - case 155 /* IfStatement */: + case 162 /* IfStatement */: return child(node.expression) || child(node.thenStatement) || child(node.elseStatement); - case 156 /* DoStatement */: + case 163 /* DoStatement */: return child(node.statement) || child(node.expression); - case 157 /* WhileStatement */: + case 164 /* WhileStatement */: return child(node.expression) || child(node.statement); - case 158 /* ForStatement */: + case 165 /* ForStatement */: return children(node.declarations) || child(node.initializer) || child(node.condition) || child(node.iterator) || child(node.statement); - case 159 /* ForInStatement */: + case 166 /* ForInStatement */: return child(node.declaration) || child(node.variable) || child(node.expression) || child(node.statement); - case 160 /* ContinueStatement */: - case 161 /* BreakStatement */: + case 167 /* ContinueStatement */: + case 168 /* BreakStatement */: return child(node.label); - case 162 /* ReturnStatement */: + case 169 /* ReturnStatement */: return child(node.expression); - case 163 /* WithStatement */: + case 170 /* WithStatement */: return child(node.expression) || child(node.statement); - case 164 /* SwitchStatement */: + case 171 /* SwitchStatement */: return child(node.expression) || children(node.clauses); - case 165 /* CaseClause */: - case 166 /* DefaultClause */: + case 172 /* CaseClause */: + case 173 /* DefaultClause */: return child(node.expression) || children(node.statements); - case 167 /* LabeledStatement */: + case 174 /* LabeledStatement */: return child(node.label) || child(node.statement); - case 168 /* ThrowStatement */: + case 175 /* ThrowStatement */: return child(node.expression); - case 169 /* TryStatement */: + case 176 /* TryStatement */: return child(node.tryBlock) || child(node.catchBlock) || child(node.finallyBlock); - case 171 /* CatchBlock */: + case 178 /* CatchBlock */: return child(node.variable) || children(node.statements); - case 174 /* VariableDeclaration */: + case 181 /* VariableDeclaration */: return child(node.name) || child(node.type) || child(node.initializer); - case 177 /* ClassDeclaration */: + case 184 /* ClassDeclaration */: return child(node.name) || children(node.typeParameters) || child(node.baseType) || children(node.implementedTypes) || children(node.members); - case 178 /* InterfaceDeclaration */: + case 185 /* InterfaceDeclaration */: return child(node.name) || children(node.typeParameters) || children(node.baseTypes) || children(node.members); - case 179 /* TypeAliasDeclaration */: + case 186 /* TypeAliasDeclaration */: return child(node.name) || child(node.type); - case 180 /* EnumDeclaration */: + case 187 /* EnumDeclaration */: return child(node.name) || children(node.members); - case 185 /* EnumMember */: + case 192 /* EnumMember */: return child(node.name) || child(node.initializer); - case 181 /* ModuleDeclaration */: + case 188 /* ModuleDeclaration */: return child(node.name) || child(node.body); - case 183 /* ImportDeclaration */: + case 190 /* ImportDeclaration */: return child(node.name) || child(node.entityName) || child(node.externalModuleName); - case 184 /* ExportAssignment */: + case 191 /* ExportAssignment */: return child(node.exportName); + case 155 /* TemplateExpression */: + return child(node.head) || children(node.templateSpans); + case 156 /* TemplateSpan */: + return child(node.expression) || child(node.literal); } } ts.forEachChild = forEachChild; @@ -2972,24 +3000,24 @@ var ts; return traverse(body); function traverse(node) { switch (node.kind) { - case 162 /* ReturnStatement */: + case 169 /* ReturnStatement */: return visitor(node); - case 151 /* Block */: - case 176 /* FunctionBlock */: - case 155 /* IfStatement */: - case 156 /* DoStatement */: - case 157 /* WhileStatement */: - case 158 /* ForStatement */: - case 159 /* ForInStatement */: - case 163 /* WithStatement */: - case 164 /* SwitchStatement */: - case 165 /* CaseClause */: - case 166 /* DefaultClause */: - case 167 /* LabeledStatement */: - case 169 /* TryStatement */: - case 170 /* TryBlock */: - case 171 /* CatchBlock */: - case 172 /* FinallyBlock */: + case 158 /* Block */: + case 183 /* FunctionBlock */: + case 162 /* IfStatement */: + case 163 /* DoStatement */: + case 164 /* WhileStatement */: + case 165 /* ForStatement */: + case 166 /* ForInStatement */: + case 170 /* WithStatement */: + case 171 /* SwitchStatement */: + case 172 /* CaseClause */: + case 173 /* DefaultClause */: + case 174 /* LabeledStatement */: + case 176 /* TryStatement */: + case 177 /* TryBlock */: + case 178 /* CatchBlock */: + case 179 /* FinallyBlock */: return forEachChild(node, traverse); } } @@ -2998,13 +3026,13 @@ var ts; function isAnyFunction(node) { if (node) { switch (node.kind) { - case 144 /* FunctionExpression */: - case 175 /* FunctionDeclaration */: - case 145 /* ArrowFunction */: - case 121 /* Method */: - case 123 /* GetAccessor */: - case 124 /* SetAccessor */: - case 122 /* Constructor */: + case 149 /* FunctionExpression */: + case 182 /* FunctionDeclaration */: + case 150 /* ArrowFunction */: + case 125 /* Method */: + case 127 /* GetAccessor */: + case 128 /* SetAccessor */: + case 126 /* Constructor */: return true; } } @@ -3027,20 +3055,20 @@ var ts; return undefined; } switch (node.kind) { - case 145 /* ArrowFunction */: + case 150 /* ArrowFunction */: if (!includeArrowFunctions) { continue; } - case 175 /* FunctionDeclaration */: - case 144 /* FunctionExpression */: - case 181 /* ModuleDeclaration */: - case 120 /* Property */: - case 121 /* Method */: - case 122 /* Constructor */: - case 123 /* GetAccessor */: - case 124 /* SetAccessor */: - case 180 /* EnumDeclaration */: - case 186 /* SourceFile */: + case 182 /* FunctionDeclaration */: + case 149 /* FunctionExpression */: + case 188 /* ModuleDeclaration */: + case 124 /* Property */: + case 125 /* Method */: + case 126 /* Constructor */: + case 127 /* GetAccessor */: + case 128 /* SetAccessor */: + case 187 /* EnumDeclaration */: + case 193 /* SourceFile */: return node; } } @@ -3053,20 +3081,103 @@ var ts; return undefined; } switch (node.kind) { - case 120 /* Property */: - case 121 /* Method */: - case 122 /* Constructor */: - case 123 /* GetAccessor */: - case 124 /* SetAccessor */: + case 124 /* Property */: + case 125 /* Method */: + case 126 /* Constructor */: + case 127 /* GetAccessor */: + case 128 /* SetAccessor */: return node; } } } ts.getSuperContainer = getSuperContainer; + function isExpression(node) { + switch (node.kind) { + case 91 /* ThisKeyword */: + case 89 /* SuperKeyword */: + case 87 /* NullKeyword */: + case 93 /* TrueKeyword */: + case 78 /* FalseKeyword */: + case 8 /* RegularExpressionLiteral */: + case 139 /* ArrayLiteral */: + case 140 /* ObjectLiteral */: + case 142 /* PropertyAccess */: + case 143 /* IndexedAccess */: + case 144 /* CallExpression */: + case 145 /* NewExpression */: + case 146 /* TaggedTemplateExpression */: + case 147 /* TypeAssertion */: + case 148 /* ParenExpression */: + case 149 /* FunctionExpression */: + case 150 /* ArrowFunction */: + case 151 /* PrefixOperator */: + case 152 /* PostfixOperator */: + case 153 /* BinaryExpression */: + case 154 /* ConditionalExpression */: + case 155 /* TemplateExpression */: + case 157 /* OmittedExpression */: + return true; + case 121 /* QualifiedName */: + while (node.parent.kind === 121 /* QualifiedName */) + node = node.parent; + return node.parent.kind === 133 /* TypeQuery */; + case 63 /* Identifier */: + if (node.parent.kind === 133 /* TypeQuery */) { + return true; + } + case 6 /* NumericLiteral */: + case 7 /* StringLiteral */: + case 9 /* NoSubstitutionTemplateLiteral */: + var parent = node.parent; + switch (parent.kind) { + case 181 /* VariableDeclaration */: + case 123 /* Parameter */: + case 124 /* Property */: + case 192 /* EnumMember */: + case 141 /* PropertyAssignment */: + return parent.initializer === node; + case 161 /* ExpressionStatement */: + case 162 /* IfStatement */: + case 163 /* DoStatement */: + case 164 /* WhileStatement */: + case 169 /* ReturnStatement */: + case 170 /* WithStatement */: + case 171 /* SwitchStatement */: + case 172 /* CaseClause */: + case 175 /* ThrowStatement */: + case 171 /* SwitchStatement */: + return parent.expression === node; + case 165 /* ForStatement */: + return parent.initializer === node || parent.condition === node || parent.iterator === node; + case 166 /* ForInStatement */: + return parent.variable === node || parent.expression === node; + case 147 /* TypeAssertion */: + return node === parent.operand; + default: + if (isExpression(parent)) { + return true; + } + } + } + return false; + } + ts.isExpression = isExpression; function hasRestParameters(s) { return s.parameters.length > 0 && (s.parameters[s.parameters.length - 1].flags & 8 /* Rest */) !== 0; } ts.hasRestParameters = hasRestParameters; + function isLiteralKind(kind) { + return ts.SyntaxKind.FirstLiteralToken <= kind && kind <= ts.SyntaxKind.LastLiteralToken; + } + ts.isLiteralKind = isLiteralKind; + function isTextualLiteralKind(kind) { + return kind === 7 /* StringLiteral */ || kind === 9 /* NoSubstitutionTemplateLiteral */; + } + ts.isTextualLiteralKind = isTextualLiteralKind; + function isTemplateLiteralKind(kind) { + return ts.SyntaxKind.FirstTemplateToken <= kind && kind <= ts.SyntaxKind.LastTemplateToken; + } + ts.isTemplateLiteralKind = isTemplateLiteralKind; function isInAmbientContext(node) { while (node) { if (node.flags & (2 /* Ambient */ | 1024 /* DeclarationFile */)) @@ -3078,22 +3189,22 @@ var ts; ts.isInAmbientContext = isInAmbientContext; function isDeclaration(node) { switch (node.kind) { - case 118 /* TypeParameter */: - case 119 /* Parameter */: - case 174 /* VariableDeclaration */: - case 120 /* Property */: - case 137 /* PropertyAssignment */: - case 185 /* EnumMember */: - case 121 /* Method */: - case 175 /* FunctionDeclaration */: - case 123 /* GetAccessor */: - case 124 /* SetAccessor */: - case 177 /* ClassDeclaration */: - case 178 /* InterfaceDeclaration */: - case 179 /* TypeAliasDeclaration */: - case 180 /* EnumDeclaration */: - case 181 /* ModuleDeclaration */: - case 183 /* ImportDeclaration */: + case 122 /* TypeParameter */: + case 123 /* Parameter */: + case 181 /* VariableDeclaration */: + case 124 /* Property */: + case 141 /* PropertyAssignment */: + case 192 /* EnumMember */: + case 125 /* Method */: + case 182 /* FunctionDeclaration */: + case 127 /* GetAccessor */: + case 128 /* SetAccessor */: + case 184 /* ClassDeclaration */: + case 185 /* InterfaceDeclaration */: + case 186 /* TypeAliasDeclaration */: + case 187 /* EnumDeclaration */: + case 188 /* ModuleDeclaration */: + case 190 /* ImportDeclaration */: return true; } return false; @@ -3101,24 +3212,24 @@ var ts; ts.isDeclaration = isDeclaration; function isStatement(n) { switch (n.kind) { - case 161 /* BreakStatement */: - case 160 /* ContinueStatement */: - case 173 /* DebuggerStatement */: - case 156 /* DoStatement */: - case 154 /* ExpressionStatement */: - case 153 /* EmptyStatement */: - case 159 /* ForInStatement */: - case 158 /* ForStatement */: - case 155 /* IfStatement */: - case 167 /* LabeledStatement */: - case 162 /* ReturnStatement */: - case 164 /* SwitchStatement */: - case 88 /* ThrowKeyword */: - case 169 /* TryStatement */: - case 152 /* VariableStatement */: - case 157 /* WhileStatement */: - case 163 /* WithStatement */: - case 184 /* ExportAssignment */: + case 168 /* BreakStatement */: + case 167 /* ContinueStatement */: + case 180 /* DebuggerStatement */: + case 163 /* DoStatement */: + case 161 /* ExpressionStatement */: + case 160 /* EmptyStatement */: + case 166 /* ForInStatement */: + case 165 /* ForStatement */: + case 162 /* IfStatement */: + case 174 /* LabeledStatement */: + case 169 /* ReturnStatement */: + case 171 /* SwitchStatement */: + case 92 /* ThrowKeyword */: + case 176 /* TryStatement */: + case 159 /* VariableStatement */: + case 164 /* WhileStatement */: + case 170 /* WithStatement */: + case 191 /* ExportAssignment */: return true; default: return false; @@ -3126,14 +3237,14 @@ var ts; } ts.isStatement = isStatement; function isDeclarationOrFunctionExpressionOrCatchVariableName(name) { - if (name.kind !== 59 /* Identifier */ && name.kind !== 7 /* StringLiteral */ && name.kind !== 6 /* NumericLiteral */) { + if (name.kind !== 63 /* Identifier */ && name.kind !== 7 /* StringLiteral */ && name.kind !== 6 /* NumericLiteral */) { return false; } var parent = name.parent; - if (isDeclaration(parent) || parent.kind === 144 /* FunctionExpression */) { + if (isDeclaration(parent) || parent.kind === 149 /* FunctionExpression */) { return parent.name === name; } - if (parent.kind === 171 /* CatchBlock */) { + if (parent.kind === 178 /* CatchBlock */) { return parent.variable === name; } return false; @@ -3141,16 +3252,16 @@ var ts; ts.isDeclarationOrFunctionExpressionOrCatchVariableName = isDeclarationOrFunctionExpressionOrCatchVariableName; function getAncestor(node, kind) { switch (kind) { - case 177 /* ClassDeclaration */: + case 184 /* ClassDeclaration */: while (node) { switch (node.kind) { - case 177 /* ClassDeclaration */: + case 184 /* ClassDeclaration */: return node; - case 180 /* EnumDeclaration */: - case 178 /* InterfaceDeclaration */: - case 179 /* TypeAliasDeclaration */: - case 181 /* ModuleDeclaration */: - case 183 /* ImportDeclaration */: + case 187 /* EnumDeclaration */: + case 185 /* InterfaceDeclaration */: + case 186 /* TypeAliasDeclaration */: + case 188 /* ModuleDeclaration */: + case 190 /* ImportDeclaration */: return undefined; default: node = node.parent; @@ -3265,12 +3376,12 @@ var ts; ts.isTrivia = isTrivia; function isModifier(token) { switch (token) { - case 102 /* PublicKeyword */: - case 100 /* PrivateKeyword */: - case 101 /* ProtectedKeyword */: - case 103 /* StaticKeyword */: - case 72 /* ExportKeyword */: - case 108 /* DeclareKeyword */: + case 106 /* PublicKeyword */: + case 104 /* PrivateKeyword */: + case 105 /* ProtectedKeyword */: + case 107 /* StaticKeyword */: + case 76 /* ExportKeyword */: + case 112 /* DeclareKeyword */: return true; } return false; @@ -3432,6 +3543,9 @@ var ts; function reScanSlashToken() { return token = scanner.reScanSlashToken(); } + function reScanTemplateToken() { + return token = scanner.reScanTemplateToken(); + } function lookAheadHelper(callback, alwaysResetState) { var saveToken = token; var saveSyntacticErrorsLength = file.syntacticErrors.length; @@ -3461,7 +3575,7 @@ var ts; return scanner.tryScan(function () { return lookAheadHelper(callback, false); }); } function isIdentifier() { - return token === 59 /* Identifier */ || (isInStrictMode ? token > ts.SyntaxKind.LastFutureReservedWord : token > ts.SyntaxKind.LastReservedWord); + return token === 63 /* Identifier */ || (isInStrictMode ? token > ts.SyntaxKind.LastFutureReservedWord : token > ts.SyntaxKind.LastReservedWord); } function parseExpected(t) { if (token === t) { @@ -3479,14 +3593,14 @@ var ts; return false; } function canParseSemicolon() { - if (token === 17 /* SemicolonToken */) { + if (token === 21 /* SemicolonToken */) { return true; } - return token === 10 /* CloseBraceToken */ || token === 1 /* EndOfFileToken */ || scanner.hasPrecedingLineBreak(); + return token === 14 /* CloseBraceToken */ || token === 1 /* EndOfFileToken */ || scanner.hasPrecedingLineBreak(); } function parseSemicolon() { if (canParseSemicolon()) { - if (token === 17 /* SemicolonToken */) { + if (token === 21 /* SemicolonToken */) { nextToken(); } } @@ -3508,7 +3622,7 @@ var ts; return node; } function createMissingNode() { - return createNode(116 /* Missing */); + return createNode(120 /* Missing */); } function internIdentifier(text) { return ts.hasProperty(identifiers, text) ? identifiers[text] : (identifiers[text] = text); @@ -3516,7 +3630,7 @@ var ts; function createIdentifier(isIdentifier) { identifierCount++; if (isIdentifier) { - var node = createNode(59 /* Identifier */); + var node = createNode(63 /* Identifier */); var text = escapeIdentifier(scanner.getTokenValue()); node.text = internIdentifier(text); nextToken(); @@ -3531,10 +3645,10 @@ var ts; return createIdentifier(isIdentifier()); } function parseIdentifierName() { - return createIdentifier(token >= 59 /* Identifier */); + return createIdentifier(token >= 63 /* Identifier */); } function isPropertyName() { - return token >= 59 /* Identifier */ || token === 7 /* StringLiteral */ || token === 6 /* NumericLiteral */; + return token >= 63 /* Identifier */ || token === 7 /* StringLiteral */ || token === 6 /* NumericLiteral */; } function parsePropertyName() { if (token === 7 /* StringLiteral */ || token === 6 /* NumericLiteral */) { @@ -3545,13 +3659,13 @@ var ts; function parseContextualModifier(t) { return token === t && tryParse(function () { nextToken(); - return token === 13 /* OpenBracketToken */ || isPropertyName(); + return token === 17 /* OpenBracketToken */ || isPropertyName(); }); } function parseAnyContextualModifier() { return isModifier(token) && tryParse(function () { nextToken(); - return token === 13 /* OpenBracketToken */ || isPropertyName(); + return token === 17 /* OpenBracketToken */ || isPropertyName(); }); } function isListElement(kind, inErrorRecovery) { @@ -3563,28 +3677,28 @@ var ts; case 4 /* SwitchClauseStatements */: return isStatement(inErrorRecovery); case 3 /* SwitchClauses */: - return token === 61 /* CaseKeyword */ || token === 67 /* DefaultKeyword */; + return token === 65 /* CaseKeyword */ || token === 71 /* DefaultKeyword */; case 5 /* TypeMembers */: - return isTypeMember(); + return isStartOfTypeMember(); case 6 /* ClassMembers */: return lookAhead(isClassMemberStart); case 7 /* EnumMembers */: case 11 /* ObjectLiteralMembers */: return isPropertyName(); case 8 /* BaseTypeReferences */: - return isIdentifier() && ((token !== 73 /* ExtendsKeyword */ && token !== 96 /* ImplementsKeyword */) || !lookAhead(function () { return (nextToken(), isIdentifier()); })); + return isIdentifier() && ((token !== 77 /* ExtendsKeyword */ && token !== 100 /* ImplementsKeyword */) || !lookAhead(function () { return (nextToken(), isIdentifier()); })); case 9 /* VariableDeclarations */: case 14 /* TypeParameters */: return isIdentifier(); case 10 /* ArgumentExpressions */: - return token === 18 /* CommaToken */ || isExpression(); + return token === 22 /* CommaToken */ || isStartOfExpression(); case 12 /* ArrayLiteralMembers */: - return token === 18 /* CommaToken */ || isExpression(); + return token === 22 /* CommaToken */ || isStartOfExpression(); case 13 /* Parameters */: - return isParameter(); + return isStartOfParameter(); case 15 /* TypeArguments */: case 16 /* TupleElementTypes */: - return token === 18 /* CommaToken */ || isType(); + return token === 22 /* CommaToken */ || isStartOfType(); } ts.Debug.fail("Non-exhaustive case in 'isListElement'."); } @@ -3600,34 +3714,34 @@ var ts; case 6 /* ClassMembers */: case 7 /* EnumMembers */: case 11 /* ObjectLiteralMembers */: - return token === 10 /* CloseBraceToken */; + return token === 14 /* CloseBraceToken */; case 4 /* SwitchClauseStatements */: - return token === 10 /* CloseBraceToken */ || token === 61 /* CaseKeyword */ || token === 67 /* DefaultKeyword */; + return token === 14 /* CloseBraceToken */ || token === 65 /* CaseKeyword */ || token === 71 /* DefaultKeyword */; case 8 /* BaseTypeReferences */: - return token === 9 /* OpenBraceToken */ || token === 73 /* ExtendsKeyword */ || token === 96 /* ImplementsKeyword */; + return token === 13 /* OpenBraceToken */ || token === 77 /* ExtendsKeyword */ || token === 100 /* ImplementsKeyword */; case 9 /* VariableDeclarations */: return isVariableDeclaratorListTerminator(); case 14 /* TypeParameters */: - return token === 20 /* GreaterThanToken */ || token === 11 /* OpenParenToken */ || token === 9 /* OpenBraceToken */ || token === 73 /* ExtendsKeyword */ || token === 96 /* ImplementsKeyword */; + return token === 24 /* GreaterThanToken */ || token === 15 /* OpenParenToken */ || token === 13 /* OpenBraceToken */ || token === 77 /* ExtendsKeyword */ || token === 100 /* ImplementsKeyword */; case 10 /* ArgumentExpressions */: - return token === 12 /* CloseParenToken */ || token === 17 /* SemicolonToken */; + return token === 16 /* CloseParenToken */ || token === 21 /* SemicolonToken */; case 12 /* ArrayLiteralMembers */: case 16 /* TupleElementTypes */: - return token === 14 /* CloseBracketToken */; + return token === 18 /* CloseBracketToken */; case 13 /* Parameters */: - return token === 12 /* CloseParenToken */ || token === 14 /* CloseBracketToken */ || token === 9 /* OpenBraceToken */; + return token === 16 /* CloseParenToken */ || token === 18 /* CloseBracketToken */ || token === 13 /* OpenBraceToken */; case 15 /* TypeArguments */: - return token === 20 /* GreaterThanToken */ || token === 11 /* OpenParenToken */; + return token === 24 /* GreaterThanToken */ || token === 15 /* OpenParenToken */; } } function isVariableDeclaratorListTerminator() { if (canParseSemicolon()) { return true; } - if (token === 80 /* InKeyword */) { + if (token === 84 /* InKeyword */) { return true; } - if (token === 27 /* EqualsGreaterThanToken */) { + if (token === 31 /* EqualsGreaterThanToken */) { return true; } return false; @@ -3688,7 +3802,7 @@ var ts; if (isListElement(kind, false)) { result.push(parseElement()); commaStart = scanner.getTokenPos(); - if (parseOptional(18 /* CommaToken */)) { + if (parseOptional(22 /* CommaToken */)) { continue; } commaStart = -1; @@ -3743,8 +3857,8 @@ var ts; } function parseEntityName(allowReservedWords) { var entity = parseIdentifier(); - while (parseOptional(15 /* DotToken */)) { - var node = createNode(117 /* QualifiedName */, entity.pos); + while (parseOptional(19 /* DotToken */)) { + var node = createNode(121 /* QualifiedName */, entity.pos); node.left = entity; node.right = allowReservedWords ? parseIdentifierName() : parseIdentifier(); entity = finishNode(node); @@ -3756,6 +3870,35 @@ var ts; nextToken(); return finishNode(node); } + function parseTemplateExpression() { + var template = createNode(155 /* TemplateExpression */); + template.head = parseLiteralNode(); + ts.Debug.assert(template.head.kind === 10 /* TemplateHead */, "Template head has wrong token kind"); + var templateSpans = []; + templateSpans.pos = getNodePos(); + do { + templateSpans.push(parseTemplateSpan()); + } while (templateSpans[templateSpans.length - 1].literal.kind === 11 /* TemplateMiddle */); + templateSpans.end = getNodeEnd(); + template.templateSpans = templateSpans; + return finishNode(template); + } + function parseTemplateSpan() { + var span = createNode(156 /* TemplateSpan */); + span.expression = parseExpression(false); + var literal; + if (token === 14 /* CloseBraceToken */) { + reScanTemplateToken(); + literal = parseLiteralNode(); + } + else { + error(ts.Diagnostics.Invalid_template_literal_expected); + literal = createMissingNode(); + literal.text = ""; + } + span.literal = literal; + return finishNode(span); + } function parseLiteralNode(internName) { var node = createNode(token); var text = scanner.getTokenValue(); @@ -3774,30 +3917,31 @@ var ts; return node; } function parseStringLiteral() { - if (token === 7 /* StringLiteral */) + if (token === 7 /* StringLiteral */) { return parseLiteralNode(true); + } error(ts.Diagnostics.String_literal_expected); return createMissingNode(); } function parseTypeReference() { - var node = createNode(128 /* TypeReference */); + var node = createNode(132 /* TypeReference */); node.typeName = parseEntityName(false); - if (!scanner.hasPrecedingLineBreak() && token === 19 /* LessThanToken */) { + if (!scanner.hasPrecedingLineBreak() && token === 23 /* LessThanToken */) { node.typeArguments = parseTypeArguments(); } return finishNode(node); } function parseTypeQuery() { - var node = createNode(129 /* TypeQuery */); - parseExpected(91 /* TypeOfKeyword */); + var node = createNode(133 /* TypeQuery */); + parseExpected(95 /* TypeOfKeyword */); node.exprName = parseEntityName(true); return finishNode(node); } function parseTypeParameter() { - var node = createNode(118 /* TypeParameter */); + var node = createNode(122 /* TypeParameter */); node.name = parseIdentifier(); - if (parseOptional(73 /* ExtendsKeyword */)) { - if (isType() || !isExpression()) { + if (parseOptional(77 /* ExtendsKeyword */)) { + if (isStartOfType() || !isStartOfExpression()) { node.constraint = parseType(); } else { @@ -3808,9 +3952,9 @@ var ts; return finishNode(node); } function parseTypeParameters() { - if (token === 19 /* LessThanToken */) { + if (token === 23 /* LessThanToken */) { var pos = getNodePos(); - var result = parseBracketedList(14 /* TypeParameters */, parseTypeParameter, 19 /* LessThanToken */, 20 /* GreaterThanToken */); + var result = parseBracketedList(14 /* TypeParameters */, parseTypeParameter, 23 /* LessThanToken */, 24 /* GreaterThanToken */); if (!result.length) { var start = getTokenPos(pos); var length = getNodePos() - start; @@ -3820,23 +3964,23 @@ var ts; } } function parseParameterType() { - return parseOptional(46 /* ColonToken */) ? token === 7 /* StringLiteral */ ? parseStringLiteral() : parseType() : undefined; + return parseOptional(50 /* ColonToken */) ? token === 7 /* StringLiteral */ ? parseStringLiteral() : parseType() : undefined; } - function isParameter() { - return token === 16 /* DotDotDotToken */ || isIdentifier() || isModifier(token); + function isStartOfParameter() { + return token === 20 /* DotDotDotToken */ || isIdentifier() || isModifier(token); } function parseParameter(flags) { if (flags === void 0) { flags = 0; } - var node = createNode(119 /* Parameter */); + var node = createNode(123 /* Parameter */); node.flags |= parseAndCheckModifiers(3 /* Parameters */); - if (parseOptional(16 /* DotDotDotToken */)) { + if (parseOptional(20 /* DotDotDotToken */)) { node.flags |= 8 /* Rest */; } node.name = parseIdentifier(); - if (node.name.kind === 116 /* Missing */ && node.flags === 0 && isModifier(token)) { + if (node.name.kind === 120 /* Missing */ && node.flags === 0 && isModifier(token)) { nextToken(); } - if (parseOptional(45 /* QuestionToken */)) { + if (parseOptional(49 /* QuestionToken */)) { node.flags |= 4 /* QuestionMark */; } node.type = parseParameterType(); @@ -3844,11 +3988,11 @@ var ts; return finishNode(node); } function parseSignature(kind, returnToken, returnTokenRequired) { - if (kind === 126 /* ConstructSignature */) { - parseExpected(82 /* NewKeyword */); + if (kind === 130 /* ConstructSignature */) { + parseExpected(86 /* NewKeyword */); } var typeParameters = parseTypeParameters(); - var parameters = parseParameterList(11 /* OpenParenToken */, 12 /* CloseParenToken */); + var parameters = parseParameterList(15 /* OpenParenToken */, 16 /* CloseParenToken */); checkParameterList(parameters); var type; if (returnTokenRequired) { @@ -3915,10 +4059,10 @@ var ts; return finishNode(node); } function parseIndexSignatureMember() { - var node = createNode(127 /* IndexSignature */); + var node = createNode(131 /* IndexSignature */); var errorCountBeforeIndexSignature = file.syntacticErrors.length; var indexerStart = scanner.getTokenPos(); - node.parameters = parseParameterList(13 /* OpenBracketToken */, 14 /* CloseBracketToken */); + node.parameters = parseParameterList(17 /* OpenBracketToken */, 18 /* CloseBracketToken */); var indexerLength = scanner.getStartPos() - indexerStart; node.type = parseTypeAnnotation(); parseSemicolon(); @@ -3959,7 +4103,7 @@ var ts; grammarErrorOnNode(parameter.name, ts.Diagnostics.An_index_signature_parameter_must_have_a_type_annotation); return; } - else if (parameter.type.kind !== 114 /* StringKeyword */ && parameter.type.kind !== 112 /* NumberKeyword */) { + else if (parameter.type.kind !== 118 /* StringKeyword */ && parameter.type.kind !== 116 /* NumberKeyword */) { grammarErrorOnNode(parameter.name, ts.Diagnostics.An_index_signature_parameter_type_must_be_string_or_number); return; } @@ -3971,58 +4115,58 @@ var ts; function parsePropertyOrMethod() { var node = createNode(0 /* Unknown */); node.name = parsePropertyName(); - if (parseOptional(45 /* QuestionToken */)) { + if (parseOptional(49 /* QuestionToken */)) { node.flags |= 4 /* QuestionMark */; } - if (token === 11 /* OpenParenToken */ || token === 19 /* LessThanToken */) { - node.kind = 121 /* Method */; - var sig = parseSignature(125 /* CallSignature */, 46 /* ColonToken */, false); + if (token === 15 /* OpenParenToken */ || token === 23 /* LessThanToken */) { + node.kind = 125 /* Method */; + var sig = parseSignature(129 /* CallSignature */, 50 /* ColonToken */, false); node.typeParameters = sig.typeParameters; node.parameters = sig.parameters; node.type = sig.type; } else { - node.kind = 120 /* Property */; + node.kind = 124 /* Property */; node.type = parseTypeAnnotation(); } parseSemicolon(); return finishNode(node); } - function isTypeMember() { + function isStartOfTypeMember() { switch (token) { - case 11 /* OpenParenToken */: - case 19 /* LessThanToken */: - case 13 /* OpenBracketToken */: + case 15 /* OpenParenToken */: + case 23 /* LessThanToken */: + case 17 /* OpenBracketToken */: return true; default: - return isPropertyName() && lookAhead(function () { return nextToken() === 11 /* OpenParenToken */ || token === 19 /* LessThanToken */ || token === 45 /* QuestionToken */ || token === 46 /* ColonToken */ || canParseSemicolon(); }); + return isPropertyName() && lookAhead(function () { return nextToken() === 15 /* OpenParenToken */ || token === 23 /* LessThanToken */ || token === 49 /* QuestionToken */ || token === 50 /* ColonToken */ || canParseSemicolon(); }); } } function parseTypeMember() { switch (token) { - case 11 /* OpenParenToken */: - case 19 /* LessThanToken */: - return parseSignatureMember(125 /* CallSignature */, 46 /* ColonToken */); - case 13 /* OpenBracketToken */: + case 15 /* OpenParenToken */: + case 23 /* LessThanToken */: + return parseSignatureMember(129 /* CallSignature */, 50 /* ColonToken */); + case 17 /* OpenBracketToken */: return parseIndexSignatureMember(); - case 82 /* NewKeyword */: - if (lookAhead(function () { return nextToken() === 11 /* OpenParenToken */ || token === 19 /* LessThanToken */; })) { - return parseSignatureMember(126 /* ConstructSignature */, 46 /* ColonToken */); + case 86 /* NewKeyword */: + if (lookAhead(function () { return nextToken() === 15 /* OpenParenToken */ || token === 23 /* LessThanToken */; })) { + return parseSignatureMember(130 /* ConstructSignature */, 50 /* ColonToken */); } case 7 /* StringLiteral */: case 6 /* NumericLiteral */: return parsePropertyOrMethod(); default: - if (token >= 59 /* Identifier */) { + if (token >= 63 /* Identifier */) { return parsePropertyOrMethod(); } } } function parseTypeLiteral() { - var node = createNode(130 /* TypeLiteral */); - if (parseExpected(9 /* OpenBraceToken */)) { + var node = createNode(134 /* TypeLiteral */); + if (parseExpected(13 /* OpenBraceToken */)) { node.members = parseList(5 /* TypeMembers */, false, parseTypeMember); - parseExpected(10 /* CloseBraceToken */); + parseExpected(14 /* CloseBraceToken */); } else { node.members = createMissingList(); @@ -4030,26 +4174,26 @@ var ts; return finishNode(node); } function parseTupleType() { - var node = createNode(132 /* TupleType */); + var node = createNode(136 /* TupleType */); var startTokenPos = scanner.getTokenPos(); var startErrorCount = file.syntacticErrors.length; - node.elementTypes = parseBracketedList(16 /* TupleElementTypes */, parseType, 13 /* OpenBracketToken */, 14 /* CloseBracketToken */); + node.elementTypes = parseBracketedList(16 /* TupleElementTypes */, parseType, 17 /* OpenBracketToken */, 18 /* CloseBracketToken */); if (!node.elementTypes.length && file.syntacticErrors.length === startErrorCount) { grammarErrorAtPos(startTokenPos, scanner.getStartPos() - startTokenPos, ts.Diagnostics.A_tuple_type_element_list_cannot_be_empty); } return finishNode(node); } function parseParenType() { - var node = createNode(134 /* ParenType */); - parseExpected(11 /* OpenParenToken */); + var node = createNode(138 /* ParenType */); + parseExpected(15 /* OpenParenToken */); node.type = parseType(); - parseExpected(12 /* CloseParenToken */); + parseExpected(16 /* CloseParenToken */); return finishNode(node); } function parseFunctionType(signatureKind) { - var node = createNode(130 /* TypeLiteral */); + var node = createNode(134 /* TypeLiteral */); var member = createNode(signatureKind); - var sig = parseSignature(signatureKind, 27 /* EqualsGreaterThanToken */, true); + var sig = parseSignature(signatureKind, 31 /* EqualsGreaterThanToken */, true); member.typeParameters = sig.typeParameters; member.parameters = sig.parameters; member.type = sig.type; @@ -4059,24 +4203,24 @@ var ts; } function parseKeywordAndNoDot() { var node = parseTokenNode(); - return token === 15 /* DotToken */ ? undefined : node; + return token === 19 /* DotToken */ ? undefined : node; } function parseNonArrayType() { switch (token) { - case 105 /* AnyKeyword */: - case 114 /* StringKeyword */: - case 112 /* NumberKeyword */: - case 106 /* BooleanKeyword */: - case 93 /* VoidKeyword */: + case 109 /* AnyKeyword */: + case 118 /* StringKeyword */: + case 116 /* NumberKeyword */: + case 110 /* BooleanKeyword */: + case 97 /* VoidKeyword */: var node = tryParse(parseKeywordAndNoDot); return node || parseTypeReference(); - case 91 /* TypeOfKeyword */: + case 95 /* TypeOfKeyword */: return parseTypeQuery(); - case 9 /* OpenBraceToken */: + case 13 /* OpenBraceToken */: return parseTypeLiteral(); - case 13 /* OpenBracketToken */: + case 17 /* OpenBracketToken */: return parseTupleType(); - case 11 /* OpenParenToken */: + case 15 /* OpenParenToken */: return parseParenType(); default: if (isIdentifier()) { @@ -4086,23 +4230,23 @@ var ts; error(ts.Diagnostics.Type_expected); return createMissingNode(); } - function isType() { + function isStartOfType() { switch (token) { - case 105 /* AnyKeyword */: - case 114 /* StringKeyword */: - case 112 /* NumberKeyword */: - case 106 /* BooleanKeyword */: - case 93 /* VoidKeyword */: - case 91 /* TypeOfKeyword */: - case 9 /* OpenBraceToken */: - case 13 /* OpenBracketToken */: - case 19 /* LessThanToken */: - case 82 /* NewKeyword */: + case 109 /* AnyKeyword */: + case 118 /* StringKeyword */: + case 116 /* NumberKeyword */: + case 110 /* BooleanKeyword */: + case 97 /* VoidKeyword */: + case 95 /* TypeOfKeyword */: + case 13 /* OpenBraceToken */: + case 17 /* OpenBracketToken */: + case 23 /* LessThanToken */: + case 86 /* NewKeyword */: return true; - case 11 /* OpenParenToken */: + case 15 /* OpenParenToken */: return lookAhead(function () { nextToken(); - return token === 12 /* CloseParenToken */ || isParameter() || isType(); + return token === 16 /* CloseParenToken */ || isStartOfParameter() || isStartOfType(); }); default: return isIdentifier(); @@ -4110,9 +4254,9 @@ var ts; } function parsePrimaryType() { var type = parseNonArrayType(); - while (!scanner.hasPrecedingLineBreak() && parseOptional(13 /* OpenBracketToken */)) { - parseExpected(14 /* CloseBracketToken */); - var node = createNode(131 /* ArrayType */, type.pos); + while (!scanner.hasPrecedingLineBreak() && parseOptional(17 /* OpenBracketToken */)) { + parseExpected(18 /* CloseBracketToken */); + var node = createNode(135 /* ArrayType */, type.pos); node.elementType = type; type = finishNode(node); } @@ -4120,33 +4264,33 @@ var ts; } function parseUnionType() { var type = parsePrimaryType(); - if (token === 39 /* BarToken */) { + if (token === 43 /* BarToken */) { var types = [type]; types.pos = type.pos; - while (parseOptional(39 /* BarToken */)) { + while (parseOptional(43 /* BarToken */)) { types.push(parsePrimaryType()); } types.end = getNodeEnd(); - var node = createNode(133 /* UnionType */, type.pos); + var node = createNode(137 /* UnionType */, type.pos); node.types = types; type = finishNode(node); } return type; } - function isFunctionType() { - return token === 19 /* LessThanToken */ || token === 11 /* OpenParenToken */ && lookAhead(function () { + function isStartOfFunctionType() { + return token === 23 /* LessThanToken */ || token === 15 /* OpenParenToken */ && lookAhead(function () { nextToken(); - if (token === 12 /* CloseParenToken */ || token === 16 /* DotDotDotToken */) { + if (token === 16 /* CloseParenToken */ || token === 20 /* DotDotDotToken */) { return true; } if (isIdentifier() || isModifier(token)) { nextToken(); - if (token === 46 /* ColonToken */ || token === 18 /* CommaToken */ || token === 45 /* QuestionToken */ || token === 47 /* EqualsToken */ || isIdentifier() || isModifier(token)) { + if (token === 50 /* ColonToken */ || token === 22 /* CommaToken */ || token === 49 /* QuestionToken */ || token === 51 /* EqualsToken */ || isIdentifier() || isModifier(token)) { return true; } - if (token === 12 /* CloseParenToken */) { + if (token === 16 /* CloseParenToken */) { nextToken(); - if (token === 27 /* EqualsGreaterThanToken */) { + if (token === 31 /* EqualsGreaterThanToken */) { return true; } } @@ -4155,66 +4299,68 @@ var ts; }); } function parseType() { - if (isFunctionType()) { - return parseFunctionType(125 /* CallSignature */); + if (isStartOfFunctionType()) { + return parseFunctionType(129 /* CallSignature */); } - if (token === 82 /* NewKeyword */) { - return parseFunctionType(126 /* ConstructSignature */); + if (token === 86 /* NewKeyword */) { + return parseFunctionType(130 /* ConstructSignature */); } return parseUnionType(); } function parseTypeAnnotation() { - return parseOptional(46 /* ColonToken */) ? parseType() : undefined; + return parseOptional(50 /* ColonToken */) ? parseType() : undefined; } - function isExpression() { + function isStartOfExpression() { switch (token) { - case 87 /* ThisKeyword */: - case 85 /* SuperKeyword */: - case 83 /* NullKeyword */: - case 89 /* TrueKeyword */: - case 74 /* FalseKeyword */: + case 91 /* ThisKeyword */: + case 89 /* SuperKeyword */: + case 87 /* NullKeyword */: + case 93 /* TrueKeyword */: + case 78 /* FalseKeyword */: case 6 /* NumericLiteral */: case 7 /* StringLiteral */: - case 11 /* OpenParenToken */: - case 13 /* OpenBracketToken */: - case 9 /* OpenBraceToken */: - case 77 /* FunctionKeyword */: - case 82 /* NewKeyword */: - case 31 /* SlashToken */: - case 51 /* SlashEqualsToken */: - case 28 /* PlusToken */: - case 29 /* MinusToken */: - case 42 /* TildeToken */: - case 41 /* ExclamationToken */: - case 68 /* DeleteKeyword */: - case 91 /* TypeOfKeyword */: - case 93 /* VoidKeyword */: - case 33 /* PlusPlusToken */: - case 34 /* MinusMinusToken */: - case 19 /* LessThanToken */: - case 59 /* Identifier */: + case 9 /* NoSubstitutionTemplateLiteral */: + case 10 /* TemplateHead */: + case 15 /* OpenParenToken */: + case 17 /* OpenBracketToken */: + case 13 /* OpenBraceToken */: + case 81 /* FunctionKeyword */: + case 86 /* NewKeyword */: + case 35 /* SlashToken */: + case 55 /* SlashEqualsToken */: + case 32 /* PlusToken */: + case 33 /* MinusToken */: + case 46 /* TildeToken */: + case 45 /* ExclamationToken */: + case 72 /* DeleteKeyword */: + case 95 /* TypeOfKeyword */: + case 97 /* VoidKeyword */: + case 37 /* PlusPlusToken */: + case 38 /* MinusMinusToken */: + case 23 /* LessThanToken */: + case 63 /* Identifier */: return true; default: return isIdentifier(); } } - function isExpressionStatement() { - return token !== 9 /* OpenBraceToken */ && token !== 77 /* FunctionKeyword */ && isExpression(); + function isStartOfExpressionStatement() { + return token !== 13 /* OpenBraceToken */ && token !== 81 /* FunctionKeyword */ && isStartOfExpression(); } function parseExpression(noIn) { var expr = parseAssignmentExpression(noIn); - while (parseOptional(18 /* CommaToken */)) { - expr = makeBinaryExpression(expr, 18 /* CommaToken */, parseAssignmentExpression(noIn)); + while (parseOptional(22 /* CommaToken */)) { + expr = makeBinaryExpression(expr, 22 /* CommaToken */, parseAssignmentExpression(noIn)); } return expr; } function parseInitializer(inParameter, noIn) { - if (token !== 47 /* EqualsToken */) { - if (scanner.hasPrecedingLineBreak() || (inParameter && token === 9 /* OpenBraceToken */) || !isExpression()) { + if (token !== 51 /* EqualsToken */) { + if (scanner.hasPrecedingLineBreak() || (inParameter && token === 13 /* OpenBraceToken */) || !isStartOfExpression()) { return undefined; } } - parseExpected(47 /* EqualsToken */); + parseExpected(51 /* EqualsToken */); return parseAssignmentExpression(noIn); } function parseAssignmentExpression(noIn) { @@ -4223,7 +4369,7 @@ var ts; return arrowExpression; } var expr = parseConditionalExpression(noIn); - if (expr.kind === 59 /* Identifier */ && token === 27 /* EqualsGreaterThanToken */) { + if (expr.kind === 63 /* Identifier */ && token === 31 /* EqualsGreaterThanToken */) { return parseSimpleArrowFunctionExpression(expr); } if (isLeftHandSideExpression(expr) && isAssignmentOperator()) { @@ -4239,33 +4385,36 @@ var ts; function isLeftHandSideExpression(expr) { if (expr) { switch (expr.kind) { - case 138 /* PropertyAccess */: - case 139 /* IndexedAccess */: - case 141 /* NewExpression */: - case 140 /* CallExpression */: - case 135 /* ArrayLiteral */: - case 143 /* ParenExpression */: - case 136 /* ObjectLiteral */: - case 144 /* FunctionExpression */: - case 59 /* Identifier */: - case 116 /* Missing */: + case 142 /* PropertyAccess */: + case 143 /* IndexedAccess */: + case 145 /* NewExpression */: + case 144 /* CallExpression */: + case 146 /* TaggedTemplateExpression */: + case 139 /* ArrayLiteral */: + case 148 /* ParenExpression */: + case 140 /* ObjectLiteral */: + case 149 /* FunctionExpression */: + case 63 /* Identifier */: + case 120 /* Missing */: case 8 /* RegularExpressionLiteral */: case 6 /* NumericLiteral */: case 7 /* StringLiteral */: - case 74 /* FalseKeyword */: - case 83 /* NullKeyword */: - case 87 /* ThisKeyword */: - case 89 /* TrueKeyword */: - case 85 /* SuperKeyword */: + case 9 /* NoSubstitutionTemplateLiteral */: + case 155 /* TemplateExpression */: + case 78 /* FalseKeyword */: + case 87 /* NullKeyword */: + case 91 /* ThisKeyword */: + case 93 /* TrueKeyword */: + case 89 /* SuperKeyword */: return true; } } return false; } function parseSimpleArrowFunctionExpression(identifier) { - ts.Debug.assert(token === 27 /* EqualsGreaterThanToken */, "parseSimpleArrowFunctionExpression should only have been called if we had a =>"); - parseExpected(27 /* EqualsGreaterThanToken */); - var parameter = createNode(119 /* Parameter */, identifier.pos); + ts.Debug.assert(token === 31 /* EqualsGreaterThanToken */, "parseSimpleArrowFunctionExpression should only have been called if we had a =>"); + parseExpected(31 /* EqualsGreaterThanToken */); + var parameter = createNode(123 /* Parameter */, identifier.pos); parameter.name = identifier; finishNode(parameter); var parameters = []; @@ -4282,17 +4431,17 @@ var ts; } var pos = getNodePos(); if (triState === 1 /* True */) { - var sig = parseSignature(125 /* CallSignature */, 46 /* ColonToken */, false); - if (parseExpected(27 /* EqualsGreaterThanToken */) || token === 9 /* OpenBraceToken */) { + var sig = parseSignature(129 /* CallSignature */, 50 /* ColonToken */, false); + if (parseExpected(31 /* EqualsGreaterThanToken */) || token === 13 /* OpenBraceToken */) { return parseArrowExpressionTail(pos, sig, false); } else { - return makeFunctionExpression(145 /* ArrowFunction */, pos, undefined, sig, createMissingNode()); + return makeFunctionExpression(150 /* ArrowFunction */, pos, undefined, sig, createMissingNode()); } } var sig = tryParseSignatureIfArrowOrBraceFollows(); if (sig) { - parseExpected(27 /* EqualsGreaterThanToken */); + parseExpected(31 /* EqualsGreaterThanToken */); return parseArrowExpressionTail(pos, sig, false); } else { @@ -4300,35 +4449,35 @@ var ts; } } function isParenthesizedArrowFunctionExpression() { - if (token === 11 /* OpenParenToken */ || token === 19 /* LessThanToken */) { + if (token === 15 /* OpenParenToken */ || token === 23 /* LessThanToken */) { return lookAhead(function () { var first = token; var second = nextToken(); - if (first === 11 /* OpenParenToken */) { - if (second === 12 /* CloseParenToken */) { + if (first === 15 /* OpenParenToken */) { + if (second === 16 /* CloseParenToken */) { var third = nextToken(); switch (third) { - case 27 /* EqualsGreaterThanToken */: - case 46 /* ColonToken */: - case 9 /* OpenBraceToken */: + case 31 /* EqualsGreaterThanToken */: + case 50 /* ColonToken */: + case 13 /* OpenBraceToken */: return 1 /* True */; default: return 0 /* False */; } } - if (second === 16 /* DotDotDotToken */) { + if (second === 20 /* DotDotDotToken */) { return 1 /* True */; } if (!isIdentifier()) { return 0 /* False */; } - if (nextToken() === 46 /* ColonToken */) { + if (nextToken() === 50 /* ColonToken */) { return 1 /* True */; } return 2 /* Unknown */; } else { - ts.Debug.assert(first === 19 /* LessThanToken */); + ts.Debug.assert(first === 23 /* LessThanToken */); if (!isIdentifier()) { return 0 /* False */; } @@ -4336,15 +4485,15 @@ var ts; } }); } - if (token === 27 /* EqualsGreaterThanToken */) { + if (token === 31 /* EqualsGreaterThanToken */) { return 1 /* True */; } return 0 /* False */; } function tryParseSignatureIfArrowOrBraceFollows() { return tryParse(function () { - var sig = parseSignature(125 /* CallSignature */, 46 /* ColonToken */, false); - if (token === 27 /* EqualsGreaterThanToken */ || token === 9 /* OpenBraceToken */) { + var sig = parseSignature(129 /* CallSignature */, 50 /* ColonToken */, false); + if (token === 31 /* EqualsGreaterThanToken */ || token === 13 /* OpenBraceToken */) { return sig; } return undefined; @@ -4352,27 +4501,27 @@ var ts; } function parseArrowExpressionTail(pos, sig, noIn) { var body; - if (token === 9 /* OpenBraceToken */) { + if (token === 13 /* OpenBraceToken */) { body = parseBody(false); } - else if (isStatement(true) && !isExpressionStatement() && token !== 77 /* FunctionKeyword */) { + else if (isStatement(true) && !isStartOfExpressionStatement() && token !== 81 /* FunctionKeyword */) { body = parseBody(true); } else { body = parseAssignmentExpression(noIn); } - return makeFunctionExpression(145 /* ArrowFunction */, pos, undefined, sig, body); + return makeFunctionExpression(150 /* ArrowFunction */, pos, undefined, sig, body); } function isAssignmentOperator() { return token >= ts.SyntaxKind.FirstAssignment && token <= ts.SyntaxKind.LastAssignment; } function parseConditionalExpression(noIn) { var expr = parseBinaryExpression(noIn); - while (parseOptional(45 /* QuestionToken */)) { - var node = createNode(149 /* ConditionalExpression */, expr.pos); + while (parseOptional(49 /* QuestionToken */)) { + var node = createNode(154 /* ConditionalExpression */, expr.pos); node.condition = expr; node.whenTrue = parseAssignmentExpression(false); - parseExpected(46 /* ColonToken */); + parseExpected(50 /* ColonToken */); node.whenFalse = parseAssignmentExpression(noIn); expr = finishNode(node); } @@ -4385,7 +4534,7 @@ var ts; while (true) { reScanGreaterToken(); var precedence = getOperatorPrecedence(); - if (precedence && precedence > minPrecedence && (!noIn || token !== 80 /* InKeyword */)) { + if (precedence && precedence > minPrecedence && (!noIn || token !== 84 /* InKeyword */)) { var operator = token; nextToken(); expr = makeBinaryExpression(expr, operator, parseBinaryOperators(parseUnaryExpression(), precedence, noIn)); @@ -4396,44 +4545,44 @@ var ts; } function getOperatorPrecedence() { switch (token) { - case 44 /* BarBarToken */: + case 48 /* BarBarToken */: return 1; - case 43 /* AmpersandAmpersandToken */: + case 47 /* AmpersandAmpersandToken */: return 2; - case 39 /* BarToken */: + case 43 /* BarToken */: return 3; - case 40 /* CaretToken */: + case 44 /* CaretToken */: return 4; - case 38 /* AmpersandToken */: + case 42 /* AmpersandToken */: return 5; - case 23 /* EqualsEqualsToken */: - case 24 /* ExclamationEqualsToken */: - case 25 /* EqualsEqualsEqualsToken */: - case 26 /* ExclamationEqualsEqualsToken */: + case 27 /* EqualsEqualsToken */: + case 28 /* ExclamationEqualsToken */: + case 29 /* EqualsEqualsEqualsToken */: + case 30 /* ExclamationEqualsEqualsToken */: return 6; - case 19 /* LessThanToken */: - case 20 /* GreaterThanToken */: - case 21 /* LessThanEqualsToken */: - case 22 /* GreaterThanEqualsToken */: - case 81 /* InstanceOfKeyword */: - case 80 /* InKeyword */: + case 23 /* LessThanToken */: + case 24 /* GreaterThanToken */: + case 25 /* LessThanEqualsToken */: + case 26 /* GreaterThanEqualsToken */: + case 85 /* InstanceOfKeyword */: + case 84 /* InKeyword */: return 7; - case 35 /* LessThanLessThanToken */: - case 36 /* GreaterThanGreaterThanToken */: - case 37 /* GreaterThanGreaterThanGreaterThanToken */: + case 39 /* LessThanLessThanToken */: + case 40 /* GreaterThanGreaterThanToken */: + case 41 /* GreaterThanGreaterThanGreaterThanToken */: return 8; - case 28 /* PlusToken */: - case 29 /* MinusToken */: + case 32 /* PlusToken */: + case 33 /* MinusToken */: return 9; - case 30 /* AsteriskToken */: - case 31 /* SlashToken */: - case 32 /* PercentToken */: + case 34 /* AsteriskToken */: + case 35 /* SlashToken */: + case 36 /* PercentToken */: return 10; } return undefined; } function makeBinaryExpression(left, operator, right) { - var node = createNode(148 /* BinaryExpression */, left.pos); + var node = createNode(153 /* BinaryExpression */, left.pos); node.left = left; node.operator = operator; node.right = right; @@ -4442,52 +4591,52 @@ var ts; function parseUnaryExpression() { var pos = getNodePos(); switch (token) { - case 28 /* PlusToken */: - case 29 /* MinusToken */: - case 42 /* TildeToken */: - case 41 /* ExclamationToken */: - case 68 /* DeleteKeyword */: - case 91 /* TypeOfKeyword */: - case 93 /* VoidKeyword */: - case 33 /* PlusPlusToken */: - case 34 /* MinusMinusToken */: + case 32 /* PlusToken */: + case 33 /* MinusToken */: + case 46 /* TildeToken */: + case 45 /* ExclamationToken */: + case 72 /* DeleteKeyword */: + case 95 /* TypeOfKeyword */: + case 97 /* VoidKeyword */: + case 37 /* PlusPlusToken */: + case 38 /* MinusMinusToken */: var operator = token; nextToken(); var operand = parseUnaryExpression(); if (isInStrictMode) { - if ((operator === 33 /* PlusPlusToken */ || operator === 34 /* MinusMinusToken */) && isEvalOrArgumentsIdentifier(operand)) { + if ((operator === 37 /* PlusPlusToken */ || operator === 38 /* MinusMinusToken */) && isEvalOrArgumentsIdentifier(operand)) { reportInvalidUseInStrictMode(operand); } - else if (operator === 68 /* DeleteKeyword */ && operand.kind === 59 /* Identifier */) { + else if (operator === 72 /* DeleteKeyword */ && operand.kind === 63 /* Identifier */) { grammarErrorOnNode(operand, ts.Diagnostics.delete_cannot_be_called_on_an_identifier_in_strict_mode); } } - return makeUnaryExpression(146 /* PrefixOperator */, pos, operator, operand); - case 19 /* LessThanToken */: + return makeUnaryExpression(151 /* PrefixOperator */, pos, operator, operand); + case 23 /* LessThanToken */: return parseTypeAssertion(); } var primaryExpression = parsePrimaryExpression(); - var illegalUsageOfSuperKeyword = primaryExpression.kind === 85 /* SuperKeyword */ && token !== 11 /* OpenParenToken */ && token !== 15 /* DotToken */; + var illegalUsageOfSuperKeyword = primaryExpression.kind === 89 /* SuperKeyword */ && token !== 15 /* OpenParenToken */ && token !== 19 /* DotToken */; if (illegalUsageOfSuperKeyword) { error(ts.Diagnostics.super_must_be_followed_by_an_argument_list_or_member_access); } var expr = parseCallAndAccess(primaryExpression, false); ts.Debug.assert(isLeftHandSideExpression(expr)); - if ((token === 33 /* PlusPlusToken */ || token === 34 /* MinusMinusToken */) && !scanner.hasPrecedingLineBreak()) { + if ((token === 37 /* PlusPlusToken */ || token === 38 /* MinusMinusToken */) && !scanner.hasPrecedingLineBreak()) { if (isInStrictMode && isEvalOrArgumentsIdentifier(expr)) { reportInvalidUseInStrictMode(expr); } var operator = token; nextToken(); - expr = makeUnaryExpression(147 /* PostfixOperator */, expr.pos, operator, expr); + expr = makeUnaryExpression(152 /* PostfixOperator */, expr.pos, operator, expr); } return expr; } function parseTypeAssertion() { - var node = createNode(142 /* TypeAssertion */); - parseExpected(19 /* LessThanToken */); + var node = createNode(147 /* TypeAssertion */); + parseExpected(23 /* LessThanToken */); node.type = parseType(); - parseExpected(20 /* GreaterThanToken */); + parseExpected(24 /* GreaterThanToken */); node.operand = parseUnaryExpression(); return finishNode(node); } @@ -4499,11 +4648,11 @@ var ts; } function parseCallAndAccess(expr, inNewExpression) { while (true) { - var dotStart = scanner.getTokenPos(); - if (parseOptional(15 /* DotToken */)) { - var propertyAccess = createNode(138 /* PropertyAccess */, expr.pos); + var dotOrBracketStart = scanner.getTokenPos(); + if (parseOptional(19 /* DotToken */)) { + var propertyAccess = createNode(142 /* PropertyAccess */, expr.pos); if (scanner.hasPrecedingLineBreak() && scanner.isReservedWord() && lookAhead(function () { return scanner.isReservedWord(); })) { - grammarErrorAtPos(dotStart, scanner.getStartPos() - dotStart, ts.Diagnostics.Identifier_expected); + grammarErrorAtPos(dotOrBracketStart, scanner.getStartPos() - dotOrBracketStart, ts.Diagnostics.Identifier_expected); var id = createMissingNode(); } else { @@ -4514,13 +4663,12 @@ var ts; expr = finishNode(propertyAccess); continue; } - var bracketStart = scanner.getTokenPos(); - if (parseOptional(13 /* OpenBracketToken */)) { - var indexedAccess = createNode(139 /* IndexedAccess */, expr.pos); + if (parseOptional(17 /* OpenBracketToken */)) { + var indexedAccess = createNode(143 /* IndexedAccess */, expr.pos); indexedAccess.object = expr; - if (inNewExpression && parseOptional(14 /* CloseBracketToken */)) { + if (inNewExpression && parseOptional(18 /* CloseBracketToken */)) { indexedAccess.index = createMissingNode(); - grammarErrorAtPos(bracketStart, scanner.getStartPos() - bracketStart, ts.Diagnostics.new_T_cannot_be_used_to_create_an_array_Use_new_Array_T_instead); + grammarErrorAtPos(dotOrBracketStart, scanner.getStartPos() - dotOrBracketStart, ts.Diagnostics.new_T_cannot_be_used_to_create_an_array_Use_new_Array_T_instead); } else { indexedAccess.index = parseExpression(); @@ -4528,79 +4676,92 @@ var ts; var literal = indexedAccess.index; literal.text = internIdentifier(literal.text); } - parseExpected(14 /* CloseBracketToken */); + parseExpected(18 /* CloseBracketToken */); } expr = finishNode(indexedAccess); continue; } - if ((token === 11 /* OpenParenToken */ || token === 19 /* LessThanToken */) && !inNewExpression) { - var callExpr = createNode(140 /* CallExpression */, expr.pos); + if ((token === 15 /* OpenParenToken */ || token === 23 /* LessThanToken */) && !inNewExpression) { + var callExpr = createNode(144 /* CallExpression */, expr.pos); callExpr.func = expr; - if (token === 19 /* LessThanToken */) { + if (token === 23 /* LessThanToken */) { if (!(callExpr.typeArguments = tryParse(parseTypeArgumentsAndOpenParen))) return expr; } else { - parseExpected(11 /* OpenParenToken */); + parseExpected(15 /* OpenParenToken */); } callExpr.arguments = parseDelimitedList(10 /* ArgumentExpressions */, parseArgumentExpression, false); - parseExpected(12 /* CloseParenToken */); + parseExpected(16 /* CloseParenToken */); expr = finishNode(callExpr); continue; } + if (token === 9 /* NoSubstitutionTemplateLiteral */ || token === 10 /* TemplateHead */) { + var tagExpression = createNode(146 /* TaggedTemplateExpression */, expr.pos); + tagExpression.tag = expr; + tagExpression.template = token === 9 /* NoSubstitutionTemplateLiteral */ ? parseLiteralNode() : parseTemplateExpression(); + expr = finishNode(tagExpression); + if (languageVersion < 2 /* ES6 */) { + grammarErrorOnNode(expr, ts.Diagnostics.Tagged_templates_are_only_available_when_targeting_ECMAScript_6_and_higher); + } + continue; + } return expr; } } function parseTypeArgumentsAndOpenParen() { var result = parseTypeArguments(); - parseExpected(11 /* OpenParenToken */); + parseExpected(15 /* OpenParenToken */); return result; } function parseTypeArguments() { var typeArgumentListStart = scanner.getTokenPos(); var errorCountBeforeTypeParameterList = file.syntacticErrors.length; - var result = parseBracketedList(15 /* TypeArguments */, parseSingleTypeArgument, 19 /* LessThanToken */, 20 /* GreaterThanToken */); + var result = parseBracketedList(15 /* TypeArguments */, parseSingleTypeArgument, 23 /* LessThanToken */, 24 /* GreaterThanToken */); if (!result.length && file.syntacticErrors.length === errorCountBeforeTypeParameterList) { grammarErrorAtPos(typeArgumentListStart, scanner.getStartPos() - typeArgumentListStart, ts.Diagnostics.Type_argument_list_cannot_be_empty); } return result; } function parseSingleTypeArgument() { - if (token === 18 /* CommaToken */) { + if (token === 22 /* CommaToken */) { var errorStart = scanner.getTokenPos(); var errorLength = scanner.getTextPos() - errorStart; grammarErrorAtPos(errorStart, errorLength, ts.Diagnostics.Type_expected); - return createNode(116 /* Missing */); + return createNode(120 /* Missing */); } return parseType(); } function parsePrimaryExpression() { switch (token) { - case 87 /* ThisKeyword */: - case 85 /* SuperKeyword */: - case 83 /* NullKeyword */: - case 89 /* TrueKeyword */: - case 74 /* FalseKeyword */: + case 91 /* ThisKeyword */: + case 89 /* SuperKeyword */: + case 87 /* NullKeyword */: + case 93 /* TrueKeyword */: + case 78 /* FalseKeyword */: return parseTokenNode(); case 6 /* NumericLiteral */: case 7 /* StringLiteral */: + case 9 /* NoSubstitutionTemplateLiteral */: return parseLiteralNode(); - case 11 /* OpenParenToken */: + case 15 /* OpenParenToken */: return parseParenExpression(); - case 13 /* OpenBracketToken */: + case 17 /* OpenBracketToken */: return parseArrayLiteral(); - case 9 /* OpenBraceToken */: + case 13 /* OpenBraceToken */: return parseObjectLiteral(); - case 77 /* FunctionKeyword */: + case 81 /* FunctionKeyword */: return parseFunctionExpression(); - case 82 /* NewKeyword */: + case 86 /* NewKeyword */: return parseNewExpression(); - case 31 /* SlashToken */: - case 51 /* SlashEqualsToken */: + case 35 /* SlashToken */: + case 55 /* SlashEqualsToken */: if (reScanSlashToken() === 8 /* RegularExpressionLiteral */) { return parseLiteralNode(); } break; + case 10 /* TemplateHead */: + return parseTemplateExpression(); default: if (isIdentifier()) { return parseIdentifier(); @@ -4610,20 +4771,20 @@ var ts; return createMissingNode(); } function parseParenExpression() { - var node = createNode(143 /* ParenExpression */); - parseExpected(11 /* OpenParenToken */); + var node = createNode(148 /* ParenExpression */); + parseExpected(15 /* OpenParenToken */); node.expression = parseExpression(); - parseExpected(12 /* CloseParenToken */); + parseExpected(16 /* CloseParenToken */); return finishNode(node); } function parseAssignmentExpressionOrOmittedExpression(omittedExpressionDiagnostic) { - if (token === 18 /* CommaToken */) { + if (token === 22 /* CommaToken */) { if (omittedExpressionDiagnostic) { var errorStart = scanner.getTokenPos(); var errorLength = scanner.getTextPos() - errorStart; grammarErrorAtPos(errorStart, errorLength, omittedExpressionDiagnostic); } - return createNode(150 /* OmittedExpression */); + return createNode(157 /* OmittedExpression */); } return parseAssignmentExpression(); } @@ -4634,24 +4795,24 @@ var ts; return parseAssignmentExpressionOrOmittedExpression(ts.Diagnostics.Argument_expression_expected); } function parseArrayLiteral() { - var node = createNode(135 /* ArrayLiteral */); - parseExpected(13 /* OpenBracketToken */); + var node = createNode(139 /* ArrayLiteral */); + parseExpected(17 /* OpenBracketToken */); if (scanner.hasPrecedingLineBreak()) node.flags |= 256 /* MultiLine */; node.elements = parseDelimitedList(12 /* ArrayLiteralMembers */, parseArrayLiteralElement, true); - parseExpected(14 /* CloseBracketToken */); + parseExpected(18 /* CloseBracketToken */); return finishNode(node); } function parsePropertyAssignment() { - var node = createNode(137 /* PropertyAssignment */); + var node = createNode(141 /* PropertyAssignment */); node.name = parsePropertyName(); - if (token === 11 /* OpenParenToken */ || token === 19 /* LessThanToken */) { - var sig = parseSignature(125 /* CallSignature */, 46 /* ColonToken */, false); + if (token === 15 /* OpenParenToken */ || token === 23 /* LessThanToken */) { + var sig = parseSignature(129 /* CallSignature */, 50 /* ColonToken */, false); var body = parseBody(false); - node.initializer = makeFunctionExpression(144 /* FunctionExpression */, node.pos, undefined, sig, body); + node.initializer = makeFunctionExpression(149 /* FunctionExpression */, node.pos, undefined, sig, body); } else { - parseExpected(46 /* ColonToken */); + parseExpected(50 /* ColonToken */); node.initializer = parseAssignmentExpression(false); } return finishNode(node); @@ -4659,37 +4820,37 @@ var ts; function parseObjectLiteralMember() { var initialPos = getNodePos(); var initialToken = token; - if (parseContextualModifier(109 /* GetKeyword */) || parseContextualModifier(113 /* SetKeyword */)) { - var kind = initialToken === 109 /* GetKeyword */ ? 123 /* GetAccessor */ : 124 /* SetAccessor */; + if (parseContextualModifier(113 /* GetKeyword */) || parseContextualModifier(117 /* SetKeyword */)) { + var kind = initialToken === 113 /* GetKeyword */ ? 127 /* GetAccessor */ : 128 /* SetAccessor */; return parseAndCheckMemberAccessorDeclaration(kind, initialPos, 0); } return parsePropertyAssignment(); } function parseObjectLiteral() { - var node = createNode(136 /* ObjectLiteral */); - parseExpected(9 /* OpenBraceToken */); + var node = createNode(140 /* ObjectLiteral */); + parseExpected(13 /* OpenBraceToken */); if (scanner.hasPrecedingLineBreak()) { node.flags |= 256 /* MultiLine */; } node.properties = parseDelimitedList(11 /* ObjectLiteralMembers */, parseObjectLiteralMember, true); - parseExpected(10 /* CloseBraceToken */); + parseExpected(14 /* CloseBraceToken */); var seen = {}; var Property = 1; var GetAccessor = 2; var SetAccesor = 4; var GetOrSetAccessor = GetAccessor | SetAccesor; ts.forEach(node.properties, function (p) { - if (p.kind === 150 /* OmittedExpression */) { + if (p.kind === 157 /* OmittedExpression */) { return; } var currentKind; - if (p.kind === 137 /* PropertyAssignment */) { + if (p.kind === 141 /* PropertyAssignment */) { currentKind = Property; } - else if (p.kind === 123 /* GetAccessor */) { + else if (p.kind === 127 /* GetAccessor */) { currentKind = GetAccessor; } - else if (p.kind === 124 /* SetAccessor */) { + else if (p.kind === 128 /* SetAccessor */) { currentKind = SetAccesor; } else { @@ -4722,14 +4883,14 @@ var ts; } function parseFunctionExpression() { var pos = getNodePos(); - parseExpected(77 /* FunctionKeyword */); + parseExpected(81 /* FunctionKeyword */); var name = isIdentifier() ? parseIdentifier() : undefined; - var sig = parseSignature(125 /* CallSignature */, 46 /* ColonToken */, false); + var sig = parseSignature(129 /* CallSignature */, 50 /* ColonToken */, false); var body = parseBody(false); if (name && isInStrictMode && isEvalOrArgumentsIdentifier(name)) { reportInvalidUseInStrictMode(name); } - return makeFunctionExpression(144 /* FunctionExpression */, pos, name, sig, body); + return makeFunctionExpression(149 /* FunctionExpression */, pos, name, sig, body); } function makeFunctionExpression(kind, pos, name, sig, body) { var node = createNode(kind, pos); @@ -4741,12 +4902,12 @@ var ts; return finishNode(node); } function parseNewExpression() { - var node = createNode(141 /* NewExpression */); - parseExpected(82 /* NewKeyword */); + var node = createNode(145 /* NewExpression */); + parseExpected(86 /* NewKeyword */); node.func = parseCallAndAccess(parsePrimaryExpression(), true); - if (parseOptional(11 /* OpenParenToken */) || token === 19 /* LessThanToken */ && (node.typeArguments = tryParse(parseTypeArgumentsAndOpenParen))) { + if (parseOptional(15 /* OpenParenToken */) || token === 23 /* LessThanToken */ && (node.typeArguments = tryParse(parseTypeArgumentsAndOpenParen))) { node.arguments = parseDelimitedList(10 /* ArgumentExpressions */, parseArgumentExpression, false); - parseExpected(12 /* CloseParenToken */); + parseExpected(16 /* CloseParenToken */); } return finishNode(node); } @@ -4754,10 +4915,10 @@ var ts; return parseStatement(true); } function parseBlock(ignoreMissingOpenBrace, checkForStrictMode) { - var node = createNode(151 /* Block */); - if (parseExpected(9 /* OpenBraceToken */) || ignoreMissingOpenBrace) { + var node = createNode(158 /* Block */); + if (parseExpected(13 /* OpenBraceToken */) || ignoreMissingOpenBrace) { node.statements = parseList(2 /* BlockStatements */, checkForStrictMode, parseStatementAllowingLetDeclaration); - parseExpected(10 /* CloseBraceToken */); + parseExpected(14 /* CloseBraceToken */); } else { node.statements = createMissingList(); @@ -4777,7 +4938,7 @@ var ts; } labelledStatementInfo.pushFunctionBoundary(); var block = parseBlock(ignoreMissingOpenBrace, true); - block.kind = 176 /* FunctionBlock */; + block.kind = 183 /* FunctionBlock */; labelledStatementInfo.pop(); inFunctionBody = saveInFunctionBody; inSwitchStatement = saveInSwitchStatement; @@ -4785,40 +4946,40 @@ var ts; return block; } function parseEmptyStatement() { - var node = createNode(153 /* EmptyStatement */); - parseExpected(17 /* SemicolonToken */); + var node = createNode(160 /* EmptyStatement */); + parseExpected(21 /* SemicolonToken */); return finishNode(node); } function parseIfStatement() { - var node = createNode(155 /* IfStatement */); - parseExpected(78 /* IfKeyword */); - parseExpected(11 /* OpenParenToken */); + var node = createNode(162 /* IfStatement */); + parseExpected(82 /* IfKeyword */); + parseExpected(15 /* OpenParenToken */); node.expression = parseExpression(); - parseExpected(12 /* CloseParenToken */); + parseExpected(16 /* CloseParenToken */); node.thenStatement = parseStatement(false); - node.elseStatement = parseOptional(70 /* ElseKeyword */) ? parseStatement(false) : undefined; + node.elseStatement = parseOptional(74 /* ElseKeyword */) ? parseStatement(false) : undefined; return finishNode(node); } function parseDoStatement() { - var node = createNode(156 /* DoStatement */); - parseExpected(69 /* DoKeyword */); + var node = createNode(163 /* DoStatement */); + parseExpected(73 /* DoKeyword */); var saveInIterationStatement = inIterationStatement; inIterationStatement = 1 /* Nested */; node.statement = parseStatement(false); inIterationStatement = saveInIterationStatement; - parseExpected(94 /* WhileKeyword */); - parseExpected(11 /* OpenParenToken */); + parseExpected(98 /* WhileKeyword */); + parseExpected(15 /* OpenParenToken */); node.expression = parseExpression(); - parseExpected(12 /* CloseParenToken */); - parseOptional(17 /* SemicolonToken */); + parseExpected(16 /* CloseParenToken */); + parseOptional(21 /* SemicolonToken */); return finishNode(node); } function parseWhileStatement() { - var node = createNode(157 /* WhileStatement */); - parseExpected(94 /* WhileKeyword */); - parseExpected(11 /* OpenParenToken */); + var node = createNode(164 /* WhileStatement */); + parseExpected(98 /* WhileKeyword */); + parseExpected(15 /* OpenParenToken */); node.expression = parseExpression(); - parseExpected(12 /* CloseParenToken */); + parseExpected(16 /* CloseParenToken */); var saveInIterationStatement = inIterationStatement; inIterationStatement = 1 /* Nested */; node.statement = parseStatement(false); @@ -4827,16 +4988,16 @@ var ts; } function parseForOrForInStatement() { var pos = getNodePos(); - parseExpected(76 /* ForKeyword */); - parseExpected(11 /* OpenParenToken */); - if (token !== 17 /* SemicolonToken */) { - if (parseOptional(92 /* VarKeyword */)) { + parseExpected(80 /* ForKeyword */); + parseExpected(15 /* OpenParenToken */); + if (token !== 21 /* SemicolonToken */) { + if (parseOptional(96 /* VarKeyword */)) { var declarations = parseVariableDeclarationList(0, true); if (!declarations.length) { error(ts.Diagnostics.Variable_declaration_list_cannot_be_empty); } } - else if (parseOptional(98 /* LetKeyword */)) { + else if (parseOptional(102 /* LetKeyword */)) { var declarations = parseVariableDeclarationList(2048 /* Let */, true); if (!declarations.length) { error(ts.Diagnostics.Variable_declaration_list_cannot_be_empty); @@ -4845,7 +5006,7 @@ var ts; grammarErrorAtPos(declarations.pos, declarations.end - declarations.pos, ts.Diagnostics.let_declarations_are_only_available_when_targeting_ECMAScript_6_and_higher); } } - else if (parseOptional(64 /* ConstKeyword */)) { + else if (parseOptional(68 /* ConstKeyword */)) { var declarations = parseVariableDeclarationList(4096 /* Const */, true); if (!declarations.length) { error(ts.Diagnostics.Variable_declaration_list_cannot_be_empty); @@ -4859,8 +5020,8 @@ var ts; } } var forOrForInStatement; - if (parseOptional(80 /* InKeyword */)) { - var forInStatement = createNode(159 /* ForInStatement */, pos); + if (parseOptional(84 /* InKeyword */)) { + var forInStatement = createNode(166 /* ForInStatement */, pos); if (declarations) { if (declarations.length > 1) { error(ts.Diagnostics.Only_a_single_variable_declaration_is_allowed_in_a_for_in_statement); @@ -4871,24 +5032,24 @@ var ts; forInStatement.variable = varOrInit; } forInStatement.expression = parseExpression(); - parseExpected(12 /* CloseParenToken */); + parseExpected(16 /* CloseParenToken */); forOrForInStatement = forInStatement; } else { - var forStatement = createNode(158 /* ForStatement */, pos); + var forStatement = createNode(165 /* ForStatement */, pos); if (declarations) forStatement.declarations = declarations; if (varOrInit) forStatement.initializer = varOrInit; - parseExpected(17 /* SemicolonToken */); - if (token !== 17 /* SemicolonToken */ && token !== 12 /* CloseParenToken */) { + parseExpected(21 /* SemicolonToken */); + if (token !== 21 /* SemicolonToken */ && token !== 16 /* CloseParenToken */) { forStatement.condition = parseExpression(); } - parseExpected(17 /* SemicolonToken */); - if (token !== 12 /* CloseParenToken */) { + parseExpected(21 /* SemicolonToken */); + if (token !== 16 /* CloseParenToken */) { forStatement.iterator = parseExpression(); } - parseExpected(12 /* CloseParenToken */); + parseExpected(16 /* CloseParenToken */); forOrForInStatement = forStatement; } var saveInIterationStatement = inIterationStatement; @@ -4900,7 +5061,7 @@ var ts; function parseBreakOrContinueStatement(kind) { var node = createNode(kind); var errorCountBeforeStatement = file.syntacticErrors.length; - parseExpected(kind === 161 /* BreakStatement */ ? 60 /* BreakKeyword */ : 65 /* ContinueKeyword */); + parseExpected(kind === 168 /* BreakStatement */ ? 64 /* BreakKeyword */ : 69 /* ContinueKeyword */); if (!canParseSemicolon()) node.label = parseIdentifier(); parseSemicolon(); @@ -4916,7 +5077,7 @@ var ts; return node; } function checkBareBreakOrContinueStatement(node) { - if (node.kind === 161 /* BreakStatement */) { + if (node.kind === 168 /* BreakStatement */) { if (inIterationStatement === 1 /* Nested */ || inSwitchStatement === 1 /* Nested */) { return; } @@ -4925,7 +5086,7 @@ var ts; return; } } - else if (node.kind === 160 /* ContinueStatement */) { + else if (node.kind === 167 /* ContinueStatement */) { if (inIterationStatement === 1 /* Nested */) { return; } @@ -4941,7 +5102,7 @@ var ts; grammarErrorOnNode(node, ts.Diagnostics.Jump_target_cannot_cross_function_boundary); } function checkBreakOrContinueStatementWithLabel(node) { - var nodeIsNestedInLabel = labelledStatementInfo.nodeIsNestedInLabel(node.label, node.kind === 160 /* ContinueStatement */, false); + var nodeIsNestedInLabel = labelledStatementInfo.nodeIsNestedInLabel(node.label, node.kind === 167 /* ContinueStatement */, false); if (nodeIsNestedInLabel === 1 /* Nested */) { return; } @@ -4949,10 +5110,10 @@ var ts; grammarErrorOnNode(node, ts.Diagnostics.Jump_target_cannot_cross_function_boundary); return; } - if (node.kind === 160 /* ContinueStatement */) { + if (node.kind === 167 /* ContinueStatement */) { grammarErrorOnNode(node, ts.Diagnostics.A_continue_statement_can_only_jump_to_a_label_of_an_enclosing_iteration_statement); } - else if (node.kind === 161 /* BreakStatement */) { + else if (node.kind === 168 /* BreakStatement */) { grammarErrorOnNode(node, ts.Diagnostics.A_break_statement_can_only_jump_to_a_label_of_an_enclosing_statement); } else { @@ -4960,11 +5121,11 @@ var ts; } } function parseReturnStatement() { - var node = createNode(162 /* ReturnStatement */); + var node = createNode(169 /* ReturnStatement */); var errorCountBeforeReturnStatement = file.syntacticErrors.length; var returnTokenStart = scanner.getTokenPos(); var returnTokenLength = scanner.getTextPos() - returnTokenStart; - parseExpected(84 /* ReturnKeyword */); + parseExpected(88 /* ReturnKeyword */); if (!canParseSemicolon()) node.expression = parseExpression(); parseSemicolon(); @@ -4974,13 +5135,13 @@ var ts; return finishNode(node); } function parseWithStatement() { - var node = createNode(163 /* WithStatement */); + var node = createNode(170 /* WithStatement */); var startPos = scanner.getTokenPos(); - parseExpected(95 /* WithKeyword */); + parseExpected(99 /* WithKeyword */); var endPos = scanner.getStartPos(); - parseExpected(11 /* OpenParenToken */); + parseExpected(15 /* OpenParenToken */); node.expression = parseExpression(); - parseExpected(12 /* CloseParenToken */); + parseExpected(16 /* CloseParenToken */); node.statement = parseStatement(false); node = finishNode(node); if (isInStrictMode) { @@ -4989,36 +5150,36 @@ var ts; return node; } function parseCaseClause() { - var node = createNode(165 /* CaseClause */); - parseExpected(61 /* CaseKeyword */); + var node = createNode(172 /* CaseClause */); + parseExpected(65 /* CaseKeyword */); node.expression = parseExpression(); - parseExpected(46 /* ColonToken */); + parseExpected(50 /* ColonToken */); node.statements = parseList(4 /* SwitchClauseStatements */, false, parseStatementAllowingLetDeclaration); return finishNode(node); } function parseDefaultClause() { - var node = createNode(166 /* DefaultClause */); - parseExpected(67 /* DefaultKeyword */); - parseExpected(46 /* ColonToken */); + var node = createNode(173 /* DefaultClause */); + parseExpected(71 /* DefaultKeyword */); + parseExpected(50 /* ColonToken */); node.statements = parseList(4 /* SwitchClauseStatements */, false, parseStatementAllowingLetDeclaration); return finishNode(node); } function parseCaseOrDefaultClause() { - return token === 61 /* CaseKeyword */ ? parseCaseClause() : parseDefaultClause(); + return token === 65 /* CaseKeyword */ ? parseCaseClause() : parseDefaultClause(); } function parseSwitchStatement() { - var node = createNode(164 /* SwitchStatement */); - parseExpected(86 /* SwitchKeyword */); - parseExpected(11 /* OpenParenToken */); + var node = createNode(171 /* SwitchStatement */); + parseExpected(90 /* SwitchKeyword */); + parseExpected(15 /* OpenParenToken */); node.expression = parseExpression(); - parseExpected(12 /* CloseParenToken */); - parseExpected(9 /* OpenBraceToken */); + parseExpected(16 /* CloseParenToken */); + parseExpected(13 /* OpenBraceToken */); var saveInSwitchStatement = inSwitchStatement; inSwitchStatement = 1 /* Nested */; node.clauses = parseList(3 /* SwitchClauses */, false, parseCaseOrDefaultClause); inSwitchStatement = saveInSwitchStatement; - parseExpected(10 /* CloseBraceToken */); - var defaultClauses = ts.filter(node.clauses, function (clause) { return clause.kind === 166 /* DefaultClause */; }); + parseExpected(14 /* CloseBraceToken */); + var defaultClauses = ts.filter(node.clauses, function (clause) { return clause.kind === 173 /* DefaultClause */; }); for (var i = 1, n = defaultClauses.length; i < n; i++) { var clause = defaultClauses[i]; var start = ts.skipTrivia(file.text, clause.pos); @@ -5028,8 +5189,8 @@ var ts; return finishNode(node); } function parseThrowStatement() { - var node = createNode(168 /* ThrowStatement */); - parseExpected(88 /* ThrowKeyword */); + var node = createNode(175 /* ThrowStatement */); + parseExpected(92 /* ThrowKeyword */); if (scanner.hasPrecedingLineBreak()) { error(ts.Diagnostics.Line_break_not_permitted_here); } @@ -5038,13 +5199,13 @@ var ts; return finishNode(node); } function parseTryStatement() { - var node = createNode(169 /* TryStatement */); - node.tryBlock = parseTokenAndBlock(90 /* TryKeyword */, 170 /* TryBlock */); - if (token === 62 /* CatchKeyword */) { + var node = createNode(176 /* TryStatement */); + node.tryBlock = parseTokenAndBlock(94 /* TryKeyword */, 177 /* TryBlock */); + if (token === 66 /* CatchKeyword */) { node.catchBlock = parseCatchBlock(); } - if (token === 75 /* FinallyKeyword */) { - node.finallyBlock = parseTokenAndBlock(75 /* FinallyKeyword */, 172 /* FinallyBlock */); + if (token === 79 /* FinallyKeyword */) { + node.finallyBlock = parseTokenAndBlock(79 /* FinallyKeyword */, 179 /* FinallyBlock */); } if (!(node.catchBlock || node.finallyBlock)) { error(ts.Diagnostics.catch_or_finally_expected); @@ -5061,15 +5222,15 @@ var ts; } function parseCatchBlock() { var pos = getNodePos(); - parseExpected(62 /* CatchKeyword */); - parseExpected(11 /* OpenParenToken */); + parseExpected(66 /* CatchKeyword */); + parseExpected(15 /* OpenParenToken */); var variable = parseIdentifier(); var typeAnnotationColonStart = scanner.getTokenPos(); var typeAnnotationColonLength = scanner.getTextPos() - typeAnnotationColonStart; var typeAnnotation = parseTypeAnnotation(); - parseExpected(12 /* CloseParenToken */); + parseExpected(16 /* CloseParenToken */); var result = parseBlock(false, false); - result.kind = 171 /* CatchBlock */; + result.kind = 178 /* CatchBlock */; result.pos = pos; result.variable = variable; if (typeAnnotation) { @@ -5081,13 +5242,13 @@ var ts; return result; } function parseDebuggerStatement() { - var node = createNode(173 /* DebuggerStatement */); - parseExpected(66 /* DebuggerKeyword */); + var node = createNode(180 /* DebuggerStatement */); + parseExpected(70 /* DebuggerKeyword */); parseSemicolon(); return finishNode(node); } function isIterationStatementStart() { - return token === 94 /* WhileKeyword */ || token === 69 /* DoKeyword */ || token === 76 /* ForKeyword */; + return token === 98 /* WhileKeyword */ || token === 73 /* DoKeyword */ || token === 80 /* ForKeyword */; } function parseStatementWithLabelSet(allowLetAndConstDeclarations) { labelledStatementInfo.pushCurrentLabelSet(isIterationStatementStart()); @@ -5096,12 +5257,12 @@ var ts; return statement; } function isLabel() { - return isIdentifier() && lookAhead(function () { return nextToken() === 46 /* ColonToken */; }); + return isIdentifier() && lookAhead(function () { return nextToken() === 50 /* ColonToken */; }); } function parseLabeledStatement(allowLetAndConstDeclarations) { - var node = createNode(167 /* LabeledStatement */); + var node = createNode(174 /* LabeledStatement */); node.label = parseIdentifier(); - parseExpected(46 /* ColonToken */); + parseExpected(50 /* ColonToken */); if (labelledStatementInfo.nodeIsNestedInLabel(node.label, false, true)) { grammarErrorOnNode(node.label, ts.Diagnostics.Duplicate_label_0, getTextOfNodeFromSourceText(sourceText, node.label)); } @@ -5110,91 +5271,93 @@ var ts; return finishNode(node); } function parseExpressionStatement() { - var node = createNode(154 /* ExpressionStatement */); + var node = createNode(161 /* ExpressionStatement */); node.expression = parseExpression(); parseSemicolon(); return finishNode(node); } function isStatement(inErrorRecovery) { switch (token) { - case 17 /* SemicolonToken */: + case 21 /* SemicolonToken */: return !inErrorRecovery; - case 9 /* OpenBraceToken */: - case 92 /* VarKeyword */: - case 98 /* LetKeyword */: - case 64 /* ConstKeyword */: - case 77 /* FunctionKeyword */: - case 78 /* IfKeyword */: - case 69 /* DoKeyword */: - case 94 /* WhileKeyword */: - case 76 /* ForKeyword */: - case 65 /* ContinueKeyword */: - case 60 /* BreakKeyword */: - case 84 /* ReturnKeyword */: - case 95 /* WithKeyword */: - case 86 /* SwitchKeyword */: - case 88 /* ThrowKeyword */: - case 90 /* TryKeyword */: - case 66 /* DebuggerKeyword */: - case 62 /* CatchKeyword */: - case 75 /* FinallyKeyword */: + case 13 /* OpenBraceToken */: + case 96 /* VarKeyword */: + case 102 /* LetKeyword */: + case 81 /* FunctionKeyword */: + case 82 /* IfKeyword */: + case 73 /* DoKeyword */: + case 98 /* WhileKeyword */: + case 80 /* ForKeyword */: + case 69 /* ContinueKeyword */: + case 64 /* BreakKeyword */: + case 88 /* ReturnKeyword */: + case 99 /* WithKeyword */: + case 90 /* SwitchKeyword */: + case 92 /* ThrowKeyword */: + case 94 /* TryKeyword */: + case 70 /* DebuggerKeyword */: + case 66 /* CatchKeyword */: + case 79 /* FinallyKeyword */: return true; - case 97 /* InterfaceKeyword */: - case 63 /* ClassKeyword */: - case 110 /* ModuleKeyword */: - case 71 /* EnumKeyword */: - case 115 /* TypeKeyword */: - if (isDeclaration()) { + case 68 /* ConstKeyword */: + var isConstEnum = lookAhead(function () { return nextToken() === 75 /* EnumKeyword */; }); + return !isConstEnum; + case 101 /* InterfaceKeyword */: + case 67 /* ClassKeyword */: + case 114 /* ModuleKeyword */: + case 75 /* EnumKeyword */: + case 119 /* TypeKeyword */: + if (isDeclarationStart()) { return false; } - case 102 /* PublicKeyword */: - case 100 /* PrivateKeyword */: - case 101 /* ProtectedKeyword */: - case 103 /* StaticKeyword */: - if (lookAhead(function () { return nextToken() >= 59 /* Identifier */; })) { + case 106 /* PublicKeyword */: + case 104 /* PrivateKeyword */: + case 105 /* ProtectedKeyword */: + case 107 /* StaticKeyword */: + if (lookAhead(function () { return nextToken() >= 63 /* Identifier */; })) { return false; } default: - return isExpression(); + return isStartOfExpression(); } } function parseStatement(allowLetAndConstDeclarations) { switch (token) { - case 9 /* OpenBraceToken */: + case 13 /* OpenBraceToken */: return parseBlock(false, false); - case 92 /* VarKeyword */: - case 98 /* LetKeyword */: - case 64 /* ConstKeyword */: + case 96 /* VarKeyword */: + case 102 /* LetKeyword */: + case 68 /* ConstKeyword */: return parseVariableStatement(allowLetAndConstDeclarations); - case 77 /* FunctionKeyword */: + case 81 /* FunctionKeyword */: return parseFunctionDeclaration(); - case 17 /* SemicolonToken */: + case 21 /* SemicolonToken */: return parseEmptyStatement(); - case 78 /* IfKeyword */: + case 82 /* IfKeyword */: return parseIfStatement(); - case 69 /* DoKeyword */: + case 73 /* DoKeyword */: return parseDoStatement(); - case 94 /* WhileKeyword */: + case 98 /* WhileKeyword */: return parseWhileStatement(); - case 76 /* ForKeyword */: + case 80 /* ForKeyword */: return parseForOrForInStatement(); - case 65 /* ContinueKeyword */: - return parseBreakOrContinueStatement(160 /* ContinueStatement */); - case 60 /* BreakKeyword */: - return parseBreakOrContinueStatement(161 /* BreakStatement */); - case 84 /* ReturnKeyword */: + case 69 /* ContinueKeyword */: + return parseBreakOrContinueStatement(167 /* ContinueStatement */); + case 64 /* BreakKeyword */: + return parseBreakOrContinueStatement(168 /* BreakStatement */); + case 88 /* ReturnKeyword */: return parseReturnStatement(); - case 95 /* WithKeyword */: + case 99 /* WithKeyword */: return parseWithStatement(); - case 86 /* SwitchKeyword */: + case 90 /* SwitchKeyword */: return parseSwitchStatement(); - case 88 /* ThrowKeyword */: + case 92 /* ThrowKeyword */: return parseThrowStatement(); - case 90 /* TryKeyword */: - case 62 /* CatchKeyword */: - case 75 /* FinallyKeyword */: + case 94 /* TryKeyword */: + case 66 /* CatchKeyword */: + case 79 /* FinallyKeyword */: return parseTryStatement(); - case 66 /* DebuggerKeyword */: + case 70 /* DebuggerKeyword */: return parseDebuggerStatement(); default: if (isLabel()) { @@ -5206,7 +5369,7 @@ var ts; function parseAndCheckFunctionBody(isConstructor) { var initialPosition = scanner.getTokenPos(); var errorCountBeforeBody = file.syntacticErrors.length; - if (token === 9 /* OpenBraceToken */) { + if (token === 13 /* OpenBraceToken */) { var body = parseBody(false); if (body && inAmbientContext && file.syntacticErrors.length === errorCountBeforeBody) { var diagnostic = isConstructor ? ts.Diagnostics.A_constructor_implementation_cannot_be_declared_in_an_ambient_context : ts.Diagnostics.A_function_implementation_cannot_be_declared_in_an_ambient_context; @@ -5221,7 +5384,7 @@ var ts; error(ts.Diagnostics.Block_or_expected); } function parseVariableDeclaration(flags, noIn) { - var node = createNode(174 /* VariableDeclaration */); + var node = createNode(181 /* VariableDeclaration */); node.flags = flags; var errorCountBeforeVariableDeclaration = file.syntacticErrors.length; node.name = parseIdentifier(); @@ -5244,17 +5407,17 @@ var ts; return parseDelimitedList(9 /* VariableDeclarations */, function () { return parseVariableDeclaration(flags, noIn); }, false); } function parseVariableStatement(allowLetAndConstDeclarations, pos, flags) { - var node = createNode(152 /* VariableStatement */, pos); + var node = createNode(159 /* VariableStatement */, pos); if (flags) node.flags = flags; var errorCountBeforeVarStatement = file.syntacticErrors.length; - if (token === 98 /* LetKeyword */) { + if (token === 102 /* LetKeyword */) { node.flags |= 2048 /* Let */; } - else if (token === 64 /* ConstKeyword */) { + else if (token === 68 /* ConstKeyword */) { node.flags |= 4096 /* Const */; } - else if (token !== 92 /* VarKeyword */) { + else if (token !== 96 /* VarKeyword */) { error(ts.Diagnostics.var_let_or_const_expected); } nextToken(); @@ -5283,12 +5446,12 @@ var ts; return node; } function parseFunctionDeclaration(pos, flags) { - var node = createNode(175 /* FunctionDeclaration */, pos); + var node = createNode(182 /* FunctionDeclaration */, pos); if (flags) node.flags = flags; - parseExpected(77 /* FunctionKeyword */); + parseExpected(81 /* FunctionKeyword */); node.name = parseIdentifier(); - var sig = parseSignature(125 /* CallSignature */, 46 /* ColonToken */, false); + var sig = parseSignature(129 /* CallSignature */, 50 /* ColonToken */, false); node.typeParameters = sig.typeParameters; node.parameters = sig.parameters; node.type = sig.type; @@ -5299,10 +5462,10 @@ var ts; return finishNode(node); } function parseConstructorDeclaration(pos, flags) { - var node = createNode(122 /* Constructor */, pos); + var node = createNode(126 /* Constructor */, pos); node.flags = flags; - parseExpected(107 /* ConstructorKeyword */); - var sig = parseSignature(125 /* CallSignature */, 46 /* ColonToken */, false); + parseExpected(111 /* ConstructorKeyword */); + var sig = parseSignature(129 /* CallSignature */, 50 /* ColonToken */, false); node.typeParameters = sig.typeParameters; node.parameters = sig.parameters; node.type = sig.type; @@ -5319,14 +5482,14 @@ var ts; var errorCountBeforePropertyDeclaration = file.syntacticErrors.length; var name = parsePropertyName(); var questionStart = scanner.getTokenPos(); - if (parseOptional(45 /* QuestionToken */)) { + if (parseOptional(49 /* QuestionToken */)) { errorAtPos(questionStart, scanner.getStartPos() - questionStart, ts.Diagnostics.A_class_member_cannot_be_declared_optional); } - if (token === 11 /* OpenParenToken */ || token === 19 /* LessThanToken */) { - var method = createNode(121 /* Method */, pos); + if (token === 15 /* OpenParenToken */ || token === 23 /* LessThanToken */) { + var method = createNode(125 /* Method */, pos); method.flags = flags; method.name = name; - var sig = parseSignature(125 /* CallSignature */, 46 /* ColonToken */, false); + var sig = parseSignature(129 /* CallSignature */, 50 /* ColonToken */, false); method.typeParameters = sig.typeParameters; method.parameters = sig.parameters; method.type = sig.type; @@ -5334,7 +5497,7 @@ var ts; return finishNode(method); } else { - var property = createNode(120 /* Property */, pos); + var property = createNode(124 /* Property */, pos); property.flags = flags; property.name = name; property.type = parseTypeAnnotation(); @@ -5361,10 +5524,10 @@ var ts; else if (accessor.typeParameters) { grammarErrorOnNode(accessor.name, ts.Diagnostics.An_accessor_cannot_have_type_parameters); } - else if (kind === 123 /* GetAccessor */ && accessor.parameters.length) { + else if (kind === 127 /* GetAccessor */ && accessor.parameters.length) { grammarErrorOnNode(accessor.name, ts.Diagnostics.A_get_accessor_cannot_have_parameters); } - else if (kind === 124 /* SetAccessor */) { + else if (kind === 128 /* SetAccessor */) { if (accessor.type) { grammarErrorOnNode(accessor.name, ts.Diagnostics.A_set_accessor_cannot_have_a_return_type_annotation); } @@ -5394,7 +5557,7 @@ var ts; var node = createNode(kind, pos); node.flags = flags; node.name = parsePropertyName(); - var sig = parseSignature(125 /* CallSignature */, 46 /* ColonToken */, false); + var sig = parseSignature(129 /* CallSignature */, 50 /* ColonToken */, false); node.typeParameters = sig.typeParameters; node.parameters = sig.parameters; node.type = sig.type; @@ -5417,19 +5580,19 @@ var ts; idToken = token; nextToken(); } - if (token === 13 /* OpenBracketToken */) { + if (token === 17 /* OpenBracketToken */) { return true; } if (idToken !== undefined) { - if (!isKeyword(idToken) || idToken === 113 /* SetKeyword */ || idToken === 109 /* GetKeyword */) { + if (!isKeyword(idToken) || idToken === 117 /* SetKeyword */ || idToken === 113 /* GetKeyword */) { return true; } switch (token) { - case 11 /* OpenParenToken */: - case 19 /* LessThanToken */: - case 46 /* ColonToken */: - case 47 /* EqualsToken */: - case 45 /* QuestionToken */: + case 15 /* OpenParenToken */: + case 23 /* LessThanToken */: + case 50 /* ColonToken */: + case 51 /* EqualsToken */: + case 49 /* QuestionToken */: return true; default: return canParseSemicolon(); @@ -5454,7 +5617,7 @@ var ts; break; var modifierLength = scanner.getStartPos() - modifierStart; switch (modifierToken) { - case 102 /* PublicKeyword */: + case 106 /* PublicKeyword */: if (flags & ts.NodeFlags.AccessibilityModifier) { grammarErrorAtPos(modifierStart, modifierLength, ts.Diagnostics.Accessibility_modifier_already_seen); } @@ -5466,7 +5629,7 @@ var ts; } flags |= 16 /* Public */; break; - case 100 /* PrivateKeyword */: + case 104 /* PrivateKeyword */: if (flags & ts.NodeFlags.AccessibilityModifier) { grammarErrorAtPos(modifierStart, modifierLength, ts.Diagnostics.Accessibility_modifier_already_seen); } @@ -5480,7 +5643,7 @@ var ts; lastPrivateModifierLength = modifierLength; flags |= 32 /* Private */; break; - case 101 /* ProtectedKeyword */: + case 105 /* ProtectedKeyword */: if (flags & 16 /* Public */ || flags & 32 /* Private */ || flags & 64 /* Protected */) { grammarErrorAtPos(modifierStart, modifierLength, ts.Diagnostics.Accessibility_modifier_already_seen); } @@ -5494,7 +5657,7 @@ var ts; lastProtectedModifierLength = modifierLength; flags |= 64 /* Protected */; break; - case 103 /* StaticKeyword */: + case 107 /* StaticKeyword */: if (flags & 128 /* Static */) { grammarErrorAtPos(modifierStart, modifierLength, ts.Diagnostics._0_modifier_already_seen, "static"); } @@ -5508,7 +5671,7 @@ var ts; lastStaticModifierLength = modifierLength; flags |= 128 /* Static */; break; - case 72 /* ExportKeyword */: + case 76 /* ExportKeyword */: if (flags & 1 /* Export */) { grammarErrorAtPos(modifierStart, modifierLength, ts.Diagnostics._0_modifier_already_seen, "export"); } @@ -5523,7 +5686,7 @@ var ts; } flags |= 1 /* Export */; break; - case 108 /* DeclareKeyword */: + case 112 /* DeclareKeyword */: if (flags & 2 /* Ambient */) { grammarErrorAtPos(modifierStart, modifierLength, ts.Diagnostics._0_modifier_already_seen, "declare"); } @@ -5542,26 +5705,26 @@ var ts; break; } } - if (token === 107 /* ConstructorKeyword */ && flags & 128 /* Static */) { + if (token === 111 /* ConstructorKeyword */ && flags & 128 /* Static */) { grammarErrorAtPos(lastStaticModifierStart, lastStaticModifierLength, ts.Diagnostics._0_modifier_cannot_appear_on_a_constructor_declaration, "static"); } - else if (token === 107 /* ConstructorKeyword */ && flags & 32 /* Private */) { + else if (token === 111 /* ConstructorKeyword */ && flags & 32 /* Private */) { grammarErrorAtPos(lastPrivateModifierStart, lastPrivateModifierLength, ts.Diagnostics._0_modifier_cannot_appear_on_a_constructor_declaration, "private"); } - else if (token === 107 /* ConstructorKeyword */ && flags & 64 /* Protected */) { + else if (token === 111 /* ConstructorKeyword */ && flags & 64 /* Protected */) { grammarErrorAtPos(lastProtectedModifierStart, lastProtectedModifierLength, ts.Diagnostics._0_modifier_cannot_appear_on_a_constructor_declaration, "protected"); } - else if (token === 79 /* ImportKeyword */) { + else if (token === 83 /* ImportKeyword */) { if (flags & 2 /* Ambient */) { grammarErrorAtPos(lastDeclareModifierStart, lastDeclareModifierLength, ts.Diagnostics.A_declare_modifier_cannot_be_used_with_an_import_declaration, "declare"); } } - else if (token === 97 /* InterfaceKeyword */) { + else if (token === 101 /* InterfaceKeyword */) { if (flags & 2 /* Ambient */) { grammarErrorAtPos(lastDeclareModifierStart, lastDeclareModifierLength, ts.Diagnostics.A_declare_modifier_cannot_be_used_with_an_interface_declaration, "declare"); } } - else if (token !== 72 /* ExportKeyword */ && !(flags & 2 /* Ambient */) && inAmbientContext && context === 0 /* SourceElements */) { + else if (token !== 76 /* ExportKeyword */ && !(flags & 2 /* Ambient */) && inAmbientContext && context === 0 /* SourceElements */) { var declarationStart = scanner.getTokenPos(); var declarationFirstTokenLength = scanner.getTextPos() - declarationStart; grammarErrorAtPos(declarationStart, declarationFirstTokenLength, ts.Diagnostics.A_declare_modifier_is_required_for_a_top_level_declaration_in_a_d_ts_file); @@ -5571,19 +5734,19 @@ var ts; function parseClassMemberDeclaration() { var pos = getNodePos(); var flags = parseAndCheckModifiers(2 /* ClassMembers */); - if (parseContextualModifier(109 /* GetKeyword */)) { - return parseAndCheckMemberAccessorDeclaration(123 /* GetAccessor */, pos, flags); + if (parseContextualModifier(113 /* GetKeyword */)) { + return parseAndCheckMemberAccessorDeclaration(127 /* GetAccessor */, pos, flags); } - if (parseContextualModifier(113 /* SetKeyword */)) { - return parseAndCheckMemberAccessorDeclaration(124 /* SetAccessor */, pos, flags); + if (parseContextualModifier(117 /* SetKeyword */)) { + return parseAndCheckMemberAccessorDeclaration(128 /* SetAccessor */, pos, flags); } - if (token === 107 /* ConstructorKeyword */) { + if (token === 111 /* ConstructorKeyword */) { return parseConstructorDeclaration(pos, flags); } - if (token >= 59 /* Identifier */ || token === 7 /* StringLiteral */ || token === 6 /* NumericLiteral */) { + if (token >= 63 /* Identifier */ || token === 7 /* StringLiteral */ || token === 6 /* NumericLiteral */) { return parsePropertyMemberDeclaration(pos, flags); } - if (token === 13 /* OpenBracketToken */) { + if (token === 17 /* OpenBracketToken */) { if (flags) { var start = getTokenPos(pos); var length = getNodePos() - start; @@ -5594,23 +5757,23 @@ var ts; ts.Debug.fail("Should not have attempted to parse class member declaration."); } function parseClassDeclaration(pos, flags) { - var node = createNode(177 /* ClassDeclaration */, pos); + var node = createNode(184 /* ClassDeclaration */, pos); node.flags = flags; var errorCountBeforeClassDeclaration = file.syntacticErrors.length; - parseExpected(63 /* ClassKeyword */); + parseExpected(67 /* ClassKeyword */); node.name = parseIdentifier(); node.typeParameters = parseTypeParameters(); - node.baseType = parseOptional(73 /* ExtendsKeyword */) ? parseTypeReference() : undefined; + node.baseType = parseOptional(77 /* ExtendsKeyword */) ? parseTypeReference() : undefined; var implementsKeywordStart = scanner.getTokenPos(); var implementsKeywordLength; - if (parseOptional(96 /* ImplementsKeyword */)) { + if (parseOptional(100 /* ImplementsKeyword */)) { implementsKeywordLength = scanner.getStartPos() - implementsKeywordStart; node.implementedTypes = parseDelimitedList(8 /* BaseTypeReferences */, parseTypeReference, false); } var errorCountBeforeClassBody = file.syntacticErrors.length; - if (parseExpected(9 /* OpenBraceToken */)) { + if (parseExpected(13 /* OpenBraceToken */)) { node.members = parseList(6 /* ClassMembers */, false, parseClassMemberDeclaration); - parseExpected(10 /* CloseBraceToken */); + parseExpected(14 /* CloseBraceToken */); } else { node.members = createMissingList(); @@ -5621,15 +5784,15 @@ var ts; return finishNode(node); } function parseInterfaceDeclaration(pos, flags) { - var node = createNode(178 /* InterfaceDeclaration */, pos); + var node = createNode(185 /* InterfaceDeclaration */, pos); node.flags = flags; var errorCountBeforeInterfaceDeclaration = file.syntacticErrors.length; - parseExpected(97 /* InterfaceKeyword */); + parseExpected(101 /* InterfaceKeyword */); node.name = parseIdentifier(); node.typeParameters = parseTypeParameters(); var extendsKeywordStart = scanner.getTokenPos(); var extendsKeywordLength; - if (parseOptional(73 /* ExtendsKeyword */)) { + if (parseOptional(77 /* ExtendsKeyword */)) { extendsKeywordLength = scanner.getStartPos() - extendsKeywordStart; node.baseTypes = parseDelimitedList(8 /* BaseTypeReferences */, parseTypeReference, false); } @@ -5641,30 +5804,24 @@ var ts; return finishNode(node); } function parseTypeAliasDeclaration(pos, flags) { - var node = createNode(179 /* TypeAliasDeclaration */, pos); + var node = createNode(186 /* TypeAliasDeclaration */, pos); node.flags = flags; - parseExpected(115 /* TypeKeyword */); + parseExpected(119 /* TypeKeyword */); node.name = parseIdentifier(); - parseExpected(47 /* EqualsToken */); + parseExpected(51 /* EqualsToken */); node.type = parseType(); parseSemicolon(); - var n = node.type; - while (n.kind === 134 /* ParenType */) { - n = n.type; - } - if (n.kind === 130 /* TypeLiteral */ && (n.pos !== n.members.pos || n.end !== n.members.end)) { - grammarErrorOnNode(node.type, ts.Diagnostics.Aliased_type_cannot_be_an_object_type_literal_Use_an_interface_declaration_instead); - } return finishNode(node); } function parseAndCheckEnumDeclaration(pos, flags) { + var enumIsConst = flags & 4096 /* Const */; function isIntegerLiteral(expression) { function isInteger(literalExpression) { return /^[0-9]+([eE]\+?[0-9]+)?$/.test(literalExpression.text); } - if (expression.kind === 146 /* PrefixOperator */) { + if (expression.kind === 151 /* PrefixOperator */) { var unaryExpression = expression; - if (unaryExpression.operator === 28 /* PlusToken */ || unaryExpression.operator === 29 /* MinusToken */) { + if (unaryExpression.operator === 32 /* PlusToken */ || unaryExpression.operator === 33 /* MinusToken */) { expression = unaryExpression.operand; } } @@ -5675,30 +5832,35 @@ var ts; } var inConstantEnumMemberSection = true; function parseAndCheckEnumMember() { - var node = createNode(185 /* EnumMember */); + var node = createNode(192 /* EnumMember */); var errorCountBeforeEnumMember = file.syntacticErrors.length; node.name = parsePropertyName(); node.initializer = parseInitializer(false); - if (inAmbientContext) { - if (node.initializer && !isIntegerLiteral(node.initializer) && errorCountBeforeEnumMember === file.syntacticErrors.length) { - grammarErrorOnNode(node.name, ts.Diagnostics.Ambient_enum_elements_can_only_have_integer_literal_initializers); + if (!enumIsConst) { + if (inAmbientContext) { + if (node.initializer && !isIntegerLiteral(node.initializer) && errorCountBeforeEnumMember === file.syntacticErrors.length) { + grammarErrorOnNode(node.name, ts.Diagnostics.Ambient_enum_elements_can_only_have_integer_literal_initializers); + } + } + else if (node.initializer) { + inConstantEnumMemberSection = isIntegerLiteral(node.initializer); + } + else if (!inConstantEnumMemberSection && errorCountBeforeEnumMember === file.syntacticErrors.length) { + grammarErrorOnNode(node.name, ts.Diagnostics.Enum_member_must_have_initializer); } - } - else if (node.initializer) { - inConstantEnumMemberSection = isIntegerLiteral(node.initializer); - } - else if (!inConstantEnumMemberSection && errorCountBeforeEnumMember === file.syntacticErrors.length) { - grammarErrorOnNode(node.name, ts.Diagnostics.Enum_member_must_have_initializer); } return finishNode(node); } - var node = createNode(180 /* EnumDeclaration */, pos); + var node = createNode(187 /* EnumDeclaration */, pos); node.flags = flags; - parseExpected(71 /* EnumKeyword */); + if (enumIsConst) { + parseExpected(68 /* ConstKeyword */); + } + parseExpected(75 /* EnumKeyword */); node.name = parseIdentifier(); - if (parseExpected(9 /* OpenBraceToken */)) { + if (parseExpected(13 /* OpenBraceToken */)) { node.members = parseDelimitedList(7 /* EnumMembers */, parseAndCheckEnumMember, true); - parseExpected(10 /* CloseBraceToken */); + parseExpected(14 /* CloseBraceToken */); } else { node.members = createMissingList(); @@ -5706,10 +5868,10 @@ var ts; return finishNode(node); } function parseModuleBody() { - var node = createNode(182 /* ModuleBlock */); - if (parseExpected(9 /* OpenBraceToken */)) { + var node = createNode(189 /* ModuleBlock */); + if (parseExpected(13 /* OpenBraceToken */)) { node.statements = parseList(1 /* ModuleElements */, false, parseModuleElement); - parseExpected(10 /* CloseBraceToken */); + parseExpected(14 /* CloseBraceToken */); } else { node.statements = createMissingList(); @@ -5717,19 +5879,19 @@ var ts; return finishNode(node); } function parseInternalModuleTail(pos, flags) { - var node = createNode(181 /* ModuleDeclaration */, pos); + var node = createNode(188 /* ModuleDeclaration */, pos); node.flags = flags; node.name = parseIdentifier(); - if (parseOptional(15 /* DotToken */)) { + if (parseOptional(19 /* DotToken */)) { node.body = parseInternalModuleTail(getNodePos(), 1 /* Export */); } else { node.body = parseModuleBody(); ts.forEach(node.body.statements, function (s) { - if (s.kind === 184 /* ExportAssignment */) { + if (s.kind === 191 /* ExportAssignment */) { grammarErrorOnNode(s, ts.Diagnostics.An_export_assignment_cannot_be_used_in_an_internal_module); } - else if (s.kind === 183 /* ImportDeclaration */ && s.externalModuleName) { + else if (s.kind === 190 /* ImportDeclaration */ && s.externalModuleName) { grammarErrorOnNode(s, ts.Diagnostics.Import_declarations_in_an_internal_module_cannot_reference_an_external_module); } }); @@ -5737,7 +5899,7 @@ var ts; return finishNode(node); } function parseAmbientExternalModuleDeclaration(pos, flags) { - var node = createNode(181 /* ModuleDeclaration */, pos); + var node = createNode(188 /* ModuleDeclaration */, pos); node.flags = flags; node.name = parseStringLiteral(); if (!inAmbientContext) { @@ -5753,19 +5915,19 @@ var ts; return finishNode(node); } function parseModuleDeclaration(pos, flags) { - parseExpected(110 /* ModuleKeyword */); + parseExpected(114 /* ModuleKeyword */); return token === 7 /* StringLiteral */ ? parseAmbientExternalModuleDeclaration(pos, flags) : parseInternalModuleTail(pos, flags); } function parseImportDeclaration(pos, flags) { - var node = createNode(183 /* ImportDeclaration */, pos); + var node = createNode(190 /* ImportDeclaration */, pos); node.flags = flags; - parseExpected(79 /* ImportKeyword */); + parseExpected(83 /* ImportKeyword */); node.name = parseIdentifier(); - parseExpected(47 /* EqualsToken */); + parseExpected(51 /* EqualsToken */); var entityName = parseEntityName(false); - if (entityName.kind === 59 /* Identifier */ && entityName.text === "require" && parseOptional(11 /* OpenParenToken */)) { + if (entityName.kind === 63 /* Identifier */ && entityName.text === "require" && parseOptional(15 /* OpenParenToken */)) { node.externalModuleName = parseStringLiteral(); - parseExpected(12 /* CloseParenToken */); + parseExpected(16 /* CloseParenToken */); } else { node.entityName = entityName; @@ -5774,36 +5936,36 @@ var ts; return finishNode(node); } function parseExportAssignmentTail(pos) { - var node = createNode(184 /* ExportAssignment */, pos); + var node = createNode(191 /* ExportAssignment */, pos); node.exportName = parseIdentifier(); parseSemicolon(); return finishNode(node); } - function isDeclaration() { + function isDeclarationStart() { switch (token) { - case 92 /* VarKeyword */: - case 98 /* LetKeyword */: - case 64 /* ConstKeyword */: - case 77 /* FunctionKeyword */: + case 96 /* VarKeyword */: + case 102 /* LetKeyword */: + case 68 /* ConstKeyword */: + case 81 /* FunctionKeyword */: return true; - case 63 /* ClassKeyword */: - case 97 /* InterfaceKeyword */: - case 71 /* EnumKeyword */: - case 79 /* ImportKeyword */: - case 115 /* TypeKeyword */: - return lookAhead(function () { return nextToken() >= 59 /* Identifier */; }); - case 110 /* ModuleKeyword */: - return lookAhead(function () { return nextToken() >= 59 /* Identifier */ || token === 7 /* StringLiteral */; }); - case 72 /* ExportKeyword */: - return lookAhead(function () { return nextToken() === 47 /* EqualsToken */ || isDeclaration(); }); - case 108 /* DeclareKeyword */: - case 102 /* PublicKeyword */: - case 100 /* PrivateKeyword */: - case 101 /* ProtectedKeyword */: - case 103 /* StaticKeyword */: + case 67 /* ClassKeyword */: + case 101 /* InterfaceKeyword */: + case 75 /* EnumKeyword */: + case 83 /* ImportKeyword */: + case 119 /* TypeKeyword */: + return lookAhead(function () { return nextToken() >= 63 /* Identifier */; }); + case 114 /* ModuleKeyword */: + return lookAhead(function () { return nextToken() >= 63 /* Identifier */ || token === 7 /* StringLiteral */; }); + case 76 /* ExportKeyword */: + return lookAhead(function () { return nextToken() === 51 /* EqualsToken */ || isDeclarationStart(); }); + case 112 /* DeclareKeyword */: + case 106 /* PublicKeyword */: + case 104 /* PrivateKeyword */: + case 105 /* ProtectedKeyword */: + case 107 /* StaticKeyword */: return lookAhead(function () { nextToken(); - return isDeclaration(); + return isDeclarationStart(); }); } } @@ -5811,10 +5973,10 @@ var ts; var pos = getNodePos(); var errorCountBeforeModifiers = file.syntacticErrors.length; var flags = parseAndCheckModifiers(modifierContext); - if (token === 72 /* ExportKeyword */) { + if (token === 76 /* ExportKeyword */) { var modifiersEnd = scanner.getStartPos(); nextToken(); - if (parseOptional(47 /* EqualsToken */)) { + if (parseOptional(51 /* EqualsToken */)) { var exportAssignmentTail = parseExportAssignmentTail(pos); if (flags !== 0 && errorCountBeforeModifiers === file.syntacticErrors.length) { var modifiersStart = ts.skipTrivia(sourceText, pos); @@ -5829,30 +5991,38 @@ var ts; } var result; switch (token) { - case 92 /* VarKeyword */: - case 98 /* LetKeyword */: - case 64 /* ConstKeyword */: + case 96 /* VarKeyword */: + case 102 /* LetKeyword */: result = parseVariableStatement(true, pos, flags); break; - case 77 /* FunctionKeyword */: + case 68 /* ConstKeyword */: + var isConstEnum = lookAhead(function () { return nextToken() === 75 /* EnumKeyword */; }); + if (isConstEnum) { + result = parseAndCheckEnumDeclaration(pos, flags | 4096 /* Const */); + } + else { + result = parseVariableStatement(true, pos, flags); + } + break; + case 81 /* FunctionKeyword */: result = parseFunctionDeclaration(pos, flags); break; - case 63 /* ClassKeyword */: + case 67 /* ClassKeyword */: result = parseClassDeclaration(pos, flags); break; - case 97 /* InterfaceKeyword */: + case 101 /* InterfaceKeyword */: result = parseInterfaceDeclaration(pos, flags); break; - case 115 /* TypeKeyword */: + case 119 /* TypeKeyword */: result = parseTypeAliasDeclaration(pos, flags); break; - case 71 /* EnumKeyword */: + case 75 /* EnumKeyword */: result = parseAndCheckEnumDeclaration(pos, flags); break; - case 110 /* ModuleKeyword */: + case 114 /* ModuleKeyword */: result = parseModuleDeclaration(pos, flags); break; - case 79 /* ImportKeyword */: + case 83 /* ImportKeyword */: result = parseImportDeclaration(pos, flags); break; default: @@ -5862,7 +6032,7 @@ var ts; return result; } function isSourceElement(inErrorRecovery) { - return isDeclaration() || isStatement(inErrorRecovery); + return isDeclarationStart() || isStatement(inErrorRecovery); } function parseSourceElement() { return parseSourceElementOrModuleElement(0 /* SourceElements */); @@ -5871,7 +6041,7 @@ var ts; return parseSourceElementOrModuleElement(1 /* ModuleElements */); } function parseSourceElementOrModuleElement(modifierContext) { - if (isDeclaration()) { + if (isDeclarationStart()) { return parseDeclaration(modifierContext); } var statementStart = scanner.getTokenPos(); @@ -5929,7 +6099,7 @@ var ts; }; } function getExternalModuleIndicator() { - return ts.forEach(file.statements, function (node) { return node.flags & 1 /* Export */ || node.kind === 183 /* ImportDeclaration */ && node.externalModuleName || node.kind === 184 /* ExportAssignment */ ? node : undefined; }); + return ts.forEach(file.statements, function (node) { return node.flags & 1 /* Export */ || node.kind === 190 /* ImportDeclaration */ && node.externalModuleName || node.kind === 191 /* ExportAssignment */ ? node : undefined; }); } scanner = ts.createScanner(languageVersion, true, sourceText, scanError, onComment); var rootNodeFlags = 0; @@ -5937,7 +6107,7 @@ var ts; rootNodeFlags = 1024 /* DeclarationFile */; inAmbientContext = true; } - file = createRootNode(186 /* SourceFile */, 0, sourceText.length, rootNodeFlags); + file = createRootNode(193 /* SourceFile */, 0, sourceText.length, rootNodeFlags); file.filename = ts.normalizePath(filename); file.text = sourceText; file.getLineAndCharacterFromPosition = getLineAndCharacterlFromSourcePosition; @@ -6070,7 +6240,7 @@ var ts; } function processImportedModules(file, basePath) { ts.forEach(file.statements, function (node) { - if (node.kind === 183 /* ImportDeclaration */ && node.externalModuleName) { + if (node.kind === 190 /* ImportDeclaration */ && node.externalModuleName) { var nameLiteral = node.externalModuleName; var moduleName = nameLiteral.text; if (moduleName) { @@ -6088,9 +6258,9 @@ var ts; } } } - else if (node.kind === 181 /* ModuleDeclaration */ && node.name.kind === 7 /* StringLiteral */ && (node.flags & 2 /* Ambient */ || isDeclarationFile(file))) { + else if (node.kind === 188 /* ModuleDeclaration */ && node.name.kind === 7 /* StringLiteral */ && (node.flags & 2 /* Ambient */ || isDeclarationFile(file))) { forEachChild(node.body, function (node) { - if (node.kind === 183 /* ImportDeclaration */ && node.externalModuleName) { + if (node.kind === 190 /* ImportDeclaration */ && node.externalModuleName) { var nameLiteral = node.externalModuleName; var moduleName = nameLiteral.text; if (moduleName) { @@ -6162,24 +6332,46 @@ var ts; })(ts || (ts = {})); var ts; (function (ts) { - function isInstantiated(node) { - if (node.kind === 178 /* InterfaceDeclaration */) { - return false; + (function (ModuleInstanceState) { + ModuleInstanceState[ModuleInstanceState["NonInstantiated"] = 0] = "NonInstantiated"; + ModuleInstanceState[ModuleInstanceState["Instantiated"] = 1] = "Instantiated"; + ModuleInstanceState[ModuleInstanceState["ConstEnumOnly"] = 2] = "ConstEnumOnly"; + })(ts.ModuleInstanceState || (ts.ModuleInstanceState = {})); + var ModuleInstanceState = ts.ModuleInstanceState; + function getModuleInstanceState(node) { + if (node.kind === 185 /* InterfaceDeclaration */) { + return 0 /* NonInstantiated */; } - else if (node.kind === 183 /* ImportDeclaration */ && !(node.flags & 1 /* Export */)) { - return false; + else if (node.kind === 187 /* EnumDeclaration */ && ts.isConstEnumDeclaration(node)) { + return 2 /* ConstEnumOnly */; } - else if (node.kind === 182 /* ModuleBlock */ && !ts.forEachChild(node, isInstantiated)) { - return false; + else if (node.kind === 190 /* ImportDeclaration */ && !(node.flags & 1 /* Export */)) { + return 0 /* NonInstantiated */; } - else if (node.kind === 181 /* ModuleDeclaration */ && !isInstantiated(node.body)) { - return false; + else if (node.kind === 189 /* ModuleBlock */) { + var state = 0 /* NonInstantiated */; + ts.forEachChild(node, function (n) { + switch (getModuleInstanceState(n)) { + case 0 /* NonInstantiated */: + return false; + case 2 /* ConstEnumOnly */: + state = 2 /* ConstEnumOnly */; + return false; + case 1 /* Instantiated */: + state = 1 /* Instantiated */; + return true; + } + }); + return state; + } + else if (node.kind === 188 /* ModuleDeclaration */) { + return getModuleInstanceState(node.body); } else { - return true; + return 1 /* Instantiated */; } } - ts.isInstantiated = isInstantiated; + ts.getModuleInstanceState = getModuleInstanceState; function bindSourceFile(file) { var parent; var container; @@ -6212,19 +6404,19 @@ var ts; } function getDeclarationName(node) { if (node.name) { - if (node.kind === 181 /* ModuleDeclaration */ && node.name.kind === 7 /* StringLiteral */) { + if (node.kind === 188 /* ModuleDeclaration */ && node.name.kind === 7 /* StringLiteral */) { return '"' + node.name.text + '"'; } return node.name.text; } switch (node.kind) { - case 122 /* Constructor */: + case 126 /* Constructor */: return "__constructor"; - case 125 /* CallSignature */: + case 129 /* CallSignature */: return "__call"; - case 126 /* ConstructSignature */: + case 130 /* ConstructSignature */: return "__new"; - case 127 /* IndexSignature */: + case 131 /* IndexSignature */: return "__index"; } } @@ -6252,8 +6444,8 @@ var ts; } addDeclarationToSymbol(symbol, node, includes); symbol.parent = parent; - if (node.kind === 177 /* ClassDeclaration */ && symbol.exports) { - var prototypeSymbol = createSymbol(4 /* Property */ | 268435456 /* Prototype */, "prototype"); + if (node.kind === 184 /* ClassDeclaration */ && symbol.exports) { + var prototypeSymbol = createSymbol(4 /* Property */ | 536870912 /* Prototype */, "prototype"); if (ts.hasProperty(symbol.exports, prototypeSymbol.name)) { if (node.name) { node.name.parent = node; @@ -6276,15 +6468,15 @@ var ts; function declareModuleMember(node, symbolKind, symbolExcludes) { var exportKind = 0; if (symbolKind & ts.SymbolFlags.Value) { - exportKind |= 2097152 /* ExportValue */; + exportKind |= 4194304 /* ExportValue */; } if (symbolKind & ts.SymbolFlags.Type) { - exportKind |= 4194304 /* ExportType */; + exportKind |= 8388608 /* ExportType */; } if (symbolKind & ts.SymbolFlags.Namespace) { - exportKind |= 8388608 /* ExportNamespace */; + exportKind |= 16777216 /* ExportNamespace */; } - if (node.flags & 1 /* Export */ || (node.kind !== 183 /* ImportDeclaration */ && isAmbientContext(container))) { + if (node.flags & 1 /* Export */ || (node.kind !== 190 /* ImportDeclaration */ && isAmbientContext(container))) { if (exportKind) { var local = declareSymbol(container.locals, undefined, node, exportKind, symbolExcludes); local.exportSymbol = declareSymbol(container.symbol.exports, container.symbol, node, symbolKind, symbolExcludes); @@ -6325,44 +6517,44 @@ var ts; } function bindDeclaration(node, symbolKind, symbolExcludes, isBlockScopeContainer) { switch (container.kind) { - case 181 /* ModuleDeclaration */: + case 188 /* ModuleDeclaration */: declareModuleMember(node, symbolKind, symbolExcludes); break; - case 186 /* SourceFile */: + case 193 /* SourceFile */: if (ts.isExternalModule(container)) { declareModuleMember(node, symbolKind, symbolExcludes); break; } - case 125 /* CallSignature */: - case 126 /* ConstructSignature */: - case 127 /* IndexSignature */: - case 121 /* Method */: - case 122 /* Constructor */: - case 123 /* GetAccessor */: - case 124 /* SetAccessor */: - case 175 /* FunctionDeclaration */: - case 144 /* FunctionExpression */: - case 145 /* ArrowFunction */: + case 129 /* CallSignature */: + case 130 /* ConstructSignature */: + case 131 /* IndexSignature */: + case 125 /* Method */: + case 126 /* Constructor */: + case 127 /* GetAccessor */: + case 128 /* SetAccessor */: + case 182 /* FunctionDeclaration */: + case 149 /* FunctionExpression */: + case 150 /* ArrowFunction */: declareSymbol(container.locals, undefined, node, symbolKind, symbolExcludes); break; - case 177 /* ClassDeclaration */: + case 184 /* ClassDeclaration */: if (node.flags & 128 /* Static */) { declareSymbol(container.symbol.exports, container.symbol, node, symbolKind, symbolExcludes); break; } - case 130 /* TypeLiteral */: - case 136 /* ObjectLiteral */: - case 178 /* InterfaceDeclaration */: + case 134 /* TypeLiteral */: + case 140 /* ObjectLiteral */: + case 185 /* InterfaceDeclaration */: declareSymbol(container.symbol.members, container.symbol, node, symbolKind, symbolExcludes); break; - case 180 /* EnumDeclaration */: + case 187 /* EnumDeclaration */: declareSymbol(container.symbol.exports, container.symbol, node, symbolKind, symbolExcludes); break; } bindChildren(node, symbolKind, isBlockScopeContainer); } function bindConstructorDeclaration(node) { - bindDeclaration(node, 8192 /* Constructor */, 0, true); + bindDeclaration(node, 16384 /* Constructor */, 0, true); ts.forEach(node.parameters, function (p) { if (p.flags & (16 /* Public */ | 32 /* Private */ | 64 /* Protected */)) { bindDeclaration(p, 4 /* Property */, ts.SymbolFlags.PropertyExcludes, false); @@ -6371,13 +6563,22 @@ var ts; } function bindModuleDeclaration(node) { if (node.name.kind === 7 /* StringLiteral */) { - bindDeclaration(node, 256 /* ValueModule */, ts.SymbolFlags.ValueModuleExcludes, true); - } - else if (isInstantiated(node)) { - bindDeclaration(node, 256 /* ValueModule */, ts.SymbolFlags.ValueModuleExcludes, true); + bindDeclaration(node, 512 /* ValueModule */, ts.SymbolFlags.ValueModuleExcludes, true); } else { - bindDeclaration(node, 512 /* NamespaceModule */, 0 /* NamespaceModuleExcludes */, true); + var state = getModuleInstanceState(node); + if (state === 0 /* NonInstantiated */) { + bindDeclaration(node, 1024 /* NamespaceModule */, 0 /* NamespaceModuleExcludes */, true); + } + else { + bindDeclaration(node, 512 /* ValueModule */, ts.SymbolFlags.ValueModuleExcludes, true); + if (state === 2 /* ConstEnumOnly */) { + node.symbol.constEnumOnlyModule = true; + } + else if (node.symbol.constEnumOnlyModule) { + node.symbol.constEnumOnlyModule = false; + } + } } } function bindAnonymousDeclaration(node, symbolKind, name, isBlockScopeContainer) { @@ -6397,10 +6598,10 @@ var ts; } function bindBlockScopedVariableDeclaration(node) { switch (blockScopeContainer.kind) { - case 181 /* ModuleDeclaration */: + case 188 /* ModuleDeclaration */: declareModuleMember(node, 2 /* BlockScopedVariable */, ts.SymbolFlags.BlockScopedVariableExcludes); break; - case 186 /* SourceFile */: + case 193 /* SourceFile */: if (ts.isExternalModule(container)) { declareModuleMember(node, 2 /* BlockScopedVariable */, ts.SymbolFlags.BlockScopedVariableExcludes); break; @@ -6416,13 +6617,13 @@ var ts; function bind(node) { node.parent = parent; switch (node.kind) { - case 118 /* TypeParameter */: - bindDeclaration(node, 524288 /* TypeParameter */, ts.SymbolFlags.TypeParameterExcludes, false); + case 122 /* TypeParameter */: + bindDeclaration(node, 1048576 /* TypeParameter */, ts.SymbolFlags.TypeParameterExcludes, false); break; - case 119 /* Parameter */: + case 123 /* Parameter */: bindDeclaration(node, 1 /* FunctionScopedVariable */, ts.SymbolFlags.ParameterExcludes, false); break; - case 174 /* VariableDeclaration */: + case 181 /* VariableDeclaration */: if (node.flags & ts.NodeFlags.BlockScoped) { bindBlockScopedVariableDeclaration(node); } @@ -6430,80 +6631,85 @@ var ts; bindDeclaration(node, 1 /* FunctionScopedVariable */, ts.SymbolFlags.FunctionScopedVariableExcludes, false); } break; - case 120 /* Property */: - case 137 /* PropertyAssignment */: + case 124 /* Property */: + case 141 /* PropertyAssignment */: bindDeclaration(node, 4 /* Property */, ts.SymbolFlags.PropertyExcludes, false); break; - case 185 /* EnumMember */: + case 192 /* EnumMember */: bindDeclaration(node, 8 /* EnumMember */, ts.SymbolFlags.EnumMemberExcludes, false); break; - case 125 /* CallSignature */: - bindDeclaration(node, 65536 /* CallSignature */, 0, false); + case 129 /* CallSignature */: + bindDeclaration(node, 131072 /* CallSignature */, 0, false); break; - case 121 /* Method */: - bindDeclaration(node, 4096 /* Method */, ts.SymbolFlags.MethodExcludes, true); + case 125 /* Method */: + bindDeclaration(node, 8192 /* Method */, ts.SymbolFlags.MethodExcludes, true); break; - case 126 /* ConstructSignature */: - bindDeclaration(node, 131072 /* ConstructSignature */, 0, true); + case 130 /* ConstructSignature */: + bindDeclaration(node, 262144 /* ConstructSignature */, 0, true); break; - case 127 /* IndexSignature */: - bindDeclaration(node, 262144 /* IndexSignature */, 0, false); + case 131 /* IndexSignature */: + bindDeclaration(node, 524288 /* IndexSignature */, 0, false); break; - case 175 /* FunctionDeclaration */: + case 182 /* FunctionDeclaration */: bindDeclaration(node, 16 /* Function */, ts.SymbolFlags.FunctionExcludes, true); break; - case 122 /* Constructor */: + case 126 /* Constructor */: bindConstructorDeclaration(node); break; - case 123 /* GetAccessor */: - bindDeclaration(node, 16384 /* GetAccessor */, ts.SymbolFlags.GetAccessorExcludes, true); + case 127 /* GetAccessor */: + bindDeclaration(node, 32768 /* GetAccessor */, ts.SymbolFlags.GetAccessorExcludes, true); break; - case 124 /* SetAccessor */: - bindDeclaration(node, 32768 /* SetAccessor */, ts.SymbolFlags.SetAccessorExcludes, true); + case 128 /* SetAccessor */: + bindDeclaration(node, 65536 /* SetAccessor */, ts.SymbolFlags.SetAccessorExcludes, true); break; - case 130 /* TypeLiteral */: - bindAnonymousDeclaration(node, 1024 /* TypeLiteral */, "__type", false); + case 134 /* TypeLiteral */: + bindAnonymousDeclaration(node, 2048 /* TypeLiteral */, "__type", false); break; - case 136 /* ObjectLiteral */: - bindAnonymousDeclaration(node, 2048 /* ObjectLiteral */, "__object", false); + case 140 /* ObjectLiteral */: + bindAnonymousDeclaration(node, 4096 /* ObjectLiteral */, "__object", false); break; - case 144 /* FunctionExpression */: - case 145 /* ArrowFunction */: + case 149 /* FunctionExpression */: + case 150 /* ArrowFunction */: bindAnonymousDeclaration(node, 16 /* Function */, "__function", true); break; - case 171 /* CatchBlock */: + case 178 /* CatchBlock */: bindCatchVariableDeclaration(node); break; - case 177 /* ClassDeclaration */: + case 184 /* ClassDeclaration */: bindDeclaration(node, 32 /* Class */, ts.SymbolFlags.ClassExcludes, false); break; - case 178 /* InterfaceDeclaration */: + case 185 /* InterfaceDeclaration */: bindDeclaration(node, 64 /* Interface */, ts.SymbolFlags.InterfaceExcludes, false); break; - case 179 /* TypeAliasDeclaration */: - bindDeclaration(node, 1048576 /* TypeAlias */, ts.SymbolFlags.TypeAliasExcludes, false); + case 186 /* TypeAliasDeclaration */: + bindDeclaration(node, 2097152 /* TypeAlias */, ts.SymbolFlags.TypeAliasExcludes, false); break; - case 180 /* EnumDeclaration */: - bindDeclaration(node, 128 /* Enum */, ts.SymbolFlags.EnumExcludes, false); + case 187 /* EnumDeclaration */: + if (ts.isConstEnumDeclaration(node)) { + bindDeclaration(node, 128 /* ConstEnum */, ts.SymbolFlags.ConstEnumExcludes, false); + } + else { + bindDeclaration(node, 256 /* RegularEnum */, ts.SymbolFlags.RegularEnumExcludes, false); + } break; - case 181 /* ModuleDeclaration */: + case 188 /* ModuleDeclaration */: bindModuleDeclaration(node); break; - case 183 /* ImportDeclaration */: - bindDeclaration(node, 16777216 /* Import */, ts.SymbolFlags.ImportExcludes, false); + case 190 /* ImportDeclaration */: + bindDeclaration(node, 33554432 /* Import */, ts.SymbolFlags.ImportExcludes, false); break; - case 186 /* SourceFile */: + case 193 /* SourceFile */: if (ts.isExternalModule(node)) { - bindAnonymousDeclaration(node, 256 /* ValueModule */, '"' + ts.removeFileExtension(node.filename) + '"', true); + bindAnonymousDeclaration(node, 512 /* ValueModule */, '"' + ts.removeFileExtension(node.filename) + '"', true); break; } - case 151 /* Block */: - case 170 /* TryBlock */: - case 171 /* CatchBlock */: - case 172 /* FinallyBlock */: - case 158 /* ForStatement */: - case 159 /* ForInStatement */: - case 164 /* SwitchStatement */: + case 158 /* Block */: + case 177 /* TryBlock */: + case 178 /* CatchBlock */: + case 179 /* FinallyBlock */: + case 165 /* ForStatement */: + case 166 /* ForInStatement */: + case 171 /* SwitchStatement */: bindChildren(node, 0, true); break; default: @@ -6566,7 +6772,7 @@ var ts; } function getFirstConstructorWithBody(node) { return ts.forEach(node.members, function (member) { - if (member.kind === 122 /* Constructor */ && member.body) { + if (member.kind === 126 /* Constructor */ && member.body) { return member; } }); @@ -6576,14 +6782,14 @@ var ts; var getAccessor; var setAccessor; ts.forEach(node.members, function (member) { - if ((member.kind === 123 /* GetAccessor */ || member.kind === 124 /* SetAccessor */) && member.name.text === accessor.name.text && (member.flags & 128 /* Static */) === (accessor.flags & 128 /* Static */)) { + if ((member.kind === 127 /* GetAccessor */ || member.kind === 128 /* SetAccessor */) && member.name.text === accessor.name.text && (member.flags & 128 /* Static */) === (accessor.flags & 128 /* Static */)) { if (!firstAccessor) { firstAccessor = member; } - if (member.kind === 123 /* GetAccessor */ && !getAccessor) { + if (member.kind === 127 /* GetAccessor */ && !getAccessor) { getAccessor = member; } - if (member.kind === 124 /* SetAccessor */ && !setAccessor) { + if (member.kind === 128 /* SetAccessor */ && !setAccessor) { setAccessor = member; } } @@ -6906,7 +7112,7 @@ var ts; if (scopeName) { recordScopeNameStart(scopeName); } - else if (node.kind === 175 /* FunctionDeclaration */ || node.kind === 144 /* FunctionExpression */ || node.kind === 121 /* Method */ || node.kind === 123 /* GetAccessor */ || node.kind === 124 /* SetAccessor */ || node.kind === 181 /* ModuleDeclaration */ || node.kind === 177 /* ClassDeclaration */ || node.kind === 180 /* EnumDeclaration */) { + else if (node.kind === 182 /* FunctionDeclaration */ || node.kind === 149 /* FunctionExpression */ || node.kind === 125 /* Method */ || node.kind === 127 /* GetAccessor */ || node.kind === 128 /* SetAccessor */ || node.kind === 188 /* ModuleDeclaration */ || node.kind === 184 /* ClassDeclaration */ || node.kind === 187 /* EnumDeclaration */) { if (node.name) { scopeName = node.name.text; } @@ -6988,7 +7194,7 @@ var ts; } function emitNodeWithMap(node) { if (node) { - if (node.kind != 186 /* SourceFile */) { + if (node.kind != 193 /* SourceFile */) { recordEmitNodeStartSpan(node); emitNode(node); recordEmitNodeEndSpan(node); @@ -7075,13 +7281,76 @@ var ts; } } function emitLiteral(node) { - var text = getSourceTextOfLocalNode(node); - if (node.kind === 7 /* StringLiteral */ && compilerOptions.sourceMap) { + var text = getLiteralText(); + if (compilerOptions.sourceMap && (node.kind === 7 /* StringLiteral */ || ts.isTemplateLiteralKind(node.kind))) { writer.writeLiteral(text); } else { write(text); } + function getLiteralText() { + if (compilerOptions.target < 2 /* ES6 */ && ts.isTemplateLiteralKind(node.kind)) { + return getTemplateLiteralAsStringLiteral(node); + } + return getSourceTextOfLocalNode(node); + } + } + function getTemplateLiteralAsStringLiteral(node) { + return '"' + ts.escapeString(node.text) + '"'; + } + function emitTemplateExpression(node) { + if (compilerOptions.target >= 2 /* ES6 */) { + ts.forEachChild(node, emit); + return; + } + ts.Debug.assert(node.parent.kind !== 146 /* TaggedTemplateExpression */); + var templateNeedsParens = ts.isExpression(node.parent) && node.parent.kind !== 148 /* ParenExpression */ && comparePrecedenceToBinaryPlus(node.parent) !== -1 /* LessThan */; + if (templateNeedsParens) { + write("("); + } + emitLiteral(node.head); + ts.forEach(node.templateSpans, function (templateSpan) { + var needsParens = templateSpan.expression.kind !== 148 /* ParenExpression */ && comparePrecedenceToBinaryPlus(templateSpan.expression) !== 1 /* GreaterThan */; + write(" + "); + if (needsParens) { + write("("); + } + emit(templateSpan.expression); + if (needsParens) { + write(")"); + } + if (templateSpan.literal.text.length !== 0) { + write(" + "); + emitLiteral(templateSpan.literal); + } + }); + if (templateNeedsParens) { + write(")"); + } + function comparePrecedenceToBinaryPlus(expression) { + ts.Debug.assert(compilerOptions.target <= 1 /* ES5 */); + switch (expression.kind) { + case 153 /* BinaryExpression */: + switch (expression.operator) { + case 34 /* AsteriskToken */: + case 35 /* SlashToken */: + case 36 /* PercentToken */: + return 1 /* GreaterThan */; + case 32 /* PlusToken */: + return 0 /* EqualTo */; + default: + return -1 /* LessThan */; + } + case 154 /* ConditionalExpression */: + return -1 /* LessThan */; + default: + return 1 /* GreaterThan */; + } + } + } + function emitTemplateSpan(span) { + emit(span.expression); + emit(span.literal); } function emitQuotedIdentifier(node) { if (node.kind === 7 /* StringLiteral */) { @@ -7101,29 +7370,29 @@ var ts; function isNonExpressionIdentifier(node) { var parent = node.parent; switch (parent.kind) { - case 119 /* Parameter */: - case 174 /* VariableDeclaration */: - case 120 /* Property */: - case 137 /* PropertyAssignment */: - case 185 /* EnumMember */: - case 121 /* Method */: - case 175 /* FunctionDeclaration */: - case 123 /* GetAccessor */: - case 124 /* SetAccessor */: - case 144 /* FunctionExpression */: - case 177 /* ClassDeclaration */: - case 178 /* InterfaceDeclaration */: - case 180 /* EnumDeclaration */: - case 181 /* ModuleDeclaration */: - case 183 /* ImportDeclaration */: + case 123 /* Parameter */: + case 181 /* VariableDeclaration */: + case 124 /* Property */: + case 141 /* PropertyAssignment */: + case 192 /* EnumMember */: + case 125 /* Method */: + case 182 /* FunctionDeclaration */: + case 127 /* GetAccessor */: + case 128 /* SetAccessor */: + case 149 /* FunctionExpression */: + case 184 /* ClassDeclaration */: + case 185 /* InterfaceDeclaration */: + case 187 /* EnumDeclaration */: + case 188 /* ModuleDeclaration */: + case 190 /* ImportDeclaration */: return parent.name === node; - case 161 /* BreakStatement */: - case 160 /* ContinueStatement */: - case 184 /* ExportAssignment */: + case 168 /* BreakStatement */: + case 167 /* ContinueStatement */: + case 191 /* ExportAssignment */: return false; - case 167 /* LabeledStatement */: + case 174 /* LabeledStatement */: return node.parent.label === node; - case 171 /* CatchBlock */: + case 178 /* CatchBlock */: return node.parent.variable === node; } } @@ -7197,18 +7466,27 @@ var ts; emit(node.initializer); emitTrailingComments(node); } - function emitPropertyAccess(node) { + function tryEmitConstantValue(node) { var constantValue = resolver.getConstantValue(node); if (constantValue !== undefined) { - write(constantValue.toString() + " /* " + ts.identifierToString(node.right) + " */"); + var propertyName = node.kind === 142 /* PropertyAccess */ ? ts.identifierToString(node.right) : ts.getTextOfNode(node.index); + write(constantValue.toString() + " /* " + propertyName + " */"); + return true; } - else { - emit(node.left); - write("."); - emit(node.right); + return false; + } + function emitPropertyAccess(node) { + if (tryEmitConstantValue(node)) { + return; } + emit(node.left); + write("."); + emit(node.right); } function emitIndexedAccess(node) { + if (tryEmitConstantValue(node)) { + return; + } emit(node.object); write("["); emit(node.index); @@ -7216,13 +7494,13 @@ var ts; } function emitCallExpression(node) { var superCall = false; - if (node.func.kind === 85 /* SuperKeyword */) { + if (node.func.kind === 89 /* SuperKeyword */) { write("_super"); superCall = true; } else { emit(node.func); - superCall = node.func.kind === 138 /* PropertyAccess */ && node.func.left.kind === 85 /* SuperKeyword */; + superCall = node.func.kind === 142 /* PropertyAccess */ && node.func.left.kind === 89 /* SuperKeyword */; } if (superCall) { write(".call("); @@ -7248,13 +7526,19 @@ var ts; write(")"); } } + function emitTaggedTemplateExpression(node) { + ts.Debug.assert(compilerOptions.target >= 2 /* ES6 */, "Trying to emit a tagged template in pre-ES6 mode."); + emit(node.tag); + write(" "); + emit(node.template); + } function emitParenExpression(node) { - if (node.expression.kind === 142 /* TypeAssertion */) { + if (node.expression.kind === 147 /* TypeAssertion */) { var operand = node.expression.operand; - while (operand.kind == 142 /* TypeAssertion */) { + while (operand.kind == 147 /* TypeAssertion */) { operand = operand.operand; } - if (operand.kind !== 146 /* PrefixOperator */ && operand.kind !== 147 /* PostfixOperator */ && operand.kind !== 141 /* NewExpression */ && !(operand.kind === 140 /* CallExpression */ && node.parent.kind === 141 /* NewExpression */) && !(operand.kind === 144 /* FunctionExpression */ && node.parent.kind === 140 /* CallExpression */)) { + if (operand.kind !== 151 /* PrefixOperator */ && operand.kind !== 152 /* PostfixOperator */ && operand.kind !== 145 /* NewExpression */ && !(operand.kind === 144 /* CallExpression */ && node.parent.kind === 145 /* NewExpression */) && !(operand.kind === 149 /* FunctionExpression */ && node.parent.kind === 144 /* CallExpression */)) { emit(operand); return; } @@ -7264,29 +7548,29 @@ var ts; write(")"); } function emitUnaryExpression(node) { - if (node.kind === 146 /* PrefixOperator */) { + if (node.kind === 151 /* PrefixOperator */) { write(ts.tokenToString(node.operator)); } - if (node.operator >= 59 /* Identifier */) { + if (node.operator >= 63 /* Identifier */) { write(" "); } - else if (node.kind === 146 /* PrefixOperator */ && node.operand.kind === 146 /* PrefixOperator */) { + else if (node.kind === 151 /* PrefixOperator */ && node.operand.kind === 151 /* PrefixOperator */) { var operand = node.operand; - if (node.operator === 28 /* PlusToken */ && (operand.operator === 28 /* PlusToken */ || operand.operator === 33 /* PlusPlusToken */)) { + if (node.operator === 32 /* PlusToken */ && (operand.operator === 32 /* PlusToken */ || operand.operator === 37 /* PlusPlusToken */)) { write(" "); } - else if (node.operator === 29 /* MinusToken */ && (operand.operator === 29 /* MinusToken */ || operand.operator === 34 /* MinusMinusToken */)) { + else if (node.operator === 33 /* MinusToken */ && (operand.operator === 33 /* MinusToken */ || operand.operator === 38 /* MinusMinusToken */)) { write(" "); } } emit(node.operand); - if (node.kind === 147 /* PostfixOperator */) { + if (node.kind === 152 /* PostfixOperator */) { write(ts.tokenToString(node.operator)); } } function emitBinaryExpression(node) { emit(node.left); - if (node.operator !== 18 /* CommaToken */) + if (node.operator !== 22 /* CommaToken */) write(" "); write(ts.tokenToString(node.operator)); write(" "); @@ -7300,21 +7584,21 @@ var ts; emit(node.whenFalse); } function emitBlock(node) { - emitToken(9 /* OpenBraceToken */, node.pos); + emitToken(13 /* OpenBraceToken */, node.pos); increaseIndent(); scopeEmitStart(node.parent); - if (node.kind === 182 /* ModuleBlock */) { - ts.Debug.assert(node.parent.kind === 181 /* ModuleDeclaration */); + if (node.kind === 189 /* ModuleBlock */) { + ts.Debug.assert(node.parent.kind === 188 /* ModuleDeclaration */); emitCaptureThisForNodeIfNecessary(node.parent); } emitLines(node.statements); decreaseIndent(); writeLine(); - emitToken(10 /* CloseBraceToken */, node.statements.end); + emitToken(14 /* CloseBraceToken */, node.statements.end); scopeEmitEnd(); } function emitEmbeddedStatement(node) { - if (node.kind === 151 /* Block */) { + if (node.kind === 158 /* Block */) { write(" "); emit(node); } @@ -7326,7 +7610,7 @@ var ts; } } function emitExpressionStatement(node) { - var isArrowExpression = node.expression.kind === 145 /* ArrowFunction */; + var isArrowExpression = node.expression.kind === 150 /* ArrowFunction */; emitLeadingComments(node); if (isArrowExpression) write("("); @@ -7338,16 +7622,16 @@ var ts; } function emitIfStatement(node) { emitLeadingComments(node); - var endPos = emitToken(78 /* IfKeyword */, node.pos); + var endPos = emitToken(82 /* IfKeyword */, node.pos); write(" "); - endPos = emitToken(11 /* OpenParenToken */, endPos); + endPos = emitToken(15 /* OpenParenToken */, endPos); emit(node.expression); - emitToken(12 /* CloseParenToken */, node.expression.end); + emitToken(16 /* CloseParenToken */, node.expression.end); emitEmbeddedStatement(node.thenStatement); if (node.elseStatement) { writeLine(); - emitToken(70 /* ElseKeyword */, node.thenStatement.end); - if (node.elseStatement.kind === 155 /* IfStatement */) { + emitToken(74 /* ElseKeyword */, node.thenStatement.end); + if (node.elseStatement.kind === 162 /* IfStatement */) { write(" "); emit(node.elseStatement); } @@ -7360,7 +7644,7 @@ var ts; function emitDoStatement(node) { write("do"); emitEmbeddedStatement(node.statement); - if (node.statement.kind === 151 /* Block */) { + if (node.statement.kind === 158 /* Block */) { write(" "); } else { @@ -7377,18 +7661,18 @@ var ts; emitEmbeddedStatement(node.statement); } function emitForStatement(node) { - var endPos = emitToken(76 /* ForKeyword */, node.pos); + var endPos = emitToken(80 /* ForKeyword */, node.pos); write(" "); - endPos = emitToken(11 /* OpenParenToken */, endPos); + endPos = emitToken(15 /* OpenParenToken */, endPos); if (node.declarations) { if (node.declarations[0] && node.declarations[0].flags & 2048 /* Let */) { - emitToken(98 /* LetKeyword */, endPos); + emitToken(102 /* LetKeyword */, endPos); } else if (node.declarations[0] && node.declarations[0].flags & 4096 /* Const */) { - emitToken(64 /* ConstKeyword */, endPos); + emitToken(68 /* ConstKeyword */, endPos); } else { - emitToken(92 /* VarKeyword */, endPos); + emitToken(96 /* VarKeyword */, endPos); } write(" "); emitCommaList(node.declarations, false); @@ -7404,15 +7688,15 @@ var ts; emitEmbeddedStatement(node.statement); } function emitForInStatement(node) { - var endPos = emitToken(76 /* ForKeyword */, node.pos); + var endPos = emitToken(80 /* ForKeyword */, node.pos); write(" "); - endPos = emitToken(11 /* OpenParenToken */, endPos); + endPos = emitToken(15 /* OpenParenToken */, endPos); if (node.declaration) { if (node.declaration.flags & 2048 /* Let */) { - emitToken(98 /* LetKeyword */, endPos); + emitToken(102 /* LetKeyword */, endPos); } else { - emitToken(92 /* VarKeyword */, endPos); + emitToken(96 /* VarKeyword */, endPos); } write(" "); emit(node.declaration); @@ -7422,17 +7706,17 @@ var ts; } write(" in "); emit(node.expression); - emitToken(12 /* CloseParenToken */, node.expression.end); + emitToken(16 /* CloseParenToken */, node.expression.end); emitEmbeddedStatement(node.statement); } function emitBreakOrContinueStatement(node) { - emitToken(node.kind === 161 /* BreakStatement */ ? 60 /* BreakKeyword */ : 65 /* ContinueKeyword */, node.pos); + emitToken(node.kind === 168 /* BreakStatement */ ? 64 /* BreakKeyword */ : 69 /* ContinueKeyword */, node.pos); emitOptional(" ", node.label); write(";"); } function emitReturnStatement(node) { emitLeadingComments(node); - emitToken(84 /* ReturnKeyword */, node.pos); + emitToken(88 /* ReturnKeyword */, node.pos); emitOptional(" ", node.expression); write(";"); emitTrailingComments(node); @@ -7444,21 +7728,24 @@ var ts; emitEmbeddedStatement(node.statement); } function emitSwitchStatement(node) { - var endPos = emitToken(86 /* SwitchKeyword */, node.pos); + var endPos = emitToken(90 /* SwitchKeyword */, node.pos); write(" "); - emitToken(11 /* OpenParenToken */, endPos); + emitToken(15 /* OpenParenToken */, endPos); emit(node.expression); - endPos = emitToken(12 /* CloseParenToken */, node.expression.end); + endPos = emitToken(16 /* CloseParenToken */, node.expression.end); write(" "); - emitToken(9 /* OpenBraceToken */, endPos); + emitToken(13 /* OpenBraceToken */, endPos); increaseIndent(); emitLines(node.clauses); decreaseIndent(); writeLine(); - emitToken(10 /* CloseBraceToken */, node.clauses.end); + emitToken(14 /* CloseBraceToken */, node.clauses.end); + } + function isOnSameLine(node1, node2) { + return getLineOfLocalPosition(ts.skipTrivia(currentSourceFile.text, node1.pos)) === getLineOfLocalPosition(ts.skipTrivia(currentSourceFile.text, node2.pos)); } function emitCaseOrDefaultClause(node) { - if (node.kind === 165 /* CaseClause */) { + if (node.kind === 172 /* CaseClause */) { write("case "); emit(node.expression); write(":"); @@ -7466,9 +7753,15 @@ var ts; else { write("default:"); } - increaseIndent(); - emitLines(node.statements); - decreaseIndent(); + if (node.statements.length === 1 && isOnSameLine(node, node.statements[0])) { + write(" "); + emit(node.statements[0]); + } + else { + increaseIndent(); + emitLines(node.statements); + decreaseIndent(); + } } function emitThrowStatement(node) { write("throw "); @@ -7487,16 +7780,16 @@ var ts; } function emitCatchBlock(node) { writeLine(); - var endPos = emitToken(62 /* CatchKeyword */, node.pos); + var endPos = emitToken(66 /* CatchKeyword */, node.pos); write(" "); - emitToken(11 /* OpenParenToken */, endPos); + emitToken(15 /* OpenParenToken */, endPos); emit(node.variable); - emitToken(12 /* CloseParenToken */, node.variable.end); + emitToken(16 /* CloseParenToken */, node.variable.end); write(" "); emitBlock(node); } function emitDebuggerStatement(node) { - emitToken(66 /* DebuggerKeyword */, node.pos); + emitToken(70 /* DebuggerKeyword */, node.pos); write(";"); } function emitLabelledStatement(node) { @@ -7507,7 +7800,7 @@ var ts; function getContainingModule(node) { do { node = node.parent; - } while (node && node.kind !== 181 /* ModuleDeclaration */); + } while (node && node.kind !== 188 /* ModuleDeclaration */); return node; } function emitModuleMemberName(node) { @@ -7606,7 +7899,7 @@ var ts; } function emitAccessor(node) { emitLeadingComments(node); - write(node.kind === 123 /* GetAccessor */ ? "get " : "set "); + write(node.kind === 127 /* GetAccessor */ ? "get " : "set "); emit(node.name); emitSignatureAndBody(node); emitTrailingComments(node); @@ -7615,15 +7908,15 @@ var ts; if (!node.body) { return emitPinnedOrTripleSlashComments(node); } - if (node.kind !== 121 /* Method */) { + if (node.kind !== 125 /* Method */) { emitLeadingComments(node); } write("function "); - if (node.kind === 175 /* FunctionDeclaration */ || (node.kind === 144 /* FunctionExpression */ && node.name)) { + if (node.kind === 182 /* FunctionDeclaration */ || (node.kind === 149 /* FunctionExpression */ && node.name)) { emit(node.name); } emitSignatureAndBody(node); - if (node.kind !== 121 /* Method */) { + if (node.kind !== 125 /* Method */) { emitTrailingComments(node); } } @@ -7649,16 +7942,16 @@ var ts; write(" {"); scopeEmitStart(node); increaseIndent(); - emitDetachedComments(node.body.kind === 176 /* FunctionBlock */ ? node.body.statements : node.body); + emitDetachedComments(node.body.kind === 183 /* FunctionBlock */ ? node.body.statements : node.body); var startIndex = 0; - if (node.body.kind === 176 /* FunctionBlock */) { + if (node.body.kind === 183 /* FunctionBlock */) { startIndex = emitDirectivePrologues(node.body.statements, true); } var outPos = writer.getTextPos(); emitCaptureThisForNodeIfNecessary(node); emitDefaultValueAssignments(node); emitRestParameter(node); - if (node.body.kind !== 176 /* FunctionBlock */ && outPos === writer.getTextPos()) { + if (node.body.kind !== 183 /* FunctionBlock */ && outPos === writer.getTextPos()) { decreaseIndent(); write(" "); emitStart(node.body); @@ -7671,7 +7964,7 @@ var ts; emitEnd(node.body); } else { - if (node.body.kind === 176 /* FunctionBlock */) { + if (node.body.kind === 183 /* FunctionBlock */) { emitLinesStartingAt(node.body.statements, startIndex); } else { @@ -7683,10 +7976,10 @@ var ts; emitTrailingComments(node.body); } writeLine(); - if (node.body.kind === 176 /* FunctionBlock */) { + if (node.body.kind === 183 /* FunctionBlock */) { emitLeadingCommentsOfPosition(node.body.statements.end); decreaseIndent(); - emitToken(10 /* CloseBraceToken */, node.body.statements.end); + emitToken(14 /* CloseBraceToken */, node.body.statements.end); } else { decreaseIndent(); @@ -7709,11 +8002,11 @@ var ts; function findInitialSuperCall(ctor) { if (ctor.body) { var statement = ctor.body.statements[0]; - if (statement && statement.kind === 154 /* ExpressionStatement */) { + if (statement && statement.kind === 161 /* ExpressionStatement */) { var expr = statement.expression; - if (expr && expr.kind === 140 /* CallExpression */) { + if (expr && expr.kind === 144 /* CallExpression */) { var func = expr.func; - if (func && func.kind === 85 /* SuperKeyword */) { + if (func && func.kind === 89 /* SuperKeyword */) { return statement; } } @@ -7749,7 +8042,7 @@ var ts; } function emitMemberAssignments(node, staticFlag) { ts.forEach(node.members, function (member) { - if (member.kind === 120 /* Property */ && (member.flags & 128 /* Static */) === staticFlag && member.initializer) { + if (member.kind === 124 /* Property */ && (member.flags & 128 /* Static */) === staticFlag && member.initializer) { writeLine(); emitLeadingComments(member); emitStart(member); @@ -7772,7 +8065,7 @@ var ts; } function emitMemberFunctions(node) { ts.forEach(node.members, function (member) { - if (member.kind === 121 /* Method */) { + if (member.kind === 125 /* Method */) { if (!member.body) { return emitPinnedOrTripleSlashComments(member); } @@ -7794,7 +8087,7 @@ var ts; write(";"); emitTrailingComments(member); } - else if (member.kind === 123 /* GetAccessor */ || member.kind === 124 /* SetAccessor */) { + else if (member.kind === 127 /* GetAccessor */ || member.kind === 128 /* SetAccessor */) { var accessors = getAllAccessorDeclarations(node, member); if (member === accessors.firstAccessor) { writeLine(); @@ -7872,11 +8165,11 @@ var ts; write("return "); emitNode(node.name); } - emitToken(10 /* CloseBraceToken */, node.members.end, emitClassReturnStatement); + emitToken(14 /* CloseBraceToken */, node.members.end, emitClassReturnStatement); write(";"); decreaseIndent(); writeLine(); - emitToken(10 /* CloseBraceToken */, node.members.end); + emitToken(14 /* CloseBraceToken */, node.members.end); scopeEmitEnd(); emitStart(node); write(")("); @@ -7897,7 +8190,7 @@ var ts; emitTrailingComments(node); function emitConstructorOfClass() { ts.forEach(node.members, function (member) { - if (member.kind === 122 /* Constructor */ && !member.body) { + if (member.kind === 126 /* Constructor */ && !member.body) { emitPinnedOrTripleSlashComments(member); } }); @@ -7948,7 +8241,7 @@ var ts; emitLeadingCommentsOfPosition(ctor.body.statements.end); } decreaseIndent(); - emitToken(10 /* CloseBraceToken */, ctor ? ctor.body.statements.end : node.members.end); + emitToken(14 /* CloseBraceToken */, ctor ? ctor.body.statements.end : node.members.end); scopeEmitEnd(); emitEnd(ctor || node); if (ctor) { @@ -7960,6 +8253,9 @@ var ts; emitPinnedOrTripleSlashComments(node); } function emitEnumDeclaration(node) { + if (ts.isConstEnumDeclaration(node) && !compilerOptions.preserveConstEnums) { + return; + } emitLeadingComments(node); if (!(node.flags & 1 /* Export */)) { emitStart(node); @@ -7980,7 +8276,7 @@ var ts; emitEnumMemberDeclarations(); decreaseIndent(); writeLine(); - emitToken(10 /* CloseBraceToken */, node.members.end); + emitToken(14 /* CloseBraceToken */, node.members.end); scopeEmitEnd(); write(")("); emitModuleMemberName(node); @@ -8025,13 +8321,13 @@ var ts; } } function getInnerMostModuleDeclarationFromDottedModule(moduleDeclaration) { - if (moduleDeclaration.body.kind === 181 /* ModuleDeclaration */) { + if (moduleDeclaration.body.kind === 188 /* ModuleDeclaration */) { var recursiveInnerModule = getInnerMostModuleDeclarationFromDottedModule(moduleDeclaration.body); return recursiveInnerModule || moduleDeclaration.body; } } function emitModuleDeclaration(node) { - if (!ts.isInstantiated(node)) { + if (ts.getModuleInstanceState(node) !== 1 /* Instantiated */) { return emitPinnedOrTripleSlashComments(node); } emitLeadingComments(node); @@ -8047,7 +8343,7 @@ var ts; write(resolver.getLocalNameOfContainer(node)); emitEnd(node.name); write(") "); - if (node.body.kind === 182 /* ModuleBlock */) { + if (node.body.kind === 189 /* ModuleBlock */) { emit(node.body); } else { @@ -8060,7 +8356,7 @@ var ts; decreaseIndent(); writeLine(); var moduleBlock = getInnerMostModuleDeclarationFromDottedModule(node).body; - emitToken(10 /* CloseBraceToken */, moduleBlock.statements.end); + emitToken(14 /* CloseBraceToken */, moduleBlock.statements.end); scopeEmitEnd(); } write(")("); @@ -8078,10 +8374,10 @@ var ts; function emitImportDeclaration(node) { var emitImportDeclaration = resolver.isReferencedImportDeclaration(node); if (!emitImportDeclaration) { - emitImportDeclaration = !ts.isExternalModule(currentSourceFile) && resolver.isTopLevelValueImportedViaEntityName(node); + emitImportDeclaration = !ts.isExternalModule(currentSourceFile) && resolver.isTopLevelValueImportWithEntityName(node); } if (emitImportDeclaration) { - if (node.externalModuleName && node.parent.kind === 186 /* SourceFile */ && compilerOptions.module === 2 /* AMD */) { + if (node.externalModuleName && node.parent.kind === 193 /* SourceFile */ && compilerOptions.module === 2 /* AMD */) { if (node.flags & 1 /* Export */) { writeLine(); emitLeadingComments(node); @@ -8110,7 +8406,7 @@ var ts; emitStart(node.externalModuleName); emitLiteral(node.externalModuleName); emitEnd(node.externalModuleName); - emitToken(12 /* CloseParenToken */, node.externalModuleName.end); + emitToken(16 /* CloseParenToken */, node.externalModuleName.end); } write(";"); emitEnd(node); @@ -8121,7 +8417,7 @@ var ts; function getExternalImportDeclarations(node) { var result = []; ts.forEach(node.statements, function (stat) { - if (stat.kind === 183 /* ImportDeclaration */ && stat.externalModuleName && resolver.isReferencedImportDeclaration(stat)) { + if (stat.kind === 190 /* ImportDeclaration */ && stat.externalModuleName && resolver.isReferencedImportDeclaration(stat)) { result.push(stat); } }); @@ -8129,7 +8425,7 @@ var ts; } function getFirstExportAssignment(sourceFile) { return ts.forEach(sourceFile.statements, function (node) { - if (node.kind === 184 /* ExportAssignment */) { + if (node.kind === 191 /* ExportAssignment */) { return node; } }); @@ -8245,117 +8541,127 @@ var ts; return emitPinnedOrTripleSlashComments(node); } switch (node.kind) { - case 59 /* Identifier */: + case 63 /* Identifier */: return emitIdentifier(node); - case 119 /* Parameter */: + case 123 /* Parameter */: return emitParameter(node); - case 123 /* GetAccessor */: - case 124 /* SetAccessor */: + case 127 /* GetAccessor */: + case 128 /* SetAccessor */: return emitAccessor(node); - case 87 /* ThisKeyword */: + case 91 /* ThisKeyword */: return emitThis(node); - case 85 /* SuperKeyword */: + case 89 /* SuperKeyword */: return emitSuper(node); - case 83 /* NullKeyword */: + case 87 /* NullKeyword */: return write("null"); - case 89 /* TrueKeyword */: + case 93 /* TrueKeyword */: return write("true"); - case 74 /* FalseKeyword */: + case 78 /* FalseKeyword */: return write("false"); case 6 /* NumericLiteral */: case 7 /* StringLiteral */: case 8 /* RegularExpressionLiteral */: + case 9 /* NoSubstitutionTemplateLiteral */: + case 10 /* TemplateHead */: + case 11 /* TemplateMiddle */: + case 12 /* TemplateTail */: return emitLiteral(node); - case 117 /* QualifiedName */: + case 155 /* TemplateExpression */: + return emitTemplateExpression(node); + case 156 /* TemplateSpan */: + return emitTemplateSpan(node); + case 121 /* QualifiedName */: return emitPropertyAccess(node); - case 135 /* ArrayLiteral */: + case 139 /* ArrayLiteral */: return emitArrayLiteral(node); - case 136 /* ObjectLiteral */: + case 140 /* ObjectLiteral */: return emitObjectLiteral(node); - case 137 /* PropertyAssignment */: + case 141 /* PropertyAssignment */: return emitPropertyAssignment(node); - case 138 /* PropertyAccess */: + case 142 /* PropertyAccess */: return emitPropertyAccess(node); - case 139 /* IndexedAccess */: + case 143 /* IndexedAccess */: return emitIndexedAccess(node); - case 140 /* CallExpression */: + case 144 /* CallExpression */: return emitCallExpression(node); - case 141 /* NewExpression */: + case 145 /* NewExpression */: return emitNewExpression(node); - case 142 /* TypeAssertion */: + case 146 /* TaggedTemplateExpression */: + return emitTaggedTemplateExpression(node); + case 147 /* TypeAssertion */: return emit(node.operand); - case 143 /* ParenExpression */: + case 148 /* ParenExpression */: return emitParenExpression(node); - case 175 /* FunctionDeclaration */: - case 144 /* FunctionExpression */: - case 145 /* ArrowFunction */: + case 182 /* FunctionDeclaration */: + case 149 /* FunctionExpression */: + case 150 /* ArrowFunction */: return emitFunctionDeclaration(node); - case 146 /* PrefixOperator */: - case 147 /* PostfixOperator */: + case 151 /* PrefixOperator */: + case 152 /* PostfixOperator */: return emitUnaryExpression(node); - case 148 /* BinaryExpression */: + case 153 /* BinaryExpression */: return emitBinaryExpression(node); - case 149 /* ConditionalExpression */: + case 154 /* ConditionalExpression */: return emitConditionalExpression(node); - case 150 /* OmittedExpression */: + case 157 /* OmittedExpression */: return; - case 151 /* Block */: - case 170 /* TryBlock */: - case 172 /* FinallyBlock */: - case 176 /* FunctionBlock */: - case 182 /* ModuleBlock */: + case 158 /* Block */: + case 177 /* TryBlock */: + case 179 /* FinallyBlock */: + case 183 /* FunctionBlock */: + case 189 /* ModuleBlock */: return emitBlock(node); - case 152 /* VariableStatement */: + case 159 /* VariableStatement */: return emitVariableStatement(node); - case 153 /* EmptyStatement */: + case 160 /* EmptyStatement */: return write(";"); - case 154 /* ExpressionStatement */: + case 161 /* ExpressionStatement */: return emitExpressionStatement(node); - case 155 /* IfStatement */: + case 162 /* IfStatement */: return emitIfStatement(node); - case 156 /* DoStatement */: + case 163 /* DoStatement */: return emitDoStatement(node); - case 157 /* WhileStatement */: + case 164 /* WhileStatement */: return emitWhileStatement(node); - case 158 /* ForStatement */: + case 165 /* ForStatement */: return emitForStatement(node); - case 159 /* ForInStatement */: + case 166 /* ForInStatement */: return emitForInStatement(node); - case 160 /* ContinueStatement */: - case 161 /* BreakStatement */: + case 167 /* ContinueStatement */: + case 168 /* BreakStatement */: return emitBreakOrContinueStatement(node); - case 162 /* ReturnStatement */: + case 169 /* ReturnStatement */: return emitReturnStatement(node); - case 163 /* WithStatement */: + case 170 /* WithStatement */: return emitWithStatement(node); - case 164 /* SwitchStatement */: + case 171 /* SwitchStatement */: return emitSwitchStatement(node); - case 165 /* CaseClause */: - case 166 /* DefaultClause */: + case 172 /* CaseClause */: + case 173 /* DefaultClause */: return emitCaseOrDefaultClause(node); - case 167 /* LabeledStatement */: + case 174 /* LabeledStatement */: return emitLabelledStatement(node); - case 168 /* ThrowStatement */: + case 175 /* ThrowStatement */: return emitThrowStatement(node); - case 169 /* TryStatement */: + case 176 /* TryStatement */: return emitTryStatement(node); - case 171 /* CatchBlock */: + case 178 /* CatchBlock */: return emitCatchBlock(node); - case 173 /* DebuggerStatement */: + case 180 /* DebuggerStatement */: return emitDebuggerStatement(node); - case 174 /* VariableDeclaration */: + case 181 /* VariableDeclaration */: return emitVariableDeclaration(node); - case 177 /* ClassDeclaration */: + case 184 /* ClassDeclaration */: return emitClassDeclaration(node); - case 178 /* InterfaceDeclaration */: + case 185 /* InterfaceDeclaration */: return emitInterfaceDeclaration(node); - case 180 /* EnumDeclaration */: + case 187 /* EnumDeclaration */: return emitEnumDeclaration(node); - case 181 /* ModuleDeclaration */: + case 188 /* ModuleDeclaration */: return emitModuleDeclaration(node); - case 183 /* ImportDeclaration */: + case 190 /* ImportDeclaration */: return emitImportDeclaration(node); - case 186 /* SourceFile */: + case 193 /* SourceFile */: return emitSourceFile(node); } } @@ -8373,7 +8679,7 @@ var ts; return leadingComments; } function getLeadingCommentsToEmit(node) { - if (node.parent.kind === 186 /* SourceFile */ || node.pos !== node.parent.pos) { + if (node.parent.kind === 193 /* SourceFile */ || node.pos !== node.parent.pos) { var leadingComments; if (hasDetachedComments(node.pos)) { leadingComments = getLeadingCommentsWithoutDetachedComments(); @@ -8390,7 +8696,7 @@ var ts; emitComments(leadingComments, true, writer, writeComment); } function emitTrailingDeclarationComments(node) { - if (node.parent.kind === 186 /* SourceFile */ || node.end !== node.parent.end) { + if (node.parent.kind === 193 /* SourceFile */ || node.end !== node.parent.end) { var trailingComments = ts.getTrailingCommentRanges(currentSourceFile.text, node.end); emitComments(trailingComments, false, writer, writeComment); } @@ -8582,7 +8888,7 @@ var ts; if (node.flags & 1 /* Export */) { write("export "); } - if (node.kind !== 178 /* InterfaceDeclaration */) { + if (node.kind !== 185 /* InterfaceDeclaration */) { write("declare "); } } @@ -8638,7 +8944,7 @@ var ts; emitDeclarationFlags(node); write("module "); emitSourceTextOfNode(node.name); - while (node.body.kind !== 182 /* ModuleBlock */) { + while (node.body.kind !== 189 /* ModuleBlock */) { node = node.body; write("."); emitSourceTextOfNode(node.name); @@ -8680,6 +8986,9 @@ var ts; if (resolver.isDeclarationVisible(node)) { emitJsDocComments(node); emitDeclarationFlags(node); + if (ts.isConstEnumDeclaration(node)) { + write("const "); + } write("enum "); emitSourceTextOfNode(node.name); write(" {"); @@ -8707,30 +9016,30 @@ var ts; function getTypeParameterConstraintVisibilityError(symbolAccesibilityResult) { var diagnosticMessage; switch (node.parent.kind) { - case 177 /* ClassDeclaration */: + case 184 /* ClassDeclaration */: diagnosticMessage = symbolAccesibilityResult.errorModuleName ? ts.Diagnostics.Type_parameter_0_of_exported_class_has_or_is_using_name_1_from_private_module_2 : ts.Diagnostics.Type_parameter_0_of_exported_class_has_or_is_using_private_name_1; break; - case 178 /* InterfaceDeclaration */: + case 185 /* InterfaceDeclaration */: diagnosticMessage = symbolAccesibilityResult.errorModuleName ? ts.Diagnostics.Type_parameter_0_of_exported_interface_has_or_is_using_name_1_from_private_module_2 : ts.Diagnostics.Type_parameter_0_of_exported_interface_has_or_is_using_private_name_1; break; - case 126 /* ConstructSignature */: + case 130 /* ConstructSignature */: diagnosticMessage = symbolAccesibilityResult.errorModuleName ? ts.Diagnostics.Type_parameter_0_of_constructor_signature_from_exported_interface_has_or_is_using_name_1_from_private_module_2 : ts.Diagnostics.Type_parameter_0_of_constructor_signature_from_exported_interface_has_or_is_using_private_name_1; break; - case 125 /* CallSignature */: + case 129 /* CallSignature */: diagnosticMessage = symbolAccesibilityResult.errorModuleName ? ts.Diagnostics.Type_parameter_0_of_call_signature_from_exported_interface_has_or_is_using_name_1_from_private_module_2 : ts.Diagnostics.Type_parameter_0_of_call_signature_from_exported_interface_has_or_is_using_private_name_1; break; - case 121 /* Method */: + case 125 /* Method */: if (node.parent.flags & 128 /* Static */) { diagnosticMessage = symbolAccesibilityResult.errorModuleName ? ts.Diagnostics.Type_parameter_0_of_public_static_method_from_exported_class_has_or_is_using_name_1_from_private_module_2 : ts.Diagnostics.Type_parameter_0_of_public_static_method_from_exported_class_has_or_is_using_private_name_1; } - else if (node.parent.parent.kind === 177 /* ClassDeclaration */) { + else if (node.parent.parent.kind === 184 /* ClassDeclaration */) { diagnosticMessage = symbolAccesibilityResult.errorModuleName ? ts.Diagnostics.Type_parameter_0_of_public_method_from_exported_class_has_or_is_using_name_1_from_private_module_2 : ts.Diagnostics.Type_parameter_0_of_public_method_from_exported_class_has_or_is_using_private_name_1; } else { diagnosticMessage = symbolAccesibilityResult.errorModuleName ? ts.Diagnostics.Type_parameter_0_of_method_from_exported_interface_has_or_is_using_name_1_from_private_module_2 : ts.Diagnostics.Type_parameter_0_of_method_from_exported_interface_has_or_is_using_private_name_1; } break; - case 175 /* FunctionDeclaration */: + case 182 /* FunctionDeclaration */: diagnosticMessage = symbolAccesibilityResult.errorModuleName ? ts.Diagnostics.Type_parameter_0_of_exported_function_has_or_is_using_name_1_from_private_module_2 : ts.Diagnostics.Type_parameter_0_of_exported_function_has_or_is_using_private_name_1; break; default: @@ -8746,7 +9055,7 @@ var ts; emitJsDocComments(node); decreaseIndent(); emitSourceTextOfNode(node.name); - if (node.constraint && (node.parent.kind !== 121 /* Method */ || !(node.parent.flags & 32 /* Private */))) { + if (node.constraint && (node.parent.kind !== 125 /* Method */ || !(node.parent.flags & 32 /* Private */))) { write(" extends "); getSymbolVisibilityDiagnosticMessage = getTypeParameterConstraintVisibilityError; resolver.writeTypeAtLocation(node.constraint, enclosingDeclaration, 2 /* UseTypeOfFunction */, writer); @@ -8768,7 +9077,7 @@ var ts; resolver.writeTypeAtLocation(node, enclosingDeclaration, 1 /* WriteArrayAsGenericType */ | 2 /* UseTypeOfFunction */, writer); function getHeritageClauseVisibilityError(symbolAccesibilityResult) { var diagnosticMessage; - if (node.parent.kind === 177 /* ClassDeclaration */) { + if (node.parent.kind === 184 /* ClassDeclaration */) { if (symbolAccesibilityResult.errorModuleName) { diagnosticMessage = isImplementsList ? ts.Diagnostics.Implements_clause_of_exported_class_0_has_or_is_using_name_1_from_private_module_2 : ts.Diagnostics.Extends_clause_of_exported_class_0_has_or_is_using_name_1_from_private_module_2; } @@ -8853,9 +9162,9 @@ var ts; writeLine(); } function emitVariableDeclaration(node) { - if (node.kind !== 174 /* VariableDeclaration */ || resolver.isDeclarationVisible(node)) { + if (node.kind !== 181 /* VariableDeclaration */ || resolver.isDeclarationVisible(node)) { emitSourceTextOfNode(node.name); - if (node.kind === 120 /* Property */ && (node.flags & 4 /* QuestionMark */)) { + if (node.kind === 124 /* Property */ && (node.flags & 4 /* QuestionMark */)) { write("?"); } if (!(node.flags & 32 /* Private */)) { @@ -8866,14 +9175,14 @@ var ts; } function getVariableDeclarationTypeVisibilityError(symbolAccesibilityResult) { var diagnosticMessage; - if (node.kind === 174 /* VariableDeclaration */) { + if (node.kind === 181 /* VariableDeclaration */) { diagnosticMessage = symbolAccesibilityResult.errorModuleName ? symbolAccesibilityResult.accessibility === 2 /* CannotBeNamed */ ? ts.Diagnostics.Exported_variable_0_has_or_is_using_name_1_from_external_module_2_but_cannot_be_named : ts.Diagnostics.Exported_variable_0_has_or_is_using_name_1_from_private_module_2 : ts.Diagnostics.Exported_variable_0_has_or_is_using_private_name_1; } - else if (node.kind === 120 /* Property */) { + else if (node.kind === 124 /* Property */) { if (node.flags & 128 /* Static */) { diagnosticMessage = symbolAccesibilityResult.errorModuleName ? symbolAccesibilityResult.accessibility === 2 /* CannotBeNamed */ ? ts.Diagnostics.Public_static_property_0_of_exported_class_has_or_is_using_name_1_from_external_module_2_but_cannot_be_named : ts.Diagnostics.Public_static_property_0_of_exported_class_has_or_is_using_name_1_from_private_module_2 : ts.Diagnostics.Public_static_property_0_of_exported_class_has_or_is_using_private_name_1; } - else if (node.parent.kind === 177 /* ClassDeclaration */) { + else if (node.parent.kind === 184 /* ClassDeclaration */) { diagnosticMessage = symbolAccesibilityResult.errorModuleName ? symbolAccesibilityResult.accessibility === 2 /* CannotBeNamed */ ? ts.Diagnostics.Public_property_0_of_exported_class_has_or_is_using_name_1_from_external_module_2_but_cannot_be_named : ts.Diagnostics.Public_property_0_of_exported_class_has_or_is_using_name_1_from_private_module_2 : ts.Diagnostics.Public_property_0_of_exported_class_has_or_is_using_private_name_1; } else { @@ -8923,7 +9232,7 @@ var ts; } function getAccessorDeclarationTypeVisibilityError(symbolAccesibilityResult) { var diagnosticMessage; - if (node.kind === 124 /* SetAccessor */) { + if (node.kind === 128 /* SetAccessor */) { if (node.parent.flags & 128 /* Static */) { diagnosticMessage = symbolAccesibilityResult.errorModuleName ? ts.Diagnostics.Parameter_0_of_public_static_property_setter_from_exported_class_has_or_is_using_name_1_from_private_module_2 : ts.Diagnostics.Parameter_0_of_public_static_property_setter_from_exported_class_has_or_is_using_private_name_1; } @@ -8952,14 +9261,14 @@ var ts; } } function emitFunctionDeclaration(node) { - if ((node.kind !== 175 /* FunctionDeclaration */ || resolver.isDeclarationVisible(node)) && !resolver.isImplementationOfOverload(node)) { + if ((node.kind !== 182 /* FunctionDeclaration */ || resolver.isDeclarationVisible(node)) && !resolver.isImplementationOfOverload(node)) { emitJsDocComments(node); emitDeclarationFlags(node); - if (node.kind === 175 /* FunctionDeclaration */) { + if (node.kind === 182 /* FunctionDeclaration */) { write("function "); emitSourceTextOfNode(node.name); } - else if (node.kind === 122 /* Constructor */) { + else if (node.kind === 126 /* Constructor */) { write("constructor"); } else { @@ -8977,24 +9286,24 @@ var ts; emitSignatureDeclaration(node); } function emitSignatureDeclaration(node) { - if (node.kind === 125 /* CallSignature */ || node.kind === 127 /* IndexSignature */) { + if (node.kind === 129 /* CallSignature */ || node.kind === 131 /* IndexSignature */) { emitJsDocComments(node); } emitTypeParameters(node.typeParameters); - if (node.kind === 127 /* IndexSignature */) { + if (node.kind === 131 /* IndexSignature */) { write("["); } else { write("("); } emitCommaList(node.parameters, emitParameterDeclaration); - if (node.kind === 127 /* IndexSignature */) { + if (node.kind === 131 /* IndexSignature */) { write("]"); } else { write(")"); } - if (node.kind !== 122 /* Constructor */ && !(node.flags & 32 /* Private */)) { + if (node.kind !== 126 /* Constructor */ && !(node.flags & 32 /* Private */)) { write(": "); getSymbolVisibilityDiagnosticMessage = getReturnTypeVisibilityError; resolver.writeReturnTypeOfSignatureDeclaration(node, enclosingDeclaration, 2 /* UseTypeOfFunction */, writer); @@ -9004,27 +9313,27 @@ var ts; function getReturnTypeVisibilityError(symbolAccesibilityResult) { var diagnosticMessage; switch (node.kind) { - case 126 /* ConstructSignature */: + case 130 /* ConstructSignature */: diagnosticMessage = symbolAccesibilityResult.errorModuleName ? ts.Diagnostics.Return_type_of_constructor_signature_from_exported_interface_has_or_is_using_name_0_from_private_module_1 : ts.Diagnostics.Return_type_of_constructor_signature_from_exported_interface_has_or_is_using_private_name_0; break; - case 125 /* CallSignature */: + case 129 /* CallSignature */: diagnosticMessage = symbolAccesibilityResult.errorModuleName ? ts.Diagnostics.Return_type_of_call_signature_from_exported_interface_has_or_is_using_name_0_from_private_module_1 : ts.Diagnostics.Return_type_of_call_signature_from_exported_interface_has_or_is_using_private_name_0; break; - case 127 /* IndexSignature */: + case 131 /* IndexSignature */: diagnosticMessage = symbolAccesibilityResult.errorModuleName ? ts.Diagnostics.Return_type_of_index_signature_from_exported_interface_has_or_is_using_name_0_from_private_module_1 : ts.Diagnostics.Return_type_of_index_signature_from_exported_interface_has_or_is_using_private_name_0; break; - case 121 /* Method */: + case 125 /* Method */: if (node.flags & 128 /* Static */) { diagnosticMessage = symbolAccesibilityResult.errorModuleName ? symbolAccesibilityResult.accessibility === 2 /* CannotBeNamed */ ? ts.Diagnostics.Return_type_of_public_static_method_from_exported_class_has_or_is_using_name_0_from_external_module_1_but_cannot_be_named : ts.Diagnostics.Return_type_of_public_static_method_from_exported_class_has_or_is_using_name_0_from_private_module_1 : ts.Diagnostics.Return_type_of_public_static_method_from_exported_class_has_or_is_using_private_name_0; } - else if (node.parent.kind === 177 /* ClassDeclaration */) { + else if (node.parent.kind === 184 /* ClassDeclaration */) { diagnosticMessage = symbolAccesibilityResult.errorModuleName ? symbolAccesibilityResult.accessibility === 2 /* CannotBeNamed */ ? ts.Diagnostics.Return_type_of_public_method_from_exported_class_has_or_is_using_name_0_from_external_module_1_but_cannot_be_named : ts.Diagnostics.Return_type_of_public_method_from_exported_class_has_or_is_using_name_0_from_private_module_1 : ts.Diagnostics.Return_type_of_public_method_from_exported_class_has_or_is_using_private_name_0; } else { diagnosticMessage = symbolAccesibilityResult.errorModuleName ? ts.Diagnostics.Return_type_of_method_from_exported_interface_has_or_is_using_name_0_from_private_module_1 : ts.Diagnostics.Return_type_of_method_from_exported_interface_has_or_is_using_private_name_0; } break; - case 175 /* FunctionDeclaration */: + case 182 /* FunctionDeclaration */: diagnosticMessage = symbolAccesibilityResult.errorModuleName ? symbolAccesibilityResult.accessibility === 2 /* CannotBeNamed */ ? ts.Diagnostics.Return_type_of_exported_function_has_or_is_using_name_0_from_external_module_1_but_cannot_be_named : ts.Diagnostics.Return_type_of_exported_function_has_or_is_using_name_0_from_private_module_1 : ts.Diagnostics.Return_type_of_exported_function_has_or_is_using_private_name_0; break; default: @@ -9055,27 +9364,27 @@ var ts; function getParameterDeclarationTypeVisibilityError(symbolAccesibilityResult) { var diagnosticMessage; switch (node.parent.kind) { - case 122 /* Constructor */: + case 126 /* Constructor */: diagnosticMessage = symbolAccesibilityResult.errorModuleName ? symbolAccesibilityResult.accessibility === 2 /* CannotBeNamed */ ? ts.Diagnostics.Parameter_0_of_constructor_from_exported_class_has_or_is_using_name_1_from_external_module_2_but_cannot_be_named : ts.Diagnostics.Parameter_0_of_constructor_from_exported_class_has_or_is_using_name_1_from_private_module_2 : ts.Diagnostics.Parameter_0_of_constructor_from_exported_class_has_or_is_using_private_name_1; break; - case 126 /* ConstructSignature */: + case 130 /* ConstructSignature */: diagnosticMessage = symbolAccesibilityResult.errorModuleName ? ts.Diagnostics.Parameter_0_of_constructor_signature_from_exported_interface_has_or_is_using_name_1_from_private_module_2 : ts.Diagnostics.Parameter_0_of_constructor_signature_from_exported_interface_has_or_is_using_private_name_1; break; - case 125 /* CallSignature */: + case 129 /* CallSignature */: diagnosticMessage = symbolAccesibilityResult.errorModuleName ? ts.Diagnostics.Parameter_0_of_call_signature_from_exported_interface_has_or_is_using_name_1_from_private_module_2 : ts.Diagnostics.Parameter_0_of_call_signature_from_exported_interface_has_or_is_using_private_name_1; break; - case 121 /* Method */: + case 125 /* Method */: if (node.parent.flags & 128 /* Static */) { diagnosticMessage = symbolAccesibilityResult.errorModuleName ? symbolAccesibilityResult.accessibility === 2 /* CannotBeNamed */ ? ts.Diagnostics.Parameter_0_of_public_static_method_from_exported_class_has_or_is_using_name_1_from_external_module_2_but_cannot_be_named : ts.Diagnostics.Parameter_0_of_public_static_method_from_exported_class_has_or_is_using_name_1_from_private_module_2 : ts.Diagnostics.Parameter_0_of_public_static_method_from_exported_class_has_or_is_using_private_name_1; } - else if (node.parent.parent.kind === 177 /* ClassDeclaration */) { + else if (node.parent.parent.kind === 184 /* ClassDeclaration */) { diagnosticMessage = symbolAccesibilityResult.errorModuleName ? symbolAccesibilityResult.accessibility === 2 /* CannotBeNamed */ ? ts.Diagnostics.Parameter_0_of_public_method_from_exported_class_has_or_is_using_name_1_from_external_module_2_but_cannot_be_named : ts.Diagnostics.Parameter_0_of_public_method_from_exported_class_has_or_is_using_name_1_from_private_module_2 : ts.Diagnostics.Parameter_0_of_public_method_from_exported_class_has_or_is_using_private_name_1; } else { diagnosticMessage = symbolAccesibilityResult.errorModuleName ? ts.Diagnostics.Parameter_0_of_method_from_exported_interface_has_or_is_using_name_1_from_private_module_2 : ts.Diagnostics.Parameter_0_of_method_from_exported_interface_has_or_is_using_private_name_1; } break; - case 175 /* FunctionDeclaration */: + case 182 /* FunctionDeclaration */: diagnosticMessage = symbolAccesibilityResult.errorModuleName ? symbolAccesibilityResult.accessibility === 2 /* CannotBeNamed */ ? ts.Diagnostics.Parameter_0_of_exported_function_has_or_is_using_name_1_from_external_module_2_but_cannot_be_named : ts.Diagnostics.Parameter_0_of_exported_function_has_or_is_using_name_1_from_private_module_2 : ts.Diagnostics.Parameter_0_of_exported_function_has_or_is_using_private_name_1; break; default: @@ -9090,39 +9399,39 @@ var ts; } function emitNode(node) { switch (node.kind) { - case 122 /* Constructor */: - case 175 /* FunctionDeclaration */: - case 121 /* Method */: + case 126 /* Constructor */: + case 182 /* FunctionDeclaration */: + case 125 /* Method */: return emitFunctionDeclaration(node); - case 126 /* ConstructSignature */: + case 130 /* ConstructSignature */: return emitConstructSignatureDeclaration(node); - case 125 /* CallSignature */: - case 127 /* IndexSignature */: + case 129 /* CallSignature */: + case 131 /* IndexSignature */: return emitSignatureDeclaration(node); - case 123 /* GetAccessor */: - case 124 /* SetAccessor */: + case 127 /* GetAccessor */: + case 128 /* SetAccessor */: return emitAccessorDeclaration(node); - case 152 /* VariableStatement */: + case 159 /* VariableStatement */: return emitVariableStatement(node); - case 120 /* Property */: + case 124 /* Property */: return emitPropertyDeclaration(node); - case 178 /* InterfaceDeclaration */: + case 185 /* InterfaceDeclaration */: return emitInterfaceDeclaration(node); - case 177 /* ClassDeclaration */: + case 184 /* ClassDeclaration */: return emitClassDeclaration(node); - case 179 /* TypeAliasDeclaration */: + case 186 /* TypeAliasDeclaration */: return emitTypeAliasDeclaration(node); - case 185 /* EnumMember */: + case 192 /* EnumMember */: return emitEnumMemberDeclaration(node); - case 180 /* EnumDeclaration */: + case 187 /* EnumDeclaration */: return emitEnumDeclaration(node); - case 181 /* ModuleDeclaration */: + case 188 /* ModuleDeclaration */: return emitModuleDeclaration(node); - case 183 /* ImportDeclaration */: + case 190 /* ImportDeclaration */: return emitImportDeclaration(node); - case 184 /* ExportAssignment */: + case 191 /* ExportAssignment */: return emitExportAssignment(node); - case 186 /* SourceFile */: + case 193 /* SourceFile */: return emitSourceFile(node); } } @@ -9329,10 +9638,10 @@ var ts; isArgumentsSymbol: function (symbol) { return symbol === argumentsSymbol; }, hasEarlyErrors: hasEarlyErrors }; - var undefinedSymbol = createSymbol(4 /* Property */ | 134217728 /* Transient */, "undefined"); - var argumentsSymbol = createSymbol(4 /* Property */ | 134217728 /* Transient */, "arguments"); - var unknownSymbol = createSymbol(4 /* Property */ | 134217728 /* Transient */, "unknown"); - var resolvingSymbol = createSymbol(134217728 /* Transient */, "__resolving__"); + var undefinedSymbol = createSymbol(4 /* Property */ | 268435456 /* Transient */, "undefined"); + var argumentsSymbol = createSymbol(4 /* Property */ | 268435456 /* Transient */, "arguments"); + var unknownSymbol = createSymbol(4 /* Property */ | 268435456 /* Transient */, "unknown"); + var resolvingSymbol = createSymbol(268435456 /* Transient */, "__resolving__"); var anyType = createIntrinsicType(1 /* Any */, "any"); var stringType = createIntrinsicType(2 /* String */, "string"); var numberType = createIntrinsicType(4 /* Number */, "number"); @@ -9394,21 +9703,23 @@ var ts; result |= ts.SymbolFlags.ClassExcludes; if (flags & 64 /* Interface */) result |= ts.SymbolFlags.InterfaceExcludes; - if (flags & 128 /* Enum */) - result |= ts.SymbolFlags.EnumExcludes; - if (flags & 256 /* ValueModule */) + if (flags & 256 /* RegularEnum */) + result |= ts.SymbolFlags.RegularEnumExcludes; + if (flags & 128 /* ConstEnum */) + result |= ts.SymbolFlags.ConstEnumExcludes; + if (flags & 512 /* ValueModule */) result |= ts.SymbolFlags.ValueModuleExcludes; - if (flags & 4096 /* Method */) + if (flags & 8192 /* Method */) result |= ts.SymbolFlags.MethodExcludes; - if (flags & 16384 /* GetAccessor */) + if (flags & 32768 /* GetAccessor */) result |= ts.SymbolFlags.GetAccessorExcludes; - if (flags & 32768 /* SetAccessor */) + if (flags & 65536 /* SetAccessor */) result |= ts.SymbolFlags.SetAccessorExcludes; - if (flags & 524288 /* TypeParameter */) + if (flags & 1048576 /* TypeParameter */) result |= ts.SymbolFlags.TypeParameterExcludes; - if (flags & 1048576 /* TypeAlias */) + if (flags & 2097152 /* TypeAlias */) result |= ts.SymbolFlags.TypeAliasExcludes; - if (flags & 16777216 /* Import */) + if (flags & 33554432 /* Import */) result |= ts.SymbolFlags.ImportExcludes; return result; } @@ -9418,11 +9729,13 @@ var ts; mergedSymbols[source.mergeId] = target; } function cloneSymbol(symbol) { - var result = createSymbol(symbol.flags | 67108864 /* Merged */, symbol.name); + var result = createSymbol(symbol.flags | 134217728 /* Merged */, symbol.name); result.declarations = symbol.declarations.slice(0); result.parent = symbol.parent; if (symbol.valueDeclaration) result.valueDeclaration = symbol.valueDeclaration; + if (symbol.constEnumOnlyModule) + result.constEnumOnlyModule = true; if (symbol.members) result.members = cloneSymbolTable(symbol.members); if (symbol.exports) @@ -9432,6 +9745,9 @@ var ts; } function extendSymbol(target, source) { if (!(target.flags & getExcludedSymbolFlags(source.flags))) { + if (source.flags & 512 /* ValueModule */ && target.flags & 512 /* ValueModule */ && target.constEnumOnlyModule && !source.constEnumOnlyModule) { + target.constEnumOnlyModule = false; + } target.flags |= source.flags; if (!target.valueDeclaration && source.valueDeclaration) target.valueDeclaration = source.valueDeclaration; @@ -9477,7 +9793,7 @@ var ts; } else { var symbol = target[id]; - if (!(symbol.flags & 67108864 /* Merged */)) { + if (!(symbol.flags & 134217728 /* Merged */)) { target[id] = symbol = cloneSymbol(symbol); } extendSymbol(symbol, source[id]); @@ -9486,7 +9802,7 @@ var ts; } } function getSymbolLinks(symbol) { - if (symbol.flags & 134217728 /* Transient */) + if (symbol.flags & 268435456 /* Transient */) return symbol; if (!symbol.id) symbol.id = nextSymbolId++; @@ -9498,19 +9814,19 @@ var ts; return nodeLinks[node.id] || (nodeLinks[node.id] = {}); } function getSourceFile(node) { - return ts.getAncestor(node, 186 /* SourceFile */); + return ts.getAncestor(node, 193 /* SourceFile */); } function isGlobalSourceFile(node) { - return node.kind === 186 /* SourceFile */ && !ts.isExternalModule(node); + return node.kind === 193 /* SourceFile */ && !ts.isExternalModule(node); } function getSymbol(symbols, name, meaning) { if (meaning && ts.hasProperty(symbols, name)) { var symbol = symbols[name]; - ts.Debug.assert((symbol.flags & 33554432 /* Instantiated */) === 0, "Should never get an instantiated symbol here."); + ts.Debug.assert((symbol.flags & 67108864 /* Instantiated */) === 0, "Should never get an instantiated symbol here."); if (symbol.flags & meaning) { return symbol; } - if (symbol.flags & 16777216 /* Import */) { + if (symbol.flags & 33554432 /* Import */) { var target = resolveImport(symbol); if (target === unknownSymbol || target.flags & meaning) { return symbol; @@ -9518,6 +9834,18 @@ var ts; } } } + function isDefinedBefore(node1, node2) { + var file1 = ts.getSourceFileOfNode(node1); + var file2 = ts.getSourceFileOfNode(node2); + if (file1 === file2) { + return node1.pos <= node2.pos; + } + if (!compilerOptions.out) { + return true; + } + var sourceFiles = program.getSourceFiles(); + return sourceFiles.indexOf(file1) <= sourceFiles.indexOf(file2); + } function resolveName(location, name, meaning, nameNotFoundMessage, nameArg) { var result; var lastLocation; @@ -9530,21 +9858,21 @@ var ts; } } switch (location.kind) { - case 186 /* SourceFile */: + case 193 /* SourceFile */: if (!ts.isExternalModule(location)) break; - case 181 /* ModuleDeclaration */: + case 188 /* ModuleDeclaration */: if (result = getSymbol(getSymbolOfNode(location).exports, name, meaning & ts.SymbolFlags.ModuleMember)) { break loop; } break; - case 180 /* EnumDeclaration */: + case 187 /* EnumDeclaration */: if (result = getSymbol(getSymbolOfNode(location).exports, name, meaning & 8 /* EnumMember */)) { break loop; } break; - case 120 /* Property */: - if (location.parent.kind === 177 /* ClassDeclaration */ && !(location.flags & 128 /* Static */)) { + case 124 /* Property */: + if (location.parent.kind === 184 /* ClassDeclaration */ && !(location.flags & 128 /* Static */)) { var ctor = findConstructorDeclaration(location.parent); if (ctor && ctor.locals) { if (getSymbol(ctor.locals, name, meaning & ts.SymbolFlags.Value)) { @@ -9553,8 +9881,8 @@ var ts; } } break; - case 177 /* ClassDeclaration */: - case 178 /* InterfaceDeclaration */: + case 184 /* ClassDeclaration */: + case 185 /* InterfaceDeclaration */: if (result = getSymbol(getSymbolOfNode(location).members, name, meaning & ts.SymbolFlags.Type)) { if (lastLocation && lastLocation.flags & 128 /* Static */) { error(errorLocation, ts.Diagnostics.Static_members_cannot_reference_class_type_parameters); @@ -9563,18 +9891,18 @@ var ts; break loop; } break; - case 121 /* Method */: - case 122 /* Constructor */: - case 123 /* GetAccessor */: - case 124 /* SetAccessor */: - case 175 /* FunctionDeclaration */: - case 145 /* ArrowFunction */: + case 125 /* Method */: + case 126 /* Constructor */: + case 127 /* GetAccessor */: + case 128 /* SetAccessor */: + case 182 /* FunctionDeclaration */: + case 150 /* ArrowFunction */: if (name === "arguments") { result = argumentsSymbol; break loop; } break; - case 144 /* FunctionExpression */: + case 149 /* FunctionExpression */: if (name === "arguments") { result = argumentsSymbol; break loop; @@ -9585,7 +9913,7 @@ var ts; break loop; } break; - case 171 /* CatchBlock */: + case 178 /* CatchBlock */: var id = location.variable; if (name === id.text) { result = location.symbol; @@ -9613,30 +9941,20 @@ var ts; } if (result.flags & 2 /* BlockScopedVariable */) { var declaration = ts.forEach(result.declarations, function (d) { return d.flags & ts.NodeFlags.BlockScoped ? d : undefined; }); - ts.Debug.assert(declaration, "Block-scoped variable declaration is undefined"); - var declarationSourceFile = ts.getSourceFileOfNode(declaration); - var referenceSourceFile = ts.getSourceFileOfNode(errorLocation); - if (declarationSourceFile === referenceSourceFile) { - if (declaration.pos > errorLocation.pos) { - error(errorLocation, ts.Diagnostics.Block_scoped_variable_0_used_before_its_declaration, ts.identifierToString(declaration.name)); - } - } - else if (compilerOptions.out) { - var sourceFiles = program.getSourceFiles(); - if (sourceFiles.indexOf(referenceSourceFile) < sourceFiles.indexOf(declarationSourceFile)) { - error(errorLocation, ts.Diagnostics.Block_scoped_variable_0_used_before_its_declaration, ts.identifierToString(declaration.name)); - } + ts.Debug.assert(declaration !== undefined, "Block-scoped variable declaration is undefined"); + if (!isDefinedBefore(declaration, errorLocation)) { + error(errorLocation, ts.Diagnostics.Block_scoped_variable_0_used_before_its_declaration, ts.identifierToString(declaration.name)); } } } return result; } function resolveImport(symbol) { - ts.Debug.assert((symbol.flags & 16777216 /* Import */) !== 0, "Should only get Imports here."); + ts.Debug.assert((symbol.flags & 33554432 /* Import */) !== 0, "Should only get Imports here."); var links = getSymbolLinks(symbol); if (!links.target) { links.target = resolvingSymbol; - var node = getDeclarationOfKind(symbol, 183 /* ImportDeclaration */); + var node = getDeclarationOfKind(symbol, 190 /* ImportDeclaration */); var target = node.externalModuleName ? resolveExternalModuleName(node, node.externalModuleName) : getSymbolOfPartOfRightHandSideOfImport(node.entityName, node); if (links.target === resolvingSymbol) { links.target = target || unknownSymbol; @@ -9652,17 +9970,17 @@ var ts; } function getSymbolOfPartOfRightHandSideOfImport(entityName, importDeclaration) { if (!importDeclaration) { - importDeclaration = ts.getAncestor(entityName, 183 /* ImportDeclaration */); - ts.Debug.assert(importDeclaration); + importDeclaration = ts.getAncestor(entityName, 190 /* ImportDeclaration */); + ts.Debug.assert(importDeclaration !== undefined); } - if (entityName.kind === 59 /* Identifier */ && isRightSideOfQualifiedNameOrPropertyAccess(entityName)) { + if (entityName.kind === 63 /* Identifier */ && isRightSideOfQualifiedNameOrPropertyAccess(entityName)) { entityName = entityName.parent; } - if (entityName.kind === 59 /* Identifier */ || entityName.parent.kind === 117 /* QualifiedName */) { + if (entityName.kind === 63 /* Identifier */ || entityName.parent.kind === 121 /* QualifiedName */) { return resolveEntityName(importDeclaration, entityName, ts.SymbolFlags.Namespace); } else { - ts.Debug.assert(entityName.parent.kind === 183 /* ImportDeclaration */); + ts.Debug.assert(entityName.parent.kind === 190 /* ImportDeclaration */); return resolveEntityName(importDeclaration, entityName, ts.SymbolFlags.Value | ts.SymbolFlags.Type | ts.SymbolFlags.Namespace); } } @@ -9670,15 +9988,15 @@ var ts; return symbol.parent ? getFullyQualifiedName(symbol.parent) + "." + symbolToString(symbol) : symbolToString(symbol); } function resolveEntityName(location, name, meaning) { - if (name.kind === 59 /* Identifier */) { + if (name.kind === 63 /* Identifier */) { var symbol = resolveName(location, name.text, meaning, ts.Diagnostics.Cannot_find_name_0, name); if (!symbol) { return; } } - else if (name.kind === 117 /* QualifiedName */) { + else if (name.kind === 121 /* QualifiedName */) { var namespace = resolveEntityName(location, name.left, ts.SymbolFlags.Namespace); - if (!namespace || namespace === unknownSymbol || name.right.kind === 116 /* Missing */) + if (!namespace || namespace === unknownSymbol || name.right.kind === 120 /* Missing */) return; var symbol = getSymbol(namespace.exports, name.right.text, meaning); if (!symbol) { @@ -9689,7 +10007,7 @@ var ts; else { return; } - ts.Debug.assert((symbol.flags & 33554432 /* Instantiated */) === 0, "Should never get an instantiated symbol here."); + ts.Debug.assert((symbol.flags & 67108864 /* Instantiated */) === 0, "Should never get an instantiated symbol here."); return symbol.flags & meaning ? symbol : resolveImport(symbol); } function isExternalModuleNameRelative(moduleName) { @@ -9702,7 +10020,7 @@ var ts; return; var isRelative = isExternalModuleNameRelative(moduleName); if (!isRelative) { - var symbol = getSymbol(globals, '"' + moduleName + '"', 256 /* ValueModule */); + var symbol = getSymbol(globals, '"' + moduleName + '"', 512 /* ValueModule */); if (symbol) { return getResolvedExportSymbol(symbol); } @@ -9732,7 +10050,7 @@ var ts; if (symbol.flags & (ts.SymbolFlags.Value | ts.SymbolFlags.Type | ts.SymbolFlags.Namespace)) { return symbol; } - if (symbol.flags & 16777216 /* Import */) { + if (symbol.flags & 33554432 /* Import */) { return resolveImport(symbol); } } @@ -9767,9 +10085,9 @@ var ts; var seenExportedMember = false; var result = []; ts.forEach(symbol.declarations, function (declaration) { - var block = (declaration.kind === 186 /* SourceFile */ ? declaration : declaration.body); + var block = (declaration.kind === 193 /* SourceFile */ ? declaration : declaration.body); ts.forEach(block.statements, function (node) { - if (node.kind === 184 /* ExportAssignment */) { + if (node.kind === 191 /* ExportAssignment */) { result.push(node); } else { @@ -9793,16 +10111,16 @@ var ts; return getMergedSymbol(symbol.parent); } function getExportSymbolOfValueSymbolIfExported(symbol) { - return symbol && (symbol.flags & 2097152 /* ExportValue */) !== 0 ? getMergedSymbol(symbol.exportSymbol) : symbol; + return symbol && (symbol.flags & 4194304 /* ExportValue */) !== 0 ? getMergedSymbol(symbol.exportSymbol) : symbol; } function symbolIsValue(symbol) { - if (symbol.flags & 33554432 /* Instantiated */) { + if (symbol.flags & 67108864 /* Instantiated */) { return symbolIsValue(getSymbolLinks(symbol).target); } if (symbol.flags & ts.SymbolFlags.Value) { return true; } - if (symbol.flags & 16777216 /* Import */) { + if (symbol.flags & 33554432 /* Import */) { return (resolveImport(symbol).flags & ts.SymbolFlags.Value) !== 0; } return false; @@ -9811,7 +10129,7 @@ var ts; var members = node.members; for (var i = 0; i < members.length; i++) { var member = members[i]; - if (member.kind === 122 /* Constructor */ && member.body) { + if (member.kind === 126 /* Constructor */ && member.body) { return member; } } @@ -9865,7 +10183,7 @@ var ts; return setObjectTypeMembers(createObjectType(32768 /* Anonymous */, symbol), members, callSignatures, constructSignatures, stringIndexType, numberIndexType); } function isOptionalProperty(propertySymbol) { - return propertySymbol.valueDeclaration && propertySymbol.valueDeclaration.flags & 4 /* QuestionMark */ && propertySymbol.valueDeclaration.kind !== 119 /* Parameter */; + return propertySymbol.valueDeclaration && propertySymbol.valueDeclaration.flags & 4 /* QuestionMark */ && propertySymbol.valueDeclaration.kind !== 123 /* Parameter */; } function forEachSymbolTableInScope(enclosingDeclaration, callback) { var result; @@ -9876,17 +10194,17 @@ var ts; } } switch (location.kind) { - case 186 /* SourceFile */: + case 193 /* SourceFile */: if (!ts.isExternalModule(location)) { break; } - case 181 /* ModuleDeclaration */: + case 188 /* ModuleDeclaration */: if (result = callback(getSymbolOfNode(location).exports)) { return result; } break; - case 177 /* ClassDeclaration */: - case 178 /* InterfaceDeclaration */: + case 184 /* ClassDeclaration */: + case 185 /* InterfaceDeclaration */: if (result = callback(getSymbolOfNode(location).members)) { return result; } @@ -9916,8 +10234,8 @@ var ts; return [symbol]; } return ts.forEachValue(symbols, function (symbolFromSymbolTable) { - if (symbolFromSymbolTable.flags & 16777216 /* Import */) { - if (!useOnlyExternalAliasing || ts.forEach(symbolFromSymbolTable.declarations, function (declaration) { return declaration.kind === 183 /* ImportDeclaration */ && declaration.externalModuleName; })) { + if (symbolFromSymbolTable.flags & 33554432 /* Import */) { + if (!useOnlyExternalAliasing || ts.forEach(symbolFromSymbolTable.declarations, function (declaration) { return declaration.kind === 190 /* ImportDeclaration */ && declaration.externalModuleName; })) { var resolvedImportedSymbol = resolveImport(symbolFromSymbolTable); if (isAccessible(symbolFromSymbolTable, resolveImport(symbolFromSymbolTable))) { return [symbolFromSymbolTable]; @@ -9944,7 +10262,7 @@ var ts; if (symbolFromSymbolTable === symbol) { return true; } - symbolFromSymbolTable = (symbolFromSymbolTable.flags & 16777216 /* Import */) ? resolveImport(symbolFromSymbolTable) : symbolFromSymbolTable; + symbolFromSymbolTable = (symbolFromSymbolTable.flags & 33554432 /* Import */) ? resolveImport(symbolFromSymbolTable) : symbolFromSymbolTable; if (symbolFromSymbolTable.flags & meaning) { qualify = true; return true; @@ -9954,7 +10272,7 @@ var ts; return qualify; } function isSymbolAccessible(symbol, enclosingDeclaration, meaning) { - if (symbol && enclosingDeclaration && !(symbol.flags & 524288 /* TypeParameter */)) { + if (symbol && enclosingDeclaration && !(symbol.flags & 1048576 /* TypeParameter */)) { var initialSymbol = symbol; var meaningToLook = meaning; while (symbol) { @@ -9999,7 +10317,7 @@ var ts; } } function hasExternalModuleSymbol(declaration) { - return (declaration.kind === 181 /* ModuleDeclaration */ && declaration.name.kind === 7 /* StringLiteral */) || (declaration.kind === 186 /* SourceFile */ && ts.isExternalModule(declaration)); + return (declaration.kind === 188 /* ModuleDeclaration */ && declaration.name.kind === 7 /* StringLiteral */) || (declaration.kind === 193 /* SourceFile */ && ts.isExternalModule(declaration)); } function hasVisibleDeclarations(symbol) { var aliasesToMakeVisible; @@ -10009,7 +10327,7 @@ var ts; return { aliasesToMakeVisible: aliasesToMakeVisible }; function getIsDeclarationVisible(declaration) { if (!isDeclarationVisible(declaration)) { - if (declaration.kind === 183 /* ImportDeclaration */ && !(declaration.flags & 1 /* Export */) && isDeclarationVisible(declaration.parent)) { + if (declaration.kind === 190 /* ImportDeclaration */ && !(declaration.flags & 1 /* Export */) && isDeclarationVisible(declaration.parent)) { getNodeLinks(declaration).isVisible = true; if (aliasesToMakeVisible) { if (!ts.contains(aliasesToMakeVisible, declaration)) { @@ -10067,12 +10385,12 @@ var ts; return result; } function getTypeAliasForTypeLiteral(type) { - if (type.symbol && type.symbol.flags & 1024 /* TypeLiteral */) { + if (type.symbol && type.symbol.flags & 2048 /* TypeLiteral */) { var node = type.symbol.declarations[0].parent; - while (node.kind === 134 /* ParenType */) { + while (node.kind === 138 /* ParenType */) { node = node.parent; } - if (node.kind === 179 /* TypeAliasDeclaration */) { + if (node.kind === 186 /* TypeAliasDeclaration */) { return getSymbolOfNode(node); } } @@ -10095,14 +10413,14 @@ var ts; function appendParentTypeArgumentsAndSymbolName(symbol) { if (parentSymbol) { if (flags & 1 /* WriteTypeParametersOrArguments */) { - if (symbol.flags & 33554432 /* Instantiated */) { + if (symbol.flags & 67108864 /* Instantiated */) { buildDisplayForTypeArgumentsAndDelimiters(getTypeParametersOfClassOrInterface(parentSymbol), symbol.mapper, writer, enclosingDeclaration); } else { buildTypeParameterDisplayFromSymbol(parentSymbol, writer, enclosingDeclaration); } } - writePunctuation(writer, 15 /* DotToken */); + writePunctuation(writer, 19 /* DotToken */); } parentSymbol = symbol; appendSymbolNameOnly(symbol, writer); @@ -10123,14 +10441,14 @@ var ts; if (!parentSymbol && ts.forEach(symbol.declarations, function (declaration) { return hasExternalModuleSymbol(declaration); })) { return; } - if (symbol.flags & 1024 /* TypeLiteral */ || symbol.flags & 2048 /* ObjectLiteral */) { + if (symbol.flags & 2048 /* TypeLiteral */ || symbol.flags & 4096 /* ObjectLiteral */) { return; } appendParentTypeArgumentsAndSymbolName(symbol); } } } - if (enclosingDeclaration && !(symbol.flags & 524288 /* TypeParameter */)) { + if (enclosingDeclaration && !(symbol.flags & 1048576 /* TypeParameter */)) { walkSymbol(symbol, meaning); return; } @@ -10162,11 +10480,11 @@ var ts; writer.writeStringLiteral(type.text); } else { - writePunctuation(writer, 9 /* OpenBraceToken */); + writePunctuation(writer, 13 /* OpenBraceToken */); writeSpace(writer); - writePunctuation(writer, 16 /* DotDotDotToken */); + writePunctuation(writer, 20 /* DotDotDotToken */); writeSpace(writer); - writePunctuation(writer, 10 /* CloseBraceToken */); + writePunctuation(writer, 14 /* CloseBraceToken */); } } function writeTypeList(types, union) { @@ -10175,7 +10493,7 @@ var ts; if (union) { writeSpace(writer); } - writePunctuation(writer, union ? 39 /* BarToken */ : 18 /* CommaToken */); + writePunctuation(writer, union ? 43 /* BarToken */ : 22 /* CommaToken */); writeSpace(writer); } writeType(types[i], union ? 64 /* InElementType */ : 0 /* None */); @@ -10184,32 +10502,32 @@ var ts; function writeTypeReference(type, flags) { if (type.target === globalArrayType && !(flags & 1 /* WriteArrayAsGenericType */)) { writeType(type.typeArguments[0], 64 /* InElementType */); - writePunctuation(writer, 13 /* OpenBracketToken */); - writePunctuation(writer, 14 /* CloseBracketToken */); + writePunctuation(writer, 17 /* OpenBracketToken */); + writePunctuation(writer, 18 /* CloseBracketToken */); } else { buildSymbolDisplay(type.target.symbol, writer, enclosingDeclaration, ts.SymbolFlags.Type); - writePunctuation(writer, 19 /* LessThanToken */); + writePunctuation(writer, 23 /* LessThanToken */); writeTypeList(type.typeArguments, false); - writePunctuation(writer, 20 /* GreaterThanToken */); + writePunctuation(writer, 24 /* GreaterThanToken */); } } function writeTupleType(type) { - writePunctuation(writer, 13 /* OpenBracketToken */); + writePunctuation(writer, 17 /* OpenBracketToken */); writeTypeList(type.elementTypes, false); - writePunctuation(writer, 14 /* CloseBracketToken */); + writePunctuation(writer, 18 /* CloseBracketToken */); } function writeUnionType(type, flags) { if (flags & 64 /* InElementType */) { - writePunctuation(writer, 11 /* OpenParenToken */); + writePunctuation(writer, 15 /* OpenParenToken */); } writeTypeList(type.types, true); if (flags & 64 /* InElementType */) { - writePunctuation(writer, 12 /* CloseParenToken */); + writePunctuation(writer, 16 /* CloseParenToken */); } } function writeAnonymousType(type, flags) { - if (type.symbol && type.symbol.flags & (32 /* Class */ | 128 /* Enum */ | 256 /* ValueModule */)) { + if (type.symbol && type.symbol.flags & (32 /* Class */ | ts.SymbolFlags.Enum | 512 /* ValueModule */)) { writeTypeofSymbol(type); } else if (shouldWriteTypeOfFunctionSymbol()) { @@ -10221,7 +10539,7 @@ var ts; buildSymbolDisplay(typeAlias, writer, enclosingDeclaration, ts.SymbolFlags.Type); } else { - writeKeyword(writer, 105 /* AnyKeyword */); + writeKeyword(writer, 109 /* AnyKeyword */); } } else { @@ -10234,8 +10552,8 @@ var ts; } function shouldWriteTypeOfFunctionSymbol() { if (type.symbol) { - var isStaticMethodSymbol = !!(type.symbol.flags & 4096 /* Method */ && ts.forEach(type.symbol.declarations, function (declaration) { return declaration.flags & 128 /* Static */; })); - var isNonLocalFunctionSymbol = !!(type.symbol.flags & 16 /* Function */) && (type.symbol.parent || ts.forEach(type.symbol.declarations, function (declaration) { return declaration.parent.kind === 186 /* SourceFile */ || declaration.parent.kind === 182 /* ModuleBlock */; })); + var isStaticMethodSymbol = !!(type.symbol.flags & 8192 /* Method */ && ts.forEach(type.symbol.declarations, function (declaration) { return declaration.flags & 128 /* Static */; })); + var isNonLocalFunctionSymbol = !!(type.symbol.flags & 16 /* Function */) && (type.symbol.parent || ts.forEach(type.symbol.declarations, function (declaration) { return declaration.parent.kind === 193 /* SourceFile */ || declaration.parent.kind === 189 /* ModuleBlock */; })); if (isStaticMethodSymbol || isNonLocalFunctionSymbol) { return !!(flags & 2 /* UseTypeOfFunction */) || (typeStack && ts.contains(typeStack, type)); } @@ -10243,7 +10561,7 @@ var ts; } } function writeTypeofSymbol(type) { - writeKeyword(writer, 91 /* TypeOfKeyword */); + writeKeyword(writer, 95 /* TypeOfKeyword */); writeSpace(writer); buildSymbolDisplay(type.symbol, writer, enclosingDeclaration, ts.SymbolFlags.Value); } @@ -10251,103 +10569,103 @@ var ts; var resolved = resolveObjectOrUnionTypeMembers(type); if (!resolved.properties.length && !resolved.stringIndexType && !resolved.numberIndexType) { if (!resolved.callSignatures.length && !resolved.constructSignatures.length) { - writePunctuation(writer, 9 /* OpenBraceToken */); - writePunctuation(writer, 10 /* CloseBraceToken */); + writePunctuation(writer, 13 /* OpenBraceToken */); + writePunctuation(writer, 14 /* CloseBraceToken */); return; } if (resolved.callSignatures.length === 1 && !resolved.constructSignatures.length) { if (flags & 64 /* InElementType */) { - writePunctuation(writer, 11 /* OpenParenToken */); + writePunctuation(writer, 15 /* OpenParenToken */); } buildSignatureDisplay(resolved.callSignatures[0], writer, enclosingDeclaration, globalFlagsToPass | 8 /* WriteArrowStyleSignature */, typeStack); if (flags & 64 /* InElementType */) { - writePunctuation(writer, 12 /* CloseParenToken */); + writePunctuation(writer, 16 /* CloseParenToken */); } return; } if (resolved.constructSignatures.length === 1 && !resolved.callSignatures.length) { if (flags & 64 /* InElementType */) { - writePunctuation(writer, 11 /* OpenParenToken */); + writePunctuation(writer, 15 /* OpenParenToken */); } - writeKeyword(writer, 82 /* NewKeyword */); + writeKeyword(writer, 86 /* NewKeyword */); writeSpace(writer); buildSignatureDisplay(resolved.constructSignatures[0], writer, enclosingDeclaration, globalFlagsToPass | 8 /* WriteArrowStyleSignature */, typeStack); if (flags & 64 /* InElementType */) { - writePunctuation(writer, 12 /* CloseParenToken */); + writePunctuation(writer, 16 /* CloseParenToken */); } return; } } - writePunctuation(writer, 9 /* OpenBraceToken */); + writePunctuation(writer, 13 /* OpenBraceToken */); writer.writeLine(); writer.increaseIndent(); for (var i = 0; i < resolved.callSignatures.length; i++) { buildSignatureDisplay(resolved.callSignatures[i], writer, enclosingDeclaration, globalFlagsToPass, typeStack); - writePunctuation(writer, 17 /* SemicolonToken */); + writePunctuation(writer, 21 /* SemicolonToken */); writer.writeLine(); } for (var i = 0; i < resolved.constructSignatures.length; i++) { - writeKeyword(writer, 82 /* NewKeyword */); + writeKeyword(writer, 86 /* NewKeyword */); writeSpace(writer); buildSignatureDisplay(resolved.constructSignatures[i], writer, enclosingDeclaration, globalFlagsToPass, typeStack); - writePunctuation(writer, 17 /* SemicolonToken */); + writePunctuation(writer, 21 /* SemicolonToken */); writer.writeLine(); } if (resolved.stringIndexType) { - writePunctuation(writer, 13 /* OpenBracketToken */); + writePunctuation(writer, 17 /* OpenBracketToken */); writer.writeParameter("x"); - writePunctuation(writer, 46 /* ColonToken */); + writePunctuation(writer, 50 /* ColonToken */); writeSpace(writer); - writeKeyword(writer, 114 /* StringKeyword */); - writePunctuation(writer, 14 /* CloseBracketToken */); - writePunctuation(writer, 46 /* ColonToken */); + writeKeyword(writer, 118 /* StringKeyword */); + writePunctuation(writer, 18 /* CloseBracketToken */); + writePunctuation(writer, 50 /* ColonToken */); writeSpace(writer); writeType(resolved.stringIndexType, 0 /* None */); - writePunctuation(writer, 17 /* SemicolonToken */); + writePunctuation(writer, 21 /* SemicolonToken */); writer.writeLine(); } if (resolved.numberIndexType) { - writePunctuation(writer, 13 /* OpenBracketToken */); + writePunctuation(writer, 17 /* OpenBracketToken */); writer.writeParameter("x"); - writePunctuation(writer, 46 /* ColonToken */); + writePunctuation(writer, 50 /* ColonToken */); writeSpace(writer); - writeKeyword(writer, 112 /* NumberKeyword */); - writePunctuation(writer, 14 /* CloseBracketToken */); - writePunctuation(writer, 46 /* ColonToken */); + writeKeyword(writer, 116 /* NumberKeyword */); + writePunctuation(writer, 18 /* CloseBracketToken */); + writePunctuation(writer, 50 /* ColonToken */); writeSpace(writer); writeType(resolved.numberIndexType, 0 /* None */); - writePunctuation(writer, 17 /* SemicolonToken */); + writePunctuation(writer, 21 /* SemicolonToken */); writer.writeLine(); } for (var i = 0; i < resolved.properties.length; i++) { var p = resolved.properties[i]; var t = getTypeOfSymbol(p); - if (p.flags & (16 /* Function */ | 4096 /* Method */) && !getPropertiesOfObjectType(t).length) { + if (p.flags & (16 /* Function */ | 8192 /* Method */) && !getPropertiesOfObjectType(t).length) { var signatures = getSignaturesOfType(t, 0 /* Call */); for (var j = 0; j < signatures.length; j++) { buildSymbolDisplay(p, writer); if (isOptionalProperty(p)) { - writePunctuation(writer, 45 /* QuestionToken */); + writePunctuation(writer, 49 /* QuestionToken */); } buildSignatureDisplay(signatures[j], writer, enclosingDeclaration, globalFlagsToPass, typeStack); - writePunctuation(writer, 17 /* SemicolonToken */); + writePunctuation(writer, 21 /* SemicolonToken */); writer.writeLine(); } } else { buildSymbolDisplay(p, writer); if (isOptionalProperty(p)) { - writePunctuation(writer, 45 /* QuestionToken */); + writePunctuation(writer, 49 /* QuestionToken */); } - writePunctuation(writer, 46 /* ColonToken */); + writePunctuation(writer, 50 /* ColonToken */); writeSpace(writer); writeType(t, 0 /* None */); - writePunctuation(writer, 17 /* SemicolonToken */); + writePunctuation(writer, 21 /* SemicolonToken */); writer.writeLine(); } } writer.decreaseIndent(); - writePunctuation(writer, 10 /* CloseBraceToken */); + writePunctuation(writer, 14 /* CloseBraceToken */); } } function buildTypeParameterDisplayFromSymbol(symbol, writer, enclosingDeclaraiton, flags) { @@ -10361,67 +10679,67 @@ var ts; var constraint = getConstraintOfTypeParameter(tp); if (constraint) { writeSpace(writer); - writeKeyword(writer, 73 /* ExtendsKeyword */); + writeKeyword(writer, 77 /* ExtendsKeyword */); writeSpace(writer); buildTypeDisplay(constraint, writer, enclosingDeclaration, flags, typeStack); } } function buildParameterDisplay(p, writer, enclosingDeclaration, flags, typeStack) { if (getDeclarationFlagsFromSymbol(p) & 8 /* Rest */) { - writePunctuation(writer, 16 /* DotDotDotToken */); + writePunctuation(writer, 20 /* DotDotDotToken */); } appendSymbolNameOnly(p, writer); if (p.valueDeclaration.flags & 4 /* QuestionMark */ || p.valueDeclaration.initializer) { - writePunctuation(writer, 45 /* QuestionToken */); + writePunctuation(writer, 49 /* QuestionToken */); } - writePunctuation(writer, 46 /* ColonToken */); + writePunctuation(writer, 50 /* ColonToken */); writeSpace(writer); buildTypeDisplay(getTypeOfSymbol(p), writer, enclosingDeclaration, flags, typeStack); } function buildDisplayForTypeParametersAndDelimiters(typeParameters, writer, enclosingDeclaration, flags, typeStack) { if (typeParameters && typeParameters.length) { - writePunctuation(writer, 19 /* LessThanToken */); + writePunctuation(writer, 23 /* LessThanToken */); for (var i = 0; i < typeParameters.length; i++) { if (i > 0) { - writePunctuation(writer, 18 /* CommaToken */); + writePunctuation(writer, 22 /* CommaToken */); writeSpace(writer); } buildTypeParameterDisplay(typeParameters[i], writer, enclosingDeclaration, flags, typeStack); } - writePunctuation(writer, 20 /* GreaterThanToken */); + writePunctuation(writer, 24 /* GreaterThanToken */); } } function buildDisplayForTypeArgumentsAndDelimiters(typeParameters, mapper, writer, enclosingDeclaration, flags, typeStack) { if (typeParameters && typeParameters.length) { - writePunctuation(writer, 19 /* LessThanToken */); + writePunctuation(writer, 23 /* LessThanToken */); for (var i = 0; i < typeParameters.length; i++) { if (i > 0) { - writePunctuation(writer, 18 /* CommaToken */); + writePunctuation(writer, 22 /* CommaToken */); writeSpace(writer); } buildTypeDisplay(mapper(typeParameters[i]), writer, enclosingDeclaration, 0 /* None */); } - writePunctuation(writer, 20 /* GreaterThanToken */); + writePunctuation(writer, 24 /* GreaterThanToken */); } } function buildDisplayForParametersAndDelimiters(parameters, writer, enclosingDeclaration, flags, typeStack) { - writePunctuation(writer, 11 /* OpenParenToken */); + writePunctuation(writer, 15 /* OpenParenToken */); for (var i = 0; i < parameters.length; i++) { if (i > 0) { - writePunctuation(writer, 18 /* CommaToken */); + writePunctuation(writer, 22 /* CommaToken */); writeSpace(writer); } buildParameterDisplay(parameters[i], writer, enclosingDeclaration, flags, typeStack); } - writePunctuation(writer, 12 /* CloseParenToken */); + writePunctuation(writer, 16 /* CloseParenToken */); } function buildReturnTypeDisplay(signature, writer, enclosingDeclaration, flags, typeStack) { if (flags & 8 /* WriteArrowStyleSignature */) { writeSpace(writer); - writePunctuation(writer, 27 /* EqualsGreaterThanToken */); + writePunctuation(writer, 31 /* EqualsGreaterThanToken */); } else { - writePunctuation(writer, 46 /* ColonToken */); + writePunctuation(writer, 50 /* ColonToken */); } writeSpace(writer); buildTypeDisplay(getReturnTypeOfSignature(signature), writer, enclosingDeclaration, flags, typeStack); @@ -10454,12 +10772,12 @@ var ts; function isDeclarationVisible(node) { function getContainingExternalModule(node) { for (; node; node = node.parent) { - if (node.kind === 181 /* ModuleDeclaration */) { + if (node.kind === 188 /* ModuleDeclaration */) { if (node.name.kind === 7 /* StringLiteral */) { return node; } } - else if (node.kind === 186 /* SourceFile */) { + else if (node.kind === 193 /* SourceFile */) { return ts.isExternalModule(node) ? node : undefined; } } @@ -10475,7 +10793,7 @@ var ts; if (isSymbolUsedInExportAssignment(symbolOfNode)) { return true; } - if (symbolOfNode.flags & 16777216 /* Import */) { + if (symbolOfNode.flags & 33554432 /* Import */) { return isSymbolUsedInExportAssignment(resolveImport(symbolOfNode)); } } @@ -10483,7 +10801,7 @@ var ts; if (exportAssignmentSymbol === symbol) { return true; } - if (exportAssignmentSymbol && !!(exportAssignmentSymbol.flags & 16777216 /* Import */)) { + if (exportAssignmentSymbol && !!(exportAssignmentSymbol.flags & 33554432 /* Import */)) { resolvedExportSymbol = resolvedExportSymbol || resolveImport(exportAssignmentSymbol); if (resolvedExportSymbol === symbol) { return true; @@ -10501,32 +10819,32 @@ var ts; } function determineIfDeclarationIsVisible() { switch (node.kind) { - case 174 /* VariableDeclaration */: - case 181 /* ModuleDeclaration */: - case 177 /* ClassDeclaration */: - case 178 /* InterfaceDeclaration */: - case 179 /* TypeAliasDeclaration */: - case 175 /* FunctionDeclaration */: - case 180 /* EnumDeclaration */: - case 183 /* ImportDeclaration */: - var parent = node.kind === 174 /* VariableDeclaration */ ? node.parent.parent : node.parent; - if (!(node.flags & 1 /* Export */) && !(node.kind !== 183 /* ImportDeclaration */ && parent.kind !== 186 /* SourceFile */ && ts.isInAmbientContext(parent))) { + case 181 /* VariableDeclaration */: + case 188 /* ModuleDeclaration */: + case 184 /* ClassDeclaration */: + case 185 /* InterfaceDeclaration */: + case 186 /* TypeAliasDeclaration */: + case 182 /* FunctionDeclaration */: + case 187 /* EnumDeclaration */: + case 190 /* ImportDeclaration */: + var parent = node.kind === 181 /* VariableDeclaration */ ? node.parent.parent : node.parent; + if (!(node.flags & 1 /* Export */) && !(node.kind !== 190 /* ImportDeclaration */ && parent.kind !== 193 /* SourceFile */ && ts.isInAmbientContext(parent))) { return isGlobalSourceFile(parent) || isUsedInExportAssignment(node); } return isDeclarationVisible(parent); - case 120 /* Property */: - case 121 /* Method */: + case 124 /* Property */: + case 125 /* Method */: if (node.flags & (32 /* Private */ | 64 /* Protected */)) { return false; } - case 122 /* Constructor */: - case 126 /* ConstructSignature */: - case 125 /* CallSignature */: - case 127 /* IndexSignature */: - case 119 /* Parameter */: - case 182 /* ModuleBlock */: + case 126 /* Constructor */: + case 130 /* ConstructSignature */: + case 129 /* CallSignature */: + case 131 /* IndexSignature */: + case 123 /* Parameter */: + case 189 /* ModuleBlock */: return isDeclarationVisible(node.parent); - case 186 /* SourceFile */: + case 193 /* SourceFile */: return true; default: ts.Debug.fail("isDeclarationVisible unknown: SyntaxKind: " + ts.SyntaxKind[node.kind]); @@ -10545,16 +10863,16 @@ var ts; return classType.typeParameters ? createTypeReference(classType, ts.map(classType.typeParameters, function (_) { return anyType; })) : classType; } function getTypeOfVariableDeclaration(declaration) { - if (declaration.parent.kind === 159 /* ForInStatement */) { + if (declaration.parent.kind === 166 /* ForInStatement */) { return anyType; } if (declaration.type) { return getTypeFromTypeNode(declaration.type); } - if (declaration.kind === 119 /* Parameter */) { + if (declaration.kind === 123 /* Parameter */) { var func = declaration.parent; - if (func.kind === 124 /* SetAccessor */) { - var getter = getDeclarationOfKind(declaration.parent.symbol, 123 /* GetAccessor */); + if (func.kind === 128 /* SetAccessor */) { + var getter = getDeclarationOfKind(declaration.parent.symbol, 127 /* GetAccessor */); if (getter) { return getReturnTypeOfSignature(getSignatureFromDeclaration(getter)); } @@ -10566,7 +10884,7 @@ var ts; } if (declaration.initializer) { var type = checkAndMarkExpression(declaration.initializer); - if (declaration.kind !== 137 /* PropertyAssignment */) { + if (declaration.kind !== 141 /* PropertyAssignment */) { var unwidenedType = type; type = getWidenedType(type); if (type !== unwidenedType) { @@ -10585,14 +10903,14 @@ var ts; if (getInnermostTypeOfNestedArrayTypes(type) !== anyType) { return; } - if (isPrivateWithinAmbient(declaration) || (declaration.kind === 119 /* Parameter */ && isPrivateWithinAmbient(declaration.parent))) { + if (isPrivateWithinAmbient(declaration) || (declaration.kind === 123 /* Parameter */ && isPrivateWithinAmbient(declaration.parent))) { return; } switch (declaration.kind) { - case 120 /* Property */: + case 124 /* Property */: var diagnostic = ts.Diagnostics.Member_0_implicitly_has_an_1_type; break; - case 119 /* Parameter */: + case 123 /* Parameter */: var diagnostic = declaration.flags & 8 /* Rest */ ? ts.Diagnostics.Rest_parameter_0_implicitly_has_an_any_type : ts.Diagnostics.Parameter_0_implicitly_has_an_1_type; break; default: @@ -10604,11 +10922,11 @@ var ts; function getTypeOfVariableOrParameterOrProperty(symbol) { var links = getSymbolLinks(symbol); if (!links.type) { - if (symbol.flags & 268435456 /* Prototype */) { + if (symbol.flags & 536870912 /* Prototype */) { return links.type = getTypeOfPrototypeProperty(symbol); } var declaration = symbol.valueDeclaration; - if (declaration.kind === 171 /* CatchBlock */) { + if (declaration.kind === 178 /* CatchBlock */) { return links.type = anyType; } links.type = resolvingType; @@ -10631,7 +10949,7 @@ var ts; } function getAnnotatedAccessorType(accessor) { if (accessor) { - if (accessor.kind === 123 /* GetAccessor */) { + if (accessor.kind === 127 /* GetAccessor */) { return accessor.type && getTypeFromTypeNode(accessor.type); } else { @@ -10650,8 +10968,8 @@ var ts; links = links || getSymbolLinks(symbol); if (!links.type) { links.type = resolvingType; - var getter = getDeclarationOfKind(symbol, 123 /* GetAccessor */); - var setter = getDeclarationOfKind(symbol, 124 /* SetAccessor */); + var getter = getDeclarationOfKind(symbol, 127 /* GetAccessor */); + var setter = getDeclarationOfKind(symbol, 128 /* SetAccessor */); var type; var getterReturnType = getAnnotatedAccessorType(getter); if (getterReturnType) { @@ -10681,7 +10999,7 @@ var ts; else if (links.type === resolvingType) { links.type = anyType; if (compilerOptions.noImplicitAny) { - var getter = getDeclarationOfKind(symbol, 123 /* GetAccessor */); + var getter = getDeclarationOfKind(symbol, 127 /* GetAccessor */); error(getter, ts.Diagnostics._0_implicitly_has_return_type_any_because_it_does_not_have_a_return_type_annotation_and_is_referenced_directly_or_indirectly_in_one_of_its_return_expressions, symbolToString(symbol)); } } @@ -10715,13 +11033,13 @@ var ts; return links.type; } function getTypeOfSymbol(symbol) { - if (symbol.flags & 33554432 /* Instantiated */) { + if (symbol.flags & 67108864 /* Instantiated */) { return getTypeOfInstantiatedSymbol(symbol); } if (symbol.flags & (ts.SymbolFlags.Variable | 4 /* Property */)) { return getTypeOfVariableOrParameterOrProperty(symbol); } - if (symbol.flags & (16 /* Function */ | 4096 /* Method */ | 32 /* Class */ | 128 /* Enum */ | 256 /* ValueModule */)) { + if (symbol.flags & (16 /* Function */ | 8192 /* Method */ | 32 /* Class */ | ts.SymbolFlags.Enum | 512 /* ValueModule */)) { return getTypeOfFuncClassEnumModule(symbol); } if (symbol.flags & 8 /* EnumMember */) { @@ -10730,7 +11048,7 @@ var ts; if (symbol.flags & ts.SymbolFlags.Accessor) { return getTypeOfAccessors(symbol); } - if (symbol.flags & 16777216 /* Import */) { + if (symbol.flags & 33554432 /* Import */) { return getTypeOfImport(symbol); } return unknownType; @@ -10748,7 +11066,7 @@ var ts; function getTypeParametersOfClassOrInterface(symbol) { var result; ts.forEach(symbol.declarations, function (node) { - if (node.kind === 178 /* InterfaceDeclaration */ || node.kind === 177 /* ClassDeclaration */) { + if (node.kind === 185 /* InterfaceDeclaration */ || node.kind === 184 /* ClassDeclaration */) { var declaration = node; if (declaration.typeParameters && declaration.typeParameters.length) { ts.forEach(declaration.typeParameters, function (node) { @@ -10779,7 +11097,7 @@ var ts; type.typeArguments = type.typeParameters; } type.baseTypes = []; - var declaration = getDeclarationOfKind(symbol, 177 /* ClassDeclaration */); + var declaration = getDeclarationOfKind(symbol, 184 /* ClassDeclaration */); if (declaration.baseType) { var baseType = getTypeFromTypeReferenceNode(declaration.baseType); if (baseType !== unknownType) { @@ -10819,7 +11137,7 @@ var ts; } type.baseTypes = []; ts.forEach(symbol.declarations, function (declaration) { - if (declaration.kind === 178 /* InterfaceDeclaration */ && declaration.baseTypes) { + if (declaration.kind === 185 /* InterfaceDeclaration */ && declaration.baseTypes) { ts.forEach(declaration.baseTypes, function (node) { var baseType = getTypeFromTypeReferenceNode(node); if (baseType !== unknownType) { @@ -10850,7 +11168,7 @@ var ts; var links = getSymbolLinks(symbol); if (!links.declaredType) { links.declaredType = resolvingType; - var declaration = getDeclarationOfKind(symbol, 179 /* TypeAliasDeclaration */); + var declaration = getDeclarationOfKind(symbol, 186 /* TypeAliasDeclaration */); var type = getTypeFromTypeNode(declaration.type); if (links.declaredType === resolvingType) { links.declaredType = type; @@ -10858,7 +11176,7 @@ var ts; } else if (links.declaredType === resolvingType) { links.declaredType = unknownType; - var declaration = getDeclarationOfKind(symbol, 179 /* TypeAliasDeclaration */); + var declaration = getDeclarationOfKind(symbol, 186 /* TypeAliasDeclaration */); error(declaration.name, ts.Diagnostics.Type_alias_0_circularly_references_itself, symbolToString(symbol)); } return links.declaredType; @@ -10877,7 +11195,7 @@ var ts; if (!links.declaredType) { var type = createType(512 /* TypeParameter */); type.symbol = symbol; - if (!getDeclarationOfKind(symbol, 118 /* TypeParameter */).constraint) { + if (!getDeclarationOfKind(symbol, 122 /* TypeParameter */).constraint) { type.constraint = noConstraintType; } links.declaredType = type; @@ -10892,23 +11210,23 @@ var ts; return links.declaredType; } function getDeclaredTypeOfSymbol(symbol) { - ts.Debug.assert((symbol.flags & 33554432 /* Instantiated */) === 0); + ts.Debug.assert((symbol.flags & 67108864 /* Instantiated */) === 0); if (symbol.flags & 32 /* Class */) { return getDeclaredTypeOfClass(symbol); } if (symbol.flags & 64 /* Interface */) { return getDeclaredTypeOfInterface(symbol); } - if (symbol.flags & 1048576 /* TypeAlias */) { + if (symbol.flags & 2097152 /* TypeAlias */) { return getDeclaredTypeOfTypeAlias(symbol); } - if (symbol.flags & 128 /* Enum */) { + if (symbol.flags & ts.SymbolFlags.Enum) { return getDeclaredTypeOfEnum(symbol); } - if (symbol.flags & 524288 /* TypeParameter */) { + if (symbol.flags & 1048576 /* TypeParameter */) { return getDeclaredTypeOfTypeParameter(symbol); } - if (symbol.flags & 16777216 /* Import */) { + if (symbol.flags & 33554432 /* Import */) { return getDeclaredTypeOfImport(symbol); } return unknownType; @@ -11010,7 +11328,7 @@ var ts; function createTupleTypeMemberSymbols(memberTypes) { var members = {}; for (var i = 0; i < memberTypes.length; i++) { - var symbol = createSymbol(4 /* Property */ | 134217728 /* Transient */, "" + i); + var symbol = createSymbol(4 /* Property */ | 268435456 /* Transient */, "" + i); symbol.type = memberTypes[i]; members[i] = symbol; } @@ -11027,7 +11345,7 @@ var ts; return false; } for (var i = 0; i < s.length; i++) { - if (!compareSignatures(s[i], t[i], false, isTypeIdenticalTo)) { + if (!compareSignatures(s[i], t[i], false, compareTypes)) { return false; } } @@ -11074,7 +11392,7 @@ var ts; } function resolveAnonymousTypeMembers(type) { var symbol = type.symbol; - if (symbol.flags & 1024 /* TypeLiteral */) { + if (symbol.flags & 2048 /* TypeLiteral */) { var members = symbol.members; var callSignatures = getSignaturesOfSymbol(members["__call"]); var constructSignatures = getSignaturesOfSymbol(members["__new"]); @@ -11088,7 +11406,7 @@ var ts; if (symbol.flags & ts.SymbolFlags.HasExports) { members = symbol.exports; } - if (symbol.flags & (16 /* Function */ | 4096 /* Method */)) { + if (symbol.flags & (16 /* Function */ | 8192 /* Method */)) { callSignatures = getSignaturesOfSymbol(symbol); } if (symbol.flags & 32 /* Class */) { @@ -11103,7 +11421,7 @@ var ts; } } var stringIndexType = undefined; - var numberIndexType = (symbol.flags & 128 /* Enum */) ? stringType : undefined; + var numberIndexType = (symbol.flags & ts.SymbolFlags.Enum) ? stringType : undefined; } setObjectTypeMembers(type, members, callSignatures, constructSignatures, stringIndexType, numberIndexType); } @@ -11207,7 +11525,7 @@ var ts; } propTypes.push(getTypeOfSymbol(prop)); } - var result = createSymbol(4 /* Property */ | 134217728 /* Transient */ | 536870912 /* UnionProperty */, name); + var result = createSymbol(4 /* Property */ | 268435456 /* Transient */ | 1073741824 /* UnionProperty */, name); result.unionType = unionType; result.declarations = declarations; result.type = getUnionType(propTypes); @@ -11280,7 +11598,7 @@ var ts; function getSignatureFromDeclaration(declaration) { var links = getNodeLinks(declaration); if (!links.resolvedSignature) { - var classType = declaration.kind === 122 /* Constructor */ ? getDeclaredTypeOfClass(declaration.parent.symbol) : undefined; + var classType = declaration.kind === 126 /* Constructor */ ? getDeclaredTypeOfClass(declaration.parent.symbol) : undefined; var typeParameters = classType ? classType.typeParameters : declaration.typeParameters ? getTypeParametersFromDeclaration(declaration.typeParameters) : undefined; var parameters = []; var hasStringLiterals = false; @@ -11308,8 +11626,8 @@ var ts; returnType = getTypeFromTypeNode(declaration.type); } else { - if (declaration.kind === 123 /* GetAccessor */) { - var setter = getDeclarationOfKind(declaration.symbol, 124 /* SetAccessor */); + if (declaration.kind === 127 /* GetAccessor */) { + var setter = getDeclarationOfKind(declaration.symbol, 128 /* SetAccessor */); returnType = getAnnotatedAccessorType(setter); } if (!returnType && !declaration.body) { @@ -11327,16 +11645,16 @@ var ts; for (var i = 0, len = symbol.declarations.length; i < len; i++) { var node = symbol.declarations[i]; switch (node.kind) { - case 175 /* FunctionDeclaration */: - case 121 /* Method */: - case 122 /* Constructor */: - case 125 /* CallSignature */: - case 126 /* ConstructSignature */: - case 127 /* IndexSignature */: - case 123 /* GetAccessor */: - case 124 /* SetAccessor */: - case 144 /* FunctionExpression */: - case 145 /* ArrowFunction */: + case 182 /* FunctionDeclaration */: + case 125 /* Method */: + case 126 /* Constructor */: + case 129 /* CallSignature */: + case 130 /* ConstructSignature */: + case 131 /* IndexSignature */: + case 127 /* GetAccessor */: + case 128 /* SetAccessor */: + case 149 /* FunctionExpression */: + case 150 /* ArrowFunction */: if (i > 0 && node.body) { var previous = symbol.declarations[i - 1]; if (node.parent === previous.parent && node.kind === previous.kind && node.pos === previous.end) { @@ -11405,7 +11723,7 @@ var ts; } function getOrCreateTypeFromSignature(signature) { if (!signature.isolatedSignatureType) { - var isConstructor = signature.declaration.kind === 122 /* Constructor */ || signature.declaration.kind === 126 /* ConstructSignature */; + var isConstructor = signature.declaration.kind === 126 /* Constructor */ || signature.declaration.kind === 130 /* ConstructSignature */; var type = createObjectType(32768 /* Anonymous */ | 65536 /* FromSignature */); type.members = emptySymbols; type.properties = emptyArray; @@ -11419,7 +11737,7 @@ var ts; return symbol.members["__index"]; } function getIndexDeclarationOfSymbol(symbol, kind) { - var syntaxKind = kind === 1 /* Number */ ? 112 /* NumberKeyword */ : 114 /* StringKeyword */; + var syntaxKind = kind === 1 /* Number */ ? 116 /* NumberKeyword */ : 118 /* StringKeyword */; var indexSymbol = getIndexSymbol(symbol); if (indexSymbol) { var len = indexSymbol.declarations.length; @@ -11446,7 +11764,7 @@ var ts; type.constraint = targetConstraint ? instantiateType(targetConstraint, type.mapper) : noConstraintType; } else { - type.constraint = getTypeFromTypeNode(getDeclarationOfKind(type.symbol, 118 /* TypeParameter */).constraint); + type.constraint = getTypeFromTypeNode(getDeclarationOfKind(type.symbol, 122 /* TypeParameter */).constraint); } } return type.constraint === noConstraintType ? undefined : type.constraint; @@ -11486,17 +11804,17 @@ var ts; while (!ts.forEach(typeParameterSymbol.declarations, function (d) { return d.parent === currentNode.parent; })) { currentNode = currentNode.parent; } - links.isIllegalTypeReferenceInConstraint = currentNode.kind === 118 /* TypeParameter */; + links.isIllegalTypeReferenceInConstraint = currentNode.kind === 122 /* TypeParameter */; return links.isIllegalTypeReferenceInConstraint; } function checkTypeParameterHasIllegalReferencesInConstraint(typeParameter) { var typeParameterSymbol; function check(n) { - if (n.kind === 128 /* TypeReference */ && n.typeName.kind === 59 /* Identifier */) { + if (n.kind === 132 /* TypeReference */ && n.typeName.kind === 63 /* Identifier */) { var links = getNodeLinks(n); if (links.isIllegalTypeReferenceInConstraint === undefined) { var symbol = resolveName(typeParameter, n.typeName.text, ts.SymbolFlags.Type, undefined, undefined); - if (symbol && (symbol.flags & 524288 /* TypeParameter */)) { + if (symbol && (symbol.flags & 1048576 /* TypeParameter */)) { links.isIllegalTypeReferenceInConstraint = ts.forEach(symbol.declarations, function (d) { return d.parent == typeParameter.parent; }); } } @@ -11517,7 +11835,7 @@ var ts; var symbol = resolveEntityName(node, node.typeName, ts.SymbolFlags.Type); if (symbol) { var type; - if ((symbol.flags & 524288 /* TypeParameter */) && isTypeParameterReferenceIllegalInConstraint(node, symbol)) { + if ((symbol.flags & 1048576 /* TypeParameter */) && isTypeParameterReferenceIllegalInConstraint(node, symbol)) { type = unknownType; } else { @@ -11557,9 +11875,9 @@ var ts; for (var i = 0; i < declarations.length; i++) { var declaration = declarations[i]; switch (declaration.kind) { - case 177 /* ClassDeclaration */: - case 178 /* InterfaceDeclaration */: - case 180 /* EnumDeclaration */: + case 184 /* ClassDeclaration */: + case 185 /* InterfaceDeclaration */: + case 187 /* EnumDeclaration */: return declaration; } } @@ -11722,34 +12040,34 @@ var ts; } function getTypeFromTypeNode(node) { switch (node.kind) { - case 105 /* AnyKeyword */: + case 109 /* AnyKeyword */: return anyType; - case 114 /* StringKeyword */: + case 118 /* StringKeyword */: return stringType; - case 112 /* NumberKeyword */: + case 116 /* NumberKeyword */: return numberType; - case 106 /* BooleanKeyword */: + case 110 /* BooleanKeyword */: return booleanType; - case 93 /* VoidKeyword */: + case 97 /* VoidKeyword */: return voidType; case 7 /* StringLiteral */: return getTypeFromStringLiteral(node); - case 128 /* TypeReference */: + case 132 /* TypeReference */: return getTypeFromTypeReferenceNode(node); - case 129 /* TypeQuery */: + case 133 /* TypeQuery */: return getTypeFromTypeQueryNode(node); - case 131 /* ArrayType */: + case 135 /* ArrayType */: return getTypeFromArrayTypeNode(node); - case 132 /* TupleType */: + case 136 /* TupleType */: return getTypeFromTupleTypeNode(node); - case 133 /* UnionType */: + case 137 /* UnionType */: return getTypeFromUnionTypeNode(node); - case 134 /* ParenType */: + case 138 /* ParenType */: return getTypeFromTypeNode(node.type); - case 130 /* TypeLiteral */: + case 134 /* TypeLiteral */: return getTypeFromTypeLiteralNode(node); - case 59 /* Identifier */: - case 117 /* QualifiedName */: + case 63 /* Identifier */: + case 121 /* QualifiedName */: var symbol = getSymbolInfo(node); return symbol && getDeclaredTypeOfSymbol(symbol); default: @@ -11847,12 +12165,12 @@ var ts; return result; } function instantiateSymbol(symbol, mapper) { - if (symbol.flags & 33554432 /* Instantiated */) { + if (symbol.flags & 67108864 /* Instantiated */) { var links = getSymbolLinks(symbol); symbol = links.target; mapper = combineTypeMappers(links.mapper, mapper); } - var result = createSymbol(33554432 /* Instantiated */ | 134217728 /* Transient */ | symbol.flags, symbol.name); + var result = createSymbol(67108864 /* Instantiated */ | 268435456 /* Transient */ | symbol.flags, symbol.name); result.declarations = symbol.declarations; result.parent = symbol.parent; result.target = symbol; @@ -11882,7 +12200,7 @@ var ts; return mapper(type); } if (type.flags & 32768 /* Anonymous */) { - return type.symbol && type.symbol.flags & (16 /* Function */ | 4096 /* Method */ | 1024 /* TypeLiteral */ | 2048 /* ObjectLiteral */) ? instantiateAnonymousType(type, mapper) : type; + return type.symbol && type.symbol.flags & (16 /* Function */ | 8192 /* Method */ | 2048 /* TypeLiteral */ | 4096 /* ObjectLiteral */) ? instantiateAnonymousType(type, mapper) : type; } if (type.flags & 4096 /* Reference */) { return createTypeReference(type.target, instantiateList(type.typeArguments, mapper, instantiateType)); @@ -11898,17 +12216,17 @@ var ts; } function isContextSensitiveExpression(node) { switch (node.kind) { - case 144 /* FunctionExpression */: - case 145 /* ArrowFunction */: + case 149 /* FunctionExpression */: + case 150 /* ArrowFunction */: return !node.typeParameters && !ts.forEach(node.parameters, function (p) { return p.type; }); - case 136 /* ObjectLiteral */: - return ts.forEach(node.properties, function (p) { return p.kind === 137 /* PropertyAssignment */ && isContextSensitiveExpression(p.initializer); }); - case 135 /* ArrayLiteral */: + case 140 /* ObjectLiteral */: + return ts.forEach(node.properties, function (p) { return p.kind === 141 /* PropertyAssignment */ && isContextSensitiveExpression(p.initializer); }); + case 139 /* ArrayLiteral */: return ts.forEach(node.elements, function (e) { return isContextSensitiveExpression(e); }); - case 149 /* ConditionalExpression */: + case 154 /* ConditionalExpression */: return isContextSensitiveExpression(node.whenTrue) || isContextSensitiveExpression(node.whenFalse); - case 148 /* BinaryExpression */: - return node.operator === 44 /* BarBarToken */ && (isContextSensitiveExpression(node.left) || isContextSensitiveExpression(node.right)); + case 153 /* BinaryExpression */: + return node.operator === 48 /* BarBarToken */ && (isContextSensitiveExpression(node.left) || isContextSensitiveExpression(node.right)); } return false; } @@ -11932,78 +12250,26 @@ var ts; function isTypeIdenticalTo(source, target) { return checkTypeRelatedTo(source, target, identityRelation, undefined); } + function compareTypes(source, target) { + return checkTypeRelatedTo(source, target, identityRelation, undefined) ? -1 /* True */ : 0 /* False */; + } function isTypeSubtypeOf(source, target) { return checkTypeSubtypeOf(source, target, undefined); } - function checkTypeSubtypeOf(source, target, errorNode, headMessage, containingMessageChain) { - return checkTypeRelatedTo(source, target, subtypeRelation, errorNode, headMessage, containingMessageChain); - } function isTypeAssignableTo(source, target) { return checkTypeAssignableTo(source, target, undefined); } + function checkTypeSubtypeOf(source, target, errorNode, headMessage, containingMessageChain) { + return checkTypeRelatedTo(source, target, subtypeRelation, errorNode, headMessage, containingMessageChain); + } function checkTypeAssignableTo(source, target, errorNode, headMessage) { return checkTypeRelatedTo(source, target, assignableRelation, errorNode, headMessage); } - function isTypeRelatedTo(source, target, relation) { - return checkTypeRelatedTo(source, target, relation, undefined); - } function isSignatureAssignableTo(source, target) { var sourceType = getOrCreateTypeFromSignature(source); var targetType = getOrCreateTypeFromSignature(target); return checkTypeRelatedTo(sourceType, targetType, assignableRelation, undefined); } - function isPropertyIdenticalTo(sourceProp, targetProp) { - return isPropertyIdenticalToRecursive(sourceProp, targetProp, false, function (s, t, _reportErrors) { return isTypeIdenticalTo(s, t); }); - } - function checkInheritedPropertiesAreIdentical(type, typeNode) { - if (!type.baseTypes.length || type.baseTypes.length === 1) { - return true; - } - var seen = {}; - ts.forEach(type.declaredProperties, function (p) { - seen[p.name] = { prop: p, containingType: type }; - }); - var ok = true; - for (var i = 0, len = type.baseTypes.length; i < len; ++i) { - var base = type.baseTypes[i]; - var properties = getPropertiesOfObjectType(base); - for (var j = 0, proplen = properties.length; j < proplen; ++j) { - var prop = properties[j]; - if (!ts.hasProperty(seen, prop.name)) { - seen[prop.name] = { prop: prop, containingType: base }; - } - else { - var existing = seen[prop.name]; - var isInheritedProperty = existing.containingType !== type; - if (isInheritedProperty && !isPropertyIdenticalTo(existing.prop, prop)) { - ok = false; - var typeName1 = typeToString(existing.containingType); - var typeName2 = typeToString(base); - var errorInfo = ts.chainDiagnosticMessages(undefined, ts.Diagnostics.Named_properties_0_of_types_1_and_2_are_not_identical, prop.name, typeName1, typeName2); - errorInfo = ts.chainDiagnosticMessages(errorInfo, ts.Diagnostics.Interface_0_cannot_simultaneously_extend_types_1_and_2, typeToString(type), typeName1, typeName2); - addDiagnostic(ts.createDiagnosticForNodeFromMessageChain(typeNode, errorInfo, program.getCompilerHost().getNewLine())); - } - } - } - } - return ok; - } - function isPropertyIdenticalToRecursive(sourceProp, targetProp, reportErrors, relate) { - if (sourceProp === targetProp) { - return true; - } - var sourcePropAccessibility = getDeclarationFlagsFromSymbol(sourceProp) & (32 /* Private */ | 64 /* Protected */); - var targetPropAccessibility = getDeclarationFlagsFromSymbol(targetProp) & (32 /* Private */ | 64 /* Protected */); - if (sourcePropAccessibility !== targetPropAccessibility) { - return false; - } - if (sourcePropAccessibility) { - return getTargetSymbol(sourceProp) === getTargetSymbol(targetProp) && relate(getTypeOfSymbol(sourceProp), getTypeOfSymbol(targetProp), reportErrors); - } - else { - return isOptionalProperty(sourceProp) === isOptionalProperty(targetProp) && relate(getTypeOfSymbol(sourceProp), getTypeOfSymbol(targetProp), reportErrors); - } - } function checkTypeRelatedTo(source, target, relation, errorNode, headMessage, containingMessageChain) { var errorInfo; var sourceStack; @@ -12012,7 +12278,7 @@ var ts; var depth = 0; var overflow = false; ts.Debug.assert(relation !== identityRelation || !errorNode, "no error reporting in identity checking"); - var result = isRelatedToWithCustomErrors(source, target, errorNode !== undefined, headMessage); + var result = isRelatedTo(source, target, errorNode !== undefined, headMessage); if (overflow) { error(errorNode, ts.Diagnostics.Excessive_stack_depth_comparing_types_0_and_1, typeToString(source), typeToString(target)); } @@ -12022,109 +12288,114 @@ var ts; } addDiagnostic(ts.createDiagnosticForNodeFromMessageChain(errorNode, errorInfo, program.getCompilerHost().getNewLine())); } - return result; + return result !== 0 /* False */; function reportError(message, arg0, arg1, arg2) { errorInfo = ts.chainDiagnosticMessages(errorInfo, message, arg0, arg1, arg2); } - function isRelatedTo(source, target, reportErrors) { - return isRelatedToWithCustomErrors(source, target, reportErrors, undefined); - } - function isRelatedToWithCustomErrors(source, target, reportErrors, headMessage) { + function isRelatedTo(source, target, reportErrors, headMessage) { + var result; if (relation === identityRelation) { if (source === target) - return true; + return -1 /* True */; } else { if (source === target) - return true; + return -1 /* True */; if (target.flags & 1 /* Any */) - return true; + return -1 /* True */; if (source === undefinedType) - return true; + return -1 /* True */; if (source === nullType && target !== undefinedType) - return true; + return -1 /* True */; if (source.flags & 128 /* Enum */ && target === numberType) - return true; + return -1 /* True */; if (source.flags & 256 /* StringLiteral */ && target === stringType) - return true; + return -1 /* True */; if (relation === assignableRelation) { if (source.flags & 1 /* Any */) - return true; + return -1 /* True */; if (source === numberType && target.flags & 128 /* Enum */) - return true; + return -1 /* True */; } } if (source.flags & 16384 /* Union */) { - if (unionTypeRelatedToType(source, target, reportErrors)) { - return true; + if (result = unionTypeRelatedToType(source, target, reportErrors)) { + return result; } } else if (target.flags & 16384 /* Union */) { - if (typeRelatedToUnionType(source, target, reportErrors)) { - return true; + if (result = typeRelatedToUnionType(source, target, reportErrors)) { + return result; } } else if (source.flags & 512 /* TypeParameter */ && target.flags & 512 /* TypeParameter */) { - if (typeParameterRelatedTo(source, target, reportErrors)) { - return true; + if (result = typeParameterRelatedTo(source, target, reportErrors)) { + return result; } } else { var saveErrorInfo = errorInfo; if (source.flags & 4096 /* Reference */ && target.flags & 4096 /* Reference */ && source.target === target.target) { - if (typesRelatedTo(source.typeArguments, target.typeArguments, reportErrors)) { - return true; + if (result = typesRelatedTo(source.typeArguments, target.typeArguments, reportErrors)) { + return result; } } var reportStructuralErrors = reportErrors && errorInfo === saveErrorInfo; var sourceOrApparentType = relation === identityRelation ? source : getApparentType(source); - if (sourceOrApparentType.flags & ts.TypeFlags.ObjectType && target.flags & ts.TypeFlags.ObjectType && objectTypeRelatedTo(sourceOrApparentType, target, reportStructuralErrors)) { + if (sourceOrApparentType.flags & ts.TypeFlags.ObjectType && target.flags & ts.TypeFlags.ObjectType && (result = objectTypeRelatedTo(sourceOrApparentType, target, reportStructuralErrors))) { errorInfo = saveErrorInfo; - return true; + return result; } } if (reportErrors) { headMessage = headMessage || ts.Diagnostics.Type_0_is_not_assignable_to_type_1; - ts.Debug.assert(headMessage); reportError(headMessage, typeToString(source), typeToString(target)); } - return false; + return 0 /* False */; } function typeRelatedToUnionType(source, target, reportErrors) { var targetTypes = target.types; for (var i = 0, len = targetTypes.length; i < len; i++) { - if (isRelatedTo(source, targetTypes[i], reportErrors && i === len - 1)) { - return true; + var related = isRelatedTo(source, targetTypes[i], reportErrors && i === len - 1); + if (related) { + return related; } } - return false; + return 0 /* False */; } function unionTypeRelatedToType(source, target, reportErrors) { + var result = -1 /* True */; var sourceTypes = source.types; for (var i = 0, len = sourceTypes.length; i < len; i++) { - if (!isRelatedTo(sourceTypes[i], target, reportErrors)) { - return false; + var related = isRelatedTo(sourceTypes[i], target, reportErrors); + if (!related) { + return 0 /* False */; } + result &= related; } - return true; + return result; } function typesRelatedTo(sources, targets, reportErrors) { + var result = -1 /* True */; for (var i = 0, len = sources.length; i < len; i++) { - if (!isRelatedTo(sources[i], targets[i], reportErrors)) - return false; + var related = isRelatedTo(sources[i], targets[i], reportErrors); + if (!related) { + return 0 /* False */; + } + result &= related; } - return true; + return result; } function typeParameterRelatedTo(source, target, reportErrors) { if (relation === identityRelation) { if (source.symbol.name !== target.symbol.name) { - return false; + return 0 /* False */; } if (source.constraint === target.constraint) { - return true; + return -1 /* True */; } if (source.constraint === noConstraintType || target.constraint === noConstraintType) { - return false; + return 0 /* False */; } return isRelatedTo(source.constraint, target.constraint, reportErrors); } @@ -12132,29 +12403,32 @@ var ts; while (true) { var constraint = getConstraintOfTypeParameter(source); if (constraint === target) - return true; + return -1 /* True */; if (!(constraint && constraint.flags & 512 /* TypeParameter */)) break; source = constraint; } - return false; + return 0 /* False */; } } function objectTypeRelatedTo(source, target, reportErrors) { - if (overflow) - return false; - var result; + if (overflow) { + return 0 /* False */; + } var id = source.id + "," + target.id; - if ((result = relation[id]) !== undefined) - return result; + var related = relation[id]; + if (related !== undefined) { + return related; + } if (depth > 0) { for (var i = 0; i < depth; i++) { - if (source === sourceStack[i] && target === targetStack[i]) - return true; + if (source === sourceStack[i] && target === targetStack[i]) { + return 1 /* Maybe */; + } } if (depth === 100) { overflow = true; - return false; + return 0 /* False */; } } else { @@ -12170,10 +12444,27 @@ var ts; expandingFlags |= 1; if (!(expandingFlags & 2) && isDeeplyNestedGeneric(target, targetStack)) expandingFlags |= 2; - result = expandingFlags === 3 || propertiesRelatedTo(source, target, reportErrors) && signaturesRelatedTo(source, target, 0 /* Call */, reportErrors) && signaturesRelatedTo(source, target, 1 /* Construct */, reportErrors) && stringIndexTypesRelatedTo(source, target, reportErrors) && numberIndexTypesRelatedTo(source, target, reportErrors); + if (expandingFlags === 3) { + var result = -1 /* True */; + } + else { + var result = propertiesRelatedTo(source, target, reportErrors); + if (result) { + result &= signaturesRelatedTo(source, target, 0 /* Call */, reportErrors); + if (result) { + result &= signaturesRelatedTo(source, target, 1 /* Construct */, reportErrors); + if (result) { + result &= stringIndexTypesRelatedTo(source, target, reportErrors); + if (result) { + result &= numberIndexTypesRelatedTo(source, target, reportErrors); + } + } + } + } + } expandingFlags = saveExpandingFlags; depth--; - if (depth === 0) { + if (result !== 1 /* Maybe */) { relation[id] = result; } return result; @@ -12195,8 +12486,9 @@ var ts; } function propertiesRelatedTo(source, target, reportErrors) { if (relation === identityRelation) { - return propertiesIdenticalTo(source, target, reportErrors); + return propertiesIdenticalTo(source, target); } + var result = -1 /* True */; var properties = getPropertiesOfObjectType(target); for (var i = 0; i < properties.length; i++) { var targetProp = properties[i]; @@ -12207,10 +12499,10 @@ var ts; if (reportErrors) { reportError(ts.Diagnostics.Property_0_is_missing_in_type_1, symbolToString(targetProp), typeToString(source)); } - return false; + return 0 /* False */; } } - else if (!(targetProp.flags & 268435456 /* Prototype */)) { + else if (!(targetProp.flags & 536870912 /* Prototype */)) { var sourceFlags = getDeclarationFlagsFromSymbol(sourceProp); var targetFlags = getDeclarationFlagsFromSymbol(targetProp); if (sourceFlags & 32 /* Private */ || targetFlags & 32 /* Private */) { @@ -12223,7 +12515,7 @@ var ts; reportError(ts.Diagnostics.Property_0_is_private_in_type_1_but_not_in_type_2, symbolToString(targetProp), typeToString(sourceFlags & 32 /* Private */ ? source : target), typeToString(sourceFlags & 32 /* Private */ ? target : source)); } } - return false; + return 0 /* False */; } } else if (targetFlags & 64 /* Protected */) { @@ -12234,55 +12526,65 @@ var ts; if (reportErrors) { reportError(ts.Diagnostics.Property_0_is_protected_but_type_1_is_not_a_class_derived_from_2, symbolToString(targetProp), typeToString(sourceClass || source), typeToString(targetClass)); } - return false; + return 0 /* False */; } } else if (sourceFlags & 64 /* Protected */) { if (reportErrors) { reportError(ts.Diagnostics.Property_0_is_protected_in_type_1_but_public_in_type_2, symbolToString(targetProp), typeToString(source), typeToString(target)); } - return false; + return 0 /* False */; } - if (!isRelatedTo(getTypeOfSymbol(sourceProp), getTypeOfSymbol(targetProp), reportErrors)) { + var related = isRelatedTo(getTypeOfSymbol(sourceProp), getTypeOfSymbol(targetProp), reportErrors); + if (!related) { if (reportErrors) { reportError(ts.Diagnostics.Types_of_property_0_are_incompatible, symbolToString(targetProp)); } - return false; + return 0 /* False */; } + result &= related; if (isOptionalProperty(sourceProp) && !isOptionalProperty(targetProp)) { if (reportErrors) { reportError(ts.Diagnostics.Property_0_is_optional_in_type_1_but_required_in_type_2, symbolToString(targetProp), typeToString(source), typeToString(target)); } - return false; + return 0 /* False */; } } } } - return true; + return result; } - function propertiesIdenticalTo(source, target, reportErrors) { + function propertiesIdenticalTo(source, target) { var sourceProperties = getPropertiesOfObjectType(source); var targetProperties = getPropertiesOfObjectType(target); if (sourceProperties.length !== targetProperties.length) { - return false; + return 0 /* False */; } + var result = -1 /* True */; for (var i = 0, len = sourceProperties.length; i < len; ++i) { var sourceProp = sourceProperties[i]; var targetProp = getPropertyOfObjectType(target, sourceProp.name); - if (!targetProp || !isPropertyIdenticalToRecursive(sourceProp, targetProp, reportErrors, isRelatedTo)) { - return false; + if (!targetProp) { + return 0 /* False */; } + var related = compareProperties(sourceProp, targetProp, isRelatedTo); + if (!related) { + return 0 /* False */; + } + result &= related; } - return true; + return result; } function signaturesRelatedTo(source, target, kind, reportErrors) { if (relation === identityRelation) { - return signaturesIdenticalTo(source, target, kind, reportErrors); + return signaturesIdenticalTo(source, target, kind); + } + if (target === anyFunctionType || source === anyFunctionType) { + return -1 /* True */; } - if (target === anyFunctionType || source === anyFunctionType) - return true; var sourceSignatures = getSignaturesOfType(source, kind); var targetSignatures = getSignaturesOfType(target, kind); + var result = -1 /* True */; var saveErrorInfo = errorInfo; outer: for (var i = 0; i < targetSignatures.length; i++) { var t = targetSignatures[i]; @@ -12291,24 +12593,26 @@ var ts; for (var j = 0; j < sourceSignatures.length; j++) { var s = sourceSignatures[j]; if (!s.hasStringLiterals || source.flags & 65536 /* FromSignature */) { - if (signatureRelatedTo(s, t, localErrors)) { + var related = signatureRelatedTo(s, t, localErrors); + if (related) { + result &= related; errorInfo = saveErrorInfo; continue outer; } localErrors = false; } } - return false; + return 0 /* False */; } } - return true; + return result; } function signatureRelatedTo(source, target, reportErrors) { if (source === target) { - return true; + return -1 /* True */; } if (!target.hasRestParameter && source.minArgumentCount > target.parameters.length) { - return false; + return 0 /* False */; } var sourceMax = source.parameters.length; var targetMax = target.parameters.length; @@ -12331,42 +12635,49 @@ var ts; } source = getErasedSignature(source); target = getErasedSignature(target); + var result = -1 /* True */; for (var i = 0; i < checkCount; i++) { var s = i < sourceMax ? getTypeOfSymbol(source.parameters[i]) : getRestTypeOfSignature(source); var t = i < targetMax ? getTypeOfSymbol(target.parameters[i]) : getRestTypeOfSignature(target); var saveErrorInfo = errorInfo; - if (!isRelatedTo(s, t, reportErrors)) { - if (!isRelatedTo(t, s, false)) { + var related = isRelatedTo(s, t, reportErrors); + if (!related) { + related = isRelatedTo(t, s, false); + if (!related) { if (reportErrors) { reportError(ts.Diagnostics.Types_of_parameters_0_and_1_are_incompatible, source.parameters[i < sourceMax ? i : sourceMax].name, target.parameters[i < targetMax ? i : targetMax].name); } - return false; + return 0 /* False */; } errorInfo = saveErrorInfo; } + result &= related; } var t = getReturnTypeOfSignature(target); if (t === voidType) - return true; + return result; var s = getReturnTypeOfSignature(source); - return isRelatedTo(s, t, reportErrors); + return result & isRelatedTo(s, t, reportErrors); } - function signaturesIdenticalTo(source, target, kind, reportErrors) { + function signaturesIdenticalTo(source, target, kind) { var sourceSignatures = getSignaturesOfType(source, kind); var targetSignatures = getSignaturesOfType(target, kind); if (sourceSignatures.length !== targetSignatures.length) { - return false; + return 0 /* False */; } + var result = -1 /* True */; for (var i = 0, len = sourceSignatures.length; i < len; ++i) { - if (!compareSignatures(sourceSignatures[i], targetSignatures[i], true, isRelatedTo)) { - return false; + var related = compareSignatures(sourceSignatures[i], targetSignatures[i], true, isRelatedTo); + if (!related) { + return 0 /* False */; } + result &= related; } - return true; + return result; } function stringIndexTypesRelatedTo(source, target, reportErrors) { if (relation === identityRelation) { - return indexTypesIdenticalTo(0 /* String */, source, target, reportErrors); + return indexTypesIdenticalTo(0 /* String */, source, target); } var targetType = getIndexTypeOfType(target, 0 /* String */); if (targetType) { @@ -12375,20 +12686,22 @@ var ts; if (reportErrors) { reportError(ts.Diagnostics.Index_signature_is_missing_in_type_0, typeToString(source)); } - return false; + return 0 /* False */; } - if (!isRelatedTo(sourceType, targetType, reportErrors)) { + var related = isRelatedTo(sourceType, targetType, reportErrors); + if (!related) { if (reportErrors) { reportError(ts.Diagnostics.Index_signatures_are_incompatible); } - return false; + return 0 /* False */; } + return related; } - return true; + return -1 /* True */; } function numberIndexTypesRelatedTo(source, target, reportErrors) { if (relation === identityRelation) { - return indexTypesIdenticalTo(1 /* Number */, source, target, reportErrors); + return indexTypesIdenticalTo(1 /* Number */, source, target); } var targetType = getIndexTypeOfType(target, 1 /* Number */); if (targetType) { @@ -12398,59 +12711,98 @@ var ts; if (reportErrors) { reportError(ts.Diagnostics.Index_signature_is_missing_in_type_0, typeToString(source)); } - return false; + return 0 /* False */; } if (sourceStringType && sourceNumberType) { - var compatible = isRelatedTo(sourceStringType, targetType, false) || isRelatedTo(sourceNumberType, targetType, reportErrors); + var related = isRelatedTo(sourceStringType, targetType, false) || isRelatedTo(sourceNumberType, targetType, reportErrors); } else { - var compatible = isRelatedTo(sourceStringType || sourceNumberType, targetType, reportErrors); + var related = isRelatedTo(sourceStringType || sourceNumberType, targetType, reportErrors); } - if (!compatible) { + if (!related) { if (reportErrors) { reportError(ts.Diagnostics.Index_signatures_are_incompatible); } - return false; + return 0 /* False */; } + return related; } - return true; + return -1 /* True */; } - function indexTypesIdenticalTo(indexKind, source, target, reportErrors) { + function indexTypesIdenticalTo(indexKind, source, target) { var targetType = getIndexTypeOfType(target, indexKind); var sourceType = getIndexTypeOfType(source, indexKind); - return (!sourceType && !targetType) || (sourceType && targetType && isRelatedTo(sourceType, targetType, reportErrors)); + if (!sourceType && !targetType) { + return -1 /* True */; + } + if (sourceType && targetType) { + return isRelatedTo(sourceType, targetType); + } + return 0 /* False */; } } + function isPropertyIdenticalTo(sourceProp, targetProp) { + return compareProperties(sourceProp, targetProp, compareTypes) !== 0 /* False */; + } + function compareProperties(sourceProp, targetProp, compareTypes) { + if (sourceProp === targetProp) { + return -1 /* True */; + } + var sourcePropAccessibility = getDeclarationFlagsFromSymbol(sourceProp) & (32 /* Private */ | 64 /* Protected */); + var targetPropAccessibility = getDeclarationFlagsFromSymbol(targetProp) & (32 /* Private */ | 64 /* Protected */); + if (sourcePropAccessibility !== targetPropAccessibility) { + return 0 /* False */; + } + if (sourcePropAccessibility) { + if (getTargetSymbol(sourceProp) !== getTargetSymbol(targetProp)) { + return 0 /* False */; + } + } + else { + if (isOptionalProperty(sourceProp) !== isOptionalProperty(targetProp)) { + return 0 /* False */; + } + } + return compareTypes(getTypeOfSymbol(sourceProp), getTypeOfSymbol(targetProp)); + } function compareSignatures(source, target, compareReturnTypes, compareTypes) { if (source === target) { - return true; + return -1 /* True */; } if (source.parameters.length !== target.parameters.length || source.minArgumentCount !== target.minArgumentCount || source.hasRestParameter !== target.hasRestParameter) { - return false; + return 0 /* False */; } + var result = -1 /* True */; if (source.typeParameters && target.typeParameters) { if (source.typeParameters.length !== target.typeParameters.length) { - return false; + return 0 /* False */; } for (var i = 0, len = source.typeParameters.length; i < len; ++i) { - if (!compareTypes(source.typeParameters[i], target.typeParameters[i])) { - return false; + var related = compareTypes(source.typeParameters[i], target.typeParameters[i]); + if (!related) { + return 0 /* False */; } + result &= related; } } else if (source.typeParameters || source.typeParameters) { - return false; + return 0 /* False */; } source = getErasedSignature(source); target = getErasedSignature(target); for (var i = 0, len = source.parameters.length; i < len; i++) { var s = source.hasRestParameter && i === len - 1 ? getRestTypeOfSignature(source) : getTypeOfSymbol(source.parameters[i]); var t = target.hasRestParameter && i === len - 1 ? getRestTypeOfSignature(target) : getTypeOfSymbol(target.parameters[i]); - if (!compareTypes(s, t)) { - return false; + var related = compareTypes(s, t); + if (!related) { + return 0 /* False */; } + result &= related; } - return !compareReturnTypes || compareTypes(getReturnTypeOfSignature(source), getReturnTypeOfSignature(target)); + if (compareReturnTypes) { + result &= compareTypes(getReturnTypeOfSignature(source), getReturnTypeOfSignature(target)); + } + return result; } function isSupertypeOfEach(candidate, types) { for (var i = 0, len = types.length; i < len; i++) { @@ -12489,7 +12841,7 @@ var ts; checkTypeSubtypeOf(bestSupertypeDownfallType, bestSupertype, errorLocation, ts.Diagnostics.Type_argument_candidate_1_is_not_a_valid_type_argument_because_it_is_not_a_supertype_of_candidate_0, errorMessageChainHead); } function isTypeOfObjectLiteral(type) { - return (type.flags & 32768 /* Anonymous */) && type.symbol && (type.symbol.flags & 2048 /* ObjectLiteral */) ? true : false; + return (type.flags & 32768 /* Anonymous */) && type.symbol && (type.symbol.flags & 4096 /* ObjectLiteral */) ? true : false; } function isArrayType(type) { return type.flags & 4096 /* Reference */ && type.target === globalArrayType; @@ -12537,7 +12889,7 @@ var ts; var members = {}; var index = 0; ts.forEach(properties, function (p) { - var symbol = createSymbol(4 /* Property */ | 134217728 /* Transient */ | p.flags, p.name); + var symbol = createSymbol(4 /* Property */ | 268435456 /* Transient */ | p.flags, p.name); symbol.declarations = p.declarations; symbol.parent = p.parent; symbol.type = widenedTypes[index++]; @@ -12672,7 +13024,7 @@ var ts; inferFromTypes(sourceTypes[i], target); } } - else if (source.flags & ts.TypeFlags.ObjectType && (target.flags & (4096 /* Reference */ | 8192 /* Tuple */) || (target.flags & 32768 /* Anonymous */) && target.symbol && target.symbol.flags & (4096 /* Method */ | 1024 /* TypeLiteral */))) { + else if (source.flags & ts.TypeFlags.ObjectType && (target.flags & (4096 /* Reference */ | 8192 /* Tuple */) || (target.flags & 32768 /* Anonymous */) && target.symbol && target.symbol.flags & (8192 /* Method */ | 2048 /* TypeLiteral */))) { if (!isInProcess(source, target) && isWithinDepthLimit(source, sourceStack) && isWithinDepthLimit(target, targetStack)) { if (depth === 0) { sourceStack = []; @@ -12756,17 +13108,17 @@ var ts; function getResolvedSymbol(node) { var links = getNodeLinks(node); if (!links.resolvedSymbol) { - links.resolvedSymbol = resolveName(node, node.text, ts.SymbolFlags.Value | 2097152 /* ExportValue */, ts.Diagnostics.Cannot_find_name_0, node) || unknownSymbol; + links.resolvedSymbol = resolveName(node, node.text, ts.SymbolFlags.Value | 4194304 /* ExportValue */, ts.Diagnostics.Cannot_find_name_0, node) || unknownSymbol; } return links.resolvedSymbol; } function isInTypeQuery(node) { while (node) { switch (node.kind) { - case 129 /* TypeQuery */: + case 133 /* TypeQuery */: return true; - case 59 /* Identifier */: - case 117 /* QualifiedName */: + case 63 /* Identifier */: + case 121 /* QualifiedName */: node = node.parent; continue; default: @@ -12799,10 +13151,10 @@ var ts; function isAssignedInBinaryExpression(node) { if (node.operator >= ts.SyntaxKind.FirstAssignment && node.operator <= ts.SyntaxKind.LastAssignment) { var n = node.left; - while (n.kind === 143 /* ParenExpression */) { + while (n.kind === 148 /* ParenExpression */) { n = n.expression; } - if (n.kind === 59 /* Identifier */ && getResolvedSymbol(n) === symbol) { + if (n.kind === 63 /* Identifier */ && getResolvedSymbol(n) === symbol) { return true; } } @@ -12816,40 +13168,40 @@ var ts; } function isAssignedIn(node) { switch (node.kind) { - case 148 /* BinaryExpression */: + case 153 /* BinaryExpression */: return isAssignedInBinaryExpression(node); - case 174 /* VariableDeclaration */: + case 181 /* VariableDeclaration */: return isAssignedInVariableDeclaration(node); - case 135 /* ArrayLiteral */: - case 136 /* ObjectLiteral */: - case 138 /* PropertyAccess */: - case 139 /* IndexedAccess */: - case 140 /* CallExpression */: - case 141 /* NewExpression */: - case 142 /* TypeAssertion */: - case 143 /* ParenExpression */: - case 146 /* PrefixOperator */: - case 147 /* PostfixOperator */: - case 149 /* ConditionalExpression */: - case 151 /* Block */: - case 152 /* VariableStatement */: - case 154 /* ExpressionStatement */: - case 155 /* IfStatement */: - case 156 /* DoStatement */: - case 157 /* WhileStatement */: - case 158 /* ForStatement */: - case 159 /* ForInStatement */: - case 162 /* ReturnStatement */: - case 163 /* WithStatement */: - case 164 /* SwitchStatement */: - case 165 /* CaseClause */: - case 166 /* DefaultClause */: - case 167 /* LabeledStatement */: - case 168 /* ThrowStatement */: - case 169 /* TryStatement */: - case 170 /* TryBlock */: - case 171 /* CatchBlock */: - case 172 /* FinallyBlock */: + case 139 /* ArrayLiteral */: + case 140 /* ObjectLiteral */: + case 142 /* PropertyAccess */: + case 143 /* IndexedAccess */: + case 144 /* CallExpression */: + case 145 /* NewExpression */: + case 147 /* TypeAssertion */: + case 148 /* ParenExpression */: + case 151 /* PrefixOperator */: + case 152 /* PostfixOperator */: + case 154 /* ConditionalExpression */: + case 158 /* Block */: + case 159 /* VariableStatement */: + case 161 /* ExpressionStatement */: + case 162 /* IfStatement */: + case 163 /* DoStatement */: + case 164 /* WhileStatement */: + case 165 /* ForStatement */: + case 166 /* ForInStatement */: + case 169 /* ReturnStatement */: + case 170 /* WithStatement */: + case 171 /* SwitchStatement */: + case 172 /* CaseClause */: + case 173 /* DefaultClause */: + case 174 /* LabeledStatement */: + case 175 /* ThrowStatement */: + case 176 /* TryStatement */: + case 177 /* TryBlock */: + case 178 /* CatchBlock */: + case 179 /* FinallyBlock */: return ts.forEachChild(node, isAssignedIn); } return false; @@ -12861,27 +13213,27 @@ var ts; while (true) { var child = node; node = node.parent; - if (!node || node.kind === 176 /* FunctionBlock */ || node.kind === 182 /* ModuleBlock */) { + if (!node || node.kind === 183 /* FunctionBlock */ || node.kind === 189 /* ModuleBlock */) { break; } var narrowedType = type; switch (node.kind) { - case 155 /* IfStatement */: + case 162 /* IfStatement */: if (child !== node.expression) { narrowedType = narrowType(type, node.expression, child === node.thenStatement); } break; - case 149 /* ConditionalExpression */: + case 154 /* ConditionalExpression */: if (child !== node.condition) { narrowedType = narrowType(type, node.condition, child === node.whenTrue); } break; - case 148 /* BinaryExpression */: + case 153 /* BinaryExpression */: if (child === node.right) { - if (node.operator === 43 /* AmpersandAmpersandToken */) { + if (node.operator === 47 /* AmpersandAmpersandToken */) { narrowedType = narrowType(type, node.left, true); } - else if (node.operator === 44 /* BarBarToken */) { + else if (node.operator === 48 /* BarBarToken */) { narrowedType = narrowType(type, node.left, false); } } @@ -12899,12 +13251,12 @@ var ts; function narrowTypeByEquality(type, expr, assumeTrue) { var left = expr.left; var right = expr.right; - if (left.kind !== 146 /* PrefixOperator */ || left.operator !== 91 /* TypeOfKeyword */ || left.operand.kind !== 59 /* Identifier */ || right.kind !== 7 /* StringLiteral */ || getResolvedSymbol(left.operand) !== symbol) { + if (left.kind !== 151 /* PrefixOperator */ || left.operator !== 95 /* TypeOfKeyword */ || left.operand.kind !== 63 /* Identifier */ || right.kind !== 7 /* StringLiteral */ || getResolvedSymbol(left.operand) !== symbol) { return type; } var t = right.text; var checkType = t === "string" ? stringType : t === "number" ? numberType : t === "boolean" ? booleanType : emptyObjectType; - if (expr.operator === 26 /* ExclamationEqualsEqualsToken */) { + if (expr.operator === 30 /* ExclamationEqualsEqualsToken */) { assumeTrue = !assumeTrue; } if (assumeTrue) { @@ -12937,7 +13289,7 @@ var ts; } } function narrowTypeByInstanceof(type, expr, assumeTrue) { - if (!assumeTrue || expr.left.kind !== 59 /* Identifier */ || getResolvedSymbol(expr.left) !== symbol) { + if (!assumeTrue || expr.left.kind !== 63 /* Identifier */ || getResolvedSymbol(expr.left) !== symbol) { return type; } var rightType = checkExpression(expr.right); @@ -12953,25 +13305,25 @@ var ts; } function narrowType(type, expr, assumeTrue) { switch (expr.kind) { - case 143 /* ParenExpression */: + case 148 /* ParenExpression */: return narrowType(type, expr.expression, assumeTrue); - case 148 /* BinaryExpression */: + case 153 /* BinaryExpression */: var operator = expr.operator; - if (operator === 25 /* EqualsEqualsEqualsToken */ || operator === 26 /* ExclamationEqualsEqualsToken */) { + if (operator === 29 /* EqualsEqualsEqualsToken */ || operator === 30 /* ExclamationEqualsEqualsToken */) { return narrowTypeByEquality(type, expr, assumeTrue); } - else if (operator === 43 /* AmpersandAmpersandToken */) { + else if (operator === 47 /* AmpersandAmpersandToken */) { return narrowTypeByAnd(type, expr, assumeTrue); } - else if (operator === 44 /* BarBarToken */) { + else if (operator === 48 /* BarBarToken */) { return narrowTypeByOr(type, expr, assumeTrue); } - else if (operator === 81 /* InstanceOfKeyword */) { + else if (operator === 85 /* InstanceOfKeyword */) { return narrowTypeByInstanceof(type, expr, assumeTrue); } break; - case 146 /* PrefixOperator */: - if (expr.operator === 41 /* ExclamationToken */) { + case 151 /* PrefixOperator */: + if (expr.operator === 45 /* ExclamationToken */) { return narrowType(type, expr.operand, !assumeTrue); } break; @@ -12981,8 +13333,8 @@ var ts; } function checkIdentifier(node) { var symbol = getResolvedSymbol(node); - if (symbol.flags & 16777216 /* Import */) { - getSymbolLinks(symbol).referenced = !isInTypeQuery(node); + if (symbol.flags & 33554432 /* Import */) { + getSymbolLinks(symbol).referenced = !isInTypeQuery(node) && !isConstEnumOrConstEnumOnlyModule(resolveImport(symbol)); } checkCollisionWithCapturedSuperVariable(node, node); checkCollisionWithCapturedThisVariable(node, node); @@ -12990,9 +13342,9 @@ var ts; return getNarrowedTypeOfSymbol(getExportSymbolOfValueSymbolIfExported(symbol), node); } function captureLexicalThis(node, container) { - var classNode = container.parent && container.parent.kind === 177 /* ClassDeclaration */ ? container.parent : undefined; + var classNode = container.parent && container.parent.kind === 184 /* ClassDeclaration */ ? container.parent : undefined; getNodeLinks(node).flags |= 2 /* LexicalThis */; - if (container.kind === 120 /* Property */ || container.kind === 122 /* Constructor */) { + if (container.kind === 124 /* Property */ || container.kind === 126 /* Constructor */) { getNodeLinks(classNode).flags |= 4 /* CaptureThis */; } else { @@ -13002,23 +13354,23 @@ var ts; function checkThisExpression(node) { var container = ts.getThisContainer(node, true); var needToCaptureLexicalThis = false; - if (container.kind === 145 /* ArrowFunction */) { + if (container.kind === 150 /* ArrowFunction */) { container = ts.getThisContainer(container, false); needToCaptureLexicalThis = true; } switch (container.kind) { - case 181 /* ModuleDeclaration */: + case 188 /* ModuleDeclaration */: error(node, ts.Diagnostics.this_cannot_be_referenced_in_a_module_body); break; - case 180 /* EnumDeclaration */: + case 187 /* EnumDeclaration */: error(node, ts.Diagnostics.this_cannot_be_referenced_in_current_location); break; - case 122 /* Constructor */: + case 126 /* Constructor */: if (isInConstructorArgumentInitializer(node, container)) { error(node, ts.Diagnostics.this_cannot_be_referenced_in_constructor_arguments); } break; - case 120 /* Property */: + case 124 /* Property */: if (container.flags & 128 /* Static */) { error(node, ts.Diagnostics.this_cannot_be_referenced_in_a_static_property_initializer); } @@ -13027,7 +13379,7 @@ var ts; if (needToCaptureLexicalThis) { captureLexicalThis(node, container); } - var classNode = container.parent && container.parent.kind === 177 /* ClassDeclaration */ ? container.parent : undefined; + var classNode = container.parent && container.parent.kind === 184 /* ClassDeclaration */ ? container.parent : undefined; if (classNode) { var symbol = getSymbolOfNode(classNode); return container.flags & 128 /* Static */ ? getTypeOfSymbol(symbol) : getDeclaredTypeOfSymbol(symbol); @@ -13040,29 +13392,29 @@ var ts; if (!node) return node; switch (node.kind) { - case 175 /* FunctionDeclaration */: - case 144 /* FunctionExpression */: - case 145 /* ArrowFunction */: - case 120 /* Property */: - case 121 /* Method */: - case 122 /* Constructor */: - case 123 /* GetAccessor */: - case 124 /* SetAccessor */: + case 182 /* FunctionDeclaration */: + case 149 /* FunctionExpression */: + case 150 /* ArrowFunction */: + case 124 /* Property */: + case 125 /* Method */: + case 126 /* Constructor */: + case 127 /* GetAccessor */: + case 128 /* SetAccessor */: return node; } } } function isInConstructorArgumentInitializer(node, constructorDecl) { for (var n = node; n && n !== constructorDecl; n = n.parent) { - if (n.kind === 119 /* Parameter */) { + if (n.kind === 123 /* Parameter */) { return true; } } return false; } function checkSuperExpression(node) { - var isCallExpression = node.parent.kind === 140 /* CallExpression */ && node.parent.func === node; - var enclosingClass = ts.getAncestor(node, 177 /* ClassDeclaration */); + var isCallExpression = node.parent.kind === 144 /* CallExpression */ && node.parent.func === node; + var enclosingClass = ts.getAncestor(node, 184 /* ClassDeclaration */); var baseClass; if (enclosingClass && enclosingClass.baseType) { var classType = getDeclaredTypeOfSymbol(getSymbolOfNode(enclosingClass)); @@ -13076,20 +13428,20 @@ var ts; if (container) { var canUseSuperExpression = false; if (isCallExpression) { - canUseSuperExpression = container.kind === 122 /* Constructor */; + canUseSuperExpression = container.kind === 126 /* Constructor */; } else { var needToCaptureLexicalThis = false; - while (container && container.kind === 145 /* ArrowFunction */) { + while (container && container.kind === 150 /* ArrowFunction */) { container = getSuperContainer(container); needToCaptureLexicalThis = true; } - if (container && container.parent && container.parent.kind === 177 /* ClassDeclaration */) { + if (container && container.parent && container.parent.kind === 184 /* ClassDeclaration */) { if (container.flags & 128 /* Static */) { - canUseSuperExpression = container.kind === 121 /* Method */ || container.kind === 123 /* GetAccessor */ || container.kind === 124 /* SetAccessor */; + canUseSuperExpression = container.kind === 125 /* Method */ || container.kind === 127 /* GetAccessor */ || container.kind === 128 /* SetAccessor */; } else { - canUseSuperExpression = container.kind === 121 /* Method */ || container.kind === 123 /* GetAccessor */ || container.kind === 124 /* SetAccessor */ || container.kind === 120 /* Property */ || container.kind === 122 /* Constructor */; + canUseSuperExpression = container.kind === 125 /* Method */ || container.kind === 127 /* GetAccessor */ || container.kind === 128 /* SetAccessor */ || container.kind === 124 /* Property */ || container.kind === 126 /* Constructor */; } } } @@ -13103,7 +13455,7 @@ var ts; getNodeLinks(node).flags |= 16 /* SuperInstance */; returnType = baseClass; } - if (container.kind === 122 /* Constructor */ && isInConstructorArgumentInitializer(node, container)) { + if (container.kind === 126 /* Constructor */ && isInConstructorArgumentInitializer(node, container)) { error(node, ts.Diagnostics.super_cannot_be_referenced_in_constructor_arguments); returnType = unknownType; } @@ -13123,7 +13475,7 @@ var ts; } function getContextuallyTypedParameterType(parameter) { var func = parameter.parent; - if (func.kind === 144 /* FunctionExpression */ || func.kind === 145 /* ArrowFunction */) { + if (func.kind === 149 /* FunctionExpression */ || func.kind === 150 /* ArrowFunction */) { if (isContextSensitiveExpression(func)) { var contextualSignature = getContextualSignature(func); if (contextualSignature) { @@ -13147,7 +13499,7 @@ var ts; if (declaration.type) { return getTypeFromTypeNode(declaration.type); } - if (declaration.kind === 119 /* Parameter */) { + if (declaration.kind === 123 /* Parameter */) { return getContextuallyTypedParameterType(declaration); } } @@ -13156,7 +13508,7 @@ var ts; function getContextualTypeForReturnExpression(node) { var func = ts.getContainingFunction(node); if (func) { - if (func.type || func.kind === 122 /* Constructor */ || func.kind === 123 /* GetAccessor */ && getSetAccessorTypeAnnotationNode(getDeclarationOfKind(func.symbol, 124 /* SetAccessor */))) { + if (func.type || func.kind === 126 /* Constructor */ || func.kind === 127 /* GetAccessor */ && getSetAccessorTypeAnnotationNode(getDeclarationOfKind(func.symbol, 128 /* SetAccessor */))) { return getReturnTypeOfSignature(getSignatureFromDeclaration(func)); } var signature = getContextualSignature(func); @@ -13183,7 +13535,7 @@ var ts; return checkExpression(binaryExpression.left); } } - else if (operator === 44 /* BarBarToken */) { + else if (operator === 48 /* BarBarToken */) { var type = getContextualType(binaryExpression); if (!type && node === binaryExpression.right) { type = checkExpression(binaryExpression.left); @@ -13262,25 +13614,25 @@ var ts; } var parent = node.parent; switch (parent.kind) { - case 174 /* VariableDeclaration */: - case 119 /* Parameter */: - case 120 /* Property */: + case 181 /* VariableDeclaration */: + case 123 /* Parameter */: + case 124 /* Property */: return getContextualTypeForInitializerExpression(node); - case 145 /* ArrowFunction */: - case 162 /* ReturnStatement */: + case 150 /* ArrowFunction */: + case 169 /* ReturnStatement */: return getContextualTypeForReturnExpression(node); - case 140 /* CallExpression */: - case 141 /* NewExpression */: + case 144 /* CallExpression */: + case 145 /* NewExpression */: return getContextualTypeForArgument(node); - case 142 /* TypeAssertion */: + case 147 /* TypeAssertion */: return getTypeFromTypeNode(parent.type); - case 148 /* BinaryExpression */: + case 153 /* BinaryExpression */: return getContextualTypeForBinaryOperand(node); - case 137 /* PropertyAssignment */: + case 141 /* PropertyAssignment */: return getContextualTypeForPropertyExpression(node); - case 135 /* ArrayLiteral */: + case 139 /* ArrayLiteral */: return getContextualTypeForElementExpression(node); - case 149 /* ConditionalExpression */: + case 154 /* ConditionalExpression */: return getContextualTypeForConditionalOperand(node); } return undefined; @@ -13310,7 +13662,7 @@ var ts; if (!result) { result = signature; } - else if (!compareSignatures(result, signature, true, isTypeIdenticalTo)) { + else if (!compareSignatures(result, signature, true, compareTypes)) { return undefined; } } @@ -13344,7 +13696,7 @@ var ts; var member = members[id]; if (member.flags & 4 /* Property */) { var type = checkExpression(member.declarations[0].initializer, contextualMapper); - var prop = createSymbol(4 /* Property */ | 134217728 /* Transient */ | member.flags, member.name); + var prop = createSymbol(4 /* Property */ | 268435456 /* Transient */ | member.flags, member.name); prop.declarations = member.declarations; prop.parent = member.parent; if (member.valueDeclaration) @@ -13354,11 +13706,11 @@ var ts; member = prop; } else { - var getAccessor = getDeclarationOfKind(member, 123 /* GetAccessor */); + var getAccessor = getDeclarationOfKind(member, 127 /* GetAccessor */); if (getAccessor) { checkAccessorDeclaration(getAccessor); } - var setAccessor = getDeclarationOfKind(member, 124 /* SetAccessor */); + var setAccessor = getDeclarationOfKind(member, 128 /* SetAccessor */); if (setAccessor) { checkAccessorDeclaration(setAccessor); } @@ -13388,17 +13740,17 @@ var ts; } } function getDeclarationKindFromSymbol(s) { - return s.valueDeclaration ? s.valueDeclaration.kind : 120 /* Property */; + return s.valueDeclaration ? s.valueDeclaration.kind : 124 /* Property */; } function getDeclarationFlagsFromSymbol(s) { - return s.valueDeclaration ? s.valueDeclaration.flags : s.flags & 268435456 /* Prototype */ ? 16 /* Public */ | 128 /* Static */ : 0; + return s.valueDeclaration ? s.valueDeclaration.flags : s.flags & 536870912 /* Prototype */ ? 16 /* Public */ | 128 /* Static */ : 0; } function checkClassPropertyAccess(node, type, prop) { var flags = getDeclarationFlagsFromSymbol(prop); if (!(flags & (32 /* Private */ | 64 /* Protected */))) { return; } - var enclosingClassDeclaration = ts.getAncestor(node, 177 /* ClassDeclaration */); + var enclosingClassDeclaration = ts.getAncestor(node, 184 /* ClassDeclaration */); var enclosingClass = enclosingClassDeclaration ? getDeclaredTypeOfSymbol(getSymbolOfNode(enclosingClassDeclaration)) : undefined; var declaringClass = getDeclaredTypeOfSymbol(prop.parent); if (flags & 32 /* Private */) { @@ -13407,7 +13759,7 @@ var ts; } return; } - if (node.left.kind === 85 /* SuperKeyword */) { + if (node.left.kind === 89 /* SuperKeyword */) { return; } if (!enclosingClass || !hasBaseType(enclosingClass, declaringClass)) { @@ -13439,7 +13791,7 @@ var ts; } getNodeLinks(node).resolvedSymbol = prop; if (prop.parent && prop.parent.flags & 32 /* Class */) { - if (node.left.kind === 85 /* SuperKeyword */ && getDeclarationKindFromSymbol(prop) !== 121 /* Method */) { + if (node.left.kind === 89 /* SuperKeyword */ && getDeclarationKindFromSymbol(prop) !== 125 /* Method */) { error(node.right, ts.Diagnostics.Only_public_and_protected_methods_of_the_base_class_are_accessible_via_the_super_keyword); } else { @@ -13455,7 +13807,7 @@ var ts; if (type !== unknownType && type !== anyType) { var prop = getPropertyOfType(getWidenedType(type), propertyName); if (prop && prop.parent && prop.parent.flags & 32 /* Class */) { - if (node.left.kind === 85 /* SuperKeyword */ && getDeclarationKindFromSymbol(prop) !== 121 /* Method */) { + if (node.left.kind === 89 /* SuperKeyword */ && getDeclarationKindFromSymbol(prop) !== 125 /* Method */) { return false; } else { @@ -13472,10 +13824,14 @@ var ts; var indexType = checkExpression(node.index); if (objectType === unknownType) return unknownType; + if (isConstEnumObjectType(objectType) && node.index.kind !== 7 /* StringLiteral */) { + error(node.index, ts.Diagnostics.Index_expression_arguments_in_const_enums_must_be_of_type_string); + } if (node.index.kind === 7 /* StringLiteral */ || node.index.kind === 6 /* NumericLiteral */) { var name = node.index.text; var prop = getPropertyOfType(objectType, name); if (prop) { + getNodeLinks(node).resolvedSymbol = prop; return getTypeOfSymbol(prop); } } @@ -13544,7 +13900,7 @@ var ts; var context = createInferenceContext(typeParameters, false); var mapper = createInferenceMapper(context); for (var i = 0; i < args.length; i++) { - if (args[i].kind === 150 /* OmittedExpression */) { + if (args[i].kind === 157 /* OmittedExpression */) { continue; } if (!excludeArgument || excludeArgument[i] === undefined) { @@ -13554,7 +13910,7 @@ var ts; } if (excludeArgument) { for (var i = 0; i < args.length; i++) { - if (args[i].kind === 150 /* OmittedExpression */) { + if (args[i].kind === 157 /* OmittedExpression */) { continue; } if (excludeArgument[i] === false) { @@ -13592,7 +13948,7 @@ var ts; if (node.arguments) { for (var i = 0; i < node.arguments.length; i++) { var arg = node.arguments[i]; - if (arg.kind === 150 /* OmittedExpression */) { + if (arg.kind === 157 /* OmittedExpression */) { continue; } var paramType = getTypeAtPosition(signature, i); @@ -13727,33 +14083,31 @@ var ts; ts.Debug.assert(!result.length); for (var i = 0; i < signatures.length; i++) { var signature = signatures[i]; - if (true) { - var symbol = signature.declaration && getSymbolOfNode(signature.declaration); - var parent = signature.declaration && signature.declaration.parent; - if (!lastSymbol || symbol === lastSymbol) { - if (lastParent && parent === lastParent) { - pos++; - } - else { - lastParent = parent; - pos = cutoffPos; - } + var symbol = signature.declaration && getSymbolOfNode(signature.declaration); + var parent = signature.declaration && signature.declaration.parent; + if (!lastSymbol || symbol === lastSymbol) { + if (lastParent && parent === lastParent) { + pos++; } else { - pos = cutoffPos = result.length; lastParent = parent; + pos = cutoffPos; } - lastSymbol = symbol; - for (var j = result.length; j > pos; j--) { - result[j] = result[j - 1]; - } - result[pos] = signature; } + else { + pos = cutoffPos = result.length; + lastParent = parent; + } + lastSymbol = symbol; + for (var j = result.length; j > pos; j--) { + result[j] = result[j - 1]; + } + result[pos] = signature; } } } function resolveCallExpression(node, candidatesOutArray) { - if (node.func.kind === 85 /* SuperKeyword */) { + if (node.func.kind === 89 /* SuperKeyword */) { var superType = checkSuperExpression(node.func); if (superType !== unknownType) { return resolveCall(node, getSignaturesOfType(superType, 1 /* Construct */), candidatesOutArray); @@ -13815,18 +14169,18 @@ var ts; var links = getNodeLinks(node); if (!links.resolvedSignature || candidatesOutArray) { links.resolvedSignature = anySignature; - links.resolvedSignature = node.kind === 140 /* CallExpression */ ? resolveCallExpression(node, candidatesOutArray) : resolveNewExpression(node, candidatesOutArray); + links.resolvedSignature = node.kind === 144 /* CallExpression */ ? resolveCallExpression(node, candidatesOutArray) : resolveNewExpression(node, candidatesOutArray); } return links.resolvedSignature; } function checkCallExpression(node) { var signature = getResolvedSignature(node); - if (node.func.kind === 85 /* SuperKeyword */) { + if (node.func.kind === 89 /* SuperKeyword */) { return voidType; } - if (node.kind === 141 /* NewExpression */) { + if (node.kind === 145 /* NewExpression */) { var declaration = signature.declaration; - if (declaration && (declaration.kind !== 122 /* Constructor */ && declaration.kind !== 126 /* ConstructSignature */)) { + if (declaration && (declaration.kind !== 126 /* Constructor */ && declaration.kind !== 130 /* ConstructSignature */)) { if (compilerOptions.noImplicitAny) { error(node, ts.Diagnostics.new_expression_whose_target_lacks_a_construct_signature_implicitly_has_an_any_type); } @@ -13835,6 +14189,11 @@ var ts; } return getReturnTypeOfSignature(signature); } + function checkTaggedTemplateExpression(node) { + checkExpression(node.tag); + checkExpression(node.template); + return anyType; + } function checkTypeAssertion(node) { var exprType = checkExpression(node.operand); var targetType = getTypeFromTypeNode(node.type); @@ -13864,7 +14223,7 @@ var ts; } function getReturnTypeFromBody(func, contextualMapper) { var contextualSignature = getContextualSignature(func); - if (func.body.kind !== 176 /* FunctionBlock */) { + if (func.body.kind !== 183 /* FunctionBlock */) { var unwidenedType = checkAndMarkExpression(func.body, contextualMapper); var widenedType = getWidenedType(unwidenedType); if (fullTypeCheck && compilerOptions.noImplicitAny && !contextualSignature && widenedType !== unwidenedType && getInnermostTypeOfNestedArrayTypes(widenedType) === anyType) { @@ -13912,7 +14271,7 @@ var ts; }); } function bodyContainsSingleThrowStatement(body) { - return (body.statements.length === 1) && (body.statements[0].kind === 168 /* ThrowStatement */); + return (body.statements.length === 1) && (body.statements[0].kind === 175 /* ThrowStatement */); } function checkIfNonVoidFunctionHasReturnExpressionsOrSingleThrowStatment(func, returnType) { if (!fullTypeCheck) { @@ -13921,7 +14280,7 @@ var ts; if (returnType === voidType || returnType === anyType) { return; } - if (!func.body || func.body.kind !== 176 /* FunctionBlock */) { + if (!func.body || func.body.kind !== 183 /* FunctionBlock */) { return; } var bodyBlock = func.body; @@ -13965,7 +14324,7 @@ var ts; if (node.type) { checkIfNonVoidFunctionHasReturnExpressionsOrSingleThrowStatment(node, getTypeFromTypeNode(node.type)); } - if (node.body.kind === 176 /* FunctionBlock */) { + if (node.body.kind === 183 /* FunctionBlock */) { checkSourceElement(node.body); } else { @@ -13990,15 +14349,15 @@ var ts; } function isReferenceOrErrorExpression(n) { switch (n.kind) { - case 59 /* Identifier */: + case 63 /* Identifier */: var symbol = findSymbol(n); return !symbol || symbol === unknownSymbol || symbol === argumentsSymbol || (symbol.flags & ts.SymbolFlags.Variable) !== 0; - case 138 /* PropertyAccess */: + case 142 /* PropertyAccess */: var symbol = findSymbol(n); return !symbol || symbol === unknownSymbol || (symbol.flags & ~8 /* EnumMember */) !== 0; - case 139 /* IndexedAccess */: + case 143 /* IndexedAccess */: return true; - case 143 /* ParenExpression */: + case 148 /* ParenExpression */: return isReferenceOrErrorExpression(n.expression); default: return false; @@ -14006,11 +14365,11 @@ var ts; } function isConstVariableReference(n) { switch (n.kind) { - case 59 /* Identifier */: - case 138 /* PropertyAccess */: + case 63 /* Identifier */: + case 142 /* PropertyAccess */: var symbol = findSymbol(n); return symbol && (symbol.flags & ts.SymbolFlags.Variable) !== 0 && (getDeclarationFlagsFromSymbol(symbol) & 4096 /* Const */) !== 0; - case 139 /* IndexedAccess */: + case 143 /* IndexedAccess */: var index = n.index; var symbol = findSymbol(n.object); if (symbol && index.kind === 7 /* StringLiteral */) { @@ -14019,7 +14378,7 @@ var ts; return prop && (prop.flags & ts.SymbolFlags.Variable) !== 0 && (getDeclarationFlagsFromSymbol(prop) & 4096 /* Const */) !== 0; } return false; - case 143 /* ParenExpression */: + case 148 /* ParenExpression */: return isConstVariableReference(n.expression); default: return false; @@ -14038,19 +14397,19 @@ var ts; function checkPrefixExpression(node) { var operandType = checkExpression(node.operand); switch (node.operator) { - case 28 /* PlusToken */: - case 29 /* MinusToken */: - case 42 /* TildeToken */: + case 32 /* PlusToken */: + case 33 /* MinusToken */: + case 46 /* TildeToken */: return numberType; - case 41 /* ExclamationToken */: - case 68 /* DeleteKeyword */: + case 45 /* ExclamationToken */: + case 72 /* DeleteKeyword */: return booleanType; - case 91 /* TypeOfKeyword */: + case 95 /* TypeOfKeyword */: return stringType; - case 93 /* VoidKeyword */: + case 97 /* VoidKeyword */: return undefinedType; - case 33 /* PlusPlusToken */: - case 34 /* MinusMinusToken */: + case 37 /* PlusPlusToken */: + case 38 /* MinusMinusToken */: var ok = checkArithmeticOperandType(node.operand, operandType, ts.Diagnostics.An_arithmetic_operand_must_be_of_type_any_number_or_an_enum_type); if (ok) { checkReferenceExpression(node.operand, ts.Diagnostics.The_operand_of_an_increment_or_decrement_operator_must_be_a_variable_property_or_indexer, ts.Diagnostics.The_operand_of_an_increment_or_decrement_operator_cannot_be_a_constant); @@ -14073,6 +14432,12 @@ var ts; } return (type.flags & ts.TypeFlags.Structured) !== 0; } + function isConstEnumObjectType(type) { + return type.flags & (ts.TypeFlags.ObjectType | 32768 /* Anonymous */) && type.symbol && isConstEnumSymbol(type.symbol); + } + function isConstEnumSymbol(symbol) { + return (symbol.flags & 128 /* ConstEnum */) !== 0; + } function checkInstanceOfExpression(node, leftType, rightType) { if (leftType !== unknownType && !isStructuredType(leftType)) { error(node.left, ts.Diagnostics.The_left_hand_side_of_an_instanceof_expression_must_be_of_type_any_an_object_type_or_a_type_parameter); @@ -14096,26 +14461,26 @@ var ts; var leftType = checkExpression(node.left, contextualMapper); var rightType = checkExpression(node.right, contextualMapper); switch (operator) { - case 30 /* AsteriskToken */: - case 50 /* AsteriskEqualsToken */: - case 31 /* SlashToken */: - case 51 /* SlashEqualsToken */: - case 32 /* PercentToken */: - case 52 /* PercentEqualsToken */: - case 29 /* MinusToken */: - case 49 /* MinusEqualsToken */: - case 35 /* LessThanLessThanToken */: - case 53 /* LessThanLessThanEqualsToken */: - case 36 /* GreaterThanGreaterThanToken */: - case 54 /* GreaterThanGreaterThanEqualsToken */: - case 37 /* GreaterThanGreaterThanGreaterThanToken */: - case 55 /* GreaterThanGreaterThanGreaterThanEqualsToken */: - case 39 /* BarToken */: - case 57 /* BarEqualsToken */: - case 40 /* CaretToken */: - case 58 /* CaretEqualsToken */: - case 38 /* AmpersandToken */: - case 56 /* AmpersandEqualsToken */: + case 34 /* AsteriskToken */: + case 54 /* AsteriskEqualsToken */: + case 35 /* SlashToken */: + case 55 /* SlashEqualsToken */: + case 36 /* PercentToken */: + case 56 /* PercentEqualsToken */: + case 33 /* MinusToken */: + case 53 /* MinusEqualsToken */: + case 39 /* LessThanLessThanToken */: + case 57 /* LessThanLessThanEqualsToken */: + case 40 /* GreaterThanGreaterThanToken */: + case 58 /* GreaterThanGreaterThanEqualsToken */: + case 41 /* GreaterThanGreaterThanGreaterThanToken */: + case 59 /* GreaterThanGreaterThanGreaterThanEqualsToken */: + case 43 /* BarToken */: + case 61 /* BarEqualsToken */: + case 44 /* CaretToken */: + case 62 /* CaretEqualsToken */: + case 42 /* AmpersandToken */: + case 60 /* AmpersandEqualsToken */: if (leftType.flags & (32 /* Undefined */ | 64 /* Null */)) leftType = rightType; if (rightType.flags & (32 /* Undefined */ | 64 /* Null */)) @@ -14132,8 +14497,8 @@ var ts; } } return numberType; - case 28 /* PlusToken */: - case 48 /* PlusEqualsToken */: + case 32 /* PlusToken */: + case 52 /* PlusEqualsToken */: if (leftType.flags & (32 /* Undefined */ | 64 /* Null */)) leftType = rightType; if (rightType.flags & (32 /* Undefined */ | 64 /* Null */)) @@ -14152,47 +14517,47 @@ var ts; reportOperatorError(); return anyType; } - if (operator === 48 /* PlusEqualsToken */) { + if (operator === 52 /* PlusEqualsToken */) { checkAssignmentOperator(resultType); } return resultType; - case 23 /* EqualsEqualsToken */: - case 24 /* ExclamationEqualsToken */: - case 25 /* EqualsEqualsEqualsToken */: - case 26 /* ExclamationEqualsEqualsToken */: - case 19 /* LessThanToken */: - case 20 /* GreaterThanToken */: - case 21 /* LessThanEqualsToken */: - case 22 /* GreaterThanEqualsToken */: + case 27 /* EqualsEqualsToken */: + case 28 /* ExclamationEqualsToken */: + case 29 /* EqualsEqualsEqualsToken */: + case 30 /* ExclamationEqualsEqualsToken */: + case 23 /* LessThanToken */: + case 24 /* GreaterThanToken */: + case 25 /* LessThanEqualsToken */: + case 26 /* GreaterThanEqualsToken */: if (!isTypeAssignableTo(leftType, rightType) && !isTypeAssignableTo(rightType, leftType)) { reportOperatorError(); } return booleanType; - case 81 /* InstanceOfKeyword */: + case 85 /* InstanceOfKeyword */: return checkInstanceOfExpression(node, leftType, rightType); - case 80 /* InKeyword */: + case 84 /* InKeyword */: return checkInExpression(node, leftType, rightType); - case 43 /* AmpersandAmpersandToken */: + case 47 /* AmpersandAmpersandToken */: return rightType; - case 44 /* BarBarToken */: + case 48 /* BarBarToken */: return getUnionType([leftType, rightType]); - case 47 /* EqualsToken */: + case 51 /* EqualsToken */: checkAssignmentOperator(rightType); return rightType; - case 18 /* CommaToken */: + case 22 /* CommaToken */: return rightType; } function getSuggestedBooleanOperator(operator) { switch (operator) { - case 39 /* BarToken */: - case 57 /* BarEqualsToken */: - return 44 /* BarBarToken */; - case 40 /* CaretToken */: - case 58 /* CaretEqualsToken */: - return 26 /* ExclamationEqualsEqualsToken */; - case 38 /* AmpersandToken */: - case 56 /* AmpersandEqualsToken */: - return 43 /* AmpersandAmpersandToken */; + case 43 /* BarToken */: + case 61 /* BarEqualsToken */: + return 48 /* BarBarToken */; + case 44 /* CaretToken */: + case 62 /* CaretEqualsToken */: + return 30 /* ExclamationEqualsEqualsToken */; + case 42 /* AmpersandToken */: + case 60 /* AmpersandEqualsToken */: + return 47 /* AmpersandAmpersandToken */; default: return undefined; } @@ -14215,6 +14580,12 @@ var ts; var type2 = checkExpression(node.whenFalse, contextualMapper); return getUnionType([type1, type2]); } + function checkTemplateExpression(node) { + ts.forEach(node.templateSpans, function (templateSpan) { + checkExpression(templateSpan.expression); + }); + return stringType; + } function checkExpressionWithContextualType(node, contextualType, contextualMapper) { var saveContextualType = node.contextualType; node.contextualType = contextualType; @@ -14241,56 +14612,67 @@ var ts; } } } + if (isConstEnumObjectType(type)) { + var ok = (node.parent.kind === 142 /* PropertyAccess */ && node.parent.left === node) || (node.parent.kind === 143 /* IndexedAccess */ && node.parent.object === node) || ((node.kind === 63 /* Identifier */ || node.kind === 121 /* QualifiedName */) && isInRightSideOfImportOrExportAssignment(node)); + if (!ok) { + error(node, ts.Diagnostics.const_enums_can_only_be_used_in_property_or_index_access_expressions_or_the_right_hand_side_of_an_import_declaration_or_export_assignment); + } + } return type; } function checkExpressionNode(node, contextualMapper) { switch (node.kind) { - case 59 /* Identifier */: + case 63 /* Identifier */: return checkIdentifier(node); - case 87 /* ThisKeyword */: + case 91 /* ThisKeyword */: return checkThisExpression(node); - case 85 /* SuperKeyword */: + case 89 /* SuperKeyword */: return checkSuperExpression(node); - case 83 /* NullKeyword */: + case 87 /* NullKeyword */: return nullType; - case 89 /* TrueKeyword */: - case 74 /* FalseKeyword */: + case 93 /* TrueKeyword */: + case 78 /* FalseKeyword */: return booleanType; case 6 /* NumericLiteral */: return numberType; + case 155 /* TemplateExpression */: + return checkTemplateExpression(node); case 7 /* StringLiteral */: + case 9 /* NoSubstitutionTemplateLiteral */: return stringType; case 8 /* RegularExpressionLiteral */: return globalRegExpType; - case 117 /* QualifiedName */: + case 121 /* QualifiedName */: return checkPropertyAccess(node); - case 135 /* ArrayLiteral */: + case 139 /* ArrayLiteral */: return checkArrayLiteral(node, contextualMapper); - case 136 /* ObjectLiteral */: + case 140 /* ObjectLiteral */: return checkObjectLiteral(node, contextualMapper); - case 138 /* PropertyAccess */: + case 142 /* PropertyAccess */: return checkPropertyAccess(node); - case 139 /* IndexedAccess */: + case 143 /* IndexedAccess */: return checkIndexedAccess(node); - case 140 /* CallExpression */: - case 141 /* NewExpression */: + case 144 /* CallExpression */: + case 145 /* NewExpression */: return checkCallExpression(node); - case 142 /* TypeAssertion */: + case 146 /* TaggedTemplateExpression */: + return checkTaggedTemplateExpression(node); + case 147 /* TypeAssertion */: return checkTypeAssertion(node); - case 143 /* ParenExpression */: + case 148 /* ParenExpression */: return checkExpression(node.expression); - case 144 /* FunctionExpression */: - case 145 /* ArrowFunction */: + case 149 /* FunctionExpression */: + case 150 /* ArrowFunction */: return checkFunctionExpression(node, contextualMapper); - case 146 /* PrefixOperator */: + case 151 /* PrefixOperator */: return checkPrefixExpression(node); - case 147 /* PostfixOperator */: + case 152 /* PostfixOperator */: return checkPostfixExpression(node); - case 148 /* BinaryExpression */: + case 153 /* BinaryExpression */: return checkBinaryExpression(node, contextualMapper); - case 149 /* ConditionalExpression */: + case 154 /* ConditionalExpression */: return checkConditionalExpression(node, contextualMapper); - case 150 /* OmittedExpression */: + case 157 /* OmittedExpression */: return undefinedType; } return unknownType; @@ -14306,7 +14688,7 @@ var ts; checkVariableDeclaration(parameterDeclaration); if (fullTypeCheck) { checkCollisionWithIndexVariableInGeneratedCode(parameterDeclaration, parameterDeclaration.name); - if (parameterDeclaration.flags & (16 /* Public */ | 32 /* Private */ | 64 /* Protected */) && !(parameterDeclaration.parent.kind === 122 /* Constructor */ && parameterDeclaration.parent.body)) { + if (parameterDeclaration.flags & (16 /* Public */ | 32 /* Private */ | 64 /* Protected */) && !(parameterDeclaration.parent.kind === 126 /* Constructor */ && parameterDeclaration.parent.body)) { error(parameterDeclaration, ts.Diagnostics.A_parameter_property_is_only_allowed_in_a_constructor_implementation); } if (parameterDeclaration.flags & 8 /* Rest */) { @@ -14321,10 +14703,10 @@ var ts; } } function checkReferencesInInitializer(n) { - if (n.kind === 59 /* Identifier */) { + if (n.kind === 63 /* Identifier */) { var referencedSymbol = getNodeLinks(n).resolvedSymbol; if (referencedSymbol && referencedSymbol !== unknownSymbol && getSymbol(parameterDeclaration.parent.locals, referencedSymbol.name, ts.SymbolFlags.Value) === referencedSymbol) { - if (referencedSymbol.valueDeclaration.kind === 119 /* Parameter */) { + if (referencedSymbol.valueDeclaration.kind === 123 /* Parameter */) { if (referencedSymbol.valueDeclaration === parameterDeclaration) { error(n, ts.Diagnostics.Parameter_0_cannot_be_referenced_in_its_initializer, ts.identifierToString(parameterDeclaration.name)); return; @@ -14358,10 +14740,10 @@ var ts; checkCollisionWithArgumentsInGeneratedCode(node); if (compilerOptions.noImplicitAny && !node.type) { switch (node.kind) { - case 126 /* ConstructSignature */: + case 130 /* ConstructSignature */: error(node, ts.Diagnostics.Construct_signature_which_lacks_return_type_annotation_implicitly_has_an_any_return_type); break; - case 125 /* CallSignature */: + case 129 /* CallSignature */: error(node, ts.Diagnostics.Call_signature_which_lacks_return_type_annotation_implicitly_has_an_any_return_type); break; } @@ -14370,7 +14752,7 @@ var ts; checkSpecializedSignatureDeclaration(node); } function checkTypeForDuplicateIndexSignatures(node) { - if (node.kind === 178 /* InterfaceDeclaration */) { + if (node.kind === 185 /* InterfaceDeclaration */) { var nodeSymbol = getSymbolOfNode(node); if (nodeSymbol.declarations.length > 0 && nodeSymbol.declarations[0] !== node) { return; @@ -14384,7 +14766,7 @@ var ts; var declaration = indexSymbol.declarations[i]; if (declaration.parameters.length == 1 && declaration.parameters[0].type) { switch (declaration.parameters[0].type.kind) { - case 114 /* StringKeyword */: + case 118 /* StringKeyword */: if (!seenStringIndexer) { seenStringIndexer = true; } @@ -14392,7 +14774,7 @@ var ts; error(declaration, ts.Diagnostics.Duplicate_string_index_signature); } break; - case 112 /* NumberKeyword */: + case 116 /* NumberKeyword */: if (!seenNumericIndexer) { seenNumericIndexer = true; } @@ -14426,39 +14808,39 @@ var ts; return; } function isSuperCallExpression(n) { - return n.kind === 140 /* CallExpression */ && n.func.kind === 85 /* SuperKeyword */; + return n.kind === 144 /* CallExpression */ && n.func.kind === 89 /* SuperKeyword */; } function containsSuperCall(n) { if (isSuperCallExpression(n)) { return true; } switch (n.kind) { - case 144 /* FunctionExpression */: - case 175 /* FunctionDeclaration */: - case 145 /* ArrowFunction */: - case 136 /* ObjectLiteral */: + case 149 /* FunctionExpression */: + case 182 /* FunctionDeclaration */: + case 150 /* ArrowFunction */: + case 140 /* ObjectLiteral */: return false; default: return ts.forEachChild(n, containsSuperCall); } } function markThisReferencesAsErrors(n) { - if (n.kind === 87 /* ThisKeyword */) { + if (n.kind === 91 /* ThisKeyword */) { error(n, ts.Diagnostics.this_cannot_be_referenced_in_current_location); } - else if (n.kind !== 144 /* FunctionExpression */ && n.kind !== 175 /* FunctionDeclaration */) { + else if (n.kind !== 149 /* FunctionExpression */ && n.kind !== 182 /* FunctionDeclaration */) { ts.forEachChild(n, markThisReferencesAsErrors); } } function isInstancePropertyWithInitializer(n) { - return n.kind === 120 /* Property */ && !(n.flags & 128 /* Static */) && !!n.initializer; + return n.kind === 124 /* Property */ && !(n.flags & 128 /* Static */) && !!n.initializer; } if (node.parent.baseType) { if (containsSuperCall(node.body)) { var superCallShouldBeFirst = ts.forEach(node.parent.members, isInstancePropertyWithInitializer) || ts.forEach(node.parameters, function (p) { return p.flags & (16 /* Public */ | 32 /* Private */ | 64 /* Protected */); }); if (superCallShouldBeFirst) { var statements = node.body.statements; - if (!statements.length || statements[0].kind !== 154 /* ExpressionStatement */ || !isSuperCallExpression(statements[0].expression)) { + if (!statements.length || statements[0].kind !== 161 /* ExpressionStatement */ || !isSuperCallExpression(statements[0].expression)) { error(node, ts.Diagnostics.A_super_call_must_be_the_first_statement_in_the_constructor_when_a_class_contains_initialized_properties_or_has_parameter_properties); } else { @@ -14473,12 +14855,12 @@ var ts; } function checkAccessorDeclaration(node) { if (fullTypeCheck) { - if (node.kind === 123 /* GetAccessor */) { + if (node.kind === 127 /* GetAccessor */) { if (!ts.isInAmbientContext(node) && node.body && !(bodyContainsAReturnStatement(node.body) || bodyContainsSingleThrowStatement(node.body))) { error(node.name, ts.Diagnostics.A_get_accessor_must_return_a_value_or_consist_of_a_single_throw_statement); } } - var otherKind = node.kind === 123 /* GetAccessor */ ? 124 /* SetAccessor */ : 123 /* GetAccessor */; + var otherKind = node.kind === 127 /* GetAccessor */ ? 128 /* SetAccessor */ : 127 /* GetAccessor */; var otherAccessor = getDeclarationOfKind(node.symbol, otherKind); if (otherAccessor) { if (((node.flags & ts.NodeFlags.AccessibilityModifier) !== (otherAccessor.flags & ts.NodeFlags.AccessibilityModifier))) { @@ -14547,9 +14929,9 @@ var ts; } var symbol = getSymbolOfNode(signatureDeclarationNode); var signaturesToCheck; - if (!signatureDeclarationNode.name && signatureDeclarationNode.parent && signatureDeclarationNode.parent.kind === 178 /* InterfaceDeclaration */) { - ts.Debug.assert(signatureDeclarationNode.kind === 125 /* CallSignature */ || signatureDeclarationNode.kind === 126 /* ConstructSignature */); - var signatureKind = signatureDeclarationNode.kind === 125 /* CallSignature */ ? 0 /* Call */ : 1 /* Construct */; + if (!signatureDeclarationNode.name && signatureDeclarationNode.parent && signatureDeclarationNode.parent.kind === 185 /* InterfaceDeclaration */) { + ts.Debug.assert(signatureDeclarationNode.kind === 129 /* CallSignature */ || signatureDeclarationNode.kind === 130 /* ConstructSignature */); + var signatureKind = signatureDeclarationNode.kind === 129 /* CallSignature */ ? 0 /* Call */ : 1 /* Construct */; var containingSymbol = getSymbolOfNode(signatureDeclarationNode.parent); var containingType = getDeclaredTypeOfSymbol(containingSymbol); signaturesToCheck = getSignaturesOfType(containingType, signatureKind); @@ -14567,7 +14949,7 @@ var ts; } function getEffectiveDeclarationFlags(n, flagsToCheck) { var flags = n.flags; - if (n.parent.kind !== 178 /* InterfaceDeclaration */ && ts.isInAmbientContext(n)) { + if (n.parent.kind !== 185 /* InterfaceDeclaration */ && ts.isInAmbientContext(n)) { if (!(flags & 2 /* Ambient */)) { flags |= 1 /* Export */; } @@ -14609,9 +14991,9 @@ var ts; var lastSeenNonAmbientDeclaration; var previousDeclaration; var declarations = symbol.declarations; - var isConstructor = (symbol.flags & 8192 /* Constructor */) !== 0; + var isConstructor = (symbol.flags & 16384 /* Constructor */) !== 0; function reportImplementationExpectedError(node) { - if (node.name && node.name.kind === 116 /* Missing */) { + if (node.name && node.name.kind === 120 /* Missing */) { return; } var seen = false; @@ -14627,7 +15009,7 @@ var ts; if (subsequentNode.kind === node.kind) { var errorNode = subsequentNode.name || subsequentNode; if (node.name && subsequentNode.name && node.name.text === subsequentNode.name.text) { - ts.Debug.assert(node.kind === 121 /* Method */); + ts.Debug.assert(node.kind === 125 /* Method */); ts.Debug.assert((node.flags & 128 /* Static */) !== (subsequentNode.flags & 128 /* Static */)); var diagnostic = node.flags & 128 /* Static */ ? ts.Diagnostics.Function_overload_must_be_static : ts.Diagnostics.Function_overload_must_not_be_static; error(errorNode, diagnostic); @@ -14653,11 +15035,11 @@ var ts; for (var i = 0; i < declarations.length; i++) { var node = declarations[i]; var inAmbientContext = ts.isInAmbientContext(node); - var inAmbientContextOrInterface = node.parent.kind === 178 /* InterfaceDeclaration */ || node.parent.kind === 130 /* TypeLiteral */ || inAmbientContext; + var inAmbientContextOrInterface = node.parent.kind === 185 /* InterfaceDeclaration */ || node.parent.kind === 134 /* TypeLiteral */ || inAmbientContext; if (inAmbientContextOrInterface) { previousDeclaration = undefined; } - if (node.kind === 175 /* FunctionDeclaration */ || node.kind === 121 /* Method */ || node.kind === 122 /* Constructor */) { + if (node.kind === 182 /* FunctionDeclaration */ || node.kind === 125 /* Method */ || node.kind === 126 /* Constructor */) { var currentNodeFlags = getEffectiveDeclarationFlags(node, flagsToCheck); someNodeFlags |= currentNodeFlags; allNodeFlags &= currentNodeFlags; @@ -14751,14 +15133,14 @@ var ts; } function getDeclarationSpaces(d) { switch (d.kind) { - case 178 /* InterfaceDeclaration */: - return 4194304 /* ExportType */; - case 181 /* ModuleDeclaration */: - return d.name.kind === 7 /* StringLiteral */ || ts.isInstantiated(d) ? 8388608 /* ExportNamespace */ | 2097152 /* ExportValue */ : 8388608 /* ExportNamespace */; - case 177 /* ClassDeclaration */: - case 180 /* EnumDeclaration */: - return 4194304 /* ExportType */ | 2097152 /* ExportValue */; - case 183 /* ImportDeclaration */: + case 185 /* InterfaceDeclaration */: + return 8388608 /* ExportType */; + case 188 /* ModuleDeclaration */: + return d.name.kind === 7 /* StringLiteral */ || ts.getModuleInstanceState(d) !== 0 /* NonInstantiated */ ? 16777216 /* ExportNamespace */ | 4194304 /* ExportValue */ : 16777216 /* ExportNamespace */; + case 184 /* ClassDeclaration */: + case 187 /* EnumDeclaration */: + return 8388608 /* ExportType */ | 4194304 /* ExportValue */; + case 190 /* ImportDeclaration */: var result = 0; var target = resolveImport(getSymbolOfNode(d)); ts.forEach(target.declarations, function (d) { @@ -14766,7 +15148,7 @@ var ts; }); return result; default: - return 2097152 /* ExportValue */; + return 4194304 /* ExportValue */; } } } @@ -14816,7 +15198,7 @@ var ts; if (!(name && name.text === "_i")) { return; } - if (node.kind === 119 /* Parameter */) { + if (node.kind === 123 /* Parameter */) { if (node.parent.body && ts.hasRestParameters(node.parent) && !ts.isInAmbientContext(node)) { error(node, ts.Diagnostics.Duplicate_identifier_i_Compiler_uses_i_to_initialize_rest_parameter); } @@ -14833,11 +15215,11 @@ var ts; return; } switch (current.kind) { - case 175 /* FunctionDeclaration */: - case 144 /* FunctionExpression */: - case 121 /* Method */: - case 145 /* ArrowFunction */: - case 122 /* Constructor */: + case 182 /* FunctionDeclaration */: + case 149 /* FunctionExpression */: + case 125 /* Method */: + case 150 /* ArrowFunction */: + case 126 /* Constructor */: if (ts.hasRestParameters(current)) { error(node, ts.Diagnostics.Expression_resolves_to_variable_declaration_i_that_compiler_uses_to_initialize_rest_parameter); return; @@ -14851,13 +15233,13 @@ var ts; if (!(identifier && identifier.text === name)) { return false; } - if (node.kind === 120 /* Property */ || node.kind === 121 /* Method */ || node.kind === 123 /* GetAccessor */ || node.kind === 124 /* SetAccessor */) { + if (node.kind === 124 /* Property */ || node.kind === 125 /* Method */ || node.kind === 127 /* GetAccessor */ || node.kind === 128 /* SetAccessor */) { return false; } if (ts.isInAmbientContext(node)) { return false; } - if (node.kind === 119 /* Parameter */ && !node.parent.body) { + if (node.kind === 123 /* Parameter */ && !node.parent.body) { return false; } return true; @@ -14872,7 +15254,7 @@ var ts; var current = node; while (current) { if (getNodeCheckFlags(current) & 4 /* CaptureThis */) { - var isDeclaration = node.kind !== 59 /* Identifier */; + var isDeclaration = node.kind !== 63 /* Identifier */; if (isDeclaration) { error(node.name, ts.Diagnostics.Duplicate_identifier_this_Compiler_uses_variable_declaration_this_to_capture_this_reference); } @@ -14888,12 +15270,12 @@ var ts; if (!needCollisionCheckForIdentifier(node, name, "_super")) { return; } - var enclosingClass = ts.getAncestor(node, 177 /* ClassDeclaration */); + var enclosingClass = ts.getAncestor(node, 184 /* ClassDeclaration */); if (!enclosingClass || ts.isInAmbientContext(enclosingClass)) { return; } if (enclosingClass.baseType) { - var isDeclaration = node.kind !== 59 /* Identifier */; + var isDeclaration = node.kind !== 63 /* Identifier */; if (isDeclaration) { error(node, ts.Diagnostics.Duplicate_identifier_super_Compiler_uses_super_to_capture_base_class_reference); } @@ -14906,11 +15288,11 @@ var ts; if (!needCollisionCheckForIdentifier(node, name, "require") && !needCollisionCheckForIdentifier(node, name, "exports")) { return; } - if (node.kind === 181 /* ModuleDeclaration */ && !ts.isInstantiated(node)) { + if (node.kind === 188 /* ModuleDeclaration */ && ts.getModuleInstanceState(node) !== 1 /* Instantiated */) { return; } - var parent = node.kind === 174 /* VariableDeclaration */ ? node.parent.parent : node.parent; - if (parent.kind === 186 /* SourceFile */ && ts.isExternalModule(parent)) { + var parent = node.kind === 181 /* VariableDeclaration */ ? node.parent.parent : node.parent; + if (parent.kind === 193 /* SourceFile */ && ts.isExternalModule(parent)) { error(name, ts.Diagnostics.Duplicate_identifier_0_Compiler_reserves_name_1_in_top_level_scope_of_an_external_module, name.text, name.text); } } @@ -15015,18 +15397,18 @@ var ts; if (node.expression && !(getNodeLinks(node.expression).flags & 1 /* TypeChecked */)) { var func = ts.getContainingFunction(node); if (func) { - if (func.kind === 124 /* SetAccessor */) { + if (func.kind === 128 /* SetAccessor */) { if (node.expression) { error(node.expression, ts.Diagnostics.Setters_cannot_return_a_value); } } else { var returnType = getReturnTypeOfSignature(getSignatureFromDeclaration(func)); - var checkAssignability = func.type || (func.kind === 123 /* GetAccessor */ && getSetAccessorTypeAnnotationNode(getDeclarationOfKind(func.symbol, 124 /* SetAccessor */))); + var checkAssignability = func.type || (func.kind === 127 /* GetAccessor */ && getSetAccessorTypeAnnotationNode(getDeclarationOfKind(func.symbol, 128 /* SetAccessor */))); if (checkAssignability) { checkTypeAssignableTo(checkExpression(node.expression), returnType, node.expression, undefined); } - else if (func.kind == 122 /* Constructor */) { + else if (func.kind == 126 /* Constructor */) { if (!isTypeAssignableTo(checkExpression(node.expression), returnType)) { error(node.expression, ts.Diagnostics.Return_type_of_constructor_signature_must_be_assignable_to_the_instance_type_of_the_class); } @@ -15186,13 +15568,13 @@ var ts; } } function getTargetSymbol(s) { - return s.flags & 33554432 /* Instantiated */ ? getSymbolLinks(s).target : s; + return s.flags & 67108864 /* Instantiated */ ? getSymbolLinks(s).target : s; } function checkKindsOfPropertyMemberOverrides(type, baseType) { var baseProperties = getPropertiesOfObjectType(baseType); for (var i = 0, len = baseProperties.length; i < len; ++i) { var base = getTargetSymbol(baseProperties[i]); - if (base.flags & 268435456 /* Prototype */) { + if (base.flags & 536870912 /* Prototype */) { continue; } var derived = getTargetSymbol(getPropertyOfObjectType(type, base.name)); @@ -15205,26 +15587,26 @@ var ts; if ((baseDeclarationFlags & 128 /* Static */) !== (derivedDeclarationFlags & 128 /* Static */)) { continue; } - if ((base.flags & derived.flags & 4096 /* Method */) || ((base.flags & ts.SymbolFlags.PropertyOrAccessor) && (derived.flags & ts.SymbolFlags.PropertyOrAccessor))) { + if ((base.flags & derived.flags & 8192 /* Method */) || ((base.flags & ts.SymbolFlags.PropertyOrAccessor) && (derived.flags & ts.SymbolFlags.PropertyOrAccessor))) { continue; } var errorMessage; - if (base.flags & 4096 /* Method */) { + if (base.flags & 8192 /* Method */) { if (derived.flags & ts.SymbolFlags.Accessor) { errorMessage = ts.Diagnostics.Class_0_defines_instance_member_function_1_but_extended_class_2_defines_it_as_instance_member_accessor; } else { - ts.Debug.assert(derived.flags & 4 /* Property */); + ts.Debug.assert((derived.flags & 4 /* Property */) !== 0); errorMessage = ts.Diagnostics.Class_0_defines_instance_member_function_1_but_extended_class_2_defines_it_as_instance_member_property; } } else if (base.flags & 4 /* Property */) { - ts.Debug.assert(derived.flags & 4096 /* Method */); + ts.Debug.assert((derived.flags & 8192 /* Method */) !== 0); errorMessage = ts.Diagnostics.Class_0_defines_instance_member_property_1_but_extended_class_2_defines_it_as_instance_member_function; } else { - ts.Debug.assert(base.flags & ts.SymbolFlags.Accessor); - ts.Debug.assert(derived.flags & 4096 /* Method */); + ts.Debug.assert((base.flags & ts.SymbolFlags.Accessor) !== 0); + ts.Debug.assert((derived.flags & 8192 /* Method */) !== 0); errorMessage = ts.Diagnostics.Class_0_defines_instance_member_accessor_1_but_extended_class_2_defines_it_as_instance_member_function; } error(derived.valueDeclaration.name, errorMessage, typeToString(baseType), symbolToString(base), typeToString(type)); @@ -15232,7 +15614,7 @@ var ts; } } function isAccessor(kind) { - return kind === 123 /* GetAccessor */ || kind === 124 /* SetAccessor */; + return kind === 127 /* GetAccessor */ || kind === 128 /* SetAccessor */; } function areTypeParametersIdentical(list1, list2) { if (!list1 && !list2) { @@ -15259,13 +15641,46 @@ var ts; } return true; } + function checkInheritedPropertiesAreIdentical(type, typeNode) { + if (!type.baseTypes.length || type.baseTypes.length === 1) { + return true; + } + var seen = {}; + ts.forEach(type.declaredProperties, function (p) { + seen[p.name] = { prop: p, containingType: type }; + }); + var ok = true; + for (var i = 0, len = type.baseTypes.length; i < len; ++i) { + var base = type.baseTypes[i]; + var properties = getPropertiesOfObjectType(base); + for (var j = 0, proplen = properties.length; j < proplen; ++j) { + var prop = properties[j]; + if (!ts.hasProperty(seen, prop.name)) { + seen[prop.name] = { prop: prop, containingType: base }; + } + else { + var existing = seen[prop.name]; + var isInheritedProperty = existing.containingType !== type; + if (isInheritedProperty && !isPropertyIdenticalTo(existing.prop, prop)) { + ok = false; + var typeName1 = typeToString(existing.containingType); + var typeName2 = typeToString(base); + var errorInfo = ts.chainDiagnosticMessages(undefined, ts.Diagnostics.Named_properties_0_of_types_1_and_2_are_not_identical, prop.name, typeName1, typeName2); + errorInfo = ts.chainDiagnosticMessages(errorInfo, ts.Diagnostics.Interface_0_cannot_simultaneously_extend_types_1_and_2, typeToString(type), typeName1, typeName2); + addDiagnostic(ts.createDiagnosticForNodeFromMessageChain(typeNode, errorInfo, program.getCompilerHost().getNewLine())); + } + } + } + } + return ok; + } function checkInterfaceDeclaration(node) { checkTypeParameters(node.typeParameters); if (fullTypeCheck) { checkTypeNameIsReserved(node.name, ts.Diagnostics.Interface_name_cannot_be_0); checkExportsOnMergedDeclarations(node); var symbol = getSymbolOfNode(node); - var firstInterfaceDecl = getDeclarationOfKind(symbol, 178 /* InterfaceDeclaration */); + var firstInterfaceDecl = getDeclarationOfKind(symbol, 185 /* InterfaceDeclaration */); if (symbol.declarations.length > 1) { if (node !== firstInterfaceDecl && !areTypeParametersIdentical(firstInterfaceDecl.typeParameters, node.typeParameters)) { error(node.name, ts.Diagnostics.All_declarations_of_an_interface_must_have_identical_type_parameters); @@ -15288,23 +15703,9 @@ var ts; } } function checkTypeAliasDeclaration(node) { + checkTypeNameIsReserved(node.name, ts.Diagnostics.Type_alias_name_cannot_be_0); checkSourceElement(node.type); } - function getConstantValueForExpression(node) { - var isNegative = false; - if (node.kind === 146 /* PrefixOperator */) { - var unaryExpression = node; - if (unaryExpression.operator === 29 /* MinusToken */ || unaryExpression.operator === 28 /* PlusToken */) { - node = unaryExpression.operand; - isNegative = unaryExpression.operator === 29 /* MinusToken */; - } - } - if (node.kind === 6 /* NumericLiteral */) { - var literalText = node.text; - return isNegative ? -literalText : +literalText; - } - return undefined; - } function computeEnumMemberValues(node) { var nodeLinks = getNodeLinks(node); if (!(nodeLinks.flags & 128 /* EnumValuesComputed */)) { @@ -15312,18 +15713,32 @@ var ts; var enumType = getDeclaredTypeOfSymbol(enumSymbol); var autoValue = 0; var ambient = ts.isInAmbientContext(node); + var enumIsConst = ts.isConstEnumDeclaration(node); ts.forEach(node.members, function (member) { if (isNumericName(member.name.text)) { error(member.name, ts.Diagnostics.An_enum_member_cannot_have_a_numeric_name); } var initializer = member.initializer; if (initializer) { - autoValue = getConstantValueForExpression(initializer); - if (autoValue === undefined && !ambient) { - checkTypeAssignableTo(checkExpression(initializer), enumType, initializer, undefined); + autoValue = getConstantValueForEnumMemberInitializer(initializer, enumIsConst); + if (autoValue === undefined) { + if (enumIsConst) { + error(initializer, ts.Diagnostics.In_const_enum_declarations_member_initializer_must_be_constant_expression); + } + else if (!ambient) { + checkTypeAssignableTo(checkExpression(initializer), enumType, initializer, undefined); + } + } + else if (enumIsConst) { + if (isNaN(autoValue)) { + error(initializer, ts.Diagnostics.const_enum_member_initializer_was_evaluated_to_disallowed_value_NaN); + } + else if (!isFinite(autoValue)) { + error(initializer, ts.Diagnostics.const_enum_member_initializer_was_evaluated_to_a_non_finite_value); + } } } - else if (ambient) { + else if (ambient && !enumIsConst) { autoValue = undefined; } if (autoValue !== undefined) { @@ -15332,6 +15747,113 @@ var ts; }); nodeLinks.flags |= 128 /* EnumValuesComputed */; } + function getConstantValueForEnumMemberInitializer(initializer, enumIsConst) { + return evalConstant(initializer); + function evalConstant(e) { + switch (e.kind) { + case 151 /* PrefixOperator */: + var value = evalConstant(e.operand); + if (value === undefined) { + return undefined; + } + switch (e.operator) { + case 32 /* PlusToken */: + return value; + case 33 /* MinusToken */: + return -value; + case 46 /* TildeToken */: + return enumIsConst ? ~value : undefined; + } + return undefined; + case 153 /* BinaryExpression */: + if (!enumIsConst) { + return undefined; + } + var left = evalConstant(e.left); + if (left === undefined) { + return undefined; + } + var right = evalConstant(e.right); + if (right === undefined) { + return undefined; + } + switch (e.operator) { + case 43 /* BarToken */: + return left | right; + case 42 /* AmpersandToken */: + return left & right; + case 40 /* GreaterThanGreaterThanToken */: + return left >> right; + case 41 /* GreaterThanGreaterThanGreaterThanToken */: + return left >>> right; + case 39 /* LessThanLessThanToken */: + return left << right; + case 44 /* CaretToken */: + return left ^ right; + case 34 /* AsteriskToken */: + return left * right; + case 35 /* SlashToken */: + return left / right; + case 32 /* PlusToken */: + return left + right; + case 33 /* MinusToken */: + return left - right; + case 36 /* PercentToken */: + return left % right; + } + return undefined; + case 6 /* NumericLiteral */: + return +e.text; + case 148 /* ParenExpression */: + return enumIsConst ? evalConstant(e.expression) : undefined; + case 63 /* Identifier */: + case 143 /* IndexedAccess */: + case 142 /* PropertyAccess */: + if (!enumIsConst) { + return undefined; + } + var member = initializer.parent; + var currentType = getTypeOfSymbol(getSymbolOfNode(member.parent)); + var enumType; + var propertyName; + if (e.kind === 63 /* Identifier */) { + enumType = currentType; + propertyName = e.text; + } + else { + if (e.kind === 143 /* IndexedAccess */) { + if (e.index.kind !== 7 /* StringLiteral */) { + return undefined; + } + var enumType = getTypeOfNode(e.object); + propertyName = e.index.text; + } + else { + var enumType = getTypeOfNode(e.left); + propertyName = e.right.text; + } + if (enumType !== currentType) { + return undefined; + } + } + if (propertyName === undefined) { + return undefined; + } + var property = getPropertyOfObjectType(enumType, propertyName); + if (!property || !(property.flags & 8 /* EnumMember */)) { + return undefined; + } + var propertyDecl = property.valueDeclaration; + if (member === propertyDecl) { + return undefined; + } + if (!isDefinedBefore(propertyDecl, member)) { + return undefined; + } + return getNodeLinks(propertyDecl).enumMemberValue; + } + } + } } function checkEnumDeclaration(node) { if (!fullTypeCheck) { @@ -15345,9 +15867,17 @@ var ts; var enumSymbol = getSymbolOfNode(node); var firstDeclaration = getDeclarationOfKind(enumSymbol, node.kind); if (node === firstDeclaration) { + if (enumSymbol.declarations.length > 1) { + var enumIsConst = ts.isConstEnumDeclaration(node); + ts.forEach(enumSymbol.declarations, function (decl) { + if (ts.isConstEnumDeclaration(decl) !== enumIsConst) { + error(decl.name, ts.Diagnostics.Enum_declarations_must_all_be_const_or_non_const); + } + }); + } var seenEnumMissingInitialInitializer = false; ts.forEach(enumSymbol.declarations, function (declaration) { - if (declaration.kind !== 180 /* EnumDeclaration */) { + if (declaration.kind !== 187 /* EnumDeclaration */) { return false; } var enumDeclaration = declaration; @@ -15370,7 +15900,7 @@ var ts; var declarations = symbol.declarations; for (var i = 0; i < declarations.length; i++) { var declaration = declarations[i]; - if ((declaration.kind === 177 /* ClassDeclaration */ || (declaration.kind === 175 /* FunctionDeclaration */ && declaration.body)) && !ts.isInAmbientContext(declaration)) { + if ((declaration.kind === 184 /* ClassDeclaration */ || (declaration.kind === 182 /* FunctionDeclaration */ && declaration.body)) && !ts.isInAmbientContext(declaration)) { return declaration; } } @@ -15382,7 +15912,7 @@ var ts; checkCollisionWithRequireExportsInGeneratedCode(node, node.name); checkExportsOnMergedDeclarations(node); var symbol = getSymbolOfNode(node); - if (symbol.flags & 256 /* ValueModule */ && symbol.declarations.length > 1 && !ts.isInAmbientContext(node)) { + if (symbol.flags & 512 /* ValueModule */ && symbol.declarations.length > 1 && !ts.isInAmbientContext(node)) { var classOrFunc = getFirstNonAmbientClassOrFunctionDeclaration(symbol); if (classOrFunc) { if (ts.getSourceFileOfNode(node) !== ts.getSourceFileOfNode(classOrFunc)) { @@ -15405,7 +15935,7 @@ var ts; checkSourceElement(node.body); } function getFirstIdentifier(node) { - while (node.kind === 117 /* QualifiedName */) { + while (node.kind === 121 /* QualifiedName */) { node = node.left; } return node; @@ -15433,10 +15963,10 @@ var ts; } } else { - if (node.parent.kind === 186 /* SourceFile */) { + if (node.parent.kind === 193 /* SourceFile */) { target = resolveImport(symbol); } - else if (node.parent.kind === 182 /* ModuleBlock */ && node.parent.parent.name.kind === 7 /* StringLiteral */) { + else if (node.parent.kind === 189 /* ModuleBlock */ && node.parent.parent.name.kind === 7 /* StringLiteral */) { if (isExternalModuleNameRelative(node.externalModuleName.text)) { error(node, ts.Diagnostics.Import_declaration_in_an_ambient_external_module_declaration_cannot_reference_external_module_through_relative_external_module_name); target = unknownSymbol; @@ -15458,7 +15988,7 @@ var ts; } function checkExportAssignment(node) { var container = node.parent; - if (container.kind !== 186 /* SourceFile */) { + if (container.kind !== 193 /* SourceFile */) { container = container.parent; } checkTypeOfExportAssignmentSymbol(getSymbolOfNode(container)); @@ -15467,150 +15997,151 @@ var ts; if (!node) return; switch (node.kind) { - case 118 /* TypeParameter */: + case 122 /* TypeParameter */: return checkTypeParameter(node); - case 119 /* Parameter */: + case 123 /* Parameter */: return checkParameter(node); - case 120 /* Property */: + case 124 /* Property */: return checkPropertyDeclaration(node); - case 125 /* CallSignature */: - case 126 /* ConstructSignature */: - case 127 /* IndexSignature */: + case 129 /* CallSignature */: + case 130 /* ConstructSignature */: + case 131 /* IndexSignature */: return checkSignatureDeclaration(node); - case 121 /* Method */: + case 125 /* Method */: return checkMethodDeclaration(node); - case 122 /* Constructor */: + case 126 /* Constructor */: return checkConstructorDeclaration(node); - case 123 /* GetAccessor */: - case 124 /* SetAccessor */: + case 127 /* GetAccessor */: + case 128 /* SetAccessor */: return checkAccessorDeclaration(node); - case 128 /* TypeReference */: + case 132 /* TypeReference */: return checkTypeReference(node); - case 129 /* TypeQuery */: + case 133 /* TypeQuery */: return checkTypeQuery(node); - case 130 /* TypeLiteral */: + case 134 /* TypeLiteral */: return checkTypeLiteral(node); - case 131 /* ArrayType */: + case 135 /* ArrayType */: return checkArrayType(node); - case 132 /* TupleType */: + case 136 /* TupleType */: return checkTupleType(node); - case 133 /* UnionType */: + case 137 /* UnionType */: return checkUnionType(node); - case 134 /* ParenType */: + case 138 /* ParenType */: return checkSourceElement(node.type); - case 175 /* FunctionDeclaration */: + case 182 /* FunctionDeclaration */: return checkFunctionDeclaration(node); - case 151 /* Block */: + case 158 /* Block */: return checkBlock(node); - case 176 /* FunctionBlock */: - case 182 /* ModuleBlock */: + case 183 /* FunctionBlock */: + case 189 /* ModuleBlock */: return checkBody(node); - case 152 /* VariableStatement */: + case 159 /* VariableStatement */: return checkVariableStatement(node); - case 154 /* ExpressionStatement */: + case 161 /* ExpressionStatement */: return checkExpressionStatement(node); - case 155 /* IfStatement */: + case 162 /* IfStatement */: return checkIfStatement(node); - case 156 /* DoStatement */: + case 163 /* DoStatement */: return checkDoStatement(node); - case 157 /* WhileStatement */: + case 164 /* WhileStatement */: return checkWhileStatement(node); - case 158 /* ForStatement */: + case 165 /* ForStatement */: return checkForStatement(node); - case 159 /* ForInStatement */: + case 166 /* ForInStatement */: return checkForInStatement(node); - case 160 /* ContinueStatement */: - case 161 /* BreakStatement */: + case 167 /* ContinueStatement */: + case 168 /* BreakStatement */: return checkBreakOrContinueStatement(node); - case 162 /* ReturnStatement */: + case 169 /* ReturnStatement */: return checkReturnStatement(node); - case 163 /* WithStatement */: + case 170 /* WithStatement */: return checkWithStatement(node); - case 164 /* SwitchStatement */: + case 171 /* SwitchStatement */: return checkSwitchStatement(node); - case 167 /* LabeledStatement */: + case 174 /* LabeledStatement */: return checkLabeledStatement(node); - case 168 /* ThrowStatement */: + case 175 /* ThrowStatement */: return checkThrowStatement(node); - case 169 /* TryStatement */: + case 176 /* TryStatement */: return checkTryStatement(node); - case 174 /* VariableDeclaration */: + case 181 /* VariableDeclaration */: return ts.Debug.fail("Checker encountered variable declaration"); - case 177 /* ClassDeclaration */: + case 184 /* ClassDeclaration */: return checkClassDeclaration(node); - case 178 /* InterfaceDeclaration */: + case 185 /* InterfaceDeclaration */: return checkInterfaceDeclaration(node); - case 179 /* TypeAliasDeclaration */: + case 186 /* TypeAliasDeclaration */: return checkTypeAliasDeclaration(node); - case 180 /* EnumDeclaration */: + case 187 /* EnumDeclaration */: return checkEnumDeclaration(node); - case 181 /* ModuleDeclaration */: + case 188 /* ModuleDeclaration */: return checkModuleDeclaration(node); - case 183 /* ImportDeclaration */: + case 190 /* ImportDeclaration */: return checkImportDeclaration(node); - case 184 /* ExportAssignment */: + case 191 /* ExportAssignment */: return checkExportAssignment(node); } } function checkFunctionExpressionBodies(node) { switch (node.kind) { - case 144 /* FunctionExpression */: - case 145 /* ArrowFunction */: + case 149 /* FunctionExpression */: + case 150 /* ArrowFunction */: ts.forEach(node.parameters, checkFunctionExpressionBodies); checkFunctionExpressionBody(node); break; - case 121 /* Method */: - case 122 /* Constructor */: - case 123 /* GetAccessor */: - case 124 /* SetAccessor */: - case 175 /* FunctionDeclaration */: + case 125 /* Method */: + case 126 /* Constructor */: + case 127 /* GetAccessor */: + case 128 /* SetAccessor */: + case 182 /* FunctionDeclaration */: ts.forEach(node.parameters, checkFunctionExpressionBodies); break; - case 163 /* WithStatement */: + case 170 /* WithStatement */: checkFunctionExpressionBodies(node.expression); break; - case 119 /* Parameter */: - case 120 /* Property */: - case 135 /* ArrayLiteral */: - case 136 /* ObjectLiteral */: - case 137 /* PropertyAssignment */: - case 138 /* PropertyAccess */: - case 139 /* IndexedAccess */: - case 140 /* CallExpression */: - case 141 /* NewExpression */: - case 142 /* TypeAssertion */: - case 143 /* ParenExpression */: - case 146 /* PrefixOperator */: - case 147 /* PostfixOperator */: - case 148 /* BinaryExpression */: - case 149 /* ConditionalExpression */: - case 151 /* Block */: - case 176 /* FunctionBlock */: - case 182 /* ModuleBlock */: - case 152 /* VariableStatement */: - case 154 /* ExpressionStatement */: - case 155 /* IfStatement */: - case 156 /* DoStatement */: - case 157 /* WhileStatement */: - case 158 /* ForStatement */: - case 159 /* ForInStatement */: - case 160 /* ContinueStatement */: - case 161 /* BreakStatement */: - case 162 /* ReturnStatement */: - case 164 /* SwitchStatement */: - case 165 /* CaseClause */: - case 166 /* DefaultClause */: - case 167 /* LabeledStatement */: - case 168 /* ThrowStatement */: - case 169 /* TryStatement */: - case 170 /* TryBlock */: - case 171 /* CatchBlock */: - case 172 /* FinallyBlock */: - case 174 /* VariableDeclaration */: - case 177 /* ClassDeclaration */: - case 180 /* EnumDeclaration */: - case 185 /* EnumMember */: - case 186 /* SourceFile */: + case 123 /* Parameter */: + case 124 /* Property */: + case 139 /* ArrayLiteral */: + case 140 /* ObjectLiteral */: + case 141 /* PropertyAssignment */: + case 142 /* PropertyAccess */: + case 143 /* IndexedAccess */: + case 144 /* CallExpression */: + case 145 /* NewExpression */: + case 146 /* TaggedTemplateExpression */: + case 147 /* TypeAssertion */: + case 148 /* ParenExpression */: + case 151 /* PrefixOperator */: + case 152 /* PostfixOperator */: + case 153 /* BinaryExpression */: + case 154 /* ConditionalExpression */: + case 158 /* Block */: + case 183 /* FunctionBlock */: + case 189 /* ModuleBlock */: + case 159 /* VariableStatement */: + case 161 /* ExpressionStatement */: + case 162 /* IfStatement */: + case 163 /* DoStatement */: + case 164 /* WhileStatement */: + case 165 /* ForStatement */: + case 166 /* ForInStatement */: + case 167 /* ContinueStatement */: + case 168 /* BreakStatement */: + case 169 /* ReturnStatement */: + case 171 /* SwitchStatement */: + case 172 /* CaseClause */: + case 173 /* DefaultClause */: + case 174 /* LabeledStatement */: + case 175 /* ThrowStatement */: + case 176 /* TryStatement */: + case 177 /* TryBlock */: + case 178 /* CatchBlock */: + case 179 /* FinallyBlock */: + case 181 /* VariableDeclaration */: + case 184 /* ClassDeclaration */: + case 187 /* EnumDeclaration */: + case 192 /* EnumMember */: + case 193 /* SourceFile */: ts.forEachChild(node, checkFunctionExpressionBodies); break; } @@ -15627,7 +16158,7 @@ var ts; checkBody(node); if (ts.isExternalModule(node)) { var symbol = getExportAssignmentSymbol(node.symbol); - if (symbol && symbol.flags & 16777216 /* Import */) { + if (symbol && symbol.flags & 33554432 /* Import */) { getSymbolLinks(symbol).referenced = true; } } @@ -15681,7 +16212,7 @@ var ts; function isInsideWithStatementBody(node) { if (node) { while (node.parent) { - if (node.parent.kind === 163 /* WithStatement */ && node.parent.statement === node) { + if (node.parent.kind === 170 /* WithStatement */ && node.parent.statement === node) { return true; } node = node.parent; @@ -15717,27 +16248,27 @@ var ts; copySymbols(location.locals, meaning); } switch (location.kind) { - case 186 /* SourceFile */: + case 193 /* SourceFile */: if (!ts.isExternalModule(location)) break; - case 181 /* ModuleDeclaration */: + case 188 /* ModuleDeclaration */: copySymbols(getSymbolOfNode(location).exports, meaning & ts.SymbolFlags.ModuleMember); break; - case 180 /* EnumDeclaration */: + case 187 /* EnumDeclaration */: copySymbols(getSymbolOfNode(location).exports, meaning & 8 /* EnumMember */); break; - case 177 /* ClassDeclaration */: - case 178 /* InterfaceDeclaration */: + case 184 /* ClassDeclaration */: + case 185 /* InterfaceDeclaration */: if (!(memberFlags & 128 /* Static */)) { copySymbols(getSymbolOfNode(location).members, meaning & ts.SymbolFlags.Type); } break; - case 144 /* FunctionExpression */: + case 149 /* FunctionExpression */: if (location.name) { copySymbol(location.symbol, meaning); } break; - case 171 /* CatchBlock */: + case 178 /* CatchBlock */: if (location.variable.text) { copySymbol(location.symbol, meaning); } @@ -15750,100 +16281,102 @@ var ts; return ts.mapToArray(symbols); } function isTypeDeclarationName(name) { - return name.kind == 59 /* Identifier */ && isTypeDeclaration(name.parent) && name.parent.name === name; + return name.kind == 63 /* Identifier */ && isTypeDeclaration(name.parent) && name.parent.name === name; } function isTypeDeclaration(node) { switch (node.kind) { - case 118 /* TypeParameter */: - case 177 /* ClassDeclaration */: - case 178 /* InterfaceDeclaration */: - case 179 /* TypeAliasDeclaration */: - case 180 /* EnumDeclaration */: + case 122 /* TypeParameter */: + case 184 /* ClassDeclaration */: + case 185 /* InterfaceDeclaration */: + case 186 /* TypeAliasDeclaration */: + case 187 /* EnumDeclaration */: return true; } } function isTypeReferenceIdentifier(entityName) { var node = entityName; - while (node.parent && node.parent.kind === 117 /* QualifiedName */) + while (node.parent && node.parent.kind === 121 /* QualifiedName */) node = node.parent; - return node.parent && node.parent.kind === 128 /* TypeReference */; + return node.parent && node.parent.kind === 132 /* TypeReference */; } function isTypeNode(node) { if (ts.SyntaxKind.FirstTypeNode <= node.kind && node.kind <= ts.SyntaxKind.LastTypeNode) { return true; } switch (node.kind) { - case 105 /* AnyKeyword */: - case 112 /* NumberKeyword */: - case 114 /* StringKeyword */: - case 106 /* BooleanKeyword */: + case 109 /* AnyKeyword */: + case 116 /* NumberKeyword */: + case 118 /* StringKeyword */: + case 110 /* BooleanKeyword */: return true; - case 93 /* VoidKeyword */: - return node.parent.kind !== 146 /* PrefixOperator */; + case 97 /* VoidKeyword */: + return node.parent.kind !== 151 /* PrefixOperator */; case 7 /* StringLiteral */: - return node.parent.kind === 119 /* Parameter */; - case 59 /* Identifier */: - if (node.parent.kind === 117 /* QualifiedName */) { + return node.parent.kind === 123 /* Parameter */; + case 63 /* Identifier */: + if (node.parent.kind === 121 /* QualifiedName */) { node = node.parent; } - case 117 /* QualifiedName */: - ts.Debug.assert(node.kind === 59 /* Identifier */ || node.kind === 117 /* QualifiedName */, "'node' was expected to be a qualified name or identifier in 'isTypeNode'."); + case 121 /* QualifiedName */: + ts.Debug.assert(node.kind === 63 /* Identifier */ || node.kind === 121 /* QualifiedName */, "'node' was expected to be a qualified name or identifier in 'isTypeNode'."); var parent = node.parent; - if (parent.kind === 129 /* TypeQuery */) { + if (parent.kind === 133 /* TypeQuery */) { return false; } if (ts.SyntaxKind.FirstTypeNode <= parent.kind && parent.kind <= ts.SyntaxKind.LastTypeNode) { return true; } switch (parent.kind) { - case 118 /* TypeParameter */: + case 122 /* TypeParameter */: return node === parent.constraint; - case 120 /* Property */: - case 119 /* Parameter */: - case 174 /* VariableDeclaration */: + case 124 /* Property */: + case 123 /* Parameter */: + case 181 /* VariableDeclaration */: return node === parent.type; - case 175 /* FunctionDeclaration */: - case 144 /* FunctionExpression */: - case 145 /* ArrowFunction */: - case 122 /* Constructor */: - case 121 /* Method */: - case 123 /* GetAccessor */: - case 124 /* SetAccessor */: + case 182 /* FunctionDeclaration */: + case 149 /* FunctionExpression */: + case 150 /* ArrowFunction */: + case 126 /* Constructor */: + case 125 /* Method */: + case 127 /* GetAccessor */: + case 128 /* SetAccessor */: return node === parent.type; - case 125 /* CallSignature */: - case 126 /* ConstructSignature */: - case 127 /* IndexSignature */: + case 129 /* CallSignature */: + case 130 /* ConstructSignature */: + case 131 /* IndexSignature */: return node === parent.type; - case 142 /* TypeAssertion */: + case 147 /* TypeAssertion */: return node === parent.type; - case 140 /* CallExpression */: - case 141 /* NewExpression */: + case 144 /* CallExpression */: + case 145 /* NewExpression */: return parent.typeArguments && parent.typeArguments.indexOf(node) >= 0; + case 146 /* TaggedTemplateExpression */: + return false; } } return false; } function isInRightSideOfImportOrExportAssignment(node) { - while (node.parent.kind === 117 /* QualifiedName */) { + while (node.parent.kind === 121 /* QualifiedName */) { node = node.parent; } - if (node.parent.kind === 183 /* ImportDeclaration */) { + if (node.parent.kind === 190 /* ImportDeclaration */) { return node.parent.entityName === node; } - if (node.parent.kind === 184 /* ExportAssignment */) { + if (node.parent.kind === 191 /* ExportAssignment */) { return node.parent.exportName === node; } return false; } function isRightSideOfQualifiedNameOrPropertyAccess(node) { - return (node.parent.kind === 117 /* QualifiedName */ || node.parent.kind === 138 /* PropertyAccess */) && node.parent.right === node; + return (node.parent.kind === 121 /* QualifiedName */ || node.parent.kind === 142 /* PropertyAccess */) && node.parent.right === node; } function getSymbolOfEntityName(entityName) { if (ts.isDeclarationOrFunctionExpressionOrCatchVariableName(entityName)) { return getSymbolOfNode(entityName.parent); } - if (entityName.parent.kind === 184 /* ExportAssignment */) { - return resolveEntityName(entityName.parent.parent, entityName, ts.SymbolFlags.Value | ts.SymbolFlags.Type | ts.SymbolFlags.Namespace | 16777216 /* Import */); + if (entityName.parent.kind === 191 /* ExportAssignment */) { + return resolveEntityName(entityName.parent.parent, entityName, ts.SymbolFlags.Value | ts.SymbolFlags.Type | ts.SymbolFlags.Namespace | 33554432 /* Import */); } if (isInRightSideOfImportOrExportAssignment(entityName)) { return getSymbolOfPartOfRightHandSideOfImport(entityName); @@ -15852,11 +16385,11 @@ var ts; entityName = entityName.parent; } if (ts.isExpression(entityName)) { - if (entityName.kind === 59 /* Identifier */) { - var meaning = ts.SymbolFlags.Value | 16777216 /* Import */; + if (entityName.kind === 63 /* Identifier */) { + var meaning = ts.SymbolFlags.Value | 33554432 /* Import */; return resolveEntityName(entityName, entityName, meaning); } - else if (entityName.kind === 117 /* QualifiedName */ || entityName.kind === 138 /* PropertyAccess */) { + else if (entityName.kind === 121 /* QualifiedName */ || entityName.kind === 142 /* PropertyAccess */) { var symbol = getNodeLinks(entityName).resolvedSymbol; if (!symbol) { checkPropertyAccess(entityName); @@ -15868,8 +16401,8 @@ var ts; } } else if (isTypeReferenceIdentifier(entityName)) { - var meaning = entityName.parent.kind === 128 /* TypeReference */ ? ts.SymbolFlags.Type : ts.SymbolFlags.Namespace; - meaning |= 16777216 /* Import */; + var meaning = entityName.parent.kind === 132 /* TypeReference */ ? ts.SymbolFlags.Type : ts.SymbolFlags.Namespace; + meaning |= 33554432 /* Import */; return resolveEntityName(entityName, entityName, meaning); } return undefined; @@ -15881,32 +16414,32 @@ var ts; if (ts.isDeclarationOrFunctionExpressionOrCatchVariableName(node)) { return getSymbolOfNode(node.parent); } - if (node.kind === 59 /* Identifier */ && isInRightSideOfImportOrExportAssignment(node)) { - return node.parent.kind === 184 /* ExportAssignment */ ? getSymbolOfEntityName(node) : getSymbolOfPartOfRightHandSideOfImport(node); + if (node.kind === 63 /* Identifier */ && isInRightSideOfImportOrExportAssignment(node)) { + return node.parent.kind === 191 /* ExportAssignment */ ? getSymbolOfEntityName(node) : getSymbolOfPartOfRightHandSideOfImport(node); } switch (node.kind) { - case 59 /* Identifier */: - case 138 /* PropertyAccess */: - case 117 /* QualifiedName */: + case 63 /* Identifier */: + case 142 /* PropertyAccess */: + case 121 /* QualifiedName */: return getSymbolOfEntityName(node); - case 87 /* ThisKeyword */: - case 85 /* SuperKeyword */: + case 91 /* ThisKeyword */: + case 89 /* SuperKeyword */: var type = checkExpression(node); return type.symbol; - case 107 /* ConstructorKeyword */: + case 111 /* ConstructorKeyword */: var constructorDeclaration = node.parent; - if (constructorDeclaration && constructorDeclaration.kind === 122 /* Constructor */) { + if (constructorDeclaration && constructorDeclaration.kind === 126 /* Constructor */) { return constructorDeclaration.parent.symbol; } return undefined; case 7 /* StringLiteral */: - if (node.parent.kind === 183 /* ImportDeclaration */ && node.parent.externalModuleName === node) { + if (node.parent.kind === 190 /* ImportDeclaration */ && node.parent.externalModuleName === node) { var importSymbol = getSymbolOfNode(node.parent); var moduleType = getTypeOfSymbol(importSymbol); return moduleType ? moduleType.symbol : undefined; } case 6 /* NumericLiteral */: - if (node.parent.kind == 139 /* IndexedAccess */ && node.parent.index === node) { + if (node.parent.kind == 143 /* IndexedAccess */ && node.parent.index === node) { var objectType = checkExpression(node.parent.object); if (objectType === unknownType) return undefined; @@ -15971,7 +16504,7 @@ var ts; return getNamedMembers(propsByName); } function getRootSymbols(symbol) { - if (symbol.flags & 536870912 /* UnionProperty */) { + if (symbol.flags & 1073741824 /* UnionProperty */) { var symbols = []; var name = symbol.name; ts.forEach(getSymbolLinks(symbol).unionType.types, function (t) { @@ -15979,7 +16512,7 @@ var ts; }); return symbols; } - else if (symbol.flags & 134217728 /* Transient */) { + else if (symbol.flags & 268435456 /* Transient */) { var target = getSymbolLinks(symbol).target; if (target) { return [target]; @@ -15988,7 +16521,7 @@ var ts; return [symbol]; } function isExternalModuleSymbol(symbol) { - return symbol.flags & 256 /* ValueModule */ && symbol.declarations.length === 1 && symbol.declarations[0].kind === 186 /* SourceFile */; + return symbol.flags & 512 /* ValueModule */ && symbol.declarations.length === 1 && symbol.declarations[0].kind === 193 /* SourceFile */; } function isNodeDescendentOf(node, ancestor) { while (node) { @@ -16000,7 +16533,7 @@ var ts; } function isUniqueLocalName(name, container) { for (var node = container; isNodeDescendentOf(node, container); node = node.nextContainer) { - if (node.locals && ts.hasProperty(node.locals, name) && node.locals[name].flags & (ts.SymbolFlags.Value | 2097152 /* ExportValue */)) { + if (node.locals && ts.hasProperty(node.locals, name) && node.locals[name].flags & (ts.SymbolFlags.Value | 4194304 /* ExportValue */)) { return false; } } @@ -16021,7 +16554,7 @@ var ts; function getLocalNameForSymbol(symbol, location) { var node = location; while (node) { - if ((node.kind === 181 /* ModuleDeclaration */ || node.kind === 180 /* EnumDeclaration */) && getSymbolOfNode(node) === symbol) { + if ((node.kind === 188 /* ModuleDeclaration */ || node.kind === 187 /* EnumDeclaration */) && getSymbolOfNode(node) === symbol) { return getLocalNameOfContainer(node); } node = node.parent; @@ -16042,15 +16575,14 @@ var ts; } function getExportAssignmentName(node) { var symbol = getExportAssignmentSymbol(getSymbolOfNode(node)); - return symbol && symbolIsValue(symbol) ? symbolToString(symbol) : undefined; + return symbol && symbolIsValue(symbol) && !isConstEnumSymbol(symbol) ? symbolToString(symbol) : undefined; } - function isTopLevelValueImportedViaEntityName(node) { - if (node.parent.kind !== 186 /* SourceFile */ || !node.entityName) { + function isTopLevelValueImportWithEntityName(node) { + if (node.parent.kind !== 193 /* SourceFile */ || !node.entityName) { return false; } var symbol = getSymbolOfNode(node); - var target = resolveImport(symbol); - return target !== unknownSymbol && ((target.flags & ts.SymbolFlags.Value) !== 0); + return isImportResolvedToValue(getSymbolOfNode(node)); } function hasSemanticErrors() { return getDiagnostics().length > 0 || getGlobalDiagnostics().length > 0; @@ -16058,16 +16590,20 @@ var ts; function hasEarlyErrors(sourceFile) { return ts.forEach(getDiagnostics(sourceFile), function (d) { return d.isEarly; }); } + function isImportResolvedToValue(symbol) { + var target = resolveImport(symbol); + return target !== unknownSymbol && target.flags & ts.SymbolFlags.Value && !isConstEnumOrConstEnumOnlyModule(target); + } + function isConstEnumOrConstEnumOnlyModule(s) { + return isConstEnumSymbol(s) || s.constEnumOnlyModule; + } function isReferencedImportDeclaration(node) { var symbol = getSymbolOfNode(node); if (getSymbolLinks(symbol).referenced) { return true; } if (node.flags & 1 /* Export */) { - var target = resolveImport(symbol); - if (target !== unknownSymbol && target.flags & ts.SymbolFlags.Value) { - return true; - } + return isImportResolvedToValue(symbol); } return false; } @@ -16091,7 +16627,7 @@ var ts; if (symbol && (symbol.flags & 8 /* EnumMember */)) { var declaration = symbol.valueDeclaration; var constantValue; - if (declaration.kind === 185 /* EnumMember */ && (constantValue = getNodeLinks(declaration).enumMemberValue) !== undefined) { + if (declaration.kind === 192 /* EnumMember */ && (constantValue = getNodeLinks(declaration).enumMemberValue) !== undefined) { return constantValue; } } @@ -16099,7 +16635,7 @@ var ts; } function writeTypeAtLocation(location, enclosingDeclaration, flags, writer) { var symbol = getSymbolOfNode(location); - var type = symbol && !(symbol.flags & 1024 /* TypeLiteral */) ? getTypeOfSymbol(symbol) : getTypeFromTypeNode(location); + var type = symbol && !(symbol.flags & 2048 /* TypeLiteral */) ? getTypeOfSymbol(symbol) : getTypeFromTypeNode(location); getSymbolDisplayBuilder().buildTypeDisplay(type, writer, enclosingDeclaration, flags); } function writeReturnTypeOfSignatureDeclaration(signatureDeclaration, enclosingDeclaration, flags, writer) { @@ -16115,7 +16651,7 @@ var ts; isReferencedImportDeclaration: isReferencedImportDeclaration, getNodeCheckFlags: getNodeCheckFlags, getEnumMemberValue: getEnumMemberValue, - isTopLevelValueImportedViaEntityName: isTopLevelValueImportedViaEntityName, + isTopLevelValueImportWithEntityName: isTopLevelValueImportWithEntityName, hasSemanticErrors: hasSemanticErrors, hasEarlyErrors: hasEarlyErrors, isDeclarationVisible: isDeclarationVisible, @@ -16273,6 +16809,11 @@ var ts; shortName: "w", type: "boolean", description: ts.Diagnostics.Watch_input_files + }, + { + name: "preserveConstEnums", + type: "boolean", + description: ts.Diagnostics.Do_not_erase_const_enum_declarations_in_generated_code } ]; var shortOptionNames = {}; diff --git a/bin/typescriptServices.js b/bin/typescriptServices.js index 8aebc0f642a..3be948ac0d8 100644 --- a/bin/typescriptServices.js +++ b/bin/typescriptServices.js @@ -134,7 +134,8 @@ var ts; const_declarations_must_be_initialized: { code: 1155, category: 1 /* Error */, key: "'const' declarations must be initialized" }, const_declarations_can_only_be_declared_inside_a_block: { code: 1156, category: 1 /* Error */, key: "'const' declarations can only be declared inside a block." }, let_declarations_can_only_be_declared_inside_a_block: { code: 1157, category: 1 /* Error */, key: "'let' declarations can only be declared inside a block." }, - Aliased_type_cannot_be_an_object_type_literal_Use_an_interface_declaration_instead: { code: 1158, category: 1 /* Error */, key: "Aliased type cannot be an object type literal. Use an interface declaration instead." }, + Invalid_template_literal_expected: { code: 1158, category: 1 /* Error */, key: "Invalid template literal; expected '}'" }, + Tagged_templates_are_only_available_when_targeting_ECMAScript_6_and_higher: { code: 1159, category: 1 /* Error */, key: "Tagged templates are only available when targeting ECMAScript 6 and higher." }, Duplicate_identifier_0: { code: 2300, category: 1 /* Error */, key: "Duplicate identifier '{0}'." }, Initializer_of_instance_member_variable_0_cannot_reference_identifier_1_declared_in_the_constructor: { code: 2301, category: 1 /* Error */, key: "Initializer of instance member variable '{0}' cannot reference identifier '{1}' declared in the constructor." }, Static_members_cannot_reference_class_type_parameters: { code: 2302, category: 1 /* Error */, key: "Static members cannot reference class type parameters." }, @@ -282,6 +283,7 @@ var ts; The_type_argument_for_type_parameter_0_cannot_be_inferred_from_the_usage_Consider_specifying_the_type_arguments_explicitly: { code: 2453, category: 1 /* Error */, key: "The type argument for type parameter '{0}' cannot be inferred from the usage. Consider specifying the type arguments explicitly." }, Type_argument_candidate_1_is_not_a_valid_type_argument_because_it_is_not_a_supertype_of_candidate_0: { code: 2455, category: 1 /* Error */, key: "Type argument candidate '{1}' is not a valid type argument because it is not a supertype of candidate '{0}'." }, Type_alias_0_circularly_references_itself: { code: 2456, category: 1 /* Error */, key: "Type alias '{0}' circularly references itself." }, + Type_alias_name_cannot_be_0: { code: 2457, category: 1 /* Error */, key: "Type alias name cannot be '{0}'" }, Import_declaration_0_is_using_private_name_1: { code: 4000, category: 1 /* Error */, key: "Import declaration '{0}' is using private name '{1}'." }, Type_parameter_0_of_exported_class_has_or_is_using_name_1_from_private_module_2: { code: 4001, category: 1 /* Error */, key: "Type parameter '{0}' of exported class has or is using name '{1}' from private module '{2}'." }, Type_parameter_0_of_exported_class_has_or_is_using_private_name_1: { code: 4002, category: 1 /* Error */, key: "Type parameter '{0}' of exported class has or is using private name '{1}'." }, @@ -364,6 +366,12 @@ var ts; Exported_type_alias_0_has_or_is_using_name_1_from_external_module_2_but_cannot_be_named: { code: 4079, category: 1 /* Error */, key: "Exported type alias '{0}' has or is using name '{1}' from external module {2} but cannot be named." }, Exported_type_alias_0_has_or_is_using_name_1_from_private_module_2: { code: 4080, category: 1 /* Error */, key: "Exported type alias '{0}' has or is using name '{1}' from private module '{2}'." }, Exported_type_alias_0_has_or_is_using_private_name_1: { code: 4081, category: 1 /* Error */, key: "Exported type alias '{0}' has or is using private name '{1}'." }, + Enum_declarations_must_all_be_const_or_non_const: { code: 4082, category: 1 /* Error */, key: "Enum declarations must all be const or non-const." }, + In_const_enum_declarations_member_initializer_must_be_constant_expression: { code: 4083, category: 1 /* Error */, key: "In 'const' enum declarations member initializer must be constant expression.", isEarly: true }, + const_enums_can_only_be_used_in_property_or_index_access_expressions_or_the_right_hand_side_of_an_import_declaration_or_export_assignment: { code: 4084, category: 1 /* Error */, key: "'const' enums can only be used in property or index access expressions or the right hand side of an import declaration or export assignment." }, + Index_expression_arguments_in_const_enums_must_be_of_type_string: { code: 4085, category: 1 /* Error */, key: "Index expression arguments in 'const' enums must be of type 'string'." }, + const_enum_member_initializer_was_evaluated_to_a_non_finite_value: { code: 4086, category: 1 /* Error */, key: "'const' enum member initializer was evaluated to a non-finite value." }, + const_enum_member_initializer_was_evaluated_to_disallowed_value_NaN: { code: 4087, category: 1 /* Error */, key: "'const' enum member initializer was evaluated to disallowed value 'NaN'." }, The_current_host_does_not_support_the_0_option: { code: 5001, category: 1 /* Error */, key: "The current host does not support the '{0}' option." }, Cannot_find_the_common_subdirectory_path_for_the_input_files: { code: 5009, category: 1 /* Error */, key: "Cannot find the common subdirectory path for the input files." }, Cannot_read_file_0_Colon_1: { code: 5012, category: 1 /* Error */, key: "Cannot read file '{0}': {1}" }, @@ -378,6 +386,7 @@ var ts; Specifies_the_location_where_debugger_should_locate_TypeScript_files_instead_of_source_locations: { code: 6004, category: 2 /* Message */, key: "Specifies the location where debugger should locate TypeScript files instead of source locations." }, Watch_input_files: { code: 6005, category: 2 /* Message */, key: "Watch input files." }, Redirect_output_structure_to_the_directory: { code: 6006, category: 2 /* Message */, key: "Redirect output structure to the directory." }, + Do_not_erase_const_enum_declarations_in_generated_code: { code: 6007, category: 2 /* Message */, key: "Do not erase const enum declarations in generated code." }, Do_not_emit_comments_to_output: { code: 6009, category: 2 /* Message */, key: "Do not emit comments to output." }, Specify_ECMAScript_target_version_Colon_ES3_default_ES5_or_ES6_experimental: { code: 6015, category: 2 /* Message */, key: "Specify ECMAScript target version: 'ES3' (default), 'ES5', or 'ES6' (experimental)" }, Specify_module_code_generation_Colon_commonjs_or_amd: { code: 6016, category: 2 /* Message */, key: "Specify module code generation: 'commonjs' or 'amd'" }, @@ -431,112 +440,112 @@ var ts; var ts; (function (ts) { var textToToken = { - "any": 105 /* AnyKeyword */, - "boolean": 106 /* BooleanKeyword */, - "break": 60 /* BreakKeyword */, - "case": 61 /* CaseKeyword */, - "catch": 62 /* CatchKeyword */, - "class": 63 /* ClassKeyword */, - "continue": 65 /* ContinueKeyword */, - "const": 64 /* ConstKeyword */, - "constructor": 107 /* ConstructorKeyword */, - "debugger": 66 /* DebuggerKeyword */, - "declare": 108 /* DeclareKeyword */, - "default": 67 /* DefaultKeyword */, - "delete": 68 /* DeleteKeyword */, - "do": 69 /* DoKeyword */, - "else": 70 /* ElseKeyword */, - "enum": 71 /* EnumKeyword */, - "export": 72 /* ExportKeyword */, - "extends": 73 /* ExtendsKeyword */, - "false": 74 /* FalseKeyword */, - "finally": 75 /* FinallyKeyword */, - "for": 76 /* ForKeyword */, - "function": 77 /* FunctionKeyword */, - "get": 109 /* GetKeyword */, - "if": 78 /* IfKeyword */, - "implements": 96 /* ImplementsKeyword */, - "import": 79 /* ImportKeyword */, - "in": 80 /* InKeyword */, - "instanceof": 81 /* InstanceOfKeyword */, - "interface": 97 /* InterfaceKeyword */, - "let": 98 /* LetKeyword */, - "module": 110 /* ModuleKeyword */, - "new": 82 /* NewKeyword */, - "null": 83 /* NullKeyword */, - "number": 112 /* NumberKeyword */, - "package": 99 /* PackageKeyword */, - "private": 100 /* PrivateKeyword */, - "protected": 101 /* ProtectedKeyword */, - "public": 102 /* PublicKeyword */, - "require": 111 /* RequireKeyword */, - "return": 84 /* ReturnKeyword */, - "set": 113 /* SetKeyword */, - "static": 103 /* StaticKeyword */, - "string": 114 /* StringKeyword */, - "super": 85 /* SuperKeyword */, - "switch": 86 /* SwitchKeyword */, - "this": 87 /* ThisKeyword */, - "throw": 88 /* ThrowKeyword */, - "true": 89 /* TrueKeyword */, - "try": 90 /* TryKeyword */, - "type": 115 /* TypeKeyword */, - "typeof": 91 /* TypeOfKeyword */, - "var": 92 /* VarKeyword */, - "void": 93 /* VoidKeyword */, - "while": 94 /* WhileKeyword */, - "with": 95 /* WithKeyword */, - "yield": 104 /* YieldKeyword */, - "{": 9 /* OpenBraceToken */, - "}": 10 /* CloseBraceToken */, - "(": 11 /* OpenParenToken */, - ")": 12 /* CloseParenToken */, - "[": 13 /* OpenBracketToken */, - "]": 14 /* CloseBracketToken */, - ".": 15 /* DotToken */, - "...": 16 /* DotDotDotToken */, - ";": 17 /* SemicolonToken */, - ",": 18 /* CommaToken */, - "<": 19 /* LessThanToken */, - ">": 20 /* GreaterThanToken */, - "<=": 21 /* LessThanEqualsToken */, - ">=": 22 /* GreaterThanEqualsToken */, - "==": 23 /* EqualsEqualsToken */, - "!=": 24 /* ExclamationEqualsToken */, - "===": 25 /* EqualsEqualsEqualsToken */, - "!==": 26 /* ExclamationEqualsEqualsToken */, - "=>": 27 /* EqualsGreaterThanToken */, - "+": 28 /* PlusToken */, - "-": 29 /* MinusToken */, - "*": 30 /* AsteriskToken */, - "/": 31 /* SlashToken */, - "%": 32 /* PercentToken */, - "++": 33 /* PlusPlusToken */, - "--": 34 /* MinusMinusToken */, - "<<": 35 /* LessThanLessThanToken */, - ">>": 36 /* GreaterThanGreaterThanToken */, - ">>>": 37 /* GreaterThanGreaterThanGreaterThanToken */, - "&": 38 /* AmpersandToken */, - "|": 39 /* BarToken */, - "^": 40 /* CaretToken */, - "!": 41 /* ExclamationToken */, - "~": 42 /* TildeToken */, - "&&": 43 /* AmpersandAmpersandToken */, - "||": 44 /* BarBarToken */, - "?": 45 /* QuestionToken */, - ":": 46 /* ColonToken */, - "=": 47 /* EqualsToken */, - "+=": 48 /* PlusEqualsToken */, - "-=": 49 /* MinusEqualsToken */, - "*=": 50 /* AsteriskEqualsToken */, - "/=": 51 /* SlashEqualsToken */, - "%=": 52 /* PercentEqualsToken */, - "<<=": 53 /* LessThanLessThanEqualsToken */, - ">>=": 54 /* GreaterThanGreaterThanEqualsToken */, - ">>>=": 55 /* GreaterThanGreaterThanGreaterThanEqualsToken */, - "&=": 56 /* AmpersandEqualsToken */, - "|=": 57 /* BarEqualsToken */, - "^=": 58 /* CaretEqualsToken */ + "any": 109 /* AnyKeyword */, + "boolean": 110 /* BooleanKeyword */, + "break": 64 /* BreakKeyword */, + "case": 65 /* CaseKeyword */, + "catch": 66 /* CatchKeyword */, + "class": 67 /* ClassKeyword */, + "continue": 69 /* ContinueKeyword */, + "const": 68 /* ConstKeyword */, + "constructor": 111 /* ConstructorKeyword */, + "debugger": 70 /* DebuggerKeyword */, + "declare": 112 /* DeclareKeyword */, + "default": 71 /* DefaultKeyword */, + "delete": 72 /* DeleteKeyword */, + "do": 73 /* DoKeyword */, + "else": 74 /* ElseKeyword */, + "enum": 75 /* EnumKeyword */, + "export": 76 /* ExportKeyword */, + "extends": 77 /* ExtendsKeyword */, + "false": 78 /* FalseKeyword */, + "finally": 79 /* FinallyKeyword */, + "for": 80 /* ForKeyword */, + "function": 81 /* FunctionKeyword */, + "get": 113 /* GetKeyword */, + "if": 82 /* IfKeyword */, + "implements": 100 /* ImplementsKeyword */, + "import": 83 /* ImportKeyword */, + "in": 84 /* InKeyword */, + "instanceof": 85 /* InstanceOfKeyword */, + "interface": 101 /* InterfaceKeyword */, + "let": 102 /* LetKeyword */, + "module": 114 /* ModuleKeyword */, + "new": 86 /* NewKeyword */, + "null": 87 /* NullKeyword */, + "number": 116 /* NumberKeyword */, + "package": 103 /* PackageKeyword */, + "private": 104 /* PrivateKeyword */, + "protected": 105 /* ProtectedKeyword */, + "public": 106 /* PublicKeyword */, + "require": 115 /* RequireKeyword */, + "return": 88 /* ReturnKeyword */, + "set": 117 /* SetKeyword */, + "static": 107 /* StaticKeyword */, + "string": 118 /* StringKeyword */, + "super": 89 /* SuperKeyword */, + "switch": 90 /* SwitchKeyword */, + "this": 91 /* ThisKeyword */, + "throw": 92 /* ThrowKeyword */, + "true": 93 /* TrueKeyword */, + "try": 94 /* TryKeyword */, + "type": 119 /* TypeKeyword */, + "typeof": 95 /* TypeOfKeyword */, + "var": 96 /* VarKeyword */, + "void": 97 /* VoidKeyword */, + "while": 98 /* WhileKeyword */, + "with": 99 /* WithKeyword */, + "yield": 108 /* YieldKeyword */, + "{": 13 /* OpenBraceToken */, + "}": 14 /* CloseBraceToken */, + "(": 15 /* OpenParenToken */, + ")": 16 /* CloseParenToken */, + "[": 17 /* OpenBracketToken */, + "]": 18 /* CloseBracketToken */, + ".": 19 /* DotToken */, + "...": 20 /* DotDotDotToken */, + ";": 21 /* SemicolonToken */, + ",": 22 /* CommaToken */, + "<": 23 /* LessThanToken */, + ">": 24 /* GreaterThanToken */, + "<=": 25 /* LessThanEqualsToken */, + ">=": 26 /* GreaterThanEqualsToken */, + "==": 27 /* EqualsEqualsToken */, + "!=": 28 /* ExclamationEqualsToken */, + "===": 29 /* EqualsEqualsEqualsToken */, + "!==": 30 /* ExclamationEqualsEqualsToken */, + "=>": 31 /* EqualsGreaterThanToken */, + "+": 32 /* PlusToken */, + "-": 33 /* MinusToken */, + "*": 34 /* AsteriskToken */, + "/": 35 /* SlashToken */, + "%": 36 /* PercentToken */, + "++": 37 /* PlusPlusToken */, + "--": 38 /* MinusMinusToken */, + "<<": 39 /* LessThanLessThanToken */, + ">>": 40 /* GreaterThanGreaterThanToken */, + ">>>": 41 /* GreaterThanGreaterThanGreaterThanToken */, + "&": 42 /* AmpersandToken */, + "|": 43 /* BarToken */, + "^": 44 /* CaretToken */, + "!": 45 /* ExclamationToken */, + "~": 46 /* TildeToken */, + "&&": 47 /* AmpersandAmpersandToken */, + "||": 48 /* BarBarToken */, + "?": 49 /* QuestionToken */, + ":": 50 /* ColonToken */, + "=": 51 /* EqualsToken */, + "+=": 52 /* PlusEqualsToken */, + "-=": 53 /* MinusEqualsToken */, + "*=": 54 /* AsteriskEqualsToken */, + "/=": 55 /* SlashEqualsToken */, + "%=": 56 /* PercentEqualsToken */, + "<<=": 57 /* LessThanLessThanEqualsToken */, + ">>=": 58 /* GreaterThanGreaterThanEqualsToken */, + ">>>=": 59 /* GreaterThanGreaterThanGreaterThanEqualsToken */, + "&=": 60 /* AmpersandEqualsToken */, + "|=": 61 /* BarEqualsToken */, + "^=": 62 /* CaretEqualsToken */ }; var unicodeES3IdentifierStart = [170, 170, 181, 181, 186, 186, 192, 214, 216, 246, 248, 543, 546, 563, 592, 685, 688, 696, 699, 705, 720, 721, 736, 740, 750, 750, 890, 890, 902, 902, 904, 906, 908, 908, 910, 929, 931, 974, 976, 983, 986, 1011, 1024, 1153, 1164, 1220, 1223, 1224, 1227, 1228, 1232, 1269, 1272, 1273, 1329, 1366, 1369, 1369, 1377, 1415, 1488, 1514, 1520, 1522, 1569, 1594, 1600, 1610, 1649, 1747, 1749, 1749, 1765, 1766, 1786, 1788, 1808, 1808, 1810, 1836, 1920, 1957, 2309, 2361, 2365, 2365, 2384, 2384, 2392, 2401, 2437, 2444, 2447, 2448, 2451, 2472, 2474, 2480, 2482, 2482, 2486, 2489, 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, 2699, 2701, 2701, 2703, 2705, 2707, 2728, 2730, 2736, 2738, 2739, 2741, 2745, 2749, 2749, 2768, 2768, 2784, 2784, 2821, 2828, 2831, 2832, 2835, 2856, 2858, 2864, 2866, 2867, 2870, 2873, 2877, 2877, 2908, 2909, 2911, 2913, 2949, 2954, 2958, 2960, 2962, 2965, 2969, 2970, 2972, 2972, 2974, 2975, 2979, 2980, 2984, 2986, 2990, 2997, 2999, 3001, 3077, 3084, 3086, 3088, 3090, 3112, 3114, 3123, 3125, 3129, 3168, 3169, 3205, 3212, 3214, 3216, 3218, 3240, 3242, 3251, 3253, 3257, 3294, 3294, 3296, 3297, 3333, 3340, 3342, 3344, 3346, 3368, 3370, 3385, 3424, 3425, 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, 3805, 3840, 3840, 3904, 3911, 3913, 3946, 3976, 3979, 4096, 4129, 4131, 4135, 4137, 4138, 4176, 4181, 4256, 4293, 4304, 4342, 4352, 4441, 4447, 4514, 4520, 4601, 4608, 4614, 4616, 4678, 4680, 4680, 4682, 4685, 4688, 4694, 4696, 4696, 4698, 4701, 4704, 4742, 4744, 4744, 4746, 4749, 4752, 4782, 4784, 4784, 4786, 4789, 4792, 4798, 4800, 4800, 4802, 4805, 4808, 4814, 4816, 4822, 4824, 4846, 4848, 4878, 4880, 4880, 4882, 4885, 4888, 4894, 4896, 4934, 4936, 4954, 5024, 5108, 5121, 5740, 5743, 5750, 5761, 5786, 5792, 5866, 6016, 6067, 6176, 6263, 6272, 6312, 7680, 7835, 7840, 7929, 7936, 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, 8319, 8319, 8450, 8450, 8455, 8455, 8458, 8467, 8469, 8469, 8473, 8477, 8484, 8484, 8486, 8486, 8488, 8488, 8490, 8493, 8495, 8497, 8499, 8505, 8544, 8579, 12293, 12295, 12321, 12329, 12337, 12341, 12344, 12346, 12353, 12436, 12445, 12446, 12449, 12538, 12540, 12542, 12549, 12588, 12593, 12686, 12704, 12727, 13312, 19893, 19968, 40869, 40960, 42124, 44032, 55203, 63744, 64045, 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, 65138, 65140, 65140, 65142, 65276, 65313, 65338, 65345, 65370, 65382, 65470, 65474, 65479, 65482, 65487, 65490, 65495, 65498, 65500,]; var unicodeES3IdentifierPart = [170, 170, 181, 181, 186, 186, 192, 214, 216, 246, 248, 543, 546, 563, 592, 685, 688, 696, 699, 705, 720, 721, 736, 740, 750, 750, 768, 846, 864, 866, 890, 890, 902, 902, 904, 906, 908, 908, 910, 929, 931, 974, 976, 983, 986, 1011, 1024, 1153, 1155, 1158, 1164, 1220, 1223, 1224, 1227, 1228, 1232, 1269, 1272, 1273, 1329, 1366, 1369, 1369, 1377, 1415, 1425, 1441, 1443, 1465, 1467, 1469, 1471, 1471, 1473, 1474, 1476, 1476, 1488, 1514, 1520, 1522, 1569, 1594, 1600, 1621, 1632, 1641, 1648, 1747, 1749, 1756, 1759, 1768, 1770, 1773, 1776, 1788, 1808, 1836, 1840, 1866, 1920, 1968, 2305, 2307, 2309, 2361, 2364, 2381, 2384, 2388, 2392, 2403, 2406, 2415, 2433, 2435, 2437, 2444, 2447, 2448, 2451, 2472, 2474, 2480, 2482, 2482, 2486, 2489, 2492, 2492, 2494, 2500, 2503, 2504, 2507, 2509, 2519, 2519, 2524, 2525, 2527, 2531, 2534, 2545, 2562, 2562, 2565, 2570, 2575, 2576, 2579, 2600, 2602, 2608, 2610, 2611, 2613, 2614, 2616, 2617, 2620, 2620, 2622, 2626, 2631, 2632, 2635, 2637, 2649, 2652, 2654, 2654, 2662, 2676, 2689, 2691, 2693, 2699, 2701, 2701, 2703, 2705, 2707, 2728, 2730, 2736, 2738, 2739, 2741, 2745, 2748, 2757, 2759, 2761, 2763, 2765, 2768, 2768, 2784, 2784, 2790, 2799, 2817, 2819, 2821, 2828, 2831, 2832, 2835, 2856, 2858, 2864, 2866, 2867, 2870, 2873, 2876, 2883, 2887, 2888, 2891, 2893, 2902, 2903, 2908, 2909, 2911, 2913, 2918, 2927, 2946, 2947, 2949, 2954, 2958, 2960, 2962, 2965, 2969, 2970, 2972, 2972, 2974, 2975, 2979, 2980, 2984, 2986, 2990, 2997, 2999, 3001, 3006, 3010, 3014, 3016, 3018, 3021, 3031, 3031, 3047, 3055, 3073, 3075, 3077, 3084, 3086, 3088, 3090, 3112, 3114, 3123, 3125, 3129, 3134, 3140, 3142, 3144, 3146, 3149, 3157, 3158, 3168, 3169, 3174, 3183, 3202, 3203, 3205, 3212, 3214, 3216, 3218, 3240, 3242, 3251, 3253, 3257, 3262, 3268, 3270, 3272, 3274, 3277, 3285, 3286, 3294, 3294, 3296, 3297, 3302, 3311, 3330, 3331, 3333, 3340, 3342, 3344, 3346, 3368, 3370, 3385, 3390, 3395, 3398, 3400, 3402, 3405, 3415, 3415, 3424, 3425, 3430, 3439, 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, 3805, 3840, 3840, 3864, 3865, 3872, 3881, 3893, 3893, 3895, 3895, 3897, 3897, 3902, 3911, 3913, 3946, 3953, 3972, 3974, 3979, 3984, 3991, 3993, 4028, 4038, 4038, 4096, 4129, 4131, 4135, 4137, 4138, 4140, 4146, 4150, 4153, 4160, 4169, 4176, 4185, 4256, 4293, 4304, 4342, 4352, 4441, 4447, 4514, 4520, 4601, 4608, 4614, 4616, 4678, 4680, 4680, 4682, 4685, 4688, 4694, 4696, 4696, 4698, 4701, 4704, 4742, 4744, 4744, 4746, 4749, 4752, 4782, 4784, 4784, 4786, 4789, 4792, 4798, 4800, 4800, 4802, 4805, 4808, 4814, 4816, 4822, 4824, 4846, 4848, 4878, 4880, 4880, 4882, 4885, 4888, 4894, 4896, 4934, 4936, 4954, 4969, 4977, 5024, 5108, 5121, 5740, 5743, 5750, 5761, 5786, 5792, 5866, 6016, 6099, 6112, 6121, 6160, 6169, 6176, 6263, 6272, 6313, 7680, 7835, 7840, 7929, 7936, 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, 8255, 8256, 8319, 8319, 8400, 8412, 8417, 8417, 8450, 8450, 8455, 8455, 8458, 8467, 8469, 8469, 8473, 8477, 8484, 8484, 8486, 8486, 8488, 8488, 8490, 8493, 8495, 8497, 8499, 8505, 8544, 8579, 12293, 12295, 12321, 12335, 12337, 12341, 12344, 12346, 12353, 12436, 12441, 12442, 12445, 12446, 12449, 12542, 12549, 12588, 12593, 12686, 12704, 12727, 13312, 19893, 19968, 40869, 40960, 42124, 44032, 55203, 63744, 64045, 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, 65056, 65059, 65075, 65076, 65101, 65103, 65136, 65138, 65140, 65140, 65142, 65276, 65296, 65305, 65313, 65338, 65343, 65343, 65345, 65370, 65381, 65470, 65474, 65479, 65482, 65487, 65490, 65495, 65498, 65500,]; @@ -838,10 +847,10 @@ var ts; } return +(text.substring(start, pos)); } - function scanHexDigits(count, exact) { + function scanHexDigits(count, mustMatchCount) { var digits = 0; var value = 0; - while (digits < count || !exact) { + while (digits < count || !mustMatchCount) { var ch = text.charCodeAt(pos); if (ch >= 48 /* _0 */ && ch <= 57 /* _9 */) { value = value * 16 + ch - 48 /* _0 */; @@ -881,61 +890,7 @@ var ts; } if (ch === 92 /* backslash */) { result += text.substring(start, pos); - pos++; - if (pos >= len) { - error(ts.Diagnostics.Unexpected_end_of_text); - break; - } - ch = text.charCodeAt(pos++); - switch (ch) { - case 48 /* _0 */: - result += "\0"; - break; - case 98 /* b */: - result += "\b"; - break; - case 116 /* t */: - result += "\t"; - break; - case 110 /* n */: - result += "\n"; - break; - case 118 /* v */: - result += "\v"; - break; - case 102 /* f */: - result += "\f"; - break; - case 114 /* r */: - result += "\r"; - break; - case 39 /* singleQuote */: - result += "\'"; - break; - case 34 /* doubleQuote */: - result += "\""; - break; - case 120 /* x */: - case 117 /* u */: - var ch = scanHexDigits(ch === 120 /* x */ ? 2 : 4, true); - if (ch >= 0) { - result += String.fromCharCode(ch); - } - else { - error(ts.Diagnostics.Hexadecimal_digit_expected); - } - break; - case 13 /* carriageReturn */: - if (pos < len && text.charCodeAt(pos) === 10 /* lineFeed */) - pos++; - break; - case 10 /* lineFeed */: - case 8232 /* lineSeparator */: - case 8233 /* paragraphSeparator */: - break; - default: - result += String.fromCharCode(ch); - } + result += scanEscapeSequence(); start = pos; continue; } @@ -948,6 +903,102 @@ var ts; } return result; } + function scanTemplateAndSetTokenValue() { + var startedWithBacktick = text.charCodeAt(pos) === 96 /* backtick */; + pos++; + var start = pos; + var contents = ""; + var resultingToken; + while (true) { + if (pos >= len) { + contents += text.substring(start, pos); + error(ts.Diagnostics.Unexpected_end_of_text); + resultingToken = startedWithBacktick ? 9 /* NoSubstitutionTemplateLiteral */ : 12 /* TemplateTail */; + break; + } + var currChar = text.charCodeAt(pos); + if (currChar === 96 /* backtick */) { + contents += text.substring(start, pos); + pos++; + resultingToken = startedWithBacktick ? 9 /* NoSubstitutionTemplateLiteral */ : 12 /* TemplateTail */; + break; + } + if (currChar === 36 /* $ */ && pos + 1 < len && text.charCodeAt(pos + 1) === 123 /* openBrace */) { + contents += text.substring(start, pos); + pos += 2; + resultingToken = startedWithBacktick ? 10 /* TemplateHead */ : 11 /* TemplateMiddle */; + break; + } + if (currChar === 92 /* backslash */) { + contents += text.substring(start, pos); + contents += scanEscapeSequence(); + start = pos; + continue; + } + if (currChar === 13 /* carriageReturn */) { + contents += text.substring(start, pos); + if (pos + 1 < len && text.charCodeAt(pos + 1) === 10 /* lineFeed */) { + pos++; + } + pos++; + contents += "\n"; + start = pos; + continue; + } + pos++; + } + ts.Debug.assert(resultingToken !== undefined); + tokenValue = contents; + return resultingToken; + } + function scanEscapeSequence() { + pos++; + if (pos >= len) { + error(ts.Diagnostics.Unexpected_end_of_text); + return ""; + } + var ch = text.charCodeAt(pos++); + switch (ch) { + case 48 /* _0 */: + return "\0"; + case 98 /* b */: + return "\b"; + case 116 /* t */: + return "\t"; + case 110 /* n */: + return "\n"; + case 118 /* v */: + return "\v"; + case 102 /* f */: + return "\f"; + case 114 /* r */: + return "\r"; + case 39 /* singleQuote */: + return "\'"; + case 34 /* doubleQuote */: + return "\""; + case 120 /* x */: + case 117 /* u */: + var ch = scanHexDigits(ch === 120 /* x */ ? 2 : 4, true); + if (ch >= 0) { + return String.fromCharCode(ch); + } + else { + error(ts.Diagnostics.Hexadecimal_digit_expected); + return ""; + } + case 13 /* carriageReturn */: + if (pos < len && text.charCodeAt(pos) === 10 /* lineFeed */) { + pos++; + } + case 10 /* lineFeed */: + case 8232 /* lineSeparator */: + case 8233 /* paragraphSeparator */: + return ""; + default: + return String.fromCharCode(ch); + } + } function peekUnicodeEscape() { if (pos + 5 < len && text.charCodeAt(pos + 1) === 117 /* u */) { var start = pos; @@ -991,7 +1042,7 @@ var ts; return token = textToToken[tokenValue]; } } - return token = 59 /* Identifier */; + return token = 63 /* Identifier */; } function scan() { startPos = pos; @@ -1036,64 +1087,66 @@ var ts; case 33 /* exclamation */: if (text.charCodeAt(pos + 1) === 61 /* equals */) { if (text.charCodeAt(pos + 2) === 61 /* equals */) { - return pos += 3, token = 26 /* ExclamationEqualsEqualsToken */; + return pos += 3, token = 30 /* ExclamationEqualsEqualsToken */; } - return pos += 2, token = 24 /* ExclamationEqualsToken */; + return pos += 2, token = 28 /* ExclamationEqualsToken */; } - return pos++, token = 41 /* ExclamationToken */; + return pos++, token = 45 /* ExclamationToken */; case 34 /* doubleQuote */: case 39 /* singleQuote */: tokenValue = scanString(); return token = 7 /* StringLiteral */; + case 96 /* backtick */: + return token = scanTemplateAndSetTokenValue(); case 37 /* percent */: if (text.charCodeAt(pos + 1) === 61 /* equals */) { - return pos += 2, token = 52 /* PercentEqualsToken */; + return pos += 2, token = 56 /* PercentEqualsToken */; } - return pos++, token = 32 /* PercentToken */; + return pos++, token = 36 /* PercentToken */; case 38 /* ampersand */: if (text.charCodeAt(pos + 1) === 38 /* ampersand */) { - return pos += 2, token = 43 /* AmpersandAmpersandToken */; + return pos += 2, token = 47 /* AmpersandAmpersandToken */; } if (text.charCodeAt(pos + 1) === 61 /* equals */) { - return pos += 2, token = 56 /* AmpersandEqualsToken */; + return pos += 2, token = 60 /* AmpersandEqualsToken */; } - return pos++, token = 38 /* AmpersandToken */; + return pos++, token = 42 /* AmpersandToken */; case 40 /* openParen */: - return pos++, token = 11 /* OpenParenToken */; + return pos++, token = 15 /* OpenParenToken */; case 41 /* closeParen */: - return pos++, token = 12 /* CloseParenToken */; + return pos++, token = 16 /* CloseParenToken */; case 42 /* asterisk */: if (text.charCodeAt(pos + 1) === 61 /* equals */) { - return pos += 2, token = 50 /* AsteriskEqualsToken */; + return pos += 2, token = 54 /* AsteriskEqualsToken */; } - return pos++, token = 30 /* AsteriskToken */; + return pos++, token = 34 /* AsteriskToken */; case 43 /* plus */: if (text.charCodeAt(pos + 1) === 43 /* plus */) { - return pos += 2, token = 33 /* PlusPlusToken */; + return pos += 2, token = 37 /* PlusPlusToken */; } if (text.charCodeAt(pos + 1) === 61 /* equals */) { - return pos += 2, token = 48 /* PlusEqualsToken */; + return pos += 2, token = 52 /* PlusEqualsToken */; } - return pos++, token = 28 /* PlusToken */; + return pos++, token = 32 /* PlusToken */; case 44 /* comma */: - return pos++, token = 18 /* CommaToken */; + return pos++, token = 22 /* CommaToken */; case 45 /* minus */: if (text.charCodeAt(pos + 1) === 45 /* minus */) { - return pos += 2, token = 34 /* MinusMinusToken */; + return pos += 2, token = 38 /* MinusMinusToken */; } if (text.charCodeAt(pos + 1) === 61 /* equals */) { - return pos += 2, token = 49 /* MinusEqualsToken */; + return pos += 2, token = 53 /* MinusEqualsToken */; } - return pos++, token = 29 /* MinusToken */; + return pos++, token = 33 /* MinusToken */; case 46 /* dot */: if (isDigit(text.charCodeAt(pos + 1))) { tokenValue = "" + scanNumber(); return token = 6 /* NumericLiteral */; } if (text.charCodeAt(pos + 1) === 46 /* dot */ && text.charCodeAt(pos + 2) === 46 /* dot */) { - return pos += 3, token = 16 /* DotDotDotToken */; + return pos += 3, token = 20 /* DotDotDotToken */; } - return pos++, token = 15 /* DotToken */; + return pos++, token = 19 /* DotToken */; case 47 /* slash */: if (text.charCodeAt(pos + 1) === 47 /* slash */) { pos += 2; @@ -1142,9 +1195,9 @@ var ts; } } if (text.charCodeAt(pos + 1) === 61 /* equals */) { - return pos += 2, token = 51 /* SlashEqualsToken */; + return pos += 2, token = 55 /* SlashEqualsToken */; } - return pos++, token = 31 /* SlashToken */; + return pos++, token = 35 /* SlashToken */; case 48 /* _0 */: if (pos + 2 < len && (text.charCodeAt(pos + 1) === 88 /* X */ || text.charCodeAt(pos + 1) === 120 /* x */)) { pos += 2; @@ -1172,58 +1225,58 @@ var ts; tokenValue = "" + scanNumber(); return token = 6 /* NumericLiteral */; case 58 /* colon */: - return pos++, token = 46 /* ColonToken */; + return pos++, token = 50 /* ColonToken */; case 59 /* semicolon */: - return pos++, token = 17 /* SemicolonToken */; + return pos++, token = 21 /* SemicolonToken */; case 60 /* lessThan */: if (text.charCodeAt(pos + 1) === 60 /* lessThan */) { if (text.charCodeAt(pos + 2) === 61 /* equals */) { - return pos += 3, token = 53 /* LessThanLessThanEqualsToken */; + return pos += 3, token = 57 /* LessThanLessThanEqualsToken */; } - return pos += 2, token = 35 /* LessThanLessThanToken */; + return pos += 2, token = 39 /* LessThanLessThanToken */; } if (text.charCodeAt(pos + 1) === 61 /* equals */) { - return pos += 2, token = 21 /* LessThanEqualsToken */; + return pos += 2, token = 25 /* LessThanEqualsToken */; } - return pos++, token = 19 /* LessThanToken */; + return pos++, token = 23 /* LessThanToken */; case 61 /* equals */: if (text.charCodeAt(pos + 1) === 61 /* equals */) { if (text.charCodeAt(pos + 2) === 61 /* equals */) { - return pos += 3, token = 25 /* EqualsEqualsEqualsToken */; + return pos += 3, token = 29 /* EqualsEqualsEqualsToken */; } - return pos += 2, token = 23 /* EqualsEqualsToken */; + return pos += 2, token = 27 /* EqualsEqualsToken */; } if (text.charCodeAt(pos + 1) === 62 /* greaterThan */) { - return pos += 2, token = 27 /* EqualsGreaterThanToken */; + return pos += 2, token = 31 /* EqualsGreaterThanToken */; } - return pos++, token = 47 /* EqualsToken */; + return pos++, token = 51 /* EqualsToken */; case 62 /* greaterThan */: - return pos++, token = 20 /* GreaterThanToken */; + return pos++, token = 24 /* GreaterThanToken */; case 63 /* question */: - return pos++, token = 45 /* QuestionToken */; + return pos++, token = 49 /* QuestionToken */; case 91 /* openBracket */: - return pos++, token = 13 /* OpenBracketToken */; + return pos++, token = 17 /* OpenBracketToken */; case 93 /* closeBracket */: - return pos++, token = 14 /* CloseBracketToken */; + return pos++, token = 18 /* CloseBracketToken */; case 94 /* caret */: if (text.charCodeAt(pos + 1) === 61 /* equals */) { - return pos += 2, token = 58 /* CaretEqualsToken */; + return pos += 2, token = 62 /* CaretEqualsToken */; } - return pos++, token = 40 /* CaretToken */; + return pos++, token = 44 /* CaretToken */; case 123 /* openBrace */: - return pos++, token = 9 /* OpenBraceToken */; + return pos++, token = 13 /* OpenBraceToken */; case 124 /* bar */: if (text.charCodeAt(pos + 1) === 124 /* bar */) { - return pos += 2, token = 44 /* BarBarToken */; + return pos += 2, token = 48 /* BarBarToken */; } if (text.charCodeAt(pos + 1) === 61 /* equals */) { - return pos += 2, token = 57 /* BarEqualsToken */; + return pos += 2, token = 61 /* BarEqualsToken */; } - return pos++, token = 39 /* BarToken */; + return pos++, token = 43 /* BarToken */; case 125 /* closeBrace */: - return pos++, token = 10 /* CloseBraceToken */; + return pos++, token = 14 /* CloseBraceToken */; case 126 /* tilde */: - return pos++, token = 42 /* TildeToken */; + return pos++, token = 46 /* TildeToken */; case 92 /* backslash */: var ch = peekUnicodeEscape(); if (ch >= 0 && isIdentifierStart(ch)) { @@ -1259,27 +1312,27 @@ var ts; } } function reScanGreaterToken() { - if (token === 20 /* GreaterThanToken */) { + if (token === 24 /* GreaterThanToken */) { if (text.charCodeAt(pos) === 62 /* greaterThan */) { if (text.charCodeAt(pos + 1) === 62 /* greaterThan */) { if (text.charCodeAt(pos + 2) === 61 /* equals */) { - return pos += 3, token = 55 /* GreaterThanGreaterThanGreaterThanEqualsToken */; + return pos += 3, token = 59 /* GreaterThanGreaterThanGreaterThanEqualsToken */; } - return pos += 2, token = 37 /* GreaterThanGreaterThanGreaterThanToken */; + return pos += 2, token = 41 /* GreaterThanGreaterThanGreaterThanToken */; } if (text.charCodeAt(pos + 1) === 61 /* equals */) { - return pos += 2, token = 54 /* GreaterThanGreaterThanEqualsToken */; + return pos += 2, token = 58 /* GreaterThanGreaterThanEqualsToken */; } - return pos++, token = 36 /* GreaterThanGreaterThanToken */; + return pos++, token = 40 /* GreaterThanGreaterThanToken */; } if (text.charCodeAt(pos) === 61 /* equals */) { - return pos++, token = 22 /* GreaterThanEqualsToken */; + return pos++, token = 26 /* GreaterThanEqualsToken */; } } return token; } function reScanSlashToken() { - if (token === 31 /* SlashToken */ || token === 51 /* SlashEqualsToken */) { + if (token === 35 /* SlashToken */ || token === 55 /* SlashEqualsToken */) { var p = tokenPos + 1; var inEscape = false; var inCharacterClass = false; @@ -1318,6 +1371,11 @@ var ts; } return token; } + function reScanTemplateToken() { + ts.Debug.assert(token === 14 /* CloseBraceToken */, "'reScanTemplateToken' should only be called on a '}'"); + pos = tokenPos; + return token = scanTemplateAndSetTokenValue(); + } function tryScan(callback) { var savePos = pos; var saveStartPos = startPos; @@ -1357,10 +1415,11 @@ var ts; getTokenText: function () { return text.substring(tokenPos, pos); }, getTokenValue: function () { return tokenValue; }, hasPrecedingLineBreak: function () { return precedingLineBreak; }, - isIdentifier: function () { return token === 59 /* Identifier */ || token > ts.SyntaxKind.LastReservedWord; }, + isIdentifier: function () { return token === 63 /* Identifier */ || token > ts.SyntaxKind.LastReservedWord; }, isReservedWord: function () { return token >= ts.SyntaxKind.FirstReservedWord && token <= ts.SyntaxKind.LastReservedWord; }, reScanGreaterToken: reScanGreaterToken, reScanSlashToken: reScanSlashToken, + reScanTemplateToken: reScanTemplateToken, scan: scan, setText: setText, setTextPos: setTextPos, @@ -1381,187 +1440,194 @@ var ts; SyntaxKind[SyntaxKind["NumericLiteral"] = 6] = "NumericLiteral"; SyntaxKind[SyntaxKind["StringLiteral"] = 7] = "StringLiteral"; SyntaxKind[SyntaxKind["RegularExpressionLiteral"] = 8] = "RegularExpressionLiteral"; - SyntaxKind[SyntaxKind["OpenBraceToken"] = 9] = "OpenBraceToken"; - SyntaxKind[SyntaxKind["CloseBraceToken"] = 10] = "CloseBraceToken"; - SyntaxKind[SyntaxKind["OpenParenToken"] = 11] = "OpenParenToken"; - SyntaxKind[SyntaxKind["CloseParenToken"] = 12] = "CloseParenToken"; - SyntaxKind[SyntaxKind["OpenBracketToken"] = 13] = "OpenBracketToken"; - SyntaxKind[SyntaxKind["CloseBracketToken"] = 14] = "CloseBracketToken"; - SyntaxKind[SyntaxKind["DotToken"] = 15] = "DotToken"; - SyntaxKind[SyntaxKind["DotDotDotToken"] = 16] = "DotDotDotToken"; - SyntaxKind[SyntaxKind["SemicolonToken"] = 17] = "SemicolonToken"; - SyntaxKind[SyntaxKind["CommaToken"] = 18] = "CommaToken"; - SyntaxKind[SyntaxKind["LessThanToken"] = 19] = "LessThanToken"; - SyntaxKind[SyntaxKind["GreaterThanToken"] = 20] = "GreaterThanToken"; - SyntaxKind[SyntaxKind["LessThanEqualsToken"] = 21] = "LessThanEqualsToken"; - SyntaxKind[SyntaxKind["GreaterThanEqualsToken"] = 22] = "GreaterThanEqualsToken"; - SyntaxKind[SyntaxKind["EqualsEqualsToken"] = 23] = "EqualsEqualsToken"; - SyntaxKind[SyntaxKind["ExclamationEqualsToken"] = 24] = "ExclamationEqualsToken"; - SyntaxKind[SyntaxKind["EqualsEqualsEqualsToken"] = 25] = "EqualsEqualsEqualsToken"; - SyntaxKind[SyntaxKind["ExclamationEqualsEqualsToken"] = 26] = "ExclamationEqualsEqualsToken"; - SyntaxKind[SyntaxKind["EqualsGreaterThanToken"] = 27] = "EqualsGreaterThanToken"; - SyntaxKind[SyntaxKind["PlusToken"] = 28] = "PlusToken"; - SyntaxKind[SyntaxKind["MinusToken"] = 29] = "MinusToken"; - SyntaxKind[SyntaxKind["AsteriskToken"] = 30] = "AsteriskToken"; - SyntaxKind[SyntaxKind["SlashToken"] = 31] = "SlashToken"; - SyntaxKind[SyntaxKind["PercentToken"] = 32] = "PercentToken"; - SyntaxKind[SyntaxKind["PlusPlusToken"] = 33] = "PlusPlusToken"; - SyntaxKind[SyntaxKind["MinusMinusToken"] = 34] = "MinusMinusToken"; - SyntaxKind[SyntaxKind["LessThanLessThanToken"] = 35] = "LessThanLessThanToken"; - SyntaxKind[SyntaxKind["GreaterThanGreaterThanToken"] = 36] = "GreaterThanGreaterThanToken"; - SyntaxKind[SyntaxKind["GreaterThanGreaterThanGreaterThanToken"] = 37] = "GreaterThanGreaterThanGreaterThanToken"; - SyntaxKind[SyntaxKind["AmpersandToken"] = 38] = "AmpersandToken"; - SyntaxKind[SyntaxKind["BarToken"] = 39] = "BarToken"; - SyntaxKind[SyntaxKind["CaretToken"] = 40] = "CaretToken"; - SyntaxKind[SyntaxKind["ExclamationToken"] = 41] = "ExclamationToken"; - SyntaxKind[SyntaxKind["TildeToken"] = 42] = "TildeToken"; - SyntaxKind[SyntaxKind["AmpersandAmpersandToken"] = 43] = "AmpersandAmpersandToken"; - SyntaxKind[SyntaxKind["BarBarToken"] = 44] = "BarBarToken"; - SyntaxKind[SyntaxKind["QuestionToken"] = 45] = "QuestionToken"; - SyntaxKind[SyntaxKind["ColonToken"] = 46] = "ColonToken"; - SyntaxKind[SyntaxKind["EqualsToken"] = 47] = "EqualsToken"; - SyntaxKind[SyntaxKind["PlusEqualsToken"] = 48] = "PlusEqualsToken"; - SyntaxKind[SyntaxKind["MinusEqualsToken"] = 49] = "MinusEqualsToken"; - SyntaxKind[SyntaxKind["AsteriskEqualsToken"] = 50] = "AsteriskEqualsToken"; - SyntaxKind[SyntaxKind["SlashEqualsToken"] = 51] = "SlashEqualsToken"; - SyntaxKind[SyntaxKind["PercentEqualsToken"] = 52] = "PercentEqualsToken"; - SyntaxKind[SyntaxKind["LessThanLessThanEqualsToken"] = 53] = "LessThanLessThanEqualsToken"; - SyntaxKind[SyntaxKind["GreaterThanGreaterThanEqualsToken"] = 54] = "GreaterThanGreaterThanEqualsToken"; - SyntaxKind[SyntaxKind["GreaterThanGreaterThanGreaterThanEqualsToken"] = 55] = "GreaterThanGreaterThanGreaterThanEqualsToken"; - SyntaxKind[SyntaxKind["AmpersandEqualsToken"] = 56] = "AmpersandEqualsToken"; - SyntaxKind[SyntaxKind["BarEqualsToken"] = 57] = "BarEqualsToken"; - SyntaxKind[SyntaxKind["CaretEqualsToken"] = 58] = "CaretEqualsToken"; - SyntaxKind[SyntaxKind["Identifier"] = 59] = "Identifier"; - SyntaxKind[SyntaxKind["BreakKeyword"] = 60] = "BreakKeyword"; - SyntaxKind[SyntaxKind["CaseKeyword"] = 61] = "CaseKeyword"; - SyntaxKind[SyntaxKind["CatchKeyword"] = 62] = "CatchKeyword"; - SyntaxKind[SyntaxKind["ClassKeyword"] = 63] = "ClassKeyword"; - SyntaxKind[SyntaxKind["ConstKeyword"] = 64] = "ConstKeyword"; - SyntaxKind[SyntaxKind["ContinueKeyword"] = 65] = "ContinueKeyword"; - SyntaxKind[SyntaxKind["DebuggerKeyword"] = 66] = "DebuggerKeyword"; - SyntaxKind[SyntaxKind["DefaultKeyword"] = 67] = "DefaultKeyword"; - SyntaxKind[SyntaxKind["DeleteKeyword"] = 68] = "DeleteKeyword"; - SyntaxKind[SyntaxKind["DoKeyword"] = 69] = "DoKeyword"; - SyntaxKind[SyntaxKind["ElseKeyword"] = 70] = "ElseKeyword"; - SyntaxKind[SyntaxKind["EnumKeyword"] = 71] = "EnumKeyword"; - SyntaxKind[SyntaxKind["ExportKeyword"] = 72] = "ExportKeyword"; - SyntaxKind[SyntaxKind["ExtendsKeyword"] = 73] = "ExtendsKeyword"; - SyntaxKind[SyntaxKind["FalseKeyword"] = 74] = "FalseKeyword"; - SyntaxKind[SyntaxKind["FinallyKeyword"] = 75] = "FinallyKeyword"; - SyntaxKind[SyntaxKind["ForKeyword"] = 76] = "ForKeyword"; - SyntaxKind[SyntaxKind["FunctionKeyword"] = 77] = "FunctionKeyword"; - SyntaxKind[SyntaxKind["IfKeyword"] = 78] = "IfKeyword"; - SyntaxKind[SyntaxKind["ImportKeyword"] = 79] = "ImportKeyword"; - SyntaxKind[SyntaxKind["InKeyword"] = 80] = "InKeyword"; - SyntaxKind[SyntaxKind["InstanceOfKeyword"] = 81] = "InstanceOfKeyword"; - SyntaxKind[SyntaxKind["NewKeyword"] = 82] = "NewKeyword"; - SyntaxKind[SyntaxKind["NullKeyword"] = 83] = "NullKeyword"; - SyntaxKind[SyntaxKind["ReturnKeyword"] = 84] = "ReturnKeyword"; - SyntaxKind[SyntaxKind["SuperKeyword"] = 85] = "SuperKeyword"; - SyntaxKind[SyntaxKind["SwitchKeyword"] = 86] = "SwitchKeyword"; - SyntaxKind[SyntaxKind["ThisKeyword"] = 87] = "ThisKeyword"; - SyntaxKind[SyntaxKind["ThrowKeyword"] = 88] = "ThrowKeyword"; - SyntaxKind[SyntaxKind["TrueKeyword"] = 89] = "TrueKeyword"; - SyntaxKind[SyntaxKind["TryKeyword"] = 90] = "TryKeyword"; - SyntaxKind[SyntaxKind["TypeOfKeyword"] = 91] = "TypeOfKeyword"; - SyntaxKind[SyntaxKind["VarKeyword"] = 92] = "VarKeyword"; - SyntaxKind[SyntaxKind["VoidKeyword"] = 93] = "VoidKeyword"; - SyntaxKind[SyntaxKind["WhileKeyword"] = 94] = "WhileKeyword"; - SyntaxKind[SyntaxKind["WithKeyword"] = 95] = "WithKeyword"; - SyntaxKind[SyntaxKind["ImplementsKeyword"] = 96] = "ImplementsKeyword"; - SyntaxKind[SyntaxKind["InterfaceKeyword"] = 97] = "InterfaceKeyword"; - SyntaxKind[SyntaxKind["LetKeyword"] = 98] = "LetKeyword"; - SyntaxKind[SyntaxKind["PackageKeyword"] = 99] = "PackageKeyword"; - SyntaxKind[SyntaxKind["PrivateKeyword"] = 100] = "PrivateKeyword"; - SyntaxKind[SyntaxKind["ProtectedKeyword"] = 101] = "ProtectedKeyword"; - SyntaxKind[SyntaxKind["PublicKeyword"] = 102] = "PublicKeyword"; - SyntaxKind[SyntaxKind["StaticKeyword"] = 103] = "StaticKeyword"; - SyntaxKind[SyntaxKind["YieldKeyword"] = 104] = "YieldKeyword"; - SyntaxKind[SyntaxKind["AnyKeyword"] = 105] = "AnyKeyword"; - SyntaxKind[SyntaxKind["BooleanKeyword"] = 106] = "BooleanKeyword"; - SyntaxKind[SyntaxKind["ConstructorKeyword"] = 107] = "ConstructorKeyword"; - SyntaxKind[SyntaxKind["DeclareKeyword"] = 108] = "DeclareKeyword"; - SyntaxKind[SyntaxKind["GetKeyword"] = 109] = "GetKeyword"; - SyntaxKind[SyntaxKind["ModuleKeyword"] = 110] = "ModuleKeyword"; - SyntaxKind[SyntaxKind["RequireKeyword"] = 111] = "RequireKeyword"; - SyntaxKind[SyntaxKind["NumberKeyword"] = 112] = "NumberKeyword"; - SyntaxKind[SyntaxKind["SetKeyword"] = 113] = "SetKeyword"; - SyntaxKind[SyntaxKind["StringKeyword"] = 114] = "StringKeyword"; - SyntaxKind[SyntaxKind["TypeKeyword"] = 115] = "TypeKeyword"; - SyntaxKind[SyntaxKind["Missing"] = 116] = "Missing"; - SyntaxKind[SyntaxKind["QualifiedName"] = 117] = "QualifiedName"; - SyntaxKind[SyntaxKind["TypeParameter"] = 118] = "TypeParameter"; - SyntaxKind[SyntaxKind["Parameter"] = 119] = "Parameter"; - SyntaxKind[SyntaxKind["Property"] = 120] = "Property"; - SyntaxKind[SyntaxKind["Method"] = 121] = "Method"; - SyntaxKind[SyntaxKind["Constructor"] = 122] = "Constructor"; - SyntaxKind[SyntaxKind["GetAccessor"] = 123] = "GetAccessor"; - SyntaxKind[SyntaxKind["SetAccessor"] = 124] = "SetAccessor"; - SyntaxKind[SyntaxKind["CallSignature"] = 125] = "CallSignature"; - SyntaxKind[SyntaxKind["ConstructSignature"] = 126] = "ConstructSignature"; - SyntaxKind[SyntaxKind["IndexSignature"] = 127] = "IndexSignature"; - SyntaxKind[SyntaxKind["TypeReference"] = 128] = "TypeReference"; - SyntaxKind[SyntaxKind["TypeQuery"] = 129] = "TypeQuery"; - SyntaxKind[SyntaxKind["TypeLiteral"] = 130] = "TypeLiteral"; - SyntaxKind[SyntaxKind["ArrayType"] = 131] = "ArrayType"; - SyntaxKind[SyntaxKind["TupleType"] = 132] = "TupleType"; - SyntaxKind[SyntaxKind["UnionType"] = 133] = "UnionType"; - SyntaxKind[SyntaxKind["ParenType"] = 134] = "ParenType"; - SyntaxKind[SyntaxKind["ArrayLiteral"] = 135] = "ArrayLiteral"; - SyntaxKind[SyntaxKind["ObjectLiteral"] = 136] = "ObjectLiteral"; - SyntaxKind[SyntaxKind["PropertyAssignment"] = 137] = "PropertyAssignment"; - SyntaxKind[SyntaxKind["PropertyAccess"] = 138] = "PropertyAccess"; - SyntaxKind[SyntaxKind["IndexedAccess"] = 139] = "IndexedAccess"; - SyntaxKind[SyntaxKind["CallExpression"] = 140] = "CallExpression"; - SyntaxKind[SyntaxKind["NewExpression"] = 141] = "NewExpression"; - SyntaxKind[SyntaxKind["TypeAssertion"] = 142] = "TypeAssertion"; - SyntaxKind[SyntaxKind["ParenExpression"] = 143] = "ParenExpression"; - SyntaxKind[SyntaxKind["FunctionExpression"] = 144] = "FunctionExpression"; - SyntaxKind[SyntaxKind["ArrowFunction"] = 145] = "ArrowFunction"; - SyntaxKind[SyntaxKind["PrefixOperator"] = 146] = "PrefixOperator"; - SyntaxKind[SyntaxKind["PostfixOperator"] = 147] = "PostfixOperator"; - SyntaxKind[SyntaxKind["BinaryExpression"] = 148] = "BinaryExpression"; - SyntaxKind[SyntaxKind["ConditionalExpression"] = 149] = "ConditionalExpression"; - SyntaxKind[SyntaxKind["OmittedExpression"] = 150] = "OmittedExpression"; - SyntaxKind[SyntaxKind["Block"] = 151] = "Block"; - SyntaxKind[SyntaxKind["VariableStatement"] = 152] = "VariableStatement"; - SyntaxKind[SyntaxKind["EmptyStatement"] = 153] = "EmptyStatement"; - SyntaxKind[SyntaxKind["ExpressionStatement"] = 154] = "ExpressionStatement"; - SyntaxKind[SyntaxKind["IfStatement"] = 155] = "IfStatement"; - SyntaxKind[SyntaxKind["DoStatement"] = 156] = "DoStatement"; - SyntaxKind[SyntaxKind["WhileStatement"] = 157] = "WhileStatement"; - SyntaxKind[SyntaxKind["ForStatement"] = 158] = "ForStatement"; - SyntaxKind[SyntaxKind["ForInStatement"] = 159] = "ForInStatement"; - SyntaxKind[SyntaxKind["ContinueStatement"] = 160] = "ContinueStatement"; - SyntaxKind[SyntaxKind["BreakStatement"] = 161] = "BreakStatement"; - SyntaxKind[SyntaxKind["ReturnStatement"] = 162] = "ReturnStatement"; - SyntaxKind[SyntaxKind["WithStatement"] = 163] = "WithStatement"; - SyntaxKind[SyntaxKind["SwitchStatement"] = 164] = "SwitchStatement"; - SyntaxKind[SyntaxKind["CaseClause"] = 165] = "CaseClause"; - SyntaxKind[SyntaxKind["DefaultClause"] = 166] = "DefaultClause"; - SyntaxKind[SyntaxKind["LabeledStatement"] = 167] = "LabeledStatement"; - SyntaxKind[SyntaxKind["ThrowStatement"] = 168] = "ThrowStatement"; - SyntaxKind[SyntaxKind["TryStatement"] = 169] = "TryStatement"; - SyntaxKind[SyntaxKind["TryBlock"] = 170] = "TryBlock"; - SyntaxKind[SyntaxKind["CatchBlock"] = 171] = "CatchBlock"; - SyntaxKind[SyntaxKind["FinallyBlock"] = 172] = "FinallyBlock"; - SyntaxKind[SyntaxKind["DebuggerStatement"] = 173] = "DebuggerStatement"; - SyntaxKind[SyntaxKind["VariableDeclaration"] = 174] = "VariableDeclaration"; - SyntaxKind[SyntaxKind["FunctionDeclaration"] = 175] = "FunctionDeclaration"; - SyntaxKind[SyntaxKind["FunctionBlock"] = 176] = "FunctionBlock"; - SyntaxKind[SyntaxKind["ClassDeclaration"] = 177] = "ClassDeclaration"; - SyntaxKind[SyntaxKind["InterfaceDeclaration"] = 178] = "InterfaceDeclaration"; - SyntaxKind[SyntaxKind["TypeAliasDeclaration"] = 179] = "TypeAliasDeclaration"; - SyntaxKind[SyntaxKind["EnumDeclaration"] = 180] = "EnumDeclaration"; - SyntaxKind[SyntaxKind["ModuleDeclaration"] = 181] = "ModuleDeclaration"; - SyntaxKind[SyntaxKind["ModuleBlock"] = 182] = "ModuleBlock"; - SyntaxKind[SyntaxKind["ImportDeclaration"] = 183] = "ImportDeclaration"; - SyntaxKind[SyntaxKind["ExportAssignment"] = 184] = "ExportAssignment"; - SyntaxKind[SyntaxKind["EnumMember"] = 185] = "EnumMember"; - SyntaxKind[SyntaxKind["SourceFile"] = 186] = "SourceFile"; - SyntaxKind[SyntaxKind["Program"] = 187] = "Program"; - SyntaxKind[SyntaxKind["SyntaxList"] = 188] = "SyntaxList"; - SyntaxKind[SyntaxKind["Count"] = 189] = "Count"; + SyntaxKind[SyntaxKind["NoSubstitutionTemplateLiteral"] = 9] = "NoSubstitutionTemplateLiteral"; + SyntaxKind[SyntaxKind["TemplateHead"] = 10] = "TemplateHead"; + SyntaxKind[SyntaxKind["TemplateMiddle"] = 11] = "TemplateMiddle"; + SyntaxKind[SyntaxKind["TemplateTail"] = 12] = "TemplateTail"; + SyntaxKind[SyntaxKind["OpenBraceToken"] = 13] = "OpenBraceToken"; + SyntaxKind[SyntaxKind["CloseBraceToken"] = 14] = "CloseBraceToken"; + SyntaxKind[SyntaxKind["OpenParenToken"] = 15] = "OpenParenToken"; + SyntaxKind[SyntaxKind["CloseParenToken"] = 16] = "CloseParenToken"; + SyntaxKind[SyntaxKind["OpenBracketToken"] = 17] = "OpenBracketToken"; + SyntaxKind[SyntaxKind["CloseBracketToken"] = 18] = "CloseBracketToken"; + SyntaxKind[SyntaxKind["DotToken"] = 19] = "DotToken"; + SyntaxKind[SyntaxKind["DotDotDotToken"] = 20] = "DotDotDotToken"; + SyntaxKind[SyntaxKind["SemicolonToken"] = 21] = "SemicolonToken"; + SyntaxKind[SyntaxKind["CommaToken"] = 22] = "CommaToken"; + SyntaxKind[SyntaxKind["LessThanToken"] = 23] = "LessThanToken"; + SyntaxKind[SyntaxKind["GreaterThanToken"] = 24] = "GreaterThanToken"; + SyntaxKind[SyntaxKind["LessThanEqualsToken"] = 25] = "LessThanEqualsToken"; + SyntaxKind[SyntaxKind["GreaterThanEqualsToken"] = 26] = "GreaterThanEqualsToken"; + SyntaxKind[SyntaxKind["EqualsEqualsToken"] = 27] = "EqualsEqualsToken"; + SyntaxKind[SyntaxKind["ExclamationEqualsToken"] = 28] = "ExclamationEqualsToken"; + SyntaxKind[SyntaxKind["EqualsEqualsEqualsToken"] = 29] = "EqualsEqualsEqualsToken"; + SyntaxKind[SyntaxKind["ExclamationEqualsEqualsToken"] = 30] = "ExclamationEqualsEqualsToken"; + SyntaxKind[SyntaxKind["EqualsGreaterThanToken"] = 31] = "EqualsGreaterThanToken"; + SyntaxKind[SyntaxKind["PlusToken"] = 32] = "PlusToken"; + SyntaxKind[SyntaxKind["MinusToken"] = 33] = "MinusToken"; + SyntaxKind[SyntaxKind["AsteriskToken"] = 34] = "AsteriskToken"; + SyntaxKind[SyntaxKind["SlashToken"] = 35] = "SlashToken"; + SyntaxKind[SyntaxKind["PercentToken"] = 36] = "PercentToken"; + SyntaxKind[SyntaxKind["PlusPlusToken"] = 37] = "PlusPlusToken"; + SyntaxKind[SyntaxKind["MinusMinusToken"] = 38] = "MinusMinusToken"; + SyntaxKind[SyntaxKind["LessThanLessThanToken"] = 39] = "LessThanLessThanToken"; + SyntaxKind[SyntaxKind["GreaterThanGreaterThanToken"] = 40] = "GreaterThanGreaterThanToken"; + SyntaxKind[SyntaxKind["GreaterThanGreaterThanGreaterThanToken"] = 41] = "GreaterThanGreaterThanGreaterThanToken"; + SyntaxKind[SyntaxKind["AmpersandToken"] = 42] = "AmpersandToken"; + SyntaxKind[SyntaxKind["BarToken"] = 43] = "BarToken"; + SyntaxKind[SyntaxKind["CaretToken"] = 44] = "CaretToken"; + SyntaxKind[SyntaxKind["ExclamationToken"] = 45] = "ExclamationToken"; + SyntaxKind[SyntaxKind["TildeToken"] = 46] = "TildeToken"; + SyntaxKind[SyntaxKind["AmpersandAmpersandToken"] = 47] = "AmpersandAmpersandToken"; + SyntaxKind[SyntaxKind["BarBarToken"] = 48] = "BarBarToken"; + SyntaxKind[SyntaxKind["QuestionToken"] = 49] = "QuestionToken"; + SyntaxKind[SyntaxKind["ColonToken"] = 50] = "ColonToken"; + SyntaxKind[SyntaxKind["EqualsToken"] = 51] = "EqualsToken"; + SyntaxKind[SyntaxKind["PlusEqualsToken"] = 52] = "PlusEqualsToken"; + SyntaxKind[SyntaxKind["MinusEqualsToken"] = 53] = "MinusEqualsToken"; + SyntaxKind[SyntaxKind["AsteriskEqualsToken"] = 54] = "AsteriskEqualsToken"; + SyntaxKind[SyntaxKind["SlashEqualsToken"] = 55] = "SlashEqualsToken"; + SyntaxKind[SyntaxKind["PercentEqualsToken"] = 56] = "PercentEqualsToken"; + SyntaxKind[SyntaxKind["LessThanLessThanEqualsToken"] = 57] = "LessThanLessThanEqualsToken"; + SyntaxKind[SyntaxKind["GreaterThanGreaterThanEqualsToken"] = 58] = "GreaterThanGreaterThanEqualsToken"; + SyntaxKind[SyntaxKind["GreaterThanGreaterThanGreaterThanEqualsToken"] = 59] = "GreaterThanGreaterThanGreaterThanEqualsToken"; + SyntaxKind[SyntaxKind["AmpersandEqualsToken"] = 60] = "AmpersandEqualsToken"; + SyntaxKind[SyntaxKind["BarEqualsToken"] = 61] = "BarEqualsToken"; + SyntaxKind[SyntaxKind["CaretEqualsToken"] = 62] = "CaretEqualsToken"; + SyntaxKind[SyntaxKind["Identifier"] = 63] = "Identifier"; + SyntaxKind[SyntaxKind["BreakKeyword"] = 64] = "BreakKeyword"; + SyntaxKind[SyntaxKind["CaseKeyword"] = 65] = "CaseKeyword"; + SyntaxKind[SyntaxKind["CatchKeyword"] = 66] = "CatchKeyword"; + SyntaxKind[SyntaxKind["ClassKeyword"] = 67] = "ClassKeyword"; + SyntaxKind[SyntaxKind["ConstKeyword"] = 68] = "ConstKeyword"; + SyntaxKind[SyntaxKind["ContinueKeyword"] = 69] = "ContinueKeyword"; + SyntaxKind[SyntaxKind["DebuggerKeyword"] = 70] = "DebuggerKeyword"; + SyntaxKind[SyntaxKind["DefaultKeyword"] = 71] = "DefaultKeyword"; + SyntaxKind[SyntaxKind["DeleteKeyword"] = 72] = "DeleteKeyword"; + SyntaxKind[SyntaxKind["DoKeyword"] = 73] = "DoKeyword"; + SyntaxKind[SyntaxKind["ElseKeyword"] = 74] = "ElseKeyword"; + SyntaxKind[SyntaxKind["EnumKeyword"] = 75] = "EnumKeyword"; + SyntaxKind[SyntaxKind["ExportKeyword"] = 76] = "ExportKeyword"; + SyntaxKind[SyntaxKind["ExtendsKeyword"] = 77] = "ExtendsKeyword"; + SyntaxKind[SyntaxKind["FalseKeyword"] = 78] = "FalseKeyword"; + SyntaxKind[SyntaxKind["FinallyKeyword"] = 79] = "FinallyKeyword"; + SyntaxKind[SyntaxKind["ForKeyword"] = 80] = "ForKeyword"; + SyntaxKind[SyntaxKind["FunctionKeyword"] = 81] = "FunctionKeyword"; + SyntaxKind[SyntaxKind["IfKeyword"] = 82] = "IfKeyword"; + SyntaxKind[SyntaxKind["ImportKeyword"] = 83] = "ImportKeyword"; + SyntaxKind[SyntaxKind["InKeyword"] = 84] = "InKeyword"; + SyntaxKind[SyntaxKind["InstanceOfKeyword"] = 85] = "InstanceOfKeyword"; + SyntaxKind[SyntaxKind["NewKeyword"] = 86] = "NewKeyword"; + SyntaxKind[SyntaxKind["NullKeyword"] = 87] = "NullKeyword"; + SyntaxKind[SyntaxKind["ReturnKeyword"] = 88] = "ReturnKeyword"; + SyntaxKind[SyntaxKind["SuperKeyword"] = 89] = "SuperKeyword"; + SyntaxKind[SyntaxKind["SwitchKeyword"] = 90] = "SwitchKeyword"; + SyntaxKind[SyntaxKind["ThisKeyword"] = 91] = "ThisKeyword"; + SyntaxKind[SyntaxKind["ThrowKeyword"] = 92] = "ThrowKeyword"; + SyntaxKind[SyntaxKind["TrueKeyword"] = 93] = "TrueKeyword"; + SyntaxKind[SyntaxKind["TryKeyword"] = 94] = "TryKeyword"; + SyntaxKind[SyntaxKind["TypeOfKeyword"] = 95] = "TypeOfKeyword"; + SyntaxKind[SyntaxKind["VarKeyword"] = 96] = "VarKeyword"; + SyntaxKind[SyntaxKind["VoidKeyword"] = 97] = "VoidKeyword"; + SyntaxKind[SyntaxKind["WhileKeyword"] = 98] = "WhileKeyword"; + SyntaxKind[SyntaxKind["WithKeyword"] = 99] = "WithKeyword"; + SyntaxKind[SyntaxKind["ImplementsKeyword"] = 100] = "ImplementsKeyword"; + SyntaxKind[SyntaxKind["InterfaceKeyword"] = 101] = "InterfaceKeyword"; + SyntaxKind[SyntaxKind["LetKeyword"] = 102] = "LetKeyword"; + SyntaxKind[SyntaxKind["PackageKeyword"] = 103] = "PackageKeyword"; + SyntaxKind[SyntaxKind["PrivateKeyword"] = 104] = "PrivateKeyword"; + SyntaxKind[SyntaxKind["ProtectedKeyword"] = 105] = "ProtectedKeyword"; + SyntaxKind[SyntaxKind["PublicKeyword"] = 106] = "PublicKeyword"; + SyntaxKind[SyntaxKind["StaticKeyword"] = 107] = "StaticKeyword"; + SyntaxKind[SyntaxKind["YieldKeyword"] = 108] = "YieldKeyword"; + SyntaxKind[SyntaxKind["AnyKeyword"] = 109] = "AnyKeyword"; + SyntaxKind[SyntaxKind["BooleanKeyword"] = 110] = "BooleanKeyword"; + SyntaxKind[SyntaxKind["ConstructorKeyword"] = 111] = "ConstructorKeyword"; + SyntaxKind[SyntaxKind["DeclareKeyword"] = 112] = "DeclareKeyword"; + SyntaxKind[SyntaxKind["GetKeyword"] = 113] = "GetKeyword"; + SyntaxKind[SyntaxKind["ModuleKeyword"] = 114] = "ModuleKeyword"; + SyntaxKind[SyntaxKind["RequireKeyword"] = 115] = "RequireKeyword"; + SyntaxKind[SyntaxKind["NumberKeyword"] = 116] = "NumberKeyword"; + SyntaxKind[SyntaxKind["SetKeyword"] = 117] = "SetKeyword"; + SyntaxKind[SyntaxKind["StringKeyword"] = 118] = "StringKeyword"; + SyntaxKind[SyntaxKind["TypeKeyword"] = 119] = "TypeKeyword"; + SyntaxKind[SyntaxKind["Missing"] = 120] = "Missing"; + SyntaxKind[SyntaxKind["QualifiedName"] = 121] = "QualifiedName"; + SyntaxKind[SyntaxKind["TypeParameter"] = 122] = "TypeParameter"; + SyntaxKind[SyntaxKind["Parameter"] = 123] = "Parameter"; + SyntaxKind[SyntaxKind["Property"] = 124] = "Property"; + SyntaxKind[SyntaxKind["Method"] = 125] = "Method"; + SyntaxKind[SyntaxKind["Constructor"] = 126] = "Constructor"; + SyntaxKind[SyntaxKind["GetAccessor"] = 127] = "GetAccessor"; + SyntaxKind[SyntaxKind["SetAccessor"] = 128] = "SetAccessor"; + SyntaxKind[SyntaxKind["CallSignature"] = 129] = "CallSignature"; + SyntaxKind[SyntaxKind["ConstructSignature"] = 130] = "ConstructSignature"; + SyntaxKind[SyntaxKind["IndexSignature"] = 131] = "IndexSignature"; + SyntaxKind[SyntaxKind["TypeReference"] = 132] = "TypeReference"; + SyntaxKind[SyntaxKind["TypeQuery"] = 133] = "TypeQuery"; + SyntaxKind[SyntaxKind["TypeLiteral"] = 134] = "TypeLiteral"; + SyntaxKind[SyntaxKind["ArrayType"] = 135] = "ArrayType"; + SyntaxKind[SyntaxKind["TupleType"] = 136] = "TupleType"; + SyntaxKind[SyntaxKind["UnionType"] = 137] = "UnionType"; + SyntaxKind[SyntaxKind["ParenType"] = 138] = "ParenType"; + SyntaxKind[SyntaxKind["ArrayLiteral"] = 139] = "ArrayLiteral"; + SyntaxKind[SyntaxKind["ObjectLiteral"] = 140] = "ObjectLiteral"; + SyntaxKind[SyntaxKind["PropertyAssignment"] = 141] = "PropertyAssignment"; + SyntaxKind[SyntaxKind["PropertyAccess"] = 142] = "PropertyAccess"; + SyntaxKind[SyntaxKind["IndexedAccess"] = 143] = "IndexedAccess"; + SyntaxKind[SyntaxKind["CallExpression"] = 144] = "CallExpression"; + SyntaxKind[SyntaxKind["NewExpression"] = 145] = "NewExpression"; + SyntaxKind[SyntaxKind["TaggedTemplateExpression"] = 146] = "TaggedTemplateExpression"; + SyntaxKind[SyntaxKind["TypeAssertion"] = 147] = "TypeAssertion"; + SyntaxKind[SyntaxKind["ParenExpression"] = 148] = "ParenExpression"; + SyntaxKind[SyntaxKind["FunctionExpression"] = 149] = "FunctionExpression"; + SyntaxKind[SyntaxKind["ArrowFunction"] = 150] = "ArrowFunction"; + SyntaxKind[SyntaxKind["PrefixOperator"] = 151] = "PrefixOperator"; + SyntaxKind[SyntaxKind["PostfixOperator"] = 152] = "PostfixOperator"; + SyntaxKind[SyntaxKind["BinaryExpression"] = 153] = "BinaryExpression"; + SyntaxKind[SyntaxKind["ConditionalExpression"] = 154] = "ConditionalExpression"; + SyntaxKind[SyntaxKind["TemplateExpression"] = 155] = "TemplateExpression"; + SyntaxKind[SyntaxKind["TemplateSpan"] = 156] = "TemplateSpan"; + SyntaxKind[SyntaxKind["OmittedExpression"] = 157] = "OmittedExpression"; + SyntaxKind[SyntaxKind["Block"] = 158] = "Block"; + SyntaxKind[SyntaxKind["VariableStatement"] = 159] = "VariableStatement"; + SyntaxKind[SyntaxKind["EmptyStatement"] = 160] = "EmptyStatement"; + SyntaxKind[SyntaxKind["ExpressionStatement"] = 161] = "ExpressionStatement"; + SyntaxKind[SyntaxKind["IfStatement"] = 162] = "IfStatement"; + SyntaxKind[SyntaxKind["DoStatement"] = 163] = "DoStatement"; + SyntaxKind[SyntaxKind["WhileStatement"] = 164] = "WhileStatement"; + SyntaxKind[SyntaxKind["ForStatement"] = 165] = "ForStatement"; + SyntaxKind[SyntaxKind["ForInStatement"] = 166] = "ForInStatement"; + SyntaxKind[SyntaxKind["ContinueStatement"] = 167] = "ContinueStatement"; + SyntaxKind[SyntaxKind["BreakStatement"] = 168] = "BreakStatement"; + SyntaxKind[SyntaxKind["ReturnStatement"] = 169] = "ReturnStatement"; + SyntaxKind[SyntaxKind["WithStatement"] = 170] = "WithStatement"; + SyntaxKind[SyntaxKind["SwitchStatement"] = 171] = "SwitchStatement"; + SyntaxKind[SyntaxKind["CaseClause"] = 172] = "CaseClause"; + SyntaxKind[SyntaxKind["DefaultClause"] = 173] = "DefaultClause"; + SyntaxKind[SyntaxKind["LabeledStatement"] = 174] = "LabeledStatement"; + SyntaxKind[SyntaxKind["ThrowStatement"] = 175] = "ThrowStatement"; + SyntaxKind[SyntaxKind["TryStatement"] = 176] = "TryStatement"; + SyntaxKind[SyntaxKind["TryBlock"] = 177] = "TryBlock"; + SyntaxKind[SyntaxKind["CatchBlock"] = 178] = "CatchBlock"; + SyntaxKind[SyntaxKind["FinallyBlock"] = 179] = "FinallyBlock"; + SyntaxKind[SyntaxKind["DebuggerStatement"] = 180] = "DebuggerStatement"; + SyntaxKind[SyntaxKind["VariableDeclaration"] = 181] = "VariableDeclaration"; + SyntaxKind[SyntaxKind["FunctionDeclaration"] = 182] = "FunctionDeclaration"; + SyntaxKind[SyntaxKind["FunctionBlock"] = 183] = "FunctionBlock"; + SyntaxKind[SyntaxKind["ClassDeclaration"] = 184] = "ClassDeclaration"; + SyntaxKind[SyntaxKind["InterfaceDeclaration"] = 185] = "InterfaceDeclaration"; + SyntaxKind[SyntaxKind["TypeAliasDeclaration"] = 186] = "TypeAliasDeclaration"; + SyntaxKind[SyntaxKind["EnumDeclaration"] = 187] = "EnumDeclaration"; + SyntaxKind[SyntaxKind["ModuleDeclaration"] = 188] = "ModuleDeclaration"; + SyntaxKind[SyntaxKind["ModuleBlock"] = 189] = "ModuleBlock"; + SyntaxKind[SyntaxKind["ImportDeclaration"] = 190] = "ImportDeclaration"; + SyntaxKind[SyntaxKind["ExportAssignment"] = 191] = "ExportAssignment"; + SyntaxKind[SyntaxKind["EnumMember"] = 192] = "EnumMember"; + SyntaxKind[SyntaxKind["SourceFile"] = 193] = "SourceFile"; + SyntaxKind[SyntaxKind["Program"] = 194] = "Program"; + SyntaxKind[SyntaxKind["SyntaxList"] = 195] = "SyntaxList"; + SyntaxKind[SyntaxKind["Count"] = 196] = "Count"; SyntaxKind[SyntaxKind["FirstAssignment"] = SyntaxKind.EqualsToken] = "FirstAssignment"; SyntaxKind[SyntaxKind["LastAssignment"] = SyntaxKind.CaretEqualsToken] = "LastAssignment"; SyntaxKind[SyntaxKind["FirstReservedWord"] = SyntaxKind.BreakKeyword] = "FirstReservedWord"; @@ -1578,6 +1644,10 @@ var ts; SyntaxKind[SyntaxKind["LastToken"] = SyntaxKind.TypeKeyword] = "LastToken"; SyntaxKind[SyntaxKind["FirstTriviaToken"] = SyntaxKind.SingleLineCommentTrivia] = "FirstTriviaToken"; SyntaxKind[SyntaxKind["LastTriviaToken"] = SyntaxKind.WhitespaceTrivia] = "LastTriviaToken"; + SyntaxKind[SyntaxKind["FirstLiteralToken"] = SyntaxKind.NumericLiteral] = "FirstLiteralToken"; + SyntaxKind[SyntaxKind["LastLiteralToken"] = SyntaxKind.NoSubstitutionTemplateLiteral] = "LastLiteralToken"; + SyntaxKind[SyntaxKind["FirstTemplateToken"] = SyntaxKind.NoSubstitutionTemplateLiteral] = "FirstTemplateToken"; + SyntaxKind[SyntaxKind["LastTemplateToken"] = SyntaxKind.TemplateTail] = "LastTemplateToken"; })(ts.SyntaxKind || (ts.SyntaxKind = {})); var SyntaxKind = ts.SyntaxKind; (function (NodeFlags) { @@ -1639,29 +1709,31 @@ var ts; SymbolFlags[SymbolFlags["Function"] = 0x00000010] = "Function"; SymbolFlags[SymbolFlags["Class"] = 0x00000020] = "Class"; SymbolFlags[SymbolFlags["Interface"] = 0x00000040] = "Interface"; - SymbolFlags[SymbolFlags["Enum"] = 0x00000080] = "Enum"; - SymbolFlags[SymbolFlags["ValueModule"] = 0x00000100] = "ValueModule"; - SymbolFlags[SymbolFlags["NamespaceModule"] = 0x00000200] = "NamespaceModule"; - SymbolFlags[SymbolFlags["TypeLiteral"] = 0x00000400] = "TypeLiteral"; - SymbolFlags[SymbolFlags["ObjectLiteral"] = 0x00000800] = "ObjectLiteral"; - SymbolFlags[SymbolFlags["Method"] = 0x00001000] = "Method"; - SymbolFlags[SymbolFlags["Constructor"] = 0x00002000] = "Constructor"; - SymbolFlags[SymbolFlags["GetAccessor"] = 0x00004000] = "GetAccessor"; - SymbolFlags[SymbolFlags["SetAccessor"] = 0x00008000] = "SetAccessor"; - SymbolFlags[SymbolFlags["CallSignature"] = 0x00010000] = "CallSignature"; - SymbolFlags[SymbolFlags["ConstructSignature"] = 0x00020000] = "ConstructSignature"; - SymbolFlags[SymbolFlags["IndexSignature"] = 0x00040000] = "IndexSignature"; - SymbolFlags[SymbolFlags["TypeParameter"] = 0x00080000] = "TypeParameter"; - SymbolFlags[SymbolFlags["TypeAlias"] = 0x00100000] = "TypeAlias"; - SymbolFlags[SymbolFlags["ExportValue"] = 0x00200000] = "ExportValue"; - SymbolFlags[SymbolFlags["ExportType"] = 0x00400000] = "ExportType"; - SymbolFlags[SymbolFlags["ExportNamespace"] = 0x00800000] = "ExportNamespace"; - SymbolFlags[SymbolFlags["Import"] = 0x01000000] = "Import"; - SymbolFlags[SymbolFlags["Instantiated"] = 0x02000000] = "Instantiated"; - SymbolFlags[SymbolFlags["Merged"] = 0x04000000] = "Merged"; - SymbolFlags[SymbolFlags["Transient"] = 0x08000000] = "Transient"; - SymbolFlags[SymbolFlags["Prototype"] = 0x10000000] = "Prototype"; - SymbolFlags[SymbolFlags["UnionProperty"] = 0x20000000] = "UnionProperty"; + SymbolFlags[SymbolFlags["ConstEnum"] = 0x00000080] = "ConstEnum"; + SymbolFlags[SymbolFlags["RegularEnum"] = 0x00000100] = "RegularEnum"; + SymbolFlags[SymbolFlags["ValueModule"] = 0x00000200] = "ValueModule"; + SymbolFlags[SymbolFlags["NamespaceModule"] = 0x00000400] = "NamespaceModule"; + SymbolFlags[SymbolFlags["TypeLiteral"] = 0x00000800] = "TypeLiteral"; + SymbolFlags[SymbolFlags["ObjectLiteral"] = 0x00001000] = "ObjectLiteral"; + SymbolFlags[SymbolFlags["Method"] = 0x00002000] = "Method"; + SymbolFlags[SymbolFlags["Constructor"] = 0x00004000] = "Constructor"; + SymbolFlags[SymbolFlags["GetAccessor"] = 0x00008000] = "GetAccessor"; + SymbolFlags[SymbolFlags["SetAccessor"] = 0x00010000] = "SetAccessor"; + SymbolFlags[SymbolFlags["CallSignature"] = 0x00020000] = "CallSignature"; + SymbolFlags[SymbolFlags["ConstructSignature"] = 0x00040000] = "ConstructSignature"; + SymbolFlags[SymbolFlags["IndexSignature"] = 0x00080000] = "IndexSignature"; + SymbolFlags[SymbolFlags["TypeParameter"] = 0x00100000] = "TypeParameter"; + SymbolFlags[SymbolFlags["TypeAlias"] = 0x00200000] = "TypeAlias"; + SymbolFlags[SymbolFlags["ExportValue"] = 0x00400000] = "ExportValue"; + SymbolFlags[SymbolFlags["ExportType"] = 0x00800000] = "ExportType"; + SymbolFlags[SymbolFlags["ExportNamespace"] = 0x01000000] = "ExportNamespace"; + SymbolFlags[SymbolFlags["Import"] = 0x02000000] = "Import"; + SymbolFlags[SymbolFlags["Instantiated"] = 0x04000000] = "Instantiated"; + SymbolFlags[SymbolFlags["Merged"] = 0x08000000] = "Merged"; + SymbolFlags[SymbolFlags["Transient"] = 0x10000000] = "Transient"; + SymbolFlags[SymbolFlags["Prototype"] = 0x20000000] = "Prototype"; + SymbolFlags[SymbolFlags["UnionProperty"] = 0x40000000] = "UnionProperty"; + SymbolFlags[SymbolFlags["Enum"] = SymbolFlags.RegularEnum | SymbolFlags.ConstEnum] = "Enum"; SymbolFlags[SymbolFlags["Variable"] = SymbolFlags.FunctionScopedVariable | SymbolFlags.BlockScopedVariable] = "Variable"; SymbolFlags[SymbolFlags["Value"] = SymbolFlags.Variable | SymbolFlags.Property | SymbolFlags.EnumMember | SymbolFlags.Function | SymbolFlags.Class | SymbolFlags.Enum | SymbolFlags.ValueModule | SymbolFlags.Method | SymbolFlags.GetAccessor | SymbolFlags.SetAccessor] = "Value"; SymbolFlags[SymbolFlags["Type"] = SymbolFlags.Class | SymbolFlags.Interface | SymbolFlags.Enum | SymbolFlags.TypeLiteral | SymbolFlags.ObjectLiteral | SymbolFlags.TypeParameter | SymbolFlags.TypeAlias] = "Type"; @@ -1677,8 +1749,9 @@ var ts; SymbolFlags[SymbolFlags["FunctionExcludes"] = SymbolFlags.Value & ~(SymbolFlags.Function | SymbolFlags.ValueModule)] = "FunctionExcludes"; SymbolFlags[SymbolFlags["ClassExcludes"] = (SymbolFlags.Value | SymbolFlags.Type) & ~SymbolFlags.ValueModule] = "ClassExcludes"; SymbolFlags[SymbolFlags["InterfaceExcludes"] = SymbolFlags.Type & ~SymbolFlags.Interface] = "InterfaceExcludes"; - SymbolFlags[SymbolFlags["EnumExcludes"] = (SymbolFlags.Value | SymbolFlags.Type) & ~(SymbolFlags.Enum | SymbolFlags.ValueModule)] = "EnumExcludes"; - SymbolFlags[SymbolFlags["ValueModuleExcludes"] = SymbolFlags.Value & ~(SymbolFlags.Function | SymbolFlags.Class | SymbolFlags.Enum | SymbolFlags.ValueModule)] = "ValueModuleExcludes"; + SymbolFlags[SymbolFlags["RegularEnumExcludes"] = (SymbolFlags.Value | SymbolFlags.Type) & ~(SymbolFlags.RegularEnum | SymbolFlags.ValueModule)] = "RegularEnumExcludes"; + SymbolFlags[SymbolFlags["ConstEnumExcludes"] = (SymbolFlags.Value | SymbolFlags.Type) & ~SymbolFlags.ConstEnum] = "ConstEnumExcludes"; + SymbolFlags[SymbolFlags["ValueModuleExcludes"] = SymbolFlags.Value & ~(SymbolFlags.Function | SymbolFlags.Class | SymbolFlags.RegularEnum | SymbolFlags.ValueModule)] = "ValueModuleExcludes"; SymbolFlags[SymbolFlags["NamespaceModuleExcludes"] = 0] = "NamespaceModuleExcludes"; SymbolFlags[SymbolFlags["MethodExcludes"] = SymbolFlags.Value & ~SymbolFlags.Method] = "MethodExcludes"; SymbolFlags[SymbolFlags["GetAccessorExcludes"] = SymbolFlags.Value & ~SymbolFlags.SetAccessor] = "GetAccessorExcludes"; @@ -1855,6 +1928,7 @@ var ts; CharacterCodes[CharacterCodes["asterisk"] = 0x2A] = "asterisk"; CharacterCodes[CharacterCodes["at"] = 0x40] = "at"; CharacterCodes[CharacterCodes["backslash"] = 0x5C] = "backslash"; + CharacterCodes[CharacterCodes["backtick"] = 0x60] = "backtick"; CharacterCodes[CharacterCodes["bar"] = 0x7C] = "bar"; CharacterCodes[CharacterCodes["caret"] = 0x5E] = "caret"; CharacterCodes[CharacterCodes["closeBrace"] = 0x7D] = "closeBrace"; @@ -1889,6 +1963,18 @@ var ts; })(ts || (ts = {})); var ts; (function (ts) { + (function (Ternary) { + Ternary[Ternary["False"] = 0] = "False"; + Ternary[Ternary["Maybe"] = 1] = "Maybe"; + Ternary[Ternary["True"] = -1] = "True"; + })(ts.Ternary || (ts.Ternary = {})); + var Ternary = ts.Ternary; + (function (Comparison) { + Comparison[Comparison["LessThan"] = -1] = "LessThan"; + Comparison[Comparison["EqualTo"] = 0] = "EqualTo"; + Comparison[Comparison["GreaterThan"] = 1] = "GreaterThan"; + })(ts.Comparison || (ts.Comparison = {})); + var Comparison = ts.Comparison; function forEach(array, callback) { var result; if (array) { @@ -2161,12 +2247,12 @@ var ts; ts.flattenDiagnosticChain = flattenDiagnosticChain; function compareValues(a, b) { if (a === b) - return 0; + return 0 /* EqualTo */; if (a === undefined) - return -1; + return -1 /* LessThan */; if (b === undefined) - return 1; - return a < b ? -1 : 1; + return 1 /* GreaterThan */; + return a < b ? -1 /* LessThan */ : 1 /* GreaterThan */; } ts.compareValues = compareValues; function getDiagnosticFilename(diagnostic) { @@ -2184,7 +2270,7 @@ var ts; var previousDiagnostic = diagnostics[0]; for (var i = 1; i < diagnostics.length; i++) { var currentDiagnostic = diagnostics[i]; - var isDupe = compareDiagnostics(currentDiagnostic, previousDiagnostic) === 0; + var isDupe = compareDiagnostics(currentDiagnostic, previousDiagnostic) === 0 /* EqualTo */; if (!isDupe) { newDiagnostics.push(currentDiagnostic); previousDiagnostic = currentDiagnostic; @@ -2445,7 +2531,7 @@ var ts; })(ts || (ts = {})); var ts; (function (ts) { - var nodeConstructors = new Array(189 /* Count */); + var nodeConstructors = new Array(196 /* Count */); function getNodeConstructor(kind) { return nodeConstructors[kind] || (nodeConstructors[kind] = ts.objectAllocator.getNodeConstructor(kind)); } @@ -2458,7 +2544,7 @@ var ts; return node; } function getSourceFileOfNode(node) { - while (node && node.kind !== 186 /* SourceFile */) + while (node && node.kind !== 193 /* SourceFile */) node = node.parent; return node; } @@ -2495,81 +2581,13 @@ var ts; } ts.unescapeIdentifier = unescapeIdentifier; function identifierToString(identifier) { - return identifier.kind === 116 /* Missing */ ? "(Missing)" : getTextOfNode(identifier); + return identifier.kind === 120 /* Missing */ ? "(Missing)" : getTextOfNode(identifier); } ts.identifierToString = identifierToString; - function isExpression(node) { - switch (node.kind) { - case 87 /* ThisKeyword */: - case 85 /* SuperKeyword */: - case 83 /* NullKeyword */: - case 89 /* TrueKeyword */: - case 74 /* FalseKeyword */: - case 8 /* RegularExpressionLiteral */: - case 135 /* ArrayLiteral */: - case 136 /* ObjectLiteral */: - case 138 /* PropertyAccess */: - case 139 /* IndexedAccess */: - case 140 /* CallExpression */: - case 141 /* NewExpression */: - case 142 /* TypeAssertion */: - case 143 /* ParenExpression */: - case 144 /* FunctionExpression */: - case 145 /* ArrowFunction */: - case 146 /* PrefixOperator */: - case 147 /* PostfixOperator */: - case 148 /* BinaryExpression */: - case 149 /* ConditionalExpression */: - case 150 /* OmittedExpression */: - return true; - case 117 /* QualifiedName */: - while (node.parent.kind === 117 /* QualifiedName */) - node = node.parent; - return node.parent.kind === 129 /* TypeQuery */; - case 59 /* Identifier */: - if (node.parent.kind === 129 /* TypeQuery */) { - return true; - } - case 6 /* NumericLiteral */: - case 7 /* StringLiteral */: - var parent = node.parent; - switch (parent.kind) { - case 174 /* VariableDeclaration */: - case 119 /* Parameter */: - case 120 /* Property */: - case 185 /* EnumMember */: - case 137 /* PropertyAssignment */: - return parent.initializer === node; - case 154 /* ExpressionStatement */: - case 155 /* IfStatement */: - case 156 /* DoStatement */: - case 157 /* WhileStatement */: - case 162 /* ReturnStatement */: - case 163 /* WithStatement */: - case 164 /* SwitchStatement */: - case 165 /* CaseClause */: - case 168 /* ThrowStatement */: - case 164 /* SwitchStatement */: - return parent.expression === node; - case 158 /* ForStatement */: - return parent.initializer === node || parent.condition === node || parent.iterator === node; - case 159 /* ForInStatement */: - return parent.variable === node || parent.expression === node; - case 142 /* TypeAssertion */: - return node === parent.operand; - default: - if (isExpression(parent)) { - return true; - } - } - } - return false; - } - ts.isExpression = isExpression; function createDiagnosticForNode(node, message, arg0, arg1, arg2) { node = getErrorSpanForNode(node); var file = getSourceFileOfNode(node); - var start = node.kind === 116 /* Missing */ ? node.pos : ts.skipTrivia(file.text, node.pos); + var start = node.kind === 120 /* Missing */ ? node.pos : ts.skipTrivia(file.text, node.pos); var length = node.end - start; return ts.createFileDiagnostic(file, start, length, message, arg0, arg1, arg2); } @@ -2585,12 +2603,12 @@ var ts; function getErrorSpanForNode(node) { var errorSpan; switch (node.kind) { - case 174 /* VariableDeclaration */: - case 177 /* ClassDeclaration */: - case 178 /* InterfaceDeclaration */: - case 181 /* ModuleDeclaration */: - case 180 /* EnumDeclaration */: - case 185 /* EnumMember */: + case 181 /* VariableDeclaration */: + case 184 /* ClassDeclaration */: + case 185 /* InterfaceDeclaration */: + case 188 /* ModuleDeclaration */: + case 187 /* EnumDeclaration */: + case 192 /* EnumMember */: errorSpan = node.name; break; } @@ -2605,12 +2623,16 @@ var ts; return (file.flags & 1024 /* DeclarationFile */) !== 0; } ts.isDeclarationFile = isDeclarationFile; + function isConstEnumDeclaration(node) { + return (node.flags & 4096 /* Const */) !== 0; + } + ts.isConstEnumDeclaration = isConstEnumDeclaration; function isPrologueDirective(node) { - return node.kind === 154 /* ExpressionStatement */ && node.expression.kind === 7 /* StringLiteral */; + return node.kind === 161 /* ExpressionStatement */ && node.expression.kind === 7 /* StringLiteral */; } ts.isPrologueDirective = isPrologueDirective; function isEvalOrArgumentsIdentifier(node) { - return node.kind === 59 /* Identifier */ && node.text && (node.text === "eval" || node.text === "arguments"); + return node.kind === 63 /* Identifier */ && node.text && (node.text === "eval" || node.text === "arguments"); } function isUseStrictPrologueDirective(node) { ts.Debug.assert(isPrologueDirective(node)); @@ -2618,7 +2640,7 @@ var ts; } function getLeadingCommentRangesOfNode(node, sourceFileOfNode) { sourceFileOfNode = sourceFileOfNode || getSourceFileOfNode(node); - if (node.kind === 119 /* Parameter */ || node.kind === 118 /* TypeParameter */) { + if (node.kind === 123 /* Parameter */ || node.kind === 122 /* TypeParameter */) { return ts.concatenate(ts.getTrailingCommentRanges(sourceFileOfNode.text, node.pos), ts.getLeadingCommentRanges(sourceFileOfNode.text, node.pos)); } else { @@ -2654,122 +2676,128 @@ var ts; if (!node) return; switch (node.kind) { - case 117 /* QualifiedName */: + case 121 /* QualifiedName */: return child(node.left) || child(node.right); - case 118 /* TypeParameter */: + case 122 /* TypeParameter */: return child(node.name) || child(node.constraint); - case 119 /* Parameter */: + case 123 /* Parameter */: return child(node.name) || child(node.type) || child(node.initializer); - case 120 /* Property */: - case 137 /* PropertyAssignment */: + case 124 /* Property */: + case 141 /* PropertyAssignment */: return child(node.name) || child(node.type) || child(node.initializer); - case 125 /* CallSignature */: - case 126 /* ConstructSignature */: - case 127 /* IndexSignature */: + case 129 /* CallSignature */: + case 130 /* ConstructSignature */: + case 131 /* IndexSignature */: return children(node.typeParameters) || children(node.parameters) || child(node.type); - case 121 /* Method */: - case 122 /* Constructor */: - case 123 /* GetAccessor */: - case 124 /* SetAccessor */: - case 144 /* FunctionExpression */: - case 175 /* FunctionDeclaration */: - case 145 /* ArrowFunction */: + case 125 /* Method */: + case 126 /* Constructor */: + case 127 /* GetAccessor */: + case 128 /* SetAccessor */: + case 149 /* FunctionExpression */: + case 182 /* FunctionDeclaration */: + case 150 /* ArrowFunction */: return child(node.name) || children(node.typeParameters) || children(node.parameters) || child(node.type) || child(node.body); - case 128 /* TypeReference */: + case 132 /* TypeReference */: return child(node.typeName) || children(node.typeArguments); - case 129 /* TypeQuery */: + case 133 /* TypeQuery */: return child(node.exprName); - case 130 /* TypeLiteral */: + case 134 /* TypeLiteral */: return children(node.members); - case 131 /* ArrayType */: + case 135 /* ArrayType */: return child(node.elementType); - case 132 /* TupleType */: + case 136 /* TupleType */: return children(node.elementTypes); - case 133 /* UnionType */: + case 137 /* UnionType */: return children(node.types); - case 134 /* ParenType */: + case 138 /* ParenType */: return child(node.type); - case 135 /* ArrayLiteral */: + case 139 /* ArrayLiteral */: return children(node.elements); - case 136 /* ObjectLiteral */: + case 140 /* ObjectLiteral */: return children(node.properties); - case 138 /* PropertyAccess */: + case 142 /* PropertyAccess */: return child(node.left) || child(node.right); - case 139 /* IndexedAccess */: + case 143 /* IndexedAccess */: return child(node.object) || child(node.index); - case 140 /* CallExpression */: - case 141 /* NewExpression */: + case 144 /* CallExpression */: + case 145 /* NewExpression */: return child(node.func) || children(node.typeArguments) || children(node.arguments); - case 142 /* TypeAssertion */: + case 146 /* TaggedTemplateExpression */: + return child(node.tag) || child(node.template); + case 147 /* TypeAssertion */: return child(node.type) || child(node.operand); - case 143 /* ParenExpression */: + case 148 /* ParenExpression */: return child(node.expression); - case 146 /* PrefixOperator */: - case 147 /* PostfixOperator */: + case 151 /* PrefixOperator */: + case 152 /* PostfixOperator */: return child(node.operand); - case 148 /* BinaryExpression */: + case 153 /* BinaryExpression */: return child(node.left) || child(node.right); - case 149 /* ConditionalExpression */: + case 154 /* ConditionalExpression */: return child(node.condition) || child(node.whenTrue) || child(node.whenFalse); - case 151 /* Block */: - case 170 /* TryBlock */: - case 172 /* FinallyBlock */: - case 176 /* FunctionBlock */: - case 182 /* ModuleBlock */: - case 186 /* SourceFile */: + case 158 /* Block */: + case 177 /* TryBlock */: + case 179 /* FinallyBlock */: + case 183 /* FunctionBlock */: + case 189 /* ModuleBlock */: + case 193 /* SourceFile */: return children(node.statements); - case 152 /* VariableStatement */: + case 159 /* VariableStatement */: return children(node.declarations); - case 154 /* ExpressionStatement */: + case 161 /* ExpressionStatement */: return child(node.expression); - case 155 /* IfStatement */: + case 162 /* IfStatement */: return child(node.expression) || child(node.thenStatement) || child(node.elseStatement); - case 156 /* DoStatement */: + case 163 /* DoStatement */: return child(node.statement) || child(node.expression); - case 157 /* WhileStatement */: + case 164 /* WhileStatement */: return child(node.expression) || child(node.statement); - case 158 /* ForStatement */: + case 165 /* ForStatement */: return children(node.declarations) || child(node.initializer) || child(node.condition) || child(node.iterator) || child(node.statement); - case 159 /* ForInStatement */: + case 166 /* ForInStatement */: return child(node.declaration) || child(node.variable) || child(node.expression) || child(node.statement); - case 160 /* ContinueStatement */: - case 161 /* BreakStatement */: + case 167 /* ContinueStatement */: + case 168 /* BreakStatement */: return child(node.label); - case 162 /* ReturnStatement */: + case 169 /* ReturnStatement */: return child(node.expression); - case 163 /* WithStatement */: + case 170 /* WithStatement */: return child(node.expression) || child(node.statement); - case 164 /* SwitchStatement */: + case 171 /* SwitchStatement */: return child(node.expression) || children(node.clauses); - case 165 /* CaseClause */: - case 166 /* DefaultClause */: + case 172 /* CaseClause */: + case 173 /* DefaultClause */: return child(node.expression) || children(node.statements); - case 167 /* LabeledStatement */: + case 174 /* LabeledStatement */: return child(node.label) || child(node.statement); - case 168 /* ThrowStatement */: + case 175 /* ThrowStatement */: return child(node.expression); - case 169 /* TryStatement */: + case 176 /* TryStatement */: return child(node.tryBlock) || child(node.catchBlock) || child(node.finallyBlock); - case 171 /* CatchBlock */: + case 178 /* CatchBlock */: return child(node.variable) || children(node.statements); - case 174 /* VariableDeclaration */: + case 181 /* VariableDeclaration */: return child(node.name) || child(node.type) || child(node.initializer); - case 177 /* ClassDeclaration */: + case 184 /* ClassDeclaration */: return child(node.name) || children(node.typeParameters) || child(node.baseType) || children(node.implementedTypes) || children(node.members); - case 178 /* InterfaceDeclaration */: + case 185 /* InterfaceDeclaration */: return child(node.name) || children(node.typeParameters) || children(node.baseTypes) || children(node.members); - case 179 /* TypeAliasDeclaration */: + case 186 /* TypeAliasDeclaration */: return child(node.name) || child(node.type); - case 180 /* EnumDeclaration */: + case 187 /* EnumDeclaration */: return child(node.name) || children(node.members); - case 185 /* EnumMember */: + case 192 /* EnumMember */: return child(node.name) || child(node.initializer); - case 181 /* ModuleDeclaration */: + case 188 /* ModuleDeclaration */: return child(node.name) || child(node.body); - case 183 /* ImportDeclaration */: + case 190 /* ImportDeclaration */: return child(node.name) || child(node.entityName) || child(node.externalModuleName); - case 184 /* ExportAssignment */: + case 191 /* ExportAssignment */: return child(node.exportName); + case 155 /* TemplateExpression */: + return child(node.head) || children(node.templateSpans); + case 156 /* TemplateSpan */: + return child(node.expression) || child(node.literal); } } ts.forEachChild = forEachChild; @@ -2777,24 +2805,24 @@ var ts; return traverse(body); function traverse(node) { switch (node.kind) { - case 162 /* ReturnStatement */: + case 169 /* ReturnStatement */: return visitor(node); - case 151 /* Block */: - case 176 /* FunctionBlock */: - case 155 /* IfStatement */: - case 156 /* DoStatement */: - case 157 /* WhileStatement */: - case 158 /* ForStatement */: - case 159 /* ForInStatement */: - case 163 /* WithStatement */: - case 164 /* SwitchStatement */: - case 165 /* CaseClause */: - case 166 /* DefaultClause */: - case 167 /* LabeledStatement */: - case 169 /* TryStatement */: - case 170 /* TryBlock */: - case 171 /* CatchBlock */: - case 172 /* FinallyBlock */: + case 158 /* Block */: + case 183 /* FunctionBlock */: + case 162 /* IfStatement */: + case 163 /* DoStatement */: + case 164 /* WhileStatement */: + case 165 /* ForStatement */: + case 166 /* ForInStatement */: + case 170 /* WithStatement */: + case 171 /* SwitchStatement */: + case 172 /* CaseClause */: + case 173 /* DefaultClause */: + case 174 /* LabeledStatement */: + case 176 /* TryStatement */: + case 177 /* TryBlock */: + case 178 /* CatchBlock */: + case 179 /* FinallyBlock */: return forEachChild(node, traverse); } } @@ -2803,13 +2831,13 @@ var ts; function isAnyFunction(node) { if (node) { switch (node.kind) { - case 144 /* FunctionExpression */: - case 175 /* FunctionDeclaration */: - case 145 /* ArrowFunction */: - case 121 /* Method */: - case 123 /* GetAccessor */: - case 124 /* SetAccessor */: - case 122 /* Constructor */: + case 149 /* FunctionExpression */: + case 182 /* FunctionDeclaration */: + case 150 /* ArrowFunction */: + case 125 /* Method */: + case 127 /* GetAccessor */: + case 128 /* SetAccessor */: + case 126 /* Constructor */: return true; } } @@ -2832,20 +2860,20 @@ var ts; return undefined; } switch (node.kind) { - case 145 /* ArrowFunction */: + case 150 /* ArrowFunction */: if (!includeArrowFunctions) { continue; } - case 175 /* FunctionDeclaration */: - case 144 /* FunctionExpression */: - case 181 /* ModuleDeclaration */: - case 120 /* Property */: - case 121 /* Method */: - case 122 /* Constructor */: - case 123 /* GetAccessor */: - case 124 /* SetAccessor */: - case 180 /* EnumDeclaration */: - case 186 /* SourceFile */: + case 182 /* FunctionDeclaration */: + case 149 /* FunctionExpression */: + case 188 /* ModuleDeclaration */: + case 124 /* Property */: + case 125 /* Method */: + case 126 /* Constructor */: + case 127 /* GetAccessor */: + case 128 /* SetAccessor */: + case 187 /* EnumDeclaration */: + case 193 /* SourceFile */: return node; } } @@ -2858,20 +2886,103 @@ var ts; return undefined; } switch (node.kind) { - case 120 /* Property */: - case 121 /* Method */: - case 122 /* Constructor */: - case 123 /* GetAccessor */: - case 124 /* SetAccessor */: + case 124 /* Property */: + case 125 /* Method */: + case 126 /* Constructor */: + case 127 /* GetAccessor */: + case 128 /* SetAccessor */: return node; } } } ts.getSuperContainer = getSuperContainer; + function isExpression(node) { + switch (node.kind) { + case 91 /* ThisKeyword */: + case 89 /* SuperKeyword */: + case 87 /* NullKeyword */: + case 93 /* TrueKeyword */: + case 78 /* FalseKeyword */: + case 8 /* RegularExpressionLiteral */: + case 139 /* ArrayLiteral */: + case 140 /* ObjectLiteral */: + case 142 /* PropertyAccess */: + case 143 /* IndexedAccess */: + case 144 /* CallExpression */: + case 145 /* NewExpression */: + case 146 /* TaggedTemplateExpression */: + case 147 /* TypeAssertion */: + case 148 /* ParenExpression */: + case 149 /* FunctionExpression */: + case 150 /* ArrowFunction */: + case 151 /* PrefixOperator */: + case 152 /* PostfixOperator */: + case 153 /* BinaryExpression */: + case 154 /* ConditionalExpression */: + case 155 /* TemplateExpression */: + case 157 /* OmittedExpression */: + return true; + case 121 /* QualifiedName */: + while (node.parent.kind === 121 /* QualifiedName */) + node = node.parent; + return node.parent.kind === 133 /* TypeQuery */; + case 63 /* Identifier */: + if (node.parent.kind === 133 /* TypeQuery */) { + return true; + } + case 6 /* NumericLiteral */: + case 7 /* StringLiteral */: + case 9 /* NoSubstitutionTemplateLiteral */: + var parent = node.parent; + switch (parent.kind) { + case 181 /* VariableDeclaration */: + case 123 /* Parameter */: + case 124 /* Property */: + case 192 /* EnumMember */: + case 141 /* PropertyAssignment */: + return parent.initializer === node; + case 161 /* ExpressionStatement */: + case 162 /* IfStatement */: + case 163 /* DoStatement */: + case 164 /* WhileStatement */: + case 169 /* ReturnStatement */: + case 170 /* WithStatement */: + case 171 /* SwitchStatement */: + case 172 /* CaseClause */: + case 175 /* ThrowStatement */: + case 171 /* SwitchStatement */: + return parent.expression === node; + case 165 /* ForStatement */: + return parent.initializer === node || parent.condition === node || parent.iterator === node; + case 166 /* ForInStatement */: + return parent.variable === node || parent.expression === node; + case 147 /* TypeAssertion */: + return node === parent.operand; + default: + if (isExpression(parent)) { + return true; + } + } + } + return false; + } + ts.isExpression = isExpression; function hasRestParameters(s) { return s.parameters.length > 0 && (s.parameters[s.parameters.length - 1].flags & 8 /* Rest */) !== 0; } ts.hasRestParameters = hasRestParameters; + function isLiteralKind(kind) { + return ts.SyntaxKind.FirstLiteralToken <= kind && kind <= ts.SyntaxKind.LastLiteralToken; + } + ts.isLiteralKind = isLiteralKind; + function isTextualLiteralKind(kind) { + return kind === 7 /* StringLiteral */ || kind === 9 /* NoSubstitutionTemplateLiteral */; + } + ts.isTextualLiteralKind = isTextualLiteralKind; + function isTemplateLiteralKind(kind) { + return ts.SyntaxKind.FirstTemplateToken <= kind && kind <= ts.SyntaxKind.LastTemplateToken; + } + ts.isTemplateLiteralKind = isTemplateLiteralKind; function isInAmbientContext(node) { while (node) { if (node.flags & (2 /* Ambient */ | 1024 /* DeclarationFile */)) @@ -2883,22 +2994,22 @@ var ts; ts.isInAmbientContext = isInAmbientContext; function isDeclaration(node) { switch (node.kind) { - case 118 /* TypeParameter */: - case 119 /* Parameter */: - case 174 /* VariableDeclaration */: - case 120 /* Property */: - case 137 /* PropertyAssignment */: - case 185 /* EnumMember */: - case 121 /* Method */: - case 175 /* FunctionDeclaration */: - case 123 /* GetAccessor */: - case 124 /* SetAccessor */: - case 177 /* ClassDeclaration */: - case 178 /* InterfaceDeclaration */: - case 179 /* TypeAliasDeclaration */: - case 180 /* EnumDeclaration */: - case 181 /* ModuleDeclaration */: - case 183 /* ImportDeclaration */: + case 122 /* TypeParameter */: + case 123 /* Parameter */: + case 181 /* VariableDeclaration */: + case 124 /* Property */: + case 141 /* PropertyAssignment */: + case 192 /* EnumMember */: + case 125 /* Method */: + case 182 /* FunctionDeclaration */: + case 127 /* GetAccessor */: + case 128 /* SetAccessor */: + case 184 /* ClassDeclaration */: + case 185 /* InterfaceDeclaration */: + case 186 /* TypeAliasDeclaration */: + case 187 /* EnumDeclaration */: + case 188 /* ModuleDeclaration */: + case 190 /* ImportDeclaration */: return true; } return false; @@ -2906,24 +3017,24 @@ var ts; ts.isDeclaration = isDeclaration; function isStatement(n) { switch (n.kind) { - case 161 /* BreakStatement */: - case 160 /* ContinueStatement */: - case 173 /* DebuggerStatement */: - case 156 /* DoStatement */: - case 154 /* ExpressionStatement */: - case 153 /* EmptyStatement */: - case 159 /* ForInStatement */: - case 158 /* ForStatement */: - case 155 /* IfStatement */: - case 167 /* LabeledStatement */: - case 162 /* ReturnStatement */: - case 164 /* SwitchStatement */: - case 88 /* ThrowKeyword */: - case 169 /* TryStatement */: - case 152 /* VariableStatement */: - case 157 /* WhileStatement */: - case 163 /* WithStatement */: - case 184 /* ExportAssignment */: + case 168 /* BreakStatement */: + case 167 /* ContinueStatement */: + case 180 /* DebuggerStatement */: + case 163 /* DoStatement */: + case 161 /* ExpressionStatement */: + case 160 /* EmptyStatement */: + case 166 /* ForInStatement */: + case 165 /* ForStatement */: + case 162 /* IfStatement */: + case 174 /* LabeledStatement */: + case 169 /* ReturnStatement */: + case 171 /* SwitchStatement */: + case 92 /* ThrowKeyword */: + case 176 /* TryStatement */: + case 159 /* VariableStatement */: + case 164 /* WhileStatement */: + case 170 /* WithStatement */: + case 191 /* ExportAssignment */: return true; default: return false; @@ -2931,14 +3042,14 @@ var ts; } ts.isStatement = isStatement; function isDeclarationOrFunctionExpressionOrCatchVariableName(name) { - if (name.kind !== 59 /* Identifier */ && name.kind !== 7 /* StringLiteral */ && name.kind !== 6 /* NumericLiteral */) { + if (name.kind !== 63 /* Identifier */ && name.kind !== 7 /* StringLiteral */ && name.kind !== 6 /* NumericLiteral */) { return false; } var parent = name.parent; - if (isDeclaration(parent) || parent.kind === 144 /* FunctionExpression */) { + if (isDeclaration(parent) || parent.kind === 149 /* FunctionExpression */) { return parent.name === name; } - if (parent.kind === 171 /* CatchBlock */) { + if (parent.kind === 178 /* CatchBlock */) { return parent.variable === name; } return false; @@ -2946,16 +3057,16 @@ var ts; ts.isDeclarationOrFunctionExpressionOrCatchVariableName = isDeclarationOrFunctionExpressionOrCatchVariableName; function getAncestor(node, kind) { switch (kind) { - case 177 /* ClassDeclaration */: + case 184 /* ClassDeclaration */: while (node) { switch (node.kind) { - case 177 /* ClassDeclaration */: + case 184 /* ClassDeclaration */: return node; - case 180 /* EnumDeclaration */: - case 178 /* InterfaceDeclaration */: - case 179 /* TypeAliasDeclaration */: - case 181 /* ModuleDeclaration */: - case 183 /* ImportDeclaration */: + case 187 /* EnumDeclaration */: + case 185 /* InterfaceDeclaration */: + case 186 /* TypeAliasDeclaration */: + case 188 /* ModuleDeclaration */: + case 190 /* ImportDeclaration */: return undefined; default: node = node.parent; @@ -3004,40 +3115,23 @@ var ts; })(Tristate || (Tristate = {})); function parsingContextErrors(context) { switch (context) { - case 0 /* SourceElements */: - return ts.Diagnostics.Declaration_or_statement_expected; - case 1 /* ModuleElements */: - return ts.Diagnostics.Declaration_or_statement_expected; - case 2 /* BlockStatements */: - return ts.Diagnostics.Statement_expected; - case 3 /* SwitchClauses */: - return ts.Diagnostics.case_or_default_expected; - case 4 /* SwitchClauseStatements */: - return ts.Diagnostics.Statement_expected; - case 5 /* TypeMembers */: - return ts.Diagnostics.Property_or_signature_expected; - case 6 /* ClassMembers */: - return ts.Diagnostics.Unexpected_token_A_constructor_method_accessor_or_property_was_expected; - case 7 /* EnumMembers */: - return ts.Diagnostics.Enum_member_expected; - case 8 /* BaseTypeReferences */: - return ts.Diagnostics.Type_reference_expected; - case 9 /* VariableDeclarations */: - return ts.Diagnostics.Variable_declaration_expected; - case 10 /* ArgumentExpressions */: - return ts.Diagnostics.Argument_expression_expected; - case 11 /* ObjectLiteralMembers */: - return ts.Diagnostics.Property_assignment_expected; - case 12 /* ArrayLiteralMembers */: - return ts.Diagnostics.Expression_or_comma_expected; - case 13 /* Parameters */: - return ts.Diagnostics.Parameter_declaration_expected; - case 14 /* TypeParameters */: - return ts.Diagnostics.Type_parameter_declaration_expected; - case 15 /* TypeArguments */: - return ts.Diagnostics.Type_argument_expected; - case 16 /* TupleElementTypes */: - return ts.Diagnostics.Type_expected; + case 0 /* SourceElements */: return ts.Diagnostics.Declaration_or_statement_expected; + case 1 /* ModuleElements */: return ts.Diagnostics.Declaration_or_statement_expected; + case 2 /* BlockStatements */: return ts.Diagnostics.Statement_expected; + case 3 /* SwitchClauses */: return ts.Diagnostics.case_or_default_expected; + case 4 /* SwitchClauseStatements */: return ts.Diagnostics.Statement_expected; + case 5 /* TypeMembers */: return ts.Diagnostics.Property_or_signature_expected; + case 6 /* ClassMembers */: return ts.Diagnostics.Unexpected_token_A_constructor_method_accessor_or_property_was_expected; + case 7 /* EnumMembers */: return ts.Diagnostics.Enum_member_expected; + case 8 /* BaseTypeReferences */: return ts.Diagnostics.Type_reference_expected; + case 9 /* VariableDeclarations */: return ts.Diagnostics.Variable_declaration_expected; + case 10 /* ArgumentExpressions */: return ts.Diagnostics.Argument_expression_expected; + case 11 /* ObjectLiteralMembers */: return ts.Diagnostics.Property_assignment_expected; + case 12 /* ArrayLiteralMembers */: return ts.Diagnostics.Expression_or_comma_expected; + case 13 /* Parameters */: return ts.Diagnostics.Parameter_declaration_expected; + case 14 /* TypeParameters */: return ts.Diagnostics.Type_parameter_declaration_expected; + case 15 /* TypeArguments */: return ts.Diagnostics.Type_argument_expected; + case 16 /* TupleElementTypes */: return ts.Diagnostics.Type_expected; } } ; @@ -3070,12 +3164,12 @@ var ts; ts.isTrivia = isTrivia; function isModifier(token) { switch (token) { - case 102 /* PublicKeyword */: - case 100 /* PrivateKeyword */: - case 101 /* ProtectedKeyword */: - case 103 /* StaticKeyword */: - case 72 /* ExportKeyword */: - case 108 /* DeclareKeyword */: + case 106 /* PublicKeyword */: + case 104 /* PrivateKeyword */: + case 105 /* ProtectedKeyword */: + case 107 /* StaticKeyword */: + case 76 /* ExportKeyword */: + case 112 /* DeclareKeyword */: return true; } return false; @@ -3237,6 +3331,9 @@ var ts; function reScanSlashToken() { return token = scanner.reScanSlashToken(); } + function reScanTemplateToken() { + return token = scanner.reScanTemplateToken(); + } function lookAheadHelper(callback, alwaysResetState) { var saveToken = token; var saveSyntacticErrorsLength = file.syntacticErrors.length; @@ -3266,7 +3363,7 @@ var ts; return scanner.tryScan(function () { return lookAheadHelper(callback, false); }); } function isIdentifier() { - return token === 59 /* Identifier */ || (isInStrictMode ? token > ts.SyntaxKind.LastFutureReservedWord : token > ts.SyntaxKind.LastReservedWord); + return token === 63 /* Identifier */ || (isInStrictMode ? token > ts.SyntaxKind.LastFutureReservedWord : token > ts.SyntaxKind.LastReservedWord); } function parseExpected(t) { if (token === t) { @@ -3284,14 +3381,14 @@ var ts; return false; } function canParseSemicolon() { - if (token === 17 /* SemicolonToken */) { + if (token === 21 /* SemicolonToken */) { return true; } - return token === 10 /* CloseBraceToken */ || token === 1 /* EndOfFileToken */ || scanner.hasPrecedingLineBreak(); + return token === 14 /* CloseBraceToken */ || token === 1 /* EndOfFileToken */ || scanner.hasPrecedingLineBreak(); } function parseSemicolon() { if (canParseSemicolon()) { - if (token === 17 /* SemicolonToken */) { + if (token === 21 /* SemicolonToken */) { nextToken(); } } @@ -3313,7 +3410,7 @@ var ts; return node; } function createMissingNode() { - return createNode(116 /* Missing */); + return createNode(120 /* Missing */); } function internIdentifier(text) { return ts.hasProperty(identifiers, text) ? identifiers[text] : (identifiers[text] = text); @@ -3321,7 +3418,7 @@ var ts; function createIdentifier(isIdentifier) { identifierCount++; if (isIdentifier) { - var node = createNode(59 /* Identifier */); + var node = createNode(63 /* Identifier */); var text = escapeIdentifier(scanner.getTokenValue()); node.text = internIdentifier(text); nextToken(); @@ -3336,10 +3433,10 @@ var ts; return createIdentifier(isIdentifier()); } function parseIdentifierName() { - return createIdentifier(token >= 59 /* Identifier */); + return createIdentifier(token >= 63 /* Identifier */); } function isPropertyName() { - return token >= 59 /* Identifier */ || token === 7 /* StringLiteral */ || token === 6 /* NumericLiteral */; + return token >= 63 /* Identifier */ || token === 7 /* StringLiteral */ || token === 6 /* NumericLiteral */; } function parsePropertyName() { if (token === 7 /* StringLiteral */ || token === 6 /* NumericLiteral */) { @@ -3350,13 +3447,13 @@ var ts; function parseContextualModifier(t) { return token === t && tryParse(function () { nextToken(); - return token === 13 /* OpenBracketToken */ || isPropertyName(); + return token === 17 /* OpenBracketToken */ || isPropertyName(); }); } function parseAnyContextualModifier() { return isModifier(token) && tryParse(function () { nextToken(); - return token === 13 /* OpenBracketToken */ || isPropertyName(); + return token === 17 /* OpenBracketToken */ || isPropertyName(); }); } function isListElement(kind, inErrorRecovery) { @@ -3368,28 +3465,28 @@ var ts; case 4 /* SwitchClauseStatements */: return isStatement(inErrorRecovery); case 3 /* SwitchClauses */: - return token === 61 /* CaseKeyword */ || token === 67 /* DefaultKeyword */; + return token === 65 /* CaseKeyword */ || token === 71 /* DefaultKeyword */; case 5 /* TypeMembers */: - return isTypeMember(); + return isStartOfTypeMember(); case 6 /* ClassMembers */: return lookAhead(isClassMemberStart); case 7 /* EnumMembers */: case 11 /* ObjectLiteralMembers */: return isPropertyName(); case 8 /* BaseTypeReferences */: - return isIdentifier() && ((token !== 73 /* ExtendsKeyword */ && token !== 96 /* ImplementsKeyword */) || !lookAhead(function () { return (nextToken(), isIdentifier()); })); + return isIdentifier() && ((token !== 77 /* ExtendsKeyword */ && token !== 100 /* ImplementsKeyword */) || !lookAhead(function () { return (nextToken(), isIdentifier()); })); case 9 /* VariableDeclarations */: case 14 /* TypeParameters */: return isIdentifier(); case 10 /* ArgumentExpressions */: - return token === 18 /* CommaToken */ || isExpression(); + return token === 22 /* CommaToken */ || isStartOfExpression(); case 12 /* ArrayLiteralMembers */: - return token === 18 /* CommaToken */ || isExpression(); + return token === 22 /* CommaToken */ || isStartOfExpression(); case 13 /* Parameters */: - return isParameter(); + return isStartOfParameter(); case 15 /* TypeArguments */: case 16 /* TupleElementTypes */: - return token === 18 /* CommaToken */ || isType(); + return token === 22 /* CommaToken */ || isStartOfType(); } ts.Debug.fail("Non-exhaustive case in 'isListElement'."); } @@ -3405,34 +3502,34 @@ var ts; case 6 /* ClassMembers */: case 7 /* EnumMembers */: case 11 /* ObjectLiteralMembers */: - return token === 10 /* CloseBraceToken */; + return token === 14 /* CloseBraceToken */; case 4 /* SwitchClauseStatements */: - return token === 10 /* CloseBraceToken */ || token === 61 /* CaseKeyword */ || token === 67 /* DefaultKeyword */; + return token === 14 /* CloseBraceToken */ || token === 65 /* CaseKeyword */ || token === 71 /* DefaultKeyword */; case 8 /* BaseTypeReferences */: - return token === 9 /* OpenBraceToken */ || token === 73 /* ExtendsKeyword */ || token === 96 /* ImplementsKeyword */; + return token === 13 /* OpenBraceToken */ || token === 77 /* ExtendsKeyword */ || token === 100 /* ImplementsKeyword */; case 9 /* VariableDeclarations */: return isVariableDeclaratorListTerminator(); case 14 /* TypeParameters */: - return token === 20 /* GreaterThanToken */ || token === 11 /* OpenParenToken */ || token === 9 /* OpenBraceToken */ || token === 73 /* ExtendsKeyword */ || token === 96 /* ImplementsKeyword */; + return token === 24 /* GreaterThanToken */ || token === 15 /* OpenParenToken */ || token === 13 /* OpenBraceToken */ || token === 77 /* ExtendsKeyword */ || token === 100 /* ImplementsKeyword */; case 10 /* ArgumentExpressions */: - return token === 12 /* CloseParenToken */ || token === 17 /* SemicolonToken */; + return token === 16 /* CloseParenToken */ || token === 21 /* SemicolonToken */; case 12 /* ArrayLiteralMembers */: case 16 /* TupleElementTypes */: - return token === 14 /* CloseBracketToken */; + return token === 18 /* CloseBracketToken */; case 13 /* Parameters */: - return token === 12 /* CloseParenToken */ || token === 14 /* CloseBracketToken */ || token === 9 /* OpenBraceToken */; + return token === 16 /* CloseParenToken */ || token === 18 /* CloseBracketToken */ || token === 13 /* OpenBraceToken */; case 15 /* TypeArguments */: - return token === 20 /* GreaterThanToken */ || token === 11 /* OpenParenToken */; + return token === 24 /* GreaterThanToken */ || token === 15 /* OpenParenToken */; } } function isVariableDeclaratorListTerminator() { if (canParseSemicolon()) { return true; } - if (token === 80 /* InKeyword */) { + if (token === 84 /* InKeyword */) { return true; } - if (token === 27 /* EqualsGreaterThanToken */) { + if (token === 31 /* EqualsGreaterThanToken */) { return true; } return false; @@ -3493,7 +3590,7 @@ var ts; if (isListElement(kind, false)) { result.push(parseElement()); commaStart = scanner.getTokenPos(); - if (parseOptional(18 /* CommaToken */)) { + if (parseOptional(22 /* CommaToken */)) { continue; } commaStart = -1; @@ -3548,8 +3645,8 @@ var ts; } function parseEntityName(allowReservedWords) { var entity = parseIdentifier(); - while (parseOptional(15 /* DotToken */)) { - var node = createNode(117 /* QualifiedName */, entity.pos); + while (parseOptional(19 /* DotToken */)) { + var node = createNode(121 /* QualifiedName */, entity.pos); node.left = entity; node.right = allowReservedWords ? parseIdentifierName() : parseIdentifier(); entity = finishNode(node); @@ -3561,6 +3658,35 @@ var ts; nextToken(); return finishNode(node); } + function parseTemplateExpression() { + var template = createNode(155 /* TemplateExpression */); + template.head = parseLiteralNode(); + ts.Debug.assert(template.head.kind === 10 /* TemplateHead */, "Template head has wrong token kind"); + var templateSpans = []; + templateSpans.pos = getNodePos(); + do { + templateSpans.push(parseTemplateSpan()); + } while (templateSpans[templateSpans.length - 1].literal.kind === 11 /* TemplateMiddle */); + templateSpans.end = getNodeEnd(); + template.templateSpans = templateSpans; + return finishNode(template); + } + function parseTemplateSpan() { + var span = createNode(156 /* TemplateSpan */); + span.expression = parseExpression(false); + var literal; + if (token === 14 /* CloseBraceToken */) { + reScanTemplateToken(); + literal = parseLiteralNode(); + } + else { + error(ts.Diagnostics.Invalid_template_literal_expected); + literal = createMissingNode(); + literal.text = ""; + } + span.literal = literal; + return finishNode(span); + } function parseLiteralNode(internName) { var node = createNode(token); var text = scanner.getTokenValue(); @@ -3579,30 +3705,31 @@ var ts; return node; } function parseStringLiteral() { - if (token === 7 /* StringLiteral */) + if (token === 7 /* StringLiteral */) { return parseLiteralNode(true); + } error(ts.Diagnostics.String_literal_expected); return createMissingNode(); } function parseTypeReference() { - var node = createNode(128 /* TypeReference */); + var node = createNode(132 /* TypeReference */); node.typeName = parseEntityName(false); - if (!scanner.hasPrecedingLineBreak() && token === 19 /* LessThanToken */) { + if (!scanner.hasPrecedingLineBreak() && token === 23 /* LessThanToken */) { node.typeArguments = parseTypeArguments(); } return finishNode(node); } function parseTypeQuery() { - var node = createNode(129 /* TypeQuery */); - parseExpected(91 /* TypeOfKeyword */); + var node = createNode(133 /* TypeQuery */); + parseExpected(95 /* TypeOfKeyword */); node.exprName = parseEntityName(true); return finishNode(node); } function parseTypeParameter() { - var node = createNode(118 /* TypeParameter */); + var node = createNode(122 /* TypeParameter */); node.name = parseIdentifier(); - if (parseOptional(73 /* ExtendsKeyword */)) { - if (isType() || !isExpression()) { + if (parseOptional(77 /* ExtendsKeyword */)) { + if (isStartOfType() || !isStartOfExpression()) { node.constraint = parseType(); } else { @@ -3613,9 +3740,9 @@ var ts; return finishNode(node); } function parseTypeParameters() { - if (token === 19 /* LessThanToken */) { + if (token === 23 /* LessThanToken */) { var pos = getNodePos(); - var result = parseBracketedList(14 /* TypeParameters */, parseTypeParameter, 19 /* LessThanToken */, 20 /* GreaterThanToken */); + var result = parseBracketedList(14 /* TypeParameters */, parseTypeParameter, 23 /* LessThanToken */, 24 /* GreaterThanToken */); if (!result.length) { var start = getTokenPos(pos); var length = getNodePos() - start; @@ -3625,23 +3752,23 @@ var ts; } } function parseParameterType() { - return parseOptional(46 /* ColonToken */) ? token === 7 /* StringLiteral */ ? parseStringLiteral() : parseType() : undefined; + return parseOptional(50 /* ColonToken */) ? token === 7 /* StringLiteral */ ? parseStringLiteral() : parseType() : undefined; } - function isParameter() { - return token === 16 /* DotDotDotToken */ || isIdentifier() || isModifier(token); + function isStartOfParameter() { + return token === 20 /* DotDotDotToken */ || isIdentifier() || isModifier(token); } function parseParameter(flags) { if (flags === void 0) { flags = 0; } - var node = createNode(119 /* Parameter */); + var node = createNode(123 /* Parameter */); node.flags |= parseAndCheckModifiers(3 /* Parameters */); - if (parseOptional(16 /* DotDotDotToken */)) { + if (parseOptional(20 /* DotDotDotToken */)) { node.flags |= 8 /* Rest */; } node.name = parseIdentifier(); - if (node.name.kind === 116 /* Missing */ && node.flags === 0 && isModifier(token)) { + if (node.name.kind === 120 /* Missing */ && node.flags === 0 && isModifier(token)) { nextToken(); } - if (parseOptional(45 /* QuestionToken */)) { + if (parseOptional(49 /* QuestionToken */)) { node.flags |= 4 /* QuestionMark */; } node.type = parseParameterType(); @@ -3649,11 +3776,11 @@ var ts; return finishNode(node); } function parseSignature(kind, returnToken, returnTokenRequired) { - if (kind === 126 /* ConstructSignature */) { - parseExpected(82 /* NewKeyword */); + if (kind === 130 /* ConstructSignature */) { + parseExpected(86 /* NewKeyword */); } var typeParameters = parseTypeParameters(); - var parameters = parseParameterList(11 /* OpenParenToken */, 12 /* CloseParenToken */); + var parameters = parseParameterList(15 /* OpenParenToken */, 16 /* CloseParenToken */); checkParameterList(parameters); var type; if (returnTokenRequired) { @@ -3720,10 +3847,10 @@ var ts; return finishNode(node); } function parseIndexSignatureMember() { - var node = createNode(127 /* IndexSignature */); + var node = createNode(131 /* IndexSignature */); var errorCountBeforeIndexSignature = file.syntacticErrors.length; var indexerStart = scanner.getTokenPos(); - node.parameters = parseParameterList(13 /* OpenBracketToken */, 14 /* CloseBracketToken */); + node.parameters = parseParameterList(17 /* OpenBracketToken */, 18 /* CloseBracketToken */); var indexerLength = scanner.getStartPos() - indexerStart; node.type = parseTypeAnnotation(); parseSemicolon(); @@ -3764,7 +3891,7 @@ var ts; grammarErrorOnNode(parameter.name, ts.Diagnostics.An_index_signature_parameter_must_have_a_type_annotation); return; } - else if (parameter.type.kind !== 114 /* StringKeyword */ && parameter.type.kind !== 112 /* NumberKeyword */) { + else if (parameter.type.kind !== 118 /* StringKeyword */ && parameter.type.kind !== 116 /* NumberKeyword */) { grammarErrorOnNode(parameter.name, ts.Diagnostics.An_index_signature_parameter_type_must_be_string_or_number); return; } @@ -3776,58 +3903,58 @@ var ts; function parsePropertyOrMethod() { var node = createNode(0 /* Unknown */); node.name = parsePropertyName(); - if (parseOptional(45 /* QuestionToken */)) { + if (parseOptional(49 /* QuestionToken */)) { node.flags |= 4 /* QuestionMark */; } - if (token === 11 /* OpenParenToken */ || token === 19 /* LessThanToken */) { - node.kind = 121 /* Method */; - var sig = parseSignature(125 /* CallSignature */, 46 /* ColonToken */, false); + if (token === 15 /* OpenParenToken */ || token === 23 /* LessThanToken */) { + node.kind = 125 /* Method */; + var sig = parseSignature(129 /* CallSignature */, 50 /* ColonToken */, false); node.typeParameters = sig.typeParameters; node.parameters = sig.parameters; node.type = sig.type; } else { - node.kind = 120 /* Property */; + node.kind = 124 /* Property */; node.type = parseTypeAnnotation(); } parseSemicolon(); return finishNode(node); } - function isTypeMember() { + function isStartOfTypeMember() { switch (token) { - case 11 /* OpenParenToken */: - case 19 /* LessThanToken */: - case 13 /* OpenBracketToken */: + case 15 /* OpenParenToken */: + case 23 /* LessThanToken */: + case 17 /* OpenBracketToken */: return true; default: - return isPropertyName() && lookAhead(function () { return nextToken() === 11 /* OpenParenToken */ || token === 19 /* LessThanToken */ || token === 45 /* QuestionToken */ || token === 46 /* ColonToken */ || canParseSemicolon(); }); + return isPropertyName() && lookAhead(function () { return nextToken() === 15 /* OpenParenToken */ || token === 23 /* LessThanToken */ || token === 49 /* QuestionToken */ || token === 50 /* ColonToken */ || canParseSemicolon(); }); } } function parseTypeMember() { switch (token) { - case 11 /* OpenParenToken */: - case 19 /* LessThanToken */: - return parseSignatureMember(125 /* CallSignature */, 46 /* ColonToken */); - case 13 /* OpenBracketToken */: + case 15 /* OpenParenToken */: + case 23 /* LessThanToken */: + return parseSignatureMember(129 /* CallSignature */, 50 /* ColonToken */); + case 17 /* OpenBracketToken */: return parseIndexSignatureMember(); - case 82 /* NewKeyword */: - if (lookAhead(function () { return nextToken() === 11 /* OpenParenToken */ || token === 19 /* LessThanToken */; })) { - return parseSignatureMember(126 /* ConstructSignature */, 46 /* ColonToken */); + case 86 /* NewKeyword */: + if (lookAhead(function () { return nextToken() === 15 /* OpenParenToken */ || token === 23 /* LessThanToken */; })) { + return parseSignatureMember(130 /* ConstructSignature */, 50 /* ColonToken */); } case 7 /* StringLiteral */: case 6 /* NumericLiteral */: return parsePropertyOrMethod(); default: - if (token >= 59 /* Identifier */) { + if (token >= 63 /* Identifier */) { return parsePropertyOrMethod(); } } } function parseTypeLiteral() { - var node = createNode(130 /* TypeLiteral */); - if (parseExpected(9 /* OpenBraceToken */)) { + var node = createNode(134 /* TypeLiteral */); + if (parseExpected(13 /* OpenBraceToken */)) { node.members = parseList(5 /* TypeMembers */, false, parseTypeMember); - parseExpected(10 /* CloseBraceToken */); + parseExpected(14 /* CloseBraceToken */); } else { node.members = createMissingList(); @@ -3835,26 +3962,26 @@ var ts; return finishNode(node); } function parseTupleType() { - var node = createNode(132 /* TupleType */); + var node = createNode(136 /* TupleType */); var startTokenPos = scanner.getTokenPos(); var startErrorCount = file.syntacticErrors.length; - node.elementTypes = parseBracketedList(16 /* TupleElementTypes */, parseType, 13 /* OpenBracketToken */, 14 /* CloseBracketToken */); + node.elementTypes = parseBracketedList(16 /* TupleElementTypes */, parseType, 17 /* OpenBracketToken */, 18 /* CloseBracketToken */); if (!node.elementTypes.length && file.syntacticErrors.length === startErrorCount) { grammarErrorAtPos(startTokenPos, scanner.getStartPos() - startTokenPos, ts.Diagnostics.A_tuple_type_element_list_cannot_be_empty); } return finishNode(node); } function parseParenType() { - var node = createNode(134 /* ParenType */); - parseExpected(11 /* OpenParenToken */); + var node = createNode(138 /* ParenType */); + parseExpected(15 /* OpenParenToken */); node.type = parseType(); - parseExpected(12 /* CloseParenToken */); + parseExpected(16 /* CloseParenToken */); return finishNode(node); } function parseFunctionType(signatureKind) { - var node = createNode(130 /* TypeLiteral */); + var node = createNode(134 /* TypeLiteral */); var member = createNode(signatureKind); - var sig = parseSignature(signatureKind, 27 /* EqualsGreaterThanToken */, true); + var sig = parseSignature(signatureKind, 31 /* EqualsGreaterThanToken */, true); member.typeParameters = sig.typeParameters; member.parameters = sig.parameters; member.type = sig.type; @@ -3864,24 +3991,24 @@ var ts; } function parseKeywordAndNoDot() { var node = parseTokenNode(); - return token === 15 /* DotToken */ ? undefined : node; + return token === 19 /* DotToken */ ? undefined : node; } function parseNonArrayType() { switch (token) { - case 105 /* AnyKeyword */: - case 114 /* StringKeyword */: - case 112 /* NumberKeyword */: - case 106 /* BooleanKeyword */: - case 93 /* VoidKeyword */: + case 109 /* AnyKeyword */: + case 118 /* StringKeyword */: + case 116 /* NumberKeyword */: + case 110 /* BooleanKeyword */: + case 97 /* VoidKeyword */: var node = tryParse(parseKeywordAndNoDot); return node || parseTypeReference(); - case 91 /* TypeOfKeyword */: + case 95 /* TypeOfKeyword */: return parseTypeQuery(); - case 9 /* OpenBraceToken */: + case 13 /* OpenBraceToken */: return parseTypeLiteral(); - case 13 /* OpenBracketToken */: + case 17 /* OpenBracketToken */: return parseTupleType(); - case 11 /* OpenParenToken */: + case 15 /* OpenParenToken */: return parseParenType(); default: if (isIdentifier()) { @@ -3891,23 +4018,23 @@ var ts; error(ts.Diagnostics.Type_expected); return createMissingNode(); } - function isType() { + function isStartOfType() { switch (token) { - case 105 /* AnyKeyword */: - case 114 /* StringKeyword */: - case 112 /* NumberKeyword */: - case 106 /* BooleanKeyword */: - case 93 /* VoidKeyword */: - case 91 /* TypeOfKeyword */: - case 9 /* OpenBraceToken */: - case 13 /* OpenBracketToken */: - case 19 /* LessThanToken */: - case 82 /* NewKeyword */: + case 109 /* AnyKeyword */: + case 118 /* StringKeyword */: + case 116 /* NumberKeyword */: + case 110 /* BooleanKeyword */: + case 97 /* VoidKeyword */: + case 95 /* TypeOfKeyword */: + case 13 /* OpenBraceToken */: + case 17 /* OpenBracketToken */: + case 23 /* LessThanToken */: + case 86 /* NewKeyword */: return true; - case 11 /* OpenParenToken */: + case 15 /* OpenParenToken */: return lookAhead(function () { nextToken(); - return token === 12 /* CloseParenToken */ || isParameter() || isType(); + return token === 16 /* CloseParenToken */ || isStartOfParameter() || isStartOfType(); }); default: return isIdentifier(); @@ -3915,9 +4042,9 @@ var ts; } function parsePrimaryType() { var type = parseNonArrayType(); - while (!scanner.hasPrecedingLineBreak() && parseOptional(13 /* OpenBracketToken */)) { - parseExpected(14 /* CloseBracketToken */); - var node = createNode(131 /* ArrayType */, type.pos); + while (!scanner.hasPrecedingLineBreak() && parseOptional(17 /* OpenBracketToken */)) { + parseExpected(18 /* CloseBracketToken */); + var node = createNode(135 /* ArrayType */, type.pos); node.elementType = type; type = finishNode(node); } @@ -3925,33 +4052,33 @@ var ts; } function parseUnionType() { var type = parsePrimaryType(); - if (token === 39 /* BarToken */) { + if (token === 43 /* BarToken */) { var types = [type]; types.pos = type.pos; - while (parseOptional(39 /* BarToken */)) { + while (parseOptional(43 /* BarToken */)) { types.push(parsePrimaryType()); } types.end = getNodeEnd(); - var node = createNode(133 /* UnionType */, type.pos); + var node = createNode(137 /* UnionType */, type.pos); node.types = types; type = finishNode(node); } return type; } - function isFunctionType() { - return token === 19 /* LessThanToken */ || token === 11 /* OpenParenToken */ && lookAhead(function () { + function isStartOfFunctionType() { + return token === 23 /* LessThanToken */ || token === 15 /* OpenParenToken */ && lookAhead(function () { nextToken(); - if (token === 12 /* CloseParenToken */ || token === 16 /* DotDotDotToken */) { + if (token === 16 /* CloseParenToken */ || token === 20 /* DotDotDotToken */) { return true; } if (isIdentifier() || isModifier(token)) { nextToken(); - if (token === 46 /* ColonToken */ || token === 18 /* CommaToken */ || token === 45 /* QuestionToken */ || token === 47 /* EqualsToken */ || isIdentifier() || isModifier(token)) { + if (token === 50 /* ColonToken */ || token === 22 /* CommaToken */ || token === 49 /* QuestionToken */ || token === 51 /* EqualsToken */ || isIdentifier() || isModifier(token)) { return true; } - if (token === 12 /* CloseParenToken */) { + if (token === 16 /* CloseParenToken */) { nextToken(); - if (token === 27 /* EqualsGreaterThanToken */) { + if (token === 31 /* EqualsGreaterThanToken */) { return true; } } @@ -3960,66 +4087,68 @@ var ts; }); } function parseType() { - if (isFunctionType()) { - return parseFunctionType(125 /* CallSignature */); + if (isStartOfFunctionType()) { + return parseFunctionType(129 /* CallSignature */); } - if (token === 82 /* NewKeyword */) { - return parseFunctionType(126 /* ConstructSignature */); + if (token === 86 /* NewKeyword */) { + return parseFunctionType(130 /* ConstructSignature */); } return parseUnionType(); } function parseTypeAnnotation() { - return parseOptional(46 /* ColonToken */) ? parseType() : undefined; + return parseOptional(50 /* ColonToken */) ? parseType() : undefined; } - function isExpression() { + function isStartOfExpression() { switch (token) { - case 87 /* ThisKeyword */: - case 85 /* SuperKeyword */: - case 83 /* NullKeyword */: - case 89 /* TrueKeyword */: - case 74 /* FalseKeyword */: + case 91 /* ThisKeyword */: + case 89 /* SuperKeyword */: + case 87 /* NullKeyword */: + case 93 /* TrueKeyword */: + case 78 /* FalseKeyword */: case 6 /* NumericLiteral */: case 7 /* StringLiteral */: - case 11 /* OpenParenToken */: - case 13 /* OpenBracketToken */: - case 9 /* OpenBraceToken */: - case 77 /* FunctionKeyword */: - case 82 /* NewKeyword */: - case 31 /* SlashToken */: - case 51 /* SlashEqualsToken */: - case 28 /* PlusToken */: - case 29 /* MinusToken */: - case 42 /* TildeToken */: - case 41 /* ExclamationToken */: - case 68 /* DeleteKeyword */: - case 91 /* TypeOfKeyword */: - case 93 /* VoidKeyword */: - case 33 /* PlusPlusToken */: - case 34 /* MinusMinusToken */: - case 19 /* LessThanToken */: - case 59 /* Identifier */: + case 9 /* NoSubstitutionTemplateLiteral */: + case 10 /* TemplateHead */: + case 15 /* OpenParenToken */: + case 17 /* OpenBracketToken */: + case 13 /* OpenBraceToken */: + case 81 /* FunctionKeyword */: + case 86 /* NewKeyword */: + case 35 /* SlashToken */: + case 55 /* SlashEqualsToken */: + case 32 /* PlusToken */: + case 33 /* MinusToken */: + case 46 /* TildeToken */: + case 45 /* ExclamationToken */: + case 72 /* DeleteKeyword */: + case 95 /* TypeOfKeyword */: + case 97 /* VoidKeyword */: + case 37 /* PlusPlusToken */: + case 38 /* MinusMinusToken */: + case 23 /* LessThanToken */: + case 63 /* Identifier */: return true; default: return isIdentifier(); } } - function isExpressionStatement() { - return token !== 9 /* OpenBraceToken */ && token !== 77 /* FunctionKeyword */ && isExpression(); + function isStartOfExpressionStatement() { + return token !== 13 /* OpenBraceToken */ && token !== 81 /* FunctionKeyword */ && isStartOfExpression(); } function parseExpression(noIn) { var expr = parseAssignmentExpression(noIn); - while (parseOptional(18 /* CommaToken */)) { - expr = makeBinaryExpression(expr, 18 /* CommaToken */, parseAssignmentExpression(noIn)); + while (parseOptional(22 /* CommaToken */)) { + expr = makeBinaryExpression(expr, 22 /* CommaToken */, parseAssignmentExpression(noIn)); } return expr; } function parseInitializer(inParameter, noIn) { - if (token !== 47 /* EqualsToken */) { - if (scanner.hasPrecedingLineBreak() || (inParameter && token === 9 /* OpenBraceToken */) || !isExpression()) { + if (token !== 51 /* EqualsToken */) { + if (scanner.hasPrecedingLineBreak() || (inParameter && token === 13 /* OpenBraceToken */) || !isStartOfExpression()) { return undefined; } } - parseExpected(47 /* EqualsToken */); + parseExpected(51 /* EqualsToken */); return parseAssignmentExpression(noIn); } function parseAssignmentExpression(noIn) { @@ -4028,7 +4157,7 @@ var ts; return arrowExpression; } var expr = parseConditionalExpression(noIn); - if (expr.kind === 59 /* Identifier */ && token === 27 /* EqualsGreaterThanToken */) { + if (expr.kind === 63 /* Identifier */ && token === 31 /* EqualsGreaterThanToken */) { return parseSimpleArrowFunctionExpression(expr); } if (isLeftHandSideExpression(expr) && isAssignmentOperator()) { @@ -4044,33 +4173,36 @@ var ts; function isLeftHandSideExpression(expr) { if (expr) { switch (expr.kind) { - case 138 /* PropertyAccess */: - case 139 /* IndexedAccess */: - case 141 /* NewExpression */: - case 140 /* CallExpression */: - case 135 /* ArrayLiteral */: - case 143 /* ParenExpression */: - case 136 /* ObjectLiteral */: - case 144 /* FunctionExpression */: - case 59 /* Identifier */: - case 116 /* Missing */: + case 142 /* PropertyAccess */: + case 143 /* IndexedAccess */: + case 145 /* NewExpression */: + case 144 /* CallExpression */: + case 146 /* TaggedTemplateExpression */: + case 139 /* ArrayLiteral */: + case 148 /* ParenExpression */: + case 140 /* ObjectLiteral */: + case 149 /* FunctionExpression */: + case 63 /* Identifier */: + case 120 /* Missing */: case 8 /* RegularExpressionLiteral */: case 6 /* NumericLiteral */: case 7 /* StringLiteral */: - case 74 /* FalseKeyword */: - case 83 /* NullKeyword */: - case 87 /* ThisKeyword */: - case 89 /* TrueKeyword */: - case 85 /* SuperKeyword */: + case 9 /* NoSubstitutionTemplateLiteral */: + case 155 /* TemplateExpression */: + case 78 /* FalseKeyword */: + case 87 /* NullKeyword */: + case 91 /* ThisKeyword */: + case 93 /* TrueKeyword */: + case 89 /* SuperKeyword */: return true; } } return false; } function parseSimpleArrowFunctionExpression(identifier) { - ts.Debug.assert(token === 27 /* EqualsGreaterThanToken */, "parseSimpleArrowFunctionExpression should only have been called if we had a =>"); - parseExpected(27 /* EqualsGreaterThanToken */); - var parameter = createNode(119 /* Parameter */, identifier.pos); + ts.Debug.assert(token === 31 /* EqualsGreaterThanToken */, "parseSimpleArrowFunctionExpression should only have been called if we had a =>"); + parseExpected(31 /* EqualsGreaterThanToken */); + var parameter = createNode(123 /* Parameter */, identifier.pos); parameter.name = identifier; finishNode(parameter); var parameters = []; @@ -4087,17 +4219,17 @@ var ts; } var pos = getNodePos(); if (triState === 1 /* True */) { - var sig = parseSignature(125 /* CallSignature */, 46 /* ColonToken */, false); - if (parseExpected(27 /* EqualsGreaterThanToken */) || token === 9 /* OpenBraceToken */) { + var sig = parseSignature(129 /* CallSignature */, 50 /* ColonToken */, false); + if (parseExpected(31 /* EqualsGreaterThanToken */) || token === 13 /* OpenBraceToken */) { return parseArrowExpressionTail(pos, sig, false); } else { - return makeFunctionExpression(145 /* ArrowFunction */, pos, undefined, sig, createMissingNode()); + return makeFunctionExpression(150 /* ArrowFunction */, pos, undefined, sig, createMissingNode()); } } var sig = tryParseSignatureIfArrowOrBraceFollows(); if (sig) { - parseExpected(27 /* EqualsGreaterThanToken */); + parseExpected(31 /* EqualsGreaterThanToken */); return parseArrowExpressionTail(pos, sig, false); } else { @@ -4105,35 +4237,35 @@ var ts; } } function isParenthesizedArrowFunctionExpression() { - if (token === 11 /* OpenParenToken */ || token === 19 /* LessThanToken */) { + if (token === 15 /* OpenParenToken */ || token === 23 /* LessThanToken */) { return lookAhead(function () { var first = token; var second = nextToken(); - if (first === 11 /* OpenParenToken */) { - if (second === 12 /* CloseParenToken */) { + if (first === 15 /* OpenParenToken */) { + if (second === 16 /* CloseParenToken */) { var third = nextToken(); switch (third) { - case 27 /* EqualsGreaterThanToken */: - case 46 /* ColonToken */: - case 9 /* OpenBraceToken */: + case 31 /* EqualsGreaterThanToken */: + case 50 /* ColonToken */: + case 13 /* OpenBraceToken */: return 1 /* True */; default: return 0 /* False */; } } - if (second === 16 /* DotDotDotToken */) { + if (second === 20 /* DotDotDotToken */) { return 1 /* True */; } if (!isIdentifier()) { return 0 /* False */; } - if (nextToken() === 46 /* ColonToken */) { + if (nextToken() === 50 /* ColonToken */) { return 1 /* True */; } return 2 /* Unknown */; } else { - ts.Debug.assert(first === 19 /* LessThanToken */); + ts.Debug.assert(first === 23 /* LessThanToken */); if (!isIdentifier()) { return 0 /* False */; } @@ -4141,15 +4273,15 @@ var ts; } }); } - if (token === 27 /* EqualsGreaterThanToken */) { + if (token === 31 /* EqualsGreaterThanToken */) { return 1 /* True */; } return 0 /* False */; } function tryParseSignatureIfArrowOrBraceFollows() { return tryParse(function () { - var sig = parseSignature(125 /* CallSignature */, 46 /* ColonToken */, false); - if (token === 27 /* EqualsGreaterThanToken */ || token === 9 /* OpenBraceToken */) { + var sig = parseSignature(129 /* CallSignature */, 50 /* ColonToken */, false); + if (token === 31 /* EqualsGreaterThanToken */ || token === 13 /* OpenBraceToken */) { return sig; } return undefined; @@ -4157,27 +4289,27 @@ var ts; } function parseArrowExpressionTail(pos, sig, noIn) { var body; - if (token === 9 /* OpenBraceToken */) { + if (token === 13 /* OpenBraceToken */) { body = parseBody(false); } - else if (isStatement(true) && !isExpressionStatement() && token !== 77 /* FunctionKeyword */) { + else if (isStatement(true) && !isStartOfExpressionStatement() && token !== 81 /* FunctionKeyword */) { body = parseBody(true); } else { body = parseAssignmentExpression(noIn); } - return makeFunctionExpression(145 /* ArrowFunction */, pos, undefined, sig, body); + return makeFunctionExpression(150 /* ArrowFunction */, pos, undefined, sig, body); } function isAssignmentOperator() { return token >= ts.SyntaxKind.FirstAssignment && token <= ts.SyntaxKind.LastAssignment; } function parseConditionalExpression(noIn) { var expr = parseBinaryExpression(noIn); - while (parseOptional(45 /* QuestionToken */)) { - var node = createNode(149 /* ConditionalExpression */, expr.pos); + while (parseOptional(49 /* QuestionToken */)) { + var node = createNode(154 /* ConditionalExpression */, expr.pos); node.condition = expr; node.whenTrue = parseAssignmentExpression(false); - parseExpected(46 /* ColonToken */); + parseExpected(50 /* ColonToken */); node.whenFalse = parseAssignmentExpression(noIn); expr = finishNode(node); } @@ -4190,7 +4322,7 @@ var ts; while (true) { reScanGreaterToken(); var precedence = getOperatorPrecedence(); - if (precedence && precedence > minPrecedence && (!noIn || token !== 80 /* InKeyword */)) { + if (precedence && precedence > minPrecedence && (!noIn || token !== 84 /* InKeyword */)) { var operator = token; nextToken(); expr = makeBinaryExpression(expr, operator, parseBinaryOperators(parseUnaryExpression(), precedence, noIn)); @@ -4201,44 +4333,44 @@ var ts; } function getOperatorPrecedence() { switch (token) { - case 44 /* BarBarToken */: + case 48 /* BarBarToken */: return 1; - case 43 /* AmpersandAmpersandToken */: + case 47 /* AmpersandAmpersandToken */: return 2; - case 39 /* BarToken */: + case 43 /* BarToken */: return 3; - case 40 /* CaretToken */: + case 44 /* CaretToken */: return 4; - case 38 /* AmpersandToken */: + case 42 /* AmpersandToken */: return 5; - case 23 /* EqualsEqualsToken */: - case 24 /* ExclamationEqualsToken */: - case 25 /* EqualsEqualsEqualsToken */: - case 26 /* ExclamationEqualsEqualsToken */: + case 27 /* EqualsEqualsToken */: + case 28 /* ExclamationEqualsToken */: + case 29 /* EqualsEqualsEqualsToken */: + case 30 /* ExclamationEqualsEqualsToken */: return 6; - case 19 /* LessThanToken */: - case 20 /* GreaterThanToken */: - case 21 /* LessThanEqualsToken */: - case 22 /* GreaterThanEqualsToken */: - case 81 /* InstanceOfKeyword */: - case 80 /* InKeyword */: + case 23 /* LessThanToken */: + case 24 /* GreaterThanToken */: + case 25 /* LessThanEqualsToken */: + case 26 /* GreaterThanEqualsToken */: + case 85 /* InstanceOfKeyword */: + case 84 /* InKeyword */: return 7; - case 35 /* LessThanLessThanToken */: - case 36 /* GreaterThanGreaterThanToken */: - case 37 /* GreaterThanGreaterThanGreaterThanToken */: + case 39 /* LessThanLessThanToken */: + case 40 /* GreaterThanGreaterThanToken */: + case 41 /* GreaterThanGreaterThanGreaterThanToken */: return 8; - case 28 /* PlusToken */: - case 29 /* MinusToken */: + case 32 /* PlusToken */: + case 33 /* MinusToken */: return 9; - case 30 /* AsteriskToken */: - case 31 /* SlashToken */: - case 32 /* PercentToken */: + case 34 /* AsteriskToken */: + case 35 /* SlashToken */: + case 36 /* PercentToken */: return 10; } return undefined; } function makeBinaryExpression(left, operator, right) { - var node = createNode(148 /* BinaryExpression */, left.pos); + var node = createNode(153 /* BinaryExpression */, left.pos); node.left = left; node.operator = operator; node.right = right; @@ -4247,52 +4379,52 @@ var ts; function parseUnaryExpression() { var pos = getNodePos(); switch (token) { - case 28 /* PlusToken */: - case 29 /* MinusToken */: - case 42 /* TildeToken */: - case 41 /* ExclamationToken */: - case 68 /* DeleteKeyword */: - case 91 /* TypeOfKeyword */: - case 93 /* VoidKeyword */: - case 33 /* PlusPlusToken */: - case 34 /* MinusMinusToken */: + case 32 /* PlusToken */: + case 33 /* MinusToken */: + case 46 /* TildeToken */: + case 45 /* ExclamationToken */: + case 72 /* DeleteKeyword */: + case 95 /* TypeOfKeyword */: + case 97 /* VoidKeyword */: + case 37 /* PlusPlusToken */: + case 38 /* MinusMinusToken */: var operator = token; nextToken(); var operand = parseUnaryExpression(); if (isInStrictMode) { - if ((operator === 33 /* PlusPlusToken */ || operator === 34 /* MinusMinusToken */) && isEvalOrArgumentsIdentifier(operand)) { + if ((operator === 37 /* PlusPlusToken */ || operator === 38 /* MinusMinusToken */) && isEvalOrArgumentsIdentifier(operand)) { reportInvalidUseInStrictMode(operand); } - else if (operator === 68 /* DeleteKeyword */ && operand.kind === 59 /* Identifier */) { + else if (operator === 72 /* DeleteKeyword */ && operand.kind === 63 /* Identifier */) { grammarErrorOnNode(operand, ts.Diagnostics.delete_cannot_be_called_on_an_identifier_in_strict_mode); } } - return makeUnaryExpression(146 /* PrefixOperator */, pos, operator, operand); - case 19 /* LessThanToken */: + return makeUnaryExpression(151 /* PrefixOperator */, pos, operator, operand); + case 23 /* LessThanToken */: return parseTypeAssertion(); } var primaryExpression = parsePrimaryExpression(); - var illegalUsageOfSuperKeyword = primaryExpression.kind === 85 /* SuperKeyword */ && token !== 11 /* OpenParenToken */ && token !== 15 /* DotToken */; + var illegalUsageOfSuperKeyword = primaryExpression.kind === 89 /* SuperKeyword */ && token !== 15 /* OpenParenToken */ && token !== 19 /* DotToken */; if (illegalUsageOfSuperKeyword) { error(ts.Diagnostics.super_must_be_followed_by_an_argument_list_or_member_access); } var expr = parseCallAndAccess(primaryExpression, false); ts.Debug.assert(isLeftHandSideExpression(expr)); - if ((token === 33 /* PlusPlusToken */ || token === 34 /* MinusMinusToken */) && !scanner.hasPrecedingLineBreak()) { + if ((token === 37 /* PlusPlusToken */ || token === 38 /* MinusMinusToken */) && !scanner.hasPrecedingLineBreak()) { if (isInStrictMode && isEvalOrArgumentsIdentifier(expr)) { reportInvalidUseInStrictMode(expr); } var operator = token; nextToken(); - expr = makeUnaryExpression(147 /* PostfixOperator */, expr.pos, operator, expr); + expr = makeUnaryExpression(152 /* PostfixOperator */, expr.pos, operator, expr); } return expr; } function parseTypeAssertion() { - var node = createNode(142 /* TypeAssertion */); - parseExpected(19 /* LessThanToken */); + var node = createNode(147 /* TypeAssertion */); + parseExpected(23 /* LessThanToken */); node.type = parseType(); - parseExpected(20 /* GreaterThanToken */); + parseExpected(24 /* GreaterThanToken */); node.operand = parseUnaryExpression(); return finishNode(node); } @@ -4304,11 +4436,11 @@ var ts; } function parseCallAndAccess(expr, inNewExpression) { while (true) { - var dotStart = scanner.getTokenPos(); - if (parseOptional(15 /* DotToken */)) { - var propertyAccess = createNode(138 /* PropertyAccess */, expr.pos); + var dotOrBracketStart = scanner.getTokenPos(); + if (parseOptional(19 /* DotToken */)) { + var propertyAccess = createNode(142 /* PropertyAccess */, expr.pos); if (scanner.hasPrecedingLineBreak() && scanner.isReservedWord() && lookAhead(function () { return scanner.isReservedWord(); })) { - grammarErrorAtPos(dotStart, scanner.getStartPos() - dotStart, ts.Diagnostics.Identifier_expected); + grammarErrorAtPos(dotOrBracketStart, scanner.getStartPos() - dotOrBracketStart, ts.Diagnostics.Identifier_expected); var id = createMissingNode(); } else { @@ -4319,13 +4451,12 @@ var ts; expr = finishNode(propertyAccess); continue; } - var bracketStart = scanner.getTokenPos(); - if (parseOptional(13 /* OpenBracketToken */)) { - var indexedAccess = createNode(139 /* IndexedAccess */, expr.pos); + if (parseOptional(17 /* OpenBracketToken */)) { + var indexedAccess = createNode(143 /* IndexedAccess */, expr.pos); indexedAccess.object = expr; - if (inNewExpression && parseOptional(14 /* CloseBracketToken */)) { + if (inNewExpression && parseOptional(18 /* CloseBracketToken */)) { indexedAccess.index = createMissingNode(); - grammarErrorAtPos(bracketStart, scanner.getStartPos() - bracketStart, ts.Diagnostics.new_T_cannot_be_used_to_create_an_array_Use_new_Array_T_instead); + grammarErrorAtPos(dotOrBracketStart, scanner.getStartPos() - dotOrBracketStart, ts.Diagnostics.new_T_cannot_be_used_to_create_an_array_Use_new_Array_T_instead); } else { indexedAccess.index = parseExpression(); @@ -4333,79 +4464,92 @@ var ts; var literal = indexedAccess.index; literal.text = internIdentifier(literal.text); } - parseExpected(14 /* CloseBracketToken */); + parseExpected(18 /* CloseBracketToken */); } expr = finishNode(indexedAccess); continue; } - if ((token === 11 /* OpenParenToken */ || token === 19 /* LessThanToken */) && !inNewExpression) { - var callExpr = createNode(140 /* CallExpression */, expr.pos); + if ((token === 15 /* OpenParenToken */ || token === 23 /* LessThanToken */) && !inNewExpression) { + var callExpr = createNode(144 /* CallExpression */, expr.pos); callExpr.func = expr; - if (token === 19 /* LessThanToken */) { + if (token === 23 /* LessThanToken */) { if (!(callExpr.typeArguments = tryParse(parseTypeArgumentsAndOpenParen))) return expr; } else { - parseExpected(11 /* OpenParenToken */); + parseExpected(15 /* OpenParenToken */); } callExpr.arguments = parseDelimitedList(10 /* ArgumentExpressions */, parseArgumentExpression, false); - parseExpected(12 /* CloseParenToken */); + parseExpected(16 /* CloseParenToken */); expr = finishNode(callExpr); continue; } + if (token === 9 /* NoSubstitutionTemplateLiteral */ || token === 10 /* TemplateHead */) { + var tagExpression = createNode(146 /* TaggedTemplateExpression */, expr.pos); + tagExpression.tag = expr; + tagExpression.template = token === 9 /* NoSubstitutionTemplateLiteral */ ? parseLiteralNode() : parseTemplateExpression(); + expr = finishNode(tagExpression); + if (languageVersion < 2 /* ES6 */) { + grammarErrorOnNode(expr, ts.Diagnostics.Tagged_templates_are_only_available_when_targeting_ECMAScript_6_and_higher); + } + continue; + } return expr; } } function parseTypeArgumentsAndOpenParen() { var result = parseTypeArguments(); - parseExpected(11 /* OpenParenToken */); + parseExpected(15 /* OpenParenToken */); return result; } function parseTypeArguments() { var typeArgumentListStart = scanner.getTokenPos(); var errorCountBeforeTypeParameterList = file.syntacticErrors.length; - var result = parseBracketedList(15 /* TypeArguments */, parseSingleTypeArgument, 19 /* LessThanToken */, 20 /* GreaterThanToken */); + var result = parseBracketedList(15 /* TypeArguments */, parseSingleTypeArgument, 23 /* LessThanToken */, 24 /* GreaterThanToken */); if (!result.length && file.syntacticErrors.length === errorCountBeforeTypeParameterList) { grammarErrorAtPos(typeArgumentListStart, scanner.getStartPos() - typeArgumentListStart, ts.Diagnostics.Type_argument_list_cannot_be_empty); } return result; } function parseSingleTypeArgument() { - if (token === 18 /* CommaToken */) { + if (token === 22 /* CommaToken */) { var errorStart = scanner.getTokenPos(); var errorLength = scanner.getTextPos() - errorStart; grammarErrorAtPos(errorStart, errorLength, ts.Diagnostics.Type_expected); - return createNode(116 /* Missing */); + return createNode(120 /* Missing */); } return parseType(); } function parsePrimaryExpression() { switch (token) { - case 87 /* ThisKeyword */: - case 85 /* SuperKeyword */: - case 83 /* NullKeyword */: - case 89 /* TrueKeyword */: - case 74 /* FalseKeyword */: + case 91 /* ThisKeyword */: + case 89 /* SuperKeyword */: + case 87 /* NullKeyword */: + case 93 /* TrueKeyword */: + case 78 /* FalseKeyword */: return parseTokenNode(); case 6 /* NumericLiteral */: case 7 /* StringLiteral */: + case 9 /* NoSubstitutionTemplateLiteral */: return parseLiteralNode(); - case 11 /* OpenParenToken */: + case 15 /* OpenParenToken */: return parseParenExpression(); - case 13 /* OpenBracketToken */: + case 17 /* OpenBracketToken */: return parseArrayLiteral(); - case 9 /* OpenBraceToken */: + case 13 /* OpenBraceToken */: return parseObjectLiteral(); - case 77 /* FunctionKeyword */: + case 81 /* FunctionKeyword */: return parseFunctionExpression(); - case 82 /* NewKeyword */: + case 86 /* NewKeyword */: return parseNewExpression(); - case 31 /* SlashToken */: - case 51 /* SlashEqualsToken */: + case 35 /* SlashToken */: + case 55 /* SlashEqualsToken */: if (reScanSlashToken() === 8 /* RegularExpressionLiteral */) { return parseLiteralNode(); } break; + case 10 /* TemplateHead */: + return parseTemplateExpression(); default: if (isIdentifier()) { return parseIdentifier(); @@ -4415,20 +4559,20 @@ var ts; return createMissingNode(); } function parseParenExpression() { - var node = createNode(143 /* ParenExpression */); - parseExpected(11 /* OpenParenToken */); + var node = createNode(148 /* ParenExpression */); + parseExpected(15 /* OpenParenToken */); node.expression = parseExpression(); - parseExpected(12 /* CloseParenToken */); + parseExpected(16 /* CloseParenToken */); return finishNode(node); } function parseAssignmentExpressionOrOmittedExpression(omittedExpressionDiagnostic) { - if (token === 18 /* CommaToken */) { + if (token === 22 /* CommaToken */) { if (omittedExpressionDiagnostic) { var errorStart = scanner.getTokenPos(); var errorLength = scanner.getTextPos() - errorStart; grammarErrorAtPos(errorStart, errorLength, omittedExpressionDiagnostic); } - return createNode(150 /* OmittedExpression */); + return createNode(157 /* OmittedExpression */); } return parseAssignmentExpression(); } @@ -4439,24 +4583,24 @@ var ts; return parseAssignmentExpressionOrOmittedExpression(ts.Diagnostics.Argument_expression_expected); } function parseArrayLiteral() { - var node = createNode(135 /* ArrayLiteral */); - parseExpected(13 /* OpenBracketToken */); + var node = createNode(139 /* ArrayLiteral */); + parseExpected(17 /* OpenBracketToken */); if (scanner.hasPrecedingLineBreak()) node.flags |= 256 /* MultiLine */; node.elements = parseDelimitedList(12 /* ArrayLiteralMembers */, parseArrayLiteralElement, true); - parseExpected(14 /* CloseBracketToken */); + parseExpected(18 /* CloseBracketToken */); return finishNode(node); } function parsePropertyAssignment() { - var node = createNode(137 /* PropertyAssignment */); + var node = createNode(141 /* PropertyAssignment */); node.name = parsePropertyName(); - if (token === 11 /* OpenParenToken */ || token === 19 /* LessThanToken */) { - var sig = parseSignature(125 /* CallSignature */, 46 /* ColonToken */, false); + if (token === 15 /* OpenParenToken */ || token === 23 /* LessThanToken */) { + var sig = parseSignature(129 /* CallSignature */, 50 /* ColonToken */, false); var body = parseBody(false); - node.initializer = makeFunctionExpression(144 /* FunctionExpression */, node.pos, undefined, sig, body); + node.initializer = makeFunctionExpression(149 /* FunctionExpression */, node.pos, undefined, sig, body); } else { - parseExpected(46 /* ColonToken */); + parseExpected(50 /* ColonToken */); node.initializer = parseAssignmentExpression(false); } return finishNode(node); @@ -4464,37 +4608,37 @@ var ts; function parseObjectLiteralMember() { var initialPos = getNodePos(); var initialToken = token; - if (parseContextualModifier(109 /* GetKeyword */) || parseContextualModifier(113 /* SetKeyword */)) { - var kind = initialToken === 109 /* GetKeyword */ ? 123 /* GetAccessor */ : 124 /* SetAccessor */; + if (parseContextualModifier(113 /* GetKeyword */) || parseContextualModifier(117 /* SetKeyword */)) { + var kind = initialToken === 113 /* GetKeyword */ ? 127 /* GetAccessor */ : 128 /* SetAccessor */; return parseAndCheckMemberAccessorDeclaration(kind, initialPos, 0); } return parsePropertyAssignment(); } function parseObjectLiteral() { - var node = createNode(136 /* ObjectLiteral */); - parseExpected(9 /* OpenBraceToken */); + var node = createNode(140 /* ObjectLiteral */); + parseExpected(13 /* OpenBraceToken */); if (scanner.hasPrecedingLineBreak()) { node.flags |= 256 /* MultiLine */; } node.properties = parseDelimitedList(11 /* ObjectLiteralMembers */, parseObjectLiteralMember, true); - parseExpected(10 /* CloseBraceToken */); + parseExpected(14 /* CloseBraceToken */); var seen = {}; var Property = 1; var GetAccessor = 2; var SetAccesor = 4; var GetOrSetAccessor = GetAccessor | SetAccesor; ts.forEach(node.properties, function (p) { - if (p.kind === 150 /* OmittedExpression */) { + if (p.kind === 157 /* OmittedExpression */) { return; } var currentKind; - if (p.kind === 137 /* PropertyAssignment */) { + if (p.kind === 141 /* PropertyAssignment */) { currentKind = Property; } - else if (p.kind === 123 /* GetAccessor */) { + else if (p.kind === 127 /* GetAccessor */) { currentKind = GetAccessor; } - else if (p.kind === 124 /* SetAccessor */) { + else if (p.kind === 128 /* SetAccessor */) { currentKind = SetAccesor; } else { @@ -4527,14 +4671,14 @@ var ts; } function parseFunctionExpression() { var pos = getNodePos(); - parseExpected(77 /* FunctionKeyword */); + parseExpected(81 /* FunctionKeyword */); var name = isIdentifier() ? parseIdentifier() : undefined; - var sig = parseSignature(125 /* CallSignature */, 46 /* ColonToken */, false); + var sig = parseSignature(129 /* CallSignature */, 50 /* ColonToken */, false); var body = parseBody(false); if (name && isInStrictMode && isEvalOrArgumentsIdentifier(name)) { reportInvalidUseInStrictMode(name); } - return makeFunctionExpression(144 /* FunctionExpression */, pos, name, sig, body); + return makeFunctionExpression(149 /* FunctionExpression */, pos, name, sig, body); } function makeFunctionExpression(kind, pos, name, sig, body) { var node = createNode(kind, pos); @@ -4546,12 +4690,12 @@ var ts; return finishNode(node); } function parseNewExpression() { - var node = createNode(141 /* NewExpression */); - parseExpected(82 /* NewKeyword */); + var node = createNode(145 /* NewExpression */); + parseExpected(86 /* NewKeyword */); node.func = parseCallAndAccess(parsePrimaryExpression(), true); - if (parseOptional(11 /* OpenParenToken */) || token === 19 /* LessThanToken */ && (node.typeArguments = tryParse(parseTypeArgumentsAndOpenParen))) { + if (parseOptional(15 /* OpenParenToken */) || token === 23 /* LessThanToken */ && (node.typeArguments = tryParse(parseTypeArgumentsAndOpenParen))) { node.arguments = parseDelimitedList(10 /* ArgumentExpressions */, parseArgumentExpression, false); - parseExpected(12 /* CloseParenToken */); + parseExpected(16 /* CloseParenToken */); } return finishNode(node); } @@ -4559,10 +4703,10 @@ var ts; return parseStatement(true); } function parseBlock(ignoreMissingOpenBrace, checkForStrictMode) { - var node = createNode(151 /* Block */); - if (parseExpected(9 /* OpenBraceToken */) || ignoreMissingOpenBrace) { + var node = createNode(158 /* Block */); + if (parseExpected(13 /* OpenBraceToken */) || ignoreMissingOpenBrace) { node.statements = parseList(2 /* BlockStatements */, checkForStrictMode, parseStatementAllowingLetDeclaration); - parseExpected(10 /* CloseBraceToken */); + parseExpected(14 /* CloseBraceToken */); } else { node.statements = createMissingList(); @@ -4582,7 +4726,7 @@ var ts; } labelledStatementInfo.pushFunctionBoundary(); var block = parseBlock(ignoreMissingOpenBrace, true); - block.kind = 176 /* FunctionBlock */; + block.kind = 183 /* FunctionBlock */; labelledStatementInfo.pop(); inFunctionBody = saveInFunctionBody; inSwitchStatement = saveInSwitchStatement; @@ -4590,40 +4734,40 @@ var ts; return block; } function parseEmptyStatement() { - var node = createNode(153 /* EmptyStatement */); - parseExpected(17 /* SemicolonToken */); + var node = createNode(160 /* EmptyStatement */); + parseExpected(21 /* SemicolonToken */); return finishNode(node); } function parseIfStatement() { - var node = createNode(155 /* IfStatement */); - parseExpected(78 /* IfKeyword */); - parseExpected(11 /* OpenParenToken */); + var node = createNode(162 /* IfStatement */); + parseExpected(82 /* IfKeyword */); + parseExpected(15 /* OpenParenToken */); node.expression = parseExpression(); - parseExpected(12 /* CloseParenToken */); + parseExpected(16 /* CloseParenToken */); node.thenStatement = parseStatement(false); - node.elseStatement = parseOptional(70 /* ElseKeyword */) ? parseStatement(false) : undefined; + node.elseStatement = parseOptional(74 /* ElseKeyword */) ? parseStatement(false) : undefined; return finishNode(node); } function parseDoStatement() { - var node = createNode(156 /* DoStatement */); - parseExpected(69 /* DoKeyword */); + var node = createNode(163 /* DoStatement */); + parseExpected(73 /* DoKeyword */); var saveInIterationStatement = inIterationStatement; inIterationStatement = 1 /* Nested */; node.statement = parseStatement(false); inIterationStatement = saveInIterationStatement; - parseExpected(94 /* WhileKeyword */); - parseExpected(11 /* OpenParenToken */); + parseExpected(98 /* WhileKeyword */); + parseExpected(15 /* OpenParenToken */); node.expression = parseExpression(); - parseExpected(12 /* CloseParenToken */); - parseOptional(17 /* SemicolonToken */); + parseExpected(16 /* CloseParenToken */); + parseOptional(21 /* SemicolonToken */); return finishNode(node); } function parseWhileStatement() { - var node = createNode(157 /* WhileStatement */); - parseExpected(94 /* WhileKeyword */); - parseExpected(11 /* OpenParenToken */); + var node = createNode(164 /* WhileStatement */); + parseExpected(98 /* WhileKeyword */); + parseExpected(15 /* OpenParenToken */); node.expression = parseExpression(); - parseExpected(12 /* CloseParenToken */); + parseExpected(16 /* CloseParenToken */); var saveInIterationStatement = inIterationStatement; inIterationStatement = 1 /* Nested */; node.statement = parseStatement(false); @@ -4632,16 +4776,16 @@ var ts; } function parseForOrForInStatement() { var pos = getNodePos(); - parseExpected(76 /* ForKeyword */); - parseExpected(11 /* OpenParenToken */); - if (token !== 17 /* SemicolonToken */) { - if (parseOptional(92 /* VarKeyword */)) { + parseExpected(80 /* ForKeyword */); + parseExpected(15 /* OpenParenToken */); + if (token !== 21 /* SemicolonToken */) { + if (parseOptional(96 /* VarKeyword */)) { var declarations = parseVariableDeclarationList(0, true); if (!declarations.length) { error(ts.Diagnostics.Variable_declaration_list_cannot_be_empty); } } - else if (parseOptional(98 /* LetKeyword */)) { + else if (parseOptional(102 /* LetKeyword */)) { var declarations = parseVariableDeclarationList(2048 /* Let */, true); if (!declarations.length) { error(ts.Diagnostics.Variable_declaration_list_cannot_be_empty); @@ -4650,7 +4794,7 @@ var ts; grammarErrorAtPos(declarations.pos, declarations.end - declarations.pos, ts.Diagnostics.let_declarations_are_only_available_when_targeting_ECMAScript_6_and_higher); } } - else if (parseOptional(64 /* ConstKeyword */)) { + else if (parseOptional(68 /* ConstKeyword */)) { var declarations = parseVariableDeclarationList(4096 /* Const */, true); if (!declarations.length) { error(ts.Diagnostics.Variable_declaration_list_cannot_be_empty); @@ -4664,8 +4808,8 @@ var ts; } } var forOrForInStatement; - if (parseOptional(80 /* InKeyword */)) { - var forInStatement = createNode(159 /* ForInStatement */, pos); + if (parseOptional(84 /* InKeyword */)) { + var forInStatement = createNode(166 /* ForInStatement */, pos); if (declarations) { if (declarations.length > 1) { error(ts.Diagnostics.Only_a_single_variable_declaration_is_allowed_in_a_for_in_statement); @@ -4676,24 +4820,24 @@ var ts; forInStatement.variable = varOrInit; } forInStatement.expression = parseExpression(); - parseExpected(12 /* CloseParenToken */); + parseExpected(16 /* CloseParenToken */); forOrForInStatement = forInStatement; } else { - var forStatement = createNode(158 /* ForStatement */, pos); + var forStatement = createNode(165 /* ForStatement */, pos); if (declarations) forStatement.declarations = declarations; if (varOrInit) forStatement.initializer = varOrInit; - parseExpected(17 /* SemicolonToken */); - if (token !== 17 /* SemicolonToken */ && token !== 12 /* CloseParenToken */) { + parseExpected(21 /* SemicolonToken */); + if (token !== 21 /* SemicolonToken */ && token !== 16 /* CloseParenToken */) { forStatement.condition = parseExpression(); } - parseExpected(17 /* SemicolonToken */); - if (token !== 12 /* CloseParenToken */) { + parseExpected(21 /* SemicolonToken */); + if (token !== 16 /* CloseParenToken */) { forStatement.iterator = parseExpression(); } - parseExpected(12 /* CloseParenToken */); + parseExpected(16 /* CloseParenToken */); forOrForInStatement = forStatement; } var saveInIterationStatement = inIterationStatement; @@ -4705,7 +4849,7 @@ var ts; function parseBreakOrContinueStatement(kind) { var node = createNode(kind); var errorCountBeforeStatement = file.syntacticErrors.length; - parseExpected(kind === 161 /* BreakStatement */ ? 60 /* BreakKeyword */ : 65 /* ContinueKeyword */); + parseExpected(kind === 168 /* BreakStatement */ ? 64 /* BreakKeyword */ : 69 /* ContinueKeyword */); if (!canParseSemicolon()) node.label = parseIdentifier(); parseSemicolon(); @@ -4721,7 +4865,7 @@ var ts; return node; } function checkBareBreakOrContinueStatement(node) { - if (node.kind === 161 /* BreakStatement */) { + if (node.kind === 168 /* BreakStatement */) { if (inIterationStatement === 1 /* Nested */ || inSwitchStatement === 1 /* Nested */) { return; } @@ -4730,7 +4874,7 @@ var ts; return; } } - else if (node.kind === 160 /* ContinueStatement */) { + else if (node.kind === 167 /* ContinueStatement */) { if (inIterationStatement === 1 /* Nested */) { return; } @@ -4746,7 +4890,7 @@ var ts; grammarErrorOnNode(node, ts.Diagnostics.Jump_target_cannot_cross_function_boundary); } function checkBreakOrContinueStatementWithLabel(node) { - var nodeIsNestedInLabel = labelledStatementInfo.nodeIsNestedInLabel(node.label, node.kind === 160 /* ContinueStatement */, false); + var nodeIsNestedInLabel = labelledStatementInfo.nodeIsNestedInLabel(node.label, node.kind === 167 /* ContinueStatement */, false); if (nodeIsNestedInLabel === 1 /* Nested */) { return; } @@ -4754,10 +4898,10 @@ var ts; grammarErrorOnNode(node, ts.Diagnostics.Jump_target_cannot_cross_function_boundary); return; } - if (node.kind === 160 /* ContinueStatement */) { + if (node.kind === 167 /* ContinueStatement */) { grammarErrorOnNode(node, ts.Diagnostics.A_continue_statement_can_only_jump_to_a_label_of_an_enclosing_iteration_statement); } - else if (node.kind === 161 /* BreakStatement */) { + else if (node.kind === 168 /* BreakStatement */) { grammarErrorOnNode(node, ts.Diagnostics.A_break_statement_can_only_jump_to_a_label_of_an_enclosing_statement); } else { @@ -4765,11 +4909,11 @@ var ts; } } function parseReturnStatement() { - var node = createNode(162 /* ReturnStatement */); + var node = createNode(169 /* ReturnStatement */); var errorCountBeforeReturnStatement = file.syntacticErrors.length; var returnTokenStart = scanner.getTokenPos(); var returnTokenLength = scanner.getTextPos() - returnTokenStart; - parseExpected(84 /* ReturnKeyword */); + parseExpected(88 /* ReturnKeyword */); if (!canParseSemicolon()) node.expression = parseExpression(); parseSemicolon(); @@ -4779,13 +4923,13 @@ var ts; return finishNode(node); } function parseWithStatement() { - var node = createNode(163 /* WithStatement */); + var node = createNode(170 /* WithStatement */); var startPos = scanner.getTokenPos(); - parseExpected(95 /* WithKeyword */); + parseExpected(99 /* WithKeyword */); var endPos = scanner.getStartPos(); - parseExpected(11 /* OpenParenToken */); + parseExpected(15 /* OpenParenToken */); node.expression = parseExpression(); - parseExpected(12 /* CloseParenToken */); + parseExpected(16 /* CloseParenToken */); node.statement = parseStatement(false); node = finishNode(node); if (isInStrictMode) { @@ -4794,36 +4938,36 @@ var ts; return node; } function parseCaseClause() { - var node = createNode(165 /* CaseClause */); - parseExpected(61 /* CaseKeyword */); + var node = createNode(172 /* CaseClause */); + parseExpected(65 /* CaseKeyword */); node.expression = parseExpression(); - parseExpected(46 /* ColonToken */); + parseExpected(50 /* ColonToken */); node.statements = parseList(4 /* SwitchClauseStatements */, false, parseStatementAllowingLetDeclaration); return finishNode(node); } function parseDefaultClause() { - var node = createNode(166 /* DefaultClause */); - parseExpected(67 /* DefaultKeyword */); - parseExpected(46 /* ColonToken */); + var node = createNode(173 /* DefaultClause */); + parseExpected(71 /* DefaultKeyword */); + parseExpected(50 /* ColonToken */); node.statements = parseList(4 /* SwitchClauseStatements */, false, parseStatementAllowingLetDeclaration); return finishNode(node); } function parseCaseOrDefaultClause() { - return token === 61 /* CaseKeyword */ ? parseCaseClause() : parseDefaultClause(); + return token === 65 /* CaseKeyword */ ? parseCaseClause() : parseDefaultClause(); } function parseSwitchStatement() { - var node = createNode(164 /* SwitchStatement */); - parseExpected(86 /* SwitchKeyword */); - parseExpected(11 /* OpenParenToken */); + var node = createNode(171 /* SwitchStatement */); + parseExpected(90 /* SwitchKeyword */); + parseExpected(15 /* OpenParenToken */); node.expression = parseExpression(); - parseExpected(12 /* CloseParenToken */); - parseExpected(9 /* OpenBraceToken */); + parseExpected(16 /* CloseParenToken */); + parseExpected(13 /* OpenBraceToken */); var saveInSwitchStatement = inSwitchStatement; inSwitchStatement = 1 /* Nested */; node.clauses = parseList(3 /* SwitchClauses */, false, parseCaseOrDefaultClause); inSwitchStatement = saveInSwitchStatement; - parseExpected(10 /* CloseBraceToken */); - var defaultClauses = ts.filter(node.clauses, function (clause) { return clause.kind === 166 /* DefaultClause */; }); + parseExpected(14 /* CloseBraceToken */); + var defaultClauses = ts.filter(node.clauses, function (clause) { return clause.kind === 173 /* DefaultClause */; }); for (var i = 1, n = defaultClauses.length; i < n; i++) { var clause = defaultClauses[i]; var start = ts.skipTrivia(file.text, clause.pos); @@ -4833,8 +4977,8 @@ var ts; return finishNode(node); } function parseThrowStatement() { - var node = createNode(168 /* ThrowStatement */); - parseExpected(88 /* ThrowKeyword */); + var node = createNode(175 /* ThrowStatement */); + parseExpected(92 /* ThrowKeyword */); if (scanner.hasPrecedingLineBreak()) { error(ts.Diagnostics.Line_break_not_permitted_here); } @@ -4843,13 +4987,13 @@ var ts; return finishNode(node); } function parseTryStatement() { - var node = createNode(169 /* TryStatement */); - node.tryBlock = parseTokenAndBlock(90 /* TryKeyword */, 170 /* TryBlock */); - if (token === 62 /* CatchKeyword */) { + var node = createNode(176 /* TryStatement */); + node.tryBlock = parseTokenAndBlock(94 /* TryKeyword */, 177 /* TryBlock */); + if (token === 66 /* CatchKeyword */) { node.catchBlock = parseCatchBlock(); } - if (token === 75 /* FinallyKeyword */) { - node.finallyBlock = parseTokenAndBlock(75 /* FinallyKeyword */, 172 /* FinallyBlock */); + if (token === 79 /* FinallyKeyword */) { + node.finallyBlock = parseTokenAndBlock(79 /* FinallyKeyword */, 179 /* FinallyBlock */); } if (!(node.catchBlock || node.finallyBlock)) { error(ts.Diagnostics.catch_or_finally_expected); @@ -4866,15 +5010,15 @@ var ts; } function parseCatchBlock() { var pos = getNodePos(); - parseExpected(62 /* CatchKeyword */); - parseExpected(11 /* OpenParenToken */); + parseExpected(66 /* CatchKeyword */); + parseExpected(15 /* OpenParenToken */); var variable = parseIdentifier(); var typeAnnotationColonStart = scanner.getTokenPos(); var typeAnnotationColonLength = scanner.getTextPos() - typeAnnotationColonStart; var typeAnnotation = parseTypeAnnotation(); - parseExpected(12 /* CloseParenToken */); + parseExpected(16 /* CloseParenToken */); var result = parseBlock(false, false); - result.kind = 171 /* CatchBlock */; + result.kind = 178 /* CatchBlock */; result.pos = pos; result.variable = variable; if (typeAnnotation) { @@ -4886,13 +5030,13 @@ var ts; return result; } function parseDebuggerStatement() { - var node = createNode(173 /* DebuggerStatement */); - parseExpected(66 /* DebuggerKeyword */); + var node = createNode(180 /* DebuggerStatement */); + parseExpected(70 /* DebuggerKeyword */); parseSemicolon(); return finishNode(node); } function isIterationStatementStart() { - return token === 94 /* WhileKeyword */ || token === 69 /* DoKeyword */ || token === 76 /* ForKeyword */; + return token === 98 /* WhileKeyword */ || token === 73 /* DoKeyword */ || token === 80 /* ForKeyword */; } function parseStatementWithLabelSet(allowLetAndConstDeclarations) { labelledStatementInfo.pushCurrentLabelSet(isIterationStatementStart()); @@ -4901,12 +5045,12 @@ var ts; return statement; } function isLabel() { - return isIdentifier() && lookAhead(function () { return nextToken() === 46 /* ColonToken */; }); + return isIdentifier() && lookAhead(function () { return nextToken() === 50 /* ColonToken */; }); } function parseLabeledStatement(allowLetAndConstDeclarations) { - var node = createNode(167 /* LabeledStatement */); + var node = createNode(174 /* LabeledStatement */); node.label = parseIdentifier(); - parseExpected(46 /* ColonToken */); + parseExpected(50 /* ColonToken */); if (labelledStatementInfo.nodeIsNestedInLabel(node.label, false, true)) { grammarErrorOnNode(node.label, ts.Diagnostics.Duplicate_label_0, getTextOfNodeFromSourceText(sourceText, node.label)); } @@ -4915,91 +5059,93 @@ var ts; return finishNode(node); } function parseExpressionStatement() { - var node = createNode(154 /* ExpressionStatement */); + var node = createNode(161 /* ExpressionStatement */); node.expression = parseExpression(); parseSemicolon(); return finishNode(node); } function isStatement(inErrorRecovery) { switch (token) { - case 17 /* SemicolonToken */: + case 21 /* SemicolonToken */: return !inErrorRecovery; - case 9 /* OpenBraceToken */: - case 92 /* VarKeyword */: - case 98 /* LetKeyword */: - case 64 /* ConstKeyword */: - case 77 /* FunctionKeyword */: - case 78 /* IfKeyword */: - case 69 /* DoKeyword */: - case 94 /* WhileKeyword */: - case 76 /* ForKeyword */: - case 65 /* ContinueKeyword */: - case 60 /* BreakKeyword */: - case 84 /* ReturnKeyword */: - case 95 /* WithKeyword */: - case 86 /* SwitchKeyword */: - case 88 /* ThrowKeyword */: - case 90 /* TryKeyword */: - case 66 /* DebuggerKeyword */: - case 62 /* CatchKeyword */: - case 75 /* FinallyKeyword */: + case 13 /* OpenBraceToken */: + case 96 /* VarKeyword */: + case 102 /* LetKeyword */: + case 81 /* FunctionKeyword */: + case 82 /* IfKeyword */: + case 73 /* DoKeyword */: + case 98 /* WhileKeyword */: + case 80 /* ForKeyword */: + case 69 /* ContinueKeyword */: + case 64 /* BreakKeyword */: + case 88 /* ReturnKeyword */: + case 99 /* WithKeyword */: + case 90 /* SwitchKeyword */: + case 92 /* ThrowKeyword */: + case 94 /* TryKeyword */: + case 70 /* DebuggerKeyword */: + case 66 /* CatchKeyword */: + case 79 /* FinallyKeyword */: return true; - case 97 /* InterfaceKeyword */: - case 63 /* ClassKeyword */: - case 110 /* ModuleKeyword */: - case 71 /* EnumKeyword */: - case 115 /* TypeKeyword */: - if (isDeclaration()) { + case 68 /* ConstKeyword */: + var isConstEnum = lookAhead(function () { return nextToken() === 75 /* EnumKeyword */; }); + return !isConstEnum; + case 101 /* InterfaceKeyword */: + case 67 /* ClassKeyword */: + case 114 /* ModuleKeyword */: + case 75 /* EnumKeyword */: + case 119 /* TypeKeyword */: + if (isDeclarationStart()) { return false; } - case 102 /* PublicKeyword */: - case 100 /* PrivateKeyword */: - case 101 /* ProtectedKeyword */: - case 103 /* StaticKeyword */: - if (lookAhead(function () { return nextToken() >= 59 /* Identifier */; })) { + case 106 /* PublicKeyword */: + case 104 /* PrivateKeyword */: + case 105 /* ProtectedKeyword */: + case 107 /* StaticKeyword */: + if (lookAhead(function () { return nextToken() >= 63 /* Identifier */; })) { return false; } default: - return isExpression(); + return isStartOfExpression(); } } function parseStatement(allowLetAndConstDeclarations) { switch (token) { - case 9 /* OpenBraceToken */: + case 13 /* OpenBraceToken */: return parseBlock(false, false); - case 92 /* VarKeyword */: - case 98 /* LetKeyword */: - case 64 /* ConstKeyword */: + case 96 /* VarKeyword */: + case 102 /* LetKeyword */: + case 68 /* ConstKeyword */: return parseVariableStatement(allowLetAndConstDeclarations); - case 77 /* FunctionKeyword */: + case 81 /* FunctionKeyword */: return parseFunctionDeclaration(); - case 17 /* SemicolonToken */: + case 21 /* SemicolonToken */: return parseEmptyStatement(); - case 78 /* IfKeyword */: + case 82 /* IfKeyword */: return parseIfStatement(); - case 69 /* DoKeyword */: + case 73 /* DoKeyword */: return parseDoStatement(); - case 94 /* WhileKeyword */: + case 98 /* WhileKeyword */: return parseWhileStatement(); - case 76 /* ForKeyword */: + case 80 /* ForKeyword */: return parseForOrForInStatement(); - case 65 /* ContinueKeyword */: - return parseBreakOrContinueStatement(160 /* ContinueStatement */); - case 60 /* BreakKeyword */: - return parseBreakOrContinueStatement(161 /* BreakStatement */); - case 84 /* ReturnKeyword */: + case 69 /* ContinueKeyword */: + return parseBreakOrContinueStatement(167 /* ContinueStatement */); + case 64 /* BreakKeyword */: + return parseBreakOrContinueStatement(168 /* BreakStatement */); + case 88 /* ReturnKeyword */: return parseReturnStatement(); - case 95 /* WithKeyword */: + case 99 /* WithKeyword */: return parseWithStatement(); - case 86 /* SwitchKeyword */: + case 90 /* SwitchKeyword */: return parseSwitchStatement(); - case 88 /* ThrowKeyword */: + case 92 /* ThrowKeyword */: return parseThrowStatement(); - case 90 /* TryKeyword */: - case 62 /* CatchKeyword */: - case 75 /* FinallyKeyword */: + case 94 /* TryKeyword */: + case 66 /* CatchKeyword */: + case 79 /* FinallyKeyword */: return parseTryStatement(); - case 66 /* DebuggerKeyword */: + case 70 /* DebuggerKeyword */: return parseDebuggerStatement(); default: if (isLabel()) { @@ -5011,7 +5157,7 @@ var ts; function parseAndCheckFunctionBody(isConstructor) { var initialPosition = scanner.getTokenPos(); var errorCountBeforeBody = file.syntacticErrors.length; - if (token === 9 /* OpenBraceToken */) { + if (token === 13 /* OpenBraceToken */) { var body = parseBody(false); if (body && inAmbientContext && file.syntacticErrors.length === errorCountBeforeBody) { var diagnostic = isConstructor ? ts.Diagnostics.A_constructor_implementation_cannot_be_declared_in_an_ambient_context : ts.Diagnostics.A_function_implementation_cannot_be_declared_in_an_ambient_context; @@ -5026,7 +5172,7 @@ var ts; error(ts.Diagnostics.Block_or_expected); } function parseVariableDeclaration(flags, noIn) { - var node = createNode(174 /* VariableDeclaration */); + var node = createNode(181 /* VariableDeclaration */); node.flags = flags; var errorCountBeforeVariableDeclaration = file.syntacticErrors.length; node.name = parseIdentifier(); @@ -5049,17 +5195,17 @@ var ts; return parseDelimitedList(9 /* VariableDeclarations */, function () { return parseVariableDeclaration(flags, noIn); }, false); } function parseVariableStatement(allowLetAndConstDeclarations, pos, flags) { - var node = createNode(152 /* VariableStatement */, pos); + var node = createNode(159 /* VariableStatement */, pos); if (flags) node.flags = flags; var errorCountBeforeVarStatement = file.syntacticErrors.length; - if (token === 98 /* LetKeyword */) { + if (token === 102 /* LetKeyword */) { node.flags |= 2048 /* Let */; } - else if (token === 64 /* ConstKeyword */) { + else if (token === 68 /* ConstKeyword */) { node.flags |= 4096 /* Const */; } - else if (token !== 92 /* VarKeyword */) { + else if (token !== 96 /* VarKeyword */) { error(ts.Diagnostics.var_let_or_const_expected); } nextToken(); @@ -5088,12 +5234,12 @@ var ts; return node; } function parseFunctionDeclaration(pos, flags) { - var node = createNode(175 /* FunctionDeclaration */, pos); + var node = createNode(182 /* FunctionDeclaration */, pos); if (flags) node.flags = flags; - parseExpected(77 /* FunctionKeyword */); + parseExpected(81 /* FunctionKeyword */); node.name = parseIdentifier(); - var sig = parseSignature(125 /* CallSignature */, 46 /* ColonToken */, false); + var sig = parseSignature(129 /* CallSignature */, 50 /* ColonToken */, false); node.typeParameters = sig.typeParameters; node.parameters = sig.parameters; node.type = sig.type; @@ -5104,10 +5250,10 @@ var ts; return finishNode(node); } function parseConstructorDeclaration(pos, flags) { - var node = createNode(122 /* Constructor */, pos); + var node = createNode(126 /* Constructor */, pos); node.flags = flags; - parseExpected(107 /* ConstructorKeyword */); - var sig = parseSignature(125 /* CallSignature */, 46 /* ColonToken */, false); + parseExpected(111 /* ConstructorKeyword */); + var sig = parseSignature(129 /* CallSignature */, 50 /* ColonToken */, false); node.typeParameters = sig.typeParameters; node.parameters = sig.parameters; node.type = sig.type; @@ -5124,14 +5270,14 @@ var ts; var errorCountBeforePropertyDeclaration = file.syntacticErrors.length; var name = parsePropertyName(); var questionStart = scanner.getTokenPos(); - if (parseOptional(45 /* QuestionToken */)) { + if (parseOptional(49 /* QuestionToken */)) { errorAtPos(questionStart, scanner.getStartPos() - questionStart, ts.Diagnostics.A_class_member_cannot_be_declared_optional); } - if (token === 11 /* OpenParenToken */ || token === 19 /* LessThanToken */) { - var method = createNode(121 /* Method */, pos); + if (token === 15 /* OpenParenToken */ || token === 23 /* LessThanToken */) { + var method = createNode(125 /* Method */, pos); method.flags = flags; method.name = name; - var sig = parseSignature(125 /* CallSignature */, 46 /* ColonToken */, false); + var sig = parseSignature(129 /* CallSignature */, 50 /* ColonToken */, false); method.typeParameters = sig.typeParameters; method.parameters = sig.parameters; method.type = sig.type; @@ -5139,7 +5285,7 @@ var ts; return finishNode(method); } else { - var property = createNode(120 /* Property */, pos); + var property = createNode(124 /* Property */, pos); property.flags = flags; property.name = name; property.type = parseTypeAnnotation(); @@ -5166,10 +5312,10 @@ var ts; else if (accessor.typeParameters) { grammarErrorOnNode(accessor.name, ts.Diagnostics.An_accessor_cannot_have_type_parameters); } - else if (kind === 123 /* GetAccessor */ && accessor.parameters.length) { + else if (kind === 127 /* GetAccessor */ && accessor.parameters.length) { grammarErrorOnNode(accessor.name, ts.Diagnostics.A_get_accessor_cannot_have_parameters); } - else if (kind === 124 /* SetAccessor */) { + else if (kind === 128 /* SetAccessor */) { if (accessor.type) { grammarErrorOnNode(accessor.name, ts.Diagnostics.A_set_accessor_cannot_have_a_return_type_annotation); } @@ -5199,7 +5345,7 @@ var ts; var node = createNode(kind, pos); node.flags = flags; node.name = parsePropertyName(); - var sig = parseSignature(125 /* CallSignature */, 46 /* ColonToken */, false); + var sig = parseSignature(129 /* CallSignature */, 50 /* ColonToken */, false); node.typeParameters = sig.typeParameters; node.parameters = sig.parameters; node.type = sig.type; @@ -5222,19 +5368,19 @@ var ts; idToken = token; nextToken(); } - if (token === 13 /* OpenBracketToken */) { + if (token === 17 /* OpenBracketToken */) { return true; } if (idToken !== undefined) { - if (!isKeyword(idToken) || idToken === 113 /* SetKeyword */ || idToken === 109 /* GetKeyword */) { + if (!isKeyword(idToken) || idToken === 117 /* SetKeyword */ || idToken === 113 /* GetKeyword */) { return true; } switch (token) { - case 11 /* OpenParenToken */: - case 19 /* LessThanToken */: - case 46 /* ColonToken */: - case 47 /* EqualsToken */: - case 45 /* QuestionToken */: + case 15 /* OpenParenToken */: + case 23 /* LessThanToken */: + case 50 /* ColonToken */: + case 51 /* EqualsToken */: + case 49 /* QuestionToken */: return true; default: return canParseSemicolon(); @@ -5259,7 +5405,7 @@ var ts; break; var modifierLength = scanner.getStartPos() - modifierStart; switch (modifierToken) { - case 102 /* PublicKeyword */: + case 106 /* PublicKeyword */: if (flags & ts.NodeFlags.AccessibilityModifier) { grammarErrorAtPos(modifierStart, modifierLength, ts.Diagnostics.Accessibility_modifier_already_seen); } @@ -5271,7 +5417,7 @@ var ts; } flags |= 16 /* Public */; break; - case 100 /* PrivateKeyword */: + case 104 /* PrivateKeyword */: if (flags & ts.NodeFlags.AccessibilityModifier) { grammarErrorAtPos(modifierStart, modifierLength, ts.Diagnostics.Accessibility_modifier_already_seen); } @@ -5285,7 +5431,7 @@ var ts; lastPrivateModifierLength = modifierLength; flags |= 32 /* Private */; break; - case 101 /* ProtectedKeyword */: + case 105 /* ProtectedKeyword */: if (flags & 16 /* Public */ || flags & 32 /* Private */ || flags & 64 /* Protected */) { grammarErrorAtPos(modifierStart, modifierLength, ts.Diagnostics.Accessibility_modifier_already_seen); } @@ -5299,7 +5445,7 @@ var ts; lastProtectedModifierLength = modifierLength; flags |= 64 /* Protected */; break; - case 103 /* StaticKeyword */: + case 107 /* StaticKeyword */: if (flags & 128 /* Static */) { grammarErrorAtPos(modifierStart, modifierLength, ts.Diagnostics._0_modifier_already_seen, "static"); } @@ -5313,7 +5459,7 @@ var ts; lastStaticModifierLength = modifierLength; flags |= 128 /* Static */; break; - case 72 /* ExportKeyword */: + case 76 /* ExportKeyword */: if (flags & 1 /* Export */) { grammarErrorAtPos(modifierStart, modifierLength, ts.Diagnostics._0_modifier_already_seen, "export"); } @@ -5328,7 +5474,7 @@ var ts; } flags |= 1 /* Export */; break; - case 108 /* DeclareKeyword */: + case 112 /* DeclareKeyword */: if (flags & 2 /* Ambient */) { grammarErrorAtPos(modifierStart, modifierLength, ts.Diagnostics._0_modifier_already_seen, "declare"); } @@ -5347,26 +5493,26 @@ var ts; break; } } - if (token === 107 /* ConstructorKeyword */ && flags & 128 /* Static */) { + if (token === 111 /* ConstructorKeyword */ && flags & 128 /* Static */) { grammarErrorAtPos(lastStaticModifierStart, lastStaticModifierLength, ts.Diagnostics._0_modifier_cannot_appear_on_a_constructor_declaration, "static"); } - else if (token === 107 /* ConstructorKeyword */ && flags & 32 /* Private */) { + else if (token === 111 /* ConstructorKeyword */ && flags & 32 /* Private */) { grammarErrorAtPos(lastPrivateModifierStart, lastPrivateModifierLength, ts.Diagnostics._0_modifier_cannot_appear_on_a_constructor_declaration, "private"); } - else if (token === 107 /* ConstructorKeyword */ && flags & 64 /* Protected */) { + else if (token === 111 /* ConstructorKeyword */ && flags & 64 /* Protected */) { grammarErrorAtPos(lastProtectedModifierStart, lastProtectedModifierLength, ts.Diagnostics._0_modifier_cannot_appear_on_a_constructor_declaration, "protected"); } - else if (token === 79 /* ImportKeyword */) { + else if (token === 83 /* ImportKeyword */) { if (flags & 2 /* Ambient */) { grammarErrorAtPos(lastDeclareModifierStart, lastDeclareModifierLength, ts.Diagnostics.A_declare_modifier_cannot_be_used_with_an_import_declaration, "declare"); } } - else if (token === 97 /* InterfaceKeyword */) { + else if (token === 101 /* InterfaceKeyword */) { if (flags & 2 /* Ambient */) { grammarErrorAtPos(lastDeclareModifierStart, lastDeclareModifierLength, ts.Diagnostics.A_declare_modifier_cannot_be_used_with_an_interface_declaration, "declare"); } } - else if (token !== 72 /* ExportKeyword */ && !(flags & 2 /* Ambient */) && inAmbientContext && context === 0 /* SourceElements */) { + else if (token !== 76 /* ExportKeyword */ && !(flags & 2 /* Ambient */) && inAmbientContext && context === 0 /* SourceElements */) { var declarationStart = scanner.getTokenPos(); var declarationFirstTokenLength = scanner.getTextPos() - declarationStart; grammarErrorAtPos(declarationStart, declarationFirstTokenLength, ts.Diagnostics.A_declare_modifier_is_required_for_a_top_level_declaration_in_a_d_ts_file); @@ -5376,19 +5522,19 @@ var ts; function parseClassMemberDeclaration() { var pos = getNodePos(); var flags = parseAndCheckModifiers(2 /* ClassMembers */); - if (parseContextualModifier(109 /* GetKeyword */)) { - return parseAndCheckMemberAccessorDeclaration(123 /* GetAccessor */, pos, flags); + if (parseContextualModifier(113 /* GetKeyword */)) { + return parseAndCheckMemberAccessorDeclaration(127 /* GetAccessor */, pos, flags); } - if (parseContextualModifier(113 /* SetKeyword */)) { - return parseAndCheckMemberAccessorDeclaration(124 /* SetAccessor */, pos, flags); + if (parseContextualModifier(117 /* SetKeyword */)) { + return parseAndCheckMemberAccessorDeclaration(128 /* SetAccessor */, pos, flags); } - if (token === 107 /* ConstructorKeyword */) { + if (token === 111 /* ConstructorKeyword */) { return parseConstructorDeclaration(pos, flags); } - if (token >= 59 /* Identifier */ || token === 7 /* StringLiteral */ || token === 6 /* NumericLiteral */) { + if (token >= 63 /* Identifier */ || token === 7 /* StringLiteral */ || token === 6 /* NumericLiteral */) { return parsePropertyMemberDeclaration(pos, flags); } - if (token === 13 /* OpenBracketToken */) { + if (token === 17 /* OpenBracketToken */) { if (flags) { var start = getTokenPos(pos); var length = getNodePos() - start; @@ -5399,23 +5545,23 @@ var ts; ts.Debug.fail("Should not have attempted to parse class member declaration."); } function parseClassDeclaration(pos, flags) { - var node = createNode(177 /* ClassDeclaration */, pos); + var node = createNode(184 /* ClassDeclaration */, pos); node.flags = flags; var errorCountBeforeClassDeclaration = file.syntacticErrors.length; - parseExpected(63 /* ClassKeyword */); + parseExpected(67 /* ClassKeyword */); node.name = parseIdentifier(); node.typeParameters = parseTypeParameters(); - node.baseType = parseOptional(73 /* ExtendsKeyword */) ? parseTypeReference() : undefined; + node.baseType = parseOptional(77 /* ExtendsKeyword */) ? parseTypeReference() : undefined; var implementsKeywordStart = scanner.getTokenPos(); var implementsKeywordLength; - if (parseOptional(96 /* ImplementsKeyword */)) { + if (parseOptional(100 /* ImplementsKeyword */)) { implementsKeywordLength = scanner.getStartPos() - implementsKeywordStart; node.implementedTypes = parseDelimitedList(8 /* BaseTypeReferences */, parseTypeReference, false); } var errorCountBeforeClassBody = file.syntacticErrors.length; - if (parseExpected(9 /* OpenBraceToken */)) { + if (parseExpected(13 /* OpenBraceToken */)) { node.members = parseList(6 /* ClassMembers */, false, parseClassMemberDeclaration); - parseExpected(10 /* CloseBraceToken */); + parseExpected(14 /* CloseBraceToken */); } else { node.members = createMissingList(); @@ -5426,15 +5572,15 @@ var ts; return finishNode(node); } function parseInterfaceDeclaration(pos, flags) { - var node = createNode(178 /* InterfaceDeclaration */, pos); + var node = createNode(185 /* InterfaceDeclaration */, pos); node.flags = flags; var errorCountBeforeInterfaceDeclaration = file.syntacticErrors.length; - parseExpected(97 /* InterfaceKeyword */); + parseExpected(101 /* InterfaceKeyword */); node.name = parseIdentifier(); node.typeParameters = parseTypeParameters(); var extendsKeywordStart = scanner.getTokenPos(); var extendsKeywordLength; - if (parseOptional(73 /* ExtendsKeyword */)) { + if (parseOptional(77 /* ExtendsKeyword */)) { extendsKeywordLength = scanner.getStartPos() - extendsKeywordStart; node.baseTypes = parseDelimitedList(8 /* BaseTypeReferences */, parseTypeReference, false); } @@ -5446,30 +5592,24 @@ var ts; return finishNode(node); } function parseTypeAliasDeclaration(pos, flags) { - var node = createNode(179 /* TypeAliasDeclaration */, pos); + var node = createNode(186 /* TypeAliasDeclaration */, pos); node.flags = flags; - parseExpected(115 /* TypeKeyword */); + parseExpected(119 /* TypeKeyword */); node.name = parseIdentifier(); - parseExpected(47 /* EqualsToken */); + parseExpected(51 /* EqualsToken */); node.type = parseType(); parseSemicolon(); - var n = node.type; - while (n.kind === 134 /* ParenType */) { - n = n.type; - } - if (n.kind === 130 /* TypeLiteral */ && (n.pos !== n.members.pos || n.end !== n.members.end)) { - grammarErrorOnNode(node.type, ts.Diagnostics.Aliased_type_cannot_be_an_object_type_literal_Use_an_interface_declaration_instead); - } return finishNode(node); } function parseAndCheckEnumDeclaration(pos, flags) { + var enumIsConst = flags & 4096 /* Const */; function isIntegerLiteral(expression) { function isInteger(literalExpression) { return /^[0-9]+([eE]\+?[0-9]+)?$/.test(literalExpression.text); } - if (expression.kind === 146 /* PrefixOperator */) { + if (expression.kind === 151 /* PrefixOperator */) { var unaryExpression = expression; - if (unaryExpression.operator === 28 /* PlusToken */ || unaryExpression.operator === 29 /* MinusToken */) { + if (unaryExpression.operator === 32 /* PlusToken */ || unaryExpression.operator === 33 /* MinusToken */) { expression = unaryExpression.operand; } } @@ -5480,30 +5620,35 @@ var ts; } var inConstantEnumMemberSection = true; function parseAndCheckEnumMember() { - var node = createNode(185 /* EnumMember */); + var node = createNode(192 /* EnumMember */); var errorCountBeforeEnumMember = file.syntacticErrors.length; node.name = parsePropertyName(); node.initializer = parseInitializer(false); - if (inAmbientContext) { - if (node.initializer && !isIntegerLiteral(node.initializer) && errorCountBeforeEnumMember === file.syntacticErrors.length) { - grammarErrorOnNode(node.name, ts.Diagnostics.Ambient_enum_elements_can_only_have_integer_literal_initializers); + if (!enumIsConst) { + if (inAmbientContext) { + if (node.initializer && !isIntegerLiteral(node.initializer) && errorCountBeforeEnumMember === file.syntacticErrors.length) { + grammarErrorOnNode(node.name, ts.Diagnostics.Ambient_enum_elements_can_only_have_integer_literal_initializers); + } + } + else if (node.initializer) { + inConstantEnumMemberSection = isIntegerLiteral(node.initializer); + } + else if (!inConstantEnumMemberSection && errorCountBeforeEnumMember === file.syntacticErrors.length) { + grammarErrorOnNode(node.name, ts.Diagnostics.Enum_member_must_have_initializer); } - } - else if (node.initializer) { - inConstantEnumMemberSection = isIntegerLiteral(node.initializer); - } - else if (!inConstantEnumMemberSection && errorCountBeforeEnumMember === file.syntacticErrors.length) { - grammarErrorOnNode(node.name, ts.Diagnostics.Enum_member_must_have_initializer); } return finishNode(node); } - var node = createNode(180 /* EnumDeclaration */, pos); + var node = createNode(187 /* EnumDeclaration */, pos); node.flags = flags; - parseExpected(71 /* EnumKeyword */); + if (enumIsConst) { + parseExpected(68 /* ConstKeyword */); + } + parseExpected(75 /* EnumKeyword */); node.name = parseIdentifier(); - if (parseExpected(9 /* OpenBraceToken */)) { + if (parseExpected(13 /* OpenBraceToken */)) { node.members = parseDelimitedList(7 /* EnumMembers */, parseAndCheckEnumMember, true); - parseExpected(10 /* CloseBraceToken */); + parseExpected(14 /* CloseBraceToken */); } else { node.members = createMissingList(); @@ -5511,10 +5656,10 @@ var ts; return finishNode(node); } function parseModuleBody() { - var node = createNode(182 /* ModuleBlock */); - if (parseExpected(9 /* OpenBraceToken */)) { + var node = createNode(189 /* ModuleBlock */); + if (parseExpected(13 /* OpenBraceToken */)) { node.statements = parseList(1 /* ModuleElements */, false, parseModuleElement); - parseExpected(10 /* CloseBraceToken */); + parseExpected(14 /* CloseBraceToken */); } else { node.statements = createMissingList(); @@ -5522,19 +5667,19 @@ var ts; return finishNode(node); } function parseInternalModuleTail(pos, flags) { - var node = createNode(181 /* ModuleDeclaration */, pos); + var node = createNode(188 /* ModuleDeclaration */, pos); node.flags = flags; node.name = parseIdentifier(); - if (parseOptional(15 /* DotToken */)) { + if (parseOptional(19 /* DotToken */)) { node.body = parseInternalModuleTail(getNodePos(), 1 /* Export */); } else { node.body = parseModuleBody(); ts.forEach(node.body.statements, function (s) { - if (s.kind === 184 /* ExportAssignment */) { + if (s.kind === 191 /* ExportAssignment */) { grammarErrorOnNode(s, ts.Diagnostics.An_export_assignment_cannot_be_used_in_an_internal_module); } - else if (s.kind === 183 /* ImportDeclaration */ && s.externalModuleName) { + else if (s.kind === 190 /* ImportDeclaration */ && s.externalModuleName) { grammarErrorOnNode(s, ts.Diagnostics.Import_declarations_in_an_internal_module_cannot_reference_an_external_module); } }); @@ -5542,7 +5687,7 @@ var ts; return finishNode(node); } function parseAmbientExternalModuleDeclaration(pos, flags) { - var node = createNode(181 /* ModuleDeclaration */, pos); + var node = createNode(188 /* ModuleDeclaration */, pos); node.flags = flags; node.name = parseStringLiteral(); if (!inAmbientContext) { @@ -5558,19 +5703,19 @@ var ts; return finishNode(node); } function parseModuleDeclaration(pos, flags) { - parseExpected(110 /* ModuleKeyword */); + parseExpected(114 /* ModuleKeyword */); return token === 7 /* StringLiteral */ ? parseAmbientExternalModuleDeclaration(pos, flags) : parseInternalModuleTail(pos, flags); } function parseImportDeclaration(pos, flags) { - var node = createNode(183 /* ImportDeclaration */, pos); + var node = createNode(190 /* ImportDeclaration */, pos); node.flags = flags; - parseExpected(79 /* ImportKeyword */); + parseExpected(83 /* ImportKeyword */); node.name = parseIdentifier(); - parseExpected(47 /* EqualsToken */); + parseExpected(51 /* EqualsToken */); var entityName = parseEntityName(false); - if (entityName.kind === 59 /* Identifier */ && entityName.text === "require" && parseOptional(11 /* OpenParenToken */)) { + if (entityName.kind === 63 /* Identifier */ && entityName.text === "require" && parseOptional(15 /* OpenParenToken */)) { node.externalModuleName = parseStringLiteral(); - parseExpected(12 /* CloseParenToken */); + parseExpected(16 /* CloseParenToken */); } else { node.entityName = entityName; @@ -5579,36 +5724,36 @@ var ts; return finishNode(node); } function parseExportAssignmentTail(pos) { - var node = createNode(184 /* ExportAssignment */, pos); + var node = createNode(191 /* ExportAssignment */, pos); node.exportName = parseIdentifier(); parseSemicolon(); return finishNode(node); } - function isDeclaration() { + function isDeclarationStart() { switch (token) { - case 92 /* VarKeyword */: - case 98 /* LetKeyword */: - case 64 /* ConstKeyword */: - case 77 /* FunctionKeyword */: + case 96 /* VarKeyword */: + case 102 /* LetKeyword */: + case 68 /* ConstKeyword */: + case 81 /* FunctionKeyword */: return true; - case 63 /* ClassKeyword */: - case 97 /* InterfaceKeyword */: - case 71 /* EnumKeyword */: - case 79 /* ImportKeyword */: - case 115 /* TypeKeyword */: - return lookAhead(function () { return nextToken() >= 59 /* Identifier */; }); - case 110 /* ModuleKeyword */: - return lookAhead(function () { return nextToken() >= 59 /* Identifier */ || token === 7 /* StringLiteral */; }); - case 72 /* ExportKeyword */: - return lookAhead(function () { return nextToken() === 47 /* EqualsToken */ || isDeclaration(); }); - case 108 /* DeclareKeyword */: - case 102 /* PublicKeyword */: - case 100 /* PrivateKeyword */: - case 101 /* ProtectedKeyword */: - case 103 /* StaticKeyword */: + case 67 /* ClassKeyword */: + case 101 /* InterfaceKeyword */: + case 75 /* EnumKeyword */: + case 83 /* ImportKeyword */: + case 119 /* TypeKeyword */: + return lookAhead(function () { return nextToken() >= 63 /* Identifier */; }); + case 114 /* ModuleKeyword */: + return lookAhead(function () { return nextToken() >= 63 /* Identifier */ || token === 7 /* StringLiteral */; }); + case 76 /* ExportKeyword */: + return lookAhead(function () { return nextToken() === 51 /* EqualsToken */ || isDeclarationStart(); }); + case 112 /* DeclareKeyword */: + case 106 /* PublicKeyword */: + case 104 /* PrivateKeyword */: + case 105 /* ProtectedKeyword */: + case 107 /* StaticKeyword */: return lookAhead(function () { nextToken(); - return isDeclaration(); + return isDeclarationStart(); }); } } @@ -5616,10 +5761,10 @@ var ts; var pos = getNodePos(); var errorCountBeforeModifiers = file.syntacticErrors.length; var flags = parseAndCheckModifiers(modifierContext); - if (token === 72 /* ExportKeyword */) { + if (token === 76 /* ExportKeyword */) { var modifiersEnd = scanner.getStartPos(); nextToken(); - if (parseOptional(47 /* EqualsToken */)) { + if (parseOptional(51 /* EqualsToken */)) { var exportAssignmentTail = parseExportAssignmentTail(pos); if (flags !== 0 && errorCountBeforeModifiers === file.syntacticErrors.length) { var modifiersStart = ts.skipTrivia(sourceText, pos); @@ -5634,30 +5779,38 @@ var ts; } var result; switch (token) { - case 92 /* VarKeyword */: - case 98 /* LetKeyword */: - case 64 /* ConstKeyword */: + case 96 /* VarKeyword */: + case 102 /* LetKeyword */: result = parseVariableStatement(true, pos, flags); break; - case 77 /* FunctionKeyword */: + case 68 /* ConstKeyword */: + var isConstEnum = lookAhead(function () { return nextToken() === 75 /* EnumKeyword */; }); + if (isConstEnum) { + result = parseAndCheckEnumDeclaration(pos, flags | 4096 /* Const */); + } + else { + result = parseVariableStatement(true, pos, flags); + } + break; + case 81 /* FunctionKeyword */: result = parseFunctionDeclaration(pos, flags); break; - case 63 /* ClassKeyword */: + case 67 /* ClassKeyword */: result = parseClassDeclaration(pos, flags); break; - case 97 /* InterfaceKeyword */: + case 101 /* InterfaceKeyword */: result = parseInterfaceDeclaration(pos, flags); break; - case 115 /* TypeKeyword */: + case 119 /* TypeKeyword */: result = parseTypeAliasDeclaration(pos, flags); break; - case 71 /* EnumKeyword */: + case 75 /* EnumKeyword */: result = parseAndCheckEnumDeclaration(pos, flags); break; - case 110 /* ModuleKeyword */: + case 114 /* ModuleKeyword */: result = parseModuleDeclaration(pos, flags); break; - case 79 /* ImportKeyword */: + case 83 /* ImportKeyword */: result = parseImportDeclaration(pos, flags); break; default: @@ -5667,7 +5820,7 @@ var ts; return result; } function isSourceElement(inErrorRecovery) { - return isDeclaration() || isStatement(inErrorRecovery); + return isDeclarationStart() || isStatement(inErrorRecovery); } function parseSourceElement() { return parseSourceElementOrModuleElement(0 /* SourceElements */); @@ -5676,7 +5829,7 @@ var ts; return parseSourceElementOrModuleElement(1 /* ModuleElements */); } function parseSourceElementOrModuleElement(modifierContext) { - if (isDeclaration()) { + if (isDeclarationStart()) { return parseDeclaration(modifierContext); } var statementStart = scanner.getTokenPos(); @@ -5734,7 +5887,7 @@ var ts; }; } function getExternalModuleIndicator() { - return ts.forEach(file.statements, function (node) { return node.flags & 1 /* Export */ || node.kind === 183 /* ImportDeclaration */ && node.externalModuleName || node.kind === 184 /* ExportAssignment */ ? node : undefined; }); + return ts.forEach(file.statements, function (node) { return node.flags & 1 /* Export */ || node.kind === 190 /* ImportDeclaration */ && node.externalModuleName || node.kind === 191 /* ExportAssignment */ ? node : undefined; }); } scanner = ts.createScanner(languageVersion, true, sourceText, scanError, onComment); var rootNodeFlags = 0; @@ -5742,7 +5895,7 @@ var ts; rootNodeFlags = 1024 /* DeclarationFile */; inAmbientContext = true; } - file = createRootNode(186 /* SourceFile */, 0, sourceText.length, rootNodeFlags); + file = createRootNode(193 /* SourceFile */, 0, sourceText.length, rootNodeFlags); file.filename = ts.normalizePath(filename); file.text = sourceText; file.getLineAndCharacterFromPosition = getLineAndCharacterlFromSourcePosition; @@ -5875,7 +6028,7 @@ var ts; } function processImportedModules(file, basePath) { ts.forEach(file.statements, function (node) { - if (node.kind === 183 /* ImportDeclaration */ && node.externalModuleName) { + if (node.kind === 190 /* ImportDeclaration */ && node.externalModuleName) { var nameLiteral = node.externalModuleName; var moduleName = nameLiteral.text; if (moduleName) { @@ -5893,9 +6046,9 @@ var ts; } } } - else if (node.kind === 181 /* ModuleDeclaration */ && node.name.kind === 7 /* StringLiteral */ && (node.flags & 2 /* Ambient */ || isDeclarationFile(file))) { + else if (node.kind === 188 /* ModuleDeclaration */ && node.name.kind === 7 /* StringLiteral */ && (node.flags & 2 /* Ambient */ || isDeclarationFile(file))) { forEachChild(node.body, function (node) { - if (node.kind === 183 /* ImportDeclaration */ && node.externalModuleName) { + if (node.kind === 190 /* ImportDeclaration */ && node.externalModuleName) { var nameLiteral = node.externalModuleName; var moduleName = nameLiteral.text; if (moduleName) { @@ -5967,24 +6120,46 @@ var ts; })(ts || (ts = {})); var ts; (function (ts) { - function isInstantiated(node) { - if (node.kind === 178 /* InterfaceDeclaration */) { - return false; + (function (ModuleInstanceState) { + ModuleInstanceState[ModuleInstanceState["NonInstantiated"] = 0] = "NonInstantiated"; + ModuleInstanceState[ModuleInstanceState["Instantiated"] = 1] = "Instantiated"; + ModuleInstanceState[ModuleInstanceState["ConstEnumOnly"] = 2] = "ConstEnumOnly"; + })(ts.ModuleInstanceState || (ts.ModuleInstanceState = {})); + var ModuleInstanceState = ts.ModuleInstanceState; + function getModuleInstanceState(node) { + if (node.kind === 185 /* InterfaceDeclaration */) { + return 0 /* NonInstantiated */; } - else if (node.kind === 183 /* ImportDeclaration */ && !(node.flags & 1 /* Export */)) { - return false; + else if (node.kind === 187 /* EnumDeclaration */ && ts.isConstEnumDeclaration(node)) { + return 2 /* ConstEnumOnly */; } - else if (node.kind === 182 /* ModuleBlock */ && !ts.forEachChild(node, isInstantiated)) { - return false; + else if (node.kind === 190 /* ImportDeclaration */ && !(node.flags & 1 /* Export */)) { + return 0 /* NonInstantiated */; } - else if (node.kind === 181 /* ModuleDeclaration */ && !isInstantiated(node.body)) { - return false; + else if (node.kind === 189 /* ModuleBlock */) { + var state = 0 /* NonInstantiated */; + ts.forEachChild(node, function (n) { + switch (getModuleInstanceState(n)) { + case 0 /* NonInstantiated */: + return false; + case 2 /* ConstEnumOnly */: + state = 2 /* ConstEnumOnly */; + return false; + case 1 /* Instantiated */: + state = 1 /* Instantiated */; + return true; + } + }); + return state; + } + else if (node.kind === 188 /* ModuleDeclaration */) { + return getModuleInstanceState(node.body); } else { - return true; + return 1 /* Instantiated */; } } - ts.isInstantiated = isInstantiated; + ts.getModuleInstanceState = getModuleInstanceState; function bindSourceFile(file) { var parent; var container; @@ -6017,20 +6192,16 @@ var ts; } function getDeclarationName(node) { if (node.name) { - if (node.kind === 181 /* ModuleDeclaration */ && node.name.kind === 7 /* StringLiteral */) { + if (node.kind === 188 /* ModuleDeclaration */ && node.name.kind === 7 /* StringLiteral */) { return '"' + node.name.text + '"'; } return node.name.text; } switch (node.kind) { - case 122 /* Constructor */: - return "__constructor"; - case 125 /* CallSignature */: - return "__call"; - case 126 /* ConstructSignature */: - return "__new"; - case 127 /* IndexSignature */: - return "__index"; + case 126 /* Constructor */: return "__constructor"; + case 129 /* CallSignature */: return "__call"; + case 130 /* ConstructSignature */: return "__new"; + case 131 /* IndexSignature */: return "__index"; } } function getDisplayName(node) { @@ -6057,8 +6228,8 @@ var ts; } addDeclarationToSymbol(symbol, node, includes); symbol.parent = parent; - if (node.kind === 177 /* ClassDeclaration */ && symbol.exports) { - var prototypeSymbol = createSymbol(4 /* Property */ | 268435456 /* Prototype */, "prototype"); + if (node.kind === 184 /* ClassDeclaration */ && symbol.exports) { + var prototypeSymbol = createSymbol(4 /* Property */ | 536870912 /* Prototype */, "prototype"); if (ts.hasProperty(symbol.exports, prototypeSymbol.name)) { if (node.name) { node.name.parent = node; @@ -6081,15 +6252,15 @@ var ts; function declareModuleMember(node, symbolKind, symbolExcludes) { var exportKind = 0; if (symbolKind & ts.SymbolFlags.Value) { - exportKind |= 2097152 /* ExportValue */; + exportKind |= 4194304 /* ExportValue */; } if (symbolKind & ts.SymbolFlags.Type) { - exportKind |= 4194304 /* ExportType */; + exportKind |= 8388608 /* ExportType */; } if (symbolKind & ts.SymbolFlags.Namespace) { - exportKind |= 8388608 /* ExportNamespace */; + exportKind |= 16777216 /* ExportNamespace */; } - if (node.flags & 1 /* Export */ || (node.kind !== 183 /* ImportDeclaration */ && isAmbientContext(container))) { + if (node.flags & 1 /* Export */ || (node.kind !== 190 /* ImportDeclaration */ && isAmbientContext(container))) { if (exportKind) { var local = declareSymbol(container.locals, undefined, node, exportKind, symbolExcludes); local.exportSymbol = declareSymbol(container.symbol.exports, container.symbol, node, symbolKind, symbolExcludes); @@ -6130,44 +6301,44 @@ var ts; } function bindDeclaration(node, symbolKind, symbolExcludes, isBlockScopeContainer) { switch (container.kind) { - case 181 /* ModuleDeclaration */: + case 188 /* ModuleDeclaration */: declareModuleMember(node, symbolKind, symbolExcludes); break; - case 186 /* SourceFile */: + case 193 /* SourceFile */: if (ts.isExternalModule(container)) { declareModuleMember(node, symbolKind, symbolExcludes); break; } - case 125 /* CallSignature */: - case 126 /* ConstructSignature */: - case 127 /* IndexSignature */: - case 121 /* Method */: - case 122 /* Constructor */: - case 123 /* GetAccessor */: - case 124 /* SetAccessor */: - case 175 /* FunctionDeclaration */: - case 144 /* FunctionExpression */: - case 145 /* ArrowFunction */: + case 129 /* CallSignature */: + case 130 /* ConstructSignature */: + case 131 /* IndexSignature */: + case 125 /* Method */: + case 126 /* Constructor */: + case 127 /* GetAccessor */: + case 128 /* SetAccessor */: + case 182 /* FunctionDeclaration */: + case 149 /* FunctionExpression */: + case 150 /* ArrowFunction */: declareSymbol(container.locals, undefined, node, symbolKind, symbolExcludes); break; - case 177 /* ClassDeclaration */: + case 184 /* ClassDeclaration */: if (node.flags & 128 /* Static */) { declareSymbol(container.symbol.exports, container.symbol, node, symbolKind, symbolExcludes); break; } - case 130 /* TypeLiteral */: - case 136 /* ObjectLiteral */: - case 178 /* InterfaceDeclaration */: + case 134 /* TypeLiteral */: + case 140 /* ObjectLiteral */: + case 185 /* InterfaceDeclaration */: declareSymbol(container.symbol.members, container.symbol, node, symbolKind, symbolExcludes); break; - case 180 /* EnumDeclaration */: + case 187 /* EnumDeclaration */: declareSymbol(container.symbol.exports, container.symbol, node, symbolKind, symbolExcludes); break; } bindChildren(node, symbolKind, isBlockScopeContainer); } function bindConstructorDeclaration(node) { - bindDeclaration(node, 8192 /* Constructor */, 0, true); + bindDeclaration(node, 16384 /* Constructor */, 0, true); ts.forEach(node.parameters, function (p) { if (p.flags & (16 /* Public */ | 32 /* Private */ | 64 /* Protected */)) { bindDeclaration(p, 4 /* Property */, ts.SymbolFlags.PropertyExcludes, false); @@ -6176,13 +6347,22 @@ var ts; } function bindModuleDeclaration(node) { if (node.name.kind === 7 /* StringLiteral */) { - bindDeclaration(node, 256 /* ValueModule */, ts.SymbolFlags.ValueModuleExcludes, true); - } - else if (isInstantiated(node)) { - bindDeclaration(node, 256 /* ValueModule */, ts.SymbolFlags.ValueModuleExcludes, true); + bindDeclaration(node, 512 /* ValueModule */, ts.SymbolFlags.ValueModuleExcludes, true); } else { - bindDeclaration(node, 512 /* NamespaceModule */, 0 /* NamespaceModuleExcludes */, true); + var state = getModuleInstanceState(node); + if (state === 0 /* NonInstantiated */) { + bindDeclaration(node, 1024 /* NamespaceModule */, 0 /* NamespaceModuleExcludes */, true); + } + else { + bindDeclaration(node, 512 /* ValueModule */, ts.SymbolFlags.ValueModuleExcludes, true); + if (state === 2 /* ConstEnumOnly */) { + node.symbol.constEnumOnlyModule = true; + } + else if (node.symbol.constEnumOnlyModule) { + node.symbol.constEnumOnlyModule = false; + } + } } } function bindAnonymousDeclaration(node, symbolKind, name, isBlockScopeContainer) { @@ -6202,10 +6382,10 @@ var ts; } function bindBlockScopedVariableDeclaration(node) { switch (blockScopeContainer.kind) { - case 181 /* ModuleDeclaration */: + case 188 /* ModuleDeclaration */: declareModuleMember(node, 2 /* BlockScopedVariable */, ts.SymbolFlags.BlockScopedVariableExcludes); break; - case 186 /* SourceFile */: + case 193 /* SourceFile */: if (ts.isExternalModule(container)) { declareModuleMember(node, 2 /* BlockScopedVariable */, ts.SymbolFlags.BlockScopedVariableExcludes); break; @@ -6221,13 +6401,13 @@ var ts; function bind(node) { node.parent = parent; switch (node.kind) { - case 118 /* TypeParameter */: - bindDeclaration(node, 524288 /* TypeParameter */, ts.SymbolFlags.TypeParameterExcludes, false); + case 122 /* TypeParameter */: + bindDeclaration(node, 1048576 /* TypeParameter */, ts.SymbolFlags.TypeParameterExcludes, false); break; - case 119 /* Parameter */: + case 123 /* Parameter */: bindDeclaration(node, 1 /* FunctionScopedVariable */, ts.SymbolFlags.ParameterExcludes, false); break; - case 174 /* VariableDeclaration */: + case 181 /* VariableDeclaration */: if (node.flags & ts.NodeFlags.BlockScoped) { bindBlockScopedVariableDeclaration(node); } @@ -6235,80 +6415,85 @@ var ts; bindDeclaration(node, 1 /* FunctionScopedVariable */, ts.SymbolFlags.FunctionScopedVariableExcludes, false); } break; - case 120 /* Property */: - case 137 /* PropertyAssignment */: + case 124 /* Property */: + case 141 /* PropertyAssignment */: bindDeclaration(node, 4 /* Property */, ts.SymbolFlags.PropertyExcludes, false); break; - case 185 /* EnumMember */: + case 192 /* EnumMember */: bindDeclaration(node, 8 /* EnumMember */, ts.SymbolFlags.EnumMemberExcludes, false); break; - case 125 /* CallSignature */: - bindDeclaration(node, 65536 /* CallSignature */, 0, false); + case 129 /* CallSignature */: + bindDeclaration(node, 131072 /* CallSignature */, 0, false); break; - case 121 /* Method */: - bindDeclaration(node, 4096 /* Method */, ts.SymbolFlags.MethodExcludes, true); + case 125 /* Method */: + bindDeclaration(node, 8192 /* Method */, ts.SymbolFlags.MethodExcludes, true); break; - case 126 /* ConstructSignature */: - bindDeclaration(node, 131072 /* ConstructSignature */, 0, true); + case 130 /* ConstructSignature */: + bindDeclaration(node, 262144 /* ConstructSignature */, 0, true); break; - case 127 /* IndexSignature */: - bindDeclaration(node, 262144 /* IndexSignature */, 0, false); + case 131 /* IndexSignature */: + bindDeclaration(node, 524288 /* IndexSignature */, 0, false); break; - case 175 /* FunctionDeclaration */: + case 182 /* FunctionDeclaration */: bindDeclaration(node, 16 /* Function */, ts.SymbolFlags.FunctionExcludes, true); break; - case 122 /* Constructor */: + case 126 /* Constructor */: bindConstructorDeclaration(node); break; - case 123 /* GetAccessor */: - bindDeclaration(node, 16384 /* GetAccessor */, ts.SymbolFlags.GetAccessorExcludes, true); + case 127 /* GetAccessor */: + bindDeclaration(node, 32768 /* GetAccessor */, ts.SymbolFlags.GetAccessorExcludes, true); break; - case 124 /* SetAccessor */: - bindDeclaration(node, 32768 /* SetAccessor */, ts.SymbolFlags.SetAccessorExcludes, true); + case 128 /* SetAccessor */: + bindDeclaration(node, 65536 /* SetAccessor */, ts.SymbolFlags.SetAccessorExcludes, true); break; - case 130 /* TypeLiteral */: - bindAnonymousDeclaration(node, 1024 /* TypeLiteral */, "__type", false); + case 134 /* TypeLiteral */: + bindAnonymousDeclaration(node, 2048 /* TypeLiteral */, "__type", false); break; - case 136 /* ObjectLiteral */: - bindAnonymousDeclaration(node, 2048 /* ObjectLiteral */, "__object", false); + case 140 /* ObjectLiteral */: + bindAnonymousDeclaration(node, 4096 /* ObjectLiteral */, "__object", false); break; - case 144 /* FunctionExpression */: - case 145 /* ArrowFunction */: + case 149 /* FunctionExpression */: + case 150 /* ArrowFunction */: bindAnonymousDeclaration(node, 16 /* Function */, "__function", true); break; - case 171 /* CatchBlock */: + case 178 /* CatchBlock */: bindCatchVariableDeclaration(node); break; - case 177 /* ClassDeclaration */: + case 184 /* ClassDeclaration */: bindDeclaration(node, 32 /* Class */, ts.SymbolFlags.ClassExcludes, false); break; - case 178 /* InterfaceDeclaration */: + case 185 /* InterfaceDeclaration */: bindDeclaration(node, 64 /* Interface */, ts.SymbolFlags.InterfaceExcludes, false); break; - case 179 /* TypeAliasDeclaration */: - bindDeclaration(node, 1048576 /* TypeAlias */, ts.SymbolFlags.TypeAliasExcludes, false); + case 186 /* TypeAliasDeclaration */: + bindDeclaration(node, 2097152 /* TypeAlias */, ts.SymbolFlags.TypeAliasExcludes, false); break; - case 180 /* EnumDeclaration */: - bindDeclaration(node, 128 /* Enum */, ts.SymbolFlags.EnumExcludes, false); + case 187 /* EnumDeclaration */: + if (ts.isConstEnumDeclaration(node)) { + bindDeclaration(node, 128 /* ConstEnum */, ts.SymbolFlags.ConstEnumExcludes, false); + } + else { + bindDeclaration(node, 256 /* RegularEnum */, ts.SymbolFlags.RegularEnumExcludes, false); + } break; - case 181 /* ModuleDeclaration */: + case 188 /* ModuleDeclaration */: bindModuleDeclaration(node); break; - case 183 /* ImportDeclaration */: - bindDeclaration(node, 16777216 /* Import */, ts.SymbolFlags.ImportExcludes, false); + case 190 /* ImportDeclaration */: + bindDeclaration(node, 33554432 /* Import */, ts.SymbolFlags.ImportExcludes, false); break; - case 186 /* SourceFile */: + case 193 /* SourceFile */: if (ts.isExternalModule(node)) { - bindAnonymousDeclaration(node, 256 /* ValueModule */, '"' + ts.removeFileExtension(node.filename) + '"', true); + bindAnonymousDeclaration(node, 512 /* ValueModule */, '"' + ts.removeFileExtension(node.filename) + '"', true); break; } - case 151 /* Block */: - case 170 /* TryBlock */: - case 171 /* CatchBlock */: - case 172 /* FinallyBlock */: - case 158 /* ForStatement */: - case 159 /* ForInStatement */: - case 164 /* SwitchStatement */: + case 158 /* Block */: + case 177 /* TryBlock */: + case 178 /* CatchBlock */: + case 179 /* FinallyBlock */: + case 165 /* ForStatement */: + case 166 /* ForInStatement */: + case 171 /* SwitchStatement */: bindChildren(node, 0, true); break; default: @@ -6371,7 +6556,7 @@ var ts; } function getFirstConstructorWithBody(node) { return ts.forEach(node.members, function (member) { - if (member.kind === 122 /* Constructor */ && member.body) { + if (member.kind === 126 /* Constructor */ && member.body) { return member; } }); @@ -6381,14 +6566,14 @@ var ts; var getAccessor; var setAccessor; ts.forEach(node.members, function (member) { - if ((member.kind === 123 /* GetAccessor */ || member.kind === 124 /* SetAccessor */) && member.name.text === accessor.name.text && (member.flags & 128 /* Static */) === (accessor.flags & 128 /* Static */)) { + if ((member.kind === 127 /* GetAccessor */ || member.kind === 128 /* SetAccessor */) && member.name.text === accessor.name.text && (member.flags & 128 /* Static */) === (accessor.flags & 128 /* Static */)) { if (!firstAccessor) { firstAccessor = member; } - if (member.kind === 123 /* GetAccessor */ && !getAccessor) { + if (member.kind === 127 /* GetAccessor */ && !getAccessor) { getAccessor = member; } - if (member.kind === 124 /* SetAccessor */ && !setAccessor) { + if (member.kind === 128 /* SetAccessor */ && !setAccessor) { setAccessor = member; } } @@ -6711,7 +6896,7 @@ var ts; if (scopeName) { recordScopeNameStart(scopeName); } - else if (node.kind === 175 /* FunctionDeclaration */ || node.kind === 144 /* FunctionExpression */ || node.kind === 121 /* Method */ || node.kind === 123 /* GetAccessor */ || node.kind === 124 /* SetAccessor */ || node.kind === 181 /* ModuleDeclaration */ || node.kind === 177 /* ClassDeclaration */ || node.kind === 180 /* EnumDeclaration */) { + else if (node.kind === 182 /* FunctionDeclaration */ || node.kind === 149 /* FunctionExpression */ || node.kind === 125 /* Method */ || node.kind === 127 /* GetAccessor */ || node.kind === 128 /* SetAccessor */ || node.kind === 188 /* ModuleDeclaration */ || node.kind === 184 /* ClassDeclaration */ || node.kind === 187 /* EnumDeclaration */) { if (node.name) { scopeName = node.name.text; } @@ -6793,7 +6978,7 @@ var ts; } function emitNodeWithMap(node) { if (node) { - if (node.kind != 186 /* SourceFile */) { + if (node.kind != 193 /* SourceFile */) { recordEmitNodeStartSpan(node); emitNode(node); recordEmitNodeEndSpan(node); @@ -6880,13 +7065,76 @@ var ts; } } function emitLiteral(node) { - var text = getSourceTextOfLocalNode(node); - if (node.kind === 7 /* StringLiteral */ && compilerOptions.sourceMap) { + var text = getLiteralText(); + if (compilerOptions.sourceMap && (node.kind === 7 /* StringLiteral */ || ts.isTemplateLiteralKind(node.kind))) { writer.writeLiteral(text); } else { write(text); } + function getLiteralText() { + if (compilerOptions.target < 2 /* ES6 */ && ts.isTemplateLiteralKind(node.kind)) { + return getTemplateLiteralAsStringLiteral(node); + } + return getSourceTextOfLocalNode(node); + } + } + function getTemplateLiteralAsStringLiteral(node) { + return '"' + ts.escapeString(node.text) + '"'; + } + function emitTemplateExpression(node) { + if (compilerOptions.target >= 2 /* ES6 */) { + ts.forEachChild(node, emit); + return; + } + ts.Debug.assert(node.parent.kind !== 146 /* TaggedTemplateExpression */); + var templateNeedsParens = ts.isExpression(node.parent) && node.parent.kind !== 148 /* ParenExpression */ && comparePrecedenceToBinaryPlus(node.parent) !== -1 /* LessThan */; + if (templateNeedsParens) { + write("("); + } + emitLiteral(node.head); + ts.forEach(node.templateSpans, function (templateSpan) { + var needsParens = templateSpan.expression.kind !== 148 /* ParenExpression */ && comparePrecedenceToBinaryPlus(templateSpan.expression) !== 1 /* GreaterThan */; + write(" + "); + if (needsParens) { + write("("); + } + emit(templateSpan.expression); + if (needsParens) { + write(")"); + } + if (templateSpan.literal.text.length !== 0) { + write(" + "); + emitLiteral(templateSpan.literal); + } + }); + if (templateNeedsParens) { + write(")"); + } + function comparePrecedenceToBinaryPlus(expression) { + ts.Debug.assert(compilerOptions.target <= 1 /* ES5 */); + switch (expression.kind) { + case 153 /* BinaryExpression */: + switch (expression.operator) { + case 34 /* AsteriskToken */: + case 35 /* SlashToken */: + case 36 /* PercentToken */: + return 1 /* GreaterThan */; + case 32 /* PlusToken */: + return 0 /* EqualTo */; + default: + return -1 /* LessThan */; + } + case 154 /* ConditionalExpression */: + return -1 /* LessThan */; + default: + return 1 /* GreaterThan */; + } + } + } + function emitTemplateSpan(span) { + emit(span.expression); + emit(span.literal); } function emitQuotedIdentifier(node) { if (node.kind === 7 /* StringLiteral */) { @@ -6906,29 +7154,29 @@ var ts; function isNonExpressionIdentifier(node) { var parent = node.parent; switch (parent.kind) { - case 119 /* Parameter */: - case 174 /* VariableDeclaration */: - case 120 /* Property */: - case 137 /* PropertyAssignment */: - case 185 /* EnumMember */: - case 121 /* Method */: - case 175 /* FunctionDeclaration */: - case 123 /* GetAccessor */: - case 124 /* SetAccessor */: - case 144 /* FunctionExpression */: - case 177 /* ClassDeclaration */: - case 178 /* InterfaceDeclaration */: - case 180 /* EnumDeclaration */: - case 181 /* ModuleDeclaration */: - case 183 /* ImportDeclaration */: + case 123 /* Parameter */: + case 181 /* VariableDeclaration */: + case 124 /* Property */: + case 141 /* PropertyAssignment */: + case 192 /* EnumMember */: + case 125 /* Method */: + case 182 /* FunctionDeclaration */: + case 127 /* GetAccessor */: + case 128 /* SetAccessor */: + case 149 /* FunctionExpression */: + case 184 /* ClassDeclaration */: + case 185 /* InterfaceDeclaration */: + case 187 /* EnumDeclaration */: + case 188 /* ModuleDeclaration */: + case 190 /* ImportDeclaration */: return parent.name === node; - case 161 /* BreakStatement */: - case 160 /* ContinueStatement */: - case 184 /* ExportAssignment */: + case 168 /* BreakStatement */: + case 167 /* ContinueStatement */: + case 191 /* ExportAssignment */: return false; - case 167 /* LabeledStatement */: + case 174 /* LabeledStatement */: return node.parent.label === node; - case 171 /* CatchBlock */: + case 178 /* CatchBlock */: return node.parent.variable === node; } } @@ -7002,18 +7250,27 @@ var ts; emit(node.initializer); emitTrailingComments(node); } - function emitPropertyAccess(node) { + function tryEmitConstantValue(node) { var constantValue = resolver.getConstantValue(node); if (constantValue !== undefined) { - write(constantValue.toString() + " /* " + ts.identifierToString(node.right) + " */"); + var propertyName = node.kind === 142 /* PropertyAccess */ ? ts.identifierToString(node.right) : ts.getTextOfNode(node.index); + write(constantValue.toString() + " /* " + propertyName + " */"); + return true; } - else { - emit(node.left); - write("."); - emit(node.right); + return false; + } + function emitPropertyAccess(node) { + if (tryEmitConstantValue(node)) { + return; } + emit(node.left); + write("."); + emit(node.right); } function emitIndexedAccess(node) { + if (tryEmitConstantValue(node)) { + return; + } emit(node.object); write("["); emit(node.index); @@ -7021,13 +7278,13 @@ var ts; } function emitCallExpression(node) { var superCall = false; - if (node.func.kind === 85 /* SuperKeyword */) { + if (node.func.kind === 89 /* SuperKeyword */) { write("_super"); superCall = true; } else { emit(node.func); - superCall = node.func.kind === 138 /* PropertyAccess */ && node.func.left.kind === 85 /* SuperKeyword */; + superCall = node.func.kind === 142 /* PropertyAccess */ && node.func.left.kind === 89 /* SuperKeyword */; } if (superCall) { write(".call("); @@ -7053,13 +7310,19 @@ var ts; write(")"); } } + function emitTaggedTemplateExpression(node) { + ts.Debug.assert(compilerOptions.target >= 2 /* ES6 */, "Trying to emit a tagged template in pre-ES6 mode."); + emit(node.tag); + write(" "); + emit(node.template); + } function emitParenExpression(node) { - if (node.expression.kind === 142 /* TypeAssertion */) { + if (node.expression.kind === 147 /* TypeAssertion */) { var operand = node.expression.operand; - while (operand.kind == 142 /* TypeAssertion */) { + while (operand.kind == 147 /* TypeAssertion */) { operand = operand.operand; } - if (operand.kind !== 146 /* PrefixOperator */ && operand.kind !== 147 /* PostfixOperator */ && operand.kind !== 141 /* NewExpression */ && !(operand.kind === 140 /* CallExpression */ && node.parent.kind === 141 /* NewExpression */) && !(operand.kind === 144 /* FunctionExpression */ && node.parent.kind === 140 /* CallExpression */)) { + if (operand.kind !== 151 /* PrefixOperator */ && operand.kind !== 152 /* PostfixOperator */ && operand.kind !== 145 /* NewExpression */ && !(operand.kind === 144 /* CallExpression */ && node.parent.kind === 145 /* NewExpression */) && !(operand.kind === 149 /* FunctionExpression */ && node.parent.kind === 144 /* CallExpression */)) { emit(operand); return; } @@ -7069,29 +7332,29 @@ var ts; write(")"); } function emitUnaryExpression(node) { - if (node.kind === 146 /* PrefixOperator */) { + if (node.kind === 151 /* PrefixOperator */) { write(ts.tokenToString(node.operator)); } - if (node.operator >= 59 /* Identifier */) { + if (node.operator >= 63 /* Identifier */) { write(" "); } - else if (node.kind === 146 /* PrefixOperator */ && node.operand.kind === 146 /* PrefixOperator */) { + else if (node.kind === 151 /* PrefixOperator */ && node.operand.kind === 151 /* PrefixOperator */) { var operand = node.operand; - if (node.operator === 28 /* PlusToken */ && (operand.operator === 28 /* PlusToken */ || operand.operator === 33 /* PlusPlusToken */)) { + if (node.operator === 32 /* PlusToken */ && (operand.operator === 32 /* PlusToken */ || operand.operator === 37 /* PlusPlusToken */)) { write(" "); } - else if (node.operator === 29 /* MinusToken */ && (operand.operator === 29 /* MinusToken */ || operand.operator === 34 /* MinusMinusToken */)) { + else if (node.operator === 33 /* MinusToken */ && (operand.operator === 33 /* MinusToken */ || operand.operator === 38 /* MinusMinusToken */)) { write(" "); } } emit(node.operand); - if (node.kind === 147 /* PostfixOperator */) { + if (node.kind === 152 /* PostfixOperator */) { write(ts.tokenToString(node.operator)); } } function emitBinaryExpression(node) { emit(node.left); - if (node.operator !== 18 /* CommaToken */) + if (node.operator !== 22 /* CommaToken */) write(" "); write(ts.tokenToString(node.operator)); write(" "); @@ -7105,21 +7368,21 @@ var ts; emit(node.whenFalse); } function emitBlock(node) { - emitToken(9 /* OpenBraceToken */, node.pos); + emitToken(13 /* OpenBraceToken */, node.pos); increaseIndent(); scopeEmitStart(node.parent); - if (node.kind === 182 /* ModuleBlock */) { - ts.Debug.assert(node.parent.kind === 181 /* ModuleDeclaration */); + if (node.kind === 189 /* ModuleBlock */) { + ts.Debug.assert(node.parent.kind === 188 /* ModuleDeclaration */); emitCaptureThisForNodeIfNecessary(node.parent); } emitLines(node.statements); decreaseIndent(); writeLine(); - emitToken(10 /* CloseBraceToken */, node.statements.end); + emitToken(14 /* CloseBraceToken */, node.statements.end); scopeEmitEnd(); } function emitEmbeddedStatement(node) { - if (node.kind === 151 /* Block */) { + if (node.kind === 158 /* Block */) { write(" "); emit(node); } @@ -7131,7 +7394,7 @@ var ts; } } function emitExpressionStatement(node) { - var isArrowExpression = node.expression.kind === 145 /* ArrowFunction */; + var isArrowExpression = node.expression.kind === 150 /* ArrowFunction */; emitLeadingComments(node); if (isArrowExpression) write("("); @@ -7143,16 +7406,16 @@ var ts; } function emitIfStatement(node) { emitLeadingComments(node); - var endPos = emitToken(78 /* IfKeyword */, node.pos); + var endPos = emitToken(82 /* IfKeyword */, node.pos); write(" "); - endPos = emitToken(11 /* OpenParenToken */, endPos); + endPos = emitToken(15 /* OpenParenToken */, endPos); emit(node.expression); - emitToken(12 /* CloseParenToken */, node.expression.end); + emitToken(16 /* CloseParenToken */, node.expression.end); emitEmbeddedStatement(node.thenStatement); if (node.elseStatement) { writeLine(); - emitToken(70 /* ElseKeyword */, node.thenStatement.end); - if (node.elseStatement.kind === 155 /* IfStatement */) { + emitToken(74 /* ElseKeyword */, node.thenStatement.end); + if (node.elseStatement.kind === 162 /* IfStatement */) { write(" "); emit(node.elseStatement); } @@ -7165,7 +7428,7 @@ var ts; function emitDoStatement(node) { write("do"); emitEmbeddedStatement(node.statement); - if (node.statement.kind === 151 /* Block */) { + if (node.statement.kind === 158 /* Block */) { write(" "); } else { @@ -7182,18 +7445,18 @@ var ts; emitEmbeddedStatement(node.statement); } function emitForStatement(node) { - var endPos = emitToken(76 /* ForKeyword */, node.pos); + var endPos = emitToken(80 /* ForKeyword */, node.pos); write(" "); - endPos = emitToken(11 /* OpenParenToken */, endPos); + endPos = emitToken(15 /* OpenParenToken */, endPos); if (node.declarations) { if (node.declarations[0] && node.declarations[0].flags & 2048 /* Let */) { - emitToken(98 /* LetKeyword */, endPos); + emitToken(102 /* LetKeyword */, endPos); } else if (node.declarations[0] && node.declarations[0].flags & 4096 /* Const */) { - emitToken(64 /* ConstKeyword */, endPos); + emitToken(68 /* ConstKeyword */, endPos); } else { - emitToken(92 /* VarKeyword */, endPos); + emitToken(96 /* VarKeyword */, endPos); } write(" "); emitCommaList(node.declarations, false); @@ -7209,15 +7472,15 @@ var ts; emitEmbeddedStatement(node.statement); } function emitForInStatement(node) { - var endPos = emitToken(76 /* ForKeyword */, node.pos); + var endPos = emitToken(80 /* ForKeyword */, node.pos); write(" "); - endPos = emitToken(11 /* OpenParenToken */, endPos); + endPos = emitToken(15 /* OpenParenToken */, endPos); if (node.declaration) { if (node.declaration.flags & 2048 /* Let */) { - emitToken(98 /* LetKeyword */, endPos); + emitToken(102 /* LetKeyword */, endPos); } else { - emitToken(92 /* VarKeyword */, endPos); + emitToken(96 /* VarKeyword */, endPos); } write(" "); emit(node.declaration); @@ -7227,17 +7490,17 @@ var ts; } write(" in "); emit(node.expression); - emitToken(12 /* CloseParenToken */, node.expression.end); + emitToken(16 /* CloseParenToken */, node.expression.end); emitEmbeddedStatement(node.statement); } function emitBreakOrContinueStatement(node) { - emitToken(node.kind === 161 /* BreakStatement */ ? 60 /* BreakKeyword */ : 65 /* ContinueKeyword */, node.pos); + emitToken(node.kind === 168 /* BreakStatement */ ? 64 /* BreakKeyword */ : 69 /* ContinueKeyword */, node.pos); emitOptional(" ", node.label); write(";"); } function emitReturnStatement(node) { emitLeadingComments(node); - emitToken(84 /* ReturnKeyword */, node.pos); + emitToken(88 /* ReturnKeyword */, node.pos); emitOptional(" ", node.expression); write(";"); emitTrailingComments(node); @@ -7249,21 +7512,24 @@ var ts; emitEmbeddedStatement(node.statement); } function emitSwitchStatement(node) { - var endPos = emitToken(86 /* SwitchKeyword */, node.pos); + var endPos = emitToken(90 /* SwitchKeyword */, node.pos); write(" "); - emitToken(11 /* OpenParenToken */, endPos); + emitToken(15 /* OpenParenToken */, endPos); emit(node.expression); - endPos = emitToken(12 /* CloseParenToken */, node.expression.end); + endPos = emitToken(16 /* CloseParenToken */, node.expression.end); write(" "); - emitToken(9 /* OpenBraceToken */, endPos); + emitToken(13 /* OpenBraceToken */, endPos); increaseIndent(); emitLines(node.clauses); decreaseIndent(); writeLine(); - emitToken(10 /* CloseBraceToken */, node.clauses.end); + emitToken(14 /* CloseBraceToken */, node.clauses.end); + } + function isOnSameLine(node1, node2) { + return getLineOfLocalPosition(ts.skipTrivia(currentSourceFile.text, node1.pos)) === getLineOfLocalPosition(ts.skipTrivia(currentSourceFile.text, node2.pos)); } function emitCaseOrDefaultClause(node) { - if (node.kind === 165 /* CaseClause */) { + if (node.kind === 172 /* CaseClause */) { write("case "); emit(node.expression); write(":"); @@ -7271,9 +7537,15 @@ var ts; else { write("default:"); } - increaseIndent(); - emitLines(node.statements); - decreaseIndent(); + if (node.statements.length === 1 && isOnSameLine(node, node.statements[0])) { + write(" "); + emit(node.statements[0]); + } + else { + increaseIndent(); + emitLines(node.statements); + decreaseIndent(); + } } function emitThrowStatement(node) { write("throw "); @@ -7292,16 +7564,16 @@ var ts; } function emitCatchBlock(node) { writeLine(); - var endPos = emitToken(62 /* CatchKeyword */, node.pos); + var endPos = emitToken(66 /* CatchKeyword */, node.pos); write(" "); - emitToken(11 /* OpenParenToken */, endPos); + emitToken(15 /* OpenParenToken */, endPos); emit(node.variable); - emitToken(12 /* CloseParenToken */, node.variable.end); + emitToken(16 /* CloseParenToken */, node.variable.end); write(" "); emitBlock(node); } function emitDebuggerStatement(node) { - emitToken(66 /* DebuggerKeyword */, node.pos); + emitToken(70 /* DebuggerKeyword */, node.pos); write(";"); } function emitLabelledStatement(node) { @@ -7312,7 +7584,7 @@ var ts; function getContainingModule(node) { do { node = node.parent; - } while (node && node.kind !== 181 /* ModuleDeclaration */); + } while (node && node.kind !== 188 /* ModuleDeclaration */); return node; } function emitModuleMemberName(node) { @@ -7411,7 +7683,7 @@ var ts; } function emitAccessor(node) { emitLeadingComments(node); - write(node.kind === 123 /* GetAccessor */ ? "get " : "set "); + write(node.kind === 127 /* GetAccessor */ ? "get " : "set "); emit(node.name); emitSignatureAndBody(node); emitTrailingComments(node); @@ -7420,15 +7692,15 @@ var ts; if (!node.body) { return emitPinnedOrTripleSlashComments(node); } - if (node.kind !== 121 /* Method */) { + if (node.kind !== 125 /* Method */) { emitLeadingComments(node); } write("function "); - if (node.kind === 175 /* FunctionDeclaration */ || (node.kind === 144 /* FunctionExpression */ && node.name)) { + if (node.kind === 182 /* FunctionDeclaration */ || (node.kind === 149 /* FunctionExpression */ && node.name)) { emit(node.name); } emitSignatureAndBody(node); - if (node.kind !== 121 /* Method */) { + if (node.kind !== 125 /* Method */) { emitTrailingComments(node); } } @@ -7454,16 +7726,16 @@ var ts; write(" {"); scopeEmitStart(node); increaseIndent(); - emitDetachedComments(node.body.kind === 176 /* FunctionBlock */ ? node.body.statements : node.body); + emitDetachedComments(node.body.kind === 183 /* FunctionBlock */ ? node.body.statements : node.body); var startIndex = 0; - if (node.body.kind === 176 /* FunctionBlock */) { + if (node.body.kind === 183 /* FunctionBlock */) { startIndex = emitDirectivePrologues(node.body.statements, true); } var outPos = writer.getTextPos(); emitCaptureThisForNodeIfNecessary(node); emitDefaultValueAssignments(node); emitRestParameter(node); - if (node.body.kind !== 176 /* FunctionBlock */ && outPos === writer.getTextPos()) { + if (node.body.kind !== 183 /* FunctionBlock */ && outPos === writer.getTextPos()) { decreaseIndent(); write(" "); emitStart(node.body); @@ -7476,7 +7748,7 @@ var ts; emitEnd(node.body); } else { - if (node.body.kind === 176 /* FunctionBlock */) { + if (node.body.kind === 183 /* FunctionBlock */) { emitLinesStartingAt(node.body.statements, startIndex); } else { @@ -7488,10 +7760,10 @@ var ts; emitTrailingComments(node.body); } writeLine(); - if (node.body.kind === 176 /* FunctionBlock */) { + if (node.body.kind === 183 /* FunctionBlock */) { emitLeadingCommentsOfPosition(node.body.statements.end); decreaseIndent(); - emitToken(10 /* CloseBraceToken */, node.body.statements.end); + emitToken(14 /* CloseBraceToken */, node.body.statements.end); } else { decreaseIndent(); @@ -7514,11 +7786,11 @@ var ts; function findInitialSuperCall(ctor) { if (ctor.body) { var statement = ctor.body.statements[0]; - if (statement && statement.kind === 154 /* ExpressionStatement */) { + if (statement && statement.kind === 161 /* ExpressionStatement */) { var expr = statement.expression; - if (expr && expr.kind === 140 /* CallExpression */) { + if (expr && expr.kind === 144 /* CallExpression */) { var func = expr.func; - if (func && func.kind === 85 /* SuperKeyword */) { + if (func && func.kind === 89 /* SuperKeyword */) { return statement; } } @@ -7554,7 +7826,7 @@ var ts; } function emitMemberAssignments(node, staticFlag) { ts.forEach(node.members, function (member) { - if (member.kind === 120 /* Property */ && (member.flags & 128 /* Static */) === staticFlag && member.initializer) { + if (member.kind === 124 /* Property */ && (member.flags & 128 /* Static */) === staticFlag && member.initializer) { writeLine(); emitLeadingComments(member); emitStart(member); @@ -7577,7 +7849,7 @@ var ts; } function emitMemberFunctions(node) { ts.forEach(node.members, function (member) { - if (member.kind === 121 /* Method */) { + if (member.kind === 125 /* Method */) { if (!member.body) { return emitPinnedOrTripleSlashComments(member); } @@ -7599,7 +7871,7 @@ var ts; write(";"); emitTrailingComments(member); } - else if (member.kind === 123 /* GetAccessor */ || member.kind === 124 /* SetAccessor */) { + else if (member.kind === 127 /* GetAccessor */ || member.kind === 128 /* SetAccessor */) { var accessors = getAllAccessorDeclarations(node, member); if (member === accessors.firstAccessor) { writeLine(); @@ -7677,11 +7949,11 @@ var ts; write("return "); emitNode(node.name); } - emitToken(10 /* CloseBraceToken */, node.members.end, emitClassReturnStatement); + emitToken(14 /* CloseBraceToken */, node.members.end, emitClassReturnStatement); write(";"); decreaseIndent(); writeLine(); - emitToken(10 /* CloseBraceToken */, node.members.end); + emitToken(14 /* CloseBraceToken */, node.members.end); scopeEmitEnd(); emitStart(node); write(")("); @@ -7702,7 +7974,7 @@ var ts; emitTrailingComments(node); function emitConstructorOfClass() { ts.forEach(node.members, function (member) { - if (member.kind === 122 /* Constructor */ && !member.body) { + if (member.kind === 126 /* Constructor */ && !member.body) { emitPinnedOrTripleSlashComments(member); } }); @@ -7753,7 +8025,7 @@ var ts; emitLeadingCommentsOfPosition(ctor.body.statements.end); } decreaseIndent(); - emitToken(10 /* CloseBraceToken */, ctor ? ctor.body.statements.end : node.members.end); + emitToken(14 /* CloseBraceToken */, ctor ? ctor.body.statements.end : node.members.end); scopeEmitEnd(); emitEnd(ctor || node); if (ctor) { @@ -7765,6 +8037,9 @@ var ts; emitPinnedOrTripleSlashComments(node); } function emitEnumDeclaration(node) { + if (ts.isConstEnumDeclaration(node) && !compilerOptions.preserveConstEnums) { + return; + } emitLeadingComments(node); if (!(node.flags & 1 /* Export */)) { emitStart(node); @@ -7785,7 +8060,7 @@ var ts; emitEnumMemberDeclarations(); decreaseIndent(); writeLine(); - emitToken(10 /* CloseBraceToken */, node.members.end); + emitToken(14 /* CloseBraceToken */, node.members.end); scopeEmitEnd(); write(")("); emitModuleMemberName(node); @@ -7830,13 +8105,13 @@ var ts; } } function getInnerMostModuleDeclarationFromDottedModule(moduleDeclaration) { - if (moduleDeclaration.body.kind === 181 /* ModuleDeclaration */) { + if (moduleDeclaration.body.kind === 188 /* ModuleDeclaration */) { var recursiveInnerModule = getInnerMostModuleDeclarationFromDottedModule(moduleDeclaration.body); return recursiveInnerModule || moduleDeclaration.body; } } function emitModuleDeclaration(node) { - if (!ts.isInstantiated(node)) { + if (ts.getModuleInstanceState(node) !== 1 /* Instantiated */) { return emitPinnedOrTripleSlashComments(node); } emitLeadingComments(node); @@ -7852,7 +8127,7 @@ var ts; write(resolver.getLocalNameOfContainer(node)); emitEnd(node.name); write(") "); - if (node.body.kind === 182 /* ModuleBlock */) { + if (node.body.kind === 189 /* ModuleBlock */) { emit(node.body); } else { @@ -7865,7 +8140,7 @@ var ts; decreaseIndent(); writeLine(); var moduleBlock = getInnerMostModuleDeclarationFromDottedModule(node).body; - emitToken(10 /* CloseBraceToken */, moduleBlock.statements.end); + emitToken(14 /* CloseBraceToken */, moduleBlock.statements.end); scopeEmitEnd(); } write(")("); @@ -7883,10 +8158,10 @@ var ts; function emitImportDeclaration(node) { var emitImportDeclaration = resolver.isReferencedImportDeclaration(node); if (!emitImportDeclaration) { - emitImportDeclaration = !ts.isExternalModule(currentSourceFile) && resolver.isTopLevelValueImportedViaEntityName(node); + emitImportDeclaration = !ts.isExternalModule(currentSourceFile) && resolver.isTopLevelValueImportWithEntityName(node); } if (emitImportDeclaration) { - if (node.externalModuleName && node.parent.kind === 186 /* SourceFile */ && compilerOptions.module === 2 /* AMD */) { + if (node.externalModuleName && node.parent.kind === 193 /* SourceFile */ && compilerOptions.module === 2 /* AMD */) { if (node.flags & 1 /* Export */) { writeLine(); emitLeadingComments(node); @@ -7915,7 +8190,7 @@ var ts; emitStart(node.externalModuleName); emitLiteral(node.externalModuleName); emitEnd(node.externalModuleName); - emitToken(12 /* CloseParenToken */, node.externalModuleName.end); + emitToken(16 /* CloseParenToken */, node.externalModuleName.end); } write(";"); emitEnd(node); @@ -7926,7 +8201,7 @@ var ts; function getExternalImportDeclarations(node) { var result = []; ts.forEach(node.statements, function (stat) { - if (stat.kind === 183 /* ImportDeclaration */ && stat.externalModuleName && resolver.isReferencedImportDeclaration(stat)) { + if (stat.kind === 190 /* ImportDeclaration */ && stat.externalModuleName && resolver.isReferencedImportDeclaration(stat)) { result.push(stat); } }); @@ -7934,7 +8209,7 @@ var ts; } function getFirstExportAssignment(sourceFile) { return ts.forEach(sourceFile.statements, function (node) { - if (node.kind === 184 /* ExportAssignment */) { + if (node.kind === 191 /* ExportAssignment */) { return node; } }); @@ -8050,117 +8325,127 @@ var ts; return emitPinnedOrTripleSlashComments(node); } switch (node.kind) { - case 59 /* Identifier */: + case 63 /* Identifier */: return emitIdentifier(node); - case 119 /* Parameter */: + case 123 /* Parameter */: return emitParameter(node); - case 123 /* GetAccessor */: - case 124 /* SetAccessor */: + case 127 /* GetAccessor */: + case 128 /* SetAccessor */: return emitAccessor(node); - case 87 /* ThisKeyword */: + case 91 /* ThisKeyword */: return emitThis(node); - case 85 /* SuperKeyword */: + case 89 /* SuperKeyword */: return emitSuper(node); - case 83 /* NullKeyword */: + case 87 /* NullKeyword */: return write("null"); - case 89 /* TrueKeyword */: + case 93 /* TrueKeyword */: return write("true"); - case 74 /* FalseKeyword */: + case 78 /* FalseKeyword */: return write("false"); case 6 /* NumericLiteral */: case 7 /* StringLiteral */: case 8 /* RegularExpressionLiteral */: + case 9 /* NoSubstitutionTemplateLiteral */: + case 10 /* TemplateHead */: + case 11 /* TemplateMiddle */: + case 12 /* TemplateTail */: return emitLiteral(node); - case 117 /* QualifiedName */: + case 155 /* TemplateExpression */: + return emitTemplateExpression(node); + case 156 /* TemplateSpan */: + return emitTemplateSpan(node); + case 121 /* QualifiedName */: return emitPropertyAccess(node); - case 135 /* ArrayLiteral */: + case 139 /* ArrayLiteral */: return emitArrayLiteral(node); - case 136 /* ObjectLiteral */: + case 140 /* ObjectLiteral */: return emitObjectLiteral(node); - case 137 /* PropertyAssignment */: + case 141 /* PropertyAssignment */: return emitPropertyAssignment(node); - case 138 /* PropertyAccess */: + case 142 /* PropertyAccess */: return emitPropertyAccess(node); - case 139 /* IndexedAccess */: + case 143 /* IndexedAccess */: return emitIndexedAccess(node); - case 140 /* CallExpression */: + case 144 /* CallExpression */: return emitCallExpression(node); - case 141 /* NewExpression */: + case 145 /* NewExpression */: return emitNewExpression(node); - case 142 /* TypeAssertion */: + case 146 /* TaggedTemplateExpression */: + return emitTaggedTemplateExpression(node); + case 147 /* TypeAssertion */: return emit(node.operand); - case 143 /* ParenExpression */: + case 148 /* ParenExpression */: return emitParenExpression(node); - case 175 /* FunctionDeclaration */: - case 144 /* FunctionExpression */: - case 145 /* ArrowFunction */: + case 182 /* FunctionDeclaration */: + case 149 /* FunctionExpression */: + case 150 /* ArrowFunction */: return emitFunctionDeclaration(node); - case 146 /* PrefixOperator */: - case 147 /* PostfixOperator */: + case 151 /* PrefixOperator */: + case 152 /* PostfixOperator */: return emitUnaryExpression(node); - case 148 /* BinaryExpression */: + case 153 /* BinaryExpression */: return emitBinaryExpression(node); - case 149 /* ConditionalExpression */: + case 154 /* ConditionalExpression */: return emitConditionalExpression(node); - case 150 /* OmittedExpression */: + case 157 /* OmittedExpression */: return; - case 151 /* Block */: - case 170 /* TryBlock */: - case 172 /* FinallyBlock */: - case 176 /* FunctionBlock */: - case 182 /* ModuleBlock */: + case 158 /* Block */: + case 177 /* TryBlock */: + case 179 /* FinallyBlock */: + case 183 /* FunctionBlock */: + case 189 /* ModuleBlock */: return emitBlock(node); - case 152 /* VariableStatement */: + case 159 /* VariableStatement */: return emitVariableStatement(node); - case 153 /* EmptyStatement */: + case 160 /* EmptyStatement */: return write(";"); - case 154 /* ExpressionStatement */: + case 161 /* ExpressionStatement */: return emitExpressionStatement(node); - case 155 /* IfStatement */: + case 162 /* IfStatement */: return emitIfStatement(node); - case 156 /* DoStatement */: + case 163 /* DoStatement */: return emitDoStatement(node); - case 157 /* WhileStatement */: + case 164 /* WhileStatement */: return emitWhileStatement(node); - case 158 /* ForStatement */: + case 165 /* ForStatement */: return emitForStatement(node); - case 159 /* ForInStatement */: + case 166 /* ForInStatement */: return emitForInStatement(node); - case 160 /* ContinueStatement */: - case 161 /* BreakStatement */: + case 167 /* ContinueStatement */: + case 168 /* BreakStatement */: return emitBreakOrContinueStatement(node); - case 162 /* ReturnStatement */: + case 169 /* ReturnStatement */: return emitReturnStatement(node); - case 163 /* WithStatement */: + case 170 /* WithStatement */: return emitWithStatement(node); - case 164 /* SwitchStatement */: + case 171 /* SwitchStatement */: return emitSwitchStatement(node); - case 165 /* CaseClause */: - case 166 /* DefaultClause */: + case 172 /* CaseClause */: + case 173 /* DefaultClause */: return emitCaseOrDefaultClause(node); - case 167 /* LabeledStatement */: + case 174 /* LabeledStatement */: return emitLabelledStatement(node); - case 168 /* ThrowStatement */: + case 175 /* ThrowStatement */: return emitThrowStatement(node); - case 169 /* TryStatement */: + case 176 /* TryStatement */: return emitTryStatement(node); - case 171 /* CatchBlock */: + case 178 /* CatchBlock */: return emitCatchBlock(node); - case 173 /* DebuggerStatement */: + case 180 /* DebuggerStatement */: return emitDebuggerStatement(node); - case 174 /* VariableDeclaration */: + case 181 /* VariableDeclaration */: return emitVariableDeclaration(node); - case 177 /* ClassDeclaration */: + case 184 /* ClassDeclaration */: return emitClassDeclaration(node); - case 178 /* InterfaceDeclaration */: + case 185 /* InterfaceDeclaration */: return emitInterfaceDeclaration(node); - case 180 /* EnumDeclaration */: + case 187 /* EnumDeclaration */: return emitEnumDeclaration(node); - case 181 /* ModuleDeclaration */: + case 188 /* ModuleDeclaration */: return emitModuleDeclaration(node); - case 183 /* ImportDeclaration */: + case 190 /* ImportDeclaration */: return emitImportDeclaration(node); - case 186 /* SourceFile */: + case 193 /* SourceFile */: return emitSourceFile(node); } } @@ -8178,7 +8463,7 @@ var ts; return leadingComments; } function getLeadingCommentsToEmit(node) { - if (node.parent.kind === 186 /* SourceFile */ || node.pos !== node.parent.pos) { + if (node.parent.kind === 193 /* SourceFile */ || node.pos !== node.parent.pos) { var leadingComments; if (hasDetachedComments(node.pos)) { leadingComments = getLeadingCommentsWithoutDetachedComments(); @@ -8195,7 +8480,7 @@ var ts; emitComments(leadingComments, true, writer, writeComment); } function emitTrailingDeclarationComments(node) { - if (node.parent.kind === 186 /* SourceFile */ || node.end !== node.parent.end) { + if (node.parent.kind === 193 /* SourceFile */ || node.end !== node.parent.end) { var trailingComments = ts.getTrailingCommentRanges(currentSourceFile.text, node.end); emitComments(trailingComments, false, writer, writeComment); } @@ -8387,7 +8672,7 @@ var ts; if (node.flags & 1 /* Export */) { write("export "); } - if (node.kind !== 178 /* InterfaceDeclaration */) { + if (node.kind !== 185 /* InterfaceDeclaration */) { write("declare "); } } @@ -8443,7 +8728,7 @@ var ts; emitDeclarationFlags(node); write("module "); emitSourceTextOfNode(node.name); - while (node.body.kind !== 182 /* ModuleBlock */) { + while (node.body.kind !== 189 /* ModuleBlock */) { node = node.body; write("."); emitSourceTextOfNode(node.name); @@ -8485,6 +8770,9 @@ var ts; if (resolver.isDeclarationVisible(node)) { emitJsDocComments(node); emitDeclarationFlags(node); + if (ts.isConstEnumDeclaration(node)) { + write("const "); + } write("enum "); emitSourceTextOfNode(node.name); write(" {"); @@ -8512,30 +8800,30 @@ var ts; function getTypeParameterConstraintVisibilityError(symbolAccesibilityResult) { var diagnosticMessage; switch (node.parent.kind) { - case 177 /* ClassDeclaration */: + case 184 /* ClassDeclaration */: diagnosticMessage = symbolAccesibilityResult.errorModuleName ? ts.Diagnostics.Type_parameter_0_of_exported_class_has_or_is_using_name_1_from_private_module_2 : ts.Diagnostics.Type_parameter_0_of_exported_class_has_or_is_using_private_name_1; break; - case 178 /* InterfaceDeclaration */: + case 185 /* InterfaceDeclaration */: diagnosticMessage = symbolAccesibilityResult.errorModuleName ? ts.Diagnostics.Type_parameter_0_of_exported_interface_has_or_is_using_name_1_from_private_module_2 : ts.Diagnostics.Type_parameter_0_of_exported_interface_has_or_is_using_private_name_1; break; - case 126 /* ConstructSignature */: + case 130 /* ConstructSignature */: diagnosticMessage = symbolAccesibilityResult.errorModuleName ? ts.Diagnostics.Type_parameter_0_of_constructor_signature_from_exported_interface_has_or_is_using_name_1_from_private_module_2 : ts.Diagnostics.Type_parameter_0_of_constructor_signature_from_exported_interface_has_or_is_using_private_name_1; break; - case 125 /* CallSignature */: + case 129 /* CallSignature */: diagnosticMessage = symbolAccesibilityResult.errorModuleName ? ts.Diagnostics.Type_parameter_0_of_call_signature_from_exported_interface_has_or_is_using_name_1_from_private_module_2 : ts.Diagnostics.Type_parameter_0_of_call_signature_from_exported_interface_has_or_is_using_private_name_1; break; - case 121 /* Method */: + case 125 /* Method */: if (node.parent.flags & 128 /* Static */) { diagnosticMessage = symbolAccesibilityResult.errorModuleName ? ts.Diagnostics.Type_parameter_0_of_public_static_method_from_exported_class_has_or_is_using_name_1_from_private_module_2 : ts.Diagnostics.Type_parameter_0_of_public_static_method_from_exported_class_has_or_is_using_private_name_1; } - else if (node.parent.parent.kind === 177 /* ClassDeclaration */) { + else if (node.parent.parent.kind === 184 /* ClassDeclaration */) { diagnosticMessage = symbolAccesibilityResult.errorModuleName ? ts.Diagnostics.Type_parameter_0_of_public_method_from_exported_class_has_or_is_using_name_1_from_private_module_2 : ts.Diagnostics.Type_parameter_0_of_public_method_from_exported_class_has_or_is_using_private_name_1; } else { diagnosticMessage = symbolAccesibilityResult.errorModuleName ? ts.Diagnostics.Type_parameter_0_of_method_from_exported_interface_has_or_is_using_name_1_from_private_module_2 : ts.Diagnostics.Type_parameter_0_of_method_from_exported_interface_has_or_is_using_private_name_1; } break; - case 175 /* FunctionDeclaration */: + case 182 /* FunctionDeclaration */: diagnosticMessage = symbolAccesibilityResult.errorModuleName ? ts.Diagnostics.Type_parameter_0_of_exported_function_has_or_is_using_name_1_from_private_module_2 : ts.Diagnostics.Type_parameter_0_of_exported_function_has_or_is_using_private_name_1; break; default: @@ -8551,7 +8839,7 @@ var ts; emitJsDocComments(node); decreaseIndent(); emitSourceTextOfNode(node.name); - if (node.constraint && (node.parent.kind !== 121 /* Method */ || !(node.parent.flags & 32 /* Private */))) { + if (node.constraint && (node.parent.kind !== 125 /* Method */ || !(node.parent.flags & 32 /* Private */))) { write(" extends "); getSymbolVisibilityDiagnosticMessage = getTypeParameterConstraintVisibilityError; resolver.writeTypeAtLocation(node.constraint, enclosingDeclaration, 2 /* UseTypeOfFunction */, writer); @@ -8573,7 +8861,7 @@ var ts; resolver.writeTypeAtLocation(node, enclosingDeclaration, 1 /* WriteArrayAsGenericType */ | 2 /* UseTypeOfFunction */, writer); function getHeritageClauseVisibilityError(symbolAccesibilityResult) { var diagnosticMessage; - if (node.parent.kind === 177 /* ClassDeclaration */) { + if (node.parent.kind === 184 /* ClassDeclaration */) { if (symbolAccesibilityResult.errorModuleName) { diagnosticMessage = isImplementsList ? ts.Diagnostics.Implements_clause_of_exported_class_0_has_or_is_using_name_1_from_private_module_2 : ts.Diagnostics.Extends_clause_of_exported_class_0_has_or_is_using_name_1_from_private_module_2; } @@ -8658,9 +8946,9 @@ var ts; writeLine(); } function emitVariableDeclaration(node) { - if (node.kind !== 174 /* VariableDeclaration */ || resolver.isDeclarationVisible(node)) { + if (node.kind !== 181 /* VariableDeclaration */ || resolver.isDeclarationVisible(node)) { emitSourceTextOfNode(node.name); - if (node.kind === 120 /* Property */ && (node.flags & 4 /* QuestionMark */)) { + if (node.kind === 124 /* Property */ && (node.flags & 4 /* QuestionMark */)) { write("?"); } if (!(node.flags & 32 /* Private */)) { @@ -8671,14 +8959,14 @@ var ts; } function getVariableDeclarationTypeVisibilityError(symbolAccesibilityResult) { var diagnosticMessage; - if (node.kind === 174 /* VariableDeclaration */) { + if (node.kind === 181 /* VariableDeclaration */) { diagnosticMessage = symbolAccesibilityResult.errorModuleName ? symbolAccesibilityResult.accessibility === 2 /* CannotBeNamed */ ? ts.Diagnostics.Exported_variable_0_has_or_is_using_name_1_from_external_module_2_but_cannot_be_named : ts.Diagnostics.Exported_variable_0_has_or_is_using_name_1_from_private_module_2 : ts.Diagnostics.Exported_variable_0_has_or_is_using_private_name_1; } - else if (node.kind === 120 /* Property */) { + else if (node.kind === 124 /* Property */) { if (node.flags & 128 /* Static */) { diagnosticMessage = symbolAccesibilityResult.errorModuleName ? symbolAccesibilityResult.accessibility === 2 /* CannotBeNamed */ ? ts.Diagnostics.Public_static_property_0_of_exported_class_has_or_is_using_name_1_from_external_module_2_but_cannot_be_named : ts.Diagnostics.Public_static_property_0_of_exported_class_has_or_is_using_name_1_from_private_module_2 : ts.Diagnostics.Public_static_property_0_of_exported_class_has_or_is_using_private_name_1; } - else if (node.parent.kind === 177 /* ClassDeclaration */) { + else if (node.parent.kind === 184 /* ClassDeclaration */) { diagnosticMessage = symbolAccesibilityResult.errorModuleName ? symbolAccesibilityResult.accessibility === 2 /* CannotBeNamed */ ? ts.Diagnostics.Public_property_0_of_exported_class_has_or_is_using_name_1_from_external_module_2_but_cannot_be_named : ts.Diagnostics.Public_property_0_of_exported_class_has_or_is_using_name_1_from_private_module_2 : ts.Diagnostics.Public_property_0_of_exported_class_has_or_is_using_private_name_1; } else { @@ -8728,7 +9016,7 @@ var ts; } function getAccessorDeclarationTypeVisibilityError(symbolAccesibilityResult) { var diagnosticMessage; - if (node.kind === 124 /* SetAccessor */) { + if (node.kind === 128 /* SetAccessor */) { if (node.parent.flags & 128 /* Static */) { diagnosticMessage = symbolAccesibilityResult.errorModuleName ? ts.Diagnostics.Parameter_0_of_public_static_property_setter_from_exported_class_has_or_is_using_name_1_from_private_module_2 : ts.Diagnostics.Parameter_0_of_public_static_property_setter_from_exported_class_has_or_is_using_private_name_1; } @@ -8757,14 +9045,14 @@ var ts; } } function emitFunctionDeclaration(node) { - if ((node.kind !== 175 /* FunctionDeclaration */ || resolver.isDeclarationVisible(node)) && !resolver.isImplementationOfOverload(node)) { + if ((node.kind !== 182 /* FunctionDeclaration */ || resolver.isDeclarationVisible(node)) && !resolver.isImplementationOfOverload(node)) { emitJsDocComments(node); emitDeclarationFlags(node); - if (node.kind === 175 /* FunctionDeclaration */) { + if (node.kind === 182 /* FunctionDeclaration */) { write("function "); emitSourceTextOfNode(node.name); } - else if (node.kind === 122 /* Constructor */) { + else if (node.kind === 126 /* Constructor */) { write("constructor"); } else { @@ -8782,24 +9070,24 @@ var ts; emitSignatureDeclaration(node); } function emitSignatureDeclaration(node) { - if (node.kind === 125 /* CallSignature */ || node.kind === 127 /* IndexSignature */) { + if (node.kind === 129 /* CallSignature */ || node.kind === 131 /* IndexSignature */) { emitJsDocComments(node); } emitTypeParameters(node.typeParameters); - if (node.kind === 127 /* IndexSignature */) { + if (node.kind === 131 /* IndexSignature */) { write("["); } else { write("("); } emitCommaList(node.parameters, emitParameterDeclaration); - if (node.kind === 127 /* IndexSignature */) { + if (node.kind === 131 /* IndexSignature */) { write("]"); } else { write(")"); } - if (node.kind !== 122 /* Constructor */ && !(node.flags & 32 /* Private */)) { + if (node.kind !== 126 /* Constructor */ && !(node.flags & 32 /* Private */)) { write(": "); getSymbolVisibilityDiagnosticMessage = getReturnTypeVisibilityError; resolver.writeReturnTypeOfSignatureDeclaration(node, enclosingDeclaration, 2 /* UseTypeOfFunction */, writer); @@ -8809,27 +9097,27 @@ var ts; function getReturnTypeVisibilityError(symbolAccesibilityResult) { var diagnosticMessage; switch (node.kind) { - case 126 /* ConstructSignature */: + case 130 /* ConstructSignature */: diagnosticMessage = symbolAccesibilityResult.errorModuleName ? ts.Diagnostics.Return_type_of_constructor_signature_from_exported_interface_has_or_is_using_name_0_from_private_module_1 : ts.Diagnostics.Return_type_of_constructor_signature_from_exported_interface_has_or_is_using_private_name_0; break; - case 125 /* CallSignature */: + case 129 /* CallSignature */: diagnosticMessage = symbolAccesibilityResult.errorModuleName ? ts.Diagnostics.Return_type_of_call_signature_from_exported_interface_has_or_is_using_name_0_from_private_module_1 : ts.Diagnostics.Return_type_of_call_signature_from_exported_interface_has_or_is_using_private_name_0; break; - case 127 /* IndexSignature */: + case 131 /* IndexSignature */: diagnosticMessage = symbolAccesibilityResult.errorModuleName ? ts.Diagnostics.Return_type_of_index_signature_from_exported_interface_has_or_is_using_name_0_from_private_module_1 : ts.Diagnostics.Return_type_of_index_signature_from_exported_interface_has_or_is_using_private_name_0; break; - case 121 /* Method */: + case 125 /* Method */: if (node.flags & 128 /* Static */) { diagnosticMessage = symbolAccesibilityResult.errorModuleName ? symbolAccesibilityResult.accessibility === 2 /* CannotBeNamed */ ? ts.Diagnostics.Return_type_of_public_static_method_from_exported_class_has_or_is_using_name_0_from_external_module_1_but_cannot_be_named : ts.Diagnostics.Return_type_of_public_static_method_from_exported_class_has_or_is_using_name_0_from_private_module_1 : ts.Diagnostics.Return_type_of_public_static_method_from_exported_class_has_or_is_using_private_name_0; } - else if (node.parent.kind === 177 /* ClassDeclaration */) { + else if (node.parent.kind === 184 /* ClassDeclaration */) { diagnosticMessage = symbolAccesibilityResult.errorModuleName ? symbolAccesibilityResult.accessibility === 2 /* CannotBeNamed */ ? ts.Diagnostics.Return_type_of_public_method_from_exported_class_has_or_is_using_name_0_from_external_module_1_but_cannot_be_named : ts.Diagnostics.Return_type_of_public_method_from_exported_class_has_or_is_using_name_0_from_private_module_1 : ts.Diagnostics.Return_type_of_public_method_from_exported_class_has_or_is_using_private_name_0; } else { diagnosticMessage = symbolAccesibilityResult.errorModuleName ? ts.Diagnostics.Return_type_of_method_from_exported_interface_has_or_is_using_name_0_from_private_module_1 : ts.Diagnostics.Return_type_of_method_from_exported_interface_has_or_is_using_private_name_0; } break; - case 175 /* FunctionDeclaration */: + case 182 /* FunctionDeclaration */: diagnosticMessage = symbolAccesibilityResult.errorModuleName ? symbolAccesibilityResult.accessibility === 2 /* CannotBeNamed */ ? ts.Diagnostics.Return_type_of_exported_function_has_or_is_using_name_0_from_external_module_1_but_cannot_be_named : ts.Diagnostics.Return_type_of_exported_function_has_or_is_using_name_0_from_private_module_1 : ts.Diagnostics.Return_type_of_exported_function_has_or_is_using_private_name_0; break; default: @@ -8860,27 +9148,27 @@ var ts; function getParameterDeclarationTypeVisibilityError(symbolAccesibilityResult) { var diagnosticMessage; switch (node.parent.kind) { - case 122 /* Constructor */: + case 126 /* Constructor */: diagnosticMessage = symbolAccesibilityResult.errorModuleName ? symbolAccesibilityResult.accessibility === 2 /* CannotBeNamed */ ? ts.Diagnostics.Parameter_0_of_constructor_from_exported_class_has_or_is_using_name_1_from_external_module_2_but_cannot_be_named : ts.Diagnostics.Parameter_0_of_constructor_from_exported_class_has_or_is_using_name_1_from_private_module_2 : ts.Diagnostics.Parameter_0_of_constructor_from_exported_class_has_or_is_using_private_name_1; break; - case 126 /* ConstructSignature */: + case 130 /* ConstructSignature */: diagnosticMessage = symbolAccesibilityResult.errorModuleName ? ts.Diagnostics.Parameter_0_of_constructor_signature_from_exported_interface_has_or_is_using_name_1_from_private_module_2 : ts.Diagnostics.Parameter_0_of_constructor_signature_from_exported_interface_has_or_is_using_private_name_1; break; - case 125 /* CallSignature */: + case 129 /* CallSignature */: diagnosticMessage = symbolAccesibilityResult.errorModuleName ? ts.Diagnostics.Parameter_0_of_call_signature_from_exported_interface_has_or_is_using_name_1_from_private_module_2 : ts.Diagnostics.Parameter_0_of_call_signature_from_exported_interface_has_or_is_using_private_name_1; break; - case 121 /* Method */: + case 125 /* Method */: if (node.parent.flags & 128 /* Static */) { diagnosticMessage = symbolAccesibilityResult.errorModuleName ? symbolAccesibilityResult.accessibility === 2 /* CannotBeNamed */ ? ts.Diagnostics.Parameter_0_of_public_static_method_from_exported_class_has_or_is_using_name_1_from_external_module_2_but_cannot_be_named : ts.Diagnostics.Parameter_0_of_public_static_method_from_exported_class_has_or_is_using_name_1_from_private_module_2 : ts.Diagnostics.Parameter_0_of_public_static_method_from_exported_class_has_or_is_using_private_name_1; } - else if (node.parent.parent.kind === 177 /* ClassDeclaration */) { + else if (node.parent.parent.kind === 184 /* ClassDeclaration */) { diagnosticMessage = symbolAccesibilityResult.errorModuleName ? symbolAccesibilityResult.accessibility === 2 /* CannotBeNamed */ ? ts.Diagnostics.Parameter_0_of_public_method_from_exported_class_has_or_is_using_name_1_from_external_module_2_but_cannot_be_named : ts.Diagnostics.Parameter_0_of_public_method_from_exported_class_has_or_is_using_name_1_from_private_module_2 : ts.Diagnostics.Parameter_0_of_public_method_from_exported_class_has_or_is_using_private_name_1; } else { diagnosticMessage = symbolAccesibilityResult.errorModuleName ? ts.Diagnostics.Parameter_0_of_method_from_exported_interface_has_or_is_using_name_1_from_private_module_2 : ts.Diagnostics.Parameter_0_of_method_from_exported_interface_has_or_is_using_private_name_1; } break; - case 175 /* FunctionDeclaration */: + case 182 /* FunctionDeclaration */: diagnosticMessage = symbolAccesibilityResult.errorModuleName ? symbolAccesibilityResult.accessibility === 2 /* CannotBeNamed */ ? ts.Diagnostics.Parameter_0_of_exported_function_has_or_is_using_name_1_from_external_module_2_but_cannot_be_named : ts.Diagnostics.Parameter_0_of_exported_function_has_or_is_using_name_1_from_private_module_2 : ts.Diagnostics.Parameter_0_of_exported_function_has_or_is_using_private_name_1; break; default: @@ -8895,39 +9183,39 @@ var ts; } function emitNode(node) { switch (node.kind) { - case 122 /* Constructor */: - case 175 /* FunctionDeclaration */: - case 121 /* Method */: + case 126 /* Constructor */: + case 182 /* FunctionDeclaration */: + case 125 /* Method */: return emitFunctionDeclaration(node); - case 126 /* ConstructSignature */: + case 130 /* ConstructSignature */: return emitConstructSignatureDeclaration(node); - case 125 /* CallSignature */: - case 127 /* IndexSignature */: + case 129 /* CallSignature */: + case 131 /* IndexSignature */: return emitSignatureDeclaration(node); - case 123 /* GetAccessor */: - case 124 /* SetAccessor */: + case 127 /* GetAccessor */: + case 128 /* SetAccessor */: return emitAccessorDeclaration(node); - case 152 /* VariableStatement */: + case 159 /* VariableStatement */: return emitVariableStatement(node); - case 120 /* Property */: + case 124 /* Property */: return emitPropertyDeclaration(node); - case 178 /* InterfaceDeclaration */: + case 185 /* InterfaceDeclaration */: return emitInterfaceDeclaration(node); - case 177 /* ClassDeclaration */: + case 184 /* ClassDeclaration */: return emitClassDeclaration(node); - case 179 /* TypeAliasDeclaration */: + case 186 /* TypeAliasDeclaration */: return emitTypeAliasDeclaration(node); - case 185 /* EnumMember */: + case 192 /* EnumMember */: return emitEnumMemberDeclaration(node); - case 180 /* EnumDeclaration */: + case 187 /* EnumDeclaration */: return emitEnumDeclaration(node); - case 181 /* ModuleDeclaration */: + case 188 /* ModuleDeclaration */: return emitModuleDeclaration(node); - case 183 /* ImportDeclaration */: + case 190 /* ImportDeclaration */: return emitImportDeclaration(node); - case 184 /* ExportAssignment */: + case 191 /* ExportAssignment */: return emitExportAssignment(node); - case 186 /* SourceFile */: + case 193 /* SourceFile */: return emitSourceFile(node); } } @@ -9134,10 +9422,10 @@ var ts; isArgumentsSymbol: function (symbol) { return symbol === argumentsSymbol; }, hasEarlyErrors: hasEarlyErrors }; - var undefinedSymbol = createSymbol(4 /* Property */ | 134217728 /* Transient */, "undefined"); - var argumentsSymbol = createSymbol(4 /* Property */ | 134217728 /* Transient */, "arguments"); - var unknownSymbol = createSymbol(4 /* Property */ | 134217728 /* Transient */, "unknown"); - var resolvingSymbol = createSymbol(134217728 /* Transient */, "__resolving__"); + var undefinedSymbol = createSymbol(4 /* Property */ | 268435456 /* Transient */, "undefined"); + var argumentsSymbol = createSymbol(4 /* Property */ | 268435456 /* Transient */, "arguments"); + var unknownSymbol = createSymbol(4 /* Property */ | 268435456 /* Transient */, "unknown"); + var resolvingSymbol = createSymbol(268435456 /* Transient */, "__resolving__"); var anyType = createIntrinsicType(1 /* Any */, "any"); var stringType = createIntrinsicType(2 /* String */, "string"); var numberType = createIntrinsicType(4 /* Number */, "number"); @@ -9199,21 +9487,23 @@ var ts; result |= ts.SymbolFlags.ClassExcludes; if (flags & 64 /* Interface */) result |= ts.SymbolFlags.InterfaceExcludes; - if (flags & 128 /* Enum */) - result |= ts.SymbolFlags.EnumExcludes; - if (flags & 256 /* ValueModule */) + if (flags & 256 /* RegularEnum */) + result |= ts.SymbolFlags.RegularEnumExcludes; + if (flags & 128 /* ConstEnum */) + result |= ts.SymbolFlags.ConstEnumExcludes; + if (flags & 512 /* ValueModule */) result |= ts.SymbolFlags.ValueModuleExcludes; - if (flags & 4096 /* Method */) + if (flags & 8192 /* Method */) result |= ts.SymbolFlags.MethodExcludes; - if (flags & 16384 /* GetAccessor */) + if (flags & 32768 /* GetAccessor */) result |= ts.SymbolFlags.GetAccessorExcludes; - if (flags & 32768 /* SetAccessor */) + if (flags & 65536 /* SetAccessor */) result |= ts.SymbolFlags.SetAccessorExcludes; - if (flags & 524288 /* TypeParameter */) + if (flags & 1048576 /* TypeParameter */) result |= ts.SymbolFlags.TypeParameterExcludes; - if (flags & 1048576 /* TypeAlias */) + if (flags & 2097152 /* TypeAlias */) result |= ts.SymbolFlags.TypeAliasExcludes; - if (flags & 16777216 /* Import */) + if (flags & 33554432 /* Import */) result |= ts.SymbolFlags.ImportExcludes; return result; } @@ -9223,11 +9513,13 @@ var ts; mergedSymbols[source.mergeId] = target; } function cloneSymbol(symbol) { - var result = createSymbol(symbol.flags | 67108864 /* Merged */, symbol.name); + var result = createSymbol(symbol.flags | 134217728 /* Merged */, symbol.name); result.declarations = symbol.declarations.slice(0); result.parent = symbol.parent; if (symbol.valueDeclaration) result.valueDeclaration = symbol.valueDeclaration; + if (symbol.constEnumOnlyModule) + result.constEnumOnlyModule = true; if (symbol.members) result.members = cloneSymbolTable(symbol.members); if (symbol.exports) @@ -9237,6 +9529,9 @@ var ts; } function extendSymbol(target, source) { if (!(target.flags & getExcludedSymbolFlags(source.flags))) { + if (source.flags & 512 /* ValueModule */ && target.flags & 512 /* ValueModule */ && target.constEnumOnlyModule && !source.constEnumOnlyModule) { + target.constEnumOnlyModule = false; + } target.flags |= source.flags; if (!target.valueDeclaration && source.valueDeclaration) target.valueDeclaration = source.valueDeclaration; @@ -9282,7 +9577,7 @@ var ts; } else { var symbol = target[id]; - if (!(symbol.flags & 67108864 /* Merged */)) { + if (!(symbol.flags & 134217728 /* Merged */)) { target[id] = symbol = cloneSymbol(symbol); } extendSymbol(symbol, source[id]); @@ -9291,7 +9586,7 @@ var ts; } } function getSymbolLinks(symbol) { - if (symbol.flags & 134217728 /* Transient */) + if (symbol.flags & 268435456 /* Transient */) return symbol; if (!symbol.id) symbol.id = nextSymbolId++; @@ -9303,19 +9598,19 @@ var ts; return nodeLinks[node.id] || (nodeLinks[node.id] = {}); } function getSourceFile(node) { - return ts.getAncestor(node, 186 /* SourceFile */); + return ts.getAncestor(node, 193 /* SourceFile */); } function isGlobalSourceFile(node) { - return node.kind === 186 /* SourceFile */ && !ts.isExternalModule(node); + return node.kind === 193 /* SourceFile */ && !ts.isExternalModule(node); } function getSymbol(symbols, name, meaning) { if (meaning && ts.hasProperty(symbols, name)) { var symbol = symbols[name]; - ts.Debug.assert((symbol.flags & 33554432 /* Instantiated */) === 0, "Should never get an instantiated symbol here."); + ts.Debug.assert((symbol.flags & 67108864 /* Instantiated */) === 0, "Should never get an instantiated symbol here."); if (symbol.flags & meaning) { return symbol; } - if (symbol.flags & 16777216 /* Import */) { + if (symbol.flags & 33554432 /* Import */) { var target = resolveImport(symbol); if (target === unknownSymbol || target.flags & meaning) { return symbol; @@ -9323,6 +9618,18 @@ var ts; } } } + function isDefinedBefore(node1, node2) { + var file1 = ts.getSourceFileOfNode(node1); + var file2 = ts.getSourceFileOfNode(node2); + if (file1 === file2) { + return node1.pos <= node2.pos; + } + if (!compilerOptions.out) { + return true; + } + var sourceFiles = program.getSourceFiles(); + return sourceFiles.indexOf(file1) <= sourceFiles.indexOf(file2); + } function resolveName(location, name, meaning, nameNotFoundMessage, nameArg) { var result; var lastLocation; @@ -9335,21 +9642,21 @@ var ts; } } switch (location.kind) { - case 186 /* SourceFile */: + case 193 /* SourceFile */: if (!ts.isExternalModule(location)) break; - case 181 /* ModuleDeclaration */: + case 188 /* ModuleDeclaration */: if (result = getSymbol(getSymbolOfNode(location).exports, name, meaning & ts.SymbolFlags.ModuleMember)) { break loop; } break; - case 180 /* EnumDeclaration */: + case 187 /* EnumDeclaration */: if (result = getSymbol(getSymbolOfNode(location).exports, name, meaning & 8 /* EnumMember */)) { break loop; } break; - case 120 /* Property */: - if (location.parent.kind === 177 /* ClassDeclaration */ && !(location.flags & 128 /* Static */)) { + case 124 /* Property */: + if (location.parent.kind === 184 /* ClassDeclaration */ && !(location.flags & 128 /* Static */)) { var ctor = findConstructorDeclaration(location.parent); if (ctor && ctor.locals) { if (getSymbol(ctor.locals, name, meaning & ts.SymbolFlags.Value)) { @@ -9358,8 +9665,8 @@ var ts; } } break; - case 177 /* ClassDeclaration */: - case 178 /* InterfaceDeclaration */: + case 184 /* ClassDeclaration */: + case 185 /* InterfaceDeclaration */: if (result = getSymbol(getSymbolOfNode(location).members, name, meaning & ts.SymbolFlags.Type)) { if (lastLocation && lastLocation.flags & 128 /* Static */) { error(errorLocation, ts.Diagnostics.Static_members_cannot_reference_class_type_parameters); @@ -9368,18 +9675,18 @@ var ts; break loop; } break; - case 121 /* Method */: - case 122 /* Constructor */: - case 123 /* GetAccessor */: - case 124 /* SetAccessor */: - case 175 /* FunctionDeclaration */: - case 145 /* ArrowFunction */: + case 125 /* Method */: + case 126 /* Constructor */: + case 127 /* GetAccessor */: + case 128 /* SetAccessor */: + case 182 /* FunctionDeclaration */: + case 150 /* ArrowFunction */: if (name === "arguments") { result = argumentsSymbol; break loop; } break; - case 144 /* FunctionExpression */: + case 149 /* FunctionExpression */: if (name === "arguments") { result = argumentsSymbol; break loop; @@ -9390,7 +9697,7 @@ var ts; break loop; } break; - case 171 /* CatchBlock */: + case 178 /* CatchBlock */: var id = location.variable; if (name === id.text) { result = location.symbol; @@ -9418,30 +9725,20 @@ var ts; } if (result.flags & 2 /* BlockScopedVariable */) { var declaration = ts.forEach(result.declarations, function (d) { return d.flags & ts.NodeFlags.BlockScoped ? d : undefined; }); - ts.Debug.assert(declaration, "Block-scoped variable declaration is undefined"); - var declarationSourceFile = ts.getSourceFileOfNode(declaration); - var referenceSourceFile = ts.getSourceFileOfNode(errorLocation); - if (declarationSourceFile === referenceSourceFile) { - if (declaration.pos > errorLocation.pos) { - error(errorLocation, ts.Diagnostics.Block_scoped_variable_0_used_before_its_declaration, ts.identifierToString(declaration.name)); - } - } - else if (compilerOptions.out) { - var sourceFiles = program.getSourceFiles(); - if (sourceFiles.indexOf(referenceSourceFile) < sourceFiles.indexOf(declarationSourceFile)) { - error(errorLocation, ts.Diagnostics.Block_scoped_variable_0_used_before_its_declaration, ts.identifierToString(declaration.name)); - } + ts.Debug.assert(declaration !== undefined, "Block-scoped variable declaration is undefined"); + if (!isDefinedBefore(declaration, errorLocation)) { + error(errorLocation, ts.Diagnostics.Block_scoped_variable_0_used_before_its_declaration, ts.identifierToString(declaration.name)); } } } return result; } function resolveImport(symbol) { - ts.Debug.assert((symbol.flags & 16777216 /* Import */) !== 0, "Should only get Imports here."); + ts.Debug.assert((symbol.flags & 33554432 /* Import */) !== 0, "Should only get Imports here."); var links = getSymbolLinks(symbol); if (!links.target) { links.target = resolvingSymbol; - var node = getDeclarationOfKind(symbol, 183 /* ImportDeclaration */); + var node = getDeclarationOfKind(symbol, 190 /* ImportDeclaration */); var target = node.externalModuleName ? resolveExternalModuleName(node, node.externalModuleName) : getSymbolOfPartOfRightHandSideOfImport(node.entityName, node); if (links.target === resolvingSymbol) { links.target = target || unknownSymbol; @@ -9457,17 +9754,17 @@ var ts; } function getSymbolOfPartOfRightHandSideOfImport(entityName, importDeclaration) { if (!importDeclaration) { - importDeclaration = ts.getAncestor(entityName, 183 /* ImportDeclaration */); - ts.Debug.assert(importDeclaration); + importDeclaration = ts.getAncestor(entityName, 190 /* ImportDeclaration */); + ts.Debug.assert(importDeclaration !== undefined); } - if (entityName.kind === 59 /* Identifier */ && isRightSideOfQualifiedNameOrPropertyAccess(entityName)) { + if (entityName.kind === 63 /* Identifier */ && isRightSideOfQualifiedNameOrPropertyAccess(entityName)) { entityName = entityName.parent; } - if (entityName.kind === 59 /* Identifier */ || entityName.parent.kind === 117 /* QualifiedName */) { + if (entityName.kind === 63 /* Identifier */ || entityName.parent.kind === 121 /* QualifiedName */) { return resolveEntityName(importDeclaration, entityName, ts.SymbolFlags.Namespace); } else { - ts.Debug.assert(entityName.parent.kind === 183 /* ImportDeclaration */); + ts.Debug.assert(entityName.parent.kind === 190 /* ImportDeclaration */); return resolveEntityName(importDeclaration, entityName, ts.SymbolFlags.Value | ts.SymbolFlags.Type | ts.SymbolFlags.Namespace); } } @@ -9475,15 +9772,15 @@ var ts; return symbol.parent ? getFullyQualifiedName(symbol.parent) + "." + symbolToString(symbol) : symbolToString(symbol); } function resolveEntityName(location, name, meaning) { - if (name.kind === 59 /* Identifier */) { + if (name.kind === 63 /* Identifier */) { var symbol = resolveName(location, name.text, meaning, ts.Diagnostics.Cannot_find_name_0, name); if (!symbol) { return; } } - else if (name.kind === 117 /* QualifiedName */) { + else if (name.kind === 121 /* QualifiedName */) { var namespace = resolveEntityName(location, name.left, ts.SymbolFlags.Namespace); - if (!namespace || namespace === unknownSymbol || name.right.kind === 116 /* Missing */) + if (!namespace || namespace === unknownSymbol || name.right.kind === 120 /* Missing */) return; var symbol = getSymbol(namespace.exports, name.right.text, meaning); if (!symbol) { @@ -9494,7 +9791,7 @@ var ts; else { return; } - ts.Debug.assert((symbol.flags & 33554432 /* Instantiated */) === 0, "Should never get an instantiated symbol here."); + ts.Debug.assert((symbol.flags & 67108864 /* Instantiated */) === 0, "Should never get an instantiated symbol here."); return symbol.flags & meaning ? symbol : resolveImport(symbol); } function isExternalModuleNameRelative(moduleName) { @@ -9507,7 +9804,7 @@ var ts; return; var isRelative = isExternalModuleNameRelative(moduleName); if (!isRelative) { - var symbol = getSymbol(globals, '"' + moduleName + '"', 256 /* ValueModule */); + var symbol = getSymbol(globals, '"' + moduleName + '"', 512 /* ValueModule */); if (symbol) { return getResolvedExportSymbol(symbol); } @@ -9537,7 +9834,7 @@ var ts; if (symbol.flags & (ts.SymbolFlags.Value | ts.SymbolFlags.Type | ts.SymbolFlags.Namespace)) { return symbol; } - if (symbol.flags & 16777216 /* Import */) { + if (symbol.flags & 33554432 /* Import */) { return resolveImport(symbol); } } @@ -9572,9 +9869,9 @@ var ts; var seenExportedMember = false; var result = []; ts.forEach(symbol.declarations, function (declaration) { - var block = (declaration.kind === 186 /* SourceFile */ ? declaration : declaration.body); + var block = (declaration.kind === 193 /* SourceFile */ ? declaration : declaration.body); ts.forEach(block.statements, function (node) { - if (node.kind === 184 /* ExportAssignment */) { + if (node.kind === 191 /* ExportAssignment */) { result.push(node); } else { @@ -9598,16 +9895,16 @@ var ts; return getMergedSymbol(symbol.parent); } function getExportSymbolOfValueSymbolIfExported(symbol) { - return symbol && (symbol.flags & 2097152 /* ExportValue */) !== 0 ? getMergedSymbol(symbol.exportSymbol) : symbol; + return symbol && (symbol.flags & 4194304 /* ExportValue */) !== 0 ? getMergedSymbol(symbol.exportSymbol) : symbol; } function symbolIsValue(symbol) { - if (symbol.flags & 33554432 /* Instantiated */) { + if (symbol.flags & 67108864 /* Instantiated */) { return symbolIsValue(getSymbolLinks(symbol).target); } if (symbol.flags & ts.SymbolFlags.Value) { return true; } - if (symbol.flags & 16777216 /* Import */) { + if (symbol.flags & 33554432 /* Import */) { return (resolveImport(symbol).flags & ts.SymbolFlags.Value) !== 0; } return false; @@ -9616,7 +9913,7 @@ var ts; var members = node.members; for (var i = 0; i < members.length; i++) { var member = members[i]; - if (member.kind === 122 /* Constructor */ && member.body) { + if (member.kind === 126 /* Constructor */ && member.body) { return member; } } @@ -9670,7 +9967,7 @@ var ts; return setObjectTypeMembers(createObjectType(32768 /* Anonymous */, symbol), members, callSignatures, constructSignatures, stringIndexType, numberIndexType); } function isOptionalProperty(propertySymbol) { - return propertySymbol.valueDeclaration && propertySymbol.valueDeclaration.flags & 4 /* QuestionMark */ && propertySymbol.valueDeclaration.kind !== 119 /* Parameter */; + return propertySymbol.valueDeclaration && propertySymbol.valueDeclaration.flags & 4 /* QuestionMark */ && propertySymbol.valueDeclaration.kind !== 123 /* Parameter */; } function forEachSymbolTableInScope(enclosingDeclaration, callback) { var result; @@ -9681,17 +9978,17 @@ var ts; } } switch (location.kind) { - case 186 /* SourceFile */: + case 193 /* SourceFile */: if (!ts.isExternalModule(location)) { break; } - case 181 /* ModuleDeclaration */: + case 188 /* ModuleDeclaration */: if (result = callback(getSymbolOfNode(location).exports)) { return result; } break; - case 177 /* ClassDeclaration */: - case 178 /* InterfaceDeclaration */: + case 184 /* ClassDeclaration */: + case 185 /* InterfaceDeclaration */: if (result = callback(getSymbolOfNode(location).members)) { return result; } @@ -9721,8 +10018,8 @@ var ts; return [symbol]; } return ts.forEachValue(symbols, function (symbolFromSymbolTable) { - if (symbolFromSymbolTable.flags & 16777216 /* Import */) { - if (!useOnlyExternalAliasing || ts.forEach(symbolFromSymbolTable.declarations, function (declaration) { return declaration.kind === 183 /* ImportDeclaration */ && declaration.externalModuleName; })) { + if (symbolFromSymbolTable.flags & 33554432 /* Import */) { + if (!useOnlyExternalAliasing || ts.forEach(symbolFromSymbolTable.declarations, function (declaration) { return declaration.kind === 190 /* ImportDeclaration */ && declaration.externalModuleName; })) { var resolvedImportedSymbol = resolveImport(symbolFromSymbolTable); if (isAccessible(symbolFromSymbolTable, resolveImport(symbolFromSymbolTable))) { return [symbolFromSymbolTable]; @@ -9749,7 +10046,7 @@ var ts; if (symbolFromSymbolTable === symbol) { return true; } - symbolFromSymbolTable = (symbolFromSymbolTable.flags & 16777216 /* Import */) ? resolveImport(symbolFromSymbolTable) : symbolFromSymbolTable; + symbolFromSymbolTable = (symbolFromSymbolTable.flags & 33554432 /* Import */) ? resolveImport(symbolFromSymbolTable) : symbolFromSymbolTable; if (symbolFromSymbolTable.flags & meaning) { qualify = true; return true; @@ -9759,7 +10056,7 @@ var ts; return qualify; } function isSymbolAccessible(symbol, enclosingDeclaration, meaning) { - if (symbol && enclosingDeclaration && !(symbol.flags & 524288 /* TypeParameter */)) { + if (symbol && enclosingDeclaration && !(symbol.flags & 1048576 /* TypeParameter */)) { var initialSymbol = symbol; var meaningToLook = meaning; while (symbol) { @@ -9804,7 +10101,7 @@ var ts; } } function hasExternalModuleSymbol(declaration) { - return (declaration.kind === 181 /* ModuleDeclaration */ && declaration.name.kind === 7 /* StringLiteral */) || (declaration.kind === 186 /* SourceFile */ && ts.isExternalModule(declaration)); + return (declaration.kind === 188 /* ModuleDeclaration */ && declaration.name.kind === 7 /* StringLiteral */) || (declaration.kind === 193 /* SourceFile */ && ts.isExternalModule(declaration)); } function hasVisibleDeclarations(symbol) { var aliasesToMakeVisible; @@ -9814,7 +10111,7 @@ var ts; return { aliasesToMakeVisible: aliasesToMakeVisible }; function getIsDeclarationVisible(declaration) { if (!isDeclarationVisible(declaration)) { - if (declaration.kind === 183 /* ImportDeclaration */ && !(declaration.flags & 1 /* Export */) && isDeclarationVisible(declaration.parent)) { + if (declaration.kind === 190 /* ImportDeclaration */ && !(declaration.flags & 1 /* Export */) && isDeclarationVisible(declaration.parent)) { getNodeLinks(declaration).isVisible = true; if (aliasesToMakeVisible) { if (!ts.contains(aliasesToMakeVisible, declaration)) { @@ -9872,12 +10169,12 @@ var ts; return result; } function getTypeAliasForTypeLiteral(type) { - if (type.symbol && type.symbol.flags & 1024 /* TypeLiteral */) { + if (type.symbol && type.symbol.flags & 2048 /* TypeLiteral */) { var node = type.symbol.declarations[0].parent; - while (node.kind === 134 /* ParenType */) { + while (node.kind === 138 /* ParenType */) { node = node.parent; } - if (node.kind === 179 /* TypeAliasDeclaration */) { + if (node.kind === 186 /* TypeAliasDeclaration */) { return getSymbolOfNode(node); } } @@ -9900,14 +10197,14 @@ var ts; function appendParentTypeArgumentsAndSymbolName(symbol) { if (parentSymbol) { if (flags & 1 /* WriteTypeParametersOrArguments */) { - if (symbol.flags & 33554432 /* Instantiated */) { + if (symbol.flags & 67108864 /* Instantiated */) { buildDisplayForTypeArgumentsAndDelimiters(getTypeParametersOfClassOrInterface(parentSymbol), symbol.mapper, writer, enclosingDeclaration); } else { buildTypeParameterDisplayFromSymbol(parentSymbol, writer, enclosingDeclaration); } } - writePunctuation(writer, 15 /* DotToken */); + writePunctuation(writer, 19 /* DotToken */); } parentSymbol = symbol; appendSymbolNameOnly(symbol, writer); @@ -9928,14 +10225,14 @@ var ts; if (!parentSymbol && ts.forEach(symbol.declarations, function (declaration) { return hasExternalModuleSymbol(declaration); })) { return; } - if (symbol.flags & 1024 /* TypeLiteral */ || symbol.flags & 2048 /* ObjectLiteral */) { + if (symbol.flags & 2048 /* TypeLiteral */ || symbol.flags & 4096 /* ObjectLiteral */) { return; } appendParentTypeArgumentsAndSymbolName(symbol); } } } - if (enclosingDeclaration && !(symbol.flags & 524288 /* TypeParameter */)) { + if (enclosingDeclaration && !(symbol.flags & 1048576 /* TypeParameter */)) { walkSymbol(symbol, meaning); return; } @@ -9967,11 +10264,11 @@ var ts; writer.writeStringLiteral(type.text); } else { - writePunctuation(writer, 9 /* OpenBraceToken */); + writePunctuation(writer, 13 /* OpenBraceToken */); writeSpace(writer); - writePunctuation(writer, 16 /* DotDotDotToken */); + writePunctuation(writer, 20 /* DotDotDotToken */); writeSpace(writer); - writePunctuation(writer, 10 /* CloseBraceToken */); + writePunctuation(writer, 14 /* CloseBraceToken */); } } function writeTypeList(types, union) { @@ -9980,7 +10277,7 @@ var ts; if (union) { writeSpace(writer); } - writePunctuation(writer, union ? 39 /* BarToken */ : 18 /* CommaToken */); + writePunctuation(writer, union ? 43 /* BarToken */ : 22 /* CommaToken */); writeSpace(writer); } writeType(types[i], union ? 64 /* InElementType */ : 0 /* None */); @@ -9989,32 +10286,32 @@ var ts; function writeTypeReference(type, flags) { if (type.target === globalArrayType && !(flags & 1 /* WriteArrayAsGenericType */)) { writeType(type.typeArguments[0], 64 /* InElementType */); - writePunctuation(writer, 13 /* OpenBracketToken */); - writePunctuation(writer, 14 /* CloseBracketToken */); + writePunctuation(writer, 17 /* OpenBracketToken */); + writePunctuation(writer, 18 /* CloseBracketToken */); } else { buildSymbolDisplay(type.target.symbol, writer, enclosingDeclaration, ts.SymbolFlags.Type); - writePunctuation(writer, 19 /* LessThanToken */); + writePunctuation(writer, 23 /* LessThanToken */); writeTypeList(type.typeArguments, false); - writePunctuation(writer, 20 /* GreaterThanToken */); + writePunctuation(writer, 24 /* GreaterThanToken */); } } function writeTupleType(type) { - writePunctuation(writer, 13 /* OpenBracketToken */); + writePunctuation(writer, 17 /* OpenBracketToken */); writeTypeList(type.elementTypes, false); - writePunctuation(writer, 14 /* CloseBracketToken */); + writePunctuation(writer, 18 /* CloseBracketToken */); } function writeUnionType(type, flags) { if (flags & 64 /* InElementType */) { - writePunctuation(writer, 11 /* OpenParenToken */); + writePunctuation(writer, 15 /* OpenParenToken */); } writeTypeList(type.types, true); if (flags & 64 /* InElementType */) { - writePunctuation(writer, 12 /* CloseParenToken */); + writePunctuation(writer, 16 /* CloseParenToken */); } } function writeAnonymousType(type, flags) { - if (type.symbol && type.symbol.flags & (32 /* Class */ | 128 /* Enum */ | 256 /* ValueModule */)) { + if (type.symbol && type.symbol.flags & (32 /* Class */ | ts.SymbolFlags.Enum | 512 /* ValueModule */)) { writeTypeofSymbol(type); } else if (shouldWriteTypeOfFunctionSymbol()) { @@ -10026,7 +10323,7 @@ var ts; buildSymbolDisplay(typeAlias, writer, enclosingDeclaration, ts.SymbolFlags.Type); } else { - writeKeyword(writer, 105 /* AnyKeyword */); + writeKeyword(writer, 109 /* AnyKeyword */); } } else { @@ -10039,8 +10336,8 @@ var ts; } function shouldWriteTypeOfFunctionSymbol() { if (type.symbol) { - var isStaticMethodSymbol = !!(type.symbol.flags & 4096 /* Method */ && ts.forEach(type.symbol.declarations, function (declaration) { return declaration.flags & 128 /* Static */; })); - var isNonLocalFunctionSymbol = !!(type.symbol.flags & 16 /* Function */) && (type.symbol.parent || ts.forEach(type.symbol.declarations, function (declaration) { return declaration.parent.kind === 186 /* SourceFile */ || declaration.parent.kind === 182 /* ModuleBlock */; })); + var isStaticMethodSymbol = !!(type.symbol.flags & 8192 /* Method */ && ts.forEach(type.symbol.declarations, function (declaration) { return declaration.flags & 128 /* Static */; })); + var isNonLocalFunctionSymbol = !!(type.symbol.flags & 16 /* Function */) && (type.symbol.parent || ts.forEach(type.symbol.declarations, function (declaration) { return declaration.parent.kind === 193 /* SourceFile */ || declaration.parent.kind === 189 /* ModuleBlock */; })); if (isStaticMethodSymbol || isNonLocalFunctionSymbol) { return !!(flags & 2 /* UseTypeOfFunction */) || (typeStack && ts.contains(typeStack, type)); } @@ -10048,7 +10345,7 @@ var ts; } } function writeTypeofSymbol(type) { - writeKeyword(writer, 91 /* TypeOfKeyword */); + writeKeyword(writer, 95 /* TypeOfKeyword */); writeSpace(writer); buildSymbolDisplay(type.symbol, writer, enclosingDeclaration, ts.SymbolFlags.Value); } @@ -10056,103 +10353,103 @@ var ts; var resolved = resolveObjectOrUnionTypeMembers(type); if (!resolved.properties.length && !resolved.stringIndexType && !resolved.numberIndexType) { if (!resolved.callSignatures.length && !resolved.constructSignatures.length) { - writePunctuation(writer, 9 /* OpenBraceToken */); - writePunctuation(writer, 10 /* CloseBraceToken */); + writePunctuation(writer, 13 /* OpenBraceToken */); + writePunctuation(writer, 14 /* CloseBraceToken */); return; } if (resolved.callSignatures.length === 1 && !resolved.constructSignatures.length) { if (flags & 64 /* InElementType */) { - writePunctuation(writer, 11 /* OpenParenToken */); + writePunctuation(writer, 15 /* OpenParenToken */); } buildSignatureDisplay(resolved.callSignatures[0], writer, enclosingDeclaration, globalFlagsToPass | 8 /* WriteArrowStyleSignature */, typeStack); if (flags & 64 /* InElementType */) { - writePunctuation(writer, 12 /* CloseParenToken */); + writePunctuation(writer, 16 /* CloseParenToken */); } return; } if (resolved.constructSignatures.length === 1 && !resolved.callSignatures.length) { if (flags & 64 /* InElementType */) { - writePunctuation(writer, 11 /* OpenParenToken */); + writePunctuation(writer, 15 /* OpenParenToken */); } - writeKeyword(writer, 82 /* NewKeyword */); + writeKeyword(writer, 86 /* NewKeyword */); writeSpace(writer); buildSignatureDisplay(resolved.constructSignatures[0], writer, enclosingDeclaration, globalFlagsToPass | 8 /* WriteArrowStyleSignature */, typeStack); if (flags & 64 /* InElementType */) { - writePunctuation(writer, 12 /* CloseParenToken */); + writePunctuation(writer, 16 /* CloseParenToken */); } return; } } - writePunctuation(writer, 9 /* OpenBraceToken */); + writePunctuation(writer, 13 /* OpenBraceToken */); writer.writeLine(); writer.increaseIndent(); for (var i = 0; i < resolved.callSignatures.length; i++) { buildSignatureDisplay(resolved.callSignatures[i], writer, enclosingDeclaration, globalFlagsToPass, typeStack); - writePunctuation(writer, 17 /* SemicolonToken */); + writePunctuation(writer, 21 /* SemicolonToken */); writer.writeLine(); } for (var i = 0; i < resolved.constructSignatures.length; i++) { - writeKeyword(writer, 82 /* NewKeyword */); + writeKeyword(writer, 86 /* NewKeyword */); writeSpace(writer); buildSignatureDisplay(resolved.constructSignatures[i], writer, enclosingDeclaration, globalFlagsToPass, typeStack); - writePunctuation(writer, 17 /* SemicolonToken */); + writePunctuation(writer, 21 /* SemicolonToken */); writer.writeLine(); } if (resolved.stringIndexType) { - writePunctuation(writer, 13 /* OpenBracketToken */); + writePunctuation(writer, 17 /* OpenBracketToken */); writer.writeParameter("x"); - writePunctuation(writer, 46 /* ColonToken */); + writePunctuation(writer, 50 /* ColonToken */); writeSpace(writer); - writeKeyword(writer, 114 /* StringKeyword */); - writePunctuation(writer, 14 /* CloseBracketToken */); - writePunctuation(writer, 46 /* ColonToken */); + writeKeyword(writer, 118 /* StringKeyword */); + writePunctuation(writer, 18 /* CloseBracketToken */); + writePunctuation(writer, 50 /* ColonToken */); writeSpace(writer); writeType(resolved.stringIndexType, 0 /* None */); - writePunctuation(writer, 17 /* SemicolonToken */); + writePunctuation(writer, 21 /* SemicolonToken */); writer.writeLine(); } if (resolved.numberIndexType) { - writePunctuation(writer, 13 /* OpenBracketToken */); + writePunctuation(writer, 17 /* OpenBracketToken */); writer.writeParameter("x"); - writePunctuation(writer, 46 /* ColonToken */); + writePunctuation(writer, 50 /* ColonToken */); writeSpace(writer); - writeKeyword(writer, 112 /* NumberKeyword */); - writePunctuation(writer, 14 /* CloseBracketToken */); - writePunctuation(writer, 46 /* ColonToken */); + writeKeyword(writer, 116 /* NumberKeyword */); + writePunctuation(writer, 18 /* CloseBracketToken */); + writePunctuation(writer, 50 /* ColonToken */); writeSpace(writer); writeType(resolved.numberIndexType, 0 /* None */); - writePunctuation(writer, 17 /* SemicolonToken */); + writePunctuation(writer, 21 /* SemicolonToken */); writer.writeLine(); } for (var i = 0; i < resolved.properties.length; i++) { var p = resolved.properties[i]; var t = getTypeOfSymbol(p); - if (p.flags & (16 /* Function */ | 4096 /* Method */) && !getPropertiesOfObjectType(t).length) { + if (p.flags & (16 /* Function */ | 8192 /* Method */) && !getPropertiesOfObjectType(t).length) { var signatures = getSignaturesOfType(t, 0 /* Call */); for (var j = 0; j < signatures.length; j++) { buildSymbolDisplay(p, writer); if (isOptionalProperty(p)) { - writePunctuation(writer, 45 /* QuestionToken */); + writePunctuation(writer, 49 /* QuestionToken */); } buildSignatureDisplay(signatures[j], writer, enclosingDeclaration, globalFlagsToPass, typeStack); - writePunctuation(writer, 17 /* SemicolonToken */); + writePunctuation(writer, 21 /* SemicolonToken */); writer.writeLine(); } } else { buildSymbolDisplay(p, writer); if (isOptionalProperty(p)) { - writePunctuation(writer, 45 /* QuestionToken */); + writePunctuation(writer, 49 /* QuestionToken */); } - writePunctuation(writer, 46 /* ColonToken */); + writePunctuation(writer, 50 /* ColonToken */); writeSpace(writer); writeType(t, 0 /* None */); - writePunctuation(writer, 17 /* SemicolonToken */); + writePunctuation(writer, 21 /* SemicolonToken */); writer.writeLine(); } } writer.decreaseIndent(); - writePunctuation(writer, 10 /* CloseBraceToken */); + writePunctuation(writer, 14 /* CloseBraceToken */); } } function buildTypeParameterDisplayFromSymbol(symbol, writer, enclosingDeclaraiton, flags) { @@ -10166,67 +10463,67 @@ var ts; var constraint = getConstraintOfTypeParameter(tp); if (constraint) { writeSpace(writer); - writeKeyword(writer, 73 /* ExtendsKeyword */); + writeKeyword(writer, 77 /* ExtendsKeyword */); writeSpace(writer); buildTypeDisplay(constraint, writer, enclosingDeclaration, flags, typeStack); } } function buildParameterDisplay(p, writer, enclosingDeclaration, flags, typeStack) { if (getDeclarationFlagsFromSymbol(p) & 8 /* Rest */) { - writePunctuation(writer, 16 /* DotDotDotToken */); + writePunctuation(writer, 20 /* DotDotDotToken */); } appendSymbolNameOnly(p, writer); if (p.valueDeclaration.flags & 4 /* QuestionMark */ || p.valueDeclaration.initializer) { - writePunctuation(writer, 45 /* QuestionToken */); + writePunctuation(writer, 49 /* QuestionToken */); } - writePunctuation(writer, 46 /* ColonToken */); + writePunctuation(writer, 50 /* ColonToken */); writeSpace(writer); buildTypeDisplay(getTypeOfSymbol(p), writer, enclosingDeclaration, flags, typeStack); } function buildDisplayForTypeParametersAndDelimiters(typeParameters, writer, enclosingDeclaration, flags, typeStack) { if (typeParameters && typeParameters.length) { - writePunctuation(writer, 19 /* LessThanToken */); + writePunctuation(writer, 23 /* LessThanToken */); for (var i = 0; i < typeParameters.length; i++) { if (i > 0) { - writePunctuation(writer, 18 /* CommaToken */); + writePunctuation(writer, 22 /* CommaToken */); writeSpace(writer); } buildTypeParameterDisplay(typeParameters[i], writer, enclosingDeclaration, flags, typeStack); } - writePunctuation(writer, 20 /* GreaterThanToken */); + writePunctuation(writer, 24 /* GreaterThanToken */); } } function buildDisplayForTypeArgumentsAndDelimiters(typeParameters, mapper, writer, enclosingDeclaration, flags, typeStack) { if (typeParameters && typeParameters.length) { - writePunctuation(writer, 19 /* LessThanToken */); + writePunctuation(writer, 23 /* LessThanToken */); for (var i = 0; i < typeParameters.length; i++) { if (i > 0) { - writePunctuation(writer, 18 /* CommaToken */); + writePunctuation(writer, 22 /* CommaToken */); writeSpace(writer); } buildTypeDisplay(mapper(typeParameters[i]), writer, enclosingDeclaration, 0 /* None */); } - writePunctuation(writer, 20 /* GreaterThanToken */); + writePunctuation(writer, 24 /* GreaterThanToken */); } } function buildDisplayForParametersAndDelimiters(parameters, writer, enclosingDeclaration, flags, typeStack) { - writePunctuation(writer, 11 /* OpenParenToken */); + writePunctuation(writer, 15 /* OpenParenToken */); for (var i = 0; i < parameters.length; i++) { if (i > 0) { - writePunctuation(writer, 18 /* CommaToken */); + writePunctuation(writer, 22 /* CommaToken */); writeSpace(writer); } buildParameterDisplay(parameters[i], writer, enclosingDeclaration, flags, typeStack); } - writePunctuation(writer, 12 /* CloseParenToken */); + writePunctuation(writer, 16 /* CloseParenToken */); } function buildReturnTypeDisplay(signature, writer, enclosingDeclaration, flags, typeStack) { if (flags & 8 /* WriteArrowStyleSignature */) { writeSpace(writer); - writePunctuation(writer, 27 /* EqualsGreaterThanToken */); + writePunctuation(writer, 31 /* EqualsGreaterThanToken */); } else { - writePunctuation(writer, 46 /* ColonToken */); + writePunctuation(writer, 50 /* ColonToken */); } writeSpace(writer); buildTypeDisplay(getReturnTypeOfSignature(signature), writer, enclosingDeclaration, flags, typeStack); @@ -10259,12 +10556,12 @@ var ts; function isDeclarationVisible(node) { function getContainingExternalModule(node) { for (; node; node = node.parent) { - if (node.kind === 181 /* ModuleDeclaration */) { + if (node.kind === 188 /* ModuleDeclaration */) { if (node.name.kind === 7 /* StringLiteral */) { return node; } } - else if (node.kind === 186 /* SourceFile */) { + else if (node.kind === 193 /* SourceFile */) { return ts.isExternalModule(node) ? node : undefined; } } @@ -10280,7 +10577,7 @@ var ts; if (isSymbolUsedInExportAssignment(symbolOfNode)) { return true; } - if (symbolOfNode.flags & 16777216 /* Import */) { + if (symbolOfNode.flags & 33554432 /* Import */) { return isSymbolUsedInExportAssignment(resolveImport(symbolOfNode)); } } @@ -10288,7 +10585,7 @@ var ts; if (exportAssignmentSymbol === symbol) { return true; } - if (exportAssignmentSymbol && !!(exportAssignmentSymbol.flags & 16777216 /* Import */)) { + if (exportAssignmentSymbol && !!(exportAssignmentSymbol.flags & 33554432 /* Import */)) { resolvedExportSymbol = resolvedExportSymbol || resolveImport(exportAssignmentSymbol); if (resolvedExportSymbol === symbol) { return true; @@ -10306,32 +10603,32 @@ var ts; } function determineIfDeclarationIsVisible() { switch (node.kind) { - case 174 /* VariableDeclaration */: - case 181 /* ModuleDeclaration */: - case 177 /* ClassDeclaration */: - case 178 /* InterfaceDeclaration */: - case 179 /* TypeAliasDeclaration */: - case 175 /* FunctionDeclaration */: - case 180 /* EnumDeclaration */: - case 183 /* ImportDeclaration */: - var parent = node.kind === 174 /* VariableDeclaration */ ? node.parent.parent : node.parent; - if (!(node.flags & 1 /* Export */) && !(node.kind !== 183 /* ImportDeclaration */ && parent.kind !== 186 /* SourceFile */ && ts.isInAmbientContext(parent))) { + case 181 /* VariableDeclaration */: + case 188 /* ModuleDeclaration */: + case 184 /* ClassDeclaration */: + case 185 /* InterfaceDeclaration */: + case 186 /* TypeAliasDeclaration */: + case 182 /* FunctionDeclaration */: + case 187 /* EnumDeclaration */: + case 190 /* ImportDeclaration */: + var parent = node.kind === 181 /* VariableDeclaration */ ? node.parent.parent : node.parent; + if (!(node.flags & 1 /* Export */) && !(node.kind !== 190 /* ImportDeclaration */ && parent.kind !== 193 /* SourceFile */ && ts.isInAmbientContext(parent))) { return isGlobalSourceFile(parent) || isUsedInExportAssignment(node); } return isDeclarationVisible(parent); - case 120 /* Property */: - case 121 /* Method */: + case 124 /* Property */: + case 125 /* Method */: if (node.flags & (32 /* Private */ | 64 /* Protected */)) { return false; } - case 122 /* Constructor */: - case 126 /* ConstructSignature */: - case 125 /* CallSignature */: - case 127 /* IndexSignature */: - case 119 /* Parameter */: - case 182 /* ModuleBlock */: + case 126 /* Constructor */: + case 130 /* ConstructSignature */: + case 129 /* CallSignature */: + case 131 /* IndexSignature */: + case 123 /* Parameter */: + case 189 /* ModuleBlock */: return isDeclarationVisible(node.parent); - case 186 /* SourceFile */: + case 193 /* SourceFile */: return true; default: ts.Debug.fail("isDeclarationVisible unknown: SyntaxKind: " + ts.SyntaxKind[node.kind]); @@ -10350,16 +10647,16 @@ var ts; return classType.typeParameters ? createTypeReference(classType, ts.map(classType.typeParameters, function (_) { return anyType; })) : classType; } function getTypeOfVariableDeclaration(declaration) { - if (declaration.parent.kind === 159 /* ForInStatement */) { + if (declaration.parent.kind === 166 /* ForInStatement */) { return anyType; } if (declaration.type) { return getTypeFromTypeNode(declaration.type); } - if (declaration.kind === 119 /* Parameter */) { + if (declaration.kind === 123 /* Parameter */) { var func = declaration.parent; - if (func.kind === 124 /* SetAccessor */) { - var getter = getDeclarationOfKind(declaration.parent.symbol, 123 /* GetAccessor */); + if (func.kind === 128 /* SetAccessor */) { + var getter = getDeclarationOfKind(declaration.parent.symbol, 127 /* GetAccessor */); if (getter) { return getReturnTypeOfSignature(getSignatureFromDeclaration(getter)); } @@ -10371,7 +10668,7 @@ var ts; } if (declaration.initializer) { var type = checkAndMarkExpression(declaration.initializer); - if (declaration.kind !== 137 /* PropertyAssignment */) { + if (declaration.kind !== 141 /* PropertyAssignment */) { var unwidenedType = type; type = getWidenedType(type); if (type !== unwidenedType) { @@ -10390,14 +10687,14 @@ var ts; if (getInnermostTypeOfNestedArrayTypes(type) !== anyType) { return; } - if (isPrivateWithinAmbient(declaration) || (declaration.kind === 119 /* Parameter */ && isPrivateWithinAmbient(declaration.parent))) { + if (isPrivateWithinAmbient(declaration) || (declaration.kind === 123 /* Parameter */ && isPrivateWithinAmbient(declaration.parent))) { return; } switch (declaration.kind) { - case 120 /* Property */: + case 124 /* Property */: var diagnostic = ts.Diagnostics.Member_0_implicitly_has_an_1_type; break; - case 119 /* Parameter */: + case 123 /* Parameter */: var diagnostic = declaration.flags & 8 /* Rest */ ? ts.Diagnostics.Rest_parameter_0_implicitly_has_an_any_type : ts.Diagnostics.Parameter_0_implicitly_has_an_1_type; break; default: @@ -10409,11 +10706,11 @@ var ts; function getTypeOfVariableOrParameterOrProperty(symbol) { var links = getSymbolLinks(symbol); if (!links.type) { - if (symbol.flags & 268435456 /* Prototype */) { + if (symbol.flags & 536870912 /* Prototype */) { return links.type = getTypeOfPrototypeProperty(symbol); } var declaration = symbol.valueDeclaration; - if (declaration.kind === 171 /* CatchBlock */) { + if (declaration.kind === 178 /* CatchBlock */) { return links.type = anyType; } links.type = resolvingType; @@ -10436,7 +10733,7 @@ var ts; } function getAnnotatedAccessorType(accessor) { if (accessor) { - if (accessor.kind === 123 /* GetAccessor */) { + if (accessor.kind === 127 /* GetAccessor */) { return accessor.type && getTypeFromTypeNode(accessor.type); } else { @@ -10455,8 +10752,8 @@ var ts; links = links || getSymbolLinks(symbol); if (!links.type) { links.type = resolvingType; - var getter = getDeclarationOfKind(symbol, 123 /* GetAccessor */); - var setter = getDeclarationOfKind(symbol, 124 /* SetAccessor */); + var getter = getDeclarationOfKind(symbol, 127 /* GetAccessor */); + var setter = getDeclarationOfKind(symbol, 128 /* SetAccessor */); var type; var getterReturnType = getAnnotatedAccessorType(getter); if (getterReturnType) { @@ -10486,7 +10783,7 @@ var ts; else if (links.type === resolvingType) { links.type = anyType; if (compilerOptions.noImplicitAny) { - var getter = getDeclarationOfKind(symbol, 123 /* GetAccessor */); + var getter = getDeclarationOfKind(symbol, 127 /* GetAccessor */); error(getter, ts.Diagnostics._0_implicitly_has_return_type_any_because_it_does_not_have_a_return_type_annotation_and_is_referenced_directly_or_indirectly_in_one_of_its_return_expressions, symbolToString(symbol)); } } @@ -10520,13 +10817,13 @@ var ts; return links.type; } function getTypeOfSymbol(symbol) { - if (symbol.flags & 33554432 /* Instantiated */) { + if (symbol.flags & 67108864 /* Instantiated */) { return getTypeOfInstantiatedSymbol(symbol); } if (symbol.flags & (ts.SymbolFlags.Variable | 4 /* Property */)) { return getTypeOfVariableOrParameterOrProperty(symbol); } - if (symbol.flags & (16 /* Function */ | 4096 /* Method */ | 32 /* Class */ | 128 /* Enum */ | 256 /* ValueModule */)) { + if (symbol.flags & (16 /* Function */ | 8192 /* Method */ | 32 /* Class */ | ts.SymbolFlags.Enum | 512 /* ValueModule */)) { return getTypeOfFuncClassEnumModule(symbol); } if (symbol.flags & 8 /* EnumMember */) { @@ -10535,7 +10832,7 @@ var ts; if (symbol.flags & ts.SymbolFlags.Accessor) { return getTypeOfAccessors(symbol); } - if (symbol.flags & 16777216 /* Import */) { + if (symbol.flags & 33554432 /* Import */) { return getTypeOfImport(symbol); } return unknownType; @@ -10553,7 +10850,7 @@ var ts; function getTypeParametersOfClassOrInterface(symbol) { var result; ts.forEach(symbol.declarations, function (node) { - if (node.kind === 178 /* InterfaceDeclaration */ || node.kind === 177 /* ClassDeclaration */) { + if (node.kind === 185 /* InterfaceDeclaration */ || node.kind === 184 /* ClassDeclaration */) { var declaration = node; if (declaration.typeParameters && declaration.typeParameters.length) { ts.forEach(declaration.typeParameters, function (node) { @@ -10584,7 +10881,7 @@ var ts; type.typeArguments = type.typeParameters; } type.baseTypes = []; - var declaration = getDeclarationOfKind(symbol, 177 /* ClassDeclaration */); + var declaration = getDeclarationOfKind(symbol, 184 /* ClassDeclaration */); if (declaration.baseType) { var baseType = getTypeFromTypeReferenceNode(declaration.baseType); if (baseType !== unknownType) { @@ -10624,7 +10921,7 @@ var ts; } type.baseTypes = []; ts.forEach(symbol.declarations, function (declaration) { - if (declaration.kind === 178 /* InterfaceDeclaration */ && declaration.baseTypes) { + if (declaration.kind === 185 /* InterfaceDeclaration */ && declaration.baseTypes) { ts.forEach(declaration.baseTypes, function (node) { var baseType = getTypeFromTypeReferenceNode(node); if (baseType !== unknownType) { @@ -10655,7 +10952,7 @@ var ts; var links = getSymbolLinks(symbol); if (!links.declaredType) { links.declaredType = resolvingType; - var declaration = getDeclarationOfKind(symbol, 179 /* TypeAliasDeclaration */); + var declaration = getDeclarationOfKind(symbol, 186 /* TypeAliasDeclaration */); var type = getTypeFromTypeNode(declaration.type); if (links.declaredType === resolvingType) { links.declaredType = type; @@ -10663,7 +10960,7 @@ var ts; } else if (links.declaredType === resolvingType) { links.declaredType = unknownType; - var declaration = getDeclarationOfKind(symbol, 179 /* TypeAliasDeclaration */); + var declaration = getDeclarationOfKind(symbol, 186 /* TypeAliasDeclaration */); error(declaration.name, ts.Diagnostics.Type_alias_0_circularly_references_itself, symbolToString(symbol)); } return links.declaredType; @@ -10682,7 +10979,7 @@ var ts; if (!links.declaredType) { var type = createType(512 /* TypeParameter */); type.symbol = symbol; - if (!getDeclarationOfKind(symbol, 118 /* TypeParameter */).constraint) { + if (!getDeclarationOfKind(symbol, 122 /* TypeParameter */).constraint) { type.constraint = noConstraintType; } links.declaredType = type; @@ -10697,23 +10994,23 @@ var ts; return links.declaredType; } function getDeclaredTypeOfSymbol(symbol) { - ts.Debug.assert((symbol.flags & 33554432 /* Instantiated */) === 0); + ts.Debug.assert((symbol.flags & 67108864 /* Instantiated */) === 0); if (symbol.flags & 32 /* Class */) { return getDeclaredTypeOfClass(symbol); } if (symbol.flags & 64 /* Interface */) { return getDeclaredTypeOfInterface(symbol); } - if (symbol.flags & 1048576 /* TypeAlias */) { + if (symbol.flags & 2097152 /* TypeAlias */) { return getDeclaredTypeOfTypeAlias(symbol); } - if (symbol.flags & 128 /* Enum */) { + if (symbol.flags & ts.SymbolFlags.Enum) { return getDeclaredTypeOfEnum(symbol); } - if (symbol.flags & 524288 /* TypeParameter */) { + if (symbol.flags & 1048576 /* TypeParameter */) { return getDeclaredTypeOfTypeParameter(symbol); } - if (symbol.flags & 16777216 /* Import */) { + if (symbol.flags & 33554432 /* Import */) { return getDeclaredTypeOfImport(symbol); } return unknownType; @@ -10815,7 +11112,7 @@ var ts; function createTupleTypeMemberSymbols(memberTypes) { var members = {}; for (var i = 0; i < memberTypes.length; i++) { - var symbol = createSymbol(4 /* Property */ | 134217728 /* Transient */, "" + i); + var symbol = createSymbol(4 /* Property */ | 268435456 /* Transient */, "" + i); symbol.type = memberTypes[i]; members[i] = symbol; } @@ -10832,7 +11129,7 @@ var ts; return false; } for (var i = 0; i < s.length; i++) { - if (!compareSignatures(s[i], t[i], false, isTypeIdenticalTo)) { + if (!compareSignatures(s[i], t[i], false, compareTypes)) { return false; } } @@ -10879,7 +11176,7 @@ var ts; } function resolveAnonymousTypeMembers(type) { var symbol = type.symbol; - if (symbol.flags & 1024 /* TypeLiteral */) { + if (symbol.flags & 2048 /* TypeLiteral */) { var members = symbol.members; var callSignatures = getSignaturesOfSymbol(members["__call"]); var constructSignatures = getSignaturesOfSymbol(members["__new"]); @@ -10893,7 +11190,7 @@ var ts; if (symbol.flags & ts.SymbolFlags.HasExports) { members = symbol.exports; } - if (symbol.flags & (16 /* Function */ | 4096 /* Method */)) { + if (symbol.flags & (16 /* Function */ | 8192 /* Method */)) { callSignatures = getSignaturesOfSymbol(symbol); } if (symbol.flags & 32 /* Class */) { @@ -10908,7 +11205,7 @@ var ts; } } var stringIndexType = undefined; - var numberIndexType = (symbol.flags & 128 /* Enum */) ? stringType : undefined; + var numberIndexType = (symbol.flags & ts.SymbolFlags.Enum) ? stringType : undefined; } setObjectTypeMembers(type, members, callSignatures, constructSignatures, stringIndexType, numberIndexType); } @@ -11012,7 +11309,7 @@ var ts; } propTypes.push(getTypeOfSymbol(prop)); } - var result = createSymbol(4 /* Property */ | 134217728 /* Transient */ | 536870912 /* UnionProperty */, name); + var result = createSymbol(4 /* Property */ | 268435456 /* Transient */ | 1073741824 /* UnionProperty */, name); result.unionType = unionType; result.declarations = declarations; result.type = getUnionType(propTypes); @@ -11085,7 +11382,7 @@ var ts; function getSignatureFromDeclaration(declaration) { var links = getNodeLinks(declaration); if (!links.resolvedSignature) { - var classType = declaration.kind === 122 /* Constructor */ ? getDeclaredTypeOfClass(declaration.parent.symbol) : undefined; + var classType = declaration.kind === 126 /* Constructor */ ? getDeclaredTypeOfClass(declaration.parent.symbol) : undefined; var typeParameters = classType ? classType.typeParameters : declaration.typeParameters ? getTypeParametersFromDeclaration(declaration.typeParameters) : undefined; var parameters = []; var hasStringLiterals = false; @@ -11113,8 +11410,8 @@ var ts; returnType = getTypeFromTypeNode(declaration.type); } else { - if (declaration.kind === 123 /* GetAccessor */) { - var setter = getDeclarationOfKind(declaration.symbol, 124 /* SetAccessor */); + if (declaration.kind === 127 /* GetAccessor */) { + var setter = getDeclarationOfKind(declaration.symbol, 128 /* SetAccessor */); returnType = getAnnotatedAccessorType(setter); } if (!returnType && !declaration.body) { @@ -11132,16 +11429,16 @@ var ts; for (var i = 0, len = symbol.declarations.length; i < len; i++) { var node = symbol.declarations[i]; switch (node.kind) { - case 175 /* FunctionDeclaration */: - case 121 /* Method */: - case 122 /* Constructor */: - case 125 /* CallSignature */: - case 126 /* ConstructSignature */: - case 127 /* IndexSignature */: - case 123 /* GetAccessor */: - case 124 /* SetAccessor */: - case 144 /* FunctionExpression */: - case 145 /* ArrowFunction */: + case 182 /* FunctionDeclaration */: + case 125 /* Method */: + case 126 /* Constructor */: + case 129 /* CallSignature */: + case 130 /* ConstructSignature */: + case 131 /* IndexSignature */: + case 127 /* GetAccessor */: + case 128 /* SetAccessor */: + case 149 /* FunctionExpression */: + case 150 /* ArrowFunction */: if (i > 0 && node.body) { var previous = symbol.declarations[i - 1]; if (node.parent === previous.parent && node.kind === previous.kind && node.pos === previous.end) { @@ -11210,7 +11507,7 @@ var ts; } function getOrCreateTypeFromSignature(signature) { if (!signature.isolatedSignatureType) { - var isConstructor = signature.declaration.kind === 122 /* Constructor */ || signature.declaration.kind === 126 /* ConstructSignature */; + var isConstructor = signature.declaration.kind === 126 /* Constructor */ || signature.declaration.kind === 130 /* ConstructSignature */; var type = createObjectType(32768 /* Anonymous */ | 65536 /* FromSignature */); type.members = emptySymbols; type.properties = emptyArray; @@ -11224,7 +11521,7 @@ var ts; return symbol.members["__index"]; } function getIndexDeclarationOfSymbol(symbol, kind) { - var syntaxKind = kind === 1 /* Number */ ? 112 /* NumberKeyword */ : 114 /* StringKeyword */; + var syntaxKind = kind === 1 /* Number */ ? 116 /* NumberKeyword */ : 118 /* StringKeyword */; var indexSymbol = getIndexSymbol(symbol); if (indexSymbol) { var len = indexSymbol.declarations.length; @@ -11251,7 +11548,7 @@ var ts; type.constraint = targetConstraint ? instantiateType(targetConstraint, type.mapper) : noConstraintType; } else { - type.constraint = getTypeFromTypeNode(getDeclarationOfKind(type.symbol, 118 /* TypeParameter */).constraint); + type.constraint = getTypeFromTypeNode(getDeclarationOfKind(type.symbol, 122 /* TypeParameter */).constraint); } } return type.constraint === noConstraintType ? undefined : type.constraint; @@ -11291,17 +11588,17 @@ var ts; while (!ts.forEach(typeParameterSymbol.declarations, function (d) { return d.parent === currentNode.parent; })) { currentNode = currentNode.parent; } - links.isIllegalTypeReferenceInConstraint = currentNode.kind === 118 /* TypeParameter */; + links.isIllegalTypeReferenceInConstraint = currentNode.kind === 122 /* TypeParameter */; return links.isIllegalTypeReferenceInConstraint; } function checkTypeParameterHasIllegalReferencesInConstraint(typeParameter) { var typeParameterSymbol; function check(n) { - if (n.kind === 128 /* TypeReference */ && n.typeName.kind === 59 /* Identifier */) { + if (n.kind === 132 /* TypeReference */ && n.typeName.kind === 63 /* Identifier */) { var links = getNodeLinks(n); if (links.isIllegalTypeReferenceInConstraint === undefined) { var symbol = resolveName(typeParameter, n.typeName.text, ts.SymbolFlags.Type, undefined, undefined); - if (symbol && (symbol.flags & 524288 /* TypeParameter */)) { + if (symbol && (symbol.flags & 1048576 /* TypeParameter */)) { links.isIllegalTypeReferenceInConstraint = ts.forEach(symbol.declarations, function (d) { return d.parent == typeParameter.parent; }); } } @@ -11322,7 +11619,7 @@ var ts; var symbol = resolveEntityName(node, node.typeName, ts.SymbolFlags.Type); if (symbol) { var type; - if ((symbol.flags & 524288 /* TypeParameter */) && isTypeParameterReferenceIllegalInConstraint(node, symbol)) { + if ((symbol.flags & 1048576 /* TypeParameter */) && isTypeParameterReferenceIllegalInConstraint(node, symbol)) { type = unknownType; } else { @@ -11362,9 +11659,9 @@ var ts; for (var i = 0; i < declarations.length; i++) { var declaration = declarations[i]; switch (declaration.kind) { - case 177 /* ClassDeclaration */: - case 178 /* InterfaceDeclaration */: - case 180 /* EnumDeclaration */: + case 184 /* ClassDeclaration */: + case 185 /* InterfaceDeclaration */: + case 187 /* EnumDeclaration */: return declaration; } } @@ -11527,34 +11824,34 @@ var ts; } function getTypeFromTypeNode(node) { switch (node.kind) { - case 105 /* AnyKeyword */: + case 109 /* AnyKeyword */: return anyType; - case 114 /* StringKeyword */: + case 118 /* StringKeyword */: return stringType; - case 112 /* NumberKeyword */: + case 116 /* NumberKeyword */: return numberType; - case 106 /* BooleanKeyword */: + case 110 /* BooleanKeyword */: return booleanType; - case 93 /* VoidKeyword */: + case 97 /* VoidKeyword */: return voidType; case 7 /* StringLiteral */: return getTypeFromStringLiteral(node); - case 128 /* TypeReference */: + case 132 /* TypeReference */: return getTypeFromTypeReferenceNode(node); - case 129 /* TypeQuery */: + case 133 /* TypeQuery */: return getTypeFromTypeQueryNode(node); - case 131 /* ArrayType */: + case 135 /* ArrayType */: return getTypeFromArrayTypeNode(node); - case 132 /* TupleType */: + case 136 /* TupleType */: return getTypeFromTupleTypeNode(node); - case 133 /* UnionType */: + case 137 /* UnionType */: return getTypeFromUnionTypeNode(node); - case 134 /* ParenType */: + case 138 /* ParenType */: return getTypeFromTypeNode(node.type); - case 130 /* TypeLiteral */: + case 134 /* TypeLiteral */: return getTypeFromTypeLiteralNode(node); - case 59 /* Identifier */: - case 117 /* QualifiedName */: + case 63 /* Identifier */: + case 121 /* QualifiedName */: var symbol = getSymbolInfo(node); return symbol && getDeclaredTypeOfSymbol(symbol); default: @@ -11579,10 +11876,8 @@ var ts; } function createTypeMapper(sources, targets) { switch (sources.length) { - case 1: - return createUnaryTypeMapper(sources[0], targets[0]); - case 2: - return createBinaryTypeMapper(sources[0], targets[0], sources[1], targets[1]); + case 1: return createUnaryTypeMapper(sources[0], targets[0]); + case 2: return createBinaryTypeMapper(sources[0], targets[0], sources[1], targets[1]); } return function (t) { for (var i = 0; i < sources.length; i++) { @@ -11600,10 +11895,8 @@ var ts; } function createTypeEraser(sources) { switch (sources.length) { - case 1: - return createUnaryTypeEraser(sources[0]); - case 2: - return createBinaryTypeEraser(sources[0], sources[1]); + case 1: return createUnaryTypeEraser(sources[0]); + case 2: return createBinaryTypeEraser(sources[0], sources[1]); } return function (t) { for (var i = 0; i < sources.length; i++) { @@ -11652,12 +11945,12 @@ var ts; return result; } function instantiateSymbol(symbol, mapper) { - if (symbol.flags & 33554432 /* Instantiated */) { + if (symbol.flags & 67108864 /* Instantiated */) { var links = getSymbolLinks(symbol); symbol = links.target; mapper = combineTypeMappers(links.mapper, mapper); } - var result = createSymbol(33554432 /* Instantiated */ | 134217728 /* Transient */ | symbol.flags, symbol.name); + var result = createSymbol(67108864 /* Instantiated */ | 268435456 /* Transient */ | symbol.flags, symbol.name); result.declarations = symbol.declarations; result.parent = symbol.parent; result.target = symbol; @@ -11687,7 +11980,7 @@ var ts; return mapper(type); } if (type.flags & 32768 /* Anonymous */) { - return type.symbol && type.symbol.flags & (16 /* Function */ | 4096 /* Method */ | 1024 /* TypeLiteral */ | 2048 /* ObjectLiteral */) ? instantiateAnonymousType(type, mapper) : type; + return type.symbol && type.symbol.flags & (16 /* Function */ | 8192 /* Method */ | 2048 /* TypeLiteral */ | 4096 /* ObjectLiteral */) ? instantiateAnonymousType(type, mapper) : type; } if (type.flags & 4096 /* Reference */) { return createTypeReference(type.target, instantiateList(type.typeArguments, mapper, instantiateType)); @@ -11703,17 +11996,17 @@ var ts; } function isContextSensitiveExpression(node) { switch (node.kind) { - case 144 /* FunctionExpression */: - case 145 /* ArrowFunction */: + case 149 /* FunctionExpression */: + case 150 /* ArrowFunction */: return !node.typeParameters && !ts.forEach(node.parameters, function (p) { return p.type; }); - case 136 /* ObjectLiteral */: - return ts.forEach(node.properties, function (p) { return p.kind === 137 /* PropertyAssignment */ && isContextSensitiveExpression(p.initializer); }); - case 135 /* ArrayLiteral */: + case 140 /* ObjectLiteral */: + return ts.forEach(node.properties, function (p) { return p.kind === 141 /* PropertyAssignment */ && isContextSensitiveExpression(p.initializer); }); + case 139 /* ArrayLiteral */: return ts.forEach(node.elements, function (e) { return isContextSensitiveExpression(e); }); - case 149 /* ConditionalExpression */: + case 154 /* ConditionalExpression */: return isContextSensitiveExpression(node.whenTrue) || isContextSensitiveExpression(node.whenFalse); - case 148 /* BinaryExpression */: - return node.operator === 44 /* BarBarToken */ && (isContextSensitiveExpression(node.left) || isContextSensitiveExpression(node.right)); + case 153 /* BinaryExpression */: + return node.operator === 48 /* BarBarToken */ && (isContextSensitiveExpression(node.left) || isContextSensitiveExpression(node.right)); } return false; } @@ -11737,78 +12030,26 @@ var ts; function isTypeIdenticalTo(source, target) { return checkTypeRelatedTo(source, target, identityRelation, undefined); } + function compareTypes(source, target) { + return checkTypeRelatedTo(source, target, identityRelation, undefined) ? -1 /* True */ : 0 /* False */; + } function isTypeSubtypeOf(source, target) { return checkTypeSubtypeOf(source, target, undefined); } - function checkTypeSubtypeOf(source, target, errorNode, headMessage, containingMessageChain) { - return checkTypeRelatedTo(source, target, subtypeRelation, errorNode, headMessage, containingMessageChain); - } function isTypeAssignableTo(source, target) { return checkTypeAssignableTo(source, target, undefined); } + function checkTypeSubtypeOf(source, target, errorNode, headMessage, containingMessageChain) { + return checkTypeRelatedTo(source, target, subtypeRelation, errorNode, headMessage, containingMessageChain); + } function checkTypeAssignableTo(source, target, errorNode, headMessage) { return checkTypeRelatedTo(source, target, assignableRelation, errorNode, headMessage); } - function isTypeRelatedTo(source, target, relation) { - return checkTypeRelatedTo(source, target, relation, undefined); - } function isSignatureAssignableTo(source, target) { var sourceType = getOrCreateTypeFromSignature(source); var targetType = getOrCreateTypeFromSignature(target); return checkTypeRelatedTo(sourceType, targetType, assignableRelation, undefined); } - function isPropertyIdenticalTo(sourceProp, targetProp) { - return isPropertyIdenticalToRecursive(sourceProp, targetProp, false, function (s, t, _reportErrors) { return isTypeIdenticalTo(s, t); }); - } - function checkInheritedPropertiesAreIdentical(type, typeNode) { - if (!type.baseTypes.length || type.baseTypes.length === 1) { - return true; - } - var seen = {}; - ts.forEach(type.declaredProperties, function (p) { - seen[p.name] = { prop: p, containingType: type }; - }); - var ok = true; - for (var i = 0, len = type.baseTypes.length; i < len; ++i) { - var base = type.baseTypes[i]; - var properties = getPropertiesOfObjectType(base); - for (var j = 0, proplen = properties.length; j < proplen; ++j) { - var prop = properties[j]; - if (!ts.hasProperty(seen, prop.name)) { - seen[prop.name] = { prop: prop, containingType: base }; - } - else { - var existing = seen[prop.name]; - var isInheritedProperty = existing.containingType !== type; - if (isInheritedProperty && !isPropertyIdenticalTo(existing.prop, prop)) { - ok = false; - var typeName1 = typeToString(existing.containingType); - var typeName2 = typeToString(base); - var errorInfo = ts.chainDiagnosticMessages(undefined, ts.Diagnostics.Named_properties_0_of_types_1_and_2_are_not_identical, prop.name, typeName1, typeName2); - errorInfo = ts.chainDiagnosticMessages(errorInfo, ts.Diagnostics.Interface_0_cannot_simultaneously_extend_types_1_and_2, typeToString(type), typeName1, typeName2); - addDiagnostic(ts.createDiagnosticForNodeFromMessageChain(typeNode, errorInfo, program.getCompilerHost().getNewLine())); - } - } - } - } - return ok; - } - function isPropertyIdenticalToRecursive(sourceProp, targetProp, reportErrors, relate) { - if (sourceProp === targetProp) { - return true; - } - var sourcePropAccessibility = getDeclarationFlagsFromSymbol(sourceProp) & (32 /* Private */ | 64 /* Protected */); - var targetPropAccessibility = getDeclarationFlagsFromSymbol(targetProp) & (32 /* Private */ | 64 /* Protected */); - if (sourcePropAccessibility !== targetPropAccessibility) { - return false; - } - if (sourcePropAccessibility) { - return getTargetSymbol(sourceProp) === getTargetSymbol(targetProp) && relate(getTypeOfSymbol(sourceProp), getTypeOfSymbol(targetProp), reportErrors); - } - else { - return isOptionalProperty(sourceProp) === isOptionalProperty(targetProp) && relate(getTypeOfSymbol(sourceProp), getTypeOfSymbol(targetProp), reportErrors); - } - } function checkTypeRelatedTo(source, target, relation, errorNode, headMessage, containingMessageChain) { var errorInfo; var sourceStack; @@ -11817,7 +12058,7 @@ var ts; var depth = 0; var overflow = false; ts.Debug.assert(relation !== identityRelation || !errorNode, "no error reporting in identity checking"); - var result = isRelatedToWithCustomErrors(source, target, errorNode !== undefined, headMessage); + var result = isRelatedTo(source, target, errorNode !== undefined, headMessage); if (overflow) { error(errorNode, ts.Diagnostics.Excessive_stack_depth_comparing_types_0_and_1, typeToString(source), typeToString(target)); } @@ -11827,109 +12068,114 @@ var ts; } addDiagnostic(ts.createDiagnosticForNodeFromMessageChain(errorNode, errorInfo, program.getCompilerHost().getNewLine())); } - return result; + return result !== 0 /* False */; function reportError(message, arg0, arg1, arg2) { errorInfo = ts.chainDiagnosticMessages(errorInfo, message, arg0, arg1, arg2); } - function isRelatedTo(source, target, reportErrors) { - return isRelatedToWithCustomErrors(source, target, reportErrors, undefined); - } - function isRelatedToWithCustomErrors(source, target, reportErrors, headMessage) { + function isRelatedTo(source, target, reportErrors, headMessage) { + var result; if (relation === identityRelation) { if (source === target) - return true; + return -1 /* True */; } else { if (source === target) - return true; + return -1 /* True */; if (target.flags & 1 /* Any */) - return true; + return -1 /* True */; if (source === undefinedType) - return true; + return -1 /* True */; if (source === nullType && target !== undefinedType) - return true; + return -1 /* True */; if (source.flags & 128 /* Enum */ && target === numberType) - return true; + return -1 /* True */; if (source.flags & 256 /* StringLiteral */ && target === stringType) - return true; + return -1 /* True */; if (relation === assignableRelation) { if (source.flags & 1 /* Any */) - return true; + return -1 /* True */; if (source === numberType && target.flags & 128 /* Enum */) - return true; + return -1 /* True */; } } if (source.flags & 16384 /* Union */) { - if (unionTypeRelatedToType(source, target, reportErrors)) { - return true; + if (result = unionTypeRelatedToType(source, target, reportErrors)) { + return result; } } else if (target.flags & 16384 /* Union */) { - if (typeRelatedToUnionType(source, target, reportErrors)) { - return true; + if (result = typeRelatedToUnionType(source, target, reportErrors)) { + return result; } } else if (source.flags & 512 /* TypeParameter */ && target.flags & 512 /* TypeParameter */) { - if (typeParameterRelatedTo(source, target, reportErrors)) { - return true; + if (result = typeParameterRelatedTo(source, target, reportErrors)) { + return result; } } else { var saveErrorInfo = errorInfo; if (source.flags & 4096 /* Reference */ && target.flags & 4096 /* Reference */ && source.target === target.target) { - if (typesRelatedTo(source.typeArguments, target.typeArguments, reportErrors)) { - return true; + if (result = typesRelatedTo(source.typeArguments, target.typeArguments, reportErrors)) { + return result; } } var reportStructuralErrors = reportErrors && errorInfo === saveErrorInfo; var sourceOrApparentType = relation === identityRelation ? source : getApparentType(source); - if (sourceOrApparentType.flags & ts.TypeFlags.ObjectType && target.flags & ts.TypeFlags.ObjectType && objectTypeRelatedTo(sourceOrApparentType, target, reportStructuralErrors)) { + if (sourceOrApparentType.flags & ts.TypeFlags.ObjectType && target.flags & ts.TypeFlags.ObjectType && (result = objectTypeRelatedTo(sourceOrApparentType, target, reportStructuralErrors))) { errorInfo = saveErrorInfo; - return true; + return result; } } if (reportErrors) { headMessage = headMessage || ts.Diagnostics.Type_0_is_not_assignable_to_type_1; - ts.Debug.assert(headMessage); reportError(headMessage, typeToString(source), typeToString(target)); } - return false; + return 0 /* False */; } function typeRelatedToUnionType(source, target, reportErrors) { var targetTypes = target.types; for (var i = 0, len = targetTypes.length; i < len; i++) { - if (isRelatedTo(source, targetTypes[i], reportErrors && i === len - 1)) { - return true; + var related = isRelatedTo(source, targetTypes[i], reportErrors && i === len - 1); + if (related) { + return related; } } - return false; + return 0 /* False */; } function unionTypeRelatedToType(source, target, reportErrors) { + var result = -1 /* True */; var sourceTypes = source.types; for (var i = 0, len = sourceTypes.length; i < len; i++) { - if (!isRelatedTo(sourceTypes[i], target, reportErrors)) { - return false; + var related = isRelatedTo(sourceTypes[i], target, reportErrors); + if (!related) { + return 0 /* False */; } + result &= related; } - return true; + return result; } function typesRelatedTo(sources, targets, reportErrors) { + var result = -1 /* True */; for (var i = 0, len = sources.length; i < len; i++) { - if (!isRelatedTo(sources[i], targets[i], reportErrors)) - return false; + var related = isRelatedTo(sources[i], targets[i], reportErrors); + if (!related) { + return 0 /* False */; + } + result &= related; } - return true; + return result; } function typeParameterRelatedTo(source, target, reportErrors) { if (relation === identityRelation) { if (source.symbol.name !== target.symbol.name) { - return false; + return 0 /* False */; } if (source.constraint === target.constraint) { - return true; + return -1 /* True */; } if (source.constraint === noConstraintType || target.constraint === noConstraintType) { - return false; + return 0 /* False */; } return isRelatedTo(source.constraint, target.constraint, reportErrors); } @@ -11937,29 +12183,32 @@ var ts; while (true) { var constraint = getConstraintOfTypeParameter(source); if (constraint === target) - return true; + return -1 /* True */; if (!(constraint && constraint.flags & 512 /* TypeParameter */)) break; source = constraint; } - return false; + return 0 /* False */; } } function objectTypeRelatedTo(source, target, reportErrors) { - if (overflow) - return false; - var result; + if (overflow) { + return 0 /* False */; + } var id = source.id + "," + target.id; - if ((result = relation[id]) !== undefined) - return result; + var related = relation[id]; + if (related !== undefined) { + return related; + } if (depth > 0) { for (var i = 0; i < depth; i++) { - if (source === sourceStack[i] && target === targetStack[i]) - return true; + if (source === sourceStack[i] && target === targetStack[i]) { + return 1 /* Maybe */; + } } if (depth === 100) { overflow = true; - return false; + return 0 /* False */; } } else { @@ -11975,10 +12224,27 @@ var ts; expandingFlags |= 1; if (!(expandingFlags & 2) && isDeeplyNestedGeneric(target, targetStack)) expandingFlags |= 2; - result = expandingFlags === 3 || propertiesRelatedTo(source, target, reportErrors) && signaturesRelatedTo(source, target, 0 /* Call */, reportErrors) && signaturesRelatedTo(source, target, 1 /* Construct */, reportErrors) && stringIndexTypesRelatedTo(source, target, reportErrors) && numberIndexTypesRelatedTo(source, target, reportErrors); + if (expandingFlags === 3) { + var result = -1 /* True */; + } + else { + var result = propertiesRelatedTo(source, target, reportErrors); + if (result) { + result &= signaturesRelatedTo(source, target, 0 /* Call */, reportErrors); + if (result) { + result &= signaturesRelatedTo(source, target, 1 /* Construct */, reportErrors); + if (result) { + result &= stringIndexTypesRelatedTo(source, target, reportErrors); + if (result) { + result &= numberIndexTypesRelatedTo(source, target, reportErrors); + } + } + } + } + } expandingFlags = saveExpandingFlags; depth--; - if (depth === 0) { + if (result !== 1 /* Maybe */) { relation[id] = result; } return result; @@ -12000,8 +12266,9 @@ var ts; } function propertiesRelatedTo(source, target, reportErrors) { if (relation === identityRelation) { - return propertiesIdenticalTo(source, target, reportErrors); + return propertiesIdenticalTo(source, target); } + var result = -1 /* True */; var properties = getPropertiesOfObjectType(target); for (var i = 0; i < properties.length; i++) { var targetProp = properties[i]; @@ -12012,10 +12279,10 @@ var ts; if (reportErrors) { reportError(ts.Diagnostics.Property_0_is_missing_in_type_1, symbolToString(targetProp), typeToString(source)); } - return false; + return 0 /* False */; } } - else if (!(targetProp.flags & 268435456 /* Prototype */)) { + else if (!(targetProp.flags & 536870912 /* Prototype */)) { var sourceFlags = getDeclarationFlagsFromSymbol(sourceProp); var targetFlags = getDeclarationFlagsFromSymbol(targetProp); if (sourceFlags & 32 /* Private */ || targetFlags & 32 /* Private */) { @@ -12028,7 +12295,7 @@ var ts; reportError(ts.Diagnostics.Property_0_is_private_in_type_1_but_not_in_type_2, symbolToString(targetProp), typeToString(sourceFlags & 32 /* Private */ ? source : target), typeToString(sourceFlags & 32 /* Private */ ? target : source)); } } - return false; + return 0 /* False */; } } else if (targetFlags & 64 /* Protected */) { @@ -12039,55 +12306,65 @@ var ts; if (reportErrors) { reportError(ts.Diagnostics.Property_0_is_protected_but_type_1_is_not_a_class_derived_from_2, symbolToString(targetProp), typeToString(sourceClass || source), typeToString(targetClass)); } - return false; + return 0 /* False */; } } else if (sourceFlags & 64 /* Protected */) { if (reportErrors) { reportError(ts.Diagnostics.Property_0_is_protected_in_type_1_but_public_in_type_2, symbolToString(targetProp), typeToString(source), typeToString(target)); } - return false; + return 0 /* False */; } - if (!isRelatedTo(getTypeOfSymbol(sourceProp), getTypeOfSymbol(targetProp), reportErrors)) { + var related = isRelatedTo(getTypeOfSymbol(sourceProp), getTypeOfSymbol(targetProp), reportErrors); + if (!related) { if (reportErrors) { reportError(ts.Diagnostics.Types_of_property_0_are_incompatible, symbolToString(targetProp)); } - return false; + return 0 /* False */; } + result &= related; if (isOptionalProperty(sourceProp) && !isOptionalProperty(targetProp)) { if (reportErrors) { reportError(ts.Diagnostics.Property_0_is_optional_in_type_1_but_required_in_type_2, symbolToString(targetProp), typeToString(source), typeToString(target)); } - return false; + return 0 /* False */; } } } } - return true; + return result; } - function propertiesIdenticalTo(source, target, reportErrors) { + function propertiesIdenticalTo(source, target) { var sourceProperties = getPropertiesOfObjectType(source); var targetProperties = getPropertiesOfObjectType(target); if (sourceProperties.length !== targetProperties.length) { - return false; + return 0 /* False */; } + var result = -1 /* True */; for (var i = 0, len = sourceProperties.length; i < len; ++i) { var sourceProp = sourceProperties[i]; var targetProp = getPropertyOfObjectType(target, sourceProp.name); - if (!targetProp || !isPropertyIdenticalToRecursive(sourceProp, targetProp, reportErrors, isRelatedTo)) { - return false; + if (!targetProp) { + return 0 /* False */; } + var related = compareProperties(sourceProp, targetProp, isRelatedTo); + if (!related) { + return 0 /* False */; + } + result &= related; } - return true; + return result; } function signaturesRelatedTo(source, target, kind, reportErrors) { if (relation === identityRelation) { - return signaturesIdenticalTo(source, target, kind, reportErrors); + return signaturesIdenticalTo(source, target, kind); + } + if (target === anyFunctionType || source === anyFunctionType) { + return -1 /* True */; } - if (target === anyFunctionType || source === anyFunctionType) - return true; var sourceSignatures = getSignaturesOfType(source, kind); var targetSignatures = getSignaturesOfType(target, kind); + var result = -1 /* True */; var saveErrorInfo = errorInfo; outer: for (var i = 0; i < targetSignatures.length; i++) { var t = targetSignatures[i]; @@ -12096,24 +12373,26 @@ var ts; for (var j = 0; j < sourceSignatures.length; j++) { var s = sourceSignatures[j]; if (!s.hasStringLiterals || source.flags & 65536 /* FromSignature */) { - if (signatureRelatedTo(s, t, localErrors)) { + var related = signatureRelatedTo(s, t, localErrors); + if (related) { + result &= related; errorInfo = saveErrorInfo; continue outer; } localErrors = false; } } - return false; + return 0 /* False */; } } - return true; + return result; } function signatureRelatedTo(source, target, reportErrors) { if (source === target) { - return true; + return -1 /* True */; } if (!target.hasRestParameter && source.minArgumentCount > target.parameters.length) { - return false; + return 0 /* False */; } var sourceMax = source.parameters.length; var targetMax = target.parameters.length; @@ -12136,42 +12415,49 @@ var ts; } source = getErasedSignature(source); target = getErasedSignature(target); + var result = -1 /* True */; for (var i = 0; i < checkCount; i++) { var s = i < sourceMax ? getTypeOfSymbol(source.parameters[i]) : getRestTypeOfSignature(source); var t = i < targetMax ? getTypeOfSymbol(target.parameters[i]) : getRestTypeOfSignature(target); var saveErrorInfo = errorInfo; - if (!isRelatedTo(s, t, reportErrors)) { - if (!isRelatedTo(t, s, false)) { + var related = isRelatedTo(s, t, reportErrors); + if (!related) { + related = isRelatedTo(t, s, false); + if (!related) { if (reportErrors) { reportError(ts.Diagnostics.Types_of_parameters_0_and_1_are_incompatible, source.parameters[i < sourceMax ? i : sourceMax].name, target.parameters[i < targetMax ? i : targetMax].name); } - return false; + return 0 /* False */; } errorInfo = saveErrorInfo; } + result &= related; } var t = getReturnTypeOfSignature(target); if (t === voidType) - return true; + return result; var s = getReturnTypeOfSignature(source); - return isRelatedTo(s, t, reportErrors); + return result & isRelatedTo(s, t, reportErrors); } - function signaturesIdenticalTo(source, target, kind, reportErrors) { + function signaturesIdenticalTo(source, target, kind) { var sourceSignatures = getSignaturesOfType(source, kind); var targetSignatures = getSignaturesOfType(target, kind); if (sourceSignatures.length !== targetSignatures.length) { - return false; + return 0 /* False */; } + var result = -1 /* True */; for (var i = 0, len = sourceSignatures.length; i < len; ++i) { - if (!compareSignatures(sourceSignatures[i], targetSignatures[i], true, isRelatedTo)) { - return false; + var related = compareSignatures(sourceSignatures[i], targetSignatures[i], true, isRelatedTo); + if (!related) { + return 0 /* False */; } + result &= related; } - return true; + return result; } function stringIndexTypesRelatedTo(source, target, reportErrors) { if (relation === identityRelation) { - return indexTypesIdenticalTo(0 /* String */, source, target, reportErrors); + return indexTypesIdenticalTo(0 /* String */, source, target); } var targetType = getIndexTypeOfType(target, 0 /* String */); if (targetType) { @@ -12180,20 +12466,22 @@ var ts; if (reportErrors) { reportError(ts.Diagnostics.Index_signature_is_missing_in_type_0, typeToString(source)); } - return false; + return 0 /* False */; } - if (!isRelatedTo(sourceType, targetType, reportErrors)) { + var related = isRelatedTo(sourceType, targetType, reportErrors); + if (!related) { if (reportErrors) { reportError(ts.Diagnostics.Index_signatures_are_incompatible); } - return false; + return 0 /* False */; } + return related; } - return true; + return -1 /* True */; } function numberIndexTypesRelatedTo(source, target, reportErrors) { if (relation === identityRelation) { - return indexTypesIdenticalTo(1 /* Number */, source, target, reportErrors); + return indexTypesIdenticalTo(1 /* Number */, source, target); } var targetType = getIndexTypeOfType(target, 1 /* Number */); if (targetType) { @@ -12203,59 +12491,98 @@ var ts; if (reportErrors) { reportError(ts.Diagnostics.Index_signature_is_missing_in_type_0, typeToString(source)); } - return false; + return 0 /* False */; } if (sourceStringType && sourceNumberType) { - var compatible = isRelatedTo(sourceStringType, targetType, false) || isRelatedTo(sourceNumberType, targetType, reportErrors); + var related = isRelatedTo(sourceStringType, targetType, false) || isRelatedTo(sourceNumberType, targetType, reportErrors); } else { - var compatible = isRelatedTo(sourceStringType || sourceNumberType, targetType, reportErrors); + var related = isRelatedTo(sourceStringType || sourceNumberType, targetType, reportErrors); } - if (!compatible) { + if (!related) { if (reportErrors) { reportError(ts.Diagnostics.Index_signatures_are_incompatible); } - return false; + return 0 /* False */; } + return related; } - return true; + return -1 /* True */; } - function indexTypesIdenticalTo(indexKind, source, target, reportErrors) { + function indexTypesIdenticalTo(indexKind, source, target) { var targetType = getIndexTypeOfType(target, indexKind); var sourceType = getIndexTypeOfType(source, indexKind); - return (!sourceType && !targetType) || (sourceType && targetType && isRelatedTo(sourceType, targetType, reportErrors)); + if (!sourceType && !targetType) { + return -1 /* True */; + } + if (sourceType && targetType) { + return isRelatedTo(sourceType, targetType); + } + return 0 /* False */; } } + function isPropertyIdenticalTo(sourceProp, targetProp) { + return compareProperties(sourceProp, targetProp, compareTypes) !== 0 /* False */; + } + function compareProperties(sourceProp, targetProp, compareTypes) { + if (sourceProp === targetProp) { + return -1 /* True */; + } + var sourcePropAccessibility = getDeclarationFlagsFromSymbol(sourceProp) & (32 /* Private */ | 64 /* Protected */); + var targetPropAccessibility = getDeclarationFlagsFromSymbol(targetProp) & (32 /* Private */ | 64 /* Protected */); + if (sourcePropAccessibility !== targetPropAccessibility) { + return 0 /* False */; + } + if (sourcePropAccessibility) { + if (getTargetSymbol(sourceProp) !== getTargetSymbol(targetProp)) { + return 0 /* False */; + } + } + else { + if (isOptionalProperty(sourceProp) !== isOptionalProperty(targetProp)) { + return 0 /* False */; + } + } + return compareTypes(getTypeOfSymbol(sourceProp), getTypeOfSymbol(targetProp)); + } function compareSignatures(source, target, compareReturnTypes, compareTypes) { if (source === target) { - return true; + return -1 /* True */; } if (source.parameters.length !== target.parameters.length || source.minArgumentCount !== target.minArgumentCount || source.hasRestParameter !== target.hasRestParameter) { - return false; + return 0 /* False */; } + var result = -1 /* True */; if (source.typeParameters && target.typeParameters) { if (source.typeParameters.length !== target.typeParameters.length) { - return false; + return 0 /* False */; } for (var i = 0, len = source.typeParameters.length; i < len; ++i) { - if (!compareTypes(source.typeParameters[i], target.typeParameters[i])) { - return false; + var related = compareTypes(source.typeParameters[i], target.typeParameters[i]); + if (!related) { + return 0 /* False */; } + result &= related; } } else if (source.typeParameters || source.typeParameters) { - return false; + return 0 /* False */; } source = getErasedSignature(source); target = getErasedSignature(target); for (var i = 0, len = source.parameters.length; i < len; i++) { var s = source.hasRestParameter && i === len - 1 ? getRestTypeOfSignature(source) : getTypeOfSymbol(source.parameters[i]); var t = target.hasRestParameter && i === len - 1 ? getRestTypeOfSignature(target) : getTypeOfSymbol(target.parameters[i]); - if (!compareTypes(s, t)) { - return false; + var related = compareTypes(s, t); + if (!related) { + return 0 /* False */; } + result &= related; } - return !compareReturnTypes || compareTypes(getReturnTypeOfSignature(source), getReturnTypeOfSignature(target)); + if (compareReturnTypes) { + result &= compareTypes(getReturnTypeOfSignature(source), getReturnTypeOfSignature(target)); + } + return result; } function isSupertypeOfEach(candidate, types) { for (var i = 0, len = types.length; i < len; i++) { @@ -12294,7 +12621,7 @@ var ts; checkTypeSubtypeOf(bestSupertypeDownfallType, bestSupertype, errorLocation, ts.Diagnostics.Type_argument_candidate_1_is_not_a_valid_type_argument_because_it_is_not_a_supertype_of_candidate_0, errorMessageChainHead); } function isTypeOfObjectLiteral(type) { - return (type.flags & 32768 /* Anonymous */) && type.symbol && (type.symbol.flags & 2048 /* ObjectLiteral */) ? true : false; + return (type.flags & 32768 /* Anonymous */) && type.symbol && (type.symbol.flags & 4096 /* ObjectLiteral */) ? true : false; } function isArrayType(type) { return type.flags & 4096 /* Reference */ && type.target === globalArrayType; @@ -12342,7 +12669,7 @@ var ts; var members = {}; var index = 0; ts.forEach(properties, function (p) { - var symbol = createSymbol(4 /* Property */ | 134217728 /* Transient */ | p.flags, p.name); + var symbol = createSymbol(4 /* Property */ | 268435456 /* Transient */ | p.flags, p.name); symbol.declarations = p.declarations; symbol.parent = p.parent; symbol.type = widenedTypes[index++]; @@ -12477,7 +12804,7 @@ var ts; inferFromTypes(sourceTypes[i], target); } } - else if (source.flags & ts.TypeFlags.ObjectType && (target.flags & (4096 /* Reference */ | 8192 /* Tuple */) || (target.flags & 32768 /* Anonymous */) && target.symbol && target.symbol.flags & (4096 /* Method */ | 1024 /* TypeLiteral */))) { + else if (source.flags & ts.TypeFlags.ObjectType && (target.flags & (4096 /* Reference */ | 8192 /* Tuple */) || (target.flags & 32768 /* Anonymous */) && target.symbol && target.symbol.flags & (8192 /* Method */ | 2048 /* TypeLiteral */))) { if (!isInProcess(source, target) && isWithinDepthLimit(source, sourceStack) && isWithinDepthLimit(target, targetStack)) { if (depth === 0) { sourceStack = []; @@ -12561,17 +12888,17 @@ var ts; function getResolvedSymbol(node) { var links = getNodeLinks(node); if (!links.resolvedSymbol) { - links.resolvedSymbol = resolveName(node, node.text, ts.SymbolFlags.Value | 2097152 /* ExportValue */, ts.Diagnostics.Cannot_find_name_0, node) || unknownSymbol; + links.resolvedSymbol = resolveName(node, node.text, ts.SymbolFlags.Value | 4194304 /* ExportValue */, ts.Diagnostics.Cannot_find_name_0, node) || unknownSymbol; } return links.resolvedSymbol; } function isInTypeQuery(node) { while (node) { switch (node.kind) { - case 129 /* TypeQuery */: + case 133 /* TypeQuery */: return true; - case 59 /* Identifier */: - case 117 /* QualifiedName */: + case 63 /* Identifier */: + case 121 /* QualifiedName */: node = node.parent; continue; default: @@ -12604,10 +12931,10 @@ var ts; function isAssignedInBinaryExpression(node) { if (node.operator >= ts.SyntaxKind.FirstAssignment && node.operator <= ts.SyntaxKind.LastAssignment) { var n = node.left; - while (n.kind === 143 /* ParenExpression */) { + while (n.kind === 148 /* ParenExpression */) { n = n.expression; } - if (n.kind === 59 /* Identifier */ && getResolvedSymbol(n) === symbol) { + if (n.kind === 63 /* Identifier */ && getResolvedSymbol(n) === symbol) { return true; } } @@ -12621,40 +12948,40 @@ var ts; } function isAssignedIn(node) { switch (node.kind) { - case 148 /* BinaryExpression */: + case 153 /* BinaryExpression */: return isAssignedInBinaryExpression(node); - case 174 /* VariableDeclaration */: + case 181 /* VariableDeclaration */: return isAssignedInVariableDeclaration(node); - case 135 /* ArrayLiteral */: - case 136 /* ObjectLiteral */: - case 138 /* PropertyAccess */: - case 139 /* IndexedAccess */: - case 140 /* CallExpression */: - case 141 /* NewExpression */: - case 142 /* TypeAssertion */: - case 143 /* ParenExpression */: - case 146 /* PrefixOperator */: - case 147 /* PostfixOperator */: - case 149 /* ConditionalExpression */: - case 151 /* Block */: - case 152 /* VariableStatement */: - case 154 /* ExpressionStatement */: - case 155 /* IfStatement */: - case 156 /* DoStatement */: - case 157 /* WhileStatement */: - case 158 /* ForStatement */: - case 159 /* ForInStatement */: - case 162 /* ReturnStatement */: - case 163 /* WithStatement */: - case 164 /* SwitchStatement */: - case 165 /* CaseClause */: - case 166 /* DefaultClause */: - case 167 /* LabeledStatement */: - case 168 /* ThrowStatement */: - case 169 /* TryStatement */: - case 170 /* TryBlock */: - case 171 /* CatchBlock */: - case 172 /* FinallyBlock */: + case 139 /* ArrayLiteral */: + case 140 /* ObjectLiteral */: + case 142 /* PropertyAccess */: + case 143 /* IndexedAccess */: + case 144 /* CallExpression */: + case 145 /* NewExpression */: + case 147 /* TypeAssertion */: + case 148 /* ParenExpression */: + case 151 /* PrefixOperator */: + case 152 /* PostfixOperator */: + case 154 /* ConditionalExpression */: + case 158 /* Block */: + case 159 /* VariableStatement */: + case 161 /* ExpressionStatement */: + case 162 /* IfStatement */: + case 163 /* DoStatement */: + case 164 /* WhileStatement */: + case 165 /* ForStatement */: + case 166 /* ForInStatement */: + case 169 /* ReturnStatement */: + case 170 /* WithStatement */: + case 171 /* SwitchStatement */: + case 172 /* CaseClause */: + case 173 /* DefaultClause */: + case 174 /* LabeledStatement */: + case 175 /* ThrowStatement */: + case 176 /* TryStatement */: + case 177 /* TryBlock */: + case 178 /* CatchBlock */: + case 179 /* FinallyBlock */: return ts.forEachChild(node, isAssignedIn); } return false; @@ -12666,27 +12993,27 @@ var ts; while (true) { var child = node; node = node.parent; - if (!node || node.kind === 176 /* FunctionBlock */ || node.kind === 182 /* ModuleBlock */) { + if (!node || node.kind === 183 /* FunctionBlock */ || node.kind === 189 /* ModuleBlock */) { break; } var narrowedType = type; switch (node.kind) { - case 155 /* IfStatement */: + case 162 /* IfStatement */: if (child !== node.expression) { narrowedType = narrowType(type, node.expression, child === node.thenStatement); } break; - case 149 /* ConditionalExpression */: + case 154 /* ConditionalExpression */: if (child !== node.condition) { narrowedType = narrowType(type, node.condition, child === node.whenTrue); } break; - case 148 /* BinaryExpression */: + case 153 /* BinaryExpression */: if (child === node.right) { - if (node.operator === 43 /* AmpersandAmpersandToken */) { + if (node.operator === 47 /* AmpersandAmpersandToken */) { narrowedType = narrowType(type, node.left, true); } - else if (node.operator === 44 /* BarBarToken */) { + else if (node.operator === 48 /* BarBarToken */) { narrowedType = narrowType(type, node.left, false); } } @@ -12704,12 +13031,12 @@ var ts; function narrowTypeByEquality(type, expr, assumeTrue) { var left = expr.left; var right = expr.right; - if (left.kind !== 146 /* PrefixOperator */ || left.operator !== 91 /* TypeOfKeyword */ || left.operand.kind !== 59 /* Identifier */ || right.kind !== 7 /* StringLiteral */ || getResolvedSymbol(left.operand) !== symbol) { + if (left.kind !== 151 /* PrefixOperator */ || left.operator !== 95 /* TypeOfKeyword */ || left.operand.kind !== 63 /* Identifier */ || right.kind !== 7 /* StringLiteral */ || getResolvedSymbol(left.operand) !== symbol) { return type; } var t = right.text; var checkType = t === "string" ? stringType : t === "number" ? numberType : t === "boolean" ? booleanType : emptyObjectType; - if (expr.operator === 26 /* ExclamationEqualsEqualsToken */) { + if (expr.operator === 30 /* ExclamationEqualsEqualsToken */) { assumeTrue = !assumeTrue; } if (assumeTrue) { @@ -12742,7 +13069,7 @@ var ts; } } function narrowTypeByInstanceof(type, expr, assumeTrue) { - if (!assumeTrue || expr.left.kind !== 59 /* Identifier */ || getResolvedSymbol(expr.left) !== symbol) { + if (!assumeTrue || expr.left.kind !== 63 /* Identifier */ || getResolvedSymbol(expr.left) !== symbol) { return type; } var rightType = checkExpression(expr.right); @@ -12758,25 +13085,25 @@ var ts; } function narrowType(type, expr, assumeTrue) { switch (expr.kind) { - case 143 /* ParenExpression */: + case 148 /* ParenExpression */: return narrowType(type, expr.expression, assumeTrue); - case 148 /* BinaryExpression */: + case 153 /* BinaryExpression */: var operator = expr.operator; - if (operator === 25 /* EqualsEqualsEqualsToken */ || operator === 26 /* ExclamationEqualsEqualsToken */) { + if (operator === 29 /* EqualsEqualsEqualsToken */ || operator === 30 /* ExclamationEqualsEqualsToken */) { return narrowTypeByEquality(type, expr, assumeTrue); } - else if (operator === 43 /* AmpersandAmpersandToken */) { + else if (operator === 47 /* AmpersandAmpersandToken */) { return narrowTypeByAnd(type, expr, assumeTrue); } - else if (operator === 44 /* BarBarToken */) { + else if (operator === 48 /* BarBarToken */) { return narrowTypeByOr(type, expr, assumeTrue); } - else if (operator === 81 /* InstanceOfKeyword */) { + else if (operator === 85 /* InstanceOfKeyword */) { return narrowTypeByInstanceof(type, expr, assumeTrue); } break; - case 146 /* PrefixOperator */: - if (expr.operator === 41 /* ExclamationToken */) { + case 151 /* PrefixOperator */: + if (expr.operator === 45 /* ExclamationToken */) { return narrowType(type, expr.operand, !assumeTrue); } break; @@ -12786,8 +13113,8 @@ var ts; } function checkIdentifier(node) { var symbol = getResolvedSymbol(node); - if (symbol.flags & 16777216 /* Import */) { - getSymbolLinks(symbol).referenced = !isInTypeQuery(node); + if (symbol.flags & 33554432 /* Import */) { + getSymbolLinks(symbol).referenced = !isInTypeQuery(node) && !isConstEnumOrConstEnumOnlyModule(resolveImport(symbol)); } checkCollisionWithCapturedSuperVariable(node, node); checkCollisionWithCapturedThisVariable(node, node); @@ -12795,9 +13122,9 @@ var ts; return getNarrowedTypeOfSymbol(getExportSymbolOfValueSymbolIfExported(symbol), node); } function captureLexicalThis(node, container) { - var classNode = container.parent && container.parent.kind === 177 /* ClassDeclaration */ ? container.parent : undefined; + var classNode = container.parent && container.parent.kind === 184 /* ClassDeclaration */ ? container.parent : undefined; getNodeLinks(node).flags |= 2 /* LexicalThis */; - if (container.kind === 120 /* Property */ || container.kind === 122 /* Constructor */) { + if (container.kind === 124 /* Property */ || container.kind === 126 /* Constructor */) { getNodeLinks(classNode).flags |= 4 /* CaptureThis */; } else { @@ -12807,23 +13134,23 @@ var ts; function checkThisExpression(node) { var container = ts.getThisContainer(node, true); var needToCaptureLexicalThis = false; - if (container.kind === 145 /* ArrowFunction */) { + if (container.kind === 150 /* ArrowFunction */) { container = ts.getThisContainer(container, false); needToCaptureLexicalThis = true; } switch (container.kind) { - case 181 /* ModuleDeclaration */: + case 188 /* ModuleDeclaration */: error(node, ts.Diagnostics.this_cannot_be_referenced_in_a_module_body); break; - case 180 /* EnumDeclaration */: + case 187 /* EnumDeclaration */: error(node, ts.Diagnostics.this_cannot_be_referenced_in_current_location); break; - case 122 /* Constructor */: + case 126 /* Constructor */: if (isInConstructorArgumentInitializer(node, container)) { error(node, ts.Diagnostics.this_cannot_be_referenced_in_constructor_arguments); } break; - case 120 /* Property */: + case 124 /* Property */: if (container.flags & 128 /* Static */) { error(node, ts.Diagnostics.this_cannot_be_referenced_in_a_static_property_initializer); } @@ -12832,7 +13159,7 @@ var ts; if (needToCaptureLexicalThis) { captureLexicalThis(node, container); } - var classNode = container.parent && container.parent.kind === 177 /* ClassDeclaration */ ? container.parent : undefined; + var classNode = container.parent && container.parent.kind === 184 /* ClassDeclaration */ ? container.parent : undefined; if (classNode) { var symbol = getSymbolOfNode(classNode); return container.flags & 128 /* Static */ ? getTypeOfSymbol(symbol) : getDeclaredTypeOfSymbol(symbol); @@ -12845,29 +13172,29 @@ var ts; if (!node) return node; switch (node.kind) { - case 175 /* FunctionDeclaration */: - case 144 /* FunctionExpression */: - case 145 /* ArrowFunction */: - case 120 /* Property */: - case 121 /* Method */: - case 122 /* Constructor */: - case 123 /* GetAccessor */: - case 124 /* SetAccessor */: + case 182 /* FunctionDeclaration */: + case 149 /* FunctionExpression */: + case 150 /* ArrowFunction */: + case 124 /* Property */: + case 125 /* Method */: + case 126 /* Constructor */: + case 127 /* GetAccessor */: + case 128 /* SetAccessor */: return node; } } } function isInConstructorArgumentInitializer(node, constructorDecl) { for (var n = node; n && n !== constructorDecl; n = n.parent) { - if (n.kind === 119 /* Parameter */) { + if (n.kind === 123 /* Parameter */) { return true; } } return false; } function checkSuperExpression(node) { - var isCallExpression = node.parent.kind === 140 /* CallExpression */ && node.parent.func === node; - var enclosingClass = ts.getAncestor(node, 177 /* ClassDeclaration */); + var isCallExpression = node.parent.kind === 144 /* CallExpression */ && node.parent.func === node; + var enclosingClass = ts.getAncestor(node, 184 /* ClassDeclaration */); var baseClass; if (enclosingClass && enclosingClass.baseType) { var classType = getDeclaredTypeOfSymbol(getSymbolOfNode(enclosingClass)); @@ -12881,20 +13208,20 @@ var ts; if (container) { var canUseSuperExpression = false; if (isCallExpression) { - canUseSuperExpression = container.kind === 122 /* Constructor */; + canUseSuperExpression = container.kind === 126 /* Constructor */; } else { var needToCaptureLexicalThis = false; - while (container && container.kind === 145 /* ArrowFunction */) { + while (container && container.kind === 150 /* ArrowFunction */) { container = getSuperContainer(container); needToCaptureLexicalThis = true; } - if (container && container.parent && container.parent.kind === 177 /* ClassDeclaration */) { + if (container && container.parent && container.parent.kind === 184 /* ClassDeclaration */) { if (container.flags & 128 /* Static */) { - canUseSuperExpression = container.kind === 121 /* Method */ || container.kind === 123 /* GetAccessor */ || container.kind === 124 /* SetAccessor */; + canUseSuperExpression = container.kind === 125 /* Method */ || container.kind === 127 /* GetAccessor */ || container.kind === 128 /* SetAccessor */; } else { - canUseSuperExpression = container.kind === 121 /* Method */ || container.kind === 123 /* GetAccessor */ || container.kind === 124 /* SetAccessor */ || container.kind === 120 /* Property */ || container.kind === 122 /* Constructor */; + canUseSuperExpression = container.kind === 125 /* Method */ || container.kind === 127 /* GetAccessor */ || container.kind === 128 /* SetAccessor */ || container.kind === 124 /* Property */ || container.kind === 126 /* Constructor */; } } } @@ -12908,7 +13235,7 @@ var ts; getNodeLinks(node).flags |= 16 /* SuperInstance */; returnType = baseClass; } - if (container.kind === 122 /* Constructor */ && isInConstructorArgumentInitializer(node, container)) { + if (container.kind === 126 /* Constructor */ && isInConstructorArgumentInitializer(node, container)) { error(node, ts.Diagnostics.super_cannot_be_referenced_in_constructor_arguments); returnType = unknownType; } @@ -12928,7 +13255,7 @@ var ts; } function getContextuallyTypedParameterType(parameter) { var func = parameter.parent; - if (func.kind === 144 /* FunctionExpression */ || func.kind === 145 /* ArrowFunction */) { + if (func.kind === 149 /* FunctionExpression */ || func.kind === 150 /* ArrowFunction */) { if (isContextSensitiveExpression(func)) { var contextualSignature = getContextualSignature(func); if (contextualSignature) { @@ -12952,7 +13279,7 @@ var ts; if (declaration.type) { return getTypeFromTypeNode(declaration.type); } - if (declaration.kind === 119 /* Parameter */) { + if (declaration.kind === 123 /* Parameter */) { return getContextuallyTypedParameterType(declaration); } } @@ -12961,7 +13288,7 @@ var ts; function getContextualTypeForReturnExpression(node) { var func = ts.getContainingFunction(node); if (func) { - if (func.type || func.kind === 122 /* Constructor */ || func.kind === 123 /* GetAccessor */ && getSetAccessorTypeAnnotationNode(getDeclarationOfKind(func.symbol, 124 /* SetAccessor */))) { + if (func.type || func.kind === 126 /* Constructor */ || func.kind === 127 /* GetAccessor */ && getSetAccessorTypeAnnotationNode(getDeclarationOfKind(func.symbol, 128 /* SetAccessor */))) { return getReturnTypeOfSignature(getSignatureFromDeclaration(func)); } var signature = getContextualSignature(func); @@ -12988,7 +13315,7 @@ var ts; return checkExpression(binaryExpression.left); } } - else if (operator === 44 /* BarBarToken */) { + else if (operator === 48 /* BarBarToken */) { var type = getContextualType(binaryExpression); if (!type && node === binaryExpression.right) { type = checkExpression(binaryExpression.left); @@ -13067,25 +13394,25 @@ var ts; } var parent = node.parent; switch (parent.kind) { - case 174 /* VariableDeclaration */: - case 119 /* Parameter */: - case 120 /* Property */: + case 181 /* VariableDeclaration */: + case 123 /* Parameter */: + case 124 /* Property */: return getContextualTypeForInitializerExpression(node); - case 145 /* ArrowFunction */: - case 162 /* ReturnStatement */: + case 150 /* ArrowFunction */: + case 169 /* ReturnStatement */: return getContextualTypeForReturnExpression(node); - case 140 /* CallExpression */: - case 141 /* NewExpression */: + case 144 /* CallExpression */: + case 145 /* NewExpression */: return getContextualTypeForArgument(node); - case 142 /* TypeAssertion */: + case 147 /* TypeAssertion */: return getTypeFromTypeNode(parent.type); - case 148 /* BinaryExpression */: + case 153 /* BinaryExpression */: return getContextualTypeForBinaryOperand(node); - case 137 /* PropertyAssignment */: + case 141 /* PropertyAssignment */: return getContextualTypeForPropertyExpression(node); - case 135 /* ArrayLiteral */: + case 139 /* ArrayLiteral */: return getContextualTypeForElementExpression(node); - case 149 /* ConditionalExpression */: + case 154 /* ConditionalExpression */: return getContextualTypeForConditionalOperand(node); } return undefined; @@ -13115,7 +13442,7 @@ var ts; if (!result) { result = signature; } - else if (!compareSignatures(result, signature, true, isTypeIdenticalTo)) { + else if (!compareSignatures(result, signature, true, compareTypes)) { return undefined; } } @@ -13149,7 +13476,7 @@ var ts; var member = members[id]; if (member.flags & 4 /* Property */) { var type = checkExpression(member.declarations[0].initializer, contextualMapper); - var prop = createSymbol(4 /* Property */ | 134217728 /* Transient */ | member.flags, member.name); + var prop = createSymbol(4 /* Property */ | 268435456 /* Transient */ | member.flags, member.name); prop.declarations = member.declarations; prop.parent = member.parent; if (member.valueDeclaration) @@ -13159,11 +13486,11 @@ var ts; member = prop; } else { - var getAccessor = getDeclarationOfKind(member, 123 /* GetAccessor */); + var getAccessor = getDeclarationOfKind(member, 127 /* GetAccessor */); if (getAccessor) { checkAccessorDeclaration(getAccessor); } - var setAccessor = getDeclarationOfKind(member, 124 /* SetAccessor */); + var setAccessor = getDeclarationOfKind(member, 128 /* SetAccessor */); if (setAccessor) { checkAccessorDeclaration(setAccessor); } @@ -13193,17 +13520,17 @@ var ts; } } function getDeclarationKindFromSymbol(s) { - return s.valueDeclaration ? s.valueDeclaration.kind : 120 /* Property */; + return s.valueDeclaration ? s.valueDeclaration.kind : 124 /* Property */; } function getDeclarationFlagsFromSymbol(s) { - return s.valueDeclaration ? s.valueDeclaration.flags : s.flags & 268435456 /* Prototype */ ? 16 /* Public */ | 128 /* Static */ : 0; + return s.valueDeclaration ? s.valueDeclaration.flags : s.flags & 536870912 /* Prototype */ ? 16 /* Public */ | 128 /* Static */ : 0; } function checkClassPropertyAccess(node, type, prop) { var flags = getDeclarationFlagsFromSymbol(prop); if (!(flags & (32 /* Private */ | 64 /* Protected */))) { return; } - var enclosingClassDeclaration = ts.getAncestor(node, 177 /* ClassDeclaration */); + var enclosingClassDeclaration = ts.getAncestor(node, 184 /* ClassDeclaration */); var enclosingClass = enclosingClassDeclaration ? getDeclaredTypeOfSymbol(getSymbolOfNode(enclosingClassDeclaration)) : undefined; var declaringClass = getDeclaredTypeOfSymbol(prop.parent); if (flags & 32 /* Private */) { @@ -13212,7 +13539,7 @@ var ts; } return; } - if (node.left.kind === 85 /* SuperKeyword */) { + if (node.left.kind === 89 /* SuperKeyword */) { return; } if (!enclosingClass || !hasBaseType(enclosingClass, declaringClass)) { @@ -13244,7 +13571,7 @@ var ts; } getNodeLinks(node).resolvedSymbol = prop; if (prop.parent && prop.parent.flags & 32 /* Class */) { - if (node.left.kind === 85 /* SuperKeyword */ && getDeclarationKindFromSymbol(prop) !== 121 /* Method */) { + if (node.left.kind === 89 /* SuperKeyword */ && getDeclarationKindFromSymbol(prop) !== 125 /* Method */) { error(node.right, ts.Diagnostics.Only_public_and_protected_methods_of_the_base_class_are_accessible_via_the_super_keyword); } else { @@ -13260,7 +13587,7 @@ var ts; if (type !== unknownType && type !== anyType) { var prop = getPropertyOfType(getWidenedType(type), propertyName); if (prop && prop.parent && prop.parent.flags & 32 /* Class */) { - if (node.left.kind === 85 /* SuperKeyword */ && getDeclarationKindFromSymbol(prop) !== 121 /* Method */) { + if (node.left.kind === 89 /* SuperKeyword */ && getDeclarationKindFromSymbol(prop) !== 125 /* Method */) { return false; } else { @@ -13277,10 +13604,14 @@ var ts; var indexType = checkExpression(node.index); if (objectType === unknownType) return unknownType; + if (isConstEnumObjectType(objectType) && node.index.kind !== 7 /* StringLiteral */) { + error(node.index, ts.Diagnostics.Index_expression_arguments_in_const_enums_must_be_of_type_string); + } if (node.index.kind === 7 /* StringLiteral */ || node.index.kind === 6 /* NumericLiteral */) { var name = node.index.text; var prop = getPropertyOfType(objectType, name); if (prop) { + getNodeLinks(node).resolvedSymbol = prop; return getTypeOfSymbol(prop); } } @@ -13349,7 +13680,7 @@ var ts; var context = createInferenceContext(typeParameters, false); var mapper = createInferenceMapper(context); for (var i = 0; i < args.length; i++) { - if (args[i].kind === 150 /* OmittedExpression */) { + if (args[i].kind === 157 /* OmittedExpression */) { continue; } if (!excludeArgument || excludeArgument[i] === undefined) { @@ -13359,7 +13690,7 @@ var ts; } if (excludeArgument) { for (var i = 0; i < args.length; i++) { - if (args[i].kind === 150 /* OmittedExpression */) { + if (args[i].kind === 157 /* OmittedExpression */) { continue; } if (excludeArgument[i] === false) { @@ -13397,7 +13728,7 @@ var ts; if (node.arguments) { for (var i = 0; i < node.arguments.length; i++) { var arg = node.arguments[i]; - if (arg.kind === 150 /* OmittedExpression */) { + if (arg.kind === 157 /* OmittedExpression */) { continue; } var paramType = getTypeAtPosition(signature, i); @@ -13532,33 +13863,31 @@ var ts; ts.Debug.assert(!result.length); for (var i = 0; i < signatures.length; i++) { var signature = signatures[i]; - if (true) { - var symbol = signature.declaration && getSymbolOfNode(signature.declaration); - var parent = signature.declaration && signature.declaration.parent; - if (!lastSymbol || symbol === lastSymbol) { - if (lastParent && parent === lastParent) { - pos++; - } - else { - lastParent = parent; - pos = cutoffPos; - } + var symbol = signature.declaration && getSymbolOfNode(signature.declaration); + var parent = signature.declaration && signature.declaration.parent; + if (!lastSymbol || symbol === lastSymbol) { + if (lastParent && parent === lastParent) { + pos++; } else { - pos = cutoffPos = result.length; lastParent = parent; + pos = cutoffPos; } - lastSymbol = symbol; - for (var j = result.length; j > pos; j--) { - result[j] = result[j - 1]; - } - result[pos] = signature; } + else { + pos = cutoffPos = result.length; + lastParent = parent; + } + lastSymbol = symbol; + for (var j = result.length; j > pos; j--) { + result[j] = result[j - 1]; + } + result[pos] = signature; } } } function resolveCallExpression(node, candidatesOutArray) { - if (node.func.kind === 85 /* SuperKeyword */) { + if (node.func.kind === 89 /* SuperKeyword */) { var superType = checkSuperExpression(node.func); if (superType !== unknownType) { return resolveCall(node, getSignaturesOfType(superType, 1 /* Construct */), candidatesOutArray); @@ -13620,18 +13949,18 @@ var ts; var links = getNodeLinks(node); if (!links.resolvedSignature || candidatesOutArray) { links.resolvedSignature = anySignature; - links.resolvedSignature = node.kind === 140 /* CallExpression */ ? resolveCallExpression(node, candidatesOutArray) : resolveNewExpression(node, candidatesOutArray); + links.resolvedSignature = node.kind === 144 /* CallExpression */ ? resolveCallExpression(node, candidatesOutArray) : resolveNewExpression(node, candidatesOutArray); } return links.resolvedSignature; } function checkCallExpression(node) { var signature = getResolvedSignature(node); - if (node.func.kind === 85 /* SuperKeyword */) { + if (node.func.kind === 89 /* SuperKeyword */) { return voidType; } - if (node.kind === 141 /* NewExpression */) { + if (node.kind === 145 /* NewExpression */) { var declaration = signature.declaration; - if (declaration && (declaration.kind !== 122 /* Constructor */ && declaration.kind !== 126 /* ConstructSignature */)) { + if (declaration && (declaration.kind !== 126 /* Constructor */ && declaration.kind !== 130 /* ConstructSignature */)) { if (compilerOptions.noImplicitAny) { error(node, ts.Diagnostics.new_expression_whose_target_lacks_a_construct_signature_implicitly_has_an_any_type); } @@ -13640,6 +13969,11 @@ var ts; } return getReturnTypeOfSignature(signature); } + function checkTaggedTemplateExpression(node) { + checkExpression(node.tag); + checkExpression(node.template); + return anyType; + } function checkTypeAssertion(node) { var exprType = checkExpression(node.operand); var targetType = getTypeFromTypeNode(node.type); @@ -13669,7 +14003,7 @@ var ts; } function getReturnTypeFromBody(func, contextualMapper) { var contextualSignature = getContextualSignature(func); - if (func.body.kind !== 176 /* FunctionBlock */) { + if (func.body.kind !== 183 /* FunctionBlock */) { var unwidenedType = checkAndMarkExpression(func.body, contextualMapper); var widenedType = getWidenedType(unwidenedType); if (fullTypeCheck && compilerOptions.noImplicitAny && !contextualSignature && widenedType !== unwidenedType && getInnermostTypeOfNestedArrayTypes(widenedType) === anyType) { @@ -13717,7 +14051,7 @@ var ts; }); } function bodyContainsSingleThrowStatement(body) { - return (body.statements.length === 1) && (body.statements[0].kind === 168 /* ThrowStatement */); + return (body.statements.length === 1) && (body.statements[0].kind === 175 /* ThrowStatement */); } function checkIfNonVoidFunctionHasReturnExpressionsOrSingleThrowStatment(func, returnType) { if (!fullTypeCheck) { @@ -13726,7 +14060,7 @@ var ts; if (returnType === voidType || returnType === anyType) { return; } - if (!func.body || func.body.kind !== 176 /* FunctionBlock */) { + if (!func.body || func.body.kind !== 183 /* FunctionBlock */) { return; } var bodyBlock = func.body; @@ -13770,7 +14104,7 @@ var ts; if (node.type) { checkIfNonVoidFunctionHasReturnExpressionsOrSingleThrowStatment(node, getTypeFromTypeNode(node.type)); } - if (node.body.kind === 176 /* FunctionBlock */) { + if (node.body.kind === 183 /* FunctionBlock */) { checkSourceElement(node.body); } else { @@ -13795,15 +14129,15 @@ var ts; } function isReferenceOrErrorExpression(n) { switch (n.kind) { - case 59 /* Identifier */: + case 63 /* Identifier */: var symbol = findSymbol(n); return !symbol || symbol === unknownSymbol || symbol === argumentsSymbol || (symbol.flags & ts.SymbolFlags.Variable) !== 0; - case 138 /* PropertyAccess */: + case 142 /* PropertyAccess */: var symbol = findSymbol(n); return !symbol || symbol === unknownSymbol || (symbol.flags & ~8 /* EnumMember */) !== 0; - case 139 /* IndexedAccess */: + case 143 /* IndexedAccess */: return true; - case 143 /* ParenExpression */: + case 148 /* ParenExpression */: return isReferenceOrErrorExpression(n.expression); default: return false; @@ -13811,11 +14145,11 @@ var ts; } function isConstVariableReference(n) { switch (n.kind) { - case 59 /* Identifier */: - case 138 /* PropertyAccess */: + case 63 /* Identifier */: + case 142 /* PropertyAccess */: var symbol = findSymbol(n); return symbol && (symbol.flags & ts.SymbolFlags.Variable) !== 0 && (getDeclarationFlagsFromSymbol(symbol) & 4096 /* Const */) !== 0; - case 139 /* IndexedAccess */: + case 143 /* IndexedAccess */: var index = n.index; var symbol = findSymbol(n.object); if (symbol && index.kind === 7 /* StringLiteral */) { @@ -13824,7 +14158,7 @@ var ts; return prop && (prop.flags & ts.SymbolFlags.Variable) !== 0 && (getDeclarationFlagsFromSymbol(prop) & 4096 /* Const */) !== 0; } return false; - case 143 /* ParenExpression */: + case 148 /* ParenExpression */: return isConstVariableReference(n.expression); default: return false; @@ -13843,19 +14177,19 @@ var ts; function checkPrefixExpression(node) { var operandType = checkExpression(node.operand); switch (node.operator) { - case 28 /* PlusToken */: - case 29 /* MinusToken */: - case 42 /* TildeToken */: + case 32 /* PlusToken */: + case 33 /* MinusToken */: + case 46 /* TildeToken */: return numberType; - case 41 /* ExclamationToken */: - case 68 /* DeleteKeyword */: + case 45 /* ExclamationToken */: + case 72 /* DeleteKeyword */: return booleanType; - case 91 /* TypeOfKeyword */: + case 95 /* TypeOfKeyword */: return stringType; - case 93 /* VoidKeyword */: + case 97 /* VoidKeyword */: return undefinedType; - case 33 /* PlusPlusToken */: - case 34 /* MinusMinusToken */: + case 37 /* PlusPlusToken */: + case 38 /* MinusMinusToken */: var ok = checkArithmeticOperandType(node.operand, operandType, ts.Diagnostics.An_arithmetic_operand_must_be_of_type_any_number_or_an_enum_type); if (ok) { checkReferenceExpression(node.operand, ts.Diagnostics.The_operand_of_an_increment_or_decrement_operator_must_be_a_variable_property_or_indexer, ts.Diagnostics.The_operand_of_an_increment_or_decrement_operator_cannot_be_a_constant); @@ -13878,6 +14212,12 @@ var ts; } return (type.flags & ts.TypeFlags.Structured) !== 0; } + function isConstEnumObjectType(type) { + return type.flags & (ts.TypeFlags.ObjectType | 32768 /* Anonymous */) && type.symbol && isConstEnumSymbol(type.symbol); + } + function isConstEnumSymbol(symbol) { + return (symbol.flags & 128 /* ConstEnum */) !== 0; + } function checkInstanceOfExpression(node, leftType, rightType) { if (leftType !== unknownType && !isStructuredType(leftType)) { error(node.left, ts.Diagnostics.The_left_hand_side_of_an_instanceof_expression_must_be_of_type_any_an_object_type_or_a_type_parameter); @@ -13901,26 +14241,26 @@ var ts; var leftType = checkExpression(node.left, contextualMapper); var rightType = checkExpression(node.right, contextualMapper); switch (operator) { - case 30 /* AsteriskToken */: - case 50 /* AsteriskEqualsToken */: - case 31 /* SlashToken */: - case 51 /* SlashEqualsToken */: - case 32 /* PercentToken */: - case 52 /* PercentEqualsToken */: - case 29 /* MinusToken */: - case 49 /* MinusEqualsToken */: - case 35 /* LessThanLessThanToken */: - case 53 /* LessThanLessThanEqualsToken */: - case 36 /* GreaterThanGreaterThanToken */: - case 54 /* GreaterThanGreaterThanEqualsToken */: - case 37 /* GreaterThanGreaterThanGreaterThanToken */: - case 55 /* GreaterThanGreaterThanGreaterThanEqualsToken */: - case 39 /* BarToken */: - case 57 /* BarEqualsToken */: - case 40 /* CaretToken */: - case 58 /* CaretEqualsToken */: - case 38 /* AmpersandToken */: - case 56 /* AmpersandEqualsToken */: + case 34 /* AsteriskToken */: + case 54 /* AsteriskEqualsToken */: + case 35 /* SlashToken */: + case 55 /* SlashEqualsToken */: + case 36 /* PercentToken */: + case 56 /* PercentEqualsToken */: + case 33 /* MinusToken */: + case 53 /* MinusEqualsToken */: + case 39 /* LessThanLessThanToken */: + case 57 /* LessThanLessThanEqualsToken */: + case 40 /* GreaterThanGreaterThanToken */: + case 58 /* GreaterThanGreaterThanEqualsToken */: + case 41 /* GreaterThanGreaterThanGreaterThanToken */: + case 59 /* GreaterThanGreaterThanGreaterThanEqualsToken */: + case 43 /* BarToken */: + case 61 /* BarEqualsToken */: + case 44 /* CaretToken */: + case 62 /* CaretEqualsToken */: + case 42 /* AmpersandToken */: + case 60 /* AmpersandEqualsToken */: if (leftType.flags & (32 /* Undefined */ | 64 /* Null */)) leftType = rightType; if (rightType.flags & (32 /* Undefined */ | 64 /* Null */)) @@ -13937,8 +14277,8 @@ var ts; } } return numberType; - case 28 /* PlusToken */: - case 48 /* PlusEqualsToken */: + case 32 /* PlusToken */: + case 52 /* PlusEqualsToken */: if (leftType.flags & (32 /* Undefined */ | 64 /* Null */)) leftType = rightType; if (rightType.flags & (32 /* Undefined */ | 64 /* Null */)) @@ -13957,47 +14297,47 @@ var ts; reportOperatorError(); return anyType; } - if (operator === 48 /* PlusEqualsToken */) { + if (operator === 52 /* PlusEqualsToken */) { checkAssignmentOperator(resultType); } return resultType; - case 23 /* EqualsEqualsToken */: - case 24 /* ExclamationEqualsToken */: - case 25 /* EqualsEqualsEqualsToken */: - case 26 /* ExclamationEqualsEqualsToken */: - case 19 /* LessThanToken */: - case 20 /* GreaterThanToken */: - case 21 /* LessThanEqualsToken */: - case 22 /* GreaterThanEqualsToken */: + case 27 /* EqualsEqualsToken */: + case 28 /* ExclamationEqualsToken */: + case 29 /* EqualsEqualsEqualsToken */: + case 30 /* ExclamationEqualsEqualsToken */: + case 23 /* LessThanToken */: + case 24 /* GreaterThanToken */: + case 25 /* LessThanEqualsToken */: + case 26 /* GreaterThanEqualsToken */: if (!isTypeAssignableTo(leftType, rightType) && !isTypeAssignableTo(rightType, leftType)) { reportOperatorError(); } return booleanType; - case 81 /* InstanceOfKeyword */: + case 85 /* InstanceOfKeyword */: return checkInstanceOfExpression(node, leftType, rightType); - case 80 /* InKeyword */: + case 84 /* InKeyword */: return checkInExpression(node, leftType, rightType); - case 43 /* AmpersandAmpersandToken */: + case 47 /* AmpersandAmpersandToken */: return rightType; - case 44 /* BarBarToken */: + case 48 /* BarBarToken */: return getUnionType([leftType, rightType]); - case 47 /* EqualsToken */: + case 51 /* EqualsToken */: checkAssignmentOperator(rightType); return rightType; - case 18 /* CommaToken */: + case 22 /* CommaToken */: return rightType; } function getSuggestedBooleanOperator(operator) { switch (operator) { - case 39 /* BarToken */: - case 57 /* BarEqualsToken */: - return 44 /* BarBarToken */; - case 40 /* CaretToken */: - case 58 /* CaretEqualsToken */: - return 26 /* ExclamationEqualsEqualsToken */; - case 38 /* AmpersandToken */: - case 56 /* AmpersandEqualsToken */: - return 43 /* AmpersandAmpersandToken */; + case 43 /* BarToken */: + case 61 /* BarEqualsToken */: + return 48 /* BarBarToken */; + case 44 /* CaretToken */: + case 62 /* CaretEqualsToken */: + return 30 /* ExclamationEqualsEqualsToken */; + case 42 /* AmpersandToken */: + case 60 /* AmpersandEqualsToken */: + return 47 /* AmpersandAmpersandToken */; default: return undefined; } @@ -14020,6 +14360,12 @@ var ts; var type2 = checkExpression(node.whenFalse, contextualMapper); return getUnionType([type1, type2]); } + function checkTemplateExpression(node) { + ts.forEach(node.templateSpans, function (templateSpan) { + checkExpression(templateSpan.expression); + }); + return stringType; + } function checkExpressionWithContextualType(node, contextualType, contextualMapper) { var saveContextualType = node.contextualType; node.contextualType = contextualType; @@ -14046,56 +14392,67 @@ var ts; } } } + if (isConstEnumObjectType(type)) { + var ok = (node.parent.kind === 142 /* PropertyAccess */ && node.parent.left === node) || (node.parent.kind === 143 /* IndexedAccess */ && node.parent.object === node) || ((node.kind === 63 /* Identifier */ || node.kind === 121 /* QualifiedName */) && isInRightSideOfImportOrExportAssignment(node)); + if (!ok) { + error(node, ts.Diagnostics.const_enums_can_only_be_used_in_property_or_index_access_expressions_or_the_right_hand_side_of_an_import_declaration_or_export_assignment); + } + } return type; } function checkExpressionNode(node, contextualMapper) { switch (node.kind) { - case 59 /* Identifier */: + case 63 /* Identifier */: return checkIdentifier(node); - case 87 /* ThisKeyword */: + case 91 /* ThisKeyword */: return checkThisExpression(node); - case 85 /* SuperKeyword */: + case 89 /* SuperKeyword */: return checkSuperExpression(node); - case 83 /* NullKeyword */: + case 87 /* NullKeyword */: return nullType; - case 89 /* TrueKeyword */: - case 74 /* FalseKeyword */: + case 93 /* TrueKeyword */: + case 78 /* FalseKeyword */: return booleanType; case 6 /* NumericLiteral */: return numberType; + case 155 /* TemplateExpression */: + return checkTemplateExpression(node); case 7 /* StringLiteral */: + case 9 /* NoSubstitutionTemplateLiteral */: return stringType; case 8 /* RegularExpressionLiteral */: return globalRegExpType; - case 117 /* QualifiedName */: + case 121 /* QualifiedName */: return checkPropertyAccess(node); - case 135 /* ArrayLiteral */: + case 139 /* ArrayLiteral */: return checkArrayLiteral(node, contextualMapper); - case 136 /* ObjectLiteral */: + case 140 /* ObjectLiteral */: return checkObjectLiteral(node, contextualMapper); - case 138 /* PropertyAccess */: + case 142 /* PropertyAccess */: return checkPropertyAccess(node); - case 139 /* IndexedAccess */: + case 143 /* IndexedAccess */: return checkIndexedAccess(node); - case 140 /* CallExpression */: - case 141 /* NewExpression */: + case 144 /* CallExpression */: + case 145 /* NewExpression */: return checkCallExpression(node); - case 142 /* TypeAssertion */: + case 146 /* TaggedTemplateExpression */: + return checkTaggedTemplateExpression(node); + case 147 /* TypeAssertion */: return checkTypeAssertion(node); - case 143 /* ParenExpression */: + case 148 /* ParenExpression */: return checkExpression(node.expression); - case 144 /* FunctionExpression */: - case 145 /* ArrowFunction */: + case 149 /* FunctionExpression */: + case 150 /* ArrowFunction */: return checkFunctionExpression(node, contextualMapper); - case 146 /* PrefixOperator */: + case 151 /* PrefixOperator */: return checkPrefixExpression(node); - case 147 /* PostfixOperator */: + case 152 /* PostfixOperator */: return checkPostfixExpression(node); - case 148 /* BinaryExpression */: + case 153 /* BinaryExpression */: return checkBinaryExpression(node, contextualMapper); - case 149 /* ConditionalExpression */: + case 154 /* ConditionalExpression */: return checkConditionalExpression(node, contextualMapper); - case 150 /* OmittedExpression */: + case 157 /* OmittedExpression */: return undefinedType; } return unknownType; @@ -14111,7 +14468,7 @@ var ts; checkVariableDeclaration(parameterDeclaration); if (fullTypeCheck) { checkCollisionWithIndexVariableInGeneratedCode(parameterDeclaration, parameterDeclaration.name); - if (parameterDeclaration.flags & (16 /* Public */ | 32 /* Private */ | 64 /* Protected */) && !(parameterDeclaration.parent.kind === 122 /* Constructor */ && parameterDeclaration.parent.body)) { + if (parameterDeclaration.flags & (16 /* Public */ | 32 /* Private */ | 64 /* Protected */) && !(parameterDeclaration.parent.kind === 126 /* Constructor */ && parameterDeclaration.parent.body)) { error(parameterDeclaration, ts.Diagnostics.A_parameter_property_is_only_allowed_in_a_constructor_implementation); } if (parameterDeclaration.flags & 8 /* Rest */) { @@ -14126,10 +14483,10 @@ var ts; } } function checkReferencesInInitializer(n) { - if (n.kind === 59 /* Identifier */) { + if (n.kind === 63 /* Identifier */) { var referencedSymbol = getNodeLinks(n).resolvedSymbol; if (referencedSymbol && referencedSymbol !== unknownSymbol && getSymbol(parameterDeclaration.parent.locals, referencedSymbol.name, ts.SymbolFlags.Value) === referencedSymbol) { - if (referencedSymbol.valueDeclaration.kind === 119 /* Parameter */) { + if (referencedSymbol.valueDeclaration.kind === 123 /* Parameter */) { if (referencedSymbol.valueDeclaration === parameterDeclaration) { error(n, ts.Diagnostics.Parameter_0_cannot_be_referenced_in_its_initializer, ts.identifierToString(parameterDeclaration.name)); return; @@ -14163,10 +14520,10 @@ var ts; checkCollisionWithArgumentsInGeneratedCode(node); if (compilerOptions.noImplicitAny && !node.type) { switch (node.kind) { - case 126 /* ConstructSignature */: + case 130 /* ConstructSignature */: error(node, ts.Diagnostics.Construct_signature_which_lacks_return_type_annotation_implicitly_has_an_any_return_type); break; - case 125 /* CallSignature */: + case 129 /* CallSignature */: error(node, ts.Diagnostics.Call_signature_which_lacks_return_type_annotation_implicitly_has_an_any_return_type); break; } @@ -14175,7 +14532,7 @@ var ts; checkSpecializedSignatureDeclaration(node); } function checkTypeForDuplicateIndexSignatures(node) { - if (node.kind === 178 /* InterfaceDeclaration */) { + if (node.kind === 185 /* InterfaceDeclaration */) { var nodeSymbol = getSymbolOfNode(node); if (nodeSymbol.declarations.length > 0 && nodeSymbol.declarations[0] !== node) { return; @@ -14189,7 +14546,7 @@ var ts; var declaration = indexSymbol.declarations[i]; if (declaration.parameters.length == 1 && declaration.parameters[0].type) { switch (declaration.parameters[0].type.kind) { - case 114 /* StringKeyword */: + case 118 /* StringKeyword */: if (!seenStringIndexer) { seenStringIndexer = true; } @@ -14197,7 +14554,7 @@ var ts; error(declaration, ts.Diagnostics.Duplicate_string_index_signature); } break; - case 112 /* NumberKeyword */: + case 116 /* NumberKeyword */: if (!seenNumericIndexer) { seenNumericIndexer = true; } @@ -14231,39 +14588,37 @@ var ts; return; } function isSuperCallExpression(n) { - return n.kind === 140 /* CallExpression */ && n.func.kind === 85 /* SuperKeyword */; + return n.kind === 144 /* CallExpression */ && n.func.kind === 89 /* SuperKeyword */; } function containsSuperCall(n) { if (isSuperCallExpression(n)) { return true; } switch (n.kind) { - case 144 /* FunctionExpression */: - case 175 /* FunctionDeclaration */: - case 145 /* ArrowFunction */: - case 136 /* ObjectLiteral */: - return false; - default: - return ts.forEachChild(n, containsSuperCall); + case 149 /* FunctionExpression */: + case 182 /* FunctionDeclaration */: + case 150 /* ArrowFunction */: + case 140 /* ObjectLiteral */: return false; + default: return ts.forEachChild(n, containsSuperCall); } } function markThisReferencesAsErrors(n) { - if (n.kind === 87 /* ThisKeyword */) { + if (n.kind === 91 /* ThisKeyword */) { error(n, ts.Diagnostics.this_cannot_be_referenced_in_current_location); } - else if (n.kind !== 144 /* FunctionExpression */ && n.kind !== 175 /* FunctionDeclaration */) { + else if (n.kind !== 149 /* FunctionExpression */ && n.kind !== 182 /* FunctionDeclaration */) { ts.forEachChild(n, markThisReferencesAsErrors); } } function isInstancePropertyWithInitializer(n) { - return n.kind === 120 /* Property */ && !(n.flags & 128 /* Static */) && !!n.initializer; + return n.kind === 124 /* Property */ && !(n.flags & 128 /* Static */) && !!n.initializer; } if (node.parent.baseType) { if (containsSuperCall(node.body)) { var superCallShouldBeFirst = ts.forEach(node.parent.members, isInstancePropertyWithInitializer) || ts.forEach(node.parameters, function (p) { return p.flags & (16 /* Public */ | 32 /* Private */ | 64 /* Protected */); }); if (superCallShouldBeFirst) { var statements = node.body.statements; - if (!statements.length || statements[0].kind !== 154 /* ExpressionStatement */ || !isSuperCallExpression(statements[0].expression)) { + if (!statements.length || statements[0].kind !== 161 /* ExpressionStatement */ || !isSuperCallExpression(statements[0].expression)) { error(node, ts.Diagnostics.A_super_call_must_be_the_first_statement_in_the_constructor_when_a_class_contains_initialized_properties_or_has_parameter_properties); } else { @@ -14278,12 +14633,12 @@ var ts; } function checkAccessorDeclaration(node) { if (fullTypeCheck) { - if (node.kind === 123 /* GetAccessor */) { + if (node.kind === 127 /* GetAccessor */) { if (!ts.isInAmbientContext(node) && node.body && !(bodyContainsAReturnStatement(node.body) || bodyContainsSingleThrowStatement(node.body))) { error(node.name, ts.Diagnostics.A_get_accessor_must_return_a_value_or_consist_of_a_single_throw_statement); } } - var otherKind = node.kind === 123 /* GetAccessor */ ? 124 /* SetAccessor */ : 123 /* GetAccessor */; + var otherKind = node.kind === 127 /* GetAccessor */ ? 128 /* SetAccessor */ : 127 /* GetAccessor */; var otherAccessor = getDeclarationOfKind(node.symbol, otherKind); if (otherAccessor) { if (((node.flags & ts.NodeFlags.AccessibilityModifier) !== (otherAccessor.flags & ts.NodeFlags.AccessibilityModifier))) { @@ -14352,9 +14707,9 @@ var ts; } var symbol = getSymbolOfNode(signatureDeclarationNode); var signaturesToCheck; - if (!signatureDeclarationNode.name && signatureDeclarationNode.parent && signatureDeclarationNode.parent.kind === 178 /* InterfaceDeclaration */) { - ts.Debug.assert(signatureDeclarationNode.kind === 125 /* CallSignature */ || signatureDeclarationNode.kind === 126 /* ConstructSignature */); - var signatureKind = signatureDeclarationNode.kind === 125 /* CallSignature */ ? 0 /* Call */ : 1 /* Construct */; + if (!signatureDeclarationNode.name && signatureDeclarationNode.parent && signatureDeclarationNode.parent.kind === 185 /* InterfaceDeclaration */) { + ts.Debug.assert(signatureDeclarationNode.kind === 129 /* CallSignature */ || signatureDeclarationNode.kind === 130 /* ConstructSignature */); + var signatureKind = signatureDeclarationNode.kind === 129 /* CallSignature */ ? 0 /* Call */ : 1 /* Construct */; var containingSymbol = getSymbolOfNode(signatureDeclarationNode.parent); var containingType = getDeclaredTypeOfSymbol(containingSymbol); signaturesToCheck = getSignaturesOfType(containingType, signatureKind); @@ -14372,7 +14727,7 @@ var ts; } function getEffectiveDeclarationFlags(n, flagsToCheck) { var flags = n.flags; - if (n.parent.kind !== 178 /* InterfaceDeclaration */ && ts.isInAmbientContext(n)) { + if (n.parent.kind !== 185 /* InterfaceDeclaration */ && ts.isInAmbientContext(n)) { if (!(flags & 2 /* Ambient */)) { flags |= 1 /* Export */; } @@ -14414,9 +14769,9 @@ var ts; var lastSeenNonAmbientDeclaration; var previousDeclaration; var declarations = symbol.declarations; - var isConstructor = (symbol.flags & 8192 /* Constructor */) !== 0; + var isConstructor = (symbol.flags & 16384 /* Constructor */) !== 0; function reportImplementationExpectedError(node) { - if (node.name && node.name.kind === 116 /* Missing */) { + if (node.name && node.name.kind === 120 /* Missing */) { return; } var seen = false; @@ -14432,7 +14787,7 @@ var ts; if (subsequentNode.kind === node.kind) { var errorNode = subsequentNode.name || subsequentNode; if (node.name && subsequentNode.name && node.name.text === subsequentNode.name.text) { - ts.Debug.assert(node.kind === 121 /* Method */); + ts.Debug.assert(node.kind === 125 /* Method */); ts.Debug.assert((node.flags & 128 /* Static */) !== (subsequentNode.flags & 128 /* Static */)); var diagnostic = node.flags & 128 /* Static */ ? ts.Diagnostics.Function_overload_must_be_static : ts.Diagnostics.Function_overload_must_not_be_static; error(errorNode, diagnostic); @@ -14458,11 +14813,11 @@ var ts; for (var i = 0; i < declarations.length; i++) { var node = declarations[i]; var inAmbientContext = ts.isInAmbientContext(node); - var inAmbientContextOrInterface = node.parent.kind === 178 /* InterfaceDeclaration */ || node.parent.kind === 130 /* TypeLiteral */ || inAmbientContext; + var inAmbientContextOrInterface = node.parent.kind === 185 /* InterfaceDeclaration */ || node.parent.kind === 134 /* TypeLiteral */ || inAmbientContext; if (inAmbientContextOrInterface) { previousDeclaration = undefined; } - if (node.kind === 175 /* FunctionDeclaration */ || node.kind === 121 /* Method */ || node.kind === 122 /* Constructor */) { + if (node.kind === 182 /* FunctionDeclaration */ || node.kind === 125 /* Method */ || node.kind === 126 /* Constructor */) { var currentNodeFlags = getEffectiveDeclarationFlags(node, flagsToCheck); someNodeFlags |= currentNodeFlags; allNodeFlags &= currentNodeFlags; @@ -14556,14 +14911,14 @@ var ts; } function getDeclarationSpaces(d) { switch (d.kind) { - case 178 /* InterfaceDeclaration */: - return 4194304 /* ExportType */; - case 181 /* ModuleDeclaration */: - return d.name.kind === 7 /* StringLiteral */ || ts.isInstantiated(d) ? 8388608 /* ExportNamespace */ | 2097152 /* ExportValue */ : 8388608 /* ExportNamespace */; - case 177 /* ClassDeclaration */: - case 180 /* EnumDeclaration */: - return 4194304 /* ExportType */ | 2097152 /* ExportValue */; - case 183 /* ImportDeclaration */: + case 185 /* InterfaceDeclaration */: + return 8388608 /* ExportType */; + case 188 /* ModuleDeclaration */: + return d.name.kind === 7 /* StringLiteral */ || ts.getModuleInstanceState(d) !== 0 /* NonInstantiated */ ? 16777216 /* ExportNamespace */ | 4194304 /* ExportValue */ : 16777216 /* ExportNamespace */; + case 184 /* ClassDeclaration */: + case 187 /* EnumDeclaration */: + return 8388608 /* ExportType */ | 4194304 /* ExportValue */; + case 190 /* ImportDeclaration */: var result = 0; var target = resolveImport(getSymbolOfNode(d)); ts.forEach(target.declarations, function (d) { @@ -14571,7 +14926,7 @@ var ts; }); return result; default: - return 2097152 /* ExportValue */; + return 4194304 /* ExportValue */; } } } @@ -14621,7 +14976,7 @@ var ts; if (!(name && name.text === "_i")) { return; } - if (node.kind === 119 /* Parameter */) { + if (node.kind === 123 /* Parameter */) { if (node.parent.body && ts.hasRestParameters(node.parent) && !ts.isInAmbientContext(node)) { error(node, ts.Diagnostics.Duplicate_identifier_i_Compiler_uses_i_to_initialize_rest_parameter); } @@ -14638,11 +14993,11 @@ var ts; return; } switch (current.kind) { - case 175 /* FunctionDeclaration */: - case 144 /* FunctionExpression */: - case 121 /* Method */: - case 145 /* ArrowFunction */: - case 122 /* Constructor */: + case 182 /* FunctionDeclaration */: + case 149 /* FunctionExpression */: + case 125 /* Method */: + case 150 /* ArrowFunction */: + case 126 /* Constructor */: if (ts.hasRestParameters(current)) { error(node, ts.Diagnostics.Expression_resolves_to_variable_declaration_i_that_compiler_uses_to_initialize_rest_parameter); return; @@ -14656,13 +15011,13 @@ var ts; if (!(identifier && identifier.text === name)) { return false; } - if (node.kind === 120 /* Property */ || node.kind === 121 /* Method */ || node.kind === 123 /* GetAccessor */ || node.kind === 124 /* SetAccessor */) { + if (node.kind === 124 /* Property */ || node.kind === 125 /* Method */ || node.kind === 127 /* GetAccessor */ || node.kind === 128 /* SetAccessor */) { return false; } if (ts.isInAmbientContext(node)) { return false; } - if (node.kind === 119 /* Parameter */ && !node.parent.body) { + if (node.kind === 123 /* Parameter */ && !node.parent.body) { return false; } return true; @@ -14677,7 +15032,7 @@ var ts; var current = node; while (current) { if (getNodeCheckFlags(current) & 4 /* CaptureThis */) { - var isDeclaration = node.kind !== 59 /* Identifier */; + var isDeclaration = node.kind !== 63 /* Identifier */; if (isDeclaration) { error(node.name, ts.Diagnostics.Duplicate_identifier_this_Compiler_uses_variable_declaration_this_to_capture_this_reference); } @@ -14693,12 +15048,12 @@ var ts; if (!needCollisionCheckForIdentifier(node, name, "_super")) { return; } - var enclosingClass = ts.getAncestor(node, 177 /* ClassDeclaration */); + var enclosingClass = ts.getAncestor(node, 184 /* ClassDeclaration */); if (!enclosingClass || ts.isInAmbientContext(enclosingClass)) { return; } if (enclosingClass.baseType) { - var isDeclaration = node.kind !== 59 /* Identifier */; + var isDeclaration = node.kind !== 63 /* Identifier */; if (isDeclaration) { error(node, ts.Diagnostics.Duplicate_identifier_super_Compiler_uses_super_to_capture_base_class_reference); } @@ -14711,11 +15066,11 @@ var ts; if (!needCollisionCheckForIdentifier(node, name, "require") && !needCollisionCheckForIdentifier(node, name, "exports")) { return; } - if (node.kind === 181 /* ModuleDeclaration */ && !ts.isInstantiated(node)) { + if (node.kind === 188 /* ModuleDeclaration */ && ts.getModuleInstanceState(node) !== 1 /* Instantiated */) { return; } - var parent = node.kind === 174 /* VariableDeclaration */ ? node.parent.parent : node.parent; - if (parent.kind === 186 /* SourceFile */ && ts.isExternalModule(parent)) { + var parent = node.kind === 181 /* VariableDeclaration */ ? node.parent.parent : node.parent; + if (parent.kind === 193 /* SourceFile */ && ts.isExternalModule(parent)) { error(name, ts.Diagnostics.Duplicate_identifier_0_Compiler_reserves_name_1_in_top_level_scope_of_an_external_module, name.text, name.text); } } @@ -14820,18 +15175,18 @@ var ts; if (node.expression && !(getNodeLinks(node.expression).flags & 1 /* TypeChecked */)) { var func = ts.getContainingFunction(node); if (func) { - if (func.kind === 124 /* SetAccessor */) { + if (func.kind === 128 /* SetAccessor */) { if (node.expression) { error(node.expression, ts.Diagnostics.Setters_cannot_return_a_value); } } else { var returnType = getReturnTypeOfSignature(getSignatureFromDeclaration(func)); - var checkAssignability = func.type || (func.kind === 123 /* GetAccessor */ && getSetAccessorTypeAnnotationNode(getDeclarationOfKind(func.symbol, 124 /* SetAccessor */))); + var checkAssignability = func.type || (func.kind === 127 /* GetAccessor */ && getSetAccessorTypeAnnotationNode(getDeclarationOfKind(func.symbol, 128 /* SetAccessor */))); if (checkAssignability) { checkTypeAssignableTo(checkExpression(node.expression), returnType, node.expression, undefined); } - else if (func.kind == 122 /* Constructor */) { + else if (func.kind == 126 /* Constructor */) { if (!isTypeAssignableTo(checkExpression(node.expression), returnType)) { error(node.expression, ts.Diagnostics.Return_type_of_constructor_signature_must_be_assignable_to_the_instance_type_of_the_class); } @@ -14991,13 +15346,13 @@ var ts; } } function getTargetSymbol(s) { - return s.flags & 33554432 /* Instantiated */ ? getSymbolLinks(s).target : s; + return s.flags & 67108864 /* Instantiated */ ? getSymbolLinks(s).target : s; } function checkKindsOfPropertyMemberOverrides(type, baseType) { var baseProperties = getPropertiesOfObjectType(baseType); for (var i = 0, len = baseProperties.length; i < len; ++i) { var base = getTargetSymbol(baseProperties[i]); - if (base.flags & 268435456 /* Prototype */) { + if (base.flags & 536870912 /* Prototype */) { continue; } var derived = getTargetSymbol(getPropertyOfObjectType(type, base.name)); @@ -15010,26 +15365,26 @@ var ts; if ((baseDeclarationFlags & 128 /* Static */) !== (derivedDeclarationFlags & 128 /* Static */)) { continue; } - if ((base.flags & derived.flags & 4096 /* Method */) || ((base.flags & ts.SymbolFlags.PropertyOrAccessor) && (derived.flags & ts.SymbolFlags.PropertyOrAccessor))) { + if ((base.flags & derived.flags & 8192 /* Method */) || ((base.flags & ts.SymbolFlags.PropertyOrAccessor) && (derived.flags & ts.SymbolFlags.PropertyOrAccessor))) { continue; } var errorMessage; - if (base.flags & 4096 /* Method */) { + if (base.flags & 8192 /* Method */) { if (derived.flags & ts.SymbolFlags.Accessor) { errorMessage = ts.Diagnostics.Class_0_defines_instance_member_function_1_but_extended_class_2_defines_it_as_instance_member_accessor; } else { - ts.Debug.assert(derived.flags & 4 /* Property */); + ts.Debug.assert((derived.flags & 4 /* Property */) !== 0); errorMessage = ts.Diagnostics.Class_0_defines_instance_member_function_1_but_extended_class_2_defines_it_as_instance_member_property; } } else if (base.flags & 4 /* Property */) { - ts.Debug.assert(derived.flags & 4096 /* Method */); + ts.Debug.assert((derived.flags & 8192 /* Method */) !== 0); errorMessage = ts.Diagnostics.Class_0_defines_instance_member_property_1_but_extended_class_2_defines_it_as_instance_member_function; } else { - ts.Debug.assert(base.flags & ts.SymbolFlags.Accessor); - ts.Debug.assert(derived.flags & 4096 /* Method */); + ts.Debug.assert((base.flags & ts.SymbolFlags.Accessor) !== 0); + ts.Debug.assert((derived.flags & 8192 /* Method */) !== 0); errorMessage = ts.Diagnostics.Class_0_defines_instance_member_accessor_1_but_extended_class_2_defines_it_as_instance_member_function; } error(derived.valueDeclaration.name, errorMessage, typeToString(baseType), symbolToString(base), typeToString(type)); @@ -15037,7 +15392,7 @@ var ts; } } function isAccessor(kind) { - return kind === 123 /* GetAccessor */ || kind === 124 /* SetAccessor */; + return kind === 127 /* GetAccessor */ || kind === 128 /* SetAccessor */; } function areTypeParametersIdentical(list1, list2) { if (!list1 && !list2) { @@ -15064,13 +15419,46 @@ var ts; } return true; } + function checkInheritedPropertiesAreIdentical(type, typeNode) { + if (!type.baseTypes.length || type.baseTypes.length === 1) { + return true; + } + var seen = {}; + ts.forEach(type.declaredProperties, function (p) { + seen[p.name] = { prop: p, containingType: type }; + }); + var ok = true; + for (var i = 0, len = type.baseTypes.length; i < len; ++i) { + var base = type.baseTypes[i]; + var properties = getPropertiesOfObjectType(base); + for (var j = 0, proplen = properties.length; j < proplen; ++j) { + var prop = properties[j]; + if (!ts.hasProperty(seen, prop.name)) { + seen[prop.name] = { prop: prop, containingType: base }; + } + else { + var existing = seen[prop.name]; + var isInheritedProperty = existing.containingType !== type; + if (isInheritedProperty && !isPropertyIdenticalTo(existing.prop, prop)) { + ok = false; + var typeName1 = typeToString(existing.containingType); + var typeName2 = typeToString(base); + var errorInfo = ts.chainDiagnosticMessages(undefined, ts.Diagnostics.Named_properties_0_of_types_1_and_2_are_not_identical, prop.name, typeName1, typeName2); + errorInfo = ts.chainDiagnosticMessages(errorInfo, ts.Diagnostics.Interface_0_cannot_simultaneously_extend_types_1_and_2, typeToString(type), typeName1, typeName2); + addDiagnostic(ts.createDiagnosticForNodeFromMessageChain(typeNode, errorInfo, program.getCompilerHost().getNewLine())); + } + } + } + } + return ok; + } function checkInterfaceDeclaration(node) { checkTypeParameters(node.typeParameters); if (fullTypeCheck) { checkTypeNameIsReserved(node.name, ts.Diagnostics.Interface_name_cannot_be_0); checkExportsOnMergedDeclarations(node); var symbol = getSymbolOfNode(node); - var firstInterfaceDecl = getDeclarationOfKind(symbol, 178 /* InterfaceDeclaration */); + var firstInterfaceDecl = getDeclarationOfKind(symbol, 185 /* InterfaceDeclaration */); if (symbol.declarations.length > 1) { if (node !== firstInterfaceDecl && !areTypeParametersIdentical(firstInterfaceDecl.typeParameters, node.typeParameters)) { error(node.name, ts.Diagnostics.All_declarations_of_an_interface_must_have_identical_type_parameters); @@ -15093,23 +15481,9 @@ var ts; } } function checkTypeAliasDeclaration(node) { + checkTypeNameIsReserved(node.name, ts.Diagnostics.Type_alias_name_cannot_be_0); checkSourceElement(node.type); } - function getConstantValueForExpression(node) { - var isNegative = false; - if (node.kind === 146 /* PrefixOperator */) { - var unaryExpression = node; - if (unaryExpression.operator === 29 /* MinusToken */ || unaryExpression.operator === 28 /* PlusToken */) { - node = unaryExpression.operand; - isNegative = unaryExpression.operator === 29 /* MinusToken */; - } - } - if (node.kind === 6 /* NumericLiteral */) { - var literalText = node.text; - return isNegative ? -literalText : +literalText; - } - return undefined; - } function computeEnumMemberValues(node) { var nodeLinks = getNodeLinks(node); if (!(nodeLinks.flags & 128 /* EnumValuesComputed */)) { @@ -15117,18 +15491,32 @@ var ts; var enumType = getDeclaredTypeOfSymbol(enumSymbol); var autoValue = 0; var ambient = ts.isInAmbientContext(node); + var enumIsConst = ts.isConstEnumDeclaration(node); ts.forEach(node.members, function (member) { if (isNumericName(member.name.text)) { error(member.name, ts.Diagnostics.An_enum_member_cannot_have_a_numeric_name); } var initializer = member.initializer; if (initializer) { - autoValue = getConstantValueForExpression(initializer); - if (autoValue === undefined && !ambient) { - checkTypeAssignableTo(checkExpression(initializer), enumType, initializer, undefined); + autoValue = getConstantValueForEnumMemberInitializer(initializer, enumIsConst); + if (autoValue === undefined) { + if (enumIsConst) { + error(initializer, ts.Diagnostics.In_const_enum_declarations_member_initializer_must_be_constant_expression); + } + else if (!ambient) { + checkTypeAssignableTo(checkExpression(initializer), enumType, initializer, undefined); + } + } + else if (enumIsConst) { + if (isNaN(autoValue)) { + error(initializer, ts.Diagnostics.const_enum_member_initializer_was_evaluated_to_disallowed_value_NaN); + } + else if (!isFinite(autoValue)) { + error(initializer, ts.Diagnostics.const_enum_member_initializer_was_evaluated_to_a_non_finite_value); + } } } - else if (ambient) { + else if (ambient && !enumIsConst) { autoValue = undefined; } if (autoValue !== undefined) { @@ -15137,6 +15525,99 @@ var ts; }); nodeLinks.flags |= 128 /* EnumValuesComputed */; } + function getConstantValueForEnumMemberInitializer(initializer, enumIsConst) { + return evalConstant(initializer); + function evalConstant(e) { + switch (e.kind) { + case 151 /* PrefixOperator */: + var value = evalConstant(e.operand); + if (value === undefined) { + return undefined; + } + switch (e.operator) { + case 32 /* PlusToken */: return value; + case 33 /* MinusToken */: return -value; + case 46 /* TildeToken */: return enumIsConst ? ~value : undefined; + } + return undefined; + case 153 /* BinaryExpression */: + if (!enumIsConst) { + return undefined; + } + var left = evalConstant(e.left); + if (left === undefined) { + return undefined; + } + var right = evalConstant(e.right); + if (right === undefined) { + return undefined; + } + switch (e.operator) { + case 43 /* BarToken */: return left | right; + case 42 /* AmpersandToken */: return left & right; + case 40 /* GreaterThanGreaterThanToken */: return left >> right; + case 41 /* GreaterThanGreaterThanGreaterThanToken */: return left >>> right; + case 39 /* LessThanLessThanToken */: return left << right; + case 44 /* CaretToken */: return left ^ right; + case 34 /* AsteriskToken */: return left * right; + case 35 /* SlashToken */: return left / right; + case 32 /* PlusToken */: return left + right; + case 33 /* MinusToken */: return left - right; + case 36 /* PercentToken */: return left % right; + } + return undefined; + case 6 /* NumericLiteral */: + return +e.text; + case 148 /* ParenExpression */: + return enumIsConst ? evalConstant(e.expression) : undefined; + case 63 /* Identifier */: + case 143 /* IndexedAccess */: + case 142 /* PropertyAccess */: + if (!enumIsConst) { + return undefined; + } + var member = initializer.parent; + var currentType = getTypeOfSymbol(getSymbolOfNode(member.parent)); + var enumType; + var propertyName; + if (e.kind === 63 /* Identifier */) { + enumType = currentType; + propertyName = e.text; + } + else { + if (e.kind === 143 /* IndexedAccess */) { + if (e.index.kind !== 7 /* StringLiteral */) { + return undefined; + } + var enumType = getTypeOfNode(e.object); + propertyName = e.index.text; + } + else { + var enumType = getTypeOfNode(e.left); + propertyName = e.right.text; + } + if (enumType !== currentType) { + return undefined; + } + } + if (propertyName === undefined) { + return undefined; + } + var property = getPropertyOfObjectType(enumType, propertyName); + if (!property || !(property.flags & 8 /* EnumMember */)) { + return undefined; + } + var propertyDecl = property.valueDeclaration; + if (member === propertyDecl) { + return undefined; + } + if (!isDefinedBefore(propertyDecl, member)) { + return undefined; + } + return getNodeLinks(propertyDecl).enumMemberValue; + } + } + } } function checkEnumDeclaration(node) { if (!fullTypeCheck) { @@ -15150,9 +15631,17 @@ var ts; var enumSymbol = getSymbolOfNode(node); var firstDeclaration = getDeclarationOfKind(enumSymbol, node.kind); if (node === firstDeclaration) { + if (enumSymbol.declarations.length > 1) { + var enumIsConst = ts.isConstEnumDeclaration(node); + ts.forEach(enumSymbol.declarations, function (decl) { + if (ts.isConstEnumDeclaration(decl) !== enumIsConst) { + error(decl.name, ts.Diagnostics.Enum_declarations_must_all_be_const_or_non_const); + } + }); + } var seenEnumMissingInitialInitializer = false; ts.forEach(enumSymbol.declarations, function (declaration) { - if (declaration.kind !== 180 /* EnumDeclaration */) { + if (declaration.kind !== 187 /* EnumDeclaration */) { return false; } var enumDeclaration = declaration; @@ -15175,7 +15664,7 @@ var ts; var declarations = symbol.declarations; for (var i = 0; i < declarations.length; i++) { var declaration = declarations[i]; - if ((declaration.kind === 177 /* ClassDeclaration */ || (declaration.kind === 175 /* FunctionDeclaration */ && declaration.body)) && !ts.isInAmbientContext(declaration)) { + if ((declaration.kind === 184 /* ClassDeclaration */ || (declaration.kind === 182 /* FunctionDeclaration */ && declaration.body)) && !ts.isInAmbientContext(declaration)) { return declaration; } } @@ -15187,7 +15676,7 @@ var ts; checkCollisionWithRequireExportsInGeneratedCode(node, node.name); checkExportsOnMergedDeclarations(node); var symbol = getSymbolOfNode(node); - if (symbol.flags & 256 /* ValueModule */ && symbol.declarations.length > 1 && !ts.isInAmbientContext(node)) { + if (symbol.flags & 512 /* ValueModule */ && symbol.declarations.length > 1 && !ts.isInAmbientContext(node)) { var classOrFunc = getFirstNonAmbientClassOrFunctionDeclaration(symbol); if (classOrFunc) { if (ts.getSourceFileOfNode(node) !== ts.getSourceFileOfNode(classOrFunc)) { @@ -15210,7 +15699,7 @@ var ts; checkSourceElement(node.body); } function getFirstIdentifier(node) { - while (node.kind === 117 /* QualifiedName */) { + while (node.kind === 121 /* QualifiedName */) { node = node.left; } return node; @@ -15238,10 +15727,10 @@ var ts; } } else { - if (node.parent.kind === 186 /* SourceFile */) { + if (node.parent.kind === 193 /* SourceFile */) { target = resolveImport(symbol); } - else if (node.parent.kind === 182 /* ModuleBlock */ && node.parent.parent.name.kind === 7 /* StringLiteral */) { + else if (node.parent.kind === 189 /* ModuleBlock */ && node.parent.parent.name.kind === 7 /* StringLiteral */) { if (isExternalModuleNameRelative(node.externalModuleName.text)) { error(node, ts.Diagnostics.Import_declaration_in_an_ambient_external_module_declaration_cannot_reference_external_module_through_relative_external_module_name); target = unknownSymbol; @@ -15263,7 +15752,7 @@ var ts; } function checkExportAssignment(node) { var container = node.parent; - if (container.kind !== 186 /* SourceFile */) { + if (container.kind !== 193 /* SourceFile */) { container = container.parent; } checkTypeOfExportAssignmentSymbol(getSymbolOfNode(container)); @@ -15272,150 +15761,151 @@ var ts; if (!node) return; switch (node.kind) { - case 118 /* TypeParameter */: + case 122 /* TypeParameter */: return checkTypeParameter(node); - case 119 /* Parameter */: + case 123 /* Parameter */: return checkParameter(node); - case 120 /* Property */: + case 124 /* Property */: return checkPropertyDeclaration(node); - case 125 /* CallSignature */: - case 126 /* ConstructSignature */: - case 127 /* IndexSignature */: + case 129 /* CallSignature */: + case 130 /* ConstructSignature */: + case 131 /* IndexSignature */: return checkSignatureDeclaration(node); - case 121 /* Method */: + case 125 /* Method */: return checkMethodDeclaration(node); - case 122 /* Constructor */: + case 126 /* Constructor */: return checkConstructorDeclaration(node); - case 123 /* GetAccessor */: - case 124 /* SetAccessor */: + case 127 /* GetAccessor */: + case 128 /* SetAccessor */: return checkAccessorDeclaration(node); - case 128 /* TypeReference */: + case 132 /* TypeReference */: return checkTypeReference(node); - case 129 /* TypeQuery */: + case 133 /* TypeQuery */: return checkTypeQuery(node); - case 130 /* TypeLiteral */: + case 134 /* TypeLiteral */: return checkTypeLiteral(node); - case 131 /* ArrayType */: + case 135 /* ArrayType */: return checkArrayType(node); - case 132 /* TupleType */: + case 136 /* TupleType */: return checkTupleType(node); - case 133 /* UnionType */: + case 137 /* UnionType */: return checkUnionType(node); - case 134 /* ParenType */: + case 138 /* ParenType */: return checkSourceElement(node.type); - case 175 /* FunctionDeclaration */: + case 182 /* FunctionDeclaration */: return checkFunctionDeclaration(node); - case 151 /* Block */: + case 158 /* Block */: return checkBlock(node); - case 176 /* FunctionBlock */: - case 182 /* ModuleBlock */: + case 183 /* FunctionBlock */: + case 189 /* ModuleBlock */: return checkBody(node); - case 152 /* VariableStatement */: + case 159 /* VariableStatement */: return checkVariableStatement(node); - case 154 /* ExpressionStatement */: + case 161 /* ExpressionStatement */: return checkExpressionStatement(node); - case 155 /* IfStatement */: + case 162 /* IfStatement */: return checkIfStatement(node); - case 156 /* DoStatement */: + case 163 /* DoStatement */: return checkDoStatement(node); - case 157 /* WhileStatement */: + case 164 /* WhileStatement */: return checkWhileStatement(node); - case 158 /* ForStatement */: + case 165 /* ForStatement */: return checkForStatement(node); - case 159 /* ForInStatement */: + case 166 /* ForInStatement */: return checkForInStatement(node); - case 160 /* ContinueStatement */: - case 161 /* BreakStatement */: + case 167 /* ContinueStatement */: + case 168 /* BreakStatement */: return checkBreakOrContinueStatement(node); - case 162 /* ReturnStatement */: + case 169 /* ReturnStatement */: return checkReturnStatement(node); - case 163 /* WithStatement */: + case 170 /* WithStatement */: return checkWithStatement(node); - case 164 /* SwitchStatement */: + case 171 /* SwitchStatement */: return checkSwitchStatement(node); - case 167 /* LabeledStatement */: + case 174 /* LabeledStatement */: return checkLabeledStatement(node); - case 168 /* ThrowStatement */: + case 175 /* ThrowStatement */: return checkThrowStatement(node); - case 169 /* TryStatement */: + case 176 /* TryStatement */: return checkTryStatement(node); - case 174 /* VariableDeclaration */: + case 181 /* VariableDeclaration */: return ts.Debug.fail("Checker encountered variable declaration"); - case 177 /* ClassDeclaration */: + case 184 /* ClassDeclaration */: return checkClassDeclaration(node); - case 178 /* InterfaceDeclaration */: + case 185 /* InterfaceDeclaration */: return checkInterfaceDeclaration(node); - case 179 /* TypeAliasDeclaration */: + case 186 /* TypeAliasDeclaration */: return checkTypeAliasDeclaration(node); - case 180 /* EnumDeclaration */: + case 187 /* EnumDeclaration */: return checkEnumDeclaration(node); - case 181 /* ModuleDeclaration */: + case 188 /* ModuleDeclaration */: return checkModuleDeclaration(node); - case 183 /* ImportDeclaration */: + case 190 /* ImportDeclaration */: return checkImportDeclaration(node); - case 184 /* ExportAssignment */: + case 191 /* ExportAssignment */: return checkExportAssignment(node); } } function checkFunctionExpressionBodies(node) { switch (node.kind) { - case 144 /* FunctionExpression */: - case 145 /* ArrowFunction */: + case 149 /* FunctionExpression */: + case 150 /* ArrowFunction */: ts.forEach(node.parameters, checkFunctionExpressionBodies); checkFunctionExpressionBody(node); break; - case 121 /* Method */: - case 122 /* Constructor */: - case 123 /* GetAccessor */: - case 124 /* SetAccessor */: - case 175 /* FunctionDeclaration */: + case 125 /* Method */: + case 126 /* Constructor */: + case 127 /* GetAccessor */: + case 128 /* SetAccessor */: + case 182 /* FunctionDeclaration */: ts.forEach(node.parameters, checkFunctionExpressionBodies); break; - case 163 /* WithStatement */: + case 170 /* WithStatement */: checkFunctionExpressionBodies(node.expression); break; - case 119 /* Parameter */: - case 120 /* Property */: - case 135 /* ArrayLiteral */: - case 136 /* ObjectLiteral */: - case 137 /* PropertyAssignment */: - case 138 /* PropertyAccess */: - case 139 /* IndexedAccess */: - case 140 /* CallExpression */: - case 141 /* NewExpression */: - case 142 /* TypeAssertion */: - case 143 /* ParenExpression */: - case 146 /* PrefixOperator */: - case 147 /* PostfixOperator */: - case 148 /* BinaryExpression */: - case 149 /* ConditionalExpression */: - case 151 /* Block */: - case 176 /* FunctionBlock */: - case 182 /* ModuleBlock */: - case 152 /* VariableStatement */: - case 154 /* ExpressionStatement */: - case 155 /* IfStatement */: - case 156 /* DoStatement */: - case 157 /* WhileStatement */: - case 158 /* ForStatement */: - case 159 /* ForInStatement */: - case 160 /* ContinueStatement */: - case 161 /* BreakStatement */: - case 162 /* ReturnStatement */: - case 164 /* SwitchStatement */: - case 165 /* CaseClause */: - case 166 /* DefaultClause */: - case 167 /* LabeledStatement */: - case 168 /* ThrowStatement */: - case 169 /* TryStatement */: - case 170 /* TryBlock */: - case 171 /* CatchBlock */: - case 172 /* FinallyBlock */: - case 174 /* VariableDeclaration */: - case 177 /* ClassDeclaration */: - case 180 /* EnumDeclaration */: - case 185 /* EnumMember */: - case 186 /* SourceFile */: + case 123 /* Parameter */: + case 124 /* Property */: + case 139 /* ArrayLiteral */: + case 140 /* ObjectLiteral */: + case 141 /* PropertyAssignment */: + case 142 /* PropertyAccess */: + case 143 /* IndexedAccess */: + case 144 /* CallExpression */: + case 145 /* NewExpression */: + case 146 /* TaggedTemplateExpression */: + case 147 /* TypeAssertion */: + case 148 /* ParenExpression */: + case 151 /* PrefixOperator */: + case 152 /* PostfixOperator */: + case 153 /* BinaryExpression */: + case 154 /* ConditionalExpression */: + case 158 /* Block */: + case 183 /* FunctionBlock */: + case 189 /* ModuleBlock */: + case 159 /* VariableStatement */: + case 161 /* ExpressionStatement */: + case 162 /* IfStatement */: + case 163 /* DoStatement */: + case 164 /* WhileStatement */: + case 165 /* ForStatement */: + case 166 /* ForInStatement */: + case 167 /* ContinueStatement */: + case 168 /* BreakStatement */: + case 169 /* ReturnStatement */: + case 171 /* SwitchStatement */: + case 172 /* CaseClause */: + case 173 /* DefaultClause */: + case 174 /* LabeledStatement */: + case 175 /* ThrowStatement */: + case 176 /* TryStatement */: + case 177 /* TryBlock */: + case 178 /* CatchBlock */: + case 179 /* FinallyBlock */: + case 181 /* VariableDeclaration */: + case 184 /* ClassDeclaration */: + case 187 /* EnumDeclaration */: + case 192 /* EnumMember */: + case 193 /* SourceFile */: ts.forEachChild(node, checkFunctionExpressionBodies); break; } @@ -15432,7 +15922,7 @@ var ts; checkBody(node); if (ts.isExternalModule(node)) { var symbol = getExportAssignmentSymbol(node.symbol); - if (symbol && symbol.flags & 16777216 /* Import */) { + if (symbol && symbol.flags & 33554432 /* Import */) { getSymbolLinks(symbol).referenced = true; } } @@ -15486,7 +15976,7 @@ var ts; function isInsideWithStatementBody(node) { if (node) { while (node.parent) { - if (node.parent.kind === 163 /* WithStatement */ && node.parent.statement === node) { + if (node.parent.kind === 170 /* WithStatement */ && node.parent.statement === node) { return true; } node = node.parent; @@ -15522,27 +16012,27 @@ var ts; copySymbols(location.locals, meaning); } switch (location.kind) { - case 186 /* SourceFile */: + case 193 /* SourceFile */: if (!ts.isExternalModule(location)) break; - case 181 /* ModuleDeclaration */: + case 188 /* ModuleDeclaration */: copySymbols(getSymbolOfNode(location).exports, meaning & ts.SymbolFlags.ModuleMember); break; - case 180 /* EnumDeclaration */: + case 187 /* EnumDeclaration */: copySymbols(getSymbolOfNode(location).exports, meaning & 8 /* EnumMember */); break; - case 177 /* ClassDeclaration */: - case 178 /* InterfaceDeclaration */: + case 184 /* ClassDeclaration */: + case 185 /* InterfaceDeclaration */: if (!(memberFlags & 128 /* Static */)) { copySymbols(getSymbolOfNode(location).members, meaning & ts.SymbolFlags.Type); } break; - case 144 /* FunctionExpression */: + case 149 /* FunctionExpression */: if (location.name) { copySymbol(location.symbol, meaning); } break; - case 171 /* CatchBlock */: + case 178 /* CatchBlock */: if (location.variable.text) { copySymbol(location.symbol, meaning); } @@ -15555,100 +16045,102 @@ var ts; return ts.mapToArray(symbols); } function isTypeDeclarationName(name) { - return name.kind == 59 /* Identifier */ && isTypeDeclaration(name.parent) && name.parent.name === name; + return name.kind == 63 /* Identifier */ && isTypeDeclaration(name.parent) && name.parent.name === name; } function isTypeDeclaration(node) { switch (node.kind) { - case 118 /* TypeParameter */: - case 177 /* ClassDeclaration */: - case 178 /* InterfaceDeclaration */: - case 179 /* TypeAliasDeclaration */: - case 180 /* EnumDeclaration */: + case 122 /* TypeParameter */: + case 184 /* ClassDeclaration */: + case 185 /* InterfaceDeclaration */: + case 186 /* TypeAliasDeclaration */: + case 187 /* EnumDeclaration */: return true; } } function isTypeReferenceIdentifier(entityName) { var node = entityName; - while (node.parent && node.parent.kind === 117 /* QualifiedName */) + while (node.parent && node.parent.kind === 121 /* QualifiedName */) node = node.parent; - return node.parent && node.parent.kind === 128 /* TypeReference */; + return node.parent && node.parent.kind === 132 /* TypeReference */; } function isTypeNode(node) { if (ts.SyntaxKind.FirstTypeNode <= node.kind && node.kind <= ts.SyntaxKind.LastTypeNode) { return true; } switch (node.kind) { - case 105 /* AnyKeyword */: - case 112 /* NumberKeyword */: - case 114 /* StringKeyword */: - case 106 /* BooleanKeyword */: + case 109 /* AnyKeyword */: + case 116 /* NumberKeyword */: + case 118 /* StringKeyword */: + case 110 /* BooleanKeyword */: return true; - case 93 /* VoidKeyword */: - return node.parent.kind !== 146 /* PrefixOperator */; + case 97 /* VoidKeyword */: + return node.parent.kind !== 151 /* PrefixOperator */; case 7 /* StringLiteral */: - return node.parent.kind === 119 /* Parameter */; - case 59 /* Identifier */: - if (node.parent.kind === 117 /* QualifiedName */) { + return node.parent.kind === 123 /* Parameter */; + case 63 /* Identifier */: + if (node.parent.kind === 121 /* QualifiedName */) { node = node.parent; } - case 117 /* QualifiedName */: - ts.Debug.assert(node.kind === 59 /* Identifier */ || node.kind === 117 /* QualifiedName */, "'node' was expected to be a qualified name or identifier in 'isTypeNode'."); + case 121 /* QualifiedName */: + ts.Debug.assert(node.kind === 63 /* Identifier */ || node.kind === 121 /* QualifiedName */, "'node' was expected to be a qualified name or identifier in 'isTypeNode'."); var parent = node.parent; - if (parent.kind === 129 /* TypeQuery */) { + if (parent.kind === 133 /* TypeQuery */) { return false; } if (ts.SyntaxKind.FirstTypeNode <= parent.kind && parent.kind <= ts.SyntaxKind.LastTypeNode) { return true; } switch (parent.kind) { - case 118 /* TypeParameter */: + case 122 /* TypeParameter */: return node === parent.constraint; - case 120 /* Property */: - case 119 /* Parameter */: - case 174 /* VariableDeclaration */: + case 124 /* Property */: + case 123 /* Parameter */: + case 181 /* VariableDeclaration */: return node === parent.type; - case 175 /* FunctionDeclaration */: - case 144 /* FunctionExpression */: - case 145 /* ArrowFunction */: - case 122 /* Constructor */: - case 121 /* Method */: - case 123 /* GetAccessor */: - case 124 /* SetAccessor */: + case 182 /* FunctionDeclaration */: + case 149 /* FunctionExpression */: + case 150 /* ArrowFunction */: + case 126 /* Constructor */: + case 125 /* Method */: + case 127 /* GetAccessor */: + case 128 /* SetAccessor */: return node === parent.type; - case 125 /* CallSignature */: - case 126 /* ConstructSignature */: - case 127 /* IndexSignature */: + case 129 /* CallSignature */: + case 130 /* ConstructSignature */: + case 131 /* IndexSignature */: return node === parent.type; - case 142 /* TypeAssertion */: + case 147 /* TypeAssertion */: return node === parent.type; - case 140 /* CallExpression */: - case 141 /* NewExpression */: + case 144 /* CallExpression */: + case 145 /* NewExpression */: return parent.typeArguments && parent.typeArguments.indexOf(node) >= 0; + case 146 /* TaggedTemplateExpression */: + return false; } } return false; } function isInRightSideOfImportOrExportAssignment(node) { - while (node.parent.kind === 117 /* QualifiedName */) { + while (node.parent.kind === 121 /* QualifiedName */) { node = node.parent; } - if (node.parent.kind === 183 /* ImportDeclaration */) { + if (node.parent.kind === 190 /* ImportDeclaration */) { return node.parent.entityName === node; } - if (node.parent.kind === 184 /* ExportAssignment */) { + if (node.parent.kind === 191 /* ExportAssignment */) { return node.parent.exportName === node; } return false; } function isRightSideOfQualifiedNameOrPropertyAccess(node) { - return (node.parent.kind === 117 /* QualifiedName */ || node.parent.kind === 138 /* PropertyAccess */) && node.parent.right === node; + return (node.parent.kind === 121 /* QualifiedName */ || node.parent.kind === 142 /* PropertyAccess */) && node.parent.right === node; } function getSymbolOfEntityName(entityName) { if (ts.isDeclarationOrFunctionExpressionOrCatchVariableName(entityName)) { return getSymbolOfNode(entityName.parent); } - if (entityName.parent.kind === 184 /* ExportAssignment */) { - return resolveEntityName(entityName.parent.parent, entityName, ts.SymbolFlags.Value | ts.SymbolFlags.Type | ts.SymbolFlags.Namespace | 16777216 /* Import */); + if (entityName.parent.kind === 191 /* ExportAssignment */) { + return resolveEntityName(entityName.parent.parent, entityName, ts.SymbolFlags.Value | ts.SymbolFlags.Type | ts.SymbolFlags.Namespace | 33554432 /* Import */); } if (isInRightSideOfImportOrExportAssignment(entityName)) { return getSymbolOfPartOfRightHandSideOfImport(entityName); @@ -15657,11 +16149,11 @@ var ts; entityName = entityName.parent; } if (ts.isExpression(entityName)) { - if (entityName.kind === 59 /* Identifier */) { - var meaning = ts.SymbolFlags.Value | 16777216 /* Import */; + if (entityName.kind === 63 /* Identifier */) { + var meaning = ts.SymbolFlags.Value | 33554432 /* Import */; return resolveEntityName(entityName, entityName, meaning); } - else if (entityName.kind === 117 /* QualifiedName */ || entityName.kind === 138 /* PropertyAccess */) { + else if (entityName.kind === 121 /* QualifiedName */ || entityName.kind === 142 /* PropertyAccess */) { var symbol = getNodeLinks(entityName).resolvedSymbol; if (!symbol) { checkPropertyAccess(entityName); @@ -15673,8 +16165,8 @@ var ts; } } else if (isTypeReferenceIdentifier(entityName)) { - var meaning = entityName.parent.kind === 128 /* TypeReference */ ? ts.SymbolFlags.Type : ts.SymbolFlags.Namespace; - meaning |= 16777216 /* Import */; + var meaning = entityName.parent.kind === 132 /* TypeReference */ ? ts.SymbolFlags.Type : ts.SymbolFlags.Namespace; + meaning |= 33554432 /* Import */; return resolveEntityName(entityName, entityName, meaning); } return undefined; @@ -15686,32 +16178,32 @@ var ts; if (ts.isDeclarationOrFunctionExpressionOrCatchVariableName(node)) { return getSymbolOfNode(node.parent); } - if (node.kind === 59 /* Identifier */ && isInRightSideOfImportOrExportAssignment(node)) { - return node.parent.kind === 184 /* ExportAssignment */ ? getSymbolOfEntityName(node) : getSymbolOfPartOfRightHandSideOfImport(node); + if (node.kind === 63 /* Identifier */ && isInRightSideOfImportOrExportAssignment(node)) { + return node.parent.kind === 191 /* ExportAssignment */ ? getSymbolOfEntityName(node) : getSymbolOfPartOfRightHandSideOfImport(node); } switch (node.kind) { - case 59 /* Identifier */: - case 138 /* PropertyAccess */: - case 117 /* QualifiedName */: + case 63 /* Identifier */: + case 142 /* PropertyAccess */: + case 121 /* QualifiedName */: return getSymbolOfEntityName(node); - case 87 /* ThisKeyword */: - case 85 /* SuperKeyword */: + case 91 /* ThisKeyword */: + case 89 /* SuperKeyword */: var type = checkExpression(node); return type.symbol; - case 107 /* ConstructorKeyword */: + case 111 /* ConstructorKeyword */: var constructorDeclaration = node.parent; - if (constructorDeclaration && constructorDeclaration.kind === 122 /* Constructor */) { + if (constructorDeclaration && constructorDeclaration.kind === 126 /* Constructor */) { return constructorDeclaration.parent.symbol; } return undefined; case 7 /* StringLiteral */: - if (node.parent.kind === 183 /* ImportDeclaration */ && node.parent.externalModuleName === node) { + if (node.parent.kind === 190 /* ImportDeclaration */ && node.parent.externalModuleName === node) { var importSymbol = getSymbolOfNode(node.parent); var moduleType = getTypeOfSymbol(importSymbol); return moduleType ? moduleType.symbol : undefined; } case 6 /* NumericLiteral */: - if (node.parent.kind == 139 /* IndexedAccess */ && node.parent.index === node) { + if (node.parent.kind == 143 /* IndexedAccess */ && node.parent.index === node) { var objectType = checkExpression(node.parent.object); if (objectType === unknownType) return undefined; @@ -15776,7 +16268,7 @@ var ts; return getNamedMembers(propsByName); } function getRootSymbols(symbol) { - if (symbol.flags & 536870912 /* UnionProperty */) { + if (symbol.flags & 1073741824 /* UnionProperty */) { var symbols = []; var name = symbol.name; ts.forEach(getSymbolLinks(symbol).unionType.types, function (t) { @@ -15784,7 +16276,7 @@ var ts; }); return symbols; } - else if (symbol.flags & 134217728 /* Transient */) { + else if (symbol.flags & 268435456 /* Transient */) { var target = getSymbolLinks(symbol).target; if (target) { return [target]; @@ -15793,7 +16285,7 @@ var ts; return [symbol]; } function isExternalModuleSymbol(symbol) { - return symbol.flags & 256 /* ValueModule */ && symbol.declarations.length === 1 && symbol.declarations[0].kind === 186 /* SourceFile */; + return symbol.flags & 512 /* ValueModule */ && symbol.declarations.length === 1 && symbol.declarations[0].kind === 193 /* SourceFile */; } function isNodeDescendentOf(node, ancestor) { while (node) { @@ -15805,7 +16297,7 @@ var ts; } function isUniqueLocalName(name, container) { for (var node = container; isNodeDescendentOf(node, container); node = node.nextContainer) { - if (node.locals && ts.hasProperty(node.locals, name) && node.locals[name].flags & (ts.SymbolFlags.Value | 2097152 /* ExportValue */)) { + if (node.locals && ts.hasProperty(node.locals, name) && node.locals[name].flags & (ts.SymbolFlags.Value | 4194304 /* ExportValue */)) { return false; } } @@ -15826,7 +16318,7 @@ var ts; function getLocalNameForSymbol(symbol, location) { var node = location; while (node) { - if ((node.kind === 181 /* ModuleDeclaration */ || node.kind === 180 /* EnumDeclaration */) && getSymbolOfNode(node) === symbol) { + if ((node.kind === 188 /* ModuleDeclaration */ || node.kind === 187 /* EnumDeclaration */) && getSymbolOfNode(node) === symbol) { return getLocalNameOfContainer(node); } node = node.parent; @@ -15847,15 +16339,14 @@ var ts; } function getExportAssignmentName(node) { var symbol = getExportAssignmentSymbol(getSymbolOfNode(node)); - return symbol && symbolIsValue(symbol) ? symbolToString(symbol) : undefined; + return symbol && symbolIsValue(symbol) && !isConstEnumSymbol(symbol) ? symbolToString(symbol) : undefined; } - function isTopLevelValueImportedViaEntityName(node) { - if (node.parent.kind !== 186 /* SourceFile */ || !node.entityName) { + function isTopLevelValueImportWithEntityName(node) { + if (node.parent.kind !== 193 /* SourceFile */ || !node.entityName) { return false; } var symbol = getSymbolOfNode(node); - var target = resolveImport(symbol); - return target !== unknownSymbol && ((target.flags & ts.SymbolFlags.Value) !== 0); + return isImportResolvedToValue(getSymbolOfNode(node)); } function hasSemanticErrors() { return getDiagnostics().length > 0 || getGlobalDiagnostics().length > 0; @@ -15863,16 +16354,20 @@ var ts; function hasEarlyErrors(sourceFile) { return ts.forEach(getDiagnostics(sourceFile), function (d) { return d.isEarly; }); } + function isImportResolvedToValue(symbol) { + var target = resolveImport(symbol); + return target !== unknownSymbol && target.flags & ts.SymbolFlags.Value && !isConstEnumOrConstEnumOnlyModule(target); + } + function isConstEnumOrConstEnumOnlyModule(s) { + return isConstEnumSymbol(s) || s.constEnumOnlyModule; + } function isReferencedImportDeclaration(node) { var symbol = getSymbolOfNode(node); if (getSymbolLinks(symbol).referenced) { return true; } if (node.flags & 1 /* Export */) { - var target = resolveImport(symbol); - if (target !== unknownSymbol && target.flags & ts.SymbolFlags.Value) { - return true; - } + return isImportResolvedToValue(symbol); } return false; } @@ -15896,7 +16391,7 @@ var ts; if (symbol && (symbol.flags & 8 /* EnumMember */)) { var declaration = symbol.valueDeclaration; var constantValue; - if (declaration.kind === 185 /* EnumMember */ && (constantValue = getNodeLinks(declaration).enumMemberValue) !== undefined) { + if (declaration.kind === 192 /* EnumMember */ && (constantValue = getNodeLinks(declaration).enumMemberValue) !== undefined) { return constantValue; } } @@ -15904,7 +16399,7 @@ var ts; } function writeTypeAtLocation(location, enclosingDeclaration, flags, writer) { var symbol = getSymbolOfNode(location); - var type = symbol && !(symbol.flags & 1024 /* TypeLiteral */) ? getTypeOfSymbol(symbol) : getTypeFromTypeNode(location); + var type = symbol && !(symbol.flags & 2048 /* TypeLiteral */) ? getTypeOfSymbol(symbol) : getTypeFromTypeNode(location); getSymbolDisplayBuilder().buildTypeDisplay(type, writer, enclosingDeclaration, flags); } function writeReturnTypeOfSignatureDeclaration(signatureDeclaration, enclosingDeclaration, flags, writer) { @@ -15920,7 +16415,7 @@ var ts; isReferencedImportDeclaration: isReferencedImportDeclaration, getNodeCheckFlags: getNodeCheckFlags, getEnumMemberValue: getEnumMemberValue, - isTopLevelValueImportedViaEntityName: isTopLevelValueImportedViaEntityName, + isTopLevelValueImportWithEntityName: isTopLevelValueImportWithEntityName, hasSemanticErrors: hasSemanticErrors, hasEarlyErrors: hasEarlyErrors, isDeclarationVisible: isDeclarationVisible, @@ -15977,7 +16472,6 @@ var TypeScript; Automatic_semicolon_insertion_not_allowed: "Automatic semicolon insertion not allowed.", Unexpected_token_0_expected: "Unexpected token; '{0}' expected.", Trailing_comma_not_allowed: "Trailing comma not allowed.", - AsteriskSlash_expected: "'*/' expected.", public_or_private_modifier_must_precede_static: "'public' or 'private' modifier must precede 'static'.", Unexpected_token: "Unexpected token.", Catch_clause_parameter_cannot_have_a_type_annotation: "Catch clause parameter cannot have a type annotation.", @@ -16059,6 +16553,7 @@ var TypeScript; return_statement_must_be_contained_within_a_function_body: "'return' statement must be contained within a function body.", Expression_expected: "Expression expected.", Type_expected: "Type expected.", + Template_literal_cannot_be_used_as_an_element_name: "Template literal cannot be used as an element name.", Duplicate_identifier_0: "Duplicate identifier '{0}'.", The_name_0_does_not_exist_in_the_current_scope: "The name '{0}' does not exist in the current scope.", The_name_0_does_not_refer_to_a_value: "The name '{0}' does not refer to a value.", @@ -16514,6 +17009,7 @@ var TypeScript; "'return' statement must be contained within a function body.": { "code": 1108, "category": 1 /* Error */ }, "Expression expected.": { "code": 1109, "category": 1 /* Error */ }, "Type expected.": { "code": 1110, "category": 1 /* Error */ }, + "Template literal cannot be used as an element name.": { "code": 1111, "category": 1 /* Error */ }, "Duplicate identifier '{0}'.": { "code": 2000, "category": 1 /* Error */ }, "The name '{0}' does not exist in the current scope.": { "code": 2001, "category": 1 /* Error */ }, "The name '{0}' does not refer to a value.": { "code": 2002, "category": 1 /* Error */ }, @@ -16871,7 +17367,7 @@ var TypeScript; if (array1 === array2) { return true; } - if (array1 === null || array2 === null) { + if (!array1 || !array2) { return false; } if (array1.length !== array2.length) { @@ -16920,7 +17416,7 @@ var TypeScript; return v; } } - return null; + return undefined; }; ArrayUtilities.firstOrDefault = function (array, func) { for (var i = 0, n = array.length; i < n; i++) { @@ -16929,7 +17425,7 @@ var TypeScript; return value; } } - return null; + return undefined; }; ArrayUtilities.first = function (array, func) { for (var i = 0, n = array.length; i < n; i++) { @@ -17043,13 +17539,12 @@ var TypeScript; return this.currentAssertionLevel >= level; }; Debug.assert = function (expression, message, verboseDebugInfo) { - if (message === void 0) { message = ""; } - if (verboseDebugInfo === void 0) { verboseDebugInfo = null; } if (!expression) { var verboseDebugString = ""; if (verboseDebugInfo) { verboseDebugString = "\r\nVerbose Debug Information:" + verboseDebugInfo(); } + message = message || ""; throw new Error("Debug Failure. False expression: " + message + verboseDebugString); } }; @@ -17103,12 +17598,10 @@ var TypeScript; var Diagnostic = (function (_super) { __extends(Diagnostic, _super); function Diagnostic(fileName, lineMap, start, length, diagnosticKey, _arguments, additionalLocations) { - if (_arguments === void 0) { _arguments = null; } - if (additionalLocations === void 0) { additionalLocations = null; } _super.call(this, fileName, lineMap, start, length); this._diagnosticKey = diagnosticKey; - this._arguments = (_arguments && _arguments.length > 0) ? _arguments : null; - this._additionalLocations = (additionalLocations && additionalLocations.length > 0) ? additionalLocations : null; + this._arguments = (_arguments && _arguments.length > 0) ? _arguments : undefined; + this._additionalLocations = (additionalLocations && additionalLocations.length > 0) ? additionalLocations : undefined; } Diagnostic.prototype.toJSON = function (key) { var result = {}; @@ -17260,7 +17753,7 @@ var TypeScript; function LineMap(_computeLineStarts, length) { this._computeLineStarts = _computeLineStarts; this.length = length; - this._lineStarts = null; + this._lineStarts = undefined; } LineMap.prototype.toJSON = function (key) { return { lineStarts: this.lineStarts(), length: this.length }; @@ -17269,7 +17762,7 @@ var TypeScript; return this.length === other.length && TypeScript.ArrayUtilities.sequenceEquals(this.lineStarts(), other.lineStarts(), function (v1, v2) { return v1 === v2; }); }; LineMap.prototype.lineStarts = function () { - if (this._lineStarts === null) { + if (!this._lineStarts) { this._lineStarts = this._computeLineStarts(); } return this._lineStarts; @@ -17456,6 +17949,7 @@ var TypeScript; CharacterCodes[CharacterCodes["asterisk"] = 42] = "asterisk"; CharacterCodes[CharacterCodes["at"] = 64] = "at"; CharacterCodes[CharacterCodes["backslash"] = 92] = "backslash"; + CharacterCodes[CharacterCodes["backtick"] = 96] = "backtick"; CharacterCodes[CharacterCodes["bar"] = 124] = "bar"; CharacterCodes[CharacterCodes["caret"] = 94] = "caret"; CharacterCodes[CharacterCodes["closeBrace"] = 125] = "closeBrace"; @@ -17495,7 +17989,7 @@ var TypeScript; var StringScriptSnapshot = (function () { function StringScriptSnapshot(text) { this.text = text; - this._lineStartPositions = null; + this._lineStartPositions = undefined; } StringScriptSnapshot.prototype.getText = function (start, end) { return this.text.substring(start, end); @@ -17545,13 +18039,14 @@ var TypeScript; var SimpleStringText = (function () { function SimpleStringText(value) { this.value = value; - this._lineMap = null; + this._lineMap = undefined; } SimpleStringText.prototype.length = function () { return this.value.length; }; SimpleStringText.prototype.substr = function (start, length) { - return this.value.substr(start, length); + var val = this.value; + return start === 0 && length == val.length ? val : val.substr(start, length); }; SimpleStringText.prototype.charCodeAt = function (index) { return this.value.charCodeAt(index); @@ -17567,7 +18062,7 @@ var TypeScript; var SimpleScriptSnapshotText = (function () { function SimpleScriptSnapshotText(scriptSnapshot) { this.scriptSnapshot = scriptSnapshot; - this._lineMap = null; + this._lineMap = undefined; } SimpleScriptSnapshotText.prototype.charCodeAt = function (index) { return this.scriptSnapshot.getText(index, index + 1).charCodeAt(0); @@ -17580,7 +18075,7 @@ var TypeScript; }; SimpleScriptSnapshotText.prototype.lineMap = function () { var _this = this; - if (this._lineMap === null) { + if (!this._lineMap) { this._lineMap = new TypeScript.LineMap(function () { return _this.scriptSnapshot.getLineStartPositions(); }, this.length()); } return this._lineMap; @@ -17714,7 +18209,7 @@ var TypeScript; if (overlapStart < overlapEnd) { return TextSpan.fromBounds(overlapStart, overlapEnd); } - return null; + return undefined; }; TextSpan.prototype.intersectsWithTextSpan = function (span) { return span._start <= this.end() && span.end() >= this._start; @@ -17732,7 +18227,7 @@ var TypeScript; if (intersectStart <= intersectEnd) { return TextSpan.fromBounds(intersectStart, intersectEnd); } - return null; + return undefined; }; TextSpan.fromBounds = function (start, end) { TypeScript.Debug.assert(start >= 0); @@ -17885,252 +18380,217 @@ var TypeScript; (function (SyntaxKind) { SyntaxKind[SyntaxKind["None"] = 0] = "None"; SyntaxKind[SyntaxKind["List"] = 1] = "List"; - SyntaxKind[SyntaxKind["SeparatedList"] = 2] = "SeparatedList"; - SyntaxKind[SyntaxKind["TriviaList"] = 3] = "TriviaList"; - SyntaxKind[SyntaxKind["WhitespaceTrivia"] = 4] = "WhitespaceTrivia"; - SyntaxKind[SyntaxKind["NewLineTrivia"] = 5] = "NewLineTrivia"; - SyntaxKind[SyntaxKind["MultiLineCommentTrivia"] = 6] = "MultiLineCommentTrivia"; - SyntaxKind[SyntaxKind["SingleLineCommentTrivia"] = 7] = "SingleLineCommentTrivia"; - SyntaxKind[SyntaxKind["SkippedTokenTrivia"] = 8] = "SkippedTokenTrivia"; - SyntaxKind[SyntaxKind["ErrorToken"] = 9] = "ErrorToken"; - SyntaxKind[SyntaxKind["EndOfFileToken"] = 10] = "EndOfFileToken"; - SyntaxKind[SyntaxKind["IdentifierName"] = 11] = "IdentifierName"; - SyntaxKind[SyntaxKind["RegularExpressionLiteral"] = 12] = "RegularExpressionLiteral"; - SyntaxKind[SyntaxKind["NumericLiteral"] = 13] = "NumericLiteral"; - SyntaxKind[SyntaxKind["StringLiteral"] = 14] = "StringLiteral"; - SyntaxKind[SyntaxKind["BreakKeyword"] = 15] = "BreakKeyword"; - SyntaxKind[SyntaxKind["CaseKeyword"] = 16] = "CaseKeyword"; - SyntaxKind[SyntaxKind["CatchKeyword"] = 17] = "CatchKeyword"; - SyntaxKind[SyntaxKind["ContinueKeyword"] = 18] = "ContinueKeyword"; - SyntaxKind[SyntaxKind["DebuggerKeyword"] = 19] = "DebuggerKeyword"; - SyntaxKind[SyntaxKind["DefaultKeyword"] = 20] = "DefaultKeyword"; - SyntaxKind[SyntaxKind["DeleteKeyword"] = 21] = "DeleteKeyword"; - SyntaxKind[SyntaxKind["DoKeyword"] = 22] = "DoKeyword"; - SyntaxKind[SyntaxKind["ElseKeyword"] = 23] = "ElseKeyword"; - SyntaxKind[SyntaxKind["FalseKeyword"] = 24] = "FalseKeyword"; - SyntaxKind[SyntaxKind["FinallyKeyword"] = 25] = "FinallyKeyword"; - SyntaxKind[SyntaxKind["ForKeyword"] = 26] = "ForKeyword"; - SyntaxKind[SyntaxKind["FunctionKeyword"] = 27] = "FunctionKeyword"; - SyntaxKind[SyntaxKind["IfKeyword"] = 28] = "IfKeyword"; - SyntaxKind[SyntaxKind["InKeyword"] = 29] = "InKeyword"; - SyntaxKind[SyntaxKind["InstanceOfKeyword"] = 30] = "InstanceOfKeyword"; - SyntaxKind[SyntaxKind["NewKeyword"] = 31] = "NewKeyword"; - SyntaxKind[SyntaxKind["NullKeyword"] = 32] = "NullKeyword"; - SyntaxKind[SyntaxKind["ReturnKeyword"] = 33] = "ReturnKeyword"; - SyntaxKind[SyntaxKind["SwitchKeyword"] = 34] = "SwitchKeyword"; - SyntaxKind[SyntaxKind["ThisKeyword"] = 35] = "ThisKeyword"; - SyntaxKind[SyntaxKind["ThrowKeyword"] = 36] = "ThrowKeyword"; - SyntaxKind[SyntaxKind["TrueKeyword"] = 37] = "TrueKeyword"; - SyntaxKind[SyntaxKind["TryKeyword"] = 38] = "TryKeyword"; - SyntaxKind[SyntaxKind["TypeOfKeyword"] = 39] = "TypeOfKeyword"; - SyntaxKind[SyntaxKind["VarKeyword"] = 40] = "VarKeyword"; - SyntaxKind[SyntaxKind["VoidKeyword"] = 41] = "VoidKeyword"; - SyntaxKind[SyntaxKind["WhileKeyword"] = 42] = "WhileKeyword"; - SyntaxKind[SyntaxKind["WithKeyword"] = 43] = "WithKeyword"; - SyntaxKind[SyntaxKind["ClassKeyword"] = 44] = "ClassKeyword"; - SyntaxKind[SyntaxKind["ConstKeyword"] = 45] = "ConstKeyword"; - SyntaxKind[SyntaxKind["EnumKeyword"] = 46] = "EnumKeyword"; - SyntaxKind[SyntaxKind["ExportKeyword"] = 47] = "ExportKeyword"; - SyntaxKind[SyntaxKind["ExtendsKeyword"] = 48] = "ExtendsKeyword"; - SyntaxKind[SyntaxKind["ImportKeyword"] = 49] = "ImportKeyword"; - SyntaxKind[SyntaxKind["SuperKeyword"] = 50] = "SuperKeyword"; - SyntaxKind[SyntaxKind["ImplementsKeyword"] = 51] = "ImplementsKeyword"; - SyntaxKind[SyntaxKind["InterfaceKeyword"] = 52] = "InterfaceKeyword"; - SyntaxKind[SyntaxKind["LetKeyword"] = 53] = "LetKeyword"; - SyntaxKind[SyntaxKind["PackageKeyword"] = 54] = "PackageKeyword"; - SyntaxKind[SyntaxKind["PrivateKeyword"] = 55] = "PrivateKeyword"; - SyntaxKind[SyntaxKind["ProtectedKeyword"] = 56] = "ProtectedKeyword"; - SyntaxKind[SyntaxKind["PublicKeyword"] = 57] = "PublicKeyword"; - SyntaxKind[SyntaxKind["StaticKeyword"] = 58] = "StaticKeyword"; - SyntaxKind[SyntaxKind["YieldKeyword"] = 59] = "YieldKeyword"; - SyntaxKind[SyntaxKind["AnyKeyword"] = 60] = "AnyKeyword"; - SyntaxKind[SyntaxKind["BooleanKeyword"] = 61] = "BooleanKeyword"; - SyntaxKind[SyntaxKind["ConstructorKeyword"] = 62] = "ConstructorKeyword"; - SyntaxKind[SyntaxKind["DeclareKeyword"] = 63] = "DeclareKeyword"; - SyntaxKind[SyntaxKind["GetKeyword"] = 64] = "GetKeyword"; - SyntaxKind[SyntaxKind["ModuleKeyword"] = 65] = "ModuleKeyword"; - SyntaxKind[SyntaxKind["RequireKeyword"] = 66] = "RequireKeyword"; - SyntaxKind[SyntaxKind["NumberKeyword"] = 67] = "NumberKeyword"; - SyntaxKind[SyntaxKind["SetKeyword"] = 68] = "SetKeyword"; - SyntaxKind[SyntaxKind["StringKeyword"] = 69] = "StringKeyword"; - SyntaxKind[SyntaxKind["OpenBraceToken"] = 70] = "OpenBraceToken"; - SyntaxKind[SyntaxKind["CloseBraceToken"] = 71] = "CloseBraceToken"; - SyntaxKind[SyntaxKind["OpenParenToken"] = 72] = "OpenParenToken"; - SyntaxKind[SyntaxKind["CloseParenToken"] = 73] = "CloseParenToken"; - SyntaxKind[SyntaxKind["OpenBracketToken"] = 74] = "OpenBracketToken"; - SyntaxKind[SyntaxKind["CloseBracketToken"] = 75] = "CloseBracketToken"; - SyntaxKind[SyntaxKind["DotToken"] = 76] = "DotToken"; - SyntaxKind[SyntaxKind["DotDotDotToken"] = 77] = "DotDotDotToken"; - SyntaxKind[SyntaxKind["SemicolonToken"] = 78] = "SemicolonToken"; - SyntaxKind[SyntaxKind["CommaToken"] = 79] = "CommaToken"; - SyntaxKind[SyntaxKind["LessThanToken"] = 80] = "LessThanToken"; - SyntaxKind[SyntaxKind["GreaterThanToken"] = 81] = "GreaterThanToken"; - SyntaxKind[SyntaxKind["LessThanEqualsToken"] = 82] = "LessThanEqualsToken"; - SyntaxKind[SyntaxKind["GreaterThanEqualsToken"] = 83] = "GreaterThanEqualsToken"; - SyntaxKind[SyntaxKind["EqualsEqualsToken"] = 84] = "EqualsEqualsToken"; - SyntaxKind[SyntaxKind["EqualsGreaterThanToken"] = 85] = "EqualsGreaterThanToken"; - SyntaxKind[SyntaxKind["ExclamationEqualsToken"] = 86] = "ExclamationEqualsToken"; - SyntaxKind[SyntaxKind["EqualsEqualsEqualsToken"] = 87] = "EqualsEqualsEqualsToken"; - SyntaxKind[SyntaxKind["ExclamationEqualsEqualsToken"] = 88] = "ExclamationEqualsEqualsToken"; - SyntaxKind[SyntaxKind["PlusToken"] = 89] = "PlusToken"; - SyntaxKind[SyntaxKind["MinusToken"] = 90] = "MinusToken"; - SyntaxKind[SyntaxKind["AsteriskToken"] = 91] = "AsteriskToken"; - SyntaxKind[SyntaxKind["PercentToken"] = 92] = "PercentToken"; - SyntaxKind[SyntaxKind["PlusPlusToken"] = 93] = "PlusPlusToken"; - SyntaxKind[SyntaxKind["MinusMinusToken"] = 94] = "MinusMinusToken"; - SyntaxKind[SyntaxKind["LessThanLessThanToken"] = 95] = "LessThanLessThanToken"; - SyntaxKind[SyntaxKind["GreaterThanGreaterThanToken"] = 96] = "GreaterThanGreaterThanToken"; - SyntaxKind[SyntaxKind["GreaterThanGreaterThanGreaterThanToken"] = 97] = "GreaterThanGreaterThanGreaterThanToken"; - SyntaxKind[SyntaxKind["AmpersandToken"] = 98] = "AmpersandToken"; - SyntaxKind[SyntaxKind["BarToken"] = 99] = "BarToken"; - SyntaxKind[SyntaxKind["CaretToken"] = 100] = "CaretToken"; - SyntaxKind[SyntaxKind["ExclamationToken"] = 101] = "ExclamationToken"; - SyntaxKind[SyntaxKind["TildeToken"] = 102] = "TildeToken"; - SyntaxKind[SyntaxKind["AmpersandAmpersandToken"] = 103] = "AmpersandAmpersandToken"; - SyntaxKind[SyntaxKind["BarBarToken"] = 104] = "BarBarToken"; - SyntaxKind[SyntaxKind["QuestionToken"] = 105] = "QuestionToken"; - SyntaxKind[SyntaxKind["ColonToken"] = 106] = "ColonToken"; - SyntaxKind[SyntaxKind["EqualsToken"] = 107] = "EqualsToken"; - SyntaxKind[SyntaxKind["PlusEqualsToken"] = 108] = "PlusEqualsToken"; - SyntaxKind[SyntaxKind["MinusEqualsToken"] = 109] = "MinusEqualsToken"; - SyntaxKind[SyntaxKind["AsteriskEqualsToken"] = 110] = "AsteriskEqualsToken"; - SyntaxKind[SyntaxKind["PercentEqualsToken"] = 111] = "PercentEqualsToken"; - SyntaxKind[SyntaxKind["LessThanLessThanEqualsToken"] = 112] = "LessThanLessThanEqualsToken"; - SyntaxKind[SyntaxKind["GreaterThanGreaterThanEqualsToken"] = 113] = "GreaterThanGreaterThanEqualsToken"; - SyntaxKind[SyntaxKind["GreaterThanGreaterThanGreaterThanEqualsToken"] = 114] = "GreaterThanGreaterThanGreaterThanEqualsToken"; - SyntaxKind[SyntaxKind["AmpersandEqualsToken"] = 115] = "AmpersandEqualsToken"; - SyntaxKind[SyntaxKind["BarEqualsToken"] = 116] = "BarEqualsToken"; - SyntaxKind[SyntaxKind["CaretEqualsToken"] = 117] = "CaretEqualsToken"; - SyntaxKind[SyntaxKind["SlashToken"] = 118] = "SlashToken"; - SyntaxKind[SyntaxKind["SlashEqualsToken"] = 119] = "SlashEqualsToken"; - SyntaxKind[SyntaxKind["SourceUnit"] = 120] = "SourceUnit"; - SyntaxKind[SyntaxKind["QualifiedName"] = 121] = "QualifiedName"; - SyntaxKind[SyntaxKind["ObjectType"] = 122] = "ObjectType"; - SyntaxKind[SyntaxKind["FunctionType"] = 123] = "FunctionType"; - SyntaxKind[SyntaxKind["ArrayType"] = 124] = "ArrayType"; - SyntaxKind[SyntaxKind["ConstructorType"] = 125] = "ConstructorType"; - SyntaxKind[SyntaxKind["GenericType"] = 126] = "GenericType"; - SyntaxKind[SyntaxKind["TypeQuery"] = 127] = "TypeQuery"; - SyntaxKind[SyntaxKind["TupleType"] = 128] = "TupleType"; - SyntaxKind[SyntaxKind["InterfaceDeclaration"] = 129] = "InterfaceDeclaration"; - SyntaxKind[SyntaxKind["FunctionDeclaration"] = 130] = "FunctionDeclaration"; - SyntaxKind[SyntaxKind["ModuleDeclaration"] = 131] = "ModuleDeclaration"; - SyntaxKind[SyntaxKind["ClassDeclaration"] = 132] = "ClassDeclaration"; - SyntaxKind[SyntaxKind["EnumDeclaration"] = 133] = "EnumDeclaration"; - SyntaxKind[SyntaxKind["ImportDeclaration"] = 134] = "ImportDeclaration"; - SyntaxKind[SyntaxKind["ExportAssignment"] = 135] = "ExportAssignment"; - SyntaxKind[SyntaxKind["MemberFunctionDeclaration"] = 136] = "MemberFunctionDeclaration"; - SyntaxKind[SyntaxKind["MemberVariableDeclaration"] = 137] = "MemberVariableDeclaration"; - SyntaxKind[SyntaxKind["ConstructorDeclaration"] = 138] = "ConstructorDeclaration"; - SyntaxKind[SyntaxKind["IndexMemberDeclaration"] = 139] = "IndexMemberDeclaration"; - SyntaxKind[SyntaxKind["GetAccessor"] = 140] = "GetAccessor"; - SyntaxKind[SyntaxKind["SetAccessor"] = 141] = "SetAccessor"; - SyntaxKind[SyntaxKind["PropertySignature"] = 142] = "PropertySignature"; - SyntaxKind[SyntaxKind["CallSignature"] = 143] = "CallSignature"; - SyntaxKind[SyntaxKind["ConstructSignature"] = 144] = "ConstructSignature"; - SyntaxKind[SyntaxKind["IndexSignature"] = 145] = "IndexSignature"; - SyntaxKind[SyntaxKind["MethodSignature"] = 146] = "MethodSignature"; - SyntaxKind[SyntaxKind["Block"] = 147] = "Block"; - SyntaxKind[SyntaxKind["IfStatement"] = 148] = "IfStatement"; - SyntaxKind[SyntaxKind["VariableStatement"] = 149] = "VariableStatement"; - SyntaxKind[SyntaxKind["ExpressionStatement"] = 150] = "ExpressionStatement"; - SyntaxKind[SyntaxKind["ReturnStatement"] = 151] = "ReturnStatement"; - SyntaxKind[SyntaxKind["SwitchStatement"] = 152] = "SwitchStatement"; - SyntaxKind[SyntaxKind["BreakStatement"] = 153] = "BreakStatement"; - SyntaxKind[SyntaxKind["ContinueStatement"] = 154] = "ContinueStatement"; - SyntaxKind[SyntaxKind["ForStatement"] = 155] = "ForStatement"; - SyntaxKind[SyntaxKind["ForInStatement"] = 156] = "ForInStatement"; - SyntaxKind[SyntaxKind["EmptyStatement"] = 157] = "EmptyStatement"; - SyntaxKind[SyntaxKind["ThrowStatement"] = 158] = "ThrowStatement"; - SyntaxKind[SyntaxKind["WhileStatement"] = 159] = "WhileStatement"; - SyntaxKind[SyntaxKind["TryStatement"] = 160] = "TryStatement"; - SyntaxKind[SyntaxKind["LabeledStatement"] = 161] = "LabeledStatement"; - SyntaxKind[SyntaxKind["DoStatement"] = 162] = "DoStatement"; - SyntaxKind[SyntaxKind["DebuggerStatement"] = 163] = "DebuggerStatement"; - SyntaxKind[SyntaxKind["WithStatement"] = 164] = "WithStatement"; - SyntaxKind[SyntaxKind["PlusExpression"] = 165] = "PlusExpression"; - SyntaxKind[SyntaxKind["NegateExpression"] = 166] = "NegateExpression"; - SyntaxKind[SyntaxKind["BitwiseNotExpression"] = 167] = "BitwiseNotExpression"; - SyntaxKind[SyntaxKind["LogicalNotExpression"] = 168] = "LogicalNotExpression"; - SyntaxKind[SyntaxKind["PreIncrementExpression"] = 169] = "PreIncrementExpression"; - SyntaxKind[SyntaxKind["PreDecrementExpression"] = 170] = "PreDecrementExpression"; - SyntaxKind[SyntaxKind["DeleteExpression"] = 171] = "DeleteExpression"; - SyntaxKind[SyntaxKind["TypeOfExpression"] = 172] = "TypeOfExpression"; - SyntaxKind[SyntaxKind["VoidExpression"] = 173] = "VoidExpression"; - SyntaxKind[SyntaxKind["CommaExpression"] = 174] = "CommaExpression"; - SyntaxKind[SyntaxKind["AssignmentExpression"] = 175] = "AssignmentExpression"; - SyntaxKind[SyntaxKind["AddAssignmentExpression"] = 176] = "AddAssignmentExpression"; - SyntaxKind[SyntaxKind["SubtractAssignmentExpression"] = 177] = "SubtractAssignmentExpression"; - SyntaxKind[SyntaxKind["MultiplyAssignmentExpression"] = 178] = "MultiplyAssignmentExpression"; - SyntaxKind[SyntaxKind["DivideAssignmentExpression"] = 179] = "DivideAssignmentExpression"; - SyntaxKind[SyntaxKind["ModuloAssignmentExpression"] = 180] = "ModuloAssignmentExpression"; - SyntaxKind[SyntaxKind["AndAssignmentExpression"] = 181] = "AndAssignmentExpression"; - SyntaxKind[SyntaxKind["ExclusiveOrAssignmentExpression"] = 182] = "ExclusiveOrAssignmentExpression"; - SyntaxKind[SyntaxKind["OrAssignmentExpression"] = 183] = "OrAssignmentExpression"; - SyntaxKind[SyntaxKind["LeftShiftAssignmentExpression"] = 184] = "LeftShiftAssignmentExpression"; - SyntaxKind[SyntaxKind["SignedRightShiftAssignmentExpression"] = 185] = "SignedRightShiftAssignmentExpression"; - SyntaxKind[SyntaxKind["UnsignedRightShiftAssignmentExpression"] = 186] = "UnsignedRightShiftAssignmentExpression"; - SyntaxKind[SyntaxKind["ConditionalExpression"] = 187] = "ConditionalExpression"; - SyntaxKind[SyntaxKind["LogicalOrExpression"] = 188] = "LogicalOrExpression"; - SyntaxKind[SyntaxKind["LogicalAndExpression"] = 189] = "LogicalAndExpression"; - SyntaxKind[SyntaxKind["BitwiseOrExpression"] = 190] = "BitwiseOrExpression"; - SyntaxKind[SyntaxKind["BitwiseExclusiveOrExpression"] = 191] = "BitwiseExclusiveOrExpression"; - SyntaxKind[SyntaxKind["BitwiseAndExpression"] = 192] = "BitwiseAndExpression"; - SyntaxKind[SyntaxKind["EqualsWithTypeConversionExpression"] = 193] = "EqualsWithTypeConversionExpression"; - SyntaxKind[SyntaxKind["NotEqualsWithTypeConversionExpression"] = 194] = "NotEqualsWithTypeConversionExpression"; - SyntaxKind[SyntaxKind["EqualsExpression"] = 195] = "EqualsExpression"; - SyntaxKind[SyntaxKind["NotEqualsExpression"] = 196] = "NotEqualsExpression"; - SyntaxKind[SyntaxKind["LessThanExpression"] = 197] = "LessThanExpression"; - SyntaxKind[SyntaxKind["GreaterThanExpression"] = 198] = "GreaterThanExpression"; - SyntaxKind[SyntaxKind["LessThanOrEqualExpression"] = 199] = "LessThanOrEqualExpression"; - SyntaxKind[SyntaxKind["GreaterThanOrEqualExpression"] = 200] = "GreaterThanOrEqualExpression"; - SyntaxKind[SyntaxKind["InstanceOfExpression"] = 201] = "InstanceOfExpression"; - SyntaxKind[SyntaxKind["InExpression"] = 202] = "InExpression"; - SyntaxKind[SyntaxKind["LeftShiftExpression"] = 203] = "LeftShiftExpression"; - SyntaxKind[SyntaxKind["SignedRightShiftExpression"] = 204] = "SignedRightShiftExpression"; - SyntaxKind[SyntaxKind["UnsignedRightShiftExpression"] = 205] = "UnsignedRightShiftExpression"; - SyntaxKind[SyntaxKind["MultiplyExpression"] = 206] = "MultiplyExpression"; - SyntaxKind[SyntaxKind["DivideExpression"] = 207] = "DivideExpression"; - SyntaxKind[SyntaxKind["ModuloExpression"] = 208] = "ModuloExpression"; - SyntaxKind[SyntaxKind["AddExpression"] = 209] = "AddExpression"; - SyntaxKind[SyntaxKind["SubtractExpression"] = 210] = "SubtractExpression"; - SyntaxKind[SyntaxKind["PostIncrementExpression"] = 211] = "PostIncrementExpression"; - SyntaxKind[SyntaxKind["PostDecrementExpression"] = 212] = "PostDecrementExpression"; - SyntaxKind[SyntaxKind["MemberAccessExpression"] = 213] = "MemberAccessExpression"; - SyntaxKind[SyntaxKind["InvocationExpression"] = 214] = "InvocationExpression"; - SyntaxKind[SyntaxKind["ArrayLiteralExpression"] = 215] = "ArrayLiteralExpression"; - SyntaxKind[SyntaxKind["ObjectLiteralExpression"] = 216] = "ObjectLiteralExpression"; - SyntaxKind[SyntaxKind["ObjectCreationExpression"] = 217] = "ObjectCreationExpression"; - SyntaxKind[SyntaxKind["ParenthesizedExpression"] = 218] = "ParenthesizedExpression"; - SyntaxKind[SyntaxKind["ParenthesizedArrowFunctionExpression"] = 219] = "ParenthesizedArrowFunctionExpression"; - SyntaxKind[SyntaxKind["SimpleArrowFunctionExpression"] = 220] = "SimpleArrowFunctionExpression"; - SyntaxKind[SyntaxKind["CastExpression"] = 221] = "CastExpression"; - SyntaxKind[SyntaxKind["ElementAccessExpression"] = 222] = "ElementAccessExpression"; - SyntaxKind[SyntaxKind["FunctionExpression"] = 223] = "FunctionExpression"; - SyntaxKind[SyntaxKind["OmittedExpression"] = 224] = "OmittedExpression"; - SyntaxKind[SyntaxKind["VariableDeclaration"] = 225] = "VariableDeclaration"; - SyntaxKind[SyntaxKind["VariableDeclarator"] = 226] = "VariableDeclarator"; - SyntaxKind[SyntaxKind["ArgumentList"] = 227] = "ArgumentList"; - SyntaxKind[SyntaxKind["ParameterList"] = 228] = "ParameterList"; - SyntaxKind[SyntaxKind["TypeArgumentList"] = 229] = "TypeArgumentList"; - SyntaxKind[SyntaxKind["TypeParameterList"] = 230] = "TypeParameterList"; - SyntaxKind[SyntaxKind["ExtendsHeritageClause"] = 231] = "ExtendsHeritageClause"; - SyntaxKind[SyntaxKind["ImplementsHeritageClause"] = 232] = "ImplementsHeritageClause"; - SyntaxKind[SyntaxKind["EqualsValueClause"] = 233] = "EqualsValueClause"; - SyntaxKind[SyntaxKind["CaseSwitchClause"] = 234] = "CaseSwitchClause"; - SyntaxKind[SyntaxKind["DefaultSwitchClause"] = 235] = "DefaultSwitchClause"; - SyntaxKind[SyntaxKind["ElseClause"] = 236] = "ElseClause"; - SyntaxKind[SyntaxKind["CatchClause"] = 237] = "CatchClause"; - SyntaxKind[SyntaxKind["FinallyClause"] = 238] = "FinallyClause"; - SyntaxKind[SyntaxKind["TypeParameter"] = 239] = "TypeParameter"; - SyntaxKind[SyntaxKind["Constraint"] = 240] = "Constraint"; - SyntaxKind[SyntaxKind["SimplePropertyAssignment"] = 241] = "SimplePropertyAssignment"; - SyntaxKind[SyntaxKind["FunctionPropertyAssignment"] = 242] = "FunctionPropertyAssignment"; - SyntaxKind[SyntaxKind["Parameter"] = 243] = "Parameter"; - SyntaxKind[SyntaxKind["EnumElement"] = 244] = "EnumElement"; - SyntaxKind[SyntaxKind["TypeAnnotation"] = 245] = "TypeAnnotation"; - SyntaxKind[SyntaxKind["ExternalModuleReference"] = 246] = "ExternalModuleReference"; - SyntaxKind[SyntaxKind["ModuleNameModuleReference"] = 247] = "ModuleNameModuleReference"; + SyntaxKind[SyntaxKind["WhitespaceTrivia"] = 2] = "WhitespaceTrivia"; + SyntaxKind[SyntaxKind["NewLineTrivia"] = 3] = "NewLineTrivia"; + SyntaxKind[SyntaxKind["MultiLineCommentTrivia"] = 4] = "MultiLineCommentTrivia"; + SyntaxKind[SyntaxKind["SingleLineCommentTrivia"] = 5] = "SingleLineCommentTrivia"; + SyntaxKind[SyntaxKind["SkippedTokenTrivia"] = 6] = "SkippedTokenTrivia"; + SyntaxKind[SyntaxKind["ErrorToken"] = 7] = "ErrorToken"; + SyntaxKind[SyntaxKind["EndOfFileToken"] = 8] = "EndOfFileToken"; + SyntaxKind[SyntaxKind["IdentifierName"] = 9] = "IdentifierName"; + SyntaxKind[SyntaxKind["RegularExpressionLiteral"] = 10] = "RegularExpressionLiteral"; + SyntaxKind[SyntaxKind["NumericLiteral"] = 11] = "NumericLiteral"; + SyntaxKind[SyntaxKind["StringLiteral"] = 12] = "StringLiteral"; + SyntaxKind[SyntaxKind["NoSubstitutionTemplateToken"] = 13] = "NoSubstitutionTemplateToken"; + SyntaxKind[SyntaxKind["TemplateStartToken"] = 14] = "TemplateStartToken"; + SyntaxKind[SyntaxKind["TemplateMiddleToken"] = 15] = "TemplateMiddleToken"; + SyntaxKind[SyntaxKind["TemplateEndToken"] = 16] = "TemplateEndToken"; + SyntaxKind[SyntaxKind["BreakKeyword"] = 17] = "BreakKeyword"; + SyntaxKind[SyntaxKind["CaseKeyword"] = 18] = "CaseKeyword"; + SyntaxKind[SyntaxKind["CatchKeyword"] = 19] = "CatchKeyword"; + SyntaxKind[SyntaxKind["ContinueKeyword"] = 20] = "ContinueKeyword"; + SyntaxKind[SyntaxKind["DebuggerKeyword"] = 21] = "DebuggerKeyword"; + SyntaxKind[SyntaxKind["DefaultKeyword"] = 22] = "DefaultKeyword"; + SyntaxKind[SyntaxKind["DeleteKeyword"] = 23] = "DeleteKeyword"; + SyntaxKind[SyntaxKind["DoKeyword"] = 24] = "DoKeyword"; + SyntaxKind[SyntaxKind["ElseKeyword"] = 25] = "ElseKeyword"; + SyntaxKind[SyntaxKind["FalseKeyword"] = 26] = "FalseKeyword"; + SyntaxKind[SyntaxKind["FinallyKeyword"] = 27] = "FinallyKeyword"; + SyntaxKind[SyntaxKind["ForKeyword"] = 28] = "ForKeyword"; + SyntaxKind[SyntaxKind["FunctionKeyword"] = 29] = "FunctionKeyword"; + SyntaxKind[SyntaxKind["IfKeyword"] = 30] = "IfKeyword"; + SyntaxKind[SyntaxKind["InKeyword"] = 31] = "InKeyword"; + SyntaxKind[SyntaxKind["InstanceOfKeyword"] = 32] = "InstanceOfKeyword"; + SyntaxKind[SyntaxKind["NewKeyword"] = 33] = "NewKeyword"; + SyntaxKind[SyntaxKind["NullKeyword"] = 34] = "NullKeyword"; + SyntaxKind[SyntaxKind["ReturnKeyword"] = 35] = "ReturnKeyword"; + SyntaxKind[SyntaxKind["SwitchKeyword"] = 36] = "SwitchKeyword"; + SyntaxKind[SyntaxKind["ThisKeyword"] = 37] = "ThisKeyword"; + SyntaxKind[SyntaxKind["ThrowKeyword"] = 38] = "ThrowKeyword"; + SyntaxKind[SyntaxKind["TrueKeyword"] = 39] = "TrueKeyword"; + SyntaxKind[SyntaxKind["TryKeyword"] = 40] = "TryKeyword"; + SyntaxKind[SyntaxKind["TypeOfKeyword"] = 41] = "TypeOfKeyword"; + SyntaxKind[SyntaxKind["VarKeyword"] = 42] = "VarKeyword"; + SyntaxKind[SyntaxKind["VoidKeyword"] = 43] = "VoidKeyword"; + SyntaxKind[SyntaxKind["WhileKeyword"] = 44] = "WhileKeyword"; + SyntaxKind[SyntaxKind["WithKeyword"] = 45] = "WithKeyword"; + SyntaxKind[SyntaxKind["ClassKeyword"] = 46] = "ClassKeyword"; + SyntaxKind[SyntaxKind["ConstKeyword"] = 47] = "ConstKeyword"; + SyntaxKind[SyntaxKind["EnumKeyword"] = 48] = "EnumKeyword"; + SyntaxKind[SyntaxKind["ExportKeyword"] = 49] = "ExportKeyword"; + SyntaxKind[SyntaxKind["ExtendsKeyword"] = 50] = "ExtendsKeyword"; + SyntaxKind[SyntaxKind["ImportKeyword"] = 51] = "ImportKeyword"; + SyntaxKind[SyntaxKind["SuperKeyword"] = 52] = "SuperKeyword"; + SyntaxKind[SyntaxKind["ImplementsKeyword"] = 53] = "ImplementsKeyword"; + SyntaxKind[SyntaxKind["InterfaceKeyword"] = 54] = "InterfaceKeyword"; + SyntaxKind[SyntaxKind["LetKeyword"] = 55] = "LetKeyword"; + SyntaxKind[SyntaxKind["PackageKeyword"] = 56] = "PackageKeyword"; + SyntaxKind[SyntaxKind["PrivateKeyword"] = 57] = "PrivateKeyword"; + SyntaxKind[SyntaxKind["ProtectedKeyword"] = 58] = "ProtectedKeyword"; + SyntaxKind[SyntaxKind["PublicKeyword"] = 59] = "PublicKeyword"; + SyntaxKind[SyntaxKind["StaticKeyword"] = 60] = "StaticKeyword"; + SyntaxKind[SyntaxKind["YieldKeyword"] = 61] = "YieldKeyword"; + SyntaxKind[SyntaxKind["AnyKeyword"] = 62] = "AnyKeyword"; + SyntaxKind[SyntaxKind["BooleanKeyword"] = 63] = "BooleanKeyword"; + SyntaxKind[SyntaxKind["ConstructorKeyword"] = 64] = "ConstructorKeyword"; + SyntaxKind[SyntaxKind["DeclareKeyword"] = 65] = "DeclareKeyword"; + SyntaxKind[SyntaxKind["GetKeyword"] = 66] = "GetKeyword"; + SyntaxKind[SyntaxKind["ModuleKeyword"] = 67] = "ModuleKeyword"; + SyntaxKind[SyntaxKind["RequireKeyword"] = 68] = "RequireKeyword"; + SyntaxKind[SyntaxKind["NumberKeyword"] = 69] = "NumberKeyword"; + SyntaxKind[SyntaxKind["SetKeyword"] = 70] = "SetKeyword"; + SyntaxKind[SyntaxKind["StringKeyword"] = 71] = "StringKeyword"; + SyntaxKind[SyntaxKind["OpenBraceToken"] = 72] = "OpenBraceToken"; + SyntaxKind[SyntaxKind["CloseBraceToken"] = 73] = "CloseBraceToken"; + SyntaxKind[SyntaxKind["OpenParenToken"] = 74] = "OpenParenToken"; + SyntaxKind[SyntaxKind["CloseParenToken"] = 75] = "CloseParenToken"; + SyntaxKind[SyntaxKind["OpenBracketToken"] = 76] = "OpenBracketToken"; + SyntaxKind[SyntaxKind["CloseBracketToken"] = 77] = "CloseBracketToken"; + SyntaxKind[SyntaxKind["DotToken"] = 78] = "DotToken"; + SyntaxKind[SyntaxKind["DotDotDotToken"] = 79] = "DotDotDotToken"; + SyntaxKind[SyntaxKind["SemicolonToken"] = 80] = "SemicolonToken"; + SyntaxKind[SyntaxKind["CommaToken"] = 81] = "CommaToken"; + SyntaxKind[SyntaxKind["LessThanToken"] = 82] = "LessThanToken"; + SyntaxKind[SyntaxKind["GreaterThanToken"] = 83] = "GreaterThanToken"; + SyntaxKind[SyntaxKind["LessThanEqualsToken"] = 84] = "LessThanEqualsToken"; + SyntaxKind[SyntaxKind["GreaterThanEqualsToken"] = 85] = "GreaterThanEqualsToken"; + SyntaxKind[SyntaxKind["EqualsEqualsToken"] = 86] = "EqualsEqualsToken"; + SyntaxKind[SyntaxKind["EqualsGreaterThanToken"] = 87] = "EqualsGreaterThanToken"; + SyntaxKind[SyntaxKind["ExclamationEqualsToken"] = 88] = "ExclamationEqualsToken"; + SyntaxKind[SyntaxKind["EqualsEqualsEqualsToken"] = 89] = "EqualsEqualsEqualsToken"; + SyntaxKind[SyntaxKind["ExclamationEqualsEqualsToken"] = 90] = "ExclamationEqualsEqualsToken"; + SyntaxKind[SyntaxKind["PlusToken"] = 91] = "PlusToken"; + SyntaxKind[SyntaxKind["MinusToken"] = 92] = "MinusToken"; + SyntaxKind[SyntaxKind["AsteriskToken"] = 93] = "AsteriskToken"; + SyntaxKind[SyntaxKind["PercentToken"] = 94] = "PercentToken"; + SyntaxKind[SyntaxKind["PlusPlusToken"] = 95] = "PlusPlusToken"; + SyntaxKind[SyntaxKind["MinusMinusToken"] = 96] = "MinusMinusToken"; + SyntaxKind[SyntaxKind["LessThanLessThanToken"] = 97] = "LessThanLessThanToken"; + SyntaxKind[SyntaxKind["GreaterThanGreaterThanToken"] = 98] = "GreaterThanGreaterThanToken"; + SyntaxKind[SyntaxKind["GreaterThanGreaterThanGreaterThanToken"] = 99] = "GreaterThanGreaterThanGreaterThanToken"; + SyntaxKind[SyntaxKind["AmpersandToken"] = 100] = "AmpersandToken"; + SyntaxKind[SyntaxKind["BarToken"] = 101] = "BarToken"; + SyntaxKind[SyntaxKind["CaretToken"] = 102] = "CaretToken"; + SyntaxKind[SyntaxKind["ExclamationToken"] = 103] = "ExclamationToken"; + SyntaxKind[SyntaxKind["TildeToken"] = 104] = "TildeToken"; + SyntaxKind[SyntaxKind["AmpersandAmpersandToken"] = 105] = "AmpersandAmpersandToken"; + SyntaxKind[SyntaxKind["BarBarToken"] = 106] = "BarBarToken"; + SyntaxKind[SyntaxKind["QuestionToken"] = 107] = "QuestionToken"; + SyntaxKind[SyntaxKind["ColonToken"] = 108] = "ColonToken"; + SyntaxKind[SyntaxKind["EqualsToken"] = 109] = "EqualsToken"; + SyntaxKind[SyntaxKind["PlusEqualsToken"] = 110] = "PlusEqualsToken"; + SyntaxKind[SyntaxKind["MinusEqualsToken"] = 111] = "MinusEqualsToken"; + SyntaxKind[SyntaxKind["AsteriskEqualsToken"] = 112] = "AsteriskEqualsToken"; + SyntaxKind[SyntaxKind["PercentEqualsToken"] = 113] = "PercentEqualsToken"; + SyntaxKind[SyntaxKind["LessThanLessThanEqualsToken"] = 114] = "LessThanLessThanEqualsToken"; + SyntaxKind[SyntaxKind["GreaterThanGreaterThanEqualsToken"] = 115] = "GreaterThanGreaterThanEqualsToken"; + SyntaxKind[SyntaxKind["GreaterThanGreaterThanGreaterThanEqualsToken"] = 116] = "GreaterThanGreaterThanGreaterThanEqualsToken"; + SyntaxKind[SyntaxKind["AmpersandEqualsToken"] = 117] = "AmpersandEqualsToken"; + SyntaxKind[SyntaxKind["BarEqualsToken"] = 118] = "BarEqualsToken"; + SyntaxKind[SyntaxKind["CaretEqualsToken"] = 119] = "CaretEqualsToken"; + SyntaxKind[SyntaxKind["SlashToken"] = 120] = "SlashToken"; + SyntaxKind[SyntaxKind["SlashEqualsToken"] = 121] = "SlashEqualsToken"; + SyntaxKind[SyntaxKind["SourceUnit"] = 122] = "SourceUnit"; + SyntaxKind[SyntaxKind["QualifiedName"] = 123] = "QualifiedName"; + SyntaxKind[SyntaxKind["ObjectType"] = 124] = "ObjectType"; + SyntaxKind[SyntaxKind["FunctionType"] = 125] = "FunctionType"; + SyntaxKind[SyntaxKind["ArrayType"] = 126] = "ArrayType"; + SyntaxKind[SyntaxKind["ConstructorType"] = 127] = "ConstructorType"; + SyntaxKind[SyntaxKind["GenericType"] = 128] = "GenericType"; + SyntaxKind[SyntaxKind["TypeQuery"] = 129] = "TypeQuery"; + SyntaxKind[SyntaxKind["TupleType"] = 130] = "TupleType"; + SyntaxKind[SyntaxKind["UnionType"] = 131] = "UnionType"; + SyntaxKind[SyntaxKind["ParenthesizedType"] = 132] = "ParenthesizedType"; + SyntaxKind[SyntaxKind["InterfaceDeclaration"] = 133] = "InterfaceDeclaration"; + SyntaxKind[SyntaxKind["FunctionDeclaration"] = 134] = "FunctionDeclaration"; + SyntaxKind[SyntaxKind["ModuleDeclaration"] = 135] = "ModuleDeclaration"; + SyntaxKind[SyntaxKind["ClassDeclaration"] = 136] = "ClassDeclaration"; + SyntaxKind[SyntaxKind["EnumDeclaration"] = 137] = "EnumDeclaration"; + SyntaxKind[SyntaxKind["ImportDeclaration"] = 138] = "ImportDeclaration"; + SyntaxKind[SyntaxKind["ExportAssignment"] = 139] = "ExportAssignment"; + SyntaxKind[SyntaxKind["MemberFunctionDeclaration"] = 140] = "MemberFunctionDeclaration"; + SyntaxKind[SyntaxKind["MemberVariableDeclaration"] = 141] = "MemberVariableDeclaration"; + SyntaxKind[SyntaxKind["ConstructorDeclaration"] = 142] = "ConstructorDeclaration"; + SyntaxKind[SyntaxKind["IndexMemberDeclaration"] = 143] = "IndexMemberDeclaration"; + SyntaxKind[SyntaxKind["GetAccessor"] = 144] = "GetAccessor"; + SyntaxKind[SyntaxKind["SetAccessor"] = 145] = "SetAccessor"; + SyntaxKind[SyntaxKind["PropertySignature"] = 146] = "PropertySignature"; + SyntaxKind[SyntaxKind["CallSignature"] = 147] = "CallSignature"; + SyntaxKind[SyntaxKind["ConstructSignature"] = 148] = "ConstructSignature"; + SyntaxKind[SyntaxKind["IndexSignature"] = 149] = "IndexSignature"; + SyntaxKind[SyntaxKind["MethodSignature"] = 150] = "MethodSignature"; + SyntaxKind[SyntaxKind["Block"] = 151] = "Block"; + SyntaxKind[SyntaxKind["IfStatement"] = 152] = "IfStatement"; + SyntaxKind[SyntaxKind["VariableStatement"] = 153] = "VariableStatement"; + SyntaxKind[SyntaxKind["ExpressionStatement"] = 154] = "ExpressionStatement"; + SyntaxKind[SyntaxKind["ReturnStatement"] = 155] = "ReturnStatement"; + SyntaxKind[SyntaxKind["SwitchStatement"] = 156] = "SwitchStatement"; + SyntaxKind[SyntaxKind["BreakStatement"] = 157] = "BreakStatement"; + SyntaxKind[SyntaxKind["ContinueStatement"] = 158] = "ContinueStatement"; + SyntaxKind[SyntaxKind["ForStatement"] = 159] = "ForStatement"; + SyntaxKind[SyntaxKind["ForInStatement"] = 160] = "ForInStatement"; + SyntaxKind[SyntaxKind["EmptyStatement"] = 161] = "EmptyStatement"; + SyntaxKind[SyntaxKind["ThrowStatement"] = 162] = "ThrowStatement"; + SyntaxKind[SyntaxKind["WhileStatement"] = 163] = "WhileStatement"; + SyntaxKind[SyntaxKind["TryStatement"] = 164] = "TryStatement"; + SyntaxKind[SyntaxKind["LabeledStatement"] = 165] = "LabeledStatement"; + SyntaxKind[SyntaxKind["DoStatement"] = 166] = "DoStatement"; + SyntaxKind[SyntaxKind["DebuggerStatement"] = 167] = "DebuggerStatement"; + SyntaxKind[SyntaxKind["WithStatement"] = 168] = "WithStatement"; + SyntaxKind[SyntaxKind["PrefixUnaryExpression"] = 169] = "PrefixUnaryExpression"; + SyntaxKind[SyntaxKind["DeleteExpression"] = 170] = "DeleteExpression"; + SyntaxKind[SyntaxKind["TypeOfExpression"] = 171] = "TypeOfExpression"; + SyntaxKind[SyntaxKind["VoidExpression"] = 172] = "VoidExpression"; + SyntaxKind[SyntaxKind["ConditionalExpression"] = 173] = "ConditionalExpression"; + SyntaxKind[SyntaxKind["BinaryExpression"] = 174] = "BinaryExpression"; + SyntaxKind[SyntaxKind["PostfixUnaryExpression"] = 175] = "PostfixUnaryExpression"; + SyntaxKind[SyntaxKind["MemberAccessExpression"] = 176] = "MemberAccessExpression"; + SyntaxKind[SyntaxKind["InvocationExpression"] = 177] = "InvocationExpression"; + SyntaxKind[SyntaxKind["ArrayLiteralExpression"] = 178] = "ArrayLiteralExpression"; + SyntaxKind[SyntaxKind["ObjectLiteralExpression"] = 179] = "ObjectLiteralExpression"; + SyntaxKind[SyntaxKind["ObjectCreationExpression"] = 180] = "ObjectCreationExpression"; + SyntaxKind[SyntaxKind["ParenthesizedExpression"] = 181] = "ParenthesizedExpression"; + SyntaxKind[SyntaxKind["ParenthesizedArrowFunctionExpression"] = 182] = "ParenthesizedArrowFunctionExpression"; + SyntaxKind[SyntaxKind["SimpleArrowFunctionExpression"] = 183] = "SimpleArrowFunctionExpression"; + SyntaxKind[SyntaxKind["CastExpression"] = 184] = "CastExpression"; + SyntaxKind[SyntaxKind["ElementAccessExpression"] = 185] = "ElementAccessExpression"; + SyntaxKind[SyntaxKind["FunctionExpression"] = 186] = "FunctionExpression"; + SyntaxKind[SyntaxKind["OmittedExpression"] = 187] = "OmittedExpression"; + SyntaxKind[SyntaxKind["TemplateExpression"] = 188] = "TemplateExpression"; + SyntaxKind[SyntaxKind["TemplateAccessExpression"] = 189] = "TemplateAccessExpression"; + SyntaxKind[SyntaxKind["VariableDeclaration"] = 190] = "VariableDeclaration"; + SyntaxKind[SyntaxKind["VariableDeclarator"] = 191] = "VariableDeclarator"; + SyntaxKind[SyntaxKind["ArgumentList"] = 192] = "ArgumentList"; + SyntaxKind[SyntaxKind["ParameterList"] = 193] = "ParameterList"; + SyntaxKind[SyntaxKind["TypeArgumentList"] = 194] = "TypeArgumentList"; + SyntaxKind[SyntaxKind["TypeParameterList"] = 195] = "TypeParameterList"; + SyntaxKind[SyntaxKind["HeritageClause"] = 196] = "HeritageClause"; + SyntaxKind[SyntaxKind["EqualsValueClause"] = 197] = "EqualsValueClause"; + SyntaxKind[SyntaxKind["CaseSwitchClause"] = 198] = "CaseSwitchClause"; + SyntaxKind[SyntaxKind["DefaultSwitchClause"] = 199] = "DefaultSwitchClause"; + SyntaxKind[SyntaxKind["ElseClause"] = 200] = "ElseClause"; + SyntaxKind[SyntaxKind["CatchClause"] = 201] = "CatchClause"; + SyntaxKind[SyntaxKind["FinallyClause"] = 202] = "FinallyClause"; + SyntaxKind[SyntaxKind["TemplateClause"] = 203] = "TemplateClause"; + SyntaxKind[SyntaxKind["TypeParameter"] = 204] = "TypeParameter"; + SyntaxKind[SyntaxKind["Constraint"] = 205] = "Constraint"; + SyntaxKind[SyntaxKind["SimplePropertyAssignment"] = 206] = "SimplePropertyAssignment"; + SyntaxKind[SyntaxKind["FunctionPropertyAssignment"] = 207] = "FunctionPropertyAssignment"; + SyntaxKind[SyntaxKind["Parameter"] = 208] = "Parameter"; + SyntaxKind[SyntaxKind["EnumElement"] = 209] = "EnumElement"; + SyntaxKind[SyntaxKind["TypeAnnotation"] = 210] = "TypeAnnotation"; + SyntaxKind[SyntaxKind["ExternalModuleReference"] = 211] = "ExternalModuleReference"; + SyntaxKind[SyntaxKind["ModuleNameModuleReference"] = 212] = "ModuleNameModuleReference"; SyntaxKind[SyntaxKind["FirstStandardKeyword"] = SyntaxKind.BreakKeyword] = "FirstStandardKeyword"; SyntaxKind[SyntaxKind["LastStandardKeyword"] = SyntaxKind.WithKeyword] = "LastStandardKeyword"; SyntaxKind[SyntaxKind["FirstFutureReservedKeyword"] = SyntaxKind.ClassKeyword] = "FirstFutureReservedKeyword"; @@ -18159,111 +18619,111 @@ var TypeScript; var SyntaxFacts; (function (SyntaxFacts) { var textToKeywordKind = { - "any": 60 /* AnyKeyword */, - "boolean": 61 /* BooleanKeyword */, - "break": 15 /* BreakKeyword */, - "case": 16 /* CaseKeyword */, - "catch": 17 /* CatchKeyword */, - "class": 44 /* ClassKeyword */, - "continue": 18 /* ContinueKeyword */, - "const": 45 /* ConstKeyword */, - "constructor": 62 /* ConstructorKeyword */, - "debugger": 19 /* DebuggerKeyword */, - "declare": 63 /* DeclareKeyword */, - "default": 20 /* DefaultKeyword */, - "delete": 21 /* DeleteKeyword */, - "do": 22 /* DoKeyword */, - "else": 23 /* ElseKeyword */, - "enum": 46 /* EnumKeyword */, - "export": 47 /* ExportKeyword */, - "extends": 48 /* ExtendsKeyword */, - "false": 24 /* FalseKeyword */, - "finally": 25 /* FinallyKeyword */, - "for": 26 /* ForKeyword */, - "function": 27 /* FunctionKeyword */, - "get": 64 /* GetKeyword */, - "if": 28 /* IfKeyword */, - "implements": 51 /* ImplementsKeyword */, - "import": 49 /* ImportKeyword */, - "in": 29 /* InKeyword */, - "instanceof": 30 /* InstanceOfKeyword */, - "interface": 52 /* InterfaceKeyword */, - "let": 53 /* LetKeyword */, - "module": 65 /* ModuleKeyword */, - "new": 31 /* NewKeyword */, - "null": 32 /* NullKeyword */, - "number": 67 /* NumberKeyword */, - "package": 54 /* PackageKeyword */, - "private": 55 /* PrivateKeyword */, - "protected": 56 /* ProtectedKeyword */, - "public": 57 /* PublicKeyword */, - "require": 66 /* RequireKeyword */, - "return": 33 /* ReturnKeyword */, - "set": 68 /* SetKeyword */, - "static": 58 /* StaticKeyword */, - "string": 69 /* StringKeyword */, - "super": 50 /* SuperKeyword */, - "switch": 34 /* SwitchKeyword */, - "this": 35 /* ThisKeyword */, - "throw": 36 /* ThrowKeyword */, - "true": 37 /* TrueKeyword */, - "try": 38 /* TryKeyword */, - "typeof": 39 /* TypeOfKeyword */, - "var": 40 /* VarKeyword */, - "void": 41 /* VoidKeyword */, - "while": 42 /* WhileKeyword */, - "with": 43 /* WithKeyword */, - "yield": 59 /* YieldKeyword */, - "{": 70 /* OpenBraceToken */, - "}": 71 /* CloseBraceToken */, - "(": 72 /* OpenParenToken */, - ")": 73 /* CloseParenToken */, - "[": 74 /* OpenBracketToken */, - "]": 75 /* CloseBracketToken */, - ".": 76 /* DotToken */, - "...": 77 /* DotDotDotToken */, - ";": 78 /* SemicolonToken */, - ",": 79 /* CommaToken */, - "<": 80 /* LessThanToken */, - ">": 81 /* GreaterThanToken */, - "<=": 82 /* LessThanEqualsToken */, - ">=": 83 /* GreaterThanEqualsToken */, - "==": 84 /* EqualsEqualsToken */, - "=>": 85 /* EqualsGreaterThanToken */, - "!=": 86 /* ExclamationEqualsToken */, - "===": 87 /* EqualsEqualsEqualsToken */, - "!==": 88 /* ExclamationEqualsEqualsToken */, - "+": 89 /* PlusToken */, - "-": 90 /* MinusToken */, - "*": 91 /* AsteriskToken */, - "%": 92 /* PercentToken */, - "++": 93 /* PlusPlusToken */, - "--": 94 /* MinusMinusToken */, - "<<": 95 /* LessThanLessThanToken */, - ">>": 96 /* GreaterThanGreaterThanToken */, - ">>>": 97 /* GreaterThanGreaterThanGreaterThanToken */, - "&": 98 /* AmpersandToken */, - "|": 99 /* BarToken */, - "^": 100 /* CaretToken */, - "!": 101 /* ExclamationToken */, - "~": 102 /* TildeToken */, - "&&": 103 /* AmpersandAmpersandToken */, - "||": 104 /* BarBarToken */, - "?": 105 /* QuestionToken */, - ":": 106 /* ColonToken */, - "=": 107 /* EqualsToken */, - "+=": 108 /* PlusEqualsToken */, - "-=": 109 /* MinusEqualsToken */, - "*=": 110 /* AsteriskEqualsToken */, - "%=": 111 /* PercentEqualsToken */, - "<<=": 112 /* LessThanLessThanEqualsToken */, - ">>=": 113 /* GreaterThanGreaterThanEqualsToken */, - ">>>=": 114 /* GreaterThanGreaterThanGreaterThanEqualsToken */, - "&=": 115 /* AmpersandEqualsToken */, - "|=": 116 /* BarEqualsToken */, - "^=": 117 /* CaretEqualsToken */, - "/": 118 /* SlashToken */, - "/=": 119 /* SlashEqualsToken */ + "any": 62 /* AnyKeyword */, + "boolean": 63 /* BooleanKeyword */, + "break": 17 /* BreakKeyword */, + "case": 18 /* CaseKeyword */, + "catch": 19 /* CatchKeyword */, + "class": 46 /* ClassKeyword */, + "continue": 20 /* ContinueKeyword */, + "const": 47 /* ConstKeyword */, + "constructor": 64 /* ConstructorKeyword */, + "debugger": 21 /* DebuggerKeyword */, + "declare": 65 /* DeclareKeyword */, + "default": 22 /* DefaultKeyword */, + "delete": 23 /* DeleteKeyword */, + "do": 24 /* DoKeyword */, + "else": 25 /* ElseKeyword */, + "enum": 48 /* EnumKeyword */, + "export": 49 /* ExportKeyword */, + "extends": 50 /* ExtendsKeyword */, + "false": 26 /* FalseKeyword */, + "finally": 27 /* FinallyKeyword */, + "for": 28 /* ForKeyword */, + "function": 29 /* FunctionKeyword */, + "get": 66 /* GetKeyword */, + "if": 30 /* IfKeyword */, + "implements": 53 /* ImplementsKeyword */, + "import": 51 /* ImportKeyword */, + "in": 31 /* InKeyword */, + "instanceof": 32 /* InstanceOfKeyword */, + "interface": 54 /* InterfaceKeyword */, + "let": 55 /* LetKeyword */, + "module": 67 /* ModuleKeyword */, + "new": 33 /* NewKeyword */, + "null": 34 /* NullKeyword */, + "number": 69 /* NumberKeyword */, + "package": 56 /* PackageKeyword */, + "private": 57 /* PrivateKeyword */, + "protected": 58 /* ProtectedKeyword */, + "public": 59 /* PublicKeyword */, + "require": 68 /* RequireKeyword */, + "return": 35 /* ReturnKeyword */, + "set": 70 /* SetKeyword */, + "static": 60 /* StaticKeyword */, + "string": 71 /* StringKeyword */, + "super": 52 /* SuperKeyword */, + "switch": 36 /* SwitchKeyword */, + "this": 37 /* ThisKeyword */, + "throw": 38 /* ThrowKeyword */, + "true": 39 /* TrueKeyword */, + "try": 40 /* TryKeyword */, + "typeof": 41 /* TypeOfKeyword */, + "var": 42 /* VarKeyword */, + "void": 43 /* VoidKeyword */, + "while": 44 /* WhileKeyword */, + "with": 45 /* WithKeyword */, + "yield": 61 /* YieldKeyword */, + "{": 72 /* OpenBraceToken */, + "}": 73 /* CloseBraceToken */, + "(": 74 /* OpenParenToken */, + ")": 75 /* CloseParenToken */, + "[": 76 /* OpenBracketToken */, + "]": 77 /* CloseBracketToken */, + ".": 78 /* DotToken */, + "...": 79 /* DotDotDotToken */, + ";": 80 /* SemicolonToken */, + ",": 81 /* CommaToken */, + "<": 82 /* LessThanToken */, + ">": 83 /* GreaterThanToken */, + "<=": 84 /* LessThanEqualsToken */, + ">=": 85 /* GreaterThanEqualsToken */, + "==": 86 /* EqualsEqualsToken */, + "=>": 87 /* EqualsGreaterThanToken */, + "!=": 88 /* ExclamationEqualsToken */, + "===": 89 /* EqualsEqualsEqualsToken */, + "!==": 90 /* ExclamationEqualsEqualsToken */, + "+": 91 /* PlusToken */, + "-": 92 /* MinusToken */, + "*": 93 /* AsteriskToken */, + "%": 94 /* PercentToken */, + "++": 95 /* PlusPlusToken */, + "--": 96 /* MinusMinusToken */, + "<<": 97 /* LessThanLessThanToken */, + ">>": 98 /* GreaterThanGreaterThanToken */, + ">>>": 99 /* GreaterThanGreaterThanGreaterThanToken */, + "&": 100 /* AmpersandToken */, + "|": 101 /* BarToken */, + "^": 102 /* CaretToken */, + "!": 103 /* ExclamationToken */, + "~": 104 /* TildeToken */, + "&&": 105 /* AmpersandAmpersandToken */, + "||": 106 /* BarBarToken */, + "?": 107 /* QuestionToken */, + ":": 108 /* ColonToken */, + "=": 109 /* EqualsToken */, + "+=": 110 /* PlusEqualsToken */, + "-=": 111 /* MinusEqualsToken */, + "*=": 112 /* AsteriskEqualsToken */, + "%=": 113 /* PercentEqualsToken */, + "<<=": 114 /* LessThanLessThanEqualsToken */, + ">>=": 115 /* GreaterThanGreaterThanEqualsToken */, + ">>>=": 116 /* GreaterThanGreaterThanGreaterThanEqualsToken */, + "&=": 117 /* AmpersandEqualsToken */, + "|=": 118 /* BarEqualsToken */, + "^=": 119 /* CaretEqualsToken */, + "/": 120 /* SlashToken */, + "/=": 121 /* SlashEqualsToken */ }; var kindToText = new Array(); for (var name in textToKeywordKind) { @@ -18271,7 +18731,7 @@ var TypeScript; kindToText[textToKeywordKind[name]] = name; } } - kindToText[62 /* ConstructorKeyword */] = "constructor"; + kindToText[64 /* ConstructorKeyword */] = "constructor"; function getTokenKind(text) { if (textToKeywordKind.hasOwnProperty(text)) { return textToKeywordKind[text]; @@ -18281,7 +18741,7 @@ var TypeScript; SyntaxFacts.getTokenKind = getTokenKind; function getText(kind) { var result = kindToText[kind]; - return result !== undefined ? result : null; + return result; } SyntaxFacts.getText = getText; function isAnyKeyword(kind) { @@ -18293,215 +18753,77 @@ var TypeScript; } SyntaxFacts.isAnyPunctuation = isAnyPunctuation; function isPrefixUnaryExpressionOperatorToken(tokenKind) { - return getPrefixUnaryExpressionFromOperatorToken(tokenKind) !== 0 /* None */; + switch (tokenKind) { + case 91 /* PlusToken */: + case 92 /* MinusToken */: + case 104 /* TildeToken */: + case 103 /* ExclamationToken */: + case 95 /* PlusPlusToken */: + case 96 /* MinusMinusToken */: + return true; + default: + return false; + } } SyntaxFacts.isPrefixUnaryExpressionOperatorToken = isPrefixUnaryExpressionOperatorToken; function isBinaryExpressionOperatorToken(tokenKind) { - return getBinaryExpressionFromOperatorToken(tokenKind) !== 0 /* None */; + switch (tokenKind) { + case 93 /* AsteriskToken */: + case 120 /* SlashToken */: + case 94 /* PercentToken */: + case 91 /* PlusToken */: + case 92 /* MinusToken */: + case 97 /* LessThanLessThanToken */: + case 98 /* GreaterThanGreaterThanToken */: + case 99 /* GreaterThanGreaterThanGreaterThanToken */: + case 82 /* LessThanToken */: + case 83 /* GreaterThanToken */: + case 84 /* LessThanEqualsToken */: + case 85 /* GreaterThanEqualsToken */: + case 32 /* InstanceOfKeyword */: + case 31 /* InKeyword */: + case 86 /* EqualsEqualsToken */: + case 88 /* ExclamationEqualsToken */: + case 89 /* EqualsEqualsEqualsToken */: + case 90 /* ExclamationEqualsEqualsToken */: + case 100 /* AmpersandToken */: + case 102 /* CaretToken */: + case 101 /* BarToken */: + case 105 /* AmpersandAmpersandToken */: + case 106 /* BarBarToken */: + case 118 /* BarEqualsToken */: + case 117 /* AmpersandEqualsToken */: + case 119 /* CaretEqualsToken */: + case 114 /* LessThanLessThanEqualsToken */: + case 115 /* GreaterThanGreaterThanEqualsToken */: + case 116 /* GreaterThanGreaterThanGreaterThanEqualsToken */: + case 110 /* PlusEqualsToken */: + case 111 /* MinusEqualsToken */: + case 112 /* AsteriskEqualsToken */: + case 121 /* SlashEqualsToken */: + case 113 /* PercentEqualsToken */: + case 109 /* EqualsToken */: + case 81 /* CommaToken */: + return true; + default: + return false; + } } SyntaxFacts.isBinaryExpressionOperatorToken = isBinaryExpressionOperatorToken; - function getPrefixUnaryExpressionFromOperatorToken(tokenKind) { - switch (tokenKind) { - case 89 /* PlusToken */: - return 165 /* PlusExpression */; - case 90 /* MinusToken */: - return 166 /* NegateExpression */; - case 102 /* TildeToken */: - return 167 /* BitwiseNotExpression */; - case 101 /* ExclamationToken */: - return 168 /* LogicalNotExpression */; - case 93 /* PlusPlusToken */: - return 169 /* PreIncrementExpression */; - case 94 /* MinusMinusToken */: - return 170 /* PreDecrementExpression */; - default: - return 0 /* None */; - } - } - SyntaxFacts.getPrefixUnaryExpressionFromOperatorToken = getPrefixUnaryExpressionFromOperatorToken; - function getPostfixUnaryExpressionFromOperatorToken(tokenKind) { - switch (tokenKind) { - case 93 /* PlusPlusToken */: - return 211 /* PostIncrementExpression */; - case 94 /* MinusMinusToken */: - return 212 /* PostDecrementExpression */; - default: - return 0 /* None */; - } - } - SyntaxFacts.getPostfixUnaryExpressionFromOperatorToken = getPostfixUnaryExpressionFromOperatorToken; - function getBinaryExpressionFromOperatorToken(tokenKind) { - switch (tokenKind) { - case 91 /* AsteriskToken */: - return 206 /* MultiplyExpression */; - case 118 /* SlashToken */: - return 207 /* DivideExpression */; - case 92 /* PercentToken */: - return 208 /* ModuloExpression */; - case 89 /* PlusToken */: - return 209 /* AddExpression */; - case 90 /* MinusToken */: - return 210 /* SubtractExpression */; - case 95 /* LessThanLessThanToken */: - return 203 /* LeftShiftExpression */; - case 96 /* GreaterThanGreaterThanToken */: - return 204 /* SignedRightShiftExpression */; - case 97 /* GreaterThanGreaterThanGreaterThanToken */: - return 205 /* UnsignedRightShiftExpression */; - case 80 /* LessThanToken */: - return 197 /* LessThanExpression */; - case 81 /* GreaterThanToken */: - return 198 /* GreaterThanExpression */; - case 82 /* LessThanEqualsToken */: - return 199 /* LessThanOrEqualExpression */; - case 83 /* GreaterThanEqualsToken */: - return 200 /* GreaterThanOrEqualExpression */; - case 30 /* InstanceOfKeyword */: - return 201 /* InstanceOfExpression */; - case 29 /* InKeyword */: - return 202 /* InExpression */; - case 84 /* EqualsEqualsToken */: - return 193 /* EqualsWithTypeConversionExpression */; - case 86 /* ExclamationEqualsToken */: - return 194 /* NotEqualsWithTypeConversionExpression */; - case 87 /* EqualsEqualsEqualsToken */: - return 195 /* EqualsExpression */; - case 88 /* ExclamationEqualsEqualsToken */: - return 196 /* NotEqualsExpression */; - case 98 /* AmpersandToken */: - return 192 /* BitwiseAndExpression */; - case 100 /* CaretToken */: - return 191 /* BitwiseExclusiveOrExpression */; - case 99 /* BarToken */: - return 190 /* BitwiseOrExpression */; - case 103 /* AmpersandAmpersandToken */: - return 189 /* LogicalAndExpression */; - case 104 /* BarBarToken */: - return 188 /* LogicalOrExpression */; - case 116 /* BarEqualsToken */: - return 183 /* OrAssignmentExpression */; - case 115 /* AmpersandEqualsToken */: - return 181 /* AndAssignmentExpression */; - case 117 /* CaretEqualsToken */: - return 182 /* ExclusiveOrAssignmentExpression */; - case 112 /* LessThanLessThanEqualsToken */: - return 184 /* LeftShiftAssignmentExpression */; - case 113 /* GreaterThanGreaterThanEqualsToken */: - return 185 /* SignedRightShiftAssignmentExpression */; - case 114 /* GreaterThanGreaterThanGreaterThanEqualsToken */: - return 186 /* UnsignedRightShiftAssignmentExpression */; - case 108 /* PlusEqualsToken */: - return 176 /* AddAssignmentExpression */; - case 109 /* MinusEqualsToken */: - return 177 /* SubtractAssignmentExpression */; - case 110 /* AsteriskEqualsToken */: - return 178 /* MultiplyAssignmentExpression */; - case 119 /* SlashEqualsToken */: - return 179 /* DivideAssignmentExpression */; - case 111 /* PercentEqualsToken */: - return 180 /* ModuloAssignmentExpression */; - case 107 /* EqualsToken */: - return 175 /* AssignmentExpression */; - case 79 /* CommaToken */: - return 174 /* CommaExpression */; - default: - return 0 /* None */; - } - } - SyntaxFacts.getBinaryExpressionFromOperatorToken = getBinaryExpressionFromOperatorToken; - function getOperatorTokenFromBinaryExpression(tokenKind) { - switch (tokenKind) { - case 206 /* MultiplyExpression */: - return 91 /* AsteriskToken */; - case 207 /* DivideExpression */: - return 118 /* SlashToken */; - case 208 /* ModuloExpression */: - return 92 /* PercentToken */; - case 209 /* AddExpression */: - return 89 /* PlusToken */; - case 210 /* SubtractExpression */: - return 90 /* MinusToken */; - case 203 /* LeftShiftExpression */: - return 95 /* LessThanLessThanToken */; - case 204 /* SignedRightShiftExpression */: - return 96 /* GreaterThanGreaterThanToken */; - case 205 /* UnsignedRightShiftExpression */: - return 97 /* GreaterThanGreaterThanGreaterThanToken */; - case 197 /* LessThanExpression */: - return 80 /* LessThanToken */; - case 198 /* GreaterThanExpression */: - return 81 /* GreaterThanToken */; - case 199 /* LessThanOrEqualExpression */: - return 82 /* LessThanEqualsToken */; - case 200 /* GreaterThanOrEqualExpression */: - return 83 /* GreaterThanEqualsToken */; - case 201 /* InstanceOfExpression */: - return 30 /* InstanceOfKeyword */; - case 202 /* InExpression */: - return 29 /* InKeyword */; - case 193 /* EqualsWithTypeConversionExpression */: - return 84 /* EqualsEqualsToken */; - case 194 /* NotEqualsWithTypeConversionExpression */: - return 86 /* ExclamationEqualsToken */; - case 195 /* EqualsExpression */: - return 87 /* EqualsEqualsEqualsToken */; - case 196 /* NotEqualsExpression */: - return 88 /* ExclamationEqualsEqualsToken */; - case 192 /* BitwiseAndExpression */: - return 98 /* AmpersandToken */; - case 191 /* BitwiseExclusiveOrExpression */: - return 100 /* CaretToken */; - case 190 /* BitwiseOrExpression */: - return 99 /* BarToken */; - case 189 /* LogicalAndExpression */: - return 103 /* AmpersandAmpersandToken */; - case 188 /* LogicalOrExpression */: - return 104 /* BarBarToken */; - case 183 /* OrAssignmentExpression */: - return 116 /* BarEqualsToken */; - case 181 /* AndAssignmentExpression */: - return 115 /* AmpersandEqualsToken */; - case 182 /* ExclusiveOrAssignmentExpression */: - return 117 /* CaretEqualsToken */; - case 184 /* LeftShiftAssignmentExpression */: - return 112 /* LessThanLessThanEqualsToken */; - case 185 /* SignedRightShiftAssignmentExpression */: - return 113 /* GreaterThanGreaterThanEqualsToken */; - case 186 /* UnsignedRightShiftAssignmentExpression */: - return 114 /* GreaterThanGreaterThanGreaterThanEqualsToken */; - case 176 /* AddAssignmentExpression */: - return 108 /* PlusEqualsToken */; - case 177 /* SubtractAssignmentExpression */: - return 109 /* MinusEqualsToken */; - case 178 /* MultiplyAssignmentExpression */: - return 110 /* AsteriskEqualsToken */; - case 179 /* DivideAssignmentExpression */: - return 119 /* SlashEqualsToken */; - case 180 /* ModuloAssignmentExpression */: - return 111 /* PercentEqualsToken */; - case 175 /* AssignmentExpression */: - return 107 /* EqualsToken */; - case 174 /* CommaExpression */: - return 79 /* CommaToken */; - default: - return 0 /* None */; - } - } - SyntaxFacts.getOperatorTokenFromBinaryExpression = getOperatorTokenFromBinaryExpression; function isAssignmentOperatorToken(tokenKind) { switch (tokenKind) { - case 116 /* BarEqualsToken */: - case 115 /* AmpersandEqualsToken */: - case 117 /* CaretEqualsToken */: - case 112 /* LessThanLessThanEqualsToken */: - case 113 /* GreaterThanGreaterThanEqualsToken */: - case 114 /* GreaterThanGreaterThanGreaterThanEqualsToken */: - case 108 /* PlusEqualsToken */: - case 109 /* MinusEqualsToken */: - case 110 /* AsteriskEqualsToken */: - case 119 /* SlashEqualsToken */: - case 111 /* PercentEqualsToken */: - case 107 /* EqualsToken */: + case 118 /* BarEqualsToken */: + case 117 /* AmpersandEqualsToken */: + case 119 /* CaretEqualsToken */: + case 114 /* LessThanLessThanEqualsToken */: + case 115 /* GreaterThanGreaterThanEqualsToken */: + case 116 /* GreaterThanGreaterThanGreaterThanEqualsToken */: + case 110 /* PlusEqualsToken */: + case 111 /* MinusEqualsToken */: + case 112 /* AsteriskEqualsToken */: + case 121 /* SlashEqualsToken */: + case 113 /* PercentEqualsToken */: + case 109 /* EqualsToken */: return true; default: return false; @@ -18510,19 +18832,19 @@ var TypeScript; SyntaxFacts.isAssignmentOperatorToken = isAssignmentOperatorToken; function isType(kind) { switch (kind) { - case 124 /* ArrayType */: - case 60 /* AnyKeyword */: - case 67 /* NumberKeyword */: - case 61 /* BooleanKeyword */: - case 69 /* StringKeyword */: - case 41 /* VoidKeyword */: - case 123 /* FunctionType */: - case 122 /* ObjectType */: - case 125 /* ConstructorType */: - case 127 /* TypeQuery */: - case 126 /* GenericType */: - case 121 /* QualifiedName */: - case 11 /* IdentifierName */: + case 126 /* ArrayType */: + case 62 /* AnyKeyword */: + case 69 /* NumberKeyword */: + case 63 /* BooleanKeyword */: + case 71 /* StringKeyword */: + case 43 /* VoidKeyword */: + case 125 /* FunctionType */: + case 124 /* ObjectType */: + case 127 /* ConstructorType */: + case 129 /* TypeQuery */: + case 128 /* GenericType */: + case 123 /* QualifiedName */: + case 9 /* IdentifierName */: return true; } return false; @@ -18614,12 +18936,15 @@ var TypeScript; } function isContextualToken(token) { switch (token.kind()) { - case 12 /* RegularExpressionLiteral */: - case 96 /* GreaterThanGreaterThanToken */: - case 97 /* GreaterThanGreaterThanGreaterThanToken */: - case 83 /* GreaterThanEqualsToken */: - case 113 /* GreaterThanGreaterThanEqualsToken */: - case 114 /* GreaterThanGreaterThanGreaterThanEqualsToken */: + case 10 /* RegularExpressionLiteral */: + case 98 /* GreaterThanGreaterThanToken */: + case 99 /* GreaterThanGreaterThanGreaterThanToken */: + case 85 /* GreaterThanEqualsToken */: + case 115 /* GreaterThanGreaterThanEqualsToken */: + case 116 /* GreaterThanGreaterThanGreaterThanEqualsToken */: + return true; + case 15 /* TemplateMiddleToken */: + case 16 /* TemplateEndToken */: return true; default: return token.isKeywordConvertedToIdentifier(); @@ -18675,6 +19000,15 @@ var TypeScript; FixedWidthTokenWithNoTrivia.prototype.setFullStart = function (fullStart) { this._packedData = fixedWidthTokenPackData(fullStart, this.kind()); }; + FixedWidthTokenWithNoTrivia.prototype.childCount = function () { + return 0; + }; + FixedWidthTokenWithNoTrivia.prototype.childAt = function (index) { + throw TypeScript.Errors.invalidOperation(); + }; + FixedWidthTokenWithNoTrivia.prototype.accept = function (visitor) { + return visitor.visitToken(this); + }; FixedWidthTokenWithNoTrivia.prototype.isIncrementallyUnusable = function () { return false; }; @@ -18706,7 +19040,7 @@ var TypeScript; return this._packedData & 127 /* KindMask */; }; FixedWidthTokenWithNoTrivia.prototype.fullWidth = function () { - return this.fullText().length; + return fixedWidthTokenLength(this._packedData & 127 /* KindMask */); }; FixedWidthTokenWithNoTrivia.prototype.fullStart = function () { return fixedWidthTokenUnpackFullStart(this._packedData); @@ -18739,6 +19073,15 @@ var TypeScript; LargeScannerToken.prototype.setFullStart = function (fullStart) { this._packedFullStartAndInfo = largeTokenPackFullStartAndInfo(fullStart, largeTokenUnpackTriviaInfo(this._packedFullStartAndInfo)); }; + LargeScannerToken.prototype.childCount = function () { + return 0; + }; + LargeScannerToken.prototype.childAt = function (index) { + throw TypeScript.Errors.invalidOperation(); + }; + LargeScannerToken.prototype.accept = function (visitor) { + return visitor.visitToken(this); + }; LargeScannerToken.prototype.syntaxTreeText = function (text) { var result = text || TypeScript.syntaxTree(this).text; TypeScript.Debug.assert(result); @@ -19026,7 +19369,7 @@ var TypeScript; } break; } - return createTrivia(4 /* WhitespaceTrivia */, absoluteStartIndex); + return createTrivia(2 /* WhitespaceTrivia */, absoluteStartIndex); } function createTrivia(kind, absoluteStartIndex) { var fullWidth = index - absoluteStartIndex; @@ -19035,7 +19378,7 @@ var TypeScript; function scanSingleLineCommentTrivia() { var absoluteStartIndex = index; skipSingleLineCommentTrivia(); - return createTrivia(7 /* SingleLineCommentTrivia */, absoluteStartIndex); + return createTrivia(5 /* SingleLineCommentTrivia */, absoluteStartIndex); } function skipSingleLineCommentTrivia() { index += 2; @@ -19049,13 +19392,13 @@ var TypeScript; function scanMultiLineCommentTrivia() { var absoluteStartIndex = index; skipMultiLineCommentTrivia(); - return createTrivia(6 /* MultiLineCommentTrivia */, absoluteStartIndex); + return createTrivia(4 /* MultiLineCommentTrivia */, absoluteStartIndex); } function skipMultiLineCommentTrivia() { index += 2; while (true) { if (index === end) { - reportDiagnostic(end, 0, TypeScript.DiagnosticCode.AsteriskSlash_expected, null); + reportDiagnostic(end, 0, TypeScript.DiagnosticCode._0_expected, ["*/"]); return; } if ((index + 1) < end && str.charCodeAt(index) === 42 /* asterisk */ && str.charCodeAt(index + 1) === 47 /* slash */) { @@ -19068,7 +19411,7 @@ var TypeScript; function scanLineTerminatorSequenceTrivia(ch) { var absoluteStartIndex = index; skipLineTerminatorSequence(ch); - return createTrivia(5 /* NewLineTrivia */, absoluteStartIndex); + return createTrivia(3 /* NewLineTrivia */, absoluteStartIndex); } function skipLineTerminatorSequence(ch) { index++; @@ -19078,37 +19421,24 @@ var TypeScript; } function scanSyntaxKind(allowContextualToken) { if (index >= end) { - return 10 /* EndOfFileToken */; + return 8 /* EndOfFileToken */; } var character = str.charCodeAt(index); index++; switch (character) { - case 33 /* exclamation */: - return scanExclamationToken(); - case 34 /* doubleQuote */: - return scanStringLiteral(character); - case 37 /* percent */: - return scanPercentToken(); - case 38 /* ampersand */: - return scanAmpersandToken(); - case 39 /* singleQuote */: - return scanStringLiteral(character); - case 40 /* openParen */: - return 72 /* OpenParenToken */; - case 41 /* closeParen */: - return 73 /* CloseParenToken */; - case 42 /* asterisk */: - return scanAsteriskToken(); - case 43 /* plus */: - return scanPlusToken(); - case 44 /* comma */: - return 79 /* CommaToken */; - case 45 /* minus */: - return scanMinusToken(); - case 46 /* dot */: - return scanDotToken(); - case 47 /* slash */: - return scanSlashToken(allowContextualToken); + case 33 /* exclamation */: return scanExclamationToken(); + case 34 /* doubleQuote */: return scanStringLiteral(character); + case 37 /* percent */: return scanPercentToken(); + case 38 /* ampersand */: return scanAmpersandToken(); + case 39 /* singleQuote */: return scanStringLiteral(character); + case 40 /* openParen */: return 74 /* OpenParenToken */; + case 41 /* closeParen */: return 75 /* CloseParenToken */; + case 42 /* asterisk */: return scanAsteriskToken(); + case 43 /* plus */: return scanPlusToken(); + case 44 /* comma */: return 81 /* CommaToken */; + case 45 /* minus */: return scanMinusToken(); + case 46 /* dot */: return scanDotToken(); + case 47 /* slash */: return scanSlashToken(allowContextualToken); case 48 /* _0 */: case 49 /* _1 */: case 50 /* _2 */: @@ -19120,32 +19450,20 @@ var TypeScript; case 56 /* _8 */: case 57 /* _9 */: return scanNumericLiteral(character); - case 58 /* colon */: - return 106 /* ColonToken */; - case 59 /* semicolon */: - return 78 /* SemicolonToken */; - case 60 /* lessThan */: - return scanLessThanToken(); - case 61 /* equals */: - return scanEqualsToken(); - case 62 /* greaterThan */: - return scanGreaterThanToken(allowContextualToken); - case 63 /* question */: - return 105 /* QuestionToken */; - case 91 /* openBracket */: - return 74 /* OpenBracketToken */; - case 93 /* closeBracket */: - return 75 /* CloseBracketToken */; - case 94 /* caret */: - return scanCaretToken(); - case 123 /* openBrace */: - return 70 /* OpenBraceToken */; - case 124 /* bar */: - return scanBarToken(); - case 125 /* closeBrace */: - return 71 /* CloseBraceToken */; - case 126 /* tilde */: - return 102 /* TildeToken */; + case 58 /* colon */: return 108 /* ColonToken */; + case 59 /* semicolon */: return 80 /* SemicolonToken */; + case 60 /* lessThan */: return scanLessThanToken(); + case 61 /* equals */: return scanEqualsToken(); + case 62 /* greaterThan */: return scanGreaterThanToken(allowContextualToken); + case 63 /* question */: return 107 /* QuestionToken */; + case 91 /* openBracket */: return 76 /* OpenBracketToken */; + case 93 /* closeBracket */: return 77 /* CloseBracketToken */; + case 94 /* caret */: return scanCaretToken(); + case 96 /* backtick */: return scanTemplateToken(character); + case 123 /* openBrace */: return 72 /* OpenBraceToken */; + case 124 /* bar */: return scanBarToken(); + case 125 /* closeBrace */: return scanCloseBraceToken(allowContextualToken, character); + case 126 /* tilde */: return 104 /* TildeToken */; } if (isIdentifierStartCharacter[character]) { var result = tryFastScanIdentifierOrKeyword(character); @@ -19161,7 +19479,7 @@ var TypeScript; var messageText = getErrorMessageText(text); reportDiagnostic(index, 1, TypeScript.DiagnosticCode.Unexpected_character_0, [messageText]); index++; - return 9 /* ErrorToken */; + return 7 /* ErrorToken */; } function isIdentifierStart(interpretedChar) { if (isIdentifierStartCharacter[interpretedChar]) { @@ -19194,7 +19512,7 @@ var TypeScript; return TypeScript.ScannerUtilities.identifierKind(str, startIndex - 1, index - startIndex + 1); } else { - return 11 /* IdentifierName */; + return 9 /* IdentifierName */; } } } @@ -19210,7 +19528,7 @@ var TypeScript; if (keywordKind >= TypeScript.SyntaxKind.FirstKeyword && keywordKind <= TypeScript.SyntaxKind.LastKeyword) { return keywordKind | 128 /* IsVariableWidthMask */; } - return 11 /* IdentifierName */; + return 9 /* IdentifierName */; } function scanNumericLiteral(ch) { if (isHexNumericLiteral(ch)) { @@ -19222,7 +19540,7 @@ var TypeScript; else { scanDecimalNumericLiteral(); } - return 13 /* NumericLiteral */; + return 11 /* NumericLiteral */; } function isOctalNumericLiteral(ch) { return ch === 48 /* _0 */ && TypeScript.CharacterInfo.isOctalDigit(str.charCodeAt(index)); @@ -19233,7 +19551,7 @@ var TypeScript; index++; } if (languageVersion >= 1 /* ES5 */) { - reportDiagnostic(start, index - start, TypeScript.DiagnosticCode.Octal_literals_are_not_available_when_targeting_ECMAScript_5_and_higher, null); + reportDiagnostic(start, index - start, TypeScript.DiagnosticCode.Octal_literals_are_not_available_when_targeting_ECMAScript_5_and_higher, undefined); } } function scanDecimalDigits() { @@ -19285,20 +19603,20 @@ var TypeScript; var ch0 = str.charCodeAt(index); if (ch0 === 61 /* equals */) { index++; - return 82 /* LessThanEqualsToken */; + return 84 /* LessThanEqualsToken */; } else if (ch0 === 60 /* lessThan */) { index++; if (str.charCodeAt(index) === 61 /* equals */) { index++; - return 112 /* LessThanLessThanEqualsToken */; + return 114 /* LessThanLessThanEqualsToken */; } else { - return 95 /* LessThanLessThanToken */; + return 97 /* LessThanLessThanToken */; } } else { - return 80 /* LessThanToken */; + return 82 /* LessThanToken */; } } function scanGreaterThanToken(allowContextualToken) { @@ -19312,108 +19630,130 @@ var TypeScript; var ch2 = str.charCodeAt(index); if (ch2 === 61 /* equals */) { index++; - return 114 /* GreaterThanGreaterThanGreaterThanEqualsToken */; + return 116 /* GreaterThanGreaterThanGreaterThanEqualsToken */; } else { - return 97 /* GreaterThanGreaterThanGreaterThanToken */; + return 99 /* GreaterThanGreaterThanGreaterThanToken */; } } else if (ch1 === 61 /* equals */) { index++; - return 113 /* GreaterThanGreaterThanEqualsToken */; + return 115 /* GreaterThanGreaterThanEqualsToken */; } else { - return 96 /* GreaterThanGreaterThanToken */; + return 98 /* GreaterThanGreaterThanToken */; } } else if (ch0 === 61 /* equals */) { index++; - return 83 /* GreaterThanEqualsToken */; + return 85 /* GreaterThanEqualsToken */; } } - return 81 /* GreaterThanToken */; + return 83 /* GreaterThanToken */; } function scanBarToken() { var ch = str.charCodeAt(index); if (ch === 61 /* equals */) { index++; - return 116 /* BarEqualsToken */; + return 118 /* BarEqualsToken */; } else if (ch === 124 /* bar */) { index++; - return 104 /* BarBarToken */; + return 106 /* BarBarToken */; } else { - return 99 /* BarToken */; + return 101 /* BarToken */; } } function scanCaretToken() { if (str.charCodeAt(index) === 61 /* equals */) { index++; - return 117 /* CaretEqualsToken */; + return 119 /* CaretEqualsToken */; } else { - return 100 /* CaretToken */; + return 102 /* CaretToken */; } } + function scanCloseBraceToken(allowContextualToken, startChar) { + return allowContextualToken ? scanTemplateToken(startChar) : 73 /* CloseBraceToken */; + } + function scanTemplateToken(startChar) { + var startedWithBacktick = startChar === 96 /* backtick */; + while (true) { + if (index === end) { + reportDiagnostic(end, 0, TypeScript.DiagnosticCode._0_expected, ["`"]); + break; + } + var ch = str.charCodeAt(index); + index++; + if (ch === 96 /* backtick */) { + break; + } + if (ch === 36 /* $ */ && index < end && str.charCodeAt(index) === 123 /* openBrace */) { + index++; + return startedWithBacktick ? 14 /* TemplateStartToken */ : 15 /* TemplateMiddleToken */; + } + } + return startedWithBacktick ? 13 /* NoSubstitutionTemplateToken */ : 16 /* TemplateEndToken */; + } function scanAmpersandToken() { var character = str.charCodeAt(index); if (character === 61 /* equals */) { index++; - return 115 /* AmpersandEqualsToken */; + return 117 /* AmpersandEqualsToken */; } else if (character === 38 /* ampersand */) { index++; - return 103 /* AmpersandAmpersandToken */; + return 105 /* AmpersandAmpersandToken */; } else { - return 98 /* AmpersandToken */; + return 100 /* AmpersandToken */; } } function scanPercentToken() { if (str.charCodeAt(index) === 61 /* equals */) { index++; - return 111 /* PercentEqualsToken */; + return 113 /* PercentEqualsToken */; } else { - return 92 /* PercentToken */; + return 94 /* PercentToken */; } } function scanMinusToken() { var character = str.charCodeAt(index); if (character === 61 /* equals */) { index++; - return 109 /* MinusEqualsToken */; + return 111 /* MinusEqualsToken */; } else if (character === 45 /* minus */) { index++; - return 94 /* MinusMinusToken */; + return 96 /* MinusMinusToken */; } else { - return 90 /* MinusToken */; + return 92 /* MinusToken */; } } function scanPlusToken() { var character = str.charCodeAt(index); if (character === 61 /* equals */) { index++; - return 108 /* PlusEqualsToken */; + return 110 /* PlusEqualsToken */; } else if (character === 43 /* plus */) { index++; - return 93 /* PlusPlusToken */; + return 95 /* PlusPlusToken */; } else { - return 89 /* PlusToken */; + return 91 /* PlusToken */; } } function scanAsteriskToken() { if (str.charCodeAt(index) === 61 /* equals */) { index++; - return 110 /* AsteriskEqualsToken */; + return 112 /* AsteriskEqualsToken */; } else { - return 91 /* AsteriskToken */; + return 93 /* AsteriskToken */; } } function scanEqualsToken() { @@ -19422,32 +19762,32 @@ var TypeScript; index++; if (str.charCodeAt(index) === 61 /* equals */) { index++; - return 87 /* EqualsEqualsEqualsToken */; + return 89 /* EqualsEqualsEqualsToken */; } else { - return 84 /* EqualsEqualsToken */; + return 86 /* EqualsEqualsToken */; } } else if (character === 62 /* greaterThan */) { index++; - return 85 /* EqualsGreaterThanToken */; + return 87 /* EqualsGreaterThanToken */; } else { - return 107 /* EqualsToken */; + return 109 /* EqualsToken */; } } function scanDotToken() { var nextChar = str.charCodeAt(index); if (TypeScript.CharacterInfo.isDecimalDigit(nextChar)) { scanDecimalNumericLiteralAfterDot(); - return 13 /* NumericLiteral */; + return 11 /* NumericLiteral */; } if (nextChar === 46 /* dot */ && str.charCodeAt(index + 1) === 46 /* dot */) { index += 2; - return 77 /* DotDotDotToken */; + return 79 /* DotDotDotToken */; } else { - return 76 /* DotToken */; + return 78 /* DotToken */; } } function scanSlashToken(allowContextualToken) { @@ -19459,10 +19799,10 @@ var TypeScript; } if (str.charCodeAt(index) === 61 /* equals */) { index++; - return 119 /* SlashEqualsToken */; + return 121 /* SlashEqualsToken */; } else { - return 118 /* SlashToken */; + return 120 /* SlashToken */; } } function tryScanRegularExpressionToken() { @@ -19503,21 +19843,21 @@ var TypeScript; while (isIdentifierPartCharacter[str.charCodeAt(index)]) { index++; } - return 12 /* RegularExpressionLiteral */; + return 10 /* RegularExpressionLiteral */; } function scanExclamationToken() { if (str.charCodeAt(index) === 61 /* equals */) { index++; if (str.charCodeAt(index) === 61 /* equals */) { index++; - return 88 /* ExclamationEqualsEqualsToken */; + return 90 /* ExclamationEqualsEqualsToken */; } else { - return 86 /* ExclamationEqualsToken */; + return 88 /* ExclamationEqualsToken */; } } else { - return 101 /* ExclamationToken */; + return 103 /* ExclamationToken */; } } function getErrorMessageText(text) { @@ -19560,14 +19900,14 @@ var TypeScript; break; } else if (isNaN(ch) || isNewLineCharacter(ch)) { - reportDiagnostic(Math.min(index, end), 1, TypeScript.DiagnosticCode.Missing_close_quote_character, null); + reportDiagnostic(Math.min(index, end), 1, TypeScript.DiagnosticCode.Missing_close_quote_character, undefined); break; } else { index++; } } - return 14 /* StringLiteral */; + return 12 /* StringLiteral */; } function isUnicodeEscape(character) { return character === 92 /* backslash */ && str.charCodeAt(index + 1) === 117 /* u */; @@ -19607,7 +19947,7 @@ var TypeScript; var ch2 = str.charCodeAt(index); if (!TypeScript.CharacterInfo.isHexDigit(ch2)) { if (report) { - reportDiagnostic(start, index - start, TypeScript.DiagnosticCode.Unrecognized_escape_sequence, null); + reportDiagnostic(start, index - start, TypeScript.DiagnosticCode.Unrecognized_escape_sequence, undefined); } break; } @@ -19647,22 +19987,22 @@ var TypeScript; var _tokenDiagnostics = []; var rewindPointPool = []; var rewindPointPoolCount = 0; - var lastDiagnostic = null; + var lastDiagnostic = undefined; var reportDiagnostic = function (position, fullWidth, diagnosticKey, args) { lastDiagnostic = new TypeScript.Diagnostic(fileName, text.lineMap(), position, fullWidth, diagnosticKey, args); }; - var slidingWindow = new TypeScript.SlidingWindow(fetchNextItem, TypeScript.ArrayUtilities.createArray(1024, null), null); + var slidingWindow = new TypeScript.SlidingWindow(fetchNextItem, TypeScript.ArrayUtilities.createArray(1024, undefined), undefined); var scanner = createScanner(languageVersion, text, reportDiagnostic); function release() { - slidingWindow = null; - scanner = null; + slidingWindow = undefined; + scanner = undefined; _tokenDiagnostics = []; rewindPointPool = []; - lastDiagnostic = null; - reportDiagnostic = null; + lastDiagnostic = undefined; + reportDiagnostic = undefined; } function currentNode() { - return null; + return undefined; } function consumeNode(node) { throw TypeScript.Errors.invalidOperation(); @@ -19679,7 +20019,7 @@ var TypeScript; } rewindPointPoolCount--; var result = rewindPointPool[rewindPointPoolCount]; - rewindPointPool[rewindPointPoolCount] = null; + rewindPointPool[rewindPointPoolCount] = undefined; return result; } function getRewindPoint() { @@ -19700,11 +20040,11 @@ var TypeScript; } function fetchNextItem(allowContextualToken) { var token = scanner.scan(allowContextualToken); - if (lastDiagnostic === null) { + if (lastDiagnostic === undefined) { return token; } _tokenDiagnostics.push(lastDiagnostic); - lastDiagnostic = null; + lastDiagnostic = undefined; return TypeScript.Syntax.realizeToken(token, text); } function peekToken(n) { @@ -19723,12 +20063,12 @@ var TypeScript; var diagnostic = _tokenDiagnostics[tokenDiagnosticsLength - 1]; if (diagnostic.start() >= position) { tokenDiagnosticsLength--; + _tokenDiagnostics.pop(); } else { break; } } - _tokenDiagnostics.length = tokenDiagnosticsLength; } function resetToPosition(absolutePosition) { TypeScript.Debug.assert(absolutePosition <= text.length(), "Trying to set the position outside the bounds of the text!"); @@ -19762,227 +20102,371 @@ var TypeScript; }; } Scanner.createParserSource = createParserSource; + function fixedWidthTokenLength(kind) { + switch (kind) { + case 17 /* BreakKeyword */: return 5; + case 18 /* CaseKeyword */: return 4; + case 19 /* CatchKeyword */: return 5; + case 20 /* ContinueKeyword */: return 8; + case 21 /* DebuggerKeyword */: return 8; + case 22 /* DefaultKeyword */: return 7; + case 23 /* DeleteKeyword */: return 6; + case 24 /* DoKeyword */: return 2; + case 25 /* ElseKeyword */: return 4; + case 26 /* FalseKeyword */: return 5; + case 27 /* FinallyKeyword */: return 7; + case 28 /* ForKeyword */: return 3; + case 29 /* FunctionKeyword */: return 8; + case 30 /* IfKeyword */: return 2; + case 31 /* InKeyword */: return 2; + case 32 /* InstanceOfKeyword */: return 10; + case 33 /* NewKeyword */: return 3; + case 34 /* NullKeyword */: return 4; + case 35 /* ReturnKeyword */: return 6; + case 36 /* SwitchKeyword */: return 6; + case 37 /* ThisKeyword */: return 4; + case 38 /* ThrowKeyword */: return 5; + case 39 /* TrueKeyword */: return 4; + case 40 /* TryKeyword */: return 3; + case 41 /* TypeOfKeyword */: return 6; + case 42 /* VarKeyword */: return 3; + case 43 /* VoidKeyword */: return 4; + case 44 /* WhileKeyword */: return 5; + case 45 /* WithKeyword */: return 4; + case 46 /* ClassKeyword */: return 5; + case 47 /* ConstKeyword */: return 5; + case 48 /* EnumKeyword */: return 4; + case 49 /* ExportKeyword */: return 6; + case 50 /* ExtendsKeyword */: return 7; + case 51 /* ImportKeyword */: return 6; + case 52 /* SuperKeyword */: return 5; + case 53 /* ImplementsKeyword */: return 10; + case 54 /* InterfaceKeyword */: return 9; + case 55 /* LetKeyword */: return 3; + case 56 /* PackageKeyword */: return 7; + case 57 /* PrivateKeyword */: return 7; + case 58 /* ProtectedKeyword */: return 9; + case 59 /* PublicKeyword */: return 6; + case 60 /* StaticKeyword */: return 6; + case 61 /* YieldKeyword */: return 5; + case 62 /* AnyKeyword */: return 3; + case 63 /* BooleanKeyword */: return 7; + case 64 /* ConstructorKeyword */: return 11; + case 65 /* DeclareKeyword */: return 7; + case 66 /* GetKeyword */: return 3; + case 67 /* ModuleKeyword */: return 6; + case 68 /* RequireKeyword */: return 7; + case 69 /* NumberKeyword */: return 6; + case 70 /* SetKeyword */: return 3; + case 71 /* StringKeyword */: return 6; + case 72 /* OpenBraceToken */: return 1; + case 73 /* CloseBraceToken */: return 1; + case 74 /* OpenParenToken */: return 1; + case 75 /* CloseParenToken */: return 1; + case 76 /* OpenBracketToken */: return 1; + case 77 /* CloseBracketToken */: return 1; + case 78 /* DotToken */: return 1; + case 79 /* DotDotDotToken */: return 3; + case 80 /* SemicolonToken */: return 1; + case 81 /* CommaToken */: return 1; + case 82 /* LessThanToken */: return 1; + case 83 /* GreaterThanToken */: return 1; + case 84 /* LessThanEqualsToken */: return 2; + case 85 /* GreaterThanEqualsToken */: return 2; + case 86 /* EqualsEqualsToken */: return 2; + case 87 /* EqualsGreaterThanToken */: return 2; + case 88 /* ExclamationEqualsToken */: return 2; + case 89 /* EqualsEqualsEqualsToken */: return 3; + case 90 /* ExclamationEqualsEqualsToken */: return 3; + case 91 /* PlusToken */: return 1; + case 92 /* MinusToken */: return 1; + case 93 /* AsteriskToken */: return 1; + case 94 /* PercentToken */: return 1; + case 95 /* PlusPlusToken */: return 2; + case 96 /* MinusMinusToken */: return 2; + case 97 /* LessThanLessThanToken */: return 2; + case 98 /* GreaterThanGreaterThanToken */: return 2; + case 99 /* GreaterThanGreaterThanGreaterThanToken */: return 3; + case 100 /* AmpersandToken */: return 1; + case 101 /* BarToken */: return 1; + case 102 /* CaretToken */: return 1; + case 103 /* ExclamationToken */: return 1; + case 104 /* TildeToken */: return 1; + case 105 /* AmpersandAmpersandToken */: return 2; + case 106 /* BarBarToken */: return 2; + case 107 /* QuestionToken */: return 1; + case 108 /* ColonToken */: return 1; + case 109 /* EqualsToken */: return 1; + case 110 /* PlusEqualsToken */: return 2; + case 111 /* MinusEqualsToken */: return 2; + case 112 /* AsteriskEqualsToken */: return 2; + case 113 /* PercentEqualsToken */: return 2; + case 114 /* LessThanLessThanEqualsToken */: return 3; + case 115 /* GreaterThanGreaterThanEqualsToken */: return 3; + case 116 /* GreaterThanGreaterThanGreaterThanEqualsToken */: return 4; + case 117 /* AmpersandEqualsToken */: return 2; + case 118 /* BarEqualsToken */: return 2; + case 119 /* CaretEqualsToken */: return 2; + case 120 /* SlashToken */: return 1; + case 121 /* SlashEqualsToken */: return 2; + default: throw new Error(); + } + } })(Scanner = TypeScript.Scanner || (TypeScript.Scanner = {})); })(TypeScript || (TypeScript = {})); var TypeScript; (function (TypeScript) { - var ScannerUtilities = (function () { - function ScannerUtilities() { + var ScannerUtilities; + (function (ScannerUtilities) { + function fixedWidthTokenLength(kind) { + switch (kind) { + case 17 /* BreakKeyword */: return 5; + case 18 /* CaseKeyword */: return 4; + case 19 /* CatchKeyword */: return 5; + case 20 /* ContinueKeyword */: return 8; + case 21 /* DebuggerKeyword */: return 8; + case 22 /* DefaultKeyword */: return 7; + case 23 /* DeleteKeyword */: return 6; + case 24 /* DoKeyword */: return 2; + case 25 /* ElseKeyword */: return 4; + case 26 /* FalseKeyword */: return 5; + case 27 /* FinallyKeyword */: return 7; + case 28 /* ForKeyword */: return 3; + case 29 /* FunctionKeyword */: return 8; + case 30 /* IfKeyword */: return 2; + case 31 /* InKeyword */: return 2; + case 32 /* InstanceOfKeyword */: return 10; + case 33 /* NewKeyword */: return 3; + case 34 /* NullKeyword */: return 4; + case 35 /* ReturnKeyword */: return 6; + case 36 /* SwitchKeyword */: return 6; + case 37 /* ThisKeyword */: return 4; + case 38 /* ThrowKeyword */: return 5; + case 39 /* TrueKeyword */: return 4; + case 40 /* TryKeyword */: return 3; + case 41 /* TypeOfKeyword */: return 6; + case 42 /* VarKeyword */: return 3; + case 43 /* VoidKeyword */: return 4; + case 44 /* WhileKeyword */: return 5; + case 45 /* WithKeyword */: return 4; + case 46 /* ClassKeyword */: return 5; + case 47 /* ConstKeyword */: return 5; + case 48 /* EnumKeyword */: return 4; + case 49 /* ExportKeyword */: return 6; + case 50 /* ExtendsKeyword */: return 7; + case 51 /* ImportKeyword */: return 6; + case 52 /* SuperKeyword */: return 5; + case 53 /* ImplementsKeyword */: return 10; + case 54 /* InterfaceKeyword */: return 9; + case 55 /* LetKeyword */: return 3; + case 56 /* PackageKeyword */: return 7; + case 57 /* PrivateKeyword */: return 7; + case 58 /* ProtectedKeyword */: return 9; + case 59 /* PublicKeyword */: return 6; + case 60 /* StaticKeyword */: return 6; + case 61 /* YieldKeyword */: return 5; + case 62 /* AnyKeyword */: return 3; + case 63 /* BooleanKeyword */: return 7; + case 64 /* ConstructorKeyword */: return 11; + case 65 /* DeclareKeyword */: return 7; + case 66 /* GetKeyword */: return 3; + case 67 /* ModuleKeyword */: return 6; + case 68 /* RequireKeyword */: return 7; + case 69 /* NumberKeyword */: return 6; + case 70 /* SetKeyword */: return 3; + case 71 /* StringKeyword */: return 6; + case 72 /* OpenBraceToken */: return 1; + case 73 /* CloseBraceToken */: return 1; + case 74 /* OpenParenToken */: return 1; + case 75 /* CloseParenToken */: return 1; + case 76 /* OpenBracketToken */: return 1; + case 77 /* CloseBracketToken */: return 1; + case 78 /* DotToken */: return 1; + case 79 /* DotDotDotToken */: return 3; + case 80 /* SemicolonToken */: return 1; + case 81 /* CommaToken */: return 1; + case 82 /* LessThanToken */: return 1; + case 83 /* GreaterThanToken */: return 1; + case 84 /* LessThanEqualsToken */: return 2; + case 85 /* GreaterThanEqualsToken */: return 2; + case 86 /* EqualsEqualsToken */: return 2; + case 87 /* EqualsGreaterThanToken */: return 2; + case 88 /* ExclamationEqualsToken */: return 2; + case 89 /* EqualsEqualsEqualsToken */: return 3; + case 90 /* ExclamationEqualsEqualsToken */: return 3; + case 91 /* PlusToken */: return 1; + case 92 /* MinusToken */: return 1; + case 93 /* AsteriskToken */: return 1; + case 94 /* PercentToken */: return 1; + case 95 /* PlusPlusToken */: return 2; + case 96 /* MinusMinusToken */: return 2; + case 97 /* LessThanLessThanToken */: return 2; + case 98 /* GreaterThanGreaterThanToken */: return 2; + case 99 /* GreaterThanGreaterThanGreaterThanToken */: return 3; + case 100 /* AmpersandToken */: return 1; + case 101 /* BarToken */: return 1; + case 102 /* CaretToken */: return 1; + case 103 /* ExclamationToken */: return 1; + case 104 /* TildeToken */: return 1; + case 105 /* AmpersandAmpersandToken */: return 2; + case 106 /* BarBarToken */: return 2; + case 107 /* QuestionToken */: return 1; + case 108 /* ColonToken */: return 1; + case 109 /* EqualsToken */: return 1; + case 110 /* PlusEqualsToken */: return 2; + case 111 /* MinusEqualsToken */: return 2; + case 112 /* AsteriskEqualsToken */: return 2; + case 113 /* PercentEqualsToken */: return 2; + case 114 /* LessThanLessThanEqualsToken */: return 3; + case 115 /* GreaterThanGreaterThanEqualsToken */: return 3; + case 116 /* GreaterThanGreaterThanGreaterThanEqualsToken */: return 4; + case 117 /* AmpersandEqualsToken */: return 2; + case 118 /* BarEqualsToken */: return 2; + case 119 /* CaretEqualsToken */: return 2; + case 120 /* SlashToken */: return 1; + case 121 /* SlashEqualsToken */: return 2; + default: throw new Error(); + } } - ScannerUtilities.identifierKind = function (str, start, length) { + ScannerUtilities.fixedWidthTokenLength = fixedWidthTokenLength; + function identifierKind(str, start, length) { switch (length) { case 2: switch (str.charCodeAt(start)) { - case 100 /* d */: - return (str.charCodeAt(start + 1) === 111 /* o */) ? 22 /* DoKeyword */ : 11 /* IdentifierName */; + case 100 /* d */: return (str.charCodeAt(start + 1) === 111 /* o */) ? 24 /* DoKeyword */ : 9 /* IdentifierName */; case 105 /* i */: switch (str.charCodeAt(start + 1)) { - case 102 /* f */: - return 28 /* IfKeyword */; - case 110 /* n */: - return 29 /* InKeyword */; - default: - return 11 /* IdentifierName */; + case 102 /* f */: return 30 /* IfKeyword */; + case 110 /* n */: return 31 /* InKeyword */; + default: return 9 /* IdentifierName */; } - default: - return 11 /* IdentifierName */; + default: return 9 /* IdentifierName */; } case 3: switch (str.charCodeAt(start)) { - case 97 /* a */: - return (str.charCodeAt(start + 1) === 110 /* n */ && str.charCodeAt(start + 2) === 121 /* y */) ? 60 /* AnyKeyword */ : 11 /* IdentifierName */; - case 102 /* f */: - return (str.charCodeAt(start + 1) === 111 /* o */ && str.charCodeAt(start + 2) === 114 /* r */) ? 26 /* ForKeyword */ : 11 /* IdentifierName */; - case 103 /* g */: - return (str.charCodeAt(start + 1) === 101 /* e */ && str.charCodeAt(start + 2) === 116 /* t */) ? 64 /* GetKeyword */ : 11 /* IdentifierName */; - case 108 /* l */: - return (str.charCodeAt(start + 1) === 101 /* e */ && str.charCodeAt(start + 2) === 116 /* t */) ? 53 /* LetKeyword */ : 11 /* IdentifierName */; - case 110 /* n */: - return (str.charCodeAt(start + 1) === 101 /* e */ && str.charCodeAt(start + 2) === 119 /* w */) ? 31 /* NewKeyword */ : 11 /* IdentifierName */; - case 115 /* s */: - return (str.charCodeAt(start + 1) === 101 /* e */ && str.charCodeAt(start + 2) === 116 /* t */) ? 68 /* SetKeyword */ : 11 /* IdentifierName */; - case 116 /* t */: - return (str.charCodeAt(start + 1) === 114 /* r */ && str.charCodeAt(start + 2) === 121 /* y */) ? 38 /* TryKeyword */ : 11 /* IdentifierName */; - case 118 /* v */: - return (str.charCodeAt(start + 1) === 97 /* a */ && str.charCodeAt(start + 2) === 114 /* r */) ? 40 /* VarKeyword */ : 11 /* IdentifierName */; - default: - return 11 /* IdentifierName */; + case 97 /* a */: return (str.charCodeAt(start + 1) === 110 /* n */ && str.charCodeAt(start + 2) === 121 /* y */) ? 62 /* AnyKeyword */ : 9 /* IdentifierName */; + case 102 /* f */: return (str.charCodeAt(start + 1) === 111 /* o */ && str.charCodeAt(start + 2) === 114 /* r */) ? 28 /* ForKeyword */ : 9 /* IdentifierName */; + case 103 /* g */: return (str.charCodeAt(start + 1) === 101 /* e */ && str.charCodeAt(start + 2) === 116 /* t */) ? 66 /* GetKeyword */ : 9 /* IdentifierName */; + case 108 /* l */: return (str.charCodeAt(start + 1) === 101 /* e */ && str.charCodeAt(start + 2) === 116 /* t */) ? 55 /* LetKeyword */ : 9 /* IdentifierName */; + case 110 /* n */: return (str.charCodeAt(start + 1) === 101 /* e */ && str.charCodeAt(start + 2) === 119 /* w */) ? 33 /* NewKeyword */ : 9 /* IdentifierName */; + case 115 /* s */: return (str.charCodeAt(start + 1) === 101 /* e */ && str.charCodeAt(start + 2) === 116 /* t */) ? 70 /* SetKeyword */ : 9 /* IdentifierName */; + case 116 /* t */: return (str.charCodeAt(start + 1) === 114 /* r */ && str.charCodeAt(start + 2) === 121 /* y */) ? 40 /* TryKeyword */ : 9 /* IdentifierName */; + case 118 /* v */: return (str.charCodeAt(start + 1) === 97 /* a */ && str.charCodeAt(start + 2) === 114 /* r */) ? 42 /* VarKeyword */ : 9 /* IdentifierName */; + default: return 9 /* IdentifierName */; } case 4: switch (str.charCodeAt(start)) { - case 99 /* c */: - return (str.charCodeAt(start + 1) === 97 /* a */ && str.charCodeAt(start + 2) === 115 /* s */ && str.charCodeAt(start + 3) === 101 /* e */) ? 16 /* CaseKeyword */ : 11 /* IdentifierName */; + case 99 /* c */: return (str.charCodeAt(start + 1) === 97 /* a */ && str.charCodeAt(start + 2) === 115 /* s */ && str.charCodeAt(start + 3) === 101 /* e */) ? 18 /* CaseKeyword */ : 9 /* IdentifierName */; case 101 /* e */: switch (str.charCodeAt(start + 1)) { - case 108 /* l */: - return (str.charCodeAt(start + 2) === 115 /* s */ && str.charCodeAt(start + 3) === 101 /* e */) ? 23 /* ElseKeyword */ : 11 /* IdentifierName */; - case 110 /* n */: - return (str.charCodeAt(start + 2) === 117 /* u */ && str.charCodeAt(start + 3) === 109 /* m */) ? 46 /* EnumKeyword */ : 11 /* IdentifierName */; - default: - return 11 /* IdentifierName */; + case 108 /* l */: return (str.charCodeAt(start + 2) === 115 /* s */ && str.charCodeAt(start + 3) === 101 /* e */) ? 25 /* ElseKeyword */ : 9 /* IdentifierName */; + case 110 /* n */: return (str.charCodeAt(start + 2) === 117 /* u */ && str.charCodeAt(start + 3) === 109 /* m */) ? 48 /* EnumKeyword */ : 9 /* IdentifierName */; + default: return 9 /* IdentifierName */; } - case 110 /* n */: - return (str.charCodeAt(start + 1) === 117 /* u */ && str.charCodeAt(start + 2) === 108 /* l */ && str.charCodeAt(start + 3) === 108 /* l */) ? 32 /* NullKeyword */ : 11 /* IdentifierName */; + case 110 /* n */: return (str.charCodeAt(start + 1) === 117 /* u */ && str.charCodeAt(start + 2) === 108 /* l */ && str.charCodeAt(start + 3) === 108 /* l */) ? 34 /* NullKeyword */ : 9 /* IdentifierName */; case 116 /* t */: switch (str.charCodeAt(start + 1)) { - case 104 /* h */: - return (str.charCodeAt(start + 2) === 105 /* i */ && str.charCodeAt(start + 3) === 115 /* s */) ? 35 /* ThisKeyword */ : 11 /* IdentifierName */; - case 114 /* r */: - return (str.charCodeAt(start + 2) === 117 /* u */ && str.charCodeAt(start + 3) === 101 /* e */) ? 37 /* TrueKeyword */ : 11 /* IdentifierName */; - default: - return 11 /* IdentifierName */; + case 104 /* h */: return (str.charCodeAt(start + 2) === 105 /* i */ && str.charCodeAt(start + 3) === 115 /* s */) ? 37 /* ThisKeyword */ : 9 /* IdentifierName */; + case 114 /* r */: return (str.charCodeAt(start + 2) === 117 /* u */ && str.charCodeAt(start + 3) === 101 /* e */) ? 39 /* TrueKeyword */ : 9 /* IdentifierName */; + default: return 9 /* IdentifierName */; } - case 118 /* v */: - return (str.charCodeAt(start + 1) === 111 /* o */ && str.charCodeAt(start + 2) === 105 /* i */ && str.charCodeAt(start + 3) === 100 /* d */) ? 41 /* VoidKeyword */ : 11 /* IdentifierName */; - case 119 /* w */: - return (str.charCodeAt(start + 1) === 105 /* i */ && str.charCodeAt(start + 2) === 116 /* t */ && str.charCodeAt(start + 3) === 104 /* h */) ? 43 /* WithKeyword */ : 11 /* IdentifierName */; - default: - return 11 /* IdentifierName */; + case 118 /* v */: return (str.charCodeAt(start + 1) === 111 /* o */ && str.charCodeAt(start + 2) === 105 /* i */ && str.charCodeAt(start + 3) === 100 /* d */) ? 43 /* VoidKeyword */ : 9 /* IdentifierName */; + case 119 /* w */: return (str.charCodeAt(start + 1) === 105 /* i */ && str.charCodeAt(start + 2) === 116 /* t */ && str.charCodeAt(start + 3) === 104 /* h */) ? 45 /* WithKeyword */ : 9 /* IdentifierName */; + default: return 9 /* IdentifierName */; } case 5: switch (str.charCodeAt(start)) { - case 98 /* b */: - return (str.charCodeAt(start + 1) === 114 /* r */ && str.charCodeAt(start + 2) === 101 /* e */ && str.charCodeAt(start + 3) === 97 /* a */ && str.charCodeAt(start + 4) === 107 /* k */) ? 15 /* BreakKeyword */ : 11 /* IdentifierName */; + case 98 /* b */: return (str.charCodeAt(start + 1) === 114 /* r */ && str.charCodeAt(start + 2) === 101 /* e */ && str.charCodeAt(start + 3) === 97 /* a */ && str.charCodeAt(start + 4) === 107 /* k */) ? 17 /* BreakKeyword */ : 9 /* IdentifierName */; case 99 /* c */: switch (str.charCodeAt(start + 1)) { - case 97 /* a */: - return (str.charCodeAt(start + 2) === 116 /* t */ && str.charCodeAt(start + 3) === 99 /* c */ && str.charCodeAt(start + 4) === 104 /* h */) ? 17 /* CatchKeyword */ : 11 /* IdentifierName */; - case 108 /* l */: - return (str.charCodeAt(start + 2) === 97 /* a */ && str.charCodeAt(start + 3) === 115 /* s */ && str.charCodeAt(start + 4) === 115 /* s */) ? 44 /* ClassKeyword */ : 11 /* IdentifierName */; - case 111 /* o */: - return (str.charCodeAt(start + 2) === 110 /* n */ && str.charCodeAt(start + 3) === 115 /* s */ && str.charCodeAt(start + 4) === 116 /* t */) ? 45 /* ConstKeyword */ : 11 /* IdentifierName */; - default: - return 11 /* IdentifierName */; + case 97 /* a */: return (str.charCodeAt(start + 2) === 116 /* t */ && str.charCodeAt(start + 3) === 99 /* c */ && str.charCodeAt(start + 4) === 104 /* h */) ? 19 /* CatchKeyword */ : 9 /* IdentifierName */; + case 108 /* l */: return (str.charCodeAt(start + 2) === 97 /* a */ && str.charCodeAt(start + 3) === 115 /* s */ && str.charCodeAt(start + 4) === 115 /* s */) ? 46 /* ClassKeyword */ : 9 /* IdentifierName */; + case 111 /* o */: return (str.charCodeAt(start + 2) === 110 /* n */ && str.charCodeAt(start + 3) === 115 /* s */ && str.charCodeAt(start + 4) === 116 /* t */) ? 47 /* ConstKeyword */ : 9 /* IdentifierName */; + default: return 9 /* IdentifierName */; } - case 102 /* f */: - return (str.charCodeAt(start + 1) === 97 /* a */ && str.charCodeAt(start + 2) === 108 /* l */ && str.charCodeAt(start + 3) === 115 /* s */ && str.charCodeAt(start + 4) === 101 /* e */) ? 24 /* FalseKeyword */ : 11 /* IdentifierName */; - case 115 /* s */: - return (str.charCodeAt(start + 1) === 117 /* u */ && str.charCodeAt(start + 2) === 112 /* p */ && str.charCodeAt(start + 3) === 101 /* e */ && str.charCodeAt(start + 4) === 114 /* r */) ? 50 /* SuperKeyword */ : 11 /* IdentifierName */; - case 116 /* t */: - return (str.charCodeAt(start + 1) === 104 /* h */ && str.charCodeAt(start + 2) === 114 /* r */ && str.charCodeAt(start + 3) === 111 /* o */ && str.charCodeAt(start + 4) === 119 /* w */) ? 36 /* ThrowKeyword */ : 11 /* IdentifierName */; - case 119 /* w */: - return (str.charCodeAt(start + 1) === 104 /* h */ && str.charCodeAt(start + 2) === 105 /* i */ && str.charCodeAt(start + 3) === 108 /* l */ && str.charCodeAt(start + 4) === 101 /* e */) ? 42 /* WhileKeyword */ : 11 /* IdentifierName */; - case 121 /* y */: - return (str.charCodeAt(start + 1) === 105 /* i */ && str.charCodeAt(start + 2) === 101 /* e */ && str.charCodeAt(start + 3) === 108 /* l */ && str.charCodeAt(start + 4) === 100 /* d */) ? 59 /* YieldKeyword */ : 11 /* IdentifierName */; - default: - return 11 /* IdentifierName */; + case 102 /* f */: return (str.charCodeAt(start + 1) === 97 /* a */ && str.charCodeAt(start + 2) === 108 /* l */ && str.charCodeAt(start + 3) === 115 /* s */ && str.charCodeAt(start + 4) === 101 /* e */) ? 26 /* FalseKeyword */ : 9 /* IdentifierName */; + case 115 /* s */: return (str.charCodeAt(start + 1) === 117 /* u */ && str.charCodeAt(start + 2) === 112 /* p */ && str.charCodeAt(start + 3) === 101 /* e */ && str.charCodeAt(start + 4) === 114 /* r */) ? 52 /* SuperKeyword */ : 9 /* IdentifierName */; + case 116 /* t */: return (str.charCodeAt(start + 1) === 104 /* h */ && str.charCodeAt(start + 2) === 114 /* r */ && str.charCodeAt(start + 3) === 111 /* o */ && str.charCodeAt(start + 4) === 119 /* w */) ? 38 /* ThrowKeyword */ : 9 /* IdentifierName */; + case 119 /* w */: return (str.charCodeAt(start + 1) === 104 /* h */ && str.charCodeAt(start + 2) === 105 /* i */ && str.charCodeAt(start + 3) === 108 /* l */ && str.charCodeAt(start + 4) === 101 /* e */) ? 44 /* WhileKeyword */ : 9 /* IdentifierName */; + case 121 /* y */: return (str.charCodeAt(start + 1) === 105 /* i */ && str.charCodeAt(start + 2) === 101 /* e */ && str.charCodeAt(start + 3) === 108 /* l */ && str.charCodeAt(start + 4) === 100 /* d */) ? 61 /* YieldKeyword */ : 9 /* IdentifierName */; + default: return 9 /* IdentifierName */; } case 6: switch (str.charCodeAt(start)) { - case 100 /* d */: - return (str.charCodeAt(start + 1) === 101 /* e */ && str.charCodeAt(start + 2) === 108 /* l */ && str.charCodeAt(start + 3) === 101 /* e */ && str.charCodeAt(start + 4) === 116 /* t */ && str.charCodeAt(start + 5) === 101 /* e */) ? 21 /* DeleteKeyword */ : 11 /* IdentifierName */; - case 101 /* e */: - return (str.charCodeAt(start + 1) === 120 /* x */ && str.charCodeAt(start + 2) === 112 /* p */ && str.charCodeAt(start + 3) === 111 /* o */ && str.charCodeAt(start + 4) === 114 /* r */ && str.charCodeAt(start + 5) === 116 /* t */) ? 47 /* ExportKeyword */ : 11 /* IdentifierName */; - case 105 /* i */: - return (str.charCodeAt(start + 1) === 109 /* m */ && str.charCodeAt(start + 2) === 112 /* p */ && str.charCodeAt(start + 3) === 111 /* o */ && str.charCodeAt(start + 4) === 114 /* r */ && str.charCodeAt(start + 5) === 116 /* t */) ? 49 /* ImportKeyword */ : 11 /* IdentifierName */; - case 109 /* m */: - return (str.charCodeAt(start + 1) === 111 /* o */ && str.charCodeAt(start + 2) === 100 /* d */ && str.charCodeAt(start + 3) === 117 /* u */ && str.charCodeAt(start + 4) === 108 /* l */ && str.charCodeAt(start + 5) === 101 /* e */) ? 65 /* ModuleKeyword */ : 11 /* IdentifierName */; - case 110 /* n */: - return (str.charCodeAt(start + 1) === 117 /* u */ && str.charCodeAt(start + 2) === 109 /* m */ && str.charCodeAt(start + 3) === 98 /* b */ && str.charCodeAt(start + 4) === 101 /* e */ && str.charCodeAt(start + 5) === 114 /* r */) ? 67 /* NumberKeyword */ : 11 /* IdentifierName */; - case 112 /* p */: - return (str.charCodeAt(start + 1) === 117 /* u */ && str.charCodeAt(start + 2) === 98 /* b */ && str.charCodeAt(start + 3) === 108 /* l */ && str.charCodeAt(start + 4) === 105 /* i */ && str.charCodeAt(start + 5) === 99 /* c */) ? 57 /* PublicKeyword */ : 11 /* IdentifierName */; - case 114 /* r */: - return (str.charCodeAt(start + 1) === 101 /* e */ && str.charCodeAt(start + 2) === 116 /* t */ && str.charCodeAt(start + 3) === 117 /* u */ && str.charCodeAt(start + 4) === 114 /* r */ && str.charCodeAt(start + 5) === 110 /* n */) ? 33 /* ReturnKeyword */ : 11 /* IdentifierName */; + case 100 /* d */: return (str.charCodeAt(start + 1) === 101 /* e */ && str.charCodeAt(start + 2) === 108 /* l */ && str.charCodeAt(start + 3) === 101 /* e */ && str.charCodeAt(start + 4) === 116 /* t */ && str.charCodeAt(start + 5) === 101 /* e */) ? 23 /* DeleteKeyword */ : 9 /* IdentifierName */; + case 101 /* e */: return (str.charCodeAt(start + 1) === 120 /* x */ && str.charCodeAt(start + 2) === 112 /* p */ && str.charCodeAt(start + 3) === 111 /* o */ && str.charCodeAt(start + 4) === 114 /* r */ && str.charCodeAt(start + 5) === 116 /* t */) ? 49 /* ExportKeyword */ : 9 /* IdentifierName */; + case 105 /* i */: return (str.charCodeAt(start + 1) === 109 /* m */ && str.charCodeAt(start + 2) === 112 /* p */ && str.charCodeAt(start + 3) === 111 /* o */ && str.charCodeAt(start + 4) === 114 /* r */ && str.charCodeAt(start + 5) === 116 /* t */) ? 51 /* ImportKeyword */ : 9 /* IdentifierName */; + case 109 /* m */: return (str.charCodeAt(start + 1) === 111 /* o */ && str.charCodeAt(start + 2) === 100 /* d */ && str.charCodeAt(start + 3) === 117 /* u */ && str.charCodeAt(start + 4) === 108 /* l */ && str.charCodeAt(start + 5) === 101 /* e */) ? 67 /* ModuleKeyword */ : 9 /* IdentifierName */; + case 110 /* n */: return (str.charCodeAt(start + 1) === 117 /* u */ && str.charCodeAt(start + 2) === 109 /* m */ && str.charCodeAt(start + 3) === 98 /* b */ && str.charCodeAt(start + 4) === 101 /* e */ && str.charCodeAt(start + 5) === 114 /* r */) ? 69 /* NumberKeyword */ : 9 /* IdentifierName */; + case 112 /* p */: return (str.charCodeAt(start + 1) === 117 /* u */ && str.charCodeAt(start + 2) === 98 /* b */ && str.charCodeAt(start + 3) === 108 /* l */ && str.charCodeAt(start + 4) === 105 /* i */ && str.charCodeAt(start + 5) === 99 /* c */) ? 59 /* PublicKeyword */ : 9 /* IdentifierName */; + case 114 /* r */: return (str.charCodeAt(start + 1) === 101 /* e */ && str.charCodeAt(start + 2) === 116 /* t */ && str.charCodeAt(start + 3) === 117 /* u */ && str.charCodeAt(start + 4) === 114 /* r */ && str.charCodeAt(start + 5) === 110 /* n */) ? 35 /* ReturnKeyword */ : 9 /* IdentifierName */; case 115 /* s */: switch (str.charCodeAt(start + 1)) { case 116 /* t */: switch (str.charCodeAt(start + 2)) { - case 97 /* a */: - return (str.charCodeAt(start + 3) === 116 /* t */ && str.charCodeAt(start + 4) === 105 /* i */ && str.charCodeAt(start + 5) === 99 /* c */) ? 58 /* StaticKeyword */ : 11 /* IdentifierName */; - case 114 /* r */: - return (str.charCodeAt(start + 3) === 105 /* i */ && str.charCodeAt(start + 4) === 110 /* n */ && str.charCodeAt(start + 5) === 103 /* g */) ? 69 /* StringKeyword */ : 11 /* IdentifierName */; - default: - return 11 /* IdentifierName */; + case 97 /* a */: return (str.charCodeAt(start + 3) === 116 /* t */ && str.charCodeAt(start + 4) === 105 /* i */ && str.charCodeAt(start + 5) === 99 /* c */) ? 60 /* StaticKeyword */ : 9 /* IdentifierName */; + case 114 /* r */: return (str.charCodeAt(start + 3) === 105 /* i */ && str.charCodeAt(start + 4) === 110 /* n */ && str.charCodeAt(start + 5) === 103 /* g */) ? 71 /* StringKeyword */ : 9 /* IdentifierName */; + default: return 9 /* IdentifierName */; } - case 119 /* w */: - return (str.charCodeAt(start + 2) === 105 /* i */ && str.charCodeAt(start + 3) === 116 /* t */ && str.charCodeAt(start + 4) === 99 /* c */ && str.charCodeAt(start + 5) === 104 /* h */) ? 34 /* SwitchKeyword */ : 11 /* IdentifierName */; - default: - return 11 /* IdentifierName */; + case 119 /* w */: return (str.charCodeAt(start + 2) === 105 /* i */ && str.charCodeAt(start + 3) === 116 /* t */ && str.charCodeAt(start + 4) === 99 /* c */ && str.charCodeAt(start + 5) === 104 /* h */) ? 36 /* SwitchKeyword */ : 9 /* IdentifierName */; + default: return 9 /* IdentifierName */; } - case 116 /* t */: - return (str.charCodeAt(start + 1) === 121 /* y */ && str.charCodeAt(start + 2) === 112 /* p */ && str.charCodeAt(start + 3) === 101 /* e */ && str.charCodeAt(start + 4) === 111 /* o */ && str.charCodeAt(start + 5) === 102 /* f */) ? 39 /* TypeOfKeyword */ : 11 /* IdentifierName */; - default: - return 11 /* IdentifierName */; + case 116 /* t */: return (str.charCodeAt(start + 1) === 121 /* y */ && str.charCodeAt(start + 2) === 112 /* p */ && str.charCodeAt(start + 3) === 101 /* e */ && str.charCodeAt(start + 4) === 111 /* o */ && str.charCodeAt(start + 5) === 102 /* f */) ? 41 /* TypeOfKeyword */ : 9 /* IdentifierName */; + default: return 9 /* IdentifierName */; } case 7: switch (str.charCodeAt(start)) { - case 98 /* b */: - return (str.charCodeAt(start + 1) === 111 /* o */ && str.charCodeAt(start + 2) === 111 /* o */ && str.charCodeAt(start + 3) === 108 /* l */ && str.charCodeAt(start + 4) === 101 /* e */ && str.charCodeAt(start + 5) === 97 /* a */ && str.charCodeAt(start + 6) === 110 /* n */) ? 61 /* BooleanKeyword */ : 11 /* IdentifierName */; + case 98 /* b */: return (str.charCodeAt(start + 1) === 111 /* o */ && str.charCodeAt(start + 2) === 111 /* o */ && str.charCodeAt(start + 3) === 108 /* l */ && str.charCodeAt(start + 4) === 101 /* e */ && str.charCodeAt(start + 5) === 97 /* a */ && str.charCodeAt(start + 6) === 110 /* n */) ? 63 /* BooleanKeyword */ : 9 /* IdentifierName */; case 100 /* d */: switch (str.charCodeAt(start + 1)) { case 101 /* e */: switch (str.charCodeAt(start + 2)) { - case 99 /* c */: - return (str.charCodeAt(start + 3) === 108 /* l */ && str.charCodeAt(start + 4) === 97 /* a */ && str.charCodeAt(start + 5) === 114 /* r */ && str.charCodeAt(start + 6) === 101 /* e */) ? 63 /* DeclareKeyword */ : 11 /* IdentifierName */; - case 102 /* f */: - return (str.charCodeAt(start + 3) === 97 /* a */ && str.charCodeAt(start + 4) === 117 /* u */ && str.charCodeAt(start + 5) === 108 /* l */ && str.charCodeAt(start + 6) === 116 /* t */) ? 20 /* DefaultKeyword */ : 11 /* IdentifierName */; - default: - return 11 /* IdentifierName */; + case 99 /* c */: return (str.charCodeAt(start + 3) === 108 /* l */ && str.charCodeAt(start + 4) === 97 /* a */ && str.charCodeAt(start + 5) === 114 /* r */ && str.charCodeAt(start + 6) === 101 /* e */) ? 65 /* DeclareKeyword */ : 9 /* IdentifierName */; + case 102 /* f */: return (str.charCodeAt(start + 3) === 97 /* a */ && str.charCodeAt(start + 4) === 117 /* u */ && str.charCodeAt(start + 5) === 108 /* l */ && str.charCodeAt(start + 6) === 116 /* t */) ? 22 /* DefaultKeyword */ : 9 /* IdentifierName */; + default: return 9 /* IdentifierName */; } - default: - return 11 /* IdentifierName */; + default: return 9 /* IdentifierName */; } - case 101 /* e */: - return (str.charCodeAt(start + 1) === 120 /* x */ && str.charCodeAt(start + 2) === 116 /* t */ && str.charCodeAt(start + 3) === 101 /* e */ && str.charCodeAt(start + 4) === 110 /* n */ && str.charCodeAt(start + 5) === 100 /* d */ && str.charCodeAt(start + 6) === 115 /* s */) ? 48 /* ExtendsKeyword */ : 11 /* IdentifierName */; - case 102 /* f */: - return (str.charCodeAt(start + 1) === 105 /* i */ && str.charCodeAt(start + 2) === 110 /* n */ && str.charCodeAt(start + 3) === 97 /* a */ && str.charCodeAt(start + 4) === 108 /* l */ && str.charCodeAt(start + 5) === 108 /* l */ && str.charCodeAt(start + 6) === 121 /* y */) ? 25 /* FinallyKeyword */ : 11 /* IdentifierName */; + case 101 /* e */: return (str.charCodeAt(start + 1) === 120 /* x */ && str.charCodeAt(start + 2) === 116 /* t */ && str.charCodeAt(start + 3) === 101 /* e */ && str.charCodeAt(start + 4) === 110 /* n */ && str.charCodeAt(start + 5) === 100 /* d */ && str.charCodeAt(start + 6) === 115 /* s */) ? 50 /* ExtendsKeyword */ : 9 /* IdentifierName */; + case 102 /* f */: return (str.charCodeAt(start + 1) === 105 /* i */ && str.charCodeAt(start + 2) === 110 /* n */ && str.charCodeAt(start + 3) === 97 /* a */ && str.charCodeAt(start + 4) === 108 /* l */ && str.charCodeAt(start + 5) === 108 /* l */ && str.charCodeAt(start + 6) === 121 /* y */) ? 27 /* FinallyKeyword */ : 9 /* IdentifierName */; case 112 /* p */: switch (str.charCodeAt(start + 1)) { - case 97 /* a */: - return (str.charCodeAt(start + 2) === 99 /* c */ && str.charCodeAt(start + 3) === 107 /* k */ && str.charCodeAt(start + 4) === 97 /* a */ && str.charCodeAt(start + 5) === 103 /* g */ && str.charCodeAt(start + 6) === 101 /* e */) ? 54 /* PackageKeyword */ : 11 /* IdentifierName */; - case 114 /* r */: - return (str.charCodeAt(start + 2) === 105 /* i */ && str.charCodeAt(start + 3) === 118 /* v */ && str.charCodeAt(start + 4) === 97 /* a */ && str.charCodeAt(start + 5) === 116 /* t */ && str.charCodeAt(start + 6) === 101 /* e */) ? 55 /* PrivateKeyword */ : 11 /* IdentifierName */; - default: - return 11 /* IdentifierName */; + case 97 /* a */: return (str.charCodeAt(start + 2) === 99 /* c */ && str.charCodeAt(start + 3) === 107 /* k */ && str.charCodeAt(start + 4) === 97 /* a */ && str.charCodeAt(start + 5) === 103 /* g */ && str.charCodeAt(start + 6) === 101 /* e */) ? 56 /* PackageKeyword */ : 9 /* IdentifierName */; + case 114 /* r */: return (str.charCodeAt(start + 2) === 105 /* i */ && str.charCodeAt(start + 3) === 118 /* v */ && str.charCodeAt(start + 4) === 97 /* a */ && str.charCodeAt(start + 5) === 116 /* t */ && str.charCodeAt(start + 6) === 101 /* e */) ? 57 /* PrivateKeyword */ : 9 /* IdentifierName */; + default: return 9 /* IdentifierName */; } - case 114 /* r */: - return (str.charCodeAt(start + 1) === 101 /* e */ && str.charCodeAt(start + 2) === 113 /* q */ && str.charCodeAt(start + 3) === 117 /* u */ && str.charCodeAt(start + 4) === 105 /* i */ && str.charCodeAt(start + 5) === 114 /* r */ && str.charCodeAt(start + 6) === 101 /* e */) ? 66 /* RequireKeyword */ : 11 /* IdentifierName */; - default: - return 11 /* IdentifierName */; + case 114 /* r */: return (str.charCodeAt(start + 1) === 101 /* e */ && str.charCodeAt(start + 2) === 113 /* q */ && str.charCodeAt(start + 3) === 117 /* u */ && str.charCodeAt(start + 4) === 105 /* i */ && str.charCodeAt(start + 5) === 114 /* r */ && str.charCodeAt(start + 6) === 101 /* e */) ? 68 /* RequireKeyword */ : 9 /* IdentifierName */; + default: return 9 /* IdentifierName */; } case 8: switch (str.charCodeAt(start)) { - case 99 /* c */: - return (str.charCodeAt(start + 1) === 111 /* o */ && str.charCodeAt(start + 2) === 110 /* n */ && str.charCodeAt(start + 3) === 116 /* t */ && str.charCodeAt(start + 4) === 105 /* i */ && str.charCodeAt(start + 5) === 110 /* n */ && str.charCodeAt(start + 6) === 117 /* u */ && str.charCodeAt(start + 7) === 101 /* e */) ? 18 /* ContinueKeyword */ : 11 /* IdentifierName */; - case 100 /* d */: - return (str.charCodeAt(start + 1) === 101 /* e */ && str.charCodeAt(start + 2) === 98 /* b */ && str.charCodeAt(start + 3) === 117 /* u */ && str.charCodeAt(start + 4) === 103 /* g */ && str.charCodeAt(start + 5) === 103 /* g */ && str.charCodeAt(start + 6) === 101 /* e */ && str.charCodeAt(start + 7) === 114 /* r */) ? 19 /* DebuggerKeyword */ : 11 /* IdentifierName */; - case 102 /* f */: - return (str.charCodeAt(start + 1) === 117 /* u */ && str.charCodeAt(start + 2) === 110 /* n */ && str.charCodeAt(start + 3) === 99 /* c */ && str.charCodeAt(start + 4) === 116 /* t */ && str.charCodeAt(start + 5) === 105 /* i */ && str.charCodeAt(start + 6) === 111 /* o */ && str.charCodeAt(start + 7) === 110 /* n */) ? 27 /* FunctionKeyword */ : 11 /* IdentifierName */; - default: - return 11 /* IdentifierName */; + case 99 /* c */: return (str.charCodeAt(start + 1) === 111 /* o */ && str.charCodeAt(start + 2) === 110 /* n */ && str.charCodeAt(start + 3) === 116 /* t */ && str.charCodeAt(start + 4) === 105 /* i */ && str.charCodeAt(start + 5) === 110 /* n */ && str.charCodeAt(start + 6) === 117 /* u */ && str.charCodeAt(start + 7) === 101 /* e */) ? 20 /* ContinueKeyword */ : 9 /* IdentifierName */; + case 100 /* d */: return (str.charCodeAt(start + 1) === 101 /* e */ && str.charCodeAt(start + 2) === 98 /* b */ && str.charCodeAt(start + 3) === 117 /* u */ && str.charCodeAt(start + 4) === 103 /* g */ && str.charCodeAt(start + 5) === 103 /* g */ && str.charCodeAt(start + 6) === 101 /* e */ && str.charCodeAt(start + 7) === 114 /* r */) ? 21 /* DebuggerKeyword */ : 9 /* IdentifierName */; + case 102 /* f */: return (str.charCodeAt(start + 1) === 117 /* u */ && str.charCodeAt(start + 2) === 110 /* n */ && str.charCodeAt(start + 3) === 99 /* c */ && str.charCodeAt(start + 4) === 116 /* t */ && str.charCodeAt(start + 5) === 105 /* i */ && str.charCodeAt(start + 6) === 111 /* o */ && str.charCodeAt(start + 7) === 110 /* n */) ? 29 /* FunctionKeyword */ : 9 /* IdentifierName */; + default: return 9 /* IdentifierName */; } case 9: switch (str.charCodeAt(start)) { - case 105 /* i */: - return (str.charCodeAt(start + 1) === 110 /* n */ && str.charCodeAt(start + 2) === 116 /* t */ && str.charCodeAt(start + 3) === 101 /* e */ && str.charCodeAt(start + 4) === 114 /* r */ && str.charCodeAt(start + 5) === 102 /* f */ && str.charCodeAt(start + 6) === 97 /* a */ && str.charCodeAt(start + 7) === 99 /* c */ && str.charCodeAt(start + 8) === 101 /* e */) ? 52 /* InterfaceKeyword */ : 11 /* IdentifierName */; - case 112 /* p */: - return (str.charCodeAt(start + 1) === 114 /* r */ && str.charCodeAt(start + 2) === 111 /* o */ && str.charCodeAt(start + 3) === 116 /* t */ && str.charCodeAt(start + 4) === 101 /* e */ && str.charCodeAt(start + 5) === 99 /* c */ && str.charCodeAt(start + 6) === 116 /* t */ && str.charCodeAt(start + 7) === 101 /* e */ && str.charCodeAt(start + 8) === 100 /* d */) ? 56 /* ProtectedKeyword */ : 11 /* IdentifierName */; - default: - return 11 /* IdentifierName */; + case 105 /* i */: return (str.charCodeAt(start + 1) === 110 /* n */ && str.charCodeAt(start + 2) === 116 /* t */ && str.charCodeAt(start + 3) === 101 /* e */ && str.charCodeAt(start + 4) === 114 /* r */ && str.charCodeAt(start + 5) === 102 /* f */ && str.charCodeAt(start + 6) === 97 /* a */ && str.charCodeAt(start + 7) === 99 /* c */ && str.charCodeAt(start + 8) === 101 /* e */) ? 54 /* InterfaceKeyword */ : 9 /* IdentifierName */; + case 112 /* p */: return (str.charCodeAt(start + 1) === 114 /* r */ && str.charCodeAt(start + 2) === 111 /* o */ && str.charCodeAt(start + 3) === 116 /* t */ && str.charCodeAt(start + 4) === 101 /* e */ && str.charCodeAt(start + 5) === 99 /* c */ && str.charCodeAt(start + 6) === 116 /* t */ && str.charCodeAt(start + 7) === 101 /* e */ && str.charCodeAt(start + 8) === 100 /* d */) ? 58 /* ProtectedKeyword */ : 9 /* IdentifierName */; + default: return 9 /* IdentifierName */; } case 10: switch (str.charCodeAt(start)) { case 105 /* i */: switch (str.charCodeAt(start + 1)) { - case 109 /* m */: - return (str.charCodeAt(start + 2) === 112 /* p */ && str.charCodeAt(start + 3) === 108 /* l */ && str.charCodeAt(start + 4) === 101 /* e */ && str.charCodeAt(start + 5) === 109 /* m */ && str.charCodeAt(start + 6) === 101 /* e */ && str.charCodeAt(start + 7) === 110 /* n */ && str.charCodeAt(start + 8) === 116 /* t */ && str.charCodeAt(start + 9) === 115 /* s */) ? 51 /* ImplementsKeyword */ : 11 /* IdentifierName */; - case 110 /* n */: - return (str.charCodeAt(start + 2) === 115 /* s */ && str.charCodeAt(start + 3) === 116 /* t */ && str.charCodeAt(start + 4) === 97 /* a */ && str.charCodeAt(start + 5) === 110 /* n */ && str.charCodeAt(start + 6) === 99 /* c */ && str.charCodeAt(start + 7) === 101 /* e */ && str.charCodeAt(start + 8) === 111 /* o */ && str.charCodeAt(start + 9) === 102 /* f */) ? 30 /* InstanceOfKeyword */ : 11 /* IdentifierName */; - default: - return 11 /* IdentifierName */; + case 109 /* m */: return (str.charCodeAt(start + 2) === 112 /* p */ && str.charCodeAt(start + 3) === 108 /* l */ && str.charCodeAt(start + 4) === 101 /* e */ && str.charCodeAt(start + 5) === 109 /* m */ && str.charCodeAt(start + 6) === 101 /* e */ && str.charCodeAt(start + 7) === 110 /* n */ && str.charCodeAt(start + 8) === 116 /* t */ && str.charCodeAt(start + 9) === 115 /* s */) ? 53 /* ImplementsKeyword */ : 9 /* IdentifierName */; + case 110 /* n */: return (str.charCodeAt(start + 2) === 115 /* s */ && str.charCodeAt(start + 3) === 116 /* t */ && str.charCodeAt(start + 4) === 97 /* a */ && str.charCodeAt(start + 5) === 110 /* n */ && str.charCodeAt(start + 6) === 99 /* c */ && str.charCodeAt(start + 7) === 101 /* e */ && str.charCodeAt(start + 8) === 111 /* o */ && str.charCodeAt(start + 9) === 102 /* f */) ? 32 /* InstanceOfKeyword */ : 9 /* IdentifierName */; + default: return 9 /* IdentifierName */; } - default: - return 11 /* IdentifierName */; + default: return 9 /* IdentifierName */; } - case 11: - return (str.charCodeAt(start) === 99 /* c */ && str.charCodeAt(start + 1) === 111 /* o */ && str.charCodeAt(start + 2) === 110 /* n */ && str.charCodeAt(start + 3) === 115 /* s */ && str.charCodeAt(start + 4) === 116 /* t */ && str.charCodeAt(start + 5) === 114 /* r */ && str.charCodeAt(start + 6) === 117 /* u */ && str.charCodeAt(start + 7) === 99 /* c */ && str.charCodeAt(start + 8) === 116 /* t */ && str.charCodeAt(start + 9) === 111 /* o */ && str.charCodeAt(start + 10) === 114 /* r */) ? 62 /* ConstructorKeyword */ : 11 /* IdentifierName */; - default: - return 11 /* IdentifierName */; + case 11: return (str.charCodeAt(start) === 99 /* c */ && str.charCodeAt(start + 1) === 111 /* o */ && str.charCodeAt(start + 2) === 110 /* n */ && str.charCodeAt(start + 3) === 115 /* s */ && str.charCodeAt(start + 4) === 116 /* t */ && str.charCodeAt(start + 5) === 114 /* r */ && str.charCodeAt(start + 6) === 117 /* u */ && str.charCodeAt(start + 7) === 99 /* c */ && str.charCodeAt(start + 8) === 116 /* t */ && str.charCodeAt(start + 9) === 111 /* o */ && str.charCodeAt(start + 10) === 114 /* r */) ? 64 /* ConstructorKeyword */ : 9 /* IdentifierName */; + default: return 9 /* IdentifierName */; } - }; - return ScannerUtilities; - })(); - TypeScript.ScannerUtilities = ScannerUtilities; + } + ScannerUtilities.identifierKind = identifierKind; + })(ScannerUtilities = TypeScript.ScannerUtilities || (TypeScript.ScannerUtilities = {})); })(TypeScript || (TypeScript = {})); var TypeScript; (function (TypeScript) { @@ -20063,7 +20547,7 @@ var TypeScript; }; SlidingWindow.prototype.peekItemN = function (n) { while (this.currentRelativeItemIndex + n >= this.windowCount) { - if (!this.addMoreItemsToWindow(null)) { + if (!this.addMoreItemsToWindow(undefined)) { return this.defaultValue; } } @@ -20084,22 +20568,12 @@ var TypeScript; var Syntax; (function (Syntax) { Syntax._nextSyntaxID = 1; - function childIndex(parent, child) { - for (var i = 0, n = TypeScript.childCount(parent); i < n; i++) { - var current = TypeScript.childAt(parent, i); - if (current === child) { - return i; - } - } - throw TypeScript.Errors.invalidOperation(); - } - Syntax.childIndex = childIndex; function nodeHasSkippedOrMissingTokens(node) { for (var i = 0; i < TypeScript.childCount(node); i++) { var child = TypeScript.childAt(node, i); if (TypeScript.isToken(child)) { var token = child; - if (token.hasSkippedToken() || (TypeScript.width(token) === 0 && token.kind() !== 10 /* EndOfFileToken */)) { + if (token.hasSkippedToken() || (TypeScript.width(token) === 0 && token.kind() !== 8 /* EndOfFileToken */)) { return true; } } @@ -20108,7 +20582,7 @@ var TypeScript; } Syntax.nodeHasSkippedOrMissingTokens = nodeHasSkippedOrMissingTokens; function isUnterminatedStringLiteral(token) { - if (token && token.kind() === 14 /* StringLiteral */) { + if (token && token.kind() === 12 /* StringLiteral */) { var text = token.text(); return text.length < 2 || text.charCodeAt(text.length - 1) !== text.charCodeAt(0); } @@ -20116,7 +20590,7 @@ var TypeScript; } Syntax.isUnterminatedStringLiteral = isUnterminatedStringLiteral; function isUnterminatedMultilineCommentTrivia(trivia) { - if (trivia && trivia.kind() === 6 /* MultiLineCommentTrivia */) { + if (trivia && trivia.kind() === 4 /* MultiLineCommentTrivia */) { var text = trivia.fullText(); return text.length < 4 || text.substring(text.length - 2) !== "*/"; } @@ -20130,7 +20604,7 @@ var TypeScript; return true; } else if (position === end) { - return trivia.kind() === 7 /* SingleLineCommentTrivia */ || isUnterminatedMultilineCommentTrivia(trivia); + return trivia.kind() === 5 /* SingleLineCommentTrivia */ || isUnterminatedMultilineCommentTrivia(trivia); } } return false; @@ -20139,9 +20613,9 @@ var TypeScript; function isEntirelyInsideComment(sourceUnit, position) { var positionedToken = TypeScript.findToken(sourceUnit, position); var fullStart = positionedToken.fullStart(); - var triviaList = null; - var lastTriviaBeforeToken = null; - if (positionedToken.kind() === 10 /* EndOfFileToken */) { + var triviaList = undefined; + var lastTriviaBeforeToken = undefined; + if (positionedToken.kind() === 8 /* EndOfFileToken */) { if (positionedToken.hasLeadingTrivia()) { triviaList = positionedToken.leadingTrivia(); } @@ -20183,45 +20657,17 @@ var TypeScript; function isEntirelyInStringOrRegularExpressionLiteral(sourceUnit, position) { var positionedToken = TypeScript.findToken(sourceUnit, position); if (positionedToken) { - if (positionedToken.kind() === 10 /* EndOfFileToken */) { + if (positionedToken.kind() === 8 /* EndOfFileToken */) { positionedToken = TypeScript.previousToken(positionedToken); return positionedToken && positionedToken.trailingTriviaWidth() === 0 && isUnterminatedStringLiteral(positionedToken); } else if (position > TypeScript.start(positionedToken)) { - return (position < TypeScript.end(positionedToken) && (positionedToken.kind() === 14 /* StringLiteral */ || positionedToken.kind() === 12 /* RegularExpressionLiteral */)) || (position <= TypeScript.end(positionedToken) && isUnterminatedStringLiteral(positionedToken)); + return (position < TypeScript.end(positionedToken) && (positionedToken.kind() === 12 /* StringLiteral */ || positionedToken.kind() === 10 /* RegularExpressionLiteral */)) || (position <= TypeScript.end(positionedToken) && isUnterminatedStringLiteral(positionedToken)); } } return false; } Syntax.isEntirelyInStringOrRegularExpressionLiteral = isEntirelyInStringOrRegularExpressionLiteral; - function findSkippedTokenOnLeftInTriviaList(positionedToken, position, lookInLeadingTriviaList) { - var triviaList = null; - var fullEnd; - if (lookInLeadingTriviaList) { - triviaList = positionedToken.leadingTrivia(); - fullEnd = positionedToken.fullStart() + triviaList.fullWidth(); - } - else { - triviaList = positionedToken.trailingTrivia(); - fullEnd = TypeScript.fullEnd(positionedToken); - } - if (triviaList && triviaList.hasSkippedToken()) { - for (var i = triviaList.count() - 1; i >= 0; i--) { - var trivia = triviaList.syntaxTriviaAt(i); - var triviaWidth = trivia.fullWidth(); - if (trivia.isSkippedToken() && position >= fullEnd) { - return trivia.skippedToken(); - } - fullEnd -= triviaWidth; - } - } - return null; - } - function findSkippedTokenOnLeft(positionedToken, position) { - var positionInLeadingTriviaList = (position < TypeScript.start(positionedToken)); - return findSkippedTokenOnLeftInTriviaList(positionedToken, position, positionInLeadingTriviaList); - } - Syntax.findSkippedTokenOnLeft = findSkippedTokenOnLeft; function getAncestorOfKind(positionedToken, kind) { while (positionedToken && positionedToken.parent) { if (positionedToken.parent.kind() === kind) { @@ -20229,21 +20675,24 @@ var TypeScript; } positionedToken = positionedToken.parent; } - return null; + return undefined; } Syntax.getAncestorOfKind = getAncestorOfKind; function hasAncestorOfKind(positionedToken, kind) { - return getAncestorOfKind(positionedToken, kind) !== null; + return !!getAncestorOfKind(positionedToken, kind); } Syntax.hasAncestorOfKind = hasAncestorOfKind; function isIntegerLiteral(expression) { if (expression) { switch (expression.kind()) { - case 165 /* PlusExpression */: - case 166 /* NegateExpression */: - expression = expression.operand; - return TypeScript.isToken(expression) && TypeScript.IntegerUtilities.isInteger(expression.text()); - case 13 /* NumericLiteral */: + case 169 /* PrefixUnaryExpression */: + var prefixExpr = expression; + if (prefixExpr.operatorToken.kind() == 91 /* PlusToken */ || prefixExpr.operatorToken.kind() === 92 /* MinusToken */) { + expression = prefixExpr.operand; + return TypeScript.isToken(expression) && TypeScript.IntegerUtilities.isInteger(expression.text()); + } + return false; + case 11 /* NumericLiteral */: var text = expression.text(); return TypeScript.IntegerUtilities.isInteger(text) || TypeScript.IntegerUtilities.isHexInteger(text); } @@ -20253,38 +20702,30 @@ var TypeScript; Syntax.isIntegerLiteral = isIntegerLiteral; function containingNode(element) { var current = element.parent; - while (current !== null && !TypeScript.isNode(current)) { + while (current && !TypeScript.isNode(current)) { current = current.parent; } return current; } Syntax.containingNode = containingNode; - function findTokenOnLeft(element, position, includeSkippedTokens) { - if (includeSkippedTokens === void 0) { includeSkippedTokens = false; } - var positionedToken = TypeScript.findToken(element, position, false); + function findTokenOnLeft(sourceUnit, position) { + var positionedToken = TypeScript.findToken(sourceUnit, position); var _start = TypeScript.start(positionedToken); - if (includeSkippedTokens) { - positionedToken = findSkippedTokenOnLeft(positionedToken, position) || positionedToken; - } if (position > _start) { return positionedToken; } if (positionedToken.fullStart() === 0) { - return null; + return undefined; } - return TypeScript.previousToken(positionedToken, includeSkippedTokens); + return TypeScript.previousToken(positionedToken); } Syntax.findTokenOnLeft = findTokenOnLeft; - function findCompleteTokenOnLeft(element, position, includeSkippedTokens) { - if (includeSkippedTokens === void 0) { includeSkippedTokens = false; } - var positionedToken = TypeScript.findToken(element, position, false); - if (includeSkippedTokens) { - positionedToken = findSkippedTokenOnLeft(positionedToken, position) || positionedToken; - } + function findCompleteTokenOnLeft(sourceUnit, position) { + var positionedToken = TypeScript.findToken(sourceUnit, position); if (TypeScript.width(positionedToken) > 0 && position >= TypeScript.end(positionedToken)) { return positionedToken; } - return TypeScript.previousToken(positionedToken, includeSkippedTokens); + return TypeScript.previousToken(positionedToken); } Syntax.findCompleteTokenOnLeft = findCompleteTokenOnLeft; function firstTokenInLineContainingPosition(syntaxTree, position) { @@ -20300,7 +20741,7 @@ var TypeScript; Syntax.firstTokenInLineContainingPosition = firstTokenInLineContainingPosition; function isFirstTokenInLine(token, lineMap) { var _previousToken = TypeScript.previousToken(token); - if (_previousToken === null) { + if (_previousToken === undefined) { return true; } return lineMap.getLineNumberFromPosition(TypeScript.end(_previousToken)) !== lineMap.getLineNumberFromPosition(TypeScript.start(token)); @@ -20309,97 +20750,50 @@ var TypeScript; })(TypeScript || (TypeScript = {})); var TypeScript; (function (TypeScript) { - function isShared(element) { - var kind = element.kind(); - return (kind === 1 /* List */ || kind === 2 /* SeparatedList */) && element.length === 0; - } - TypeScript.isShared = isShared; - function childCount(element) { - var kind = element.kind(); - if (kind === 1 /* List */) { - return element.length; - } - else if (kind === 2 /* SeparatedList */) { - return element.length + element.separators.length; - } - else if (kind >= TypeScript.SyntaxKind.FirstToken && kind <= TypeScript.SyntaxKind.LastToken) { - return 0; - } - else { - return TypeScript.nodeMetadata[kind].length; - } - } - TypeScript.childCount = childCount; - function childAt(element, index) { - var kind = element.kind(); - if (kind === 1 /* List */) { - return element[index]; - } - else if (kind === 2 /* SeparatedList */) { - return (index % 2 === 0) ? element[index / 2] : element.separators[(index - 1) / 2]; - } - else { - return element[TypeScript.nodeMetadata[element.kind()][index]]; - } - } - TypeScript.childAt = childAt; function syntaxTree(element) { if (element) { - TypeScript.Debug.assert(!isShared(element)); while (element) { - if (element.kind() === 120 /* SourceUnit */) { + if (element.kind() === 122 /* SourceUnit */) { return element.syntaxTree; } element = element.parent; } } - return null; + return undefined; } TypeScript.syntaxTree = syntaxTree; function parsedInStrictMode(node) { - var info = node.data; + var info = node.__data; if (info === undefined) { return false; } return (info & 4 /* NodeParsedInStrictModeMask */) !== 0; } TypeScript.parsedInStrictMode = parsedInStrictMode; - function previousToken(token, includeSkippedTokens) { - if (includeSkippedTokens === void 0) { includeSkippedTokens = false; } - if (includeSkippedTokens) { - var triviaList = token.leadingTrivia(); - if (triviaList && triviaList.hasSkippedToken()) { - var currentTriviaEndPosition = TypeScript.start(token); - for (var i = triviaList.count() - 1; i >= 0; i--) { - var trivia = triviaList.syntaxTriviaAt(i); - if (trivia.isSkippedToken()) { - return trivia.skippedToken(); - } - currentTriviaEndPosition -= trivia.fullWidth(); - } - } - } + function previousToken(token) { var start = token.fullStart(); if (start === 0) { - return null; + return undefined; } - return findToken(syntaxTree(token).sourceUnit(), start - 1, includeSkippedTokens); + return findToken(syntaxTree(token).sourceUnit(), start - 1); } TypeScript.previousToken = previousToken; - function findToken(element, position, includeSkippedTokens) { - if (includeSkippedTokens === void 0) { includeSkippedTokens = false; } - var endOfFileToken = tryGetEndOfFileAt(element, position); - if (endOfFileToken !== null) { - return endOfFileToken; - } - if (position < 0 || position >= fullWidth(element)) { + function findToken(sourceUnit, position) { + if (position < 0) { throw TypeScript.Errors.argumentOutOfRange("position"); } - var positionedToken = findTokenWorker(element, position); - if (includeSkippedTokens) { - return findSkippedTokenInPositionedToken(positionedToken, position) || positionedToken; + var token = findTokenWorker(sourceUnit, 0, position); + if (token) { + TypeScript.Debug.assert(token.fullWidth() > 0); + return token; } - return positionedToken; + if (position === fullWidth(sourceUnit)) { + return sourceUnit.endOfFileToken; + } + if (position > fullWidth(sourceUnit)) { + throw TypeScript.Errors.argumentOutOfRange("position"); + } + throw TypeScript.Errors.invalidOperation(); } TypeScript.findToken = findToken; function findSkippedTokenInPositionedToken(positionedToken, position) { @@ -20416,7 +20810,7 @@ var TypeScript; } TypeScript.findSkippedTokenInTrailingTriviaList = findSkippedTokenInTrailingTriviaList; function findSkippedTokenInTriviaList(positionedToken, position, lookInLeadingTriviaList) { - var triviaList = null; + var triviaList = undefined; var fullStart; if (lookInLeadingTriviaList) { triviaList = positionedToken.leadingTrivia(); @@ -20436,61 +20830,41 @@ var TypeScript; fullStart += triviaWidth; } } - return null; + return undefined; } - function findTokenWorker(element, position) { + function findTokenWorker(element, elementPosition, position) { if (isToken(element)) { - TypeScript.Debug.assert(fullWidth(element) > 0); return element; } - if (isShared(element)) { - throw TypeScript.Errors.invalidOperation(); - } - for (var i = 0, n = childCount(element); i < n; i++) { - var child = childAt(element, i); - if (child !== null) { + for (var i = 0, n = TypeScript.childCount(element); i < n; i++) { + var child = TypeScript.childAt(element, i); + if (child) { var childFullWidth = fullWidth(child); - if (childFullWidth > 0) { - var childFullStart = fullStart(child); - if (position >= childFullStart) { - var childFullEnd = childFullStart + childFullWidth; - if (position < childFullEnd) { - return findTokenWorker(child, position); - } - } + var elementEndPosition = elementPosition + childFullWidth; + if (position < elementEndPosition) { + return findTokenWorker(child, elementPosition, position); } + elementPosition = elementEndPosition; } } - throw TypeScript.Errors.invalidOperation(); + return undefined; } function tryGetEndOfFileAt(element, position) { - if (element.kind() === 120 /* SourceUnit */ && position === fullWidth(element)) { + if (element.kind() === 122 /* SourceUnit */ && position === fullWidth(element)) { var sourceUnit = element; return sourceUnit.endOfFileToken; } - return null; + return undefined; } - function nextToken(token, text, includeSkippedTokens) { - if (includeSkippedTokens === void 0) { includeSkippedTokens = false; } - if (token.kind() === 10 /* EndOfFileToken */) { - return null; + function nextToken(token, text) { + if (token.kind() === 8 /* EndOfFileToken */) { + return undefined; } - if (includeSkippedTokens) { - var triviaList = token.trailingTrivia(text); - if (triviaList && triviaList.hasSkippedToken()) { - for (var i = 0, n = triviaList.count(); i < n; i++) { - var trivia = triviaList.syntaxTriviaAt(i); - if (trivia.isSkippedToken()) { - return trivia.skippedToken(); - } - } - } - } - return findToken(syntaxTree(token).sourceUnit(), fullEnd(token), includeSkippedTokens); + return findToken(syntaxTree(token).sourceUnit(), fullEnd(token)); } TypeScript.nextToken = nextToken; function isNode(element) { - if (element !== null) { + if (element) { var kind = element.kind(); return kind >= TypeScript.SyntaxKind.FirstNode && kind <= TypeScript.SyntaxKind.LastNode; } @@ -20501,24 +20875,17 @@ var TypeScript; return kind >= TypeScript.SyntaxKind.FirstToken && kind <= TypeScript.SyntaxKind.LastToken; } function isToken(element) { - if (element !== null) { + if (element) { return isTokenKind(element.kind()); } return false; } TypeScript.isToken = isToken; function isList(element) { - return element !== null && element.kind() === 1 /* List */; + return element instanceof Array; } TypeScript.isList = isList; - function isSeparatedList(element) { - return element !== null && element.kind() === 2 /* SeparatedList */; - } - TypeScript.isSeparatedList = isSeparatedList; function syntaxID(element) { - if (isShared(element)) { - throw TypeScript.Errors.invalidOperation("Should not use shared syntax element as a key."); - } var obj = element; if (obj._syntaxID === undefined) { obj._syntaxID = TypeScript.Syntax._nextSyntaxID++; @@ -20532,8 +20899,8 @@ var TypeScript; elements.push(element.fullText(text)); } else { - for (var i = 0, n = childCount(element); i < n; i++) { - collectTextElements(childAt(element, i), elements, text); + for (var i = 0, n = TypeScript.childCount(element); i < n; i++) { + collectTextElements(TypeScript.childAt(element, i), elements, text); } } } @@ -20561,65 +20928,38 @@ var TypeScript; if (element) { var kind = element.kind(); if (isTokenKind(kind)) { - return fullWidth(element) > 0 || element.kind() === 10 /* EndOfFileToken */ ? element : null; + return element.fullWidth() > 0 || kind === 8 /* EndOfFileToken */ ? element : undefined; } - if (kind === 1 /* List */) { - var array = element; - for (var i = 0, n = array.length; i < n; i++) { - var token = firstToken(array[i]); - if (token) { - return token; - } - } - } - else if (kind === 2 /* SeparatedList */) { - var array = element; - var separators = array.separators; - for (var i = 0, n = array.length + separators.length; i < n; i++) { - var token = firstToken(i % 2 === 0 ? array[i / 2] : separators[(i - 1) / 2]); - if (token) { - return token; - } - } - } - else { - var metadata = TypeScript.nodeMetadata[kind]; - for (var i = 0, n = metadata.length; i < n; i++) { - var child = element[metadata[i]]; - var token = firstToken(child); - if (token) { - return token; - } - } - if (element.kind() === 120 /* SourceUnit */) { - return element.endOfFileToken; + for (var i = 0, n = TypeScript.childCount(element); i < n; i++) { + var token = firstToken(TypeScript.childAt(element, i)); + if (token) { + return token; } } } - return null; + return undefined; } TypeScript.firstToken = firstToken; function lastToken(element) { if (isToken(element)) { - return fullWidth(element) > 0 || element.kind() === 10 /* EndOfFileToken */ ? element : null; + return fullWidth(element) > 0 || element.kind() === 8 /* EndOfFileToken */ ? element : undefined; } - if (element.kind() === 120 /* SourceUnit */) { + if (element.kind() === 122 /* SourceUnit */) { return element.endOfFileToken; } - for (var i = childCount(element) - 1; i >= 0; i--) { - var child = childAt(element, i); - if (child !== null) { + for (var i = TypeScript.childCount(element) - 1; i >= 0; i--) { + var child = TypeScript.childAt(element, i); + if (child) { var token = lastToken(child); if (token) { return token; } } } - return null; + return undefined; } TypeScript.lastToken = lastToken; function fullStart(element) { - TypeScript.Debug.assert(!isShared(element)); var token = isToken(element) ? element : firstToken(element); return token ? token.fullStart() : -1; } @@ -20628,9 +20968,6 @@ var TypeScript; if (isToken(element)) { return element.fullWidth(); } - if (isShared(element)) { - return 0; - } var info = data(element); return info >>> 3 /* NodeFullWidthShift */; } @@ -20639,31 +20976,27 @@ var TypeScript; if (isToken(element)) { return element.isIncrementallyUnusable(); } - if (isShared(element)) { - return false; - } return (data(element) & 2 /* NodeIncrementallyUnusableMask */) !== 0; } TypeScript.isIncrementallyUnusable = isIncrementallyUnusable; function data(element) { - TypeScript.Debug.assert(isNode(element) || isList(element) || isSeparatedList(element)); var dataElement = element; - var info = dataElement.data; + var info = dataElement.__data; if (info === undefined) { info = 0; } if ((info & 1 /* NodeDataComputed */) === 0) { info |= computeData(element); - dataElement.data = info; + dataElement.__data = info; } return info; } function computeData(element) { - var slotCount = childCount(element); + var slotCount = TypeScript.childCount(element); var fullWidth = 0; - var isIncrementallyUnusable = slotCount === 0; + var isIncrementallyUnusable = slotCount === 0 && !isList(element); for (var i = 0, n = slotCount; i < n; i++) { - var child = childAt(element, i); + var child = TypeScript.childAt(element, i); if (child) { fullWidth += TypeScript.fullWidth(child); isIncrementallyUnusable = isIncrementallyUnusable || TypeScript.isIncrementallyUnusable(child); @@ -20696,7 +21029,7 @@ var TypeScript; if (token1 === token2) { return false; } - if (token1 === null || token2 === null) { + if (!token1 || !token2) { return true; } var lineMap = text.lineMap(); @@ -20709,10 +21042,10 @@ var TypeScript; var SyntaxFacts; (function (SyntaxFacts) { function isDirectivePrologueElement(node) { - if (node.kind() === 150 /* ExpressionStatement */) { + if (node.kind() === 154 /* ExpressionStatement */) { var expressionStatement = node; var expression = expressionStatement.expression; - if (expression.kind() === 14 /* StringLiteral */) { + if (expression.kind() === 12 /* StringLiteral */) { return true; } } @@ -20728,14 +21061,14 @@ var TypeScript; SyntaxFacts.isUseStrictDirective = isUseStrictDirective; function isIdentifierNameOrAnyKeyword(token) { var tokenKind = token.kind(); - return tokenKind === 11 /* IdentifierName */ || SyntaxFacts.isAnyKeyword(tokenKind); + return tokenKind === 9 /* IdentifierName */ || SyntaxFacts.isAnyKeyword(tokenKind); } SyntaxFacts.isIdentifierNameOrAnyKeyword = isIdentifierNameOrAnyKeyword; function isAccessibilityModifier(kind) { switch (kind) { - case 57 /* PublicKeyword */: - case 55 /* PrivateKeyword */: - case 56 /* ProtectedKeyword */: + case 59 /* PublicKeyword */: + case 57 /* PrivateKeyword */: + case 58 /* ProtectedKeyword */: return true; } return false; @@ -20744,126 +21077,94 @@ var TypeScript; })(SyntaxFacts = TypeScript.SyntaxFacts || (TypeScript.SyntaxFacts = {})); })(TypeScript || (TypeScript = {})); var TypeScript; +(function (TypeScript) { + function separatorCount(list) { + return list.length >> 1; + } + TypeScript.separatorCount = separatorCount; + function nonSeparatorCount(list) { + return (list.length + 1) >> 1; + } + TypeScript.nonSeparatorCount = nonSeparatorCount; + function separatorAt(list, index) { + return list[(index << 1) + 1]; + } + TypeScript.separatorAt = separatorAt; + function nonSeparatorAt(list, index) { + return list[index << 1]; + } + TypeScript.nonSeparatorAt = nonSeparatorAt; +})(TypeScript || (TypeScript = {})); +var TypeScript; (function (TypeScript) { var Syntax; (function (Syntax) { - var _emptyList = []; - var _emptySeparatedList = []; - var _emptySeparators = []; - _emptySeparatedList.separators = _emptySeparators; - function assertEmptyLists() { - } - Array.prototype.kind = function () { - return this.separators === undefined ? 1 /* List */ : 2 /* SeparatedList */; - }; - Array.prototype.separatorCount = function () { - assertEmptyLists(); - return this.separators.length; - }; - Array.prototype.separatorAt = function (index) { - assertEmptyLists(); - return this.separators[index]; - }; - function emptyList() { - return _emptyList; - } - Syntax.emptyList = emptyList; - function emptySeparatedList() { - return _emptySeparatedList; - } - Syntax.emptySeparatedList = emptySeparatedList; - function list(nodes) { - if (nodes === undefined || nodes === null || nodes.length === 0) { - return emptyList(); + function addArrayFunction(name, func) { + if (Object.defineProperty) { + Object.defineProperty(Array.prototype, name, { value: func, writable: true }); } + else { + Array.prototype[name] = func; + } + } + addArrayFunction("kind", function () { + return 1 /* List */; + }); + function list(nodes) { for (var i = 0, n = nodes.length; i < n; i++) { nodes[i].parent = nodes; } return nodes; } Syntax.list = list; - function separatedList(nodes, separators) { - if (nodes === undefined || nodes === null || nodes.length === 0) { - return emptySeparatedList(); + function separatedList(nodesAndTokens) { + for (var i = 0, n = nodesAndTokens.length; i < n; i++) { + nodesAndTokens[i].parent = nodesAndTokens; } - for (var i = 0, n = nodes.length; i < n; i++) { - nodes[i].parent = nodes; - } - for (var i = 0, n = separators.length; i < n; i++) { - separators[i].parent = nodes; - } - nodes.separators = separators.length === 0 ? _emptySeparators : separators; - return nodes; + return nodesAndTokens; } Syntax.separatedList = separatedList; - function nonSeparatorIndexOf(list, ast) { - for (var i = 0, n = list.length; i < n; i++) { - if (list[i] === ast) { - return i; - } - } - return -1; - } - Syntax.nonSeparatorIndexOf = nonSeparatorIndexOf; })(Syntax = TypeScript.Syntax || (TypeScript.Syntax = {})); })(TypeScript || (TypeScript = {})); var TypeScript; -(function (TypeScript) { - var SyntaxNode = (function () { - function SyntaxNode(data) { - if (data) { - this.data = data; - } - } - SyntaxNode.prototype.kind = function () { - return this.__kind; - }; - return SyntaxNode; - })(); - TypeScript.SyntaxNode = SyntaxNode; -})(TypeScript || (TypeScript = {})); -var TypeScript; -(function (TypeScript) { - TypeScript.nodeMetadata = [[], [], [], [], [], [], [], [], [], [], [], [], [], [], [], [], [], [], [], [], [], [], [], [], [], [], [], [], [], [], [], [], [], [], [], [], [], [], [], [], [], [], [], [], [], [], [], [], [], [], [], [], [], [], [], [], [], [], [], [], [], [], [], [], [], [], [], [], [], [], [], [], [], [], [], [], [], [], [], [], [], [], [], [], [], [], [], [], [], [], [], [], [], [], [], [], [], [], [], [], [], [], [], [], [], [], [], [], [], [], [], [], [], [], [], [], [], [], [], [], ["moduleElements", "endOfFileToken"], ["left", "dotToken", "right"], ["openBraceToken", "typeMembers", "closeBraceToken"], ["typeParameterList", "parameterList", "equalsGreaterThanToken", "type"], ["type", "openBracketToken", "closeBracketToken"], ["newKeyword", "typeParameterList", "parameterList", "equalsGreaterThanToken", "type"], ["name", "typeArgumentList"], ["typeOfKeyword", "name"], ["openBracketToken", "types", "closeBracketToken"], ["modifiers", "interfaceKeyword", "identifier", "typeParameterList", "heritageClauses", "body"], ["modifiers", "functionKeyword", "identifier", "callSignature", "block", "semicolonToken"], ["modifiers", "moduleKeyword", "name", "stringLiteral", "openBraceToken", "moduleElements", "closeBraceToken"], ["modifiers", "classKeyword", "identifier", "typeParameterList", "heritageClauses", "openBraceToken", "classElements", "closeBraceToken"], ["modifiers", "enumKeyword", "identifier", "openBraceToken", "enumElements", "closeBraceToken"], ["modifiers", "importKeyword", "identifier", "equalsToken", "moduleReference", "semicolonToken"], ["exportKeyword", "equalsToken", "identifier", "semicolonToken"], ["modifiers", "propertyName", "callSignature", "block", "semicolonToken"], ["modifiers", "variableDeclarator", "semicolonToken"], ["modifiers", "constructorKeyword", "callSignature", "block", "semicolonToken"], ["modifiers", "indexSignature", "semicolonToken"], ["modifiers", "getKeyword", "propertyName", "callSignature", "block"], ["modifiers", "setKeyword", "propertyName", "callSignature", "block"], ["propertyName", "questionToken", "typeAnnotation"], ["typeParameterList", "parameterList", "typeAnnotation"], ["newKeyword", "callSignature"], ["openBracketToken", "parameters", "closeBracketToken", "typeAnnotation"], ["propertyName", "questionToken", "callSignature"], ["openBraceToken", "statements", "closeBraceToken"], ["ifKeyword", "openParenToken", "condition", "closeParenToken", "statement", "elseClause"], ["modifiers", "variableDeclaration", "semicolonToken"], ["expression", "semicolonToken"], ["returnKeyword", "expression", "semicolonToken"], ["switchKeyword", "openParenToken", "expression", "closeParenToken", "openBraceToken", "switchClauses", "closeBraceToken"], ["breakKeyword", "identifier", "semicolonToken"], ["continueKeyword", "identifier", "semicolonToken"], ["forKeyword", "openParenToken", "variableDeclaration", "initializer", "firstSemicolonToken", "condition", "secondSemicolonToken", "incrementor", "closeParenToken", "statement"], ["forKeyword", "openParenToken", "variableDeclaration", "left", "inKeyword", "expression", "closeParenToken", "statement"], ["semicolonToken"], ["throwKeyword", "expression", "semicolonToken"], ["whileKeyword", "openParenToken", "condition", "closeParenToken", "statement"], ["tryKeyword", "block", "catchClause", "finallyClause"], ["identifier", "colonToken", "statement"], ["doKeyword", "statement", "whileKeyword", "openParenToken", "condition", "closeParenToken", "semicolonToken"], ["debuggerKeyword", "semicolonToken"], ["withKeyword", "openParenToken", "condition", "closeParenToken", "statement"], ["operatorToken", "operand"], ["operatorToken", "operand"], ["operatorToken", "operand"], ["operatorToken", "operand"], ["operatorToken", "operand"], ["operatorToken", "operand"], ["deleteKeyword", "expression"], ["typeOfKeyword", "expression"], ["voidKeyword", "expression"], ["left", "operatorToken", "right"], ["left", "operatorToken", "right"], ["left", "operatorToken", "right"], ["left", "operatorToken", "right"], ["left", "operatorToken", "right"], ["left", "operatorToken", "right"], ["left", "operatorToken", "right"], ["left", "operatorToken", "right"], ["left", "operatorToken", "right"], ["left", "operatorToken", "right"], ["left", "operatorToken", "right"], ["left", "operatorToken", "right"], ["left", "operatorToken", "right"], ["condition", "questionToken", "whenTrue", "colonToken", "whenFalse"], ["left", "operatorToken", "right"], ["left", "operatorToken", "right"], ["left", "operatorToken", "right"], ["left", "operatorToken", "right"], ["left", "operatorToken", "right"], ["left", "operatorToken", "right"], ["left", "operatorToken", "right"], ["left", "operatorToken", "right"], ["left", "operatorToken", "right"], ["left", "operatorToken", "right"], ["left", "operatorToken", "right"], ["left", "operatorToken", "right"], ["left", "operatorToken", "right"], ["left", "operatorToken", "right"], ["left", "operatorToken", "right"], ["left", "operatorToken", "right"], ["left", "operatorToken", "right"], ["left", "operatorToken", "right"], ["left", "operatorToken", "right"], ["left", "operatorToken", "right"], ["left", "operatorToken", "right"], ["left", "operatorToken", "right"], ["left", "operatorToken", "right"], ["operand", "operatorToken"], ["operand", "operatorToken"], ["expression", "dotToken", "name"], ["expression", "argumentList"], ["openBracketToken", "expressions", "closeBracketToken"], ["openBraceToken", "propertyAssignments", "closeBraceToken"], ["newKeyword", "expression", "argumentList"], ["openParenToken", "expression", "closeParenToken"], ["callSignature", "equalsGreaterThanToken", "block", "expression"], ["parameter", "equalsGreaterThanToken", "block", "expression"], ["lessThanToken", "type", "greaterThanToken", "expression"], ["expression", "openBracketToken", "argumentExpression", "closeBracketToken"], ["functionKeyword", "identifier", "callSignature", "block"], [], ["varKeyword", "variableDeclarators"], ["propertyName", "typeAnnotation", "equalsValueClause"], ["typeArgumentList", "openParenToken", "arguments", "closeParenToken"], ["openParenToken", "parameters", "closeParenToken"], ["lessThanToken", "typeArguments", "greaterThanToken"], ["lessThanToken", "typeParameters", "greaterThanToken"], ["extendsOrImplementsKeyword", "typeNames"], ["extendsOrImplementsKeyword", "typeNames"], ["equalsToken", "value"], ["caseKeyword", "expression", "colonToken", "statements"], ["defaultKeyword", "colonToken", "statements"], ["elseKeyword", "statement"], ["catchKeyword", "openParenToken", "identifier", "typeAnnotation", "closeParenToken", "block"], ["finallyKeyword", "block"], ["identifier", "constraint"], ["extendsKeyword", "typeOrExpression"], ["propertyName", "colonToken", "expression"], ["propertyName", "callSignature", "block"], ["dotDotDotToken", "modifiers", "identifier", "questionToken", "typeAnnotation", "equalsValueClause"], ["propertyName", "equalsValueClause"], ["colonToken", "type"], ["requireKeyword", "openParenToken", "stringLiteral", "closeParenToken"], ["moduleName"],]; -})(TypeScript || (TypeScript = {})); -var TypeScript; (function (TypeScript) { function tokenValue(token) { if (token.fullWidth() === 0) { - return null; + return undefined; } var kind = token.kind(); var text = token.text(); - if (kind === 11 /* IdentifierName */) { + if (kind === 9 /* IdentifierName */) { return massageEscapes(text); } switch (kind) { - case 37 /* TrueKeyword */: + case 39 /* TrueKeyword */: return true; - case 24 /* FalseKeyword */: + case 26 /* FalseKeyword */: return false; - case 32 /* NullKeyword */: - return null; + case 34 /* NullKeyword */: + return undefined; } if (TypeScript.SyntaxFacts.isAnyKeyword(kind) || TypeScript.SyntaxFacts.isAnyPunctuation(kind)) { return TypeScript.SyntaxFacts.getText(kind); } - if (kind === 13 /* NumericLiteral */) { + if (kind === 11 /* NumericLiteral */) { return TypeScript.IntegerUtilities.isHexInteger(text) ? parseInt(text, 16) : parseFloat(text); } - else if (kind === 14 /* StringLiteral */) { - if (text.length > 1 && text.charCodeAt(text.length - 1) === text.charCodeAt(0)) { - return massageEscapes(text.substr(1, text.length - 2)); - } - else { - return massageEscapes(text.substr(1)); - } + else if (kind === 12 /* StringLiteral */) { + return (text.length > 1 && text.charCodeAt(text.length - 1) === text.charCodeAt(0)) ? massageEscapes(text.substr(1, text.length - "''".length)) : massageEscapes(text.substr(1)); } - else if (kind === 12 /* RegularExpressionLiteral */) { + else if (kind === 13 /* NoSubstitutionTemplateToken */ || kind === 16 /* TemplateEndToken */) { + return (text.length > 1 && text.charCodeAt(text.length - 1) === 96 /* backtick */) ? massageTemplate(text.substr(1, text.length - "``".length)) : massageTemplate(text.substr(1)); + } + else if (kind === 14 /* TemplateStartToken */ || kind === 15 /* TemplateMiddleToken */) { + return massageTemplate(text.substr(1, text.length - "`${".length)); + } + else if (kind === 10 /* RegularExpressionLiteral */) { return regularExpressionValue(text); } - else if (kind === 10 /* EndOfFileToken */ || kind === 9 /* ErrorToken */) { - return null; + else if (kind === 8 /* EndOfFileToken */ || kind === 7 /* ErrorToken */) { + return undefined; } else { throw TypeScript.Errors.invalidOperation(); @@ -20872,9 +21173,13 @@ var TypeScript; TypeScript.tokenValue = tokenValue; function tokenValueText(token) { var value = tokenValue(token); - return value === null ? "" : massageDisallowedIdentifiers(value.toString()); + return value === undefined ? "" : massageDisallowedIdentifiers(value.toString()); } TypeScript.tokenValueText = tokenValueText; + function massageTemplate(text) { + text = text.replace("\r\n", "\n").replace("\r", "\n"); + return massageEscapes(text); + } function massageEscapes(text) { return text.indexOf("\\") >= 0 ? convertEscapes(text) : text; } @@ -20887,7 +21192,7 @@ var TypeScript; return new RegExp(body, flags); } catch (e) { - return null; + return undefined; } } function massageDisallowedIdentifiers(text) { @@ -20952,12 +21257,12 @@ var TypeScript; } characterArray.push(ch); if (i && !(i % 1024)) { - result = result.concat(String.fromCharCode.apply(null, characterArray)); + result = result.concat(String.fromCharCode.apply(undefined, characterArray)); characterArray.length = 0; } } if (characterArray.length) { - result = result.concat(String.fromCharCode.apply(null, characterArray)); + result = result.concat(String.fromCharCode.apply(undefined, characterArray)); } return result; } @@ -21006,6 +21311,15 @@ var TypeScript; EmptyToken.prototype.kind = function () { return this._kind; }; + EmptyToken.prototype.childCount = function () { + return 0; + }; + EmptyToken.prototype.childAt = function (index) { + throw TypeScript.Errors.invalidOperation(); + }; + EmptyToken.prototype.accept = function (visitor) { + return visitor.visitToken(this); + }; EmptyToken.prototype.clone = function () { return new EmptyToken(this.kind()); }; @@ -21020,15 +21334,15 @@ var TypeScript; }; EmptyToken.prototype.position = function () { var previousElement = this.previousNonZeroWidthElement(); - return previousElement === null ? 0 : TypeScript.fullStart(previousElement) + TypeScript.fullWidth(previousElement); + return !previousElement ? 0 : TypeScript.fullStart(previousElement) + TypeScript.fullWidth(previousElement); }; EmptyToken.prototype.previousNonZeroWidthElement = function () { var current = this; while (true) { var parent = current.parent; - if (parent === null) { - TypeScript.Debug.assert(current.kind() === 120 /* SourceUnit */, "We had a node without a parent that was not the root node!"); - return null; + if (parent === undefined) { + TypeScript.Debug.assert(current.kind() === 122 /* SourceUnit */, "We had a node without a parent that was not the root node!"); + return undefined; } for (var i = 0, n = TypeScript.childCount(parent); i < n; i++) { if (TypeScript.childAt(parent, i) === current) { @@ -21104,6 +21418,15 @@ var TypeScript; RealizedToken.prototype.kind = function () { return this._kind; }; + RealizedToken.prototype.childCount = function () { + return 0; + }; + RealizedToken.prototype.childAt = function (index) { + throw TypeScript.Errors.invalidOperation(); + }; + RealizedToken.prototype.accept = function (visitor) { + return visitor.visitToken(this); + }; RealizedToken.prototype.clone = function () { return new RealizedToken(this._fullStart, this.kind(), this._isKeywordConvertedToIdentifier, this._leadingTrivia, this._text, this._trailingTrivia); }; @@ -21159,11 +21482,20 @@ var TypeScript; this.underlyingToken = underlyingToken; } ConvertedKeywordToken.prototype.kind = function () { - return 11 /* IdentifierName */; + return 9 /* IdentifierName */; }; ConvertedKeywordToken.prototype.setFullStart = function (fullStart) { this.underlyingToken.setFullStart(fullStart); }; + ConvertedKeywordToken.prototype.childCount = function () { + return 0; + }; + ConvertedKeywordToken.prototype.childAt = function (index) { + throw TypeScript.Errors.invalidOperation(); + }; + ConvertedKeywordToken.prototype.accept = function (visitor) { + return visitor.visitToken(this); + }; ConvertedKeywordToken.prototype.fullStart = function () { return this.underlyingToken.fullStart(); }; @@ -21252,23 +21584,23 @@ var TypeScript; throw TypeScript.Errors.abstract(); }; AbstractTrivia.prototype.isWhitespace = function () { - return this.kind() === 4 /* WhitespaceTrivia */; + return this.kind() === 2 /* WhitespaceTrivia */; }; AbstractTrivia.prototype.isComment = function () { - return this.kind() === 7 /* SingleLineCommentTrivia */ || this.kind() === 6 /* MultiLineCommentTrivia */; + return this.kind() === 5 /* SingleLineCommentTrivia */ || this.kind() === 4 /* MultiLineCommentTrivia */; }; AbstractTrivia.prototype.isNewLine = function () { - return this.kind() === 5 /* NewLineTrivia */; + return this.kind() === 3 /* NewLineTrivia */; }; AbstractTrivia.prototype.isSkippedToken = function () { - return this.kind() === 8 /* SkippedTokenTrivia */; + return this.kind() === 6 /* SkippedTokenTrivia */; }; return AbstractTrivia; })(); var SkippedTokenTrivia = (function (_super) { __extends(SkippedTokenTrivia, _super); function SkippedTokenTrivia(_skippedToken, _fullText) { - _super.call(this, 8 /* SkippedTokenTrivia */); + _super.call(this, 6 /* SkippedTokenTrivia */); this._skippedToken = _skippedToken; this._fullText = _fullText; _skippedToken.parent = this; @@ -21358,9 +21690,6 @@ var TypeScript; var EmptyTriviaList = (function () { function EmptyTriviaList() { } - EmptyTriviaList.prototype.kind = function () { - return 3 /* TriviaList */; - }; EmptyTriviaList.prototype.isShared = function () { return true; }; @@ -21399,16 +21728,13 @@ var TypeScript; ; Syntax.emptyTriviaList = new EmptyTriviaList(); function isComment(trivia) { - return trivia.kind() === 6 /* MultiLineCommentTrivia */ || trivia.kind() === 7 /* SingleLineCommentTrivia */; + return trivia.kind() === 4 /* MultiLineCommentTrivia */ || trivia.kind() === 5 /* SingleLineCommentTrivia */; } var SingletonSyntaxTriviaList = (function () { function SingletonSyntaxTriviaList(item) { this.item = item.clone(); this.item.parent = this; } - SingletonSyntaxTriviaList.prototype.kind = function () { - return 3 /* TriviaList */; - }; SingletonSyntaxTriviaList.prototype.isShared = function () { return false; }; @@ -21434,10 +21760,10 @@ var TypeScript; return isComment(this.item); }; SingletonSyntaxTriviaList.prototype.hasNewLine = function () { - return this.item.kind() === 5 /* NewLineTrivia */; + return this.item.kind() === 3 /* NewLineTrivia */; }; SingletonSyntaxTriviaList.prototype.hasSkippedToken = function () { - return this.item.kind() === 8 /* SkippedTokenTrivia */; + return this.item.kind() === 6 /* SkippedTokenTrivia */; }; SingletonSyntaxTriviaList.prototype.toArray = function () { return [this.item]; @@ -21456,9 +21782,6 @@ var TypeScript; return cloned; }); } - NormalSyntaxTriviaList.prototype.kind = function () { - return 3 /* TriviaList */; - }; NormalSyntaxTriviaList.prototype.isShared = function () { return false; }; @@ -21494,7 +21817,7 @@ var TypeScript; }; NormalSyntaxTriviaList.prototype.hasNewLine = function () { for (var i = 0; i < this.trivia.length; i++) { - if (this.trivia[i].kind() === 5 /* NewLineTrivia */) { + if (this.trivia[i].kind() === 3 /* NewLineTrivia */) { return true; } } @@ -21502,7 +21825,7 @@ var TypeScript; }; NormalSyntaxTriviaList.prototype.hasSkippedToken = function () { for (var i = 0; i < this.trivia.length; i++) { - if (this.trivia[i].kind() === 8 /* SkippedTokenTrivia */) { + if (this.trivia[i].kind() === 6 /* SkippedTokenTrivia */) { return true; } } @@ -21517,7 +21840,7 @@ var TypeScript; return NormalSyntaxTriviaList; })(); function triviaList(trivia) { - if (trivia === undefined || trivia === null || trivia.length === 0) { + if (!trivia || trivia.length === 0) { return Syntax.emptyTriviaList; } if (trivia.length === 1) { @@ -21535,22 +21858,22 @@ var TypeScript; } SyntaxUtilities.isAnyFunctionExpressionOrDeclaration = function (ast) { switch (ast.kind()) { - case 220 /* SimpleArrowFunctionExpression */: - case 219 /* ParenthesizedArrowFunctionExpression */: - case 223 /* FunctionExpression */: - case 130 /* FunctionDeclaration */: - case 136 /* MemberFunctionDeclaration */: - case 242 /* FunctionPropertyAssignment */: - case 138 /* ConstructorDeclaration */: - case 140 /* GetAccessor */: - case 141 /* SetAccessor */: + case 183 /* SimpleArrowFunctionExpression */: + case 182 /* ParenthesizedArrowFunctionExpression */: + case 186 /* FunctionExpression */: + case 134 /* FunctionDeclaration */: + case 140 /* MemberFunctionDeclaration */: + case 207 /* FunctionPropertyAssignment */: + case 142 /* ConstructorDeclaration */: + case 144 /* GetAccessor */: + case 145 /* SetAccessor */: return true; } return false; }; SyntaxUtilities.isLastTokenOnLine = function (token, text) { var _nextToken = TypeScript.nextToken(token, text); - if (_nextToken === null) { + if (_nextToken === undefined) { return true; } var lineMap = text.lineMap(); @@ -21561,100 +21884,24 @@ var TypeScript; SyntaxUtilities.isLeftHandSizeExpression = function (element) { if (element) { switch (element.kind()) { - case 213 /* MemberAccessExpression */: - case 222 /* ElementAccessExpression */: - case 217 /* ObjectCreationExpression */: - case 214 /* InvocationExpression */: - case 215 /* ArrayLiteralExpression */: - case 218 /* ParenthesizedExpression */: - case 216 /* ObjectLiteralExpression */: - case 223 /* FunctionExpression */: - case 11 /* IdentifierName */: - case 12 /* RegularExpressionLiteral */: - case 13 /* NumericLiteral */: - case 14 /* StringLiteral */: - case 24 /* FalseKeyword */: - case 32 /* NullKeyword */: - case 35 /* ThisKeyword */: - case 37 /* TrueKeyword */: - case 50 /* SuperKeyword */: - return true; - } - } - return false; - }; - SyntaxUtilities.isExpression = function (element) { - if (element) { - switch (element.kind()) { - case 11 /* IdentifierName */: - case 12 /* RegularExpressionLiteral */: - case 13 /* NumericLiteral */: - case 14 /* StringLiteral */: - case 24 /* FalseKeyword */: - case 32 /* NullKeyword */: - case 35 /* ThisKeyword */: - case 37 /* TrueKeyword */: - case 50 /* SuperKeyword */: - case 165 /* PlusExpression */: - case 166 /* NegateExpression */: - case 167 /* BitwiseNotExpression */: - case 168 /* LogicalNotExpression */: - case 169 /* PreIncrementExpression */: - case 170 /* PreDecrementExpression */: - case 171 /* DeleteExpression */: - case 172 /* TypeOfExpression */: - case 173 /* VoidExpression */: - case 174 /* CommaExpression */: - case 175 /* AssignmentExpression */: - case 176 /* AddAssignmentExpression */: - case 177 /* SubtractAssignmentExpression */: - case 178 /* MultiplyAssignmentExpression */: - case 179 /* DivideAssignmentExpression */: - case 180 /* ModuloAssignmentExpression */: - case 181 /* AndAssignmentExpression */: - case 182 /* ExclusiveOrAssignmentExpression */: - case 183 /* OrAssignmentExpression */: - case 184 /* LeftShiftAssignmentExpression */: - case 185 /* SignedRightShiftAssignmentExpression */: - case 186 /* UnsignedRightShiftAssignmentExpression */: - case 187 /* ConditionalExpression */: - case 188 /* LogicalOrExpression */: - case 189 /* LogicalAndExpression */: - case 190 /* BitwiseOrExpression */: - case 191 /* BitwiseExclusiveOrExpression */: - case 192 /* BitwiseAndExpression */: - case 193 /* EqualsWithTypeConversionExpression */: - case 194 /* NotEqualsWithTypeConversionExpression */: - case 195 /* EqualsExpression */: - case 196 /* NotEqualsExpression */: - case 197 /* LessThanExpression */: - case 198 /* GreaterThanExpression */: - case 199 /* LessThanOrEqualExpression */: - case 200 /* GreaterThanOrEqualExpression */: - case 201 /* InstanceOfExpression */: - case 202 /* InExpression */: - case 203 /* LeftShiftExpression */: - case 204 /* SignedRightShiftExpression */: - case 205 /* UnsignedRightShiftExpression */: - case 206 /* MultiplyExpression */: - case 207 /* DivideExpression */: - case 208 /* ModuloExpression */: - case 209 /* AddExpression */: - case 210 /* SubtractExpression */: - case 211 /* PostIncrementExpression */: - case 212 /* PostDecrementExpression */: - case 213 /* MemberAccessExpression */: - case 214 /* InvocationExpression */: - case 215 /* ArrayLiteralExpression */: - case 216 /* ObjectLiteralExpression */: - case 217 /* ObjectCreationExpression */: - case 218 /* ParenthesizedExpression */: - case 219 /* ParenthesizedArrowFunctionExpression */: - case 220 /* SimpleArrowFunctionExpression */: - case 221 /* CastExpression */: - case 222 /* ElementAccessExpression */: - case 223 /* FunctionExpression */: - case 224 /* OmittedExpression */: + case 176 /* MemberAccessExpression */: + case 185 /* ElementAccessExpression */: + case 189 /* TemplateAccessExpression */: + case 180 /* ObjectCreationExpression */: + case 177 /* InvocationExpression */: + case 178 /* ArrayLiteralExpression */: + case 181 /* ParenthesizedExpression */: + case 179 /* ObjectLiteralExpression */: + case 186 /* FunctionExpression */: + case 9 /* IdentifierName */: + case 10 /* RegularExpressionLiteral */: + case 11 /* NumericLiteral */: + case 12 /* StringLiteral */: + case 26 /* FalseKeyword */: + case 34 /* NullKeyword */: + case 37 /* ThisKeyword */: + case 39 /* TrueKeyword */: + case 52 /* SuperKeyword */: return true; } } @@ -21663,8 +21910,8 @@ var TypeScript; SyntaxUtilities.isSwitchClause = function (element) { if (element) { switch (element.kind()) { - case 234 /* CaseSwitchClause */: - case 235 /* DefaultSwitchClause */: + case 198 /* CaseSwitchClause */: + case 199 /* DefaultSwitchClause */: return true; } } @@ -21673,11 +21920,11 @@ var TypeScript; SyntaxUtilities.isTypeMember = function (element) { if (element) { switch (element.kind()) { - case 144 /* ConstructSignature */: - case 146 /* MethodSignature */: - case 145 /* IndexSignature */: - case 142 /* PropertySignature */: - case 143 /* CallSignature */: + case 148 /* ConstructSignature */: + case 150 /* MethodSignature */: + case 149 /* IndexSignature */: + case 146 /* PropertySignature */: + case 147 /* CallSignature */: return true; } } @@ -21686,13 +21933,13 @@ var TypeScript; SyntaxUtilities.isClassElement = function (element) { if (element) { switch (element.kind()) { - case 138 /* ConstructorDeclaration */: - case 139 /* IndexMemberDeclaration */: - case 136 /* MemberFunctionDeclaration */: - case 140 /* GetAccessor */: - case 141 /* SetAccessor */: - case 136 /* MemberFunctionDeclaration */: - case 137 /* MemberVariableDeclaration */: + case 142 /* ConstructorDeclaration */: + case 143 /* IndexMemberDeclaration */: + case 140 /* MemberFunctionDeclaration */: + case 144 /* GetAccessor */: + case 145 /* SetAccessor */: + case 140 /* MemberFunctionDeclaration */: + case 141 /* MemberVariableDeclaration */: return true; } } @@ -21701,31 +21948,31 @@ var TypeScript; SyntaxUtilities.isModuleElement = function (element) { if (element) { switch (element.kind()) { - case 134 /* ImportDeclaration */: - case 135 /* ExportAssignment */: - case 132 /* ClassDeclaration */: - case 129 /* InterfaceDeclaration */: - case 131 /* ModuleDeclaration */: - case 133 /* EnumDeclaration */: - case 130 /* FunctionDeclaration */: - case 149 /* VariableStatement */: - case 147 /* Block */: - case 148 /* IfStatement */: - case 150 /* ExpressionStatement */: - case 158 /* ThrowStatement */: - case 151 /* ReturnStatement */: - case 152 /* SwitchStatement */: - case 153 /* BreakStatement */: - case 154 /* ContinueStatement */: - case 156 /* ForInStatement */: - case 155 /* ForStatement */: - case 159 /* WhileStatement */: - case 164 /* WithStatement */: - case 157 /* EmptyStatement */: - case 160 /* TryStatement */: - case 161 /* LabeledStatement */: - case 162 /* DoStatement */: - case 163 /* DebuggerStatement */: + case 138 /* ImportDeclaration */: + case 139 /* ExportAssignment */: + case 136 /* ClassDeclaration */: + case 133 /* InterfaceDeclaration */: + case 135 /* ModuleDeclaration */: + case 137 /* EnumDeclaration */: + case 134 /* FunctionDeclaration */: + case 153 /* VariableStatement */: + case 151 /* Block */: + case 152 /* IfStatement */: + case 154 /* ExpressionStatement */: + case 162 /* ThrowStatement */: + case 155 /* ReturnStatement */: + case 156 /* SwitchStatement */: + case 157 /* BreakStatement */: + case 158 /* ContinueStatement */: + case 160 /* ForInStatement */: + case 159 /* ForStatement */: + case 163 /* WhileStatement */: + case 168 /* WithStatement */: + case 161 /* EmptyStatement */: + case 164 /* TryStatement */: + case 165 /* LabeledStatement */: + case 166 /* DoStatement */: + case 167 /* DebuggerStatement */: return true; } } @@ -21734,25 +21981,25 @@ var TypeScript; SyntaxUtilities.isStatement = function (element) { if (element) { switch (element.kind()) { - case 130 /* FunctionDeclaration */: - case 149 /* VariableStatement */: - case 147 /* Block */: - case 148 /* IfStatement */: - case 150 /* ExpressionStatement */: - case 158 /* ThrowStatement */: - case 151 /* ReturnStatement */: - case 152 /* SwitchStatement */: - case 153 /* BreakStatement */: - case 154 /* ContinueStatement */: - case 156 /* ForInStatement */: - case 155 /* ForStatement */: - case 159 /* WhileStatement */: - case 164 /* WithStatement */: - case 157 /* EmptyStatement */: - case 160 /* TryStatement */: - case 161 /* LabeledStatement */: - case 162 /* DoStatement */: - case 163 /* DebuggerStatement */: + case 134 /* FunctionDeclaration */: + case 153 /* VariableStatement */: + case 151 /* Block */: + case 152 /* IfStatement */: + case 154 /* ExpressionStatement */: + case 162 /* ThrowStatement */: + case 155 /* ReturnStatement */: + case 156 /* SwitchStatement */: + case 157 /* BreakStatement */: + case 158 /* ContinueStatement */: + case 160 /* ForInStatement */: + case 159 /* ForStatement */: + case 163 /* WhileStatement */: + case 168 /* WithStatement */: + case 161 /* EmptyStatement */: + case 164 /* TryStatement */: + case 165 /* LabeledStatement */: + case 166 /* DoStatement */: + case 167 /* DebuggerStatement */: return true; } } @@ -21761,11 +22008,11 @@ var TypeScript; SyntaxUtilities.isAngleBracket = function (positionedElement) { var element = positionedElement; var parent = positionedElement.parent; - if (parent !== null && (element.kind() === 80 /* LessThanToken */ || element.kind() === 81 /* GreaterThanToken */)) { + if (parent && (element.kind() === 82 /* LessThanToken */ || element.kind() === 83 /* GreaterThanToken */)) { switch (parent.kind()) { - case 229 /* TypeArgumentList */: - case 230 /* TypeParameterList */: - case 221 /* CastExpression */: + case 194 /* TypeArgumentList */: + case 195 /* TypeParameterList */: + case 184 /* CastExpression */: return true; } } @@ -21778,26 +22025,26 @@ var TypeScript; return token; } } - return null; + return undefined; }; SyntaxUtilities.containsToken = function (list, kind) { - return SyntaxUtilities.getToken(list, kind) !== null; + return !!SyntaxUtilities.getToken(list, kind); }; SyntaxUtilities.hasExportKeyword = function (moduleElement) { - return SyntaxUtilities.getExportKeyword(moduleElement) !== null; + return !!SyntaxUtilities.getExportKeyword(moduleElement); }; SyntaxUtilities.getExportKeyword = function (moduleElement) { switch (moduleElement.kind()) { - case 131 /* ModuleDeclaration */: - case 132 /* ClassDeclaration */: - case 130 /* FunctionDeclaration */: - case 149 /* VariableStatement */: - case 133 /* EnumDeclaration */: - case 129 /* InterfaceDeclaration */: - case 134 /* ImportDeclaration */: - return SyntaxUtilities.getToken(moduleElement.modifiers, 47 /* ExportKeyword */); + case 135 /* ModuleDeclaration */: + case 136 /* ClassDeclaration */: + case 134 /* FunctionDeclaration */: + case 153 /* VariableStatement */: + case 137 /* EnumDeclaration */: + case 133 /* InterfaceDeclaration */: + case 138 /* ImportDeclaration */: + return SyntaxUtilities.getToken(moduleElement.modifiers, 49 /* ExportKeyword */); default: - return null; + return undefined; } }; SyntaxUtilities.isAmbientDeclarationSyntax = function (positionNode) { @@ -21806,24 +22053,24 @@ var TypeScript; } var node = positionNode; switch (node.kind()) { - case 131 /* ModuleDeclaration */: - case 132 /* ClassDeclaration */: - case 130 /* FunctionDeclaration */: - case 149 /* VariableStatement */: - case 133 /* EnumDeclaration */: - if (SyntaxUtilities.containsToken(node.modifiers, 63 /* DeclareKeyword */)) { + case 135 /* ModuleDeclaration */: + case 136 /* ClassDeclaration */: + case 134 /* FunctionDeclaration */: + case 153 /* VariableStatement */: + case 137 /* EnumDeclaration */: + if (SyntaxUtilities.containsToken(node.modifiers, 65 /* DeclareKeyword */)) { return true; } - case 134 /* ImportDeclaration */: - case 138 /* ConstructorDeclaration */: - case 136 /* MemberFunctionDeclaration */: - case 140 /* GetAccessor */: - case 141 /* SetAccessor */: - case 137 /* MemberVariableDeclaration */: + case 138 /* ImportDeclaration */: + case 142 /* ConstructorDeclaration */: + case 140 /* MemberFunctionDeclaration */: + case 144 /* GetAccessor */: + case 145 /* SetAccessor */: + case 141 /* MemberVariableDeclaration */: if (SyntaxUtilities.isClassElement(node) || SyntaxUtilities.isModuleElement(node)) { return SyntaxUtilities.isAmbientDeclarationSyntax(TypeScript.Syntax.containingNode(positionNode)); } - case 244 /* EnumElement */: + case 209 /* EnumElement */: return SyntaxUtilities.isAmbientDeclarationSyntax(TypeScript.Syntax.containingNode(TypeScript.Syntax.containingNode(positionNode))); default: return SyntaxUtilities.isAmbientDeclarationSyntax(TypeScript.Syntax.containingNode(positionNode)); @@ -21835,230 +22082,897 @@ var TypeScript; })(TypeScript || (TypeScript = {})); var TypeScript; (function (TypeScript) { - function visitNodeOrToken(visitor, element) { - if (element === null) { - return null; + var childCountArray = [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 3, 3, 4, 3, 5, 2, 2, 3, 3, 3, 6, 6, 7, 8, 6, 6, 4, 5, 3, 5, 3, 5, 5, 3, 3, 2, 4, 3, 3, 6, 3, 2, 3, 7, 3, 3, 10, 8, 1, 3, 5, 4, 3, 7, 2, 5, 2, 2, 2, 2, 5, 3, 2, 3, 2, 3, 3, 3, 3, 4, 4, 4, 4, 4, 0, 2, 2, 2, 3, 4, 3, 3, 3, 2, 2, 4, 3, 2, 6, 2, 2, 2, 2, 3, 3, 6, 2, 2, 4, 1]; + function childCount(element) { + if (TypeScript.isList(element)) { + return element.length; } - if (TypeScript.isToken(element)) { - return visitor.visitToken(element); + return childCountArray[element.kind()]; + } + TypeScript.childCount = childCount; + function sourceUnitChildAt(node, index) { + switch (index) { + case 0: return node.moduleElements; + case 1: return node.endOfFileToken; + } + } + function qualifiedNameChildAt(node, index) { + switch (index) { + case 0: return node.left; + case 1: return node.dotToken; + case 2: return node.right; + } + } + function objectTypeChildAt(node, index) { + switch (index) { + case 0: return node.openBraceToken; + case 1: return node.typeMembers; + case 2: return node.closeBraceToken; + } + } + function functionTypeChildAt(node, index) { + switch (index) { + case 0: return node.typeParameterList; + case 1: return node.parameterList; + case 2: return node.equalsGreaterThanToken; + case 3: return node.type; + } + } + function arrayTypeChildAt(node, index) { + switch (index) { + case 0: return node.type; + case 1: return node.openBracketToken; + case 2: return node.closeBracketToken; + } + } + function constructorTypeChildAt(node, index) { + switch (index) { + case 0: return node.newKeyword; + case 1: return node.typeParameterList; + case 2: return node.parameterList; + case 3: return node.equalsGreaterThanToken; + case 4: return node.type; + } + } + function genericTypeChildAt(node, index) { + switch (index) { + case 0: return node.name; + case 1: return node.typeArgumentList; + } + } + function typeQueryChildAt(node, index) { + switch (index) { + case 0: return node.typeOfKeyword; + case 1: return node.name; + } + } + function tupleTypeChildAt(node, index) { + switch (index) { + case 0: return node.openBracketToken; + case 1: return node.types; + case 2: return node.closeBracketToken; + } + } + function unionTypeChildAt(node, index) { + switch (index) { + case 0: return node.left; + case 1: return node.barToken; + case 2: return node.right; + } + } + function parenthesizedTypeChildAt(node, index) { + switch (index) { + case 0: return node.openParenToken; + case 1: return node.type; + case 2: return node.closeParenToken; + } + } + function interfaceDeclarationChildAt(node, index) { + switch (index) { + case 0: return node.modifiers; + case 1: return node.interfaceKeyword; + case 2: return node.identifier; + case 3: return node.typeParameterList; + case 4: return node.heritageClauses; + case 5: return node.body; + } + } + function functionDeclarationChildAt(node, index) { + switch (index) { + case 0: return node.modifiers; + case 1: return node.functionKeyword; + case 2: return node.identifier; + case 3: return node.callSignature; + case 4: return node.block; + case 5: return node.semicolonToken; + } + } + function moduleDeclarationChildAt(node, index) { + switch (index) { + case 0: return node.modifiers; + case 1: return node.moduleKeyword; + case 2: return node.name; + case 3: return node.stringLiteral; + case 4: return node.openBraceToken; + case 5: return node.moduleElements; + case 6: return node.closeBraceToken; + } + } + function classDeclarationChildAt(node, index) { + switch (index) { + case 0: return node.modifiers; + case 1: return node.classKeyword; + case 2: return node.identifier; + case 3: return node.typeParameterList; + case 4: return node.heritageClauses; + case 5: return node.openBraceToken; + case 6: return node.classElements; + case 7: return node.closeBraceToken; + } + } + function enumDeclarationChildAt(node, index) { + switch (index) { + case 0: return node.modifiers; + case 1: return node.enumKeyword; + case 2: return node.identifier; + case 3: return node.openBraceToken; + case 4: return node.enumElements; + case 5: return node.closeBraceToken; + } + } + function importDeclarationChildAt(node, index) { + switch (index) { + case 0: return node.modifiers; + case 1: return node.importKeyword; + case 2: return node.identifier; + case 3: return node.equalsToken; + case 4: return node.moduleReference; + case 5: return node.semicolonToken; + } + } + function exportAssignmentChildAt(node, index) { + switch (index) { + case 0: return node.exportKeyword; + case 1: return node.equalsToken; + case 2: return node.identifier; + case 3: return node.semicolonToken; + } + } + function memberFunctionDeclarationChildAt(node, index) { + switch (index) { + case 0: return node.modifiers; + case 1: return node.propertyName; + case 2: return node.callSignature; + case 3: return node.block; + case 4: return node.semicolonToken; + } + } + function memberVariableDeclarationChildAt(node, index) { + switch (index) { + case 0: return node.modifiers; + case 1: return node.variableDeclarator; + case 2: return node.semicolonToken; + } + } + function constructorDeclarationChildAt(node, index) { + switch (index) { + case 0: return node.modifiers; + case 1: return node.constructorKeyword; + case 2: return node.callSignature; + case 3: return node.block; + case 4: return node.semicolonToken; + } + } + function indexMemberDeclarationChildAt(node, index) { + switch (index) { + case 0: return node.modifiers; + case 1: return node.indexSignature; + case 2: return node.semicolonToken; + } + } + function getAccessorChildAt(node, index) { + switch (index) { + case 0: return node.modifiers; + case 1: return node.getKeyword; + case 2: return node.propertyName; + case 3: return node.callSignature; + case 4: return node.block; + } + } + function setAccessorChildAt(node, index) { + switch (index) { + case 0: return node.modifiers; + case 1: return node.setKeyword; + case 2: return node.propertyName; + case 3: return node.callSignature; + case 4: return node.block; + } + } + function propertySignatureChildAt(node, index) { + switch (index) { + case 0: return node.propertyName; + case 1: return node.questionToken; + case 2: return node.typeAnnotation; + } + } + function callSignatureChildAt(node, index) { + switch (index) { + case 0: return node.typeParameterList; + case 1: return node.parameterList; + case 2: return node.typeAnnotation; + } + } + function constructSignatureChildAt(node, index) { + switch (index) { + case 0: return node.newKeyword; + case 1: return node.callSignature; + } + } + function indexSignatureChildAt(node, index) { + switch (index) { + case 0: return node.openBracketToken; + case 1: return node.parameters; + case 2: return node.closeBracketToken; + case 3: return node.typeAnnotation; + } + } + function methodSignatureChildAt(node, index) { + switch (index) { + case 0: return node.propertyName; + case 1: return node.questionToken; + case 2: return node.callSignature; + } + } + function blockChildAt(node, index) { + switch (index) { + case 0: return node.openBraceToken; + case 1: return node.statements; + case 2: return node.closeBraceToken; + } + } + function ifStatementChildAt(node, index) { + switch (index) { + case 0: return node.ifKeyword; + case 1: return node.openParenToken; + case 2: return node.condition; + case 3: return node.closeParenToken; + case 4: return node.statement; + case 5: return node.elseClause; + } + } + function variableStatementChildAt(node, index) { + switch (index) { + case 0: return node.modifiers; + case 1: return node.variableDeclaration; + case 2: return node.semicolonToken; + } + } + function expressionStatementChildAt(node, index) { + switch (index) { + case 0: return node.expression; + case 1: return node.semicolonToken; + } + } + function returnStatementChildAt(node, index) { + switch (index) { + case 0: return node.returnKeyword; + case 1: return node.expression; + case 2: return node.semicolonToken; + } + } + function switchStatementChildAt(node, index) { + switch (index) { + case 0: return node.switchKeyword; + case 1: return node.openParenToken; + case 2: return node.expression; + case 3: return node.closeParenToken; + case 4: return node.openBraceToken; + case 5: return node.switchClauses; + case 6: return node.closeBraceToken; + } + } + function breakStatementChildAt(node, index) { + switch (index) { + case 0: return node.breakKeyword; + case 1: return node.identifier; + case 2: return node.semicolonToken; + } + } + function continueStatementChildAt(node, index) { + switch (index) { + case 0: return node.continueKeyword; + case 1: return node.identifier; + case 2: return node.semicolonToken; + } + } + function forStatementChildAt(node, index) { + switch (index) { + case 0: return node.forKeyword; + case 1: return node.openParenToken; + case 2: return node.variableDeclaration; + case 3: return node.initializer; + case 4: return node.firstSemicolonToken; + case 5: return node.condition; + case 6: return node.secondSemicolonToken; + case 7: return node.incrementor; + case 8: return node.closeParenToken; + case 9: return node.statement; + } + } + function forInStatementChildAt(node, index) { + switch (index) { + case 0: return node.forKeyword; + case 1: return node.openParenToken; + case 2: return node.variableDeclaration; + case 3: return node.left; + case 4: return node.inKeyword; + case 5: return node.expression; + case 6: return node.closeParenToken; + case 7: return node.statement; + } + } + function emptyStatementChildAt(node, index) { + switch (index) { + case 0: return node.semicolonToken; + } + } + function throwStatementChildAt(node, index) { + switch (index) { + case 0: return node.throwKeyword; + case 1: return node.expression; + case 2: return node.semicolonToken; + } + } + function whileStatementChildAt(node, index) { + switch (index) { + case 0: return node.whileKeyword; + case 1: return node.openParenToken; + case 2: return node.condition; + case 3: return node.closeParenToken; + case 4: return node.statement; + } + } + function tryStatementChildAt(node, index) { + switch (index) { + case 0: return node.tryKeyword; + case 1: return node.block; + case 2: return node.catchClause; + case 3: return node.finallyClause; + } + } + function labeledStatementChildAt(node, index) { + switch (index) { + case 0: return node.identifier; + case 1: return node.colonToken; + case 2: return node.statement; + } + } + function doStatementChildAt(node, index) { + switch (index) { + case 0: return node.doKeyword; + case 1: return node.statement; + case 2: return node.whileKeyword; + case 3: return node.openParenToken; + case 4: return node.condition; + case 5: return node.closeParenToken; + case 6: return node.semicolonToken; + } + } + function debuggerStatementChildAt(node, index) { + switch (index) { + case 0: return node.debuggerKeyword; + case 1: return node.semicolonToken; + } + } + function withStatementChildAt(node, index) { + switch (index) { + case 0: return node.withKeyword; + case 1: return node.openParenToken; + case 2: return node.condition; + case 3: return node.closeParenToken; + case 4: return node.statement; + } + } + function prefixUnaryExpressionChildAt(node, index) { + switch (index) { + case 0: return node.operatorToken; + case 1: return node.operand; + } + } + function deleteExpressionChildAt(node, index) { + switch (index) { + case 0: return node.deleteKeyword; + case 1: return node.expression; + } + } + function typeOfExpressionChildAt(node, index) { + switch (index) { + case 0: return node.typeOfKeyword; + case 1: return node.expression; + } + } + function voidExpressionChildAt(node, index) { + switch (index) { + case 0: return node.voidKeyword; + case 1: return node.expression; + } + } + function conditionalExpressionChildAt(node, index) { + switch (index) { + case 0: return node.condition; + case 1: return node.questionToken; + case 2: return node.whenTrue; + case 3: return node.colonToken; + case 4: return node.whenFalse; + } + } + function binaryExpressionChildAt(node, index) { + switch (index) { + case 0: return node.left; + case 1: return node.operatorToken; + case 2: return node.right; + } + } + function postfixUnaryExpressionChildAt(node, index) { + switch (index) { + case 0: return node.operand; + case 1: return node.operatorToken; + } + } + function memberAccessExpressionChildAt(node, index) { + switch (index) { + case 0: return node.expression; + case 1: return node.dotToken; + case 2: return node.name; + } + } + function invocationExpressionChildAt(node, index) { + switch (index) { + case 0: return node.expression; + case 1: return node.argumentList; + } + } + function arrayLiteralExpressionChildAt(node, index) { + switch (index) { + case 0: return node.openBracketToken; + case 1: return node.expressions; + case 2: return node.closeBracketToken; + } + } + function objectLiteralExpressionChildAt(node, index) { + switch (index) { + case 0: return node.openBraceToken; + case 1: return node.propertyAssignments; + case 2: return node.closeBraceToken; + } + } + function objectCreationExpressionChildAt(node, index) { + switch (index) { + case 0: return node.newKeyword; + case 1: return node.expression; + case 2: return node.argumentList; + } + } + function parenthesizedExpressionChildAt(node, index) { + switch (index) { + case 0: return node.openParenToken; + case 1: return node.expression; + case 2: return node.closeParenToken; + } + } + function parenthesizedArrowFunctionExpressionChildAt(node, index) { + switch (index) { + case 0: return node.callSignature; + case 1: return node.equalsGreaterThanToken; + case 2: return node.block; + case 3: return node.expression; + } + } + function simpleArrowFunctionExpressionChildAt(node, index) { + switch (index) { + case 0: return node.parameter; + case 1: return node.equalsGreaterThanToken; + case 2: return node.block; + case 3: return node.expression; + } + } + function castExpressionChildAt(node, index) { + switch (index) { + case 0: return node.lessThanToken; + case 1: return node.type; + case 2: return node.greaterThanToken; + case 3: return node.expression; + } + } + function elementAccessExpressionChildAt(node, index) { + switch (index) { + case 0: return node.expression; + case 1: return node.openBracketToken; + case 2: return node.argumentExpression; + case 3: return node.closeBracketToken; + } + } + function functionExpressionChildAt(node, index) { + switch (index) { + case 0: return node.functionKeyword; + case 1: return node.identifier; + case 2: return node.callSignature; + case 3: return node.block; + } + } + function omittedExpressionChildAt(node, index) { + throw TypeScript.Errors.invalidOperation(); + } + function templateExpressionChildAt(node, index) { + switch (index) { + case 0: return node.templateStartToken; + case 1: return node.templateClauses; + } + } + function templateAccessExpressionChildAt(node, index) { + switch (index) { + case 0: return node.expression; + case 1: return node.templateExpression; + } + } + function variableDeclarationChildAt(node, index) { + switch (index) { + case 0: return node.varKeyword; + case 1: return node.variableDeclarators; + } + } + function variableDeclaratorChildAt(node, index) { + switch (index) { + case 0: return node.propertyName; + case 1: return node.typeAnnotation; + case 2: return node.equalsValueClause; + } + } + function argumentListChildAt(node, index) { + switch (index) { + case 0: return node.typeArgumentList; + case 1: return node.openParenToken; + case 2: return node.arguments; + case 3: return node.closeParenToken; + } + } + function parameterListChildAt(node, index) { + switch (index) { + case 0: return node.openParenToken; + case 1: return node.parameters; + case 2: return node.closeParenToken; + } + } + function typeArgumentListChildAt(node, index) { + switch (index) { + case 0: return node.lessThanToken; + case 1: return node.typeArguments; + case 2: return node.greaterThanToken; + } + } + function typeParameterListChildAt(node, index) { + switch (index) { + case 0: return node.lessThanToken; + case 1: return node.typeParameters; + case 2: return node.greaterThanToken; + } + } + function heritageClauseChildAt(node, index) { + switch (index) { + case 0: return node.extendsOrImplementsKeyword; + case 1: return node.typeNames; + } + } + function equalsValueClauseChildAt(node, index) { + switch (index) { + case 0: return node.equalsToken; + case 1: return node.value; + } + } + function caseSwitchClauseChildAt(node, index) { + switch (index) { + case 0: return node.caseKeyword; + case 1: return node.expression; + case 2: return node.colonToken; + case 3: return node.statements; + } + } + function defaultSwitchClauseChildAt(node, index) { + switch (index) { + case 0: return node.defaultKeyword; + case 1: return node.colonToken; + case 2: return node.statements; + } + } + function elseClauseChildAt(node, index) { + switch (index) { + case 0: return node.elseKeyword; + case 1: return node.statement; + } + } + function catchClauseChildAt(node, index) { + switch (index) { + case 0: return node.catchKeyword; + case 1: return node.openParenToken; + case 2: return node.identifier; + case 3: return node.typeAnnotation; + case 4: return node.closeParenToken; + case 5: return node.block; + } + } + function finallyClauseChildAt(node, index) { + switch (index) { + case 0: return node.finallyKeyword; + case 1: return node.block; + } + } + function templateClauseChildAt(node, index) { + switch (index) { + case 0: return node.expression; + case 1: return node.templateMiddleOrEndToken; + } + } + function typeParameterChildAt(node, index) { + switch (index) { + case 0: return node.identifier; + case 1: return node.constraint; + } + } + function constraintChildAt(node, index) { + switch (index) { + case 0: return node.extendsKeyword; + case 1: return node.typeOrExpression; + } + } + function simplePropertyAssignmentChildAt(node, index) { + switch (index) { + case 0: return node.propertyName; + case 1: return node.colonToken; + case 2: return node.expression; + } + } + function functionPropertyAssignmentChildAt(node, index) { + switch (index) { + case 0: return node.propertyName; + case 1: return node.callSignature; + case 2: return node.block; + } + } + function parameterChildAt(node, index) { + switch (index) { + case 0: return node.dotDotDotToken; + case 1: return node.modifiers; + case 2: return node.identifier; + case 3: return node.questionToken; + case 4: return node.typeAnnotation; + case 5: return node.equalsValueClause; + } + } + function enumElementChildAt(node, index) { + switch (index) { + case 0: return node.propertyName; + case 1: return node.equalsValueClause; + } + } + function typeAnnotationChildAt(node, index) { + switch (index) { + case 0: return node.colonToken; + case 1: return node.type; + } + } + function externalModuleReferenceChildAt(node, index) { + switch (index) { + case 0: return node.requireKeyword; + case 1: return node.openParenToken; + case 2: return node.stringLiteral; + case 3: return node.closeParenToken; + } + } + function moduleNameModuleReferenceChildAt(node, index) { + switch (index) { + case 0: return node.moduleName; + } + } + function childAt(element, index) { + if (TypeScript.isList(element)) { + return element[index]; } switch (element.kind()) { - case 120 /* SourceUnit */: - return visitor.visitSourceUnit(element); - case 121 /* QualifiedName */: - return visitor.visitQualifiedName(element); - case 122 /* ObjectType */: - return visitor.visitObjectType(element); - case 123 /* FunctionType */: - return visitor.visitFunctionType(element); - case 124 /* ArrayType */: - return visitor.visitArrayType(element); - case 125 /* ConstructorType */: - return visitor.visitConstructorType(element); - case 126 /* GenericType */: - return visitor.visitGenericType(element); - case 127 /* TypeQuery */: - return visitor.visitTypeQuery(element); - case 128 /* TupleType */: - return visitor.visitTupleType(element); - case 129 /* InterfaceDeclaration */: - return visitor.visitInterfaceDeclaration(element); - case 130 /* FunctionDeclaration */: - return visitor.visitFunctionDeclaration(element); - case 131 /* ModuleDeclaration */: - return visitor.visitModuleDeclaration(element); - case 132 /* ClassDeclaration */: - return visitor.visitClassDeclaration(element); - case 133 /* EnumDeclaration */: - return visitor.visitEnumDeclaration(element); - case 134 /* ImportDeclaration */: - return visitor.visitImportDeclaration(element); - case 135 /* ExportAssignment */: - return visitor.visitExportAssignment(element); - case 136 /* MemberFunctionDeclaration */: - return visitor.visitMemberFunctionDeclaration(element); - case 137 /* MemberVariableDeclaration */: - return visitor.visitMemberVariableDeclaration(element); - case 138 /* ConstructorDeclaration */: - return visitor.visitConstructorDeclaration(element); - case 139 /* IndexMemberDeclaration */: - return visitor.visitIndexMemberDeclaration(element); - case 140 /* GetAccessor */: - return visitor.visitGetAccessor(element); - case 141 /* SetAccessor */: - return visitor.visitSetAccessor(element); - case 142 /* PropertySignature */: - return visitor.visitPropertySignature(element); - case 143 /* CallSignature */: - return visitor.visitCallSignature(element); - case 144 /* ConstructSignature */: - return visitor.visitConstructSignature(element); - case 145 /* IndexSignature */: - return visitor.visitIndexSignature(element); - case 146 /* MethodSignature */: - return visitor.visitMethodSignature(element); - case 147 /* Block */: - return visitor.visitBlock(element); - case 148 /* IfStatement */: - return visitor.visitIfStatement(element); - case 149 /* VariableStatement */: - return visitor.visitVariableStatement(element); - case 150 /* ExpressionStatement */: - return visitor.visitExpressionStatement(element); - case 151 /* ReturnStatement */: - return visitor.visitReturnStatement(element); - case 152 /* SwitchStatement */: - return visitor.visitSwitchStatement(element); - case 153 /* BreakStatement */: - return visitor.visitBreakStatement(element); - case 154 /* ContinueStatement */: - return visitor.visitContinueStatement(element); - case 155 /* ForStatement */: - return visitor.visitForStatement(element); - case 156 /* ForInStatement */: - return visitor.visitForInStatement(element); - case 157 /* EmptyStatement */: - return visitor.visitEmptyStatement(element); - case 158 /* ThrowStatement */: - return visitor.visitThrowStatement(element); - case 159 /* WhileStatement */: - return visitor.visitWhileStatement(element); - case 160 /* TryStatement */: - return visitor.visitTryStatement(element); - case 161 /* LabeledStatement */: - return visitor.visitLabeledStatement(element); - case 162 /* DoStatement */: - return visitor.visitDoStatement(element); - case 163 /* DebuggerStatement */: - return visitor.visitDebuggerStatement(element); - case 164 /* WithStatement */: - return visitor.visitWithStatement(element); - case 169 /* PreIncrementExpression */: - case 170 /* PreDecrementExpression */: - case 165 /* PlusExpression */: - case 166 /* NegateExpression */: - case 167 /* BitwiseNotExpression */: - case 168 /* LogicalNotExpression */: - return visitor.visitPrefixUnaryExpression(element); - case 171 /* DeleteExpression */: - return visitor.visitDeleteExpression(element); - case 172 /* TypeOfExpression */: - return visitor.visitTypeOfExpression(element); - case 173 /* VoidExpression */: - return visitor.visitVoidExpression(element); - case 187 /* ConditionalExpression */: - return visitor.visitConditionalExpression(element); - case 206 /* MultiplyExpression */: - case 207 /* DivideExpression */: - case 208 /* ModuloExpression */: - case 209 /* AddExpression */: - case 210 /* SubtractExpression */: - case 203 /* LeftShiftExpression */: - case 204 /* SignedRightShiftExpression */: - case 205 /* UnsignedRightShiftExpression */: - case 197 /* LessThanExpression */: - case 198 /* GreaterThanExpression */: - case 199 /* LessThanOrEqualExpression */: - case 200 /* GreaterThanOrEqualExpression */: - case 201 /* InstanceOfExpression */: - case 202 /* InExpression */: - case 193 /* EqualsWithTypeConversionExpression */: - case 194 /* NotEqualsWithTypeConversionExpression */: - case 195 /* EqualsExpression */: - case 196 /* NotEqualsExpression */: - case 192 /* BitwiseAndExpression */: - case 191 /* BitwiseExclusiveOrExpression */: - case 190 /* BitwiseOrExpression */: - case 189 /* LogicalAndExpression */: - case 188 /* LogicalOrExpression */: - case 183 /* OrAssignmentExpression */: - case 181 /* AndAssignmentExpression */: - case 182 /* ExclusiveOrAssignmentExpression */: - case 184 /* LeftShiftAssignmentExpression */: - case 185 /* SignedRightShiftAssignmentExpression */: - case 186 /* UnsignedRightShiftAssignmentExpression */: - case 176 /* AddAssignmentExpression */: - case 177 /* SubtractAssignmentExpression */: - case 178 /* MultiplyAssignmentExpression */: - case 179 /* DivideAssignmentExpression */: - case 180 /* ModuloAssignmentExpression */: - case 175 /* AssignmentExpression */: - case 174 /* CommaExpression */: - return visitor.visitBinaryExpression(element); - case 211 /* PostIncrementExpression */: - case 212 /* PostDecrementExpression */: - return visitor.visitPostfixUnaryExpression(element); - case 213 /* MemberAccessExpression */: - return visitor.visitMemberAccessExpression(element); - case 214 /* InvocationExpression */: - return visitor.visitInvocationExpression(element); - case 215 /* ArrayLiteralExpression */: - return visitor.visitArrayLiteralExpression(element); - case 216 /* ObjectLiteralExpression */: - return visitor.visitObjectLiteralExpression(element); - case 217 /* ObjectCreationExpression */: - return visitor.visitObjectCreationExpression(element); - case 218 /* ParenthesizedExpression */: - return visitor.visitParenthesizedExpression(element); - case 219 /* ParenthesizedArrowFunctionExpression */: - return visitor.visitParenthesizedArrowFunctionExpression(element); - case 220 /* SimpleArrowFunctionExpression */: - return visitor.visitSimpleArrowFunctionExpression(element); - case 221 /* CastExpression */: - return visitor.visitCastExpression(element); - case 222 /* ElementAccessExpression */: - return visitor.visitElementAccessExpression(element); - case 223 /* FunctionExpression */: - return visitor.visitFunctionExpression(element); - case 224 /* OmittedExpression */: - return visitor.visitOmittedExpression(element); - case 225 /* VariableDeclaration */: - return visitor.visitVariableDeclaration(element); - case 226 /* VariableDeclarator */: - return visitor.visitVariableDeclarator(element); - case 227 /* ArgumentList */: - return visitor.visitArgumentList(element); - case 228 /* ParameterList */: - return visitor.visitParameterList(element); - case 229 /* TypeArgumentList */: - return visitor.visitTypeArgumentList(element); - case 230 /* TypeParameterList */: - return visitor.visitTypeParameterList(element); - case 231 /* ExtendsHeritageClause */: - case 232 /* ImplementsHeritageClause */: - return visitor.visitHeritageClause(element); - case 233 /* EqualsValueClause */: - return visitor.visitEqualsValueClause(element); - case 234 /* CaseSwitchClause */: - return visitor.visitCaseSwitchClause(element); - case 235 /* DefaultSwitchClause */: - return visitor.visitDefaultSwitchClause(element); - case 236 /* ElseClause */: - return visitor.visitElseClause(element); - case 237 /* CatchClause */: - return visitor.visitCatchClause(element); - case 238 /* FinallyClause */: - return visitor.visitFinallyClause(element); - case 239 /* TypeParameter */: - return visitor.visitTypeParameter(element); - case 240 /* Constraint */: - return visitor.visitConstraint(element); - case 241 /* SimplePropertyAssignment */: - return visitor.visitSimplePropertyAssignment(element); - case 242 /* FunctionPropertyAssignment */: - return visitor.visitFunctionPropertyAssignment(element); - case 243 /* Parameter */: - return visitor.visitParameter(element); - case 244 /* EnumElement */: - return visitor.visitEnumElement(element); - case 245 /* TypeAnnotation */: - return visitor.visitTypeAnnotation(element); - case 246 /* ExternalModuleReference */: - return visitor.visitExternalModuleReference(element); - case 247 /* ModuleNameModuleReference */: - return visitor.visitModuleNameModuleReference(element); + case 122 /* SourceUnit */: return sourceUnitChildAt(element, index); + case 123 /* QualifiedName */: return qualifiedNameChildAt(element, index); + case 124 /* ObjectType */: return objectTypeChildAt(element, index); + case 125 /* FunctionType */: return functionTypeChildAt(element, index); + case 126 /* ArrayType */: return arrayTypeChildAt(element, index); + case 127 /* ConstructorType */: return constructorTypeChildAt(element, index); + case 128 /* GenericType */: return genericTypeChildAt(element, index); + case 129 /* TypeQuery */: return typeQueryChildAt(element, index); + case 130 /* TupleType */: return tupleTypeChildAt(element, index); + case 131 /* UnionType */: return unionTypeChildAt(element, index); + case 132 /* ParenthesizedType */: return parenthesizedTypeChildAt(element, index); + case 133 /* InterfaceDeclaration */: return interfaceDeclarationChildAt(element, index); + case 134 /* FunctionDeclaration */: return functionDeclarationChildAt(element, index); + case 135 /* ModuleDeclaration */: return moduleDeclarationChildAt(element, index); + case 136 /* ClassDeclaration */: return classDeclarationChildAt(element, index); + case 137 /* EnumDeclaration */: return enumDeclarationChildAt(element, index); + case 138 /* ImportDeclaration */: return importDeclarationChildAt(element, index); + case 139 /* ExportAssignment */: return exportAssignmentChildAt(element, index); + case 140 /* MemberFunctionDeclaration */: return memberFunctionDeclarationChildAt(element, index); + case 141 /* MemberVariableDeclaration */: return memberVariableDeclarationChildAt(element, index); + case 142 /* ConstructorDeclaration */: return constructorDeclarationChildAt(element, index); + case 143 /* IndexMemberDeclaration */: return indexMemberDeclarationChildAt(element, index); + case 144 /* GetAccessor */: return getAccessorChildAt(element, index); + case 145 /* SetAccessor */: return setAccessorChildAt(element, index); + case 146 /* PropertySignature */: return propertySignatureChildAt(element, index); + case 147 /* CallSignature */: return callSignatureChildAt(element, index); + case 148 /* ConstructSignature */: return constructSignatureChildAt(element, index); + case 149 /* IndexSignature */: return indexSignatureChildAt(element, index); + case 150 /* MethodSignature */: return methodSignatureChildAt(element, index); + case 151 /* Block */: return blockChildAt(element, index); + case 152 /* IfStatement */: return ifStatementChildAt(element, index); + case 153 /* VariableStatement */: return variableStatementChildAt(element, index); + case 154 /* ExpressionStatement */: return expressionStatementChildAt(element, index); + case 155 /* ReturnStatement */: return returnStatementChildAt(element, index); + case 156 /* SwitchStatement */: return switchStatementChildAt(element, index); + case 157 /* BreakStatement */: return breakStatementChildAt(element, index); + case 158 /* ContinueStatement */: return continueStatementChildAt(element, index); + case 159 /* ForStatement */: return forStatementChildAt(element, index); + case 160 /* ForInStatement */: return forInStatementChildAt(element, index); + case 161 /* EmptyStatement */: return emptyStatementChildAt(element, index); + case 162 /* ThrowStatement */: return throwStatementChildAt(element, index); + case 163 /* WhileStatement */: return whileStatementChildAt(element, index); + case 164 /* TryStatement */: return tryStatementChildAt(element, index); + case 165 /* LabeledStatement */: return labeledStatementChildAt(element, index); + case 166 /* DoStatement */: return doStatementChildAt(element, index); + case 167 /* DebuggerStatement */: return debuggerStatementChildAt(element, index); + case 168 /* WithStatement */: return withStatementChildAt(element, index); + case 169 /* PrefixUnaryExpression */: return prefixUnaryExpressionChildAt(element, index); + case 170 /* DeleteExpression */: return deleteExpressionChildAt(element, index); + case 171 /* TypeOfExpression */: return typeOfExpressionChildAt(element, index); + case 172 /* VoidExpression */: return voidExpressionChildAt(element, index); + case 173 /* ConditionalExpression */: return conditionalExpressionChildAt(element, index); + case 174 /* BinaryExpression */: return binaryExpressionChildAt(element, index); + case 175 /* PostfixUnaryExpression */: return postfixUnaryExpressionChildAt(element, index); + case 176 /* MemberAccessExpression */: return memberAccessExpressionChildAt(element, index); + case 177 /* InvocationExpression */: return invocationExpressionChildAt(element, index); + case 178 /* ArrayLiteralExpression */: return arrayLiteralExpressionChildAt(element, index); + case 179 /* ObjectLiteralExpression */: return objectLiteralExpressionChildAt(element, index); + case 180 /* ObjectCreationExpression */: return objectCreationExpressionChildAt(element, index); + case 181 /* ParenthesizedExpression */: return parenthesizedExpressionChildAt(element, index); + case 182 /* ParenthesizedArrowFunctionExpression */: return parenthesizedArrowFunctionExpressionChildAt(element, index); + case 183 /* SimpleArrowFunctionExpression */: return simpleArrowFunctionExpressionChildAt(element, index); + case 184 /* CastExpression */: return castExpressionChildAt(element, index); + case 185 /* ElementAccessExpression */: return elementAccessExpressionChildAt(element, index); + case 186 /* FunctionExpression */: return functionExpressionChildAt(element, index); + case 187 /* OmittedExpression */: return omittedExpressionChildAt(element, index); + case 188 /* TemplateExpression */: return templateExpressionChildAt(element, index); + case 189 /* TemplateAccessExpression */: return templateAccessExpressionChildAt(element, index); + case 190 /* VariableDeclaration */: return variableDeclarationChildAt(element, index); + case 191 /* VariableDeclarator */: return variableDeclaratorChildAt(element, index); + case 192 /* ArgumentList */: return argumentListChildAt(element, index); + case 193 /* ParameterList */: return parameterListChildAt(element, index); + case 194 /* TypeArgumentList */: return typeArgumentListChildAt(element, index); + case 195 /* TypeParameterList */: return typeParameterListChildAt(element, index); + case 196 /* HeritageClause */: return heritageClauseChildAt(element, index); + case 197 /* EqualsValueClause */: return equalsValueClauseChildAt(element, index); + case 198 /* CaseSwitchClause */: return caseSwitchClauseChildAt(element, index); + case 199 /* DefaultSwitchClause */: return defaultSwitchClauseChildAt(element, index); + case 200 /* ElseClause */: return elseClauseChildAt(element, index); + case 201 /* CatchClause */: return catchClauseChildAt(element, index); + case 202 /* FinallyClause */: return finallyClauseChildAt(element, index); + case 203 /* TemplateClause */: return templateClauseChildAt(element, index); + case 204 /* TypeParameter */: return typeParameterChildAt(element, index); + case 205 /* Constraint */: return constraintChildAt(element, index); + case 206 /* SimplePropertyAssignment */: return simplePropertyAssignmentChildAt(element, index); + case 207 /* FunctionPropertyAssignment */: return functionPropertyAssignmentChildAt(element, index); + case 208 /* Parameter */: return parameterChildAt(element, index); + case 209 /* EnumElement */: return enumElementChildAt(element, index); + case 210 /* TypeAnnotation */: return typeAnnotationChildAt(element, index); + case 211 /* ExternalModuleReference */: return externalModuleReferenceChildAt(element, index); + case 212 /* ModuleNameModuleReference */: return moduleNameModuleReferenceChildAt(element, index); + } + } + TypeScript.childAt = childAt; +})(TypeScript || (TypeScript = {})); +var TypeScript; +(function (TypeScript) { + function visitNodeOrToken(visitor, element) { + if (element === undefined) { + return undefined; + } + switch (element.kind()) { + case 122 /* SourceUnit */: return visitor.visitSourceUnit(element); + case 123 /* QualifiedName */: return visitor.visitQualifiedName(element); + case 124 /* ObjectType */: return visitor.visitObjectType(element); + case 125 /* FunctionType */: return visitor.visitFunctionType(element); + case 126 /* ArrayType */: return visitor.visitArrayType(element); + case 127 /* ConstructorType */: return visitor.visitConstructorType(element); + case 128 /* GenericType */: return visitor.visitGenericType(element); + case 129 /* TypeQuery */: return visitor.visitTypeQuery(element); + case 130 /* TupleType */: return visitor.visitTupleType(element); + case 131 /* UnionType */: return visitor.visitUnionType(element); + case 132 /* ParenthesizedType */: return visitor.visitParenthesizedType(element); + case 133 /* InterfaceDeclaration */: return visitor.visitInterfaceDeclaration(element); + case 134 /* FunctionDeclaration */: return visitor.visitFunctionDeclaration(element); + case 135 /* ModuleDeclaration */: return visitor.visitModuleDeclaration(element); + case 136 /* ClassDeclaration */: return visitor.visitClassDeclaration(element); + case 137 /* EnumDeclaration */: return visitor.visitEnumDeclaration(element); + case 138 /* ImportDeclaration */: return visitor.visitImportDeclaration(element); + case 139 /* ExportAssignment */: return visitor.visitExportAssignment(element); + case 140 /* MemberFunctionDeclaration */: return visitor.visitMemberFunctionDeclaration(element); + case 141 /* MemberVariableDeclaration */: return visitor.visitMemberVariableDeclaration(element); + case 142 /* ConstructorDeclaration */: return visitor.visitConstructorDeclaration(element); + case 143 /* IndexMemberDeclaration */: return visitor.visitIndexMemberDeclaration(element); + case 144 /* GetAccessor */: return visitor.visitGetAccessor(element); + case 145 /* SetAccessor */: return visitor.visitSetAccessor(element); + case 146 /* PropertySignature */: return visitor.visitPropertySignature(element); + case 147 /* CallSignature */: return visitor.visitCallSignature(element); + case 148 /* ConstructSignature */: return visitor.visitConstructSignature(element); + case 149 /* IndexSignature */: return visitor.visitIndexSignature(element); + case 150 /* MethodSignature */: return visitor.visitMethodSignature(element); + case 151 /* Block */: return visitor.visitBlock(element); + case 152 /* IfStatement */: return visitor.visitIfStatement(element); + case 153 /* VariableStatement */: return visitor.visitVariableStatement(element); + case 154 /* ExpressionStatement */: return visitor.visitExpressionStatement(element); + case 155 /* ReturnStatement */: return visitor.visitReturnStatement(element); + case 156 /* SwitchStatement */: return visitor.visitSwitchStatement(element); + case 157 /* BreakStatement */: return visitor.visitBreakStatement(element); + case 158 /* ContinueStatement */: return visitor.visitContinueStatement(element); + case 159 /* ForStatement */: return visitor.visitForStatement(element); + case 160 /* ForInStatement */: return visitor.visitForInStatement(element); + case 161 /* EmptyStatement */: return visitor.visitEmptyStatement(element); + case 162 /* ThrowStatement */: return visitor.visitThrowStatement(element); + case 163 /* WhileStatement */: return visitor.visitWhileStatement(element); + case 164 /* TryStatement */: return visitor.visitTryStatement(element); + case 165 /* LabeledStatement */: return visitor.visitLabeledStatement(element); + case 166 /* DoStatement */: return visitor.visitDoStatement(element); + case 167 /* DebuggerStatement */: return visitor.visitDebuggerStatement(element); + case 168 /* WithStatement */: return visitor.visitWithStatement(element); + case 169 /* PrefixUnaryExpression */: return visitor.visitPrefixUnaryExpression(element); + case 170 /* DeleteExpression */: return visitor.visitDeleteExpression(element); + case 171 /* TypeOfExpression */: return visitor.visitTypeOfExpression(element); + case 172 /* VoidExpression */: return visitor.visitVoidExpression(element); + case 173 /* ConditionalExpression */: return visitor.visitConditionalExpression(element); + case 174 /* BinaryExpression */: return visitor.visitBinaryExpression(element); + case 175 /* PostfixUnaryExpression */: return visitor.visitPostfixUnaryExpression(element); + case 176 /* MemberAccessExpression */: return visitor.visitMemberAccessExpression(element); + case 177 /* InvocationExpression */: return visitor.visitInvocationExpression(element); + case 178 /* ArrayLiteralExpression */: return visitor.visitArrayLiteralExpression(element); + case 179 /* ObjectLiteralExpression */: return visitor.visitObjectLiteralExpression(element); + case 180 /* ObjectCreationExpression */: return visitor.visitObjectCreationExpression(element); + case 181 /* ParenthesizedExpression */: return visitor.visitParenthesizedExpression(element); + case 182 /* ParenthesizedArrowFunctionExpression */: return visitor.visitParenthesizedArrowFunctionExpression(element); + case 183 /* SimpleArrowFunctionExpression */: return visitor.visitSimpleArrowFunctionExpression(element); + case 184 /* CastExpression */: return visitor.visitCastExpression(element); + case 185 /* ElementAccessExpression */: return visitor.visitElementAccessExpression(element); + case 186 /* FunctionExpression */: return visitor.visitFunctionExpression(element); + case 187 /* OmittedExpression */: return visitor.visitOmittedExpression(element); + case 188 /* TemplateExpression */: return visitor.visitTemplateExpression(element); + case 189 /* TemplateAccessExpression */: return visitor.visitTemplateAccessExpression(element); + case 190 /* VariableDeclaration */: return visitor.visitVariableDeclaration(element); + case 191 /* VariableDeclarator */: return visitor.visitVariableDeclarator(element); + case 192 /* ArgumentList */: return visitor.visitArgumentList(element); + case 193 /* ParameterList */: return visitor.visitParameterList(element); + case 194 /* TypeArgumentList */: return visitor.visitTypeArgumentList(element); + case 195 /* TypeParameterList */: return visitor.visitTypeParameterList(element); + case 196 /* HeritageClause */: return visitor.visitHeritageClause(element); + case 197 /* EqualsValueClause */: return visitor.visitEqualsValueClause(element); + case 198 /* CaseSwitchClause */: return visitor.visitCaseSwitchClause(element); + case 199 /* DefaultSwitchClause */: return visitor.visitDefaultSwitchClause(element); + case 200 /* ElseClause */: return visitor.visitElseClause(element); + case 201 /* CatchClause */: return visitor.visitCatchClause(element); + case 202 /* FinallyClause */: return visitor.visitFinallyClause(element); + case 203 /* TemplateClause */: return visitor.visitTemplateClause(element); + case 204 /* TypeParameter */: return visitor.visitTypeParameter(element); + case 205 /* Constraint */: return visitor.visitConstraint(element); + case 206 /* SimplePropertyAssignment */: return visitor.visitSimplePropertyAssignment(element); + case 207 /* FunctionPropertyAssignment */: return visitor.visitFunctionPropertyAssignment(element); + case 208 /* Parameter */: return visitor.visitParameter(element); + case 209 /* EnumElement */: return visitor.visitEnumElement(element); + case 210 /* TypeAnnotation */: return visitor.visitTypeAnnotation(element); + case 211 /* ExternalModuleReference */: return visitor.visitExternalModuleReference(element); + case 212 /* ModuleNameModuleReference */: return visitor.visitModuleNameModuleReference(element); + default: return visitor.visitToken(element); } - throw TypeScript.Errors.invalidOperation(); } TypeScript.visitNodeOrToken = visitNodeOrToken; })(TypeScript || (TypeScript = {})); @@ -22069,44 +22983,15 @@ var TypeScript; } SyntaxWalker.prototype.visitToken = function (token) { }; - SyntaxWalker.prototype.visitNode = function (node) { - TypeScript.visitNodeOrToken(this, node); - }; - SyntaxWalker.prototype.visitNodeOrToken = function (nodeOrToken) { - if (TypeScript.isToken(nodeOrToken)) { - this.visitToken(nodeOrToken); - } - else { - this.visitNode(nodeOrToken); - } - }; SyntaxWalker.prototype.visitOptionalToken = function (token) { - if (token === null) { + if (token === undefined) { return; } this.visitToken(token); }; - SyntaxWalker.prototype.visitOptionalNode = function (node) { - if (node === null) { - return; - } - this.visitNode(node); - }; - SyntaxWalker.prototype.visitOptionalNodeOrToken = function (nodeOrToken) { - if (nodeOrToken === null) { - return; - } - this.visitNodeOrToken(nodeOrToken); - }; SyntaxWalker.prototype.visitList = function (list) { for (var i = 0, n = list.length; i < n; i++) { - this.visitNodeOrToken(list[i]); - } - }; - SyntaxWalker.prototype.visitSeparatedList = function (list) { - for (var i = 0, n = TypeScript.childCount(list); i < n; i++) { - var item = TypeScript.childAt(list, i); - this.visitNodeOrToken(item); + TypeScript.visitNodeOrToken(this, list[i]); } }; SyntaxWalker.prototype.visitSourceUnit = function (node) { @@ -22114,66 +22999,76 @@ var TypeScript; this.visitToken(node.endOfFileToken); }; SyntaxWalker.prototype.visitQualifiedName = function (node) { - this.visitNodeOrToken(node.left); + TypeScript.visitNodeOrToken(this, node.left); this.visitToken(node.dotToken); this.visitToken(node.right); }; SyntaxWalker.prototype.visitObjectType = function (node) { this.visitToken(node.openBraceToken); - this.visitSeparatedList(node.typeMembers); + this.visitList(node.typeMembers); this.visitToken(node.closeBraceToken); }; SyntaxWalker.prototype.visitFunctionType = function (node) { - this.visitOptionalNode(node.typeParameterList); - this.visitNode(node.parameterList); + TypeScript.visitNodeOrToken(this, node.typeParameterList); + TypeScript.visitNodeOrToken(this, node.parameterList); this.visitToken(node.equalsGreaterThanToken); - this.visitNodeOrToken(node.type); + TypeScript.visitNodeOrToken(this, node.type); }; SyntaxWalker.prototype.visitArrayType = function (node) { - this.visitNodeOrToken(node.type); + TypeScript.visitNodeOrToken(this, node.type); this.visitToken(node.openBracketToken); this.visitToken(node.closeBracketToken); }; SyntaxWalker.prototype.visitConstructorType = function (node) { this.visitToken(node.newKeyword); - this.visitOptionalNode(node.typeParameterList); - this.visitNode(node.parameterList); + TypeScript.visitNodeOrToken(this, node.typeParameterList); + TypeScript.visitNodeOrToken(this, node.parameterList); this.visitToken(node.equalsGreaterThanToken); - this.visitNodeOrToken(node.type); + TypeScript.visitNodeOrToken(this, node.type); }; SyntaxWalker.prototype.visitGenericType = function (node) { - this.visitNodeOrToken(node.name); - this.visitNode(node.typeArgumentList); + TypeScript.visitNodeOrToken(this, node.name); + TypeScript.visitNodeOrToken(this, node.typeArgumentList); }; SyntaxWalker.prototype.visitTypeQuery = function (node) { this.visitToken(node.typeOfKeyword); - this.visitNodeOrToken(node.name); + TypeScript.visitNodeOrToken(this, node.name); }; SyntaxWalker.prototype.visitTupleType = function (node) { this.visitToken(node.openBracketToken); - this.visitSeparatedList(node.types); + this.visitList(node.types); this.visitToken(node.closeBracketToken); }; + SyntaxWalker.prototype.visitUnionType = function (node) { + TypeScript.visitNodeOrToken(this, node.left); + this.visitToken(node.barToken); + TypeScript.visitNodeOrToken(this, node.right); + }; + SyntaxWalker.prototype.visitParenthesizedType = function (node) { + this.visitToken(node.openParenToken); + TypeScript.visitNodeOrToken(this, node.type); + this.visitToken(node.closeParenToken); + }; SyntaxWalker.prototype.visitInterfaceDeclaration = function (node) { this.visitList(node.modifiers); this.visitToken(node.interfaceKeyword); this.visitToken(node.identifier); - this.visitOptionalNode(node.typeParameterList); + TypeScript.visitNodeOrToken(this, node.typeParameterList); this.visitList(node.heritageClauses); - this.visitNode(node.body); + TypeScript.visitNodeOrToken(this, node.body); }; SyntaxWalker.prototype.visitFunctionDeclaration = function (node) { this.visitList(node.modifiers); this.visitToken(node.functionKeyword); this.visitToken(node.identifier); - this.visitNode(node.callSignature); - this.visitOptionalNode(node.block); + TypeScript.visitNodeOrToken(this, node.callSignature); + TypeScript.visitNodeOrToken(this, node.block); this.visitOptionalToken(node.semicolonToken); }; SyntaxWalker.prototype.visitModuleDeclaration = function (node) { this.visitList(node.modifiers); this.visitToken(node.moduleKeyword); - this.visitOptionalNodeOrToken(node.name); + TypeScript.visitNodeOrToken(this, node.name); this.visitOptionalToken(node.stringLiteral); this.visitToken(node.openBraceToken); this.visitList(node.moduleElements); @@ -22183,7 +23078,7 @@ var TypeScript; this.visitList(node.modifiers); this.visitToken(node.classKeyword); this.visitToken(node.identifier); - this.visitOptionalNode(node.typeParameterList); + TypeScript.visitNodeOrToken(this, node.typeParameterList); this.visitList(node.heritageClauses); this.visitToken(node.openBraceToken); this.visitList(node.classElements); @@ -22194,7 +23089,7 @@ var TypeScript; this.visitToken(node.enumKeyword); this.visitToken(node.identifier); this.visitToken(node.openBraceToken); - this.visitSeparatedList(node.enumElements); + this.visitList(node.enumElements); this.visitToken(node.closeBraceToken); }; SyntaxWalker.prototype.visitImportDeclaration = function (node) { @@ -22202,7 +23097,7 @@ var TypeScript; this.visitToken(node.importKeyword); this.visitToken(node.identifier); this.visitToken(node.equalsToken); - this.visitNodeOrToken(node.moduleReference); + TypeScript.visitNodeOrToken(this, node.moduleReference); this.visitOptionalToken(node.semicolonToken); }; SyntaxWalker.prototype.visitExportAssignment = function (node) { @@ -22214,65 +23109,65 @@ var TypeScript; SyntaxWalker.prototype.visitMemberFunctionDeclaration = function (node) { this.visitList(node.modifiers); this.visitToken(node.propertyName); - this.visitNode(node.callSignature); - this.visitOptionalNode(node.block); + TypeScript.visitNodeOrToken(this, node.callSignature); + TypeScript.visitNodeOrToken(this, node.block); this.visitOptionalToken(node.semicolonToken); }; SyntaxWalker.prototype.visitMemberVariableDeclaration = function (node) { this.visitList(node.modifiers); - this.visitNode(node.variableDeclarator); + TypeScript.visitNodeOrToken(this, node.variableDeclarator); this.visitOptionalToken(node.semicolonToken); }; SyntaxWalker.prototype.visitConstructorDeclaration = function (node) { this.visitList(node.modifiers); this.visitToken(node.constructorKeyword); - this.visitNode(node.callSignature); - this.visitOptionalNode(node.block); + TypeScript.visitNodeOrToken(this, node.callSignature); + TypeScript.visitNodeOrToken(this, node.block); this.visitOptionalToken(node.semicolonToken); }; SyntaxWalker.prototype.visitIndexMemberDeclaration = function (node) { this.visitList(node.modifiers); - this.visitNode(node.indexSignature); + TypeScript.visitNodeOrToken(this, node.indexSignature); this.visitOptionalToken(node.semicolonToken); }; SyntaxWalker.prototype.visitGetAccessor = function (node) { this.visitList(node.modifiers); this.visitToken(node.getKeyword); this.visitToken(node.propertyName); - this.visitNode(node.callSignature); - this.visitNode(node.block); + TypeScript.visitNodeOrToken(this, node.callSignature); + TypeScript.visitNodeOrToken(this, node.block); }; SyntaxWalker.prototype.visitSetAccessor = function (node) { this.visitList(node.modifiers); this.visitToken(node.setKeyword); this.visitToken(node.propertyName); - this.visitNode(node.callSignature); - this.visitNode(node.block); + TypeScript.visitNodeOrToken(this, node.callSignature); + TypeScript.visitNodeOrToken(this, node.block); }; SyntaxWalker.prototype.visitPropertySignature = function (node) { this.visitToken(node.propertyName); this.visitOptionalToken(node.questionToken); - this.visitOptionalNode(node.typeAnnotation); + TypeScript.visitNodeOrToken(this, node.typeAnnotation); }; SyntaxWalker.prototype.visitCallSignature = function (node) { - this.visitOptionalNode(node.typeParameterList); - this.visitNode(node.parameterList); - this.visitOptionalNode(node.typeAnnotation); + TypeScript.visitNodeOrToken(this, node.typeParameterList); + TypeScript.visitNodeOrToken(this, node.parameterList); + TypeScript.visitNodeOrToken(this, node.typeAnnotation); }; SyntaxWalker.prototype.visitConstructSignature = function (node) { this.visitToken(node.newKeyword); - this.visitNode(node.callSignature); + TypeScript.visitNodeOrToken(this, node.callSignature); }; SyntaxWalker.prototype.visitIndexSignature = function (node) { this.visitToken(node.openBracketToken); - this.visitSeparatedList(node.parameters); + this.visitList(node.parameters); this.visitToken(node.closeBracketToken); - this.visitOptionalNode(node.typeAnnotation); + TypeScript.visitNodeOrToken(this, node.typeAnnotation); }; SyntaxWalker.prototype.visitMethodSignature = function (node) { this.visitToken(node.propertyName); this.visitOptionalToken(node.questionToken); - this.visitNode(node.callSignature); + TypeScript.visitNodeOrToken(this, node.callSignature); }; SyntaxWalker.prototype.visitBlock = function (node) { this.visitToken(node.openBraceToken); @@ -22282,29 +23177,29 @@ var TypeScript; SyntaxWalker.prototype.visitIfStatement = function (node) { this.visitToken(node.ifKeyword); this.visitToken(node.openParenToken); - this.visitNodeOrToken(node.condition); + TypeScript.visitNodeOrToken(this, node.condition); this.visitToken(node.closeParenToken); - this.visitNodeOrToken(node.statement); - this.visitOptionalNode(node.elseClause); + TypeScript.visitNodeOrToken(this, node.statement); + TypeScript.visitNodeOrToken(this, node.elseClause); }; SyntaxWalker.prototype.visitVariableStatement = function (node) { this.visitList(node.modifiers); - this.visitNode(node.variableDeclaration); + TypeScript.visitNodeOrToken(this, node.variableDeclaration); this.visitOptionalToken(node.semicolonToken); }; SyntaxWalker.prototype.visitExpressionStatement = function (node) { - this.visitNodeOrToken(node.expression); + TypeScript.visitNodeOrToken(this, node.expression); this.visitOptionalToken(node.semicolonToken); }; SyntaxWalker.prototype.visitReturnStatement = function (node) { this.visitToken(node.returnKeyword); - this.visitOptionalNodeOrToken(node.expression); + TypeScript.visitNodeOrToken(this, node.expression); this.visitOptionalToken(node.semicolonToken); }; SyntaxWalker.prototype.visitSwitchStatement = function (node) { this.visitToken(node.switchKeyword); this.visitToken(node.openParenToken); - this.visitNodeOrToken(node.expression); + TypeScript.visitNodeOrToken(this, node.expression); this.visitToken(node.closeParenToken); this.visitToken(node.openBraceToken); this.visitList(node.switchClauses); @@ -22323,57 +23218,57 @@ var TypeScript; SyntaxWalker.prototype.visitForStatement = function (node) { this.visitToken(node.forKeyword); this.visitToken(node.openParenToken); - this.visitOptionalNode(node.variableDeclaration); - this.visitOptionalNodeOrToken(node.initializer); + TypeScript.visitNodeOrToken(this, node.variableDeclaration); + TypeScript.visitNodeOrToken(this, node.initializer); this.visitToken(node.firstSemicolonToken); - this.visitOptionalNodeOrToken(node.condition); + TypeScript.visitNodeOrToken(this, node.condition); this.visitToken(node.secondSemicolonToken); - this.visitOptionalNodeOrToken(node.incrementor); + TypeScript.visitNodeOrToken(this, node.incrementor); this.visitToken(node.closeParenToken); - this.visitNodeOrToken(node.statement); + TypeScript.visitNodeOrToken(this, node.statement); }; SyntaxWalker.prototype.visitForInStatement = function (node) { this.visitToken(node.forKeyword); this.visitToken(node.openParenToken); - this.visitOptionalNode(node.variableDeclaration); - this.visitOptionalNodeOrToken(node.left); + TypeScript.visitNodeOrToken(this, node.variableDeclaration); + TypeScript.visitNodeOrToken(this, node.left); this.visitToken(node.inKeyword); - this.visitNodeOrToken(node.expression); + TypeScript.visitNodeOrToken(this, node.expression); this.visitToken(node.closeParenToken); - this.visitNodeOrToken(node.statement); + TypeScript.visitNodeOrToken(this, node.statement); }; SyntaxWalker.prototype.visitEmptyStatement = function (node) { this.visitToken(node.semicolonToken); }; SyntaxWalker.prototype.visitThrowStatement = function (node) { this.visitToken(node.throwKeyword); - this.visitNodeOrToken(node.expression); + TypeScript.visitNodeOrToken(this, node.expression); this.visitOptionalToken(node.semicolonToken); }; SyntaxWalker.prototype.visitWhileStatement = function (node) { this.visitToken(node.whileKeyword); this.visitToken(node.openParenToken); - this.visitNodeOrToken(node.condition); + TypeScript.visitNodeOrToken(this, node.condition); this.visitToken(node.closeParenToken); - this.visitNodeOrToken(node.statement); + TypeScript.visitNodeOrToken(this, node.statement); }; SyntaxWalker.prototype.visitTryStatement = function (node) { this.visitToken(node.tryKeyword); - this.visitNode(node.block); - this.visitOptionalNode(node.catchClause); - this.visitOptionalNode(node.finallyClause); + TypeScript.visitNodeOrToken(this, node.block); + TypeScript.visitNodeOrToken(this, node.catchClause); + TypeScript.visitNodeOrToken(this, node.finallyClause); }; SyntaxWalker.prototype.visitLabeledStatement = function (node) { this.visitToken(node.identifier); this.visitToken(node.colonToken); - this.visitNodeOrToken(node.statement); + TypeScript.visitNodeOrToken(this, node.statement); }; SyntaxWalker.prototype.visitDoStatement = function (node) { this.visitToken(node.doKeyword); - this.visitNodeOrToken(node.statement); + TypeScript.visitNodeOrToken(this, node.statement); this.visitToken(node.whileKeyword); this.visitToken(node.openParenToken); - this.visitNodeOrToken(node.condition); + TypeScript.visitNodeOrToken(this, node.condition); this.visitToken(node.closeParenToken); this.visitOptionalToken(node.semicolonToken); }; @@ -22384,144 +23279,152 @@ var TypeScript; SyntaxWalker.prototype.visitWithStatement = function (node) { this.visitToken(node.withKeyword); this.visitToken(node.openParenToken); - this.visitNodeOrToken(node.condition); + TypeScript.visitNodeOrToken(this, node.condition); this.visitToken(node.closeParenToken); - this.visitNodeOrToken(node.statement); + TypeScript.visitNodeOrToken(this, node.statement); }; SyntaxWalker.prototype.visitPrefixUnaryExpression = function (node) { this.visitToken(node.operatorToken); - this.visitNodeOrToken(node.operand); + TypeScript.visitNodeOrToken(this, node.operand); }; SyntaxWalker.prototype.visitDeleteExpression = function (node) { this.visitToken(node.deleteKeyword); - this.visitNodeOrToken(node.expression); + TypeScript.visitNodeOrToken(this, node.expression); }; SyntaxWalker.prototype.visitTypeOfExpression = function (node) { this.visitToken(node.typeOfKeyword); - this.visitNodeOrToken(node.expression); + TypeScript.visitNodeOrToken(this, node.expression); }; SyntaxWalker.prototype.visitVoidExpression = function (node) { this.visitToken(node.voidKeyword); - this.visitNodeOrToken(node.expression); + TypeScript.visitNodeOrToken(this, node.expression); }; SyntaxWalker.prototype.visitConditionalExpression = function (node) { - this.visitNodeOrToken(node.condition); + TypeScript.visitNodeOrToken(this, node.condition); this.visitToken(node.questionToken); - this.visitNodeOrToken(node.whenTrue); + TypeScript.visitNodeOrToken(this, node.whenTrue); this.visitToken(node.colonToken); - this.visitNodeOrToken(node.whenFalse); + TypeScript.visitNodeOrToken(this, node.whenFalse); }; SyntaxWalker.prototype.visitBinaryExpression = function (node) { - this.visitNodeOrToken(node.left); + TypeScript.visitNodeOrToken(this, node.left); this.visitToken(node.operatorToken); - this.visitNodeOrToken(node.right); + TypeScript.visitNodeOrToken(this, node.right); }; SyntaxWalker.prototype.visitPostfixUnaryExpression = function (node) { - this.visitNodeOrToken(node.operand); + TypeScript.visitNodeOrToken(this, node.operand); this.visitToken(node.operatorToken); }; SyntaxWalker.prototype.visitMemberAccessExpression = function (node) { - this.visitNodeOrToken(node.expression); + TypeScript.visitNodeOrToken(this, node.expression); this.visitToken(node.dotToken); this.visitToken(node.name); }; SyntaxWalker.prototype.visitInvocationExpression = function (node) { - this.visitNodeOrToken(node.expression); - this.visitNode(node.argumentList); + TypeScript.visitNodeOrToken(this, node.expression); + TypeScript.visitNodeOrToken(this, node.argumentList); }; SyntaxWalker.prototype.visitArrayLiteralExpression = function (node) { this.visitToken(node.openBracketToken); - this.visitSeparatedList(node.expressions); + this.visitList(node.expressions); this.visitToken(node.closeBracketToken); }; SyntaxWalker.prototype.visitObjectLiteralExpression = function (node) { this.visitToken(node.openBraceToken); - this.visitSeparatedList(node.propertyAssignments); + this.visitList(node.propertyAssignments); this.visitToken(node.closeBraceToken); }; SyntaxWalker.prototype.visitObjectCreationExpression = function (node) { this.visitToken(node.newKeyword); - this.visitNodeOrToken(node.expression); - this.visitOptionalNode(node.argumentList); + TypeScript.visitNodeOrToken(this, node.expression); + TypeScript.visitNodeOrToken(this, node.argumentList); }; SyntaxWalker.prototype.visitParenthesizedExpression = function (node) { this.visitToken(node.openParenToken); - this.visitNodeOrToken(node.expression); + TypeScript.visitNodeOrToken(this, node.expression); this.visitToken(node.closeParenToken); }; SyntaxWalker.prototype.visitParenthesizedArrowFunctionExpression = function (node) { - this.visitNode(node.callSignature); + TypeScript.visitNodeOrToken(this, node.callSignature); this.visitToken(node.equalsGreaterThanToken); - this.visitOptionalNode(node.block); - this.visitOptionalNodeOrToken(node.expression); + TypeScript.visitNodeOrToken(this, node.block); + TypeScript.visitNodeOrToken(this, node.expression); }; SyntaxWalker.prototype.visitSimpleArrowFunctionExpression = function (node) { - this.visitNode(node.parameter); + TypeScript.visitNodeOrToken(this, node.parameter); this.visitToken(node.equalsGreaterThanToken); - this.visitOptionalNode(node.block); - this.visitOptionalNodeOrToken(node.expression); + TypeScript.visitNodeOrToken(this, node.block); + TypeScript.visitNodeOrToken(this, node.expression); }; SyntaxWalker.prototype.visitCastExpression = function (node) { this.visitToken(node.lessThanToken); - this.visitNodeOrToken(node.type); + TypeScript.visitNodeOrToken(this, node.type); this.visitToken(node.greaterThanToken); - this.visitNodeOrToken(node.expression); + TypeScript.visitNodeOrToken(this, node.expression); }; SyntaxWalker.prototype.visitElementAccessExpression = function (node) { - this.visitNodeOrToken(node.expression); + TypeScript.visitNodeOrToken(this, node.expression); this.visitToken(node.openBracketToken); - this.visitNodeOrToken(node.argumentExpression); + TypeScript.visitNodeOrToken(this, node.argumentExpression); this.visitToken(node.closeBracketToken); }; SyntaxWalker.prototype.visitFunctionExpression = function (node) { this.visitToken(node.functionKeyword); this.visitOptionalToken(node.identifier); - this.visitNode(node.callSignature); - this.visitNode(node.block); + TypeScript.visitNodeOrToken(this, node.callSignature); + TypeScript.visitNodeOrToken(this, node.block); }; SyntaxWalker.prototype.visitOmittedExpression = function (node) { }; + SyntaxWalker.prototype.visitTemplateExpression = function (node) { + this.visitToken(node.templateStartToken); + this.visitList(node.templateClauses); + }; + SyntaxWalker.prototype.visitTemplateAccessExpression = function (node) { + TypeScript.visitNodeOrToken(this, node.expression); + TypeScript.visitNodeOrToken(this, node.templateExpression); + }; SyntaxWalker.prototype.visitVariableDeclaration = function (node) { this.visitToken(node.varKeyword); - this.visitSeparatedList(node.variableDeclarators); + this.visitList(node.variableDeclarators); }; SyntaxWalker.prototype.visitVariableDeclarator = function (node) { this.visitToken(node.propertyName); - this.visitOptionalNode(node.typeAnnotation); - this.visitOptionalNode(node.equalsValueClause); + TypeScript.visitNodeOrToken(this, node.typeAnnotation); + TypeScript.visitNodeOrToken(this, node.equalsValueClause); }; SyntaxWalker.prototype.visitArgumentList = function (node) { - this.visitOptionalNode(node.typeArgumentList); + TypeScript.visitNodeOrToken(this, node.typeArgumentList); this.visitToken(node.openParenToken); - this.visitSeparatedList(node.arguments); + this.visitList(node.arguments); this.visitToken(node.closeParenToken); }; SyntaxWalker.prototype.visitParameterList = function (node) { this.visitToken(node.openParenToken); - this.visitSeparatedList(node.parameters); + this.visitList(node.parameters); this.visitToken(node.closeParenToken); }; SyntaxWalker.prototype.visitTypeArgumentList = function (node) { this.visitToken(node.lessThanToken); - this.visitSeparatedList(node.typeArguments); + this.visitList(node.typeArguments); this.visitToken(node.greaterThanToken); }; SyntaxWalker.prototype.visitTypeParameterList = function (node) { this.visitToken(node.lessThanToken); - this.visitSeparatedList(node.typeParameters); + this.visitList(node.typeParameters); this.visitToken(node.greaterThanToken); }; SyntaxWalker.prototype.visitHeritageClause = function (node) { this.visitToken(node.extendsOrImplementsKeyword); - this.visitSeparatedList(node.typeNames); + this.visitList(node.typeNames); }; SyntaxWalker.prototype.visitEqualsValueClause = function (node) { this.visitToken(node.equalsToken); - this.visitNodeOrToken(node.value); + TypeScript.visitNodeOrToken(this, node.value); }; SyntaxWalker.prototype.visitCaseSwitchClause = function (node) { this.visitToken(node.caseKeyword); - this.visitNodeOrToken(node.expression); + TypeScript.visitNodeOrToken(this, node.expression); this.visitToken(node.colonToken); this.visitList(node.statements); }; @@ -22532,53 +23435,57 @@ var TypeScript; }; SyntaxWalker.prototype.visitElseClause = function (node) { this.visitToken(node.elseKeyword); - this.visitNodeOrToken(node.statement); + TypeScript.visitNodeOrToken(this, node.statement); }; SyntaxWalker.prototype.visitCatchClause = function (node) { this.visitToken(node.catchKeyword); this.visitToken(node.openParenToken); this.visitToken(node.identifier); - this.visitOptionalNode(node.typeAnnotation); + TypeScript.visitNodeOrToken(this, node.typeAnnotation); this.visitToken(node.closeParenToken); - this.visitNode(node.block); + TypeScript.visitNodeOrToken(this, node.block); }; SyntaxWalker.prototype.visitFinallyClause = function (node) { this.visitToken(node.finallyKeyword); - this.visitNode(node.block); + TypeScript.visitNodeOrToken(this, node.block); + }; + SyntaxWalker.prototype.visitTemplateClause = function (node) { + TypeScript.visitNodeOrToken(this, node.expression); + this.visitToken(node.templateMiddleOrEndToken); }; SyntaxWalker.prototype.visitTypeParameter = function (node) { this.visitToken(node.identifier); - this.visitOptionalNode(node.constraint); + TypeScript.visitNodeOrToken(this, node.constraint); }; SyntaxWalker.prototype.visitConstraint = function (node) { this.visitToken(node.extendsKeyword); - this.visitNodeOrToken(node.typeOrExpression); + TypeScript.visitNodeOrToken(this, node.typeOrExpression); }; SyntaxWalker.prototype.visitSimplePropertyAssignment = function (node) { this.visitToken(node.propertyName); this.visitToken(node.colonToken); - this.visitNodeOrToken(node.expression); + TypeScript.visitNodeOrToken(this, node.expression); }; SyntaxWalker.prototype.visitFunctionPropertyAssignment = function (node) { this.visitToken(node.propertyName); - this.visitNode(node.callSignature); - this.visitNode(node.block); + TypeScript.visitNodeOrToken(this, node.callSignature); + TypeScript.visitNodeOrToken(this, node.block); }; SyntaxWalker.prototype.visitParameter = function (node) { this.visitOptionalToken(node.dotDotDotToken); this.visitList(node.modifiers); this.visitToken(node.identifier); this.visitOptionalToken(node.questionToken); - this.visitOptionalNode(node.typeAnnotation); - this.visitOptionalNode(node.equalsValueClause); + TypeScript.visitNodeOrToken(this, node.typeAnnotation); + TypeScript.visitNodeOrToken(this, node.equalsValueClause); }; SyntaxWalker.prototype.visitEnumElement = function (node) { this.visitToken(node.propertyName); - this.visitOptionalNode(node.equalsValueClause); + TypeScript.visitNodeOrToken(this, node.equalsValueClause); }; SyntaxWalker.prototype.visitTypeAnnotation = function (node) { this.visitToken(node.colonToken); - this.visitNodeOrToken(node.type); + TypeScript.visitNodeOrToken(this, node.type); }; SyntaxWalker.prototype.visitExternalModuleReference = function (node) { this.visitToken(node.requireKeyword); @@ -22587,38 +23494,16 @@ var TypeScript; this.visitToken(node.closeParenToken); }; SyntaxWalker.prototype.visitModuleNameModuleReference = function (node) { - this.visitNodeOrToken(node.moduleName); + TypeScript.visitNodeOrToken(this, node.moduleName); }; return SyntaxWalker; })(); TypeScript.SyntaxWalker = SyntaxWalker; })(TypeScript || (TypeScript = {})); var TypeScript; -(function (TypeScript) { - var DepthLimitedWalker = (function (_super) { - __extends(DepthLimitedWalker, _super); - function DepthLimitedWalker(maximumDepth) { - _super.call(this); - this._depth = 0; - this._maximumDepth = 0; - this._maximumDepth = maximumDepth; - } - DepthLimitedWalker.prototype.visitNode = function (node) { - if (this._depth < this._maximumDepth) { - this._depth++; - _super.prototype.visitNode.call(this, node); - this._depth--; - } - }; - return DepthLimitedWalker; - })(TypeScript.SyntaxWalker); - TypeScript.DepthLimitedWalker = DepthLimitedWalker; -})(TypeScript || (TypeScript = {})); -var TypeScript; (function (TypeScript) { var Parser; (function (Parser) { - Parser.syntaxFactory; var arrayPool = []; var arrayPoolCount = 0; function getArray() { @@ -22627,14 +23512,9 @@ var TypeScript; } arrayPoolCount--; var result = arrayPool[arrayPoolCount]; - arrayPool[arrayPoolCount] = null; + arrayPool[arrayPoolCount] = undefined; return result; } - function returnZeroLengthArray(array) { - if (array.length === 0) { - returnArray(array); - } - } function returnArray(array) { array.length = 0; arrayPool[arrayPoolCount] = array; @@ -22655,17 +23535,17 @@ var TypeScript; var result = parseSyntaxTreeWorker(isDeclaration); diagnostics = []; parseNodeData = 0 /* None */; - fileName = null; + fileName = undefined; source.release(); - source = null; - _source = null; + source = undefined; + _source = undefined; return result; } function parseSyntaxTreeWorker(isDeclaration) { var sourceUnit = parseSourceUnit(); var allDiagnostics = source.tokenDiagnostics().concat(diagnostics); allDiagnostics.sort(function (a, b) { return a.start() - b.start(); }); - return new TypeScript.SyntaxTree(Parser.syntaxFactory.isConcrete, sourceUnit, isDeclaration, allDiagnostics, fileName, source.text, languageVersion); + return new TypeScript.SyntaxTree(sourceUnit, isDeclaration, allDiagnostics, fileName, source.text, languageVersion); } function getRewindPoint() { var rewindPoint = source.getRewindPoint(); @@ -22683,8 +23563,8 @@ var TypeScript; } function currentNode() { var node = source.currentNode(); - if (node === null || TypeScript.parsedInStrictMode(node) !== isInStrictMode) { - return null; + if (!node || TypeScript.parsedInStrictMode(node) !== isInStrictMode) { + return undefined; } return node; } @@ -22716,11 +23596,11 @@ var TypeScript; if (_currentToken.kind() === kind) { return consumeToken(_currentToken); } - return null; + return undefined; } function isIdentifier(token) { var tokenKind = token.kind(); - if (tokenKind === 11 /* IdentifierName */) { + if (tokenKind === 9 /* IdentifierName */) { return true; } if (tokenKind >= TypeScript.SyntaxKind.FirstFutureReservedStrictKeyword) { @@ -22734,27 +23614,27 @@ var TypeScript; function eatIdentifierNameToken() { var token = currentToken(); var tokenKind = token.kind(); - if (tokenKind === 11 /* IdentifierName */) { + if (tokenKind === 9 /* IdentifierName */) { return consumeToken(token); } if (TypeScript.SyntaxFacts.isAnyKeyword(tokenKind)) { return TypeScript.Syntax.convertKeywordToIdentifier(consumeToken(token)); } - return createMissingToken(11 /* IdentifierName */, token); + return createMissingToken(9 /* IdentifierName */, token); } function eatOptionalIdentifierToken() { - return isIdentifier(currentToken()) ? eatIdentifierToken() : null; + return isIdentifier(currentToken()) ? eatIdentifierToken() : undefined; } function eatIdentifierToken(diagnosticCode) { var token = currentToken(); if (isIdentifier(token)) { consumeToken(token); - if (token.kind() === 11 /* IdentifierName */) { + if (token.kind() === 9 /* IdentifierName */) { return token; } return TypeScript.Syntax.convertKeywordToIdentifier(token); } - return createMissingToken(11 /* IdentifierName */, token, diagnosticCode); + return createMissingToken(9 /* IdentifierName */, token, diagnosticCode); } function previousTokenHasTrailingNewLine(token) { var tokenFullStart = token.fullStart(); @@ -22768,10 +23648,10 @@ var TypeScript; function canEatAutomaticSemicolon(allowWithoutNewLine) { var token = currentToken(); var tokenKind = token.kind(); - if (tokenKind === 10 /* EndOfFileToken */) { + if (tokenKind === 8 /* EndOfFileToken */) { return true; } - if (tokenKind === 71 /* CloseBraceToken */) { + if (tokenKind === 73 /* CloseBraceToken */) { return true; } if (allowWithoutNewLine) { @@ -22784,20 +23664,20 @@ var TypeScript; } function canEatExplicitOrAutomaticSemicolon(allowWithoutNewline) { var token = currentToken(); - if (token.kind() === 78 /* SemicolonToken */) { + if (token.kind() === 80 /* SemicolonToken */) { return true; } return canEatAutomaticSemicolon(allowWithoutNewline); } function eatExplicitOrAutomaticSemicolon(allowWithoutNewline) { var token = currentToken(); - if (token.kind() === 78 /* SemicolonToken */) { + if (token.kind() === 80 /* SemicolonToken */) { return consumeToken(token); } if (canEatAutomaticSemicolon(allowWithoutNewline)) { - return null; + return undefined; } - return eatToken(78 /* SemicolonToken */); + return eatToken(80 /* SemicolonToken */); } function createMissingToken(expectedKind, actual, diagnosticCode) { var diagnostic = getExpectedTokenDiagnostic(expectedKind, actual, diagnosticCode); @@ -22806,14 +23686,14 @@ var TypeScript; } function getExpectedTokenDiagnostic(expectedKind, actual, diagnosticCode) { var token = currentToken(); - var args = null; + var args = undefined; if (!diagnosticCode) { if (TypeScript.SyntaxFacts.isAnyKeyword(expectedKind) || TypeScript.SyntaxFacts.isAnyPunctuation(expectedKind)) { diagnosticCode = TypeScript.DiagnosticCode._0_expected; args = [TypeScript.SyntaxFacts.getText(expectedKind)]; } else { - if (actual !== null && TypeScript.SyntaxFacts.isAnyKeyword(actual.kind())) { + if (actual && TypeScript.SyntaxFacts.isAnyKeyword(actual.kind())) { diagnosticCode = TypeScript.DiagnosticCode.Identifier_expected_0_is_a_keyword; args = [TypeScript.SyntaxFacts.getText(actual.kind())]; } @@ -22826,38 +23706,33 @@ var TypeScript; } function getBinaryExpressionPrecedence(tokenKind) { switch (tokenKind) { - case 104 /* BarBarToken */: - return 2 /* LogicalOrExpressionPrecedence */; - case 103 /* AmpersandAmpersandToken */: - return 3 /* LogicalAndExpressionPrecedence */; - case 99 /* BarToken */: - return 4 /* BitwiseOrExpressionPrecedence */; - case 100 /* CaretToken */: - return 5 /* BitwiseExclusiveOrExpressionPrecedence */; - case 98 /* AmpersandToken */: - return 6 /* BitwiseAndExpressionPrecedence */; - case 84 /* EqualsEqualsToken */: - case 86 /* ExclamationEqualsToken */: - case 87 /* EqualsEqualsEqualsToken */: - case 88 /* ExclamationEqualsEqualsToken */: + case 106 /* BarBarToken */: return 2 /* LogicalOrExpressionPrecedence */; + case 105 /* AmpersandAmpersandToken */: return 3 /* LogicalAndExpressionPrecedence */; + case 101 /* BarToken */: return 4 /* BitwiseOrExpressionPrecedence */; + case 102 /* CaretToken */: return 5 /* BitwiseExclusiveOrExpressionPrecedence */; + case 100 /* AmpersandToken */: return 6 /* BitwiseAndExpressionPrecedence */; + case 86 /* EqualsEqualsToken */: + case 88 /* ExclamationEqualsToken */: + case 89 /* EqualsEqualsEqualsToken */: + case 90 /* ExclamationEqualsEqualsToken */: return 7 /* EqualityExpressionPrecedence */; - case 80 /* LessThanToken */: - case 81 /* GreaterThanToken */: - case 82 /* LessThanEqualsToken */: - case 83 /* GreaterThanEqualsToken */: - case 30 /* InstanceOfKeyword */: - case 29 /* InKeyword */: + case 82 /* LessThanToken */: + case 83 /* GreaterThanToken */: + case 84 /* LessThanEqualsToken */: + case 85 /* GreaterThanEqualsToken */: + case 32 /* InstanceOfKeyword */: + case 31 /* InKeyword */: return 8 /* RelationalExpressionPrecedence */; - case 95 /* LessThanLessThanToken */: - case 96 /* GreaterThanGreaterThanToken */: - case 97 /* GreaterThanGreaterThanGreaterThanToken */: + case 97 /* LessThanLessThanToken */: + case 98 /* GreaterThanGreaterThanToken */: + case 99 /* GreaterThanGreaterThanGreaterThanToken */: return 9 /* ShiftExpressionPrecdence */; - case 89 /* PlusToken */: - case 90 /* MinusToken */: + case 91 /* PlusToken */: + case 92 /* MinusToken */: return 10 /* AdditiveExpressionPrecedence */; - case 91 /* AsteriskToken */: - case 118 /* SlashToken */: - case 92 /* PercentToken */: + case 93 /* AsteriskToken */: + case 120 /* SlashToken */: + case 94 /* PercentToken */: return 11 /* MultiplicativeExpressionPrecedence */; } throw TypeScript.Errors.invalidOperation(); @@ -22878,11 +23753,12 @@ var TypeScript; var parent = oldToken.parent; newToken.parent = parent; while (true) { - TypeScript.Debug.assert(TypeScript.isNode(parent) || TypeScript.isList(parent) || TypeScript.isSeparatedList(parent)); + TypeScript.Debug.assert(TypeScript.isNode(parent) || TypeScript.isList(parent)); var dataElement = parent; - if (dataElement.data) { - dataElement.data &= 4 /* NodeParsedInStrictModeMask */; + if (dataElement.__data) { + dataElement.__data &= 4 /* NodeParsedInStrictModeMask */; } + dataElement.__cachedTokens = undefined; if (parent === node) { break; } @@ -22909,20 +23785,6 @@ var TypeScript; } } } - else if (TypeScript.isSeparatedList(parent)) { - var list2 = parent; - for (var i = 0, n = TypeScript.childCount(list2); i < n; i++) { - if (TypeScript.childAt(list2, i) === oldToken) { - if (i % 2 === 0) { - list2[i / 2] = newToken; - } - else { - list2.separators[(i - 1) / 2] = newToken; - } - return; - } - } - } throw TypeScript.Errors.invalidOperation(); } function addSkippedTokenAfterNode(node, skippedToken) { @@ -22989,7 +23851,7 @@ var TypeScript; var skippedTokens = getArray(); var moduleElements = parseSyntaxList(0 /* SourceUnit_ModuleElements */, skippedTokens, updateStrictModeState); setStrictMode(savedIsInStrictMode); - var sourceUnit = new Parser.syntaxFactory.SourceUnitSyntax(parseNodeData, moduleElements, currentToken()); + var sourceUnit = new TypeScript.SourceUnitSyntax(parseNodeData, moduleElements, currentToken()); sourceUnit = addSkippedTokensBeforeNode(sourceUnit, skippedTokens); if (TypeScript.Debug.shouldAssert(2 /* Aggressive */)) { TypeScript.Debug.assert(TypeScript.fullWidth(sourceUnit) === source.text.length()); @@ -23027,48 +23889,43 @@ var TypeScript; var _modifierCount = modifierCount(); if (_modifierCount) { switch (peekToken(_modifierCount).kind()) { - case 49 /* ImportKeyword */: - return parseImportDeclaration(); - case 65 /* ModuleKeyword */: - return parseModuleDeclaration(); - case 52 /* InterfaceKeyword */: - return parseInterfaceDeclaration(); - case 44 /* ClassKeyword */: - return parseClassDeclaration(); - case 46 /* EnumKeyword */: - return parseEnumDeclaration(); + case 51 /* ImportKeyword */: return parseImportDeclaration(); + case 67 /* ModuleKeyword */: return parseModuleDeclaration(); + case 54 /* InterfaceKeyword */: return parseInterfaceDeclaration(); + case 46 /* ClassKeyword */: return parseClassDeclaration(); + case 48 /* EnumKeyword */: return parseEnumDeclaration(); } } var nextToken = peekToken(1); var currentTokenKind = _currentToken.kind(); switch (currentTokenKind) { - case 65 /* ModuleKeyword */: - if (isIdentifier(nextToken) || nextToken.kind() === 14 /* StringLiteral */) { + case 67 /* ModuleKeyword */: + if (isIdentifier(nextToken) || nextToken.kind() === 12 /* StringLiteral */) { return parseModuleDeclaration(); } break; - case 49 /* ImportKeyword */: + case 51 /* ImportKeyword */: if (isIdentifier(nextToken)) { return parseImportDeclaration(); } break; - case 44 /* ClassKeyword */: + case 46 /* ClassKeyword */: if (isIdentifier(nextToken)) { return parseClassDeclaration(); } break; - case 46 /* EnumKeyword */: + case 48 /* EnumKeyword */: if (isIdentifier(nextToken)) { return parseEnumDeclaration(); } break; - case 52 /* InterfaceKeyword */: + case 54 /* InterfaceKeyword */: if (isIdentifier(nextToken)) { return parseInterfaceDeclaration(); } break; - case 47 /* ExportKeyword */: - if (nextToken.kind() === 107 /* EqualsToken */) { + case 49 /* ExportKeyword */: + if (nextToken.kind() === 109 /* EqualsToken */) { return parseExportAssignment(); } break; @@ -23076,72 +23933,72 @@ var TypeScript; return tryParseStatementWorker(_currentToken, currentTokenKind, _modifierCount, inErrorRecovery); } function parseImportDeclaration() { - return new Parser.syntaxFactory.ImportDeclarationSyntax(parseNodeData, parseModifiers(), eatToken(49 /* ImportKeyword */), eatIdentifierToken(), eatToken(107 /* EqualsToken */), parseModuleReference(), eatExplicitOrAutomaticSemicolon(false)); + return new TypeScript.ImportDeclarationSyntax(parseNodeData, parseModifiers(), eatToken(51 /* ImportKeyword */), eatIdentifierToken(), eatToken(109 /* EqualsToken */), parseModuleReference(), eatExplicitOrAutomaticSemicolon(false)); } function parseExportAssignment() { - return new Parser.syntaxFactory.ExportAssignmentSyntax(parseNodeData, eatToken(47 /* ExportKeyword */), eatToken(107 /* EqualsToken */), eatIdentifierToken(), eatExplicitOrAutomaticSemicolon(false)); + return new TypeScript.ExportAssignmentSyntax(parseNodeData, eatToken(49 /* ExportKeyword */), eatToken(109 /* EqualsToken */), eatIdentifierToken(), eatExplicitOrAutomaticSemicolon(false)); } function parseModuleReference() { return isExternalModuleReference() ? parseExternalModuleReference() : parseModuleNameModuleReference(); } function isExternalModuleReference() { - return currentToken().kind() === 66 /* RequireKeyword */ && peekToken(1).kind() === 72 /* OpenParenToken */; + return currentToken().kind() === 68 /* RequireKeyword */ && peekToken(1).kind() === 74 /* OpenParenToken */; } function parseExternalModuleReference() { - return new Parser.syntaxFactory.ExternalModuleReferenceSyntax(parseNodeData, eatToken(66 /* RequireKeyword */), eatToken(72 /* OpenParenToken */), eatToken(14 /* StringLiteral */), eatToken(73 /* CloseParenToken */)); + return new TypeScript.ExternalModuleReferenceSyntax(parseNodeData, eatToken(68 /* RequireKeyword */), eatToken(74 /* OpenParenToken */), eatToken(12 /* StringLiteral */), eatToken(75 /* CloseParenToken */)); } function parseModuleNameModuleReference() { - return new Parser.syntaxFactory.ModuleNameModuleReferenceSyntax(parseNodeData, parseName(false)); + return new TypeScript.ModuleNameModuleReferenceSyntax(parseNodeData, parseName(false)); } function tryParseTypeArgumentList(inExpression) { var _currentToken = currentToken(); - if (_currentToken.kind() !== 80 /* LessThanToken */) { - return null; + if (_currentToken.kind() !== 82 /* LessThanToken */) { + return undefined; } if (!inExpression) { var lessThanToken = consumeToken(_currentToken); var skippedTokens = getArray(); var typeArguments = parseSeparatedSyntaxList(19 /* TypeArgumentList_Types */, skippedTokens); lessThanToken = addSkippedTokensAfterToken(lessThanToken, skippedTokens); - return new Parser.syntaxFactory.TypeArgumentListSyntax(parseNodeData, lessThanToken, typeArguments, eatToken(81 /* GreaterThanToken */)); + return new TypeScript.TypeArgumentListSyntax(parseNodeData, lessThanToken, typeArguments, eatToken(83 /* GreaterThanToken */)); } var rewindPoint = getRewindPoint(); var lessThanToken = consumeToken(_currentToken); var skippedTokens = getArray(); var typeArguments = parseSeparatedSyntaxList(19 /* TypeArgumentList_Types */, skippedTokens); var lessThanToken = addSkippedTokensAfterToken(lessThanToken, skippedTokens); - var greaterThanToken = eatToken(81 /* GreaterThanToken */); + var greaterThanToken = eatToken(83 /* GreaterThanToken */); if (greaterThanToken.fullWidth() === 0 || !canFollowTypeArgumentListInExpression(currentToken().kind())) { rewind(rewindPoint); releaseRewindPoint(rewindPoint); - return null; + return undefined; } else { releaseRewindPoint(rewindPoint); - return new Parser.syntaxFactory.TypeArgumentListSyntax(parseNodeData, lessThanToken, typeArguments, greaterThanToken); + return new TypeScript.TypeArgumentListSyntax(parseNodeData, lessThanToken, typeArguments, greaterThanToken); } } function canFollowTypeArgumentListInExpression(kind) { switch (kind) { - case 72 /* OpenParenToken */: - case 76 /* DotToken */: - case 73 /* CloseParenToken */: - case 75 /* CloseBracketToken */: - case 106 /* ColonToken */: - case 78 /* SemicolonToken */: - case 79 /* CommaToken */: - case 105 /* QuestionToken */: - case 84 /* EqualsEqualsToken */: - case 87 /* EqualsEqualsEqualsToken */: - case 86 /* ExclamationEqualsToken */: - case 88 /* ExclamationEqualsEqualsToken */: - case 103 /* AmpersandAmpersandToken */: - case 104 /* BarBarToken */: - case 100 /* CaretToken */: - case 98 /* AmpersandToken */: - case 99 /* BarToken */: - case 71 /* CloseBraceToken */: - case 10 /* EndOfFileToken */: + case 74 /* OpenParenToken */: + case 78 /* DotToken */: + case 75 /* CloseParenToken */: + case 77 /* CloseBracketToken */: + case 108 /* ColonToken */: + case 80 /* SemicolonToken */: + case 81 /* CommaToken */: + case 107 /* QuestionToken */: + case 86 /* EqualsEqualsToken */: + case 89 /* EqualsEqualsEqualsToken */: + case 88 /* ExclamationEqualsToken */: + case 90 /* ExclamationEqualsEqualsToken */: + case 105 /* AmpersandAmpersandToken */: + case 106 /* BarBarToken */: + case 102 /* CaretToken */: + case 100 /* AmpersandToken */: + case 101 /* BarToken */: + case 73 /* CloseBraceToken */: + case 8 /* EndOfFileToken */: return true; default: return false; @@ -23155,7 +24012,7 @@ var TypeScript; if (TypeScript.SyntaxFacts.isAnyKeyword(_currentToken.kind()) && previousTokenHasTrailingNewLine(_currentToken)) { var token1 = peekToken(1); if (!TypeScript.existsNewLineBetweenTokens(_currentToken, token1, source.text) && TypeScript.SyntaxFacts.isIdentifierNameOrAnyKeyword(token1)) { - return createMissingToken(11 /* IdentifierName */, _currentToken); + return createMissingToken(9 /* IdentifierName */, _currentToken); } } return allowIdentifierNames ? eatIdentifierNameToken() : eatIdentifierToken(); @@ -23164,59 +24021,59 @@ var TypeScript; var token0 = currentToken(); var shouldContinue = isIdentifier(token0); if (!shouldContinue) { - return null; + return undefined; } var current = eatIdentifierToken(); - while (shouldContinue && currentToken().kind() === 76 /* DotToken */) { + while (shouldContinue && currentToken().kind() === 78 /* DotToken */) { var dotToken = consumeToken(currentToken()); var identifierName = eatRightSideOfName(allowIdentifierNames); - current = new Parser.syntaxFactory.QualifiedNameSyntax(parseNodeData, current, dotToken, identifierName); + current = new TypeScript.QualifiedNameSyntax(parseNodeData, current, dotToken, identifierName); shouldContinue = identifierName.fullWidth() > 0; } return current; } function parseEnumDeclaration() { var modifiers = parseModifiers(); - var enumKeyword = eatToken(46 /* EnumKeyword */); + var enumKeyword = eatToken(48 /* EnumKeyword */); var identifier = eatIdentifierToken(); - var openBraceToken = eatToken(70 /* OpenBraceToken */); - var enumElements = TypeScript.Syntax.emptySeparatedList(); + var openBraceToken = eatToken(72 /* OpenBraceToken */); + var enumElements; if (openBraceToken.fullWidth() > 0) { var skippedTokens = getArray(); enumElements = parseSeparatedSyntaxList(8 /* EnumDeclaration_EnumElements */, skippedTokens); openBraceToken = addSkippedTokensAfterToken(openBraceToken, skippedTokens); } - return new Parser.syntaxFactory.EnumDeclarationSyntax(parseNodeData, modifiers, enumKeyword, identifier, openBraceToken, enumElements, eatToken(71 /* CloseBraceToken */)); + return new TypeScript.EnumDeclarationSyntax(parseNodeData, modifiers, enumKeyword, identifier, openBraceToken, enumElements || [], eatToken(73 /* CloseBraceToken */)); } function isEnumElement(inErrorRecovery) { var node = currentNode(); - if (node !== null && node.kind() === 244 /* EnumElement */) { + if (node && node.kind() === 209 /* EnumElement */) { return true; } return isPropertyName(currentToken(), inErrorRecovery); } function tryParseEnumElementEqualsValueClause() { - return isEqualsValueClause(false) ? parseEqualsValueClause(true) : null; + return isEqualsValueClause(false) ? parseEqualsValueClause(true) : undefined; } function tryParseEnumElement(inErrorRecovery) { var node = currentNode(); - if (node !== null && node.kind() === 244 /* EnumElement */) { + if (node && node.kind() === 209 /* EnumElement */) { consumeNode(node); return node; } if (!isPropertyName(currentToken(), inErrorRecovery)) { - return null; + return undefined; } - return new Parser.syntaxFactory.EnumElementSyntax(parseNodeData, eatPropertyName(), tryParseEnumElementEqualsValueClause()); + return new TypeScript.EnumElementSyntax(parseNodeData, eatPropertyName(), tryParseEnumElementEqualsValueClause()); } function isModifierKind(kind) { switch (kind) { - case 47 /* ExportKeyword */: - case 57 /* PublicKeyword */: - case 55 /* PrivateKeyword */: - case 56 /* ProtectedKeyword */: - case 58 /* StaticKeyword */: - case 63 /* DeclareKeyword */: + case 49 /* ExportKeyword */: + case 59 /* PublicKeyword */: + case 57 /* PrivateKeyword */: + case 58 /* ProtectedKeyword */: + case 60 /* StaticKeyword */: + case 65 /* DeclareKeyword */: return true; } return false; @@ -23226,10 +24083,10 @@ var TypeScript; var nextToken = peekToken(index + 1); var nextTokenKind = nextToken.kind(); switch (nextTokenKind) { - case 11 /* IdentifierName */: - case 74 /* OpenBracketToken */: - case 13 /* NumericLiteral */: - case 14 /* StringLiteral */: + case 9 /* IdentifierName */: + case 76 /* OpenBracketToken */: + case 11 /* NumericLiteral */: + case 12 /* StringLiteral */: return true; default: return TypeScript.SyntaxFacts.isAnyKeyword(nextTokenKind); @@ -23254,39 +24111,37 @@ var TypeScript; } break; } - var result = TypeScript.Syntax.list(tokens); - returnZeroLengthArray(tokens); - return result; + return TypeScript.Syntax.list(tokens); } function parseHeritageClauses() { - var heritageClauses = TypeScript.Syntax.emptyList(); + var heritageClauses; if (isHeritageClause()) { - heritageClauses = parseSyntaxList(10 /* ClassOrInterfaceDeclaration_HeritageClauses */, null); + heritageClauses = parseSyntaxList(10 /* ClassOrInterfaceDeclaration_HeritageClauses */, undefined); } - return heritageClauses; + return heritageClauses || []; } function tryParseHeritageClauseTypeName() { - return isHeritageClauseTypeName() ? tryParseNameOrGenericType() : null; + return isHeritageClauseTypeName() ? tryParseNameOrGenericType() : undefined; } function parseClassDeclaration() { var modifiers = parseModifiers(); - var classKeyword = eatToken(44 /* ClassKeyword */); + var classKeyword = eatToken(46 /* ClassKeyword */); var identifier = eatIdentifierToken(); var typeParameterList = tryParseTypeParameterList(false); var heritageClauses = parseHeritageClauses(); - var openBraceToken = eatToken(70 /* OpenBraceToken */); - var classElements = TypeScript.Syntax.emptyList(); + var openBraceToken = eatToken(72 /* OpenBraceToken */); + var classElements; if (openBraceToken.fullWidth() > 0) { var skippedTokens = getArray(); classElements = parseSyntaxList(1 /* ClassDeclaration_ClassElements */, skippedTokens); openBraceToken = addSkippedTokensAfterToken(openBraceToken, skippedTokens); } ; - return new Parser.syntaxFactory.ClassDeclarationSyntax(parseNodeData, modifiers, classKeyword, identifier, typeParameterList, heritageClauses, openBraceToken, classElements, eatToken(71 /* CloseBraceToken */)); + return new TypeScript.ClassDeclarationSyntax(parseNodeData, modifiers, classKeyword, identifier, typeParameterList, heritageClauses, openBraceToken, classElements || [], eatToken(73 /* CloseBraceToken */)); } function isAccessor(modifierCount, inErrorRecovery) { var tokenKind = peekToken(modifierCount).kind(); - if (tokenKind !== 64 /* GetKeyword */ && tokenKind !== 68 /* SetKeyword */) { + if (tokenKind !== 66 /* GetKeyword */ && tokenKind !== 70 /* SetKeyword */) { return false; } return isPropertyName(peekToken(modifierCount + 1), inErrorRecovery); @@ -23295,10 +24150,10 @@ var TypeScript; var modifiers = parseModifiers(); var _currenToken = currentToken(); var tokenKind = _currenToken.kind(); - if (tokenKind === 64 /* GetKeyword */) { + if (tokenKind === 66 /* GetKeyword */) { return parseGetMemberAccessorDeclaration(modifiers, _currenToken, checkForStrictMode); } - else if (tokenKind === 68 /* SetKeyword */) { + else if (tokenKind === 70 /* SetKeyword */) { return parseSetMemberAccessorDeclaration(modifiers, _currenToken, checkForStrictMode); } else { @@ -23306,10 +24161,10 @@ var TypeScript; } } function parseGetMemberAccessorDeclaration(modifiers, getKeyword, checkForStrictMode) { - return new Parser.syntaxFactory.GetAccessorSyntax(parseNodeData, modifiers, consumeToken(getKeyword), eatPropertyName(), parseCallSignature(false), parseBlock(false, checkForStrictMode)); + return new TypeScript.GetAccessorSyntax(parseNodeData, modifiers, consumeToken(getKeyword), eatPropertyName(), parseCallSignature(false), parseBlock(false, checkForStrictMode)); } function parseSetMemberAccessorDeclaration(modifiers, setKeyword, checkForStrictMode) { - return new Parser.syntaxFactory.SetAccessorSyntax(parseNodeData, modifiers, consumeToken(setKeyword), eatPropertyName(), parseCallSignature(false), parseBlock(false, checkForStrictMode)); + return new TypeScript.SetAccessorSyntax(parseNodeData, modifiers, consumeToken(setKeyword), eatPropertyName(), parseCallSignature(false), parseBlock(false, checkForStrictMode)); } function isClassElement(inErrorRecovery) { if (TypeScript.SyntaxUtilities.isClassElement(currentNode())) { @@ -23341,25 +24196,25 @@ var TypeScript; return parseIndexMemberDeclaration(); } else { - return null; + return undefined; } } function isConstructorDeclaration(modifierCount) { - return peekToken(modifierCount).kind() === 62 /* ConstructorKeyword */; + return peekToken(modifierCount).kind() === 64 /* ConstructorKeyword */; } function parseConstructorDeclaration() { var modifiers = parseModifiers(); - var constructorKeyword = eatToken(62 /* ConstructorKeyword */); + var constructorKeyword = eatToken(64 /* ConstructorKeyword */); var callSignature = parseCallSignature(false); - var semicolonToken = null; - var block = null; + var semicolonToken = undefined; + var block = undefined; if (isBlock()) { block = parseBlock(false, true); } else { semicolonToken = eatExplicitOrAutomaticSemicolon(false); } - return new Parser.syntaxFactory.ConstructorDeclarationSyntax(parseNodeData, modifiers, constructorKeyword, callSignature, block, semicolonToken); + return new TypeScript.ConstructorDeclarationSyntax(parseNodeData, modifiers, constructorKeyword, callSignature, block, semicolonToken); } function isMemberFunctionDeclaration(modifierCount, inErrorRecovery) { return isPropertyName(peekToken(modifierCount), inErrorRecovery) && isCallSignature(modifierCount + 1); @@ -23369,25 +24224,25 @@ var TypeScript; var propertyName = eatPropertyName(); var callSignature = parseCallSignature(false); var parseBlockEvenWithNoOpenBrace = tryAddUnexpectedEqualsGreaterThanToken(callSignature); - var block = null; - var semicolon = null; + var block = undefined; + var semicolon = undefined; if (parseBlockEvenWithNoOpenBrace || isBlock()) { block = parseBlock(parseBlockEvenWithNoOpenBrace, true); } else { semicolon = eatExplicitOrAutomaticSemicolon(false); } - return new Parser.syntaxFactory.MemberFunctionDeclarationSyntax(parseNodeData, modifiers, propertyName, callSignature, block, semicolon); + return new TypeScript.MemberFunctionDeclarationSyntax(parseNodeData, modifiers, propertyName, callSignature, block, semicolon); } function isDefinitelyMemberVariablePropertyName(index) { if (TypeScript.SyntaxFacts.isAnyKeyword(peekToken(index).kind())) { var nextToken = peekToken(index + 1); switch (nextToken.kind()) { - case 78 /* SemicolonToken */: - case 107 /* EqualsToken */: - case 106 /* ColonToken */: - case 71 /* CloseBraceToken */: - case 10 /* EndOfFileToken */: + case 80 /* SemicolonToken */: + case 109 /* EqualsToken */: + case 108 /* ColonToken */: + case 73 /* CloseBraceToken */: + case 8 /* EndOfFileToken */: return true; default: return previousTokenHasTrailingNewLine(nextToken); @@ -23401,92 +24256,90 @@ var TypeScript; return isPropertyName(peekToken(modifierCount), inErrorRecover) && isDefinitelyMemberVariablePropertyName(modifierCount); } function parseMemberVariableDeclaration() { - return new Parser.syntaxFactory.MemberVariableDeclarationSyntax(parseNodeData, parseModifiers(), tryParseVariableDeclarator(true, true), eatExplicitOrAutomaticSemicolon(false)); + return new TypeScript.MemberVariableDeclarationSyntax(parseNodeData, parseModifiers(), tryParseVariableDeclarator(true, true), eatExplicitOrAutomaticSemicolon(false)); } function isIndexMemberDeclaration(modifierCount) { return isIndexSignature(modifierCount); } function parseIndexMemberDeclaration() { - return new Parser.syntaxFactory.IndexMemberDeclarationSyntax(parseNodeData, parseModifiers(), parseIndexSignature(), eatExplicitOrAutomaticSemicolon(false)); + return new TypeScript.IndexMemberDeclarationSyntax(parseNodeData, parseModifiers(), parseIndexSignature(), eatExplicitOrAutomaticSemicolon(false)); } function tryAddUnexpectedEqualsGreaterThanToken(callSignature) { var token0 = currentToken(); - var hasEqualsGreaterThanToken = token0.kind() === 85 /* EqualsGreaterThanToken */; + var hasEqualsGreaterThanToken = token0.kind() === 87 /* EqualsGreaterThanToken */; if (hasEqualsGreaterThanToken) { var _lastToken = TypeScript.lastToken(callSignature); if (_lastToken && _lastToken.fullWidth() > 0) { - var diagnostic = new TypeScript.Diagnostic(fileName, source.text.lineMap(), TypeScript.start(token0, source.text), TypeScript.width(token0), TypeScript.DiagnosticCode.Unexpected_token_0_expected, [TypeScript.SyntaxFacts.getText(70 /* OpenBraceToken */)]); + var diagnostic = new TypeScript.Diagnostic(fileName, source.text.lineMap(), TypeScript.start(token0, source.text), TypeScript.width(token0), TypeScript.DiagnosticCode.Unexpected_token_0_expected, [TypeScript.SyntaxFacts.getText(72 /* OpenBraceToken */)]); addDiagnostic(diagnostic); consumeToken(token0); - if (Parser.syntaxFactory.isConcrete) { - addSkippedTokenAfterNode(callSignature, token0); - } + addSkippedTokenAfterNode(callSignature, token0); return true; } } return false; } function isFunctionDeclaration(modifierCount) { - return peekToken(modifierCount).kind() === 27 /* FunctionKeyword */; + return peekToken(modifierCount).kind() === 29 /* FunctionKeyword */; } function parseFunctionDeclaration() { var modifiers = parseModifiers(); - var functionKeyword = eatToken(27 /* FunctionKeyword */); + var functionKeyword = eatToken(29 /* FunctionKeyword */); var identifier = eatIdentifierToken(); var callSignature = parseCallSignature(false); var parseBlockEvenWithNoOpenBrace = tryAddUnexpectedEqualsGreaterThanToken(callSignature); - var semicolonToken = null; - var block = null; + var semicolonToken = undefined; + var block = undefined; if (parseBlockEvenWithNoOpenBrace || isBlock()) { block = parseBlock(parseBlockEvenWithNoOpenBrace, true); } else { semicolonToken = eatExplicitOrAutomaticSemicolon(false); } - return new Parser.syntaxFactory.FunctionDeclarationSyntax(parseNodeData, modifiers, functionKeyword, identifier, callSignature, block, semicolonToken); + return new TypeScript.FunctionDeclarationSyntax(parseNodeData, modifiers, functionKeyword, identifier, callSignature, block, semicolonToken); } function parseModuleDeclaration() { var modifiers = parseModifiers(); - var moduleKeyword = eatToken(65 /* ModuleKeyword */); - var moduleName = null; - var stringLiteral = null; - if (currentToken().kind() === 14 /* StringLiteral */) { - stringLiteral = eatToken(14 /* StringLiteral */); + var moduleKeyword = eatToken(67 /* ModuleKeyword */); + var moduleName = undefined; + var stringLiteral = undefined; + if (currentToken().kind() === 12 /* StringLiteral */) { + stringLiteral = eatToken(12 /* StringLiteral */); } else { moduleName = parseName(false); } - var openBraceToken = eatToken(70 /* OpenBraceToken */); - var moduleElements = TypeScript.Syntax.emptyList(); + var openBraceToken = eatToken(72 /* OpenBraceToken */); + var moduleElements; if (openBraceToken.fullWidth() > 0) { var skippedTokens = getArray(); moduleElements = parseSyntaxList(2 /* ModuleDeclaration_ModuleElements */, skippedTokens); openBraceToken = addSkippedTokensAfterToken(openBraceToken, skippedTokens); } - return new Parser.syntaxFactory.ModuleDeclarationSyntax(parseNodeData, modifiers, moduleKeyword, moduleName, stringLiteral, openBraceToken, moduleElements, eatToken(71 /* CloseBraceToken */)); + return new TypeScript.ModuleDeclarationSyntax(parseNodeData, modifiers, moduleKeyword, moduleName, stringLiteral, openBraceToken, moduleElements || [], eatToken(73 /* CloseBraceToken */)); } function parseInterfaceDeclaration() { - return new Parser.syntaxFactory.InterfaceDeclarationSyntax(parseNodeData, parseModifiers(), eatToken(52 /* InterfaceKeyword */), eatIdentifierToken(), tryParseTypeParameterList(false), parseHeritageClauses(), parseObjectType()); + return new TypeScript.InterfaceDeclarationSyntax(parseNodeData, parseModifiers(), eatToken(54 /* InterfaceKeyword */), eatIdentifierToken(), tryParseTypeParameterList(false), parseHeritageClauses(), parseObjectType()); } function parseObjectType() { - var openBraceToken = eatToken(70 /* OpenBraceToken */); - var typeMembers = TypeScript.Syntax.emptySeparatedList(); + var openBraceToken = eatToken(72 /* OpenBraceToken */); + var typeMembers; if (openBraceToken.fullWidth() > 0) { var skippedTokens = getArray(); typeMembers = parseSeparatedSyntaxList(9 /* ObjectType_TypeMembers */, skippedTokens); openBraceToken = addSkippedTokensAfterToken(openBraceToken, skippedTokens); } - return new Parser.syntaxFactory.ObjectTypeSyntax(parseNodeData, openBraceToken, typeMembers, eatToken(71 /* CloseBraceToken */)); + return new TypeScript.ObjectTypeSyntax(parseNodeData, openBraceToken, typeMembers || [], eatToken(73 /* CloseBraceToken */)); } function parseTupleType(currentToken) { var openBracket = consumeToken(currentToken); - var types = TypeScript.Syntax.emptySeparatedList(); + var types; if (openBracket.fullWidth() > 0) { var skippedTokens = getArray(); types = parseSeparatedSyntaxList(21 /* TupleType_Types */, skippedTokens); openBracket = addSkippedTokensAfterToken(openBracket, skippedTokens); } - return new Parser.syntaxFactory.TupleTypeSyntax(parseNodeData, openBracket, types, eatToken(75 /* CloseBracketToken */)); + return new TypeScript.TupleTypeSyntax(parseNodeData, openBracket, types || [], eatToken(77 /* CloseBracketToken */)); } function isTypeMember(inErrorRecovery) { if (TypeScript.SyntaxUtilities.isTypeMember(currentNode())) { @@ -23516,44 +24369,44 @@ var TypeScript; return parsePropertySignature(); } else { - return null; + return undefined; } } function parseConstructSignature() { - return new Parser.syntaxFactory.ConstructSignatureSyntax(parseNodeData, eatToken(31 /* NewKeyword */), parseCallSignature(false)); + return new TypeScript.ConstructSignatureSyntax(parseNodeData, eatToken(33 /* NewKeyword */), parseCallSignature(false)); } function parseIndexSignature() { - var openBracketToken = eatToken(74 /* OpenBracketToken */); + var openBracketToken = eatToken(76 /* OpenBracketToken */); var skippedTokens = getArray(); var parameters = parseSeparatedSyntaxList(18 /* IndexSignature_Parameters */, skippedTokens); openBracketToken = addSkippedTokensAfterToken(openBracketToken, skippedTokens); - return new Parser.syntaxFactory.IndexSignatureSyntax(parseNodeData, openBracketToken, parameters, eatToken(75 /* CloseBracketToken */), parseOptionalTypeAnnotation(false)); + return new TypeScript.IndexSignatureSyntax(parseNodeData, openBracketToken, parameters, eatToken(77 /* CloseBracketToken */), parseOptionalTypeAnnotation(false)); } function parseMethodSignature() { - return new Parser.syntaxFactory.MethodSignatureSyntax(parseNodeData, eatPropertyName(), tryEatToken(105 /* QuestionToken */), parseCallSignature(false)); + return new TypeScript.MethodSignatureSyntax(parseNodeData, eatPropertyName(), tryEatToken(107 /* QuestionToken */), parseCallSignature(false)); } function parsePropertySignature() { - return new Parser.syntaxFactory.PropertySignatureSyntax(parseNodeData, eatPropertyName(), tryEatToken(105 /* QuestionToken */), parseOptionalTypeAnnotation(false)); + return new TypeScript.PropertySignatureSyntax(parseNodeData, eatPropertyName(), tryEatToken(107 /* QuestionToken */), parseOptionalTypeAnnotation(false)); } function isCallSignature(peekIndex) { var tokenKind = peekToken(peekIndex).kind(); - return tokenKind === 72 /* OpenParenToken */ || tokenKind === 80 /* LessThanToken */; + return tokenKind === 74 /* OpenParenToken */ || tokenKind === 82 /* LessThanToken */; } function isConstructSignature() { - if (currentToken().kind() !== 31 /* NewKeyword */) { + if (currentToken().kind() !== 33 /* NewKeyword */) { return false; } return isCallSignature(1); } function isIndexSignature(peekIndex) { - return peekToken(peekIndex).kind() === 74 /* OpenBracketToken */; + return peekToken(peekIndex).kind() === 76 /* OpenBracketToken */; } function isMethodSignature(inErrorRecovery) { if (isPropertyName(currentToken(), inErrorRecovery)) { if (isCallSignature(1)) { return true; } - if (peekToken(1).kind() === 105 /* QuestionToken */ && isCallSignature(2)) { + if (peekToken(1).kind() === 107 /* QuestionToken */ && isCallSignature(2)) { return true; } } @@ -23570,11 +24423,11 @@ var TypeScript; } function isHeritageClause() { var tokenKind = currentToken().kind(); - return tokenKind === 48 /* ExtendsKeyword */ || tokenKind === 51 /* ImplementsKeyword */; + return tokenKind === 50 /* ExtendsKeyword */ || tokenKind === 53 /* ImplementsKeyword */; } function isNotHeritageClauseTypeName() { var tokenKind = currentToken().kind(); - if (tokenKind === 51 /* ImplementsKeyword */ || tokenKind === 48 /* ExtendsKeyword */) { + if (tokenKind === 53 /* ImplementsKeyword */ || tokenKind === 50 /* ExtendsKeyword */) { return isIdentifier(peekToken(1)); } return false; @@ -23588,47 +24441,38 @@ var TypeScript; function tryParseHeritageClause() { var extendsOrImplementsKeyword = currentToken(); var tokenKind = extendsOrImplementsKeyword.kind(); - if (tokenKind !== 48 /* ExtendsKeyword */ && tokenKind !== 51 /* ImplementsKeyword */) { - return null; + if (tokenKind !== 50 /* ExtendsKeyword */ && tokenKind !== 53 /* ImplementsKeyword */) { + return undefined; } consumeToken(extendsOrImplementsKeyword); var skippedTokens = getArray(); var typeNames = parseSeparatedSyntaxList(11 /* HeritageClause_TypeNameList */, skippedTokens); extendsOrImplementsKeyword = addSkippedTokensAfterToken(extendsOrImplementsKeyword, skippedTokens); - return new Parser.syntaxFactory.HeritageClauseSyntax(parseNodeData, extendsOrImplementsKeyword, typeNames); + return new TypeScript.HeritageClauseSyntax(parseNodeData, extendsOrImplementsKeyword, typeNames); } - function isInterfaceEnumClassModuleImportOrExport(modifierCount) { - var _currentToken = currentToken(); + function isInterfaceEnumClassModuleImportOrExport(modifierCount, _currentToken) { if (modifierCount) { switch (peekToken(modifierCount).kind()) { - case 49 /* ImportKeyword */: - case 65 /* ModuleKeyword */: - case 52 /* InterfaceKeyword */: - case 44 /* ClassKeyword */: - case 46 /* EnumKeyword */: + case 51 /* ImportKeyword */: + case 67 /* ModuleKeyword */: + case 54 /* InterfaceKeyword */: + case 46 /* ClassKeyword */: + case 48 /* EnumKeyword */: return true; } } + _currentToken = _currentToken || currentToken(); var nextToken = peekToken(1); switch (_currentToken.kind()) { - case 65 /* ModuleKeyword */: - if (isIdentifier(nextToken) || nextToken.kind() === 14 /* StringLiteral */) { - return true; - } - break; - case 49 /* ImportKeyword */: - case 44 /* ClassKeyword */: - case 46 /* EnumKeyword */: - case 52 /* InterfaceKeyword */: - if (isIdentifier(nextToken)) { - return true; - } - break; - case 47 /* ExportKeyword */: - if (nextToken.kind() === 107 /* EqualsToken */) { - return true; - } - break; + case 67 /* ModuleKeyword */: + return isIdentifier(nextToken) || nextToken.kind() === 12 /* StringLiteral */; + case 51 /* ImportKeyword */: + case 46 /* ClassKeyword */: + case 48 /* EnumKeyword */: + case 54 /* InterfaceKeyword */: + return isIdentifier(nextToken); + case 49 /* ExportKeyword */: + return nextToken.kind() === 109 /* EqualsToken */; } return false; } @@ -23639,31 +24483,31 @@ var TypeScript; var _currentToken = currentToken(); var currentTokenKind = _currentToken.kind(); switch (currentTokenKind) { - case 57 /* PublicKeyword */: - case 55 /* PrivateKeyword */: - case 56 /* ProtectedKeyword */: - case 58 /* StaticKeyword */: + case 59 /* PublicKeyword */: + case 57 /* PrivateKeyword */: + case 58 /* ProtectedKeyword */: + case 60 /* StaticKeyword */: var token1 = peekToken(1); if (TypeScript.SyntaxFacts.isIdentifierNameOrAnyKeyword(token1)) { return false; } break; - case 28 /* IfKeyword */: - case 70 /* OpenBraceToken */: - case 33 /* ReturnKeyword */: - case 34 /* SwitchKeyword */: - case 36 /* ThrowKeyword */: - case 15 /* BreakKeyword */: - case 18 /* ContinueKeyword */: - case 26 /* ForKeyword */: - case 42 /* WhileKeyword */: - case 43 /* WithKeyword */: - case 22 /* DoKeyword */: - case 38 /* TryKeyword */: - case 19 /* DebuggerKeyword */: + case 30 /* IfKeyword */: + case 72 /* OpenBraceToken */: + case 35 /* ReturnKeyword */: + case 36 /* SwitchKeyword */: + case 38 /* ThrowKeyword */: + case 17 /* BreakKeyword */: + case 20 /* ContinueKeyword */: + case 28 /* ForKeyword */: + case 44 /* WhileKeyword */: + case 45 /* WithKeyword */: + case 24 /* DoKeyword */: + case 40 /* TryKeyword */: + case 21 /* DebuggerKeyword */: return true; } - if (isInterfaceEnumClassModuleImportOrExport(modifierCount)) { + if (isInterfaceEnumClassModuleImportOrExport(modifierCount, _currentToken)) { return false; } return isLabeledStatement(_currentToken) || isVariableStatement(modifierCount) || isFunctionDeclaration(modifierCount) || isEmptyStatement(_currentToken, inErrorRecovery) || isExpressionStatement(_currentToken); @@ -23683,45 +24527,32 @@ var TypeScript; } function tryParseStatementWorker(_currentToken, currentTokenKind, modifierCount, inErrorRecovery) { switch (currentTokenKind) { - case 57 /* PublicKeyword */: - case 55 /* PrivateKeyword */: - case 56 /* ProtectedKeyword */: - case 58 /* StaticKeyword */: + case 59 /* PublicKeyword */: + case 57 /* PrivateKeyword */: + case 58 /* ProtectedKeyword */: + case 60 /* StaticKeyword */: if (TypeScript.SyntaxFacts.isIdentifierNameOrAnyKeyword(peekToken(1))) { - return null; + return undefined; } else { break; } - case 28 /* IfKeyword */: - return parseIfStatement(_currentToken); - case 70 /* OpenBraceToken */: - return parseBlock(false, false); - case 33 /* ReturnKeyword */: - return parseReturnStatement(_currentToken); - case 34 /* SwitchKeyword */: - return parseSwitchStatement(_currentToken); - case 36 /* ThrowKeyword */: - return parseThrowStatement(_currentToken); - case 15 /* BreakKeyword */: - return parseBreakStatement(_currentToken); - case 18 /* ContinueKeyword */: - return parseContinueStatement(_currentToken); - case 26 /* ForKeyword */: - return parseForOrForInStatement(_currentToken); - case 42 /* WhileKeyword */: - return parseWhileStatement(_currentToken); - case 43 /* WithKeyword */: - return parseWithStatement(_currentToken); - case 22 /* DoKeyword */: - return parseDoStatement(_currentToken); - case 38 /* TryKeyword */: - return parseTryStatement(_currentToken); - case 19 /* DebuggerKeyword */: - return parseDebuggerStatement(_currentToken); + case 30 /* IfKeyword */: return parseIfStatement(_currentToken); + case 72 /* OpenBraceToken */: return parseBlock(false, false); + case 35 /* ReturnKeyword */: return parseReturnStatement(_currentToken); + case 36 /* SwitchKeyword */: return parseSwitchStatement(_currentToken); + case 38 /* ThrowKeyword */: return parseThrowStatement(_currentToken); + case 17 /* BreakKeyword */: return parseBreakStatement(_currentToken); + case 20 /* ContinueKeyword */: return parseContinueStatement(_currentToken); + case 28 /* ForKeyword */: return parseForOrForInStatement(_currentToken); + case 44 /* WhileKeyword */: return parseWhileStatement(_currentToken); + case 45 /* WithKeyword */: return parseWithStatement(_currentToken); + case 24 /* DoKeyword */: return parseDoStatement(_currentToken); + case 40 /* TryKeyword */: return parseTryStatement(_currentToken); + case 21 /* DebuggerKeyword */: return parseDebuggerStatement(_currentToken); } - if (isInterfaceEnumClassModuleImportOrExport(modifierCount)) { - return null; + if (isInterfaceEnumClassModuleImportOrExport(modifierCount, _currentToken)) { + return undefined; } else if (isVariableStatement(modifierCount)) { return parseVariableStatement(); @@ -23739,20 +24570,20 @@ var TypeScript; return parseExpressionStatement(); } else { - return null; + return undefined; } } function parseDebuggerStatement(debuggerKeyword) { - return new Parser.syntaxFactory.DebuggerStatementSyntax(parseNodeData, consumeToken(debuggerKeyword), eatExplicitOrAutomaticSemicolon(false)); + return new TypeScript.DebuggerStatementSyntax(parseNodeData, consumeToken(debuggerKeyword), eatExplicitOrAutomaticSemicolon(false)); } function parseDoStatement(doKeyword) { - return new Parser.syntaxFactory.DoStatementSyntax(parseNodeData, consumeToken(doKeyword), parseStatement(false), eatToken(42 /* WhileKeyword */), eatToken(72 /* OpenParenToken */), parseExpression(true), eatToken(73 /* CloseParenToken */), eatExplicitOrAutomaticSemicolon(true)); + return new TypeScript.DoStatementSyntax(parseNodeData, consumeToken(doKeyword), parseStatement(false), eatToken(44 /* WhileKeyword */), eatToken(74 /* OpenParenToken */), parseExpression(true), eatToken(75 /* CloseParenToken */), eatExplicitOrAutomaticSemicolon(true)); } function isLabeledStatement(currentToken) { - return isIdentifier(currentToken) && peekToken(1).kind() === 106 /* ColonToken */; + return isIdentifier(currentToken) && peekToken(1).kind() === 108 /* ColonToken */; } function parseLabeledStatement(identifierToken) { - return new Parser.syntaxFactory.LabeledStatementSyntax(parseNodeData, consumeToken(identifierToken), eatToken(106 /* ColonToken */), parseStatement(false)); + return new TypeScript.LabeledStatementSyntax(parseNodeData, consumeToken(identifierToken), eatToken(108 /* ColonToken */), parseStatement(false)); } function parseTryStatement(tryKeyword) { var tryKeyword = consumeToken(tryKeyword); @@ -23760,15 +24591,15 @@ var TypeScript; listParsingState |= (1 << 6 /* TryBlock_Statements */); var block = parseBlock(false, false); listParsingState = savedListParsingState; - var catchClause = null; - if (currentToken().kind() === 17 /* CatchKeyword */) { + var catchClause = undefined; + if (currentToken().kind() === 19 /* CatchKeyword */) { catchClause = parseCatchClause(); } - var finallyClause = null; - if (catchClause === null || currentToken().kind() === 25 /* FinallyKeyword */) { + var finallyClause = undefined; + if (!catchClause || currentToken().kind() === 27 /* FinallyKeyword */) { finallyClause = parseFinallyClause(); } - return new Parser.syntaxFactory.TryStatementSyntax(parseNodeData, tryKeyword, block, catchClause, finallyClause); + return new TypeScript.TryStatementSyntax(parseNodeData, tryKeyword, block, catchClause, finallyClause); } function parseCatchClauseBlock() { var savedListParsingState = listParsingState; @@ -23778,35 +24609,35 @@ var TypeScript; return block; } function parseCatchClause() { - return new Parser.syntaxFactory.CatchClauseSyntax(parseNodeData, eatToken(17 /* CatchKeyword */), eatToken(72 /* OpenParenToken */), eatIdentifierToken(), parseOptionalTypeAnnotation(false), eatToken(73 /* CloseParenToken */), parseCatchClauseBlock()); + return new TypeScript.CatchClauseSyntax(parseNodeData, eatToken(19 /* CatchKeyword */), eatToken(74 /* OpenParenToken */), eatIdentifierToken(), parseOptionalTypeAnnotation(false), eatToken(75 /* CloseParenToken */), parseCatchClauseBlock()); } function parseFinallyClause() { - return new Parser.syntaxFactory.FinallyClauseSyntax(parseNodeData, eatToken(25 /* FinallyKeyword */), parseBlock(false, false)); + return new TypeScript.FinallyClauseSyntax(parseNodeData, eatToken(27 /* FinallyKeyword */), parseBlock(false, false)); } function parseWithStatement(withKeyword) { - return new Parser.syntaxFactory.WithStatementSyntax(parseNodeData, consumeToken(withKeyword), eatToken(72 /* OpenParenToken */), parseExpression(true), eatToken(73 /* CloseParenToken */), parseStatement(false)); + return new TypeScript.WithStatementSyntax(parseNodeData, consumeToken(withKeyword), eatToken(74 /* OpenParenToken */), parseExpression(true), eatToken(75 /* CloseParenToken */), parseStatement(false)); } function parseWhileStatement(whileKeyword) { - return new Parser.syntaxFactory.WhileStatementSyntax(parseNodeData, consumeToken(whileKeyword), eatToken(72 /* OpenParenToken */), parseExpression(true), eatToken(73 /* CloseParenToken */), parseStatement(false)); + return new TypeScript.WhileStatementSyntax(parseNodeData, consumeToken(whileKeyword), eatToken(74 /* OpenParenToken */), parseExpression(true), eatToken(75 /* CloseParenToken */), parseStatement(false)); } function isEmptyStatement(currentToken, inErrorRecovery) { if (inErrorRecovery) { return false; } - return currentToken.kind() === 78 /* SemicolonToken */; + return currentToken.kind() === 80 /* SemicolonToken */; } function parseEmptyStatement(semicolonToken) { - return new Parser.syntaxFactory.EmptyStatementSyntax(parseNodeData, consumeToken(semicolonToken)); + return new TypeScript.EmptyStatementSyntax(parseNodeData, consumeToken(semicolonToken)); } function parseForOrForInStatement(forKeyword) { consumeToken(forKeyword); - var openParenToken = eatToken(72 /* OpenParenToken */); + var openParenToken = eatToken(74 /* OpenParenToken */); var _currentToken = currentToken(); var tokenKind = _currentToken.kind(); - if (tokenKind === 40 /* VarKeyword */) { + if (tokenKind === 42 /* VarKeyword */) { return parseForOrForInStatementWithVariableDeclaration(forKeyword, openParenToken); } - else if (tokenKind === 78 /* SemicolonToken */) { + else if (tokenKind === 80 /* SemicolonToken */) { return parseForStatementWithNoVariableDeclarationOrInitializer(forKeyword, openParenToken); } else { @@ -23815,70 +24646,70 @@ var TypeScript; } function parseForOrForInStatementWithVariableDeclaration(forKeyword, openParenToken) { var variableDeclaration = parseVariableDeclaration(false); - return currentToken().kind() === 29 /* InKeyword */ ? parseForInStatementWithVariableDeclarationOrInitializer(forKeyword, openParenToken, variableDeclaration, null) : parseForStatementWithVariableDeclarationOrInitializer(forKeyword, openParenToken, variableDeclaration, null); + return currentToken().kind() === 31 /* InKeyword */ ? parseForInStatementWithVariableDeclarationOrInitializer(forKeyword, openParenToken, variableDeclaration, undefined) : parseForStatementWithVariableDeclarationOrInitializer(forKeyword, openParenToken, variableDeclaration, undefined); } function parseForInStatementWithVariableDeclarationOrInitializer(forKeyword, openParenToken, variableDeclaration, initializer) { - return new Parser.syntaxFactory.ForInStatementSyntax(parseNodeData, forKeyword, openParenToken, variableDeclaration, initializer, eatToken(29 /* InKeyword */), parseExpression(true), eatToken(73 /* CloseParenToken */), parseStatement(false)); + return new TypeScript.ForInStatementSyntax(parseNodeData, forKeyword, openParenToken, variableDeclaration, initializer, eatToken(31 /* InKeyword */), parseExpression(true), eatToken(75 /* CloseParenToken */), parseStatement(false)); } function parseForOrForInStatementWithInitializer(forKeyword, openParenToken) { var initializer = parseExpression(false); - return currentToken().kind() === 29 /* InKeyword */ ? parseForInStatementWithVariableDeclarationOrInitializer(forKeyword, openParenToken, null, initializer) : parseForStatementWithVariableDeclarationOrInitializer(forKeyword, openParenToken, null, initializer); + return currentToken().kind() === 31 /* InKeyword */ ? parseForInStatementWithVariableDeclarationOrInitializer(forKeyword, openParenToken, undefined, initializer) : parseForStatementWithVariableDeclarationOrInitializer(forKeyword, openParenToken, undefined, initializer); } function parseForStatementWithNoVariableDeclarationOrInitializer(forKeyword, openParenToken) { - return parseForStatementWithVariableDeclarationOrInitializer(forKeyword, openParenToken, null, null); + return parseForStatementWithVariableDeclarationOrInitializer(forKeyword, openParenToken, undefined, undefined); } function tryParseForStatementCondition() { var tokenKind = currentToken().kind(); - if (tokenKind !== 78 /* SemicolonToken */ && tokenKind !== 73 /* CloseParenToken */ && tokenKind !== 10 /* EndOfFileToken */) { + if (tokenKind !== 80 /* SemicolonToken */ && tokenKind !== 75 /* CloseParenToken */ && tokenKind !== 8 /* EndOfFileToken */) { return parseExpression(true); } - return null; + return undefined; } function tryParseForStatementIncrementor() { var tokenKind = currentToken().kind(); - if (tokenKind !== 73 /* CloseParenToken */ && tokenKind !== 10 /* EndOfFileToken */) { + if (tokenKind !== 75 /* CloseParenToken */ && tokenKind !== 8 /* EndOfFileToken */) { return parseExpression(true); } - return null; + return undefined; } function parseForStatementWithVariableDeclarationOrInitializer(forKeyword, openParenToken, variableDeclaration, initializer) { - return new Parser.syntaxFactory.ForStatementSyntax(parseNodeData, forKeyword, openParenToken, variableDeclaration, initializer, eatToken(78 /* SemicolonToken */), tryParseForStatementCondition(), eatToken(78 /* SemicolonToken */), tryParseForStatementIncrementor(), eatToken(73 /* CloseParenToken */), parseStatement(false)); + return new TypeScript.ForStatementSyntax(parseNodeData, forKeyword, openParenToken, variableDeclaration, initializer, eatToken(80 /* SemicolonToken */), tryParseForStatementCondition(), eatToken(80 /* SemicolonToken */), tryParseForStatementIncrementor(), eatToken(75 /* CloseParenToken */), parseStatement(false)); } function tryEatBreakOrContinueLabel() { - var identifier = null; + var identifier = undefined; if (!canEatExplicitOrAutomaticSemicolon(false)) { if (isIdentifier(currentToken())) { return eatIdentifierToken(); } } - return null; + return undefined; } function parseBreakStatement(breakKeyword) { - return new Parser.syntaxFactory.BreakStatementSyntax(parseNodeData, consumeToken(breakKeyword), tryEatBreakOrContinueLabel(), eatExplicitOrAutomaticSemicolon(false)); + return new TypeScript.BreakStatementSyntax(parseNodeData, consumeToken(breakKeyword), tryEatBreakOrContinueLabel(), eatExplicitOrAutomaticSemicolon(false)); } function parseContinueStatement(continueKeyword) { - return new Parser.syntaxFactory.ContinueStatementSyntax(parseNodeData, consumeToken(continueKeyword), tryEatBreakOrContinueLabel(), eatExplicitOrAutomaticSemicolon(false)); + return new TypeScript.ContinueStatementSyntax(parseNodeData, consumeToken(continueKeyword), tryEatBreakOrContinueLabel(), eatExplicitOrAutomaticSemicolon(false)); } function parseSwitchStatement(switchKeyword) { consumeToken(switchKeyword); - var openParenToken = eatToken(72 /* OpenParenToken */); + var openParenToken = eatToken(74 /* OpenParenToken */); var expression = parseExpression(true); - var closeParenToken = eatToken(73 /* CloseParenToken */); - var openBraceToken = eatToken(70 /* OpenBraceToken */); - var switchClauses = TypeScript.Syntax.emptyList(); + var closeParenToken = eatToken(75 /* CloseParenToken */); + var openBraceToken = eatToken(72 /* OpenBraceToken */); + var switchClauses; if (openBraceToken.fullWidth() > 0) { var skippedTokens = getArray(); switchClauses = parseSyntaxList(3 /* SwitchStatement_SwitchClauses */, skippedTokens); openBraceToken = addSkippedTokensAfterToken(openBraceToken, skippedTokens); } - return new Parser.syntaxFactory.SwitchStatementSyntax(parseNodeData, switchKeyword, openParenToken, expression, closeParenToken, openBraceToken, switchClauses, eatToken(71 /* CloseBraceToken */)); + return new TypeScript.SwitchStatementSyntax(parseNodeData, switchKeyword, openParenToken, expression, closeParenToken, openBraceToken, switchClauses || [], eatToken(73 /* CloseBraceToken */)); } function isSwitchClause() { if (TypeScript.SyntaxUtilities.isSwitchClause(currentNode())) { return true; } var currentTokenKind = currentToken().kind(); - return currentTokenKind === 16 /* CaseKeyword */ || currentTokenKind === 20 /* DefaultKeyword */; + return currentTokenKind === 18 /* CaseKeyword */ || currentTokenKind === 22 /* DefaultKeyword */; } function tryParseSwitchClause() { var node = currentNode(); @@ -23888,136 +24719,138 @@ var TypeScript; } var _currentToken = currentToken(); var kind = _currentToken.kind(); - if (kind === 16 /* CaseKeyword */) { + if (kind === 18 /* CaseKeyword */) { return parseCaseSwitchClause(_currentToken); } - else if (kind === 20 /* DefaultKeyword */) { + else if (kind === 22 /* DefaultKeyword */) { return parseDefaultSwitchClause(_currentToken); } else { - return null; + return undefined; } } function parseCaseSwitchClause(caseKeyword) { consumeToken(caseKeyword); var expression = parseExpression(true); - var colonToken = eatToken(106 /* ColonToken */); - var statements = TypeScript.Syntax.emptyList(); + var colonToken = eatToken(108 /* ColonToken */); + var statements; if (colonToken.fullWidth() > 0) { var skippedTokens = getArray(); statements = parseSyntaxList(4 /* SwitchClause_Statements */, skippedTokens); colonToken = addSkippedTokensAfterToken(colonToken, skippedTokens); } - return new Parser.syntaxFactory.CaseSwitchClauseSyntax(parseNodeData, caseKeyword, expression, colonToken, statements); + return new TypeScript.CaseSwitchClauseSyntax(parseNodeData, caseKeyword, expression, colonToken, statements || []); } function parseDefaultSwitchClause(defaultKeyword) { consumeToken(defaultKeyword); - var colonToken = eatToken(106 /* ColonToken */); - var statements = TypeScript.Syntax.emptyList(); + var colonToken = eatToken(108 /* ColonToken */); + var statements; if (colonToken.fullWidth() > 0) { var skippedTokens = getArray(); statements = parseSyntaxList(4 /* SwitchClause_Statements */, skippedTokens); colonToken = addSkippedTokensAfterToken(colonToken, skippedTokens); } - return new Parser.syntaxFactory.DefaultSwitchClauseSyntax(parseNodeData, defaultKeyword, colonToken, statements); + return new TypeScript.DefaultSwitchClauseSyntax(parseNodeData, defaultKeyword, colonToken, statements || []); } function parseThrowStatementExpression() { - return canEatExplicitOrAutomaticSemicolon(false) ? createMissingToken(11 /* IdentifierName */, null) : parseExpression(true); + return canEatExplicitOrAutomaticSemicolon(false) ? createMissingToken(9 /* IdentifierName */, undefined) : parseExpression(true); } function parseThrowStatement(throwKeyword) { - return new Parser.syntaxFactory.ThrowStatementSyntax(parseNodeData, consumeToken(throwKeyword), parseThrowStatementExpression(), eatExplicitOrAutomaticSemicolon(false)); + return new TypeScript.ThrowStatementSyntax(parseNodeData, consumeToken(throwKeyword), parseThrowStatementExpression(), eatExplicitOrAutomaticSemicolon(false)); } function tryParseReturnStatementExpression() { - return !canEatExplicitOrAutomaticSemicolon(false) ? parseExpression(true) : null; + return !canEatExplicitOrAutomaticSemicolon(false) ? parseExpression(true) : undefined; } function parseReturnStatement(returnKeyword) { - return new Parser.syntaxFactory.ReturnStatementSyntax(parseNodeData, consumeToken(returnKeyword), tryParseReturnStatementExpression(), eatExplicitOrAutomaticSemicolon(false)); + return new TypeScript.ReturnStatementSyntax(parseNodeData, consumeToken(returnKeyword), tryParseReturnStatementExpression(), eatExplicitOrAutomaticSemicolon(false)); } function isExpressionStatement(currentToken) { var tokenKind = currentToken.kind(); - return tokenKind !== 70 /* OpenBraceToken */ && tokenKind !== 27 /* FunctionKeyword */ && isExpression(currentToken); + return tokenKind !== 72 /* OpenBraceToken */ && tokenKind !== 29 /* FunctionKeyword */ && isExpression(currentToken); } function isAssignmentOrOmittedExpression() { var _currentToken = currentToken(); - return _currentToken.kind() === 79 /* CommaToken */ || isExpression(_currentToken); + return _currentToken.kind() === 81 /* CommaToken */ || isExpression(_currentToken); } function tryParseAssignmentOrOmittedExpression() { - if (currentToken().kind() === 79 /* CommaToken */) { - return new Parser.syntaxFactory.OmittedExpressionSyntax(parseNodeData); + if (currentToken().kind() === 81 /* CommaToken */) { + return new TypeScript.OmittedExpressionSyntax(parseNodeData); } return tryParseAssignmentExpressionOrHigher(false, true); } function isExpression(currentToken) { switch (currentToken.kind()) { - case 13 /* NumericLiteral */: - case 14 /* StringLiteral */: - case 12 /* RegularExpressionLiteral */: - case 74 /* OpenBracketToken */: - case 72 /* OpenParenToken */: - case 80 /* LessThanToken */: - case 93 /* PlusPlusToken */: - case 94 /* MinusMinusToken */: - case 89 /* PlusToken */: - case 90 /* MinusToken */: - case 102 /* TildeToken */: - case 101 /* ExclamationToken */: - case 70 /* OpenBraceToken */: - case 85 /* EqualsGreaterThanToken */: - case 118 /* SlashToken */: - case 119 /* SlashEqualsToken */: - case 50 /* SuperKeyword */: - case 35 /* ThisKeyword */: - case 37 /* TrueKeyword */: - case 24 /* FalseKeyword */: - case 32 /* NullKeyword */: - case 31 /* NewKeyword */: - case 21 /* DeleteKeyword */: - case 41 /* VoidKeyword */: - case 39 /* TypeOfKeyword */: - case 27 /* FunctionKeyword */: + case 11 /* NumericLiteral */: + case 12 /* StringLiteral */: + case 10 /* RegularExpressionLiteral */: + case 13 /* NoSubstitutionTemplateToken */: + case 14 /* TemplateStartToken */: + case 76 /* OpenBracketToken */: + case 74 /* OpenParenToken */: + case 82 /* LessThanToken */: + case 95 /* PlusPlusToken */: + case 96 /* MinusMinusToken */: + case 91 /* PlusToken */: + case 92 /* MinusToken */: + case 104 /* TildeToken */: + case 103 /* ExclamationToken */: + case 72 /* OpenBraceToken */: + case 87 /* EqualsGreaterThanToken */: + case 120 /* SlashToken */: + case 121 /* SlashEqualsToken */: + case 52 /* SuperKeyword */: + case 37 /* ThisKeyword */: + case 39 /* TrueKeyword */: + case 26 /* FalseKeyword */: + case 34 /* NullKeyword */: + case 33 /* NewKeyword */: + case 23 /* DeleteKeyword */: + case 43 /* VoidKeyword */: + case 41 /* TypeOfKeyword */: + case 29 /* FunctionKeyword */: return true; } return isIdentifier(currentToken); } function parseExpressionStatement() { - return new Parser.syntaxFactory.ExpressionStatementSyntax(parseNodeData, parseExpression(true), eatExplicitOrAutomaticSemicolon(false)); + return new TypeScript.ExpressionStatementSyntax(parseNodeData, parseExpression(true), eatExplicitOrAutomaticSemicolon(false)); } function parseIfStatement(ifKeyword) { - return new Parser.syntaxFactory.IfStatementSyntax(parseNodeData, consumeToken(ifKeyword), eatToken(72 /* OpenParenToken */), parseExpression(true), eatToken(73 /* CloseParenToken */), parseStatement(false), parseOptionalElseClause()); + return new TypeScript.IfStatementSyntax(parseNodeData, consumeToken(ifKeyword), eatToken(74 /* OpenParenToken */), parseExpression(true), eatToken(75 /* CloseParenToken */), parseStatement(false), parseOptionalElseClause()); } function parseOptionalElseClause() { - return currentToken().kind() === 23 /* ElseKeyword */ ? parseElseClause() : null; + return currentToken().kind() === 25 /* ElseKeyword */ ? parseElseClause() : undefined; } function parseElseClause() { - return new Parser.syntaxFactory.ElseClauseSyntax(parseNodeData, eatToken(23 /* ElseKeyword */), parseStatement(false)); + return new TypeScript.ElseClauseSyntax(parseNodeData, eatToken(25 /* ElseKeyword */), parseStatement(false)); } function isVariableStatement(modifierCount) { - return peekToken(modifierCount).kind() === 40 /* VarKeyword */; + return peekToken(modifierCount).kind() === 42 /* VarKeyword */; } function parseVariableStatement() { - return new Parser.syntaxFactory.VariableStatementSyntax(parseNodeData, parseModifiers(), parseVariableDeclaration(true), eatExplicitOrAutomaticSemicolon(false)); + return new TypeScript.VariableStatementSyntax(parseNodeData, parseModifiers(), parseVariableDeclaration(true), eatExplicitOrAutomaticSemicolon(false)); } function parseVariableDeclaration(allowIn) { - var varKeyword = eatToken(40 /* VarKeyword */); + var varKeyword = eatToken(42 /* VarKeyword */); var listParsingState = allowIn ? 12 /* VariableDeclaration_VariableDeclarators_AllowIn */ : 13 /* VariableDeclaration_VariableDeclarators_DisallowIn */; var skippedTokens = getArray(); var variableDeclarators = parseSeparatedSyntaxList(listParsingState, skippedTokens); varKeyword = addSkippedTokensAfterToken(varKeyword, skippedTokens); - return new Parser.syntaxFactory.VariableDeclarationSyntax(parseNodeData, varKeyword, variableDeclarators); + return new TypeScript.VariableDeclarationSyntax(parseNodeData, varKeyword, variableDeclarators); } function isVariableDeclarator() { var node = currentNode(); - if (node !== null && node.kind() === 226 /* VariableDeclarator */) { + if (node && node.kind() === 191 /* VariableDeclarator */) { return true; } return isIdentifier(currentToken()); } function canReuseVariableDeclaratorNode(node) { - if (node === null || node.kind() !== 226 /* VariableDeclarator */) { + if (!node || node.kind() !== 191 /* VariableDeclarator */) { return false; } var variableDeclarator = node; - return variableDeclarator.equalsValueClause === null; + return variableDeclarator.equalsValueClause === undefined; } function tryParseVariableDeclarator(allowIn, allowPropertyName) { var node = currentNode(); @@ -24028,30 +24861,30 @@ var TypeScript; if (allowPropertyName) { } if (!allowPropertyName && !isIdentifier(currentToken())) { - return null; + return undefined; } var propertyName = allowPropertyName ? eatPropertyName() : eatIdentifierToken(); - var equalsValueClause = null; - var typeAnnotation = null; + var equalsValueClause = undefined; + var typeAnnotation = undefined; if (propertyName.fullWidth() > 0) { typeAnnotation = parseOptionalTypeAnnotation(false); if (isEqualsValueClause(false)) { equalsValueClause = parseEqualsValueClause(allowIn); } } - return new Parser.syntaxFactory.VariableDeclaratorSyntax(parseNodeData, propertyName, typeAnnotation, equalsValueClause); + return new TypeScript.VariableDeclaratorSyntax(parseNodeData, propertyName, typeAnnotation, equalsValueClause); } function isEqualsValueClause(inParameter) { var token0 = currentToken(); - if (token0.kind() === 107 /* EqualsToken */) { + if (token0.kind() === 109 /* EqualsToken */) { return true; } if (!previousTokenHasTrailingNewLine(token0)) { var tokenKind = token0.kind(); - if (tokenKind === 85 /* EqualsGreaterThanToken */) { + if (tokenKind === 87 /* EqualsGreaterThanToken */) { return false; } - if (tokenKind === 70 /* OpenBraceToken */ && inParameter) { + if (tokenKind === 72 /* OpenBraceToken */ && inParameter) { return false; } return isExpression(token0); @@ -24059,33 +24892,33 @@ var TypeScript; return false; } function parseEqualsValueClause(allowIn) { - return new Parser.syntaxFactory.EqualsValueClauseSyntax(parseNodeData, eatToken(107 /* EqualsToken */), tryParseAssignmentExpressionOrHigher(true, allowIn)); + return new TypeScript.EqualsValueClauseSyntax(parseNodeData, eatToken(109 /* EqualsToken */), tryParseAssignmentExpressionOrHigher(true, allowIn)); } function parseExpression(allowIn) { var leftOperand = tryParseAssignmentExpressionOrHigher(true, allowIn); while (true) { var _currentToken = currentToken(); - if (_currentToken.kind() !== 79 /* CommaToken */) { + if (_currentToken.kind() !== 81 /* CommaToken */) { break; } - leftOperand = new Parser.syntaxFactory.BinaryExpressionSyntax(parseNodeData, leftOperand, consumeToken(_currentToken), tryParseAssignmentExpressionOrHigher(true, allowIn)); + leftOperand = new TypeScript.BinaryExpressionSyntax(parseNodeData, leftOperand, consumeToken(_currentToken), tryParseAssignmentExpressionOrHigher(true, allowIn)); } return leftOperand; } function tryParseAssignmentExpressionOrHigher(force, allowIn) { var _currentToken = currentToken(); var arrowFunction = tryParseAnyArrowFunctionExpression(_currentToken); - if (arrowFunction !== null) { + if (arrowFunction) { return arrowFunction; } var leftOperand = tryParseBinaryExpressionOrHigher(_currentToken, force, 1 /* Lowest */, allowIn); - if (leftOperand === null) { - return null; + if (leftOperand === undefined) { + return undefined; } if (TypeScript.SyntaxUtilities.isLeftHandSizeExpression(leftOperand)) { var operatorToken = currentOperatorToken(); if (TypeScript.SyntaxFacts.isAssignmentOperatorToken(operatorToken.kind())) { - return new Parser.syntaxFactory.BinaryExpressionSyntax(parseNodeData, leftOperand, consumeToken(operatorToken), tryParseAssignmentExpressionOrHigher(true, allowIn)); + return new TypeScript.BinaryExpressionSyntax(parseNodeData, leftOperand, consumeToken(operatorToken), tryParseAssignmentExpressionOrHigher(true, allowIn)); } } return parseConditionalExpressionRest(allowIn, leftOperand); @@ -24096,68 +24929,64 @@ var TypeScript; function tryParseUnaryExpressionOrHigher(_currentToken, force) { var currentTokenKind = _currentToken.kind(); switch (currentTokenKind) { - case 89 /* PlusToken */: - case 90 /* MinusToken */: - case 102 /* TildeToken */: - case 101 /* ExclamationToken */: - case 93 /* PlusPlusToken */: - case 94 /* MinusMinusToken */: - return new Parser.syntaxFactory.PrefixUnaryExpressionSyntax(parseNodeData, consumeToken(_currentToken), tryParseUnaryExpressionOrHigher(currentToken(), true)); - case 39 /* TypeOfKeyword */: - return parseTypeOfExpression(_currentToken); - case 41 /* VoidKeyword */: - return parseVoidExpression(_currentToken); - case 21 /* DeleteKeyword */: - return parseDeleteExpression(_currentToken); - case 80 /* LessThanToken */: - return parseCastExpression(_currentToken); + case 91 /* PlusToken */: + case 92 /* MinusToken */: + case 104 /* TildeToken */: + case 103 /* ExclamationToken */: + case 95 /* PlusPlusToken */: + case 96 /* MinusMinusToken */: + return new TypeScript.PrefixUnaryExpressionSyntax(parseNodeData, consumeToken(_currentToken), tryParseUnaryExpressionOrHigher(currentToken(), true)); + case 41 /* TypeOfKeyword */: return parseTypeOfExpression(_currentToken); + case 43 /* VoidKeyword */: return parseVoidExpression(_currentToken); + case 23 /* DeleteKeyword */: return parseDeleteExpression(_currentToken); + case 82 /* LessThanToken */: return parseCastExpression(_currentToken); default: return tryParsePostfixExpressionOrHigher(_currentToken, force); } } function tryParseBinaryExpressionOrHigher(_currentToken, force, precedence, allowIn) { var leftOperand = tryParseUnaryExpressionOrHigher(_currentToken, force); - if (leftOperand === null) { - return null; + if (leftOperand === undefined) { + return undefined; } return parseBinaryExpressionRest(precedence, allowIn, leftOperand); } function parseConditionalExpressionRest(allowIn, leftOperand) { var _currentToken = currentToken(); - if (_currentToken.kind() !== 105 /* QuestionToken */) { + if (_currentToken.kind() !== 107 /* QuestionToken */) { return leftOperand; } - return new Parser.syntaxFactory.ConditionalExpressionSyntax(parseNodeData, leftOperand, consumeToken(_currentToken), tryParseAssignmentExpressionOrHigher(true, true), eatToken(106 /* ColonToken */), tryParseAssignmentExpressionOrHigher(true, allowIn)); + return new TypeScript.ConditionalExpressionSyntax(parseNodeData, leftOperand, consumeToken(_currentToken), tryParseAssignmentExpressionOrHigher(true, true), eatToken(108 /* ColonToken */), tryParseAssignmentExpressionOrHigher(true, allowIn)); } function parseBinaryExpressionRest(precedence, allowIn, leftOperand) { while (true) { var operatorToken = currentOperatorToken(); var tokenKind = operatorToken.kind(); - if (!TypeScript.SyntaxFacts.isBinaryExpressionOperatorToken(tokenKind) || tokenKind === 79 /* CommaToken */ || TypeScript.SyntaxFacts.isAssignmentOperatorToken(tokenKind)) { + if (!TypeScript.SyntaxFacts.isBinaryExpressionOperatorToken(tokenKind) || tokenKind === 81 /* CommaToken */ || TypeScript.SyntaxFacts.isAssignmentOperatorToken(tokenKind)) { break; } - if (tokenKind === 29 /* InKeyword */ && !allowIn) { + if (tokenKind === 31 /* InKeyword */ && !allowIn) { break; } var newPrecedence = getBinaryExpressionPrecedence(tokenKind); if (newPrecedence <= precedence) { break; } - leftOperand = new Parser.syntaxFactory.BinaryExpressionSyntax(parseNodeData, leftOperand, consumeToken(operatorToken), tryParseBinaryExpressionOrHigher(currentToken(), true, newPrecedence, allowIn)); + leftOperand = new TypeScript.BinaryExpressionSyntax(parseNodeData, leftOperand, consumeToken(operatorToken), tryParseBinaryExpressionOrHigher(currentToken(), true, newPrecedence, allowIn)); } return leftOperand; } function currentOperatorToken() { var token0 = currentToken(); - if (token0.kind() === 81 /* GreaterThanToken */) { + if (token0.kind() === 83 /* GreaterThanToken */) { return currentContextualToken(); } return token0; } function tryParseMemberExpressionOrHigher(_currentToken, force, inObjectCreation) { var expression = tryParsePrimaryExpression(_currentToken, force); - if (expression === null) { - return null; + if (expression === undefined) { + return undefined; } return parseMemberExpressionRest(expression, inObjectCreation); } @@ -24166,21 +24995,25 @@ var TypeScript; var _currentToken = currentToken(); var currentTokenKind = _currentToken.kind(); switch (currentTokenKind) { - case 72 /* OpenParenToken */: - expression = new Parser.syntaxFactory.InvocationExpressionSyntax(parseNodeData, expression, parseArgumentList(null)); + case 74 /* OpenParenToken */: + expression = new TypeScript.InvocationExpressionSyntax(parseNodeData, expression, parseArgumentList(undefined)); continue; - case 80 /* LessThanToken */: + case 82 /* LessThanToken */: var argumentList = tryParseArgumentList(); - if (argumentList === null) { + if (argumentList === undefined) { break; } - expression = new Parser.syntaxFactory.InvocationExpressionSyntax(parseNodeData, expression, argumentList); + expression = new TypeScript.InvocationExpressionSyntax(parseNodeData, expression, argumentList); continue; - case 74 /* OpenBracketToken */: + case 76 /* OpenBracketToken */: expression = parseElementAccessExpression(expression, _currentToken, false); continue; - case 76 /* DotToken */: - expression = new Parser.syntaxFactory.MemberAccessExpressionSyntax(parseNodeData, expression, consumeToken(_currentToken), eatIdentifierNameToken()); + case 78 /* DotToken */: + expression = new TypeScript.MemberAccessExpressionSyntax(parseNodeData, expression, consumeToken(_currentToken), eatIdentifierNameToken()); + continue; + case 13 /* NoSubstitutionTemplateToken */: + case 14 /* TemplateStartToken */: + expression = new TypeScript.TemplateAccessExpressionSyntax(parseNodeData, expression, parseTemplateExpression(_currentToken)); continue; } return expression; @@ -24191,25 +25024,29 @@ var TypeScript; var _currentToken = currentToken(); var currentTokenKind = _currentToken.kind(); switch (currentTokenKind) { - case 74 /* OpenBracketToken */: + case 76 /* OpenBracketToken */: expression = parseElementAccessExpression(expression, _currentToken, inObjectCreation); continue; - case 76 /* DotToken */: - expression = new Parser.syntaxFactory.MemberAccessExpressionSyntax(parseNodeData, expression, consumeToken(_currentToken), eatIdentifierNameToken()); + case 78 /* DotToken */: + expression = new TypeScript.MemberAccessExpressionSyntax(parseNodeData, expression, consumeToken(_currentToken), eatIdentifierNameToken()); + continue; + case 13 /* NoSubstitutionTemplateToken */: + case 14 /* TemplateStartToken */: + expression = new TypeScript.TemplateAccessExpressionSyntax(parseNodeData, expression, parseTemplateExpression(_currentToken)); continue; } return expression; } } function tryParseLeftHandSideExpressionOrHigher(_currentToken, force) { - var expression = null; - if (_currentToken.kind() === 50 /* SuperKeyword */) { + var expression = undefined; + if (_currentToken.kind() === 52 /* SuperKeyword */) { expression = parseSuperExpression(_currentToken); } else { expression = tryParseMemberExpressionOrHigher(_currentToken, force, false); - if (expression === null) { - return null; + if (expression === undefined) { + return undefined; } } return parseCallExpressionRest(expression); @@ -24217,22 +25054,22 @@ var TypeScript; function parseSuperExpression(superToken) { var expression = consumeToken(superToken); var currentTokenKind = currentToken().kind(); - return currentTokenKind === 72 /* OpenParenToken */ || currentTokenKind === 76 /* DotToken */ ? expression : new Parser.syntaxFactory.MemberAccessExpressionSyntax(parseNodeData, expression, eatToken(76 /* DotToken */), eatIdentifierNameToken()); + return currentTokenKind === 74 /* OpenParenToken */ || currentTokenKind === 78 /* DotToken */ ? expression : new TypeScript.MemberAccessExpressionSyntax(parseNodeData, expression, eatToken(78 /* DotToken */), eatIdentifierNameToken()); } function tryParsePostfixExpressionOrHigher(_currentToken, force) { var expression = tryParseLeftHandSideExpressionOrHigher(_currentToken, force); - if (expression === null) { - return null; + if (expression === undefined) { + return undefined; } var _currentToken = currentToken(); var currentTokenKind = _currentToken.kind(); switch (currentTokenKind) { - case 93 /* PlusPlusToken */: - case 94 /* MinusMinusToken */: + case 95 /* PlusPlusToken */: + case 96 /* MinusMinusToken */: if (previousTokenHasTrailingNewLine(_currentToken)) { break; } - return new Parser.syntaxFactory.PostfixUnaryExpressionSyntax(parseNodeData, expression, consumeToken(_currentToken)); + return new TypeScript.PostfixUnaryExpressionSyntax(parseNodeData, expression, consumeToken(_currentToken)); } return expression; } @@ -24241,21 +25078,21 @@ var TypeScript; var typeArgumentList = tryParseTypeArgumentList(true); var token0 = currentToken(); var tokenKind = token0.kind(); - var isOpenParen = tokenKind === 72 /* OpenParenToken */; - var isDot = tokenKind === 76 /* DotToken */; + var isOpenParen = tokenKind === 74 /* OpenParenToken */; + var isDot = tokenKind === 78 /* DotToken */; var isOpenParenOrDot = isOpenParen || isDot; - var argumentList = null; - if (typeArgumentList === null || !isOpenParenOrDot) { + var argumentList = undefined; + if (!typeArgumentList || !isOpenParenOrDot) { rewind(rewindPoint); releaseRewindPoint(rewindPoint); - return null; + return undefined; } else { releaseRewindPoint(rewindPoint); if (isDot) { - var diagnostic = new TypeScript.Diagnostic(fileName, source.text.lineMap(), TypeScript.start(token0, source.text), TypeScript.width(token0), TypeScript.DiagnosticCode.A_parameter_list_must_follow_a_generic_type_argument_list_expected, null); + var diagnostic = new TypeScript.Diagnostic(fileName, source.text.lineMap(), TypeScript.start(token0, source.text), TypeScript.width(token0), TypeScript.DiagnosticCode.A_parameter_list_must_follow_a_generic_type_argument_list_expected, undefined); addDiagnostic(diagnostic); - return new Parser.syntaxFactory.ArgumentListSyntax(parseNodeData, typeArgumentList, TypeScript.Syntax.emptyToken(72 /* OpenParenToken */), TypeScript.Syntax.emptySeparatedList(), TypeScript.Syntax.emptyToken(73 /* CloseParenToken */)); + return new TypeScript.ArgumentListSyntax(parseNodeData, typeArgumentList, TypeScript.Syntax.emptyToken(74 /* OpenParenToken */), [], TypeScript.Syntax.emptyToken(75 /* CloseParenToken */)); } else { return parseArgumentList(typeArgumentList); @@ -24264,42 +25101,42 @@ var TypeScript; } function tryParseArgumentList() { var tokenKind = currentToken().kind(); - if (tokenKind === 80 /* LessThanToken */) { + if (tokenKind === 82 /* LessThanToken */) { return tryParseGenericArgumentList(); } - if (tokenKind === 72 /* OpenParenToken */) { - return parseArgumentList(null); + if (tokenKind === 74 /* OpenParenToken */) { + return parseArgumentList(undefined); } - return null; + return undefined; } function parseArgumentList(typeArgumentList) { - var openParenToken = eatToken(72 /* OpenParenToken */); - var _arguments = TypeScript.Syntax.emptySeparatedList(); + var openParenToken = eatToken(74 /* OpenParenToken */); + var _arguments; if (openParenToken.fullWidth() > 0) { var skippedTokens = getArray(); _arguments = parseSeparatedSyntaxList(14 /* ArgumentList_AssignmentExpressions */, skippedTokens); openParenToken = addSkippedTokensAfterToken(openParenToken, skippedTokens); } - return new Parser.syntaxFactory.ArgumentListSyntax(parseNodeData, typeArgumentList, openParenToken, _arguments, eatToken(73 /* CloseParenToken */)); + return new TypeScript.ArgumentListSyntax(parseNodeData, typeArgumentList, openParenToken, _arguments || [], eatToken(75 /* CloseParenToken */)); } function tryParseArgumentListExpression() { - var force = currentToken().kind() === 79 /* CommaToken */; + var force = currentToken().kind() === 81 /* CommaToken */; return tryParseAssignmentExpressionOrHigher(force, true); } function parseElementAccessArgumentExpression(openBracketToken, inObjectCreation) { - if (inObjectCreation && currentToken().kind() === 75 /* CloseBracketToken */) { + if (inObjectCreation && currentToken().kind() === 77 /* CloseBracketToken */) { var errorStart = TypeScript.start(openBracketToken, source.text); var errorEnd = TypeScript.end(currentToken(), source.text); - var diagnostic = new TypeScript.Diagnostic(fileName, source.text.lineMap(), errorStart, errorEnd - errorStart, TypeScript.DiagnosticCode.new_T_cannot_be_used_to_create_an_array_Use_new_Array_T_instead, null); + var diagnostic = new TypeScript.Diagnostic(fileName, source.text.lineMap(), errorStart, errorEnd - errorStart, TypeScript.DiagnosticCode.new_T_cannot_be_used_to_create_an_array_Use_new_Array_T_instead, undefined); addDiagnostic(diagnostic); - return TypeScript.Syntax.emptyToken(11 /* IdentifierName */); + return TypeScript.Syntax.emptyToken(9 /* IdentifierName */); } else { return parseExpression(true); } } function parseElementAccessExpression(expression, openBracketToken, inObjectCreation) { - return new Parser.syntaxFactory.ElementAccessExpressionSyntax(parseNodeData, expression, consumeToken(openBracketToken), parseElementAccessArgumentExpression(openBracketToken, inObjectCreation), eatToken(75 /* CloseBracketToken */)); + return new TypeScript.ElementAccessExpressionSyntax(parseNodeData, expression, consumeToken(openBracketToken), parseElementAccessArgumentExpression(openBracketToken, inObjectCreation), eatToken(77 /* CloseBracketToken */)); } function tryParsePrimaryExpression(_currentToken, force) { if (isIdentifier(_currentToken)) { @@ -24307,41 +25144,39 @@ var TypeScript; } var currentTokenKind = _currentToken.kind(); switch (currentTokenKind) { - case 35 /* ThisKeyword */: - case 37 /* TrueKeyword */: - case 24 /* FalseKeyword */: - case 32 /* NullKeyword */: - case 13 /* NumericLiteral */: - case 12 /* RegularExpressionLiteral */: - case 14 /* StringLiteral */: + case 37 /* ThisKeyword */: + case 39 /* TrueKeyword */: + case 26 /* FalseKeyword */: + case 34 /* NullKeyword */: + case 11 /* NumericLiteral */: + case 10 /* RegularExpressionLiteral */: + case 12 /* StringLiteral */: return consumeToken(_currentToken); - case 27 /* FunctionKeyword */: - return parseFunctionExpression(_currentToken); - case 74 /* OpenBracketToken */: - return parseArrayLiteralExpression(_currentToken); - case 70 /* OpenBraceToken */: - return parseObjectLiteralExpression(_currentToken); - case 72 /* OpenParenToken */: - return parseParenthesizedExpression(_currentToken); - case 31 /* NewKeyword */: - return parseObjectCreationExpression(_currentToken); - case 118 /* SlashToken */: - case 119 /* SlashEqualsToken */: + case 29 /* FunctionKeyword */: return parseFunctionExpression(_currentToken); + case 76 /* OpenBracketToken */: return parseArrayLiteralExpression(_currentToken); + case 72 /* OpenBraceToken */: return parseObjectLiteralExpression(_currentToken); + case 74 /* OpenParenToken */: return parseParenthesizedExpression(_currentToken); + case 33 /* NewKeyword */: return parseObjectCreationExpression(_currentToken); + case 13 /* NoSubstitutionTemplateToken */: + case 14 /* TemplateStartToken */: + return parseTemplateExpression(_currentToken); + case 120 /* SlashToken */: + case 121 /* SlashEqualsToken */: var result = tryReparseDivideAsRegularExpression(); return result || eatIdentifierToken(TypeScript.DiagnosticCode.Expression_expected); } if (!force) { - return null; + return undefined; } return eatIdentifierToken(TypeScript.DiagnosticCode.Expression_expected); } function tryReparseDivideAsRegularExpression() { var currentToken = currentContextualToken(); var tokenKind = currentToken.kind(); - if (tokenKind === 118 /* SlashToken */ || tokenKind === 119 /* SlashEqualsToken */) { - return null; + if (tokenKind === 120 /* SlashToken */ || tokenKind === 121 /* SlashEqualsToken */) { + return undefined; } - else if (tokenKind === 12 /* RegularExpressionLiteral */) { + else if (tokenKind === 10 /* RegularExpressionLiteral */) { return consumeToken(currentToken); } else { @@ -24349,40 +25184,66 @@ var TypeScript; } } function parseTypeOfExpression(typeOfKeyword) { - return new Parser.syntaxFactory.TypeOfExpressionSyntax(parseNodeData, consumeToken(typeOfKeyword), tryParseUnaryExpressionOrHigher(currentToken(), true)); + return new TypeScript.TypeOfExpressionSyntax(parseNodeData, consumeToken(typeOfKeyword), tryParseUnaryExpressionOrHigher(currentToken(), true)); } function parseDeleteExpression(deleteKeyword) { - return new Parser.syntaxFactory.DeleteExpressionSyntax(parseNodeData, consumeToken(deleteKeyword), tryParseUnaryExpressionOrHigher(currentToken(), true)); + return new TypeScript.DeleteExpressionSyntax(parseNodeData, consumeToken(deleteKeyword), tryParseUnaryExpressionOrHigher(currentToken(), true)); } function parseVoidExpression(voidKeyword) { - return new Parser.syntaxFactory.VoidExpressionSyntax(parseNodeData, consumeToken(voidKeyword), tryParseUnaryExpressionOrHigher(currentToken(), true)); + return new TypeScript.VoidExpressionSyntax(parseNodeData, consumeToken(voidKeyword), tryParseUnaryExpressionOrHigher(currentToken(), true)); } function parseFunctionExpression(functionKeyword) { - return new Parser.syntaxFactory.FunctionExpressionSyntax(parseNodeData, consumeToken(functionKeyword), eatOptionalIdentifierToken(), parseCallSignature(false), parseBlock(false, true)); + return new TypeScript.FunctionExpressionSyntax(parseNodeData, consumeToken(functionKeyword), eatOptionalIdentifierToken(), parseCallSignature(false), parseBlock(false, true)); } function parseObjectCreationExpression(newKeyword) { - return new Parser.syntaxFactory.ObjectCreationExpressionSyntax(parseNodeData, consumeToken(newKeyword), tryParseMemberExpressionOrHigher(currentToken(), true, true), tryParseArgumentList()); + return new TypeScript.ObjectCreationExpressionSyntax(parseNodeData, consumeToken(newKeyword), tryParseMemberExpressionOrHigher(currentToken(), true, true), tryParseArgumentList()); + } + function parseTemplateExpression(startToken) { + consumeToken(startToken); + if (startToken.kind() === 13 /* NoSubstitutionTemplateToken */) { + return startToken; + } + var templateClauses = getArray(); + do { + templateClauses.push(parseTemplateClause()); + } while (templateClauses[templateClauses.length - 1].templateMiddleOrEndToken.kind() === 15 /* TemplateMiddleToken */); + return new TypeScript.TemplateExpressionSyntax(parseNodeData, startToken, TypeScript.Syntax.list(templateClauses)); + } + function parseTemplateClause() { + var expression = parseExpression(true); + var token = currentToken(); + if (token.kind() === 73 /* CloseBraceToken */) { + token = currentContextualToken(); + TypeScript.Debug.assert(token.kind() === 15 /* TemplateMiddleToken */ || token.kind() === 16 /* TemplateEndToken */); + consumeToken(token); + } + else { + var diagnostic = getExpectedTokenDiagnostic(73 /* CloseBraceToken */); + addDiagnostic(diagnostic); + token = TypeScript.Syntax.emptyToken(16 /* TemplateEndToken */); + } + return new TypeScript.TemplateClauseSyntax(parseNodeData, expression, token); } function parseCastExpression(lessThanToken) { - return new Parser.syntaxFactory.CastExpressionSyntax(parseNodeData, consumeToken(lessThanToken), parseType(), eatToken(81 /* GreaterThanToken */), tryParseUnaryExpressionOrHigher(currentToken(), true)); + return new TypeScript.CastExpressionSyntax(parseNodeData, consumeToken(lessThanToken), parseType(), eatToken(83 /* GreaterThanToken */), tryParseUnaryExpressionOrHigher(currentToken(), true)); } function parseParenthesizedExpression(openParenToken) { - return new Parser.syntaxFactory.ParenthesizedExpressionSyntax(parseNodeData, consumeToken(openParenToken), parseExpression(true), eatToken(73 /* CloseParenToken */)); + return new TypeScript.ParenthesizedExpressionSyntax(parseNodeData, consumeToken(openParenToken), parseExpression(true), eatToken(75 /* CloseParenToken */)); } function tryParseParenthesizedArrowFunctionExpression() { var tokenKind = currentToken().kind(); - if (tokenKind !== 72 /* OpenParenToken */ && tokenKind !== 80 /* LessThanToken */) { - return null; + if (tokenKind !== 74 /* OpenParenToken */ && tokenKind !== 82 /* LessThanToken */) { + return undefined; } if (isDefinitelyArrowFunctionExpression()) { return tryParseParenthesizedArrowFunctionExpressionWorker(false); } if (!isPossiblyArrowFunctionExpression()) { - return null; + return undefined; } var rewindPoint = getRewindPoint(); var arrowFunction = tryParseParenthesizedArrowFunctionExpressionWorker(true); - if (arrowFunction === null) { + if (arrowFunction === undefined) { rewind(rewindPoint); } releaseRewindPoint(rewindPoint); @@ -24391,16 +25252,16 @@ var TypeScript; function tryParseParenthesizedArrowFunctionExpressionWorker(requireArrow) { var _currentToken = currentToken(); var callSignature = parseCallSignature(true); - if (requireArrow && currentToken().kind() !== 85 /* EqualsGreaterThanToken */) { - return null; + if (requireArrow && currentToken().kind() !== 87 /* EqualsGreaterThanToken */) { + return undefined; } - var equalsGreaterThanToken = eatToken(85 /* EqualsGreaterThanToken */); + var equalsGreaterThanToken = eatToken(87 /* EqualsGreaterThanToken */); var block = tryParseArrowFunctionBlock(); - var expression = null; - if (block === null) { + var expression = undefined; + if (block === undefined) { expression = tryParseAssignmentExpressionOrHigher(true, true); } - return new Parser.syntaxFactory.ParenthesizedArrowFunctionExpressionSyntax(parseNodeData, callSignature, equalsGreaterThanToken, block, expression); + return new TypeScript.ParenthesizedArrowFunctionExpressionSyntax(parseNodeData, callSignature, equalsGreaterThanToken, block, expression); } function tryParseArrowFunctionBlock() { if (isBlock()) { @@ -24412,43 +25273,43 @@ var TypeScript; return parseBlock(true, false); } else { - return null; + return undefined; } } } function isSimpleArrowFunctionExpression(_currentToken) { - if (_currentToken.kind() === 85 /* EqualsGreaterThanToken */) { + if (_currentToken.kind() === 87 /* EqualsGreaterThanToken */) { return true; } - return isIdentifier(_currentToken) && peekToken(1).kind() === 85 /* EqualsGreaterThanToken */; + return isIdentifier(_currentToken) && peekToken(1).kind() === 87 /* EqualsGreaterThanToken */; } function parseSimpleArrowFunctionExpression() { var parameter = eatSimpleParameter(); - var equalsGreaterThanToken = eatToken(85 /* EqualsGreaterThanToken */); + var equalsGreaterThanToken = eatToken(87 /* EqualsGreaterThanToken */); var block = tryParseArrowFunctionBlock(); - var expression = null; - if (block === null) { + var expression = undefined; + if (block === undefined) { expression = tryParseAssignmentExpressionOrHigher(true, true); } - return new Parser.syntaxFactory.SimpleArrowFunctionExpressionSyntax(parseNodeData, parameter, equalsGreaterThanToken, block, expression); + return new TypeScript.SimpleArrowFunctionExpressionSyntax(parseNodeData, parameter, equalsGreaterThanToken, block, expression); } function isBlock() { - return currentToken().kind() === 70 /* OpenBraceToken */; + return currentToken().kind() === 72 /* OpenBraceToken */; } function isDefinitelyArrowFunctionExpression() { var token0 = currentToken(); - if (token0.kind() !== 72 /* OpenParenToken */) { + if (token0.kind() !== 74 /* OpenParenToken */) { return false; } var token1 = peekToken(1); var token1Kind = token1.kind(); var token2; - if (token1Kind === 73 /* CloseParenToken */) { + if (token1Kind === 75 /* CloseParenToken */) { token2 = peekToken(2); var token2Kind = token2.kind(); - return token2Kind === 106 /* ColonToken */ || token2Kind === 85 /* EqualsGreaterThanToken */ || token2Kind === 70 /* OpenBraceToken */; + return token2Kind === 108 /* ColonToken */ || token2Kind === 87 /* EqualsGreaterThanToken */ || token2Kind === 72 /* OpenBraceToken */; } - if (token1Kind === 77 /* DotDotDotToken */) { + if (token1Kind === 79 /* DotDotDotToken */) { return true; } token2 = peekToken(2); @@ -24461,18 +25322,18 @@ var TypeScript; if (!isIdentifier(token1)) { return false; } - if (token2Kind === 106 /* ColonToken */) { + if (token2Kind === 108 /* ColonToken */) { return true; } var token3 = peekToken(3); var token3Kind = token3.kind(); - if (token2Kind === 105 /* QuestionToken */) { - if (token3Kind === 106 /* ColonToken */ || token3Kind === 73 /* CloseParenToken */ || token3Kind === 79 /* CommaToken */) { + if (token2Kind === 107 /* QuestionToken */) { + if (token3Kind === 108 /* ColonToken */ || token3Kind === 75 /* CloseParenToken */ || token3Kind === 81 /* CommaToken */) { return true; } } - if (token2Kind === 73 /* CloseParenToken */) { - if (token3Kind === 85 /* EqualsGreaterThanToken */) { + if (token2Kind === 75 /* CloseParenToken */) { + if (token3Kind === 87 /* EqualsGreaterThanToken */) { return true; } } @@ -24480,7 +25341,7 @@ var TypeScript; } function isPossiblyArrowFunctionExpression() { var token0 = currentToken(); - if (token0.kind() !== 72 /* OpenParenToken */) { + if (token0.kind() !== 74 /* OpenParenToken */) { return true; } var token1 = peekToken(1); @@ -24489,15 +25350,15 @@ var TypeScript; } var token2 = peekToken(2); var token2Kind = token2.kind(); - if (token2Kind === 107 /* EqualsToken */) { + if (token2Kind === 109 /* EqualsToken */) { return true; } - if (token2Kind === 79 /* CommaToken */) { + if (token2Kind === 81 /* CommaToken */) { return true; } - if (token2Kind === 73 /* CloseParenToken */) { + if (token2Kind === 75 /* CloseParenToken */) { var token3 = peekToken(3); - if (token3.kind() === 106 /* ColonToken */) { + if (token3.kind() === 108 /* ColonToken */) { return true; } } @@ -24508,7 +25369,7 @@ var TypeScript; var skippedTokens = getArray(); var propertyAssignments = parseSeparatedSyntaxList(15 /* ObjectLiteralExpression_PropertyAssignments */, skippedTokens); openBraceToken = addSkippedTokensAfterToken(openBraceToken, skippedTokens); - return new Parser.syntaxFactory.ObjectLiteralExpressionSyntax(parseNodeData, openBraceToken, propertyAssignments, eatToken(71 /* CloseBraceToken */)); + return new TypeScript.ObjectLiteralExpressionSyntax(parseNodeData, openBraceToken, propertyAssignments, eatToken(73 /* CloseBraceToken */)); } function tryParsePropertyAssignment(inErrorRecovery) { if (isAccessor(modifierCount(), inErrorRecovery)) { @@ -24521,7 +25382,7 @@ var TypeScript; return parseSimplePropertyAssignment(); } else { - return null; + return undefined; } } function isPropertyAssignment(inErrorRecovery) { @@ -24535,13 +25396,13 @@ var TypeScript; return isPropertyName(currentToken(), inErrorRecovery) && isCallSignature(1); } function parseFunctionPropertyAssignment() { - return new Parser.syntaxFactory.FunctionPropertyAssignmentSyntax(parseNodeData, eatPropertyName(), parseCallSignature(false), parseBlock(false, true)); + return new TypeScript.FunctionPropertyAssignmentSyntax(parseNodeData, eatPropertyName(), parseCallSignature(false), parseBlock(false, true)); } function isSimplePropertyAssignment(inErrorRecovery) { return isPropertyName(currentToken(), inErrorRecovery); } function parseSimplePropertyAssignment() { - return new Parser.syntaxFactory.SimplePropertyAssignmentSyntax(parseNodeData, eatPropertyName(), eatToken(106 /* ColonToken */), tryParseAssignmentExpressionOrHigher(true, true)); + return new TypeScript.SimplePropertyAssignmentSyntax(parseNodeData, eatPropertyName(), eatToken(108 /* ColonToken */), tryParseAssignmentExpressionOrHigher(true, true)); } function isPropertyName(token, inErrorRecovery) { if (TypeScript.SyntaxFacts.isIdentifierNameOrAnyKeyword(token)) { @@ -24553,50 +25414,50 @@ var TypeScript; } } var kind = token.kind(); - return kind === 14 /* StringLiteral */ || kind === 13 /* NumericLiteral */; + return kind === 12 /* StringLiteral */ || kind === 11 /* NumericLiteral */ || kind === 13 /* NoSubstitutionTemplateToken */; } function parseArrayLiteralExpression(openBracketToken) { consumeToken(openBracketToken); var skippedTokens = getArray(); var expressions = parseSeparatedSyntaxList(16 /* ArrayLiteralExpression_AssignmentExpressions */, skippedTokens); openBracketToken = addSkippedTokensAfterToken(openBracketToken, skippedTokens); - return new Parser.syntaxFactory.ArrayLiteralExpressionSyntax(parseNodeData, openBracketToken, expressions, eatToken(75 /* CloseBracketToken */)); + return new TypeScript.ArrayLiteralExpressionSyntax(parseNodeData, openBracketToken, expressions, eatToken(77 /* CloseBracketToken */)); } function parseBlock(parseBlockEvenWithNoOpenBrace, checkForStrictMode) { - var openBraceToken = eatToken(70 /* OpenBraceToken */); - var statements = TypeScript.Syntax.emptyList(); + var openBraceToken = eatToken(72 /* OpenBraceToken */); + var statements; if (parseBlockEvenWithNoOpenBrace || openBraceToken.fullWidth() > 0) { var savedIsInStrictMode = isInStrictMode; - var processItems = checkForStrictMode ? updateStrictModeState : null; + var processItems = checkForStrictMode ? updateStrictModeState : undefined; var skippedTokens = getArray(); var statements = parseSyntaxList(5 /* Block_Statements */, skippedTokens, processItems); openBraceToken = addSkippedTokensAfterToken(openBraceToken, skippedTokens); setStrictMode(savedIsInStrictMode); } - return new Parser.syntaxFactory.BlockSyntax(parseNodeData, openBraceToken, statements, eatToken(71 /* CloseBraceToken */)); + return new TypeScript.BlockSyntax(parseNodeData, openBraceToken, statements || [], eatToken(73 /* CloseBraceToken */)); } function parseCallSignature(requireCompleteTypeParameterList) { - return new Parser.syntaxFactory.CallSignatureSyntax(parseNodeData, tryParseTypeParameterList(requireCompleteTypeParameterList), parseParameterList(), parseOptionalTypeAnnotation(false)); + return new TypeScript.CallSignatureSyntax(parseNodeData, tryParseTypeParameterList(requireCompleteTypeParameterList), parseParameterList(), parseOptionalTypeAnnotation(false)); } function tryParseTypeParameterList(requireCompleteTypeParameterList) { var _currentToken = currentToken(); - if (_currentToken.kind() !== 80 /* LessThanToken */) { - return null; + if (_currentToken.kind() !== 82 /* LessThanToken */) { + return undefined; } var rewindPoint = getRewindPoint(); var lessThanToken = consumeToken(_currentToken); var skippedTokens = getArray(); var typeParameters = parseSeparatedSyntaxList(20 /* TypeParameterList_TypeParameters */, skippedTokens); lessThanToken = addSkippedTokensAfterToken(lessThanToken, skippedTokens); - var greaterThanToken = eatToken(81 /* GreaterThanToken */); + var greaterThanToken = eatToken(83 /* GreaterThanToken */); if (requireCompleteTypeParameterList && greaterThanToken.fullWidth() === 0) { rewind(rewindPoint); releaseRewindPoint(rewindPoint); - return null; + return undefined; } else { releaseRewindPoint(rewindPoint); - return new Parser.syntaxFactory.TypeParameterListSyntax(parseNodeData, lessThanToken, typeParameters, greaterThanToken); + return new TypeScript.TypeParameterListSyntax(parseNodeData, lessThanToken, typeParameters, greaterThanToken); } } function isTypeParameter() { @@ -24604,63 +25465,63 @@ var TypeScript; } function tryParseTypeParameter() { if (!isIdentifier(currentToken())) { - return null; + return undefined; } - return new Parser.syntaxFactory.TypeParameterSyntax(parseNodeData, eatIdentifierToken(), tryParseConstraint()); + return new TypeScript.TypeParameterSyntax(parseNodeData, eatIdentifierToken(), tryParseConstraint()); } function tryParseConstraint() { - if (currentToken().kind() !== 48 /* ExtendsKeyword */) { - return null; + if (currentToken().kind() !== 50 /* ExtendsKeyword */) { + return undefined; } - return new Parser.syntaxFactory.ConstraintSyntax(parseNodeData, eatToken(48 /* ExtendsKeyword */), parseTypeOrExpression()); + return new TypeScript.ConstraintSyntax(parseNodeData, eatToken(50 /* ExtendsKeyword */), parseTypeOrExpression()); } function tryParseParameterList() { - if (currentToken().kind() === 72 /* OpenParenToken */) { + if (currentToken().kind() === 74 /* OpenParenToken */) { var token1 = peekToken(1); - if (token1.kind() === 73 /* CloseParenToken */ || isParameterHelper(token1)) { + if (token1.kind() === 75 /* CloseParenToken */ || isParameterHelper(token1)) { return parseParameterList(); } } - return null; + return undefined; } function parseParameterList() { - var openParenToken = eatToken(72 /* OpenParenToken */); - var parameters = TypeScript.Syntax.emptySeparatedList(); + var openParenToken = eatToken(74 /* OpenParenToken */); + var parameters; if (openParenToken.fullWidth() > 0) { var skippedTokens = getArray(); parameters = parseSeparatedSyntaxList(17 /* ParameterList_Parameters */, skippedTokens); openParenToken = addSkippedTokensAfterToken(openParenToken, skippedTokens); } - return new Parser.syntaxFactory.ParameterListSyntax(parseNodeData, openParenToken, parameters, eatToken(73 /* CloseParenToken */)); + return new TypeScript.ParameterListSyntax(parseNodeData, openParenToken, parameters || [], eatToken(75 /* CloseParenToken */)); } function parseOptionalTypeAnnotation(allowStringLiteral) { - return currentToken().kind() === 106 /* ColonToken */ ? parseTypeAnnotation(allowStringLiteral) : null; + return currentToken().kind() === 108 /* ColonToken */ ? parseTypeAnnotation(allowStringLiteral) : undefined; } function parseTypeAnnotationType(allowStringLiteral) { if (allowStringLiteral) { var _currentToken = currentToken(); - if (_currentToken.kind() === 14 /* StringLiteral */) { + if (_currentToken.kind() === 12 /* StringLiteral */) { return consumeToken(_currentToken); } } return parseType(); } function parseTypeAnnotation(allowStringLiteral) { - return new Parser.syntaxFactory.TypeAnnotationSyntax(parseNodeData, consumeToken(currentToken()), parseTypeAnnotationType(allowStringLiteral)); + return new TypeScript.TypeAnnotationSyntax(parseNodeData, consumeToken(currentToken()), parseTypeAnnotationType(allowStringLiteral)); } function isType() { var _currentToken = currentToken(); switch (_currentToken.kind()) { - case 39 /* TypeOfKeyword */: - case 60 /* AnyKeyword */: - case 67 /* NumberKeyword */: - case 61 /* BooleanKeyword */: - case 69 /* StringKeyword */: - case 41 /* VoidKeyword */: - case 70 /* OpenBraceToken */: - case 72 /* OpenParenToken */: - case 80 /* LessThanToken */: - case 31 /* NewKeyword */: + case 41 /* TypeOfKeyword */: + case 62 /* AnyKeyword */: + case 69 /* NumberKeyword */: + case 63 /* BooleanKeyword */: + case 71 /* StringKeyword */: + case 43 /* VoidKeyword */: + case 72 /* OpenBraceToken */: + case 74 /* OpenParenToken */: + case 82 /* LessThanToken */: + case 33 /* NewKeyword */: return true; default: return isIdentifier(_currentToken); @@ -24681,115 +25542,149 @@ var TypeScript; return tryParseType() || eatIdentifierToken(TypeScript.DiagnosticCode.Type_expected); } function tryParseType() { + if (isFunctionType()) { + return parseFunctionType(); + } + if (currentToken().kind() === 33 /* NewKeyword */) { + return parseConstructorType(); + } + return tryParseUnionTypeOrHigher(); + } + function tryParseUnionTypeOrHigher() { + var type = tryParsePrimaryType(); + if (type) { + var barToken; + while ((barToken = currentToken()).kind() === 101 /* BarToken */) { + consumeToken(barToken); + var right = parsePrimaryType(); + type = new TypeScript.UnionTypeSyntax(parseNodeData, type, barToken, right); + } + } + return type; + } + function parsePrimaryType() { + return tryParsePrimaryType() || eatIdentifierToken(TypeScript.DiagnosticCode.Type_expected); + } + function tryParsePrimaryType() { var type = tryParseNonArrayType(); while (type) { var _currentToken = currentToken(); - if (previousTokenHasTrailingNewLine(_currentToken) || _currentToken.kind() !== 74 /* OpenBracketToken */) { + if (previousTokenHasTrailingNewLine(_currentToken) || _currentToken.kind() !== 76 /* OpenBracketToken */) { break; } - type = new Parser.syntaxFactory.ArrayTypeSyntax(parseNodeData, type, consumeToken(_currentToken), eatToken(75 /* CloseBracketToken */)); + type = new TypeScript.ArrayTypeSyntax(parseNodeData, type, consumeToken(_currentToken), eatToken(77 /* CloseBracketToken */)); } return type; } function parseTypeQuery(typeOfKeyword) { - return new Parser.syntaxFactory.TypeQuerySyntax(parseNodeData, consumeToken(typeOfKeyword), parseName(true)); + return new TypeScript.TypeQuerySyntax(parseNodeData, consumeToken(typeOfKeyword), parseName(true)); } function tryParseNonArrayType() { var _currentToken = currentToken(); switch (_currentToken.kind()) { - case 60 /* AnyKeyword */: - case 67 /* NumberKeyword */: - case 61 /* BooleanKeyword */: - case 69 /* StringKeyword */: - if (peekToken(1).kind() === 76 /* DotToken */) { + case 62 /* AnyKeyword */: + case 69 /* NumberKeyword */: + case 63 /* BooleanKeyword */: + case 71 /* StringKeyword */: + if (peekToken(1).kind() === 78 /* DotToken */) { break; } return consumeToken(_currentToken); - case 72 /* OpenParenToken */: - case 80 /* LessThanToken */: - return tryParseFunctionType(); - case 41 /* VoidKeyword */: - return consumeToken(_currentToken); - case 70 /* OpenBraceToken */: - return parseObjectType(); - case 31 /* NewKeyword */: - return parseConstructorType(); - case 39 /* TypeOfKeyword */: - return parseTypeQuery(_currentToken); - case 74 /* OpenBracketToken */: - return parseTupleType(_currentToken); + case 43 /* VoidKeyword */: return consumeToken(_currentToken); + case 74 /* OpenParenToken */: return parseParenthesizedType(_currentToken); + case 72 /* OpenBraceToken */: return parseObjectType(); + case 41 /* TypeOfKeyword */: return parseTypeQuery(_currentToken); + case 76 /* OpenBracketToken */: return parseTupleType(_currentToken); } return tryParseNameOrGenericType(); } + function parseParenthesizedType(openParenToken) { + return new TypeScript.ParenthesizedTypeSyntax(parseNodeData, consumeToken(openParenToken), parseType(), eatToken(75 /* CloseParenToken */)); + } function tryParseNameOrGenericType() { var name = tryParseName(false); - if (name === null) { - return null; + if (name === undefined) { + return undefined; } if (previousTokenHasTrailingNewLine(currentToken())) { return name; } var typeArgumentList = tryParseTypeArgumentList(false); - return typeArgumentList === null ? name : new Parser.syntaxFactory.GenericTypeSyntax(parseNodeData, name, typeArgumentList); + return !typeArgumentList ? name : new TypeScript.GenericTypeSyntax(parseNodeData, name, typeArgumentList); } - function tryParseFunctionType() { - var typeParameterList = tryParseTypeParameterList(false); - var parameterList = null; - if (typeParameterList === null) { - parameterList = tryParseParameterList(); - if (parameterList === null) { - return null; + function isFunctionType() { + var token0 = currentToken(); + var token0Kind = token0.kind(); + if (token0Kind === 82 /* LessThanToken */) { + return true; + } + if (token0Kind === 74 /* OpenParenToken */) { + var token1 = peekToken(1); + var token1Kind = token1.kind(); + if (token1Kind === 75 /* CloseParenToken */ || token1Kind === 79 /* DotDotDotToken */) { + return true; + } + if (isModifierKind(token1Kind) || isIdentifier(token1)) { + var token2 = peekToken(2); + var token2Kind = token2.kind(); + if (token2Kind === 108 /* ColonToken */ || token2Kind === 81 /* CommaToken */ || token2Kind === 107 /* QuestionToken */ || token2Kind === 109 /* EqualsToken */ || isIdentifier(token2) || isModifierKind(token2Kind)) { + return true; + } + if (token2Kind === 75 /* CloseParenToken */) { + return peekToken(3).kind() === 87 /* EqualsGreaterThanToken */; + } } } - else { - parameterList = parseParameterList(); - } - return new Parser.syntaxFactory.FunctionTypeSyntax(parseNodeData, typeParameterList, parameterList, eatToken(85 /* EqualsGreaterThanToken */), parseType()); + return false; + } + function parseFunctionType() { + var typeParameterList = tryParseTypeParameterList(false); + var parameterList = parseParameterList(); + return new TypeScript.FunctionTypeSyntax(parseNodeData, typeParameterList, parameterList, eatToken(87 /* EqualsGreaterThanToken */), parseType()); } function parseConstructorType() { - return new Parser.syntaxFactory.ConstructorTypeSyntax(parseNodeData, eatToken(31 /* NewKeyword */), tryParseTypeParameterList(false), parseParameterList(), eatToken(85 /* EqualsGreaterThanToken */), parseType()); + return new TypeScript.ConstructorTypeSyntax(parseNodeData, eatToken(33 /* NewKeyword */), tryParseTypeParameterList(false), parseParameterList(), eatToken(87 /* EqualsGreaterThanToken */), parseType()); } function isParameter() { - if (currentNode() !== null && currentNode().kind() === 243 /* Parameter */) { + if (currentNode() && currentNode().kind() === 208 /* Parameter */) { return true; } return isParameterHelper(currentToken()); } function isParameterHelper(token) { var tokenKind = token.kind(); - return tokenKind === 77 /* DotDotDotToken */ || isModifierKind(tokenKind) || isIdentifier(token); + return tokenKind === 79 /* DotDotDotToken */ || isModifierKind(tokenKind) || isIdentifier(token); } function eatSimpleParameter() { - return new Parser.syntaxFactory.ParameterSyntax(parseNodeData, null, TypeScript.Syntax.emptyList(), eatIdentifierToken(), null, null, null); + return new TypeScript.ParameterSyntax(parseNodeData, undefined, [], eatIdentifierToken(), undefined, undefined, undefined); } function tryParseParameter() { var node = currentNode(); - if (node !== null && node.kind() === 243 /* Parameter */) { + if (node && node.kind() === 208 /* Parameter */) { consumeNode(node); return node; } - var dotDotDotToken = tryEatToken(77 /* DotDotDotToken */); + var dotDotDotToken = tryEatToken(79 /* DotDotDotToken */); var modifiers = parseModifiers(); var _currentToken = currentToken(); - if (!isIdentifier(_currentToken) && dotDotDotToken === null && modifiers.length === 0) { + if (!isIdentifier(_currentToken) && !dotDotDotToken && modifiers.length === 0) { if (isModifierKind(_currentToken.kind())) { modifiers = TypeScript.Syntax.list([consumeToken(_currentToken)]); } else { - return null; + return undefined; } } var identifier = eatIdentifierToken(); - var questionToken = tryEatToken(105 /* QuestionToken */); + var questionToken = tryEatToken(107 /* QuestionToken */); var typeAnnotation = parseOptionalTypeAnnotation(true); - var equalsValueClause = null; + var equalsValueClause = undefined; if (isEqualsValueClause(true)) { equalsValueClause = parseEqualsValueClause(true); } - return new Parser.syntaxFactory.ParameterSyntax(parseNodeData, dotDotDotToken, modifiers, identifier, questionToken, typeAnnotation, equalsValueClause); + return new TypeScript.ParameterSyntax(parseNodeData, dotDotDotToken, modifiers, identifier, questionToken, typeAnnotation, equalsValueClause); } function parseSyntaxList(currentListType, skippedTokens, processItems) { - if (processItems === void 0) { processItems = null; } var savedListParsingState = listParsingState; listParsingState |= (1 << currentListType); var result = parseSyntaxListWorker(currentListType, skippedTokens, processItems); @@ -24803,7 +25698,7 @@ var TypeScript; listParsingState = savedListParsingState; return result; } - function abortParsingListOrMoveToNextToken(currentListType, nodes, separators, skippedTokens) { + function abortParsingListOrMoveToNextToken(currentListType, nodeAndSeparators, skippedTokens) { reportUnexpectedTokenDiagnostic(currentListType); for (var state = ListParsingState.LastListParsingState; state >= ListParsingState.FirstListParsingState; state--) { if ((listParsingState & (1 << state)) !== 0) { @@ -24812,70 +25707,63 @@ var TypeScript; } } } - addSkippedTokenToList(nodes, separators, skippedTokens, consumeToken(currentToken())); + addSkippedTokenToList(nodeAndSeparators, skippedTokens, consumeToken(currentToken())); return false; } - function addSkippedTokenToList(nodes, separators, skippedTokens, skippedToken) { - if (Parser.syntaxFactory.isConcrete) { - var length = nodes.length + (separators ? separators.length : 0); - for (var i = length - 1; i >= 0; i--) { - var array = separators && (i % 2 === 1) ? separators : nodes; - var arrayIndex = separators ? TypeScript.IntegerUtilities.integerDivide(i, 2) : i; - var item = array[arrayIndex]; - var _lastToken = TypeScript.lastToken(item); - if (_lastToken && _lastToken.fullWidth() > 0) { - array[arrayIndex] = addSkippedTokenAfterNodeOrToken(item, skippedToken); - return; - } + function addSkippedTokenToList(nodesAndSeparators, skippedTokens, skippedToken) { + var length = nodesAndSeparators.length; + for (var i = length - 1; i >= 0; i--) { + var item = nodesAndSeparators[i]; + var _lastToken = TypeScript.lastToken(item); + if (_lastToken && _lastToken.fullWidth() > 0) { + nodesAndSeparators[i] = addSkippedTokenAfterNodeOrToken(item, skippedToken); + return; } - skippedTokens.push(skippedToken); } + skippedTokens.push(skippedToken); } function tryParseExpectedListItem(currentListType, inErrorRecovery, items, processItems) { var item = tryParseExpectedListItemWorker(currentListType, inErrorRecovery); - if (item === null) { + if (item === undefined) { return false; } items.push(item); - if (processItems !== null) { + if (processItems) { processItems(items); } return true; } function listIsTerminated(currentListType) { - return isExpectedListTerminator(currentListType) || currentToken().kind() === 10 /* EndOfFileToken */; + return isExpectedListTerminator(currentListType) || currentToken().kind() === 8 /* EndOfFileToken */; } function parseSyntaxListWorker(currentListType, skippedTokens, processItems) { - var items = getArray(); + var items = []; while (true) { var succeeded = tryParseExpectedListItem(currentListType, false, items, processItems); if (!succeeded) { if (listIsTerminated(currentListType)) { break; } - var abort = abortParsingListOrMoveToNextToken(currentListType, items, null, skippedTokens); + var abort = abortParsingListOrMoveToNextToken(currentListType, items, skippedTokens); if (abort) { break; } } } - var result = TypeScript.Syntax.list(items); - returnZeroLengthArray(items); - return result; + return TypeScript.Syntax.list(items); } function parseSeparatedSyntaxListWorker(currentListType, skippedTokens) { - var nodes = getArray(); - var separators = getArray(); - var _separatorKind = currentListType === 9 /* ObjectType_TypeMembers */ ? 78 /* SemicolonToken */ : 79 /* CommaToken */; - var allowAutomaticSemicolonInsertion = _separatorKind === 78 /* SemicolonToken */; + var nodesAndSeparators = []; + var _separatorKind = currentListType === 9 /* ObjectType_TypeMembers */ ? 80 /* SemicolonToken */ : 81 /* CommaToken */; + var allowAutomaticSemicolonInsertion = _separatorKind === 80 /* SemicolonToken */; var inErrorRecovery = false; while (true) { - var succeeded = tryParseExpectedListItem(currentListType, inErrorRecovery, nodes, null); + var succeeded = tryParseExpectedListItem(currentListType, inErrorRecovery, nodesAndSeparators, undefined); if (!succeeded) { if (listIsTerminated(currentListType)) { break; } - var abort = abortParsingListOrMoveToNextToken(currentListType, nodes, separators, skippedTokens); + var abort = abortParsingListOrMoveToNextToken(currentListType, nodesAndSeparators, skippedTokens); if (abort) { break; } @@ -24887,25 +25775,22 @@ var TypeScript; inErrorRecovery = false; var _currentToken = currentToken(); var tokenKind = _currentToken.kind(); - if (tokenKind === _separatorKind || tokenKind === 79 /* CommaToken */) { - separators.push(consumeToken(_currentToken)); + if (tokenKind === _separatorKind || tokenKind === 81 /* CommaToken */) { + nodesAndSeparators.push(consumeToken(_currentToken)); continue; } if (listIsTerminated(currentListType)) { break; } if (allowAutomaticSemicolonInsertion && canEatAutomaticSemicolon(false)) { - var semicolonToken = eatExplicitOrAutomaticSemicolon(false) || TypeScript.Syntax.emptyToken(78 /* SemicolonToken */); - separators.push(semicolonToken); + var semicolonToken = eatExplicitOrAutomaticSemicolon(false) || TypeScript.Syntax.emptyToken(80 /* SemicolonToken */); + nodesAndSeparators.push(semicolonToken); continue; } - separators.push(eatToken(_separatorKind)); + nodesAndSeparators.push(eatToken(_separatorKind)); inErrorRecovery = true; } - var result = TypeScript.Syntax.separatedList(nodes, separators); - returnZeroLengthArray(nodes); - returnZeroLengthArray(separators); - return result; + return TypeScript.Syntax.separatedList(nodesAndSeparators); } function reportUnexpectedTokenDiagnostic(listType) { var token = currentToken(); @@ -24920,76 +25805,54 @@ var TypeScript; } function isExpectedListTerminator(currentListType) { switch (currentListType) { - case 0 /* SourceUnit_ModuleElements */: - return isExpectedSourceUnit_ModuleElementsTerminator(); - case 1 /* ClassDeclaration_ClassElements */: - return isExpectedClassDeclaration_ClassElementsTerminator(); - case 2 /* ModuleDeclaration_ModuleElements */: - return isExpectedModuleDeclaration_ModuleElementsTerminator(); - case 3 /* SwitchStatement_SwitchClauses */: - return isExpectedSwitchStatement_SwitchClausesTerminator(); - case 4 /* SwitchClause_Statements */: - return isExpectedSwitchClause_StatementsTerminator(); - case 5 /* Block_Statements */: - return isExpectedBlock_StatementsTerminator(); - case 6 /* TryBlock_Statements */: - return isExpectedTryBlock_StatementsTerminator(); - case 7 /* CatchBlock_Statements */: - return isExpectedCatchBlock_StatementsTerminator(); - case 8 /* EnumDeclaration_EnumElements */: - return isExpectedEnumDeclaration_EnumElementsTerminator(); - case 9 /* ObjectType_TypeMembers */: - return isExpectedObjectType_TypeMembersTerminator(); - case 10 /* ClassOrInterfaceDeclaration_HeritageClauses */: - return isExpectedClassOrInterfaceDeclaration_HeritageClausesTerminator(); - case 11 /* HeritageClause_TypeNameList */: - return isExpectedHeritageClause_TypeNameListTerminator(); - case 12 /* VariableDeclaration_VariableDeclarators_AllowIn */: - return isExpectedVariableDeclaration_VariableDeclarators_AllowInTerminator(); - case 13 /* VariableDeclaration_VariableDeclarators_DisallowIn */: - return isExpectedVariableDeclaration_VariableDeclarators_DisallowInTerminator(); - case 14 /* ArgumentList_AssignmentExpressions */: - return isExpectedArgumentList_AssignmentExpressionsTerminator(); - case 15 /* ObjectLiteralExpression_PropertyAssignments */: - return isExpectedObjectLiteralExpression_PropertyAssignmentsTerminator(); - case 16 /* ArrayLiteralExpression_AssignmentExpressions */: - return isExpectedLiteralExpression_AssignmentExpressionsTerminator(); - case 17 /* ParameterList_Parameters */: - return isExpectedParameterList_ParametersTerminator(); - case 18 /* IndexSignature_Parameters */: - return isExpectedIndexSignature_ParametersTerminator(); - case 19 /* TypeArgumentList_Types */: - return isExpectedTypeArgumentList_TypesTerminator(); - case 20 /* TypeParameterList_TypeParameters */: - return isExpectedTypeParameterList_TypeParametersTerminator(); - case 21 /* TupleType_Types */: - return isExpectedTupleType_TypesTerminator(); + case 0 /* SourceUnit_ModuleElements */: return isExpectedSourceUnit_ModuleElementsTerminator(); + case 1 /* ClassDeclaration_ClassElements */: return isExpectedClassDeclaration_ClassElementsTerminator(); + case 2 /* ModuleDeclaration_ModuleElements */: return isExpectedModuleDeclaration_ModuleElementsTerminator(); + case 3 /* SwitchStatement_SwitchClauses */: return isExpectedSwitchStatement_SwitchClausesTerminator(); + case 4 /* SwitchClause_Statements */: return isExpectedSwitchClause_StatementsTerminator(); + case 5 /* Block_Statements */: return isExpectedBlock_StatementsTerminator(); + case 6 /* TryBlock_Statements */: return isExpectedTryBlock_StatementsTerminator(); + case 7 /* CatchBlock_Statements */: return isExpectedCatchBlock_StatementsTerminator(); + case 8 /* EnumDeclaration_EnumElements */: return isExpectedEnumDeclaration_EnumElementsTerminator(); + case 9 /* ObjectType_TypeMembers */: return isExpectedObjectType_TypeMembersTerminator(); + case 10 /* ClassOrInterfaceDeclaration_HeritageClauses */: return isExpectedClassOrInterfaceDeclaration_HeritageClausesTerminator(); + case 11 /* HeritageClause_TypeNameList */: return isExpectedHeritageClause_TypeNameListTerminator(); + case 12 /* VariableDeclaration_VariableDeclarators_AllowIn */: return isExpectedVariableDeclaration_VariableDeclarators_AllowInTerminator(); + case 13 /* VariableDeclaration_VariableDeclarators_DisallowIn */: return isExpectedVariableDeclaration_VariableDeclarators_DisallowInTerminator(); + case 14 /* ArgumentList_AssignmentExpressions */: return isExpectedArgumentList_AssignmentExpressionsTerminator(); + case 15 /* ObjectLiteralExpression_PropertyAssignments */: return isExpectedObjectLiteralExpression_PropertyAssignmentsTerminator(); + case 16 /* ArrayLiteralExpression_AssignmentExpressions */: return isExpectedLiteralExpression_AssignmentExpressionsTerminator(); + case 17 /* ParameterList_Parameters */: return isExpectedParameterList_ParametersTerminator(); + case 18 /* IndexSignature_Parameters */: return isExpectedIndexSignature_ParametersTerminator(); + case 19 /* TypeArgumentList_Types */: return isExpectedTypeArgumentList_TypesTerminator(); + case 20 /* TypeParameterList_TypeParameters */: return isExpectedTypeParameterList_TypeParametersTerminator(); + case 21 /* TupleType_Types */: return isExpectedTupleType_TypesTerminator(); default: throw TypeScript.Errors.invalidOperation(); } } function isExpectedSourceUnit_ModuleElementsTerminator() { - return currentToken().kind() === 10 /* EndOfFileToken */; + return currentToken().kind() === 8 /* EndOfFileToken */; } function isExpectedEnumDeclaration_EnumElementsTerminator() { - return currentToken().kind() === 71 /* CloseBraceToken */; + return currentToken().kind() === 73 /* CloseBraceToken */; } function isExpectedModuleDeclaration_ModuleElementsTerminator() { - return currentToken().kind() === 71 /* CloseBraceToken */; + return currentToken().kind() === 73 /* CloseBraceToken */; } function isExpectedObjectType_TypeMembersTerminator() { - return currentToken().kind() === 71 /* CloseBraceToken */; + return currentToken().kind() === 73 /* CloseBraceToken */; } function isExpectedObjectLiteralExpression_PropertyAssignmentsTerminator() { - return currentToken().kind() === 71 /* CloseBraceToken */; + return currentToken().kind() === 73 /* CloseBraceToken */; } function isExpectedLiteralExpression_AssignmentExpressionsTerminator() { - return currentToken().kind() === 75 /* CloseBracketToken */; + return currentToken().kind() === 77 /* CloseBracketToken */; } function isExpectedTypeArgumentList_TypesTerminator() { var token = currentToken(); var tokenKind = token.kind(); - if (tokenKind === 81 /* GreaterThanToken */) { + if (tokenKind === 83 /* GreaterThanToken */) { return true; } if (canFollowTypeArgumentListInExpression(tokenKind)) { @@ -25000,70 +25863,70 @@ var TypeScript; function isExpectedTupleType_TypesTerminator() { var token = currentToken(); var tokenKind = token.kind(); - if (tokenKind === 75 /* CloseBracketToken */) { + if (tokenKind === 77 /* CloseBracketToken */) { return true; } return false; } function isExpectedTypeParameterList_TypeParametersTerminator() { var tokenKind = currentToken().kind(); - if (tokenKind === 81 /* GreaterThanToken */) { + if (tokenKind === 83 /* GreaterThanToken */) { return true; } - if (tokenKind === 72 /* OpenParenToken */ || tokenKind === 70 /* OpenBraceToken */ || tokenKind === 48 /* ExtendsKeyword */ || tokenKind === 51 /* ImplementsKeyword */) { + if (tokenKind === 74 /* OpenParenToken */ || tokenKind === 72 /* OpenBraceToken */ || tokenKind === 50 /* ExtendsKeyword */ || tokenKind === 53 /* ImplementsKeyword */) { return true; } return false; } function isExpectedParameterList_ParametersTerminator() { var tokenKind = currentToken().kind(); - if (tokenKind === 73 /* CloseParenToken */) { + if (tokenKind === 75 /* CloseParenToken */) { return true; } - if (tokenKind === 70 /* OpenBraceToken */) { + if (tokenKind === 72 /* OpenBraceToken */) { return true; } - if (tokenKind === 85 /* EqualsGreaterThanToken */) { + if (tokenKind === 87 /* EqualsGreaterThanToken */) { return true; } return false; } function isExpectedIndexSignature_ParametersTerminator() { var tokenKind = currentToken().kind(); - if (tokenKind === 75 /* CloseBracketToken */) { + if (tokenKind === 77 /* CloseBracketToken */) { return true; } - if (tokenKind === 70 /* OpenBraceToken */) { + if (tokenKind === 72 /* OpenBraceToken */) { return true; } return false; } function isExpectedVariableDeclaration_VariableDeclarators_DisallowInTerminator() { var tokenKind = currentToken().kind(); - if (tokenKind === 78 /* SemicolonToken */ || tokenKind === 73 /* CloseParenToken */) { + if (tokenKind === 80 /* SemicolonToken */ || tokenKind === 75 /* CloseParenToken */) { return true; } - if (tokenKind === 29 /* InKeyword */) { + if (tokenKind === 31 /* InKeyword */) { return true; } return false; } function isExpectedVariableDeclaration_VariableDeclarators_AllowInTerminator() { - if (currentToken().kind() === 85 /* EqualsGreaterThanToken */) { + if (currentToken().kind() === 87 /* EqualsGreaterThanToken */) { return true; } return canEatExplicitOrAutomaticSemicolon(false); } function isExpectedClassOrInterfaceDeclaration_HeritageClausesTerminator() { var tokenKind = currentToken().kind(); - if (tokenKind === 70 /* OpenBraceToken */ || tokenKind === 71 /* CloseBraceToken */) { + if (tokenKind === 72 /* OpenBraceToken */ || tokenKind === 73 /* CloseBraceToken */) { return true; } return false; } function isExpectedHeritageClause_TypeNameListTerminator() { var tokenKind = currentToken().kind(); - if (tokenKind === 48 /* ExtendsKeyword */ || tokenKind === 51 /* ImplementsKeyword */) { + if (tokenKind === 50 /* ExtendsKeyword */ || tokenKind === 53 /* ImplementsKeyword */) { return true; } if (isExpectedClassOrInterfaceDeclaration_HeritageClausesTerminator()) { @@ -25074,75 +25937,52 @@ var TypeScript; function isExpectedArgumentList_AssignmentExpressionsTerminator() { var token0 = currentToken(); var tokenKind = token0.kind(); - return tokenKind === 73 /* CloseParenToken */ || tokenKind === 78 /* SemicolonToken */; + return tokenKind === 75 /* CloseParenToken */ || tokenKind === 80 /* SemicolonToken */; } function isExpectedClassDeclaration_ClassElementsTerminator() { - return currentToken().kind() === 71 /* CloseBraceToken */; + return currentToken().kind() === 73 /* CloseBraceToken */; } function isExpectedSwitchStatement_SwitchClausesTerminator() { - return currentToken().kind() === 71 /* CloseBraceToken */; + return currentToken().kind() === 73 /* CloseBraceToken */; } function isExpectedSwitchClause_StatementsTerminator() { - return currentToken().kind() === 71 /* CloseBraceToken */ || isSwitchClause(); + return currentToken().kind() === 73 /* CloseBraceToken */ || isSwitchClause(); } function isExpectedBlock_StatementsTerminator() { - return currentToken().kind() === 71 /* CloseBraceToken */; + return currentToken().kind() === 73 /* CloseBraceToken */; } function isExpectedTryBlock_StatementsTerminator() { var tokenKind = currentToken().kind(); - return tokenKind === 17 /* CatchKeyword */ || tokenKind === 25 /* FinallyKeyword */; + return tokenKind === 19 /* CatchKeyword */ || tokenKind === 27 /* FinallyKeyword */; } function isExpectedCatchBlock_StatementsTerminator() { - return currentToken().kind() === 25 /* FinallyKeyword */; + return currentToken().kind() === 27 /* FinallyKeyword */; } function isExpectedListItem(currentListType, inErrorRecovery) { switch (currentListType) { - case 0 /* SourceUnit_ModuleElements */: - return isModuleElement(inErrorRecovery); - case 1 /* ClassDeclaration_ClassElements */: - return isClassElement(inErrorRecovery); - case 2 /* ModuleDeclaration_ModuleElements */: - return isModuleElement(inErrorRecovery); - case 3 /* SwitchStatement_SwitchClauses */: - return isSwitchClause(); - case 4 /* SwitchClause_Statements */: - return isStatement(modifierCount(), inErrorRecovery); - case 5 /* Block_Statements */: - return isStatement(modifierCount(), inErrorRecovery); - case 6 /* TryBlock_Statements */: - return false; - case 7 /* CatchBlock_Statements */: - return false; - case 8 /* EnumDeclaration_EnumElements */: - return isEnumElement(inErrorRecovery); - case 9 /* ObjectType_TypeMembers */: - return isTypeMember(inErrorRecovery); - case 10 /* ClassOrInterfaceDeclaration_HeritageClauses */: - return isHeritageClause(); - case 11 /* HeritageClause_TypeNameList */: - return isHeritageClauseTypeName(); - case 12 /* VariableDeclaration_VariableDeclarators_AllowIn */: - return isVariableDeclarator(); - case 13 /* VariableDeclaration_VariableDeclarators_DisallowIn */: - return isVariableDeclarator(); - case 14 /* ArgumentList_AssignmentExpressions */: - return isExpectedArgumentList_AssignmentExpression(); - case 15 /* ObjectLiteralExpression_PropertyAssignments */: - return isPropertyAssignment(inErrorRecovery); - case 16 /* ArrayLiteralExpression_AssignmentExpressions */: - return isAssignmentOrOmittedExpression(); - case 17 /* ParameterList_Parameters */: - return isParameter(); - case 18 /* IndexSignature_Parameters */: - return isParameter(); - case 19 /* TypeArgumentList_Types */: - return isType(); - case 20 /* TypeParameterList_TypeParameters */: - return isTypeParameter(); - case 21 /* TupleType_Types */: - return isType(); - default: - throw TypeScript.Errors.invalidOperation(); + case 0 /* SourceUnit_ModuleElements */: return isModuleElement(inErrorRecovery); + case 1 /* ClassDeclaration_ClassElements */: return isClassElement(inErrorRecovery); + case 2 /* ModuleDeclaration_ModuleElements */: return isModuleElement(inErrorRecovery); + case 3 /* SwitchStatement_SwitchClauses */: return isSwitchClause(); + case 4 /* SwitchClause_Statements */: return isStatement(modifierCount(), inErrorRecovery); + case 5 /* Block_Statements */: return isStatement(modifierCount(), inErrorRecovery); + case 6 /* TryBlock_Statements */: return false; + case 7 /* CatchBlock_Statements */: return false; + case 8 /* EnumDeclaration_EnumElements */: return isEnumElement(inErrorRecovery); + case 9 /* ObjectType_TypeMembers */: return isTypeMember(inErrorRecovery); + case 10 /* ClassOrInterfaceDeclaration_HeritageClauses */: return isHeritageClause(); + case 11 /* HeritageClause_TypeNameList */: return isHeritageClauseTypeName(); + case 12 /* VariableDeclaration_VariableDeclarators_AllowIn */: return isVariableDeclarator(); + case 13 /* VariableDeclaration_VariableDeclarators_DisallowIn */: return isVariableDeclarator(); + case 14 /* ArgumentList_AssignmentExpressions */: return isExpectedArgumentList_AssignmentExpression(); + case 15 /* ObjectLiteralExpression_PropertyAssignments */: return isPropertyAssignment(inErrorRecovery); + case 16 /* ArrayLiteralExpression_AssignmentExpressions */: return isAssignmentOrOmittedExpression(); + case 17 /* ParameterList_Parameters */: return isParameter(); + case 18 /* IndexSignature_Parameters */: return isParameter(); + case 19 /* TypeArgumentList_Types */: return isType(); + case 20 /* TypeParameterList_TypeParameters */: return isTypeParameter(); + case 21 /* TupleType_Types */: return isType(); + default: throw TypeScript.Errors.invalidOperation(); } } function isExpectedArgumentList_AssignmentExpression() { @@ -25150,105 +25990,61 @@ var TypeScript; if (isExpression(_currentToken)) { return true; } - if (_currentToken.kind() === 79 /* CommaToken */) { + if (_currentToken.kind() === 81 /* CommaToken */) { return true; } return false; } function tryParseExpectedListItemWorker(currentListType, inErrorRecovery) { switch (currentListType) { - case 0 /* SourceUnit_ModuleElements */: - return tryParseModuleElement(inErrorRecovery); - case 1 /* ClassDeclaration_ClassElements */: - return tryParseClassElement(inErrorRecovery); - case 2 /* ModuleDeclaration_ModuleElements */: - return tryParseModuleElement(inErrorRecovery); - case 3 /* SwitchStatement_SwitchClauses */: - return tryParseSwitchClause(); - case 4 /* SwitchClause_Statements */: - return tryParseStatement(inErrorRecovery); - case 5 /* Block_Statements */: - return tryParseStatement(inErrorRecovery); - case 6 /* TryBlock_Statements */: - return tryParseStatement(inErrorRecovery); - case 7 /* CatchBlock_Statements */: - return tryParseStatement(inErrorRecovery); - case 8 /* EnumDeclaration_EnumElements */: - return tryParseEnumElement(inErrorRecovery); - case 9 /* ObjectType_TypeMembers */: - return tryParseTypeMember(inErrorRecovery); - case 10 /* ClassOrInterfaceDeclaration_HeritageClauses */: - return tryParseHeritageClause(); - case 11 /* HeritageClause_TypeNameList */: - return tryParseHeritageClauseTypeName(); - case 12 /* VariableDeclaration_VariableDeclarators_AllowIn */: - return tryParseVariableDeclarator(true, false); - case 13 /* VariableDeclaration_VariableDeclarators_DisallowIn */: - return tryParseVariableDeclarator(false, false); - case 14 /* ArgumentList_AssignmentExpressions */: - return tryParseArgumentListExpression(); - case 15 /* ObjectLiteralExpression_PropertyAssignments */: - return tryParsePropertyAssignment(inErrorRecovery); - case 16 /* ArrayLiteralExpression_AssignmentExpressions */: - return tryParseAssignmentOrOmittedExpression(); - case 17 /* ParameterList_Parameters */: - return tryParseParameter(); - case 18 /* IndexSignature_Parameters */: - return tryParseParameter(); - case 19 /* TypeArgumentList_Types */: - return tryParseType(); - case 20 /* TypeParameterList_TypeParameters */: - return tryParseTypeParameter(); - case 21 /* TupleType_Types */: - return tryParseType(); - default: - throw TypeScript.Errors.invalidOperation(); + case 0 /* SourceUnit_ModuleElements */: return tryParseModuleElement(inErrorRecovery); + case 1 /* ClassDeclaration_ClassElements */: return tryParseClassElement(inErrorRecovery); + case 2 /* ModuleDeclaration_ModuleElements */: return tryParseModuleElement(inErrorRecovery); + case 3 /* SwitchStatement_SwitchClauses */: return tryParseSwitchClause(); + case 4 /* SwitchClause_Statements */: return tryParseStatement(inErrorRecovery); + case 5 /* Block_Statements */: return tryParseStatement(inErrorRecovery); + case 6 /* TryBlock_Statements */: return tryParseStatement(inErrorRecovery); + case 7 /* CatchBlock_Statements */: return tryParseStatement(inErrorRecovery); + case 8 /* EnumDeclaration_EnumElements */: return tryParseEnumElement(inErrorRecovery); + case 9 /* ObjectType_TypeMembers */: return tryParseTypeMember(inErrorRecovery); + case 10 /* ClassOrInterfaceDeclaration_HeritageClauses */: return tryParseHeritageClause(); + case 11 /* HeritageClause_TypeNameList */: return tryParseHeritageClauseTypeName(); + case 12 /* VariableDeclaration_VariableDeclarators_AllowIn */: return tryParseVariableDeclarator(true, false); + case 13 /* VariableDeclaration_VariableDeclarators_DisallowIn */: return tryParseVariableDeclarator(false, false); + case 14 /* ArgumentList_AssignmentExpressions */: return tryParseArgumentListExpression(); + case 15 /* ObjectLiteralExpression_PropertyAssignments */: return tryParsePropertyAssignment(inErrorRecovery); + case 16 /* ArrayLiteralExpression_AssignmentExpressions */: return tryParseAssignmentOrOmittedExpression(); + case 17 /* ParameterList_Parameters */: return tryParseParameter(); + case 18 /* IndexSignature_Parameters */: return tryParseParameter(); + case 19 /* TypeArgumentList_Types */: return tryParseType(); + case 20 /* TypeParameterList_TypeParameters */: return tryParseTypeParameter(); + case 21 /* TupleType_Types */: return tryParseType(); + default: throw TypeScript.Errors.invalidOperation(); } } function getExpectedListElementType(currentListType) { switch (currentListType) { - case 0 /* SourceUnit_ModuleElements */: - return TypeScript.getLocalizedText(TypeScript.DiagnosticCode.module_class_interface_enum_import_or_statement, null); - case 10 /* ClassOrInterfaceDeclaration_HeritageClauses */: - return '{'; - case 1 /* ClassDeclaration_ClassElements */: - return TypeScript.getLocalizedText(TypeScript.DiagnosticCode.constructor_function_accessor_or_variable, null); - case 2 /* ModuleDeclaration_ModuleElements */: - return TypeScript.getLocalizedText(TypeScript.DiagnosticCode.module_class_interface_enum_import_or_statement, null); - case 3 /* SwitchStatement_SwitchClauses */: - return TypeScript.getLocalizedText(TypeScript.DiagnosticCode.case_or_default_clause, null); - case 4 /* SwitchClause_Statements */: - return TypeScript.getLocalizedText(TypeScript.DiagnosticCode.statement, null); - case 5 /* Block_Statements */: - return TypeScript.getLocalizedText(TypeScript.DiagnosticCode.statement, null); - case 12 /* VariableDeclaration_VariableDeclarators_AllowIn */: - return TypeScript.getLocalizedText(TypeScript.DiagnosticCode.identifier, null); - case 13 /* VariableDeclaration_VariableDeclarators_DisallowIn */: - return TypeScript.getLocalizedText(TypeScript.DiagnosticCode.identifier, null); - case 8 /* EnumDeclaration_EnumElements */: - return TypeScript.getLocalizedText(TypeScript.DiagnosticCode.identifier, null); - case 9 /* ObjectType_TypeMembers */: - return TypeScript.getLocalizedText(TypeScript.DiagnosticCode.call_construct_index_property_or_function_signature, null); - case 14 /* ArgumentList_AssignmentExpressions */: - return TypeScript.getLocalizedText(TypeScript.DiagnosticCode.expression, null); - case 11 /* HeritageClause_TypeNameList */: - return TypeScript.getLocalizedText(TypeScript.DiagnosticCode.type_name, null); - case 15 /* ObjectLiteralExpression_PropertyAssignments */: - return TypeScript.getLocalizedText(TypeScript.DiagnosticCode.property_or_accessor, null); - case 17 /* ParameterList_Parameters */: - return TypeScript.getLocalizedText(TypeScript.DiagnosticCode.parameter, null); - case 18 /* IndexSignature_Parameters */: - return TypeScript.getLocalizedText(TypeScript.DiagnosticCode.parameter, null); - case 19 /* TypeArgumentList_Types */: - return TypeScript.getLocalizedText(TypeScript.DiagnosticCode.type, null); - case 20 /* TypeParameterList_TypeParameters */: - return TypeScript.getLocalizedText(TypeScript.DiagnosticCode.type_parameter, null); - case 21 /* TupleType_Types */: - return TypeScript.getLocalizedText(TypeScript.DiagnosticCode.type, null); - case 16 /* ArrayLiteralExpression_AssignmentExpressions */: - return TypeScript.getLocalizedText(TypeScript.DiagnosticCode.expression, null); - default: - throw TypeScript.Errors.invalidOperation(); + case 0 /* SourceUnit_ModuleElements */: return TypeScript.getLocalizedText(TypeScript.DiagnosticCode.module_class_interface_enum_import_or_statement, undefined); + case 10 /* ClassOrInterfaceDeclaration_HeritageClauses */: return '{'; + case 1 /* ClassDeclaration_ClassElements */: return TypeScript.getLocalizedText(TypeScript.DiagnosticCode.constructor_function_accessor_or_variable, undefined); + case 2 /* ModuleDeclaration_ModuleElements */: return TypeScript.getLocalizedText(TypeScript.DiagnosticCode.module_class_interface_enum_import_or_statement, undefined); + case 3 /* SwitchStatement_SwitchClauses */: return TypeScript.getLocalizedText(TypeScript.DiagnosticCode.case_or_default_clause, undefined); + case 4 /* SwitchClause_Statements */: return TypeScript.getLocalizedText(TypeScript.DiagnosticCode.statement, undefined); + case 5 /* Block_Statements */: return TypeScript.getLocalizedText(TypeScript.DiagnosticCode.statement, undefined); + case 12 /* VariableDeclaration_VariableDeclarators_AllowIn */: return TypeScript.getLocalizedText(TypeScript.DiagnosticCode.identifier, undefined); + case 13 /* VariableDeclaration_VariableDeclarators_DisallowIn */: return TypeScript.getLocalizedText(TypeScript.DiagnosticCode.identifier, undefined); + case 8 /* EnumDeclaration_EnumElements */: return TypeScript.getLocalizedText(TypeScript.DiagnosticCode.identifier, undefined); + case 9 /* ObjectType_TypeMembers */: return TypeScript.getLocalizedText(TypeScript.DiagnosticCode.call_construct_index_property_or_function_signature, undefined); + case 14 /* ArgumentList_AssignmentExpressions */: return TypeScript.getLocalizedText(TypeScript.DiagnosticCode.expression, undefined); + case 11 /* HeritageClause_TypeNameList */: return TypeScript.getLocalizedText(TypeScript.DiagnosticCode.type_name, undefined); + case 15 /* ObjectLiteralExpression_PropertyAssignments */: return TypeScript.getLocalizedText(TypeScript.DiagnosticCode.property_or_accessor, undefined); + case 17 /* ParameterList_Parameters */: return TypeScript.getLocalizedText(TypeScript.DiagnosticCode.parameter, undefined); + case 18 /* IndexSignature_Parameters */: return TypeScript.getLocalizedText(TypeScript.DiagnosticCode.parameter, undefined); + case 19 /* TypeArgumentList_Types */: return TypeScript.getLocalizedText(TypeScript.DiagnosticCode.type, undefined); + case 20 /* TypeParameterList_TypeParameters */: return TypeScript.getLocalizedText(TypeScript.DiagnosticCode.type_parameter, undefined); + case 21 /* TupleType_Types */: return TypeScript.getLocalizedText(TypeScript.DiagnosticCode.type, undefined); + case 16 /* ArrayLiteralExpression_AssignmentExpressions */: return TypeScript.getLocalizedText(TypeScript.DiagnosticCode.expression, undefined); + default: throw TypeScript.Errors.invalidOperation(); } } return parseSyntaxTree; @@ -25307,810 +26103,922 @@ var TypeScript; })(TypeScript || (TypeScript = {})); var TypeScript; (function (TypeScript) { - var Syntax; - (function (Syntax) { - var Concrete; - (function (Concrete) { - TypeScript.Parser.syntaxFactory = Concrete; - Concrete.isConcrete = true; - var SourceUnitSyntax = (function (_super) { - __extends(SourceUnitSyntax, _super); - function SourceUnitSyntax(data, moduleElements, endOfFileToken) { - _super.call(this, data); - this.syntaxTree = null; - this.parent = null, this.moduleElements = moduleElements, this.endOfFileToken = endOfFileToken, !TypeScript.isShared(moduleElements) && (moduleElements.parent = this), endOfFileToken.parent = this; - } - return SourceUnitSyntax; - })(TypeScript.SyntaxNode); - Concrete.SourceUnitSyntax = SourceUnitSyntax; - var QualifiedNameSyntax = (function (_super) { - __extends(QualifiedNameSyntax, _super); - function QualifiedNameSyntax(data, left, dotToken, right) { - _super.call(this, data); - this.left = left, this.dotToken = dotToken, this.right = right, left.parent = this, dotToken.parent = this, right.parent = this; - } - return QualifiedNameSyntax; - })(TypeScript.SyntaxNode); - Concrete.QualifiedNameSyntax = QualifiedNameSyntax; - var ObjectTypeSyntax = (function (_super) { - __extends(ObjectTypeSyntax, _super); - function ObjectTypeSyntax(data, openBraceToken, typeMembers, closeBraceToken) { - _super.call(this, data); - this.openBraceToken = openBraceToken, this.typeMembers = typeMembers, this.closeBraceToken = closeBraceToken, openBraceToken.parent = this, !TypeScript.isShared(typeMembers) && (typeMembers.parent = this), closeBraceToken.parent = this; - } - return ObjectTypeSyntax; - })(TypeScript.SyntaxNode); - Concrete.ObjectTypeSyntax = ObjectTypeSyntax; - var FunctionTypeSyntax = (function (_super) { - __extends(FunctionTypeSyntax, _super); - function FunctionTypeSyntax(data, typeParameterList, parameterList, equalsGreaterThanToken, type) { - _super.call(this, data); - this.typeParameterList = typeParameterList, this.parameterList = parameterList, this.equalsGreaterThanToken = equalsGreaterThanToken, this.type = type, typeParameterList && (typeParameterList.parent = this), parameterList.parent = this, equalsGreaterThanToken.parent = this, type.parent = this; - } - return FunctionTypeSyntax; - })(TypeScript.SyntaxNode); - Concrete.FunctionTypeSyntax = FunctionTypeSyntax; - var ArrayTypeSyntax = (function (_super) { - __extends(ArrayTypeSyntax, _super); - function ArrayTypeSyntax(data, type, openBracketToken, closeBracketToken) { - _super.call(this, data); - this.type = type, this.openBracketToken = openBracketToken, this.closeBracketToken = closeBracketToken, type.parent = this, openBracketToken.parent = this, closeBracketToken.parent = this; - } - return ArrayTypeSyntax; - })(TypeScript.SyntaxNode); - Concrete.ArrayTypeSyntax = ArrayTypeSyntax; - var ConstructorTypeSyntax = (function (_super) { - __extends(ConstructorTypeSyntax, _super); - function ConstructorTypeSyntax(data, newKeyword, typeParameterList, parameterList, equalsGreaterThanToken, type) { - _super.call(this, data); - this.newKeyword = newKeyword, this.typeParameterList = typeParameterList, this.parameterList = parameterList, this.equalsGreaterThanToken = equalsGreaterThanToken, this.type = type, newKeyword.parent = this, typeParameterList && (typeParameterList.parent = this), parameterList.parent = this, equalsGreaterThanToken.parent = this, type.parent = this; - } - return ConstructorTypeSyntax; - })(TypeScript.SyntaxNode); - Concrete.ConstructorTypeSyntax = ConstructorTypeSyntax; - var GenericTypeSyntax = (function (_super) { - __extends(GenericTypeSyntax, _super); - function GenericTypeSyntax(data, name, typeArgumentList) { - _super.call(this, data); - this.name = name, this.typeArgumentList = typeArgumentList, name.parent = this, typeArgumentList.parent = this; - } - return GenericTypeSyntax; - })(TypeScript.SyntaxNode); - Concrete.GenericTypeSyntax = GenericTypeSyntax; - var TypeQuerySyntax = (function (_super) { - __extends(TypeQuerySyntax, _super); - function TypeQuerySyntax(data, typeOfKeyword, name) { - _super.call(this, data); - this.typeOfKeyword = typeOfKeyword, this.name = name, typeOfKeyword.parent = this, name.parent = this; - } - return TypeQuerySyntax; - })(TypeScript.SyntaxNode); - Concrete.TypeQuerySyntax = TypeQuerySyntax; - var TupleTypeSyntax = (function (_super) { - __extends(TupleTypeSyntax, _super); - function TupleTypeSyntax(data, openBracketToken, types, closeBracketToken) { - _super.call(this, data); - this.openBracketToken = openBracketToken, this.types = types, this.closeBracketToken = closeBracketToken, openBracketToken.parent = this, !TypeScript.isShared(types) && (types.parent = this), closeBracketToken.parent = this; - } - return TupleTypeSyntax; - })(TypeScript.SyntaxNode); - Concrete.TupleTypeSyntax = TupleTypeSyntax; - var InterfaceDeclarationSyntax = (function (_super) { - __extends(InterfaceDeclarationSyntax, _super); - function InterfaceDeclarationSyntax(data, modifiers, interfaceKeyword, identifier, typeParameterList, heritageClauses, body) { - _super.call(this, data); - this.modifiers = modifiers, this.interfaceKeyword = interfaceKeyword, this.identifier = identifier, this.typeParameterList = typeParameterList, this.heritageClauses = heritageClauses, this.body = body, !TypeScript.isShared(modifiers) && (modifiers.parent = this), interfaceKeyword.parent = this, identifier.parent = this, typeParameterList && (typeParameterList.parent = this), !TypeScript.isShared(heritageClauses) && (heritageClauses.parent = this), body.parent = this; - } - return InterfaceDeclarationSyntax; - })(TypeScript.SyntaxNode); - Concrete.InterfaceDeclarationSyntax = InterfaceDeclarationSyntax; - var FunctionDeclarationSyntax = (function (_super) { - __extends(FunctionDeclarationSyntax, _super); - function FunctionDeclarationSyntax(data, modifiers, functionKeyword, identifier, callSignature, block, semicolonToken) { - _super.call(this, data); - this.modifiers = modifiers, this.functionKeyword = functionKeyword, this.identifier = identifier, this.callSignature = callSignature, this.block = block, this.semicolonToken = semicolonToken, !TypeScript.isShared(modifiers) && (modifiers.parent = this), functionKeyword.parent = this, identifier.parent = this, callSignature.parent = this, block && (block.parent = this), semicolonToken && (semicolonToken.parent = this); - } - return FunctionDeclarationSyntax; - })(TypeScript.SyntaxNode); - Concrete.FunctionDeclarationSyntax = FunctionDeclarationSyntax; - var ModuleDeclarationSyntax = (function (_super) { - __extends(ModuleDeclarationSyntax, _super); - function ModuleDeclarationSyntax(data, modifiers, moduleKeyword, name, stringLiteral, openBraceToken, moduleElements, closeBraceToken) { - _super.call(this, data); - this.modifiers = modifiers, this.moduleKeyword = moduleKeyword, this.name = name, this.stringLiteral = stringLiteral, this.openBraceToken = openBraceToken, this.moduleElements = moduleElements, this.closeBraceToken = closeBraceToken, !TypeScript.isShared(modifiers) && (modifiers.parent = this), moduleKeyword.parent = this, name && (name.parent = this), stringLiteral && (stringLiteral.parent = this), openBraceToken.parent = this, !TypeScript.isShared(moduleElements) && (moduleElements.parent = this), closeBraceToken.parent = this; - } - return ModuleDeclarationSyntax; - })(TypeScript.SyntaxNode); - Concrete.ModuleDeclarationSyntax = ModuleDeclarationSyntax; - var ClassDeclarationSyntax = (function (_super) { - __extends(ClassDeclarationSyntax, _super); - function ClassDeclarationSyntax(data, modifiers, classKeyword, identifier, typeParameterList, heritageClauses, openBraceToken, classElements, closeBraceToken) { - _super.call(this, data); - this.modifiers = modifiers, this.classKeyword = classKeyword, this.identifier = identifier, this.typeParameterList = typeParameterList, this.heritageClauses = heritageClauses, this.openBraceToken = openBraceToken, this.classElements = classElements, this.closeBraceToken = closeBraceToken, !TypeScript.isShared(modifiers) && (modifiers.parent = this), classKeyword.parent = this, identifier.parent = this, typeParameterList && (typeParameterList.parent = this), !TypeScript.isShared(heritageClauses) && (heritageClauses.parent = this), openBraceToken.parent = this, !TypeScript.isShared(classElements) && (classElements.parent = this), closeBraceToken.parent = this; - } - return ClassDeclarationSyntax; - })(TypeScript.SyntaxNode); - Concrete.ClassDeclarationSyntax = ClassDeclarationSyntax; - var EnumDeclarationSyntax = (function (_super) { - __extends(EnumDeclarationSyntax, _super); - function EnumDeclarationSyntax(data, modifiers, enumKeyword, identifier, openBraceToken, enumElements, closeBraceToken) { - _super.call(this, data); - this.modifiers = modifiers, this.enumKeyword = enumKeyword, this.identifier = identifier, this.openBraceToken = openBraceToken, this.enumElements = enumElements, this.closeBraceToken = closeBraceToken, !TypeScript.isShared(modifiers) && (modifiers.parent = this), enumKeyword.parent = this, identifier.parent = this, openBraceToken.parent = this, !TypeScript.isShared(enumElements) && (enumElements.parent = this), closeBraceToken.parent = this; - } - return EnumDeclarationSyntax; - })(TypeScript.SyntaxNode); - Concrete.EnumDeclarationSyntax = EnumDeclarationSyntax; - var ImportDeclarationSyntax = (function (_super) { - __extends(ImportDeclarationSyntax, _super); - function ImportDeclarationSyntax(data, modifiers, importKeyword, identifier, equalsToken, moduleReference, semicolonToken) { - _super.call(this, data); - this.modifiers = modifiers, this.importKeyword = importKeyword, this.identifier = identifier, this.equalsToken = equalsToken, this.moduleReference = moduleReference, this.semicolonToken = semicolonToken, !TypeScript.isShared(modifiers) && (modifiers.parent = this), importKeyword.parent = this, identifier.parent = this, equalsToken.parent = this, moduleReference.parent = this, semicolonToken && (semicolonToken.parent = this); - } - return ImportDeclarationSyntax; - })(TypeScript.SyntaxNode); - Concrete.ImportDeclarationSyntax = ImportDeclarationSyntax; - var ExportAssignmentSyntax = (function (_super) { - __extends(ExportAssignmentSyntax, _super); - function ExportAssignmentSyntax(data, exportKeyword, equalsToken, identifier, semicolonToken) { - _super.call(this, data); - this.exportKeyword = exportKeyword, this.equalsToken = equalsToken, this.identifier = identifier, this.semicolonToken = semicolonToken, exportKeyword.parent = this, equalsToken.parent = this, identifier.parent = this, semicolonToken && (semicolonToken.parent = this); - } - return ExportAssignmentSyntax; - })(TypeScript.SyntaxNode); - Concrete.ExportAssignmentSyntax = ExportAssignmentSyntax; - var MemberFunctionDeclarationSyntax = (function (_super) { - __extends(MemberFunctionDeclarationSyntax, _super); - function MemberFunctionDeclarationSyntax(data, modifiers, propertyName, callSignature, block, semicolonToken) { - _super.call(this, data); - this.modifiers = modifiers, this.propertyName = propertyName, this.callSignature = callSignature, this.block = block, this.semicolonToken = semicolonToken, !TypeScript.isShared(modifiers) && (modifiers.parent = this), propertyName.parent = this, callSignature.parent = this, block && (block.parent = this), semicolonToken && (semicolonToken.parent = this); - } - return MemberFunctionDeclarationSyntax; - })(TypeScript.SyntaxNode); - Concrete.MemberFunctionDeclarationSyntax = MemberFunctionDeclarationSyntax; - var MemberVariableDeclarationSyntax = (function (_super) { - __extends(MemberVariableDeclarationSyntax, _super); - function MemberVariableDeclarationSyntax(data, modifiers, variableDeclarator, semicolonToken) { - _super.call(this, data); - this.modifiers = modifiers, this.variableDeclarator = variableDeclarator, this.semicolonToken = semicolonToken, !TypeScript.isShared(modifiers) && (modifiers.parent = this), variableDeclarator.parent = this, semicolonToken && (semicolonToken.parent = this); - } - return MemberVariableDeclarationSyntax; - })(TypeScript.SyntaxNode); - Concrete.MemberVariableDeclarationSyntax = MemberVariableDeclarationSyntax; - var ConstructorDeclarationSyntax = (function (_super) { - __extends(ConstructorDeclarationSyntax, _super); - function ConstructorDeclarationSyntax(data, modifiers, constructorKeyword, callSignature, block, semicolonToken) { - _super.call(this, data); - this.modifiers = modifiers, this.constructorKeyword = constructorKeyword, this.callSignature = callSignature, this.block = block, this.semicolonToken = semicolonToken, !TypeScript.isShared(modifiers) && (modifiers.parent = this), constructorKeyword.parent = this, callSignature.parent = this, block && (block.parent = this), semicolonToken && (semicolonToken.parent = this); - } - return ConstructorDeclarationSyntax; - })(TypeScript.SyntaxNode); - Concrete.ConstructorDeclarationSyntax = ConstructorDeclarationSyntax; - var IndexMemberDeclarationSyntax = (function (_super) { - __extends(IndexMemberDeclarationSyntax, _super); - function IndexMemberDeclarationSyntax(data, modifiers, indexSignature, semicolonToken) { - _super.call(this, data); - this.modifiers = modifiers, this.indexSignature = indexSignature, this.semicolonToken = semicolonToken, !TypeScript.isShared(modifiers) && (modifiers.parent = this), indexSignature.parent = this, semicolonToken && (semicolonToken.parent = this); - } - return IndexMemberDeclarationSyntax; - })(TypeScript.SyntaxNode); - Concrete.IndexMemberDeclarationSyntax = IndexMemberDeclarationSyntax; - var GetAccessorSyntax = (function (_super) { - __extends(GetAccessorSyntax, _super); - function GetAccessorSyntax(data, modifiers, getKeyword, propertyName, callSignature, block) { - _super.call(this, data); - this.modifiers = modifiers, this.getKeyword = getKeyword, this.propertyName = propertyName, this.callSignature = callSignature, this.block = block, !TypeScript.isShared(modifiers) && (modifiers.parent = this), getKeyword.parent = this, propertyName.parent = this, callSignature.parent = this, block.parent = this; - } - return GetAccessorSyntax; - })(TypeScript.SyntaxNode); - Concrete.GetAccessorSyntax = GetAccessorSyntax; - var SetAccessorSyntax = (function (_super) { - __extends(SetAccessorSyntax, _super); - function SetAccessorSyntax(data, modifiers, setKeyword, propertyName, callSignature, block) { - _super.call(this, data); - this.modifiers = modifiers, this.setKeyword = setKeyword, this.propertyName = propertyName, this.callSignature = callSignature, this.block = block, !TypeScript.isShared(modifiers) && (modifiers.parent = this), setKeyword.parent = this, propertyName.parent = this, callSignature.parent = this, block.parent = this; - } - return SetAccessorSyntax; - })(TypeScript.SyntaxNode); - Concrete.SetAccessorSyntax = SetAccessorSyntax; - var PropertySignatureSyntax = (function (_super) { - __extends(PropertySignatureSyntax, _super); - function PropertySignatureSyntax(data, propertyName, questionToken, typeAnnotation) { - _super.call(this, data); - this.propertyName = propertyName, this.questionToken = questionToken, this.typeAnnotation = typeAnnotation, propertyName.parent = this, questionToken && (questionToken.parent = this), typeAnnotation && (typeAnnotation.parent = this); - } - return PropertySignatureSyntax; - })(TypeScript.SyntaxNode); - Concrete.PropertySignatureSyntax = PropertySignatureSyntax; - var CallSignatureSyntax = (function (_super) { - __extends(CallSignatureSyntax, _super); - function CallSignatureSyntax(data, typeParameterList, parameterList, typeAnnotation) { - _super.call(this, data); - this.typeParameterList = typeParameterList, this.parameterList = parameterList, this.typeAnnotation = typeAnnotation, typeParameterList && (typeParameterList.parent = this), parameterList.parent = this, typeAnnotation && (typeAnnotation.parent = this); - } - return CallSignatureSyntax; - })(TypeScript.SyntaxNode); - Concrete.CallSignatureSyntax = CallSignatureSyntax; - var ConstructSignatureSyntax = (function (_super) { - __extends(ConstructSignatureSyntax, _super); - function ConstructSignatureSyntax(data, newKeyword, callSignature) { - _super.call(this, data); - this.newKeyword = newKeyword, this.callSignature = callSignature, newKeyword.parent = this, callSignature.parent = this; - } - return ConstructSignatureSyntax; - })(TypeScript.SyntaxNode); - Concrete.ConstructSignatureSyntax = ConstructSignatureSyntax; - var IndexSignatureSyntax = (function (_super) { - __extends(IndexSignatureSyntax, _super); - function IndexSignatureSyntax(data, openBracketToken, parameters, closeBracketToken, typeAnnotation) { - _super.call(this, data); - this.openBracketToken = openBracketToken, this.parameters = parameters, this.closeBracketToken = closeBracketToken, this.typeAnnotation = typeAnnotation, openBracketToken.parent = this, !TypeScript.isShared(parameters) && (parameters.parent = this), closeBracketToken.parent = this, typeAnnotation && (typeAnnotation.parent = this); - } - return IndexSignatureSyntax; - })(TypeScript.SyntaxNode); - Concrete.IndexSignatureSyntax = IndexSignatureSyntax; - var MethodSignatureSyntax = (function (_super) { - __extends(MethodSignatureSyntax, _super); - function MethodSignatureSyntax(data, propertyName, questionToken, callSignature) { - _super.call(this, data); - this.propertyName = propertyName, this.questionToken = questionToken, this.callSignature = callSignature, propertyName.parent = this, questionToken && (questionToken.parent = this), callSignature.parent = this; - } - return MethodSignatureSyntax; - })(TypeScript.SyntaxNode); - Concrete.MethodSignatureSyntax = MethodSignatureSyntax; - var BlockSyntax = (function (_super) { - __extends(BlockSyntax, _super); - function BlockSyntax(data, openBraceToken, statements, closeBraceToken) { - _super.call(this, data); - this.openBraceToken = openBraceToken, this.statements = statements, this.closeBraceToken = closeBraceToken, openBraceToken.parent = this, !TypeScript.isShared(statements) && (statements.parent = this), closeBraceToken.parent = this; - } - return BlockSyntax; - })(TypeScript.SyntaxNode); - Concrete.BlockSyntax = BlockSyntax; - var IfStatementSyntax = (function (_super) { - __extends(IfStatementSyntax, _super); - function IfStatementSyntax(data, ifKeyword, openParenToken, condition, closeParenToken, statement, elseClause) { - _super.call(this, data); - this.ifKeyword = ifKeyword, this.openParenToken = openParenToken, this.condition = condition, this.closeParenToken = closeParenToken, this.statement = statement, this.elseClause = elseClause, ifKeyword.parent = this, openParenToken.parent = this, condition.parent = this, closeParenToken.parent = this, statement.parent = this, elseClause && (elseClause.parent = this); - } - return IfStatementSyntax; - })(TypeScript.SyntaxNode); - Concrete.IfStatementSyntax = IfStatementSyntax; - var VariableStatementSyntax = (function (_super) { - __extends(VariableStatementSyntax, _super); - function VariableStatementSyntax(data, modifiers, variableDeclaration, semicolonToken) { - _super.call(this, data); - this.modifiers = modifiers, this.variableDeclaration = variableDeclaration, this.semicolonToken = semicolonToken, !TypeScript.isShared(modifiers) && (modifiers.parent = this), variableDeclaration.parent = this, semicolonToken && (semicolonToken.parent = this); - } - return VariableStatementSyntax; - })(TypeScript.SyntaxNode); - Concrete.VariableStatementSyntax = VariableStatementSyntax; - var ExpressionStatementSyntax = (function (_super) { - __extends(ExpressionStatementSyntax, _super); - function ExpressionStatementSyntax(data, expression, semicolonToken) { - _super.call(this, data); - this.expression = expression, this.semicolonToken = semicolonToken, expression.parent = this, semicolonToken && (semicolonToken.parent = this); - } - return ExpressionStatementSyntax; - })(TypeScript.SyntaxNode); - Concrete.ExpressionStatementSyntax = ExpressionStatementSyntax; - var ReturnStatementSyntax = (function (_super) { - __extends(ReturnStatementSyntax, _super); - function ReturnStatementSyntax(data, returnKeyword, expression, semicolonToken) { - _super.call(this, data); - this.returnKeyword = returnKeyword, this.expression = expression, this.semicolonToken = semicolonToken, returnKeyword.parent = this, expression && (expression.parent = this), semicolonToken && (semicolonToken.parent = this); - } - return ReturnStatementSyntax; - })(TypeScript.SyntaxNode); - Concrete.ReturnStatementSyntax = ReturnStatementSyntax; - var SwitchStatementSyntax = (function (_super) { - __extends(SwitchStatementSyntax, _super); - function SwitchStatementSyntax(data, switchKeyword, openParenToken, expression, closeParenToken, openBraceToken, switchClauses, closeBraceToken) { - _super.call(this, data); - this.switchKeyword = switchKeyword, this.openParenToken = openParenToken, this.expression = expression, this.closeParenToken = closeParenToken, this.openBraceToken = openBraceToken, this.switchClauses = switchClauses, this.closeBraceToken = closeBraceToken, switchKeyword.parent = this, openParenToken.parent = this, expression.parent = this, closeParenToken.parent = this, openBraceToken.parent = this, !TypeScript.isShared(switchClauses) && (switchClauses.parent = this), closeBraceToken.parent = this; - } - return SwitchStatementSyntax; - })(TypeScript.SyntaxNode); - Concrete.SwitchStatementSyntax = SwitchStatementSyntax; - var BreakStatementSyntax = (function (_super) { - __extends(BreakStatementSyntax, _super); - function BreakStatementSyntax(data, breakKeyword, identifier, semicolonToken) { - _super.call(this, data); - this.breakKeyword = breakKeyword, this.identifier = identifier, this.semicolonToken = semicolonToken, breakKeyword.parent = this, identifier && (identifier.parent = this), semicolonToken && (semicolonToken.parent = this); - } - return BreakStatementSyntax; - })(TypeScript.SyntaxNode); - Concrete.BreakStatementSyntax = BreakStatementSyntax; - var ContinueStatementSyntax = (function (_super) { - __extends(ContinueStatementSyntax, _super); - function ContinueStatementSyntax(data, continueKeyword, identifier, semicolonToken) { - _super.call(this, data); - this.continueKeyword = continueKeyword, this.identifier = identifier, this.semicolonToken = semicolonToken, continueKeyword.parent = this, identifier && (identifier.parent = this), semicolonToken && (semicolonToken.parent = this); - } - return ContinueStatementSyntax; - })(TypeScript.SyntaxNode); - Concrete.ContinueStatementSyntax = ContinueStatementSyntax; - var ForStatementSyntax = (function (_super) { - __extends(ForStatementSyntax, _super); - function ForStatementSyntax(data, forKeyword, openParenToken, variableDeclaration, initializer, firstSemicolonToken, condition, secondSemicolonToken, incrementor, closeParenToken, statement) { - _super.call(this, data); - this.forKeyword = forKeyword, this.openParenToken = openParenToken, this.variableDeclaration = variableDeclaration, this.initializer = initializer, this.firstSemicolonToken = firstSemicolonToken, this.condition = condition, this.secondSemicolonToken = secondSemicolonToken, this.incrementor = incrementor, this.closeParenToken = closeParenToken, this.statement = statement, forKeyword.parent = this, openParenToken.parent = this, variableDeclaration && (variableDeclaration.parent = this), initializer && (initializer.parent = this), firstSemicolonToken.parent = this, condition && (condition.parent = this), secondSemicolonToken.parent = this, incrementor && (incrementor.parent = this), closeParenToken.parent = this, statement.parent = this; - } - return ForStatementSyntax; - })(TypeScript.SyntaxNode); - Concrete.ForStatementSyntax = ForStatementSyntax; - var ForInStatementSyntax = (function (_super) { - __extends(ForInStatementSyntax, _super); - function ForInStatementSyntax(data, forKeyword, openParenToken, variableDeclaration, left, inKeyword, expression, closeParenToken, statement) { - _super.call(this, data); - this.forKeyword = forKeyword, this.openParenToken = openParenToken, this.variableDeclaration = variableDeclaration, this.left = left, this.inKeyword = inKeyword, this.expression = expression, this.closeParenToken = closeParenToken, this.statement = statement, forKeyword.parent = this, openParenToken.parent = this, variableDeclaration && (variableDeclaration.parent = this), left && (left.parent = this), inKeyword.parent = this, expression.parent = this, closeParenToken.parent = this, statement.parent = this; - } - return ForInStatementSyntax; - })(TypeScript.SyntaxNode); - Concrete.ForInStatementSyntax = ForInStatementSyntax; - var EmptyStatementSyntax = (function (_super) { - __extends(EmptyStatementSyntax, _super); - function EmptyStatementSyntax(data, semicolonToken) { - _super.call(this, data); - this.semicolonToken = semicolonToken, semicolonToken.parent = this; - } - return EmptyStatementSyntax; - })(TypeScript.SyntaxNode); - Concrete.EmptyStatementSyntax = EmptyStatementSyntax; - var ThrowStatementSyntax = (function (_super) { - __extends(ThrowStatementSyntax, _super); - function ThrowStatementSyntax(data, throwKeyword, expression, semicolonToken) { - _super.call(this, data); - this.throwKeyword = throwKeyword, this.expression = expression, this.semicolonToken = semicolonToken, throwKeyword.parent = this, expression.parent = this, semicolonToken && (semicolonToken.parent = this); - } - return ThrowStatementSyntax; - })(TypeScript.SyntaxNode); - Concrete.ThrowStatementSyntax = ThrowStatementSyntax; - var WhileStatementSyntax = (function (_super) { - __extends(WhileStatementSyntax, _super); - function WhileStatementSyntax(data, whileKeyword, openParenToken, condition, closeParenToken, statement) { - _super.call(this, data); - this.whileKeyword = whileKeyword, this.openParenToken = openParenToken, this.condition = condition, this.closeParenToken = closeParenToken, this.statement = statement, whileKeyword.parent = this, openParenToken.parent = this, condition.parent = this, closeParenToken.parent = this, statement.parent = this; - } - return WhileStatementSyntax; - })(TypeScript.SyntaxNode); - Concrete.WhileStatementSyntax = WhileStatementSyntax; - var TryStatementSyntax = (function (_super) { - __extends(TryStatementSyntax, _super); - function TryStatementSyntax(data, tryKeyword, block, catchClause, finallyClause) { - _super.call(this, data); - this.tryKeyword = tryKeyword, this.block = block, this.catchClause = catchClause, this.finallyClause = finallyClause, tryKeyword.parent = this, block.parent = this, catchClause && (catchClause.parent = this), finallyClause && (finallyClause.parent = this); - } - return TryStatementSyntax; - })(TypeScript.SyntaxNode); - Concrete.TryStatementSyntax = TryStatementSyntax; - var LabeledStatementSyntax = (function (_super) { - __extends(LabeledStatementSyntax, _super); - function LabeledStatementSyntax(data, identifier, colonToken, statement) { - _super.call(this, data); - this.identifier = identifier, this.colonToken = colonToken, this.statement = statement, identifier.parent = this, colonToken.parent = this, statement.parent = this; - } - return LabeledStatementSyntax; - })(TypeScript.SyntaxNode); - Concrete.LabeledStatementSyntax = LabeledStatementSyntax; - var DoStatementSyntax = (function (_super) { - __extends(DoStatementSyntax, _super); - function DoStatementSyntax(data, doKeyword, statement, whileKeyword, openParenToken, condition, closeParenToken, semicolonToken) { - _super.call(this, data); - this.doKeyword = doKeyword, this.statement = statement, this.whileKeyword = whileKeyword, this.openParenToken = openParenToken, this.condition = condition, this.closeParenToken = closeParenToken, this.semicolonToken = semicolonToken, doKeyword.parent = this, statement.parent = this, whileKeyword.parent = this, openParenToken.parent = this, condition.parent = this, closeParenToken.parent = this, semicolonToken && (semicolonToken.parent = this); - } - return DoStatementSyntax; - })(TypeScript.SyntaxNode); - Concrete.DoStatementSyntax = DoStatementSyntax; - var DebuggerStatementSyntax = (function (_super) { - __extends(DebuggerStatementSyntax, _super); - function DebuggerStatementSyntax(data, debuggerKeyword, semicolonToken) { - _super.call(this, data); - this.debuggerKeyword = debuggerKeyword, this.semicolonToken = semicolonToken, debuggerKeyword.parent = this, semicolonToken && (semicolonToken.parent = this); - } - return DebuggerStatementSyntax; - })(TypeScript.SyntaxNode); - Concrete.DebuggerStatementSyntax = DebuggerStatementSyntax; - var WithStatementSyntax = (function (_super) { - __extends(WithStatementSyntax, _super); - function WithStatementSyntax(data, withKeyword, openParenToken, condition, closeParenToken, statement) { - _super.call(this, data); - this.withKeyword = withKeyword, this.openParenToken = openParenToken, this.condition = condition, this.closeParenToken = closeParenToken, this.statement = statement, withKeyword.parent = this, openParenToken.parent = this, condition.parent = this, closeParenToken.parent = this, statement.parent = this; - } - return WithStatementSyntax; - })(TypeScript.SyntaxNode); - Concrete.WithStatementSyntax = WithStatementSyntax; - var PrefixUnaryExpressionSyntax = (function (_super) { - __extends(PrefixUnaryExpressionSyntax, _super); - function PrefixUnaryExpressionSyntax(data, operatorToken, operand) { - _super.call(this, data); - this.operatorToken = operatorToken, this.operand = operand, operatorToken.parent = this, operand.parent = this; - } - PrefixUnaryExpressionSyntax.prototype.kind = function () { - return TypeScript.SyntaxFacts.getPrefixUnaryExpressionFromOperatorToken(this.operatorToken.kind()); - }; - return PrefixUnaryExpressionSyntax; - })(TypeScript.SyntaxNode); - Concrete.PrefixUnaryExpressionSyntax = PrefixUnaryExpressionSyntax; - var DeleteExpressionSyntax = (function (_super) { - __extends(DeleteExpressionSyntax, _super); - function DeleteExpressionSyntax(data, deleteKeyword, expression) { - _super.call(this, data); - this.deleteKeyword = deleteKeyword, this.expression = expression, deleteKeyword.parent = this, expression.parent = this; - } - return DeleteExpressionSyntax; - })(TypeScript.SyntaxNode); - Concrete.DeleteExpressionSyntax = DeleteExpressionSyntax; - var TypeOfExpressionSyntax = (function (_super) { - __extends(TypeOfExpressionSyntax, _super); - function TypeOfExpressionSyntax(data, typeOfKeyword, expression) { - _super.call(this, data); - this.typeOfKeyword = typeOfKeyword, this.expression = expression, typeOfKeyword.parent = this, expression.parent = this; - } - return TypeOfExpressionSyntax; - })(TypeScript.SyntaxNode); - Concrete.TypeOfExpressionSyntax = TypeOfExpressionSyntax; - var VoidExpressionSyntax = (function (_super) { - __extends(VoidExpressionSyntax, _super); - function VoidExpressionSyntax(data, voidKeyword, expression) { - _super.call(this, data); - this.voidKeyword = voidKeyword, this.expression = expression, voidKeyword.parent = this, expression.parent = this; - } - return VoidExpressionSyntax; - })(TypeScript.SyntaxNode); - Concrete.VoidExpressionSyntax = VoidExpressionSyntax; - var ConditionalExpressionSyntax = (function (_super) { - __extends(ConditionalExpressionSyntax, _super); - function ConditionalExpressionSyntax(data, condition, questionToken, whenTrue, colonToken, whenFalse) { - _super.call(this, data); - this.condition = condition, this.questionToken = questionToken, this.whenTrue = whenTrue, this.colonToken = colonToken, this.whenFalse = whenFalse, condition.parent = this, questionToken.parent = this, whenTrue.parent = this, colonToken.parent = this, whenFalse.parent = this; - } - return ConditionalExpressionSyntax; - })(TypeScript.SyntaxNode); - Concrete.ConditionalExpressionSyntax = ConditionalExpressionSyntax; - var BinaryExpressionSyntax = (function (_super) { - __extends(BinaryExpressionSyntax, _super); - function BinaryExpressionSyntax(data, left, operatorToken, right) { - _super.call(this, data); - this.left = left, this.operatorToken = operatorToken, this.right = right, left.parent = this, operatorToken.parent = this, right.parent = this; - } - BinaryExpressionSyntax.prototype.kind = function () { - return TypeScript.SyntaxFacts.getBinaryExpressionFromOperatorToken(this.operatorToken.kind()); - }; - return BinaryExpressionSyntax; - })(TypeScript.SyntaxNode); - Concrete.BinaryExpressionSyntax = BinaryExpressionSyntax; - var PostfixUnaryExpressionSyntax = (function (_super) { - __extends(PostfixUnaryExpressionSyntax, _super); - function PostfixUnaryExpressionSyntax(data, operand, operatorToken) { - _super.call(this, data); - this.operand = operand, this.operatorToken = operatorToken, operand.parent = this, operatorToken.parent = this; - } - PostfixUnaryExpressionSyntax.prototype.kind = function () { - return TypeScript.SyntaxFacts.getPostfixUnaryExpressionFromOperatorToken(this.operatorToken.kind()); - }; - return PostfixUnaryExpressionSyntax; - })(TypeScript.SyntaxNode); - Concrete.PostfixUnaryExpressionSyntax = PostfixUnaryExpressionSyntax; - var MemberAccessExpressionSyntax = (function (_super) { - __extends(MemberAccessExpressionSyntax, _super); - function MemberAccessExpressionSyntax(data, expression, dotToken, name) { - _super.call(this, data); - this.expression = expression, this.dotToken = dotToken, this.name = name, expression.parent = this, dotToken.parent = this, name.parent = this; - } - return MemberAccessExpressionSyntax; - })(TypeScript.SyntaxNode); - Concrete.MemberAccessExpressionSyntax = MemberAccessExpressionSyntax; - var InvocationExpressionSyntax = (function (_super) { - __extends(InvocationExpressionSyntax, _super); - function InvocationExpressionSyntax(data, expression, argumentList) { - _super.call(this, data); - this.expression = expression, this.argumentList = argumentList, expression.parent = this, argumentList.parent = this; - } - return InvocationExpressionSyntax; - })(TypeScript.SyntaxNode); - Concrete.InvocationExpressionSyntax = InvocationExpressionSyntax; - var ArrayLiteralExpressionSyntax = (function (_super) { - __extends(ArrayLiteralExpressionSyntax, _super); - function ArrayLiteralExpressionSyntax(data, openBracketToken, expressions, closeBracketToken) { - _super.call(this, data); - this.openBracketToken = openBracketToken, this.expressions = expressions, this.closeBracketToken = closeBracketToken, openBracketToken.parent = this, !TypeScript.isShared(expressions) && (expressions.parent = this), closeBracketToken.parent = this; - } - return ArrayLiteralExpressionSyntax; - })(TypeScript.SyntaxNode); - Concrete.ArrayLiteralExpressionSyntax = ArrayLiteralExpressionSyntax; - var ObjectLiteralExpressionSyntax = (function (_super) { - __extends(ObjectLiteralExpressionSyntax, _super); - function ObjectLiteralExpressionSyntax(data, openBraceToken, propertyAssignments, closeBraceToken) { - _super.call(this, data); - this.openBraceToken = openBraceToken, this.propertyAssignments = propertyAssignments, this.closeBraceToken = closeBraceToken, openBraceToken.parent = this, !TypeScript.isShared(propertyAssignments) && (propertyAssignments.parent = this), closeBraceToken.parent = this; - } - return ObjectLiteralExpressionSyntax; - })(TypeScript.SyntaxNode); - Concrete.ObjectLiteralExpressionSyntax = ObjectLiteralExpressionSyntax; - var ObjectCreationExpressionSyntax = (function (_super) { - __extends(ObjectCreationExpressionSyntax, _super); - function ObjectCreationExpressionSyntax(data, newKeyword, expression, argumentList) { - _super.call(this, data); - this.newKeyword = newKeyword, this.expression = expression, this.argumentList = argumentList, newKeyword.parent = this, expression.parent = this, argumentList && (argumentList.parent = this); - } - return ObjectCreationExpressionSyntax; - })(TypeScript.SyntaxNode); - Concrete.ObjectCreationExpressionSyntax = ObjectCreationExpressionSyntax; - var ParenthesizedExpressionSyntax = (function (_super) { - __extends(ParenthesizedExpressionSyntax, _super); - function ParenthesizedExpressionSyntax(data, openParenToken, expression, closeParenToken) { - _super.call(this, data); - this.openParenToken = openParenToken, this.expression = expression, this.closeParenToken = closeParenToken, openParenToken.parent = this, expression.parent = this, closeParenToken.parent = this; - } - return ParenthesizedExpressionSyntax; - })(TypeScript.SyntaxNode); - Concrete.ParenthesizedExpressionSyntax = ParenthesizedExpressionSyntax; - var ParenthesizedArrowFunctionExpressionSyntax = (function (_super) { - __extends(ParenthesizedArrowFunctionExpressionSyntax, _super); - function ParenthesizedArrowFunctionExpressionSyntax(data, callSignature, equalsGreaterThanToken, block, expression) { - _super.call(this, data); - this.callSignature = callSignature, this.equalsGreaterThanToken = equalsGreaterThanToken, this.block = block, this.expression = expression, callSignature.parent = this, equalsGreaterThanToken.parent = this, block && (block.parent = this), expression && (expression.parent = this); - } - return ParenthesizedArrowFunctionExpressionSyntax; - })(TypeScript.SyntaxNode); - Concrete.ParenthesizedArrowFunctionExpressionSyntax = ParenthesizedArrowFunctionExpressionSyntax; - var SimpleArrowFunctionExpressionSyntax = (function (_super) { - __extends(SimpleArrowFunctionExpressionSyntax, _super); - function SimpleArrowFunctionExpressionSyntax(data, parameter, equalsGreaterThanToken, block, expression) { - _super.call(this, data); - this.parameter = parameter, this.equalsGreaterThanToken = equalsGreaterThanToken, this.block = block, this.expression = expression, parameter.parent = this, equalsGreaterThanToken.parent = this, block && (block.parent = this), expression && (expression.parent = this); - } - return SimpleArrowFunctionExpressionSyntax; - })(TypeScript.SyntaxNode); - Concrete.SimpleArrowFunctionExpressionSyntax = SimpleArrowFunctionExpressionSyntax; - var CastExpressionSyntax = (function (_super) { - __extends(CastExpressionSyntax, _super); - function CastExpressionSyntax(data, lessThanToken, type, greaterThanToken, expression) { - _super.call(this, data); - this.lessThanToken = lessThanToken, this.type = type, this.greaterThanToken = greaterThanToken, this.expression = expression, lessThanToken.parent = this, type.parent = this, greaterThanToken.parent = this, expression.parent = this; - } - return CastExpressionSyntax; - })(TypeScript.SyntaxNode); - Concrete.CastExpressionSyntax = CastExpressionSyntax; - var ElementAccessExpressionSyntax = (function (_super) { - __extends(ElementAccessExpressionSyntax, _super); - function ElementAccessExpressionSyntax(data, expression, openBracketToken, argumentExpression, closeBracketToken) { - _super.call(this, data); - this.expression = expression, this.openBracketToken = openBracketToken, this.argumentExpression = argumentExpression, this.closeBracketToken = closeBracketToken, expression.parent = this, openBracketToken.parent = this, argumentExpression.parent = this, closeBracketToken.parent = this; - } - return ElementAccessExpressionSyntax; - })(TypeScript.SyntaxNode); - Concrete.ElementAccessExpressionSyntax = ElementAccessExpressionSyntax; - var FunctionExpressionSyntax = (function (_super) { - __extends(FunctionExpressionSyntax, _super); - function FunctionExpressionSyntax(data, functionKeyword, identifier, callSignature, block) { - _super.call(this, data); - this.functionKeyword = functionKeyword, this.identifier = identifier, this.callSignature = callSignature, this.block = block, functionKeyword.parent = this, identifier && (identifier.parent = this), callSignature.parent = this, block.parent = this; - } - return FunctionExpressionSyntax; - })(TypeScript.SyntaxNode); - Concrete.FunctionExpressionSyntax = FunctionExpressionSyntax; - var OmittedExpressionSyntax = (function (_super) { - __extends(OmittedExpressionSyntax, _super); - function OmittedExpressionSyntax(data) { - _super.call(this, data); - } - return OmittedExpressionSyntax; - })(TypeScript.SyntaxNode); - Concrete.OmittedExpressionSyntax = OmittedExpressionSyntax; - var VariableDeclarationSyntax = (function (_super) { - __extends(VariableDeclarationSyntax, _super); - function VariableDeclarationSyntax(data, varKeyword, variableDeclarators) { - _super.call(this, data); - this.varKeyword = varKeyword, this.variableDeclarators = variableDeclarators, varKeyword.parent = this, !TypeScript.isShared(variableDeclarators) && (variableDeclarators.parent = this); - } - return VariableDeclarationSyntax; - })(TypeScript.SyntaxNode); - Concrete.VariableDeclarationSyntax = VariableDeclarationSyntax; - var VariableDeclaratorSyntax = (function (_super) { - __extends(VariableDeclaratorSyntax, _super); - function VariableDeclaratorSyntax(data, propertyName, typeAnnotation, equalsValueClause) { - _super.call(this, data); - this.propertyName = propertyName, this.typeAnnotation = typeAnnotation, this.equalsValueClause = equalsValueClause, propertyName.parent = this, typeAnnotation && (typeAnnotation.parent = this), equalsValueClause && (equalsValueClause.parent = this); - } - return VariableDeclaratorSyntax; - })(TypeScript.SyntaxNode); - Concrete.VariableDeclaratorSyntax = VariableDeclaratorSyntax; - var ArgumentListSyntax = (function (_super) { - __extends(ArgumentListSyntax, _super); - function ArgumentListSyntax(data, typeArgumentList, openParenToken, _arguments, closeParenToken) { - _super.call(this, data); - this.typeArgumentList = typeArgumentList, this.openParenToken = openParenToken, this.arguments = _arguments, this.closeParenToken = closeParenToken, typeArgumentList && (typeArgumentList.parent = this), openParenToken.parent = this, !TypeScript.isShared(_arguments) && (_arguments.parent = this), closeParenToken.parent = this; - } - return ArgumentListSyntax; - })(TypeScript.SyntaxNode); - Concrete.ArgumentListSyntax = ArgumentListSyntax; - var ParameterListSyntax = (function (_super) { - __extends(ParameterListSyntax, _super); - function ParameterListSyntax(data, openParenToken, parameters, closeParenToken) { - _super.call(this, data); - this.openParenToken = openParenToken, this.parameters = parameters, this.closeParenToken = closeParenToken, openParenToken.parent = this, !TypeScript.isShared(parameters) && (parameters.parent = this), closeParenToken.parent = this; - } - return ParameterListSyntax; - })(TypeScript.SyntaxNode); - Concrete.ParameterListSyntax = ParameterListSyntax; - var TypeArgumentListSyntax = (function (_super) { - __extends(TypeArgumentListSyntax, _super); - function TypeArgumentListSyntax(data, lessThanToken, typeArguments, greaterThanToken) { - _super.call(this, data); - this.lessThanToken = lessThanToken, this.typeArguments = typeArguments, this.greaterThanToken = greaterThanToken, lessThanToken.parent = this, !TypeScript.isShared(typeArguments) && (typeArguments.parent = this), greaterThanToken.parent = this; - } - return TypeArgumentListSyntax; - })(TypeScript.SyntaxNode); - Concrete.TypeArgumentListSyntax = TypeArgumentListSyntax; - var TypeParameterListSyntax = (function (_super) { - __extends(TypeParameterListSyntax, _super); - function TypeParameterListSyntax(data, lessThanToken, typeParameters, greaterThanToken) { - _super.call(this, data); - this.lessThanToken = lessThanToken, this.typeParameters = typeParameters, this.greaterThanToken = greaterThanToken, lessThanToken.parent = this, !TypeScript.isShared(typeParameters) && (typeParameters.parent = this), greaterThanToken.parent = this; - } - return TypeParameterListSyntax; - })(TypeScript.SyntaxNode); - Concrete.TypeParameterListSyntax = TypeParameterListSyntax; - var HeritageClauseSyntax = (function (_super) { - __extends(HeritageClauseSyntax, _super); - function HeritageClauseSyntax(data, extendsOrImplementsKeyword, typeNames) { - _super.call(this, data); - this.extendsOrImplementsKeyword = extendsOrImplementsKeyword, this.typeNames = typeNames, extendsOrImplementsKeyword.parent = this, !TypeScript.isShared(typeNames) && (typeNames.parent = this); - } - HeritageClauseSyntax.prototype.kind = function () { - return this.extendsOrImplementsKeyword.kind() === 48 /* ExtendsKeyword */ ? 231 /* ExtendsHeritageClause */ : 232 /* ImplementsHeritageClause */; - }; - return HeritageClauseSyntax; - })(TypeScript.SyntaxNode); - Concrete.HeritageClauseSyntax = HeritageClauseSyntax; - var EqualsValueClauseSyntax = (function (_super) { - __extends(EqualsValueClauseSyntax, _super); - function EqualsValueClauseSyntax(data, equalsToken, value) { - _super.call(this, data); - this.equalsToken = equalsToken, this.value = value, equalsToken.parent = this, value.parent = this; - } - return EqualsValueClauseSyntax; - })(TypeScript.SyntaxNode); - Concrete.EqualsValueClauseSyntax = EqualsValueClauseSyntax; - var CaseSwitchClauseSyntax = (function (_super) { - __extends(CaseSwitchClauseSyntax, _super); - function CaseSwitchClauseSyntax(data, caseKeyword, expression, colonToken, statements) { - _super.call(this, data); - this.caseKeyword = caseKeyword, this.expression = expression, this.colonToken = colonToken, this.statements = statements, caseKeyword.parent = this, expression.parent = this, colonToken.parent = this, !TypeScript.isShared(statements) && (statements.parent = this); - } - return CaseSwitchClauseSyntax; - })(TypeScript.SyntaxNode); - Concrete.CaseSwitchClauseSyntax = CaseSwitchClauseSyntax; - var DefaultSwitchClauseSyntax = (function (_super) { - __extends(DefaultSwitchClauseSyntax, _super); - function DefaultSwitchClauseSyntax(data, defaultKeyword, colonToken, statements) { - _super.call(this, data); - this.defaultKeyword = defaultKeyword, this.colonToken = colonToken, this.statements = statements, defaultKeyword.parent = this, colonToken.parent = this, !TypeScript.isShared(statements) && (statements.parent = this); - } - return DefaultSwitchClauseSyntax; - })(TypeScript.SyntaxNode); - Concrete.DefaultSwitchClauseSyntax = DefaultSwitchClauseSyntax; - var ElseClauseSyntax = (function (_super) { - __extends(ElseClauseSyntax, _super); - function ElseClauseSyntax(data, elseKeyword, statement) { - _super.call(this, data); - this.elseKeyword = elseKeyword, this.statement = statement, elseKeyword.parent = this, statement.parent = this; - } - return ElseClauseSyntax; - })(TypeScript.SyntaxNode); - Concrete.ElseClauseSyntax = ElseClauseSyntax; - var CatchClauseSyntax = (function (_super) { - __extends(CatchClauseSyntax, _super); - function CatchClauseSyntax(data, catchKeyword, openParenToken, identifier, typeAnnotation, closeParenToken, block) { - _super.call(this, data); - this.catchKeyword = catchKeyword, this.openParenToken = openParenToken, this.identifier = identifier, this.typeAnnotation = typeAnnotation, this.closeParenToken = closeParenToken, this.block = block, catchKeyword.parent = this, openParenToken.parent = this, identifier.parent = this, typeAnnotation && (typeAnnotation.parent = this), closeParenToken.parent = this, block.parent = this; - } - return CatchClauseSyntax; - })(TypeScript.SyntaxNode); - Concrete.CatchClauseSyntax = CatchClauseSyntax; - var FinallyClauseSyntax = (function (_super) { - __extends(FinallyClauseSyntax, _super); - function FinallyClauseSyntax(data, finallyKeyword, block) { - _super.call(this, data); - this.finallyKeyword = finallyKeyword, this.block = block, finallyKeyword.parent = this, block.parent = this; - } - return FinallyClauseSyntax; - })(TypeScript.SyntaxNode); - Concrete.FinallyClauseSyntax = FinallyClauseSyntax; - var TypeParameterSyntax = (function (_super) { - __extends(TypeParameterSyntax, _super); - function TypeParameterSyntax(data, identifier, constraint) { - _super.call(this, data); - this.identifier = identifier, this.constraint = constraint, identifier.parent = this, constraint && (constraint.parent = this); - } - return TypeParameterSyntax; - })(TypeScript.SyntaxNode); - Concrete.TypeParameterSyntax = TypeParameterSyntax; - var ConstraintSyntax = (function (_super) { - __extends(ConstraintSyntax, _super); - function ConstraintSyntax(data, extendsKeyword, typeOrExpression) { - _super.call(this, data); - this.extendsKeyword = extendsKeyword, this.typeOrExpression = typeOrExpression, extendsKeyword.parent = this, typeOrExpression.parent = this; - } - return ConstraintSyntax; - })(TypeScript.SyntaxNode); - Concrete.ConstraintSyntax = ConstraintSyntax; - var SimplePropertyAssignmentSyntax = (function (_super) { - __extends(SimplePropertyAssignmentSyntax, _super); - function SimplePropertyAssignmentSyntax(data, propertyName, colonToken, expression) { - _super.call(this, data); - this.propertyName = propertyName, this.colonToken = colonToken, this.expression = expression, propertyName.parent = this, colonToken.parent = this, expression.parent = this; - } - return SimplePropertyAssignmentSyntax; - })(TypeScript.SyntaxNode); - Concrete.SimplePropertyAssignmentSyntax = SimplePropertyAssignmentSyntax; - var FunctionPropertyAssignmentSyntax = (function (_super) { - __extends(FunctionPropertyAssignmentSyntax, _super); - function FunctionPropertyAssignmentSyntax(data, propertyName, callSignature, block) { - _super.call(this, data); - this.propertyName = propertyName, this.callSignature = callSignature, this.block = block, propertyName.parent = this, callSignature.parent = this, block.parent = this; - } - return FunctionPropertyAssignmentSyntax; - })(TypeScript.SyntaxNode); - Concrete.FunctionPropertyAssignmentSyntax = FunctionPropertyAssignmentSyntax; - var ParameterSyntax = (function (_super) { - __extends(ParameterSyntax, _super); - function ParameterSyntax(data, dotDotDotToken, modifiers, identifier, questionToken, typeAnnotation, equalsValueClause) { - _super.call(this, data); - this.dotDotDotToken = dotDotDotToken, this.modifiers = modifiers, this.identifier = identifier, this.questionToken = questionToken, this.typeAnnotation = typeAnnotation, this.equalsValueClause = equalsValueClause, dotDotDotToken && (dotDotDotToken.parent = this), !TypeScript.isShared(modifiers) && (modifiers.parent = this), identifier.parent = this, questionToken && (questionToken.parent = this), typeAnnotation && (typeAnnotation.parent = this), equalsValueClause && (equalsValueClause.parent = this); - } - return ParameterSyntax; - })(TypeScript.SyntaxNode); - Concrete.ParameterSyntax = ParameterSyntax; - var EnumElementSyntax = (function (_super) { - __extends(EnumElementSyntax, _super); - function EnumElementSyntax(data, propertyName, equalsValueClause) { - _super.call(this, data); - this.propertyName = propertyName, this.equalsValueClause = equalsValueClause, propertyName.parent = this, equalsValueClause && (equalsValueClause.parent = this); - } - return EnumElementSyntax; - })(TypeScript.SyntaxNode); - Concrete.EnumElementSyntax = EnumElementSyntax; - var TypeAnnotationSyntax = (function (_super) { - __extends(TypeAnnotationSyntax, _super); - function TypeAnnotationSyntax(data, colonToken, type) { - _super.call(this, data); - this.colonToken = colonToken, this.type = type, colonToken.parent = this, type.parent = this; - } - return TypeAnnotationSyntax; - })(TypeScript.SyntaxNode); - Concrete.TypeAnnotationSyntax = TypeAnnotationSyntax; - var ExternalModuleReferenceSyntax = (function (_super) { - __extends(ExternalModuleReferenceSyntax, _super); - function ExternalModuleReferenceSyntax(data, requireKeyword, openParenToken, stringLiteral, closeParenToken) { - _super.call(this, data); - this.requireKeyword = requireKeyword, this.openParenToken = openParenToken, this.stringLiteral = stringLiteral, this.closeParenToken = closeParenToken, requireKeyword.parent = this, openParenToken.parent = this, stringLiteral.parent = this, closeParenToken.parent = this; - } - return ExternalModuleReferenceSyntax; - })(TypeScript.SyntaxNode); - Concrete.ExternalModuleReferenceSyntax = ExternalModuleReferenceSyntax; - var ModuleNameModuleReferenceSyntax = (function (_super) { - __extends(ModuleNameModuleReferenceSyntax, _super); - function ModuleNameModuleReferenceSyntax(data, moduleName) { - _super.call(this, data); - this.moduleName = moduleName, moduleName.parent = this; - } - return ModuleNameModuleReferenceSyntax; - })(TypeScript.SyntaxNode); - Concrete.ModuleNameModuleReferenceSyntax = ModuleNameModuleReferenceSyntax; - SourceUnitSyntax.prototype.__kind = 120 /* SourceUnit */, QualifiedNameSyntax.prototype.__kind = 121 /* QualifiedName */, ObjectTypeSyntax.prototype.__kind = 122 /* ObjectType */, FunctionTypeSyntax.prototype.__kind = 123 /* FunctionType */, ArrayTypeSyntax.prototype.__kind = 124 /* ArrayType */, ConstructorTypeSyntax.prototype.__kind = 125 /* ConstructorType */, GenericTypeSyntax.prototype.__kind = 126 /* GenericType */, TypeQuerySyntax.prototype.__kind = 127 /* TypeQuery */, TupleTypeSyntax.prototype.__kind = 128 /* TupleType */, InterfaceDeclarationSyntax.prototype.__kind = 129 /* InterfaceDeclaration */, FunctionDeclarationSyntax.prototype.__kind = 130 /* FunctionDeclaration */, ModuleDeclarationSyntax.prototype.__kind = 131 /* ModuleDeclaration */, ClassDeclarationSyntax.prototype.__kind = 132 /* ClassDeclaration */, EnumDeclarationSyntax.prototype.__kind = 133 /* EnumDeclaration */, ImportDeclarationSyntax.prototype.__kind = 134 /* ImportDeclaration */, ExportAssignmentSyntax.prototype.__kind = 135 /* ExportAssignment */, MemberFunctionDeclarationSyntax.prototype.__kind = 136 /* MemberFunctionDeclaration */, MemberVariableDeclarationSyntax.prototype.__kind = 137 /* MemberVariableDeclaration */, ConstructorDeclarationSyntax.prototype.__kind = 138 /* ConstructorDeclaration */, IndexMemberDeclarationSyntax.prototype.__kind = 139 /* IndexMemberDeclaration */, GetAccessorSyntax.prototype.__kind = 140 /* GetAccessor */, SetAccessorSyntax.prototype.__kind = 141 /* SetAccessor */, PropertySignatureSyntax.prototype.__kind = 142 /* PropertySignature */, CallSignatureSyntax.prototype.__kind = 143 /* CallSignature */, ConstructSignatureSyntax.prototype.__kind = 144 /* ConstructSignature */, IndexSignatureSyntax.prototype.__kind = 145 /* IndexSignature */, MethodSignatureSyntax.prototype.__kind = 146 /* MethodSignature */, BlockSyntax.prototype.__kind = 147 /* Block */, IfStatementSyntax.prototype.__kind = 148 /* IfStatement */, VariableStatementSyntax.prototype.__kind = 149 /* VariableStatement */, ExpressionStatementSyntax.prototype.__kind = 150 /* ExpressionStatement */, ReturnStatementSyntax.prototype.__kind = 151 /* ReturnStatement */, SwitchStatementSyntax.prototype.__kind = 152 /* SwitchStatement */, BreakStatementSyntax.prototype.__kind = 153 /* BreakStatement */, ContinueStatementSyntax.prototype.__kind = 154 /* ContinueStatement */, ForStatementSyntax.prototype.__kind = 155 /* ForStatement */, ForInStatementSyntax.prototype.__kind = 156 /* ForInStatement */, EmptyStatementSyntax.prototype.__kind = 157 /* EmptyStatement */, ThrowStatementSyntax.prototype.__kind = 158 /* ThrowStatement */, WhileStatementSyntax.prototype.__kind = 159 /* WhileStatement */, TryStatementSyntax.prototype.__kind = 160 /* TryStatement */, LabeledStatementSyntax.prototype.__kind = 161 /* LabeledStatement */, DoStatementSyntax.prototype.__kind = 162 /* DoStatement */, DebuggerStatementSyntax.prototype.__kind = 163 /* DebuggerStatement */, WithStatementSyntax.prototype.__kind = 164 /* WithStatement */, DeleteExpressionSyntax.prototype.__kind = 171 /* DeleteExpression */, TypeOfExpressionSyntax.prototype.__kind = 172 /* TypeOfExpression */, VoidExpressionSyntax.prototype.__kind = 173 /* VoidExpression */, ConditionalExpressionSyntax.prototype.__kind = 187 /* ConditionalExpression */, MemberAccessExpressionSyntax.prototype.__kind = 213 /* MemberAccessExpression */, InvocationExpressionSyntax.prototype.__kind = 214 /* InvocationExpression */, ArrayLiteralExpressionSyntax.prototype.__kind = 215 /* ArrayLiteralExpression */, ObjectLiteralExpressionSyntax.prototype.__kind = 216 /* ObjectLiteralExpression */, ObjectCreationExpressionSyntax.prototype.__kind = 217 /* ObjectCreationExpression */, ParenthesizedExpressionSyntax.prototype.__kind = 218 /* ParenthesizedExpression */, ParenthesizedArrowFunctionExpressionSyntax.prototype.__kind = 219 /* ParenthesizedArrowFunctionExpression */, SimpleArrowFunctionExpressionSyntax.prototype.__kind = 220 /* SimpleArrowFunctionExpression */, CastExpressionSyntax.prototype.__kind = 221 /* CastExpression */, ElementAccessExpressionSyntax.prototype.__kind = 222 /* ElementAccessExpression */, FunctionExpressionSyntax.prototype.__kind = 223 /* FunctionExpression */, OmittedExpressionSyntax.prototype.__kind = 224 /* OmittedExpression */, VariableDeclarationSyntax.prototype.__kind = 225 /* VariableDeclaration */, VariableDeclaratorSyntax.prototype.__kind = 226 /* VariableDeclarator */, ArgumentListSyntax.prototype.__kind = 227 /* ArgumentList */, ParameterListSyntax.prototype.__kind = 228 /* ParameterList */, TypeArgumentListSyntax.prototype.__kind = 229 /* TypeArgumentList */, TypeParameterListSyntax.prototype.__kind = 230 /* TypeParameterList */, EqualsValueClauseSyntax.prototype.__kind = 233 /* EqualsValueClause */, CaseSwitchClauseSyntax.prototype.__kind = 234 /* CaseSwitchClause */, DefaultSwitchClauseSyntax.prototype.__kind = 235 /* DefaultSwitchClause */, ElseClauseSyntax.prototype.__kind = 236 /* ElseClause */, CatchClauseSyntax.prototype.__kind = 237 /* CatchClause */, FinallyClauseSyntax.prototype.__kind = 238 /* FinallyClause */, TypeParameterSyntax.prototype.__kind = 239 /* TypeParameter */, ConstraintSyntax.prototype.__kind = 240 /* Constraint */, SimplePropertyAssignmentSyntax.prototype.__kind = 241 /* SimplePropertyAssignment */, FunctionPropertyAssignmentSyntax.prototype.__kind = 242 /* FunctionPropertyAssignment */, ParameterSyntax.prototype.__kind = 243 /* Parameter */, EnumElementSyntax.prototype.__kind = 244 /* EnumElement */, TypeAnnotationSyntax.prototype.__kind = 245 /* TypeAnnotation */, ExternalModuleReferenceSyntax.prototype.__kind = 246 /* ExternalModuleReference */, ModuleNameModuleReferenceSyntax.prototype.__kind = 247 /* ModuleNameModuleReference */; - })(Concrete = Syntax.Concrete || (Syntax.Concrete = {})); - })(Syntax = TypeScript.Syntax || (TypeScript.Syntax = {})); + TypeScript.SourceUnitSyntax = function (data, moduleElements, endOfFileToken) { + if (data) { + this.__data = data; + } + this.moduleElements = moduleElements, this.endOfFileToken = endOfFileToken; + moduleElements.parent = this, endOfFileToken.parent = this; + }; + TypeScript.SourceUnitSyntax.prototype.kind = function () { + return 122 /* SourceUnit */; + }; + TypeScript.QualifiedNameSyntax = function (data, left, dotToken, right) { + if (data) { + this.__data = data; + } + this.left = left, this.dotToken = dotToken, this.right = right; + left.parent = this, dotToken.parent = this, right.parent = this; + }; + TypeScript.QualifiedNameSyntax.prototype.kind = function () { + return 123 /* QualifiedName */; + }; + TypeScript.ObjectTypeSyntax = function (data, openBraceToken, typeMembers, closeBraceToken) { + if (data) { + this.__data = data; + } + this.openBraceToken = openBraceToken, this.typeMembers = typeMembers, this.closeBraceToken = closeBraceToken; + openBraceToken.parent = this, typeMembers.parent = this, closeBraceToken.parent = this; + }; + TypeScript.ObjectTypeSyntax.prototype.kind = function () { + return 124 /* ObjectType */; + }; + TypeScript.FunctionTypeSyntax = function (data, typeParameterList, parameterList, equalsGreaterThanToken, type) { + if (data) { + this.__data = data; + } + this.typeParameterList = typeParameterList, this.parameterList = parameterList, this.equalsGreaterThanToken = equalsGreaterThanToken, this.type = type; + typeParameterList && (typeParameterList.parent = this), parameterList.parent = this, equalsGreaterThanToken.parent = this, type.parent = this; + }; + TypeScript.FunctionTypeSyntax.prototype.kind = function () { + return 125 /* FunctionType */; + }; + TypeScript.ArrayTypeSyntax = function (data, type, openBracketToken, closeBracketToken) { + if (data) { + this.__data = data; + } + this.type = type, this.openBracketToken = openBracketToken, this.closeBracketToken = closeBracketToken; + type.parent = this, openBracketToken.parent = this, closeBracketToken.parent = this; + }; + TypeScript.ArrayTypeSyntax.prototype.kind = function () { + return 126 /* ArrayType */; + }; + TypeScript.ConstructorTypeSyntax = function (data, newKeyword, typeParameterList, parameterList, equalsGreaterThanToken, type) { + if (data) { + this.__data = data; + } + this.newKeyword = newKeyword, this.typeParameterList = typeParameterList, this.parameterList = parameterList, this.equalsGreaterThanToken = equalsGreaterThanToken, this.type = type; + newKeyword.parent = this, typeParameterList && (typeParameterList.parent = this), parameterList.parent = this, equalsGreaterThanToken.parent = this, type.parent = this; + }; + TypeScript.ConstructorTypeSyntax.prototype.kind = function () { + return 127 /* ConstructorType */; + }; + TypeScript.GenericTypeSyntax = function (data, name, typeArgumentList) { + if (data) { + this.__data = data; + } + this.name = name, this.typeArgumentList = typeArgumentList; + name.parent = this, typeArgumentList.parent = this; + }; + TypeScript.GenericTypeSyntax.prototype.kind = function () { + return 128 /* GenericType */; + }; + TypeScript.TypeQuerySyntax = function (data, typeOfKeyword, name) { + if (data) { + this.__data = data; + } + this.typeOfKeyword = typeOfKeyword, this.name = name; + typeOfKeyword.parent = this, name.parent = this; + }; + TypeScript.TypeQuerySyntax.prototype.kind = function () { + return 129 /* TypeQuery */; + }; + TypeScript.TupleTypeSyntax = function (data, openBracketToken, types, closeBracketToken) { + if (data) { + this.__data = data; + } + this.openBracketToken = openBracketToken, this.types = types, this.closeBracketToken = closeBracketToken; + openBracketToken.parent = this, types.parent = this, closeBracketToken.parent = this; + }; + TypeScript.TupleTypeSyntax.prototype.kind = function () { + return 130 /* TupleType */; + }; + TypeScript.UnionTypeSyntax = function (data, left, barToken, right) { + if (data) { + this.__data = data; + } + this.left = left, this.barToken = barToken, this.right = right; + left.parent = this, barToken.parent = this, right.parent = this; + }; + TypeScript.UnionTypeSyntax.prototype.kind = function () { + return 131 /* UnionType */; + }; + TypeScript.ParenthesizedTypeSyntax = function (data, openParenToken, type, closeParenToken) { + if (data) { + this.__data = data; + } + this.openParenToken = openParenToken, this.type = type, this.closeParenToken = closeParenToken; + openParenToken.parent = this, type.parent = this, closeParenToken.parent = this; + }; + TypeScript.ParenthesizedTypeSyntax.prototype.kind = function () { + return 132 /* ParenthesizedType */; + }; + TypeScript.InterfaceDeclarationSyntax = function (data, modifiers, interfaceKeyword, identifier, typeParameterList, heritageClauses, body) { + if (data) { + this.__data = data; + } + this.modifiers = modifiers, this.interfaceKeyword = interfaceKeyword, this.identifier = identifier, this.typeParameterList = typeParameterList, this.heritageClauses = heritageClauses, this.body = body; + modifiers.parent = this, interfaceKeyword.parent = this, identifier.parent = this, typeParameterList && (typeParameterList.parent = this), heritageClauses.parent = this, body.parent = this; + }; + TypeScript.InterfaceDeclarationSyntax.prototype.kind = function () { + return 133 /* InterfaceDeclaration */; + }; + TypeScript.FunctionDeclarationSyntax = function (data, modifiers, functionKeyword, identifier, callSignature, block, semicolonToken) { + if (data) { + this.__data = data; + } + this.modifiers = modifiers, this.functionKeyword = functionKeyword, this.identifier = identifier, this.callSignature = callSignature, this.block = block, this.semicolonToken = semicolonToken; + modifiers.parent = this, functionKeyword.parent = this, identifier.parent = this, callSignature.parent = this, block && (block.parent = this), semicolonToken && (semicolonToken.parent = this); + }; + TypeScript.FunctionDeclarationSyntax.prototype.kind = function () { + return 134 /* FunctionDeclaration */; + }; + TypeScript.ModuleDeclarationSyntax = function (data, modifiers, moduleKeyword, name, stringLiteral, openBraceToken, moduleElements, closeBraceToken) { + if (data) { + this.__data = data; + } + this.modifiers = modifiers, this.moduleKeyword = moduleKeyword, this.name = name, this.stringLiteral = stringLiteral, this.openBraceToken = openBraceToken, this.moduleElements = moduleElements, this.closeBraceToken = closeBraceToken; + modifiers.parent = this, moduleKeyword.parent = this, name && (name.parent = this), stringLiteral && (stringLiteral.parent = this), openBraceToken.parent = this, moduleElements.parent = this, closeBraceToken.parent = this; + }; + TypeScript.ModuleDeclarationSyntax.prototype.kind = function () { + return 135 /* ModuleDeclaration */; + }; + TypeScript.ClassDeclarationSyntax = function (data, modifiers, classKeyword, identifier, typeParameterList, heritageClauses, openBraceToken, classElements, closeBraceToken) { + if (data) { + this.__data = data; + } + this.modifiers = modifiers, this.classKeyword = classKeyword, this.identifier = identifier, this.typeParameterList = typeParameterList, this.heritageClauses = heritageClauses, this.openBraceToken = openBraceToken, this.classElements = classElements, this.closeBraceToken = closeBraceToken; + modifiers.parent = this, classKeyword.parent = this, identifier.parent = this, typeParameterList && (typeParameterList.parent = this), heritageClauses.parent = this, openBraceToken.parent = this, classElements.parent = this, closeBraceToken.parent = this; + }; + TypeScript.ClassDeclarationSyntax.prototype.kind = function () { + return 136 /* ClassDeclaration */; + }; + TypeScript.EnumDeclarationSyntax = function (data, modifiers, enumKeyword, identifier, openBraceToken, enumElements, closeBraceToken) { + if (data) { + this.__data = data; + } + this.modifiers = modifiers, this.enumKeyword = enumKeyword, this.identifier = identifier, this.openBraceToken = openBraceToken, this.enumElements = enumElements, this.closeBraceToken = closeBraceToken; + modifiers.parent = this, enumKeyword.parent = this, identifier.parent = this, openBraceToken.parent = this, enumElements.parent = this, closeBraceToken.parent = this; + }; + TypeScript.EnumDeclarationSyntax.prototype.kind = function () { + return 137 /* EnumDeclaration */; + }; + TypeScript.ImportDeclarationSyntax = function (data, modifiers, importKeyword, identifier, equalsToken, moduleReference, semicolonToken) { + if (data) { + this.__data = data; + } + this.modifiers = modifiers, this.importKeyword = importKeyword, this.identifier = identifier, this.equalsToken = equalsToken, this.moduleReference = moduleReference, this.semicolonToken = semicolonToken; + modifiers.parent = this, importKeyword.parent = this, identifier.parent = this, equalsToken.parent = this, moduleReference.parent = this, semicolonToken && (semicolonToken.parent = this); + }; + TypeScript.ImportDeclarationSyntax.prototype.kind = function () { + return 138 /* ImportDeclaration */; + }; + TypeScript.ExportAssignmentSyntax = function (data, exportKeyword, equalsToken, identifier, semicolonToken) { + if (data) { + this.__data = data; + } + this.exportKeyword = exportKeyword, this.equalsToken = equalsToken, this.identifier = identifier, this.semicolonToken = semicolonToken; + exportKeyword.parent = this, equalsToken.parent = this, identifier.parent = this, semicolonToken && (semicolonToken.parent = this); + }; + TypeScript.ExportAssignmentSyntax.prototype.kind = function () { + return 139 /* ExportAssignment */; + }; + TypeScript.MemberFunctionDeclarationSyntax = function (data, modifiers, propertyName, callSignature, block, semicolonToken) { + if (data) { + this.__data = data; + } + this.modifiers = modifiers, this.propertyName = propertyName, this.callSignature = callSignature, this.block = block, this.semicolonToken = semicolonToken; + modifiers.parent = this, propertyName.parent = this, callSignature.parent = this, block && (block.parent = this), semicolonToken && (semicolonToken.parent = this); + }; + TypeScript.MemberFunctionDeclarationSyntax.prototype.kind = function () { + return 140 /* MemberFunctionDeclaration */; + }; + TypeScript.MemberVariableDeclarationSyntax = function (data, modifiers, variableDeclarator, semicolonToken) { + if (data) { + this.__data = data; + } + this.modifiers = modifiers, this.variableDeclarator = variableDeclarator, this.semicolonToken = semicolonToken; + modifiers.parent = this, variableDeclarator.parent = this, semicolonToken && (semicolonToken.parent = this); + }; + TypeScript.MemberVariableDeclarationSyntax.prototype.kind = function () { + return 141 /* MemberVariableDeclaration */; + }; + TypeScript.ConstructorDeclarationSyntax = function (data, modifiers, constructorKeyword, callSignature, block, semicolonToken) { + if (data) { + this.__data = data; + } + this.modifiers = modifiers, this.constructorKeyword = constructorKeyword, this.callSignature = callSignature, this.block = block, this.semicolonToken = semicolonToken; + modifiers.parent = this, constructorKeyword.parent = this, callSignature.parent = this, block && (block.parent = this), semicolonToken && (semicolonToken.parent = this); + }; + TypeScript.ConstructorDeclarationSyntax.prototype.kind = function () { + return 142 /* ConstructorDeclaration */; + }; + TypeScript.IndexMemberDeclarationSyntax = function (data, modifiers, indexSignature, semicolonToken) { + if (data) { + this.__data = data; + } + this.modifiers = modifiers, this.indexSignature = indexSignature, this.semicolonToken = semicolonToken; + modifiers.parent = this, indexSignature.parent = this, semicolonToken && (semicolonToken.parent = this); + }; + TypeScript.IndexMemberDeclarationSyntax.prototype.kind = function () { + return 143 /* IndexMemberDeclaration */; + }; + TypeScript.GetAccessorSyntax = function (data, modifiers, getKeyword, propertyName, callSignature, block) { + if (data) { + this.__data = data; + } + this.modifiers = modifiers, this.getKeyword = getKeyword, this.propertyName = propertyName, this.callSignature = callSignature, this.block = block; + modifiers.parent = this, getKeyword.parent = this, propertyName.parent = this, callSignature.parent = this, block.parent = this; + }; + TypeScript.GetAccessorSyntax.prototype.kind = function () { + return 144 /* GetAccessor */; + }; + TypeScript.SetAccessorSyntax = function (data, modifiers, setKeyword, propertyName, callSignature, block) { + if (data) { + this.__data = data; + } + this.modifiers = modifiers, this.setKeyword = setKeyword, this.propertyName = propertyName, this.callSignature = callSignature, this.block = block; + modifiers.parent = this, setKeyword.parent = this, propertyName.parent = this, callSignature.parent = this, block.parent = this; + }; + TypeScript.SetAccessorSyntax.prototype.kind = function () { + return 145 /* SetAccessor */; + }; + TypeScript.PropertySignatureSyntax = function (data, propertyName, questionToken, typeAnnotation) { + if (data) { + this.__data = data; + } + this.propertyName = propertyName, this.questionToken = questionToken, this.typeAnnotation = typeAnnotation; + propertyName.parent = this, questionToken && (questionToken.parent = this), typeAnnotation && (typeAnnotation.parent = this); + }; + TypeScript.PropertySignatureSyntax.prototype.kind = function () { + return 146 /* PropertySignature */; + }; + TypeScript.CallSignatureSyntax = function (data, typeParameterList, parameterList, typeAnnotation) { + if (data) { + this.__data = data; + } + this.typeParameterList = typeParameterList, this.parameterList = parameterList, this.typeAnnotation = typeAnnotation; + typeParameterList && (typeParameterList.parent = this), parameterList.parent = this, typeAnnotation && (typeAnnotation.parent = this); + }; + TypeScript.CallSignatureSyntax.prototype.kind = function () { + return 147 /* CallSignature */; + }; + TypeScript.ConstructSignatureSyntax = function (data, newKeyword, callSignature) { + if (data) { + this.__data = data; + } + this.newKeyword = newKeyword, this.callSignature = callSignature; + newKeyword.parent = this, callSignature.parent = this; + }; + TypeScript.ConstructSignatureSyntax.prototype.kind = function () { + return 148 /* ConstructSignature */; + }; + TypeScript.IndexSignatureSyntax = function (data, openBracketToken, parameters, closeBracketToken, typeAnnotation) { + if (data) { + this.__data = data; + } + this.openBracketToken = openBracketToken, this.parameters = parameters, this.closeBracketToken = closeBracketToken, this.typeAnnotation = typeAnnotation; + openBracketToken.parent = this, parameters.parent = this, closeBracketToken.parent = this, typeAnnotation && (typeAnnotation.parent = this); + }; + TypeScript.IndexSignatureSyntax.prototype.kind = function () { + return 149 /* IndexSignature */; + }; + TypeScript.MethodSignatureSyntax = function (data, propertyName, questionToken, callSignature) { + if (data) { + this.__data = data; + } + this.propertyName = propertyName, this.questionToken = questionToken, this.callSignature = callSignature; + propertyName.parent = this, questionToken && (questionToken.parent = this), callSignature.parent = this; + }; + TypeScript.MethodSignatureSyntax.prototype.kind = function () { + return 150 /* MethodSignature */; + }; + TypeScript.BlockSyntax = function (data, openBraceToken, statements, closeBraceToken) { + if (data) { + this.__data = data; + } + this.openBraceToken = openBraceToken, this.statements = statements, this.closeBraceToken = closeBraceToken; + openBraceToken.parent = this, statements.parent = this, closeBraceToken.parent = this; + }; + TypeScript.BlockSyntax.prototype.kind = function () { + return 151 /* Block */; + }; + TypeScript.IfStatementSyntax = function (data, ifKeyword, openParenToken, condition, closeParenToken, statement, elseClause) { + if (data) { + this.__data = data; + } + this.ifKeyword = ifKeyword, this.openParenToken = openParenToken, this.condition = condition, this.closeParenToken = closeParenToken, this.statement = statement, this.elseClause = elseClause; + ifKeyword.parent = this, openParenToken.parent = this, condition.parent = this, closeParenToken.parent = this, statement.parent = this, elseClause && (elseClause.parent = this); + }; + TypeScript.IfStatementSyntax.prototype.kind = function () { + return 152 /* IfStatement */; + }; + TypeScript.VariableStatementSyntax = function (data, modifiers, variableDeclaration, semicolonToken) { + if (data) { + this.__data = data; + } + this.modifiers = modifiers, this.variableDeclaration = variableDeclaration, this.semicolonToken = semicolonToken; + modifiers.parent = this, variableDeclaration.parent = this, semicolonToken && (semicolonToken.parent = this); + }; + TypeScript.VariableStatementSyntax.prototype.kind = function () { + return 153 /* VariableStatement */; + }; + TypeScript.ExpressionStatementSyntax = function (data, expression, semicolonToken) { + if (data) { + this.__data = data; + } + this.expression = expression, this.semicolonToken = semicolonToken; + expression.parent = this, semicolonToken && (semicolonToken.parent = this); + }; + TypeScript.ExpressionStatementSyntax.prototype.kind = function () { + return 154 /* ExpressionStatement */; + }; + TypeScript.ReturnStatementSyntax = function (data, returnKeyword, expression, semicolonToken) { + if (data) { + this.__data = data; + } + this.returnKeyword = returnKeyword, this.expression = expression, this.semicolonToken = semicolonToken; + returnKeyword.parent = this, expression && (expression.parent = this), semicolonToken && (semicolonToken.parent = this); + }; + TypeScript.ReturnStatementSyntax.prototype.kind = function () { + return 155 /* ReturnStatement */; + }; + TypeScript.SwitchStatementSyntax = function (data, switchKeyword, openParenToken, expression, closeParenToken, openBraceToken, switchClauses, closeBraceToken) { + if (data) { + this.__data = data; + } + this.switchKeyword = switchKeyword, this.openParenToken = openParenToken, this.expression = expression, this.closeParenToken = closeParenToken, this.openBraceToken = openBraceToken, this.switchClauses = switchClauses, this.closeBraceToken = closeBraceToken; + switchKeyword.parent = this, openParenToken.parent = this, expression.parent = this, closeParenToken.parent = this, openBraceToken.parent = this, switchClauses.parent = this, closeBraceToken.parent = this; + }; + TypeScript.SwitchStatementSyntax.prototype.kind = function () { + return 156 /* SwitchStatement */; + }; + TypeScript.BreakStatementSyntax = function (data, breakKeyword, identifier, semicolonToken) { + if (data) { + this.__data = data; + } + this.breakKeyword = breakKeyword, this.identifier = identifier, this.semicolonToken = semicolonToken; + breakKeyword.parent = this, identifier && (identifier.parent = this), semicolonToken && (semicolonToken.parent = this); + }; + TypeScript.BreakStatementSyntax.prototype.kind = function () { + return 157 /* BreakStatement */; + }; + TypeScript.ContinueStatementSyntax = function (data, continueKeyword, identifier, semicolonToken) { + if (data) { + this.__data = data; + } + this.continueKeyword = continueKeyword, this.identifier = identifier, this.semicolonToken = semicolonToken; + continueKeyword.parent = this, identifier && (identifier.parent = this), semicolonToken && (semicolonToken.parent = this); + }; + TypeScript.ContinueStatementSyntax.prototype.kind = function () { + return 158 /* ContinueStatement */; + }; + TypeScript.ForStatementSyntax = function (data, forKeyword, openParenToken, variableDeclaration, initializer, firstSemicolonToken, condition, secondSemicolonToken, incrementor, closeParenToken, statement) { + if (data) { + this.__data = data; + } + this.forKeyword = forKeyword, this.openParenToken = openParenToken, this.variableDeclaration = variableDeclaration, this.initializer = initializer, this.firstSemicolonToken = firstSemicolonToken, this.condition = condition, this.secondSemicolonToken = secondSemicolonToken, this.incrementor = incrementor, this.closeParenToken = closeParenToken, this.statement = statement; + forKeyword.parent = this, openParenToken.parent = this, variableDeclaration && (variableDeclaration.parent = this), initializer && (initializer.parent = this), firstSemicolonToken.parent = this, condition && (condition.parent = this), secondSemicolonToken.parent = this, incrementor && (incrementor.parent = this), closeParenToken.parent = this, statement.parent = this; + }; + TypeScript.ForStatementSyntax.prototype.kind = function () { + return 159 /* ForStatement */; + }; + TypeScript.ForInStatementSyntax = function (data, forKeyword, openParenToken, variableDeclaration, left, inKeyword, expression, closeParenToken, statement) { + if (data) { + this.__data = data; + } + this.forKeyword = forKeyword, this.openParenToken = openParenToken, this.variableDeclaration = variableDeclaration, this.left = left, this.inKeyword = inKeyword, this.expression = expression, this.closeParenToken = closeParenToken, this.statement = statement; + forKeyword.parent = this, openParenToken.parent = this, variableDeclaration && (variableDeclaration.parent = this), left && (left.parent = this), inKeyword.parent = this, expression.parent = this, closeParenToken.parent = this, statement.parent = this; + }; + TypeScript.ForInStatementSyntax.prototype.kind = function () { + return 160 /* ForInStatement */; + }; + TypeScript.EmptyStatementSyntax = function (data, semicolonToken) { + if (data) { + this.__data = data; + } + this.semicolonToken = semicolonToken; + semicolonToken.parent = this; + }; + TypeScript.EmptyStatementSyntax.prototype.kind = function () { + return 161 /* EmptyStatement */; + }; + TypeScript.ThrowStatementSyntax = function (data, throwKeyword, expression, semicolonToken) { + if (data) { + this.__data = data; + } + this.throwKeyword = throwKeyword, this.expression = expression, this.semicolonToken = semicolonToken; + throwKeyword.parent = this, expression.parent = this, semicolonToken && (semicolonToken.parent = this); + }; + TypeScript.ThrowStatementSyntax.prototype.kind = function () { + return 162 /* ThrowStatement */; + }; + TypeScript.WhileStatementSyntax = function (data, whileKeyword, openParenToken, condition, closeParenToken, statement) { + if (data) { + this.__data = data; + } + this.whileKeyword = whileKeyword, this.openParenToken = openParenToken, this.condition = condition, this.closeParenToken = closeParenToken, this.statement = statement; + whileKeyword.parent = this, openParenToken.parent = this, condition.parent = this, closeParenToken.parent = this, statement.parent = this; + }; + TypeScript.WhileStatementSyntax.prototype.kind = function () { + return 163 /* WhileStatement */; + }; + TypeScript.TryStatementSyntax = function (data, tryKeyword, block, catchClause, finallyClause) { + if (data) { + this.__data = data; + } + this.tryKeyword = tryKeyword, this.block = block, this.catchClause = catchClause, this.finallyClause = finallyClause; + tryKeyword.parent = this, block.parent = this, catchClause && (catchClause.parent = this), finallyClause && (finallyClause.parent = this); + }; + TypeScript.TryStatementSyntax.prototype.kind = function () { + return 164 /* TryStatement */; + }; + TypeScript.LabeledStatementSyntax = function (data, identifier, colonToken, statement) { + if (data) { + this.__data = data; + } + this.identifier = identifier, this.colonToken = colonToken, this.statement = statement; + identifier.parent = this, colonToken.parent = this, statement.parent = this; + }; + TypeScript.LabeledStatementSyntax.prototype.kind = function () { + return 165 /* LabeledStatement */; + }; + TypeScript.DoStatementSyntax = function (data, doKeyword, statement, whileKeyword, openParenToken, condition, closeParenToken, semicolonToken) { + if (data) { + this.__data = data; + } + this.doKeyword = doKeyword, this.statement = statement, this.whileKeyword = whileKeyword, this.openParenToken = openParenToken, this.condition = condition, this.closeParenToken = closeParenToken, this.semicolonToken = semicolonToken; + doKeyword.parent = this, statement.parent = this, whileKeyword.parent = this, openParenToken.parent = this, condition.parent = this, closeParenToken.parent = this, semicolonToken && (semicolonToken.parent = this); + }; + TypeScript.DoStatementSyntax.prototype.kind = function () { + return 166 /* DoStatement */; + }; + TypeScript.DebuggerStatementSyntax = function (data, debuggerKeyword, semicolonToken) { + if (data) { + this.__data = data; + } + this.debuggerKeyword = debuggerKeyword, this.semicolonToken = semicolonToken; + debuggerKeyword.parent = this, semicolonToken && (semicolonToken.parent = this); + }; + TypeScript.DebuggerStatementSyntax.prototype.kind = function () { + return 167 /* DebuggerStatement */; + }; + TypeScript.WithStatementSyntax = function (data, withKeyword, openParenToken, condition, closeParenToken, statement) { + if (data) { + this.__data = data; + } + this.withKeyword = withKeyword, this.openParenToken = openParenToken, this.condition = condition, this.closeParenToken = closeParenToken, this.statement = statement; + withKeyword.parent = this, openParenToken.parent = this, condition.parent = this, closeParenToken.parent = this, statement.parent = this; + }; + TypeScript.WithStatementSyntax.prototype.kind = function () { + return 168 /* WithStatement */; + }; + TypeScript.PrefixUnaryExpressionSyntax = function (data, operatorToken, operand) { + if (data) { + this.__data = data; + } + this.operatorToken = operatorToken, this.operand = operand; + operatorToken.parent = this, operand.parent = this; + }; + TypeScript.PrefixUnaryExpressionSyntax.prototype.kind = function () { + return 169 /* PrefixUnaryExpression */; + }; + TypeScript.DeleteExpressionSyntax = function (data, deleteKeyword, expression) { + if (data) { + this.__data = data; + } + this.deleteKeyword = deleteKeyword, this.expression = expression; + deleteKeyword.parent = this, expression.parent = this; + }; + TypeScript.DeleteExpressionSyntax.prototype.kind = function () { + return 170 /* DeleteExpression */; + }; + TypeScript.TypeOfExpressionSyntax = function (data, typeOfKeyword, expression) { + if (data) { + this.__data = data; + } + this.typeOfKeyword = typeOfKeyword, this.expression = expression; + typeOfKeyword.parent = this, expression.parent = this; + }; + TypeScript.TypeOfExpressionSyntax.prototype.kind = function () { + return 171 /* TypeOfExpression */; + }; + TypeScript.VoidExpressionSyntax = function (data, voidKeyword, expression) { + if (data) { + this.__data = data; + } + this.voidKeyword = voidKeyword, this.expression = expression; + voidKeyword.parent = this, expression.parent = this; + }; + TypeScript.VoidExpressionSyntax.prototype.kind = function () { + return 172 /* VoidExpression */; + }; + TypeScript.ConditionalExpressionSyntax = function (data, condition, questionToken, whenTrue, colonToken, whenFalse) { + if (data) { + this.__data = data; + } + this.condition = condition, this.questionToken = questionToken, this.whenTrue = whenTrue, this.colonToken = colonToken, this.whenFalse = whenFalse; + condition.parent = this, questionToken.parent = this, whenTrue.parent = this, colonToken.parent = this, whenFalse.parent = this; + }; + TypeScript.ConditionalExpressionSyntax.prototype.kind = function () { + return 173 /* ConditionalExpression */; + }; + TypeScript.BinaryExpressionSyntax = function (data, left, operatorToken, right) { + if (data) { + this.__data = data; + } + this.left = left, this.operatorToken = operatorToken, this.right = right; + left.parent = this, operatorToken.parent = this, right.parent = this; + }; + TypeScript.BinaryExpressionSyntax.prototype.kind = function () { + return 174 /* BinaryExpression */; + }; + TypeScript.PostfixUnaryExpressionSyntax = function (data, operand, operatorToken) { + if (data) { + this.__data = data; + } + this.operand = operand, this.operatorToken = operatorToken; + operand.parent = this, operatorToken.parent = this; + }; + TypeScript.PostfixUnaryExpressionSyntax.prototype.kind = function () { + return 175 /* PostfixUnaryExpression */; + }; + TypeScript.MemberAccessExpressionSyntax = function (data, expression, dotToken, name) { + if (data) { + this.__data = data; + } + this.expression = expression, this.dotToken = dotToken, this.name = name; + expression.parent = this, dotToken.parent = this, name.parent = this; + }; + TypeScript.MemberAccessExpressionSyntax.prototype.kind = function () { + return 176 /* MemberAccessExpression */; + }; + TypeScript.InvocationExpressionSyntax = function (data, expression, argumentList) { + if (data) { + this.__data = data; + } + this.expression = expression, this.argumentList = argumentList; + expression.parent = this, argumentList.parent = this; + }; + TypeScript.InvocationExpressionSyntax.prototype.kind = function () { + return 177 /* InvocationExpression */; + }; + TypeScript.ArrayLiteralExpressionSyntax = function (data, openBracketToken, expressions, closeBracketToken) { + if (data) { + this.__data = data; + } + this.openBracketToken = openBracketToken, this.expressions = expressions, this.closeBracketToken = closeBracketToken; + openBracketToken.parent = this, expressions.parent = this, closeBracketToken.parent = this; + }; + TypeScript.ArrayLiteralExpressionSyntax.prototype.kind = function () { + return 178 /* ArrayLiteralExpression */; + }; + TypeScript.ObjectLiteralExpressionSyntax = function (data, openBraceToken, propertyAssignments, closeBraceToken) { + if (data) { + this.__data = data; + } + this.openBraceToken = openBraceToken, this.propertyAssignments = propertyAssignments, this.closeBraceToken = closeBraceToken; + openBraceToken.parent = this, propertyAssignments.parent = this, closeBraceToken.parent = this; + }; + TypeScript.ObjectLiteralExpressionSyntax.prototype.kind = function () { + return 179 /* ObjectLiteralExpression */; + }; + TypeScript.ObjectCreationExpressionSyntax = function (data, newKeyword, expression, argumentList) { + if (data) { + this.__data = data; + } + this.newKeyword = newKeyword, this.expression = expression, this.argumentList = argumentList; + newKeyword.parent = this, expression.parent = this, argumentList && (argumentList.parent = this); + }; + TypeScript.ObjectCreationExpressionSyntax.prototype.kind = function () { + return 180 /* ObjectCreationExpression */; + }; + TypeScript.ParenthesizedExpressionSyntax = function (data, openParenToken, expression, closeParenToken) { + if (data) { + this.__data = data; + } + this.openParenToken = openParenToken, this.expression = expression, this.closeParenToken = closeParenToken; + openParenToken.parent = this, expression.parent = this, closeParenToken.parent = this; + }; + TypeScript.ParenthesizedExpressionSyntax.prototype.kind = function () { + return 181 /* ParenthesizedExpression */; + }; + TypeScript.ParenthesizedArrowFunctionExpressionSyntax = function (data, callSignature, equalsGreaterThanToken, block, expression) { + if (data) { + this.__data = data; + } + this.callSignature = callSignature, this.equalsGreaterThanToken = equalsGreaterThanToken, this.block = block, this.expression = expression; + callSignature.parent = this, equalsGreaterThanToken.parent = this, block && (block.parent = this), expression && (expression.parent = this); + }; + TypeScript.ParenthesizedArrowFunctionExpressionSyntax.prototype.kind = function () { + return 182 /* ParenthesizedArrowFunctionExpression */; + }; + TypeScript.SimpleArrowFunctionExpressionSyntax = function (data, parameter, equalsGreaterThanToken, block, expression) { + if (data) { + this.__data = data; + } + this.parameter = parameter, this.equalsGreaterThanToken = equalsGreaterThanToken, this.block = block, this.expression = expression; + parameter.parent = this, equalsGreaterThanToken.parent = this, block && (block.parent = this), expression && (expression.parent = this); + }; + TypeScript.SimpleArrowFunctionExpressionSyntax.prototype.kind = function () { + return 183 /* SimpleArrowFunctionExpression */; + }; + TypeScript.CastExpressionSyntax = function (data, lessThanToken, type, greaterThanToken, expression) { + if (data) { + this.__data = data; + } + this.lessThanToken = lessThanToken, this.type = type, this.greaterThanToken = greaterThanToken, this.expression = expression; + lessThanToken.parent = this, type.parent = this, greaterThanToken.parent = this, expression.parent = this; + }; + TypeScript.CastExpressionSyntax.prototype.kind = function () { + return 184 /* CastExpression */; + }; + TypeScript.ElementAccessExpressionSyntax = function (data, expression, openBracketToken, argumentExpression, closeBracketToken) { + if (data) { + this.__data = data; + } + this.expression = expression, this.openBracketToken = openBracketToken, this.argumentExpression = argumentExpression, this.closeBracketToken = closeBracketToken; + expression.parent = this, openBracketToken.parent = this, argumentExpression.parent = this, closeBracketToken.parent = this; + }; + TypeScript.ElementAccessExpressionSyntax.prototype.kind = function () { + return 185 /* ElementAccessExpression */; + }; + TypeScript.FunctionExpressionSyntax = function (data, functionKeyword, identifier, callSignature, block) { + if (data) { + this.__data = data; + } + this.functionKeyword = functionKeyword, this.identifier = identifier, this.callSignature = callSignature, this.block = block; + functionKeyword.parent = this, identifier && (identifier.parent = this), callSignature.parent = this, block.parent = this; + }; + TypeScript.FunctionExpressionSyntax.prototype.kind = function () { + return 186 /* FunctionExpression */; + }; + TypeScript.OmittedExpressionSyntax = function (data) { + if (data) { + this.__data = data; + } + }; + TypeScript.OmittedExpressionSyntax.prototype.kind = function () { + return 187 /* OmittedExpression */; + }; + TypeScript.TemplateExpressionSyntax = function (data, templateStartToken, templateClauses) { + if (data) { + this.__data = data; + } + this.templateStartToken = templateStartToken, this.templateClauses = templateClauses; + templateStartToken.parent = this, templateClauses.parent = this; + }; + TypeScript.TemplateExpressionSyntax.prototype.kind = function () { + return 188 /* TemplateExpression */; + }; + TypeScript.TemplateAccessExpressionSyntax = function (data, expression, templateExpression) { + if (data) { + this.__data = data; + } + this.expression = expression, this.templateExpression = templateExpression; + expression.parent = this, templateExpression.parent = this; + }; + TypeScript.TemplateAccessExpressionSyntax.prototype.kind = function () { + return 189 /* TemplateAccessExpression */; + }; + TypeScript.VariableDeclarationSyntax = function (data, varKeyword, variableDeclarators) { + if (data) { + this.__data = data; + } + this.varKeyword = varKeyword, this.variableDeclarators = variableDeclarators; + varKeyword.parent = this, variableDeclarators.parent = this; + }; + TypeScript.VariableDeclarationSyntax.prototype.kind = function () { + return 190 /* VariableDeclaration */; + }; + TypeScript.VariableDeclaratorSyntax = function (data, propertyName, typeAnnotation, equalsValueClause) { + if (data) { + this.__data = data; + } + this.propertyName = propertyName, this.typeAnnotation = typeAnnotation, this.equalsValueClause = equalsValueClause; + propertyName.parent = this, typeAnnotation && (typeAnnotation.parent = this), equalsValueClause && (equalsValueClause.parent = this); + }; + TypeScript.VariableDeclaratorSyntax.prototype.kind = function () { + return 191 /* VariableDeclarator */; + }; + TypeScript.ArgumentListSyntax = function (data, typeArgumentList, openParenToken, _arguments, closeParenToken) { + if (data) { + this.__data = data; + } + this.typeArgumentList = typeArgumentList, this.openParenToken = openParenToken, this.arguments = _arguments, this.closeParenToken = closeParenToken; + typeArgumentList && (typeArgumentList.parent = this), openParenToken.parent = this, _arguments.parent = this, closeParenToken.parent = this; + }; + TypeScript.ArgumentListSyntax.prototype.kind = function () { + return 192 /* ArgumentList */; + }; + TypeScript.ParameterListSyntax = function (data, openParenToken, parameters, closeParenToken) { + if (data) { + this.__data = data; + } + this.openParenToken = openParenToken, this.parameters = parameters, this.closeParenToken = closeParenToken; + openParenToken.parent = this, parameters.parent = this, closeParenToken.parent = this; + }; + TypeScript.ParameterListSyntax.prototype.kind = function () { + return 193 /* ParameterList */; + }; + TypeScript.TypeArgumentListSyntax = function (data, lessThanToken, typeArguments, greaterThanToken) { + if (data) { + this.__data = data; + } + this.lessThanToken = lessThanToken, this.typeArguments = typeArguments, this.greaterThanToken = greaterThanToken; + lessThanToken.parent = this, typeArguments.parent = this, greaterThanToken.parent = this; + }; + TypeScript.TypeArgumentListSyntax.prototype.kind = function () { + return 194 /* TypeArgumentList */; + }; + TypeScript.TypeParameterListSyntax = function (data, lessThanToken, typeParameters, greaterThanToken) { + if (data) { + this.__data = data; + } + this.lessThanToken = lessThanToken, this.typeParameters = typeParameters, this.greaterThanToken = greaterThanToken; + lessThanToken.parent = this, typeParameters.parent = this, greaterThanToken.parent = this; + }; + TypeScript.TypeParameterListSyntax.prototype.kind = function () { + return 195 /* TypeParameterList */; + }; + TypeScript.HeritageClauseSyntax = function (data, extendsOrImplementsKeyword, typeNames) { + if (data) { + this.__data = data; + } + this.extendsOrImplementsKeyword = extendsOrImplementsKeyword, this.typeNames = typeNames; + extendsOrImplementsKeyword.parent = this, typeNames.parent = this; + }; + TypeScript.HeritageClauseSyntax.prototype.kind = function () { + return 196 /* HeritageClause */; + }; + TypeScript.EqualsValueClauseSyntax = function (data, equalsToken, value) { + if (data) { + this.__data = data; + } + this.equalsToken = equalsToken, this.value = value; + equalsToken.parent = this, value.parent = this; + }; + TypeScript.EqualsValueClauseSyntax.prototype.kind = function () { + return 197 /* EqualsValueClause */; + }; + TypeScript.CaseSwitchClauseSyntax = function (data, caseKeyword, expression, colonToken, statements) { + if (data) { + this.__data = data; + } + this.caseKeyword = caseKeyword, this.expression = expression, this.colonToken = colonToken, this.statements = statements; + caseKeyword.parent = this, expression.parent = this, colonToken.parent = this, statements.parent = this; + }; + TypeScript.CaseSwitchClauseSyntax.prototype.kind = function () { + return 198 /* CaseSwitchClause */; + }; + TypeScript.DefaultSwitchClauseSyntax = function (data, defaultKeyword, colonToken, statements) { + if (data) { + this.__data = data; + } + this.defaultKeyword = defaultKeyword, this.colonToken = colonToken, this.statements = statements; + defaultKeyword.parent = this, colonToken.parent = this, statements.parent = this; + }; + TypeScript.DefaultSwitchClauseSyntax.prototype.kind = function () { + return 199 /* DefaultSwitchClause */; + }; + TypeScript.ElseClauseSyntax = function (data, elseKeyword, statement) { + if (data) { + this.__data = data; + } + this.elseKeyword = elseKeyword, this.statement = statement; + elseKeyword.parent = this, statement.parent = this; + }; + TypeScript.ElseClauseSyntax.prototype.kind = function () { + return 200 /* ElseClause */; + }; + TypeScript.CatchClauseSyntax = function (data, catchKeyword, openParenToken, identifier, typeAnnotation, closeParenToken, block) { + if (data) { + this.__data = data; + } + this.catchKeyword = catchKeyword, this.openParenToken = openParenToken, this.identifier = identifier, this.typeAnnotation = typeAnnotation, this.closeParenToken = closeParenToken, this.block = block; + catchKeyword.parent = this, openParenToken.parent = this, identifier.parent = this, typeAnnotation && (typeAnnotation.parent = this), closeParenToken.parent = this, block.parent = this; + }; + TypeScript.CatchClauseSyntax.prototype.kind = function () { + return 201 /* CatchClause */; + }; + TypeScript.FinallyClauseSyntax = function (data, finallyKeyword, block) { + if (data) { + this.__data = data; + } + this.finallyKeyword = finallyKeyword, this.block = block; + finallyKeyword.parent = this, block.parent = this; + }; + TypeScript.FinallyClauseSyntax.prototype.kind = function () { + return 202 /* FinallyClause */; + }; + TypeScript.TemplateClauseSyntax = function (data, expression, templateMiddleOrEndToken) { + if (data) { + this.__data = data; + } + this.expression = expression, this.templateMiddleOrEndToken = templateMiddleOrEndToken; + expression.parent = this, templateMiddleOrEndToken.parent = this; + }; + TypeScript.TemplateClauseSyntax.prototype.kind = function () { + return 203 /* TemplateClause */; + }; + TypeScript.TypeParameterSyntax = function (data, identifier, constraint) { + if (data) { + this.__data = data; + } + this.identifier = identifier, this.constraint = constraint; + identifier.parent = this, constraint && (constraint.parent = this); + }; + TypeScript.TypeParameterSyntax.prototype.kind = function () { + return 204 /* TypeParameter */; + }; + TypeScript.ConstraintSyntax = function (data, extendsKeyword, typeOrExpression) { + if (data) { + this.__data = data; + } + this.extendsKeyword = extendsKeyword, this.typeOrExpression = typeOrExpression; + extendsKeyword.parent = this, typeOrExpression.parent = this; + }; + TypeScript.ConstraintSyntax.prototype.kind = function () { + return 205 /* Constraint */; + }; + TypeScript.SimplePropertyAssignmentSyntax = function (data, propertyName, colonToken, expression) { + if (data) { + this.__data = data; + } + this.propertyName = propertyName, this.colonToken = colonToken, this.expression = expression; + propertyName.parent = this, colonToken.parent = this, expression.parent = this; + }; + TypeScript.SimplePropertyAssignmentSyntax.prototype.kind = function () { + return 206 /* SimplePropertyAssignment */; + }; + TypeScript.FunctionPropertyAssignmentSyntax = function (data, propertyName, callSignature, block) { + if (data) { + this.__data = data; + } + this.propertyName = propertyName, this.callSignature = callSignature, this.block = block; + propertyName.parent = this, callSignature.parent = this, block.parent = this; + }; + TypeScript.FunctionPropertyAssignmentSyntax.prototype.kind = function () { + return 207 /* FunctionPropertyAssignment */; + }; + TypeScript.ParameterSyntax = function (data, dotDotDotToken, modifiers, identifier, questionToken, typeAnnotation, equalsValueClause) { + if (data) { + this.__data = data; + } + this.dotDotDotToken = dotDotDotToken, this.modifiers = modifiers, this.identifier = identifier, this.questionToken = questionToken, this.typeAnnotation = typeAnnotation, this.equalsValueClause = equalsValueClause; + dotDotDotToken && (dotDotDotToken.parent = this), modifiers.parent = this, identifier.parent = this, questionToken && (questionToken.parent = this), typeAnnotation && (typeAnnotation.parent = this), equalsValueClause && (equalsValueClause.parent = this); + }; + TypeScript.ParameterSyntax.prototype.kind = function () { + return 208 /* Parameter */; + }; + TypeScript.EnumElementSyntax = function (data, propertyName, equalsValueClause) { + if (data) { + this.__data = data; + } + this.propertyName = propertyName, this.equalsValueClause = equalsValueClause; + propertyName.parent = this, equalsValueClause && (equalsValueClause.parent = this); + }; + TypeScript.EnumElementSyntax.prototype.kind = function () { + return 209 /* EnumElement */; + }; + TypeScript.TypeAnnotationSyntax = function (data, colonToken, type) { + if (data) { + this.__data = data; + } + this.colonToken = colonToken, this.type = type; + colonToken.parent = this, type.parent = this; + }; + TypeScript.TypeAnnotationSyntax.prototype.kind = function () { + return 210 /* TypeAnnotation */; + }; + TypeScript.ExternalModuleReferenceSyntax = function (data, requireKeyword, openParenToken, stringLiteral, closeParenToken) { + if (data) { + this.__data = data; + } + this.requireKeyword = requireKeyword, this.openParenToken = openParenToken, this.stringLiteral = stringLiteral, this.closeParenToken = closeParenToken; + requireKeyword.parent = this, openParenToken.parent = this, stringLiteral.parent = this, closeParenToken.parent = this; + }; + TypeScript.ExternalModuleReferenceSyntax.prototype.kind = function () { + return 211 /* ExternalModuleReference */; + }; + TypeScript.ModuleNameModuleReferenceSyntax = function (data, moduleName) { + if (data) { + this.__data = data; + } + this.moduleName = moduleName; + moduleName.parent = this; + }; + TypeScript.ModuleNameModuleReferenceSyntax.prototype.kind = function () { + return 212 /* ModuleNameModuleReference */; + }; })(TypeScript || (TypeScript = {})); var TypeScript; (function (TypeScript) { TypeScript.syntaxDiagnosticsTime = 0; var SyntaxTree = (function () { - function SyntaxTree(isConcrete, sourceUnit, isDeclaration, diagnostics, fileName, text, languageVersion) { + function SyntaxTree(sourceUnit, isDeclaration, diagnostics, fileName, text, languageVersion) { this.text = text; - this._allDiagnostics = null; - this._isConcrete = isConcrete; + this._allDiagnostics = undefined; this._sourceUnit = sourceUnit; this._isDeclaration = isDeclaration; this._parserDiagnostics = diagnostics; @@ -26119,9 +27027,6 @@ var TypeScript; this._languageVersion = languageVersion; sourceUnit.syntaxTree = this; } - SyntaxTree.prototype.isConcrete = function () { - return this._isConcrete; - }; SyntaxTree.prototype.sourceUnit = function () { return this._sourceUnit; }; @@ -26137,7 +27042,7 @@ var TypeScript; return diagnostics; }; SyntaxTree.prototype.diagnostics = function () { - if (this._allDiagnostics === null) { + if (!this._allDiagnostics) { var start = new Date().getTime(); this._allDiagnostics = this.computeDiagnostics(); TypeScript.syntaxDiagnosticsTime += new Date().getTime() - start; @@ -26156,7 +27061,7 @@ var TypeScript; SyntaxTree.prototype.cacheSyntaxTreeInfo = function () { var firstToken = firstSyntaxTreeToken(this); var leadingTrivia = firstToken.leadingTrivia(this.text); - this._isExternalModule = externalModuleIndicatorSpanWorker(this, firstToken) !== null; + this._isExternalModule = !!externalModuleIndicatorSpanWorker(this, firstToken); var amdDependencies = []; for (var i = 0, n = leadingTrivia.count(); i < n; i++) { var trivia = leadingTrivia.syntaxTriviaAt(i); @@ -26172,7 +27077,7 @@ var TypeScript; SyntaxTree.prototype.getAmdDependency = function (comment) { var amdDependencyRegEx = /^\/\/\/\s* 0) { return false; } @@ -26310,7 +27214,7 @@ var TypeScript; _super.prototype.visitParameterList.call(this, node); }; GrammarCheckerWalker.prototype.visitHeritageClause = function (node) { - if (this.checkForTrailingComma(node.typeNames) || this.checkForAtLeastOneElement(node, node.typeNames, node.extendsOrImplementsKeyword, TypeScript.SyntaxFacts.getText(node.extendsOrImplementsKeyword.kind()))) { + if (this.checkForTrailingComma(node.typeNames) || this.checkForAtLeastOneElement(node.typeNames, node.extendsOrImplementsKeyword, TypeScript.SyntaxFacts.getText(node.extendsOrImplementsKeyword.kind()))) { return; } _super.prototype.visitHeritageClause.call(this, node); @@ -26322,25 +27226,25 @@ var TypeScript; _super.prototype.visitArgumentList.call(this, node); }; GrammarCheckerWalker.prototype.visitVariableDeclaration = function (node) { - if (this.checkForAtLeastOneElement(node, node.variableDeclarators, node.varKeyword, TypeScript.getLocalizedText(TypeScript.DiagnosticCode.variable_declaration, null)) || this.checkForTrailingComma(node.variableDeclarators)) { + if (this.checkForAtLeastOneElement(node.variableDeclarators, node.varKeyword, TypeScript.getLocalizedText(TypeScript.DiagnosticCode.variable_declaration, undefined)) || this.checkForTrailingComma(node.variableDeclarators)) { return; } _super.prototype.visitVariableDeclaration.call(this, node); }; GrammarCheckerWalker.prototype.visitTypeArgumentList = function (node) { - if (this.checkForTrailingComma(node.typeArguments) || this.checkForAtLeastOneElement(node, node.typeArguments, node.lessThanToken, TypeScript.getLocalizedText(TypeScript.DiagnosticCode.type_argument, null))) { + if (this.checkForTrailingComma(node.typeArguments) || this.checkForAtLeastOneElement(node.typeArguments, node.lessThanToken, TypeScript.getLocalizedText(TypeScript.DiagnosticCode.type_argument, undefined))) { return; } _super.prototype.visitTypeArgumentList.call(this, node); }; GrammarCheckerWalker.prototype.visitTupleType = function (node) { - if (this.checkForTrailingComma(node.types) || this.checkForAtLeastOneElement(node, node.types, node.openBracketToken, TypeScript.getLocalizedText(TypeScript.DiagnosticCode.type, null))) { + if (this.checkForTrailingComma(node.types) || this.checkForAtLeastOneElement(node.types, node.openBracketToken, TypeScript.getLocalizedText(TypeScript.DiagnosticCode.type, undefined))) { return; } _super.prototype.visitTupleType.call(this, node); }; GrammarCheckerWalker.prototype.visitTypeParameterList = function (node) { - if (this.checkForTrailingComma(node.typeParameters) || this.checkForAtLeastOneElement(node, node.typeParameters, node.lessThanToken, TypeScript.getLocalizedText(TypeScript.DiagnosticCode.type_parameter, null))) { + if (this.checkForTrailingComma(node.typeParameters) || this.checkForAtLeastOneElement(node.typeParameters, node.lessThanToken, TypeScript.getLocalizedText(TypeScript.DiagnosticCode.type_parameter, undefined))) { return; } _super.prototype.visitTypeParameterList.call(this, node); @@ -26350,7 +27254,7 @@ var TypeScript; this.pushDiagnostic(node.openBracketToken, TypeScript.DiagnosticCode.Index_signature_must_have_exactly_one_parameter); return true; } - var parameter = node.parameters[0]; + var parameter = TypeScript.nonSeparatorAt(node.parameters, 0); if (parameter.dotDotDotToken) { this.pushDiagnostic(parameter, TypeScript.DiagnosticCode.Index_signatures_cannot_have_rest_parameters); return true; @@ -26371,7 +27275,7 @@ var TypeScript; this.pushDiagnostic(parameter, TypeScript.DiagnosticCode.Index_signature_parameter_must_have_a_type_annotation); return true; } - else if (parameter.typeAnnotation.type.kind() !== 69 /* StringKeyword */ && parameter.typeAnnotation.type.kind() !== 67 /* NumberKeyword */) { + else if (parameter.typeAnnotation.type.kind() !== 71 /* StringKeyword */ && parameter.typeAnnotation.type.kind() !== 69 /* NumberKeyword */) { this.pushDiagnostic(parameter, TypeScript.DiagnosticCode.Index_signature_parameter_type_must_be_string_or_number); return true; } @@ -26393,7 +27297,7 @@ var TypeScript; for (var i = 0, n = node.heritageClauses.length; i < n; i++) { TypeScript.Debug.assert(i <= 2); var heritageClause = node.heritageClauses[i]; - if (heritageClause.extendsOrImplementsKeyword.kind() === 48 /* ExtendsKeyword */) { + if (heritageClause.extendsOrImplementsKeyword.kind() === 50 /* ExtendsKeyword */) { if (seenExtendsClause) { this.pushDiagnostic(heritageClause, TypeScript.DiagnosticCode.extends_clause_already_seen); return true; @@ -26402,14 +27306,14 @@ var TypeScript; this.pushDiagnostic(heritageClause, TypeScript.DiagnosticCode.extends_clause_must_precede_implements_clause); return true; } - if (heritageClause.typeNames.length > 1) { + if (TypeScript.nonSeparatorCount(heritageClause.typeNames) > 1) { this.pushDiagnostic(heritageClause, TypeScript.DiagnosticCode.Classes_can_only_extend_a_single_class); return true; } seenExtendsClause = true; } else { - TypeScript.Debug.assert(heritageClause.extendsOrImplementsKeyword.kind() === 51 /* ImplementsKeyword */); + TypeScript.Debug.assert(heritageClause.extendsOrImplementsKeyword.kind() === 53 /* ImplementsKeyword */); if (seenImplementsClause) { this.pushDiagnostic(heritageClause, TypeScript.DiagnosticCode.implements_clause_already_seen); return true; @@ -26421,7 +27325,7 @@ var TypeScript; }; GrammarCheckerWalker.prototype.checkForDisallowedDeclareModifier = function (modifiers) { if (this.inAmbientDeclaration) { - var declareToken = TypeScript.SyntaxUtilities.getToken(modifiers, 63 /* DeclareKeyword */); + var declareToken = TypeScript.SyntaxUtilities.getToken(modifiers, 65 /* DeclareKeyword */); if (declareToken) { this.pushDiagnostic(declareToken, TypeScript.DiagnosticCode.A_declare_modifier_cannot_be_used_in_an_already_ambient_context); return true; @@ -26431,7 +27335,7 @@ var TypeScript; }; GrammarCheckerWalker.prototype.checkForRequiredDeclareModifier = function (moduleElement, reportToken, modifiers) { if (!this.inAmbientDeclaration && this.syntaxTree.isDeclaration()) { - if (!TypeScript.SyntaxUtilities.containsToken(modifiers, 63 /* DeclareKeyword */)) { + if (!TypeScript.SyntaxUtilities.containsToken(modifiers, 65 /* DeclareKeyword */)) { this.pushDiagnostic(reportToken, TypeScript.DiagnosticCode.A_declare_modifier_is_required_for_a_top_level_declaration_in_a_d_ts_file); return true; } @@ -26442,7 +27346,7 @@ var TypeScript; return; } var savedInAmbientDeclaration = this.inAmbientDeclaration; - this.inAmbientDeclaration = this.inAmbientDeclaration || this.syntaxTree.isDeclaration() || TypeScript.SyntaxUtilities.containsToken(node.modifiers, 63 /* DeclareKeyword */); + this.inAmbientDeclaration = this.inAmbientDeclaration || this.syntaxTree.isDeclaration() || TypeScript.SyntaxUtilities.containsToken(node.modifiers, 65 /* DeclareKeyword */); _super.prototype.visitClassDeclaration.call(this, node); this.inAmbientDeclaration = savedInAmbientDeclaration; }; @@ -26451,7 +27355,7 @@ var TypeScript; for (var i = 0, n = node.heritageClauses.length; i < n; i++) { TypeScript.Debug.assert(i <= 1); var heritageClause = node.heritageClauses[i]; - if (heritageClause.extendsOrImplementsKeyword.kind() === 48 /* ExtendsKeyword */) { + if (heritageClause.extendsOrImplementsKeyword.kind() === 50 /* ExtendsKeyword */) { if (seenExtendsClause) { this.pushDiagnostic(heritageClause, TypeScript.DiagnosticCode.extends_clause_already_seen); return true; @@ -26459,7 +27363,7 @@ var TypeScript; seenExtendsClause = true; } else { - TypeScript.Debug.assert(heritageClause.extendsOrImplementsKeyword.kind() === 51 /* ImplementsKeyword */); + TypeScript.Debug.assert(heritageClause.extendsOrImplementsKeyword.kind() === 53 /* ImplementsKeyword */); this.pushDiagnostic(heritageClause, TypeScript.DiagnosticCode.Interface_declaration_cannot_have_implements_clause); return true; } @@ -26469,7 +27373,7 @@ var TypeScript; GrammarCheckerWalker.prototype.checkInterfaceModifiers = function (modifiers) { for (var i = 0, n = modifiers.length; i < n; i++) { var modifier = modifiers[i]; - if (modifier.kind() === 63 /* DeclareKeyword */) { + if (modifier.kind() === 65 /* DeclareKeyword */) { this.pushDiagnostic(modifier, TypeScript.DiagnosticCode.A_declare_modifier_cannot_be_used_with_an_interface_declaration); return true; } @@ -26499,7 +27403,7 @@ var TypeScript; } seenAccessibilityModifier = true; } - else if (modifier.kind() === 58 /* StaticKeyword */) { + else if (modifier.kind() === 60 /* StaticKeyword */) { if (seenStaticModifier) { this.pushDiagnostic(modifier, TypeScript.DiagnosticCode._0_modifier_already_seen, [modifier.text()]); return true; @@ -26519,8 +27423,20 @@ var TypeScript; } _super.prototype.visitMemberVariableDeclaration.call(this, node); }; + GrammarCheckerWalker.prototype.visitMethodSignature = function (node) { + if (this.checkForTemplatePropertyName(node.propertyName)) { + return; + } + _super.prototype.visitMethodSignature.call(this, node); + }; + GrammarCheckerWalker.prototype.visitPropertySignature = function (node) { + if (this.checkForTemplatePropertyName(node.propertyName)) { + return; + } + _super.prototype.visitPropertySignature.call(this, node); + }; GrammarCheckerWalker.prototype.visitMemberFunctionDeclaration = function (node) { - if (this.checkClassElementModifiers(node.modifiers)) { + if (this.checkClassElementModifiers(node.modifiers) || this.checkForTemplatePropertyName(node.propertyName)) { return; } _super.prototype.visitMemberFunctionDeclaration.call(this, node); @@ -26540,12 +27456,12 @@ var TypeScript; }; GrammarCheckerWalker.prototype.checkIndexMemberModifiers = function (node) { if (node.modifiers.length > 0) { - this.pushDiagnostic(TypeScript.childAt(node.modifiers, 0), TypeScript.DiagnosticCode.Modifiers_cannot_appear_here); + this.pushDiagnostic(node.modifiers[0], TypeScript.DiagnosticCode.Modifiers_cannot_appear_here); return true; } return false; }; - GrammarCheckerWalker.prototype.checkEcmaScriptVersionIsAtLeast = function (parent, reportToken, languageVersion, diagnosticKey) { + GrammarCheckerWalker.prototype.checkEcmaScriptVersionIsAtLeast = function (reportToken, languageVersion, diagnosticKey) { if (this.syntaxTree.languageVersion() < languageVersion) { this.pushDiagnostic(reportToken, diagnosticKey); return true; @@ -26559,7 +27475,7 @@ var TypeScript; this.inObjectLiteralExpression = savedInObjectLiteralExpression; }; GrammarCheckerWalker.prototype.visitGetAccessor = function (node) { - if (this.checkForAccessorDeclarationInAmbientContext(node) || this.checkEcmaScriptVersionIsAtLeast(node, node.propertyName, 1 /* ES5 */, TypeScript.DiagnosticCode.Accessors_are_only_available_when_targeting_ECMAScript_5_and_higher) || this.checkForDisallowedModifiers(node, node.modifiers) || this.checkClassElementModifiers(node.modifiers) || this.checkForDisallowedAccessorTypeParameters(node.callSignature) || this.checkGetAccessorParameter(node)) { + if (this.checkForAccessorDeclarationInAmbientContext(node) || this.checkEcmaScriptVersionIsAtLeast(node.propertyName, 1 /* ES5 */, TypeScript.DiagnosticCode.Accessors_are_only_available_when_targeting_ECMAScript_5_and_higher) || this.checkForDisallowedModifiers(node.modifiers) || this.checkClassElementModifiers(node.modifiers) || this.checkForDisallowedAccessorTypeParameters(node.callSignature) || this.checkGetAccessorParameter(node) || this.checkForTemplatePropertyName(node.propertyName)) { return; } _super.prototype.visitGetAccessor.call(this, node); @@ -26572,7 +27488,7 @@ var TypeScript; return false; }; GrammarCheckerWalker.prototype.checkForDisallowedAccessorTypeParameters = function (callSignature) { - if (callSignature.typeParameterList !== null) { + if (callSignature.typeParameterList) { this.pushDiagnostic(callSignature.typeParameterList, TypeScript.DiagnosticCode.Type_parameters_cannot_appear_on_an_accessor); return true; } @@ -26587,11 +27503,11 @@ var TypeScript; }; GrammarCheckerWalker.prototype.checkSetAccessorParameter = function (node) { var parameters = node.callSignature.parameterList.parameters; - if (TypeScript.childCount(parameters) !== 1) { + if (TypeScript.nonSeparatorCount(parameters) !== 1) { this.pushDiagnostic(node.propertyName, TypeScript.DiagnosticCode.set_accessor_must_have_exactly_one_parameter); return true; } - var parameter = parameters[0]; + var parameter = TypeScript.nonSeparatorAt(parameters, 0); if (parameter.questionToken) { this.pushDiagnostic(parameter, TypeScript.DiagnosticCode.set_accessor_parameter_cannot_be_optional); return true; @@ -26606,8 +27522,14 @@ var TypeScript; } return false; }; + GrammarCheckerWalker.prototype.visitSimplePropertyAssignment = function (node) { + if (this.checkForTemplatePropertyName(node.propertyName)) { + return; + } + _super.prototype.visitSimplePropertyAssignment.call(this, node); + }; GrammarCheckerWalker.prototype.visitSetAccessor = function (node) { - if (this.checkForAccessorDeclarationInAmbientContext(node) || this.checkEcmaScriptVersionIsAtLeast(node, node.propertyName, 1 /* ES5 */, TypeScript.DiagnosticCode.Accessors_are_only_available_when_targeting_ECMAScript_5_and_higher) || this.checkForDisallowedModifiers(node, node.modifiers) || this.checkClassElementModifiers(node.modifiers) || this.checkForDisallowedAccessorTypeParameters(node.callSignature) || this.checkForDisallowedSetAccessorTypeAnnotation(node) || this.checkSetAccessorParameter(node)) { + if (this.checkForAccessorDeclarationInAmbientContext(node) || this.checkEcmaScriptVersionIsAtLeast(node.propertyName, 1 /* ES5 */, TypeScript.DiagnosticCode.Accessors_are_only_available_when_targeting_ECMAScript_5_and_higher) || this.checkForDisallowedModifiers(node.modifiers) || this.checkClassElementModifiers(node.modifiers) || this.checkForDisallowedAccessorTypeParameters(node.callSignature) || this.checkForDisallowedSetAccessorTypeAnnotation(node) || this.checkSetAccessorParameter(node) || this.checkForTemplatePropertyName(node.propertyName)) { return; } _super.prototype.visitSetAccessor.call(this, node); @@ -26617,29 +27539,29 @@ var TypeScript; return; } var savedInAmbientDeclaration = this.inAmbientDeclaration; - this.inAmbientDeclaration = this.inAmbientDeclaration || this.syntaxTree.isDeclaration() || TypeScript.SyntaxUtilities.containsToken(node.modifiers, 63 /* DeclareKeyword */); + this.inAmbientDeclaration = this.inAmbientDeclaration || this.syntaxTree.isDeclaration() || TypeScript.SyntaxUtilities.containsToken(node.modifiers, 65 /* DeclareKeyword */); _super.prototype.visitEnumDeclaration.call(this, node); this.inAmbientDeclaration = savedInAmbientDeclaration; }; GrammarCheckerWalker.prototype.checkEnumElements = function (node) { var previousValueWasComputed = false; - for (var i = 0, n = TypeScript.childCount(node.enumElements); i < n; i++) { - var child = TypeScript.childAt(node.enumElements, i); - if (i % 2 === 0) { - var enumElement = child; - if (!enumElement.equalsValueClause && previousValueWasComputed) { - this.pushDiagnostic(enumElement, TypeScript.DiagnosticCode.Enum_member_must_have_initializer); - return true; - } - if (enumElement.equalsValueClause) { - var value = enumElement.equalsValueClause.value; - previousValueWasComputed = !TypeScript.Syntax.isIntegerLiteral(value); - } + for (var i = 0, n = TypeScript.nonSeparatorCount(node.enumElements); i < n; i++) { + var enumElement = TypeScript.nonSeparatorAt(node.enumElements, i); + if (!enumElement.equalsValueClause && previousValueWasComputed) { + this.pushDiagnostic(enumElement, TypeScript.DiagnosticCode.Enum_member_must_have_initializer); + return true; + } + if (enumElement.equalsValueClause) { + var value = enumElement.equalsValueClause.value; + previousValueWasComputed = !TypeScript.Syntax.isIntegerLiteral(value); } } return false; }; GrammarCheckerWalker.prototype.visitEnumElement = function (node) { + if (this.checkForTemplatePropertyName(node.propertyName)) { + return; + } if (this.inAmbientDeclaration && node.equalsValueClause) { var expression = node.equalsValueClause.value; if (!TypeScript.Syntax.isIntegerLiteral(expression)) { @@ -26650,7 +27572,7 @@ var TypeScript; _super.prototype.visitEnumElement.call(this, node); }; GrammarCheckerWalker.prototype.visitInvocationExpression = function (node) { - if (node.expression.kind() === 50 /* SuperKeyword */ && node.argumentList.typeArgumentList !== null) { + if (node.expression.kind() === 52 /* SuperKeyword */ && node.argumentList.typeArgumentList) { this.pushDiagnostic(node, TypeScript.DiagnosticCode.super_invocation_cannot_have_type_arguments); } _super.prototype.visitInvocationExpression.call(this, node); @@ -26660,24 +27582,24 @@ var TypeScript; var seenDeclareModifier = false; for (var i = 0, n = modifiers.length; i < n; i++) { var modifier = modifiers[i]; - if (TypeScript.SyntaxFacts.isAccessibilityModifier(modifier.kind()) || modifier.kind() === 58 /* StaticKeyword */) { + if (TypeScript.SyntaxFacts.isAccessibilityModifier(modifier.kind()) || modifier.kind() === 60 /* StaticKeyword */) { this.pushDiagnostic(modifier, TypeScript.DiagnosticCode._0_modifier_cannot_appear_on_a_module_element, [modifier.text()]); return true; } - if (modifier.kind() === 63 /* DeclareKeyword */) { + if (modifier.kind() === 65 /* DeclareKeyword */) { if (seenDeclareModifier) { this.pushDiagnostic(modifier, TypeScript.DiagnosticCode.Accessibility_modifier_already_seen); return; } seenDeclareModifier = true; } - else if (modifier.kind() === 47 /* ExportKeyword */) { + else if (modifier.kind() === 49 /* ExportKeyword */) { if (seenExportModifier) { this.pushDiagnostic(modifier, TypeScript.DiagnosticCode._0_modifier_already_seen, [modifier.text()]); return; } if (seenDeclareModifier) { - this.pushDiagnostic(modifier, TypeScript.DiagnosticCode._0_modifier_must_precede_1_modifier, [TypeScript.SyntaxFacts.getText(47 /* ExportKeyword */), TypeScript.SyntaxFacts.getText(63 /* DeclareKeyword */)]); + this.pushDiagnostic(modifier, TypeScript.DiagnosticCode._0_modifier_must_precede_1_modifier, [TypeScript.SyntaxFacts.getText(49 /* ExportKeyword */), TypeScript.SyntaxFacts.getText(65 /* DeclareKeyword */)]); return; } seenExportModifier = true; @@ -26689,9 +27611,9 @@ var TypeScript; if (!node.stringLiteral) { for (var i = 0, n = node.moduleElements.length; i < n; i++) { var child = node.moduleElements[i]; - if (child.kind() === 134 /* ImportDeclaration */) { + if (child.kind() === 138 /* ImportDeclaration */) { var importDeclaration = child; - if (importDeclaration.moduleReference.kind() === 246 /* ExternalModuleReference */) { + if (importDeclaration.moduleReference.kind() === 211 /* ExternalModuleReference */) { this.pushDiagnostic(importDeclaration, TypeScript.DiagnosticCode.Import_declarations_in_an_internal_module_cannot_reference_an_external_module); } } @@ -26700,7 +27622,7 @@ var TypeScript; return false; }; GrammarCheckerWalker.prototype.checkForDisallowedDeclareModifierOnImportDeclaration = function (modifiers) { - var declareToken = TypeScript.SyntaxUtilities.getToken(modifiers, 63 /* DeclareKeyword */); + var declareToken = TypeScript.SyntaxUtilities.getToken(modifiers, 65 /* DeclareKeyword */); if (declareToken) { this.pushDiagnostic(declareToken, TypeScript.DiagnosticCode.A_declare_modifier_cannot_be_used_with_an_import_declaration); return true; @@ -26717,7 +27639,7 @@ var TypeScript; return; } if (node.stringLiteral) { - if (!this.inAmbientDeclaration && !TypeScript.SyntaxUtilities.containsToken(node.modifiers, 63 /* DeclareKeyword */)) { + if (!this.inAmbientDeclaration && !TypeScript.SyntaxUtilities.containsToken(node.modifiers, 65 /* DeclareKeyword */)) { this.pushDiagnostic(node.stringLiteral, TypeScript.DiagnosticCode.Only_ambient_modules_can_use_quoted_names); return; } @@ -26726,14 +27648,14 @@ var TypeScript; return; } var savedInAmbientDeclaration = this.inAmbientDeclaration; - this.inAmbientDeclaration = this.inAmbientDeclaration || this.syntaxTree.isDeclaration() || TypeScript.SyntaxUtilities.containsToken(node.modifiers, 63 /* DeclareKeyword */); + this.inAmbientDeclaration = this.inAmbientDeclaration || this.syntaxTree.isDeclaration() || TypeScript.SyntaxUtilities.containsToken(node.modifiers, 65 /* DeclareKeyword */); _super.prototype.visitModuleDeclaration.call(this, node); this.inAmbientDeclaration = savedInAmbientDeclaration; }; GrammarCheckerWalker.prototype.checkForDisallowedExportAssignment = function (node) { for (var i = 0, n = node.moduleElements.length; i < n; i++) { var child = node.moduleElements[i]; - if (child.kind() === 135 /* ExportAssignment */) { + if (child.kind() === 139 /* ExportAssignment */) { this.pushDiagnostic(child, TypeScript.DiagnosticCode.Export_assignment_cannot_be_used_in_internal_modules); return true; } @@ -26807,7 +27729,7 @@ var TypeScript; }; GrammarCheckerWalker.prototype.inSwitchStatement = function (ast) { while (ast) { - if (ast.kind() === 152 /* SwitchStatement */) { + if (ast.kind() === 156 /* SwitchStatement */) { return true; } if (TypeScript.SyntaxUtilities.isAnyFunctionExpressionOrDeclaration(ast)) { @@ -26819,10 +27741,10 @@ var TypeScript; }; GrammarCheckerWalker.prototype.isIterationStatement = function (ast) { switch (ast.kind()) { - case 155 /* ForStatement */: - case 156 /* ForInStatement */: - case 159 /* WhileStatement */: - case 162 /* DoStatement */: + case 159 /* ForStatement */: + case 160 /* ForInStatement */: + case 163 /* WhileStatement */: + case 166 /* DoStatement */: return true; } return false; @@ -26843,7 +27765,7 @@ var TypeScript; var result = []; element = element.parent; while (element) { - if (element.kind() === 161 /* LabeledStatement */) { + if (element.kind() === 165 /* LabeledStatement */) { var labeledStatement = element; if (breakable) { result.push(labeledStatement); @@ -26863,12 +27785,12 @@ var TypeScript; }; GrammarCheckerWalker.prototype.labelIsOnContinuableConstruct = function (statement) { switch (statement.kind()) { - case 161 /* LabeledStatement */: + case 165 /* LabeledStatement */: return this.labelIsOnContinuableConstruct(statement.statement); - case 159 /* WhileStatement */: - case 155 /* ForStatement */: - case 156 /* ForInStatement */: - case 162 /* DoStatement */: + case 163 /* WhileStatement */: + case 159 /* ForStatement */: + case 160 /* ForInStatement */: + case 166 /* DoStatement */: return true; default: return false; @@ -27023,21 +27945,21 @@ var TypeScript; } return false; }; - GrammarCheckerWalker.prototype.checkForDisallowedModifiers = function (parent, modifiers) { + GrammarCheckerWalker.prototype.checkForDisallowedModifiers = function (modifiers) { if (this.inBlock || this.inObjectLiteralExpression) { if (modifiers.length > 0) { - this.pushDiagnostic(TypeScript.childAt(modifiers, 0), TypeScript.DiagnosticCode.Modifiers_cannot_appear_here); + this.pushDiagnostic(modifiers[0], TypeScript.DiagnosticCode.Modifiers_cannot_appear_here); return true; } } return false; }; GrammarCheckerWalker.prototype.visitFunctionDeclaration = function (node) { - if (this.checkForDisallowedDeclareModifier(node.modifiers) || this.checkForDisallowedModifiers(node, node.modifiers) || this.checkForRequiredDeclareModifier(node, node.identifier, node.modifiers) || this.checkModuleElementModifiers(node.modifiers) || this.checkForDisallowedEvalOrArguments(node, node.identifier)) { + if (this.checkForDisallowedDeclareModifier(node.modifiers) || this.checkForDisallowedModifiers(node.modifiers) || this.checkForRequiredDeclareModifier(node, node.identifier, node.modifiers) || this.checkModuleElementModifiers(node.modifiers) || this.checkForDisallowedEvalOrArguments(node, node.identifier)) { return; } var savedInAmbientDeclaration = this.inAmbientDeclaration; - this.inAmbientDeclaration = this.inAmbientDeclaration || this.syntaxTree.isDeclaration() || TypeScript.SyntaxUtilities.containsToken(node.modifiers, 63 /* DeclareKeyword */); + this.inAmbientDeclaration = this.inAmbientDeclaration || this.syntaxTree.isDeclaration() || TypeScript.SyntaxUtilities.containsToken(node.modifiers, 65 /* DeclareKeyword */); _super.prototype.visitFunctionDeclaration.call(this, node); this.inAmbientDeclaration = savedInAmbientDeclaration; }; @@ -27047,26 +27969,32 @@ var TypeScript; } _super.prototype.visitFunctionExpression.call(this, node); }; + GrammarCheckerWalker.prototype.visitFunctionPropertyAssignment = function (node) { + if (this.checkForTemplatePropertyName(node.propertyName)) { + return; + } + _super.prototype.visitFunctionPropertyAssignment.call(this, node); + }; GrammarCheckerWalker.prototype.visitVariableStatement = function (node) { - if (this.checkForDisallowedDeclareModifier(node.modifiers) || this.checkForDisallowedModifiers(node, node.modifiers) || this.checkForRequiredDeclareModifier(node, node.variableDeclaration.varKeyword, node.modifiers) || this.checkModuleElementModifiers(node.modifiers)) { + if (this.checkForDisallowedDeclareModifier(node.modifiers) || this.checkForDisallowedModifiers(node.modifiers) || this.checkForRequiredDeclareModifier(node, node.variableDeclaration.varKeyword, node.modifiers) || this.checkModuleElementModifiers(node.modifiers)) { return; } var savedInAmbientDeclaration = this.inAmbientDeclaration; - this.inAmbientDeclaration = this.inAmbientDeclaration || this.syntaxTree.isDeclaration() || TypeScript.SyntaxUtilities.containsToken(node.modifiers, 63 /* DeclareKeyword */); + this.inAmbientDeclaration = this.inAmbientDeclaration || this.syntaxTree.isDeclaration() || TypeScript.SyntaxUtilities.containsToken(node.modifiers, 65 /* DeclareKeyword */); _super.prototype.visitVariableStatement.call(this, node); this.inAmbientDeclaration = savedInAmbientDeclaration; }; - GrammarCheckerWalker.prototype.checkListSeparators = function (parent, list, kind) { - for (var i = 0, n = TypeScript.childCount(list); i < n; i++) { - var child = TypeScript.childAt(list, i); - if (i % 2 === 1 && child.kind() !== kind) { + GrammarCheckerWalker.prototype.checkListSeparators = function (list, kind) { + for (var i = 0, n = TypeScript.separatorCount(list); i < n; i++) { + var child = TypeScript.separatorAt(list, i); + if (child.kind() !== kind) { this.pushDiagnostic(child, TypeScript.DiagnosticCode._0_expected, [TypeScript.SyntaxFacts.getText(kind)]); } } return false; }; GrammarCheckerWalker.prototype.visitObjectType = function (node) { - if (this.checkListSeparators(node, node.typeMembers, 78 /* SemicolonToken */)) { + if (this.checkListSeparators(node.typeMembers, 80 /* SemicolonToken */)) { return; } var savedInAmbientDeclaration = this.inAmbientDeclaration; @@ -27093,13 +28021,20 @@ var TypeScript; this.inAmbientDeclaration = savedInAmbientDeclaration; }; GrammarCheckerWalker.prototype.visitVariableDeclarator = function (node) { - if (this.checkVariableDeclaratorInitializer(node) || this.checkVariableDeclaratorIdentifier(node)) { + if (this.checkVariableDeclaratorInitializer(node) || this.checkVariableDeclaratorIdentifier(node) || this.checkForTemplatePropertyName(node.propertyName)) { return; } _super.prototype.visitVariableDeclarator.call(this, node); }; + GrammarCheckerWalker.prototype.checkForTemplatePropertyName = function (token) { + if (token.kind() === 13 /* NoSubstitutionTemplateToken */) { + this.pushDiagnostic(token, TypeScript.DiagnosticCode.Template_literal_cannot_be_used_as_an_element_name); + return true; + } + return false; + }; GrammarCheckerWalker.prototype.checkVariableDeclaratorIdentifier = function (node) { - if (node.parent.kind() !== 137 /* MemberVariableDeclaration */) { + if (node.parent.kind() !== 141 /* MemberVariableDeclaration */) { if (this.checkForDisallowedEvalOrArguments(node, node.propertyName)) { return true; } @@ -27122,7 +28057,7 @@ var TypeScript; GrammarCheckerWalker.prototype.checkConstructorModifiers = function (modifiers) { for (var i = 0, n = modifiers.length; i < n; i++) { var child = modifiers[i]; - if (child.kind() !== 57 /* PublicKeyword */) { + if (child.kind() !== 59 /* PublicKeyword */) { this.pushDiagnostic(child, TypeScript.DiagnosticCode._0_modifier_cannot_appear_on_a_constructor_declaration, [TypeScript.SyntaxFacts.getText(child.kind())]); return true; } @@ -27177,15 +28112,15 @@ var TypeScript; return false; }; GrammarCheckerWalker.prototype.isPreIncrementOrDecrementExpression = function (node) { - switch (node.kind()) { - case 170 /* PreDecrementExpression */: - case 169 /* PreIncrementExpression */: + switch (node.operatorToken.kind()) { + case 96 /* MinusMinusToken */: + case 95 /* PlusPlusToken */: return true; } return false; }; GrammarCheckerWalker.prototype.visitDeleteExpression = function (node) { - if (TypeScript.parsedInStrictMode(node) && node.expression.kind() === 11 /* IdentifierName */) { + if (TypeScript.parsedInStrictMode(node) && node.expression.kind() === 9 /* IdentifierName */) { this.pushDiagnostic(TypeScript.firstToken(node), TypeScript.DiagnosticCode.delete_cannot_be_called_on_an_identifier_in_strict_mode); return; } @@ -27199,16 +28134,16 @@ var TypeScript; return false; }; GrammarCheckerWalker.prototype.getEvalOrArguments = function (expr) { - if (expr.kind() === 11 /* IdentifierName */) { + if (expr.kind() === 9 /* IdentifierName */) { var text = TypeScript.tokenValueText(expr); if (text === "eval" || text === "arguments") { return text; } } - return null; + return undefined; }; GrammarCheckerWalker.prototype.isEvalOrArguments = function (expr) { - return this.getEvalOrArguments(expr) !== null; + return !!this.getEvalOrArguments(expr); }; GrammarCheckerWalker.prototype.visitConstraint = function (node) { if (this.checkConstraintType(node)) { @@ -27250,7 +28185,7 @@ var TypeScript; } } } - return null; + return undefined; } function implicitImportSpanWorker(trivia) { var implicitImportRegEx = /^(\/\/\/\s*/gim; @@ -27258,24 +28193,24 @@ var TypeScript; if (match) { return new TypeScript.TextSpan(trivia.fullStart(), trivia.fullWidth()); } - return null; + return undefined; } function topLevelImportOrExportSpan(node) { for (var i = 0, n = node.moduleElements.length; i < n; i++) { var moduleElement = node.moduleElements[i]; var _firstToken = TypeScript.firstToken(moduleElement); - if (_firstToken !== null && _firstToken.kind() === 47 /* ExportKeyword */) { + if (_firstToken && _firstToken.kind() === 49 /* ExportKeyword */) { return new TypeScript.TextSpan(TypeScript.start(_firstToken), TypeScript.width(_firstToken)); } - if (moduleElement.kind() === 134 /* ImportDeclaration */) { + if (moduleElement.kind() === 138 /* ImportDeclaration */) { var importDecl = moduleElement; - if (importDecl.moduleReference.kind() === 246 /* ExternalModuleReference */) { + if (importDecl.moduleReference.kind() === 211 /* ExternalModuleReference */) { var literal = importDecl.moduleReference.stringLiteral; return new TypeScript.TextSpan(TypeScript.start(literal), TypeScript.width(literal)); } } } - return null; + return undefined; } })(TypeScript || (TypeScript = {})); var TypeScript; @@ -27360,8 +28295,8 @@ var TypeScript; _scannerParserSource = TypeScript.Scanner.createParserSource(oldSyntaxTree.fileName(), text, oldSyntaxTree.languageVersion()); function release() { _scannerParserSource.release(); - _scannerParserSource = null; - _oldSourceUnitCursor = null; + _scannerParserSource = undefined; + _oldSourceUnitCursor = undefined; _outstandingRewindPointCount = 0; } function extendToAffectedRange(changeRange, sourceUnit) { @@ -27397,11 +28332,11 @@ var TypeScript; _changeDelta = rewindPoint.changeDelta; returnSyntaxCursor(_oldSourceUnitCursor); _oldSourceUnitCursor = rewindPoint.oldSourceUnitCursor; - rewindPoint.oldSourceUnitCursor = null; + rewindPoint.oldSourceUnitCursor = undefined; _scannerParserSource.rewind(rewindPoint); } function releaseRewindPoint(rewindPoint) { - if (rewindPoint.oldSourceUnitCursor !== null) { + if (rewindPoint.oldSourceUnitCursor) { returnSyntaxCursor(rewindPoint.oldSourceUnitCursor); } _scannerParserSource.releaseRewindPoint(rewindPoint); @@ -27415,34 +28350,53 @@ var TypeScript; if (isPinned()) { return false; } - if (_changeRange !== null && _changeRangeNewSpan.intersectsWithPosition(absolutePosition())) { + if (_changeRange && _changeRangeNewSpan.intersectsWithPosition(absolutePosition())) { return false; } syncCursorToNewTextIfBehind(); return _changeDelta === 0 && !_oldSourceUnitCursor.isFinished(); } function updateTokens(nodeOrToken) { - var position = absolutePosition(); - var tokenWasMoved = isPastChangeRange() && TypeScript.fullStart(nodeOrToken) !== position; - if (tokenWasMoved) { - setTokenFullStartWalker.position = position; - TypeScript.visitNodeOrToken(setTokenFullStartWalker, nodeOrToken); + if (isPastChangeRange()) { + var position = absolutePosition(); + if (TypeScript.isToken(nodeOrToken)) { + nodeOrToken.setFullStart(position); + } + else { + var tokens = getTokens(nodeOrToken); + for (var i = 0, n = tokens.length; i < n; i++) { + var token = tokens[i]; + token.setFullStart(position); + position += token.fullWidth(); + } + } } } + function getTokens(node) { + var tokens = node.__cachedTokens; + if (!tokens) { + tokens = []; + tokenCollectorWalker.tokens = tokens; + TypeScript.visitNodeOrToken(tokenCollectorWalker, node); + node.__cachedTokens = tokens; + tokenCollectorWalker.tokens = undefined; + } + return tokens; + } function currentNode() { if (canReadFromOldSourceUnit()) { var node = tryGetNodeFromOldSourceUnit(); - if (node !== null) { + if (node) { updateTokens(node); return node; } } - return null; + return undefined; } function currentToken() { if (canReadFromOldSourceUnit()) { var token = tryGetTokenFromOldSourceUnit(); - if (token !== null) { + if (token) { updateTokens(token); return token; } @@ -27476,8 +28430,8 @@ var TypeScript; function tryGetNodeFromOldSourceUnit() { while (true) { var node = _oldSourceUnitCursor.currentNode(); - if (node === null) { - return null; + if (node === undefined) { + return undefined; } if (!intersectsWithChangeRangeSpanInOriginalText(absolutePosition(), TypeScript.fullWidth(node))) { var isIncrementallyUnusuable = TypeScript.isIncrementallyUnusable(node); @@ -27489,7 +28443,7 @@ var TypeScript; } } function canReuseTokenFromOldSourceUnit(position, token) { - if (token !== null) { + if (token) { if (!intersectsWithChangeRangeSpanInOriginalText(position, token.fullWidth())) { if (!token.isIncrementallyUnusable() && !TypeScript.Scanner.isContextualToken(token)) { return true; @@ -27500,12 +28454,12 @@ var TypeScript; } function tryGetTokenFromOldSourceUnit() { var token = _oldSourceUnitCursor.currentToken(); - return canReuseTokenFromOldSourceUnit(absolutePosition(), token) ? token : null; + return canReuseTokenFromOldSourceUnit(absolutePosition(), token) ? token : undefined; } function peekToken(n) { if (canReadFromOldSourceUnit()) { var token = tryPeekTokenFromOldSourceUnit(n); - if (token !== null) { + if (token) { return token; } } @@ -27524,13 +28478,13 @@ var TypeScript; for (var i = 0; i < n; i++) { var interimToken = _oldSourceUnitCursor.currentToken(); if (!canReuseTokenFromOldSourceUnit(currentPosition, interimToken)) { - return null; + return undefined; } currentPosition += interimToken.fullWidth(); _oldSourceUnitCursor.moveToNextSibling(); } var token = _oldSourceUnitCursor.currentToken(); - return canReuseTokenFromOldSourceUnit(currentPosition, token) ? token : null; + return canReuseTokenFromOldSourceUnit(currentPosition, token) ? token : undefined; } function consumeNode(node) { _oldSourceUnitCursor.moveToNextSibling(); @@ -27549,13 +28503,13 @@ var TypeScript; if (!isPastChangeRange()) { if (absolutePosition() >= _changeRangeNewSpan.end()) { _changeDelta += _changeRange.newLength() - _changeRange.span().length(); - _changeRange = null; + _changeRange = undefined; } } } } function isPastChangeRange() { - return _changeRange === null; + return _changeRange === undefined; } return { text: text, @@ -27588,7 +28542,7 @@ var TypeScript; var cursor = syntaxCursorPoolCount > 0 ? syntaxCursorPool[syntaxCursorPoolCount - 1] : createSyntaxCursor(); if (syntaxCursorPoolCount > 0) { syntaxCursorPoolCount--; - syntaxCursorPool[syntaxCursorPoolCount] = null; + syntaxCursorPool[syntaxCursorPoolCount] = undefined; } return cursor; } @@ -27603,10 +28557,10 @@ var TypeScript; function clean() { for (var i = 0, n = pieces.length; i < n; i++) { var piece = pieces[i]; - if (piece.element === null) { + if (piece.element === undefined) { break; } - piece.element = null; + piece.element = undefined; piece.indexInParent = -1; } currentPieceIndex = -1; @@ -27614,7 +28568,7 @@ var TypeScript; function deepCopyFrom(other) { for (var i = 0, n = other.pieces.length; i < n; i++) { var piece = other.pieces[i]; - if (piece.element === null) { + if (piece.element === undefined) { break; } pushElement(piece.element, piece.indexInParent); @@ -27625,18 +28579,21 @@ var TypeScript; } function currentNodeOrToken() { if (isFinished()) { - return null; + return undefined; } var result = pieces[currentPieceIndex].element; return result; } function currentNode() { var element = currentNodeOrToken(); - return TypeScript.isNode(element) ? element : null; + return TypeScript.isNode(element) ? element : undefined; + } + function isEmptyList(element) { + return TypeScript.isList(element) && element.length === 0; } function moveToFirstChild() { var nodeOrToken = currentNodeOrToken(); - if (nodeOrToken === null) { + if (nodeOrToken === undefined) { return; } if (TypeScript.isToken(nodeOrToken)) { @@ -27644,7 +28601,7 @@ var TypeScript; } for (var i = 0, n = TypeScript.childCount(nodeOrToken); i < n; i++) { var child = TypeScript.childAt(nodeOrToken, i); - if (child !== null && !TypeScript.isShared(child)) { + if (child && !isEmptyList(child)) { pushElement(child, i); moveToFirstChildIfList(); return; @@ -27658,21 +28615,21 @@ var TypeScript; var parent = currentPiece.element.parent; for (var i = currentPiece.indexInParent + 1, n = TypeScript.childCount(parent); i < n; i++) { var sibling = TypeScript.childAt(parent, i); - if (sibling !== null && !TypeScript.isShared(sibling)) { + if (sibling && !isEmptyList(sibling)) { currentPiece.element = sibling; currentPiece.indexInParent = i; moveToFirstChildIfList(); return; } } - currentPiece.element = null; + currentPiece.element = undefined; currentPiece.indexInParent = -1; currentPieceIndex--; } } function moveToFirstChildIfList() { var element = pieces[currentPieceIndex].element; - if (TypeScript.isList(element) || TypeScript.isSeparatedList(element)) { + if (TypeScript.isList(element)) { pushElement(TypeScript.childAt(element, 0), 0); } } @@ -27700,7 +28657,7 @@ var TypeScript; function currentToken() { moveToFirstToken(); var element = currentNodeOrToken(); - return element === null ? null : element; + return element; } return { pieces: pieces, @@ -27716,21 +28673,19 @@ var TypeScript; deepCopyFrom: deepCopyFrom }; } - var SetTokenFullStartWalker = (function (_super) { - __extends(SetTokenFullStartWalker, _super); - function SetTokenFullStartWalker() { + var TokenCollectorWalker = (function (_super) { + __extends(TokenCollectorWalker, _super); + function TokenCollectorWalker() { _super.apply(this, arguments); + this.tokens = []; } - SetTokenFullStartWalker.prototype.visitToken = function (token) { - var position = this.position; - token.setFullStart(position); - this.position = position + token.fullWidth(); + TokenCollectorWalker.prototype.visitToken = function (token) { + this.tokens.push(token); }; - return SetTokenFullStartWalker; + return TokenCollectorWalker; })(TypeScript.SyntaxWalker); - var setTokenFullStartWalker = new SetTokenFullStartWalker(); + var tokenCollectorWalker = new TokenCollectorWalker(); function parse(oldSyntaxTree, textChangeRange, newText) { - TypeScript.Debug.assert(oldSyntaxTree.isConcrete(), "Can only incrementally parse a concrete syntax tree."); if (textChangeRange.isUnchanged()) { return oldSyntaxTree; } @@ -27759,10 +28714,10 @@ var ts; } function autoCollapse(node) { switch (node.kind) { - case 182 /* ModuleBlock */: - case 177 /* ClassDeclaration */: - case 178 /* InterfaceDeclaration */: - case 180 /* EnumDeclaration */: + case 189 /* ModuleBlock */: + case 184 /* ClassDeclaration */: + case 185 /* InterfaceDeclaration */: + case 187 /* EnumDeclaration */: return false; } return true; @@ -27774,11 +28729,11 @@ var ts; return; } switch (n.kind) { - case 151 /* Block */: + case 158 /* Block */: var parent = n.parent; - var openBrace = ts.findChildOfKind(n, 9 /* OpenBraceToken */, sourceFile); - var closeBrace = ts.findChildOfKind(n, 10 /* CloseBraceToken */, sourceFile); - if (parent.kind === 156 /* DoStatement */ || parent.kind === 159 /* ForInStatement */ || parent.kind === 158 /* ForStatement */ || parent.kind === 155 /* IfStatement */ || parent.kind === 157 /* WhileStatement */ || parent.kind === 163 /* WithStatement */) { + var openBrace = ts.findChildOfKind(n, 13 /* OpenBraceToken */, sourceFile); + var closeBrace = ts.findChildOfKind(n, 14 /* CloseBraceToken */, sourceFile); + if (parent.kind === 163 /* DoStatement */ || parent.kind === 166 /* ForInStatement */ || parent.kind === 165 /* ForStatement */ || parent.kind === 162 /* IfStatement */ || parent.kind === 164 /* WhileStatement */ || parent.kind === 170 /* WithStatement */) { addOutliningSpan(parent, openBrace, closeBrace, autoCollapse(n)); } else { @@ -27791,27 +28746,27 @@ var ts; }); } break; - case 176 /* FunctionBlock */: - case 182 /* ModuleBlock */: - case 170 /* TryBlock */: - case 171 /* CatchBlock */: - case 172 /* FinallyBlock */: - var openBrace = ts.findChildOfKind(n, 9 /* OpenBraceToken */, sourceFile); - var closeBrace = ts.findChildOfKind(n, 10 /* CloseBraceToken */, sourceFile); + case 183 /* FunctionBlock */: + case 189 /* ModuleBlock */: + case 177 /* TryBlock */: + case 178 /* CatchBlock */: + case 179 /* FinallyBlock */: + var openBrace = ts.findChildOfKind(n, 13 /* OpenBraceToken */, sourceFile); + var closeBrace = ts.findChildOfKind(n, 14 /* CloseBraceToken */, sourceFile); addOutliningSpan(n.parent, openBrace, closeBrace, autoCollapse(n)); break; - case 177 /* ClassDeclaration */: - case 178 /* InterfaceDeclaration */: - case 180 /* EnumDeclaration */: - case 136 /* ObjectLiteral */: - case 164 /* SwitchStatement */: - var openBrace = ts.findChildOfKind(n, 9 /* OpenBraceToken */, sourceFile); - var closeBrace = ts.findChildOfKind(n, 10 /* CloseBraceToken */, sourceFile); + case 184 /* ClassDeclaration */: + case 185 /* InterfaceDeclaration */: + case 187 /* EnumDeclaration */: + case 140 /* ObjectLiteral */: + case 171 /* SwitchStatement */: + var openBrace = ts.findChildOfKind(n, 13 /* OpenBraceToken */, sourceFile); + var closeBrace = ts.findChildOfKind(n, 14 /* CloseBraceToken */, sourceFile); addOutliningSpan(n, openBrace, closeBrace, autoCollapse(n)); break; - case 135 /* ArrayLiteral */: - var openBracket = ts.findChildOfKind(n, 13 /* OpenBracketToken */, sourceFile); - var closeBracket = ts.findChildOfKind(n, 14 /* CloseBracketToken */, sourceFile); + case 139 /* ArrayLiteral */: + var openBracket = ts.findChildOfKind(n, 17 /* OpenBracketToken */, sourceFile); + var closeBracket = ts.findChildOfKind(n, 18 /* CloseBracketToken */, sourceFile); addOutliningSpan(n, openBracket, closeBracket, autoCollapse(n)); break; } @@ -27837,14 +28792,14 @@ var ts; var current = node.parent; while (current) { switch (current.kind) { - case 181 /* ModuleDeclaration */: + case 188 /* ModuleDeclaration */: do { current = current.parent; - } while (current.kind === 181 /* ModuleDeclaration */); - case 177 /* ClassDeclaration */: - case 180 /* EnumDeclaration */: - case 178 /* InterfaceDeclaration */: - case 175 /* FunctionDeclaration */: + } while (current.kind === 188 /* ModuleDeclaration */); + case 184 /* ClassDeclaration */: + case 187 /* EnumDeclaration */: + case 185 /* InterfaceDeclaration */: + case 182 /* FunctionDeclaration */: indent++; } current = current.parent; @@ -27855,10 +28810,10 @@ var ts; var childNodes = []; for (var i = 0, n = nodes.length; i < n; i++) { var node = nodes[i]; - if (node.kind === 177 /* ClassDeclaration */ || node.kind === 180 /* EnumDeclaration */ || node.kind === 178 /* InterfaceDeclaration */ || node.kind === 181 /* ModuleDeclaration */ || node.kind === 175 /* FunctionDeclaration */) { + if (node.kind === 184 /* ClassDeclaration */ || node.kind === 187 /* EnumDeclaration */ || node.kind === 185 /* InterfaceDeclaration */ || node.kind === 188 /* ModuleDeclaration */ || node.kind === 182 /* FunctionDeclaration */) { childNodes.push(node); } - else if (node.kind === 152 /* VariableStatement */) { + else if (node.kind === 159 /* VariableStatement */) { childNodes.push.apply(childNodes, node.declarations); } } @@ -27891,17 +28846,17 @@ var ts; for (var i = 0, n = nodes.length; i < n; i++) { var node = nodes[i]; switch (node.kind) { - case 177 /* ClassDeclaration */: - case 180 /* EnumDeclaration */: - case 178 /* InterfaceDeclaration */: + case 184 /* ClassDeclaration */: + case 187 /* EnumDeclaration */: + case 185 /* InterfaceDeclaration */: topLevelNodes.push(node); break; - case 181 /* ModuleDeclaration */: + case 188 /* ModuleDeclaration */: var moduleDeclaration = node; topLevelNodes.push(node); addTopLevelNodes(getInnermostModule(moduleDeclaration).body.statements, topLevelNodes); break; - case 175 /* FunctionDeclaration */: + case 182 /* FunctionDeclaration */: var functionDeclaration = node; if (isTopLevelFunctionDeclaration(functionDeclaration)) { topLevelNodes.push(node); @@ -27912,12 +28867,12 @@ var ts; } } function isTopLevelFunctionDeclaration(functionDeclaration) { - if (functionDeclaration.kind === 175 /* FunctionDeclaration */) { - if (functionDeclaration.body && functionDeclaration.body.kind === 176 /* FunctionBlock */) { - if (ts.forEach(functionDeclaration.body.statements, function (s) { return s.kind === 175 /* FunctionDeclaration */ && !isEmpty(s.name.text); })) { + if (functionDeclaration.kind === 182 /* FunctionDeclaration */) { + if (functionDeclaration.body && functionDeclaration.body.kind === 183 /* FunctionBlock */) { + if (ts.forEach(functionDeclaration.body.statements, function (s) { return s.kind === 182 /* FunctionDeclaration */ && !isEmpty(s.name.text); })) { return true; } - if (functionDeclaration.parent.kind !== 176 /* FunctionBlock */) { + if (functionDeclaration.parent.kind !== 183 /* FunctionBlock */) { return true; } } @@ -27967,37 +28922,37 @@ var ts; } function createChildItem(node) { switch (node.kind) { - case 119 /* Parameter */: + case 123 /* Parameter */: if ((node.flags & ts.NodeFlags.Modifier) === 0) { return undefined; } return createItem(node, getTextOfNode(node.name), ts.ScriptElementKind.memberVariableElement); - case 121 /* Method */: + case 125 /* Method */: return createItem(node, getTextOfNode(node.name), ts.ScriptElementKind.memberFunctionElement); - case 123 /* GetAccessor */: + case 127 /* GetAccessor */: return createItem(node, getTextOfNode(node.name), ts.ScriptElementKind.memberGetAccessorElement); - case 124 /* SetAccessor */: + case 128 /* SetAccessor */: return createItem(node, getTextOfNode(node.name), ts.ScriptElementKind.memberSetAccessorElement); - case 127 /* IndexSignature */: + case 131 /* IndexSignature */: return createItem(node, "[]", ts.ScriptElementKind.indexSignatureElement); - case 185 /* EnumMember */: + case 192 /* EnumMember */: return createItem(node, getTextOfNode(node.name), ts.ScriptElementKind.memberVariableElement); - case 125 /* CallSignature */: + case 129 /* CallSignature */: return createItem(node, "()", ts.ScriptElementKind.callSignatureElement); - case 126 /* ConstructSignature */: + case 130 /* ConstructSignature */: return createItem(node, "new()", ts.ScriptElementKind.constructSignatureElement); - case 120 /* Property */: + case 124 /* Property */: return createItem(node, getTextOfNode(node.name), ts.ScriptElementKind.memberVariableElement); - case 175 /* FunctionDeclaration */: + case 182 /* FunctionDeclaration */: return createItem(node, getTextOfNode(node.name), ts.ScriptElementKind.functionElement); - case 174 /* VariableDeclaration */: + case 181 /* VariableDeclaration */: if (node.flags & 4096 /* Const */) { return createItem(node, getTextOfNode(node.name), ts.ScriptElementKind.constantElement); } else { return createItem(node, getTextOfNode(node.name), ts.ScriptElementKind.variableElement); } - case 122 /* Constructor */: + case 126 /* Constructor */: return createItem(node, "constructor", ts.ScriptElementKind.constructorImplementationElement); } return undefined; @@ -28027,17 +28982,17 @@ var ts; } function createTopLevelItem(node) { switch (node.kind) { - case 186 /* SourceFile */: + case 193 /* SourceFile */: return createSourceFileItem(node); - case 177 /* ClassDeclaration */: + case 184 /* ClassDeclaration */: return createClassItem(node); - case 180 /* EnumDeclaration */: + case 187 /* EnumDeclaration */: return createEnumItem(node); - case 178 /* InterfaceDeclaration */: + case 185 /* InterfaceDeclaration */: return createIterfaceItem(node); - case 181 /* ModuleDeclaration */: + case 188 /* ModuleDeclaration */: return createModuleItem(node); - case 175 /* FunctionDeclaration */: + case 182 /* FunctionDeclaration */: return createFunctionItem(node); } return undefined; @@ -28047,7 +29002,7 @@ var ts; } var result = []; result.push(moduleDeclaration.name.text); - while (moduleDeclaration.body && moduleDeclaration.body.kind === 181 /* ModuleDeclaration */) { + while (moduleDeclaration.body && moduleDeclaration.body.kind === 188 /* ModuleDeclaration */) { moduleDeclaration = moduleDeclaration.body; result.push(moduleDeclaration.name.text); } @@ -28059,7 +29014,7 @@ var ts; return getNavigationBarItem(moduleName, ts.ScriptElementKind.moduleElement, ts.getNodeModifiers(node), [getNodeSpan(node)], childItems, getIndent(node)); } function createFunctionItem(node) { - if (node.name && node.body && node.body.kind === 176 /* FunctionBlock */) { + if (node.name && node.body && node.body.kind === 183 /* FunctionBlock */) { var childItems = getItemsWorker(sortNodes(node.body.statements), createChildItem); return getNavigationBarItem(node.name.text, ts.ScriptElementKind.functionElement, ts.getNodeModifiers(node), [getNodeSpan(node)], childItems, getIndent(node)); } @@ -28078,7 +29033,7 @@ var ts; var childItems; if (node.members) { var constructor = ts.forEach(node.members, function (member) { - return member.kind === 122 /* Constructor */ && member; + return member.kind === 126 /* Constructor */ && member; }); var nodes = constructor ? constructor.parameters.concat(node.members) : node.members; var childItems = getItemsWorker(sortNodes(nodes), createChildItem); @@ -28095,13 +29050,13 @@ var ts; } } function getInnermostModule(node) { - while (node.body.kind === 181 /* ModuleDeclaration */) { + while (node.body.kind === 188 /* ModuleDeclaration */) { node = node.body; } return node; } function getNodeSpan(node) { - return node.kind === 186 /* SourceFile */ ? TypeScript.TextSpan.fromBounds(node.getFullStart(), node.getEnd()) : TypeScript.TextSpan.fromBounds(node.getStart(), node.getEnd()); + return node.kind === 193 /* SourceFile */ ? TypeScript.TextSpan.fromBounds(node.getFullStart(), node.getEnd()) : TypeScript.TextSpan.fromBounds(node.getStart(), node.getEnd()); } function getTextOfNode(node) { return ts.getTextOfNodeFromSourceText(sourceFile.text, node); @@ -28149,10 +29104,10 @@ var TypeScript; var leadingTrivia = firstTokenInLine.leadingTrivia(); for (var i = leadingTrivia.count() - 1; i >= 0; i--) { var trivia = leadingTrivia.syntaxTriviaAt(i); - if (trivia.kind() === 5 /* NewLineTrivia */) { + if (trivia.kind() === 3 /* NewLineTrivia */) { break; } - if (trivia.kind() === 6 /* MultiLineCommentTrivia */) { + if (trivia.kind() === 4 /* MultiLineCommentTrivia */) { var lineSegments = TypeScript.Syntax.splitMultiLineCommentTriviaIntoMultipleLines(trivia); leadingTextInReverse.push(TypeScript.ArrayUtilities.last(lineSegments)); if (lineSegments.length > 0) { @@ -28234,13 +29189,13 @@ var ts; } return createSignatureHelpItems(candidates, resolvedSignature, argumentInfo); function getImmediatelyContainingArgumentInfo(node) { - if (node.parent.kind !== 140 /* CallExpression */ && node.parent.kind !== 141 /* NewExpression */) { + if (node.parent.kind !== 144 /* CallExpression */ && node.parent.kind !== 145 /* NewExpression */) { return undefined; } var parent = node.parent; - if (node.kind === 19 /* LessThanToken */ || node.kind === 11 /* OpenParenToken */) { + if (node.kind === 23 /* LessThanToken */ || node.kind === 15 /* OpenParenToken */) { var list = getChildListThatStartsWithOpenerToken(parent, node, sourceFile); - ts.Debug.assert(list); + ts.Debug.assert(list !== undefined); return { list: list, listItemIndex: 0 @@ -28249,8 +29204,8 @@ var ts; return ts.findListItemInfo(node); } function getContainingArgumentInfo(node) { - for (var n = node; n.kind !== 186 /* SourceFile */; n = n.parent) { - if (n.kind === 176 /* FunctionBlock */) { + for (var n = node; n.kind !== 193 /* SourceFile */; n = n.parent) { + if (n.kind === 183 /* FunctionBlock */) { return undefined; } if (n.pos < n.parent.pos || n.end > n.parent.end) { @@ -28300,20 +29255,20 @@ var ts; prefixParts.push.apply(prefixParts, callTargetDisplayParts); } if (isTypeParameterHelp) { - prefixParts.push(ts.punctuationPart(19 /* LessThanToken */)); + prefixParts.push(ts.punctuationPart(23 /* LessThanToken */)); var typeParameters = candidateSignature.typeParameters; signatureHelpParameters = typeParameters && typeParameters.length > 0 ? ts.map(typeParameters, createSignatureHelpParameterForTypeParameter) : emptyArray; - suffixParts.push(ts.punctuationPart(20 /* GreaterThanToken */)); + suffixParts.push(ts.punctuationPart(24 /* GreaterThanToken */)); var parameterParts = ts.mapToDisplayParts(function (writer) { return typeInfoResolver.getSymbolDisplayBuilder().buildDisplayForParametersAndDelimiters(candidateSignature.parameters, writer, argumentListOrTypeArgumentList); }); suffixParts.push.apply(suffixParts, parameterParts); } else { var typeParameterParts = ts.mapToDisplayParts(function (writer) { return typeInfoResolver.getSymbolDisplayBuilder().buildDisplayForTypeParametersAndDelimiters(candidateSignature.typeParameters, writer, argumentListOrTypeArgumentList); }); prefixParts.push.apply(prefixParts, typeParameterParts); - prefixParts.push(ts.punctuationPart(11 /* OpenParenToken */)); + prefixParts.push(ts.punctuationPart(15 /* OpenParenToken */)); var parameters = candidateSignature.parameters; signatureHelpParameters = parameters.length > 0 ? ts.map(parameters, createSignatureHelpParameterForParameter) : emptyArray; - suffixParts.push(ts.punctuationPart(12 /* CloseParenToken */)); + suffixParts.push(ts.punctuationPart(16 /* CloseParenToken */)); } var returnTypeParts = ts.mapToDisplayParts(function (writer) { return typeInfoResolver.getSymbolDisplayBuilder().buildReturnTypeDisplay(candidateSignature, writer, argumentListOrTypeArgumentList); }); suffixParts.push.apply(suffixParts, returnTypeParts); @@ -28321,7 +29276,7 @@ var ts; isVariadic: candidateSignature.hasRestParameter, prefixDisplayParts: prefixParts, suffixDisplayParts: suffixParts, - separatorDisplayParts: [ts.punctuationPart(18 /* CommaToken */), ts.spacePart()], + separatorDisplayParts: [ts.punctuationPart(22 /* CommaToken */), ts.spacePart()], parameters: signatureHelpParameters, documentation: candidateSignature.getDocumentationComment() }; @@ -28330,7 +29285,7 @@ var ts; var applicableSpanEnd = ts.skipTrivia(sourceFile.text, argumentListOrTypeArgumentList.end, false); var applicableSpan = new TypeScript.TextSpan(applicableSpanStart, applicableSpanEnd - applicableSpanStart); var argumentIndex = (argumentInfoOrTypeArgumentInfo.listItemIndex + 1) >> 1; - var argumentCount = argumentListOrTypeArgumentList.getChildCount() === 0 ? 0 : 1 + ts.countWhere(argumentListOrTypeArgumentList.getChildren(), function (arg) { return arg.kind === 18 /* CommaToken */; }); + var argumentCount = argumentListOrTypeArgumentList.getChildCount() === 0 ? 0 : 1 + ts.countWhere(argumentListOrTypeArgumentList.getChildren(), function (arg) { return arg.kind === 22 /* CommaToken */; }); var selectedItemIndex = candidates.indexOf(bestSignature); if (selectedItemIndex < 0) { selectedItemIndex = selectBestInvalidOverloadIndex(candidates, argumentCount); @@ -28387,7 +29342,7 @@ var ts; ts.findChildOfKind = findChildOfKind; function findContainingList(node) { var syntaxList = ts.forEach(node.parent.getChildren(), function (c) { - if (c.kind === 188 /* SyntaxList */ && c.pos <= node.pos && c.end >= node.end) { + if (c.kind === 195 /* SyntaxList */ && c.pos <= node.pos && c.end >= node.end) { return c; } }); @@ -28395,7 +29350,7 @@ var ts; } ts.findContainingList = findContainingList; function findListItemIndexContainingPosition(list, position) { - ts.Debug.assert(list.kind === 188 /* SyntaxList */); + ts.Debug.assert(list.kind === 195 /* SyntaxList */); var children = list.getChildren(); for (var i = 0; i < children.length; i++) { if (children[i].pos <= position && children[i].end > position) { @@ -28502,7 +29457,7 @@ var ts; } } } - ts.Debug.assert(startNode || n.kind === 186 /* SourceFile */); + ts.Debug.assert(startNode !== undefined || n.kind === 193 /* SourceFile */); if (children.length) { var candidate = findRightmostChildNodeWithTokens(children, children.length); return candidate && findRightmostToken(candidate); @@ -28518,19 +29473,19 @@ var ts; } ts.findPrecedingToken = findPrecedingToken; function nodeHasTokens(n) { - if (n.kind === 154 /* ExpressionStatement */) { + if (n.kind === 161 /* ExpressionStatement */) { return nodeHasTokens(n.expression); } - if (n.kind === 1 /* EndOfFileToken */ || n.kind === 150 /* OmittedExpression */ || n.kind === 116 /* Missing */) { + if (n.kind === 1 /* EndOfFileToken */ || n.kind === 157 /* OmittedExpression */ || n.kind === 120 /* Missing */) { return false; } - return n.kind !== 188 /* SyntaxList */ || n.getChildCount() !== 0; + return n.kind !== 195 /* SyntaxList */ || n.getChildCount() !== 0; } function getTypeArgumentOrTypeParameterList(node) { - if (node.kind === 128 /* TypeReference */ || node.kind === 140 /* CallExpression */) { + if (node.kind === 132 /* TypeReference */ || node.kind === 144 /* CallExpression */) { return node.typeArguments; } - if (ts.isAnyFunction(node) || node.kind === 177 /* ClassDeclaration */ || node.kind === 178 /* InterfaceDeclaration */) { + if (ts.isAnyFunction(node) || node.kind === 184 /* ClassDeclaration */ || node.kind === 185 /* InterfaceDeclaration */) { return node.typeParameters; } return undefined; @@ -28541,7 +29496,7 @@ var ts; } ts.isToken = isToken; function isWord(n) { - return n.kind === 59 /* Identifier */ || ts.isKeyword(n.kind); + return n.kind === 63 /* Identifier */ || ts.isKeyword(n.kind); } function isPropertyName(n) { return n.kind === 7 /* StringLiteral */ || n.kind === 6 /* NumericLiteral */ || isWord(n); @@ -28802,7 +29757,7 @@ var TypeScript; FormattingManager.prototype.formatOnSemicolon = function (caretPosition) { var sourceUnit = this.syntaxTree.sourceUnit(); var semicolonPositionedToken = TypeScript.findToken(sourceUnit, caretPosition - 1); - if (semicolonPositionedToken.kind() === 78 /* SemicolonToken */) { + if (semicolonPositionedToken.kind() === 80 /* SemicolonToken */) { var current = semicolonPositionedToken; while (current.parent !== null && TypeScript.end(current.parent) === TypeScript.end(semicolonPositionedToken) && current.parent.kind() !== 1 /* List */) { current = current.parent; @@ -28815,7 +29770,7 @@ var TypeScript; FormattingManager.prototype.formatOnClosingCurlyBrace = function (caretPosition) { var sourceUnit = this.syntaxTree.sourceUnit(); var closeBracePositionedToken = TypeScript.findToken(sourceUnit, caretPosition - 1); - if (closeBracePositionedToken.kind() === 71 /* CloseBraceToken */) { + if (closeBracePositionedToken.kind() === 73 /* CloseBraceToken */) { var current = closeBracePositionedToken; while (current.parent !== null && TypeScript.end(current.parent) === TypeScript.end(closeBracePositionedToken) && current.parent.kind() !== 1 /* List */) { current = current.parent; @@ -29029,71 +29984,71 @@ var TypeScript; var Rules = (function () { function Rules() { this.IgnoreBeforeComment = new Formatting.Rule(Formatting.RuleDescriptor.create4(Formatting.Shared.TokenRange.Any, Formatting.Shared.TokenRange.Comments), Formatting.RuleOperation.create1(0 /* Ignore */)); - this.IgnoreAfterLineComment = new Formatting.Rule(Formatting.RuleDescriptor.create3(7 /* SingleLineCommentTrivia */, Formatting.Shared.TokenRange.Any), Formatting.RuleOperation.create1(0 /* Ignore */)); - this.NoSpaceBeforeSemicolon = new Formatting.Rule(Formatting.RuleDescriptor.create2(Formatting.Shared.TokenRange.Any, 78 /* SemicolonToken */), Formatting.RuleOperation.create2(new Formatting.RuleOperationContext(Rules.IsSameLineTokenContext), 3 /* Delete */)); - this.NoSpaceBeforeColon = new Formatting.Rule(Formatting.RuleDescriptor.create2(Formatting.Shared.TokenRange.Any, 106 /* ColonToken */), Formatting.RuleOperation.create2(new Formatting.RuleOperationContext(Rules.IsSameLineTokenContext, Rules.IsNotBinaryOpContext), 3 /* Delete */)); - this.NoSpaceBeforeQMark = new Formatting.Rule(Formatting.RuleDescriptor.create2(Formatting.Shared.TokenRange.Any, 105 /* QuestionToken */), Formatting.RuleOperation.create2(new Formatting.RuleOperationContext(Rules.IsSameLineTokenContext, Rules.IsNotBinaryOpContext), 3 /* Delete */)); - this.SpaceAfterColon = new Formatting.Rule(Formatting.RuleDescriptor.create3(106 /* ColonToken */, Formatting.Shared.TokenRange.Any), Formatting.RuleOperation.create2(new Formatting.RuleOperationContext(Rules.IsSameLineTokenContext, Rules.IsNotBinaryOpContext), 1 /* Space */)); - this.SpaceAfterQMark = new Formatting.Rule(Formatting.RuleDescriptor.create3(105 /* QuestionToken */, Formatting.Shared.TokenRange.Any), Formatting.RuleOperation.create2(new Formatting.RuleOperationContext(Rules.IsSameLineTokenContext, Rules.IsNotBinaryOpContext), 1 /* Space */)); - this.SpaceAfterSemicolon = new Formatting.Rule(Formatting.RuleDescriptor.create3(78 /* SemicolonToken */, Formatting.Shared.TokenRange.Any), Formatting.RuleOperation.create2(new Formatting.RuleOperationContext(Rules.IsSameLineTokenContext), 1 /* Space */)); - this.SpaceAfterCloseBrace = new Formatting.Rule(Formatting.RuleDescriptor.create3(71 /* CloseBraceToken */, Formatting.Shared.TokenRange.Any), Formatting.RuleOperation.create2(new Formatting.RuleOperationContext(Rules.IsSameLineTokenContext, Rules.IsAfterCodeBlockContext), 1 /* Space */)); - this.SpaceBetweenCloseBraceAndElse = new Formatting.Rule(Formatting.RuleDescriptor.create1(71 /* CloseBraceToken */, 23 /* ElseKeyword */), Formatting.RuleOperation.create2(new Formatting.RuleOperationContext(Rules.IsSameLineTokenContext), 1 /* Space */)); - this.SpaceBetweenCloseBraceAndWhile = new Formatting.Rule(Formatting.RuleDescriptor.create1(71 /* CloseBraceToken */, 42 /* WhileKeyword */), Formatting.RuleOperation.create2(new Formatting.RuleOperationContext(Rules.IsSameLineTokenContext), 1 /* Space */)); - this.NoSpaceAfterCloseBrace = new Formatting.Rule(Formatting.RuleDescriptor.create3(71 /* CloseBraceToken */, Formatting.Shared.TokenRange.FromTokens([73 /* CloseParenToken */, 75 /* CloseBracketToken */, 79 /* CommaToken */, 78 /* SemicolonToken */])), Formatting.RuleOperation.create2(new Formatting.RuleOperationContext(Rules.IsSameLineTokenContext), 3 /* Delete */)); - this.NoSpaceBeforeDot = new Formatting.Rule(Formatting.RuleDescriptor.create2(Formatting.Shared.TokenRange.Any, 76 /* DotToken */), Formatting.RuleOperation.create2(new Formatting.RuleOperationContext(Rules.IsSameLineTokenContext), 3 /* Delete */)); - this.NoSpaceAfterDot = new Formatting.Rule(Formatting.RuleDescriptor.create3(76 /* DotToken */, Formatting.Shared.TokenRange.Any), Formatting.RuleOperation.create2(new Formatting.RuleOperationContext(Rules.IsSameLineTokenContext), 3 /* Delete */)); - this.NoSpaceBeforeOpenBracket = new Formatting.Rule(Formatting.RuleDescriptor.create2(Formatting.Shared.TokenRange.Any, 74 /* OpenBracketToken */), Formatting.RuleOperation.create2(new Formatting.RuleOperationContext(Rules.IsSameLineTokenContext), 3 /* Delete */)); - this.NoSpaceAfterOpenBracket = new Formatting.Rule(Formatting.RuleDescriptor.create3(74 /* OpenBracketToken */, Formatting.Shared.TokenRange.Any), Formatting.RuleOperation.create2(new Formatting.RuleOperationContext(Rules.IsSameLineTokenContext), 3 /* Delete */)); - this.NoSpaceBeforeCloseBracket = new Formatting.Rule(Formatting.RuleDescriptor.create2(Formatting.Shared.TokenRange.Any, 75 /* CloseBracketToken */), Formatting.RuleOperation.create2(new Formatting.RuleOperationContext(Rules.IsSameLineTokenContext), 3 /* Delete */)); - this.NoSpaceAfterCloseBracket = new Formatting.Rule(Formatting.RuleDescriptor.create3(75 /* CloseBracketToken */, Formatting.Shared.TokenRange.Any), Formatting.RuleOperation.create2(new Formatting.RuleOperationContext(Rules.IsSameLineTokenContext), 3 /* Delete */)); + this.IgnoreAfterLineComment = new Formatting.Rule(Formatting.RuleDescriptor.create3(5 /* SingleLineCommentTrivia */, Formatting.Shared.TokenRange.Any), Formatting.RuleOperation.create1(0 /* Ignore */)); + this.NoSpaceBeforeSemicolon = new Formatting.Rule(Formatting.RuleDescriptor.create2(Formatting.Shared.TokenRange.Any, 80 /* SemicolonToken */), Formatting.RuleOperation.create2(new Formatting.RuleOperationContext(Rules.IsSameLineTokenContext), 3 /* Delete */)); + this.NoSpaceBeforeColon = new Formatting.Rule(Formatting.RuleDescriptor.create2(Formatting.Shared.TokenRange.Any, 108 /* ColonToken */), Formatting.RuleOperation.create2(new Formatting.RuleOperationContext(Rules.IsSameLineTokenContext, Rules.IsNotBinaryOpContext), 3 /* Delete */)); + this.NoSpaceBeforeQMark = new Formatting.Rule(Formatting.RuleDescriptor.create2(Formatting.Shared.TokenRange.Any, 107 /* QuestionToken */), Formatting.RuleOperation.create2(new Formatting.RuleOperationContext(Rules.IsSameLineTokenContext, Rules.IsNotBinaryOpContext), 3 /* Delete */)); + this.SpaceAfterColon = new Formatting.Rule(Formatting.RuleDescriptor.create3(108 /* ColonToken */, Formatting.Shared.TokenRange.Any), Formatting.RuleOperation.create2(new Formatting.RuleOperationContext(Rules.IsSameLineTokenContext, Rules.IsNotBinaryOpContext), 1 /* Space */)); + this.SpaceAfterQMark = new Formatting.Rule(Formatting.RuleDescriptor.create3(107 /* QuestionToken */, Formatting.Shared.TokenRange.Any), Formatting.RuleOperation.create2(new Formatting.RuleOperationContext(Rules.IsSameLineTokenContext, Rules.IsNotBinaryOpContext), 1 /* Space */)); + this.SpaceAfterSemicolon = new Formatting.Rule(Formatting.RuleDescriptor.create3(80 /* SemicolonToken */, Formatting.Shared.TokenRange.Any), Formatting.RuleOperation.create2(new Formatting.RuleOperationContext(Rules.IsSameLineTokenContext), 1 /* Space */)); + this.SpaceAfterCloseBrace = new Formatting.Rule(Formatting.RuleDescriptor.create3(73 /* CloseBraceToken */, Formatting.Shared.TokenRange.Any), Formatting.RuleOperation.create2(new Formatting.RuleOperationContext(Rules.IsSameLineTokenContext, Rules.IsAfterCodeBlockContext), 1 /* Space */)); + this.SpaceBetweenCloseBraceAndElse = new Formatting.Rule(Formatting.RuleDescriptor.create1(73 /* CloseBraceToken */, 25 /* ElseKeyword */), Formatting.RuleOperation.create2(new Formatting.RuleOperationContext(Rules.IsSameLineTokenContext), 1 /* Space */)); + this.SpaceBetweenCloseBraceAndWhile = new Formatting.Rule(Formatting.RuleDescriptor.create1(73 /* CloseBraceToken */, 44 /* WhileKeyword */), Formatting.RuleOperation.create2(new Formatting.RuleOperationContext(Rules.IsSameLineTokenContext), 1 /* Space */)); + this.NoSpaceAfterCloseBrace = new Formatting.Rule(Formatting.RuleDescriptor.create3(73 /* CloseBraceToken */, Formatting.Shared.TokenRange.FromTokens([75 /* CloseParenToken */, 77 /* CloseBracketToken */, 81 /* CommaToken */, 80 /* SemicolonToken */])), Formatting.RuleOperation.create2(new Formatting.RuleOperationContext(Rules.IsSameLineTokenContext), 3 /* Delete */)); + this.NoSpaceBeforeDot = new Formatting.Rule(Formatting.RuleDescriptor.create2(Formatting.Shared.TokenRange.Any, 78 /* DotToken */), Formatting.RuleOperation.create2(new Formatting.RuleOperationContext(Rules.IsSameLineTokenContext), 3 /* Delete */)); + this.NoSpaceAfterDot = new Formatting.Rule(Formatting.RuleDescriptor.create3(78 /* DotToken */, Formatting.Shared.TokenRange.Any), Formatting.RuleOperation.create2(new Formatting.RuleOperationContext(Rules.IsSameLineTokenContext), 3 /* Delete */)); + this.NoSpaceBeforeOpenBracket = new Formatting.Rule(Formatting.RuleDescriptor.create2(Formatting.Shared.TokenRange.Any, 76 /* OpenBracketToken */), Formatting.RuleOperation.create2(new Formatting.RuleOperationContext(Rules.IsSameLineTokenContext), 3 /* Delete */)); + this.NoSpaceAfterOpenBracket = new Formatting.Rule(Formatting.RuleDescriptor.create3(76 /* OpenBracketToken */, Formatting.Shared.TokenRange.Any), Formatting.RuleOperation.create2(new Formatting.RuleOperationContext(Rules.IsSameLineTokenContext), 3 /* Delete */)); + this.NoSpaceBeforeCloseBracket = new Formatting.Rule(Formatting.RuleDescriptor.create2(Formatting.Shared.TokenRange.Any, 77 /* CloseBracketToken */), Formatting.RuleOperation.create2(new Formatting.RuleOperationContext(Rules.IsSameLineTokenContext), 3 /* Delete */)); + this.NoSpaceAfterCloseBracket = new Formatting.Rule(Formatting.RuleDescriptor.create3(77 /* CloseBracketToken */, Formatting.Shared.TokenRange.Any), Formatting.RuleOperation.create2(new Formatting.RuleOperationContext(Rules.IsSameLineTokenContext), 3 /* Delete */)); this.FunctionOpenBraceLeftTokenRange = Formatting.Shared.TokenRange.AnyIncludingMultilineComments; - this.SpaceBeforeOpenBraceInFunction = new Formatting.Rule(Formatting.RuleDescriptor.create2(this.FunctionOpenBraceLeftTokenRange, 70 /* OpenBraceToken */), Formatting.RuleOperation.create2(new Formatting.RuleOperationContext(Rules.IsFunctionDeclContext, Rules.IsNotFormatOnEnter, Rules.IsSameLineTokenOrBeforeMultilineBlockContext), 1 /* Space */), 1 /* CanDeleteNewLines */); - this.TypeScriptOpenBraceLeftTokenRange = Formatting.Shared.TokenRange.FromTokens([11 /* IdentifierName */, 6 /* MultiLineCommentTrivia */]); - this.SpaceBeforeOpenBraceInTypeScriptDeclWithBlock = new Formatting.Rule(Formatting.RuleDescriptor.create2(this.TypeScriptOpenBraceLeftTokenRange, 70 /* OpenBraceToken */), Formatting.RuleOperation.create2(new Formatting.RuleOperationContext(Rules.IsTypeScriptDeclWithBlockContext, Rules.IsNotFormatOnEnter, Rules.IsSameLineTokenOrBeforeMultilineBlockContext), 1 /* Space */), 1 /* CanDeleteNewLines */); - this.ControlOpenBraceLeftTokenRange = Formatting.Shared.TokenRange.FromTokens([73 /* CloseParenToken */, 6 /* MultiLineCommentTrivia */, 22 /* DoKeyword */, 38 /* TryKeyword */, 25 /* FinallyKeyword */, 23 /* ElseKeyword */]); - this.SpaceBeforeOpenBraceInControl = new Formatting.Rule(Formatting.RuleDescriptor.create2(this.ControlOpenBraceLeftTokenRange, 70 /* OpenBraceToken */), Formatting.RuleOperation.create2(new Formatting.RuleOperationContext(Rules.IsControlDeclContext, Rules.IsNotFormatOnEnter, Rules.IsSameLineTokenOrBeforeMultilineBlockContext), 1 /* Space */), 1 /* CanDeleteNewLines */); - this.SpaceAfterOpenBrace = new Formatting.Rule(Formatting.RuleDescriptor.create3(70 /* OpenBraceToken */, Formatting.Shared.TokenRange.Any), Formatting.RuleOperation.create2(new Formatting.RuleOperationContext(Rules.IsSingleLineBlockContext), 1 /* Space */)); - this.SpaceBeforeCloseBrace = new Formatting.Rule(Formatting.RuleDescriptor.create2(Formatting.Shared.TokenRange.Any, 71 /* CloseBraceToken */), Formatting.RuleOperation.create2(new Formatting.RuleOperationContext(Rules.IsSingleLineBlockContext), 1 /* Space */)); - this.NoSpaceBetweenEmptyBraceBrackets = new Formatting.Rule(Formatting.RuleDescriptor.create1(70 /* OpenBraceToken */, 71 /* CloseBraceToken */), Formatting.RuleOperation.create2(new Formatting.RuleOperationContext(Rules.IsSameLineTokenContext, Rules.IsObjectContext), 3 /* Delete */)); - this.NewLineAfterOpenBraceInBlockContext = new Formatting.Rule(Formatting.RuleDescriptor.create3(70 /* OpenBraceToken */, Formatting.Shared.TokenRange.Any), Formatting.RuleOperation.create2(new Formatting.RuleOperationContext(Rules.IsMultilineBlockContext), 2 /* NewLine */)); - this.NewLineBeforeCloseBraceInBlockContext = new Formatting.Rule(Formatting.RuleDescriptor.create2(Formatting.Shared.TokenRange.AnyIncludingMultilineComments, 71 /* CloseBraceToken */), Formatting.RuleOperation.create2(new Formatting.RuleOperationContext(Rules.IsMultilineBlockContext), 2 /* NewLine */)); + this.SpaceBeforeOpenBraceInFunction = new Formatting.Rule(Formatting.RuleDescriptor.create2(this.FunctionOpenBraceLeftTokenRange, 72 /* OpenBraceToken */), Formatting.RuleOperation.create2(new Formatting.RuleOperationContext(Rules.IsFunctionDeclContext, Rules.IsNotFormatOnEnter, Rules.IsSameLineTokenOrBeforeMultilineBlockContext), 1 /* Space */), 1 /* CanDeleteNewLines */); + this.TypeScriptOpenBraceLeftTokenRange = Formatting.Shared.TokenRange.FromTokens([9 /* IdentifierName */, 4 /* MultiLineCommentTrivia */]); + this.SpaceBeforeOpenBraceInTypeScriptDeclWithBlock = new Formatting.Rule(Formatting.RuleDescriptor.create2(this.TypeScriptOpenBraceLeftTokenRange, 72 /* OpenBraceToken */), Formatting.RuleOperation.create2(new Formatting.RuleOperationContext(Rules.IsTypeScriptDeclWithBlockContext, Rules.IsNotFormatOnEnter, Rules.IsSameLineTokenOrBeforeMultilineBlockContext), 1 /* Space */), 1 /* CanDeleteNewLines */); + this.ControlOpenBraceLeftTokenRange = Formatting.Shared.TokenRange.FromTokens([75 /* CloseParenToken */, 4 /* MultiLineCommentTrivia */, 24 /* DoKeyword */, 40 /* TryKeyword */, 27 /* FinallyKeyword */, 25 /* ElseKeyword */]); + this.SpaceBeforeOpenBraceInControl = new Formatting.Rule(Formatting.RuleDescriptor.create2(this.ControlOpenBraceLeftTokenRange, 72 /* OpenBraceToken */), Formatting.RuleOperation.create2(new Formatting.RuleOperationContext(Rules.IsControlDeclContext, Rules.IsNotFormatOnEnter, Rules.IsSameLineTokenOrBeforeMultilineBlockContext), 1 /* Space */), 1 /* CanDeleteNewLines */); + this.SpaceAfterOpenBrace = new Formatting.Rule(Formatting.RuleDescriptor.create3(72 /* OpenBraceToken */, Formatting.Shared.TokenRange.Any), Formatting.RuleOperation.create2(new Formatting.RuleOperationContext(Rules.IsSingleLineBlockContext), 1 /* Space */)); + this.SpaceBeforeCloseBrace = new Formatting.Rule(Formatting.RuleDescriptor.create2(Formatting.Shared.TokenRange.Any, 73 /* CloseBraceToken */), Formatting.RuleOperation.create2(new Formatting.RuleOperationContext(Rules.IsSingleLineBlockContext), 1 /* Space */)); + this.NoSpaceBetweenEmptyBraceBrackets = new Formatting.Rule(Formatting.RuleDescriptor.create1(72 /* OpenBraceToken */, 73 /* CloseBraceToken */), Formatting.RuleOperation.create2(new Formatting.RuleOperationContext(Rules.IsSameLineTokenContext, Rules.IsObjectContext), 3 /* Delete */)); + this.NewLineAfterOpenBraceInBlockContext = new Formatting.Rule(Formatting.RuleDescriptor.create3(72 /* OpenBraceToken */, Formatting.Shared.TokenRange.Any), Formatting.RuleOperation.create2(new Formatting.RuleOperationContext(Rules.IsMultilineBlockContext), 2 /* NewLine */)); + this.NewLineBeforeCloseBraceInBlockContext = new Formatting.Rule(Formatting.RuleDescriptor.create2(Formatting.Shared.TokenRange.AnyIncludingMultilineComments, 73 /* CloseBraceToken */), Formatting.RuleOperation.create2(new Formatting.RuleOperationContext(Rules.IsMultilineBlockContext), 2 /* NewLine */)); this.NoSpaceAfterUnaryPrefixOperator = new Formatting.Rule(Formatting.RuleDescriptor.create4(Formatting.Shared.TokenRange.UnaryPrefixOperators, Formatting.Shared.TokenRange.UnaryPrefixExpressions), Formatting.RuleOperation.create2(new Formatting.RuleOperationContext(Rules.IsSameLineTokenContext, Rules.IsNotBinaryOpContext), 3 /* Delete */)); - this.NoSpaceAfterUnaryPreincrementOperator = new Formatting.Rule(Formatting.RuleDescriptor.create3(93 /* PlusPlusToken */, Formatting.Shared.TokenRange.UnaryPreincrementExpressions), Formatting.RuleOperation.create2(new Formatting.RuleOperationContext(Rules.IsSameLineTokenContext), 3 /* Delete */)); - this.NoSpaceAfterUnaryPredecrementOperator = new Formatting.Rule(Formatting.RuleDescriptor.create3(94 /* MinusMinusToken */, Formatting.Shared.TokenRange.UnaryPredecrementExpressions), Formatting.RuleOperation.create2(new Formatting.RuleOperationContext(Rules.IsSameLineTokenContext), 3 /* Delete */)); - this.NoSpaceBeforeUnaryPostincrementOperator = new Formatting.Rule(Formatting.RuleDescriptor.create2(Formatting.Shared.TokenRange.UnaryPostincrementExpressions, 93 /* PlusPlusToken */), Formatting.RuleOperation.create2(new Formatting.RuleOperationContext(Rules.IsSameLineTokenContext), 3 /* Delete */)); - this.NoSpaceBeforeUnaryPostdecrementOperator = new Formatting.Rule(Formatting.RuleDescriptor.create2(Formatting.Shared.TokenRange.UnaryPostdecrementExpressions, 94 /* MinusMinusToken */), Formatting.RuleOperation.create2(new Formatting.RuleOperationContext(Rules.IsSameLineTokenContext), 3 /* Delete */)); - this.SpaceAfterPostincrementWhenFollowedByAdd = new Formatting.Rule(Formatting.RuleDescriptor.create1(93 /* PlusPlusToken */, 89 /* PlusToken */), Formatting.RuleOperation.create2(new Formatting.RuleOperationContext(Rules.IsSameLineTokenContext, Rules.IsBinaryOpContext), 1 /* Space */)); - this.SpaceAfterAddWhenFollowedByUnaryPlus = new Formatting.Rule(Formatting.RuleDescriptor.create1(89 /* PlusToken */, 89 /* PlusToken */), Formatting.RuleOperation.create2(new Formatting.RuleOperationContext(Rules.IsSameLineTokenContext, Rules.IsBinaryOpContext), 1 /* Space */)); - this.SpaceAfterAddWhenFollowedByPreincrement = new Formatting.Rule(Formatting.RuleDescriptor.create1(89 /* PlusToken */, 93 /* PlusPlusToken */), Formatting.RuleOperation.create2(new Formatting.RuleOperationContext(Rules.IsSameLineTokenContext, Rules.IsBinaryOpContext), 1 /* Space */)); - this.SpaceAfterPostdecrementWhenFollowedBySubtract = new Formatting.Rule(Formatting.RuleDescriptor.create1(94 /* MinusMinusToken */, 90 /* MinusToken */), Formatting.RuleOperation.create2(new Formatting.RuleOperationContext(Rules.IsSameLineTokenContext, Rules.IsBinaryOpContext), 1 /* Space */)); - this.SpaceAfterSubtractWhenFollowedByUnaryMinus = new Formatting.Rule(Formatting.RuleDescriptor.create1(90 /* MinusToken */, 90 /* MinusToken */), Formatting.RuleOperation.create2(new Formatting.RuleOperationContext(Rules.IsSameLineTokenContext, Rules.IsBinaryOpContext), 1 /* Space */)); - this.SpaceAfterSubtractWhenFollowedByPredecrement = new Formatting.Rule(Formatting.RuleDescriptor.create1(90 /* MinusToken */, 94 /* MinusMinusToken */), Formatting.RuleOperation.create2(new Formatting.RuleOperationContext(Rules.IsSameLineTokenContext, Rules.IsBinaryOpContext), 1 /* Space */)); - this.NoSpaceBeforeComma = new Formatting.Rule(Formatting.RuleDescriptor.create2(Formatting.Shared.TokenRange.Any, 79 /* CommaToken */), Formatting.RuleOperation.create2(new Formatting.RuleOperationContext(Rules.IsSameLineTokenContext), 3 /* Delete */)); - this.SpaceAfterCertainKeywords = new Formatting.Rule(Formatting.RuleDescriptor.create4(Formatting.Shared.TokenRange.FromTokens([40 /* VarKeyword */, 36 /* ThrowKeyword */, 31 /* NewKeyword */, 21 /* DeleteKeyword */, 33 /* ReturnKeyword */, 39 /* TypeOfKeyword */]), Formatting.Shared.TokenRange.Any), Formatting.RuleOperation.create2(new Formatting.RuleOperationContext(Rules.IsSameLineTokenContext), 1 /* Space */)); - this.NoSpaceBeforeOpenParenInFuncCall = new Formatting.Rule(Formatting.RuleDescriptor.create2(Formatting.Shared.TokenRange.Any, 72 /* OpenParenToken */), Formatting.RuleOperation.create2(new Formatting.RuleOperationContext(Rules.IsSameLineTokenContext, Rules.IsFunctionCallOrNewContext), 3 /* Delete */)); - this.SpaceAfterFunctionInFuncDecl = new Formatting.Rule(Formatting.RuleDescriptor.create3(27 /* FunctionKeyword */, Formatting.Shared.TokenRange.Any), Formatting.RuleOperation.create2(new Formatting.RuleOperationContext(Rules.IsFunctionDeclContext), 1 /* Space */)); - this.NoSpaceBeforeOpenParenInFuncDecl = new Formatting.Rule(Formatting.RuleDescriptor.create2(Formatting.Shared.TokenRange.Any, 72 /* OpenParenToken */), Formatting.RuleOperation.create2(new Formatting.RuleOperationContext(Rules.IsSameLineTokenContext, Rules.IsFunctionDeclContext), 3 /* Delete */)); - this.SpaceAfterVoidOperator = new Formatting.Rule(Formatting.RuleDescriptor.create3(41 /* VoidKeyword */, Formatting.Shared.TokenRange.Any), Formatting.RuleOperation.create2(new Formatting.RuleOperationContext(Rules.IsSameLineTokenContext, Rules.IsVoidOpContext), 1 /* Space */)); - this.NoSpaceBetweenReturnAndSemicolon = new Formatting.Rule(Formatting.RuleDescriptor.create1(33 /* ReturnKeyword */, 78 /* SemicolonToken */), Formatting.RuleOperation.create2(new Formatting.RuleOperationContext(Rules.IsSameLineTokenContext), 3 /* Delete */)); - this.SpaceBetweenStatements = new Formatting.Rule(Formatting.RuleDescriptor.create4(Formatting.Shared.TokenRange.FromTokens([73 /* CloseParenToken */, 22 /* DoKeyword */, 23 /* ElseKeyword */, 16 /* CaseKeyword */]), Formatting.Shared.TokenRange.Any), Formatting.RuleOperation.create2(new Formatting.RuleOperationContext(Rules.IsSameLineTokenContext, Rules.IsNotForContext), 1 /* Space */)); - this.SpaceAfterTryFinally = new Formatting.Rule(Formatting.RuleDescriptor.create2(Formatting.Shared.TokenRange.FromTokens([38 /* TryKeyword */, 25 /* FinallyKeyword */]), 70 /* OpenBraceToken */), Formatting.RuleOperation.create2(new Formatting.RuleOperationContext(Rules.IsSameLineTokenContext), 1 /* Space */)); - this.SpaceAfterGetSetInMember = new Formatting.Rule(Formatting.RuleDescriptor.create2(Formatting.Shared.TokenRange.FromTokens([64 /* GetKeyword */, 68 /* SetKeyword */]), 11 /* IdentifierName */), Formatting.RuleOperation.create2(new Formatting.RuleOperationContext(Rules.IsFunctionDeclContext), 1 /* Space */)); + this.NoSpaceAfterUnaryPreincrementOperator = new Formatting.Rule(Formatting.RuleDescriptor.create3(95 /* PlusPlusToken */, Formatting.Shared.TokenRange.UnaryPreincrementExpressions), Formatting.RuleOperation.create2(new Formatting.RuleOperationContext(Rules.IsSameLineTokenContext), 3 /* Delete */)); + this.NoSpaceAfterUnaryPredecrementOperator = new Formatting.Rule(Formatting.RuleDescriptor.create3(96 /* MinusMinusToken */, Formatting.Shared.TokenRange.UnaryPredecrementExpressions), Formatting.RuleOperation.create2(new Formatting.RuleOperationContext(Rules.IsSameLineTokenContext), 3 /* Delete */)); + this.NoSpaceBeforeUnaryPostincrementOperator = new Formatting.Rule(Formatting.RuleDescriptor.create2(Formatting.Shared.TokenRange.UnaryPostincrementExpressions, 95 /* PlusPlusToken */), Formatting.RuleOperation.create2(new Formatting.RuleOperationContext(Rules.IsSameLineTokenContext), 3 /* Delete */)); + this.NoSpaceBeforeUnaryPostdecrementOperator = new Formatting.Rule(Formatting.RuleDescriptor.create2(Formatting.Shared.TokenRange.UnaryPostdecrementExpressions, 96 /* MinusMinusToken */), Formatting.RuleOperation.create2(new Formatting.RuleOperationContext(Rules.IsSameLineTokenContext), 3 /* Delete */)); + this.SpaceAfterPostincrementWhenFollowedByAdd = new Formatting.Rule(Formatting.RuleDescriptor.create1(95 /* PlusPlusToken */, 91 /* PlusToken */), Formatting.RuleOperation.create2(new Formatting.RuleOperationContext(Rules.IsSameLineTokenContext, Rules.IsBinaryOpContext), 1 /* Space */)); + this.SpaceAfterAddWhenFollowedByUnaryPlus = new Formatting.Rule(Formatting.RuleDescriptor.create1(91 /* PlusToken */, 91 /* PlusToken */), Formatting.RuleOperation.create2(new Formatting.RuleOperationContext(Rules.IsSameLineTokenContext, Rules.IsBinaryOpContext), 1 /* Space */)); + this.SpaceAfterAddWhenFollowedByPreincrement = new Formatting.Rule(Formatting.RuleDescriptor.create1(91 /* PlusToken */, 95 /* PlusPlusToken */), Formatting.RuleOperation.create2(new Formatting.RuleOperationContext(Rules.IsSameLineTokenContext, Rules.IsBinaryOpContext), 1 /* Space */)); + this.SpaceAfterPostdecrementWhenFollowedBySubtract = new Formatting.Rule(Formatting.RuleDescriptor.create1(96 /* MinusMinusToken */, 92 /* MinusToken */), Formatting.RuleOperation.create2(new Formatting.RuleOperationContext(Rules.IsSameLineTokenContext, Rules.IsBinaryOpContext), 1 /* Space */)); + this.SpaceAfterSubtractWhenFollowedByUnaryMinus = new Formatting.Rule(Formatting.RuleDescriptor.create1(92 /* MinusToken */, 92 /* MinusToken */), Formatting.RuleOperation.create2(new Formatting.RuleOperationContext(Rules.IsSameLineTokenContext, Rules.IsBinaryOpContext), 1 /* Space */)); + this.SpaceAfterSubtractWhenFollowedByPredecrement = new Formatting.Rule(Formatting.RuleDescriptor.create1(92 /* MinusToken */, 96 /* MinusMinusToken */), Formatting.RuleOperation.create2(new Formatting.RuleOperationContext(Rules.IsSameLineTokenContext, Rules.IsBinaryOpContext), 1 /* Space */)); + this.NoSpaceBeforeComma = new Formatting.Rule(Formatting.RuleDescriptor.create2(Formatting.Shared.TokenRange.Any, 81 /* CommaToken */), Formatting.RuleOperation.create2(new Formatting.RuleOperationContext(Rules.IsSameLineTokenContext), 3 /* Delete */)); + this.SpaceAfterCertainKeywords = new Formatting.Rule(Formatting.RuleDescriptor.create4(Formatting.Shared.TokenRange.FromTokens([42 /* VarKeyword */, 38 /* ThrowKeyword */, 33 /* NewKeyword */, 23 /* DeleteKeyword */, 35 /* ReturnKeyword */, 41 /* TypeOfKeyword */]), Formatting.Shared.TokenRange.Any), Formatting.RuleOperation.create2(new Formatting.RuleOperationContext(Rules.IsSameLineTokenContext), 1 /* Space */)); + this.NoSpaceBeforeOpenParenInFuncCall = new Formatting.Rule(Formatting.RuleDescriptor.create2(Formatting.Shared.TokenRange.Any, 74 /* OpenParenToken */), Formatting.RuleOperation.create2(new Formatting.RuleOperationContext(Rules.IsSameLineTokenContext, Rules.IsFunctionCallOrNewContext), 3 /* Delete */)); + this.SpaceAfterFunctionInFuncDecl = new Formatting.Rule(Formatting.RuleDescriptor.create3(29 /* FunctionKeyword */, Formatting.Shared.TokenRange.Any), Formatting.RuleOperation.create2(new Formatting.RuleOperationContext(Rules.IsFunctionDeclContext), 1 /* Space */)); + this.NoSpaceBeforeOpenParenInFuncDecl = new Formatting.Rule(Formatting.RuleDescriptor.create2(Formatting.Shared.TokenRange.Any, 74 /* OpenParenToken */), Formatting.RuleOperation.create2(new Formatting.RuleOperationContext(Rules.IsSameLineTokenContext, Rules.IsFunctionDeclContext), 3 /* Delete */)); + this.SpaceAfterVoidOperator = new Formatting.Rule(Formatting.RuleDescriptor.create3(43 /* VoidKeyword */, Formatting.Shared.TokenRange.Any), Formatting.RuleOperation.create2(new Formatting.RuleOperationContext(Rules.IsSameLineTokenContext, Rules.IsVoidOpContext), 1 /* Space */)); + this.NoSpaceBetweenReturnAndSemicolon = new Formatting.Rule(Formatting.RuleDescriptor.create1(35 /* ReturnKeyword */, 80 /* SemicolonToken */), Formatting.RuleOperation.create2(new Formatting.RuleOperationContext(Rules.IsSameLineTokenContext), 3 /* Delete */)); + this.SpaceBetweenStatements = new Formatting.Rule(Formatting.RuleDescriptor.create4(Formatting.Shared.TokenRange.FromTokens([75 /* CloseParenToken */, 24 /* DoKeyword */, 25 /* ElseKeyword */, 18 /* CaseKeyword */]), Formatting.Shared.TokenRange.Any), Formatting.RuleOperation.create2(new Formatting.RuleOperationContext(Rules.IsSameLineTokenContext, Rules.IsNotForContext), 1 /* Space */)); + this.SpaceAfterTryFinally = new Formatting.Rule(Formatting.RuleDescriptor.create2(Formatting.Shared.TokenRange.FromTokens([40 /* TryKeyword */, 27 /* FinallyKeyword */]), 72 /* OpenBraceToken */), Formatting.RuleOperation.create2(new Formatting.RuleOperationContext(Rules.IsSameLineTokenContext), 1 /* Space */)); + this.SpaceAfterGetSetInMember = new Formatting.Rule(Formatting.RuleDescriptor.create2(Formatting.Shared.TokenRange.FromTokens([66 /* GetKeyword */, 70 /* SetKeyword */]), 9 /* IdentifierName */), Formatting.RuleOperation.create2(new Formatting.RuleOperationContext(Rules.IsFunctionDeclContext), 1 /* Space */)); this.SpaceBeforeBinaryKeywordOperator = new Formatting.Rule(Formatting.RuleDescriptor.create4(Formatting.Shared.TokenRange.Any, Formatting.Shared.TokenRange.BinaryKeywordOperators), Formatting.RuleOperation.create2(new Formatting.RuleOperationContext(Rules.IsSameLineTokenContext, Rules.IsBinaryOpContext), 1 /* Space */)); this.SpaceAfterBinaryKeywordOperator = new Formatting.Rule(Formatting.RuleDescriptor.create4(Formatting.Shared.TokenRange.BinaryKeywordOperators, Formatting.Shared.TokenRange.Any), Formatting.RuleOperation.create2(new Formatting.RuleOperationContext(Rules.IsSameLineTokenContext, Rules.IsBinaryOpContext), 1 /* Space */)); - this.NoSpaceAfterConstructor = new Formatting.Rule(Formatting.RuleDescriptor.create1(62 /* ConstructorKeyword */, 72 /* OpenParenToken */), Formatting.RuleOperation.create2(new Formatting.RuleOperationContext(Rules.IsSameLineTokenContext), 3 /* Delete */)); - this.NoSpaceAfterModuleImport = new Formatting.Rule(Formatting.RuleDescriptor.create2(Formatting.Shared.TokenRange.FromTokens([65 /* ModuleKeyword */, 66 /* RequireKeyword */]), 72 /* OpenParenToken */), Formatting.RuleOperation.create2(new Formatting.RuleOperationContext(Rules.IsSameLineTokenContext), 3 /* Delete */)); - this.SpaceAfterCertainTypeScriptKeywords = new Formatting.Rule(Formatting.RuleDescriptor.create4(Formatting.Shared.TokenRange.FromTokens([44 /* ClassKeyword */, 63 /* DeclareKeyword */, 46 /* EnumKeyword */, 47 /* ExportKeyword */, 48 /* ExtendsKeyword */, 64 /* GetKeyword */, 51 /* ImplementsKeyword */, 49 /* ImportKeyword */, 52 /* InterfaceKeyword */, 65 /* ModuleKeyword */, 55 /* PrivateKeyword */, 57 /* PublicKeyword */, 68 /* SetKeyword */, 58 /* StaticKeyword */]), Formatting.Shared.TokenRange.Any), Formatting.RuleOperation.create2(new Formatting.RuleOperationContext(Rules.IsSameLineTokenContext), 1 /* Space */)); - this.SpaceBeforeCertainTypeScriptKeywords = new Formatting.Rule(Formatting.RuleDescriptor.create4(Formatting.Shared.TokenRange.Any, Formatting.Shared.TokenRange.FromTokens([48 /* ExtendsKeyword */, 51 /* ImplementsKeyword */])), Formatting.RuleOperation.create2(new Formatting.RuleOperationContext(Rules.IsSameLineTokenContext), 1 /* Space */)); - this.SpaceAfterModuleName = new Formatting.Rule(Formatting.RuleDescriptor.create1(14 /* StringLiteral */, 70 /* OpenBraceToken */), Formatting.RuleOperation.create2(new Formatting.RuleOperationContext(Rules.IsModuleDeclContext), 1 /* Space */)); - this.SpaceAfterArrow = new Formatting.Rule(Formatting.RuleDescriptor.create3(85 /* EqualsGreaterThanToken */, Formatting.Shared.TokenRange.Any), Formatting.RuleOperation.create2(new Formatting.RuleOperationContext(Rules.IsSameLineTokenContext), 1 /* Space */)); - this.NoSpaceAfterEllipsis = new Formatting.Rule(Formatting.RuleDescriptor.create1(77 /* DotDotDotToken */, 11 /* IdentifierName */), Formatting.RuleOperation.create2(new Formatting.RuleOperationContext(Rules.IsSameLineTokenContext), 3 /* Delete */)); - this.NoSpaceAfterOptionalParameters = new Formatting.Rule(Formatting.RuleDescriptor.create3(105 /* QuestionToken */, Formatting.Shared.TokenRange.FromTokens([73 /* CloseParenToken */, 79 /* CommaToken */])), Formatting.RuleOperation.create2(new Formatting.RuleOperationContext(Rules.IsSameLineTokenContext, Rules.IsNotBinaryOpContext), 3 /* Delete */)); - this.NoSpaceBeforeOpenAngularBracket = new Formatting.Rule(Formatting.RuleDescriptor.create2(Formatting.Shared.TokenRange.TypeNames, 80 /* LessThanToken */), Formatting.RuleOperation.create2(new Formatting.RuleOperationContext(Rules.IsSameLineTokenContext, Rules.IsTypeArgumentOrParameterContext), 3 /* Delete */)); - this.NoSpaceBetweenCloseParenAndAngularBracket = new Formatting.Rule(Formatting.RuleDescriptor.create1(73 /* CloseParenToken */, 80 /* LessThanToken */), Formatting.RuleOperation.create2(new Formatting.RuleOperationContext(Rules.IsSameLineTokenContext, Rules.IsTypeArgumentOrParameterContext), 3 /* Delete */)); - this.NoSpaceAfterOpenAngularBracket = new Formatting.Rule(Formatting.RuleDescriptor.create3(80 /* LessThanToken */, Formatting.Shared.TokenRange.TypeNames), Formatting.RuleOperation.create2(new Formatting.RuleOperationContext(Rules.IsSameLineTokenContext, Rules.IsTypeArgumentOrParameterContext), 3 /* Delete */)); - this.NoSpaceBeforeCloseAngularBracket = new Formatting.Rule(Formatting.RuleDescriptor.create2(Formatting.Shared.TokenRange.Any, 81 /* GreaterThanToken */), Formatting.RuleOperation.create2(new Formatting.RuleOperationContext(Rules.IsSameLineTokenContext, Rules.IsTypeArgumentOrParameterContext), 3 /* Delete */)); - this.NoSpaceAfterCloseAngularBracket = new Formatting.Rule(Formatting.RuleDescriptor.create3(81 /* GreaterThanToken */, Formatting.Shared.TokenRange.FromTokens([72 /* OpenParenToken */, 74 /* OpenBracketToken */, 81 /* GreaterThanToken */, 79 /* CommaToken */])), Formatting.RuleOperation.create2(new Formatting.RuleOperationContext(Rules.IsSameLineTokenContext, Rules.IsTypeArgumentOrParameterContext), 3 /* Delete */)); - this.NoSpaceBetweenEmptyInterfaceBraceBrackets = new Formatting.Rule(Formatting.RuleDescriptor.create1(70 /* OpenBraceToken */, 71 /* CloseBraceToken */), Formatting.RuleOperation.create2(new Formatting.RuleOperationContext(Rules.IsSameLineTokenContext, Rules.IsObjectTypeContext), 3 /* Delete */)); + this.NoSpaceAfterConstructor = new Formatting.Rule(Formatting.RuleDescriptor.create1(64 /* ConstructorKeyword */, 74 /* OpenParenToken */), Formatting.RuleOperation.create2(new Formatting.RuleOperationContext(Rules.IsSameLineTokenContext), 3 /* Delete */)); + this.NoSpaceAfterModuleImport = new Formatting.Rule(Formatting.RuleDescriptor.create2(Formatting.Shared.TokenRange.FromTokens([67 /* ModuleKeyword */, 68 /* RequireKeyword */]), 74 /* OpenParenToken */), Formatting.RuleOperation.create2(new Formatting.RuleOperationContext(Rules.IsSameLineTokenContext), 3 /* Delete */)); + this.SpaceAfterCertainTypeScriptKeywords = new Formatting.Rule(Formatting.RuleDescriptor.create4(Formatting.Shared.TokenRange.FromTokens([46 /* ClassKeyword */, 65 /* DeclareKeyword */, 48 /* EnumKeyword */, 49 /* ExportKeyword */, 50 /* ExtendsKeyword */, 66 /* GetKeyword */, 53 /* ImplementsKeyword */, 51 /* ImportKeyword */, 54 /* InterfaceKeyword */, 67 /* ModuleKeyword */, 57 /* PrivateKeyword */, 59 /* PublicKeyword */, 70 /* SetKeyword */, 60 /* StaticKeyword */]), Formatting.Shared.TokenRange.Any), Formatting.RuleOperation.create2(new Formatting.RuleOperationContext(Rules.IsSameLineTokenContext), 1 /* Space */)); + this.SpaceBeforeCertainTypeScriptKeywords = new Formatting.Rule(Formatting.RuleDescriptor.create4(Formatting.Shared.TokenRange.Any, Formatting.Shared.TokenRange.FromTokens([50 /* ExtendsKeyword */, 53 /* ImplementsKeyword */])), Formatting.RuleOperation.create2(new Formatting.RuleOperationContext(Rules.IsSameLineTokenContext), 1 /* Space */)); + this.SpaceAfterModuleName = new Formatting.Rule(Formatting.RuleDescriptor.create1(12 /* StringLiteral */, 72 /* OpenBraceToken */), Formatting.RuleOperation.create2(new Formatting.RuleOperationContext(Rules.IsModuleDeclContext), 1 /* Space */)); + this.SpaceAfterArrow = new Formatting.Rule(Formatting.RuleDescriptor.create3(87 /* EqualsGreaterThanToken */, Formatting.Shared.TokenRange.Any), Formatting.RuleOperation.create2(new Formatting.RuleOperationContext(Rules.IsSameLineTokenContext), 1 /* Space */)); + this.NoSpaceAfterEllipsis = new Formatting.Rule(Formatting.RuleDescriptor.create1(79 /* DotDotDotToken */, 9 /* IdentifierName */), Formatting.RuleOperation.create2(new Formatting.RuleOperationContext(Rules.IsSameLineTokenContext), 3 /* Delete */)); + this.NoSpaceAfterOptionalParameters = new Formatting.Rule(Formatting.RuleDescriptor.create3(107 /* QuestionToken */, Formatting.Shared.TokenRange.FromTokens([75 /* CloseParenToken */, 81 /* CommaToken */])), Formatting.RuleOperation.create2(new Formatting.RuleOperationContext(Rules.IsSameLineTokenContext, Rules.IsNotBinaryOpContext), 3 /* Delete */)); + this.NoSpaceBeforeOpenAngularBracket = new Formatting.Rule(Formatting.RuleDescriptor.create2(Formatting.Shared.TokenRange.TypeNames, 82 /* LessThanToken */), Formatting.RuleOperation.create2(new Formatting.RuleOperationContext(Rules.IsSameLineTokenContext, Rules.IsTypeArgumentOrParameterContext), 3 /* Delete */)); + this.NoSpaceBetweenCloseParenAndAngularBracket = new Formatting.Rule(Formatting.RuleDescriptor.create1(75 /* CloseParenToken */, 82 /* LessThanToken */), Formatting.RuleOperation.create2(new Formatting.RuleOperationContext(Rules.IsSameLineTokenContext, Rules.IsTypeArgumentOrParameterContext), 3 /* Delete */)); + this.NoSpaceAfterOpenAngularBracket = new Formatting.Rule(Formatting.RuleDescriptor.create3(82 /* LessThanToken */, Formatting.Shared.TokenRange.TypeNames), Formatting.RuleOperation.create2(new Formatting.RuleOperationContext(Rules.IsSameLineTokenContext, Rules.IsTypeArgumentOrParameterContext), 3 /* Delete */)); + this.NoSpaceBeforeCloseAngularBracket = new Formatting.Rule(Formatting.RuleDescriptor.create2(Formatting.Shared.TokenRange.Any, 83 /* GreaterThanToken */), Formatting.RuleOperation.create2(new Formatting.RuleOperationContext(Rules.IsSameLineTokenContext, Rules.IsTypeArgumentOrParameterContext), 3 /* Delete */)); + this.NoSpaceAfterCloseAngularBracket = new Formatting.Rule(Formatting.RuleDescriptor.create3(83 /* GreaterThanToken */, Formatting.Shared.TokenRange.FromTokens([74 /* OpenParenToken */, 76 /* OpenBracketToken */, 83 /* GreaterThanToken */, 81 /* CommaToken */])), Formatting.RuleOperation.create2(new Formatting.RuleOperationContext(Rules.IsSameLineTokenContext, Rules.IsTypeArgumentOrParameterContext), 3 /* Delete */)); + this.NoSpaceBetweenEmptyInterfaceBraceBrackets = new Formatting.Rule(Formatting.RuleDescriptor.create1(72 /* OpenBraceToken */, 73 /* CloseBraceToken */), Formatting.RuleOperation.create2(new Formatting.RuleOperationContext(Rules.IsSameLineTokenContext, Rules.IsObjectTypeContext), 3 /* Delete */)); this.HighPriorityCommonRules = [ this.IgnoreBeforeComment, this.IgnoreAfterLineComment, @@ -29161,26 +30116,26 @@ var TypeScript; this.SpaceBetweenStatements, this.SpaceAfterTryFinally ]; - this.SpaceAfterComma = new Formatting.Rule(Formatting.RuleDescriptor.create3(79 /* CommaToken */, Formatting.Shared.TokenRange.Any), Formatting.RuleOperation.create2(new Formatting.RuleOperationContext(Rules.IsSameLineTokenContext), 1 /* Space */)); - this.NoSpaceAfterComma = new Formatting.Rule(Formatting.RuleDescriptor.create3(79 /* CommaToken */, Formatting.Shared.TokenRange.Any), Formatting.RuleOperation.create2(new Formatting.RuleOperationContext(Rules.IsSameLineTokenContext), 3 /* Delete */)); + this.SpaceAfterComma = new Formatting.Rule(Formatting.RuleDescriptor.create3(81 /* CommaToken */, Formatting.Shared.TokenRange.Any), Formatting.RuleOperation.create2(new Formatting.RuleOperationContext(Rules.IsSameLineTokenContext), 1 /* Space */)); + this.NoSpaceAfterComma = new Formatting.Rule(Formatting.RuleDescriptor.create3(81 /* CommaToken */, Formatting.Shared.TokenRange.Any), Formatting.RuleOperation.create2(new Formatting.RuleOperationContext(Rules.IsSameLineTokenContext), 3 /* Delete */)); this.SpaceBeforeBinaryOperator = new Formatting.Rule(Formatting.RuleDescriptor.create4(Formatting.Shared.TokenRange.Any, Formatting.Shared.TokenRange.BinaryOperators), Formatting.RuleOperation.create2(new Formatting.RuleOperationContext(Rules.IsSameLineTokenContext, Rules.IsBinaryOpContext), 1 /* Space */)); this.SpaceAfterBinaryOperator = new Formatting.Rule(Formatting.RuleDescriptor.create4(Formatting.Shared.TokenRange.BinaryOperators, Formatting.Shared.TokenRange.Any), Formatting.RuleOperation.create2(new Formatting.RuleOperationContext(Rules.IsSameLineTokenContext, Rules.IsBinaryOpContext), 1 /* Space */)); this.NoSpaceBeforeBinaryOperator = new Formatting.Rule(Formatting.RuleDescriptor.create4(Formatting.Shared.TokenRange.Any, Formatting.Shared.TokenRange.BinaryOperators), Formatting.RuleOperation.create2(new Formatting.RuleOperationContext(Rules.IsSameLineTokenContext, Rules.IsBinaryOpContext), 3 /* Delete */)); this.NoSpaceAfterBinaryOperator = new Formatting.Rule(Formatting.RuleDescriptor.create4(Formatting.Shared.TokenRange.BinaryOperators, Formatting.Shared.TokenRange.Any), Formatting.RuleOperation.create2(new Formatting.RuleOperationContext(Rules.IsSameLineTokenContext, Rules.IsBinaryOpContext), 3 /* Delete */)); - this.SpaceAfterKeywordInControl = new Formatting.Rule(Formatting.RuleDescriptor.create2(Formatting.Shared.TokenRange.Keywords, 72 /* OpenParenToken */), Formatting.RuleOperation.create2(new Formatting.RuleOperationContext(Rules.IsControlDeclContext), 1 /* Space */)); - this.NoSpaceAfterKeywordInControl = new Formatting.Rule(Formatting.RuleDescriptor.create2(Formatting.Shared.TokenRange.Keywords, 72 /* OpenParenToken */), Formatting.RuleOperation.create2(new Formatting.RuleOperationContext(Rules.IsControlDeclContext), 3 /* Delete */)); - this.NewLineBeforeOpenBraceInFunction = new Formatting.Rule(Formatting.RuleDescriptor.create2(this.FunctionOpenBraceLeftTokenRange, 70 /* OpenBraceToken */), Formatting.RuleOperation.create2(new Formatting.RuleOperationContext(Rules.IsFunctionDeclContext, Rules.IsBeforeMultilineBlockContext), 2 /* NewLine */), 1 /* CanDeleteNewLines */); - this.NewLineBeforeOpenBraceInTypeScriptDeclWithBlock = new Formatting.Rule(Formatting.RuleDescriptor.create2(this.TypeScriptOpenBraceLeftTokenRange, 70 /* OpenBraceToken */), Formatting.RuleOperation.create2(new Formatting.RuleOperationContext(Rules.IsTypeScriptDeclWithBlockContext, Rules.IsBeforeMultilineBlockContext), 2 /* NewLine */), 1 /* CanDeleteNewLines */); - this.NewLineBeforeOpenBraceInControl = new Formatting.Rule(Formatting.RuleDescriptor.create2(this.ControlOpenBraceLeftTokenRange, 70 /* OpenBraceToken */), Formatting.RuleOperation.create2(new Formatting.RuleOperationContext(Rules.IsControlDeclContext, Rules.IsBeforeMultilineBlockContext), 2 /* NewLine */), 1 /* CanDeleteNewLines */); - this.SpaceAfterSemicolonInFor = new Formatting.Rule(Formatting.RuleDescriptor.create3(78 /* SemicolonToken */, Formatting.Shared.TokenRange.Any), Formatting.RuleOperation.create2(new Formatting.RuleOperationContext(Rules.IsSameLineTokenContext, Rules.IsForContext), 1 /* Space */)); - this.NoSpaceAfterSemicolonInFor = new Formatting.Rule(Formatting.RuleDescriptor.create3(78 /* SemicolonToken */, Formatting.Shared.TokenRange.Any), Formatting.RuleOperation.create2(new Formatting.RuleOperationContext(Rules.IsSameLineTokenContext, Rules.IsForContext), 3 /* Delete */)); - this.SpaceAfterOpenParen = new Formatting.Rule(Formatting.RuleDescriptor.create3(72 /* OpenParenToken */, Formatting.Shared.TokenRange.Any), Formatting.RuleOperation.create2(new Formatting.RuleOperationContext(Rules.IsSameLineTokenContext), 1 /* Space */)); - this.SpaceBeforeCloseParen = new Formatting.Rule(Formatting.RuleDescriptor.create2(Formatting.Shared.TokenRange.Any, 73 /* CloseParenToken */), Formatting.RuleOperation.create2(new Formatting.RuleOperationContext(Rules.IsSameLineTokenContext), 1 /* Space */)); - this.NoSpaceBetweenParens = new Formatting.Rule(Formatting.RuleDescriptor.create1(72 /* OpenParenToken */, 73 /* CloseParenToken */), Formatting.RuleOperation.create2(new Formatting.RuleOperationContext(Rules.IsSameLineTokenContext), 3 /* Delete */)); - this.NoSpaceAfterOpenParen = new Formatting.Rule(Formatting.RuleDescriptor.create3(72 /* OpenParenToken */, Formatting.Shared.TokenRange.Any), Formatting.RuleOperation.create2(new Formatting.RuleOperationContext(Rules.IsSameLineTokenContext), 3 /* Delete */)); - this.NoSpaceBeforeCloseParen = new Formatting.Rule(Formatting.RuleDescriptor.create2(Formatting.Shared.TokenRange.Any, 73 /* CloseParenToken */), Formatting.RuleOperation.create2(new Formatting.RuleOperationContext(Rules.IsSameLineTokenContext), 3 /* Delete */)); - this.SpaceAfterAnonymousFunctionKeyword = new Formatting.Rule(Formatting.RuleDescriptor.create1(27 /* FunctionKeyword */, 72 /* OpenParenToken */), Formatting.RuleOperation.create2(new Formatting.RuleOperationContext(Rules.IsFunctionDeclContext), 1 /* Space */)); - this.NoSpaceAfterAnonymousFunctionKeyword = new Formatting.Rule(Formatting.RuleDescriptor.create1(27 /* FunctionKeyword */, 72 /* OpenParenToken */), Formatting.RuleOperation.create2(new Formatting.RuleOperationContext(Rules.IsFunctionDeclContext), 3 /* Delete */)); + this.SpaceAfterKeywordInControl = new Formatting.Rule(Formatting.RuleDescriptor.create2(Formatting.Shared.TokenRange.Keywords, 74 /* OpenParenToken */), Formatting.RuleOperation.create2(new Formatting.RuleOperationContext(Rules.IsControlDeclContext), 1 /* Space */)); + this.NoSpaceAfterKeywordInControl = new Formatting.Rule(Formatting.RuleDescriptor.create2(Formatting.Shared.TokenRange.Keywords, 74 /* OpenParenToken */), Formatting.RuleOperation.create2(new Formatting.RuleOperationContext(Rules.IsControlDeclContext), 3 /* Delete */)); + this.NewLineBeforeOpenBraceInFunction = new Formatting.Rule(Formatting.RuleDescriptor.create2(this.FunctionOpenBraceLeftTokenRange, 72 /* OpenBraceToken */), Formatting.RuleOperation.create2(new Formatting.RuleOperationContext(Rules.IsFunctionDeclContext, Rules.IsBeforeMultilineBlockContext), 2 /* NewLine */), 1 /* CanDeleteNewLines */); + this.NewLineBeforeOpenBraceInTypeScriptDeclWithBlock = new Formatting.Rule(Formatting.RuleDescriptor.create2(this.TypeScriptOpenBraceLeftTokenRange, 72 /* OpenBraceToken */), Formatting.RuleOperation.create2(new Formatting.RuleOperationContext(Rules.IsTypeScriptDeclWithBlockContext, Rules.IsBeforeMultilineBlockContext), 2 /* NewLine */), 1 /* CanDeleteNewLines */); + this.NewLineBeforeOpenBraceInControl = new Formatting.Rule(Formatting.RuleDescriptor.create2(this.ControlOpenBraceLeftTokenRange, 72 /* OpenBraceToken */), Formatting.RuleOperation.create2(new Formatting.RuleOperationContext(Rules.IsControlDeclContext, Rules.IsBeforeMultilineBlockContext), 2 /* NewLine */), 1 /* CanDeleteNewLines */); + this.SpaceAfterSemicolonInFor = new Formatting.Rule(Formatting.RuleDescriptor.create3(80 /* SemicolonToken */, Formatting.Shared.TokenRange.Any), Formatting.RuleOperation.create2(new Formatting.RuleOperationContext(Rules.IsSameLineTokenContext, Rules.IsForContext), 1 /* Space */)); + this.NoSpaceAfterSemicolonInFor = new Formatting.Rule(Formatting.RuleDescriptor.create3(80 /* SemicolonToken */, Formatting.Shared.TokenRange.Any), Formatting.RuleOperation.create2(new Formatting.RuleOperationContext(Rules.IsSameLineTokenContext, Rules.IsForContext), 3 /* Delete */)); + this.SpaceAfterOpenParen = new Formatting.Rule(Formatting.RuleDescriptor.create3(74 /* OpenParenToken */, Formatting.Shared.TokenRange.Any), Formatting.RuleOperation.create2(new Formatting.RuleOperationContext(Rules.IsSameLineTokenContext), 1 /* Space */)); + this.SpaceBeforeCloseParen = new Formatting.Rule(Formatting.RuleDescriptor.create2(Formatting.Shared.TokenRange.Any, 75 /* CloseParenToken */), Formatting.RuleOperation.create2(new Formatting.RuleOperationContext(Rules.IsSameLineTokenContext), 1 /* Space */)); + this.NoSpaceBetweenParens = new Formatting.Rule(Formatting.RuleDescriptor.create1(74 /* OpenParenToken */, 75 /* CloseParenToken */), Formatting.RuleOperation.create2(new Formatting.RuleOperationContext(Rules.IsSameLineTokenContext), 3 /* Delete */)); + this.NoSpaceAfterOpenParen = new Formatting.Rule(Formatting.RuleDescriptor.create3(74 /* OpenParenToken */, Formatting.Shared.TokenRange.Any), Formatting.RuleOperation.create2(new Formatting.RuleOperationContext(Rules.IsSameLineTokenContext), 3 /* Delete */)); + this.NoSpaceBeforeCloseParen = new Formatting.Rule(Formatting.RuleDescriptor.create2(Formatting.Shared.TokenRange.Any, 75 /* CloseParenToken */), Formatting.RuleOperation.create2(new Formatting.RuleOperationContext(Rules.IsSameLineTokenContext), 3 /* Delete */)); + this.SpaceAfterAnonymousFunctionKeyword = new Formatting.Rule(Formatting.RuleDescriptor.create1(29 /* FunctionKeyword */, 74 /* OpenParenToken */), Formatting.RuleOperation.create2(new Formatting.RuleOperationContext(Rules.IsFunctionDeclContext), 1 /* Space */)); + this.NoSpaceAfterAnonymousFunctionKeyword = new Formatting.Rule(Formatting.RuleDescriptor.create1(29 /* FunctionKeyword */, 74 /* OpenParenToken */), Formatting.RuleOperation.create2(new Formatting.RuleOperationContext(Rules.IsFunctionDeclContext), 3 /* Delete */)); } Rules.prototype.getRuleName = function (rule) { var o = this; @@ -29192,56 +30147,22 @@ var TypeScript; throw new Error(TypeScript.getDiagnosticMessage(TypeScript.DiagnosticCode.Unknown_rule, null)); }; Rules.IsForContext = function (context) { - return context.contextNode.kind() === 155 /* ForStatement */; + return context.contextNode.kind() === 159 /* ForStatement */; }; Rules.IsNotForContext = function (context) { return !Rules.IsForContext(context); }; Rules.IsBinaryOpContext = function (context) { switch (context.contextNode.kind()) { - case 175 /* AssignmentExpression */: - case 176 /* AddAssignmentExpression */: - case 177 /* SubtractAssignmentExpression */: - case 178 /* MultiplyAssignmentExpression */: - case 179 /* DivideAssignmentExpression */: - case 180 /* ModuloAssignmentExpression */: - case 181 /* AndAssignmentExpression */: - case 182 /* ExclusiveOrAssignmentExpression */: - case 183 /* OrAssignmentExpression */: - case 184 /* LeftShiftAssignmentExpression */: - case 185 /* SignedRightShiftAssignmentExpression */: - case 186 /* UnsignedRightShiftAssignmentExpression */: - case 187 /* ConditionalExpression */: - case 188 /* LogicalOrExpression */: - case 189 /* LogicalAndExpression */: - case 190 /* BitwiseOrExpression */: - case 191 /* BitwiseExclusiveOrExpression */: - case 192 /* BitwiseAndExpression */: - case 193 /* EqualsWithTypeConversionExpression */: - case 194 /* NotEqualsWithTypeConversionExpression */: - case 195 /* EqualsExpression */: - case 196 /* NotEqualsExpression */: - case 197 /* LessThanExpression */: - case 198 /* GreaterThanExpression */: - case 199 /* LessThanOrEqualExpression */: - case 200 /* GreaterThanOrEqualExpression */: - case 201 /* InstanceOfExpression */: - case 202 /* InExpression */: - case 203 /* LeftShiftExpression */: - case 204 /* SignedRightShiftExpression */: - case 205 /* UnsignedRightShiftExpression */: - case 206 /* MultiplyExpression */: - case 207 /* DivideExpression */: - case 208 /* ModuloExpression */: - case 209 /* AddExpression */: - case 210 /* SubtractExpression */: + case 174 /* BinaryExpression */: + case 173 /* ConditionalExpression */: return true; - case 134 /* ImportDeclaration */: - case 226 /* VariableDeclarator */: - case 233 /* EqualsValueClause */: - return context.currentTokenSpan.kind === 107 /* EqualsToken */ || context.nextTokenSpan.kind === 107 /* EqualsToken */; - case 156 /* ForInStatement */: - return context.currentTokenSpan.kind === 29 /* InKeyword */ || context.nextTokenSpan.kind === 29 /* InKeyword */; + case 138 /* ImportDeclaration */: + case 191 /* VariableDeclarator */: + case 197 /* EqualsValueClause */: + return context.currentTokenSpan.kind === 109 /* EqualsToken */ || context.nextTokenSpan.kind === 109 /* EqualsToken */; + case 160 /* ForInStatement */: + return context.currentTokenSpan.kind === 31 /* InKeyword */ || context.nextTokenSpan.kind === 31 /* InKeyword */; } return false; }; @@ -29271,26 +30192,26 @@ var TypeScript; return true; } switch (node.kind()) { - case 147 /* Block */: - case 152 /* SwitchStatement */: - case 216 /* ObjectLiteralExpression */: + case 151 /* Block */: + case 156 /* SwitchStatement */: + case 179 /* ObjectLiteralExpression */: return true; } return false; }; Rules.IsFunctionDeclContext = function (context) { switch (context.contextNode.kind()) { - case 130 /* FunctionDeclaration */: - case 136 /* MemberFunctionDeclaration */: - case 140 /* GetAccessor */: - case 141 /* SetAccessor */: - case 146 /* MethodSignature */: - case 143 /* CallSignature */: - case 223 /* FunctionExpression */: - case 138 /* ConstructorDeclaration */: - case 220 /* SimpleArrowFunctionExpression */: - case 219 /* ParenthesizedArrowFunctionExpression */: - case 129 /* InterfaceDeclaration */: + case 134 /* FunctionDeclaration */: + case 140 /* MemberFunctionDeclaration */: + case 144 /* GetAccessor */: + case 145 /* SetAccessor */: + case 150 /* MethodSignature */: + case 147 /* CallSignature */: + case 186 /* FunctionExpression */: + case 142 /* ConstructorDeclaration */: + case 183 /* SimpleArrowFunctionExpression */: + case 182 /* ParenthesizedArrowFunctionExpression */: + case 133 /* InterfaceDeclaration */: return true; } return false; @@ -29300,51 +30221,51 @@ var TypeScript; }; Rules.NodeIsTypeScriptDeclWithBlockContext = function (node) { switch (node.kind()) { - case 132 /* ClassDeclaration */: - case 133 /* EnumDeclaration */: - case 122 /* ObjectType */: - case 131 /* ModuleDeclaration */: + case 136 /* ClassDeclaration */: + case 137 /* EnumDeclaration */: + case 124 /* ObjectType */: + case 135 /* ModuleDeclaration */: return true; } return false; }; Rules.IsAfterCodeBlockContext = function (context) { switch (context.currentTokenParent.kind()) { - case 132 /* ClassDeclaration */: - case 131 /* ModuleDeclaration */: - case 133 /* EnumDeclaration */: - case 147 /* Block */: - case 152 /* SwitchStatement */: + case 136 /* ClassDeclaration */: + case 135 /* ModuleDeclaration */: + case 137 /* EnumDeclaration */: + case 151 /* Block */: + case 156 /* SwitchStatement */: return true; } return false; }; Rules.IsControlDeclContext = function (context) { switch (context.contextNode.kind()) { - case 148 /* IfStatement */: - case 152 /* SwitchStatement */: - case 155 /* ForStatement */: - case 156 /* ForInStatement */: - case 159 /* WhileStatement */: - case 160 /* TryStatement */: - case 162 /* DoStatement */: - case 164 /* WithStatement */: - case 236 /* ElseClause */: - case 237 /* CatchClause */: - case 238 /* FinallyClause */: + case 152 /* IfStatement */: + case 156 /* SwitchStatement */: + case 159 /* ForStatement */: + case 160 /* ForInStatement */: + case 163 /* WhileStatement */: + case 164 /* TryStatement */: + case 166 /* DoStatement */: + case 168 /* WithStatement */: + case 200 /* ElseClause */: + case 201 /* CatchClause */: + case 202 /* FinallyClause */: return true; default: return false; } }; Rules.IsObjectContext = function (context) { - return context.contextNode.kind() === 216 /* ObjectLiteralExpression */; + return context.contextNode.kind() === 179 /* ObjectLiteralExpression */; }; Rules.IsFunctionCallContext = function (context) { - return context.contextNode.kind() === 214 /* InvocationExpression */; + return context.contextNode.kind() === 177 /* InvocationExpression */; }; Rules.IsNewContext = function (context) { - return context.contextNode.kind() === 217 /* ObjectCreationExpression */; + return context.contextNode.kind() === 180 /* ObjectCreationExpression */; }; Rules.IsFunctionCallOrNewContext = function (context) { return Rules.IsFunctionCallContext(context) || Rules.IsNewContext(context); @@ -29356,19 +30277,19 @@ var TypeScript; return context.formattingRequestKind != 2 /* FormatOnEnter */; }; Rules.IsModuleDeclContext = function (context) { - return context.contextNode.kind() === 131 /* ModuleDeclaration */; + return context.contextNode.kind() === 135 /* ModuleDeclaration */; }; Rules.IsObjectTypeContext = function (context) { - return context.contextNode.kind() === 122 /* ObjectType */ && context.contextNode.parent().kind() !== 129 /* InterfaceDeclaration */; + return context.contextNode.kind() === 124 /* ObjectType */ && context.contextNode.parent().kind() !== 133 /* InterfaceDeclaration */; }; Rules.IsTypeArgumentOrParameter = function (tokenKind, parentKind) { - return ((tokenKind === 80 /* LessThanToken */ || tokenKind === 81 /* GreaterThanToken */) && (parentKind === 230 /* TypeParameterList */ || parentKind === 229 /* TypeArgumentList */)); + return ((tokenKind === 82 /* LessThanToken */ || tokenKind === 83 /* GreaterThanToken */) && (parentKind === 195 /* TypeParameterList */ || parentKind === 194 /* TypeArgumentList */)); }; Rules.IsTypeArgumentOrParameterContext = function (context) { return Rules.IsTypeArgumentOrParameter(context.currentTokenSpan.kind, context.currentTokenParent.kind()) || Rules.IsTypeArgumentOrParameter(context.nextTokenSpan.kind, context.nextTokenParent.kind()); }; Rules.IsVoidOpContext = function (context) { - return context.currentTokenSpan.kind === 41 /* VoidKeyword */ && context.currentTokenParent.kind() === 173 /* VoidExpression */; + return context.currentTokenSpan.kind === 43 /* VoidKeyword */ && context.currentTokenParent.kind() === 172 /* VoidExpression */; }; return Rules; })(); @@ -29721,20 +30642,20 @@ var TypeScript; return this.tokenAccess.toString(); }; TokenRange.Any = TokenRange.AllTokens(); - TokenRange.AnyIncludingMultilineComments = TokenRange.FromTokens(TokenRange.Any.GetTokens().concat([6 /* MultiLineCommentTrivia */])); + TokenRange.AnyIncludingMultilineComments = TokenRange.FromTokens(TokenRange.Any.GetTokens().concat([4 /* MultiLineCommentTrivia */])); TokenRange.Keywords = TokenRange.FromRange(TypeScript.SyntaxKind.FirstKeyword, TypeScript.SyntaxKind.LastKeyword); - TokenRange.Operators = TokenRange.FromRange(78 /* SemicolonToken */, 119 /* SlashEqualsToken */); - TokenRange.BinaryOperators = TokenRange.FromRange(80 /* LessThanToken */, 119 /* SlashEqualsToken */); - TokenRange.BinaryKeywordOperators = TokenRange.FromTokens([29 /* InKeyword */, 30 /* InstanceOfKeyword */]); + TokenRange.Operators = TokenRange.FromRange(80 /* SemicolonToken */, 121 /* SlashEqualsToken */); + TokenRange.BinaryOperators = TokenRange.FromRange(82 /* LessThanToken */, 121 /* SlashEqualsToken */); + TokenRange.BinaryKeywordOperators = TokenRange.FromTokens([31 /* InKeyword */, 32 /* InstanceOfKeyword */]); TokenRange.ReservedKeywords = TokenRange.FromRange(TypeScript.SyntaxKind.FirstFutureReservedStrictKeyword, TypeScript.SyntaxKind.LastFutureReservedStrictKeyword); - TokenRange.UnaryPrefixOperators = TokenRange.FromTokens([93 /* PlusPlusToken */, 94 /* MinusMinusToken */, 102 /* TildeToken */, 101 /* ExclamationToken */]); - TokenRange.UnaryPrefixExpressions = TokenRange.FromTokens([13 /* NumericLiteral */, 11 /* IdentifierName */, 72 /* OpenParenToken */, 74 /* OpenBracketToken */, 70 /* OpenBraceToken */, 35 /* ThisKeyword */, 31 /* NewKeyword */]); - TokenRange.UnaryPreincrementExpressions = TokenRange.FromTokens([11 /* IdentifierName */, 72 /* OpenParenToken */, 35 /* ThisKeyword */, 31 /* NewKeyword */]); - TokenRange.UnaryPostincrementExpressions = TokenRange.FromTokens([11 /* IdentifierName */, 73 /* CloseParenToken */, 75 /* CloseBracketToken */, 31 /* NewKeyword */]); - TokenRange.UnaryPredecrementExpressions = TokenRange.FromTokens([11 /* IdentifierName */, 72 /* OpenParenToken */, 35 /* ThisKeyword */, 31 /* NewKeyword */]); - TokenRange.UnaryPostdecrementExpressions = TokenRange.FromTokens([11 /* IdentifierName */, 73 /* CloseParenToken */, 75 /* CloseBracketToken */, 31 /* NewKeyword */]); - TokenRange.Comments = TokenRange.FromTokens([7 /* SingleLineCommentTrivia */, 6 /* MultiLineCommentTrivia */]); - TokenRange.TypeNames = TokenRange.FromTokens([11 /* IdentifierName */, 67 /* NumberKeyword */, 69 /* StringKeyword */, 61 /* BooleanKeyword */, 41 /* VoidKeyword */, 60 /* AnyKeyword */]); + TokenRange.UnaryPrefixOperators = TokenRange.FromTokens([95 /* PlusPlusToken */, 96 /* MinusMinusToken */, 104 /* TildeToken */, 103 /* ExclamationToken */]); + TokenRange.UnaryPrefixExpressions = TokenRange.FromTokens([11 /* NumericLiteral */, 9 /* IdentifierName */, 74 /* OpenParenToken */, 76 /* OpenBracketToken */, 72 /* OpenBraceToken */, 37 /* ThisKeyword */, 33 /* NewKeyword */]); + TokenRange.UnaryPreincrementExpressions = TokenRange.FromTokens([9 /* IdentifierName */, 74 /* OpenParenToken */, 37 /* ThisKeyword */, 33 /* NewKeyword */]); + TokenRange.UnaryPostincrementExpressions = TokenRange.FromTokens([9 /* IdentifierName */, 75 /* CloseParenToken */, 77 /* CloseBracketToken */, 33 /* NewKeyword */]); + TokenRange.UnaryPredecrementExpressions = TokenRange.FromTokens([9 /* IdentifierName */, 74 /* OpenParenToken */, 37 /* ThisKeyword */, 33 /* NewKeyword */]); + TokenRange.UnaryPostdecrementExpressions = TokenRange.FromTokens([9 /* IdentifierName */, 75 /* CloseParenToken */, 77 /* CloseBracketToken */, 33 /* NewKeyword */]); + TokenRange.Comments = TokenRange.FromTokens([5 /* SingleLineCommentTrivia */, 4 /* MultiLineCommentTrivia */]); + TokenRange.TypeNames = TokenRange.FromTokens([9 /* IdentifierName */, 69 /* NumberKeyword */, 71 /* StringKeyword */, 63 /* BooleanKeyword */, 43 /* VoidKeyword */, 62 /* AnyKeyword */]); return TokenRange; })(); Shared.TokenRange = TokenRange; @@ -29873,10 +30794,8 @@ var TypeScript; (function (Services) { var Formatting; (function (Formatting) { - var IndentationTrackingWalker = (function (_super) { - __extends(IndentationTrackingWalker, _super); + var IndentationTrackingWalker = (function () { function IndentationTrackingWalker(textSpan, sourceUnit, snapshot, indentFirstToken, options) { - _super.call(this); this.options = options; this._position = 0; this._parent = null; @@ -29925,17 +30844,34 @@ var TypeScript; if (tokenSpan.intersectsWithTextSpan(this._textSpan)) { this.visitTokenInSpan(token); var trivia = token.trailingTrivia(); - this._lastTriviaWasNewLine = trivia.hasNewLine() && trivia.syntaxTriviaAt(trivia.count() - 1).kind() == 5 /* NewLineTrivia */; + this._lastTriviaWasNewLine = trivia.hasNewLine() && trivia.syntaxTriviaAt(trivia.count() - 1).kind() == 3 /* NewLineTrivia */; } this._position += token.fullWidth(); }; + IndentationTrackingWalker.prototype.walk = function (element) { + if (element) { + if (TypeScript.isToken(element)) { + this.visitToken(element); + } + else if (element.kind() === 1 /* List */) { + for (var i = 0, n = TypeScript.childCount(element); i < n; i++) { + this.walk(TypeScript.childAt(element, i)); + } + } + else { + this.visitNode(element); + } + } + }; IndentationTrackingWalker.prototype.visitNode = function (node) { var nodeSpan = new TypeScript.TextSpan(this._position, TypeScript.fullWidth(node)); if (nodeSpan.intersectsWithTextSpan(this._textSpan)) { var indentation = this.getNodeIndentation(node); var currentParent = this._parent; this._parent = this._indentationNodeContextPool.getNode(currentParent, node, this._position, indentation.indentationAmount, indentation.indentationAmountDelta); - TypeScript.visitNodeOrToken(this, node); + for (var i = 0, n = TypeScript.childCount(node); i < n; i++) { + this.walk(TypeScript.childAt(node, i)); + } this._indentationNodeContextPool.releaseNode(this._parent); this._parent = currentParent; } @@ -29944,13 +30880,13 @@ var TypeScript; } }; IndentationTrackingWalker.prototype.getTokenIndentationAmount = function (token) { - if (TypeScript.firstToken(this._parent.node()) === token || token.kind() === 70 /* OpenBraceToken */ || token.kind() === 71 /* CloseBraceToken */ || token.kind() === 74 /* OpenBracketToken */ || token.kind() === 75 /* CloseBracketToken */ || (token.kind() === 42 /* WhileKeyword */ && this._parent.node().kind() == 162 /* DoStatement */)) { + if (TypeScript.firstToken(this._parent.node()) === token || token.kind() === 72 /* OpenBraceToken */ || token.kind() === 73 /* CloseBraceToken */ || token.kind() === 76 /* OpenBracketToken */ || token.kind() === 77 /* CloseBracketToken */ || (token.kind() === 44 /* WhileKeyword */ && this._parent.node().kind() == 166 /* DoStatement */)) { return this._parent.indentationAmount(); } return (this._parent.indentationAmount() + this._parent.childIndentationAmountDelta()); }; IndentationTrackingWalker.prototype.getCommentIndentationAmount = function (token) { - if (token.kind() === 71 /* CloseBraceToken */ || token.kind() === 75 /* CloseBracketToken */) { + if (token.kind() === 73 /* CloseBraceToken */ || token.kind() === 77 /* CloseBracketToken */) { return (this._parent.indentationAmount() + this._parent.childIndentationAmountDelta()); } return this._parent.indentationAmount(); @@ -29962,7 +30898,7 @@ var TypeScript; parentIndentationAmount = parent.indentationAmount(); } else { - if (parent.kind() === 147 /* Block */ && !this.shouldIndentBlockInParent(this._parent.parent())) { + if (parent.kind() === 151 /* Block */ && !this.shouldIndentBlockInParent(this._parent.parent())) { parent = this._parent.parent(); } var line = this._snapshot.getLineFromPosition(parent.start()).getText(); @@ -29978,46 +30914,46 @@ var TypeScript; indentationAmount = (parentIndentationAmount + parentIndentationAmountDelta); indentationAmountDelta = 0; break; - case 132 /* ClassDeclaration */: - case 131 /* ModuleDeclaration */: - case 122 /* ObjectType */: - case 133 /* EnumDeclaration */: - case 152 /* SwitchStatement */: - case 216 /* ObjectLiteralExpression */: - case 138 /* ConstructorDeclaration */: - case 130 /* FunctionDeclaration */: - case 223 /* FunctionExpression */: - case 136 /* MemberFunctionDeclaration */: - case 140 /* GetAccessor */: - case 141 /* SetAccessor */: - case 139 /* IndexMemberDeclaration */: - case 237 /* CatchClause */: - case 215 /* ArrayLiteralExpression */: - case 124 /* ArrayType */: - case 222 /* ElementAccessExpression */: - case 145 /* IndexSignature */: - case 155 /* ForStatement */: - case 156 /* ForInStatement */: - case 159 /* WhileStatement */: - case 162 /* DoStatement */: - case 164 /* WithStatement */: - case 234 /* CaseSwitchClause */: - case 235 /* DefaultSwitchClause */: - case 151 /* ReturnStatement */: - case 158 /* ThrowStatement */: - case 220 /* SimpleArrowFunctionExpression */: - case 219 /* ParenthesizedArrowFunctionExpression */: - case 225 /* VariableDeclaration */: - case 135 /* ExportAssignment */: - case 214 /* InvocationExpression */: - case 217 /* ObjectCreationExpression */: - case 143 /* CallSignature */: - case 144 /* ConstructSignature */: + case 136 /* ClassDeclaration */: + case 135 /* ModuleDeclaration */: + case 124 /* ObjectType */: + case 137 /* EnumDeclaration */: + case 156 /* SwitchStatement */: + case 179 /* ObjectLiteralExpression */: + case 142 /* ConstructorDeclaration */: + case 134 /* FunctionDeclaration */: + case 186 /* FunctionExpression */: + case 140 /* MemberFunctionDeclaration */: + case 144 /* GetAccessor */: + case 145 /* SetAccessor */: + case 143 /* IndexMemberDeclaration */: + case 201 /* CatchClause */: + case 178 /* ArrayLiteralExpression */: + case 126 /* ArrayType */: + case 185 /* ElementAccessExpression */: + case 149 /* IndexSignature */: + case 159 /* ForStatement */: + case 160 /* ForInStatement */: + case 163 /* WhileStatement */: + case 166 /* DoStatement */: + case 168 /* WithStatement */: + case 198 /* CaseSwitchClause */: + case 199 /* DefaultSwitchClause */: + case 155 /* ReturnStatement */: + case 162 /* ThrowStatement */: + case 183 /* SimpleArrowFunctionExpression */: + case 182 /* ParenthesizedArrowFunctionExpression */: + case 190 /* VariableDeclaration */: + case 139 /* ExportAssignment */: + case 177 /* InvocationExpression */: + case 180 /* ObjectCreationExpression */: + case 147 /* CallSignature */: + case 148 /* ConstructSignature */: indentationAmount = (parentIndentationAmount + parentIndentationAmountDelta); indentationAmountDelta = this.options.indentSpaces; break; - case 148 /* IfStatement */: - if (parent.kind() === 236 /* ElseClause */ && !TypeScript.SyntaxUtilities.isLastTokenOnLine(parentNode.elseKeyword, this._text)) { + case 152 /* IfStatement */: + if (parent.kind() === 200 /* ElseClause */ && !TypeScript.SyntaxUtilities.isLastTokenOnLine(parentNode.elseKeyword, this._text)) { indentationAmount = parentIndentationAmount; } else { @@ -30025,11 +30961,11 @@ var TypeScript; } indentationAmountDelta = this.options.indentSpaces; break; - case 236 /* ElseClause */: + case 200 /* ElseClause */: indentationAmount = parentIndentationAmount; indentationAmountDelta = this.options.indentSpaces; break; - case 147 /* Block */: + case 151 /* Block */: if (this.shouldIndentBlockInParent(parent)) { indentationAmount = parentIndentationAmount + parentIndentationAmountDelta; } @@ -30056,11 +30992,11 @@ var TypeScript; }; IndentationTrackingWalker.prototype.shouldIndentBlockInParent = function (parent) { switch (parent.kind()) { - case 120 /* SourceUnit */: - case 131 /* ModuleDeclaration */: - case 147 /* Block */: - case 234 /* CaseSwitchClause */: - case 235 /* DefaultSwitchClause */: + case 122 /* SourceUnit */: + case 135 /* ModuleDeclaration */: + case 151 /* Block */: + case 198 /* CaseSwitchClause */: + case 199 /* DefaultSwitchClause */: return true; default: return false; @@ -30076,7 +31012,7 @@ var TypeScript; } }; return IndentationTrackingWalker; - })(TypeScript.SyntaxWalker); + })(); Formatting.IndentationTrackingWalker = IndentationTrackingWalker; })(Formatting = Services.Formatting || (Services.Formatting = {})); })(Services = TypeScript.Services || (TypeScript.Services = {})); @@ -30126,19 +31062,19 @@ var TypeScript; continue; } switch (trivia.kind()) { - case 6 /* MultiLineCommentTrivia */: + case 4 /* MultiLineCommentTrivia */: this.recordIndentationEditsForMultiLineComment(trivia, position, commentIndentationString, leadingWhiteSpace, !indentNextTokenOrTrivia); indentNextTokenOrTrivia = false; leadingWhiteSpace = ""; break; - case 7 /* SingleLineCommentTrivia */: - case 8 /* SkippedTokenTrivia */: + case 5 /* SingleLineCommentTrivia */: + case 6 /* SkippedTokenTrivia */: if (indentNextTokenOrTrivia) { this.recordIndentationEditsForSingleLineOrSkippedText(trivia, position, commentIndentationString); indentNextTokenOrTrivia = false; } break; - case 4 /* WhitespaceTrivia */: + case 2 /* WhitespaceTrivia */: var nextTrivia = length > i + 1 && triviaList.syntaxTriviaAt(i + 1); var whiteSpaceIndentationString = nextTrivia && nextTrivia.isComment() ? commentIndentationString : indentationString; if (indentNextTokenOrTrivia) { @@ -30149,7 +31085,7 @@ var TypeScript; } leadingWhiteSpace += trivia.fullText(); break; - case 5 /* NewLineTrivia */: + case 3 /* NewLineTrivia */: indentNextTokenOrTrivia = true; leadingWhiteSpace = ""; break; @@ -30158,7 +31094,7 @@ var TypeScript; } } } - if (token.kind() !== 10 /* EndOfFileToken */ && indentNextTokenOrTrivia) { + if (token.kind() !== 8 /* EndOfFileToken */ && indentNextTokenOrTrivia) { if (indentationString.length > 0) { this.recordEdit(position, 0, indentationString); } @@ -30241,7 +31177,7 @@ var TypeScript; } Formatter.getEdits = function (textSpan, sourceUnit, options, indentFirstToken, snapshot, rulesProvider, formattingRequestKind) { var walker = new Formatter(textSpan, sourceUnit, indentFirstToken, options, snapshot, rulesProvider, formattingRequestKind); - TypeScript.visitNodeOrToken(walker, sourceUnit); + walker.walk(sourceUnit); return walker.edits(); }; Formatter.prototype.visitTokenInSpan = function (token) { @@ -30365,7 +31301,7 @@ var TypeScript; } }; Formatter.prototype.trimWhitespace = function (line, token) { - if (token && (token.kind == 6 /* MultiLineCommentTrivia */ || token.kind == 7 /* SingleLineCommentTrivia */) && token.start() <= line.endPosition() && token.end() >= line.endPosition()) + if (token && (token.kind == 4 /* MultiLineCommentTrivia */ || token.kind == 5 /* SingleLineCommentTrivia */) && token.start() <= line.endPosition() && token.end() >= line.endPosition()) return; var text = line.getText(); var index = 0; @@ -30456,7 +31392,7 @@ var ts; return 0; } var lineAtPosition = sourceFile.getLineAndCharacterFromPosition(position).line; - if (precedingToken.kind === 18 /* CommaToken */ && precedingToken.parent.kind !== 148 /* BinaryExpression */) { + if (precedingToken.kind === 22 /* CommaToken */ && precedingToken.parent.kind !== 153 /* BinaryExpression */) { var actualIndentation = getActualIndentationForListItemBeforeComma(precedingToken, sourceFile, options); if (actualIndentation !== -1) { return actualIndentation; @@ -30516,7 +31452,7 @@ var ts; return deriveActualIndentationFromList(commaItemInfo.list.getChildren(), commaItemInfo.listItemIndex - 1, sourceFile, options); } function getActualIndentationForNode(current, parent, currentLineAndChar, parentAndChildShareLine, sourceFile, options) { - var useActualIndentation = (ts.isDeclaration(current) || ts.isStatement(current)) && (parent.kind === 186 /* SourceFile */ || !parentAndChildShareLine); + var useActualIndentation = (ts.isDeclaration(current) || ts.isStatement(current)) && (parent.kind === 193 /* SourceFile */ || !parentAndChildShareLine); if (!useActualIndentation) { return -1; } @@ -30527,10 +31463,10 @@ var ts; if (!nextToken) { return false; } - if (nextToken.kind === 9 /* OpenBraceToken */) { + if (nextToken.kind === 13 /* OpenBraceToken */) { return true; } - else if (nextToken.kind === 10 /* CloseBraceToken */) { + else if (nextToken.kind === 14 /* CloseBraceToken */) { var nextTokenStartLine = getStartLineAndCharacterForNode(nextToken, sourceFile).line; return lineAtPosition === nextTokenStartLine; } @@ -30543,9 +31479,9 @@ var ts; return candidate.end > position || !isCompletedNode(candidate, sourceFile); } function childStartsOnTheSameLineWithElseInIfStatement(parent, child, childStartLine, sourceFile) { - if (parent.kind === 155 /* IfStatement */ && parent.elseStatement === child) { - var elseKeyword = ts.findChildOfKind(parent, 70 /* ElseKeyword */, sourceFile); - ts.Debug.assert(elseKeyword); + if (parent.kind === 162 /* IfStatement */ && parent.elseStatement === child) { + var elseKeyword = ts.findChildOfKind(parent, 74 /* ElseKeyword */, sourceFile); + ts.Debug.assert(elseKeyword !== undefined); var elseKeywordStartLine = getStartLineAndCharacterForNode(elseKeyword, sourceFile).line; return elseKeywordStartLine === childStartLine; } @@ -30553,29 +31489,29 @@ var ts; function getActualIndentationForListItem(node, sourceFile, options) { if (node.parent) { switch (node.parent.kind) { - case 128 /* TypeReference */: + case 132 /* TypeReference */: if (node.parent.typeArguments) { return getActualIndentationFromList(node.parent.typeArguments); } break; - case 136 /* ObjectLiteral */: + case 140 /* ObjectLiteral */: return getActualIndentationFromList(node.parent.properties); - case 130 /* TypeLiteral */: + case 134 /* TypeLiteral */: return getActualIndentationFromList(node.parent.members); - case 135 /* ArrayLiteral */: + case 139 /* ArrayLiteral */: return getActualIndentationFromList(node.parent.elements); - case 175 /* FunctionDeclaration */: - case 144 /* FunctionExpression */: - case 145 /* ArrowFunction */: - case 121 /* Method */: - case 125 /* CallSignature */: - case 126 /* ConstructSignature */: + case 182 /* FunctionDeclaration */: + case 149 /* FunctionExpression */: + case 150 /* ArrowFunction */: + case 125 /* Method */: + case 129 /* CallSignature */: + case 130 /* ConstructSignature */: if (node.parent.typeParameters && node.end < node.parent.typeParameters.end) { return getActualIndentationFromList(node.parent.typeParameters); } return getActualIndentationFromList(node.parent.parameters); - case 141 /* NewExpression */: - case 140 /* CallExpression */: + case 145 /* NewExpression */: + case 144 /* CallExpression */: if (node.parent.typeArguments && node.end < node.parent.typeArguments.end) { return getActualIndentationFromList(node.parent.typeArguments); } @@ -30593,7 +31529,7 @@ var ts; var node = list[index]; var lineAndCharacter = getStartLineAndCharacterForNode(node, sourceFile); for (var i = index - 1; i >= 0; --i) { - if (list[i].kind === 18 /* CommaToken */) { + if (list[i].kind === 22 /* CommaToken */) { continue; } var prevEndLine = sourceFile.getLineAndCharacterFromPosition(list[i].end).line; @@ -30623,45 +31559,45 @@ var ts; } function nodeContentIsIndented(parent, child) { switch (parent.kind) { - case 177 /* ClassDeclaration */: - case 178 /* InterfaceDeclaration */: - case 180 /* EnumDeclaration */: + case 184 /* ClassDeclaration */: + case 185 /* InterfaceDeclaration */: + case 187 /* EnumDeclaration */: return true; - case 181 /* ModuleDeclaration */: + case 188 /* ModuleDeclaration */: return false; - case 175 /* FunctionDeclaration */: - case 121 /* Method */: - case 144 /* FunctionExpression */: - case 123 /* GetAccessor */: - case 124 /* SetAccessor */: - case 122 /* Constructor */: + case 182 /* FunctionDeclaration */: + case 125 /* Method */: + case 149 /* FunctionExpression */: + case 127 /* GetAccessor */: + case 128 /* SetAccessor */: + case 126 /* Constructor */: return false; - case 156 /* DoStatement */: - case 157 /* WhileStatement */: - case 159 /* ForInStatement */: - case 158 /* ForStatement */: - return child && child.kind !== 151 /* Block */; - case 155 /* IfStatement */: - return child && child.kind !== 151 /* Block */; - case 169 /* TryStatement */: + case 163 /* DoStatement */: + case 164 /* WhileStatement */: + case 166 /* ForInStatement */: + case 165 /* ForStatement */: + return child && child.kind !== 158 /* Block */; + case 162 /* IfStatement */: + return child && child.kind !== 158 /* Block */; + case 176 /* TryStatement */: return false; - case 135 /* ArrayLiteral */: - case 151 /* Block */: - case 176 /* FunctionBlock */: - case 170 /* TryBlock */: - case 171 /* CatchBlock */: - case 172 /* FinallyBlock */: - case 182 /* ModuleBlock */: - case 136 /* ObjectLiteral */: - case 130 /* TypeLiteral */: - case 164 /* SwitchStatement */: - case 166 /* DefaultClause */: - case 165 /* CaseClause */: - case 143 /* ParenExpression */: - case 140 /* CallExpression */: - case 141 /* NewExpression */: - case 152 /* VariableStatement */: - case 174 /* VariableDeclaration */: + case 139 /* ArrayLiteral */: + case 158 /* Block */: + case 183 /* FunctionBlock */: + case 177 /* TryBlock */: + case 178 /* CatchBlock */: + case 179 /* FinallyBlock */: + case 189 /* ModuleBlock */: + case 140 /* ObjectLiteral */: + case 134 /* TypeLiteral */: + case 171 /* SwitchStatement */: + case 173 /* DefaultClause */: + case 172 /* CaseClause */: + case 148 /* ParenExpression */: + case 144 /* CallExpression */: + case 145 /* NewExpression */: + case 159 /* VariableStatement */: + case 181 /* VariableDeclaration */: return true; default: return false; @@ -30674,7 +31610,7 @@ var ts; if (last.kind === expectedLastToken) { return true; } - else if (last.kind === 17 /* SemicolonToken */ && children.length !== 1) { + else if (last.kind === 21 /* SemicolonToken */ && children.length !== 1) { return children[children.length - 2].kind === expectedLastToken; } } @@ -30682,49 +31618,49 @@ var ts; } function isCompletedNode(n, sourceFile) { switch (n.kind) { - case 177 /* ClassDeclaration */: - case 178 /* InterfaceDeclaration */: - case 180 /* EnumDeclaration */: - case 136 /* ObjectLiteral */: - case 151 /* Block */: - case 171 /* CatchBlock */: - case 172 /* FinallyBlock */: - case 176 /* FunctionBlock */: - case 182 /* ModuleBlock */: - case 164 /* SwitchStatement */: - return nodeEndsWith(n, 10 /* CloseBraceToken */, sourceFile); - case 143 /* ParenExpression */: - case 125 /* CallSignature */: - case 140 /* CallExpression */: - case 126 /* ConstructSignature */: - return nodeEndsWith(n, 12 /* CloseParenToken */, sourceFile); - case 175 /* FunctionDeclaration */: - case 144 /* FunctionExpression */: - case 121 /* Method */: - case 145 /* ArrowFunction */: + case 184 /* ClassDeclaration */: + case 185 /* InterfaceDeclaration */: + case 187 /* EnumDeclaration */: + case 140 /* ObjectLiteral */: + case 158 /* Block */: + case 178 /* CatchBlock */: + case 179 /* FinallyBlock */: + case 183 /* FunctionBlock */: + case 189 /* ModuleBlock */: + case 171 /* SwitchStatement */: + return nodeEndsWith(n, 14 /* CloseBraceToken */, sourceFile); + case 148 /* ParenExpression */: + case 129 /* CallSignature */: + case 144 /* CallExpression */: + case 130 /* ConstructSignature */: + return nodeEndsWith(n, 16 /* CloseParenToken */, sourceFile); + case 182 /* FunctionDeclaration */: + case 149 /* FunctionExpression */: + case 125 /* Method */: + case 150 /* ArrowFunction */: return !n.body || isCompletedNode(n.body, sourceFile); - case 181 /* ModuleDeclaration */: + case 188 /* ModuleDeclaration */: return n.body && isCompletedNode(n.body, sourceFile); - case 155 /* IfStatement */: + case 162 /* IfStatement */: if (n.elseStatement) { return isCompletedNode(n.elseStatement, sourceFile); } return isCompletedNode(n.thenStatement, sourceFile); - case 154 /* ExpressionStatement */: + case 161 /* ExpressionStatement */: return isCompletedNode(n.expression, sourceFile); - case 135 /* ArrayLiteral */: - return nodeEndsWith(n, 14 /* CloseBracketToken */, sourceFile); - case 116 /* Missing */: + case 139 /* ArrayLiteral */: + return nodeEndsWith(n, 18 /* CloseBracketToken */, sourceFile); + case 120 /* Missing */: return false; - case 165 /* CaseClause */: - case 166 /* DefaultClause */: + case 172 /* CaseClause */: + case 173 /* DefaultClause */: return false; - case 157 /* WhileStatement */: + case 164 /* WhileStatement */: return isCompletedNode(n.statement, sourceFile); - case 156 /* DoStatement */: - var hasWhileKeyword = ts.findChildOfKind(n, 94 /* WhileKeyword */, sourceFile); + case 163 /* DoStatement */: + var hasWhileKeyword = ts.findChildOfKind(n, 98 /* WhileKeyword */, sourceFile); if (hasWhileKeyword) { - return nodeEndsWith(n, 12 /* CloseParenToken */, sourceFile); + return nodeEndsWith(n, 16 /* CloseParenToken */, sourceFile); } return isCompletedNode(n.statement, sourceFile); default: @@ -30769,1203 +31705,6 @@ var TypeScript; TypeScript.createIntrinsicsObject = createIntrinsicsObject; })(TypeScript || (TypeScript = {})); var TypeScript; -(function (TypeScript) { - var Comment = (function () { - function Comment(_trivia, endsLine, _start, _end) { - this._trivia = _trivia; - this.endsLine = endsLine; - this._start = _start; - this._end = _end; - } - Comment.prototype.start = function () { - return this._start; - }; - Comment.prototype.end = function () { - return this._end; - }; - Comment.prototype.fullText = function () { - return this._trivia.fullText(); - }; - Comment.prototype.kind = function () { - return this._trivia.kind(); - }; - Comment.prototype.structuralEquals = function (ast, includingPosition) { - if (includingPosition) { - if (this.start() !== ast.start() || this.end() !== ast.end()) { - return false; - } - } - return this._trivia.fullText() === ast._trivia.fullText() && this.endsLine === ast.endsLine; - }; - return Comment; - })(); - TypeScript.Comment = Comment; -})(TypeScript || (TypeScript = {})); -var TypeScript; -(function (TypeScript) { - function walkListChildren(preAst, walker) { - for (var i = 0, n = preAst.length; i < n; i++) { - walker.walk(preAst[i]); - } - } - function walkThrowStatementChildren(preAst, walker) { - walker.walk(preAst.expression); - } - function walkPrefixUnaryExpressionChildren(preAst, walker) { - walker.walk(preAst.operand); - } - function walkPostfixUnaryExpressionChildren(preAst, walker) { - walker.walk(preAst.operand); - } - function walkDeleteExpressionChildren(preAst, walker) { - walker.walk(preAst.expression); - } - function walkTypeArgumentListChildren(preAst, walker) { - walker.walk(preAst.typeArguments); - } - function walkTupleTypeChildren(preAst, walker) { - walker.walk(preAst.types); - } - function walkTypeOfExpressionChildren(preAst, walker) { - walker.walk(preAst.expression); - } - function walkVoidExpressionChildren(preAst, walker) { - walker.walk(preAst.expression); - } - function walkArgumentListChildren(preAst, walker) { - walker.walk(preAst.typeArgumentList); - walker.walk(preAst.arguments); - } - function walkArrayLiteralExpressionChildren(preAst, walker) { - walker.walk(preAst.expressions); - } - function walkSimplePropertyAssignmentChildren(preAst, walker) { - walker.walk(preAst.propertyName); - walker.walk(preAst.expression); - } - function walkFunctionPropertyAssignmentChildren(preAst, walker) { - walker.walk(preAst.propertyName); - walker.walk(preAst.callSignature); - walker.walk(preAst.block); - } - function walkGetAccessorChildren(preAst, walker) { - walker.walk(preAst.propertyName); - walker.walk(preAst.callSignature); - walker.walk(preAst.block); - } - function walkSeparatedListChildren(preAst, walker) { - for (var i = 0, n = preAst.length; i < n; i++) { - walker.walk(preAst[i]); - } - } - function walkSetAccessorChildren(preAst, walker) { - walker.walk(preAst.propertyName); - walker.walk(preAst.callSignature); - walker.walk(preAst.block); - } - function walkObjectLiteralExpressionChildren(preAst, walker) { - walker.walk(preAst.propertyAssignments); - } - function walkCastExpressionChildren(preAst, walker) { - walker.walk(preAst.type); - walker.walk(preAst.expression); - } - function walkParenthesizedExpressionChildren(preAst, walker) { - walker.walk(preAst.expression); - } - function walkElementAccessExpressionChildren(preAst, walker) { - walker.walk(preAst.expression); - walker.walk(preAst.argumentExpression); - } - function walkMemberAccessExpressionChildren(preAst, walker) { - walker.walk(preAst.expression); - walker.walk(preAst.name); - } - function walkQualifiedNameChildren(preAst, walker) { - walker.walk(preAst.left); - walker.walk(preAst.right); - } - function walkBinaryExpressionChildren(preAst, walker) { - walker.walk(preAst.left); - walker.walk(preAst.right); - } - function walkEqualsValueClauseChildren(preAst, walker) { - walker.walk(preAst.value); - } - function walkTypeParameterChildren(preAst, walker) { - walker.walk(preAst.identifier); - walker.walk(preAst.constraint); - } - function walkTypeParameterListChildren(preAst, walker) { - walker.walk(preAst.typeParameters); - } - function walkGenericTypeChildren(preAst, walker) { - walker.walk(preAst.name); - walker.walk(preAst.typeArgumentList); - } - function walkTypeAnnotationChildren(preAst, walker) { - walker.walk(preAst.type); - } - function walkTypeQueryChildren(preAst, walker) { - walker.walk(preAst.name); - } - function walkInvocationExpressionChildren(preAst, walker) { - walker.walk(preAst.expression); - walker.walk(preAst.argumentList); - } - function walkObjectCreationExpressionChildren(preAst, walker) { - walker.walk(preAst.expression); - walker.walk(preAst.argumentList); - } - function walkTrinaryExpressionChildren(preAst, walker) { - walker.walk(preAst.condition); - walker.walk(preAst.whenTrue); - walker.walk(preAst.whenFalse); - } - function walkFunctionExpressionChildren(preAst, walker) { - walker.walk(preAst.identifier); - walker.walk(preAst.callSignature); - walker.walk(preAst.block); - } - function walkFunctionTypeChildren(preAst, walker) { - walker.walk(preAst.typeParameterList); - walker.walk(preAst.parameterList); - walker.walk(preAst.type); - } - function walkParenthesizedArrowFunctionExpressionChildren(preAst, walker) { - walker.walk(preAst.callSignature); - walker.walk(preAst.block); - walker.walk(preAst.expression); - } - function walkSimpleArrowFunctionExpressionChildren(preAst, walker) { - walker.walk(preAst.parameter); - walker.walk(preAst.block); - walker.walk(preAst.expression); - } - function walkMemberFunctionDeclarationChildren(preAst, walker) { - walker.walk(preAst.propertyName); - walker.walk(preAst.callSignature); - walker.walk(preAst.block); - } - function walkFuncDeclChildren(preAst, walker) { - walker.walk(preAst.identifier); - walker.walk(preAst.callSignature); - walker.walk(preAst.block); - } - function walkIndexMemberDeclarationChildren(preAst, walker) { - walker.walk(preAst.indexSignature); - } - function walkIndexSignatureChildren(preAst, walker) { - walker.walk(preAst.parameters); - walker.walk(preAst.typeAnnotation); - } - function walkCallSignatureChildren(preAst, walker) { - walker.walk(preAst.typeParameterList); - walker.walk(preAst.parameterList); - walker.walk(preAst.typeAnnotation); - } - function walkConstraintChildren(preAst, walker) { - walker.walk(preAst.typeOrExpression); - } - function walkConstructorDeclarationChildren(preAst, walker) { - walker.walk(preAst.callSignature); - walker.walk(preAst.block); - } - function walkConstructorTypeChildren(preAst, walker) { - walker.walk(preAst.typeParameterList); - walker.walk(preAst.parameterList); - walker.walk(preAst.type); - } - function walkConstructSignatureChildren(preAst, walker) { - walker.walk(preAst.callSignature); - } - function walkParameterChildren(preAst, walker) { - walker.walk(preAst.identifier); - walker.walk(preAst.typeAnnotation); - walker.walk(preAst.equalsValueClause); - } - function walkParameterListChildren(preAst, walker) { - walker.walk(preAst.parameters); - } - function walkPropertySignatureChildren(preAst, walker) { - walker.walk(preAst.propertyName); - walker.walk(preAst.typeAnnotation); - } - function walkVariableDeclaratorChildren(preAst, walker) { - walker.walk(preAst.propertyName); - walker.walk(preAst.typeAnnotation); - walker.walk(preAst.equalsValueClause); - } - function walkMemberVariableDeclarationChildren(preAst, walker) { - walker.walk(preAst.variableDeclarator); - } - function walkMethodSignatureChildren(preAst, walker) { - walker.walk(preAst.propertyName); - walker.walk(preAst.callSignature); - } - function walkReturnStatementChildren(preAst, walker) { - walker.walk(preAst.expression); - } - function walkForStatementChildren(preAst, walker) { - walker.walk(preAst.variableDeclaration); - walker.walk(preAst.initializer); - walker.walk(preAst.condition); - walker.walk(preAst.incrementor); - walker.walk(preAst.statement); - } - function walkForInStatementChildren(preAst, walker) { - walker.walk(preAst.variableDeclaration); - walker.walk(preAst.left); - walker.walk(preAst.expression); - walker.walk(preAst.statement); - } - function walkIfStatementChildren(preAst, walker) { - walker.walk(preAst.condition); - walker.walk(preAst.statement); - walker.walk(preAst.elseClause); - } - function walkElseClauseChildren(preAst, walker) { - walker.walk(preAst.statement); - } - function walkWhileStatementChildren(preAst, walker) { - walker.walk(preAst.condition); - walker.walk(preAst.statement); - } - function walkDoStatementChildren(preAst, walker) { - walker.walk(preAst.condition); - walker.walk(preAst.statement); - } - function walkBlockChildren(preAst, walker) { - walker.walk(preAst.statements); - } - function walkVariableDeclarationChildren(preAst, walker) { - walker.walk(preAst.variableDeclarators); - } - function walkCaseSwitchClauseChildren(preAst, walker) { - walker.walk(preAst.expression); - walker.walk(preAst.statements); - } - function walkDefaultSwitchClauseChildren(preAst, walker) { - walker.walk(preAst.statements); - } - function walkSwitchStatementChildren(preAst, walker) { - walker.walk(preAst.expression); - walker.walk(preAst.switchClauses); - } - function walkTryStatementChildren(preAst, walker) { - walker.walk(preAst.block); - walker.walk(preAst.catchClause); - walker.walk(preAst.finallyClause); - } - function walkCatchClauseChildren(preAst, walker) { - walker.walk(preAst.identifier); - walker.walk(preAst.typeAnnotation); - walker.walk(preAst.block); - } - function walkExternalModuleReferenceChildren(preAst, walker) { - walker.walk(preAst.stringLiteral); - } - function walkFinallyClauseChildren(preAst, walker) { - walker.walk(preAst.block); - } - function walkClassDeclChildren(preAst, walker) { - walker.walk(preAst.identifier); - walker.walk(preAst.typeParameterList); - walker.walk(preAst.heritageClauses); - walker.walk(preAst.classElements); - } - function walkScriptChildren(preAst, walker) { - walker.walk(preAst.moduleElements); - } - function walkHeritageClauseChildren(preAst, walker) { - walker.walk(preAst.typeNames); - } - function walkInterfaceDeclerationChildren(preAst, walker) { - walker.walk(preAst.identifier); - walker.walk(preAst.typeParameterList); - walker.walk(preAst.heritageClauses); - walker.walk(preAst.body); - } - function walkObjectTypeChildren(preAst, walker) { - walker.walk(preAst.typeMembers); - } - function walkArrayTypeChildren(preAst, walker) { - walker.walk(preAst.type); - } - function walkModuleDeclarationChildren(preAst, walker) { - walker.walk(preAst.name); - walker.walk(preAst.stringLiteral); - walker.walk(preAst.moduleElements); - } - function walkModuleNameModuleReferenceChildren(preAst, walker) { - walker.walk(preAst.moduleName); - } - function walkEnumDeclarationChildren(preAst, walker) { - walker.walk(preAst.identifier); - walker.walk(preAst.enumElements); - } - function walkEnumElementChildren(preAst, walker) { - walker.walk(preAst.propertyName); - walker.walk(preAst.equalsValueClause); - } - function walkImportDeclarationChildren(preAst, walker) { - walker.walk(preAst.identifier); - walker.walk(preAst.moduleReference); - } - function walkExportAssignmentChildren(preAst, walker) { - walker.walk(preAst.identifier); - } - function walkWithStatementChildren(preAst, walker) { - walker.walk(preAst.condition); - walker.walk(preAst.statement); - } - function walkExpressionStatementChildren(preAst, walker) { - walker.walk(preAst.expression); - } - function walkLabeledStatementChildren(preAst, walker) { - walker.walk(preAst.identifier); - walker.walk(preAst.statement); - } - function walkVariableStatementChildren(preAst, walker) { - walker.walk(preAst.variableDeclaration); - } - var childrenWalkers = new Array(TypeScript.SyntaxKind.LastNode + 1); - for (var i = TypeScript.SyntaxKind.FirstToken, n = TypeScript.SyntaxKind.LastToken; i <= n; i++) { - childrenWalkers[i] = null; - } - for (var i = TypeScript.SyntaxKind.FirstTrivia, n = TypeScript.SyntaxKind.LastTrivia; i <= n; i++) { - childrenWalkers[i] = null; - } - childrenWalkers[176 /* AddAssignmentExpression */] = walkBinaryExpressionChildren; - childrenWalkers[209 /* AddExpression */] = walkBinaryExpressionChildren; - childrenWalkers[181 /* AndAssignmentExpression */] = walkBinaryExpressionChildren; - childrenWalkers[60 /* AnyKeyword */] = null; - childrenWalkers[227 /* ArgumentList */] = walkArgumentListChildren; - childrenWalkers[215 /* ArrayLiteralExpression */] = walkArrayLiteralExpressionChildren; - childrenWalkers[124 /* ArrayType */] = walkArrayTypeChildren; - childrenWalkers[220 /* SimpleArrowFunctionExpression */] = walkSimpleArrowFunctionExpressionChildren; - childrenWalkers[219 /* ParenthesizedArrowFunctionExpression */] = walkParenthesizedArrowFunctionExpressionChildren; - childrenWalkers[175 /* AssignmentExpression */] = walkBinaryExpressionChildren; - childrenWalkers[192 /* BitwiseAndExpression */] = walkBinaryExpressionChildren; - childrenWalkers[191 /* BitwiseExclusiveOrExpression */] = walkBinaryExpressionChildren; - childrenWalkers[167 /* BitwiseNotExpression */] = walkPrefixUnaryExpressionChildren; - childrenWalkers[190 /* BitwiseOrExpression */] = walkBinaryExpressionChildren; - childrenWalkers[147 /* Block */] = walkBlockChildren; - childrenWalkers[61 /* BooleanKeyword */] = null; - childrenWalkers[153 /* BreakStatement */] = null; - childrenWalkers[143 /* CallSignature */] = walkCallSignatureChildren; - childrenWalkers[234 /* CaseSwitchClause */] = walkCaseSwitchClauseChildren; - childrenWalkers[221 /* CastExpression */] = walkCastExpressionChildren; - childrenWalkers[237 /* CatchClause */] = walkCatchClauseChildren; - childrenWalkers[132 /* ClassDeclaration */] = walkClassDeclChildren; - childrenWalkers[174 /* CommaExpression */] = walkBinaryExpressionChildren; - childrenWalkers[187 /* ConditionalExpression */] = walkTrinaryExpressionChildren; - childrenWalkers[240 /* Constraint */] = walkConstraintChildren; - childrenWalkers[138 /* ConstructorDeclaration */] = walkConstructorDeclarationChildren; - childrenWalkers[144 /* ConstructSignature */] = walkConstructSignatureChildren; - childrenWalkers[154 /* ContinueStatement */] = null; - childrenWalkers[125 /* ConstructorType */] = walkConstructorTypeChildren; - childrenWalkers[163 /* DebuggerStatement */] = null; - childrenWalkers[235 /* DefaultSwitchClause */] = walkDefaultSwitchClauseChildren; - childrenWalkers[171 /* DeleteExpression */] = walkDeleteExpressionChildren; - childrenWalkers[179 /* DivideAssignmentExpression */] = walkBinaryExpressionChildren; - childrenWalkers[207 /* DivideExpression */] = walkBinaryExpressionChildren; - childrenWalkers[162 /* DoStatement */] = walkDoStatementChildren; - childrenWalkers[222 /* ElementAccessExpression */] = walkElementAccessExpressionChildren; - childrenWalkers[236 /* ElseClause */] = walkElseClauseChildren; - childrenWalkers[157 /* EmptyStatement */] = null; - childrenWalkers[133 /* EnumDeclaration */] = walkEnumDeclarationChildren; - childrenWalkers[244 /* EnumElement */] = walkEnumElementChildren; - childrenWalkers[195 /* EqualsExpression */] = walkBinaryExpressionChildren; - childrenWalkers[233 /* EqualsValueClause */] = walkEqualsValueClauseChildren; - childrenWalkers[193 /* EqualsWithTypeConversionExpression */] = walkBinaryExpressionChildren; - childrenWalkers[182 /* ExclusiveOrAssignmentExpression */] = walkBinaryExpressionChildren; - childrenWalkers[135 /* ExportAssignment */] = walkExportAssignmentChildren; - childrenWalkers[150 /* ExpressionStatement */] = walkExpressionStatementChildren; - childrenWalkers[231 /* ExtendsHeritageClause */] = walkHeritageClauseChildren; - childrenWalkers[246 /* ExternalModuleReference */] = walkExternalModuleReferenceChildren; - childrenWalkers[24 /* FalseKeyword */] = null; - childrenWalkers[238 /* FinallyClause */] = walkFinallyClauseChildren; - childrenWalkers[156 /* ForInStatement */] = walkForInStatementChildren; - childrenWalkers[155 /* ForStatement */] = walkForStatementChildren; - childrenWalkers[130 /* FunctionDeclaration */] = walkFuncDeclChildren; - childrenWalkers[223 /* FunctionExpression */] = walkFunctionExpressionChildren; - childrenWalkers[242 /* FunctionPropertyAssignment */] = walkFunctionPropertyAssignmentChildren; - childrenWalkers[123 /* FunctionType */] = walkFunctionTypeChildren; - childrenWalkers[126 /* GenericType */] = walkGenericTypeChildren; - childrenWalkers[140 /* GetAccessor */] = walkGetAccessorChildren; - childrenWalkers[198 /* GreaterThanExpression */] = walkBinaryExpressionChildren; - childrenWalkers[200 /* GreaterThanOrEqualExpression */] = walkBinaryExpressionChildren; - childrenWalkers[148 /* IfStatement */] = walkIfStatementChildren; - childrenWalkers[232 /* ImplementsHeritageClause */] = walkHeritageClauseChildren; - childrenWalkers[134 /* ImportDeclaration */] = walkImportDeclarationChildren; - childrenWalkers[139 /* IndexMemberDeclaration */] = walkIndexMemberDeclarationChildren; - childrenWalkers[145 /* IndexSignature */] = walkIndexSignatureChildren; - childrenWalkers[202 /* InExpression */] = walkBinaryExpressionChildren; - childrenWalkers[201 /* InstanceOfExpression */] = walkBinaryExpressionChildren; - childrenWalkers[129 /* InterfaceDeclaration */] = walkInterfaceDeclerationChildren; - childrenWalkers[214 /* InvocationExpression */] = walkInvocationExpressionChildren; - childrenWalkers[161 /* LabeledStatement */] = walkLabeledStatementChildren; - childrenWalkers[184 /* LeftShiftAssignmentExpression */] = walkBinaryExpressionChildren; - childrenWalkers[203 /* LeftShiftExpression */] = walkBinaryExpressionChildren; - childrenWalkers[197 /* LessThanExpression */] = walkBinaryExpressionChildren; - childrenWalkers[199 /* LessThanOrEqualExpression */] = walkBinaryExpressionChildren; - childrenWalkers[1 /* List */] = walkListChildren; - childrenWalkers[189 /* LogicalAndExpression */] = walkBinaryExpressionChildren; - childrenWalkers[168 /* LogicalNotExpression */] = walkPrefixUnaryExpressionChildren; - childrenWalkers[188 /* LogicalOrExpression */] = walkBinaryExpressionChildren; - childrenWalkers[213 /* MemberAccessExpression */] = walkMemberAccessExpressionChildren; - childrenWalkers[136 /* MemberFunctionDeclaration */] = walkMemberFunctionDeclarationChildren; - childrenWalkers[137 /* MemberVariableDeclaration */] = walkMemberVariableDeclarationChildren; - childrenWalkers[146 /* MethodSignature */] = walkMethodSignatureChildren; - childrenWalkers[131 /* ModuleDeclaration */] = walkModuleDeclarationChildren; - childrenWalkers[247 /* ModuleNameModuleReference */] = walkModuleNameModuleReferenceChildren; - childrenWalkers[180 /* ModuloAssignmentExpression */] = walkBinaryExpressionChildren; - childrenWalkers[208 /* ModuloExpression */] = walkBinaryExpressionChildren; - childrenWalkers[178 /* MultiplyAssignmentExpression */] = walkBinaryExpressionChildren; - childrenWalkers[206 /* MultiplyExpression */] = walkBinaryExpressionChildren; - childrenWalkers[11 /* IdentifierName */] = null; - childrenWalkers[166 /* NegateExpression */] = walkPrefixUnaryExpressionChildren; - childrenWalkers[0 /* None */] = null; - childrenWalkers[196 /* NotEqualsExpression */] = walkBinaryExpressionChildren; - childrenWalkers[194 /* NotEqualsWithTypeConversionExpression */] = walkBinaryExpressionChildren; - childrenWalkers[32 /* NullKeyword */] = null; - childrenWalkers[67 /* NumberKeyword */] = null; - childrenWalkers[13 /* NumericLiteral */] = null; - childrenWalkers[217 /* ObjectCreationExpression */] = walkObjectCreationExpressionChildren; - childrenWalkers[216 /* ObjectLiteralExpression */] = walkObjectLiteralExpressionChildren; - childrenWalkers[122 /* ObjectType */] = walkObjectTypeChildren; - childrenWalkers[224 /* OmittedExpression */] = null; - childrenWalkers[183 /* OrAssignmentExpression */] = walkBinaryExpressionChildren; - childrenWalkers[243 /* Parameter */] = walkParameterChildren; - childrenWalkers[228 /* ParameterList */] = walkParameterListChildren; - childrenWalkers[218 /* ParenthesizedExpression */] = walkParenthesizedExpressionChildren; - childrenWalkers[165 /* PlusExpression */] = walkPrefixUnaryExpressionChildren; - childrenWalkers[212 /* PostDecrementExpression */] = walkPostfixUnaryExpressionChildren; - childrenWalkers[211 /* PostIncrementExpression */] = walkPostfixUnaryExpressionChildren; - childrenWalkers[170 /* PreDecrementExpression */] = walkPrefixUnaryExpressionChildren; - childrenWalkers[169 /* PreIncrementExpression */] = walkPrefixUnaryExpressionChildren; - childrenWalkers[142 /* PropertySignature */] = walkPropertySignatureChildren; - childrenWalkers[121 /* QualifiedName */] = walkQualifiedNameChildren; - childrenWalkers[12 /* RegularExpressionLiteral */] = null; - childrenWalkers[151 /* ReturnStatement */] = walkReturnStatementChildren; - childrenWalkers[120 /* SourceUnit */] = walkScriptChildren; - childrenWalkers[2 /* SeparatedList */] = walkSeparatedListChildren; - childrenWalkers[141 /* SetAccessor */] = walkSetAccessorChildren; - childrenWalkers[185 /* SignedRightShiftAssignmentExpression */] = walkBinaryExpressionChildren; - childrenWalkers[204 /* SignedRightShiftExpression */] = walkBinaryExpressionChildren; - childrenWalkers[241 /* SimplePropertyAssignment */] = walkSimplePropertyAssignmentChildren; - childrenWalkers[14 /* StringLiteral */] = null; - childrenWalkers[69 /* StringKeyword */] = null; - childrenWalkers[177 /* SubtractAssignmentExpression */] = walkBinaryExpressionChildren; - childrenWalkers[210 /* SubtractExpression */] = walkBinaryExpressionChildren; - childrenWalkers[50 /* SuperKeyword */] = null; - childrenWalkers[152 /* SwitchStatement */] = walkSwitchStatementChildren; - childrenWalkers[35 /* ThisKeyword */] = null; - childrenWalkers[158 /* ThrowStatement */] = walkThrowStatementChildren; - childrenWalkers[3 /* TriviaList */] = null; - childrenWalkers[37 /* TrueKeyword */] = null; - childrenWalkers[160 /* TryStatement */] = walkTryStatementChildren; - childrenWalkers[128 /* TupleType */] = walkTupleTypeChildren; - childrenWalkers[245 /* TypeAnnotation */] = walkTypeAnnotationChildren; - childrenWalkers[229 /* TypeArgumentList */] = walkTypeArgumentListChildren; - childrenWalkers[172 /* TypeOfExpression */] = walkTypeOfExpressionChildren; - childrenWalkers[239 /* TypeParameter */] = walkTypeParameterChildren; - childrenWalkers[230 /* TypeParameterList */] = walkTypeParameterListChildren; - childrenWalkers[127 /* TypeQuery */] = walkTypeQueryChildren; - childrenWalkers[186 /* UnsignedRightShiftAssignmentExpression */] = walkBinaryExpressionChildren; - childrenWalkers[205 /* UnsignedRightShiftExpression */] = walkBinaryExpressionChildren; - childrenWalkers[225 /* VariableDeclaration */] = walkVariableDeclarationChildren; - childrenWalkers[226 /* VariableDeclarator */] = walkVariableDeclaratorChildren; - childrenWalkers[149 /* VariableStatement */] = walkVariableStatementChildren; - childrenWalkers[173 /* VoidExpression */] = walkVoidExpressionChildren; - childrenWalkers[41 /* VoidKeyword */] = null; - childrenWalkers[159 /* WhileStatement */] = walkWhileStatementChildren; - childrenWalkers[164 /* WithStatement */] = walkWithStatementChildren; - for (var e in TypeScript.SyntaxKind) { - if (TypeScript.SyntaxKind.hasOwnProperty(e) && TypeScript.StringUtilities.isString(TypeScript.SyntaxKind[e])) { - TypeScript.Debug.assert(childrenWalkers[e] !== undefined, "Fix initWalkers: " + TypeScript.SyntaxKind[e]); - } - } - var AstWalkOptions = (function () { - function AstWalkOptions() { - this.goChildren = true; - this.stopWalking = false; - } - return AstWalkOptions; - })(); - TypeScript.AstWalkOptions = AstWalkOptions; - var SimplePreAstWalker = (function () { - function SimplePreAstWalker(pre, state) { - this.pre = pre; - this.state = state; - this.options = new AstWalkOptions(); - } - SimplePreAstWalker.prototype.walk = function (ast) { - if (!ast) { - return; - } - this.pre(ast, this.state); - var walker = childrenWalkers[ast.kind()]; - if (walker) { - walker(ast, this); - } - }; - return SimplePreAstWalker; - })(); - var SimplePrePostAstWalker = (function () { - function SimplePrePostAstWalker(pre, post, state) { - this.pre = pre; - this.post = post; - this.state = state; - this.options = new AstWalkOptions(); - } - SimplePrePostAstWalker.prototype.walk = function (ast) { - if (!ast) { - return; - } - this.pre(ast, this.state); - var walker = childrenWalkers[ast.kind()]; - if (walker) { - walker(ast, this); - } - this.post(ast, this.state); - }; - return SimplePrePostAstWalker; - })(); - var NormalAstWalker = (function () { - function NormalAstWalker(pre, post, state) { - this.pre = pre; - this.post = post; - this.state = state; - this.options = new AstWalkOptions(); - } - NormalAstWalker.prototype.walk = function (ast) { - if (!ast) { - return; - } - if (this.options.stopWalking) { - return; - } - this.pre(ast, this); - if (this.options.stopWalking) { - return; - } - if (this.options.goChildren) { - var walker = childrenWalkers[ast.kind()]; - if (walker) { - walker(ast, this); - } - } - else { - this.options.goChildren = true; - } - if (this.post) { - this.post(ast, this); - } - }; - return NormalAstWalker; - })(); - var AstWalkerFactory = (function () { - function AstWalkerFactory() { - } - AstWalkerFactory.prototype.walk = function (ast, pre, post, state) { - new NormalAstWalker(pre, post, state).walk(ast); - }; - AstWalkerFactory.prototype.simpleWalk = function (ast, pre, post, state) { - if (post) { - new SimplePrePostAstWalker(pre, post, state).walk(ast); - } - else { - new SimplePreAstWalker(pre, state).walk(ast); - } - }; - return AstWalkerFactory; - })(); - TypeScript.AstWalkerFactory = AstWalkerFactory; - var globalAstWalkerFactory = new AstWalkerFactory(); - function getAstWalkerFactory() { - return globalAstWalkerFactory; - } - TypeScript.getAstWalkerFactory = getAstWalkerFactory; -})(TypeScript || (TypeScript = {})); -var TypeScript; -(function (TypeScript) { - var ASTHelpers; - (function (ASTHelpers) { - var sentinelEmptyArray = []; - function isValidAstNode(ast) { - return ast && !TypeScript.isShared(ast) && TypeScript.start(ast) !== -1 && TypeScript.end(ast) !== -1; - } - ASTHelpers.isValidAstNode = isValidAstNode; - function isValidSpan(ast) { - if (!ast) - return false; - if (ast.start() === -1 || ast.end() === -1) - return false; - return true; - } - ASTHelpers.isValidSpan = isValidSpan; - function getAstAtPosition(script, pos, useTrailingTriviaAsLimChar, forceInclusive) { - if (useTrailingTriviaAsLimChar === void 0) { useTrailingTriviaAsLimChar = true; } - if (forceInclusive === void 0) { forceInclusive = false; } - var top = null; - var pre = function (cur, walker) { - if (!TypeScript.isShared(cur) && isValidAstNode(cur)) { - var isInvalid1 = cur.kind() === 150 /* ExpressionStatement */ && TypeScript.width(cur) === 0; - if (isInvalid1) { - walker.options.goChildren = false; - } - else { - var inclusive = forceInclusive || cur.kind() === 11 /* IdentifierName */ || cur.kind() === 213 /* MemberAccessExpression */ || cur.kind() === 121 /* QualifiedName */ || cur.kind() === 225 /* VariableDeclaration */ || cur.kind() === 226 /* VariableDeclarator */ || cur.kind() === 214 /* InvocationExpression */ || pos === TypeScript.end(script) + TypeScript.lastToken(script).trailingTriviaWidth(); - var minChar = TypeScript.start(cur); - var limChar = TypeScript.end(cur) + (useTrailingTriviaAsLimChar ? TypeScript.trailingTriviaWidth(cur) : 0) + (inclusive ? 1 : 0); - if (pos >= minChar && pos < limChar) { - if ((cur.kind() !== 1 /* List */ && cur.kind() !== 2 /* SeparatedList */) || TypeScript.end(cur) > TypeScript.start(cur)) { - if (top === null) { - top = cur; - } - else if (TypeScript.start(cur) >= TypeScript.start(top) && (TypeScript.end(cur) + (useTrailingTriviaAsLimChar ? TypeScript.trailingTriviaWidth(cur) : 0)) <= (TypeScript.end(top) + (useTrailingTriviaAsLimChar ? TypeScript.trailingTriviaWidth(top) : 0))) { - if (TypeScript.width(top) !== 0 || TypeScript.width(cur) !== 0) { - top = cur; - } - } - } - } - walker.options.goChildren = (minChar <= pos && pos <= limChar); - } - } - }; - TypeScript.getAstWalkerFactory().walk(script, pre); - return top; - } - ASTHelpers.getAstAtPosition = getAstAtPosition; - function getExtendsHeritageClause(clauses) { - return getHeritageClause(clauses, 231 /* ExtendsHeritageClause */); - } - ASTHelpers.getExtendsHeritageClause = getExtendsHeritageClause; - function getImplementsHeritageClause(clauses) { - return getHeritageClause(clauses, 232 /* ImplementsHeritageClause */); - } - ASTHelpers.getImplementsHeritageClause = getImplementsHeritageClause; - function getHeritageClause(clauses, kind) { - if (clauses) { - for (var i = 0, n = clauses.length; i < n; i++) { - var child = clauses[i]; - if (child.typeNames.length > 0 && child.kind() === kind) { - return child; - } - } - } - return null; - } - function isCallExpression(ast) { - return (ast && ast.kind() === 214 /* InvocationExpression */) || (ast && ast.kind() === 217 /* ObjectCreationExpression */); - } - ASTHelpers.isCallExpression = isCallExpression; - function isCallExpressionTarget(ast) { - return !!getCallExpressionTarget(ast); - } - ASTHelpers.isCallExpressionTarget = isCallExpressionTarget; - function getCallExpressionTarget(ast) { - if (!ast) { - return null; - } - var current = ast; - while (current && current.parent) { - if (current.parent.kind() === 213 /* MemberAccessExpression */ && current.parent.name === current) { - current = current.parent; - continue; - } - break; - } - if (current && current.parent) { - if (current.parent.kind() === 214 /* InvocationExpression */ || current.parent.kind() === 217 /* ObjectCreationExpression */) { - return current === current.parent.expression ? current : null; - } - } - return null; - } - ASTHelpers.getCallExpressionTarget = getCallExpressionTarget; - function isNameOfSomeDeclaration(ast) { - if (ast === null || ast.parent === null) { - return false; - } - if (ast.kind() !== 11 /* IdentifierName */) { - return false; - } - switch (ast.parent.kind()) { - case 132 /* ClassDeclaration */: - return ast.parent.identifier === ast; - case 129 /* InterfaceDeclaration */: - return ast.parent.identifier === ast; - case 133 /* EnumDeclaration */: - return ast.parent.identifier === ast; - case 131 /* ModuleDeclaration */: - return ast.parent.name === ast || ast.parent.stringLiteral === ast; - case 226 /* VariableDeclarator */: - return ast.parent.propertyName === ast; - case 130 /* FunctionDeclaration */: - return ast.parent.identifier === ast; - case 136 /* MemberFunctionDeclaration */: - return ast.parent.propertyName === ast; - case 243 /* Parameter */: - return ast.parent.identifier === ast; - case 239 /* TypeParameter */: - return ast.parent.identifier === ast; - case 241 /* SimplePropertyAssignment */: - return ast.parent.propertyName === ast; - case 242 /* FunctionPropertyAssignment */: - return ast.parent.propertyName === ast; - case 244 /* EnumElement */: - return ast.parent.propertyName === ast; - case 134 /* ImportDeclaration */: - return ast.parent.identifier === ast; - case 146 /* MethodSignature */: - return ast.parent.propertyName === ast; - case 142 /* PropertySignature */: - return ast.parent.propertyName === ast; - } - return false; - } - function isDeclarationASTOrDeclarationNameAST(ast) { - return isNameOfSomeDeclaration(ast) || ASTHelpers.isDeclarationAST(ast); - } - ASTHelpers.isDeclarationASTOrDeclarationNameAST = isDeclarationASTOrDeclarationNameAST; - function getEnclosingParameterForInitializer(ast) { - var current = ast; - while (current) { - switch (current.kind()) { - case 233 /* EqualsValueClause */: - if (current.parent && current.parent.kind() === 243 /* Parameter */) { - return current.parent; - } - break; - case 132 /* ClassDeclaration */: - case 129 /* InterfaceDeclaration */: - case 131 /* ModuleDeclaration */: - return null; - } - current = current.parent; - } - return null; - } - ASTHelpers.getEnclosingParameterForInitializer = getEnclosingParameterForInitializer; - function getEnclosingMemberDeclaration(ast) { - var current = ast; - while (current) { - switch (current.kind()) { - case 137 /* MemberVariableDeclaration */: - case 146 /* MethodSignature */: - case 136 /* MemberFunctionDeclaration */: - case 140 /* GetAccessor */: - case 141 /* SetAccessor */: - return current; - case 132 /* ClassDeclaration */: - case 129 /* InterfaceDeclaration */: - case 131 /* ModuleDeclaration */: - return null; - } - current = current.parent; - } - return null; - } - ASTHelpers.getEnclosingMemberDeclaration = getEnclosingMemberDeclaration; - function isNameOfFunction(ast) { - return ast && ast.parent && ast.kind() === 11 /* IdentifierName */ && ast.parent.kind() === 130 /* FunctionDeclaration */ && ast.parent.identifier === ast; - } - ASTHelpers.isNameOfFunction = isNameOfFunction; - function isNameOfMemberFunction(ast) { - return ast && ast.parent && ast.kind() === 11 /* IdentifierName */ && ast.parent.kind() === 136 /* MemberFunctionDeclaration */ && ast.parent.propertyName === ast; - } - ASTHelpers.isNameOfMemberFunction = isNameOfMemberFunction; - function isNameOfMemberAccessExpression(ast) { - if (ast && ast.parent && ast.parent.kind() === 213 /* MemberAccessExpression */ && ast.parent.name === ast) { - return true; - } - return false; - } - ASTHelpers.isNameOfMemberAccessExpression = isNameOfMemberAccessExpression; - function isRightSideOfQualifiedName(ast) { - if (ast && ast.parent && ast.parent.kind() === 121 /* QualifiedName */ && ast.parent.right === ast) { - return true; - } - return false; - } - ASTHelpers.isRightSideOfQualifiedName = isRightSideOfQualifiedName; - function parentIsModuleDeclaration(ast) { - return ast.parent && ast.parent.kind() === 131 /* ModuleDeclaration */; - } - ASTHelpers.parentIsModuleDeclaration = parentIsModuleDeclaration; - function isDeclarationAST(ast) { - switch (ast.kind()) { - case 226 /* VariableDeclarator */: - return getVariableStatement(ast) !== null; - case 134 /* ImportDeclaration */: - case 132 /* ClassDeclaration */: - case 129 /* InterfaceDeclaration */: - case 243 /* Parameter */: - case 220 /* SimpleArrowFunctionExpression */: - case 219 /* ParenthesizedArrowFunctionExpression */: - case 145 /* IndexSignature */: - case 130 /* FunctionDeclaration */: - case 131 /* ModuleDeclaration */: - case 124 /* ArrayType */: - case 122 /* ObjectType */: - case 239 /* TypeParameter */: - case 138 /* ConstructorDeclaration */: - case 136 /* MemberFunctionDeclaration */: - case 140 /* GetAccessor */: - case 141 /* SetAccessor */: - case 137 /* MemberVariableDeclaration */: - case 139 /* IndexMemberDeclaration */: - case 133 /* EnumDeclaration */: - case 244 /* EnumElement */: - case 241 /* SimplePropertyAssignment */: - case 242 /* FunctionPropertyAssignment */: - case 223 /* FunctionExpression */: - case 143 /* CallSignature */: - case 144 /* ConstructSignature */: - case 146 /* MethodSignature */: - case 142 /* PropertySignature */: - return true; - default: - return false; - } - } - ASTHelpers.isDeclarationAST = isDeclarationAST; - function preComments(element, text) { - if (element) { - switch (element.kind()) { - case 149 /* VariableStatement */: - case 150 /* ExpressionStatement */: - case 132 /* ClassDeclaration */: - case 134 /* ImportDeclaration */: - case 130 /* FunctionDeclaration */: - case 131 /* ModuleDeclaration */: - case 133 /* EnumDeclaration */: - case 148 /* IfStatement */: - case 241 /* SimplePropertyAssignment */: - case 136 /* MemberFunctionDeclaration */: - case 129 /* InterfaceDeclaration */: - case 140 /* GetAccessor */: - case 141 /* SetAccessor */: - case 151 /* ReturnStatement */: - case 138 /* ConstructorDeclaration */: - case 137 /* MemberVariableDeclaration */: - case 244 /* EnumElement */: - case 143 /* CallSignature */: - case 144 /* ConstructSignature */: - case 145 /* IndexSignature */: - case 142 /* PropertySignature */: - case 146 /* MethodSignature */: - case 242 /* FunctionPropertyAssignment */: - case 243 /* Parameter */: - return convertNodeLeadingComments(element, text); - } - } - return null; - } - ASTHelpers.preComments = preComments; - function postComments(element, text) { - if (element) { - switch (element.kind()) { - case 150 /* ExpressionStatement */: - return convertNodeTrailingComments(element, text, true); - case 149 /* VariableStatement */: - case 132 /* ClassDeclaration */: - case 134 /* ImportDeclaration */: - case 130 /* FunctionDeclaration */: - case 131 /* ModuleDeclaration */: - case 133 /* EnumDeclaration */: - case 148 /* IfStatement */: - case 241 /* SimplePropertyAssignment */: - case 136 /* MemberFunctionDeclaration */: - case 129 /* InterfaceDeclaration */: - case 140 /* GetAccessor */: - case 141 /* SetAccessor */: - case 151 /* ReturnStatement */: - case 138 /* ConstructorDeclaration */: - case 137 /* MemberVariableDeclaration */: - case 244 /* EnumElement */: - case 143 /* CallSignature */: - case 144 /* ConstructSignature */: - case 145 /* IndexSignature */: - case 142 /* PropertySignature */: - case 146 /* MethodSignature */: - case 242 /* FunctionPropertyAssignment */: - case 243 /* Parameter */: - return convertNodeTrailingComments(element, text); - } - } - return null; - } - ASTHelpers.postComments = postComments; - function convertNodeTrailingComments(node, text, allowWithNewLine) { - if (allowWithNewLine === void 0) { allowWithNewLine = false; } - var _lastToken = TypeScript.lastToken(node); - if (_lastToken === null || !_lastToken.hasTrailingTrivia()) { - return null; - } - if (!allowWithNewLine && TypeScript.SyntaxUtilities.isLastTokenOnLine(_lastToken, text)) { - return null; - } - return convertComments(_lastToken.trailingTrivia(text), TypeScript.fullStart(node) + TypeScript.fullWidth(node) - _lastToken.trailingTriviaWidth(text)); - } - function convertNodeLeadingComments(element, text) { - if (element) { - return convertTokenLeadingComments(TypeScript.firstToken(element), text); - } - return null; - } - function convertTokenLeadingComments(token, text) { - if (token === null) { - return null; - } - return token.hasLeadingTrivia() ? convertComments(token.leadingTrivia(text), token.fullStart()) : null; - } - ASTHelpers.convertTokenLeadingComments = convertTokenLeadingComments; - function convertTokenTrailingComments(token, text) { - if (token === null) { - return null; - } - return token.hasTrailingTrivia() ? convertComments(token.trailingTrivia(text), TypeScript.fullEnd(token) - token.trailingTriviaWidth(text)) : null; - } - ASTHelpers.convertTokenTrailingComments = convertTokenTrailingComments; - function convertComments(triviaList, commentStartPosition) { - var result = null; - for (var i = 0, n = triviaList.count(); i < n; i++) { - var trivia = triviaList.syntaxTriviaAt(i); - if (trivia.isComment()) { - var hasTrailingNewLine = ((i + 1) < n) && triviaList.syntaxTriviaAt(i + 1).isNewLine(); - result = result || []; - result.push(convertComment(trivia, commentStartPosition, hasTrailingNewLine)); - } - commentStartPosition += trivia.fullWidth(); - } - return result; - } - function convertComment(trivia, commentStartPosition, hasTrailingNewLine) { - var comment = new TypeScript.Comment(trivia, hasTrailingNewLine, commentStartPosition, commentStartPosition + trivia.fullWidth()); - return comment; - } - function docComments(ast, text) { - if (isDeclarationAST(ast)) { - var comments = null; - if (ast.kind() === 226 /* VariableDeclarator */) { - comments = TypeScript.ASTHelpers.preComments(getVariableStatement(ast), text); - } - else if (ast.kind() === 243 /* Parameter */) { - comments = TypeScript.ASTHelpers.preComments(ast, text); - if (!comments) { - var previousToken = TypeScript.findToken(TypeScript.syntaxTree(ast).sourceUnit(), TypeScript.firstToken(ast).fullStart() - 1); - if (previousToken && (previousToken.kind() === 72 /* OpenParenToken */ || previousToken.kind() === 79 /* CommaToken */)) { - comments = convertTokenTrailingComments(previousToken, text); - } - } - } - else { - comments = TypeScript.ASTHelpers.preComments(ast, text); - } - if (comments && comments.length > 0) { - return comments.filter(function (c) { return isDocComment(c); }); - } - } - return sentinelEmptyArray; - } - ASTHelpers.docComments = docComments; - function isDocComment(comment) { - if (comment.kind() === 6 /* MultiLineCommentTrivia */) { - var fullText = comment.fullText(); - return fullText.charAt(2) === "*" && fullText.charAt(3) !== "/"; - } - return false; - } - ASTHelpers.isDocComment = isDocComment; - function getParameterList(ast) { - if (ast) { - switch (ast.kind()) { - case 138 /* ConstructorDeclaration */: - return getParameterList(ast.callSignature); - case 130 /* FunctionDeclaration */: - return getParameterList(ast.callSignature); - case 219 /* ParenthesizedArrowFunctionExpression */: - return getParameterList(ast.callSignature); - case 144 /* ConstructSignature */: - return getParameterList(ast.callSignature); - case 136 /* MemberFunctionDeclaration */: - return getParameterList(ast.callSignature); - case 242 /* FunctionPropertyAssignment */: - return getParameterList(ast.callSignature); - case 223 /* FunctionExpression */: - return getParameterList(ast.callSignature); - case 146 /* MethodSignature */: - return getParameterList(ast.callSignature); - case 125 /* ConstructorType */: - return ast.parameterList; - case 123 /* FunctionType */: - return ast.parameterList; - case 143 /* CallSignature */: - return ast.parameterList; - case 140 /* GetAccessor */: - return getParameterList(ast.callSignature); - case 141 /* SetAccessor */: - return getParameterList(ast.callSignature); - } - } - return null; - } - ASTHelpers.getParameterList = getParameterList; - function getType(ast) { - if (ast) { - switch (ast.kind()) { - case 130 /* FunctionDeclaration */: - return getType(ast.callSignature); - case 219 /* ParenthesizedArrowFunctionExpression */: - return getType(ast.callSignature); - case 144 /* ConstructSignature */: - return getType(ast.callSignature); - case 136 /* MemberFunctionDeclaration */: - return getType(ast.callSignature); - case 242 /* FunctionPropertyAssignment */: - return getType(ast.callSignature); - case 223 /* FunctionExpression */: - return getType(ast.callSignature); - case 146 /* MethodSignature */: - return getType(ast.callSignature); - case 143 /* CallSignature */: - return getType(ast.typeAnnotation); - case 145 /* IndexSignature */: - return getType(ast.typeAnnotation); - case 142 /* PropertySignature */: - return getType(ast.typeAnnotation); - case 140 /* GetAccessor */: - return getType(ast.callSignature); - case 243 /* Parameter */: - return getType(ast.typeAnnotation); - case 137 /* MemberVariableDeclaration */: - return getType(ast.variableDeclarator); - case 226 /* VariableDeclarator */: - return getType(ast.typeAnnotation); - case 237 /* CatchClause */: - return getType(ast.typeAnnotation); - case 125 /* ConstructorType */: - return ast.type; - case 123 /* FunctionType */: - return ast.type; - case 245 /* TypeAnnotation */: - return ast.type; - } - } - return null; - } - ASTHelpers.getType = getType; - function getVariableStatement(variableDeclarator) { - if (variableDeclarator && variableDeclarator.parent && variableDeclarator.parent.parent && variableDeclarator.parent.parent.parent && variableDeclarator.parent.kind() === 2 /* SeparatedList */ && variableDeclarator.parent.parent.kind() === 225 /* VariableDeclaration */ && variableDeclarator.parent.parent.parent.kind() === 149 /* VariableStatement */) { - return variableDeclarator.parent.parent.parent; - } - return null; - } - function getVariableDeclaratorModifiers(variableDeclarator) { - var variableStatement = getVariableStatement(variableDeclarator); - return variableStatement ? variableStatement.modifiers : TypeScript.Syntax.emptyList(); - } - ASTHelpers.getVariableDeclaratorModifiers = getVariableDeclaratorModifiers; - function isIntegerLiteralAST(expression) { - if (expression) { - switch (expression.kind()) { - case 165 /* PlusExpression */: - case 166 /* NegateExpression */: - expression = expression.operand; - return expression.kind() === 13 /* NumericLiteral */ && TypeScript.IntegerUtilities.isInteger(expression.text()); - case 13 /* NumericLiteral */: - var text = expression.text(); - return TypeScript.IntegerUtilities.isInteger(text) || TypeScript.IntegerUtilities.isHexInteger(text); - } - } - return false; - } - ASTHelpers.isIntegerLiteralAST = isIntegerLiteralAST; - function getEnclosingModuleDeclaration(ast) { - while (ast) { - if (ast.kind() === 131 /* ModuleDeclaration */) { - return ast; - } - ast = ast.parent; - } - return null; - } - ASTHelpers.getEnclosingModuleDeclaration = getEnclosingModuleDeclaration; - function isEntireNameOfModuleDeclaration(nameAST) { - return parentIsModuleDeclaration(nameAST) && nameAST.parent.name === nameAST; - } - function getModuleDeclarationFromNameAST(ast) { - if (ast) { - switch (ast.kind()) { - case 14 /* StringLiteral */: - if (parentIsModuleDeclaration(ast) && ast.parent.stringLiteral === ast) { - return ast.parent; - } - return null; - case 11 /* IdentifierName */: - case 121 /* QualifiedName */: - if (isEntireNameOfModuleDeclaration(ast)) { - return ast.parent; - } - break; - default: - return null; - } - for (ast = ast.parent; ast && ast.kind() === 121 /* QualifiedName */; ast = ast.parent) { - if (isEntireNameOfModuleDeclaration(ast)) { - return ast.parent; - } - } - } - return null; - } - ASTHelpers.getModuleDeclarationFromNameAST = getModuleDeclarationFromNameAST; - function isLastNameOfModule(ast, astName) { - if (ast) { - if (ast.stringLiteral) { - return astName === ast.stringLiteral; - } - else if (ast.name.kind() === 121 /* QualifiedName */) { - return astName === ast.name.right; - } - else { - return astName === ast.name; - } - } - return false; - } - ASTHelpers.isLastNameOfModule = isLastNameOfModule; - function getNameOfIdentifierOrQualifiedName(name) { - if (name.kind() === 11 /* IdentifierName */) { - return name.text(); - } - else { - TypeScript.Debug.assert(name.kind() == 121 /* QualifiedName */); - var dotExpr = name; - return getNameOfIdentifierOrQualifiedName(dotExpr.left) + "." + getNameOfIdentifierOrQualifiedName(dotExpr.right); - } - } - ASTHelpers.getNameOfIdentifierOrQualifiedName = getNameOfIdentifierOrQualifiedName; - function getModuleNames(name, result) { - result = result || []; - if (name.kind() === 121 /* QualifiedName */) { - getModuleNames(name.left, result); - result.push(name.right); - } - else { - result.push(name); - } - return result; - } - ASTHelpers.getModuleNames = getModuleNames; - })(ASTHelpers = TypeScript.ASTHelpers || (TypeScript.ASTHelpers = {})); -})(TypeScript || (TypeScript = {})); -var TypeScript; (function (TypeScript) { function stripStartAndEndQuotes(str) { var firstCharCode = str && str.charCodeAt(0); @@ -31975,143 +31714,31 @@ var TypeScript; return str; } TypeScript.stripStartAndEndQuotes = stripStartAndEndQuotes; - function isSingleQuoted(str) { - return str && str.length >= 2 && str.charCodeAt(0) === str.charCodeAt(str.length - 1) && str.charCodeAt(0) === 39 /* singleQuote */; - } - TypeScript.isSingleQuoted = isSingleQuoted; - function isDoubleQuoted(str) { - return str && str.length >= 2 && str.charCodeAt(0) === str.charCodeAt(str.length - 1) && str.charCodeAt(0) === 34 /* doubleQuote */; - } - TypeScript.isDoubleQuoted = isDoubleQuoted; - function isQuoted(str) { - return isDoubleQuoted(str) || isSingleQuoted(str); - } - TypeScript.isQuoted = isQuoted; - function quoteStr(str) { - return "\"" + str + "\""; - } - TypeScript.quoteStr = quoteStr; var switchToForwardSlashesRegEx = /\\/g; function switchToForwardSlashes(path) { return path.replace(switchToForwardSlashesRegEx, "/"); } TypeScript.switchToForwardSlashes = switchToForwardSlashes; - function trimModName(modName) { - if (modName.length > 5 && modName.substring(modName.length - 5, modName.length) === ".d.ts") { - return modName.substring(0, modName.length - 5); - } - if (modName.length > 3 && modName.substring(modName.length - 3, modName.length) === ".ts") { - return modName.substring(0, modName.length - 3); - } - if (modName.length > 3 && modName.substring(modName.length - 3, modName.length) === ".js") { - return modName.substring(0, modName.length - 3); - } - return modName; - } - TypeScript.trimModName = trimModName; - function getDeclareFilePath(fname) { - return isTSFile(fname) ? changePathToDTS(fname) : changePathToDTS(fname); - } - TypeScript.getDeclareFilePath = getDeclareFilePath; function isFileOfExtension(fname, ext) { var invariantFname = fname.toLocaleUpperCase(); var invariantExt = ext.toLocaleUpperCase(); var extLength = invariantExt.length; return invariantFname.length > extLength && invariantFname.substring(invariantFname.length - extLength, invariantFname.length) === invariantExt; } - function isTSFile(fname) { - return isFileOfExtension(fname, ".ts"); - } - TypeScript.isTSFile = isTSFile; function isDTSFile(fname) { return isFileOfExtension(fname, ".d.ts"); } TypeScript.isDTSFile = isDTSFile; - function getPrettyName(modPath, quote, treatAsFileName) { - if (quote === void 0) { quote = true; } - if (treatAsFileName === void 0) { treatAsFileName = false; } - var modName = treatAsFileName ? switchToForwardSlashes(modPath) : trimModName(stripStartAndEndQuotes(modPath)); - var components = this.getPathComponents(modName); - return components.length ? (quote ? quoteStr(components[components.length - 1]) : components[components.length - 1]) : modPath; - } - TypeScript.getPrettyName = getPrettyName; function getPathComponents(path) { return path.split("/"); } TypeScript.getPathComponents = getPathComponents; - function getRelativePathToFixedPath(fixedModFilePath, absoluteModPath, isAbsoultePathURL) { - if (isAbsoultePathURL === void 0) { isAbsoultePathURL = true; } - absoluteModPath = switchToForwardSlashes(absoluteModPath); - var modComponents = this.getPathComponents(absoluteModPath); - var fixedModComponents = this.getPathComponents(fixedModFilePath); - var joinStartIndex = 0; - for (; joinStartIndex < modComponents.length && joinStartIndex < fixedModComponents.length; joinStartIndex++) { - if (fixedModComponents[joinStartIndex] !== modComponents[joinStartIndex]) { - break; - } - } - if (joinStartIndex !== 0) { - var relativePath = ""; - var relativePathComponents = modComponents.slice(joinStartIndex, modComponents.length); - for (; joinStartIndex < fixedModComponents.length; joinStartIndex++) { - if (fixedModComponents[joinStartIndex] !== "") { - relativePath = relativePath + "../"; - } - } - return relativePath + relativePathComponents.join("/"); - } - if (isAbsoultePathURL && absoluteModPath.indexOf("://") === -1) { - absoluteModPath = "file:///" + absoluteModPath; - } - return absoluteModPath; - } - TypeScript.getRelativePathToFixedPath = getRelativePathToFixedPath; - function changePathToDTS(modPath) { - return trimModName(stripStartAndEndQuotes(modPath)) + ".d.ts"; - } - TypeScript.changePathToDTS = changePathToDTS; - function isRelative(path) { - return path.length > 0 && path.charAt(0) === "."; - } - TypeScript.isRelative = isRelative; - function isRooted(path) { - return path.length > 0 && (path.charAt(0) === "\\" || path.charAt(0) === "/" || (path.indexOf(":\\") !== -1) || (path.indexOf(":/") !== -1)); - } - TypeScript.isRooted = isRooted; - function getRootFilePath(outFname) { - if (outFname === "") { - return outFname; - } - else { - var isPath = outFname.indexOf("/") !== -1; - return isPath ? filePath(outFname) : ""; - } - } - TypeScript.getRootFilePath = getRootFilePath; - function filePathComponents(fullPath) { - fullPath = switchToForwardSlashes(fullPath); - var components = getPathComponents(fullPath); - return components.slice(0, components.length - 1); - } - TypeScript.filePathComponents = filePathComponents; - function filePath(fullPath) { - var path = filePathComponents(fullPath); - return path.join("/") + "/"; - } - TypeScript.filePath = filePath; - function convertToDirectoryPath(dirPath) { - if (dirPath && dirPath.charAt(dirPath.length - 1) !== "/") { - dirPath += "/"; - } - return dirPath; - } - TypeScript.convertToDirectoryPath = convertToDirectoryPath; var normalizePathRegEx = /^\\\\[^\\]/; function normalizePath(path) { if (normalizePathRegEx.test(path)) { path = "file:" + path; } - var parts = this.getPathComponents(switchToForwardSlashes(path)); + var parts = getPathComponents(switchToForwardSlashes(path)); var normalizedParts = []; for (var i = 0; i < parts.length; i++) { var part = parts[i]; @@ -32181,7 +31808,7 @@ var ts; return pos; }; NodeObject.prototype.createSyntaxList = function (nodes) { - var list = createNode(188 /* SyntaxList */, nodes.pos, nodes.end, 512 /* Synthetic */, this); + var list = createNode(195 /* SyntaxList */, nodes.pos, nodes.end, 512 /* Synthetic */, this); list._children = []; var pos = nodes.pos; for (var i = 0, len = nodes.length; i < len; i++) { @@ -32199,7 +31826,7 @@ var ts; }; NodeObject.prototype.createChildren = function (sourceFile) { var _this = this; - if (this.kind > 116 /* Missing */) { + if (this.kind > 120 /* Missing */) { scanner.setText((sourceFile || this.getSourceFile()).text); var children = []; var pos = this.pos; @@ -32244,9 +31871,9 @@ var ts; var children = this.getChildren(); for (var i = 0; i < children.length; i++) { var child = children[i]; - if (child.kind < 116 /* Missing */) + if (child.kind < 120 /* Missing */) return child; - if (child.kind > 116 /* Missing */) + if (child.kind > 120 /* Missing */) return child.getFirstToken(sourceFile); } }; @@ -32254,9 +31881,9 @@ var ts; var children = this.getChildren(sourceFile); for (var i = children.length - 1; i >= 0; i--) { var child = children[i]; - if (child.kind < 116 /* Missing */) + if (child.kind < 120 /* Missing */) return child; - if (child.kind > 116 /* Missing */) + if (child.kind > 120 /* Missing */) return child.getLastToken(sourceFile); } }; @@ -32299,7 +31926,7 @@ var ts; var jsDocCommentParts = []; ts.forEach(declarations, function (declaration) { var sourceFileOfDeclaration = ts.getSourceFileOfNode(declaration); - if (canUseParsedParamTagComments && declaration.kind === 119 /* Parameter */) { + if (canUseParsedParamTagComments && declaration.kind === 123 /* Parameter */) { ts.forEach(getJsDocCommentTextRange(declaration.parent, sourceFileOfDeclaration), function (jsDocCommentTextRange) { var cleanedParamJsDocComment = getCleanedParamJsDocComment(jsDocCommentTextRange.pos, jsDocCommentTextRange.end, sourceFileOfDeclaration); if (cleanedParamJsDocComment) { @@ -32307,13 +31934,13 @@ var ts; } }); } - if (declaration.kind === 181 /* ModuleDeclaration */ && declaration.body.kind === 181 /* ModuleDeclaration */) { + if (declaration.kind === 188 /* ModuleDeclaration */ && declaration.body.kind === 188 /* ModuleDeclaration */) { return; } - while (declaration.kind === 181 /* ModuleDeclaration */ && declaration.parent.kind === 181 /* ModuleDeclaration */) { + while (declaration.kind === 188 /* ModuleDeclaration */ && declaration.parent.kind === 188 /* ModuleDeclaration */) { declaration = declaration.parent; } - ts.forEach(getJsDocCommentTextRange(declaration.kind === 174 /* VariableDeclaration */ ? declaration.parent : declaration, sourceFileOfDeclaration), function (jsDocCommentTextRange) { + ts.forEach(getJsDocCommentTextRange(declaration.kind === 181 /* VariableDeclaration */ ? declaration.parent : declaration, sourceFileOfDeclaration), function (jsDocCommentTextRange) { var cleanedJsDocComment = getCleanedJsDocComment(jsDocCommentTextRange.pos, jsDocCommentTextRange.end, sourceFileOfDeclaration); if (cleanedJsDocComment) { jsDocCommentParts.push.apply(jsDocCommentParts, cleanedJsDocComment); @@ -32574,10 +32201,10 @@ var ts; var namedDeclarations = []; ts.forEachChild(sourceFile, function visit(node) { switch (node.kind) { - case 175 /* FunctionDeclaration */: - case 121 /* Method */: + case 182 /* FunctionDeclaration */: + case 125 /* Method */: var functionDeclaration = node; - if (functionDeclaration.name && functionDeclaration.name.kind !== 116 /* Missing */) { + if (functionDeclaration.name && functionDeclaration.name.kind !== 120 /* Missing */) { var lastDeclaration = namedDeclarations.length > 0 ? namedDeclarations[namedDeclarations.length - 1] : undefined; if (lastDeclaration && functionDeclaration.symbol === lastDeclaration.symbol) { if (functionDeclaration.body && !lastDeclaration.body) { @@ -32590,31 +32217,31 @@ var ts; ts.forEachChild(node, visit); } break; - case 177 /* ClassDeclaration */: - case 178 /* InterfaceDeclaration */: - case 179 /* TypeAliasDeclaration */: - case 180 /* EnumDeclaration */: - case 181 /* ModuleDeclaration */: - case 183 /* ImportDeclaration */: - case 123 /* GetAccessor */: - case 124 /* SetAccessor */: - case 130 /* TypeLiteral */: + case 184 /* ClassDeclaration */: + case 185 /* InterfaceDeclaration */: + case 186 /* TypeAliasDeclaration */: + case 187 /* EnumDeclaration */: + case 188 /* ModuleDeclaration */: + case 190 /* ImportDeclaration */: + case 127 /* GetAccessor */: + case 128 /* SetAccessor */: + case 134 /* TypeLiteral */: if (node.name) { namedDeclarations.push(node); } - case 122 /* Constructor */: - case 152 /* VariableStatement */: - case 182 /* ModuleBlock */: - case 176 /* FunctionBlock */: + case 126 /* Constructor */: + case 159 /* VariableStatement */: + case 189 /* ModuleBlock */: + case 183 /* FunctionBlock */: ts.forEachChild(node, visit); break; - case 119 /* Parameter */: + case 123 /* Parameter */: if (!(node.flags & ts.NodeFlags.AccessibilityModifier)) { break; } - case 174 /* VariableDeclaration */: - case 185 /* EnumMember */: - case 120 /* Property */: + case 181 /* VariableDeclaration */: + case 192 /* EnumMember */: + case 124 /* Property */: namedDeclarations.push(node); break; } @@ -32865,21 +32492,21 @@ var ts; } ts.lineBreakPart = lineBreakPart; function isFirstDeclarationOfSymbolParameter(symbol) { - return symbol.declarations && symbol.declarations.length > 0 && symbol.declarations[0].kind === 119 /* Parameter */; + return symbol.declarations && symbol.declarations.length > 0 && symbol.declarations[0].kind === 123 /* Parameter */; } function isLocalVariableOrFunction(symbol) { if (symbol.parent) { return false; } return ts.forEach(symbol.declarations, function (declaration) { - if (declaration.kind === 144 /* FunctionExpression */) { + if (declaration.kind === 149 /* FunctionExpression */) { return true; } - if (declaration.kind !== 174 /* VariableDeclaration */ && declaration.kind !== 175 /* FunctionDeclaration */) { + if (declaration.kind !== 181 /* VariableDeclaration */ && declaration.kind !== 182 /* FunctionDeclaration */) { return false; } - for (var parent = declaration.parent; parent.kind !== 176 /* FunctionBlock */; parent = parent.parent) { - if (parent.kind === 186 /* SourceFile */ || parent.kind === 182 /* ModuleBlock */) { + for (var parent = declaration.parent; parent.kind !== 183 /* FunctionBlock */; parent = parent.parent) { + if (parent.kind === 193 /* SourceFile */ || parent.kind === 189 /* ModuleBlock */) { return false; } } @@ -32908,16 +32535,16 @@ var ts; else if (flags & 64 /* Interface */) { return 4 /* interfaceName */; } - else if (flags & 128 /* Enum */) { + else if (flags & ts.SymbolFlags.Enum) { return 2 /* enumName */; } else if (flags & ts.SymbolFlags.Module) { return 11 /* moduleName */; } - else if (flags & 4096 /* Method */) { + else if (flags & 8192 /* Method */) { return 10 /* methodName */; } - else if (flags & 524288 /* TypeParameter */) { + else if (flags & 1048576 /* TypeParameter */) { return 18 /* typeParameterName */; } return 17 /* text */; @@ -33098,7 +32725,7 @@ var ts; this.host.log("SyntaxTreeCache.Initialize: fixupParentRefs : " + (new Date().getTime() - start)); } if (syntaxTree !== null) { - ts.Debug.assert(sourceFile); + ts.Debug.assert(sourceFile !== undefined); this.currentFileVersion = version; this.currentFilename = filename; this.currentFileSyntaxTree = syntaxTree; @@ -33225,9 +32852,9 @@ var ts; } function updateDocument(sourceFile, filename, compilationSettings, scriptSnapshot, version, isOpen, textChangeRange) { var bucket = getBucketForCompilationSettings(compilationSettings, false); - ts.Debug.assert(bucket); + ts.Debug.assert(bucket !== undefined); var entry = ts.lookUp(bucket, filename); - ts.Debug.assert(entry); + ts.Debug.assert(entry !== undefined); if (entry.sourceFile.isOpen === isOpen && entry.sourceFile.version === version) { return entry.sourceFile; } @@ -33236,7 +32863,7 @@ var ts; } function releaseDocument(filename, compilationSettings) { var bucket = getBucketForCompilationSettings(compilationSettings, false); - ts.Debug.assert(bucket); + ts.Debug.assert(bucket !== undefined); var entry = ts.lookUp(bucket, filename); entry.refCount--; ts.Debug.assert(entry.refCount >= 0); @@ -33272,7 +32899,7 @@ var ts; ts.getNodeModifiers = getNodeModifiers; function getTargetLabel(referenceNode, labelName) { while (referenceNode) { - if (referenceNode.kind === 167 /* LabeledStatement */ && referenceNode.label.text === labelName) { + if (referenceNode.kind === 174 /* LabeledStatement */ && referenceNode.label.text === labelName) { return referenceNode.label; } referenceNode = referenceNode.parent; @@ -33280,13 +32907,13 @@ var ts; return undefined; } function isJumpStatementTarget(node) { - return node.kind === 59 /* Identifier */ && (node.parent.kind === 161 /* BreakStatement */ || node.parent.kind === 160 /* ContinueStatement */) && node.parent.label === node; + return node.kind === 63 /* Identifier */ && (node.parent.kind === 168 /* BreakStatement */ || node.parent.kind === 167 /* ContinueStatement */) && node.parent.label === node; } function isLabelOfLabeledStatement(node) { - return node.kind === 59 /* Identifier */ && node.parent.kind === 167 /* LabeledStatement */ && node.parent.label === node; + return node.kind === 63 /* Identifier */ && node.parent.kind === 174 /* LabeledStatement */ && node.parent.label === node; } function isLabeledBy(node, labelName) { - for (var owner = node.parent; owner.kind === 167 /* LabeledStatement */; owner = owner.parent) { + for (var owner = node.parent; owner.kind === 174 /* LabeledStatement */; owner = owner.parent) { if (owner.label.text === labelName) { return true; } @@ -33297,51 +32924,51 @@ var ts; return isLabelOfLabeledStatement(node) || isJumpStatementTarget(node); } function isRightSideOfQualifiedName(node) { - return node.parent.kind === 117 /* QualifiedName */ && node.parent.right === node; + return node.parent.kind === 121 /* QualifiedName */ && node.parent.right === node; } function isRightSideOfPropertyAccess(node) { - return node && node.parent && node.parent.kind === 138 /* PropertyAccess */ && node.parent.right === node; + return node && node.parent && node.parent.kind === 142 /* PropertyAccess */ && node.parent.right === node; } function isCallExpressionTarget(node) { if (isRightSideOfPropertyAccess(node)) { node = node.parent; } - return node && node.parent && node.parent.kind === 140 /* CallExpression */ && node.parent.func === node; + return node && node.parent && node.parent.kind === 144 /* CallExpression */ && node.parent.func === node; } function isNewExpressionTarget(node) { if (isRightSideOfPropertyAccess(node)) { node = node.parent; } - return node && node.parent && node.parent.kind === 141 /* NewExpression */ && node.parent.func === node; + return node && node.parent && node.parent.kind === 145 /* NewExpression */ && node.parent.func === node; } function isNameOfModuleDeclaration(node) { - return node.parent.kind === 181 /* ModuleDeclaration */ && node.parent.name === node; + return node.parent.kind === 188 /* ModuleDeclaration */ && node.parent.name === node; } function isNameOfFunctionDeclaration(node) { - return node.kind === 59 /* Identifier */ && ts.isAnyFunction(node.parent) && node.parent.name === node; + return node.kind === 63 /* Identifier */ && ts.isAnyFunction(node.parent) && node.parent.name === node; } function isNameOfPropertyAssignment(node) { - return (node.kind === 59 /* Identifier */ || node.kind === 7 /* StringLiteral */ || node.kind === 6 /* NumericLiteral */) && node.parent.kind === 137 /* PropertyAssignment */ && node.parent.name === node; + return (node.kind === 63 /* Identifier */ || node.kind === 7 /* StringLiteral */ || node.kind === 6 /* NumericLiteral */) && node.parent.kind === 141 /* PropertyAssignment */ && node.parent.name === node; } function isLiteralNameOfPropertyDeclarationOrIndexAccess(node) { if (node.kind === 7 /* StringLiteral */ || node.kind === 6 /* NumericLiteral */) { switch (node.parent.kind) { - case 120 /* Property */: - case 137 /* PropertyAssignment */: - case 185 /* EnumMember */: - case 121 /* Method */: - case 123 /* GetAccessor */: - case 124 /* SetAccessor */: - case 181 /* ModuleDeclaration */: + case 124 /* Property */: + case 141 /* PropertyAssignment */: + case 192 /* EnumMember */: + case 125 /* Method */: + case 127 /* GetAccessor */: + case 128 /* SetAccessor */: + case 188 /* ModuleDeclaration */: return node.parent.name === node; - case 139 /* IndexedAccess */: + case 143 /* IndexedAccess */: return node.parent.index === node; } } return false; } function isNameOfExternalModuleImportOrDeclaration(node) { - return node.kind === 7 /* StringLiteral */ && (isNameOfModuleDeclaration(node) || (node.parent.kind === 183 /* ImportDeclaration */ && node.parent.externalModuleName === node)); + return node.kind === 7 /* StringLiteral */ && (isNameOfModuleDeclaration(node) || (node.parent.kind === 190 /* ImportDeclaration */ && node.parent.externalModuleName === node)); } function isInsideComment(sourceFile, token, position) { return position <= token.getStart(sourceFile) && (isInsideCommentRange(ts.getTrailingCommentRanges(sourceFile.text, token.getFullStart())) || isInsideCommentRange(ts.getLeadingCommentRanges(sourceFile.text, token.getFullStart()))); @@ -33567,15 +33194,25 @@ var ts; function getCompletionsAtPosition(filename, position, isMemberCompletion) { synchronizeHostData(); filename = TypeScript.switchToForwardSlashes(filename); + var syntacticStart = new Date().getTime(); var sourceFile = getSourceFile(filename); + var start = new Date().getTime(); var currentToken = ts.getTokenAtPosition(sourceFile, position); - if (isInsideComment(sourceFile, currentToken, position)) { + host.log("getCompletionsAtPosition: Get current token: " + (new Date().getTime() - start)); + var start = new Date().getTime(); + var insideComment = isInsideComment(sourceFile, currentToken, position); + host.log("getCompletionsAtPosition: Is inside comment: " + (new Date().getTime() - start)); + if (insideComment) { host.log("Returning an empty list because completion was inside a comment."); return undefined; } + var start = new Date().getTime(); var previousToken = ts.findPrecedingToken(position, sourceFile); - if (previousToken && position <= previousToken.end && previousToken.kind === 59 /* Identifier */) { + host.log("getCompletionsAtPosition: Get previous token 1: " + (new Date().getTime() - start)); + if (previousToken && position <= previousToken.end && previousToken.kind === 63 /* Identifier */) { + var start = new Date().getTime(); previousToken = ts.findPrecedingToken(previousToken.pos, sourceFile); + host.log("getCompletionsAtPosition: Get previous token 2: " + (new Date().getTime() - start)); } if (previousToken && isCompletionListBlocker(previousToken)) { host.log("Returning an empty list because completion was requested in an invalid position."); @@ -33583,7 +33220,7 @@ var ts; } var node; var isRightOfDot; - if (previousToken && previousToken.kind === 15 /* DotToken */ && (previousToken.parent.kind === 138 /* PropertyAccess */ || previousToken.parent.kind === 117 /* QualifiedName */)) { + if (previousToken && previousToken.kind === 19 /* DotToken */ && (previousToken.parent.kind === 142 /* PropertyAccess */ || previousToken.parent.kind === 121 /* QualifiedName */)) { node = previousToken.parent.left; isRightOfDot = true; } @@ -33598,12 +33235,14 @@ var ts; symbols: {}, typeChecker: typeInfoResolver }; + host.log("getCompletionsAtPosition: Syntactic work: " + (new Date().getTime() - syntacticStart)); + var semanticStart = new Date().getTime(); if (isRightOfDot) { var symbols = []; isMemberCompletion = true; - if (node.kind === 59 /* Identifier */ || node.kind === 117 /* QualifiedName */ || node.kind === 138 /* PropertyAccess */) { + if (node.kind === 63 /* Identifier */ || node.kind === 121 /* QualifiedName */ || node.kind === 142 /* PropertyAccess */) { var symbol = typeInfoResolver.getSymbolInfo(node); - if (symbol && symbol.flags & 16777216 /* Import */) { + if (symbol && symbol.flags & 33554432 /* Import */) { symbol = typeInfoResolver.getAliasedSymbol(symbol); } if (symbol && symbol.flags & ts.SymbolFlags.HasExports) { @@ -33640,7 +33279,7 @@ var ts; } else { isMemberCompletion = false; - var symbolMeanings = ts.SymbolFlags.Type | ts.SymbolFlags.Value | ts.SymbolFlags.Namespace | 16777216 /* Import */; + var symbolMeanings = ts.SymbolFlags.Type | ts.SymbolFlags.Value | ts.SymbolFlags.Namespace | 33554432 /* Import */; var symbols = typeInfoResolver.getSymbolsInScope(node, symbolMeanings); getCompletionEntriesFromSymbols(symbols, activeCompletionSession); } @@ -33648,11 +33287,13 @@ var ts; if (!isMemberCompletion) { Array.prototype.push.apply(activeCompletionSession.entries, keywordCompletions); } + host.log("getCompletionsAtPosition: Semantic work: " + (new Date().getTime() - semanticStart)); return { isMemberCompletion: isMemberCompletion, entries: activeCompletionSession.entries }; function getCompletionEntriesFromSymbols(symbols, session) { + var start = new Date().getTime(); ts.forEach(symbols, function (symbol) { var entry = createCompletionEntry(symbol, session.typeChecker); if (entry && !ts.lookUp(session.symbols, entry.name)) { @@ -33660,12 +33301,16 @@ var ts; session.symbols[entry.name] = symbol; } }); + host.log("getCompletionsAtPosition: getCompletionEntriesFromSymbols: " + (new Date().getTime() - semanticStart)); } function isCompletionListBlocker(previousToken) { - return isInStringOrRegularExpressionLiteral(previousToken) || isIdentifierDefinitionLocation(previousToken) || isRightOfIllegalDot(previousToken); + var start = new Date().getTime(); + var result = isInStringOrRegularExpressionOrTemplateLiteral(previousToken) || isIdentifierDefinitionLocation(previousToken) || isRightOfIllegalDot(previousToken); + host.log("getCompletionsAtPosition: isCompletionListBlocker: " + (new Date().getTime() - semanticStart)); + return result; } - function isInStringOrRegularExpressionLiteral(previousToken) { - if (previousToken.kind === 7 /* StringLiteral */) { + function isInStringOrRegularExpressionOrTemplateLiteral(previousToken) { + if (previousToken.kind === 7 /* StringLiteral */ || ts.isTemplateLiteralKind(previousToken.kind)) { var start = previousToken.getStart(); var end = previousToken.getEnd(); if (start < position && position < end) { @@ -33674,7 +33319,20 @@ var ts; else if (position === end) { var width = end - start; var text = previousToken.getSourceFile().text; - return width <= 1 || text.charCodeAt(start) !== text.charCodeAt(end - 1) || text.charCodeAt(end - 2) === 92 /* backslash */; + if (width <= 1 || text.charCodeAt(end - 2) === 92 /* backslash */) { + return true; + } + switch (previousToken.kind) { + case 7 /* StringLiteral */: + case 9 /* NoSubstitutionTemplateLiteral */: + return text.charCodeAt(start) !== text.charCodeAt(end - 1); + case 10 /* TemplateHead */: + case 11 /* TemplateMiddle */: + return text.charCodeAt(end - 1) !== 123 /* openBrace */ || text.charCodeAt(end - 2) !== 36 /* $ */; + case 12 /* TemplateTail */: + return text.charCodeAt(end - 1) !== 96 /* backtick */; + } + return false; } } else if (previousToken.kind === 8 /* RegularExpressionLiteral */) { @@ -33686,9 +33344,9 @@ var ts; if (previousToken) { var parent = previousToken.parent; switch (previousToken.kind) { - case 9 /* OpenBraceToken */: - case 18 /* CommaToken */: - if (parent && parent.kind === 136 /* ObjectLiteral */) { + case 13 /* OpenBraceToken */: + case 22 /* CommaToken */: + if (parent && parent.kind === 140 /* ObjectLiteral */) { return parent; } break; @@ -33698,16 +33356,16 @@ var ts; } function isFunction(kind) { switch (kind) { - case 144 /* FunctionExpression */: - case 145 /* ArrowFunction */: - case 175 /* FunctionDeclaration */: - case 121 /* Method */: - case 122 /* Constructor */: - case 123 /* GetAccessor */: - case 124 /* SetAccessor */: - case 125 /* CallSignature */: - case 126 /* ConstructSignature */: - case 127 /* IndexSignature */: + case 149 /* FunctionExpression */: + case 150 /* ArrowFunction */: + case 182 /* FunctionDeclaration */: + case 125 /* Method */: + case 126 /* Constructor */: + case 127 /* GetAccessor */: + case 128 /* SetAccessor */: + case 129 /* CallSignature */: + case 130 /* ConstructSignature */: + case 131 /* IndexSignature */: return true; } return false; @@ -33716,27 +33374,27 @@ var ts; if (previousToken) { var containingNodeKind = previousToken.parent.kind; switch (previousToken.kind) { - case 18 /* CommaToken */: - return containingNodeKind === 174 /* VariableDeclaration */ || containingNodeKind === 152 /* VariableStatement */ || containingNodeKind === 180 /* EnumDeclaration */ || isFunction(containingNodeKind); - case 11 /* OpenParenToken */: - return containingNodeKind === 171 /* CatchBlock */ || isFunction(containingNodeKind); - case 9 /* OpenBraceToken */: - return containingNodeKind === 180 /* EnumDeclaration */ || containingNodeKind === 178 /* InterfaceDeclaration */; - case 17 /* SemicolonToken */: - return containingNodeKind === 120 /* Property */ && previousToken.parent.parent.kind === 178 /* InterfaceDeclaration */; - case 102 /* PublicKeyword */: - case 100 /* PrivateKeyword */: - case 103 /* StaticKeyword */: - case 16 /* DotDotDotToken */: - return containingNodeKind === 119 /* Parameter */; - case 63 /* ClassKeyword */: - case 110 /* ModuleKeyword */: - case 71 /* EnumKeyword */: - case 97 /* InterfaceKeyword */: - case 77 /* FunctionKeyword */: - case 92 /* VarKeyword */: - case 109 /* GetKeyword */: - case 113 /* SetKeyword */: + case 22 /* CommaToken */: + return containingNodeKind === 181 /* VariableDeclaration */ || containingNodeKind === 159 /* VariableStatement */ || containingNodeKind === 187 /* EnumDeclaration */ || isFunction(containingNodeKind); + case 15 /* OpenParenToken */: + return containingNodeKind === 178 /* CatchBlock */ || isFunction(containingNodeKind); + case 13 /* OpenBraceToken */: + return containingNodeKind === 187 /* EnumDeclaration */ || containingNodeKind === 185 /* InterfaceDeclaration */; + case 21 /* SemicolonToken */: + return containingNodeKind === 124 /* Property */ && previousToken.parent.parent.kind === 185 /* InterfaceDeclaration */; + case 106 /* PublicKeyword */: + case 104 /* PrivateKeyword */: + case 107 /* StaticKeyword */: + case 20 /* DotDotDotToken */: + return containingNodeKind === 123 /* Parameter */; + case 67 /* ClassKeyword */: + case 114 /* ModuleKeyword */: + case 75 /* EnumKeyword */: + case 101 /* InterfaceKeyword */: + case 81 /* FunctionKeyword */: + case 96 /* VarKeyword */: + case 113 /* GetKeyword */: + case 117 /* SetKeyword */: return true; } switch (previousToken.getText()) { @@ -33764,7 +33422,7 @@ var ts; } var existingMemberNames = {}; ts.forEach(existingMembers, function (m) { - if (m.kind !== 137 /* PropertyAssignment */) { + if (m.kind !== 141 /* PropertyAssignment */) { return; } if (m.getStart() <= position && position <= m.getEnd()) { @@ -33791,7 +33449,7 @@ var ts; var symbol = ts.lookUp(activeCompletionSession.symbols, entryName); if (symbol) { var type = session.typeChecker.getTypeOfSymbol(symbol); - ts.Debug.assert(type, "Could not find type for symbol"); + ts.Debug.assert(type !== undefined, "Could not find type for symbol"); var completionEntry = createCompletionEntry(symbol, session.typeChecker); var location = ts.getTouchingPropertyName(sourceFile, position); var displayPartsDocumentationsAndSymbolKind = getSymbolDisplayPartsDocumentationAndSymbolKind(symbol, getSourceFile(filename), location, session.typeChecker, location, SemanticMeaning.All); @@ -33820,16 +33478,16 @@ var ts; return node; } switch (node.kind) { - case 186 /* SourceFile */: - case 121 /* Method */: - case 175 /* FunctionDeclaration */: - case 144 /* FunctionExpression */: - case 123 /* GetAccessor */: - case 124 /* SetAccessor */: - case 177 /* ClassDeclaration */: - case 178 /* InterfaceDeclaration */: - case 180 /* EnumDeclaration */: - case 181 /* ModuleDeclaration */: + case 193 /* SourceFile */: + case 125 /* Method */: + case 182 /* FunctionDeclaration */: + case 149 /* FunctionExpression */: + case 127 /* GetAccessor */: + case 128 /* SetAccessor */: + case 184 /* ClassDeclaration */: + case 185 /* InterfaceDeclaration */: + case 187 /* EnumDeclaration */: + case 188 /* ModuleDeclaration */: return node; } } @@ -33838,21 +33496,21 @@ var ts; var flags = symbol.getFlags(); if (flags & 32 /* Class */) return ScriptElementKind.classElement; - if (flags & 128 /* Enum */) + if (flags & ts.SymbolFlags.Enum) return ScriptElementKind.enumElement; - if (flags & 1048576 /* TypeAlias */) + if (flags & 2097152 /* TypeAlias */) return ScriptElementKind.typeElement; if (flags & 64 /* Interface */) return ScriptElementKind.interfaceElement; - if (flags & 524288 /* TypeParameter */) + if (flags & 1048576 /* TypeParameter */) return ScriptElementKind.typeParameterElement; var result = getSymbolKindOfConstructorPropertyMethodAccessorFunctionOrVar(symbol, flags, typeResolver); if (result === ScriptElementKind.unknown) { - if (flags & 524288 /* TypeParameter */) + if (flags & 1048576 /* TypeParameter */) return ScriptElementKind.typeParameterElement; if (flags & 8 /* EnumMember */) return ScriptElementKind.variableElement; - if (flags & 16777216 /* Import */) + if (flags & 33554432 /* Import */) return ScriptElementKind.alias; } return result; @@ -33875,26 +33533,26 @@ var ts; } if (flags & 16 /* Function */) return isLocalVariableOrFunction(symbol) ? ScriptElementKind.localFunctionElement : ScriptElementKind.functionElement; - if (flags & 16384 /* GetAccessor */) + if (flags & 32768 /* GetAccessor */) return ScriptElementKind.memberGetAccessorElement; - if (flags & 32768 /* SetAccessor */) + if (flags & 65536 /* SetAccessor */) return ScriptElementKind.memberSetAccessorElement; - if (flags & 4096 /* Method */) + if (flags & 8192 /* Method */) return ScriptElementKind.memberFunctionElement; - if (flags & 8192 /* Constructor */) + if (flags & 16384 /* Constructor */) return ScriptElementKind.constructorImplementationElement; if (flags & 4 /* Property */) { - if (flags & 536870912 /* UnionProperty */) { + if (flags & 1073741824 /* UnionProperty */) { return ts.forEach(typeInfoResolver.getRootSymbols(symbol), function (rootSymbol) { var rootSymbolFlags = rootSymbol.getFlags(); if (rootSymbolFlags & 4 /* Property */) { return ScriptElementKind.memberVariableElement; } - if (rootSymbolFlags & 16384 /* GetAccessor */) + if (rootSymbolFlags & 32768 /* GetAccessor */) return ScriptElementKind.memberVariableElement; - if (rootSymbolFlags & 32768 /* SetAccessor */) + if (rootSymbolFlags & 65536 /* SetAccessor */) return ScriptElementKind.memberVariableElement; - ts.Debug.assert(rootSymbolFlags & 4096 /* Method */); + ts.Debug.assert((rootSymbolFlags & 8192 /* Method */) !== undefined); }) || ScriptElementKind.memberFunctionElement; } return ScriptElementKind.memberVariableElement; @@ -33919,42 +33577,24 @@ var ts; } function getNodeKind(node) { switch (node.kind) { - case 181 /* ModuleDeclaration */: - return ScriptElementKind.moduleElement; - case 177 /* ClassDeclaration */: - return ScriptElementKind.classElement; - case 178 /* InterfaceDeclaration */: - return ScriptElementKind.interfaceElement; - case 179 /* TypeAliasDeclaration */: - return ScriptElementKind.typeElement; - case 180 /* EnumDeclaration */: - return ScriptElementKind.enumElement; - case 174 /* VariableDeclaration */: - return node.flags & 4096 /* Const */ ? ScriptElementKind.constantElement : ScriptElementKind.variableElement; - case 175 /* FunctionDeclaration */: - return ScriptElementKind.functionElement; - case 123 /* GetAccessor */: - return ScriptElementKind.memberGetAccessorElement; - case 124 /* SetAccessor */: - return ScriptElementKind.memberSetAccessorElement; - case 121 /* Method */: - return ScriptElementKind.memberFunctionElement; - case 120 /* Property */: - return ScriptElementKind.memberVariableElement; - case 127 /* IndexSignature */: - return ScriptElementKind.indexSignatureElement; - case 126 /* ConstructSignature */: - return ScriptElementKind.constructSignatureElement; - case 125 /* CallSignature */: - return ScriptElementKind.callSignatureElement; - case 122 /* Constructor */: - return ScriptElementKind.constructorImplementationElement; - case 118 /* TypeParameter */: - return ScriptElementKind.typeParameterElement; - case 185 /* EnumMember */: - return ScriptElementKind.variableElement; - case 119 /* Parameter */: - return (node.flags & ts.NodeFlags.AccessibilityModifier) ? ScriptElementKind.memberVariableElement : ScriptElementKind.parameterElement; + case 188 /* ModuleDeclaration */: return ScriptElementKind.moduleElement; + case 184 /* ClassDeclaration */: return ScriptElementKind.classElement; + case 185 /* InterfaceDeclaration */: return ScriptElementKind.interfaceElement; + case 186 /* TypeAliasDeclaration */: return ScriptElementKind.typeElement; + case 187 /* EnumDeclaration */: return ScriptElementKind.enumElement; + case 181 /* VariableDeclaration */: return node.flags & 4096 /* Const */ ? ScriptElementKind.constantElement : ScriptElementKind.variableElement; + case 182 /* FunctionDeclaration */: return ScriptElementKind.functionElement; + case 127 /* GetAccessor */: return ScriptElementKind.memberGetAccessorElement; + case 128 /* SetAccessor */: return ScriptElementKind.memberSetAccessorElement; + case 125 /* Method */: return ScriptElementKind.memberFunctionElement; + case 124 /* Property */: return ScriptElementKind.memberVariableElement; + case 131 /* IndexSignature */: return ScriptElementKind.indexSignatureElement; + case 130 /* ConstructSignature */: return ScriptElementKind.constructSignatureElement; + case 129 /* CallSignature */: return ScriptElementKind.callSignatureElement; + case 126 /* Constructor */: return ScriptElementKind.constructorImplementationElement; + case 122 /* TypeParameter */: return ScriptElementKind.typeParameterElement; + case 192 /* EnumMember */: return ScriptElementKind.variableElement; + case 123 /* Parameter */: return (node.flags & ts.NodeFlags.AccessibilityModifier) ? ScriptElementKind.memberVariableElement : ScriptElementKind.parameterElement; } return ScriptElementKind.unknown; } @@ -33968,20 +33608,20 @@ var ts; var symbolFlags = symbol.flags; var symbolKind = getSymbolKindOfConstructorPropertyMethodAccessorFunctionOrVar(symbol, symbolFlags, typeResolver); var hasAddedSymbolInfo; - if (symbolKind !== ScriptElementKind.unknown || symbolFlags & 32 /* Class */ || symbolFlags & 16777216 /* Import */) { + if (symbolKind !== ScriptElementKind.unknown || symbolFlags & 32 /* Class */ || symbolFlags & 33554432 /* Import */) { if (symbolKind === ScriptElementKind.memberGetAccessorElement || symbolKind === ScriptElementKind.memberSetAccessorElement) { symbolKind = ScriptElementKind.memberVariableElement; } var type = typeResolver.getTypeOfSymbol(symbol); if (type) { - if (location.parent && location.parent.kind === 138 /* PropertyAccess */) { + if (location.parent && location.parent.kind === 142 /* PropertyAccess */) { var right = location.parent.right; - if (right === location || (right && right.kind === 116 /* Missing */)) { + if (right === location || (right && right.kind === 120 /* Missing */)) { location = location.parent; } } var callExpression; - if (location.kind === 140 /* CallExpression */ || location.kind === 141 /* NewExpression */) { + if (location.kind === 144 /* CallExpression */ || location.kind === 145 /* NewExpression */) { callExpression = location; } else if (isCallExpressionTarget(location) || isNewExpressionTarget(location)) { @@ -33993,7 +33633,7 @@ var ts; if (!signature && candidateSignatures.length) { signature = candidateSignatures[0]; } - var useConstructSignatures = callExpression.kind === 141 /* NewExpression */ || callExpression.func.kind === 85 /* SuperKeyword */; + var useConstructSignatures = callExpression.kind === 145 /* NewExpression */ || callExpression.func.kind === 89 /* SuperKeyword */; var allSignatures = useConstructSignatures ? type.getConstructSignatures() : type.getCallSignatures(); if (!ts.contains(allSignatures, signature.target || signature)) { signature = allSignatures.length ? allSignatures[0] : undefined; @@ -34003,14 +33643,14 @@ var ts; symbolKind = ScriptElementKind.constructorImplementationElement; addPrefixForAnyFunctionOrVar(type.symbol, symbolKind); } - else if (symbolFlags & 16777216 /* Import */) { + else if (symbolFlags & 33554432 /* Import */) { symbolKind = ScriptElementKind.alias; - displayParts.push(punctuationPart(11 /* OpenParenToken */)); + displayParts.push(punctuationPart(15 /* OpenParenToken */)); displayParts.push(textPart(symbolKind)); - displayParts.push(punctuationPart(12 /* CloseParenToken */)); + displayParts.push(punctuationPart(16 /* CloseParenToken */)); displayParts.push(spacePart()); if (useConstructSignatures) { - displayParts.push(keywordPart(82 /* NewKeyword */)); + displayParts.push(keywordPart(86 /* NewKeyword */)); displayParts.push(spacePart()); } addFullSymbolName(symbol); @@ -34024,10 +33664,10 @@ var ts; case ScriptElementKind.constantElement: case ScriptElementKind.parameterElement: case ScriptElementKind.localVariableElement: - displayParts.push(punctuationPart(46 /* ColonToken */)); + displayParts.push(punctuationPart(50 /* ColonToken */)); displayParts.push(spacePart()); if (useConstructSignatures) { - displayParts.push(keywordPart(82 /* NewKeyword */)); + displayParts.push(keywordPart(86 /* NewKeyword */)); displayParts.push(spacePart()); } if (!(type.flags & 32768 /* Anonymous */)) { @@ -34041,21 +33681,21 @@ var ts; hasAddedSymbolInfo = true; } } - else if ((isNameOfFunctionDeclaration(location) && !(symbol.flags & ts.SymbolFlags.Accessor)) || (location.kind === 107 /* ConstructorKeyword */ && location.parent.kind === 122 /* Constructor */)) { + else if ((isNameOfFunctionDeclaration(location) && !(symbol.flags & ts.SymbolFlags.Accessor)) || (location.kind === 111 /* ConstructorKeyword */ && location.parent.kind === 126 /* Constructor */)) { var signature; var functionDeclaration = location.parent; - var allSignatures = functionDeclaration.kind === 122 /* Constructor */ ? type.getConstructSignatures() : type.getCallSignatures(); + var allSignatures = functionDeclaration.kind === 126 /* Constructor */ ? type.getConstructSignatures() : type.getCallSignatures(); if (!typeResolver.isImplementationOfOverload(functionDeclaration)) { signature = typeResolver.getSignatureFromDeclaration(functionDeclaration); } else { signature = allSignatures[0]; } - if (functionDeclaration.kind === 122 /* Constructor */) { + if (functionDeclaration.kind === 126 /* Constructor */) { addPrefixForAnyFunctionOrVar(type.symbol, ScriptElementKind.constructorImplementationElement); } else { - addPrefixForAnyFunctionOrVar(functionDeclaration.kind === 125 /* CallSignature */ && !(type.symbol.flags & 1024 /* TypeLiteral */ || type.symbol.flags & 2048 /* ObjectLiteral */) ? type.symbol : symbol, symbolKind); + addPrefixForAnyFunctionOrVar(functionDeclaration.kind === 129 /* CallSignature */ && !(type.symbol.flags & 2048 /* TypeLiteral */ || type.symbol.flags & 4096 /* ObjectLiteral */) ? type.symbol : symbol, symbolKind); } addSignatureDisplayParts(signature, allSignatures); hasAddedSymbolInfo = true; @@ -34063,62 +33703,62 @@ var ts; } } if (symbolFlags & 32 /* Class */ && !hasAddedSymbolInfo) { - displayParts.push(keywordPart(63 /* ClassKeyword */)); + displayParts.push(keywordPart(67 /* ClassKeyword */)); displayParts.push(spacePart()); addFullSymbolName(symbol); writeTypeParametersOfSymbol(symbol, sourceFile); } if ((symbolFlags & 64 /* Interface */) && (semanticMeaning & 2 /* Type */)) { addNewLineIfDisplayPartsExist(); - displayParts.push(keywordPart(97 /* InterfaceKeyword */)); + displayParts.push(keywordPart(101 /* InterfaceKeyword */)); displayParts.push(spacePart()); addFullSymbolName(symbol); writeTypeParametersOfSymbol(symbol, sourceFile); } - if (symbolFlags & 1048576 /* TypeAlias */) { + if (symbolFlags & 2097152 /* TypeAlias */) { addNewLineIfDisplayPartsExist(); - displayParts.push(keywordPart(115 /* TypeKeyword */)); + displayParts.push(keywordPart(119 /* TypeKeyword */)); displayParts.push(spacePart()); addFullSymbolName(symbol); displayParts.push(spacePart()); - displayParts.push(punctuationPart(47 /* EqualsToken */)); + displayParts.push(punctuationPart(51 /* EqualsToken */)); displayParts.push(spacePart()); displayParts.push.apply(displayParts, typeToDisplayParts(typeResolver, typeResolver.getDeclaredTypeOfSymbol(symbol), enclosingDeclaration)); } - if (symbolFlags & 128 /* Enum */) { + if (symbolFlags & ts.SymbolFlags.Enum) { addNewLineIfDisplayPartsExist(); - displayParts.push(keywordPart(71 /* EnumKeyword */)); + displayParts.push(keywordPart(75 /* EnumKeyword */)); displayParts.push(spacePart()); addFullSymbolName(symbol); } if (symbolFlags & ts.SymbolFlags.Module) { addNewLineIfDisplayPartsExist(); - displayParts.push(keywordPart(110 /* ModuleKeyword */)); + displayParts.push(keywordPart(114 /* ModuleKeyword */)); displayParts.push(spacePart()); addFullSymbolName(symbol); } - if ((symbolFlags & 524288 /* TypeParameter */) && (semanticMeaning & 2 /* Type */)) { + if ((symbolFlags & 1048576 /* TypeParameter */) && (semanticMeaning & 2 /* Type */)) { addNewLineIfDisplayPartsExist(); - displayParts.push(punctuationPart(11 /* OpenParenToken */)); + displayParts.push(punctuationPart(15 /* OpenParenToken */)); displayParts.push(textPart("type parameter")); - displayParts.push(punctuationPart(12 /* CloseParenToken */)); + displayParts.push(punctuationPart(16 /* CloseParenToken */)); displayParts.push(spacePart()); addFullSymbolName(symbol); displayParts.push(spacePart()); - displayParts.push(keywordPart(80 /* InKeyword */)); + displayParts.push(keywordPart(84 /* InKeyword */)); displayParts.push(spacePart()); if (symbol.parent) { addFullSymbolName(symbol.parent, enclosingDeclaration); writeTypeParametersOfSymbol(symbol.parent, enclosingDeclaration); } else { - var signatureDeclaration = ts.getDeclarationOfKind(symbol, 118 /* TypeParameter */).parent; + var signatureDeclaration = ts.getDeclarationOfKind(symbol, 122 /* TypeParameter */).parent; var signature = typeResolver.getSignatureFromDeclaration(signatureDeclaration); - if (signatureDeclaration.kind === 126 /* ConstructSignature */) { - displayParts.push(keywordPart(82 /* NewKeyword */)); + if (signatureDeclaration.kind === 130 /* ConstructSignature */) { + displayParts.push(keywordPart(86 /* NewKeyword */)); displayParts.push(spacePart()); } - else if (signatureDeclaration.kind !== 125 /* CallSignature */ && signatureDeclaration.name) { + else if (signatureDeclaration.kind !== 129 /* CallSignature */ && signatureDeclaration.name) { addFullSymbolName(signatureDeclaration.symbol); } displayParts.push.apply(displayParts, signatureToDisplayParts(typeResolver, signature, sourceFile, 32 /* WriteTypeArgumentsOfSignature */)); @@ -34127,32 +33767,32 @@ var ts; if (symbolFlags & 8 /* EnumMember */) { addPrefixForAnyFunctionOrVar(symbol, "enum member"); var declaration = symbol.declarations[0]; - if (declaration.kind === 185 /* EnumMember */) { + if (declaration.kind === 192 /* EnumMember */) { var constantValue = typeResolver.getEnumMemberValue(declaration); if (constantValue !== undefined) { displayParts.push(spacePart()); - displayParts.push(operatorPart(47 /* EqualsToken */)); + displayParts.push(operatorPart(51 /* EqualsToken */)); displayParts.push(spacePart()); displayParts.push(displayPart(constantValue.toString(), 7 /* numericLiteral */)); } } } - if (symbolFlags & 16777216 /* Import */) { + if (symbolFlags & 33554432 /* Import */) { addNewLineIfDisplayPartsExist(); - displayParts.push(keywordPart(79 /* ImportKeyword */)); + displayParts.push(keywordPart(83 /* ImportKeyword */)); displayParts.push(spacePart()); addFullSymbolName(symbol); displayParts.push(spacePart()); - displayParts.push(punctuationPart(47 /* EqualsToken */)); + displayParts.push(punctuationPart(51 /* EqualsToken */)); displayParts.push(spacePart()); ts.forEach(symbol.declarations, function (declaration) { - if (declaration.kind === 183 /* ImportDeclaration */) { + if (declaration.kind === 190 /* ImportDeclaration */) { var importDeclaration = declaration; if (importDeclaration.externalModuleName) { - displayParts.push(keywordPart(111 /* RequireKeyword */)); - displayParts.push(punctuationPart(11 /* OpenParenToken */)); + displayParts.push(keywordPart(115 /* RequireKeyword */)); + displayParts.push(punctuationPart(15 /* OpenParenToken */)); displayParts.push(displayPart(ts.getTextOfNode(importDeclaration.externalModuleName), 8 /* stringLiteral */)); - displayParts.push(punctuationPart(12 /* CloseParenToken */)); + displayParts.push(punctuationPart(16 /* CloseParenToken */)); } else { var internalAliasSymbol = typeResolver.getSymbolInfo(importDeclaration.entityName); @@ -34167,9 +33807,9 @@ var ts; if (type) { addPrefixForAnyFunctionOrVar(symbol, symbolKind); if (symbolKind === ScriptElementKind.memberVariableElement || symbolFlags & ts.SymbolFlags.Variable || symbolKind === ScriptElementKind.localVariableElement) { - displayParts.push(punctuationPart(46 /* ColonToken */)); + displayParts.push(punctuationPart(50 /* ColonToken */)); displayParts.push(spacePart()); - if (type.symbol && type.symbol.flags & 524288 /* TypeParameter */) { + if (type.symbol && type.symbol.flags & 1048576 /* TypeParameter */) { var typeParameterParts = mapToDisplayParts(function (writer) { typeResolver.getSymbolDisplayBuilder().buildTypeParameterDisplay(type, writer, enclosingDeclaration); }); @@ -34179,7 +33819,7 @@ var ts; displayParts.push.apply(displayParts, typeToDisplayParts(typeResolver, type, enclosingDeclaration)); } } - else if (symbolFlags & 16 /* Function */ || symbolFlags & 4096 /* Method */ || symbolFlags & 8192 /* Constructor */ || symbolFlags & ts.SymbolFlags.Signature || symbolFlags & ts.SymbolFlags.Accessor || symbolKind === ScriptElementKind.memberFunctionElement) { + else if (symbolFlags & 16 /* Function */ || symbolFlags & 8192 /* Method */ || symbolFlags & 16384 /* Constructor */ || symbolFlags & ts.SymbolFlags.Signature || symbolFlags & ts.SymbolFlags.Accessor || symbolKind === ScriptElementKind.memberFunctionElement) { var allSignatures = type.getCallSignatures(); addSignatureDisplayParts(allSignatures[0], allSignatures); } @@ -34205,9 +33845,9 @@ var ts; function addPrefixForAnyFunctionOrVar(symbol, symbolKind) { addNewLineIfDisplayPartsExist(); if (symbolKind) { - displayParts.push(punctuationPart(11 /* OpenParenToken */)); + displayParts.push(punctuationPart(15 /* OpenParenToken */)); displayParts.push(textPart(symbolKind)); - displayParts.push(punctuationPart(12 /* CloseParenToken */)); + displayParts.push(punctuationPart(16 /* CloseParenToken */)); displayParts.push(spacePart()); addFullSymbolName(symbol); } @@ -34216,12 +33856,12 @@ var ts; displayParts.push.apply(displayParts, signatureToDisplayParts(typeResolver, signature, enclosingDeclaration, flags | 32 /* WriteTypeArgumentsOfSignature */)); if (allSignatures.length > 1) { displayParts.push(spacePart()); - displayParts.push(punctuationPart(11 /* OpenParenToken */)); - displayParts.push(operatorPart(28 /* PlusToken */)); + displayParts.push(punctuationPart(15 /* OpenParenToken */)); + displayParts.push(operatorPart(32 /* PlusToken */)); displayParts.push(displayPart((allSignatures.length - 1).toString(), 7 /* numericLiteral */)); displayParts.push(spacePart()); displayParts.push(textPart(allSignatures.length === 2 ? "overload" : "overloads")); - displayParts.push(punctuationPart(12 /* CloseParenToken */)); + displayParts.push(punctuationPart(16 /* CloseParenToken */)); } documentation = signature.getDocumentationComment(); } @@ -34243,11 +33883,11 @@ var ts; var symbol = typeInfoResolver.getSymbolInfo(node); if (!symbol) { switch (node.kind) { - case 59 /* Identifier */: - case 138 /* PropertyAccess */: - case 117 /* QualifiedName */: - case 87 /* ThisKeyword */: - case 85 /* SuperKeyword */: + case 63 /* Identifier */: + case 142 /* PropertyAccess */: + case 121 /* QualifiedName */: + case 91 /* ThisKeyword */: + case 89 /* SuperKeyword */: var type = typeInfoResolver.getTypeOfNode(node); if (type) { return { @@ -34285,7 +33925,7 @@ var ts; var declarations = []; var definition; ts.forEach(signatureDeclarations, function (d) { - if ((selectConstructors && d.kind === 122 /* Constructor */) || (!selectConstructors && (d.kind === 175 /* FunctionDeclaration */ || d.kind === 121 /* Method */))) { + if ((selectConstructors && d.kind === 126 /* Constructor */) || (!selectConstructors && (d.kind === 182 /* FunctionDeclaration */ || d.kind === 125 /* Method */))) { declarations.push(d); if (d.body) definition = d; @@ -34302,10 +33942,10 @@ var ts; return false; } function tryAddConstructSignature(symbol, location, symbolKind, symbolName, containerName, result) { - if (isNewExpressionTarget(location) || location.kind === 107 /* ConstructorKeyword */) { + if (isNewExpressionTarget(location) || location.kind === 111 /* ConstructorKeyword */) { if (symbol.flags & 32 /* Class */) { var classDeclaration = symbol.getDeclarations()[0]; - ts.Debug.assert(classDeclaration && classDeclaration.kind === 177 /* ClassDeclaration */); + ts.Debug.assert(classDeclaration && classDeclaration.kind === 184 /* ClassDeclaration */); return tryAddSignature(classDeclaration.members, true, symbolKind, symbolName, containerName, result); } } @@ -34370,94 +34010,94 @@ var ts; if (!node) { return undefined; } - if (node.kind === 59 /* Identifier */ || node.kind === 87 /* ThisKeyword */ || node.kind === 85 /* SuperKeyword */ || isLiteralNameOfPropertyDeclarationOrIndexAccess(node) || isNameOfExternalModuleImportOrDeclaration(node)) { + if (node.kind === 63 /* Identifier */ || node.kind === 91 /* ThisKeyword */ || node.kind === 89 /* SuperKeyword */ || isLiteralNameOfPropertyDeclarationOrIndexAccess(node) || isNameOfExternalModuleImportOrDeclaration(node)) { return getReferencesForNode(node, [sourceFile], false, false); } switch (node.kind) { - case 78 /* IfKeyword */: - case 70 /* ElseKeyword */: - if (hasKind(node.parent, 155 /* IfStatement */)) { + case 82 /* IfKeyword */: + case 74 /* ElseKeyword */: + if (hasKind(node.parent, 162 /* IfStatement */)) { return getIfElseOccurrences(node.parent); } break; - case 84 /* ReturnKeyword */: - if (hasKind(node.parent, 162 /* ReturnStatement */)) { + case 88 /* ReturnKeyword */: + if (hasKind(node.parent, 169 /* ReturnStatement */)) { return getReturnOccurrences(node.parent); } break; - case 88 /* ThrowKeyword */: - if (hasKind(node.parent, 168 /* ThrowStatement */)) { + case 92 /* ThrowKeyword */: + if (hasKind(node.parent, 175 /* ThrowStatement */)) { return getThrowOccurrences(node.parent); } break; - case 90 /* TryKeyword */: - case 62 /* CatchKeyword */: - case 75 /* FinallyKeyword */: - if (hasKind(parent(parent(node)), 169 /* TryStatement */)) { + case 94 /* TryKeyword */: + case 66 /* CatchKeyword */: + case 79 /* FinallyKeyword */: + if (hasKind(parent(parent(node)), 176 /* TryStatement */)) { return getTryCatchFinallyOccurrences(node.parent.parent); } break; - case 86 /* SwitchKeyword */: - if (hasKind(node.parent, 164 /* SwitchStatement */)) { + case 90 /* SwitchKeyword */: + if (hasKind(node.parent, 171 /* SwitchStatement */)) { return getSwitchCaseDefaultOccurrences(node.parent); } break; - case 61 /* CaseKeyword */: - case 67 /* DefaultKeyword */: - if (hasKind(parent(parent(node)), 164 /* SwitchStatement */)) { + case 65 /* CaseKeyword */: + case 71 /* DefaultKeyword */: + if (hasKind(parent(parent(node)), 171 /* SwitchStatement */)) { return getSwitchCaseDefaultOccurrences(node.parent.parent); } break; - case 60 /* BreakKeyword */: - case 65 /* ContinueKeyword */: - if (hasKind(node.parent, 161 /* BreakStatement */) || hasKind(node.parent, 160 /* ContinueStatement */)) { + case 64 /* BreakKeyword */: + case 69 /* ContinueKeyword */: + if (hasKind(node.parent, 168 /* BreakStatement */) || hasKind(node.parent, 167 /* ContinueStatement */)) { return getBreakOrContinueStatementOccurences(node.parent); } break; - case 76 /* ForKeyword */: - if (hasKind(node.parent, 158 /* ForStatement */) || hasKind(node.parent, 159 /* ForInStatement */)) { + case 80 /* ForKeyword */: + if (hasKind(node.parent, 165 /* ForStatement */) || hasKind(node.parent, 166 /* ForInStatement */)) { return getLoopBreakContinueOccurrences(node.parent); } break; - case 94 /* WhileKeyword */: - case 69 /* DoKeyword */: - if (hasKind(node.parent, 157 /* WhileStatement */) || hasKind(node.parent, 156 /* DoStatement */)) { + case 98 /* WhileKeyword */: + case 73 /* DoKeyword */: + if (hasKind(node.parent, 164 /* WhileStatement */) || hasKind(node.parent, 163 /* DoStatement */)) { return getLoopBreakContinueOccurrences(node.parent); } break; - case 107 /* ConstructorKeyword */: - if (hasKind(node.parent, 122 /* Constructor */)) { + case 111 /* ConstructorKeyword */: + if (hasKind(node.parent, 126 /* Constructor */)) { return getConstructorOccurrences(node.parent); } break; - case 109 /* GetKeyword */: - case 113 /* SetKeyword */: - if (hasKind(node.parent, 123 /* GetAccessor */) || hasKind(node.parent, 124 /* SetAccessor */)) { + case 113 /* GetKeyword */: + case 117 /* SetKeyword */: + if (hasKind(node.parent, 127 /* GetAccessor */) || hasKind(node.parent, 128 /* SetAccessor */)) { return getGetAndSetOccurrences(node.parent); } } return undefined; function getIfElseOccurrences(ifStatement) { var keywords = []; - while (hasKind(ifStatement.parent, 155 /* IfStatement */) && ifStatement.parent.elseStatement === ifStatement) { + while (hasKind(ifStatement.parent, 162 /* IfStatement */) && ifStatement.parent.elseStatement === ifStatement) { ifStatement = ifStatement.parent; } while (ifStatement) { var children = ifStatement.getChildren(); - pushKeywordIf(keywords, children[0], 78 /* IfKeyword */); + pushKeywordIf(keywords, children[0], 82 /* IfKeyword */); for (var i = children.length - 1; i >= 0; i--) { - if (pushKeywordIf(keywords, children[i], 70 /* ElseKeyword */)) { + if (pushKeywordIf(keywords, children[i], 74 /* ElseKeyword */)) { break; } } - if (!hasKind(ifStatement.elseStatement, 155 /* IfStatement */)) { + if (!hasKind(ifStatement.elseStatement, 162 /* IfStatement */)) { break; } ifStatement = ifStatement.elseStatement; } var result = []; for (var i = 0; i < keywords.length; i++) { - if (keywords[i].kind === 70 /* ElseKeyword */ && i < keywords.length - 1) { + if (keywords[i].kind === 74 /* ElseKeyword */ && i < keywords.length - 1) { var elseKeyword = keywords[i]; var ifKeyword = keywords[i + 1]; var shouldHighlightNextKeyword = true; @@ -34483,15 +34123,15 @@ var ts; } function getReturnOccurrences(returnStatement) { var func = ts.getContainingFunction(returnStatement); - if (!(func && hasKind(func.body, 176 /* FunctionBlock */))) { + if (!(func && hasKind(func.body, 183 /* FunctionBlock */))) { return undefined; } var keywords = []; ts.forEachReturnStatement(func.body, function (returnStatement) { - pushKeywordIf(keywords, returnStatement.getFirstToken(), 84 /* ReturnKeyword */); + pushKeywordIf(keywords, returnStatement.getFirstToken(), 88 /* ReturnKeyword */); }); ts.forEach(aggregateOwnedThrowStatements(func.body), function (throwStatement) { - pushKeywordIf(keywords, throwStatement.getFirstToken(), 88 /* ThrowKeyword */); + pushKeywordIf(keywords, throwStatement.getFirstToken(), 92 /* ThrowKeyword */); }); return ts.map(keywords, getReferenceEntryFromNode); } @@ -34502,11 +34142,11 @@ var ts; } var keywords = []; ts.forEach(aggregateOwnedThrowStatements(owner), function (throwStatement) { - pushKeywordIf(keywords, throwStatement.getFirstToken(), 88 /* ThrowKeyword */); + pushKeywordIf(keywords, throwStatement.getFirstToken(), 92 /* ThrowKeyword */); }); - if (owner.kind === 176 /* FunctionBlock */) { + if (owner.kind === 183 /* FunctionBlock */) { ts.forEachReturnStatement(owner, function (returnStatement) { - pushKeywordIf(keywords, returnStatement.getFirstToken(), 84 /* ReturnKeyword */); + pushKeywordIf(keywords, returnStatement.getFirstToken(), 88 /* ReturnKeyword */); }); } return ts.map(keywords, getReferenceEntryFromNode); @@ -34516,10 +34156,10 @@ var ts; aggregate(node); return statementAccumulator; function aggregate(node) { - if (node.kind === 168 /* ThrowStatement */) { + if (node.kind === 175 /* ThrowStatement */) { statementAccumulator.push(node); } - else if (node.kind === 169 /* TryStatement */) { + else if (node.kind === 176 /* TryStatement */) { var tryStatement = node; if (tryStatement.catchBlock) { aggregate(tryStatement.catchBlock); @@ -34541,10 +34181,10 @@ var ts; var child = throwStatement; while (child.parent) { var parent = child.parent; - if (parent.kind === 176 /* FunctionBlock */ || parent.kind === 186 /* SourceFile */) { + if (parent.kind === 183 /* FunctionBlock */ || parent.kind === 193 /* SourceFile */) { return parent; } - if (parent.kind === 169 /* TryStatement */) { + if (parent.kind === 176 /* TryStatement */) { var tryStatement = parent; if (tryStatement.tryBlock === child && tryStatement.catchBlock) { return child; @@ -34556,22 +34196,22 @@ var ts; } function getTryCatchFinallyOccurrences(tryStatement) { var keywords = []; - pushKeywordIf(keywords, tryStatement.getFirstToken(), 90 /* TryKeyword */); + pushKeywordIf(keywords, tryStatement.getFirstToken(), 94 /* TryKeyword */); if (tryStatement.catchBlock) { - pushKeywordIf(keywords, tryStatement.catchBlock.getFirstToken(), 62 /* CatchKeyword */); + pushKeywordIf(keywords, tryStatement.catchBlock.getFirstToken(), 66 /* CatchKeyword */); } if (tryStatement.finallyBlock) { - pushKeywordIf(keywords, tryStatement.finallyBlock.getFirstToken(), 75 /* FinallyKeyword */); + pushKeywordIf(keywords, tryStatement.finallyBlock.getFirstToken(), 79 /* FinallyKeyword */); } return ts.map(keywords, getReferenceEntryFromNode); } function getLoopBreakContinueOccurrences(loopNode) { var keywords = []; - if (pushKeywordIf(keywords, loopNode.getFirstToken(), 76 /* ForKeyword */, 94 /* WhileKeyword */, 69 /* DoKeyword */)) { - if (loopNode.kind === 156 /* DoStatement */) { + if (pushKeywordIf(keywords, loopNode.getFirstToken(), 80 /* ForKeyword */, 98 /* WhileKeyword */, 73 /* DoKeyword */)) { + if (loopNode.kind === 163 /* DoStatement */) { var loopTokens = loopNode.getChildren(); for (var i = loopTokens.length - 1; i >= 0; i--) { - if (pushKeywordIf(keywords, loopTokens[i], 94 /* WhileKeyword */)) { + if (pushKeywordIf(keywords, loopTokens[i], 98 /* WhileKeyword */)) { break; } } @@ -34580,21 +34220,21 @@ var ts; var breaksAndContinues = aggregateAllBreakAndContinueStatements(loopNode.statement); ts.forEach(breaksAndContinues, function (statement) { if (ownsBreakOrContinueStatement(loopNode, statement)) { - pushKeywordIf(keywords, statement.getFirstToken(), 60 /* BreakKeyword */, 65 /* ContinueKeyword */); + pushKeywordIf(keywords, statement.getFirstToken(), 64 /* BreakKeyword */, 69 /* ContinueKeyword */); } }); return ts.map(keywords, getReferenceEntryFromNode); } function getSwitchCaseDefaultOccurrences(switchStatement) { var keywords = []; - pushKeywordIf(keywords, switchStatement.getFirstToken(), 86 /* SwitchKeyword */); + pushKeywordIf(keywords, switchStatement.getFirstToken(), 90 /* SwitchKeyword */); var breakSearchType = BreakContinueSearchType.All; ts.forEach(switchStatement.clauses, function (clause) { - pushKeywordIf(keywords, clause.getFirstToken(), 61 /* CaseKeyword */, 67 /* DefaultKeyword */); + pushKeywordIf(keywords, clause.getFirstToken(), 65 /* CaseKeyword */, 71 /* DefaultKeyword */); var breaksAndContinues = aggregateAllBreakAndContinueStatements(clause); ts.forEach(breaksAndContinues, function (statement) { if (ownsBreakOrContinueStatement(switchStatement, statement)) { - pushKeywordIf(keywords, statement.getFirstToken(), 60 /* BreakKeyword */); + pushKeywordIf(keywords, statement.getFirstToken(), 64 /* BreakKeyword */); } }); }); @@ -34604,12 +34244,12 @@ var ts; var owner = getBreakOrContinueOwner(breakOrContinueStatement); if (owner) { switch (owner.kind) { - case 158 /* ForStatement */: - case 159 /* ForInStatement */: - case 156 /* DoStatement */: - case 157 /* WhileStatement */: + case 165 /* ForStatement */: + case 166 /* ForInStatement */: + case 163 /* DoStatement */: + case 164 /* WhileStatement */: return getLoopBreakContinueOccurrences(owner); - case 164 /* SwitchStatement */: + case 171 /* SwitchStatement */: return getSwitchCaseDefaultOccurrences(owner); } } @@ -34620,7 +34260,7 @@ var ts; aggregate(node); return statementAccumulator; function aggregate(node) { - if (node.kind === 161 /* BreakStatement */ || node.kind === 160 /* ContinueStatement */) { + if (node.kind === 168 /* BreakStatement */ || node.kind === 167 /* ContinueStatement */) { statementAccumulator.push(node); } else if (!ts.isAnyFunction(node)) { @@ -34636,14 +34276,14 @@ var ts; function getBreakOrContinueOwner(statement) { for (var node = statement.parent; node; node = node.parent) { switch (node.kind) { - case 164 /* SwitchStatement */: - if (statement.kind === 160 /* ContinueStatement */) { + case 171 /* SwitchStatement */: + if (statement.kind === 167 /* ContinueStatement */) { continue; } - case 158 /* ForStatement */: - case 159 /* ForInStatement */: - case 157 /* WhileStatement */: - case 156 /* DoStatement */: + case 165 /* ForStatement */: + case 166 /* ForInStatement */: + case 164 /* WhileStatement */: + case 163 /* DoStatement */: if (!statement.label || isLabeledBy(node, statement.label.text)) { return node; } @@ -34662,20 +34302,20 @@ var ts; var keywords = []; ts.forEach(declarations, function (declaration) { ts.forEach(declaration.getChildren(), function (token) { - return pushKeywordIf(keywords, token, 107 /* ConstructorKeyword */); + return pushKeywordIf(keywords, token, 111 /* ConstructorKeyword */); }); }); return ts.map(keywords, getReferenceEntryFromNode); } function getGetAndSetOccurrences(accessorDeclaration) { var keywords = []; - tryPushAccessorKeyword(accessorDeclaration.symbol, 123 /* GetAccessor */); - tryPushAccessorKeyword(accessorDeclaration.symbol, 124 /* SetAccessor */); + tryPushAccessorKeyword(accessorDeclaration.symbol, 127 /* GetAccessor */); + tryPushAccessorKeyword(accessorDeclaration.symbol, 128 /* SetAccessor */); return ts.map(keywords, getReferenceEntryFromNode); function tryPushAccessorKeyword(accessorSymbol, accessorKind) { var accessor = ts.getDeclarationOfKind(accessorSymbol, accessorKind); if (accessor) { - ts.forEach(accessor.getChildren(), function (child) { return pushKeywordIf(keywords, child, 109 /* GetKeyword */, 113 /* SetKeyword */); }); + ts.forEach(accessor.getChildren(), function (child) { return pushKeywordIf(keywords, child, 113 /* GetKeyword */, 117 /* SetKeyword */); }); } } } @@ -34711,10 +34351,10 @@ var ts; if (!node) { return undefined; } - if (node.kind !== 59 /* Identifier */ && !isLiteralNameOfPropertyDeclarationOrIndexAccess(node) && !isNameOfExternalModuleImportOrDeclaration(node)) { + if (node.kind !== 63 /* Identifier */ && !isLiteralNameOfPropertyDeclarationOrIndexAccess(node) && !isNameOfExternalModuleImportOrDeclaration(node)) { return undefined; } - ts.Debug.assert(node.kind === 59 /* Identifier */ || node.kind === 6 /* NumericLiteral */ || node.kind === 7 /* StringLiteral */); + ts.Debug.assert(node.kind === 63 /* Identifier */ || node.kind === 6 /* NumericLiteral */ || node.kind === 7 /* StringLiteral */); return getReferencesForNode(node, program.getSourceFiles(), findInStrings, findInComments); } function getReferencesForNode(node, sourceFiles, findInStrings, findInComments) { @@ -34727,10 +34367,10 @@ var ts; return getLabelReferencesInNode(node.parent, node); } } - if (node.kind === 87 /* ThisKeyword */) { + if (node.kind === 91 /* ThisKeyword */) { return getReferencesForThisKeyword(node, sourceFiles); } - if (node.kind === 85 /* SuperKeyword */) { + if (node.kind === 89 /* SuperKeyword */) { return getReferencesForSuperKeyword(node); } var symbol = typeInfoResolver.getSymbolInfo(node); @@ -34760,7 +34400,7 @@ var ts; } return result; function getNormalizedSymbolName(symbolName, declarations) { - var functionExpression = ts.forEach(declarations, function (d) { return d.kind === 144 /* FunctionExpression */ ? d : undefined; }); + var functionExpression = ts.forEach(declarations, function (d) { return d.kind === 149 /* FunctionExpression */ ? d : undefined; }); if (functionExpression && functionExpression.name) { var name = functionExpression.name.text; } @@ -34775,10 +34415,10 @@ var ts; return name; } function getSymbolScope(symbol) { - if (symbol.getFlags() && (4 /* Property */ | 4096 /* Method */)) { + if (symbol.getFlags() && (4 /* Property */ | 8192 /* Method */)) { var privateDeclaration = ts.forEach(symbol.getDeclarations(), function (d) { return (d.flags & 32 /* Private */) ? d : undefined; }); if (privateDeclaration) { - return ts.getAncestor(privateDeclaration, 177 /* ClassDeclaration */); + return ts.getAncestor(privateDeclaration, 184 /* ClassDeclaration */); } } if (symbol.parent) { @@ -34792,7 +34432,7 @@ var ts; if (scope && scope !== container) { return undefined; } - if (container.kind === 186 /* SourceFile */ && !ts.isExternalModule(container)) { + if (container.kind === 193 /* SourceFile */ && !ts.isExternalModule(container)) { return undefined; } scope = container; @@ -34841,7 +34481,7 @@ var ts; function isValidReferencePosition(node, searchSymbolName) { if (node) { switch (node.kind) { - case 59 /* Identifier */: + case 63 /* Identifier */: return node.getWidth() === searchSymbolName.length; case 7 /* StringLiteral */: if (isLiteralNameOfPropertyDeclarationOrIndexAccess(node) || isNameOfExternalModuleImportOrDeclaration(node)) { @@ -34912,11 +34552,11 @@ var ts; } var staticFlag = 128 /* Static */; switch (searchSpaceNode.kind) { - case 120 /* Property */: - case 121 /* Method */: - case 122 /* Constructor */: - case 123 /* GetAccessor */: - case 124 /* SetAccessor */: + case 124 /* Property */: + case 125 /* Method */: + case 126 /* Constructor */: + case 127 /* GetAccessor */: + case 128 /* SetAccessor */: staticFlag &= searchSpaceNode.flags; searchSpaceNode = searchSpaceNode.parent; break; @@ -34929,7 +34569,7 @@ var ts; ts.forEach(possiblePositions, function (position) { cancellationToken.throwIfCancellationRequested(); var node = ts.getTouchingWord(sourceFile, position); - if (!node || node.kind !== 85 /* SuperKeyword */) { + if (!node || node.kind !== 89 /* SuperKeyword */) { return; } var container = ts.getSuperContainer(node); @@ -34943,26 +34583,26 @@ var ts; var searchSpaceNode = ts.getThisContainer(thisOrSuperKeyword, false); var staticFlag = 128 /* Static */; switch (searchSpaceNode.kind) { - case 120 /* Property */: - case 121 /* Method */: - case 122 /* Constructor */: - case 123 /* GetAccessor */: - case 124 /* SetAccessor */: + case 124 /* Property */: + case 125 /* Method */: + case 126 /* Constructor */: + case 127 /* GetAccessor */: + case 128 /* SetAccessor */: staticFlag &= searchSpaceNode.flags; searchSpaceNode = searchSpaceNode.parent; break; - case 186 /* SourceFile */: + case 193 /* SourceFile */: if (ts.isExternalModule(searchSpaceNode)) { return undefined; } - case 175 /* FunctionDeclaration */: - case 144 /* FunctionExpression */: + case 182 /* FunctionDeclaration */: + case 149 /* FunctionExpression */: break; default: return undefined; } var result = []; - if (searchSpaceNode.kind === 186 /* SourceFile */) { + if (searchSpaceNode.kind === 193 /* SourceFile */) { ts.forEach(sourceFiles, function (sourceFile) { var possiblePositions = getPossibleSymbolReferencePositions(sourceFile, "this", sourceFile.getStart(), sourceFile.getEnd()); getThisReferencesInFile(sourceFile, sourceFile, possiblePositions, result); @@ -34978,24 +34618,24 @@ var ts; ts.forEach(possiblePositions, function (position) { cancellationToken.throwIfCancellationRequested(); var node = ts.getTouchingWord(sourceFile, position); - if (!node || node.kind !== 87 /* ThisKeyword */) { + if (!node || node.kind !== 91 /* ThisKeyword */) { return; } var container = ts.getThisContainer(node, false); switch (searchSpaceNode.kind) { - case 144 /* FunctionExpression */: - case 175 /* FunctionDeclaration */: + case 149 /* FunctionExpression */: + case 182 /* FunctionDeclaration */: if (searchSpaceNode.symbol === container.symbol) { result.push(getReferenceEntryFromNode(node)); } break; - case 177 /* ClassDeclaration */: + case 184 /* ClassDeclaration */: if (container.parent && searchSpaceNode.symbol === container.parent.symbol && (container.flags & 128 /* Static */) === staticFlag) { result.push(getReferenceEntryFromNode(node)); } break; - case 186 /* SourceFile */: - if (container.kind === 186 /* SourceFile */ && !ts.isExternalModule(container)) { + case 193 /* SourceFile */: + if (container.kind === 193 /* SourceFile */ && !ts.isExternalModule(container)) { result.push(getReferenceEntryFromNode(node)); } break; @@ -35023,11 +34663,11 @@ var ts; function getPropertySymbolsFromBaseTypes(symbol, propertyName, result) { if (symbol && symbol.flags & (32 /* Class */ | 64 /* Interface */)) { ts.forEach(symbol.getDeclarations(), function (declaration) { - if (declaration.kind === 177 /* ClassDeclaration */) { + if (declaration.kind === 184 /* ClassDeclaration */) { getPropertySymbolFromTypeReference(declaration.baseType); ts.forEach(declaration.implementedTypes, getPropertySymbolFromTypeReference); } - else if (declaration.kind === 178 /* InterfaceDeclaration */) { + else if (declaration.kind === 185 /* InterfaceDeclaration */) { ts.forEach(declaration.baseTypes, getPropertySymbolFromTypeReference); } }); @@ -35128,15 +34768,15 @@ var ts; }; } function isWriteAccess(node) { - if (node.kind === 59 /* Identifier */ && ts.isDeclarationOrFunctionExpressionOrCatchVariableName(node)) { + if (node.kind === 63 /* Identifier */ && ts.isDeclarationOrFunctionExpressionOrCatchVariableName(node)) { return true; } var parent = node.parent; if (parent) { - if (parent.kind === 147 /* PostfixOperator */ || parent.kind === 146 /* PrefixOperator */) { + if (parent.kind === 152 /* PostfixOperator */ || parent.kind === 151 /* PrefixOperator */) { return true; } - else if (parent.kind === 148 /* BinaryExpression */ && parent.left === node) { + else if (parent.kind === 153 /* BinaryExpression */ && parent.left === node) { var operator = parent.operator; return ts.SyntaxKind.FirstAssignment <= operator && operator <= ts.SyntaxKind.LastAssignment; } @@ -35250,40 +34890,40 @@ var ts; } function getMeaningFromDeclaration(node) { switch (node.kind) { - case 119 /* Parameter */: - case 174 /* VariableDeclaration */: - case 120 /* Property */: - case 137 /* PropertyAssignment */: - case 185 /* EnumMember */: - case 121 /* Method */: - case 122 /* Constructor */: - case 123 /* GetAccessor */: - case 124 /* SetAccessor */: - case 175 /* FunctionDeclaration */: - case 144 /* FunctionExpression */: - case 145 /* ArrowFunction */: - case 171 /* CatchBlock */: + case 123 /* Parameter */: + case 181 /* VariableDeclaration */: + case 124 /* Property */: + case 141 /* PropertyAssignment */: + case 192 /* EnumMember */: + case 125 /* Method */: + case 126 /* Constructor */: + case 127 /* GetAccessor */: + case 128 /* SetAccessor */: + case 182 /* FunctionDeclaration */: + case 149 /* FunctionExpression */: + case 150 /* ArrowFunction */: + case 178 /* CatchBlock */: return 1 /* Value */; - case 118 /* TypeParameter */: - case 178 /* InterfaceDeclaration */: - case 179 /* TypeAliasDeclaration */: - case 130 /* TypeLiteral */: + case 122 /* TypeParameter */: + case 185 /* InterfaceDeclaration */: + case 186 /* TypeAliasDeclaration */: + case 134 /* TypeLiteral */: return 2 /* Type */; - case 177 /* ClassDeclaration */: - case 180 /* EnumDeclaration */: + case 184 /* ClassDeclaration */: + case 187 /* EnumDeclaration */: return 1 /* Value */ | 2 /* Type */; - case 181 /* ModuleDeclaration */: + case 188 /* ModuleDeclaration */: if (node.name.kind === 7 /* StringLiteral */) { return 4 /* Namespace */ | 1 /* Value */; } - else if (ts.isInstantiated(node)) { + else if (ts.getModuleInstanceState(node) === 1 /* Instantiated */) { return 4 /* Namespace */ | 1 /* Value */; } else { return 4 /* Namespace */; } break; - case 183 /* ImportDeclaration */: + case 190 /* ImportDeclaration */: return 1 /* Value */ | 2 /* Type */ | 4 /* Namespace */; } ts.Debug.fail("Unknown declaration type"); @@ -35292,33 +34932,33 @@ var ts; if (isRightSideOfQualifiedName(node)) { node = node.parent; } - return node.parent.kind === 128 /* TypeReference */; + return node.parent.kind === 132 /* TypeReference */; } function isNamespaceReference(node) { var root = node; var isLastClause = true; - if (root.parent.kind === 117 /* QualifiedName */) { - while (root.parent && root.parent.kind === 117 /* QualifiedName */) + if (root.parent.kind === 121 /* QualifiedName */) { + while (root.parent && root.parent.kind === 121 /* QualifiedName */) root = root.parent; isLastClause = root.right === node; } - return root.parent.kind === 128 /* TypeReference */ && !isLastClause; + return root.parent.kind === 132 /* TypeReference */ && !isLastClause; } function isInRightSideOfImport(node) { - while (node.parent.kind === 117 /* QualifiedName */) { + while (node.parent.kind === 121 /* QualifiedName */) { node = node.parent; } - return node.parent.kind === 183 /* ImportDeclaration */ && node.parent.entityName === node; + return node.parent.kind === 190 /* ImportDeclaration */ && node.parent.entityName === node; } function getMeaningFromRightHandSideOfImport(node) { - ts.Debug.assert(node.kind === 59 /* Identifier */); - if (node.parent.kind === 117 /* QualifiedName */ && node.parent.right === node && node.parent.parent.kind === 183 /* ImportDeclaration */) { + ts.Debug.assert(node.kind === 63 /* Identifier */); + if (node.parent.kind === 121 /* QualifiedName */ && node.parent.right === node && node.parent.parent.kind === 190 /* ImportDeclaration */) { return 1 /* Value */ | 2 /* Type */ | 4 /* Namespace */; } return 4 /* Namespace */; } function getMeaningFromLocation(node) { - if (node.parent.kind === 184 /* ExportAssignment */) { + if (node.parent.kind === 191 /* ExportAssignment */) { return 1 /* Value */ | 2 /* Type */ | 4 /* Namespace */; } else if (isInRightSideOfImport(node)) { @@ -35407,15 +35047,15 @@ var ts; return; } switch (node.kind) { - case 138 /* PropertyAccess */: - case 117 /* QualifiedName */: + case 142 /* PropertyAccess */: + case 121 /* QualifiedName */: case 7 /* StringLiteral */: - case 74 /* FalseKeyword */: - case 89 /* TrueKeyword */: - case 83 /* NullKeyword */: - case 85 /* SuperKeyword */: - case 87 /* ThisKeyword */: - case 59 /* Identifier */: + case 78 /* FalseKeyword */: + case 93 /* TrueKeyword */: + case 87 /* NullKeyword */: + case 89 /* SuperKeyword */: + case 91 /* ThisKeyword */: + case 63 /* Identifier */: break; default: return; @@ -35426,7 +35066,7 @@ var ts; nodeForStartPos = nodeForStartPos.parent; } else if (isNameOfModuleDeclaration(nodeForStartPos)) { - if (nodeForStartPos.parent.parent.kind === 181 /* ModuleDeclaration */ && nodeForStartPos.parent.parent.body === nodeForStartPos.parent) { + if (nodeForStartPos.parent.parent.kind === 188 /* ModuleDeclaration */ && nodeForStartPos.parent.parent.body === nodeForStartPos.parent) { nodeForStartPos = nodeForStartPos.parent.parent.name; } else { @@ -35459,14 +35099,14 @@ var ts; if (flags & 32 /* Class */) { return ClassificationTypeNames.className; } - else if (flags & 128 /* Enum */) { + else if (flags & ts.SymbolFlags.Enum) { return ClassificationTypeNames.enumName; } else if (meaningAtPosition & 2 /* Type */) { if (flags & 64 /* Interface */) { return ClassificationTypeNames.interfaceName; } - else if (flags & 524288 /* TypeParameter */) { + else if (flags & 1048576 /* TypeParameter */) { return ClassificationTypeNames.typeParameterName; } } @@ -35478,13 +35118,13 @@ var ts; return undefined; function hasValueSideModule(symbol) { return ts.forEach(symbol.declarations, function (declaration) { - return declaration.kind === 181 /* ModuleDeclaration */ && ts.isInstantiated(declaration); + return declaration.kind === 188 /* ModuleDeclaration */ && ts.getModuleInstanceState(declaration) == 1 /* Instantiated */; }); } } function processNode(node) { if (node && span.intersectsWith(node.getStart(), node.getWidth())) { - if (node.kind === 59 /* Identifier */ && node.getWidth() > 0) { + if (node.kind === 63 /* Identifier */ && node.getWidth() > 0) { var symbol = typeInfoResolver.getSymbolInfo(node); if (symbol) { var type = classifySymbol(symbol, getMeaningFromLocation(node)); @@ -35533,13 +35173,13 @@ var ts; if (ts.isKeyword(tokenKind)) { return ClassificationTypeNames.keyword; } - if (tokenKind === 19 /* LessThanToken */ || tokenKind === 20 /* GreaterThanToken */) { + if (tokenKind === 23 /* LessThanToken */ || tokenKind === 24 /* GreaterThanToken */) { if (ts.getTypeArgumentOrTypeParameterList(token.parent)) { return ClassificationTypeNames.punctuation; } } if (ts.isPunctuation(token)) { - if (token.parent.kind === 148 /* BinaryExpression */ || token.parent.kind === 174 /* VariableDeclaration */ || token.parent.kind === 146 /* PrefixOperator */ || token.parent.kind === 147 /* PostfixOperator */ || token.parent.kind === 149 /* ConditionalExpression */) { + if (token.parent.kind === 153 /* BinaryExpression */ || token.parent.kind === 181 /* VariableDeclaration */ || token.parent.kind === 151 /* PrefixOperator */ || token.parent.kind === 152 /* PostfixOperator */ || token.parent.kind === 154 /* ConditionalExpression */) { return ClassificationTypeNames.operator; } else { @@ -35555,29 +35195,32 @@ var ts; else if (tokenKind === 8 /* RegularExpressionLiteral */) { return ClassificationTypeNames.stringLiteral; } - else if (tokenKind === 59 /* Identifier */) { + else if (ts.isTemplateLiteralKind(tokenKind)) { + return ClassificationTypeNames.stringLiteral; + } + else if (tokenKind === 63 /* Identifier */) { switch (token.parent.kind) { - case 177 /* ClassDeclaration */: + case 184 /* ClassDeclaration */: if (token.parent.name === token) { return ClassificationTypeNames.className; } return; - case 118 /* TypeParameter */: + case 122 /* TypeParameter */: if (token.parent.name === token) { return ClassificationTypeNames.typeParameterName; } return; - case 178 /* InterfaceDeclaration */: + case 185 /* InterfaceDeclaration */: if (token.parent.name === token) { return ClassificationTypeNames.interfaceName; } return; - case 180 /* EnumDeclaration */: + case 187 /* EnumDeclaration */: if (token.parent.name === token) { return ClassificationTypeNames.enumName; } return; - case 181 /* ModuleDeclaration */: + case 188 /* ModuleDeclaration */: if (token.parent.name === token) { return ClassificationTypeNames.moduleName; } @@ -35635,22 +35278,14 @@ var ts; return result; function getMatchingTokenKind(token) { switch (token.kind) { - case 9 /* OpenBraceToken */: - return 10 /* CloseBraceToken */; - case 11 /* OpenParenToken */: - return 12 /* CloseParenToken */; - case 13 /* OpenBracketToken */: - return 14 /* CloseBracketToken */; - case 19 /* LessThanToken */: - return 20 /* GreaterThanToken */; - case 10 /* CloseBraceToken */: - return 9 /* OpenBraceToken */; - case 12 /* CloseParenToken */: - return 11 /* OpenParenToken */; - case 14 /* CloseBracketToken */: - return 13 /* OpenBracketToken */; - case 20 /* GreaterThanToken */: - return 19 /* LessThanToken */; + case 13 /* OpenBraceToken */: return 14 /* CloseBraceToken */; + case 15 /* OpenParenToken */: return 16 /* CloseParenToken */; + case 17 /* OpenBracketToken */: return 18 /* CloseBracketToken */; + case 23 /* LessThanToken */: return 24 /* GreaterThanToken */; + case 14 /* CloseBraceToken */: return 13 /* OpenBraceToken */; + case 16 /* CloseParenToken */: return 15 /* OpenParenToken */; + case 18 /* CloseBracketToken */: return 17 /* OpenBracketToken */; + case 24 /* GreaterThanToken */: return 23 /* LessThanToken */; } return undefined; } @@ -35703,8 +35338,9 @@ var ts; return []; } function getTodoComments(filename, descriptors) { + synchronizeHostData(); filename = TypeScript.switchToForwardSlashes(filename); - var sourceFile = getCurrentSourceFile(filename); + var sourceFile = getSourceFile(filename); cancellationToken.throwIfCancellationRequested(); var fileContents = sourceFile.text; cancellationToken.throwIfCancellationRequested(); @@ -35728,7 +35364,7 @@ var ts; descriptor = descriptors[i]; } } - ts.Debug.assert(descriptor); + ts.Debug.assert(descriptor !== undefined); if (isLetterOrDigit(fileContents.charCodeAt(matchPosition + descriptor.text.length))) { continue; } @@ -35776,7 +35412,7 @@ var ts; fileName = TypeScript.switchToForwardSlashes(fileName); var sourceFile = getSourceFile(fileName); var node = ts.getTouchingWord(sourceFile, position); - if (node && node.kind === 59 /* Identifier */) { + if (node && node.kind === 63 /* Identifier */) { var symbol = typeInfoResolver.getSymbolInfo(node); if (symbol && symbol.getDeclarations() && symbol.getDeclarations().length > 0) { var kind = getSymbolKind(symbol, typeInfoResolver); @@ -35846,30 +35482,30 @@ var ts; function createClassifier(host) { var scanner = ts.createScanner(ts.ScriptTarget.Latest, false); var noRegexTable = []; - noRegexTable[59 /* Identifier */] = true; + noRegexTable[63 /* Identifier */] = true; noRegexTable[7 /* StringLiteral */] = true; noRegexTable[6 /* NumericLiteral */] = true; noRegexTable[8 /* RegularExpressionLiteral */] = true; - noRegexTable[87 /* ThisKeyword */] = true; - noRegexTable[33 /* PlusPlusToken */] = true; - noRegexTable[34 /* MinusMinusToken */] = true; - noRegexTable[12 /* CloseParenToken */] = true; - noRegexTable[14 /* CloseBracketToken */] = true; - noRegexTable[10 /* CloseBraceToken */] = true; - noRegexTable[89 /* TrueKeyword */] = true; - noRegexTable[74 /* FalseKeyword */] = true; + noRegexTable[91 /* ThisKeyword */] = true; + noRegexTable[37 /* PlusPlusToken */] = true; + noRegexTable[38 /* MinusMinusToken */] = true; + noRegexTable[16 /* CloseParenToken */] = true; + noRegexTable[18 /* CloseBracketToken */] = true; + noRegexTable[14 /* CloseBraceToken */] = true; + noRegexTable[93 /* TrueKeyword */] = true; + noRegexTable[78 /* FalseKeyword */] = true; function isAccessibilityModifier(kind) { switch (kind) { - case 102 /* PublicKeyword */: - case 100 /* PrivateKeyword */: - case 101 /* ProtectedKeyword */: + case 106 /* PublicKeyword */: + case 104 /* PrivateKeyword */: + case 105 /* ProtectedKeyword */: return true; } return false; } function canFollow(keyword1, keyword2) { if (isAccessibilityModifier(keyword1)) { - if (keyword2 === 109 /* GetKeyword */ || keyword2 === 113 /* SetKeyword */ || keyword2 === 107 /* ConstructorKeyword */ || keyword2 === 103 /* StaticKeyword */) { + if (keyword2 === 113 /* GetKeyword */ || keyword2 === 117 /* SetKeyword */ || keyword2 === 111 /* ConstructorKeyword */ || keyword2 === 107 /* StaticKeyword */) { return true; } return false; @@ -35904,26 +35540,26 @@ var ts; do { token = scanner.scan(); if (!ts.isTrivia(token)) { - if ((token === 31 /* SlashToken */ || token === 51 /* SlashEqualsToken */) && !noRegexTable[lastNonTriviaToken]) { + if ((token === 35 /* SlashToken */ || token === 55 /* SlashEqualsToken */) && !noRegexTable[lastNonTriviaToken]) { if (scanner.reScanSlashToken() === 8 /* RegularExpressionLiteral */) { token = 8 /* RegularExpressionLiteral */; } } - else if (lastNonTriviaToken === 15 /* DotToken */ && isKeyword(token)) { - token = 59 /* Identifier */; + else if (lastNonTriviaToken === 19 /* DotToken */ && isKeyword(token)) { + token = 63 /* Identifier */; } else if (isKeyword(lastNonTriviaToken) && isKeyword(token) && !canFollow(lastNonTriviaToken, token)) { - token = 59 /* Identifier */; + token = 63 /* Identifier */; } - else if (lastNonTriviaToken === 59 /* Identifier */ && token === 19 /* LessThanToken */) { + else if (lastNonTriviaToken === 63 /* Identifier */ && token === 23 /* LessThanToken */) { angleBracketStack++; } - else if (token === 20 /* GreaterThanToken */ && angleBracketStack > 0) { + else if (token === 24 /* GreaterThanToken */ && angleBracketStack > 0) { angleBracketStack--; } - else if (token === 105 /* AnyKeyword */ || token === 114 /* StringKeyword */ || token === 112 /* NumberKeyword */ || token === 106 /* BooleanKeyword */) { + else if (token === 109 /* AnyKeyword */ || token === 118 /* StringKeyword */ || token === 116 /* NumberKeyword */ || token === 110 /* BooleanKeyword */) { if (angleBracketStack > 0) { - token = 59 /* Identifier */; + token = 63 /* Identifier */; } } lastNonTriviaToken = token; @@ -35962,55 +35598,54 @@ var ts; } function isBinaryExpressionOperatorToken(token) { switch (token) { - case 30 /* AsteriskToken */: - case 31 /* SlashToken */: - case 32 /* PercentToken */: - case 28 /* PlusToken */: - case 29 /* MinusToken */: - case 35 /* LessThanLessThanToken */: - case 36 /* GreaterThanGreaterThanToken */: - case 37 /* GreaterThanGreaterThanGreaterThanToken */: - case 19 /* LessThanToken */: - case 20 /* GreaterThanToken */: - case 21 /* LessThanEqualsToken */: - case 22 /* GreaterThanEqualsToken */: - case 81 /* InstanceOfKeyword */: - case 80 /* InKeyword */: - case 23 /* EqualsEqualsToken */: - case 24 /* ExclamationEqualsToken */: - case 25 /* EqualsEqualsEqualsToken */: - case 26 /* ExclamationEqualsEqualsToken */: - case 38 /* AmpersandToken */: - case 40 /* CaretToken */: - case 39 /* BarToken */: - case 43 /* AmpersandAmpersandToken */: - case 44 /* BarBarToken */: - case 57 /* BarEqualsToken */: - case 56 /* AmpersandEqualsToken */: - case 58 /* CaretEqualsToken */: - case 53 /* LessThanLessThanEqualsToken */: - case 54 /* GreaterThanGreaterThanEqualsToken */: - case 55 /* GreaterThanGreaterThanGreaterThanEqualsToken */: - case 48 /* PlusEqualsToken */: - case 49 /* MinusEqualsToken */: - case 50 /* AsteriskEqualsToken */: - case 51 /* SlashEqualsToken */: - case 52 /* PercentEqualsToken */: - case 47 /* EqualsToken */: - case 18 /* CommaToken */: + case 34 /* AsteriskToken */: + case 35 /* SlashToken */: + case 36 /* PercentToken */: + case 32 /* PlusToken */: + case 33 /* MinusToken */: + case 39 /* LessThanLessThanToken */: + case 40 /* GreaterThanGreaterThanToken */: + case 41 /* GreaterThanGreaterThanGreaterThanToken */: + case 23 /* LessThanToken */: + case 24 /* GreaterThanToken */: + case 25 /* LessThanEqualsToken */: + case 26 /* GreaterThanEqualsToken */: + case 85 /* InstanceOfKeyword */: + case 84 /* InKeyword */: + case 27 /* EqualsEqualsToken */: + case 28 /* ExclamationEqualsToken */: + case 29 /* EqualsEqualsEqualsToken */: + case 30 /* ExclamationEqualsEqualsToken */: + case 42 /* AmpersandToken */: + case 44 /* CaretToken */: + case 43 /* BarToken */: + case 47 /* AmpersandAmpersandToken */: + case 48 /* BarBarToken */: + case 61 /* BarEqualsToken */: + case 60 /* AmpersandEqualsToken */: + case 62 /* CaretEqualsToken */: + case 57 /* LessThanLessThanEqualsToken */: + case 58 /* GreaterThanGreaterThanEqualsToken */: + case 59 /* GreaterThanGreaterThanGreaterThanEqualsToken */: + case 52 /* PlusEqualsToken */: + case 53 /* MinusEqualsToken */: + case 54 /* AsteriskEqualsToken */: + case 55 /* SlashEqualsToken */: + case 56 /* PercentEqualsToken */: + case 51 /* EqualsToken */: + case 22 /* CommaToken */: return true; - default: - return false; + default: return false; } } function isPrefixUnaryExpressionOperatorToken(token) { switch (token) { - case 28 /* PlusToken */: - case 29 /* MinusToken */: - case 42 /* TildeToken */: - case 41 /* ExclamationToken */: - case 33 /* PlusPlusToken */: - case 34 /* MinusMinusToken */: + case 32 /* PlusToken */: + case 33 /* MinusToken */: + case 46 /* TildeToken */: + case 45 /* ExclamationToken */: + case 37 /* PlusPlusToken */: + case 38 /* MinusMinusToken */: return true; default: return false; @@ -36041,7 +35676,7 @@ var ts; return 3 /* Comment */; case 5 /* WhitespaceTrivia */: return 4 /* Whitespace */; - case 59 /* Identifier */: + case 63 /* Identifier */: default: return 5 /* Identifier */; } @@ -36056,7 +35691,7 @@ var ts; getNodeConstructor: function (kind) { function Node() { } - var proto = kind === 186 /* SourceFile */ ? new SourceFileObject() : new NodeObject(); + var proto = kind === 193 /* SourceFile */ ? new SourceFileObject() : new NodeObject(); proto.kind = kind; proto.pos = 0; proto.end = 0; @@ -36110,120 +35745,120 @@ var ts; function spanInNode(node) { if (node) { if (ts.isExpression(node)) { - if (node.parent.kind === 156 /* DoStatement */) { + if (node.parent.kind === 163 /* DoStatement */) { return spanInPreviousNode(node); } - if (node.parent.kind === 158 /* ForStatement */) { + if (node.parent.kind === 165 /* ForStatement */) { return textSpan(node); } - if (node.parent.kind === 148 /* BinaryExpression */ && node.parent.operator === 18 /* CommaToken */) { + if (node.parent.kind === 153 /* BinaryExpression */ && node.parent.operator === 22 /* CommaToken */) { return textSpan(node); } - if (node.parent.kind == 145 /* ArrowFunction */ && node.parent.body == node) { + if (node.parent.kind == 150 /* ArrowFunction */ && node.parent.body == node) { return textSpan(node); } } switch (node.kind) { - case 152 /* VariableStatement */: + case 159 /* VariableStatement */: return spanInVariableDeclaration(node.declarations[0]); - case 174 /* VariableDeclaration */: - case 120 /* Property */: + case 181 /* VariableDeclaration */: + case 124 /* Property */: return spanInVariableDeclaration(node); - case 119 /* Parameter */: + case 123 /* Parameter */: return spanInParameterDeclaration(node); - case 175 /* FunctionDeclaration */: - case 121 /* Method */: - case 123 /* GetAccessor */: - case 124 /* SetAccessor */: - case 122 /* Constructor */: - case 144 /* FunctionExpression */: - case 145 /* ArrowFunction */: + case 182 /* FunctionDeclaration */: + case 125 /* Method */: + case 127 /* GetAccessor */: + case 128 /* SetAccessor */: + case 126 /* Constructor */: + case 149 /* FunctionExpression */: + case 150 /* ArrowFunction */: return spanInFunctionDeclaration(node); - case 176 /* FunctionBlock */: + case 183 /* FunctionBlock */: return spanInFunctionBlock(node); - case 151 /* Block */: - case 170 /* TryBlock */: - case 171 /* CatchBlock */: - case 172 /* FinallyBlock */: - case 182 /* ModuleBlock */: + case 158 /* Block */: + case 177 /* TryBlock */: + case 178 /* CatchBlock */: + case 179 /* FinallyBlock */: + case 189 /* ModuleBlock */: return spanInBlock(node); - case 154 /* ExpressionStatement */: + case 161 /* ExpressionStatement */: return textSpan(node.expression); - case 162 /* ReturnStatement */: + case 169 /* ReturnStatement */: return textSpan(node.getChildAt(0), node.expression); - case 157 /* WhileStatement */: + case 164 /* WhileStatement */: return textSpan(node, ts.findNextToken(node.expression, node)); - case 156 /* DoStatement */: + case 163 /* DoStatement */: return spanInNode(node.statement); - case 173 /* DebuggerStatement */: + case 180 /* DebuggerStatement */: return textSpan(node.getChildAt(0)); - case 155 /* IfStatement */: + case 162 /* IfStatement */: return textSpan(node, ts.findNextToken(node.expression, node)); - case 167 /* LabeledStatement */: + case 174 /* LabeledStatement */: return spanInNode(node.statement); - case 161 /* BreakStatement */: - case 160 /* ContinueStatement */: + case 168 /* BreakStatement */: + case 167 /* ContinueStatement */: return textSpan(node.getChildAt(0), node.label); - case 158 /* ForStatement */: + case 165 /* ForStatement */: return spanInForStatement(node); - case 159 /* ForInStatement */: + case 166 /* ForInStatement */: return textSpan(node, ts.findNextToken(node.expression, node)); - case 164 /* SwitchStatement */: + case 171 /* SwitchStatement */: return textSpan(node, ts.findNextToken(node.expression, node)); - case 165 /* CaseClause */: - case 166 /* DefaultClause */: + case 172 /* CaseClause */: + case 173 /* DefaultClause */: return spanInNode(node.statements[0]); - case 169 /* TryStatement */: + case 176 /* TryStatement */: return spanInBlock(node.tryBlock); - case 168 /* ThrowStatement */: + case 175 /* ThrowStatement */: return textSpan(node, node.expression); - case 184 /* ExportAssignment */: + case 191 /* ExportAssignment */: return textSpan(node, node.exportName); - case 183 /* ImportDeclaration */: + case 190 /* ImportDeclaration */: return textSpan(node, node.entityName || node.externalModuleName); - case 181 /* ModuleDeclaration */: - if (!ts.isInstantiated(node)) { + case 188 /* ModuleDeclaration */: + if (ts.getModuleInstanceState(node) !== 1 /* Instantiated */) { return undefined; } - case 177 /* ClassDeclaration */: - case 180 /* EnumDeclaration */: - case 185 /* EnumMember */: - case 140 /* CallExpression */: - case 141 /* NewExpression */: + case 184 /* ClassDeclaration */: + case 187 /* EnumDeclaration */: + case 192 /* EnumMember */: + case 144 /* CallExpression */: + case 145 /* NewExpression */: return textSpan(node); - case 163 /* WithStatement */: + case 170 /* WithStatement */: return spanInNode(node.statement); - case 178 /* InterfaceDeclaration */: + case 185 /* InterfaceDeclaration */: return undefined; - case 17 /* SemicolonToken */: + case 21 /* SemicolonToken */: case 1 /* EndOfFileToken */: return spanInNodeIfStartsOnSameLine(ts.findPrecedingToken(node.pos, sourceFile)); - case 18 /* CommaToken */: + case 22 /* CommaToken */: return spanInPreviousNode(node); - case 9 /* OpenBraceToken */: + case 13 /* OpenBraceToken */: return spanInOpenBraceToken(node); - case 10 /* CloseBraceToken */: + case 14 /* CloseBraceToken */: return spanInCloseBraceToken(node); - case 11 /* OpenParenToken */: + case 15 /* OpenParenToken */: return spanInOpenParenToken(node); - case 12 /* CloseParenToken */: + case 16 /* CloseParenToken */: return spanInCloseParenToken(node); - case 46 /* ColonToken */: + case 50 /* ColonToken */: return spanInColonToken(node); - case 20 /* GreaterThanToken */: - case 19 /* LessThanToken */: + case 24 /* GreaterThanToken */: + case 23 /* LessThanToken */: return spanInGreaterThanOrLessThanToken(node); - case 94 /* WhileKeyword */: + case 98 /* WhileKeyword */: return spanInWhileKeyword(node); - case 70 /* ElseKeyword */: - case 62 /* CatchKeyword */: - case 75 /* FinallyKeyword */: + case 74 /* ElseKeyword */: + case 66 /* CatchKeyword */: + case 79 /* FinallyKeyword */: return spanInNextNode(node); default: - if (node.parent.kind === 137 /* PropertyAssignment */ && node.parent.name === node) { + if (node.parent.kind === 141 /* PropertyAssignment */ && node.parent.name === node) { return spanInNode(node.parent.initializer); } - if (node.parent.kind === 142 /* TypeAssertion */ && node.parent.type === node) { + if (node.parent.kind === 147 /* TypeAssertion */ && node.parent.type === node) { return spanInNode(node.parent.operand); } if (ts.isAnyFunction(node.parent) && node.parent.type === node) { @@ -36233,11 +35868,11 @@ var ts; } } function spanInVariableDeclaration(variableDeclaration) { - if (variableDeclaration.parent.kind === 159 /* ForInStatement */) { + if (variableDeclaration.parent.kind === 166 /* ForInStatement */) { return spanInNode(variableDeclaration.parent); } - var isParentVariableStatement = variableDeclaration.parent.kind === 152 /* VariableStatement */; - var isDeclarationOfForStatement = variableDeclaration.parent.kind === 158 /* ForStatement */ && ts.contains(variableDeclaration.parent.declarations, variableDeclaration); + var isParentVariableStatement = variableDeclaration.parent.kind === 159 /* VariableStatement */; + var isDeclarationOfForStatement = variableDeclaration.parent.kind === 165 /* ForStatement */ && ts.contains(variableDeclaration.parent.declarations, variableDeclaration); var declarations = isParentVariableStatement ? variableDeclaration.parent.declarations : isDeclarationOfForStatement ? variableDeclaration.parent.declarations : undefined; if (variableDeclaration.initializer || (variableDeclaration.flags & 1 /* Export */)) { if (declarations && declarations[0] === variableDeclaration) { @@ -36277,7 +35912,7 @@ var ts; } } function canFunctionHaveSpanInWholeDeclaration(functionDeclaration) { - return !!(functionDeclaration.flags & 1 /* Export */) || (functionDeclaration.parent.kind === 177 /* ClassDeclaration */ && functionDeclaration.kind !== 122 /* Constructor */); + return !!(functionDeclaration.flags & 1 /* Export */) || (functionDeclaration.parent.kind === 184 /* ClassDeclaration */ && functionDeclaration.kind !== 126 /* Constructor */); } function spanInFunctionDeclaration(functionDeclaration) { if (!functionDeclaration.body) { @@ -36297,15 +35932,15 @@ var ts; } function spanInBlock(block) { switch (block.parent.kind) { - case 181 /* ModuleDeclaration */: - if (!ts.isInstantiated(block.parent)) { + case 188 /* ModuleDeclaration */: + if (ts.getModuleInstanceState(block.parent) !== 1 /* Instantiated */) { return undefined; } - case 157 /* WhileStatement */: - case 155 /* IfStatement */: - case 159 /* ForInStatement */: + case 164 /* WhileStatement */: + case 162 /* IfStatement */: + case 166 /* ForInStatement */: return spanInNodeIfStartsOnSameLine(block.parent, block.statements[0]); - case 158 /* ForStatement */: + case 165 /* ForStatement */: return spanInNodeIfStartsOnSameLine(ts.findPrecedingToken(block.pos, sourceFile, block.parent), block.statements[0]); } return spanInNode(block.statements[0]); @@ -36326,34 +35961,34 @@ var ts; } function spanInOpenBraceToken(node) { switch (node.parent.kind) { - case 180 /* EnumDeclaration */: + case 187 /* EnumDeclaration */: var enumDeclaration = node.parent; return spanInNodeIfStartsOnSameLine(ts.findPrecedingToken(node.pos, sourceFile, node.parent), enumDeclaration.members.length ? enumDeclaration.members[0] : enumDeclaration.getLastToken(sourceFile)); - case 177 /* ClassDeclaration */: + case 184 /* ClassDeclaration */: var classDeclaration = node.parent; return spanInNodeIfStartsOnSameLine(ts.findPrecedingToken(node.pos, sourceFile, node.parent), classDeclaration.members.length ? classDeclaration.members[0] : classDeclaration.getLastToken(sourceFile)); - case 164 /* SwitchStatement */: + case 171 /* SwitchStatement */: return spanInNodeIfStartsOnSameLine(node.parent, node.parent.clauses[0]); } return spanInNode(node.parent); } function spanInCloseBraceToken(node) { switch (node.parent.kind) { - case 182 /* ModuleBlock */: - if (!ts.isInstantiated(node.parent.parent)) { + case 189 /* ModuleBlock */: + if (ts.getModuleInstanceState(node.parent.parent) !== 1 /* Instantiated */) { return undefined; } - case 176 /* FunctionBlock */: - case 180 /* EnumDeclaration */: - case 177 /* ClassDeclaration */: + case 183 /* FunctionBlock */: + case 187 /* EnumDeclaration */: + case 184 /* ClassDeclaration */: return textSpan(node); - case 151 /* Block */: - case 170 /* TryBlock */: - case 171 /* CatchBlock */: - case 172 /* FinallyBlock */: + case 158 /* Block */: + case 177 /* TryBlock */: + case 178 /* CatchBlock */: + case 179 /* FinallyBlock */: return spanInNode(node.parent.statements[node.parent.statements.length - 1]); ; - case 164 /* SwitchStatement */: + case 171 /* SwitchStatement */: var switchStatement = node.parent; var lastClause = switchStatement.clauses[switchStatement.clauses.length - 1]; if (lastClause) { @@ -36365,23 +36000,23 @@ var ts; } } function spanInOpenParenToken(node) { - if (node.parent.kind === 156 /* DoStatement */) { + if (node.parent.kind === 163 /* DoStatement */) { return spanInPreviousNode(node); } return spanInNode(node.parent); } function spanInCloseParenToken(node) { switch (node.parent.kind) { - case 144 /* FunctionExpression */: - case 175 /* FunctionDeclaration */: - case 145 /* ArrowFunction */: - case 121 /* Method */: - case 123 /* GetAccessor */: - case 124 /* SetAccessor */: - case 122 /* Constructor */: - case 157 /* WhileStatement */: - case 156 /* DoStatement */: - case 158 /* ForStatement */: + case 149 /* FunctionExpression */: + case 182 /* FunctionDeclaration */: + case 150 /* ArrowFunction */: + case 125 /* Method */: + case 127 /* GetAccessor */: + case 128 /* SetAccessor */: + case 126 /* Constructor */: + case 164 /* WhileStatement */: + case 163 /* DoStatement */: + case 165 /* ForStatement */: return spanInPreviousNode(node); default: return spanInNode(node.parent); @@ -36389,19 +36024,19 @@ var ts; return spanInNode(node.parent); } function spanInColonToken(node) { - if (ts.isAnyFunction(node.parent) || node.parent.kind === 137 /* PropertyAssignment */) { + if (ts.isAnyFunction(node.parent) || node.parent.kind === 141 /* PropertyAssignment */) { return spanInPreviousNode(node); } return spanInNode(node.parent); } function spanInGreaterThanOrLessThanToken(node) { - if (node.parent.kind === 142 /* TypeAssertion */) { + if (node.parent.kind === 147 /* TypeAssertion */) { return spanInNode(node.parent.operand); } return spanInNode(node.parent); } function spanInWhileKeyword(node) { - if (node.parent.kind === 156 /* DoStatement */) { + if (node.parent.kind === 163 /* DoStatement */) { return textSpan(node, ts.findNextToken(node.parent.expression, node.parent)); } return spanInNode(node.parent); @@ -36452,20 +36087,20 @@ var TypeScript; var lineChar = { line: -1, character: -1 }; var lineMap = text.lineMap(); var start = new Date().getTime(); - while (token.kind() !== 10 /* EndOfFileToken */) { - if (token.kind() === 49 /* ImportKeyword */) { + while (token.kind() !== 8 /* EndOfFileToken */) { + if (token.kind() === 51 /* ImportKeyword */) { var importToken = token; token = scanner.scan(false); if (TypeScript.SyntaxFacts.isIdentifierNameOrAnyKeyword(token)) { token = scanner.scan(false); - if (token.kind() === 107 /* EqualsToken */) { + if (token.kind() === 109 /* EqualsToken */) { token = scanner.scan(false); - if (token.kind() === 65 /* ModuleKeyword */ || token.kind() === 66 /* RequireKeyword */) { + if (token.kind() === 67 /* ModuleKeyword */ || token.kind() === 68 /* RequireKeyword */) { token = scanner.scan(false); - if (token.kind() === 72 /* OpenParenToken */) { + if (token.kind() === 74 /* OpenParenToken */) { token = scanner.scan(false); lineMap.fillLineAndCharacterFromPosition(TypeScript.start(importToken, text), lineChar); - if (token.kind() === 14 /* StringLiteral */) { + if (token.kind() === 12 /* StringLiteral */) { var ref = { line: lineChar.line, character: lineChar.character, @@ -36495,7 +36130,7 @@ var TypeScript; var lineMap = text.lineMap(); for (var i = 0, n = leadingTrivia.count(); i < n; i++) { var trivia = leadingTrivia.syntaxTriviaAt(i); - if (trivia.kind() === 7 /* SingleLineCommentTrivia */) { + if (trivia.kind() === 5 /* SingleLineCommentTrivia */) { var triviaText = trivia.fullText(); var referencedCode = getFileReferenceFromReferencePath(fileName, text, position, triviaText, diagnostics); if (referencedCode) { @@ -36552,56 +36187,40 @@ var ts; if (typeof languageVersion === "undefined") return undefined; switch (languageVersion) { - case 0 /* EcmaScript3 */: - return 0 /* ES3 */; - case 1 /* EcmaScript5 */: - return 1 /* ES5 */; - case 2 /* EcmaScript6 */: - return 2 /* ES6 */; - default: - throw Error("unsupported LanguageVersion value: " + languageVersion); + case 0 /* EcmaScript3 */: return 0 /* ES3 */; + case 1 /* EcmaScript5 */: return 1 /* ES5 */; + case 2 /* EcmaScript6 */: return 2 /* ES6 */; + default: throw Error("unsupported LanguageVersion value: " + languageVersion); } } function moduleGenTargetToModuleKind(moduleGenTarget) { if (typeof moduleGenTarget === "undefined") return undefined; switch (moduleGenTarget) { - case 2 /* Asynchronous */: - return 2 /* AMD */; - case 1 /* Synchronous */: - return 1 /* CommonJS */; - case 0 /* Unspecified */: - return 0 /* None */; - default: - throw Error("unsupported ModuleGenTarget value: " + moduleGenTarget); + case 2 /* Asynchronous */: return 2 /* AMD */; + case 1 /* Synchronous */: return 1 /* CommonJS */; + case 0 /* Unspecified */: return 0 /* None */; + default: throw Error("unsupported ModuleGenTarget value: " + moduleGenTarget); } } function scriptTargetTolanguageVersion(scriptTarget) { if (typeof scriptTarget === "undefined") return undefined; switch (scriptTarget) { - case 0 /* ES3 */: - return 0 /* EcmaScript3 */; - case 1 /* ES5 */: - return 1 /* EcmaScript5 */; - case 2 /* ES6 */: - return 2 /* EcmaScript6 */; - default: - throw Error("unsupported ScriptTarget value: " + scriptTarget); + case 0 /* ES3 */: return 0 /* EcmaScript3 */; + case 1 /* ES5 */: return 1 /* EcmaScript5 */; + case 2 /* ES6 */: return 2 /* EcmaScript6 */; + default: throw Error("unsupported ScriptTarget value: " + scriptTarget); } } function moduleKindToModuleGenTarget(moduleKind) { if (typeof moduleKind === "undefined") return undefined; switch (moduleKind) { - case 2 /* AMD */: - return 2 /* Asynchronous */; - case 1 /* CommonJS */: - return 1 /* Synchronous */; - case 0 /* None */: - return 0 /* Unspecified */; - default: - throw Error("unsupported ModuleKind value: " + moduleKind); + case 2 /* AMD */: return 2 /* Asynchronous */; + case 1 /* CommonJS */: return 1 /* Synchronous */; + case 0 /* None */: return 0 /* Unspecified */; + default: throw Error("unsupported ModuleKind value: " + moduleKind); } } function compilationSettingsToCompilerOptions(settings) {