diff --git a/.gitmodules b/.gitmodules new file mode 100644 index 0000000..e69de29 diff --git a/CMakeLists.txt b/CMakeLists.txt new file mode 100644 index 0000000..46d21b7 --- /dev/null +++ b/CMakeLists.txt @@ -0,0 +1,21 @@ +cmake_minimum_required(VERSION 3.22) +project(typescript) + +set(CMAKE_CXX_STANDARD 20) + +set(CMAKE_CXX_FLAGS "-Wall -Wextra -O2") +list(APPEND CMAKE_MODULE_PATH libs/) + +#add_definitions(-DTRACY_ENABLE) +#include_directories(libs/tracy/) + +add_subdirectory(src) + +include_directories(libs) + +add_executable(typescript_main main.cpp) + +target_link_libraries( + typescript_main + typescript +) \ No newline at end of file diff --git a/libs/.gitkeep b/libs/.gitkeep new file mode 100644 index 0000000..e69de29 diff --git a/libs/magic_enum.hpp b/libs/magic_enum.hpp new file mode 100644 index 0000000..1548036 --- /dev/null +++ b/libs/magic_enum.hpp @@ -0,0 +1,1380 @@ + +// __ __ _ ______ _____ +// | \/ | (_) | ____| / ____|_ _ +// | \ / | __ _ __ _ _ ___ | |__ _ __ _ _ _ __ ___ | | _| |_ _| |_ +// | |\/| |/ _` |/ _` | |/ __| | __| | '_ \| | | | '_ ` _ \ | | |_ _|_ _| +// | | | | (_| | (_| | | (__ | |____| | | | |_| | | | | | | | |____|_| |_| +// |_| |_|\__,_|\__, |_|\___| |______|_| |_|\__,_|_| |_| |_| \_____| +// __/ | https://github.com/Neargye/magic_enum +// |___/ version 0.8.0 +// +// Licensed under the MIT License . +// SPDX-License-Identifier: MIT +// Copyright (c) 2019 - 2022 Daniil Goncharov . +// +// Permission is hereby granted, free of charge, to any person obtaining a copy +// of this software and associated documentation files (the "Software"), to deal +// in the Software without restriction, including without limitation the rights +// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +// copies of the Software, and to permit persons to whom the Software is +// furnished to do so, subject to the following conditions: +// +// The above copyright notice and this permission notice shall be included in all +// copies or substantial portions of the Software. +// +// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +// SOFTWARE. + +#ifndef NEARGYE_MAGIC_ENUM_HPP +#define NEARGYE_MAGIC_ENUM_HPP + +#define MAGIC_ENUM_VERSION_MAJOR 0 +#define MAGIC_ENUM_VERSION_MINOR 8 +#define MAGIC_ENUM_VERSION_PATCH 0 + +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#if defined(MAGIC_ENUM_CONFIG_FILE) +#include MAGIC_ENUM_CONFIG_FILE +#endif + +#if !defined(MAGIC_ENUM_USING_ALIAS_OPTIONAL) +#include +#endif +#if !defined(MAGIC_ENUM_USING_ALIAS_STRING) +#include +#endif +#if !defined(MAGIC_ENUM_USING_ALIAS_STRING_VIEW) +#include +#endif + +#if defined(__clang__) +# pragma clang diagnostic push +#elif defined(__GNUC__) +# pragma GCC diagnostic push +# pragma GCC diagnostic ignored "-Wmaybe-uninitialized" // May be used uninitialized 'return {};'. +#elif defined(_MSC_VER) +# pragma warning(push) +# pragma warning(disable : 26495) // Variable 'static_string::chars_' is uninitialized. +# pragma warning(disable : 28020) // Arithmetic overflow: Using operator '-' on a 4 byte value and then casting the result to a 8 byte value. +# pragma warning(disable : 26451) // The expression '0<=_Param_(1)&&_Param_(1)<=1-1' is not true at this call. +#endif + +// Checks magic_enum compiler compatibility. +#if defined(__clang__) && __clang_major__ >= 5 || defined(__GNUC__) && __GNUC__ >= 9 || defined(_MSC_VER) && _MSC_VER >= 1910 +# undef MAGIC_ENUM_SUPPORTED +# define MAGIC_ENUM_SUPPORTED 1 +#endif + +// Checks magic_enum compiler aliases compatibility. +#if defined(__clang__) && __clang_major__ >= 5 || defined(__GNUC__) && __GNUC__ >= 9 || defined(_MSC_VER) && _MSC_VER >= 1920 +# undef MAGIC_ENUM_SUPPORTED_ALIASES +# define MAGIC_ENUM_SUPPORTED_ALIASES 1 +#endif + +// Enum value must be greater or equals than MAGIC_ENUM_RANGE_MIN. By default MAGIC_ENUM_RANGE_MIN = -128. +// If need another min range for all enum types by default, redefine the macro MAGIC_ENUM_RANGE_MIN. +#if !defined(MAGIC_ENUM_RANGE_MIN) +# define MAGIC_ENUM_RANGE_MIN -128 +#endif + +// Enum value must be less or equals than MAGIC_ENUM_RANGE_MAX. By default MAGIC_ENUM_RANGE_MAX = 128. +// If need another max range for all enum types by default, redefine the macro MAGIC_ENUM_RANGE_MAX. +#if !defined(MAGIC_ENUM_RANGE_MAX) +# define MAGIC_ENUM_RANGE_MAX 128 +#endif + +namespace magic_enum { + +// If need another optional type, define the macro MAGIC_ENUM_USING_ALIAS_OPTIONAL. +#if defined(MAGIC_ENUM_USING_ALIAS_OPTIONAL) + MAGIC_ENUM_USING_ALIAS_OPTIONAL +#else + using std::optional; +#endif + +// If need another string_view type, define the macro MAGIC_ENUM_USING_ALIAS_STRING_VIEW. +#if defined(MAGIC_ENUM_USING_ALIAS_STRING_VIEW) + MAGIC_ENUM_USING_ALIAS_STRING_VIEW +#else + using std::string_view; +#endif + +// If need another string type, define the macro MAGIC_ENUM_USING_ALIAS_STRING. +#if defined(MAGIC_ENUM_USING_ALIAS_STRING) + MAGIC_ENUM_USING_ALIAS_STRING +#else + using std::string; +#endif + + namespace customize { + +// Enum value must be in range [MAGIC_ENUM_RANGE_MIN, MAGIC_ENUM_RANGE_MAX]. By default MAGIC_ENUM_RANGE_MIN = -128, MAGIC_ENUM_RANGE_MAX = 128. +// If need another range for all enum types by default, redefine the macro MAGIC_ENUM_RANGE_MIN and MAGIC_ENUM_RANGE_MAX. +// If need another range for specific enum type, add specialization enum_range for necessary enum type. + template + struct enum_range { + static_assert(std::is_enum_v, "magic_enum::customize::enum_range requires enum type."); + static constexpr int min = MAGIC_ENUM_RANGE_MIN; + static constexpr int max = MAGIC_ENUM_RANGE_MAX; + static_assert(max > min, "magic_enum::customize::enum_range requires max > min."); + }; + + static_assert(MAGIC_ENUM_RANGE_MAX > MAGIC_ENUM_RANGE_MIN, "MAGIC_ENUM_RANGE_MAX must be greater than MAGIC_ENUM_RANGE_MIN."); + static_assert((MAGIC_ENUM_RANGE_MAX - MAGIC_ENUM_RANGE_MIN) < (std::numeric_limits::max)(), "MAGIC_ENUM_RANGE must be less than UINT16_MAX."); + + namespace detail { + enum class default_customize_tag {}; + enum class invalid_customize_tag {}; + } // namespace magic_enum::customize::detail + + using customize_t = std::variant; + +// Default customize. + inline constexpr auto default_tag = detail::default_customize_tag{}; +// Invalid customize. + inline constexpr auto invalid_tag = detail::invalid_customize_tag{}; + +// If need custom names for enum, add specialization enum_name for necessary enum type. + template + constexpr customize_t enum_name(E) noexcept { + return default_tag; + } + +// If need custom type name for enum, add specialization enum_type_name for necessary enum type. + template + constexpr customize_t enum_type_name() noexcept { + return default_tag; + } + + } // namespace magic_enum::customize + + namespace detail { + + template >>> + using enum_constant = std::integral_constant, V>; + + template + inline constexpr bool always_false_v = false; + + template + struct supported +#if defined(MAGIC_ENUM_SUPPORTED) && MAGIC_ENUM_SUPPORTED || defined(MAGIC_ENUM_NO_CHECK_SUPPORT) + : std::true_type {}; +#else + : std::false_type {}; +#endif + + template + struct has_is_flags : std::false_type {}; + + template + struct has_is_flags::is_flags)>> : std::bool_constant::is_flags)>>> {}; + + template + struct range_min : std::integral_constant {}; + + template + struct range_min::min)>> : std::integral_constant::min), customize::enum_range::min> {}; + + template + struct range_max : std::integral_constant {}; + + template + struct range_max::max)>> : std::integral_constant::max), customize::enum_range::max> {}; + + template + class static_string { + public: + constexpr explicit static_string(string_view str) noexcept : static_string{str, std::make_index_sequence{}} { + assert(str.size() == N); + } + + constexpr const char* data() const noexcept { return chars_; } + + constexpr std::size_t size() const noexcept { return N; } + + constexpr operator string_view() const noexcept { return {data(), size()}; } + + private: + template + constexpr static_string(string_view str, std::index_sequence) noexcept : chars_{str[I]..., '\0'} {} + + char chars_[N + 1]; + }; + + template <> + class static_string<0> { + public: + constexpr explicit static_string() = default; + + constexpr explicit static_string(string_view) noexcept {} + + constexpr const char* data() const noexcept { return nullptr; } + + constexpr std::size_t size() const noexcept { return 0; } + + constexpr operator string_view() const noexcept { return {}; } + }; + + constexpr string_view pretty_name(string_view name) noexcept { + for (std::size_t i = name.size(); i > 0; --i) { + if (!((name[i - 1] >= '0' && name[i - 1] <= '9') || + (name[i - 1] >= 'a' && name[i - 1] <= 'z') || + (name[i - 1] >= 'A' && name[i - 1] <= 'Z') || + #if defined(MAGIC_ENUM_ENABLE_NONASCII) + (name[i - 1] & 0x80) || + #endif + (name[i - 1] == '_'))) { + name.remove_prefix(i); + break; + } + } + + if (name.size() > 0 && ((name.front() >= 'a' && name.front() <= 'z') || + (name.front() >= 'A' && name.front() <= 'Z') || + #if defined(MAGIC_ENUM_ENABLE_NONASCII) + (name.front() & 0x80) || + #endif + (name.front() == '_'))) { + return name; + } + + return {}; // Invalid name. + } + + class case_insensitive { + static constexpr char to_lower(char c) noexcept { + return (c >= 'A' && c <= 'Z') ? static_cast(c + ('a' - 'A')) : c; + } + + public: + template + constexpr auto operator()([[maybe_unused]] L lhs, [[maybe_unused]] R rhs) const noexcept -> std::enable_if_t, char> && std::is_same_v, char>, bool> { +#if defined(MAGIC_ENUM_ENABLE_NONASCII) + static_assert(always_false_v, "magic_enum::case_insensitive not supported Non-ASCII feature."); + return false; +#else + return to_lower(lhs) == to_lower(rhs); +#endif + } + }; + + constexpr std::size_t find(string_view str, char c) noexcept { +#if defined(__clang__) && __clang_major__ < 9 && defined(__GLIBCXX__) || defined(_MSC_VER) && _MSC_VER < 1920 && !defined(__clang__) + // https://stackoverflow.com/questions/56484834/constexpr-stdstring-viewfind-last-of-doesnt-work-on-clang-8-with-libstdc +// https://developercommunity.visualstudio.com/content/problem/360432/vs20178-regression-c-failed-in-test.html + constexpr bool workaround = true; +#else + constexpr bool workaround = false; +#endif + + if constexpr (workaround) { + for (std::size_t i = 0; i < str.size(); ++i) { + if (str[i] == c) { + return i; + } + } + + return string_view::npos; + } else { + return str.find_first_of(c); + } + } + + template + constexpr std::array, N> to_array(T (&a)[N], std::index_sequence) noexcept { + return {{a[I]...}}; + } + + template + constexpr bool is_default_predicate() noexcept { + return std::is_same_v, std::equal_to> || + std::is_same_v, std::equal_to<>>; + } + + template + constexpr bool is_nothrow_invocable() { + return is_default_predicate() || + std::is_nothrow_invocable_r_v; + } + + template + constexpr bool cmp_equal(string_view lhs, string_view rhs, [[maybe_unused]] BinaryPredicate&& p) noexcept(is_nothrow_invocable()) { +#if defined(_MSC_VER) && _MSC_VER < 1920 && !defined(__clang__) + // https://developercommunity.visualstudio.com/content/problem/360432/vs20178-regression-c-failed-in-test.html + // https://developercommunity.visualstudio.com/content/problem/232218/c-constexpr-string-view.html + constexpr bool workaround = true; +#else + constexpr bool workaround = false; +#endif + + if constexpr (!is_default_predicate() || workaround) { + if (lhs.size() != rhs.size()) { + return false; + } + + const auto size = lhs.size(); + for (std::size_t i = 0; i < size; ++i) { + if (!p(lhs[i], rhs[i])) { + return false; + } + } + + return true; + } else { + return lhs == rhs; + } + } + + template + constexpr bool cmp_less(L lhs, R rhs) noexcept { + static_assert(std::is_integral_v && std::is_integral_v, "magic_enum::detail::cmp_less requires integral type."); + + if constexpr (std::is_signed_v == std::is_signed_v) { + // If same signedness (both signed or both unsigned). + return lhs < rhs; + } else if constexpr (std::is_same_v) { // bool special case + return static_cast(lhs) < rhs; + } else if constexpr (std::is_same_v) { // bool special case + return lhs < static_cast(rhs); + } else if constexpr (std::is_signed_v) { + // If 'right' is negative, then result is 'false', otherwise cast & compare. + return rhs > 0 && lhs < static_cast>(rhs); + } else { + // If 'left' is negative, then result is 'true', otherwise cast & compare. + return lhs < 0 || static_cast>(lhs) < rhs; + } + } + + template + constexpr I log2(I value) noexcept { + static_assert(std::is_integral_v, "magic_enum::detail::log2 requires integral type."); + + if constexpr (std::is_same_v) { // bool special case + return assert(false), value; + } else { + auto ret = I{0}; + for (; value > I{1}; value >>= I{1}, ++ret) {} + + return ret; + } + } + + template + inline constexpr bool is_enum_v = std::is_enum_v && std::is_same_v>; + + template + constexpr auto n() noexcept { + static_assert(is_enum_v, "magic_enum::detail::n requires enum type."); + + [[maybe_unused]] constexpr auto custom = customize::enum_type_name(); + static_assert(std::is_same_v, customize::customize_t>, "magic_enum::customize requires customize_t type."); + if constexpr (custom.index() == 0) { + constexpr auto name = std::get(custom); + static_assert(!name.empty(), "magic_enum::customize requires not empty string."); + return static_string{name}; + } else if constexpr (custom.index() == 1 && supported::value) { +#if defined(__clang__) || defined(__GNUC__) + constexpr auto name = pretty_name({__PRETTY_FUNCTION__, sizeof(__PRETTY_FUNCTION__) - 2}); +#elif defined(_MSC_VER) + constexpr auto name = pretty_name({__FUNCSIG__, sizeof(__FUNCSIG__) - 17}); +#else + constexpr auto name = string_view{}; +#endif + return static_string{name}; + } else { + return static_string<0>{}; // Unsupported compiler or Invalid customize. + } + } + + template + inline constexpr auto type_name_v = n(); + + template + constexpr auto n() noexcept { + static_assert(is_enum_v, "magic_enum::detail::n requires enum type."); + + [[maybe_unused]] constexpr auto custom = customize::enum_name(V); + static_assert(std::is_same_v, customize::customize_t>, "magic_enum::customize requires customize_t type."); + if constexpr (custom.index() == 0) { + constexpr auto name = std::get(custom); + static_assert(!name.empty(), "magic_enum::customize requires not empty string."); + return static_string{name}; + } else if constexpr (custom.index() == 1 && supported::value) { +#if defined(__clang__) || defined(__GNUC__) + constexpr auto name = pretty_name({__PRETTY_FUNCTION__, sizeof(__PRETTY_FUNCTION__) - 2}); +#elif defined(_MSC_VER) + constexpr auto name = pretty_name({__FUNCSIG__, sizeof(__FUNCSIG__) - 17}); +#else + constexpr auto name = string_view{}; +#endif + return static_string{name}; + } else { + return static_string<0>{}; // Unsupported compiler or Invalid customize. + } + } + + template + inline constexpr auto enum_name_v = n(); + + template + constexpr bool is_valid() noexcept { + static_assert(is_enum_v, "magic_enum::detail::is_valid requires enum type."); + + return n(V)>().size() != 0; + } + + template > + constexpr E value(std::size_t i) noexcept { + static_assert(is_enum_v, "magic_enum::detail::value requires enum type."); + + if constexpr (std::is_same_v) { // bool special case + static_assert(O == 0, "magic_enum::detail::value requires valid offset."); + + return static_cast(i); + } else if constexpr (IsFlags) { + return static_cast(U{1} << static_cast(static_cast(i) + O)); + } else { + return static_cast(static_cast(i) + O); + } + } + + template > + constexpr int reflected_min() noexcept { + static_assert(is_enum_v, "magic_enum::detail::reflected_min requires enum type."); + + if constexpr (IsFlags) { + return 0; + } else { + constexpr auto lhs = range_min::value; + constexpr auto rhs = (std::numeric_limits::min)(); + + if constexpr (cmp_less(rhs, lhs)) { + return lhs; + } else { + return rhs; + } + } + } + + template > + constexpr int reflected_max() noexcept { + static_assert(is_enum_v, "magic_enum::detail::reflected_max requires enum type."); + + if constexpr (IsFlags) { + return std::numeric_limits::digits - 1; + } else { + constexpr auto lhs = range_max::value; + constexpr auto rhs = (std::numeric_limits::max)(); + + if constexpr (cmp_less(lhs, rhs)) { + return lhs; + } else { + return rhs; + } + } + } + + template + inline constexpr auto reflected_min_v = reflected_min(); + + template + inline constexpr auto reflected_max_v = reflected_max(); + + template + constexpr std::size_t values_count(const bool (&valid)[N]) noexcept { + auto count = std::size_t{0}; + for (std::size_t i = 0; i < N; ++i) { + if (valid[i]) { + ++count; + } + } + + return count; + } + + template + constexpr auto values(std::index_sequence) noexcept { + static_assert(is_enum_v, "magic_enum::detail::values requires enum type."); + constexpr bool valid[sizeof...(I)] = {is_valid(I)>()...}; + constexpr std::size_t count = values_count(valid); + + if constexpr (count > 0) { + E values[count] = {}; + for (std::size_t i = 0, v = 0; v < count; ++i) { + if (valid[i]) { + values[v++] = value(i); + } + } + + return to_array(values, std::make_index_sequence{}); + } else { + return std::array{}; + } + } + + template > + constexpr auto values() noexcept { + static_assert(is_enum_v, "magic_enum::detail::values requires enum type."); + constexpr auto min = reflected_min_v; + constexpr auto max = reflected_max_v; + constexpr auto range_size = max - min + 1; + static_assert(range_size > 0, "magic_enum::enum_range requires valid size."); + static_assert(range_size < (std::numeric_limits::max)(), "magic_enum::enum_range requires valid size."); + + return values>(std::make_index_sequence{}); + } + + template > + constexpr bool is_flags_enum() noexcept { + static_assert(is_enum_v, "magic_enum::detail::is_flags_enum requires enum type."); + + if constexpr (has_is_flags::value) { + return customize::enum_range::is_flags; + } else if constexpr (std::is_same_v) { // bool special case + return false; + } else { +#if defined(MAGIC_ENUM_NO_CHECK_FLAGS) + return false; +#else + constexpr auto flags_values = values(); + constexpr auto default_values = values(); + if (flags_values.size() == 0 || default_values.size() > flags_values.size()) { + return false; + } + for (std::size_t i = 0; i < default_values.size(); ++i) { + const auto v = static_cast(default_values[i]); + if (v != 0 && (v & (v - 1)) != 0) { + return false; + } + } + return flags_values.size() > 0; +#endif + } + } + + template + inline constexpr bool is_flags_v = is_flags_enum(); + + template + inline constexpr std::array values_v = values>(); + + template > + using values_t = decltype((values_v)); + + template + inline constexpr auto count_v = values_v.size(); + + template > + inline constexpr auto min_v = (count_v > 0) ? static_cast(values_v.front()) : U{0}; + + template > + inline constexpr auto max_v = (count_v > 0) ? static_cast(values_v.back()) : U{0}; + + template + constexpr auto names(std::index_sequence) noexcept { + static_assert(is_enum_v, "magic_enum::detail::names requires enum type."); + + return std::array{{enum_name_v[I]>...}}; + } + + template + inline constexpr std::array names_v = names(std::make_index_sequence>{}); + + template > + using names_t = decltype((names_v)); + + template + constexpr auto entries(std::index_sequence) noexcept { + static_assert(is_enum_v, "magic_enum::detail::entries requires enum type."); + + return std::array, sizeof...(I)>{{{values_v[I], enum_name_v[I]>}...}}; + } + + template + inline constexpr std::array entries_v = entries(std::make_index_sequence>{}); + + template > + using entries_t = decltype((entries_v)); + + template > + constexpr bool is_sparse() noexcept { + static_assert(is_enum_v, "magic_enum::detail::is_sparse requires enum type."); + + if constexpr (count_v == 0) { + return false; + } else if constexpr (std::is_same_v) { // bool special case + return false; + } else { + constexpr auto max = is_flags_v ? log2(max_v) : max_v; + constexpr auto min = is_flags_v ? log2(min_v) : min_v; + constexpr auto range_size = max - min + 1; + + return range_size != count_v; + } + } + + template + inline constexpr bool is_sparse_v = is_sparse(); + + template > + constexpr U values_ors() noexcept { + static_assert(is_enum_v, "magic_enum::detail::values_ors requires enum type."); + + auto ors = U{0}; + for (std::size_t i = 0; i < count_v; ++i) { + ors |= static_cast(values_v[i]); + } + + return ors; + } + + template + struct enable_if_enum {}; + + template + struct enable_if_enum { + using type = R; + static_assert(supported::value, "magic_enum unsupported compiler (https://github.com/Neargye/magic_enum#compiler-compatibility)."); + }; + + template > + using enable_if_t = typename enable_if_enum> && std::is_invocable_r_v, R>::type; + + template >>> + using enum_concept = T; + + template > + struct is_scoped_enum : std::false_type {}; + + template + struct is_scoped_enum : std::bool_constant>> {}; + + template > + struct is_unscoped_enum : std::false_type {}; + + template + struct is_unscoped_enum : std::bool_constant>> {}; + + template >> + struct underlying_type {}; + + template + struct underlying_type : std::underlying_type> {}; + + template + struct constexpr_hash_t; + + template + struct constexpr_hash_t>> { + constexpr auto operator()(Value value) const noexcept { + using U = typename underlying_type::type; + if constexpr (std::is_same_v) { // bool special case + return static_cast(value); + } else { + return static_cast(value); + } + } + using secondary_hash = constexpr_hash_t; + }; + + template + struct constexpr_hash_t>> { + static constexpr std::uint32_t crc_table[256] { + 0x00000000L, 0x77073096L, 0xee0e612cL, 0x990951baL, 0x076dc419L, 0x706af48fL, 0xe963a535L, 0x9e6495a3L, + 0x0edb8832L, 0x79dcb8a4L, 0xe0d5e91eL, 0x97d2d988L, 0x09b64c2bL, 0x7eb17cbdL, 0xe7b82d07L, 0x90bf1d91L, + 0x1db71064L, 0x6ab020f2L, 0xf3b97148L, 0x84be41deL, 0x1adad47dL, 0x6ddde4ebL, 0xf4d4b551L, 0x83d385c7L, + 0x136c9856L, 0x646ba8c0L, 0xfd62f97aL, 0x8a65c9ecL, 0x14015c4fL, 0x63066cd9L, 0xfa0f3d63L, 0x8d080df5L, + 0x3b6e20c8L, 0x4c69105eL, 0xd56041e4L, 0xa2677172L, 0x3c03e4d1L, 0x4b04d447L, 0xd20d85fdL, 0xa50ab56bL, + 0x35b5a8faL, 0x42b2986cL, 0xdbbbc9d6L, 0xacbcf940L, 0x32d86ce3L, 0x45df5c75L, 0xdcd60dcfL, 0xabd13d59L, + 0x26d930acL, 0x51de003aL, 0xc8d75180L, 0xbfd06116L, 0x21b4f4b5L, 0x56b3c423L, 0xcfba9599L, 0xb8bda50fL, + 0x2802b89eL, 0x5f058808L, 0xc60cd9b2L, 0xb10be924L, 0x2f6f7c87L, 0x58684c11L, 0xc1611dabL, 0xb6662d3dL, + 0x76dc4190L, 0x01db7106L, 0x98d220bcL, 0xefd5102aL, 0x71b18589L, 0x06b6b51fL, 0x9fbfe4a5L, 0xe8b8d433L, + 0x7807c9a2L, 0x0f00f934L, 0x9609a88eL, 0xe10e9818L, 0x7f6a0dbbL, 0x086d3d2dL, 0x91646c97L, 0xe6635c01L, + 0x6b6b51f4L, 0x1c6c6162L, 0x856530d8L, 0xf262004eL, 0x6c0695edL, 0x1b01a57bL, 0x8208f4c1L, 0xf50fc457L, + 0x65b0d9c6L, 0x12b7e950L, 0x8bbeb8eaL, 0xfcb9887cL, 0x62dd1ddfL, 0x15da2d49L, 0x8cd37cf3L, 0xfbd44c65L, + 0x4db26158L, 0x3ab551ceL, 0xa3bc0074L, 0xd4bb30e2L, 0x4adfa541L, 0x3dd895d7L, 0xa4d1c46dL, 0xd3d6f4fbL, + 0x4369e96aL, 0x346ed9fcL, 0xad678846L, 0xda60b8d0L, 0x44042d73L, 0x33031de5L, 0xaa0a4c5fL, 0xdd0d7cc9L, + 0x5005713cL, 0x270241aaL, 0xbe0b1010L, 0xc90c2086L, 0x5768b525L, 0x206f85b3L, 0xb966d409L, 0xce61e49fL, + 0x5edef90eL, 0x29d9c998L, 0xb0d09822L, 0xc7d7a8b4L, 0x59b33d17L, 0x2eb40d81L, 0xb7bd5c3bL, 0xc0ba6cadL, + 0xedb88320L, 0x9abfb3b6L, 0x03b6e20cL, 0x74b1d29aL, 0xead54739L, 0x9dd277afL, 0x04db2615L, 0x73dc1683L, + 0xe3630b12L, 0x94643b84L, 0x0d6d6a3eL, 0x7a6a5aa8L, 0xe40ecf0bL, 0x9309ff9dL, 0x0a00ae27L, 0x7d079eb1L, + 0xf00f9344L, 0x8708a3d2L, 0x1e01f268L, 0x6906c2feL, 0xf762575dL, 0x806567cbL, 0x196c3671L, 0x6e6b06e7L, + 0xfed41b76L, 0x89d32be0L, 0x10da7a5aL, 0x67dd4accL, 0xf9b9df6fL, 0x8ebeeff9L, 0x17b7be43L, 0x60b08ed5L, + 0xd6d6a3e8L, 0xa1d1937eL, 0x38d8c2c4L, 0x4fdff252L, 0xd1bb67f1L, 0xa6bc5767L, 0x3fb506ddL, 0x48b2364bL, + 0xd80d2bdaL, 0xaf0a1b4cL, 0x36034af6L, 0x41047a60L, 0xdf60efc3L, 0xa867df55L, 0x316e8eefL, 0x4669be79L, + 0xcb61b38cL, 0xbc66831aL, 0x256fd2a0L, 0x5268e236L, 0xcc0c7795L, 0xbb0b4703L, 0x220216b9L, 0x5505262fL, + 0xc5ba3bbeL, 0xb2bd0b28L, 0x2bb45a92L, 0x5cb36a04L, 0xc2d7ffa7L, 0xb5d0cf31L, 0x2cd99e8bL, 0x5bdeae1dL, + 0x9b64c2b0L, 0xec63f226L, 0x756aa39cL, 0x026d930aL, 0x9c0906a9L, 0xeb0e363fL, 0x72076785L, 0x05005713L, + 0x95bf4a82L, 0xe2b87a14L, 0x7bb12baeL, 0x0cb61b38L, 0x92d28e9bL, 0xe5d5be0dL, 0x7cdcefb7L, 0x0bdbdf21L, + 0x86d3d2d4L, 0xf1d4e242L, 0x68ddb3f8L, 0x1fda836eL, 0x81be16cdL, 0xf6b9265bL, 0x6fb077e1L, 0x18b74777L, + 0x88085ae6L, 0xff0f6a70L, 0x66063bcaL, 0x11010b5cL, 0x8f659effL, 0xf862ae69L, 0x616bffd3L, 0x166ccf45L, + 0xa00ae278L, 0xd70dd2eeL, 0x4e048354L, 0x3903b3c2L, 0xa7672661L, 0xd06016f7L, 0x4969474dL, 0x3e6e77dbL, + 0xaed16a4aL, 0xd9d65adcL, 0x40df0b66L, 0x37d83bf0L, 0xa9bcae53L, 0xdebb9ec5L, 0x47b2cf7fL, 0x30b5ffe9L, + 0xbdbdf21cL, 0xcabac28aL, 0x53b39330L, 0x24b4a3a6L, 0xbad03605L, 0xcdd70693L, 0x54de5729L, 0x23d967bfL, + 0xb3667a2eL, 0xc4614ab8L, 0x5d681b02L, 0x2a6f2b94L, 0xb40bbe37L, 0xc30c8ea1L, 0x5a05df1bL, 0x2d02ef8dL + }; + constexpr std::uint32_t operator()(string_view value) const noexcept { + auto crc = static_cast(0xffffffffL); + for (const auto c : value) { + crc = (crc >> 8) ^ crc_table[(crc ^ static_cast(c)) & 0xff]; + } + return crc ^ 0xffffffffL; + } + + struct secondary_hash { + constexpr std::uint32_t operator()(string_view value) const noexcept { + auto acc = static_cast(2166136261ULL); + for (const auto c : value) { + acc = ((acc ^ static_cast(c)) * static_cast(16777619ULL)) & std::numeric_limits::max(); + } + return static_cast(acc); + } + }; + }; + + template + constexpr static Hash hash_v{}; + + template + constexpr auto calculate_cases(std::size_t Page) noexcept { + constexpr std::array values = *GlobValues; + constexpr std::size_t size = values.size(); + + using switch_t = std::invoke_result_t; + static_assert(std::is_integral_v && !std::is_same_v); + const std::size_t values_to = (std::min)(static_cast(256), size - Page); + + std::array result{}; + auto fill = result.begin(); + for (auto first = values.begin() + Page, last = values.begin() + Page + values_to; first != last; ) { + *fill++ = hash_v(*first++); + } + + // dead cases, try to avoid case collisions + for (switch_t last_value = result[values_to - 1]; fill != result.end() && last_value != (std::numeric_limits::max)(); *fill++ = ++last_value) { + } + + auto it = result.begin(); + for (auto last_value = (std::numeric_limits::min)(); fill != result.end(); *fill++ = last_value++) { + while (last_value == *it) { + ++last_value, ++it; + } + } + + return result; + } + + template + constexpr R invoke_r(F&& f, Args&&... args) noexcept(std::is_nothrow_invocable_r_v) { + if constexpr (std::is_void_v) { + std::forward(f)(std::forward(args)...); + } else { + return static_cast(std::forward(f)(std::forward(args)...)); + } + } + + enum class case_call_t { + index, value + }; + + template + inline constexpr auto default_result_type_lambda = []() noexcept(std::is_nothrow_default_constructible_v) { return T{}; }; + + template <> + inline constexpr auto default_result_type_lambda = []() noexcept {}; + + template + constexpr bool no_duplicate() noexcept { + using value_t = std::decay_t; + using hash_value_t = std::invoke_result_t; + std::arraysize()> hashes{}; + std::size_t size = 0; + for (auto elem : *Arr) { + hashes[size] = hash_v(elem); + for (auto i = size++; i > 0; --i) { + if (hashes[i] < hashes[i - 1]) { + auto tmp = hashes[i]; + hashes[i] = hashes[i - 1]; + hashes[i - 1] = tmp; + } else if (hashes[i] == hashes[i - 1]) { + return false; + } else { + break; + } + } + } + return true; + } + +#define MAGIC_ENUM_FOR_EACH_256(T) T(0)T(1)T(2)T(3)T(4)T(5)T(6)T(7)T(8)T(9)T(10)T(11)T(12)T(13)T(14)T(15)T(16)T(17)T(18)T(19)T(20)T(21)T(22)T(23)T(24)T(25)T(26)T(27)T(28)T(29)T(30)T(31) \ + T(32)T(33)T(34)T(35)T(36)T(37)T(38)T(39)T(40)T(41)T(42)T(43)T(44)T(45)T(46)T(47)T(48)T(49)T(50)T(51)T(52)T(53)T(54)T(55)T(56)T(57)T(58)T(59)T(60)T(61)T(62)T(63) \ + T(64)T(65)T(66)T(67)T(68)T(69)T(70)T(71)T(72)T(73)T(74)T(75)T(76)T(77)T(78)T(79)T(80)T(81)T(82)T(83)T(84)T(85)T(86)T(87)T(88)T(89)T(90)T(91)T(92)T(93)T(94)T(95) \ + T(96)T(97)T(98)T(99)T(100)T(101)T(102)T(103)T(104)T(105)T(106)T(107)T(108)T(109)T(110)T(111)T(112)T(113)T(114)T(115)T(116)T(117)T(118)T(119)T(120)T(121)T(122)T(123)T(124)T(125)T(126)T(127) \ + T(128)T(129)T(130)T(131)T(132)T(133)T(134)T(135)T(136)T(137)T(138)T(139)T(140)T(141)T(142)T(143)T(144)T(145)T(146)T(147)T(148)T(149)T(150)T(151)T(152)T(153)T(154)T(155)T(156)T(157)T(158)T(159) \ + T(160)T(161)T(162)T(163)T(164)T(165)T(166)T(167)T(168)T(169)T(170)T(171)T(172)T(173)T(174)T(175)T(176)T(177)T(178)T(179)T(180)T(181)T(182)T(183)T(184)T(185)T(186)T(187)T(188)T(189)T(190)T(191) \ + T(192)T(193)T(194)T(195)T(196)T(197)T(198)T(199)T(200)T(201)T(202)T(203)T(204)T(205)T(206)T(207)T(208)T(209)T(210)T(211)T(212)T(213)T(214)T(215)T(216)T(217)T(218)T(219)T(220)T(221)T(222)T(223) \ + T(224)T(225)T(226)T(227)T(228)T(229)T(230)T(231)T(232)T(233)T(234)T(235)T(236)T(237)T(238)T(239)T(240)T(241)T(242)T(243)T(244)T(245)T(246)T(247)T(248)T(249)T(250)T(251)T(252)T(253)T(254)T(255) + +#define MAGIC_ENUM_CASE(val) \ + case cases[val]: \ + if constexpr ((val) + Page < size) { \ + if (!pred(values[val + Page], searched)) { \ + break; \ + } \ + if constexpr (CallValue == case_call_t::index) { \ + if constexpr (std::is_invocable_r_v>) { \ + return detail::invoke_r(std::forward(lambda), std::integral_constant{}); \ + } else if constexpr (std::is_invocable_v>) { \ + assert(false && "magic_enum::detail::constexpr_switch wrong result type."); \ + } \ + } else if constexpr (CallValue == case_call_t::value) { \ + if constexpr (std::is_invocable_r_v>) { \ + return detail::invoke_r(std::forward(lambda), enum_constant{}); \ + } else if constexpr (std::is_invocable_r_v>) { \ + assert(false && "magic_enum::detail::constexpr_switch wrong result type."); \ + } \ + } \ + break; \ + } else [[fallthrough]]; + + template ::value_type>, + typename Lambda, typename ResultGetterType = decltype(default_result_type_lambda<>), + typename BinaryPredicate = std::equal_to<>> + constexpr std::invoke_result_t constexpr_switch( + Lambda&& lambda, + typename std::decay_t::value_type searched, + ResultGetterType&& def = default_result_type_lambda<>, + BinaryPredicate&& pred = {}) { + using result_t = std::invoke_result_t; + using hash_t = std::conditional_t(), Hash, typename Hash::secondary_hash>; + constexpr std::array values = *GlobValues; + constexpr std::size_t size = values.size(); + constexpr std::array cases = calculate_cases(Page); + + switch (hash_v(searched)) { + MAGIC_ENUM_FOR_EACH_256(MAGIC_ENUM_CASE) + default: + if constexpr (size > 256 + Page) { + return constexpr_switch(std::forward(lambda), searched, std::forward(def)); + } + break; + } + return def(); + } + +#undef MAGIC_ENUM_FOR_EACH_256 +#undef MAGIC_ENUM_CASE + + template + constexpr auto for_each(Lambda&& lambda, std::index_sequence) { + static_assert(is_enum_v, "magic_enum::detail::for_each requires enum type."); + constexpr bool has_void_return = (std::is_void_v[I]>>> || ...); + constexpr bool all_same_return = (std::is_same_v[0]>>, std::invoke_result_t[I]>>> && ...); + + if constexpr (has_void_return) { + (lambda(enum_constant[I]>{}), ...); + } else if constexpr (all_same_return) { + return std::array{lambda(enum_constant[I]>{})...}; + } else { + return std::tuple{lambda(enum_constant[I]>{})...}; + } + } + + } // namespace magic_enum::detail + +// Checks is magic_enum supported compiler. + inline constexpr bool is_magic_enum_supported = detail::supported::value; + + template + using Enum = detail::enum_concept; + +// Checks whether T is an Unscoped enumeration type. +// Provides the member constant value which is equal to true, if T is an [Unscoped enumeration](https://en.cppreference.com/w/cpp/language/enum#Unscoped_enumeration) type. Otherwise, value is equal to false. + template + struct is_unscoped_enum : detail::is_unscoped_enum {}; + + template + inline constexpr bool is_unscoped_enum_v = is_unscoped_enum::value; + +// Checks whether T is an Scoped enumeration type. +// Provides the member constant value which is equal to true, if T is an [Scoped enumeration](https://en.cppreference.com/w/cpp/language/enum#Scoped_enumerations) type. Otherwise, value is equal to false. + template + struct is_scoped_enum : detail::is_scoped_enum {}; + + template + inline constexpr bool is_scoped_enum_v = is_scoped_enum::value; + +// If T is a complete enumeration type, provides a member typedef type that names the underlying type of T. +// Otherwise, if T is not an enumeration type, there is no member type. Otherwise (T is an incomplete enumeration type), the program is ill-formed. + template + struct underlying_type : detail::underlying_type {}; + + template + using underlying_type_t = typename underlying_type::type; + + template + using enum_constant = detail::enum_constant; + +// Returns type name of enum. + template + [[nodiscard]] constexpr auto enum_type_name() noexcept -> detail::enable_if_t { + constexpr string_view name = detail::type_name_v>; + static_assert(!name.empty(), "magic_enum::enum_type_name enum type does not have a name."); + + return name; + } + +// Returns number of enum values. + template + [[nodiscard]] constexpr auto enum_count() noexcept -> detail::enable_if_t { + return detail::count_v>; + } + +// Returns enum value at specified index. +// No bounds checking is performed: the behavior is undefined if index >= number of enum values. + template + [[nodiscard]] constexpr auto enum_value(std::size_t index) noexcept -> detail::enable_if_t> { + using D = std::decay_t; + + if constexpr (detail::is_sparse_v) { + return assert((index < detail::count_v)), detail::values_v[index]; + } else { + constexpr bool is_flag = detail::is_flags_v; + constexpr auto min = is_flag ? detail::log2(detail::min_v) : detail::min_v; + + return assert((index < detail::count_v)), detail::value(index); + } + } + +// Returns enum value at specified index. + template + [[nodiscard]] constexpr auto enum_value() noexcept -> detail::enable_if_t> { + using D = std::decay_t; + static_assert(I < detail::count_v, "magic_enum::enum_value out of range."); + + return enum_value(I); + } + +// Returns std::array with enum values, sorted by enum value. + template + [[nodiscard]] constexpr auto enum_values() noexcept -> detail::enable_if_t> { + return detail::values_v>; + } + +// Returns integer value from enum value. + template + [[nodiscard]] constexpr auto enum_integer(E value) noexcept -> detail::enable_if_t> { + return static_cast>(value); + } + +// Returns underlying value from enum value. + template + [[nodiscard]] constexpr auto enum_underlying(E value) noexcept -> detail::enable_if_t> { + return static_cast>(value); + } + +// Obtains index in enum values from enum value. +// Returns optional with index. + template + [[nodiscard]] constexpr auto enum_index(E value) noexcept -> detail::enable_if_t> { + using D = std::decay_t; + using U = underlying_type_t; + + if constexpr (detail::count_v == 0) { + return {}; // Empty enum. + } else if constexpr (detail::is_sparse_v || detail::is_flags_v) { + return detail::constexpr_switch<&detail::values_v, detail::case_call_t::index>( + [](std::size_t i) { return optional{i}; }, + value, + detail::default_result_type_lambda>); + } else { + const auto v = static_cast(value); + if (v >= detail::min_v && v <= detail::max_v) { + return static_cast(v - detail::min_v); + } + return {}; // Invalid value or out of range. + } + } + +// Obtains index in enum values from static storage enum variable. + template + [[nodiscard]] constexpr auto enum_index() noexcept -> detail::enable_if_t { + constexpr auto index = enum_index>(V); + static_assert(index, "magic_enum::enum_index enum value does not have a index."); + + return *index; + } + +// Returns name from static storage enum variable. +// This version is much lighter on the compile times and is not restricted to the enum_range limitation. + template + [[nodiscard]] constexpr auto enum_name() noexcept -> detail::enable_if_t { + constexpr string_view name = detail::enum_name_v, V>; + static_assert(!name.empty(), "magic_enum::enum_name enum value does not have a name."); + + return name; + } + +// Returns name from enum value. +// If enum value does not have name or value out of range, returns empty string. + template + [[nodiscard]] constexpr auto enum_name(E value) noexcept -> detail::enable_if_t { + using D = std::decay_t; + + if (const auto i = enum_index(value)) { + return detail::names_v[*i]; + } + return {}; + } + +// Returns name from enum-flags value. +// If enum-flags value does not have name or value out of range, returns empty string. + template + [[nodiscard]] auto enum_flags_name(E value) -> detail::enable_if_t { + using D = std::decay_t; + using U = underlying_type_t; + + if constexpr (detail::is_flags_v) { + string name; + auto check_value = U{0}; + for (std::size_t i = 0; i < detail::count_v; ++i) { + if (const auto v = static_cast(enum_value(i)); (static_cast(value) & v) != 0) { + check_value |= v; + const auto n = detail::names_v[i]; + if (!name.empty()) { + name.append(1, '|'); + } + name.append(n.data(), n.size()); + } + } + + if (check_value != 0 && check_value == static_cast(value)) { + return name; + } + + return {}; // Invalid value or out of range. + } else { + return string{enum_name(value)}; + } + } + +// Returns std::array with names, sorted by enum value. + template + [[nodiscard]] constexpr auto enum_names() noexcept -> detail::enable_if_t> { + return detail::names_v>; + } + +// Returns std::array with pairs (value, name), sorted by enum value. + template + [[nodiscard]] constexpr auto enum_entries() noexcept -> detail::enable_if_t> { + return detail::entries_v>; + } + +// Allows you to write magic_enum::enum_cast("bar", magic_enum::case_insensitive); + inline constexpr auto case_insensitive = detail::case_insensitive{}; + +// Obtains enum value from integer value. +// Returns optional with enum value. + template + [[nodiscard]] constexpr auto enum_cast(underlying_type_t value) noexcept -> detail::enable_if_t>> { + using D = std::decay_t; + using U = underlying_type_t; + + if constexpr (detail::count_v == 0) { + return {}; // Empty enum. + } else if constexpr (detail::is_sparse_v) { + if constexpr (detail::is_flags_v) { + constexpr auto count = detail::count_v; + auto check_value = U{0}; + for (std::size_t i = 0; i < count; ++i) { + if (const auto v = static_cast(enum_value(i)); (value & v) != 0) { + check_value |= v; + } + } + + if (check_value != 0 && check_value == value) { + return static_cast(value); + } + return {}; // Invalid value or out of range. + } else { + return detail::constexpr_switch<&detail::values_v, detail::case_call_t::value>( + [](D v) { return optional{v}; }, + static_cast(value), + detail::default_result_type_lambda>); + } + } else { + constexpr auto min = detail::min_v; + constexpr auto max = detail::is_flags_v ? detail::values_ors() : detail::max_v; + + if (value >= min && value <= max) { + return static_cast(value); + } + return {}; // Invalid value or out of range. + } + } + +// Obtains enum value from name. +// Returns optional with enum value. + template > + [[nodiscard]] constexpr auto enum_cast(string_view value, [[maybe_unused]] BinaryPredicate&& p = {}) noexcept(detail::is_nothrow_invocable()) -> detail::enable_if_t>, BinaryPredicate> { + static_assert(std::is_invocable_r_v, "magic_enum::enum_cast requires bool(char, char) invocable predicate."); + using D = std::decay_t; + using U = underlying_type_t; + + if constexpr (detail::count_v == 0) { + return {}; // Empty enum. + } else if constexpr (detail::is_flags_v) { + auto result = U{0}; + while (!value.empty()) { + const auto d = detail::find(value, '|'); + const auto s = (d == string_view::npos) ? value : value.substr(0, d); + auto f = U{0}; + for (std::size_t i = 0; i < detail::count_v; ++i) { + if (detail::cmp_equal(s, detail::names_v[i], p)) { + f = static_cast(enum_value(i)); + result |= f; + break; + } + } + if (f == U{0}) { + return {}; // Invalid value or out of range. + } + value.remove_prefix((d == string_view::npos) ? value.size() : d + 1); + } + + if (result != U{0}) { + return static_cast(result); + } + return {}; // Invalid value or out of range. + } else if constexpr (detail::count_v > 0) { + if constexpr (detail::is_default_predicate()) { + return detail::constexpr_switch<&detail::names_v, detail::case_call_t::index>( + [](std::size_t i) { return optional{detail::values_v[i]}; }, + value, + detail::default_result_type_lambda>, + [&p](string_view lhs, string_view rhs) { return detail::cmp_equal(lhs, rhs, p); }); + } else { + for (std::size_t i = 0; i < detail::count_v; ++i) { + if (detail::cmp_equal(value, detail::names_v[i], p)) { + return enum_value(i); + } + } + return {}; // Invalid value or out of range. + } + } + } + +// Checks whether enum contains enumerator with such enum value. + template + [[nodiscard]] constexpr auto enum_contains(E value) noexcept -> detail::enable_if_t { + using D = std::decay_t; + using U = underlying_type_t; + + return static_cast(enum_cast(static_cast(value))); + } + +// Checks whether enum contains enumerator with such integer value. + template + [[nodiscard]] constexpr auto enum_contains(underlying_type_t value) noexcept -> detail::enable_if_t { + using D = std::decay_t; + + return static_cast(enum_cast(value)); + } + +// Checks whether enum contains enumerator with such name. + template > + [[nodiscard]] constexpr auto enum_contains(string_view value, BinaryPredicate&& p = {}) noexcept(detail::is_nothrow_invocable()) -> detail::enable_if_t { + static_assert(std::is_invocable_r_v, "magic_enum::enum_contains requires bool(char, char) invocable predicate."); + using D = std::decay_t; + + return static_cast(enum_cast(value, std::forward(p))); + } + + template + constexpr auto enum_switch(Lambda&& lambda, E value) -> detail::enable_if_t { + using D = std::decay_t; + + return detail::constexpr_switch<&detail::values_v, detail::case_call_t::value>( + std::forward(lambda), + value, + detail::default_result_type_lambda); + } + + template + constexpr auto enum_switch(Lambda&& lambda, E value, Result&& result) -> detail::enable_if_t { + using D = std::decay_t; + + return detail::constexpr_switch<&detail::values_v, detail::case_call_t::value>( + std::forward(lambda), + value, + [&result] { return std::forward(result); }); + } + + template , typename Lambda> + constexpr auto enum_switch(Lambda&& lambda, string_view name, BinaryPredicate&& p = {}) -> detail::enable_if_t { + static_assert(std::is_invocable_r_v, "magic_enum::enum_switch requires bool(char, char) invocable predicate."); + using D = std::decay_t; + + if (const auto v = enum_cast(name, std::forward(p))) { + return enum_switch(std::forward(lambda), *v); + } + return detail::default_result_type_lambda(); + } + + template , typename Lambda> + constexpr auto enum_switch(Lambda&& lambda, string_view name, Result&& result, BinaryPredicate&& p = {}) -> detail::enable_if_t { + static_assert(std::is_invocable_r_v, "magic_enum::enum_switch requires bool(char, char) invocable predicate."); + using D = std::decay_t; + + if (const auto v = enum_cast(name, std::forward(p))) { + return enum_switch(std::forward(lambda), *v, std::forward(result)); + } + return std::forward(result); + } + + template + constexpr auto enum_switch(Lambda&& lambda, underlying_type_t value) -> detail::enable_if_t { + using D = std::decay_t; + + if (const auto v = enum_cast(value)) { + return enum_switch(std::forward(lambda), *v); + } + return detail::default_result_type_lambda(); + } + + template + constexpr auto enum_switch(Lambda&& lambda, underlying_type_t value, Result&& result) -> detail::enable_if_t { + using D = std::decay_t; + + if (const auto v = enum_cast(value)) { + return enum_switch(std::forward(lambda), *v, std::forward(result)); + } + return std::forward(result); + } + + template + constexpr auto enum_for_each(Lambda&& lambda) { + using D = std::decay_t; + static_assert(std::is_enum_v, "magic_enum::enum_for_each requires enum type."); + + return detail::for_each(std::forward(lambda), std::make_index_sequence>{}); + } + + namespace ostream_operators { + + template = 0> + std::basic_ostream& operator<<(std::basic_ostream& os, E value) { + using D = std::decay_t; + using U = underlying_type_t; + + if constexpr (detail::supported::value) { + if (const auto name = enum_flags_name(value); !name.empty()) { + for (const auto c : name) { + os.put(c); + } + return os; + } + } + return (os << static_cast(value)); + } + + template = 0> + std::basic_ostream& operator<<(std::basic_ostream& os, optional value) { + return value ? (os << *value) : os; + } + + } // namespace magic_enum::ostream_operators + + namespace istream_operators { + + template = 0> + std::basic_istream& operator>>(std::basic_istream& is, E& value) { + using D = std::decay_t; + + std::basic_string s; + is >> s; + if (const auto v = enum_cast(s)) { + value = *v; + } else { + is.setstate(std::basic_ios::failbit); + } + return is; + } + + } // namespace magic_enum::istream_operators + + namespace iostream_operators { + + using namespace ostream_operators; + using namespace istream_operators; + + } // namespace magic_enum::iostream_operators + + namespace bitwise_operators { + + template = 0> + constexpr E operator~(E rhs) noexcept { + return static_cast(~static_cast>(rhs)); + } + + template = 0> + constexpr E operator|(E lhs, E rhs) noexcept { + return static_cast(static_cast>(lhs) | static_cast>(rhs)); + } + + template = 0> + constexpr E operator&(E lhs, E rhs) noexcept { + return static_cast(static_cast>(lhs) & static_cast>(rhs)); + } + + template = 0> + constexpr E operator^(E lhs, E rhs) noexcept { + return static_cast(static_cast>(lhs) ^ static_cast>(rhs)); + } + + template = 0> + constexpr E& operator|=(E& lhs, E rhs) noexcept { + return lhs = (lhs | rhs); + } + + template = 0> + constexpr E& operator&=(E& lhs, E rhs) noexcept { + return lhs = (lhs & rhs); + } + + template = 0> + constexpr E& operator^=(E& lhs, E rhs) noexcept { + return lhs = (lhs ^ rhs); + } + + } // namespace magic_enum::bitwise_operators + +} // namespace magic_enum + +#if defined(__clang__) +# pragma clang diagnostic pop +#elif defined(__GNUC__) +# pragma GCC diagnostic pop +#elif defined(_MSC_VER) +# pragma warning(pop) +#endif + +#endif // NEARGYE_MAGIC_ENUM_HPP \ No newline at end of file diff --git a/main.cpp b/main.cpp new file mode 100644 index 0000000..5da6bc4 --- /dev/null +++ b/main.cpp @@ -0,0 +1,14 @@ +#include +#include "src/utf.h" + +int main() { + std::string text = "今天12"; + + for (int i = 0; i < text.length();) { + auto p = ts::charCodeAt(text, i); + std::cout << p.code << std::endl; + i += p.length; + } + + return 0; +} diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt new file mode 100644 index 0000000..cd0b5f1 --- /dev/null +++ b/src/CMakeLists.txt @@ -0,0 +1,10 @@ +cmake_minimum_required(VERSION 3.22) +project(typescript) + +add_definitions(-DTRACY_ENABLE) + +add_subdirectory(tests) + +#add_library(typescript parser.cpp scanner.cpp utf.cpp syntax_cursor.cpp syntax_cursor.h ast.h parser2.h) +add_library(typescript scanner.cpp utf.cpp syntax_cursor.cpp syntax_cursor.h ast.h parser2.h types.cpp factory.h node_test.h) +#add_library(typescript scanner.cpp utf.cpp syntax_cursor.cpp syntax_cursor.h ast.h) \ No newline at end of file diff --git a/src/ast.h b/src/ast.h new file mode 100644 index 0000000..2d35093 --- /dev/null +++ b/src/ast.h @@ -0,0 +1,515 @@ +#pragma once + +#include +#include "types.h" + +using namespace ts; +using namespace ts::types; + +inline bool forEachChild(Node *node, function cbNode,function cbNodes) { + if (node == nullptr || node->kind <= SyntaxKind::LastToken) { + return false; + } + switch (node->kind) { + case SyntaxKind::QualifiedName: + return visitNode(cbNode, (node as QualifiedName).left) || + visitNode(cbNode, (node as QualifiedName).right); + case SyntaxKind::TypeParameter: + return visitNodes(cbNode, cbNodes, node.modifiers) || + visitNode(cbNode, (node as TypeParameterDeclaration).name) || + visitNode(cbNode, (node as TypeParameterDeclaration).constraint) || + visitNode(cbNode, (node as TypeParameterDeclaration).default) || + visitNode(cbNode, (node as TypeParameterDeclaration).expression); + case SyntaxKind::ShorthandPropertyAssignment: + return visitNodes(cbNode, cbNodes, node.decorators) || + visitNodes(cbNode, cbNodes, node.modifiers) || + visitNode(cbNode, (node as ShorthandPropertyAssignment).name) || + visitNode(cbNode, (node as ShorthandPropertyAssignment).questionToken) || + visitNode(cbNode, (node as ShorthandPropertyAssignment).exclamationToken) || + visitNode(cbNode, (node as ShorthandPropertyAssignment).equalsToken) || + visitNode(cbNode, (node as ShorthandPropertyAssignment).objectAssignmentInitializer); + case SyntaxKind::SpreadAssignment: + return visitNode(cbNode, (node as SpreadAssignment).expression); + case SyntaxKind::Parameter: + return visitNodes(cbNode, cbNodes, node.decorators) || + visitNodes(cbNode, cbNodes, node.modifiers) || + visitNode(cbNode, (node as ParameterDeclaration).dotDotDotToken) || + visitNode(cbNode, (node as ParameterDeclaration).name) || + visitNode(cbNode, (node as ParameterDeclaration).questionToken) || + visitNode(cbNode, (node as ParameterDeclaration).type) || + visitNode(cbNode, (node as ParameterDeclaration).initializer); + case SyntaxKind::PropertyDeclaration: + return visitNodes(cbNode, cbNodes, node.decorators) || + visitNodes(cbNode, cbNodes, node.modifiers) || + visitNode(cbNode, (node as PropertyDeclaration).name) || + visitNode(cbNode, (node as PropertyDeclaration).questionToken) || + visitNode(cbNode, (node as PropertyDeclaration).exclamationToken) || + visitNode(cbNode, (node as PropertyDeclaration).type) || + visitNode(cbNode, (node as PropertyDeclaration).initializer); + case SyntaxKind::PropertySignature: + return visitNodes(cbNode, cbNodes, node.decorators) || + visitNodes(cbNode, cbNodes, node.modifiers) || + visitNode(cbNode, (node as PropertySignature).name) || + visitNode(cbNode, (node as PropertySignature).questionToken) || + visitNode(cbNode, (node as PropertySignature).type) || + visitNode(cbNode, (node as PropertySignature).initializer); + case SyntaxKind::PropertyAssignment: + return visitNodes(cbNode, cbNodes, node.decorators) || + visitNodes(cbNode, cbNodes, node.modifiers) || + visitNode(cbNode, (node as PropertyAssignment).name) || + visitNode(cbNode, (node as PropertyAssignment).questionToken) || + visitNode(cbNode, (node as PropertyAssignment).initializer); + case SyntaxKind::VariableDeclaration: + return visitNodes(cbNode, cbNodes, node.decorators) || + visitNodes(cbNode, cbNodes, node.modifiers) || + visitNode(cbNode, (node as VariableDeclaration).name) || + visitNode(cbNode, (node as VariableDeclaration).exclamationToken) || + visitNode(cbNode, (node as VariableDeclaration).type) || + visitNode(cbNode, (node as VariableDeclaration).initializer); + case SyntaxKind::BindingElement: + return visitNodes(cbNode, cbNodes, node.decorators) || + visitNodes(cbNode, cbNodes, node.modifiers) || + visitNode(cbNode, (node as BindingElement).dotDotDotToken) || + visitNode(cbNode, (node as BindingElement).propertyName) || + visitNode(cbNode, (node as BindingElement).name) || + visitNode(cbNode, (node as BindingElement).initializer); + case SyntaxKind::FunctionType: + case SyntaxKind::ConstructorType: + case SyntaxKind::CallSignature: + case SyntaxKind::ConstructSignature: + case SyntaxKind::IndexSignature: + return visitNodes(cbNode, cbNodes, node.decorators) || + visitNodes(cbNode, cbNodes, node.modifiers) || + visitNodes(cbNode, cbNodes, (node as SignatureDeclaration).typeParameters) || + visitNodes(cbNode, cbNodes, (node as SignatureDeclaration).parameters) || + visitNode(cbNode, (node as SignatureDeclaration).type); + case SyntaxKind::MethodDeclaration: + case SyntaxKind::MethodSignature: + case SyntaxKind::Constructor: + case SyntaxKind::GetAccessor: + case SyntaxKind::SetAccessor: + case SyntaxKind::FunctionExpression: + case SyntaxKind::FunctionDeclaration: + case SyntaxKind::ArrowFunction: + return visitNodes(cbNode, cbNodes, node.decorators) || + visitNodes(cbNode, cbNodes, node.modifiers) || + visitNode(cbNode, (node as FunctionLikeDeclaration).asteriskToken) || + visitNode(cbNode, (node as FunctionLikeDeclaration).name) || + visitNode(cbNode, (node as FunctionLikeDeclaration).questionToken) || + visitNode(cbNode, (node as FunctionLikeDeclaration).exclamationToken) || + visitNodes(cbNode, cbNodes, (node as FunctionLikeDeclaration).typeParameters) || + visitNodes(cbNode, cbNodes, (node as FunctionLikeDeclaration).parameters) || + visitNode(cbNode, (node as FunctionLikeDeclaration).type) || + visitNode(cbNode, (node as ArrowFunction).equalsGreaterThanToken) || + visitNode(cbNode, (node as FunctionLikeDeclaration).body); + case SyntaxKind::ClassStaticBlockDeclaration: + return visitNodes(cbNode, cbNodes, node.decorators) || + visitNodes(cbNode, cbNodes, node.modifiers) || + visitNode(cbNode, (node as ClassStaticBlockDeclaration).body); + case SyntaxKind::TypeReference: + return visitNode(cbNode, (node as TypeReferenceNode).typeName) || + visitNodes(cbNode, cbNodes, (node as TypeReferenceNode).typeArguments); + case SyntaxKind::TypePredicate: + return visitNode(cbNode, (node as TypePredicateNode).assertsModifier) || + visitNode(cbNode, (node as TypePredicateNode).parameterName) || + visitNode(cbNode, (node as TypePredicateNode).type); + case SyntaxKind::TypeQuery: + return visitNode(cbNode, (node as TypeQueryNode).exprName) || + visitNodes(cbNode, cbNodes, (node as TypeQueryNode).typeArguments); + case SyntaxKind::TypeLiteral: + return visitNodes(cbNode, cbNodes, (node as TypeLiteralNode).members); + case SyntaxKind::ArrayType: + return visitNode(cbNode, (node as ArrayTypeNode).elementType); + case SyntaxKind::TupleType: + return visitNodes(cbNode, cbNodes, (node as TupleTypeNode).elements); + case SyntaxKind::UnionType: + case SyntaxKind::IntersectionType: + return visitNodes(cbNode, cbNodes, (node as UnionOrIntersectionTypeNode).types); + case SyntaxKind::ConditionalType: + return visitNode(cbNode, (node as ConditionalTypeNode).checkType) || + visitNode(cbNode, (node as ConditionalTypeNode).extendsType) || + visitNode(cbNode, (node as ConditionalTypeNode).trueType) || + visitNode(cbNode, (node as ConditionalTypeNode).falseType); + case SyntaxKind::InferType: + return visitNode(cbNode, (node as InferTypeNode).typeParameter); + case SyntaxKind::ImportType: + return visitNode(cbNode, (node as ImportTypeNode).argument) || + visitNode(cbNode, (node as ImportTypeNode).assertions) || + visitNode(cbNode, (node as ImportTypeNode).qualifier) || + visitNodes(cbNode, cbNodes, (node as ImportTypeNode).typeArguments); + case SyntaxKind::ImportTypeAssertionContainer: + return visitNode(cbNode, (node as ImportTypeAssertionContainer).assertClause); + case SyntaxKind::ParenthesizedType: + case SyntaxKind::TypeOperator: + return visitNode(cbNode, (node as ParenthesizedTypeNode | TypeOperatorNode).type); + case SyntaxKind::IndexedAccessType: + return visitNode(cbNode, (node as IndexedAccessTypeNode).objectType) || + visitNode(cbNode, (node as IndexedAccessTypeNode).indexType); + case SyntaxKind::MappedType: + return visitNode(cbNode, (node as MappedTypeNode).readonlyToken) || + visitNode(cbNode, (node as MappedTypeNode).typeParameter) || + visitNode(cbNode, (node as MappedTypeNode).nameType) || + visitNode(cbNode, (node as MappedTypeNode).questionToken) || + visitNode(cbNode, (node as MappedTypeNode).type) || + visitNodes(cbNode, cbNodes, (node as MappedTypeNode).members); + case SyntaxKind::LiteralType: + return visitNode(cbNode, (node as LiteralTypeNode).literal); + case SyntaxKind::NamedTupleMember: + return visitNode(cbNode, (node as NamedTupleMember).dotDotDotToken) || + visitNode(cbNode, (node as NamedTupleMember).name) || + visitNode(cbNode, (node as NamedTupleMember).questionToken) || + visitNode(cbNode, (node as NamedTupleMember).type); + case SyntaxKind::ObjectBindingPattern: + case SyntaxKind::ArrayBindingPattern: + return visitNodes(cbNode, cbNodes, (node as BindingPattern).elements); + case SyntaxKind::ArrayLiteralExpression: + return visitNodes(cbNode, cbNodes, (node as ArrayLiteralExpression).elements); + case SyntaxKind::ObjectLiteralExpression: + return visitNodes(cbNode, cbNodes, (node as ObjectLiteralExpression).properties); + case SyntaxKind::PropertyAccessExpression: + return visitNode(cbNode, (node as PropertyAccessExpression).expression) || + visitNode(cbNode, (node as PropertyAccessExpression).questionDotToken) || + visitNode(cbNode, (node as PropertyAccessExpression).name); + case SyntaxKind::ElementAccessExpression: + return visitNode(cbNode, (node as ElementAccessExpression).expression) || + visitNode(cbNode, (node as ElementAccessExpression).questionDotToken) || + visitNode(cbNode, (node as ElementAccessExpression).argumentExpression); + case SyntaxKind::CallExpression: + case SyntaxKind::NewExpression: + return visitNode(cbNode, (node as CallExpression).expression) || + visitNode(cbNode, (node as CallExpression).questionDotToken) || + visitNodes(cbNode, cbNodes, (node as CallExpression).typeArguments) || + visitNodes(cbNode, cbNodes, (node as CallExpression).arguments); + case SyntaxKind::TaggedTemplateExpression: + return visitNode(cbNode, (node as TaggedTemplateExpression).tag) || + visitNode(cbNode, (node as TaggedTemplateExpression).questionDotToken) || + visitNodes(cbNode, cbNodes, (node as TaggedTemplateExpression).typeArguments) || + visitNode(cbNode, (node as TaggedTemplateExpression).template); + case SyntaxKind::TypeAssertionExpression: + return visitNode(cbNode, (node as TypeAssertion).type) || + visitNode(cbNode, (node as TypeAssertion).expression); + case SyntaxKind::ParenthesizedExpression: + return visitNode(cbNode, (node as ParenthesizedExpression).expression); + case SyntaxKind::DeleteExpression: + return visitNode(cbNode, (node as DeleteExpression).expression); + case SyntaxKind::TypeOfExpression: + return visitNode(cbNode, (node as TypeOfExpression).expression); + case SyntaxKind::VoidExpression: + return visitNode(cbNode, (node as VoidExpression).expression); + case SyntaxKind::PrefixUnaryExpression: + return visitNode(cbNode, (node as PrefixUnaryExpression).operand); + case SyntaxKind::YieldExpression: + return visitNode(cbNode, (node as YieldExpression).asteriskToken) || + visitNode(cbNode, (node as YieldExpression).expression); + case SyntaxKind::AwaitExpression: + return visitNode(cbNode, (node as AwaitExpression).expression); + case SyntaxKind::PostfixUnaryExpression: + return visitNode(cbNode, (node as PostfixUnaryExpression).operand); + case SyntaxKind::BinaryExpression: + return visitNode(cbNode, (node as BinaryExpression).left) || + visitNode(cbNode, (node as BinaryExpression).operatorToken) || + visitNode(cbNode, (node as BinaryExpression).right); + case SyntaxKind::AsExpression: + return visitNode(cbNode, (node as AsExpression).expression) || + visitNode(cbNode, (node as AsExpression).type); + case SyntaxKind::NonNullExpression: + return visitNode(cbNode, (node as NonNullExpression).expression); + case SyntaxKind::MetaProperty: + return visitNode(cbNode, (node as MetaProperty).name); + case SyntaxKind::ConditionalExpression: + return visitNode(cbNode, (node as ConditionalExpression).condition) || + visitNode(cbNode, (node as ConditionalExpression).questionToken) || + visitNode(cbNode, (node as ConditionalExpression).whenTrue) || + visitNode(cbNode, (node as ConditionalExpression).colonToken) || + visitNode(cbNode, (node as ConditionalExpression).whenFalse); + case SyntaxKind::SpreadElement: + return visitNode(cbNode, (node as SpreadElement).expression); + case SyntaxKind::Block: + case SyntaxKind::ModuleBlock: + return visitNodes(cbNode, cbNodes, (node as Block).statements); + case SyntaxKind::SourceFile: + return visitNodes(cbNode, cbNodes, (node as SourceFile).statements) || + visitNode(cbNode, (node as SourceFile).endOfFileToken); + case SyntaxKind::VariableStatement: + return visitNodes(cbNode, cbNodes, node.decorators) || + visitNodes(cbNode, cbNodes, node.modifiers) || + visitNode(cbNode, (node as VariableStatement).declarationList); + case SyntaxKind::VariableDeclarationList: + return visitNodes(cbNode, cbNodes, (node as VariableDeclarationList).declarations); + case SyntaxKind::ExpressionStatement: + return visitNode(cbNode, (node as ExpressionStatement).expression); + case SyntaxKind::IfStatement: + return visitNode(cbNode, (node as IfStatement).expression) || + visitNode(cbNode, (node as IfStatement).thenStatement) || + visitNode(cbNode, (node as IfStatement).elseStatement); + case SyntaxKind::DoStatement: + return visitNode(cbNode, (node as DoStatement).statement) || + visitNode(cbNode, (node as DoStatement).expression); + case SyntaxKind::WhileStatement: + return visitNode(cbNode, (node as WhileStatement).expression) || + visitNode(cbNode, (node as WhileStatement).statement); + case SyntaxKind::ForStatement: + return visitNode(cbNode, (node as ForStatement).initializer) || + visitNode(cbNode, (node as ForStatement).condition) || + visitNode(cbNode, (node as ForStatement).incrementor) || + visitNode(cbNode, (node as ForStatement).statement); + case SyntaxKind::ForInStatement: + return visitNode(cbNode, (node as ForInStatement).initializer) || + visitNode(cbNode, (node as ForInStatement).expression) || + visitNode(cbNode, (node as ForInStatement).statement); + case SyntaxKind::ForOfStatement: + return visitNode(cbNode, (node as ForOfStatement).awaitModifier) || + visitNode(cbNode, (node as ForOfStatement).initializer) || + visitNode(cbNode, (node as ForOfStatement).expression) || + visitNode(cbNode, (node as ForOfStatement).statement); + case SyntaxKind::ContinueStatement: + case SyntaxKind::BreakStatement: + return visitNode(cbNode, (node as BreakOrContinueStatement).label); + case SyntaxKind::ReturnStatement: + return visitNode(cbNode, (node as ReturnStatement).expression); + case SyntaxKind::WithStatement: + return visitNode(cbNode, (node as WithStatement).expression) || + visitNode(cbNode, (node as WithStatement).statement); + case SyntaxKind::SwitchStatement: + return visitNode(cbNode, (node as SwitchStatement).expression) || + visitNode(cbNode, (node as SwitchStatement).caseBlock); + case SyntaxKind::CaseBlock: + return visitNodes(cbNode, cbNodes, (node as CaseBlock).clauses); + case SyntaxKind::CaseClause: + return visitNode(cbNode, (node as CaseClause).expression) || + visitNodes(cbNode, cbNodes, (node as CaseClause).statements); + case SyntaxKind::DefaultClause: + return visitNodes(cbNode, cbNodes, (node as DefaultClause).statements); + case SyntaxKind::LabeledStatement: + return visitNode(cbNode, (node as LabeledStatement).label) || + visitNode(cbNode, (node as LabeledStatement).statement); + case SyntaxKind::ThrowStatement: + return visitNode(cbNode, (node as ThrowStatement).expression); + case SyntaxKind::TryStatement: + return visitNode(cbNode, (node as TryStatement).tryBlock) || + visitNode(cbNode, (node as TryStatement).catchClause) || + visitNode(cbNode, (node as TryStatement).finallyBlock); + case SyntaxKind::CatchClause: + return visitNode(cbNode, (node as CatchClause).variableDeclaration) || + visitNode(cbNode, (node as CatchClause).block); + case SyntaxKind::Decorator: + return visitNode(cbNode, (node as Decorator).expression); + case SyntaxKind::ClassDeclaration: + case SyntaxKind::ClassExpression: + return visitNodes(cbNode, cbNodes, node.decorators) || + visitNodes(cbNode, cbNodes, node.modifiers) || + visitNode(cbNode, (node as ClassLikeDeclaration).name) || + visitNodes(cbNode, cbNodes, (node as ClassLikeDeclaration).typeParameters) || + visitNodes(cbNode, cbNodes, (node as ClassLikeDeclaration).heritageClauses) || + visitNodes(cbNode, cbNodes, (node as ClassLikeDeclaration).members); + case SyntaxKind::InterfaceDeclaration: + return visitNodes(cbNode, cbNodes, node.decorators) || + visitNodes(cbNode, cbNodes, node.modifiers) || + visitNode(cbNode, (node as InterfaceDeclaration).name) || + visitNodes(cbNode, cbNodes, (node as InterfaceDeclaration).typeParameters) || + visitNodes(cbNode, cbNodes, (node as ClassDeclaration).heritageClauses) || + visitNodes(cbNode, cbNodes, (node as InterfaceDeclaration).members); + case SyntaxKind::TypeAliasDeclaration: + return visitNodes(cbNode, cbNodes, node.decorators) || + visitNodes(cbNode, cbNodes, node.modifiers) || + visitNode(cbNode, (node as TypeAliasDeclaration).name) || + visitNodes(cbNode, cbNodes, (node as TypeAliasDeclaration).typeParameters) || + visitNode(cbNode, (node as TypeAliasDeclaration).type); + case SyntaxKind::EnumDeclaration: + return visitNodes(cbNode, cbNodes, node.decorators) || + visitNodes(cbNode, cbNodes, node.modifiers) || + visitNode(cbNode, (node as EnumDeclaration).name) || + visitNodes(cbNode, cbNodes, (node as EnumDeclaration).members); + case SyntaxKind::EnumMember: + return visitNode(cbNode, (node as EnumMember).name) || + visitNode(cbNode, (node as EnumMember).initializer); + case SyntaxKind::ModuleDeclaration: + return visitNodes(cbNode, cbNodes, node.decorators) || + visitNodes(cbNode, cbNodes, node.modifiers) || + visitNode(cbNode, (node as ModuleDeclaration).name) || + visitNode(cbNode, (node as ModuleDeclaration).body); + case SyntaxKind::ImportEqualsDeclaration: + return visitNodes(cbNode, cbNodes, node.decorators) || + visitNodes(cbNode, cbNodes, node.modifiers) || + visitNode(cbNode, (node as ImportEqualsDeclaration).name) || + visitNode(cbNode, (node as ImportEqualsDeclaration).moduleReference); + case SyntaxKind::ImportDeclaration: + return visitNodes(cbNode, cbNodes, node.decorators) || + visitNodes(cbNode, cbNodes, node.modifiers) || + visitNode(cbNode, (node as ImportDeclaration).importClause) || + visitNode(cbNode, (node as ImportDeclaration).moduleSpecifier) || + visitNode(cbNode, (node as ImportDeclaration).assertClause); + case SyntaxKind::ImportClause: + return visitNode(cbNode, (node as ImportClause).name) || + visitNode(cbNode, (node as ImportClause).namedBindings); + case SyntaxKind::AssertClause: + return visitNodes(cbNode, cbNodes, (node as AssertClause).elements); + case SyntaxKind::AssertEntry: + return visitNode(cbNode, (node as AssertEntry).name) || + visitNode(cbNode, (node as AssertEntry).value); + case SyntaxKind::NamespaceExportDeclaration: + return visitNode(cbNode, (node as NamespaceExportDeclaration).name); + case SyntaxKind::NamespaceImport: + return visitNode(cbNode, (node as NamespaceImport).name); + case SyntaxKind::NamespaceExport: + return visitNode(cbNode, (node as NamespaceExport).name); + case SyntaxKind::NamedImports: + case SyntaxKind::NamedExports: + return visitNodes(cbNode, cbNodes, (node as NamedImportsOrExports).elements); + case SyntaxKind::ExportDeclaration: + return visitNodes(cbNode, cbNodes, node.decorators) || + visitNodes(cbNode, cbNodes, node.modifiers) || + visitNode(cbNode, (node as ExportDeclaration).exportClause) || + visitNode(cbNode, (node as ExportDeclaration).moduleSpecifier) || + visitNode(cbNode, (node as ExportDeclaration).assertClause); + case SyntaxKind::ImportSpecifier: + case SyntaxKind::ExportSpecifier: + return visitNode(cbNode, (node as ImportOrExportSpecifier).propertyName) || + visitNode(cbNode, (node as ImportOrExportSpecifier).name); + case SyntaxKind::ExportAssignment: + return visitNodes(cbNode, cbNodes, node.decorators) || + visitNodes(cbNode, cbNodes, node.modifiers) || + visitNode(cbNode, (node as ExportAssignment).expression); + case SyntaxKind::TemplateExpression: + return visitNode(cbNode, (node as TemplateExpression).head) || visitNodes(cbNode, cbNodes, (node as TemplateExpression).templateSpans); + case SyntaxKind::TemplateSpan: + return visitNode(cbNode, (node as TemplateSpan).expression) || visitNode(cbNode, (node as TemplateSpan).literal); + case SyntaxKind::TemplateLiteralType: + return visitNode(cbNode, (node as TemplateLiteralTypeNode).head) || visitNodes(cbNode, cbNodes, (node as TemplateLiteralTypeNode).templateSpans); + case SyntaxKind::TemplateLiteralTypeSpan: + return visitNode(cbNode, (node as TemplateLiteralTypeSpan).type) || visitNode(cbNode, (node as TemplateLiteralTypeSpan).literal); + case SyntaxKind::ComputedPropertyName: + return visitNode(cbNode, (node as ComputedPropertyName).expression); + case SyntaxKind::HeritageClause: + return visitNodes(cbNode, cbNodes, (node as HeritageClause).types); + case SyntaxKind::ExpressionWithTypeArguments: + return visitNode(cbNode, (node as ExpressionWithTypeArguments).expression) || + visitNodes(cbNode, cbNodes, (node as ExpressionWithTypeArguments).typeArguments); + case SyntaxKind::ExternalModuleReference: + return visitNode(cbNode, (node as ExternalModuleReference).expression); + case SyntaxKind::MissingDeclaration: + return visitNodes(cbNode, cbNodes, node.decorators); + case SyntaxKind::CommaListExpression: + return visitNodes(cbNode, cbNodes, (node as CommaListExpression).elements); + + case SyntaxKind::JsxElement: + return visitNode(cbNode, (node as JsxElement).openingElement) || + visitNodes(cbNode, cbNodes, (node as JsxElement).children) || + visitNode(cbNode, (node as JsxElement).closingElement); + case SyntaxKind::JsxFragment: + return visitNode(cbNode, (node as JsxFragment).openingFragment) || + visitNodes(cbNode, cbNodes, (node as JsxFragment).children) || + visitNode(cbNode, (node as JsxFragment).closingFragment); + case SyntaxKind::JsxSelfClosingElement: + case SyntaxKind::JsxOpeningElement: + return visitNode(cbNode, (node as JsxOpeningLikeElement).tagName) || + visitNodes(cbNode, cbNodes, (node as JsxOpeningLikeElement).typeArguments) || + visitNode(cbNode, (node as JsxOpeningLikeElement).attributes); + case SyntaxKind::JsxAttributes: + return visitNodes(cbNode, cbNodes, (node as JsxAttributes).properties); + case SyntaxKind::JsxAttribute: + return visitNode(cbNode, (node as JsxAttribute).name) || + visitNode(cbNode, (node as JsxAttribute).initializer); + case SyntaxKind::JsxSpreadAttribute: + return visitNode(cbNode, (node as JsxSpreadAttribute).expression); + case SyntaxKind::JsxExpression: + return visitNode(cbNode, (node as JsxExpression).dotDotDotToken) || + visitNode(cbNode, (node as JsxExpression).expression); + case SyntaxKind::JsxClosingElement: + return visitNode(cbNode, (node as JsxClosingElement).tagName); + + case SyntaxKind::OptionalType: + case SyntaxKind::RestType: + case SyntaxKind::JSDocTypeExpression: + case SyntaxKind::JSDocNonNullableType: + case SyntaxKind::JSDocNullableType: + case SyntaxKind::JSDocOptionalType: + case SyntaxKind::JSDocVariadicType: + return visitNode(cbNode, (node as OptionalTypeNode | RestTypeNode | JSDocTypeExpression | JSDocTypeReferencingNode).type); + case SyntaxKind::JSDocFunctionType: + return visitNodes(cbNode, cbNodes, (node as JSDocFunctionType).parameters) || + visitNode(cbNode, (node as JSDocFunctionType).type); + case SyntaxKind::JSDoc: + return (typeof (node as JSDoc).comment === "string" ? undefined : visitNodes(cbNode, cbNodes, (node as JSDoc).comment as NodeArray | undefined)) + || visitNodes(cbNode, cbNodes, (node as JSDoc).tags); + case SyntaxKind::JSDocSeeTag: + return visitNode(cbNode, (node as JSDocSeeTag).tagName) || + visitNode(cbNode, (node as JSDocSeeTag).name) || + (typeof (node as JSDoc).comment === "string" ? undefined : visitNodes(cbNode, cbNodes, (node as JSDoc).comment as NodeArray | undefined)); + case SyntaxKind::JSDocNameReference: + return visitNode(cbNode, (node as JSDocNameReference).name); + case SyntaxKind::JSDocMemberName: + return visitNode(cbNode, (node as JSDocMemberName).left) || + visitNode(cbNode, (node as JSDocMemberName).right); + case SyntaxKind::JSDocParameterTag: + case SyntaxKind::JSDocPropertyTag: + return visitNode(cbNode, (node as JSDocTag).tagName) || + ((node as JSDocPropertyLikeTag).isNameFirst + ? visitNode(cbNode, (node as JSDocPropertyLikeTag).name) || + visitNode(cbNode, (node as JSDocPropertyLikeTag).typeExpression) || + (typeof (node as JSDoc).comment === "string" ? undefined : visitNodes(cbNode, cbNodes, (node as JSDoc).comment as NodeArray | undefined)) + : visitNode(cbNode, (node as JSDocPropertyLikeTag).typeExpression) || + visitNode(cbNode, (node as JSDocPropertyLikeTag).name) || + (typeof (node as JSDoc).comment === "string" ? undefined : visitNodes(cbNode, cbNodes, (node as JSDoc).comment as NodeArray | undefined))); + case SyntaxKind::JSDocAuthorTag: + return visitNode(cbNode, (node as JSDocTag).tagName) || + (typeof (node as JSDoc).comment === "string" ? undefined : visitNodes(cbNode, cbNodes, (node as JSDoc).comment as NodeArray | undefined)); + case SyntaxKind::JSDocImplementsTag: + return visitNode(cbNode, (node as JSDocTag).tagName) || + visitNode(cbNode, (node as JSDocImplementsTag).class) || + (typeof (node as JSDoc).comment === "string" ? undefined : visitNodes(cbNode, cbNodes, (node as JSDoc).comment as NodeArray | undefined)); + case SyntaxKind::JSDocAugmentsTag: + return visitNode(cbNode, (node as JSDocTag).tagName) || + visitNode(cbNode, (node as JSDocAugmentsTag).class) || + (typeof (node as JSDoc).comment === "string" ? undefined : visitNodes(cbNode, cbNodes, (node as JSDoc).comment as NodeArray | undefined)); + case SyntaxKind::JSDocTemplateTag: + return visitNode(cbNode, (node as JSDocTag).tagName) || + visitNode(cbNode, (node as JSDocTemplateTag).constraint) || + visitNodes(cbNode, cbNodes, (node as JSDocTemplateTag).typeParameters) || + (typeof (node as JSDoc).comment === "string" ? undefined : visitNodes(cbNode, cbNodes, (node as JSDoc).comment as NodeArray | undefined)); + case SyntaxKind::JSDocTypedefTag: + return visitNode(cbNode, (node as JSDocTag).tagName) || + ((node as JSDocTypedefTag).typeExpression && + (node as JSDocTypedefTag).typeExpression!.kind === SyntaxKind::JSDocTypeExpression + ? visitNode(cbNode, (node as JSDocTypedefTag).typeExpression) || + visitNode(cbNode, (node as JSDocTypedefTag).fullName) || + (typeof (node as JSDoc).comment === "string" ? undefined : visitNodes(cbNode, cbNodes, (node as JSDoc).comment as NodeArray | undefined)) + : visitNode(cbNode, (node as JSDocTypedefTag).fullName) || + visitNode(cbNode, (node as JSDocTypedefTag).typeExpression) || + (typeof (node as JSDoc).comment === "string" ? undefined : visitNodes(cbNode, cbNodes, (node as JSDoc).comment as NodeArray | undefined))); + case SyntaxKind::JSDocCallbackTag: + return visitNode(cbNode, (node as JSDocTag).tagName) || + visitNode(cbNode, (node as JSDocCallbackTag).fullName) || + visitNode(cbNode, (node as JSDocCallbackTag).typeExpression) || + (typeof (node as JSDoc).comment === "string" ? undefined : visitNodes(cbNode, cbNodes, (node as JSDoc).comment as NodeArray | undefined)); + case SyntaxKind::JSDocReturnTag: + case SyntaxKind::JSDocTypeTag: + case SyntaxKind::JSDocThisTag: + case SyntaxKind::JSDocEnumTag: + return visitNode(cbNode, (node as JSDocTag).tagName) || + visitNode(cbNode, (node as JSDocReturnTag | JSDocTypeTag | JSDocThisTag | JSDocEnumTag).typeExpression) || + (typeof (node as JSDoc).comment === "string" ? undefined : visitNodes(cbNode, cbNodes, (node as JSDoc).comment as NodeArray | undefined)); + case SyntaxKind::JSDocSignature: + return forEach((node as JSDocSignature).typeParameters, cbNode) || + forEach((node as JSDocSignature).parameters, cbNode) || + visitNode(cbNode, (node as JSDocSignature).type); + case SyntaxKind::JSDocLink: + case SyntaxKind::JSDocLinkCode: + case SyntaxKind::JSDocLinkPlain: + return visitNode(cbNode, (node as JSDocLink | JSDocLinkCode | JSDocLinkPlain).name); + case SyntaxKind::JSDocTypeLiteral: + return forEach((node as JSDocTypeLiteral).jsDocPropertyTags, cbNode); + case SyntaxKind::JSDocTag: + case SyntaxKind::JSDocClassTag: + case SyntaxKind::JSDocPublicTag: + case SyntaxKind::JSDocPrivateTag: + case SyntaxKind::JSDocProtectedTag: + case SyntaxKind::JSDocReadonlyTag: + case SyntaxKind::JSDocDeprecatedTag: + return visitNode(cbNode, (node as JSDocTag).tagName) + || (typeof (node as JSDoc).comment === "string" ? undefined : visitNodes(cbNode, cbNodes, (node as JSDoc).comment as NodeArray | undefined)); + case SyntaxKind::PartiallyEmittedExpression: + return visitNode(cbNode, (node as PartiallyEmittedExpression).expression); + } +} + diff --git a/src/core.h b/src/core.h new file mode 100644 index 0000000..03318bb --- /dev/null +++ b/src/core.h @@ -0,0 +1,104 @@ +#pragma once + +#include +#include +#include +#include +#include +#include + +namespace ts { + using namespace std; + + inline string trimStringStart(string s) { + while (s.compare(0, 1, " ") == 0) s.erase(s.begin()); + return s; + } + + inline string trimStringEnd(string s) { + while (s.size() > 0 && s.compare(s.size() - 1, 1, " ") == 0) s.erase(s.end() - 1); + return s; + } + + template + inline bool some(optional> array, optional> predicate) { + //inline bool some(vector array, std::function predicate) { + //inline bool some(optional> array) { + if (array) { + if (predicate) { + for (auto &v: (*array)) { + if ((*predicate)(v)) { + return true; + } + } + } else { + return (*array).size() > 0; + } + } + return false; + }; + + //inline bool some(optional array, std::function predicate) { + template + inline bool some(vector array, std::function predicate) { + return some(optional(array), optional(predicate)); + } + + template + class LogicalOrReturnLast { + protected: + T value; + public: + LogicalOrReturnLast(T value) : value(value) {} + operator T() { return value; } + LogicalOrReturnLast operator||(LogicalOrReturnLast other) { + if (value) return *this; + + return other; + } + LogicalOrReturnLast operator||(T other) { + if (value) return *this; + + return LogicalOrReturnLast(other); + } + }; + + //template + //inline bool some(ts::NodeArray array, std::function predicate) { + // return some(optional(array.list), optional(predicate)); + //} + + /** + * Filters vector by filter in-place. + */ + template + static void remove(vector &vector, const Func &filter) { + auto new_end = remove_if(vector.begin(), vector.end(), filter); + vector.erase(new_end, vector.end()); + }; + + template + static void remove(vector &vector, T item) { + vector.erase(remove(vector.begin(), vector.end(), item), vector.end()); + }; + + template + static bool has(vector &vector, T item) { + return find(vector.begin(), vector.end(), item) != vector.end(); + }; + + template + static bool has(const vector &vector, T item) { + return find(vector.begin(), vector.end(), item) != vector.end(); + }; + + template + static bool has(unordered_map &map, T key) { + return map.find(key) != map.end(); + }; + + template + static bool has(map &map, T key) { + return map.find(key) != map.end(); + }; +} diff --git a/src/diagnostic_messages.h b/src/diagnostic_messages.h new file mode 100644 index 0000000..083164a --- /dev/null +++ b/src/diagnostic_messages.h @@ -0,0 +1,1843 @@ +#pragma once + +#include "types.h" +#include +#include + +using namespace ts; + +static DiagnosticMessage diag(int code, DiagnosticCategory category, const std::string &key, const std::string &message, bool reportsUnnecessary = false, bool elidedInCompatabilityPyramid = false, bool reportsDeprecated = false) { + return DiagnosticMessage{code, category, key, message, reportsUnnecessary, elidedInCompatabilityPyramid, reportsDeprecated}; +} + +class Diagnostics { +public: + static inline const auto Unterminated_string_literal = diag(1002, DiagnosticCategory::Error, "Unterminated_string_literal_1002", "Unterminated string literal."); + static inline const auto Identifier_expected = diag(1003, DiagnosticCategory::Error, "Identifier_expected_1003", "Identifier expected."); + static inline const auto _0_expected = diag(1005, DiagnosticCategory::Error, "_0_expected_1005", "'{0}' expected."); + static inline const auto A_file_cannot_have_a_reference_to_itself = diag(1006, DiagnosticCategory::Error, "A_file_cannot_have_a_reference_to_itself_1006", "A file cannot have a reference to itself."); + static inline const auto The_parser_expected_to_find_a_to_match_the_token_here = diag(1007, DiagnosticCategory::Error, "The_parser_expected_to_find_a_to_match_the_token_here_1007", "The parser expected to find a '}' to match the '{' token here."); + static inline const auto Trailing_comma_not_allowed = diag(1009, DiagnosticCategory::Error, "Trailing_comma_not_allowed_1009", "Trailing comma not allowed."); + static inline const auto Asterisk_Slash_expected = diag(1010, DiagnosticCategory::Error, "Asterisk_Slash_expected_1010", "'*/' expected."); + static inline const auto An_element_access_expression_should_take_an_argument = diag(1011, DiagnosticCategory::Error, "An_element_access_expression_should_take_an_argument_1011", "An element access expression should take an argument."); + static inline const auto Unexpected_token = diag(1012, DiagnosticCategory::Error, "Unexpected_token_1012", "Unexpected token."); + static inline const auto A_rest_parameter_or_binding_pattern_may_not_have_a_trailing_comma = diag(1013, DiagnosticCategory::Error, "A_rest_parameter_or_binding_pattern_may_not_have_a_trailing_comma_1013", "A rest parameter or binding pattern may not have a trailing comma."); + static inline const auto A_rest_parameter_must_be_last_in_a_parameter_list = diag(1014, DiagnosticCategory::Error, "A_rest_parameter_must_be_last_in_a_parameter_list_1014", "A rest parameter must be last in a parameter list."); + static inline const auto Parameter_cannot_have_question_mark_and_initializer = diag(1015, DiagnosticCategory::Error, "Parameter_cannot_have_question_mark_and_initializer_1015", "Parameter cannot have question mark and initializer."); + static inline const auto A_required_parameter_cannot_follow_an_optional_parameter = diag(1016, DiagnosticCategory::Error, "A_required_parameter_cannot_follow_an_optional_parameter_1016", "A required parameter cannot follow an optional parameter."); + static inline const auto An_index_signature_cannot_have_a_rest_parameter = diag(1017, DiagnosticCategory::Error, "An_index_signature_cannot_have_a_rest_parameter_1017", "An index signature cannot have a rest parameter."); + static inline const auto An_index_signature_parameter_cannot_have_an_accessibility_modifier = diag(1018, DiagnosticCategory::Error, "An_index_signature_parameter_cannot_have_an_accessibility_modifier_1018", "An index signature parameter cannot have an accessibility modifier."); + static inline const auto An_index_signature_parameter_cannot_have_a_question_mark = diag(1019, DiagnosticCategory::Error, "An_index_signature_parameter_cannot_have_a_question_mark_1019", "An index signature parameter cannot have a question mark."); + static inline const auto An_index_signature_parameter_cannot_have_an_initializer = diag(1020, DiagnosticCategory::Error, "An_index_signature_parameter_cannot_have_an_initializer_1020", "An index signature parameter cannot have an initializer."); + static inline const auto An_index_signature_must_have_a_type_annotation = diag(1021, DiagnosticCategory::Error, "An_index_signature_must_have_a_type_annotation_1021", "An index signature must have a type annotation."); + static inline const auto An_index_signature_parameter_must_have_a_type_annotation = diag(1022, DiagnosticCategory::Error, "An_index_signature_parameter_must_have_a_type_annotation_1022", "An index signature parameter must have a type annotation."); + static inline const auto readonly_modifier_can_only_appear_on_a_property_declaration_or_index_signature = diag(1024, DiagnosticCategory::Error, "readonly_modifier_can_only_appear_on_a_property_declaration_or_index_signature_1024", "'readonly' modifier can only appear on a property declaration or index signature."); + static inline const auto An_index_signature_cannot_have_a_trailing_comma = diag(1025, DiagnosticCategory::Error, "An_index_signature_cannot_have_a_trailing_comma_1025", "An index signature cannot have a trailing comma."); + static inline const auto Accessibility_modifier_already_seen = diag(1028, DiagnosticCategory::Error, "Accessibility_modifier_already_seen_1028", "Accessibility modifier already seen."); + static inline const auto _0_modifier_must_precede_1_modifier = diag(1029, DiagnosticCategory::Error, "_0_modifier_must_precede_1_modifier_1029", "'{0}' modifier must precede '{1}' modifier."); + static inline const auto _0_modifier_already_seen = diag(1030, DiagnosticCategory::Error, "_0_modifier_already_seen_1030", "'{0}' modifier already seen."); + static inline const auto _0_modifier_cannot_appear_on_class_elements_of_this_kind = diag(1031, DiagnosticCategory::Error, "_0_modifier_cannot_appear_on_class_elements_of_this_kind_1031", "'{0}' modifier cannot appear on class elements of this kind."); + static inline const auto super_must_be_followed_by_an_argument_list_or_member_access = diag(1034, DiagnosticCategory::Error, "super_must_be_followed_by_an_argument_list_or_member_access_1034", "'super' must be followed by an argument list or member access."); + static inline const auto Only_ambient_modules_can_use_quoted_names = diag(1035, DiagnosticCategory::Error, "Only_ambient_modules_can_use_quoted_names_1035", "Only ambient modules can use quoted names."); + static inline const auto Statements_are_not_allowed_in_ambient_contexts = diag(1036, DiagnosticCategory::Error, "Statements_are_not_allowed_in_ambient_contexts_1036", "Statements are not allowed in ambient contexts."); + static inline const auto A_declare_modifier_cannot_be_used_in_an_already_ambient_context = diag(1038, DiagnosticCategory::Error, "A_declare_modifier_cannot_be_used_in_an_already_ambient_context_1038", "A 'declare' modifier cannot be used in an already ambient context."); + static inline const auto Initializers_are_not_allowed_in_ambient_contexts = diag(1039, DiagnosticCategory::Error, "Initializers_are_not_allowed_in_ambient_contexts_1039", "Initializers are not allowed in ambient contexts."); + static inline const auto _0_modifier_cannot_be_used_in_an_ambient_context = diag(1040, DiagnosticCategory::Error, "_0_modifier_cannot_be_used_in_an_ambient_context_1040", "'{0}' modifier cannot be used in an ambient context."); + static inline const auto _0_modifier_cannot_be_used_here = diag(1042, DiagnosticCategory::Error, "_0_modifier_cannot_be_used_here_1042", "'{0}' modifier cannot be used here."); + static inline const auto _0_modifier_cannot_appear_on_a_module_or_namespace_element = diag(1044, DiagnosticCategory::Error, "_0_modifier_cannot_appear_on_a_module_or_namespace_element_1044", "'{0}' modifier cannot appear on a module or namespace element."); + static inline const auto Top_level_declarations_in_d_ts_files_must_start_with_either_a_declare_or_export_modifier = diag(1046, DiagnosticCategory::Error, "Top_level_declarations_in_d_ts_files_must_start_with_either_a_declare_or_export_modifier_1046", "Top-level declarations in .d.ts files must start with either a 'declare' or 'export' modifier."); + static inline const auto A_rest_parameter_cannot_be_optional = diag(1047, DiagnosticCategory::Error, "A_rest_parameter_cannot_be_optional_1047", "A rest parameter cannot be optional."); + static inline const auto A_rest_parameter_cannot_have_an_initializer = diag(1048, DiagnosticCategory::Error, "A_rest_parameter_cannot_have_an_initializer_1048", "A rest parameter cannot have an initializer."); + static inline const auto A_set_accessor_must_have_exactly_one_parameter = diag(1049, DiagnosticCategory::Error, "A_set_accessor_must_have_exactly_one_parameter_1049", "A 'set' accessor must have exactly one parameter."); + static inline const auto A_set_accessor_cannot_have_an_optional_parameter = diag(1051, DiagnosticCategory::Error, "A_set_accessor_cannot_have_an_optional_parameter_1051", "A 'set' accessor cannot have an optional parameter."); + static inline const auto A_set_accessor_parameter_cannot_have_an_initializer = diag(1052, DiagnosticCategory::Error, "A_set_accessor_parameter_cannot_have_an_initializer_1052", "A 'set' accessor parameter cannot have an initializer."); + static inline const auto A_set_accessor_cannot_have_rest_parameter = diag(1053, DiagnosticCategory::Error, "A_set_accessor_cannot_have_rest_parameter_1053", "A 'set' accessor cannot have rest parameter."); + static inline const auto A_get_accessor_cannot_have_parameters = diag(1054, DiagnosticCategory::Error, "A_get_accessor_cannot_have_parameters_1054", "A 'get' accessor cannot have parameters."); + static inline const auto Type_0_is_not_a_valid_async_function_return_type_in_ES5_SlashES3_because_it_does_not_refer_to_a_Promise_compatible_constructor_value = diag(1055, DiagnosticCategory::Error, "Type_0_is_not_a_valid_async_function_return_type_in_ES5_SlashES3_because_it_does_not_refer_to_a_Prom_1055", "Type '{0}' is not a valid async function return type in ES5/ES3 because it does not refer to a Promise-compatible constructor value."); + static inline const auto Accessors_are_only_available_when_targeting_ECMAScript_5_and_higher = diag(1056, DiagnosticCategory::Error, "Accessors_are_only_available_when_targeting_ECMAScript_5_and_higher_1056", "Accessors are only available when targeting ECMAScript 5 and higher."); + static inline const auto The_return_type_of_an_async_function_must_either_be_a_valid_promise_or_must_not_contain_a_callable_then_member = diag(1058, DiagnosticCategory::Error, "The_return_type_of_an_async_function_must_either_be_a_valid_promise_or_must_not_contain_a_callable_t_1058", "The return type of an async function must either be a valid promise or must not contain a callable 'then' member."); + static inline const auto A_promise_must_have_a_then_method = diag(1059, DiagnosticCategory::Error, "A_promise_must_have_a_then_method_1059", "A promise must have a 'then' method."); + static inline const auto The_first_parameter_of_the_then_method_of_a_promise_must_be_a_callback = diag(1060, DiagnosticCategory::Error, "The_first_parameter_of_the_then_method_of_a_promise_must_be_a_callback_1060", "The first parameter of the 'then' method of a promise must be a callback."); + static inline const auto Enum_member_must_have_initializer = diag(1061, DiagnosticCategory::Error, "Enum_member_must_have_initializer_1061", "Enum member must have initializer."); + static inline const auto Type_is_referenced_directly_or_indirectly_in_the_fulfillment_callback_of_its_own_then_method = diag(1062, DiagnosticCategory::Error, "Type_is_referenced_directly_or_indirectly_in_the_fulfillment_callback_of_its_own_then_method_1062", "Type is referenced directly or indirectly in the fulfillment callback of its own 'then' method."); + static inline const auto An_export_assignment_cannot_be_used_in_a_namespace = diag(1063, DiagnosticCategory::Error, "An_export_assignment_cannot_be_used_in_a_namespace_1063", "An export assignment cannot be used in a namespace."); + static inline const auto The_return_type_of_an_async_function_or_method_must_be_the_global_Promise_T_type_Did_you_mean_to_write_Promise_0 = diag(1064, DiagnosticCategory::Error, "The_return_type_of_an_async_function_or_method_must_be_the_global_Promise_T_type_Did_you_mean_to_wri_1064", "The return type of an async function or method must be the global Promise type. Did you mean to write 'Promise<{0}>'?"); + static inline const auto In_ambient_enum_declarations_member_initializer_must_be_constant_expression = diag(1066, DiagnosticCategory::Error, "In_ambient_enum_declarations_member_initializer_must_be_constant_expression_1066", "In ambient enum declarations member initializer must be constant expression."); + static inline const auto Unexpected_token_A_constructor_method_accessor_or_property_was_expected = diag(1068, DiagnosticCategory::Error, "Unexpected_token_A_constructor_method_accessor_or_property_was_expected_1068", "Unexpected token. A constructor, method, accessor, or property was expected."); + static inline const auto Unexpected_token_A_type_parameter_name_was_expected_without_curly_braces = diag(1069, DiagnosticCategory::Error, "Unexpected_token_A_type_parameter_name_was_expected_without_curly_braces_1069", "Unexpected token. A type parameter name was expected without curly braces."); + static inline const auto _0_modifier_cannot_appear_on_a_type_member = diag(1070, DiagnosticCategory::Error, "_0_modifier_cannot_appear_on_a_type_member_1070", "'{0}' modifier cannot appear on a type member."); + static inline const auto _0_modifier_cannot_appear_on_an_index_signature = diag(1071, DiagnosticCategory::Error, "_0_modifier_cannot_appear_on_an_index_signature_1071", "'{0}' modifier cannot appear on an index signature."); + static inline const auto A_0_modifier_cannot_be_used_with_an_import_declaration = diag(1079, DiagnosticCategory::Error, "A_0_modifier_cannot_be_used_with_an_import_declaration_1079", "A '{0}' modifier cannot be used with an import declaration."); + static inline const auto Invalid_reference_directive_syntax = diag(1084, DiagnosticCategory::Error, "Invalid_reference_directive_syntax_1084", "Invalid 'reference' directive syntax."); + static inline const auto Octal_literals_are_not_available_when_targeting_ECMAScript_5_and_higher_Use_the_syntax_0 = diag(1085, DiagnosticCategory::Error, "Octal_literals_are_not_available_when_targeting_ECMAScript_5_and_higher_Use_the_syntax_0_1085", "Octal literals are not available when targeting ECMAScript 5 and higher. Use the syntax '{0}'."); + static inline const auto _0_modifier_cannot_appear_on_a_constructor_declaration = diag(1089, DiagnosticCategory::Error, "_0_modifier_cannot_appear_on_a_constructor_declaration_1089", "'{0}' modifier cannot appear on a constructor declaration."); + static inline const auto _0_modifier_cannot_appear_on_a_parameter = diag(1090, DiagnosticCategory::Error, "_0_modifier_cannot_appear_on_a_parameter_1090", "'{0}' modifier cannot appear on a parameter."); + static inline const auto Only_a_single_variable_declaration_is_allowed_in_a_for_in_statement = diag(1091, DiagnosticCategory::Error, "Only_a_single_variable_declaration_is_allowed_in_a_for_in_statement_1091", "Only a single variable declaration is allowed in a 'for...in' statement."); + static inline const auto Type_parameters_cannot_appear_on_a_constructor_declaration = diag(1092, DiagnosticCategory::Error, "Type_parameters_cannot_appear_on_a_constructor_declaration_1092", "Type parameters cannot appear on a constructor declaration."); + static inline const auto Type_annotation_cannot_appear_on_a_constructor_declaration = diag(1093, DiagnosticCategory::Error, "Type_annotation_cannot_appear_on_a_constructor_declaration_1093", "Type annotation cannot appear on a constructor declaration."); + static inline const auto An_accessor_cannot_have_type_parameters = diag(1094, DiagnosticCategory::Error, "An_accessor_cannot_have_type_parameters_1094", "An accessor cannot have type parameters."); + static inline const auto A_set_accessor_cannot_have_a_return_type_annotation = diag(1095, DiagnosticCategory::Error, "A_set_accessor_cannot_have_a_return_type_annotation_1095", "A 'set' accessor cannot have a return type annotation."); + static inline const auto An_index_signature_must_have_exactly_one_parameter = diag(1096, DiagnosticCategory::Error, "An_index_signature_must_have_exactly_one_parameter_1096", "An index signature must have exactly one parameter."); + static inline const auto _0_list_cannot_be_empty = diag(1097, DiagnosticCategory::Error, "_0_list_cannot_be_empty_1097", "'{0}' list cannot be empty."); + static inline const auto Type_parameter_list_cannot_be_empty = diag(1098, DiagnosticCategory::Error, "Type_parameter_list_cannot_be_empty_1098", "Type parameter list cannot be empty."); + static inline const auto Type_argument_list_cannot_be_empty = diag(1099, DiagnosticCategory::Error, "Type_argument_list_cannot_be_empty_1099", "Type argument list cannot be empty."); + static inline const auto Invalid_use_of_0_in_strict_mode = diag(1100, DiagnosticCategory::Error, "Invalid_use_of_0_in_strict_mode_1100", "Invalid use of '{0}' in strict mode."); + static inline const auto with_statements_are_not_allowed_in_strict_mode = diag(1101, DiagnosticCategory::Error, "with_statements_are_not_allowed_in_strict_mode_1101", "'with' statements are not allowed in strict mode."); + static inline const auto delete_cannot_be_called_on_an_identifier_in_strict_mode = diag(1102, DiagnosticCategory::Error, "delete_cannot_be_called_on_an_identifier_in_strict_mode_1102", "'delete' cannot be called on an identifier in strict mode."); + static inline const auto for_await_loops_are_only_allowed_within_async_functions_and_at_the_top_levels_of_modules = diag(1103, DiagnosticCategory::Error, "for_await_loops_are_only_allowed_within_async_functions_and_at_the_top_levels_of_modules_1103", "'for await' loops are only allowed within async functions and at the top levels of modules."); + static inline const auto A_continue_statement_can_only_be_used_within_an_enclosing_iteration_statement = diag(1104, DiagnosticCategory::Error, "A_continue_statement_can_only_be_used_within_an_enclosing_iteration_statement_1104", "A 'continue' statement can only be used within an enclosing iteration statement."); + static inline const auto A_break_statement_can_only_be_used_within_an_enclosing_iteration_or_switch_statement = diag(1105, DiagnosticCategory::Error, "A_break_statement_can_only_be_used_within_an_enclosing_iteration_or_switch_statement_1105", "A 'break' statement can only be used within an enclosing iteration or switch statement."); + static inline const auto The_left_hand_side_of_a_for_of_statement_may_not_be_async = diag(1106, DiagnosticCategory::Error, "The_left_hand_side_of_a_for_of_statement_may_not_be_async_1106", "The left-hand side of a 'for...of' statement may not be 'async'."); + static inline const auto Jump_target_cannot_cross_function_boundary = diag(1107, DiagnosticCategory::Error, "Jump_target_cannot_cross_function_boundary_1107", "Jump target cannot cross function boundary."); + static inline const auto A_return_statement_can_only_be_used_within_a_function_body = diag(1108, DiagnosticCategory::Error, "A_return_statement_can_only_be_used_within_a_function_body_1108", "A 'return' statement can only be used within a function body."); + static inline const auto Expression_expected = diag(1109, DiagnosticCategory::Error, "Expression_expected_1109", "Expression expected."); + static inline const auto Type_expected = diag(1110, DiagnosticCategory::Error, "Type_expected_1110", "Type expected."); + static inline const auto A_default_clause_cannot_appear_more_than_once_in_a_switch_statement = diag(1113, DiagnosticCategory::Error, "A_default_clause_cannot_appear_more_than_once_in_a_switch_statement_1113", "A 'default' clause cannot appear more than once in a 'switch' statement."); + static inline const auto Duplicate_label_0 = diag(1114, DiagnosticCategory::Error, "Duplicate_label_0_1114", "Duplicate label '{0}'."); + static inline const auto A_continue_statement_can_only_jump_to_a_label_of_an_enclosing_iteration_statement = diag(1115, DiagnosticCategory::Error, "A_continue_statement_can_only_jump_to_a_label_of_an_enclosing_iteration_statement_1115", "A 'continue' statement can only jump to a label of an enclosing iteration statement."); + static inline const auto A_break_statement_can_only_jump_to_a_label_of_an_enclosing_statement = diag(1116, DiagnosticCategory::Error, "A_break_statement_can_only_jump_to_a_label_of_an_enclosing_statement_1116", "A 'break' statement can only jump to a label of an enclosing statement."); + static inline const auto An_object_literal_cannot_have_multiple_properties_with_the_same_name_in_strict_mode = diag(1117, DiagnosticCategory::Error, "An_object_literal_cannot_have_multiple_properties_with_the_same_name_in_strict_mode_1117", "An object literal cannot have multiple properties with the same name in strict mode."); + static inline const auto An_object_literal_cannot_have_multiple_get_Slashset_accessors_with_the_same_name = diag(1118, DiagnosticCategory::Error, "An_object_literal_cannot_have_multiple_get_Slashset_accessors_with_the_same_name_1118", "An object literal cannot have multiple get/set accessors with the same name."); + static inline const auto An_object_literal_cannot_have_property_and_accessor_with_the_same_name = diag(1119, DiagnosticCategory::Error, "An_object_literal_cannot_have_property_and_accessor_with_the_same_name_1119", "An object literal cannot have property and accessor with the same name."); + static inline const auto An_export_assignment_cannot_have_modifiers = diag(1120, DiagnosticCategory::Error, "An_export_assignment_cannot_have_modifiers_1120", "An export assignment cannot have modifiers."); + static inline const auto Octal_literals_are_not_allowed_in_strict_mode = diag(1121, DiagnosticCategory::Error, "Octal_literals_are_not_allowed_in_strict_mode_1121", "Octal literals are not allowed in strict mode."); + static inline const auto Variable_declaration_list_cannot_be_empty = diag(1123, DiagnosticCategory::Error, "Variable_declaration_list_cannot_be_empty_1123", "Variable declaration list cannot be empty."); + static inline const auto Digit_expected = diag(1124, DiagnosticCategory::Error, "Digit_expected_1124", "Digit expected."); + static inline const auto Hexadecimal_digit_expected = diag(1125, DiagnosticCategory::Error, "Hexadecimal_digit_expected_1125", "Hexadecimal digit expected."); + static inline const auto Unexpected_end_of_text = diag(1126, DiagnosticCategory::Error, "Unexpected_end_of_text_1126", "Unexpected end of text."); + static inline const auto Invalid_character = diag(1127, DiagnosticCategory::Error, "Invalid_character_1127", "Invalid character."); + static inline const auto Declaration_or_statement_expected = diag(1128, DiagnosticCategory::Error, "Declaration_or_statement_expected_1128", "Declaration or statement expected."); + static inline const auto Statement_expected = diag(1129, DiagnosticCategory::Error, "Statement_expected_1129", "Statement expected."); + static inline const auto case_or_default_expected = diag(1130, DiagnosticCategory::Error, "case_or_default_expected_1130", "'case' or 'default' expected."); + static inline const auto Property_or_signature_expected = diag(1131, DiagnosticCategory::Error, "Property_or_signature_expected_1131", "Property or signature expected."); + static inline const auto Enum_member_expected = diag(1132, DiagnosticCategory::Error, "Enum_member_expected_1132", "Enum member expected."); + static inline const auto Variable_declaration_expected = diag(1134, DiagnosticCategory::Error, "Variable_declaration_expected_1134", "Variable declaration expected."); + static inline const auto Argument_expression_expected = diag(1135, DiagnosticCategory::Error, "Argument_expression_expected_1135", "Argument expression expected."); + static inline const auto Property_assignment_expected = diag(1136, DiagnosticCategory::Error, "Property_assignment_expected_1136", "Property assignment expected."); + static inline const auto Expression_or_comma_expected = diag(1137, DiagnosticCategory::Error, "Expression_or_comma_expected_1137", "Expression or comma expected."); + static inline const auto Parameter_declaration_expected = diag(1138, DiagnosticCategory::Error, "Parameter_declaration_expected_1138", "Parameter declaration expected."); + static inline const auto Type_parameter_declaration_expected = diag(1139, DiagnosticCategory::Error, "Type_parameter_declaration_expected_1139", "Type parameter declaration expected."); + static inline const auto Type_argument_expected = diag(1140, DiagnosticCategory::Error, "Type_argument_expected_1140", "Type argument expected."); + static inline const auto String_literal_expected = diag(1141, DiagnosticCategory::Error, "String_literal_expected_1141", "String literal expected."); + static inline const auto Line_break_not_permitted_here = diag(1142, DiagnosticCategory::Error, "Line_break_not_permitted_here_1142", "Line break not permitted here."); + static inline const auto or_expected = diag(1144, DiagnosticCategory::Error, "or_expected_1144", "'{' or ';' expected."); + static inline const auto Declaration_expected = diag(1146, DiagnosticCategory::Error, "Declaration_expected_1146", "Declaration expected."); + static inline const auto Import_declarations_in_a_namespace_cannot_reference_a_module = diag(1147, DiagnosticCategory::Error, "Import_declarations_in_a_namespace_cannot_reference_a_module_1147", "Import declarations in a namespace cannot reference a module."); + static inline const auto Cannot_use_imports_exports_or_module_augmentations_when_module_is_none = diag(1148, DiagnosticCategory::Error, "Cannot_use_imports_exports_or_module_augmentations_when_module_is_none_1148", "Cannot use imports, exports, or module augmentations when '--module' is 'none'."); + static inline const auto File_name_0_differs_from_already_included_file_name_1_only_in_casing = diag(1149, DiagnosticCategory::Error, "File_name_0_differs_from_already_included_file_name_1_only_in_casing_1149", "File name '{0}' differs from already included file name '{1}' only in casing."); + static inline const auto const_declarations_must_be_initialized = diag(1155, DiagnosticCategory::Error, "const_declarations_must_be_initialized_1155", "'const' declarations must be initialized."); + static inline const auto const_declarations_can_only_be_declared_inside_a_block = diag(1156, DiagnosticCategory::Error, "const_declarations_can_only_be_declared_inside_a_block_1156", "'const' declarations can only be declared inside a block."); + static inline const auto let_declarations_can_only_be_declared_inside_a_block = diag(1157, DiagnosticCategory::Error, "let_declarations_can_only_be_declared_inside_a_block_1157", "'let' declarations can only be declared inside a block."); + static inline const auto Unterminated_template_literal = diag(1160, DiagnosticCategory::Error, "Unterminated_template_literal_1160", "Unterminated template literal."); + static inline const auto Unterminated_regular_expression_literal = diag(1161, DiagnosticCategory::Error, "Unterminated_regular_expression_literal_1161", "Unterminated regular expression literal."); + static inline const auto An_object_member_cannot_be_declared_optional = diag(1162, DiagnosticCategory::Error, "An_object_member_cannot_be_declared_optional_1162", "An object member cannot be declared optional."); + static inline const auto A_yield_expression_is_only_allowed_in_a_generator_body = diag(1163, DiagnosticCategory::Error, "A_yield_expression_is_only_allowed_in_a_generator_body_1163", "A 'yield' expression is only allowed in a generator body."); + static inline const auto Computed_property_names_are_not_allowed_in_enums = diag(1164, DiagnosticCategory::Error, "Computed_property_names_are_not_allowed_in_enums_1164", "Computed property names are not allowed in enums."); + static inline const auto A_computed_property_name_in_an_ambient_context_must_refer_to_an_expression_whose_type_is_a_literal_type_or_a_unique_symbol_type = diag(1165, DiagnosticCategory::Error, "A_computed_property_name_in_an_ambient_context_must_refer_to_an_expression_whose_type_is_a_literal_t_1165", "A computed property name in an ambient context must refer to an expression whose type is a literal type or a 'unique symbol' type."); + static inline const auto A_computed_property_name_in_a_class_property_declaration_must_have_a_simple_literal_type_or_a_unique_symbol_type = diag(1166, DiagnosticCategory::Error, "A_computed_property_name_in_a_class_property_declaration_must_have_a_simple_literal_type_or_a_unique_1166", "A computed property name in a class property declaration must have a simple literal type or a 'unique symbol' type."); + static inline const auto A_computed_property_name_in_a_method_overload_must_refer_to_an_expression_whose_type_is_a_literal_type_or_a_unique_symbol_type = diag(1168, DiagnosticCategory::Error, "A_computed_property_name_in_a_method_overload_must_refer_to_an_expression_whose_type_is_a_literal_ty_1168", "A computed property name in a method overload must refer to an expression whose type is a literal type or a 'unique symbol' type."); + static inline const auto A_computed_property_name_in_an_interface_must_refer_to_an_expression_whose_type_is_a_literal_type_or_a_unique_symbol_type = diag(1169, DiagnosticCategory::Error, "A_computed_property_name_in_an_interface_must_refer_to_an_expression_whose_type_is_a_literal_type_or_1169", "A computed property name in an interface must refer to an expression whose type is a literal type or a 'unique symbol' type."); + static inline const auto A_computed_property_name_in_a_type_literal_must_refer_to_an_expression_whose_type_is_a_literal_type_or_a_unique_symbol_type = diag(1170, DiagnosticCategory::Error, "A_computed_property_name_in_a_type_literal_must_refer_to_an_expression_whose_type_is_a_literal_type__1170", "A computed property name in a type literal must refer to an expression whose type is a literal type or a 'unique symbol' type."); + static inline const auto A_comma_expression_is_not_allowed_in_a_computed_property_name = diag(1171, DiagnosticCategory::Error, "A_comma_expression_is_not_allowed_in_a_computed_property_name_1171", "A comma expression is not allowed in a computed property name."); + static inline const auto extends_clause_already_seen = diag(1172, DiagnosticCategory::Error, "extends_clause_already_seen_1172", "'extends' clause already seen."); + static inline const auto extends_clause_must_precede_implements_clause = diag(1173, DiagnosticCategory::Error, "extends_clause_must_precede_implements_clause_1173", "'extends' clause must precede 'implements' clause."); + static inline const auto Classes_can_only_extend_a_single_class = diag(1174, DiagnosticCategory::Error, "Classes_can_only_extend_a_single_class_1174", "Classes can only extend a single class."); + static inline const auto implements_clause_already_seen = diag(1175, DiagnosticCategory::Error, "implements_clause_already_seen_1175", "'implements' clause already seen."); + static inline const auto Interface_declaration_cannot_have_implements_clause = diag(1176, DiagnosticCategory::Error, "Interface_declaration_cannot_have_implements_clause_1176", "Interface declaration cannot have 'implements' clause."); + static inline const auto Binary_digit_expected = diag(1177, DiagnosticCategory::Error, "Binary_digit_expected_1177", "Binary digit expected."); + static inline const auto Octal_digit_expected = diag(1178, DiagnosticCategory::Error, "Octal_digit_expected_1178", "Octal digit expected."); + static inline const auto Unexpected_token_expected = diag(1179, DiagnosticCategory::Error, "Unexpected_token_expected_1179", "Unexpected token. '{' expected."); + static inline const auto Property_destructuring_pattern_expected = diag(1180, DiagnosticCategory::Error, "Property_destructuring_pattern_expected_1180", "Property destructuring pattern expected."); + static inline const auto Array_element_destructuring_pattern_expected = diag(1181, DiagnosticCategory::Error, "Array_element_destructuring_pattern_expected_1181", "Array element destructuring pattern expected."); + static inline const auto A_destructuring_declaration_must_have_an_initializer = diag(1182, DiagnosticCategory::Error, "A_destructuring_declaration_must_have_an_initializer_1182", "A destructuring declaration must have an initializer."); + static inline const auto An_implementation_cannot_be_declared_in_ambient_contexts = diag(1183, DiagnosticCategory::Error, "An_implementation_cannot_be_declared_in_ambient_contexts_1183", "An implementation cannot be declared in ambient contexts."); + static inline const auto Modifiers_cannot_appear_here = diag(1184, DiagnosticCategory::Error, "Modifiers_cannot_appear_here_1184", "Modifiers cannot appear here."); + static inline const auto Merge_conflict_marker_encountered = diag(1185, DiagnosticCategory::Error, "Merge_conflict_marker_encountered_1185", "Merge conflict marker encountered."); + static inline const auto A_rest_element_cannot_have_an_initializer = diag(1186, DiagnosticCategory::Error, "A_rest_element_cannot_have_an_initializer_1186", "A rest element cannot have an initializer."); + static inline const auto A_parameter_property_may_not_be_declared_using_a_binding_pattern = diag(1187, DiagnosticCategory::Error, "A_parameter_property_may_not_be_declared_using_a_binding_pattern_1187", "A parameter property may not be declared using a binding pattern."); + static inline const auto Only_a_single_variable_declaration_is_allowed_in_a_for_of_statement = diag(1188, DiagnosticCategory::Error, "Only_a_single_variable_declaration_is_allowed_in_a_for_of_statement_1188", "Only a single variable declaration is allowed in a 'for...of' statement."); + static inline const auto The_variable_declaration_of_a_for_in_statement_cannot_have_an_initializer = diag(1189, DiagnosticCategory::Error, "The_variable_declaration_of_a_for_in_statement_cannot_have_an_initializer_1189", "The variable declaration of a 'for...in' statement cannot have an initializer."); + static inline const auto The_variable_declaration_of_a_for_of_statement_cannot_have_an_initializer = diag(1190, DiagnosticCategory::Error, "The_variable_declaration_of_a_for_of_statement_cannot_have_an_initializer_1190", "The variable declaration of a 'for...of' statement cannot have an initializer."); + static inline const auto An_import_declaration_cannot_have_modifiers = diag(1191, DiagnosticCategory::Error, "An_import_declaration_cannot_have_modifiers_1191", "An import declaration cannot have modifiers."); + static inline const auto Module_0_has_no_default_export = diag(1192, DiagnosticCategory::Error, "Module_0_has_no_default_export_1192", "Module '{0}' has no default export."); + static inline const auto An_export_declaration_cannot_have_modifiers = diag(1193, DiagnosticCategory::Error, "An_export_declaration_cannot_have_modifiers_1193", "An export declaration cannot have modifiers."); + static inline const auto Export_declarations_are_not_permitted_in_a_namespace = diag(1194, DiagnosticCategory::Error, "Export_declarations_are_not_permitted_in_a_namespace_1194", "Export declarations are not permitted in a namespace."); + static inline const auto export_Asterisk_does_not_re_export_a_default = diag(1195, DiagnosticCategory::Error, "export_Asterisk_does_not_re_export_a_default_1195", "'export *' does not re-export a default."); + static inline const auto Catch_clause_variable_type_annotation_must_be_any_or_unknown_if_specified = diag(1196, DiagnosticCategory::Error, "Catch_clause_variable_type_annotation_must_be_any_or_unknown_if_specified_1196", "Catch clause variable type annotation must be 'any' or 'unknown' if specified."); + static inline const auto Catch_clause_variable_cannot_have_an_initializer = diag(1197, DiagnosticCategory::Error, "Catch_clause_variable_cannot_have_an_initializer_1197", "Catch clause variable cannot have an initializer."); + static inline const auto An_extended_Unicode_escape_value_must_be_between_0x0_and_0x10FFFF_inclusive = diag(1198, DiagnosticCategory::Error, "An_extended_Unicode_escape_value_must_be_between_0x0_and_0x10FFFF_inclusive_1198", "An extended Unicode escape value must be between 0x0 and 0x10FFFF inclusive."); + static inline const auto Unterminated_Unicode_escape_sequence = diag(1199, DiagnosticCategory::Error, "Unterminated_Unicode_escape_sequence_1199", "Unterminated Unicode escape sequence."); + static inline const auto Line_terminator_not_permitted_before_arrow = diag(1200, DiagnosticCategory::Error, "Line_terminator_not_permitted_before_arrow_1200", "Line terminator not permitted before arrow."); + static inline const auto Import_assignment_cannot_be_used_when_targeting_ECMAScript_modules_Consider_using_import_Asterisk_as_ns_from_mod_import_a_from_mod_import_d_from_mod_or_another_module_format_instead = diag(1202, DiagnosticCategory::Error, "Import_assignment_cannot_be_used_when_targeting_ECMAScript_modules_Consider_using_import_Asterisk_as_1202", + "Import assignment cannot be used when targeting ECMAScript modules. Consider using 'import * as ns from \"mod\"', 'import {a} from \"mod\"', 'import d from \"mod\"', or another module format instead."); + static inline const auto Export_assignment_cannot_be_used_when_targeting_ECMAScript_modules_Consider_using_export_default_or_another_module_format_instead = diag(1203, DiagnosticCategory::Error, "Export_assignment_cannot_be_used_when_targeting_ECMAScript_modules_Consider_using_export_default_or__1203", "Export assignment cannot be used when targeting ECMAScript modules. Consider using 'export default' or another module format instead."); + static inline const auto Re_exporting_a_type_when_the_isolatedModules_flag_is_provided_requires_using_export_type = diag(1205, DiagnosticCategory::Error, "Re_exporting_a_type_when_the_isolatedModules_flag_is_provided_requires_using_export_type_1205", "Re-exporting a type when the '--isolatedModules' flag is provided requires using 'export type'."); + static inline const auto Decorators_are_not_valid_here = diag(1206, DiagnosticCategory::Error, "Decorators_are_not_valid_here_1206", "Decorators are not valid here."); + static inline const auto Decorators_cannot_be_applied_to_multiple_get_Slashset_accessors_of_the_same_name = diag(1207, DiagnosticCategory::Error, "Decorators_cannot_be_applied_to_multiple_get_Slashset_accessors_of_the_same_name_1207", "Decorators cannot be applied to multiple get/set accessors of the same name."); + static inline const auto _0_cannot_be_compiled_under_isolatedModules_because_it_is_considered_a_global_script_file_Add_an_import_export_or_an_empty_export_statement_to_make_it_a_module = diag(1208, DiagnosticCategory::Error, "_0_cannot_be_compiled_under_isolatedModules_because_it_is_considered_a_global_script_file_Add_an_imp_1208", + "'{0}' cannot be compiled under '--isolatedModules' because it is considered a global script file. Add an import, export, or an empty 'export {}' statement to make it a module."); + static inline const auto Code_contained_in_a_class_is_evaluated_in_JavaScript_s_strict_mode_which_does_not_allow_this_use_of_0_For_more_information_see_https_Colon_Slash_Slashdeveloper_mozilla_org_Slashen_US_Slashdocs_SlashWeb_SlashJavaScript_SlashReference_SlashStrict_mode = diag(1210, DiagnosticCategory::Error, "Code_contained_in_a_class_is_evaluated_in_JavaScript_s_strict_mode_which_does_not_allow_this_use_of__1210", + "Code contained in a class is evaluated in JavaScript's strict mode which does not allow this use of '{0}'. For more information, see https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Strict_mode."); + static inline const auto A_class_declaration_without_the_default_modifier_must_have_a_name = diag(1211, DiagnosticCategory::Error, "A_class_declaration_without_the_default_modifier_must_have_a_name_1211", "A class declaration without the 'default' modifier must have a name."); + static inline const auto Identifier_expected_0_is_a_reserved_word_in_strict_mode = diag(1212, DiagnosticCategory::Error, "Identifier_expected_0_is_a_reserved_word_in_strict_mode_1212", "Identifier expected. '{0}' is a reserved word in strict mode."); + static inline const auto Identifier_expected_0_is_a_reserved_word_in_strict_mode_Class_definitions_are_automatically_in_strict_mode = diag(1213, DiagnosticCategory::Error, "Identifier_expected_0_is_a_reserved_word_in_strict_mode_Class_definitions_are_automatically_in_stric_1213", "Identifier expected. '{0}' is a reserved word in strict mode. Class definitions are automatically in strict mode."); + static inline const auto Identifier_expected_0_is_a_reserved_word_in_strict_mode_Modules_are_automatically_in_strict_mode = diag(1214, DiagnosticCategory::Error, "Identifier_expected_0_is_a_reserved_word_in_strict_mode_Modules_are_automatically_in_strict_mode_1214", "Identifier expected. '{0}' is a reserved word in strict mode. Modules are automatically in strict mode."); + static inline const auto Invalid_use_of_0_Modules_are_automatically_in_strict_mode = diag(1215, DiagnosticCategory::Error, "Invalid_use_of_0_Modules_are_automatically_in_strict_mode_1215", "Invalid use of '{0}'. Modules are automatically in strict mode."); + static inline const auto Identifier_expected_esModule_is_reserved_as_an_exported_marker_when_transforming_ECMAScript_modules = diag(1216, DiagnosticCategory::Error, "Identifier_expected_esModule_is_reserved_as_an_exported_marker_when_transforming_ECMAScript_modules_1216", "Identifier expected. '__esModule' is reserved as an exported marker when transforming ECMAScript modules."); + static inline const auto Export_assignment_is_not_supported_when_module_flag_is_system = diag(1218, DiagnosticCategory::Error, "Export_assignment_is_not_supported_when_module_flag_is_system_1218", "Export assignment is not supported when '--module' flag is 'system'."); + static inline const auto Experimental_support_for_decorators_is_a_feature_that_is_subject_to_change_in_a_future_release_Set_the_experimentalDecorators_option_in_your_tsconfig_or_jsconfig_to_remove_this_warning = diag(1219, DiagnosticCategory::Error, "Experimental_support_for_decorators_is_a_feature_that_is_subject_to_change_in_a_future_release_Set_t_1219", + "Experimental support for decorators is a feature that is subject to change in a future release. Set the 'experimentalDecorators' option in your 'tsconfig' or 'jsconfig' to remove this warning."); + static inline const auto Generators_are_not_allowed_in_an_ambient_context = diag(1221, DiagnosticCategory::Error, "Generators_are_not_allowed_in_an_ambient_context_1221", "Generators are not allowed in an ambient context."); + static inline const auto An_overload_signature_cannot_be_declared_as_a_generator = diag(1222, DiagnosticCategory::Error, "An_overload_signature_cannot_be_declared_as_a_generator_1222", "An overload signature cannot be declared as a generator."); + static inline const auto _0_tag_already_specified = diag(1223, DiagnosticCategory::Error, "_0_tag_already_specified_1223", "'{0}' tag already specified."); + static inline const auto Signature_0_must_be_a_type_predicate = diag(1224, DiagnosticCategory::Error, "Signature_0_must_be_a_type_predicate_1224", "Signature '{0}' must be a type predicate."); + static inline const auto Cannot_find_parameter_0 = diag(1225, DiagnosticCategory::Error, "Cannot_find_parameter_0_1225", "Cannot find parameter '{0}'."); + static inline const auto Type_predicate_0_is_not_assignable_to_1 = diag(1226, DiagnosticCategory::Error, "Type_predicate_0_is_not_assignable_to_1_1226", "Type predicate '{0}' is not assignable to '{1}'."); + static inline const auto Parameter_0_is_not_in_the_same_position_as_parameter_1 = diag(1227, DiagnosticCategory::Error, "Parameter_0_is_not_in_the_same_position_as_parameter_1_1227", "Parameter '{0}' is not in the same position as parameter '{1}'."); + static inline const auto A_type_predicate_is_only_allowed_in_return_type_position_for_functions_and_methods = diag(1228, DiagnosticCategory::Error, "A_type_predicate_is_only_allowed_in_return_type_position_for_functions_and_methods_1228", "A type predicate is only allowed in return type position for functions and methods."); + static inline const auto A_type_predicate_cannot_reference_a_rest_parameter = diag(1229, DiagnosticCategory::Error, "A_type_predicate_cannot_reference_a_rest_parameter_1229", "A type predicate cannot reference a rest parameter."); + static inline const auto A_type_predicate_cannot_reference_element_0_in_a_binding_pattern = diag(1230, DiagnosticCategory::Error, "A_type_predicate_cannot_reference_element_0_in_a_binding_pattern_1230", "A type predicate cannot reference element '{0}' in a binding pattern."); + static inline const auto An_export_assignment_must_be_at_the_top_level_of_a_file_or_module_declaration = diag(1231, DiagnosticCategory::Error, "An_export_assignment_must_be_at_the_top_level_of_a_file_or_module_declaration_1231", "An export assignment must be at the top level of a file or module declaration."); + static inline const auto An_import_declaration_can_only_be_used_in_a_namespace_or_module = diag(1232, DiagnosticCategory::Error, "An_import_declaration_can_only_be_used_in_a_namespace_or_module_1232", "An import declaration can only be used in a namespace or module."); + static inline const auto An_export_declaration_can_only_be_used_in_a_module = diag(1233, DiagnosticCategory::Error, "An_export_declaration_can_only_be_used_in_a_module_1233", "An export declaration can only be used in a module."); + static inline const auto An_ambient_module_declaration_is_only_allowed_at_the_top_level_in_a_file = diag(1234, DiagnosticCategory::Error, "An_ambient_module_declaration_is_only_allowed_at_the_top_level_in_a_file_1234", "An ambient module declaration is only allowed at the top level in a file."); + static inline const auto A_namespace_declaration_is_only_allowed_in_a_namespace_or_module = diag(1235, DiagnosticCategory::Error, "A_namespace_declaration_is_only_allowed_in_a_namespace_or_module_1235", "A namespace declaration is only allowed in a namespace or module."); + static inline const auto The_return_type_of_a_property_decorator_function_must_be_either_void_or_any = diag(1236, DiagnosticCategory::Error, "The_return_type_of_a_property_decorator_function_must_be_either_void_or_any_1236", "The return type of a property decorator function must be either 'void' or 'any'."); + static inline const auto The_return_type_of_a_parameter_decorator_function_must_be_either_void_or_any = diag(1237, DiagnosticCategory::Error, "The_return_type_of_a_parameter_decorator_function_must_be_either_void_or_any_1237", "The return type of a parameter decorator function must be either 'void' or 'any'."); + static inline const auto Unable_to_resolve_signature_of_class_decorator_when_called_as_an_expression = diag(1238, DiagnosticCategory::Error, "Unable_to_resolve_signature_of_class_decorator_when_called_as_an_expression_1238", "Unable to resolve signature of class decorator when called as an expression."); + static inline const auto Unable_to_resolve_signature_of_parameter_decorator_when_called_as_an_expression = diag(1239, DiagnosticCategory::Error, "Unable_to_resolve_signature_of_parameter_decorator_when_called_as_an_expression_1239", "Unable to resolve signature of parameter decorator when called as an expression."); + static inline const auto Unable_to_resolve_signature_of_property_decorator_when_called_as_an_expression = diag(1240, DiagnosticCategory::Error, "Unable_to_resolve_signature_of_property_decorator_when_called_as_an_expression_1240", "Unable to resolve signature of property decorator when called as an expression."); + static inline const auto Unable_to_resolve_signature_of_method_decorator_when_called_as_an_expression = diag(1241, DiagnosticCategory::Error, "Unable_to_resolve_signature_of_method_decorator_when_called_as_an_expression_1241", "Unable to resolve signature of method decorator when called as an expression."); + static inline const auto abstract_modifier_can_only_appear_on_a_class_method_or_property_declaration = diag(1242, DiagnosticCategory::Error, "abstract_modifier_can_only_appear_on_a_class_method_or_property_declaration_1242", "'abstract' modifier can only appear on a class, method, or property declaration."); + static inline const auto _0_modifier_cannot_be_used_with_1_modifier = diag(1243, DiagnosticCategory::Error, "_0_modifier_cannot_be_used_with_1_modifier_1243", "'{0}' modifier cannot be used with '{1}' modifier."); + static inline const auto Abstract_methods_can_only_appear_within_an_abstract_class = diag(1244, DiagnosticCategory::Error, "Abstract_methods_can_only_appear_within_an_abstract_class_1244", "Abstract methods can only appear within an abstract class."); + static inline const auto Method_0_cannot_have_an_implementation_because_it_is_marked_abstract = diag(1245, DiagnosticCategory::Error, "Method_0_cannot_have_an_implementation_because_it_is_marked_abstract_1245", "Method '{0}' cannot have an implementation because it is marked abstract."); + static inline const auto An_interface_property_cannot_have_an_initializer = diag(1246, DiagnosticCategory::Error, "An_interface_property_cannot_have_an_initializer_1246", "An interface property cannot have an initializer."); + static inline const auto A_type_literal_property_cannot_have_an_initializer = diag(1247, DiagnosticCategory::Error, "A_type_literal_property_cannot_have_an_initializer_1247", "A type literal property cannot have an initializer."); + static inline const auto A_class_member_cannot_have_the_0_keyword = diag(1248, DiagnosticCategory::Error, "A_class_member_cannot_have_the_0_keyword_1248", "A class member cannot have the '{0}' keyword."); + static inline const auto A_decorator_can_only_decorate_a_method_implementation_not_an_overload = diag(1249, DiagnosticCategory::Error, "A_decorator_can_only_decorate_a_method_implementation_not_an_overload_1249", "A decorator can only decorate a method implementation, not an overload."); + static inline const auto Function_declarations_are_not_allowed_inside_blocks_in_strict_mode_when_targeting_ES3_or_ES5 = diag(1250, DiagnosticCategory::Error, "Function_declarations_are_not_allowed_inside_blocks_in_strict_mode_when_targeting_ES3_or_ES5_1250", "Function declarations are not allowed inside blocks in strict mode when targeting 'ES3' or 'ES5'."); + static inline const auto Function_declarations_are_not_allowed_inside_blocks_in_strict_mode_when_targeting_ES3_or_ES5_Class_definitions_are_automatically_in_strict_mode = diag(1251, DiagnosticCategory::Error, "Function_declarations_are_not_allowed_inside_blocks_in_strict_mode_when_targeting_ES3_or_ES5_Class_d_1251", "Function declarations are not allowed inside blocks in strict mode when targeting 'ES3' or 'ES5'. Class definitions are automatically in strict mode."); + static inline const auto Function_declarations_are_not_allowed_inside_blocks_in_strict_mode_when_targeting_ES3_or_ES5_Modules_are_automatically_in_strict_mode = diag(1252, DiagnosticCategory::Error, "Function_declarations_are_not_allowed_inside_blocks_in_strict_mode_when_targeting_ES3_or_ES5_Modules_1252", "Function declarations are not allowed inside blocks in strict mode when targeting 'ES3' or 'ES5'. Modules are automatically in strict mode."); + static inline const auto A_const_initializer_in_an_ambient_context_must_be_a_string_or_numeric_literal_or_literal_enum_reference = diag(1254, DiagnosticCategory::Error, "A_const_initializer_in_an_ambient_context_must_be_a_string_or_numeric_literal_or_literal_enum_refere_1254", "A 'const' initializer in an ambient context must be a string or numeric literal or literal enum reference."); + static inline const auto A_definite_assignment_assertion_is_not_permitted_in_this_context = diag(1255, DiagnosticCategory::Error, "A_definite_assignment_assertion_is_not_permitted_in_this_context_1255", "A definite assignment assertion '!' is not permitted in this context."); + static inline const auto A_required_element_cannot_follow_an_optional_element = diag(1257, DiagnosticCategory::Error, "A_required_element_cannot_follow_an_optional_element_1257", "A required element cannot follow an optional element."); + static inline const auto A_default_export_must_be_at_the_top_level_of_a_file_or_module_declaration = diag(1258, DiagnosticCategory::Error, "A_default_export_must_be_at_the_top_level_of_a_file_or_module_declaration_1258", "A default export must be at the top level of a file or module declaration."); + static inline const auto Module_0_can_only_be_default_imported_using_the_1_flag = diag(1259, DiagnosticCategory::Error, "Module_0_can_only_be_default_imported_using_the_1_flag_1259", "Module '{0}' can only be default-imported using the '{1}' flag"); + static inline const auto Keywords_cannot_contain_escape_characters = diag(1260, DiagnosticCategory::Error, "Keywords_cannot_contain_escape_characters_1260", "Keywords cannot contain escape characters."); + static inline const auto Already_included_file_name_0_differs_from_file_name_1_only_in_casing = diag(1261, DiagnosticCategory::Error, "Already_included_file_name_0_differs_from_file_name_1_only_in_casing_1261", "Already included file name '{0}' differs from file name '{1}' only in casing."); + static inline const auto Identifier_expected_0_is_a_reserved_word_at_the_top_level_of_a_module = diag(1262, DiagnosticCategory::Error, "Identifier_expected_0_is_a_reserved_word_at_the_top_level_of_a_module_1262", "Identifier expected. '{0}' is a reserved word at the top-level of a module."); + static inline const auto Declarations_with_initializers_cannot_also_have_definite_assignment_assertions = diag(1263, DiagnosticCategory::Error, "Declarations_with_initializers_cannot_also_have_definite_assignment_assertions_1263", "Declarations with initializers cannot also have definite assignment assertions."); + static inline const auto Declarations_with_definite_assignment_assertions_must_also_have_type_annotations = diag(1264, DiagnosticCategory::Error, "Declarations_with_definite_assignment_assertions_must_also_have_type_annotations_1264", "Declarations with definite assignment assertions must also have type annotations."); + static inline const auto A_rest_element_cannot_follow_another_rest_element = diag(1265, DiagnosticCategory::Error, "A_rest_element_cannot_follow_another_rest_element_1265", "A rest element cannot follow another rest element."); + static inline const auto An_optional_element_cannot_follow_a_rest_element = diag(1266, DiagnosticCategory::Error, "An_optional_element_cannot_follow_a_rest_element_1266", "An optional element cannot follow a rest element."); + static inline const auto Property_0_cannot_have_an_initializer_because_it_is_marked_abstract = diag(1267, DiagnosticCategory::Error, "Property_0_cannot_have_an_initializer_because_it_is_marked_abstract_1267", "Property '{0}' cannot have an initializer because it is marked abstract."); + static inline const auto An_index_signature_parameter_type_must_be_string_number_symbol_or_a_template_literal_type = diag(1268, DiagnosticCategory::Error, "An_index_signature_parameter_type_must_be_string_number_symbol_or_a_template_literal_type_1268", "An index signature parameter type must be 'string', 'number', 'symbol', or a template literal type."); + static inline const auto with_statements_are_not_allowed_in_an_async_function_block = diag(1300, DiagnosticCategory::Error, "with_statements_are_not_allowed_in_an_async_function_block_1300", "'with' statements are not allowed in an async function block."); + static inline const auto await_expressions_are_only_allowed_within_async_functions_and_at_the_top_levels_of_modules = diag(1308, DiagnosticCategory::Error, "await_expressions_are_only_allowed_within_async_functions_and_at_the_top_levels_of_modules_1308", "'await' expressions are only allowed within async functions and at the top levels of modules."); + static inline const auto Did_you_mean_to_use_a_Colon_An_can_only_follow_a_property_name_when_the_containing_object_literal_is_part_of_a_destructuring_pattern = diag(1312, DiagnosticCategory::Error, "Did_you_mean_to_use_a_Colon_An_can_only_follow_a_property_name_when_the_containing_object_literal_is_1312", "Did you mean to use a ':'? An '=' can only follow a property name when the containing object literal is part of a destructuring pattern."); + static inline const auto The_body_of_an_if_statement_cannot_be_the_empty_statement = diag(1313, DiagnosticCategory::Error, "The_body_of_an_if_statement_cannot_be_the_empty_statement_1313", "The body of an 'if' statement cannot be the empty statement."); + static inline const auto Global_module_exports_may_only_appear_in_module_files = diag(1314, DiagnosticCategory::Error, "Global_module_exports_may_only_appear_in_module_files_1314", "Global module exports may only appear in module files."); + static inline const auto Global_module_exports_may_only_appear_in_declaration_files = diag(1315, DiagnosticCategory::Error, "Global_module_exports_may_only_appear_in_declaration_files_1315", "Global module exports may only appear in declaration files."); + static inline const auto Global_module_exports_may_only_appear_at_top_level = diag(1316, DiagnosticCategory::Error, "Global_module_exports_may_only_appear_at_top_level_1316", "Global module exports may only appear at top level."); + static inline const auto A_parameter_property_cannot_be_declared_using_a_rest_parameter = diag(1317, DiagnosticCategory::Error, "A_parameter_property_cannot_be_declared_using_a_rest_parameter_1317", "A parameter property cannot be declared using a rest parameter."); + static inline const auto An_abstract_accessor_cannot_have_an_implementation = diag(1318, DiagnosticCategory::Error, "An_abstract_accessor_cannot_have_an_implementation_1318", "An abstract accessor cannot have an implementation."); + static inline const auto A_default_export_can_only_be_used_in_an_ECMAScript_style_module = diag(1319, DiagnosticCategory::Error, "A_default_export_can_only_be_used_in_an_ECMAScript_style_module_1319", "A default export can only be used in an ECMAScript-style module."); + static inline const auto Type_of_await_operand_must_either_be_a_valid_promise_or_must_not_contain_a_callable_then_member = diag(1320, DiagnosticCategory::Error, "Type_of_await_operand_must_either_be_a_valid_promise_or_must_not_contain_a_callable_then_member_1320", "Type of 'await' operand must either be a valid promise or must not contain a callable 'then' member."); + static inline const auto Type_of_yield_operand_in_an_async_generator_must_either_be_a_valid_promise_or_must_not_contain_a_callable_then_member = diag(1321, DiagnosticCategory::Error, "Type_of_yield_operand_in_an_async_generator_must_either_be_a_valid_promise_or_must_not_contain_a_cal_1321", "Type of 'yield' operand in an async generator must either be a valid promise or must not contain a callable 'then' member."); + static inline const auto Type_of_iterated_elements_of_a_yield_Asterisk_operand_must_either_be_a_valid_promise_or_must_not_contain_a_callable_then_member = diag(1322, DiagnosticCategory::Error, "Type_of_iterated_elements_of_a_yield_Asterisk_operand_must_either_be_a_valid_promise_or_must_not_con_1322", "Type of iterated elements of a 'yield*' operand must either be a valid promise or must not contain a callable 'then' member."); + static inline const auto Dynamic_imports_are_only_supported_when_the_module_flag_is_set_to_es2020_es2022_esnext_commonjs_amd_system_umd_node12_or_nodenext = diag(1323, DiagnosticCategory::Error, "Dynamic_imports_are_only_supported_when_the_module_flag_is_set_to_es2020_es2022_esnext_commonjs_amd__1323", "Dynamic imports are only supported when the '--module' flag is set to 'es2020', 'es2022', 'esnext', 'commonjs', 'amd', 'system', 'umd', 'node12', or 'nodenext'."); + static inline const auto Dynamic_imports_only_support_a_second_argument_when_the_module_option_is_set_to_esnext_or_nodenext = diag(1324, DiagnosticCategory::Error, "Dynamic_imports_only_support_a_second_argument_when_the_module_option_is_set_to_esnext_or_nodenext_1324", "Dynamic imports only support a second argument when the '--module' option is set to 'esnext' or 'nodenext'."); + static inline const auto Argument_of_dynamic_import_cannot_be_spread_element = diag(1325, DiagnosticCategory::Error, "Argument_of_dynamic_import_cannot_be_spread_element_1325", "Argument of dynamic import cannot be spread element."); + static inline const auto Dynamic_import_cannot_have_type_arguments = diag(1326, DiagnosticCategory::Error, "Dynamic_import_cannot_have_type_arguments_1326", "Dynamic import cannot have type arguments."); + static inline const auto String_literal_with_double_quotes_expected = diag(1327, DiagnosticCategory::Error, "String_literal_with_double_quotes_expected_1327", "String literal with double quotes expected."); + static inline const auto Property_value_can_only_be_string_literal_numeric_literal_true_false_null_object_literal_or_array_literal = diag(1328, DiagnosticCategory::Error, "Property_value_can_only_be_string_literal_numeric_literal_true_false_null_object_literal_or_array_li_1328", "Property value can only be string literal, numeric literal, 'true', 'false', 'null', object literal or array literal."); + static inline const auto _0_accepts_too_few_arguments_to_be_used_as_a_decorator_here_Did_you_mean_to_call_it_first_and_write_0 = diag(1329, DiagnosticCategory::Error, "_0_accepts_too_few_arguments_to_be_used_as_a_decorator_here_Did_you_mean_to_call_it_first_and_write__1329", "'{0}' accepts too few arguments to be used as a decorator here. Did you mean to call it first and write '@{0}()'?"); + static inline const auto A_property_of_an_interface_or_type_literal_whose_type_is_a_unique_symbol_type_must_be_readonly = diag(1330, DiagnosticCategory::Error, "A_property_of_an_interface_or_type_literal_whose_type_is_a_unique_symbol_type_must_be_readonly_1330", "A property of an interface or type literal whose type is a 'unique symbol' type must be 'readonly'."); + static inline const auto A_property_of_a_class_whose_type_is_a_unique_symbol_type_must_be_both_static_and_readonly = diag(1331, DiagnosticCategory::Error, "A_property_of_a_class_whose_type_is_a_unique_symbol_type_must_be_both_static_and_readonly_1331", "A property of a class whose type is a 'unique symbol' type must be both 'static' and 'readonly'."); + static inline const auto A_variable_whose_type_is_a_unique_symbol_type_must_be_const = diag(1332, DiagnosticCategory::Error, "A_variable_whose_type_is_a_unique_symbol_type_must_be_const_1332", "A variable whose type is a 'unique symbol' type must be 'const'."); + static inline const auto unique_symbol_types_may_not_be_used_on_a_variable_declaration_with_a_binding_name = diag(1333, DiagnosticCategory::Error, "unique_symbol_types_may_not_be_used_on_a_variable_declaration_with_a_binding_name_1333", "'unique symbol' types may not be used on a variable declaration with a binding name."); + static inline const auto unique_symbol_types_are_only_allowed_on_variables_in_a_variable_statement = diag(1334, DiagnosticCategory::Error, "unique_symbol_types_are_only_allowed_on_variables_in_a_variable_statement_1334", "'unique symbol' types are only allowed on variables in a variable statement."); + static inline const auto unique_symbol_types_are_not_allowed_here = diag(1335, DiagnosticCategory::Error, "unique_symbol_types_are_not_allowed_here_1335", "'unique symbol' types are not allowed here."); + static inline const auto An_index_signature_parameter_type_cannot_be_a_literal_type_or_generic_type_Consider_using_a_mapped_object_type_instead = diag(1337, DiagnosticCategory::Error, "An_index_signature_parameter_type_cannot_be_a_literal_type_or_generic_type_Consider_using_a_mapped_o_1337", "An index signature parameter type cannot be a literal type or generic type. Consider using a mapped object type instead."); + static inline const auto infer_declarations_are_only_permitted_in_the_extends_clause_of_a_conditional_type = diag(1338, DiagnosticCategory::Error, "infer_declarations_are_only_permitted_in_the_extends_clause_of_a_conditional_type_1338", "'infer' declarations are only permitted in the 'extends' clause of a conditional type."); + static inline const auto Module_0_does_not_refer_to_a_value_but_is_used_as_a_value_here = diag(1339, DiagnosticCategory::Error, "Module_0_does_not_refer_to_a_value_but_is_used_as_a_value_here_1339", "Module '{0}' does not refer to a value, but is used as a value here."); + static inline const auto Module_0_does_not_refer_to_a_type_but_is_used_as_a_type_here_Did_you_mean_typeof_import_0 = diag(1340, DiagnosticCategory::Error, "Module_0_does_not_refer_to_a_type_but_is_used_as_a_type_here_Did_you_mean_typeof_import_0_1340", "Module '{0}' does not refer to a type, but is used as a type here. Did you mean 'typeof import('{0}')'?"); + static inline const auto Type_arguments_cannot_be_used_here = diag(1342, DiagnosticCategory::Error, "Type_arguments_cannot_be_used_here_1342", "Type arguments cannot be used here."); + static inline const auto The_import_meta_meta_property_is_only_allowed_when_the_module_option_is_es2020_es2022_esnext_system_node12_or_nodenext = diag(1343, DiagnosticCategory::Error, "The_import_meta_meta_property_is_only_allowed_when_the_module_option_is_es2020_es2022_esnext_system__1343", "The 'import.meta' meta-property is only allowed when the '--module' option is 'es2020', 'es2022', 'esnext', 'system', 'node12', or 'nodenext'."); + static inline const auto A_label_is_not_allowed_here = diag(1344, DiagnosticCategory::Error, "A_label_is_not_allowed_here_1344", "'A label is not allowed here."); + static inline const auto An_expression_of_type_void_cannot_be_tested_for_truthiness = diag(1345, DiagnosticCategory::Error, "An_expression_of_type_void_cannot_be_tested_for_truthiness_1345", "An expression of type 'void' cannot be tested for truthiness."); + static inline const auto This_parameter_is_not_allowed_with_use_strict_directive = diag(1346, DiagnosticCategory::Error, "This_parameter_is_not_allowed_with_use_strict_directive_1346", "This parameter is not allowed with 'use strict' directive."); + static inline const auto use_strict_directive_cannot_be_used_with_non_simple_parameter_list = diag(1347, DiagnosticCategory::Error, "use_strict_directive_cannot_be_used_with_non_simple_parameter_list_1347", "'use strict' directive cannot be used with non-simple parameter list."); + static inline const auto Non_simple_parameter_declared_here = diag(1348, DiagnosticCategory::Error, "Non_simple_parameter_declared_here_1348", "Non-simple parameter declared here."); + static inline const auto use_strict_directive_used_here = diag(1349, DiagnosticCategory::Error, "use_strict_directive_used_here_1349", "'use strict' directive used here."); + static inline const auto Print_the_final_configuration_instead_of_building = diag(1350, DiagnosticCategory::Message, "Print_the_final_configuration_instead_of_building_1350", "Print the final configuration instead of building."); + static inline const auto An_identifier_or_keyword_cannot_immediately_follow_a_numeric_literal = diag(1351, DiagnosticCategory::Error, "An_identifier_or_keyword_cannot_immediately_follow_a_numeric_literal_1351", "An identifier or keyword cannot immediately follow a numeric literal."); + static inline const auto A_bigint_literal_cannot_use_exponential_notation = diag(1352, DiagnosticCategory::Error, "A_bigint_literal_cannot_use_exponential_notation_1352", "A bigint literal cannot use exponential notation."); + static inline const auto A_bigint_literal_must_be_an_integer = diag(1353, DiagnosticCategory::Error, "A_bigint_literal_must_be_an_integer_1353", "A bigint literal must be an integer."); + static inline const auto readonly_type_modifier_is_only_permitted_on_array_and_tuple_literal_types = diag(1354, DiagnosticCategory::Error, "readonly_type_modifier_is_only_permitted_on_array_and_tuple_literal_types_1354", "'readonly' type modifier is only permitted on array and tuple literal types."); + static inline const auto A_const_assertions_can_only_be_applied_to_references_to_enum_members_or_string_number_boolean_array_or_object_literals = diag(1355, DiagnosticCategory::Error, "A_const_assertions_can_only_be_applied_to_references_to_enum_members_or_string_number_boolean_array__1355", "A 'const' assertions can only be applied to references to enum members, or string, number, boolean, array, or object literals."); + static inline const auto Did_you_mean_to_mark_this_function_as_async = diag(1356, DiagnosticCategory::Error, "Did_you_mean_to_mark_this_function_as_async_1356", "Did you mean to mark this function as 'async'?"); + static inline const auto An_enum_member_name_must_be_followed_by_a_or = diag(1357, DiagnosticCategory::Error, "An_enum_member_name_must_be_followed_by_a_or_1357", "An enum member name must be followed by a ',', '=', or '}'."); + static inline const auto Tagged_template_expressions_are_not_permitted_in_an_optional_chain = diag(1358, DiagnosticCategory::Error, "Tagged_template_expressions_are_not_permitted_in_an_optional_chain_1358", "Tagged template expressions are not permitted in an optional chain."); + static inline const auto Identifier_expected_0_is_a_reserved_word_that_cannot_be_used_here = diag(1359, DiagnosticCategory::Error, "Identifier_expected_0_is_a_reserved_word_that_cannot_be_used_here_1359", "Identifier expected. '{0}' is a reserved word that cannot be used here."); + static inline const auto _0_cannot_be_used_as_a_value_because_it_was_imported_using_import_type = diag(1361, DiagnosticCategory::Error, "_0_cannot_be_used_as_a_value_because_it_was_imported_using_import_type_1361", "'{0}' cannot be used as a value because it was imported using 'import type'."); + static inline const auto _0_cannot_be_used_as_a_value_because_it_was_exported_using_export_type = diag(1362, DiagnosticCategory::Error, "_0_cannot_be_used_as_a_value_because_it_was_exported_using_export_type_1362", "'{0}' cannot be used as a value because it was exported using 'export type'."); + static inline const auto A_type_only_import_can_specify_a_default_import_or_named_bindings_but_not_both = diag(1363, DiagnosticCategory::Error, "A_type_only_import_can_specify_a_default_import_or_named_bindings_but_not_both_1363", "A type-only import can specify a default import or named bindings, but not both."); + static inline const auto Convert_to_type_only_export = diag(1364, DiagnosticCategory::Message, "Convert_to_type_only_export_1364", "Convert to type-only export"); + static inline const auto Convert_all_re_exported_types_to_type_only_exports = diag(1365, DiagnosticCategory::Message, "Convert_all_re_exported_types_to_type_only_exports_1365", "Convert all re-exported types to type-only exports"); + static inline const auto Split_into_two_separate_import_declarations = diag(1366, DiagnosticCategory::Message, "Split_into_two_separate_import_declarations_1366", "Split into two separate import declarations"); + static inline const auto Split_all_invalid_type_only_imports = diag(1367, DiagnosticCategory::Message, "Split_all_invalid_type_only_imports_1367", "Split all invalid type-only imports"); + static inline const auto Did_you_mean_0 = diag(1369, DiagnosticCategory::Message, "Did_you_mean_0_1369", "Did you mean '{0}'?"); + static inline const auto This_import_is_never_used_as_a_value_and_must_use_import_type_because_importsNotUsedAsValues_is_set_to_error = diag(1371, DiagnosticCategory::Error, "This_import_is_never_used_as_a_value_and_must_use_import_type_because_importsNotUsedAsValues_is_set__1371", "This import is never used as a value and must use 'import type' because 'importsNotUsedAsValues' is set to 'error'."); + static inline const auto Convert_to_type_only_import = diag(1373, DiagnosticCategory::Message, "Convert_to_type_only_import_1373", "Convert to type-only import"); + static inline const auto Convert_all_imports_not_used_as_a_value_to_type_only_imports = diag(1374, DiagnosticCategory::Message, "Convert_all_imports_not_used_as_a_value_to_type_only_imports_1374", "Convert all imports not used as a value to type-only imports"); + static inline const auto await_expressions_are_only_allowed_at_the_top_level_of_a_file_when_that_file_is_a_module_but_this_file_has_no_imports_or_exports_Consider_adding_an_empty_export_to_make_this_file_a_module = diag(1375, DiagnosticCategory::Error, "await_expressions_are_only_allowed_at_the_top_level_of_a_file_when_that_file_is_a_module_but_this_fi_1375", + "'await' expressions are only allowed at the top level of a file when that file is a module, but this file has no imports or exports. Consider adding an empty 'export {}' to make this file a module."); + static inline const auto _0_was_imported_here = diag(1376, DiagnosticCategory::Message, "_0_was_imported_here_1376", "'{0}' was imported here."); + static inline const auto _0_was_exported_here = diag(1377, DiagnosticCategory::Message, "_0_was_exported_here_1377", "'{0}' was exported here."); + static inline const auto Top_level_await_expressions_are_only_allowed_when_the_module_option_is_set_to_es2022_esnext_system_or_nodenext_and_the_target_option_is_set_to_es2017_or_higher = diag(1378, DiagnosticCategory::Error, "Top_level_await_expressions_are_only_allowed_when_the_module_option_is_set_to_es2022_esnext_system_o_1378", + "Top-level 'await' expressions are only allowed when the 'module' option is set to 'es2022', 'esnext', 'system', or 'nodenext', and the 'target' option is set to 'es2017' or higher."); + static inline const auto An_import_alias_cannot_reference_a_declaration_that_was_exported_using_export_type = diag(1379, DiagnosticCategory::Error, "An_import_alias_cannot_reference_a_declaration_that_was_exported_using_export_type_1379", "An import alias cannot reference a declaration that was exported using 'export type'."); + static inline const auto An_import_alias_cannot_reference_a_declaration_that_was_imported_using_import_type = diag(1380, DiagnosticCategory::Error, "An_import_alias_cannot_reference_a_declaration_that_was_imported_using_import_type_1380", "An import alias cannot reference a declaration that was imported using 'import type'."); + static inline const auto Unexpected_token_Did_you_mean_or_rbrace = diag(1381, DiagnosticCategory::Error, "Unexpected_token_Did_you_mean_or_rbrace_1381", "Unexpected token. Did you mean `{'}'}` or `}`?"); + static inline const auto Unexpected_token_Did_you_mean_or_gt = diag(1382, DiagnosticCategory::Error, "Unexpected_token_Did_you_mean_or_gt_1382", "Unexpected token. Did you mean `{'>'}` or `>`?"); + static inline const auto Only_named_exports_may_use_export_type = diag(1383, DiagnosticCategory::Error, "Only_named_exports_may_use_export_type_1383", "Only named exports may use 'export type'."); + static inline const auto A_new_expression_with_type_arguments_must_always_be_followed_by_a_parenthesized_argument_list = diag(1384, DiagnosticCategory::Error, "A_new_expression_with_type_arguments_must_always_be_followed_by_a_parenthesized_argument_list_1384", "A 'new' expression with type arguments must always be followed by a parenthesized argument list."); + static inline const auto Function_type_notation_must_be_parenthesized_when_used_in_a_union_type = diag(1385, DiagnosticCategory::Error, "Function_type_notation_must_be_parenthesized_when_used_in_a_union_type_1385", "Function type notation must be parenthesized when used in a union type."); + static inline const auto Constructor_type_notation_must_be_parenthesized_when_used_in_a_union_type = diag(1386, DiagnosticCategory::Error, "Constructor_type_notation_must_be_parenthesized_when_used_in_a_union_type_1386", "Constructor type notation must be parenthesized when used in a union type."); + static inline const auto Function_type_notation_must_be_parenthesized_when_used_in_an_intersection_type = diag(1387, DiagnosticCategory::Error, "Function_type_notation_must_be_parenthesized_when_used_in_an_intersection_type_1387", "Function type notation must be parenthesized when used in an intersection type."); + static inline const auto Constructor_type_notation_must_be_parenthesized_when_used_in_an_intersection_type = diag(1388, DiagnosticCategory::Error, "Constructor_type_notation_must_be_parenthesized_when_used_in_an_intersection_type_1388", "Constructor type notation must be parenthesized when used in an intersection type."); + static inline const auto _0_is_not_allowed_as_a_variable_declaration_name = diag(1389, DiagnosticCategory::Error, "_0_is_not_allowed_as_a_variable_declaration_name_1389", "'{0}' is not allowed as a variable declaration name."); + static inline const auto _0_is_not_allowed_as_a_parameter_name = diag(1390, DiagnosticCategory::Error, "_0_is_not_allowed_as_a_parameter_name_1390", "'{0}' is not allowed as a parameter name."); + static inline const auto An_import_alias_cannot_use_import_type = diag(1392, DiagnosticCategory::Error, "An_import_alias_cannot_use_import_type_1392", "An import alias cannot use 'import type'"); + static inline const auto Imported_via_0_from_file_1 = diag(1393, DiagnosticCategory::Message, "Imported_via_0_from_file_1_1393", "Imported via {0} from file '{1}'"); + static inline const auto Imported_via_0_from_file_1_with_packageId_2 = diag(1394, DiagnosticCategory::Message, "Imported_via_0_from_file_1_with_packageId_2_1394", "Imported via {0} from file '{1}' with packageId '{2}'"); + static inline const auto Imported_via_0_from_file_1_to_import_importHelpers_as_specified_in_compilerOptions = diag(1395, DiagnosticCategory::Message, "Imported_via_0_from_file_1_to_import_importHelpers_as_specified_in_compilerOptions_1395", "Imported via {0} from file '{1}' to import 'importHelpers' as specified in compilerOptions"); + static inline const auto Imported_via_0_from_file_1_with_packageId_2_to_import_importHelpers_as_specified_in_compilerOptions = diag(1396, DiagnosticCategory::Message, "Imported_via_0_from_file_1_with_packageId_2_to_import_importHelpers_as_specified_in_compilerOptions_1396", "Imported via {0} from file '{1}' with packageId '{2}' to import 'importHelpers' as specified in compilerOptions"); + static inline const auto Imported_via_0_from_file_1_to_import_jsx_and_jsxs_factory_functions = diag(1397, DiagnosticCategory::Message, "Imported_via_0_from_file_1_to_import_jsx_and_jsxs_factory_functions_1397", "Imported via {0} from file '{1}' to import 'jsx' and 'jsxs' factory functions"); + static inline const auto Imported_via_0_from_file_1_with_packageId_2_to_import_jsx_and_jsxs_factory_functions = diag(1398, DiagnosticCategory::Message, "Imported_via_0_from_file_1_with_packageId_2_to_import_jsx_and_jsxs_factory_functions_1398", "Imported via {0} from file '{1}' with packageId '{2}' to import 'jsx' and 'jsxs' factory functions"); + static inline const auto File_is_included_via_import_here = diag(1399, DiagnosticCategory::Message, "File_is_included_via_import_here_1399", "File is included via import here."); + static inline const auto Referenced_via_0_from_file_1 = diag(1400, DiagnosticCategory::Message, "Referenced_via_0_from_file_1_1400", "Referenced via '{0}' from file '{1}'"); + static inline const auto File_is_included_via_reference_here = diag(1401, DiagnosticCategory::Message, "File_is_included_via_reference_here_1401", "File is included via reference here."); + static inline const auto Type_library_referenced_via_0_from_file_1 = diag(1402, DiagnosticCategory::Message, "Type_library_referenced_via_0_from_file_1_1402", "Type library referenced via '{0}' from file '{1}'"); + static inline const auto Type_library_referenced_via_0_from_file_1_with_packageId_2 = diag(1403, DiagnosticCategory::Message, "Type_library_referenced_via_0_from_file_1_with_packageId_2_1403", "Type library referenced via '{0}' from file '{1}' with packageId '{2}'"); + static inline const auto File_is_included_via_type_library_reference_here = diag(1404, DiagnosticCategory::Message, "File_is_included_via_type_library_reference_here_1404", "File is included via type library reference here."); + static inline const auto Library_referenced_via_0_from_file_1 = diag(1405, DiagnosticCategory::Message, "Library_referenced_via_0_from_file_1_1405", "Library referenced via '{0}' from file '{1}'"); + static inline const auto File_is_included_via_library_reference_here = diag(1406, DiagnosticCategory::Message, "File_is_included_via_library_reference_here_1406", "File is included via library reference here."); + static inline const auto Matched_by_include_pattern_0_in_1 = diag(1407, DiagnosticCategory::Message, "Matched_by_include_pattern_0_in_1_1407", "Matched by include pattern '{0}' in '{1}'"); + static inline const auto File_is_matched_by_include_pattern_specified_here = diag(1408, DiagnosticCategory::Message, "File_is_matched_by_include_pattern_specified_here_1408", "File is matched by include pattern specified here."); + static inline const auto Part_of_files_list_in_tsconfig_json = diag(1409, DiagnosticCategory::Message, "Part_of_files_list_in_tsconfig_json_1409", "Part of 'files' list in tsconfig.json"); + static inline const auto File_is_matched_by_files_list_specified_here = diag(1410, DiagnosticCategory::Message, "File_is_matched_by_files_list_specified_here_1410", "File is matched by 'files' list specified here."); + static inline const auto Output_from_referenced_project_0_included_because_1_specified = diag(1411, DiagnosticCategory::Message, "Output_from_referenced_project_0_included_because_1_specified_1411", "Output from referenced project '{0}' included because '{1}' specified"); + static inline const auto Output_from_referenced_project_0_included_because_module_is_specified_as_none = diag(1412, DiagnosticCategory::Message, "Output_from_referenced_project_0_included_because_module_is_specified_as_none_1412", "Output from referenced project '{0}' included because '--module' is specified as 'none'"); + static inline const auto File_is_output_from_referenced_project_specified_here = diag(1413, DiagnosticCategory::Message, "File_is_output_from_referenced_project_specified_here_1413", "File is output from referenced project specified here."); + static inline const auto Source_from_referenced_project_0_included_because_1_specified = diag(1414, DiagnosticCategory::Message, "Source_from_referenced_project_0_included_because_1_specified_1414", "Source from referenced project '{0}' included because '{1}' specified"); + static inline const auto Source_from_referenced_project_0_included_because_module_is_specified_as_none = diag(1415, DiagnosticCategory::Message, "Source_from_referenced_project_0_included_because_module_is_specified_as_none_1415", "Source from referenced project '{0}' included because '--module' is specified as 'none'"); + static inline const auto File_is_source_from_referenced_project_specified_here = diag(1416, DiagnosticCategory::Message, "File_is_source_from_referenced_project_specified_here_1416", "File is source from referenced project specified here."); + static inline const auto Entry_point_of_type_library_0_specified_in_compilerOptions = diag(1417, DiagnosticCategory::Message, "Entry_point_of_type_library_0_specified_in_compilerOptions_1417", "Entry point of type library '{0}' specified in compilerOptions"); + static inline const auto Entry_point_of_type_library_0_specified_in_compilerOptions_with_packageId_1 = diag(1418, DiagnosticCategory::Message, "Entry_point_of_type_library_0_specified_in_compilerOptions_with_packageId_1_1418", "Entry point of type library '{0}' specified in compilerOptions with packageId '{1}'"); + static inline const auto File_is_entry_point_of_type_library_specified_here = diag(1419, DiagnosticCategory::Message, "File_is_entry_point_of_type_library_specified_here_1419", "File is entry point of type library specified here."); + static inline const auto Entry_point_for_implicit_type_library_0 = diag(1420, DiagnosticCategory::Message, "Entry_point_for_implicit_type_library_0_1420", "Entry point for implicit type library '{0}'"); + static inline const auto Entry_point_for_implicit_type_library_0_with_packageId_1 = diag(1421, DiagnosticCategory::Message, "Entry_point_for_implicit_type_library_0_with_packageId_1_1421", "Entry point for implicit type library '{0}' with packageId '{1}'"); + static inline const auto Library_0_specified_in_compilerOptions = diag(1422, DiagnosticCategory::Message, "Library_0_specified_in_compilerOptions_1422", "Library '{0}' specified in compilerOptions"); + static inline const auto File_is_library_specified_here = diag(1423, DiagnosticCategory::Message, "File_is_library_specified_here_1423", "File is library specified here."); + static inline const auto Default_library = diag(1424, DiagnosticCategory::Message, "Default_library_1424", "Default library"); + static inline const auto Default_library_for_target_0 = diag(1425, DiagnosticCategory::Message, "Default_library_for_target_0_1425", "Default library for target '{0}'"); + static inline const auto File_is_default_library_for_target_specified_here = diag(1426, DiagnosticCategory::Message, "File_is_default_library_for_target_specified_here_1426", "File is default library for target specified here."); + static inline const auto Root_file_specified_for_compilation = diag(1427, DiagnosticCategory::Message, "Root_file_specified_for_compilation_1427", "Root file specified for compilation"); + static inline const auto File_is_output_of_project_reference_source_0 = diag(1428, DiagnosticCategory::Message, "File_is_output_of_project_reference_source_0_1428", "File is output of project reference source '{0}'"); + static inline const auto File_redirects_to_file_0 = diag(1429, DiagnosticCategory::Message, "File_redirects_to_file_0_1429", "File redirects to file '{0}'"); + static inline const auto The_file_is_in_the_program_because_Colon = diag(1430, DiagnosticCategory::Message, "The_file_is_in_the_program_because_Colon_1430", "The file is in the program because:"); + static inline const auto for_await_loops_are_only_allowed_at_the_top_level_of_a_file_when_that_file_is_a_module_but_this_file_has_no_imports_or_exports_Consider_adding_an_empty_export_to_make_this_file_a_module = diag(1431, DiagnosticCategory::Error, "for_await_loops_are_only_allowed_at_the_top_level_of_a_file_when_that_file_is_a_module_but_this_file_1431", + "'for await' loops are only allowed at the top level of a file when that file is a module, but this file has no imports or exports. Consider adding an empty 'export {}' to make this file a module."); + static inline const auto Top_level_for_await_loops_are_only_allowed_when_the_module_option_is_set_to_es2022_esnext_system_or_nodenext_and_the_target_option_is_set_to_es2017_or_higher = diag(1432, DiagnosticCategory::Error, "Top_level_for_await_loops_are_only_allowed_when_the_module_option_is_set_to_es2022_esnext_system_or__1432", + "Top-level 'for await' loops are only allowed when the 'module' option is set to 'es2022', 'esnext', 'system', or 'nodenext', and the 'target' option is set to 'es2017' or higher."); + static inline const auto Decorators_may_not_be_applied_to_this_parameters = diag(1433, DiagnosticCategory::Error, "Decorators_may_not_be_applied_to_this_parameters_1433", "Decorators may not be applied to 'this' parameters."); + static inline const auto Unexpected_keyword_or_identifier = diag(1434, DiagnosticCategory::Error, "Unexpected_keyword_or_identifier_1434", "Unexpected keyword or identifier."); + static inline const auto Unknown_keyword_or_identifier_Did_you_mean_0 = diag(1435, DiagnosticCategory::Error, "Unknown_keyword_or_identifier_Did_you_mean_0_1435", "Unknown keyword or identifier. Did you mean '{0}'?"); + static inline const auto Decorators_must_precede_the_name_and_all_keywords_of_property_declarations = diag(1436, DiagnosticCategory::Error, "Decorators_must_precede_the_name_and_all_keywords_of_property_declarations_1436", "Decorators must precede the name and all keywords of property declarations."); + static inline const auto Namespace_must_be_given_a_name = diag(1437, DiagnosticCategory::Error, "Namespace_must_be_given_a_name_1437", "Namespace must be given a name."); + static inline const auto Interface_must_be_given_a_name = diag(1438, DiagnosticCategory::Error, "Interface_must_be_given_a_name_1438", "Interface must be given a name."); + static inline const auto Type_alias_must_be_given_a_name = diag(1439, DiagnosticCategory::Error, "Type_alias_must_be_given_a_name_1439", "Type alias must be given a name."); + static inline const auto Variable_declaration_not_allowed_at_this_location = diag(1440, DiagnosticCategory::Error, "Variable_declaration_not_allowed_at_this_location_1440", "Variable declaration not allowed at this location."); + static inline const auto Cannot_start_a_function_call_in_a_type_annotation = diag(1441, DiagnosticCategory::Error, "Cannot_start_a_function_call_in_a_type_annotation_1441", "Cannot start a function call in a type annotation."); + static inline const auto Expected_for_property_initializer = diag(1442, DiagnosticCategory::Error, "Expected_for_property_initializer_1442", "Expected '=' for property initializer."); + static inline const auto Module_declaration_names_may_only_use_or_quoted_strings = diag(1443, DiagnosticCategory::Error, "Module_declaration_names_may_only_use_or_quoted_strings_1443", "Module declaration names may only use ' or \" quoted strings."); + static inline const auto _0_is_a_type_and_must_be_imported_using_a_type_only_import_when_preserveValueImports_and_isolatedModules_are_both_enabled = diag(1444, DiagnosticCategory::Error, "_0_is_a_type_and_must_be_imported_using_a_type_only_import_when_preserveValueImports_and_isolatedMod_1444", "'{0}' is a type and must be imported using a type-only import when 'preserveValueImports' and 'isolatedModules' are both enabled."); + static inline const auto _0_resolves_to_a_type_only_declaration_and_must_be_imported_using_a_type_only_import_when_preserveValueImports_and_isolatedModules_are_both_enabled = diag(1446, DiagnosticCategory::Error, "_0_resolves_to_a_type_only_declaration_and_must_be_imported_using_a_type_only_import_when_preserveVa_1446", "'{0}' resolves to a type-only declaration and must be imported using a type-only import when 'preserveValueImports' and 'isolatedModules' are both enabled."); + static inline const auto _0_resolves_to_a_type_only_declaration_and_must_be_re_exported_using_a_type_only_re_export_when_isolatedModules_is_enabled = diag(1448, DiagnosticCategory::Error, "_0_resolves_to_a_type_only_declaration_and_must_be_re_exported_using_a_type_only_re_export_when_isol_1448", "'{0}' resolves to a type-only declaration and must be re-exported using a type-only re-export when 'isolatedModules' is enabled."); + static inline const auto Preserve_unused_imported_values_in_the_JavaScript_output_that_would_otherwise_be_removed = diag(1449, DiagnosticCategory::Message, "Preserve_unused_imported_values_in_the_JavaScript_output_that_would_otherwise_be_removed_1449", "Preserve unused imported values in the JavaScript output that would otherwise be removed."); + static inline const auto Dynamic_imports_can_only_accept_a_module_specifier_and_an_optional_assertion_as_arguments = diag(1450, DiagnosticCategory::Message, "Dynamic_imports_can_only_accept_a_module_specifier_and_an_optional_assertion_as_arguments_1450", "Dynamic imports can only accept a module specifier and an optional assertion as arguments"); + static inline const auto Private_identifiers_are_only_allowed_in_class_bodies_and_may_only_be_used_as_part_of_a_class_member_declaration_property_access_or_on_the_left_hand_side_of_an_in_expression = diag(1451, DiagnosticCategory::Error, "Private_identifiers_are_only_allowed_in_class_bodies_and_may_only_be_used_as_part_of_a_class_member__1451", + "Private identifiers are only allowed in class bodies and may only be used as part of a class member declaration, property access, or on the left-hand-side of an 'in' expression"); + static inline const auto The_import_meta_meta_property_is_not_allowed_in_files_which_will_build_into_CommonJS_output = diag(1470, DiagnosticCategory::Error, "The_import_meta_meta_property_is_not_allowed_in_files_which_will_build_into_CommonJS_output_1470", "The 'import.meta' meta-property is not allowed in files which will build into CommonJS output."); + static inline const auto Module_0_cannot_be_imported_using_this_construct_The_specifier_only_resolves_to_an_ES_module_which_cannot_be_imported_synchronously_Use_dynamic_import_instead = diag(1471, DiagnosticCategory::Error, "Module_0_cannot_be_imported_using_this_construct_The_specifier_only_resolves_to_an_ES_module_which_c_1471", + "Module '{0}' cannot be imported using this construct. The specifier only resolves to an ES module, which cannot be imported synchronously. Use dynamic import instead."); + static inline const auto The_types_of_0_are_incompatible_between_these_types = diag(2200, DiagnosticCategory::Error, "The_types_of_0_are_incompatible_between_these_types_2200", "The types of '{0}' are incompatible between these types."); + static inline const auto The_types_returned_by_0_are_incompatible_between_these_types = diag(2201, DiagnosticCategory::Error, "The_types_returned_by_0_are_incompatible_between_these_types_2201", "The types returned by '{0}' are incompatible between these types."); + static inline const auto Call_signature_return_types_0_and_1_are_incompatible = diag(2202, DiagnosticCategory::Error, "Call_signature_return_types_0_and_1_are_incompatible_2202", "Call signature return types '{0}' and '{1}' are incompatible.", /*reportsUnnecessary*/ false, /*elidedInCompatabilityPyramid*/ true); + static inline const auto Construct_signature_return_types_0_and_1_are_incompatible = diag(2203, DiagnosticCategory::Error, "Construct_signature_return_types_0_and_1_are_incompatible_2203", "Construct signature return types '{0}' and '{1}' are incompatible.", /*reportsUnnecessary*/ false, /*elidedInCompatabilityPyramid*/ true); + static inline const auto Call_signatures_with_no_arguments_have_incompatible_return_types_0_and_1 = diag(2204, DiagnosticCategory::Error, "Call_signatures_with_no_arguments_have_incompatible_return_types_0_and_1_2204", "Call signatures with no arguments have incompatible return types '{0}' and '{1}'.", /*reportsUnnecessary*/ false, /*elidedInCompatabilityPyramid*/ true); + static inline const auto Construct_signatures_with_no_arguments_have_incompatible_return_types_0_and_1 = diag(2205, DiagnosticCategory::Error, "Construct_signatures_with_no_arguments_have_incompatible_return_types_0_and_1_2205", "Construct signatures with no arguments have incompatible return types '{0}' and '{1}'.", /*reportsUnnecessary*/ false, /*elidedInCompatabilityPyramid*/ true); + static inline const auto The_type_modifier_cannot_be_used_on_a_named_import_when_import_type_is_used_on_its_import_statement = diag(2206, DiagnosticCategory::Error, "The_type_modifier_cannot_be_used_on_a_named_import_when_import_type_is_used_on_its_import_statement_2206", "The 'type' modifier cannot be used on a named import when 'import type' is used on its import statement."); + static inline const auto The_type_modifier_cannot_be_used_on_a_named_export_when_export_type_is_used_on_its_export_statement = diag(2207, DiagnosticCategory::Error, "The_type_modifier_cannot_be_used_on_a_named_export_when_export_type_is_used_on_its_export_statement_2207", "The 'type' modifier cannot be used on a named export when 'export type' is used on its export statement."); + static inline const auto Duplicate_identifier_0 = diag(2300, DiagnosticCategory::Error, "Duplicate_identifier_0_2300", "Duplicate identifier '{0}'."); + static inline const auto Initializer_of_instance_member_variable_0_cannot_reference_identifier_1_declared_in_the_constructor = diag(2301, DiagnosticCategory::Error, "Initializer_of_instance_member_variable_0_cannot_reference_identifier_1_declared_in_the_constructor_2301", "Initializer of instance member variable '{0}' cannot reference identifier '{1}' declared in the constructor."); + static inline const auto Static_members_cannot_reference_class_type_parameters = diag(2302, DiagnosticCategory::Error, "Static_members_cannot_reference_class_type_parameters_2302", "Static members cannot reference class type parameters."); + static inline const auto Circular_definition_of_import_alias_0 = diag(2303, DiagnosticCategory::Error, "Circular_definition_of_import_alias_0_2303", "Circular definition of import alias '{0}'."); + static inline const auto Cannot_find_name_0 = diag(2304, DiagnosticCategory::Error, "Cannot_find_name_0_2304", "Cannot find name '{0}'."); + static inline const auto Module_0_has_no_exported_member_1 = diag(2305, DiagnosticCategory::Error, "Module_0_has_no_exported_member_1_2305", "Module '{0}' has no exported member '{1}'."); + static inline const auto File_0_is_not_a_module = diag(2306, DiagnosticCategory::Error, "File_0_is_not_a_module_2306", "File '{0}' is not a module."); + static inline const auto Cannot_find_module_0_or_its_corresponding_type_declarations = diag(2307, DiagnosticCategory::Error, "Cannot_find_module_0_or_its_corresponding_type_declarations_2307", "Cannot find module '{0}' or its corresponding type declarations."); + static inline const auto Module_0_has_already_exported_a_member_named_1_Consider_explicitly_re_exporting_to_resolve_the_ambiguity = diag(2308, DiagnosticCategory::Error, "Module_0_has_already_exported_a_member_named_1_Consider_explicitly_re_exporting_to_resolve_the_ambig_2308", "Module {0} has already exported a member named '{1}'. Consider explicitly re-exporting to resolve the ambiguity."); + static inline const auto An_export_assignment_cannot_be_used_in_a_module_with_other_exported_elements = diag(2309, DiagnosticCategory::Error, "An_export_assignment_cannot_be_used_in_a_module_with_other_exported_elements_2309", "An export assignment cannot be used in a module with other exported elements."); + static inline const auto Type_0_recursively_references_itself_as_a_base_type = diag(2310, DiagnosticCategory::Error, "Type_0_recursively_references_itself_as_a_base_type_2310", "Type '{0}' recursively references itself as a base type."); + static inline const auto An_interface_can_only_extend_an_object_type_or_intersection_of_object_types_with_statically_known_members = diag(2312, DiagnosticCategory::Error, "An_interface_can_only_extend_an_object_type_or_intersection_of_object_types_with_statically_known_me_2312", "An interface can only extend an object type or intersection of object types with statically known members."); + static inline const auto Type_parameter_0_has_a_circular_constraint = diag(2313, DiagnosticCategory::Error, "Type_parameter_0_has_a_circular_constraint_2313", "Type parameter '{0}' has a circular constraint."); + static inline const auto Generic_type_0_requires_1_type_argument_s = diag(2314, DiagnosticCategory::Error, "Generic_type_0_requires_1_type_argument_s_2314", "Generic type '{0}' requires {1} type argument(s)."); + static inline const auto Type_0_is_not_generic = diag(2315, DiagnosticCategory::Error, "Type_0_is_not_generic_2315", "Type '{0}' is not generic."); + static inline const auto Global_type_0_must_be_a_class_or_interface_type = diag(2316, DiagnosticCategory::Error, "Global_type_0_must_be_a_class_or_interface_type_2316", "Global type '{0}' must be a class or interface type."); + static inline const auto Global_type_0_must_have_1_type_parameter_s = diag(2317, DiagnosticCategory::Error, "Global_type_0_must_have_1_type_parameter_s_2317", "Global type '{0}' must have {1} type parameter(s)."); + static inline const auto Cannot_find_global_type_0 = diag(2318, DiagnosticCategory::Error, "Cannot_find_global_type_0_2318", "Cannot find global type '{0}'."); + static inline const auto Named_property_0_of_types_1_and_2_are_not_identical = diag(2319, DiagnosticCategory::Error, "Named_property_0_of_types_1_and_2_are_not_identical_2319", "Named property '{0}' of types '{1}' and '{2}' are not identical."); + static inline const auto Interface_0_cannot_simultaneously_extend_types_1_and_2 = diag(2320, DiagnosticCategory::Error, "Interface_0_cannot_simultaneously_extend_types_1_and_2_2320", "Interface '{0}' cannot simultaneously extend types '{1}' and '{2}'."); + static inline const auto Excessive_stack_depth_comparing_types_0_and_1 = diag(2321, DiagnosticCategory::Error, "Excessive_stack_depth_comparing_types_0_and_1_2321", "Excessive stack depth comparing types '{0}' and '{1}'."); + static inline const auto Type_0_is_not_assignable_to_type_1 = diag(2322, DiagnosticCategory::Error, "Type_0_is_not_assignable_to_type_1_2322", "Type '{0}' is not assignable to type '{1}'."); + static inline const auto Cannot_redeclare_exported_variable_0 = diag(2323, DiagnosticCategory::Error, "Cannot_redeclare_exported_variable_0_2323", "Cannot redeclare exported variable '{0}'."); + static inline const auto Property_0_is_missing_in_type_1 = diag(2324, DiagnosticCategory::Error, "Property_0_is_missing_in_type_1_2324", "Property '{0}' is missing in type '{1}'."); + static inline const auto Property_0_is_private_in_type_1_but_not_in_type_2 = diag(2325, DiagnosticCategory::Error, "Property_0_is_private_in_type_1_but_not_in_type_2_2325", "Property '{0}' is private in type '{1}' but not in type '{2}'."); + static inline const auto Types_of_property_0_are_incompatible = diag(2326, DiagnosticCategory::Error, "Types_of_property_0_are_incompatible_2326", "Types of property '{0}' are incompatible."); + static inline const auto Property_0_is_optional_in_type_1_but_required_in_type_2 = diag(2327, DiagnosticCategory::Error, "Property_0_is_optional_in_type_1_but_required_in_type_2_2327", "Property '{0}' is optional in type '{1}' but required in type '{2}'."); + static inline const auto Types_of_parameters_0_and_1_are_incompatible = diag(2328, DiagnosticCategory::Error, "Types_of_parameters_0_and_1_are_incompatible_2328", "Types of parameters '{0}' and '{1}' are incompatible."); + static inline const auto Index_signature_for_type_0_is_missing_in_type_1 = diag(2329, DiagnosticCategory::Error, "Index_signature_for_type_0_is_missing_in_type_1_2329", "Index signature for type '{0}' is missing in type '{1}'."); + static inline const auto _0_and_1_index_signatures_are_incompatible = diag(2330, DiagnosticCategory::Error, "_0_and_1_index_signatures_are_incompatible_2330", "'{0}' and '{1}' index signatures are incompatible."); + static inline const auto this_cannot_be_referenced_in_a_module_or_namespace_body = diag(2331, DiagnosticCategory::Error, "this_cannot_be_referenced_in_a_module_or_namespace_body_2331", "'this' cannot be referenced in a module or namespace body."); + static inline const auto this_cannot_be_referenced_in_current_location = diag(2332, DiagnosticCategory::Error, "this_cannot_be_referenced_in_current_location_2332", "'this' cannot be referenced in current location."); + static inline const auto this_cannot_be_referenced_in_constructor_arguments = diag(2333, DiagnosticCategory::Error, "this_cannot_be_referenced_in_constructor_arguments_2333", "'this' cannot be referenced in constructor arguments."); + static inline const auto this_cannot_be_referenced_in_a_static_property_initializer = diag(2334, DiagnosticCategory::Error, "this_cannot_be_referenced_in_a_static_property_initializer_2334", "'this' cannot be referenced in a static property initializer."); + static inline const auto super_can_only_be_referenced_in_a_derived_class = diag(2335, DiagnosticCategory::Error, "super_can_only_be_referenced_in_a_derived_class_2335", "'super' can only be referenced in a derived class."); + static inline const auto super_cannot_be_referenced_in_constructor_arguments = diag(2336, DiagnosticCategory::Error, "super_cannot_be_referenced_in_constructor_arguments_2336", "'super' cannot be referenced in constructor arguments."); + static inline const auto Super_calls_are_not_permitted_outside_constructors_or_in_nested_functions_inside_constructors = diag(2337, DiagnosticCategory::Error, "Super_calls_are_not_permitted_outside_constructors_or_in_nested_functions_inside_constructors_2337", "Super calls are not permitted outside constructors or in nested functions inside constructors."); + static inline const auto super_property_access_is_permitted_only_in_a_constructor_member_function_or_member_accessor_of_a_derived_class = diag(2338, DiagnosticCategory::Error, "super_property_access_is_permitted_only_in_a_constructor_member_function_or_member_accessor_of_a_der_2338", "'super' property access is permitted only in a constructor, member function, or member accessor of a derived class."); + static inline const auto Property_0_does_not_exist_on_type_1 = diag(2339, DiagnosticCategory::Error, "Property_0_does_not_exist_on_type_1_2339", "Property '{0}' does not exist on type '{1}'."); + static inline const auto Only_public_and_protected_methods_of_the_base_class_are_accessible_via_the_super_keyword = diag(2340, DiagnosticCategory::Error, "Only_public_and_protected_methods_of_the_base_class_are_accessible_via_the_super_keyword_2340", "Only public and protected methods of the base class are accessible via the 'super' keyword."); + static inline const auto Property_0_is_private_and_only_accessible_within_class_1 = diag(2341, DiagnosticCategory::Error, "Property_0_is_private_and_only_accessible_within_class_1_2341", "Property '{0}' is private and only accessible within class '{1}'."); + static inline const auto This_syntax_requires_an_imported_helper_named_1_which_does_not_exist_in_0_Consider_upgrading_your_version_of_0 = diag(2343, DiagnosticCategory::Error, "This_syntax_requires_an_imported_helper_named_1_which_does_not_exist_in_0_Consider_upgrading_your_ve_2343", "This syntax requires an imported helper named '{1}' which does not exist in '{0}'. Consider upgrading your version of '{0}'."); + static inline const auto Type_0_does_not_satisfy_the_constraint_1 = diag(2344, DiagnosticCategory::Error, "Type_0_does_not_satisfy_the_constraint_1_2344", "Type '{0}' does not satisfy the constraint '{1}'."); + static inline const auto Argument_of_type_0_is_not_assignable_to_parameter_of_type_1 = diag(2345, DiagnosticCategory::Error, "Argument_of_type_0_is_not_assignable_to_parameter_of_type_1_2345", "Argument of type '{0}' is not assignable to parameter of type '{1}'."); + static inline const auto Call_target_does_not_contain_any_signatures = diag(2346, DiagnosticCategory::Error, "Call_target_does_not_contain_any_signatures_2346", "Call target does not contain any signatures."); + static inline const auto Untyped_function_calls_may_not_accept_type_arguments = diag(2347, DiagnosticCategory::Error, "Untyped_function_calls_may_not_accept_type_arguments_2347", "Untyped function calls may not accept type arguments."); + static inline const auto Value_of_type_0_is_not_callable_Did_you_mean_to_include_new = diag(2348, DiagnosticCategory::Error, "Value_of_type_0_is_not_callable_Did_you_mean_to_include_new_2348", "Value of type '{0}' is not callable. Did you mean to include 'new'?"); + static inline const auto This_expression_is_not_callable = diag(2349, DiagnosticCategory::Error, "This_expression_is_not_callable_2349", "This expression is not callable."); + static inline const auto Only_a_void_function_can_be_called_with_the_new_keyword = diag(2350, DiagnosticCategory::Error, "Only_a_void_function_can_be_called_with_the_new_keyword_2350", "Only a void function can be called with the 'new' keyword."); + static inline const auto This_expression_is_not_constructable = diag(2351, DiagnosticCategory::Error, "This_expression_is_not_constructable_2351", "This expression is not constructable."); + static inline const auto Conversion_of_type_0_to_type_1_may_be_a_mistake_because_neither_type_sufficiently_overlaps_with_the_other_If_this_was_intentional_convert_the_expression_to_unknown_first = diag(2352, DiagnosticCategory::Error, "Conversion_of_type_0_to_type_1_may_be_a_mistake_because_neither_type_sufficiently_overlaps_with_the__2352", + "Conversion of type '{0}' to type '{1}' may be a mistake because neither type sufficiently overlaps with the other. If this was intentional, convert the expression to 'unknown' first."); + static inline const auto Object_literal_may_only_specify_known_properties_and_0_does_not_exist_in_type_1 = diag(2353, DiagnosticCategory::Error, "Object_literal_may_only_specify_known_properties_and_0_does_not_exist_in_type_1_2353", "Object literal may only specify known properties, and '{0}' does not exist in type '{1}'."); + static inline const auto This_syntax_requires_an_imported_helper_but_module_0_cannot_be_found = diag(2354, DiagnosticCategory::Error, "This_syntax_requires_an_imported_helper_but_module_0_cannot_be_found_2354", "This syntax requires an imported helper but module '{0}' cannot be found."); + static inline const auto A_function_whose_declared_type_is_neither_void_nor_any_must_return_a_value = diag(2355, DiagnosticCategory::Error, "A_function_whose_declared_type_is_neither_void_nor_any_must_return_a_value_2355", "A function whose declared type is neither 'void' nor 'any' must return a value."); + static inline const auto An_arithmetic_operand_must_be_of_type_any_number_bigint_or_an_enum_type = diag(2356, DiagnosticCategory::Error, "An_arithmetic_operand_must_be_of_type_any_number_bigint_or_an_enum_type_2356", "An arithmetic operand must be of type 'any', 'number', 'bigint' or an enum type."); + static inline const auto The_operand_of_an_increment_or_decrement_operator_must_be_a_variable_or_a_property_access = diag(2357, DiagnosticCategory::Error, "The_operand_of_an_increment_or_decrement_operator_must_be_a_variable_or_a_property_access_2357", "The operand of an increment or decrement operator must be a variable or a property access."); + static inline const auto The_left_hand_side_of_an_instanceof_expression_must_be_of_type_any_an_object_type_or_a_type_parameter = diag(2358, DiagnosticCategory::Error, "The_left_hand_side_of_an_instanceof_expression_must_be_of_type_any_an_object_type_or_a_type_paramete_2358", "The left-hand side of an 'instanceof' expression must be of type 'any', an object type or a type parameter."); + static inline const auto The_right_hand_side_of_an_instanceof_expression_must_be_of_type_any_or_of_a_type_assignable_to_the_Function_interface_type = diag(2359, DiagnosticCategory::Error, "The_right_hand_side_of_an_instanceof_expression_must_be_of_type_any_or_of_a_type_assignable_to_the_F_2359", "The right-hand side of an 'instanceof' expression must be of type 'any' or of a type assignable to the 'Function' interface type."); + static inline const auto The_left_hand_side_of_an_in_expression_must_be_a_private_identifier_or_of_type_any_string_number_or_symbol = diag(2360, DiagnosticCategory::Error, "The_left_hand_side_of_an_in_expression_must_be_a_private_identifier_or_of_type_any_string_number_or__2360", "The left-hand side of an 'in' expression must be a private identifier or of type 'any', 'string', 'number', or 'symbol'."); + static inline const auto The_right_hand_side_of_an_in_expression_must_not_be_a_primitive = diag(2361, DiagnosticCategory::Error, "The_right_hand_side_of_an_in_expression_must_not_be_a_primitive_2361", "The right-hand side of an 'in' expression must not be a primitive."); + static inline const auto The_left_hand_side_of_an_arithmetic_operation_must_be_of_type_any_number_bigint_or_an_enum_type = diag(2362, DiagnosticCategory::Error, "The_left_hand_side_of_an_arithmetic_operation_must_be_of_type_any_number_bigint_or_an_enum_type_2362", "The left-hand side of an arithmetic operation must be of type 'any', 'number', 'bigint' or an enum type."); + static inline const auto The_right_hand_side_of_an_arithmetic_operation_must_be_of_type_any_number_bigint_or_an_enum_type = diag(2363, DiagnosticCategory::Error, "The_right_hand_side_of_an_arithmetic_operation_must_be_of_type_any_number_bigint_or_an_enum_type_2363", "The right-hand side of an arithmetic operation must be of type 'any', 'number', 'bigint' or an enum type."); + static inline const auto The_left_hand_side_of_an_assignment_expression_must_be_a_variable_or_a_property_access = diag(2364, DiagnosticCategory::Error, "The_left_hand_side_of_an_assignment_expression_must_be_a_variable_or_a_property_access_2364", "The left-hand side of an assignment expression must be a variable or a property access."); + static inline const auto Operator_0_cannot_be_applied_to_types_1_and_2 = diag(2365, DiagnosticCategory::Error, "Operator_0_cannot_be_applied_to_types_1_and_2_2365", "Operator '{0}' cannot be applied to types '{1}' and '{2}'."); + static inline const auto Function_lacks_ending_return_statement_and_return_type_does_not_include_undefined = diag(2366, DiagnosticCategory::Error, "Function_lacks_ending_return_statement_and_return_type_does_not_include_undefined_2366", "Function lacks ending return statement and return type does not include 'undefined'."); + static inline const auto This_condition_will_always_return_0_since_the_types_1_and_2_have_no_overlap = diag(2367, DiagnosticCategory::Error, "This_condition_will_always_return_0_since_the_types_1_and_2_have_no_overlap_2367", "This condition will always return '{0}' since the types '{1}' and '{2}' have no overlap."); + static inline const auto Type_parameter_name_cannot_be_0 = diag(2368, DiagnosticCategory::Error, "Type_parameter_name_cannot_be_0_2368", "Type parameter name cannot be '{0}'."); + static inline const auto A_parameter_property_is_only_allowed_in_a_constructor_implementation = diag(2369, DiagnosticCategory::Error, "A_parameter_property_is_only_allowed_in_a_constructor_implementation_2369", "A parameter property is only allowed in a constructor implementation."); + static inline const auto A_rest_parameter_must_be_of_an_array_type = diag(2370, DiagnosticCategory::Error, "A_rest_parameter_must_be_of_an_array_type_2370", "A rest parameter must be of an array type."); + static inline const auto A_parameter_initializer_is_only_allowed_in_a_function_or_constructor_implementation = diag(2371, DiagnosticCategory::Error, "A_parameter_initializer_is_only_allowed_in_a_function_or_constructor_implementation_2371", "A parameter initializer is only allowed in a function or constructor implementation."); + static inline const auto Parameter_0_cannot_reference_itself = diag(2372, DiagnosticCategory::Error, "Parameter_0_cannot_reference_itself_2372", "Parameter '{0}' cannot reference itself."); + static inline const auto Parameter_0_cannot_reference_identifier_1_declared_after_it = diag(2373, DiagnosticCategory::Error, "Parameter_0_cannot_reference_identifier_1_declared_after_it_2373", "Parameter '{0}' cannot reference identifier '{1}' declared after it."); + static inline const auto Duplicate_index_signature_for_type_0 = diag(2374, DiagnosticCategory::Error, "Duplicate_index_signature_for_type_0_2374", "Duplicate index signature for type '{0}'."); + static inline const auto Type_0_is_not_assignable_to_type_1_with_exactOptionalPropertyTypes_Colon_true_Consider_adding_undefined_to_the_types_of_the_target_s_properties = diag(2375, DiagnosticCategory::Error, "Type_0_is_not_assignable_to_type_1_with_exactOptionalPropertyTypes_Colon_true_Consider_adding_undefi_2375", "Type '{0}' is not assignable to type '{1}' with 'exactOptionalPropertyTypes: true'. Consider adding 'undefined' to the types of the target's properties."); + static inline const auto A_super_call_must_be_the_first_statement_in_the_constructor_when_a_class_contains_initialized_properties_parameter_properties_or_private_identifiers = diag(2376, DiagnosticCategory::Error, "A_super_call_must_be_the_first_statement_in_the_constructor_when_a_class_contains_initialized_proper_2376", "A 'super' call must be the first statement in the constructor when a class contains initialized properties, parameter properties, or private identifiers."); + static inline const auto Constructors_for_derived_classes_must_contain_a_super_call = diag(2377, DiagnosticCategory::Error, "Constructors_for_derived_classes_must_contain_a_super_call_2377", "Constructors for derived classes must contain a 'super' call."); + static inline const auto A_get_accessor_must_return_a_value = diag(2378, DiagnosticCategory::Error, "A_get_accessor_must_return_a_value_2378", "A 'get' accessor must return a value."); + static inline const auto Argument_of_type_0_is_not_assignable_to_parameter_of_type_1_with_exactOptionalPropertyTypes_Colon_true_Consider_adding_undefined_to_the_types_of_the_target_s_properties = diag(2379, DiagnosticCategory::Error, "Argument_of_type_0_is_not_assignable_to_parameter_of_type_1_with_exactOptionalPropertyTypes_Colon_tr_2379", + "Argument of type '{0}' is not assignable to parameter of type '{1}' with 'exactOptionalPropertyTypes: true'. Consider adding 'undefined' to the types of the target's properties."); + static inline const auto The_return_type_of_a_get_accessor_must_be_assignable_to_its_set_accessor_type = diag(2380, DiagnosticCategory::Error, "The_return_type_of_a_get_accessor_must_be_assignable_to_its_set_accessor_type_2380", "The return type of a 'get' accessor must be assignable to its 'set' accessor type"); + static inline const auto Overload_signatures_must_all_be_exported_or_non_exported = diag(2383, DiagnosticCategory::Error, "Overload_signatures_must_all_be_exported_or_non_exported_2383", "Overload signatures must all be exported or non-exported."); + static inline const auto Overload_signatures_must_all_be_ambient_or_non_ambient = diag(2384, DiagnosticCategory::Error, "Overload_signatures_must_all_be_ambient_or_non_ambient_2384", "Overload signatures must all be ambient or non-ambient."); + static inline const auto Overload_signatures_must_all_be_public_private_or_protected = diag(2385, DiagnosticCategory::Error, "Overload_signatures_must_all_be_public_private_or_protected_2385", "Overload signatures must all be public, private or protected."); + static inline const auto Overload_signatures_must_all_be_optional_or_required = diag(2386, DiagnosticCategory::Error, "Overload_signatures_must_all_be_optional_or_required_2386", "Overload signatures must all be optional or required."); + static inline const auto Function_overload_must_be_static = diag(2387, DiagnosticCategory::Error, "Function_overload_must_be_static_2387", "Function overload must be static."); + static inline const auto Function_overload_must_not_be_static = diag(2388, DiagnosticCategory::Error, "Function_overload_must_not_be_static_2388", "Function overload must not be static."); + static inline const auto Function_implementation_name_must_be_0 = diag(2389, DiagnosticCategory::Error, "Function_implementation_name_must_be_0_2389", "Function implementation name must be '{0}'."); + static inline const auto Constructor_implementation_is_missing = diag(2390, DiagnosticCategory::Error, "Constructor_implementation_is_missing_2390", "Constructor implementation is missing."); + static inline const auto Function_implementation_is_missing_or_not_immediately_following_the_declaration = diag(2391, DiagnosticCategory::Error, "Function_implementation_is_missing_or_not_immediately_following_the_declaration_2391", "Function implementation is missing or not immediately following the declaration."); + static inline const auto Multiple_constructor_implementations_are_not_allowed = diag(2392, DiagnosticCategory::Error, "Multiple_constructor_implementations_are_not_allowed_2392", "Multiple constructor implementations are not allowed."); + static inline const auto Duplicate_function_implementation = diag(2393, DiagnosticCategory::Error, "Duplicate_function_implementation_2393", "Duplicate function implementation."); + static inline const auto This_overload_signature_is_not_compatible_with_its_implementation_signature = diag(2394, DiagnosticCategory::Error, "This_overload_signature_is_not_compatible_with_its_implementation_signature_2394", "This overload signature is not compatible with its implementation signature."); + static inline const auto Individual_declarations_in_merged_declaration_0_must_be_all_exported_or_all_local = diag(2395, DiagnosticCategory::Error, "Individual_declarations_in_merged_declaration_0_must_be_all_exported_or_all_local_2395", "Individual declarations in merged declaration '{0}' must be all exported or all local."); + static inline const auto Duplicate_identifier_arguments_Compiler_uses_arguments_to_initialize_rest_parameters = diag(2396, DiagnosticCategory::Error, "Duplicate_identifier_arguments_Compiler_uses_arguments_to_initialize_rest_parameters_2396", "Duplicate identifier 'arguments'. Compiler uses 'arguments' to initialize rest parameters."); + static inline const auto Declaration_name_conflicts_with_built_in_global_identifier_0 = diag(2397, DiagnosticCategory::Error, "Declaration_name_conflicts_with_built_in_global_identifier_0_2397", "Declaration name conflicts with built-in global identifier '{0}'."); + static inline const auto constructor_cannot_be_used_as_a_parameter_property_name = diag(2398, DiagnosticCategory::Error, "constructor_cannot_be_used_as_a_parameter_property_name_2398", "'constructor' cannot be used as a parameter property name."); + static inline const auto Duplicate_identifier_this_Compiler_uses_variable_declaration_this_to_capture_this_reference = diag(2399, DiagnosticCategory::Error, "Duplicate_identifier_this_Compiler_uses_variable_declaration_this_to_capture_this_reference_2399", "Duplicate identifier '_this'. Compiler uses variable declaration '_this' to capture 'this' reference."); + static inline const auto Expression_resolves_to_variable_declaration_this_that_compiler_uses_to_capture_this_reference = diag(2400, DiagnosticCategory::Error, "Expression_resolves_to_variable_declaration_this_that_compiler_uses_to_capture_this_reference_2400", "Expression resolves to variable declaration '_this' that compiler uses to capture 'this' reference."); + static inline const auto Expression_resolves_to_super_that_compiler_uses_to_capture_base_class_reference = diag(2402, DiagnosticCategory::Error, "Expression_resolves_to_super_that_compiler_uses_to_capture_base_class_reference_2402", "Expression resolves to '_super' that compiler uses to capture base class reference."); + static inline const auto Subsequent_variable_declarations_must_have_the_same_type_Variable_0_must_be_of_type_1_but_here_has_type_2 = diag(2403, DiagnosticCategory::Error, "Subsequent_variable_declarations_must_have_the_same_type_Variable_0_must_be_of_type_1_but_here_has_t_2403", "Subsequent variable declarations must have the same type. Variable '{0}' must be of type '{1}', but here has type '{2}'."); + static inline const auto The_left_hand_side_of_a_for_in_statement_cannot_use_a_type_annotation = diag(2404, DiagnosticCategory::Error, "The_left_hand_side_of_a_for_in_statement_cannot_use_a_type_annotation_2404", "The left-hand side of a 'for...in' statement cannot use a type annotation."); + static inline const auto The_left_hand_side_of_a_for_in_statement_must_be_of_type_string_or_any = diag(2405, DiagnosticCategory::Error, "The_left_hand_side_of_a_for_in_statement_must_be_of_type_string_or_any_2405", "The left-hand side of a 'for...in' statement must be of type 'string' or 'any'."); + static inline const auto The_left_hand_side_of_a_for_in_statement_must_be_a_variable_or_a_property_access = diag(2406, DiagnosticCategory::Error, "The_left_hand_side_of_a_for_in_statement_must_be_a_variable_or_a_property_access_2406", "The left-hand side of a 'for...in' statement must be a variable or a property access."); + static inline const auto The_right_hand_side_of_a_for_in_statement_must_be_of_type_any_an_object_type_or_a_type_parameter_but_here_has_type_0 = diag(2407, DiagnosticCategory::Error, "The_right_hand_side_of_a_for_in_statement_must_be_of_type_any_an_object_type_or_a_type_parameter_but_2407", "The right-hand side of a 'for...in' statement must be of type 'any', an object type or a type parameter, but here has type '{0}'."); + static inline const auto Setters_cannot_return_a_value = diag(2408, DiagnosticCategory::Error, "Setters_cannot_return_a_value_2408", "Setters cannot return a value."); + static inline const auto Return_type_of_constructor_signature_must_be_assignable_to_the_instance_type_of_the_class = diag(2409, DiagnosticCategory::Error, "Return_type_of_constructor_signature_must_be_assignable_to_the_instance_type_of_the_class_2409", "Return type of constructor signature must be assignable to the instance type of the class."); + static inline const auto The_with_statement_is_not_supported_All_symbols_in_a_with_block_will_have_type_any = diag(2410, DiagnosticCategory::Error, "The_with_statement_is_not_supported_All_symbols_in_a_with_block_will_have_type_any_2410", "The 'with' statement is not supported. All symbols in a 'with' block will have type 'any'."); + static inline const auto Type_0_is_not_assignable_to_type_1_with_exactOptionalPropertyTypes_Colon_true_Consider_adding_undefined_to_the_type_of_the_target = diag(2412, DiagnosticCategory::Error, "Type_0_is_not_assignable_to_type_1_with_exactOptionalPropertyTypes_Colon_true_Consider_adding_undefi_2412", "Type '{0}' is not assignable to type '{1}' with 'exactOptionalPropertyTypes: true'. Consider adding 'undefined' to the type of the target."); + static inline const auto Property_0_of_type_1_is_not_assignable_to_2_index_type_3 = diag(2411, DiagnosticCategory::Error, "Property_0_of_type_1_is_not_assignable_to_2_index_type_3_2411", "Property '{0}' of type '{1}' is not assignable to '{2}' index type '{3}'."); + static inline const auto _0_index_type_1_is_not_assignable_to_2_index_type_3 = diag(2413, DiagnosticCategory::Error, "_0_index_type_1_is_not_assignable_to_2_index_type_3_2413", "'{0}' index type '{1}' is not assignable to '{2}' index type '{3}'."); + static inline const auto Class_name_cannot_be_0 = diag(2414, DiagnosticCategory::Error, "Class_name_cannot_be_0_2414", "Class name cannot be '{0}'."); + static inline const auto Class_0_incorrectly_extends_base_class_1 = diag(2415, DiagnosticCategory::Error, "Class_0_incorrectly_extends_base_class_1_2415", "Class '{0}' incorrectly extends base class '{1}'."); + static inline const auto Property_0_in_type_1_is_not_assignable_to_the_same_property_in_base_type_2 = diag(2416, DiagnosticCategory::Error, "Property_0_in_type_1_is_not_assignable_to_the_same_property_in_base_type_2_2416", "Property '{0}' in type '{1}' is not assignable to the same property in base type '{2}'."); + static inline const auto Class_static_side_0_incorrectly_extends_base_class_static_side_1 = diag(2417, DiagnosticCategory::Error, "Class_static_side_0_incorrectly_extends_base_class_static_side_1_2417", "Class static side '{0}' incorrectly extends base class static side '{1}'."); + static inline const auto Type_of_computed_property_s_value_is_0_which_is_not_assignable_to_type_1 = diag(2418, DiagnosticCategory::Error, "Type_of_computed_property_s_value_is_0_which_is_not_assignable_to_type_1_2418", "Type of computed property's value is '{0}', which is not assignable to type '{1}'."); + static inline const auto Types_of_construct_signatures_are_incompatible = diag(2419, DiagnosticCategory::Error, "Types_of_construct_signatures_are_incompatible_2419", "Types of construct signatures are incompatible."); + static inline const auto Class_0_incorrectly_implements_interface_1 = diag(2420, DiagnosticCategory::Error, "Class_0_incorrectly_implements_interface_1_2420", "Class '{0}' incorrectly implements interface '{1}'."); + static inline const auto A_class_can_only_implement_an_object_type_or_intersection_of_object_types_with_statically_known_members = diag(2422, DiagnosticCategory::Error, "A_class_can_only_implement_an_object_type_or_intersection_of_object_types_with_statically_known_memb_2422", "A class can only implement an object type or intersection of object types with statically known members."); + static inline const auto Class_0_defines_instance_member_function_1_but_extended_class_2_defines_it_as_instance_member_accessor = diag(2423, DiagnosticCategory::Error, "Class_0_defines_instance_member_function_1_but_extended_class_2_defines_it_as_instance_member_access_2423", "Class '{0}' defines instance member function '{1}', but extended class '{2}' defines it as instance member accessor."); + static inline const auto Class_0_defines_instance_member_property_1_but_extended_class_2_defines_it_as_instance_member_function = diag(2425, DiagnosticCategory::Error, "Class_0_defines_instance_member_property_1_but_extended_class_2_defines_it_as_instance_member_functi_2425", "Class '{0}' defines instance member property '{1}', but extended class '{2}' defines it as instance member function."); + static inline const auto Class_0_defines_instance_member_accessor_1_but_extended_class_2_defines_it_as_instance_member_function = diag(2426, DiagnosticCategory::Error, "Class_0_defines_instance_member_accessor_1_but_extended_class_2_defines_it_as_instance_member_functi_2426", "Class '{0}' defines instance member accessor '{1}', but extended class '{2}' defines it as instance member function."); + static inline const auto Interface_name_cannot_be_0 = diag(2427, DiagnosticCategory::Error, "Interface_name_cannot_be_0_2427", "Interface name cannot be '{0}'."); + static inline const auto All_declarations_of_0_must_have_identical_type_parameters = diag(2428, DiagnosticCategory::Error, "All_declarations_of_0_must_have_identical_type_parameters_2428", "All declarations of '{0}' must have identical type parameters."); + static inline const auto Interface_0_incorrectly_extends_interface_1 = diag(2430, DiagnosticCategory::Error, "Interface_0_incorrectly_extends_interface_1_2430", "Interface '{0}' incorrectly extends interface '{1}'."); + static inline const auto Enum_name_cannot_be_0 = diag(2431, DiagnosticCategory::Error, "Enum_name_cannot_be_0_2431", "Enum name cannot be '{0}'."); + static inline const auto In_an_enum_with_multiple_declarations_only_one_declaration_can_omit_an_initializer_for_its_first_enum_element = diag(2432, DiagnosticCategory::Error, "In_an_enum_with_multiple_declarations_only_one_declaration_can_omit_an_initializer_for_its_first_enu_2432", "In an enum with multiple declarations, only one declaration can omit an initializer for its first enum element."); + static inline const auto A_namespace_declaration_cannot_be_in_a_different_file_from_a_class_or_function_with_which_it_is_merged = diag(2433, DiagnosticCategory::Error, "A_namespace_declaration_cannot_be_in_a_different_file_from_a_class_or_function_with_which_it_is_merg_2433", "A namespace declaration cannot be in a different file from a class or function with which it is merged."); + static inline const auto A_namespace_declaration_cannot_be_located_prior_to_a_class_or_function_with_which_it_is_merged = diag(2434, DiagnosticCategory::Error, "A_namespace_declaration_cannot_be_located_prior_to_a_class_or_function_with_which_it_is_merged_2434", "A namespace declaration cannot be located prior to a class or function with which it is merged."); + static inline const auto Ambient_modules_cannot_be_nested_in_other_modules_or_namespaces = diag(2435, DiagnosticCategory::Error, "Ambient_modules_cannot_be_nested_in_other_modules_or_namespaces_2435", "Ambient modules cannot be nested in other modules or namespaces."); + static inline const auto Ambient_module_declaration_cannot_specify_relative_module_name = diag(2436, DiagnosticCategory::Error, "Ambient_module_declaration_cannot_specify_relative_module_name_2436", "Ambient module declaration cannot specify relative module name."); + static inline const auto Module_0_is_hidden_by_a_local_declaration_with_the_same_name = diag(2437, DiagnosticCategory::Error, "Module_0_is_hidden_by_a_local_declaration_with_the_same_name_2437", "Module '{0}' is hidden by a local declaration with the same name."); + static inline const auto Import_name_cannot_be_0 = diag(2438, DiagnosticCategory::Error, "Import_name_cannot_be_0_2438", "Import name cannot be '{0}'."); + static inline const auto Import_or_export_declaration_in_an_ambient_module_declaration_cannot_reference_module_through_relative_module_name = diag(2439, DiagnosticCategory::Error, "Import_or_export_declaration_in_an_ambient_module_declaration_cannot_reference_module_through_relati_2439", "Import or export declaration in an ambient module declaration cannot reference module through relative module name."); + static inline const auto Import_declaration_conflicts_with_local_declaration_of_0 = diag(2440, DiagnosticCategory::Error, "Import_declaration_conflicts_with_local_declaration_of_0_2440", "Import declaration conflicts with local declaration of '{0}'."); + static inline const auto Duplicate_identifier_0_Compiler_reserves_name_1_in_top_level_scope_of_a_module = diag(2441, DiagnosticCategory::Error, "Duplicate_identifier_0_Compiler_reserves_name_1_in_top_level_scope_of_a_module_2441", "Duplicate identifier '{0}'. Compiler reserves name '{1}' in top level scope of a module."); + static inline const auto Types_have_separate_declarations_of_a_private_property_0 = diag(2442, DiagnosticCategory::Error, "Types_have_separate_declarations_of_a_private_property_0_2442", "Types have separate declarations of a private property '{0}'."); + static inline const auto Property_0_is_protected_but_type_1_is_not_a_class_derived_from_2 = diag(2443, DiagnosticCategory::Error, "Property_0_is_protected_but_type_1_is_not_a_class_derived_from_2_2443", "Property '{0}' is protected but type '{1}' is not a class derived from '{2}'."); + static inline const auto Property_0_is_protected_in_type_1_but_public_in_type_2 = diag(2444, DiagnosticCategory::Error, "Property_0_is_protected_in_type_1_but_public_in_type_2_2444", "Property '{0}' is protected in type '{1}' but public in type '{2}'."); + static inline const auto Property_0_is_protected_and_only_accessible_within_class_1_and_its_subclasses = diag(2445, DiagnosticCategory::Error, "Property_0_is_protected_and_only_accessible_within_class_1_and_its_subclasses_2445", "Property '{0}' is protected and only accessible within class '{1}' and its subclasses."); + static inline const auto Property_0_is_protected_and_only_accessible_through_an_instance_of_class_1_This_is_an_instance_of_class_2 = diag(2446, DiagnosticCategory::Error, "Property_0_is_protected_and_only_accessible_through_an_instance_of_class_1_This_is_an_instance_of_cl_2446", "Property '{0}' is protected and only accessible through an instance of class '{1}'. This is an instance of class '{2}'."); + static inline const auto The_0_operator_is_not_allowed_for_boolean_types_Consider_using_1_instead = diag(2447, DiagnosticCategory::Error, "The_0_operator_is_not_allowed_for_boolean_types_Consider_using_1_instead_2447", "The '{0}' operator is not allowed for boolean types. Consider using '{1}' instead."); + static inline const auto Block_scoped_variable_0_used_before_its_declaration = diag(2448, DiagnosticCategory::Error, "Block_scoped_variable_0_used_before_its_declaration_2448", "Block-scoped variable '{0}' used before its declaration."); + static inline const auto Class_0_used_before_its_declaration = diag(2449, DiagnosticCategory::Error, "Class_0_used_before_its_declaration_2449", "Class '{0}' used before its declaration."); + static inline const auto Enum_0_used_before_its_declaration = diag(2450, DiagnosticCategory::Error, "Enum_0_used_before_its_declaration_2450", "Enum '{0}' used before its declaration."); + static inline const auto Cannot_redeclare_block_scoped_variable_0 = diag(2451, DiagnosticCategory::Error, "Cannot_redeclare_block_scoped_variable_0_2451", "Cannot redeclare block-scoped variable '{0}'."); + static inline const auto An_enum_member_cannot_have_a_numeric_name = diag(2452, DiagnosticCategory::Error, "An_enum_member_cannot_have_a_numeric_name_2452", "An enum member cannot have a numeric name."); + static inline const auto Variable_0_is_used_before_being_assigned = diag(2454, DiagnosticCategory::Error, "Variable_0_is_used_before_being_assigned_2454", "Variable '{0}' is used before being assigned."); + static inline const auto Type_alias_0_circularly_references_itself = diag(2456, DiagnosticCategory::Error, "Type_alias_0_circularly_references_itself_2456", "Type alias '{0}' circularly references itself."); + static inline const auto Type_alias_name_cannot_be_0 = diag(2457, DiagnosticCategory::Error, "Type_alias_name_cannot_be_0_2457", "Type alias name cannot be '{0}'."); + static inline const auto An_AMD_module_cannot_have_multiple_name_assignments = diag(2458, DiagnosticCategory::Error, "An_AMD_module_cannot_have_multiple_name_assignments_2458", "An AMD module cannot have multiple name assignments."); + static inline const auto Module_0_declares_1_locally_but_it_is_not_exported = diag(2459, DiagnosticCategory::Error, "Module_0_declares_1_locally_but_it_is_not_exported_2459", "Module '{0}' declares '{1}' locally, but it is not exported."); + static inline const auto Module_0_declares_1_locally_but_it_is_exported_as_2 = diag(2460, DiagnosticCategory::Error, "Module_0_declares_1_locally_but_it_is_exported_as_2_2460", "Module '{0}' declares '{1}' locally, but it is exported as '{2}'."); + static inline const auto Type_0_is_not_an_array_type = diag(2461, DiagnosticCategory::Error, "Type_0_is_not_an_array_type_2461", "Type '{0}' is not an array type."); + static inline const auto A_rest_element_must_be_last_in_a_destructuring_pattern = diag(2462, DiagnosticCategory::Error, "A_rest_element_must_be_last_in_a_destructuring_pattern_2462", "A rest element must be last in a destructuring pattern."); + static inline const auto A_binding_pattern_parameter_cannot_be_optional_in_an_implementation_signature = diag(2463, DiagnosticCategory::Error, "A_binding_pattern_parameter_cannot_be_optional_in_an_implementation_signature_2463", "A binding pattern parameter cannot be optional in an implementation signature."); + static inline const auto A_computed_property_name_must_be_of_type_string_number_symbol_or_any = diag(2464, DiagnosticCategory::Error, "A_computed_property_name_must_be_of_type_string_number_symbol_or_any_2464", "A computed property name must be of type 'string', 'number', 'symbol', or 'any'."); + static inline const auto this_cannot_be_referenced_in_a_computed_property_name = diag(2465, DiagnosticCategory::Error, "this_cannot_be_referenced_in_a_computed_property_name_2465", "'this' cannot be referenced in a computed property name."); + static inline const auto super_cannot_be_referenced_in_a_computed_property_name = diag(2466, DiagnosticCategory::Error, "super_cannot_be_referenced_in_a_computed_property_name_2466", "'super' cannot be referenced in a computed property name."); + static inline const auto A_computed_property_name_cannot_reference_a_type_parameter_from_its_containing_type = diag(2467, DiagnosticCategory::Error, "A_computed_property_name_cannot_reference_a_type_parameter_from_its_containing_type_2467", "A computed property name cannot reference a type parameter from its containing type."); + static inline const auto Cannot_find_global_value_0 = diag(2468, DiagnosticCategory::Error, "Cannot_find_global_value_0_2468", "Cannot find global value '{0}'."); + static inline const auto The_0_operator_cannot_be_applied_to_type_symbol = diag(2469, DiagnosticCategory::Error, "The_0_operator_cannot_be_applied_to_type_symbol_2469", "The '{0}' operator cannot be applied to type 'symbol'."); + static inline const auto Spread_operator_in_new_expressions_is_only_available_when_targeting_ECMAScript_5_and_higher = diag(2472, DiagnosticCategory::Error, "Spread_operator_in_new_expressions_is_only_available_when_targeting_ECMAScript_5_and_higher_2472", "Spread operator in 'new' expressions is only available when targeting ECMAScript 5 and higher."); + static inline const auto Enum_declarations_must_all_be_const_or_non_const = diag(2473, DiagnosticCategory::Error, "Enum_declarations_must_all_be_const_or_non_const_2473", "Enum declarations must all be const or non-const."); + static inline const auto const_enum_member_initializers_can_only_contain_literal_values_and_other_computed_enum_values = diag(2474, DiagnosticCategory::Error, "const_enum_member_initializers_can_only_contain_literal_values_and_other_computed_enum_values_2474", "const enum member initializers can only contain literal values and other computed enum values."); + static inline const auto const_enums_can_only_be_used_in_property_or_index_access_expressions_or_the_right_hand_side_of_an_import_declaration_or_export_assignment_or_type_query = diag(2475, DiagnosticCategory::Error, "const_enums_can_only_be_used_in_property_or_index_access_expressions_or_the_right_hand_side_of_an_im_2475", "'const' enums can only be used in property or index access expressions or the right hand side of an import declaration or export assignment or type query."); + static inline const auto A_const_enum_member_can_only_be_accessed_using_a_string_literal = diag(2476, DiagnosticCategory::Error, "A_const_enum_member_can_only_be_accessed_using_a_string_literal_2476", "A const enum member can only be accessed using a string literal."); + static inline const auto const_enum_member_initializer_was_evaluated_to_a_non_finite_value = diag(2477, DiagnosticCategory::Error, "const_enum_member_initializer_was_evaluated_to_a_non_finite_value_2477", "'const' enum member initializer was evaluated to a non-finite value."); + static inline const auto const_enum_member_initializer_was_evaluated_to_disallowed_value_NaN = diag(2478, DiagnosticCategory::Error, "const_enum_member_initializer_was_evaluated_to_disallowed_value_NaN_2478", "'const' enum member initializer was evaluated to disallowed value 'NaN'."); + static inline const auto let_is_not_allowed_to_be_used_as_a_name_in_let_or_const_declarations = diag(2480, DiagnosticCategory::Error, "let_is_not_allowed_to_be_used_as_a_name_in_let_or_const_declarations_2480", "'let' is not allowed to be used as a name in 'let' or 'const' declarations."); + static inline const auto Cannot_initialize_outer_scoped_variable_0_in_the_same_scope_as_block_scoped_declaration_1 = diag(2481, DiagnosticCategory::Error, "Cannot_initialize_outer_scoped_variable_0_in_the_same_scope_as_block_scoped_declaration_1_2481", "Cannot initialize outer scoped variable '{0}' in the same scope as block scoped declaration '{1}'."); + static inline const auto The_left_hand_side_of_a_for_of_statement_cannot_use_a_type_annotation = diag(2483, DiagnosticCategory::Error, "The_left_hand_side_of_a_for_of_statement_cannot_use_a_type_annotation_2483", "The left-hand side of a 'for...of' statement cannot use a type annotation."); + static inline const auto Export_declaration_conflicts_with_exported_declaration_of_0 = diag(2484, DiagnosticCategory::Error, "Export_declaration_conflicts_with_exported_declaration_of_0_2484", "Export declaration conflicts with exported declaration of '{0}'."); + static inline const auto The_left_hand_side_of_a_for_of_statement_must_be_a_variable_or_a_property_access = diag(2487, DiagnosticCategory::Error, "The_left_hand_side_of_a_for_of_statement_must_be_a_variable_or_a_property_access_2487", "The left-hand side of a 'for...of' statement must be a variable or a property access."); + static inline const auto Type_0_must_have_a_Symbol_iterator_method_that_returns_an_iterator = diag(2488, DiagnosticCategory::Error, "Type_0_must_have_a_Symbol_iterator_method_that_returns_an_iterator_2488", "Type '{0}' must have a '[Symbol.iterator]()' method that returns an iterator."); + static inline const auto An_iterator_must_have_a_next_method = diag(2489, DiagnosticCategory::Error, "An_iterator_must_have_a_next_method_2489", "An iterator must have a 'next()' method."); + static inline const auto The_type_returned_by_the_0_method_of_an_iterator_must_have_a_value_property = diag(2490, DiagnosticCategory::Error, "The_type_returned_by_the_0_method_of_an_iterator_must_have_a_value_property_2490", "The type returned by the '{0}()' method of an iterator must have a 'value' property."); + static inline const auto The_left_hand_side_of_a_for_in_statement_cannot_be_a_destructuring_pattern = diag(2491, DiagnosticCategory::Error, "The_left_hand_side_of_a_for_in_statement_cannot_be_a_destructuring_pattern_2491", "The left-hand side of a 'for...in' statement cannot be a destructuring pattern."); + static inline const auto Cannot_redeclare_identifier_0_in_catch_clause = diag(2492, DiagnosticCategory::Error, "Cannot_redeclare_identifier_0_in_catch_clause_2492", "Cannot redeclare identifier '{0}' in catch clause."); + static inline const auto Tuple_type_0_of_length_1_has_no_element_at_index_2 = diag(2493, DiagnosticCategory::Error, "Tuple_type_0_of_length_1_has_no_element_at_index_2_2493", "Tuple type '{0}' of length '{1}' has no element at index '{2}'."); + static inline const auto Using_a_string_in_a_for_of_statement_is_only_supported_in_ECMAScript_5_and_higher = diag(2494, DiagnosticCategory::Error, "Using_a_string_in_a_for_of_statement_is_only_supported_in_ECMAScript_5_and_higher_2494", "Using a string in a 'for...of' statement is only supported in ECMAScript 5 and higher."); + static inline const auto Type_0_is_not_an_array_type_or_a_string_type = diag(2495, DiagnosticCategory::Error, "Type_0_is_not_an_array_type_or_a_string_type_2495", "Type '{0}' is not an array type or a string type."); + static inline const auto The_arguments_object_cannot_be_referenced_in_an_arrow_function_in_ES3_and_ES5_Consider_using_a_standard_function_expression = diag(2496, DiagnosticCategory::Error, "The_arguments_object_cannot_be_referenced_in_an_arrow_function_in_ES3_and_ES5_Consider_using_a_stand_2496", "The 'arguments' object cannot be referenced in an arrow function in ES3 and ES5. Consider using a standard function expression."); + static inline const auto This_module_can_only_be_referenced_with_ECMAScript_imports_Slashexports_by_turning_on_the_0_flag_and_referencing_its_default_export = diag(2497, DiagnosticCategory::Error, "This_module_can_only_be_referenced_with_ECMAScript_imports_Slashexports_by_turning_on_the_0_flag_and_2497", "This module can only be referenced with ECMAScript imports/exports by turning on the '{0}' flag and referencing its default export."); + static inline const auto Module_0_uses_export_and_cannot_be_used_with_export_Asterisk = diag(2498, DiagnosticCategory::Error, "Module_0_uses_export_and_cannot_be_used_with_export_Asterisk_2498", "Module '{0}' uses 'export =' and cannot be used with 'export *'."); + static inline const auto An_interface_can_only_extend_an_identifier_Slashqualified_name_with_optional_type_arguments = diag(2499, DiagnosticCategory::Error, "An_interface_can_only_extend_an_identifier_Slashqualified_name_with_optional_type_arguments_2499", "An interface can only extend an identifier/qualified-name with optional type arguments."); + static inline const auto A_class_can_only_implement_an_identifier_Slashqualified_name_with_optional_type_arguments = diag(2500, DiagnosticCategory::Error, "A_class_can_only_implement_an_identifier_Slashqualified_name_with_optional_type_arguments_2500", "A class can only implement an identifier/qualified-name with optional type arguments."); + static inline const auto A_rest_element_cannot_contain_a_binding_pattern = diag(2501, DiagnosticCategory::Error, "A_rest_element_cannot_contain_a_binding_pattern_2501", "A rest element cannot contain a binding pattern."); + static inline const auto _0_is_referenced_directly_or_indirectly_in_its_own_type_annotation = diag(2502, DiagnosticCategory::Error, "_0_is_referenced_directly_or_indirectly_in_its_own_type_annotation_2502", "'{0}' is referenced directly or indirectly in its own type annotation."); + static inline const auto Cannot_find_namespace_0 = diag(2503, DiagnosticCategory::Error, "Cannot_find_namespace_0_2503", "Cannot find namespace '{0}'."); + static inline const auto Type_0_must_have_a_Symbol_asyncIterator_method_that_returns_an_async_iterator = diag(2504, DiagnosticCategory::Error, "Type_0_must_have_a_Symbol_asyncIterator_method_that_returns_an_async_iterator_2504", "Type '{0}' must have a '[Symbol.asyncIterator]()' method that returns an async iterator."); + static inline const auto A_generator_cannot_have_a_void_type_annotation = diag(2505, DiagnosticCategory::Error, "A_generator_cannot_have_a_void_type_annotation_2505", "A generator cannot have a 'void' type annotation."); + static inline const auto _0_is_referenced_directly_or_indirectly_in_its_own_base_expression = diag(2506, DiagnosticCategory::Error, "_0_is_referenced_directly_or_indirectly_in_its_own_base_expression_2506", "'{0}' is referenced directly or indirectly in its own base expression."); + static inline const auto Type_0_is_not_a_constructor_function_type = diag(2507, DiagnosticCategory::Error, "Type_0_is_not_a_constructor_function_type_2507", "Type '{0}' is not a constructor function type."); + static inline const auto No_base_constructor_has_the_specified_number_of_type_arguments = diag(2508, DiagnosticCategory::Error, "No_base_constructor_has_the_specified_number_of_type_arguments_2508", "No base constructor has the specified number of type arguments."); + static inline const auto Base_constructor_return_type_0_is_not_an_object_type_or_intersection_of_object_types_with_statically_known_members = diag(2509, DiagnosticCategory::Error, "Base_constructor_return_type_0_is_not_an_object_type_or_intersection_of_object_types_with_statically_2509", "Base constructor return type '{0}' is not an object type or intersection of object types with statically known members."); + static inline const auto Base_constructors_must_all_have_the_same_return_type = diag(2510, DiagnosticCategory::Error, "Base_constructors_must_all_have_the_same_return_type_2510", "Base constructors must all have the same return type."); + static inline const auto Cannot_create_an_instance_of_an_abstract_class = diag(2511, DiagnosticCategory::Error, "Cannot_create_an_instance_of_an_abstract_class_2511", "Cannot create an instance of an abstract class."); + static inline const auto Overload_signatures_must_all_be_abstract_or_non_abstract = diag(2512, DiagnosticCategory::Error, "Overload_signatures_must_all_be_abstract_or_non_abstract_2512", "Overload signatures must all be abstract or non-abstract."); + static inline const auto Abstract_method_0_in_class_1_cannot_be_accessed_via_super_expression = diag(2513, DiagnosticCategory::Error, "Abstract_method_0_in_class_1_cannot_be_accessed_via_super_expression_2513", "Abstract method '{0}' in class '{1}' cannot be accessed via super expression."); + static inline const auto Non_abstract_class_0_does_not_implement_inherited_abstract_member_1_from_class_2 = diag(2515, DiagnosticCategory::Error, "Non_abstract_class_0_does_not_implement_inherited_abstract_member_1_from_class_2_2515", "Non-abstract class '{0}' does not implement inherited abstract member '{1}' from class '{2}'."); + static inline const auto All_declarations_of_an_abstract_method_must_be_consecutive = diag(2516, DiagnosticCategory::Error, "All_declarations_of_an_abstract_method_must_be_consecutive_2516", "All declarations of an abstract method must be consecutive."); + static inline const auto Cannot_assign_an_abstract_constructor_type_to_a_non_abstract_constructor_type = diag(2517, DiagnosticCategory::Error, "Cannot_assign_an_abstract_constructor_type_to_a_non_abstract_constructor_type_2517", "Cannot assign an abstract constructor type to a non-abstract constructor type."); + static inline const auto A_this_based_type_guard_is_not_compatible_with_a_parameter_based_type_guard = diag(2518, DiagnosticCategory::Error, "A_this_based_type_guard_is_not_compatible_with_a_parameter_based_type_guard_2518", "A 'this'-based type guard is not compatible with a parameter-based type guard."); + static inline const auto An_async_iterator_must_have_a_next_method = diag(2519, DiagnosticCategory::Error, "An_async_iterator_must_have_a_next_method_2519", "An async iterator must have a 'next()' method."); + static inline const auto Duplicate_identifier_0_Compiler_uses_declaration_1_to_support_async_functions = diag(2520, DiagnosticCategory::Error, "Duplicate_identifier_0_Compiler_uses_declaration_1_to_support_async_functions_2520", "Duplicate identifier '{0}'. Compiler uses declaration '{1}' to support async functions."); + static inline const auto The_arguments_object_cannot_be_referenced_in_an_async_function_or_method_in_ES3_and_ES5_Consider_using_a_standard_function_or_method = diag(2522, DiagnosticCategory::Error, "The_arguments_object_cannot_be_referenced_in_an_async_function_or_method_in_ES3_and_ES5_Consider_usi_2522", "The 'arguments' object cannot be referenced in an async function or method in ES3 and ES5. Consider using a standard function or method."); + static inline const auto yield_expressions_cannot_be_used_in_a_parameter_initializer = diag(2523, DiagnosticCategory::Error, "yield_expressions_cannot_be_used_in_a_parameter_initializer_2523", "'yield' expressions cannot be used in a parameter initializer."); + static inline const auto await_expressions_cannot_be_used_in_a_parameter_initializer = diag(2524, DiagnosticCategory::Error, "await_expressions_cannot_be_used_in_a_parameter_initializer_2524", "'await' expressions cannot be used in a parameter initializer."); + static inline const auto Initializer_provides_no_value_for_this_binding_element_and_the_binding_element_has_no_default_value = diag(2525, DiagnosticCategory::Error, "Initializer_provides_no_value_for_this_binding_element_and_the_binding_element_has_no_default_value_2525", "Initializer provides no value for this binding element and the binding element has no default value."); + static inline const auto A_this_type_is_available_only_in_a_non_static_member_of_a_class_or_interface = diag(2526, DiagnosticCategory::Error, "A_this_type_is_available_only_in_a_non_static_member_of_a_class_or_interface_2526", "A 'this' type is available only in a non-static member of a class or interface."); + static inline const auto The_inferred_type_of_0_references_an_inaccessible_1_type_A_type_annotation_is_necessary = diag(2527, DiagnosticCategory::Error, "The_inferred_type_of_0_references_an_inaccessible_1_type_A_type_annotation_is_necessary_2527", "The inferred type of '{0}' references an inaccessible '{1}' type. A type annotation is necessary."); + static inline const auto A_module_cannot_have_multiple_default_exports = diag(2528, DiagnosticCategory::Error, "A_module_cannot_have_multiple_default_exports_2528", "A module cannot have multiple default exports."); + static inline const auto Duplicate_identifier_0_Compiler_reserves_name_1_in_top_level_scope_of_a_module_containing_async_functions = diag(2529, DiagnosticCategory::Error, "Duplicate_identifier_0_Compiler_reserves_name_1_in_top_level_scope_of_a_module_containing_async_func_2529", "Duplicate identifier '{0}'. Compiler reserves name '{1}' in top level scope of a module containing async functions."); + static inline const auto Property_0_is_incompatible_with_index_signature = diag(2530, DiagnosticCategory::Error, "Property_0_is_incompatible_with_index_signature_2530", "Property '{0}' is incompatible with index signature."); + static inline const auto Object_is_possibly_null = diag(2531, DiagnosticCategory::Error, "Object_is_possibly_null_2531", "Object is possibly 'null'."); + static inline const auto Object_is_possibly_undefined = diag(2532, DiagnosticCategory::Error, "Object_is_possibly_undefined_2532", "Object is possibly 'undefined'."); + static inline const auto Object_is_possibly_null_or_undefined = diag(2533, DiagnosticCategory::Error, "Object_is_possibly_null_or_undefined_2533", "Object is possibly 'null' or 'undefined'."); + static inline const auto A_function_returning_never_cannot_have_a_reachable_end_point = diag(2534, DiagnosticCategory::Error, "A_function_returning_never_cannot_have_a_reachable_end_point_2534", "A function returning 'never' cannot have a reachable end point."); + static inline const auto Enum_type_0_has_members_with_initializers_that_are_not_literals = diag(2535, DiagnosticCategory::Error, "Enum_type_0_has_members_with_initializers_that_are_not_literals_2535", "Enum type '{0}' has members with initializers that are not literals."); + static inline const auto Type_0_cannot_be_used_to_index_type_1 = diag(2536, DiagnosticCategory::Error, "Type_0_cannot_be_used_to_index_type_1_2536", "Type '{0}' cannot be used to index type '{1}'."); + static inline const auto Type_0_has_no_matching_index_signature_for_type_1 = diag(2537, DiagnosticCategory::Error, "Type_0_has_no_matching_index_signature_for_type_1_2537", "Type '{0}' has no matching index signature for type '{1}'."); + static inline const auto Type_0_cannot_be_used_as_an_index_type = diag(2538, DiagnosticCategory::Error, "Type_0_cannot_be_used_as_an_index_type_2538", "Type '{0}' cannot be used as an index type."); + static inline const auto Cannot_assign_to_0_because_it_is_not_a_variable = diag(2539, DiagnosticCategory::Error, "Cannot_assign_to_0_because_it_is_not_a_variable_2539", "Cannot assign to '{0}' because it is not a variable."); + static inline const auto Cannot_assign_to_0_because_it_is_a_read_only_property = diag(2540, DiagnosticCategory::Error, "Cannot_assign_to_0_because_it_is_a_read_only_property_2540", "Cannot assign to '{0}' because it is a read-only property."); + static inline const auto Index_signature_in_type_0_only_permits_reading = diag(2542, DiagnosticCategory::Error, "Index_signature_in_type_0_only_permits_reading_2542", "Index signature in type '{0}' only permits reading."); + static inline const auto Duplicate_identifier_newTarget_Compiler_uses_variable_declaration_newTarget_to_capture_new_target_meta_property_reference = diag(2543, DiagnosticCategory::Error, "Duplicate_identifier_newTarget_Compiler_uses_variable_declaration_newTarget_to_capture_new_target_me_2543", "Duplicate identifier '_newTarget'. Compiler uses variable declaration '_newTarget' to capture 'new.target' meta-property reference."); + static inline const auto Expression_resolves_to_variable_declaration_newTarget_that_compiler_uses_to_capture_new_target_meta_property_reference = diag(2544, DiagnosticCategory::Error, "Expression_resolves_to_variable_declaration_newTarget_that_compiler_uses_to_capture_new_target_meta__2544", "Expression resolves to variable declaration '_newTarget' that compiler uses to capture 'new.target' meta-property reference."); + static inline const auto A_mixin_class_must_have_a_constructor_with_a_single_rest_parameter_of_type_any = diag(2545, DiagnosticCategory::Error, "A_mixin_class_must_have_a_constructor_with_a_single_rest_parameter_of_type_any_2545", "A mixin class must have a constructor with a single rest parameter of type 'any[]'."); + static inline const auto The_type_returned_by_the_0_method_of_an_async_iterator_must_be_a_promise_for_a_type_with_a_value_property = diag(2547, DiagnosticCategory::Error, "The_type_returned_by_the_0_method_of_an_async_iterator_must_be_a_promise_for_a_type_with_a_value_pro_2547", "The type returned by the '{0}()' method of an async iterator must be a promise for a type with a 'value' property."); + static inline const auto Type_0_is_not_an_array_type_or_does_not_have_a_Symbol_iterator_method_that_returns_an_iterator = diag(2548, DiagnosticCategory::Error, "Type_0_is_not_an_array_type_or_does_not_have_a_Symbol_iterator_method_that_returns_an_iterator_2548", "Type '{0}' is not an array type or does not have a '[Symbol.iterator]()' method that returns an iterator."); + static inline const auto Type_0_is_not_an_array_type_or_a_string_type_or_does_not_have_a_Symbol_iterator_method_that_returns_an_iterator = diag(2549, DiagnosticCategory::Error, "Type_0_is_not_an_array_type_or_a_string_type_or_does_not_have_a_Symbol_iterator_method_that_returns__2549", "Type '{0}' is not an array type or a string type or does not have a '[Symbol.iterator]()' method that returns an iterator."); + static inline const auto Property_0_does_not_exist_on_type_1_Do_you_need_to_change_your_target_library_Try_changing_the_lib_compiler_option_to_2_or_later = diag(2550, DiagnosticCategory::Error, "Property_0_does_not_exist_on_type_1_Do_you_need_to_change_your_target_library_Try_changing_the_lib_c_2550", "Property '{0}' does not exist on type '{1}'. Do you need to change your target library? Try changing the 'lib' compiler option to '{2}' or later."); + static inline const auto Property_0_does_not_exist_on_type_1_Did_you_mean_2 = diag(2551, DiagnosticCategory::Error, "Property_0_does_not_exist_on_type_1_Did_you_mean_2_2551", "Property '{0}' does not exist on type '{1}'. Did you mean '{2}'?"); + static inline const auto Cannot_find_name_0_Did_you_mean_1 = diag(2552, DiagnosticCategory::Error, "Cannot_find_name_0_Did_you_mean_1_2552", "Cannot find name '{0}'. Did you mean '{1}'?"); + static inline const auto Computed_values_are_not_permitted_in_an_enum_with_string_valued_members = diag(2553, DiagnosticCategory::Error, "Computed_values_are_not_permitted_in_an_enum_with_string_valued_members_2553", "Computed values are not permitted in an enum with string valued members."); + static inline const auto Expected_0_arguments_but_got_1 = diag(2554, DiagnosticCategory::Error, "Expected_0_arguments_but_got_1_2554", "Expected {0} arguments, but got {1}."); + static inline const auto Expected_at_least_0_arguments_but_got_1 = diag(2555, DiagnosticCategory::Error, "Expected_at_least_0_arguments_but_got_1_2555", "Expected at least {0} arguments, but got {1}."); + static inline const auto A_spread_argument_must_either_have_a_tuple_type_or_be_passed_to_a_rest_parameter = diag(2556, DiagnosticCategory::Error, "A_spread_argument_must_either_have_a_tuple_type_or_be_passed_to_a_rest_parameter_2556", "A spread argument must either have a tuple type or be passed to a rest parameter."); + static inline const auto Expected_0_type_arguments_but_got_1 = diag(2558, DiagnosticCategory::Error, "Expected_0_type_arguments_but_got_1_2558", "Expected {0} type arguments, but got {1}."); + static inline const auto Type_0_has_no_properties_in_common_with_type_1 = diag(2559, DiagnosticCategory::Error, "Type_0_has_no_properties_in_common_with_type_1_2559", "Type '{0}' has no properties in common with type '{1}'."); + static inline const auto Value_of_type_0_has_no_properties_in_common_with_type_1_Did_you_mean_to_call_it = diag(2560, DiagnosticCategory::Error, "Value_of_type_0_has_no_properties_in_common_with_type_1_Did_you_mean_to_call_it_2560", "Value of type '{0}' has no properties in common with type '{1}'. Did you mean to call it?"); + static inline const auto Object_literal_may_only_specify_known_properties_but_0_does_not_exist_in_type_1_Did_you_mean_to_write_2 = diag(2561, DiagnosticCategory::Error, "Object_literal_may_only_specify_known_properties_but_0_does_not_exist_in_type_1_Did_you_mean_to_writ_2561", "Object literal may only specify known properties, but '{0}' does not exist in type '{1}'. Did you mean to write '{2}'?"); + static inline const auto Base_class_expressions_cannot_reference_class_type_parameters = diag(2562, DiagnosticCategory::Error, "Base_class_expressions_cannot_reference_class_type_parameters_2562", "Base class expressions cannot reference class type parameters."); + static inline const auto The_containing_function_or_module_body_is_too_large_for_control_flow_analysis = diag(2563, DiagnosticCategory::Error, "The_containing_function_or_module_body_is_too_large_for_control_flow_analysis_2563", "The containing function or module body is too large for control flow analysis."); + static inline const auto Property_0_has_no_initializer_and_is_not_definitely_assigned_in_the_constructor = diag(2564, DiagnosticCategory::Error, "Property_0_has_no_initializer_and_is_not_definitely_assigned_in_the_constructor_2564", "Property '{0}' has no initializer and is not definitely assigned in the constructor."); + static inline const auto Property_0_is_used_before_being_assigned = diag(2565, DiagnosticCategory::Error, "Property_0_is_used_before_being_assigned_2565", "Property '{0}' is used before being assigned."); + static inline const auto A_rest_element_cannot_have_a_property_name = diag(2566, DiagnosticCategory::Error, "A_rest_element_cannot_have_a_property_name_2566", "A rest element cannot have a property name."); + static inline const auto Enum_declarations_can_only_merge_with_namespace_or_other_enum_declarations = diag(2567, DiagnosticCategory::Error, "Enum_declarations_can_only_merge_with_namespace_or_other_enum_declarations_2567", "Enum declarations can only merge with namespace or other enum declarations."); + static inline const auto Property_0_may_not_exist_on_type_1_Did_you_mean_2 = diag(2568, DiagnosticCategory::Error, "Property_0_may_not_exist_on_type_1_Did_you_mean_2_2568", "Property '{0}' may not exist on type '{1}'. Did you mean '{2}'?"); + static inline const auto Type_0_is_not_an_array_type_or_a_string_type_Use_compiler_option_downlevelIteration_to_allow_iterating_of_iterators = diag(2569, DiagnosticCategory::Error, "Type_0_is_not_an_array_type_or_a_string_type_Use_compiler_option_downlevelIteration_to_allow_iterati_2569", "Type '{0}' is not an array type or a string type. Use compiler option '--downlevelIteration' to allow iterating of iterators."); + static inline const auto Could_not_find_name_0_Did_you_mean_1 = diag(2570, DiagnosticCategory::Error, "Could_not_find_name_0_Did_you_mean_1_2570", "Could not find name '{0}'. Did you mean '{1}'?"); + static inline const auto Object_is_of_type_unknown = diag(2571, DiagnosticCategory::Error, "Object_is_of_type_unknown_2571", "Object is of type 'unknown'."); + static inline const auto A_rest_element_type_must_be_an_array_type = diag(2574, DiagnosticCategory::Error, "A_rest_element_type_must_be_an_array_type_2574", "A rest element type must be an array type."); + static inline const auto No_overload_expects_0_arguments_but_overloads_do_exist_that_expect_either_1_or_2_arguments = diag(2575, DiagnosticCategory::Error, "No_overload_expects_0_arguments_but_overloads_do_exist_that_expect_either_1_or_2_arguments_2575", "No overload expects {0} arguments, but overloads do exist that expect either {1} or {2} arguments."); + static inline const auto Property_0_does_not_exist_on_type_1_Did_you_mean_to_access_the_static_member_2_instead = diag(2576, DiagnosticCategory::Error, "Property_0_does_not_exist_on_type_1_Did_you_mean_to_access_the_static_member_2_instead_2576", "Property '{0}' does not exist on type '{1}'. Did you mean to access the static member '{2}' instead?"); + static inline const auto Return_type_annotation_circularly_references_itself = diag(2577, DiagnosticCategory::Error, "Return_type_annotation_circularly_references_itself_2577", "Return type annotation circularly references itself."); + static inline const auto Unused_ts_expect_error_directive = diag(2578, DiagnosticCategory::Error, "Unused_ts_expect_error_directive_2578", "Unused '@ts-expect-error' directive."); + static inline const auto Cannot_find_name_0_Do_you_need_to_install_type_definitions_for_node_Try_npm_i_save_dev_types_Slashnode = diag(2580, DiagnosticCategory::Error, "Cannot_find_name_0_Do_you_need_to_install_type_definitions_for_node_Try_npm_i_save_dev_types_Slashno_2580", "Cannot find name '{0}'. Do you need to install type definitions for node? Try `npm i --save-dev @types/node`."); + static inline const auto Cannot_find_name_0_Do_you_need_to_install_type_definitions_for_jQuery_Try_npm_i_save_dev_types_Slashjquery = diag(2581, DiagnosticCategory::Error, "Cannot_find_name_0_Do_you_need_to_install_type_definitions_for_jQuery_Try_npm_i_save_dev_types_Slash_2581", "Cannot find name '{0}'. Do you need to install type definitions for jQuery? Try `npm i --save-dev @types/jquery`."); + static inline const auto Cannot_find_name_0_Do_you_need_to_install_type_definitions_for_a_test_runner_Try_npm_i_save_dev_types_Slashjest_or_npm_i_save_dev_types_Slashmocha = diag(2582, DiagnosticCategory::Error, "Cannot_find_name_0_Do_you_need_to_install_type_definitions_for_a_test_runner_Try_npm_i_save_dev_type_2582", "Cannot find name '{0}'. Do you need to install type definitions for a test runner? Try `npm i --save-dev @types/jest` or `npm i --save-dev @types/mocha`."); + static inline const auto Cannot_find_name_0_Do_you_need_to_change_your_target_library_Try_changing_the_lib_compiler_option_to_1_or_later = diag(2583, DiagnosticCategory::Error, "Cannot_find_name_0_Do_you_need_to_change_your_target_library_Try_changing_the_lib_compiler_option_to_2583", "Cannot find name '{0}'. Do you need to change your target library? Try changing the 'lib' compiler option to '{1}' or later."); + static inline const auto Cannot_find_name_0_Do_you_need_to_change_your_target_library_Try_changing_the_lib_compiler_option_to_include_dom = diag(2584, DiagnosticCategory::Error, "Cannot_find_name_0_Do_you_need_to_change_your_target_library_Try_changing_the_lib_compiler_option_to_2584", "Cannot find name '{0}'. Do you need to change your target library? Try changing the 'lib' compiler option to include 'dom'."); + static inline const auto _0_only_refers_to_a_type_but_is_being_used_as_a_value_here_Do_you_need_to_change_your_target_library_Try_changing_the_lib_compiler_option_to_es2015_or_later = diag(2585, DiagnosticCategory::Error, "_0_only_refers_to_a_type_but_is_being_used_as_a_value_here_Do_you_need_to_change_your_target_library_2585", + "'{0}' only refers to a type, but is being used as a value here. Do you need to change your target library? Try changing the 'lib' compiler option to es2015 or later."); + static inline const auto Cannot_assign_to_0_because_it_is_a_constant = diag(2588, DiagnosticCategory::Error, "Cannot_assign_to_0_because_it_is_a_constant_2588", "Cannot assign to '{0}' because it is a constant."); + static inline const auto Type_instantiation_is_excessively_deep_and_possibly_infinite = diag(2589, DiagnosticCategory::Error, "Type_instantiation_is_excessively_deep_and_possibly_infinite_2589", "Type instantiation is excessively deep and possibly infinite."); + static inline const auto Expression_produces_a_union_type_that_is_too_complex_to_represent = diag(2590, DiagnosticCategory::Error, "Expression_produces_a_union_type_that_is_too_complex_to_represent_2590", "Expression produces a union type that is too complex to represent."); + static inline const auto Cannot_find_name_0_Do_you_need_to_install_type_definitions_for_node_Try_npm_i_save_dev_types_Slashnode_and_then_add_node_to_the_types_field_in_your_tsconfig = diag(2591, DiagnosticCategory::Error, "Cannot_find_name_0_Do_you_need_to_install_type_definitions_for_node_Try_npm_i_save_dev_types_Slashno_2591", + "Cannot find name '{0}'. Do you need to install type definitions for node? Try `npm i --save-dev @types/node` and then add 'node' to the types field in your tsconfig."); + static inline const auto Cannot_find_name_0_Do_you_need_to_install_type_definitions_for_jQuery_Try_npm_i_save_dev_types_Slashjquery_and_then_add_jquery_to_the_types_field_in_your_tsconfig = diag(2592, DiagnosticCategory::Error, "Cannot_find_name_0_Do_you_need_to_install_type_definitions_for_jQuery_Try_npm_i_save_dev_types_Slash_2592", + "Cannot find name '{0}'. Do you need to install type definitions for jQuery? Try `npm i --save-dev @types/jquery` and then add 'jquery' to the types field in your tsconfig."); + static inline const auto Cannot_find_name_0_Do_you_need_to_install_type_definitions_for_a_test_runner_Try_npm_i_save_dev_types_Slashjest_or_npm_i_save_dev_types_Slashmocha_and_then_add_jest_or_mocha_to_the_types_field_in_your_tsconfig = diag(2593, DiagnosticCategory::Error, "Cannot_find_name_0_Do_you_need_to_install_type_definitions_for_a_test_runner_Try_npm_i_save_dev_type_2593", + "Cannot find name '{0}'. Do you need to install type definitions for a test runner? Try `npm i --save-dev @types/jest` or `npm i --save-dev @types/mocha` and then add 'jest' or 'mocha' to the types field in your tsconfig."); + static inline const auto This_module_is_declared_with_using_export_and_can_only_be_used_with_a_default_import_when_using_the_0_flag = diag(2594, DiagnosticCategory::Error, "This_module_is_declared_with_using_export_and_can_only_be_used_with_a_default_import_when_using_the__2594", "This module is declared with using 'export =', and can only be used with a default import when using the '{0}' flag."); + static inline const auto _0_can_only_be_imported_by_using_a_default_import = diag(2595, DiagnosticCategory::Error, "_0_can_only_be_imported_by_using_a_default_import_2595", "'{0}' can only be imported by using a default import."); + static inline const auto _0_can_only_be_imported_by_turning_on_the_esModuleInterop_flag_and_using_a_default_import = diag(2596, DiagnosticCategory::Error, "_0_can_only_be_imported_by_turning_on_the_esModuleInterop_flag_and_using_a_default_import_2596", "'{0}' can only be imported by turning on the 'esModuleInterop' flag and using a default import."); + static inline const auto _0_can_only_be_imported_by_using_a_require_call_or_by_using_a_default_import = diag(2597, DiagnosticCategory::Error, "_0_can_only_be_imported_by_using_a_require_call_or_by_using_a_default_import_2597", "'{0}' can only be imported by using a 'require' call or by using a default import."); + static inline const auto _0_can_only_be_imported_by_using_a_require_call_or_by_turning_on_the_esModuleInterop_flag_and_using_a_default_import = diag(2598, DiagnosticCategory::Error, "_0_can_only_be_imported_by_using_a_require_call_or_by_turning_on_the_esModuleInterop_flag_and_using__2598", "'{0}' can only be imported by using a 'require' call or by turning on the 'esModuleInterop' flag and using a default import."); + static inline const auto JSX_element_implicitly_has_type_any_because_the_global_type_JSX_Element_does_not_exist = diag(2602, DiagnosticCategory::Error, "JSX_element_implicitly_has_type_any_because_the_global_type_JSX_Element_does_not_exist_2602", "JSX element implicitly has type 'any' because the global type 'JSX.Element' does not exist."); + static inline const auto Property_0_in_type_1_is_not_assignable_to_type_2 = diag(2603, DiagnosticCategory::Error, "Property_0_in_type_1_is_not_assignable_to_type_2_2603", "Property '{0}' in type '{1}' is not assignable to type '{2}'."); + static inline const auto JSX_element_type_0_does_not_have_any_construct_or_call_signatures = diag(2604, DiagnosticCategory::Error, "JSX_element_type_0_does_not_have_any_construct_or_call_signatures_2604", "JSX element type '{0}' does not have any construct or call signatures."); + static inline const auto Property_0_of_JSX_spread_attribute_is_not_assignable_to_target_property = diag(2606, DiagnosticCategory::Error, "Property_0_of_JSX_spread_attribute_is_not_assignable_to_target_property_2606", "Property '{0}' of JSX spread attribute is not assignable to target property."); + static inline const auto JSX_element_class_does_not_support_attributes_because_it_does_not_have_a_0_property = diag(2607, DiagnosticCategory::Error, "JSX_element_class_does_not_support_attributes_because_it_does_not_have_a_0_property_2607", "JSX element class does not support attributes because it does not have a '{0}' property."); + static inline const auto The_global_type_JSX_0_may_not_have_more_than_one_property = diag(2608, DiagnosticCategory::Error, "The_global_type_JSX_0_may_not_have_more_than_one_property_2608", "The global type 'JSX.{0}' may not have more than one property."); + static inline const auto JSX_spread_child_must_be_an_array_type = diag(2609, DiagnosticCategory::Error, "JSX_spread_child_must_be_an_array_type_2609", "JSX spread child must be an array type."); + static inline const auto _0_is_defined_as_an_accessor_in_class_1_but_is_overridden_here_in_2_as_an_instance_property = diag(2610, DiagnosticCategory::Error, "_0_is_defined_as_an_accessor_in_class_1_but_is_overridden_here_in_2_as_an_instance_property_2610", "'{0}' is defined as an accessor in class '{1}', but is overridden here in '{2}' as an instance property."); + static inline const auto _0_is_defined_as_a_property_in_class_1_but_is_overridden_here_in_2_as_an_accessor = diag(2611, DiagnosticCategory::Error, "_0_is_defined_as_a_property_in_class_1_but_is_overridden_here_in_2_as_an_accessor_2611", "'{0}' is defined as a property in class '{1}', but is overridden here in '{2}' as an accessor."); + static inline const auto Property_0_will_overwrite_the_base_property_in_1_If_this_is_intentional_add_an_initializer_Otherwise_add_a_declare_modifier_or_remove_the_redundant_declaration = diag(2612, DiagnosticCategory::Error, "Property_0_will_overwrite_the_base_property_in_1_If_this_is_intentional_add_an_initializer_Otherwise_2612", + "Property '{0}' will overwrite the base property in '{1}'. If this is intentional, add an initializer. Otherwise, add a 'declare' modifier or remove the redundant declaration."); + static inline const auto Module_0_has_no_default_export_Did_you_mean_to_use_import_1_from_0_instead = diag(2613, DiagnosticCategory::Error, "Module_0_has_no_default_export_Did_you_mean_to_use_import_1_from_0_instead_2613", "Module '{0}' has no default export. Did you mean to use 'import { {1} } from {0}' instead?"); + static inline const auto Module_0_has_no_exported_member_1_Did_you_mean_to_use_import_1_from_0_instead = diag(2614, DiagnosticCategory::Error, "Module_0_has_no_exported_member_1_Did_you_mean_to_use_import_1_from_0_instead_2614", "Module '{0}' has no exported member '{1}'. Did you mean to use 'import {1} from {0}' instead?"); + static inline const auto Type_of_property_0_circularly_references_itself_in_mapped_type_1 = diag(2615, DiagnosticCategory::Error, "Type_of_property_0_circularly_references_itself_in_mapped_type_1_2615", "Type of property '{0}' circularly references itself in mapped type '{1}'."); + static inline const auto _0_can_only_be_imported_by_using_import_1_require_2_or_a_default_import = diag(2616, DiagnosticCategory::Error, "_0_can_only_be_imported_by_using_import_1_require_2_or_a_default_import_2616", "'{0}' can only be imported by using 'import {1} = require({2})' or a default import."); + static inline const auto _0_can_only_be_imported_by_using_import_1_require_2_or_by_turning_on_the_esModuleInterop_flag_and_using_a_default_import = diag(2617, DiagnosticCategory::Error, "_0_can_only_be_imported_by_using_import_1_require_2_or_by_turning_on_the_esModuleInterop_flag_and_us_2617", "'{0}' can only be imported by using 'import {1} = require({2})' or by turning on the 'esModuleInterop' flag and using a default import."); + static inline const auto Source_has_0_element_s_but_target_requires_1 = diag(2618, DiagnosticCategory::Error, "Source_has_0_element_s_but_target_requires_1_2618", "Source has {0} element(s) but target requires {1}."); + static inline const auto Source_has_0_element_s_but_target_allows_only_1 = diag(2619, DiagnosticCategory::Error, "Source_has_0_element_s_but_target_allows_only_1_2619", "Source has {0} element(s) but target allows only {1}."); + static inline const auto Target_requires_0_element_s_but_source_may_have_fewer = diag(2620, DiagnosticCategory::Error, "Target_requires_0_element_s_but_source_may_have_fewer_2620", "Target requires {0} element(s) but source may have fewer."); + static inline const auto Target_allows_only_0_element_s_but_source_may_have_more = diag(2621, DiagnosticCategory::Error, "Target_allows_only_0_element_s_but_source_may_have_more_2621", "Target allows only {0} element(s) but source may have more."); + static inline const auto Source_provides_no_match_for_required_element_at_position_0_in_target = diag(2623, DiagnosticCategory::Error, "Source_provides_no_match_for_required_element_at_position_0_in_target_2623", "Source provides no match for required element at position {0} in target."); + static inline const auto Source_provides_no_match_for_variadic_element_at_position_0_in_target = diag(2624, DiagnosticCategory::Error, "Source_provides_no_match_for_variadic_element_at_position_0_in_target_2624", "Source provides no match for variadic element at position {0} in target."); + static inline const auto Variadic_element_at_position_0_in_source_does_not_match_element_at_position_1_in_target = diag(2625, DiagnosticCategory::Error, "Variadic_element_at_position_0_in_source_does_not_match_element_at_position_1_in_target_2625", "Variadic element at position {0} in source does not match element at position {1} in target."); + static inline const auto Type_at_position_0_in_source_is_not_compatible_with_type_at_position_1_in_target = diag(2626, DiagnosticCategory::Error, "Type_at_position_0_in_source_is_not_compatible_with_type_at_position_1_in_target_2626", "Type at position {0} in source is not compatible with type at position {1} in target."); + static inline const auto Type_at_positions_0_through_1_in_source_is_not_compatible_with_type_at_position_2_in_target = diag(2627, DiagnosticCategory::Error, "Type_at_positions_0_through_1_in_source_is_not_compatible_with_type_at_position_2_in_target_2627", "Type at positions {0} through {1} in source is not compatible with type at position {2} in target."); + static inline const auto Cannot_assign_to_0_because_it_is_an_enum = diag(2628, DiagnosticCategory::Error, "Cannot_assign_to_0_because_it_is_an_enum_2628", "Cannot assign to '{0}' because it is an enum."); + static inline const auto Cannot_assign_to_0_because_it_is_a_class = diag(2629, DiagnosticCategory::Error, "Cannot_assign_to_0_because_it_is_a_class_2629", "Cannot assign to '{0}' because it is a class."); + static inline const auto Cannot_assign_to_0_because_it_is_a_function = diag(2630, DiagnosticCategory::Error, "Cannot_assign_to_0_because_it_is_a_function_2630", "Cannot assign to '{0}' because it is a function."); + static inline const auto Cannot_assign_to_0_because_it_is_a_namespace = diag(2631, DiagnosticCategory::Error, "Cannot_assign_to_0_because_it_is_a_namespace_2631", "Cannot assign to '{0}' because it is a namespace."); + static inline const auto Cannot_assign_to_0_because_it_is_an_import = diag(2632, DiagnosticCategory::Error, "Cannot_assign_to_0_because_it_is_an_import_2632", "Cannot assign to '{0}' because it is an import."); + static inline const auto JSX_property_access_expressions_cannot_include_JSX_namespace_names = diag(2633, DiagnosticCategory::Error, "JSX_property_access_expressions_cannot_include_JSX_namespace_names_2633", "JSX property access expressions cannot include JSX namespace names"); + static inline const auto _0_index_signatures_are_incompatible = diag(2634, DiagnosticCategory::Error, "_0_index_signatures_are_incompatible_2634", "'{0}' index signatures are incompatible."); + static inline const auto Cannot_augment_module_0_with_value_exports_because_it_resolves_to_a_non_module_entity = diag(2649, DiagnosticCategory::Error, "Cannot_augment_module_0_with_value_exports_because_it_resolves_to_a_non_module_entity_2649", "Cannot augment module '{0}' with value exports because it resolves to a non-module entity."); + static inline const auto A_member_initializer_in_a_enum_declaration_cannot_reference_members_declared_after_it_including_members_defined_in_other_enums = diag(2651, DiagnosticCategory::Error, "A_member_initializer_in_a_enum_declaration_cannot_reference_members_declared_after_it_including_memb_2651", "A member initializer in a enum declaration cannot reference members declared after it, including members defined in other enums."); + static inline const auto Merged_declaration_0_cannot_include_a_default_export_declaration_Consider_adding_a_separate_export_default_0_declaration_instead = diag(2652, DiagnosticCategory::Error, "Merged_declaration_0_cannot_include_a_default_export_declaration_Consider_adding_a_separate_export_d_2652", "Merged declaration '{0}' cannot include a default export declaration. Consider adding a separate 'export default {0}' declaration instead."); + static inline const auto Non_abstract_class_expression_does_not_implement_inherited_abstract_member_0_from_class_1 = diag(2653, DiagnosticCategory::Error, "Non_abstract_class_expression_does_not_implement_inherited_abstract_member_0_from_class_1_2653", "Non-abstract class expression does not implement inherited abstract member '{0}' from class '{1}'."); + static inline const auto JSX_expressions_must_have_one_parent_element = diag(2657, DiagnosticCategory::Error, "JSX_expressions_must_have_one_parent_element_2657", "JSX expressions must have one parent element."); + static inline const auto Type_0_provides_no_match_for_the_signature_1 = diag(2658, DiagnosticCategory::Error, "Type_0_provides_no_match_for_the_signature_1_2658", "Type '{0}' provides no match for the signature '{1}'."); + static inline const auto super_is_only_allowed_in_members_of_object_literal_expressions_when_option_target_is_ES2015_or_higher = diag(2659, DiagnosticCategory::Error, "super_is_only_allowed_in_members_of_object_literal_expressions_when_option_target_is_ES2015_or_highe_2659", "'super' is only allowed in members of object literal expressions when option 'target' is 'ES2015' or higher."); + static inline const auto super_can_only_be_referenced_in_members_of_derived_classes_or_object_literal_expressions = diag(2660, DiagnosticCategory::Error, "super_can_only_be_referenced_in_members_of_derived_classes_or_object_literal_expressions_2660", "'super' can only be referenced in members of derived classes or object literal expressions."); + static inline const auto Cannot_export_0_Only_local_declarations_can_be_exported_from_a_module = diag(2661, DiagnosticCategory::Error, "Cannot_export_0_Only_local_declarations_can_be_exported_from_a_module_2661", "Cannot export '{0}'. Only local declarations can be exported from a module."); + static inline const auto Cannot_find_name_0_Did_you_mean_the_static_member_1_0 = diag(2662, DiagnosticCategory::Error, "Cannot_find_name_0_Did_you_mean_the_static_member_1_0_2662", "Cannot find name '{0}'. Did you mean the static member '{1}.{0}'?"); + static inline const auto Cannot_find_name_0_Did_you_mean_the_instance_member_this_0 = diag(2663, DiagnosticCategory::Error, "Cannot_find_name_0_Did_you_mean_the_instance_member_this_0_2663", "Cannot find name '{0}'. Did you mean the instance member 'this.{0}'?"); + static inline const auto Invalid_module_name_in_augmentation_module_0_cannot_be_found = diag(2664, DiagnosticCategory::Error, "Invalid_module_name_in_augmentation_module_0_cannot_be_found_2664", "Invalid module name in augmentation, module '{0}' cannot be found."); + static inline const auto Invalid_module_name_in_augmentation_Module_0_resolves_to_an_untyped_module_at_1_which_cannot_be_augmented = diag(2665, DiagnosticCategory::Error, "Invalid_module_name_in_augmentation_Module_0_resolves_to_an_untyped_module_at_1_which_cannot_be_augm_2665", "Invalid module name in augmentation. Module '{0}' resolves to an untyped module at '{1}', which cannot be augmented."); + static inline const auto Exports_and_export_assignments_are_not_permitted_in_module_augmentations = diag(2666, DiagnosticCategory::Error, "Exports_and_export_assignments_are_not_permitted_in_module_augmentations_2666", "Exports and export assignments are not permitted in module augmentations."); + static inline const auto Imports_are_not_permitted_in_module_augmentations_Consider_moving_them_to_the_enclosing_external_module = diag(2667, DiagnosticCategory::Error, "Imports_are_not_permitted_in_module_augmentations_Consider_moving_them_to_the_enclosing_external_mod_2667", "Imports are not permitted in module augmentations. Consider moving them to the enclosing external module."); + static inline const auto export_modifier_cannot_be_applied_to_ambient_modules_and_module_augmentations_since_they_are_always_visible = diag(2668, DiagnosticCategory::Error, "export_modifier_cannot_be_applied_to_ambient_modules_and_module_augmentations_since_they_are_always__2668", "'export' modifier cannot be applied to ambient modules and module augmentations since they are always visible."); + static inline const auto Augmentations_for_the_global_scope_can_only_be_directly_nested_in_external_modules_or_ambient_module_declarations = diag(2669, DiagnosticCategory::Error, "Augmentations_for_the_global_scope_can_only_be_directly_nested_in_external_modules_or_ambient_module_2669", "Augmentations for the global scope can only be directly nested in external modules or ambient module declarations."); + static inline const auto Augmentations_for_the_global_scope_should_have_declare_modifier_unless_they_appear_in_already_ambient_context = diag(2670, DiagnosticCategory::Error, "Augmentations_for_the_global_scope_should_have_declare_modifier_unless_they_appear_in_already_ambien_2670", "Augmentations for the global scope should have 'declare' modifier unless they appear in already ambient context."); + static inline const auto Cannot_augment_module_0_because_it_resolves_to_a_non_module_entity = diag(2671, DiagnosticCategory::Error, "Cannot_augment_module_0_because_it_resolves_to_a_non_module_entity_2671", "Cannot augment module '{0}' because it resolves to a non-module entity."); + static inline const auto Cannot_assign_a_0_constructor_type_to_a_1_constructor_type = diag(2672, DiagnosticCategory::Error, "Cannot_assign_a_0_constructor_type_to_a_1_constructor_type_2672", "Cannot assign a '{0}' constructor type to a '{1}' constructor type."); + static inline const auto Constructor_of_class_0_is_private_and_only_accessible_within_the_class_declaration = diag(2673, DiagnosticCategory::Error, "Constructor_of_class_0_is_private_and_only_accessible_within_the_class_declaration_2673", "Constructor of class '{0}' is private and only accessible within the class declaration."); + static inline const auto Constructor_of_class_0_is_protected_and_only_accessible_within_the_class_declaration = diag(2674, DiagnosticCategory::Error, "Constructor_of_class_0_is_protected_and_only_accessible_within_the_class_declaration_2674", "Constructor of class '{0}' is protected and only accessible within the class declaration."); + static inline const auto Cannot_extend_a_class_0_Class_constructor_is_marked_as_private = diag(2675, DiagnosticCategory::Error, "Cannot_extend_a_class_0_Class_constructor_is_marked_as_private_2675", "Cannot extend a class '{0}'. Class constructor is marked as private."); + static inline const auto Accessors_must_both_be_abstract_or_non_abstract = diag(2676, DiagnosticCategory::Error, "Accessors_must_both_be_abstract_or_non_abstract_2676", "Accessors must both be abstract or non-abstract."); + static inline const auto A_type_predicate_s_type_must_be_assignable_to_its_parameter_s_type = diag(2677, DiagnosticCategory::Error, "A_type_predicate_s_type_must_be_assignable_to_its_parameter_s_type_2677", "A type predicate's type must be assignable to its parameter's type."); + static inline const auto Type_0_is_not_comparable_to_type_1 = diag(2678, DiagnosticCategory::Error, "Type_0_is_not_comparable_to_type_1_2678", "Type '{0}' is not comparable to type '{1}'."); + static inline const auto A_function_that_is_called_with_the_new_keyword_cannot_have_a_this_type_that_is_void = diag(2679, DiagnosticCategory::Error, "A_function_that_is_called_with_the_new_keyword_cannot_have_a_this_type_that_is_void_2679", "A function that is called with the 'new' keyword cannot have a 'this' type that is 'void'."); + static inline const auto A_0_parameter_must_be_the_first_parameter = diag(2680, DiagnosticCategory::Error, "A_0_parameter_must_be_the_first_parameter_2680", "A '{0}' parameter must be the first parameter."); + static inline const auto A_constructor_cannot_have_a_this_parameter = diag(2681, DiagnosticCategory::Error, "A_constructor_cannot_have_a_this_parameter_2681", "A constructor cannot have a 'this' parameter."); + static inline const auto this_implicitly_has_type_any_because_it_does_not_have_a_type_annotation = diag(2683, DiagnosticCategory::Error, "this_implicitly_has_type_any_because_it_does_not_have_a_type_annotation_2683", "'this' implicitly has type 'any' because it does not have a type annotation."); + static inline const auto The_this_context_of_type_0_is_not_assignable_to_method_s_this_of_type_1 = diag(2684, DiagnosticCategory::Error, "The_this_context_of_type_0_is_not_assignable_to_method_s_this_of_type_1_2684", "The 'this' context of type '{0}' is not assignable to method's 'this' of type '{1}'."); + static inline const auto The_this_types_of_each_signature_are_incompatible = diag(2685, DiagnosticCategory::Error, "The_this_types_of_each_signature_are_incompatible_2685", "The 'this' types of each signature are incompatible."); + static inline const auto _0_refers_to_a_UMD_global_but_the_current_file_is_a_module_Consider_adding_an_import_instead = diag(2686, DiagnosticCategory::Error, "_0_refers_to_a_UMD_global_but_the_current_file_is_a_module_Consider_adding_an_import_instead_2686", "'{0}' refers to a UMD global, but the current file is a module. Consider adding an import instead."); + static inline const auto All_declarations_of_0_must_have_identical_modifiers = diag(2687, DiagnosticCategory::Error, "All_declarations_of_0_must_have_identical_modifiers_2687", "All declarations of '{0}' must have identical modifiers."); + static inline const auto Cannot_find_type_definition_file_for_0 = diag(2688, DiagnosticCategory::Error, "Cannot_find_type_definition_file_for_0_2688", "Cannot find type definition file for '{0}'."); + static inline const auto Cannot_extend_an_interface_0_Did_you_mean_implements = diag(2689, DiagnosticCategory::Error, "Cannot_extend_an_interface_0_Did_you_mean_implements_2689", "Cannot extend an interface '{0}'. Did you mean 'implements'?"); + static inline const auto _0_only_refers_to_a_type_but_is_being_used_as_a_value_here_Did_you_mean_to_use_1_in_0 = diag(2690, DiagnosticCategory::Error, "_0_only_refers_to_a_type_but_is_being_used_as_a_value_here_Did_you_mean_to_use_1_in_0_2690", "'{0}' only refers to a type, but is being used as a value here. Did you mean to use '{1} in {0}'?"); + static inline const auto An_import_path_cannot_end_with_a_0_extension_Consider_importing_1_instead = diag(2691, DiagnosticCategory::Error, "An_import_path_cannot_end_with_a_0_extension_Consider_importing_1_instead_2691", "An import path cannot end with a '{0}' extension. Consider importing '{1}' instead."); + static inline const auto _0_is_a_primitive_but_1_is_a_wrapper_object_Prefer_using_0_when_possible = diag(2692, DiagnosticCategory::Error, "_0_is_a_primitive_but_1_is_a_wrapper_object_Prefer_using_0_when_possible_2692", "'{0}' is a primitive, but '{1}' is a wrapper object. Prefer using '{0}' when possible."); + static inline const auto _0_only_refers_to_a_type_but_is_being_used_as_a_value_here = diag(2693, DiagnosticCategory::Error, "_0_only_refers_to_a_type_but_is_being_used_as_a_value_here_2693", "'{0}' only refers to a type, but is being used as a value here."); + static inline const auto Namespace_0_has_no_exported_member_1 = diag(2694, DiagnosticCategory::Error, "Namespace_0_has_no_exported_member_1_2694", "Namespace '{0}' has no exported member '{1}'."); + static inline const auto Left_side_of_comma_operator_is_unused_and_has_no_side_effects = diag(2695, DiagnosticCategory::Error, "Left_side_of_comma_operator_is_unused_and_has_no_side_effects_2695", "Left side of comma operator is unused and has no side effects.", /*reportsUnnecessary*/ true); + static inline const auto The_Object_type_is_assignable_to_very_few_other_types_Did_you_mean_to_use_the_any_type_instead = diag(2696, DiagnosticCategory::Error, "The_Object_type_is_assignable_to_very_few_other_types_Did_you_mean_to_use_the_any_type_instead_2696", "The 'Object' type is assignable to very few other types. Did you mean to use the 'any' type instead?"); + static inline const auto An_async_function_or_method_must_return_a_Promise_Make_sure_you_have_a_declaration_for_Promise_or_include_ES2015_in_your_lib_option = diag(2697, DiagnosticCategory::Error, "An_async_function_or_method_must_return_a_Promise_Make_sure_you_have_a_declaration_for_Promise_or_in_2697", "An async function or method must return a 'Promise'. Make sure you have a declaration for 'Promise' or include 'ES2015' in your '--lib' option."); + static inline const auto Spread_types_may_only_be_created_from_object_types = diag(2698, DiagnosticCategory::Error, "Spread_types_may_only_be_created_from_object_types_2698", "Spread types may only be created from object types."); + static inline const auto Static_property_0_conflicts_with_built_in_property_Function_0_of_constructor_function_1 = diag(2699, DiagnosticCategory::Error, "Static_property_0_conflicts_with_built_in_property_Function_0_of_constructor_function_1_2699", "Static property '{0}' conflicts with built-in property 'Function.{0}' of constructor function '{1}'."); + static inline const auto Rest_types_may_only_be_created_from_object_types = diag(2700, DiagnosticCategory::Error, "Rest_types_may_only_be_created_from_object_types_2700", "Rest types may only be created from object types."); + static inline const auto The_target_of_an_object_rest_assignment_must_be_a_variable_or_a_property_access = diag(2701, DiagnosticCategory::Error, "The_target_of_an_object_rest_assignment_must_be_a_variable_or_a_property_access_2701", "The target of an object rest assignment must be a variable or a property access."); + static inline const auto _0_only_refers_to_a_type_but_is_being_used_as_a_namespace_here = diag(2702, DiagnosticCategory::Error, "_0_only_refers_to_a_type_but_is_being_used_as_a_namespace_here_2702", "'{0}' only refers to a type, but is being used as a namespace here."); + static inline const auto The_operand_of_a_delete_operator_must_be_a_property_reference = diag(2703, DiagnosticCategory::Error, "The_operand_of_a_delete_operator_must_be_a_property_reference_2703", "The operand of a 'delete' operator must be a property reference."); + static inline const auto The_operand_of_a_delete_operator_cannot_be_a_read_only_property = diag(2704, DiagnosticCategory::Error, "The_operand_of_a_delete_operator_cannot_be_a_read_only_property_2704", "The operand of a 'delete' operator cannot be a read-only property."); + static inline const auto An_async_function_or_method_in_ES5_SlashES3_requires_the_Promise_constructor_Make_sure_you_have_a_declaration_for_the_Promise_constructor_or_include_ES2015_in_your_lib_option = diag(2705, DiagnosticCategory::Error, "An_async_function_or_method_in_ES5_SlashES3_requires_the_Promise_constructor_Make_sure_you_have_a_de_2705", + "An async function or method in ES5/ES3 requires the 'Promise' constructor. Make sure you have a declaration for the 'Promise' constructor or include 'ES2015' in your '--lib' option."); + static inline const auto Required_type_parameters_may_not_follow_optional_type_parameters = diag(2706, DiagnosticCategory::Error, "Required_type_parameters_may_not_follow_optional_type_parameters_2706", "Required type parameters may not follow optional type parameters."); + static inline const auto Generic_type_0_requires_between_1_and_2_type_arguments = diag(2707, DiagnosticCategory::Error, "Generic_type_0_requires_between_1_and_2_type_arguments_2707", "Generic type '{0}' requires between {1} and {2} type arguments."); + static inline const auto Cannot_use_namespace_0_as_a_value = diag(2708, DiagnosticCategory::Error, "Cannot_use_namespace_0_as_a_value_2708", "Cannot use namespace '{0}' as a value."); + static inline const auto Cannot_use_namespace_0_as_a_type = diag(2709, DiagnosticCategory::Error, "Cannot_use_namespace_0_as_a_type_2709", "Cannot use namespace '{0}' as a type."); + static inline const auto _0_are_specified_twice_The_attribute_named_0_will_be_overwritten = diag(2710, DiagnosticCategory::Error, "_0_are_specified_twice_The_attribute_named_0_will_be_overwritten_2710", "'{0}' are specified twice. The attribute named '{0}' will be overwritten."); + static inline const auto A_dynamic_import_call_returns_a_Promise_Make_sure_you_have_a_declaration_for_Promise_or_include_ES2015_in_your_lib_option = diag(2711, DiagnosticCategory::Error, "A_dynamic_import_call_returns_a_Promise_Make_sure_you_have_a_declaration_for_Promise_or_include_ES20_2711", "A dynamic import call returns a 'Promise'. Make sure you have a declaration for 'Promise' or include 'ES2015' in your '--lib' option."); + static inline const auto A_dynamic_import_call_in_ES5_SlashES3_requires_the_Promise_constructor_Make_sure_you_have_a_declaration_for_the_Promise_constructor_or_include_ES2015_in_your_lib_option = diag(2712, DiagnosticCategory::Error, "A_dynamic_import_call_in_ES5_SlashES3_requires_the_Promise_constructor_Make_sure_you_have_a_declarat_2712", + "A dynamic import call in ES5/ES3 requires the 'Promise' constructor. Make sure you have a declaration for the 'Promise' constructor or include 'ES2015' in your '--lib' option."); + static inline const auto Cannot_access_0_1_because_0_is_a_type_but_not_a_namespace_Did_you_mean_to_retrieve_the_type_of_the_property_1_in_0_with_0_1 = diag(2713, DiagnosticCategory::Error, "Cannot_access_0_1_because_0_is_a_type_but_not_a_namespace_Did_you_mean_to_retrieve_the_type_of_the_p_2713", "Cannot access '{0}.{1}' because '{0}' is a type, but not a namespace. Did you mean to retrieve the type of the property '{1}' in '{0}' with '{0}[\"{1}\"]'?"); + static inline const auto The_expression_of_an_export_assignment_must_be_an_identifier_or_qualified_name_in_an_ambient_context = diag(2714, DiagnosticCategory::Error, "The_expression_of_an_export_assignment_must_be_an_identifier_or_qualified_name_in_an_ambient_context_2714", "The expression of an export assignment must be an identifier or qualified name in an ambient context."); + static inline const auto Abstract_property_0_in_class_1_cannot_be_accessed_in_the_constructor = diag(2715, DiagnosticCategory::Error, "Abstract_property_0_in_class_1_cannot_be_accessed_in_the_constructor_2715", "Abstract property '{0}' in class '{1}' cannot be accessed in the constructor."); + static inline const auto Type_parameter_0_has_a_circular_default = diag(2716, DiagnosticCategory::Error, "Type_parameter_0_has_a_circular_default_2716", "Type parameter '{0}' has a circular default."); + static inline const auto Subsequent_property_declarations_must_have_the_same_type_Property_0_must_be_of_type_1_but_here_has_type_2 = diag(2717, DiagnosticCategory::Error, "Subsequent_property_declarations_must_have_the_same_type_Property_0_must_be_of_type_1_but_here_has_t_2717", "Subsequent property declarations must have the same type. Property '{0}' must be of type '{1}', but here has type '{2}'."); + static inline const auto Duplicate_property_0 = diag(2718, DiagnosticCategory::Error, "Duplicate_property_0_2718", "Duplicate property '{0}'."); + static inline const auto Type_0_is_not_assignable_to_type_1_Two_different_types_with_this_name_exist_but_they_are_unrelated = diag(2719, DiagnosticCategory::Error, "Type_0_is_not_assignable_to_type_1_Two_different_types_with_this_name_exist_but_they_are_unrelated_2719", "Type '{0}' is not assignable to type '{1}'. Two different types with this name exist, but they are unrelated."); + static inline const auto Class_0_incorrectly_implements_class_1_Did_you_mean_to_extend_1_and_inherit_its_members_as_a_subclass = diag(2720, DiagnosticCategory::Error, "Class_0_incorrectly_implements_class_1_Did_you_mean_to_extend_1_and_inherit_its_members_as_a_subclas_2720", "Class '{0}' incorrectly implements class '{1}'. Did you mean to extend '{1}' and inherit its members as a subclass?"); + static inline const auto Cannot_invoke_an_object_which_is_possibly_null = diag(2721, DiagnosticCategory::Error, "Cannot_invoke_an_object_which_is_possibly_null_2721", "Cannot invoke an object which is possibly 'null'."); + static inline const auto Cannot_invoke_an_object_which_is_possibly_undefined = diag(2722, DiagnosticCategory::Error, "Cannot_invoke_an_object_which_is_possibly_undefined_2722", "Cannot invoke an object which is possibly 'undefined'."); + static inline const auto Cannot_invoke_an_object_which_is_possibly_null_or_undefined = diag(2723, DiagnosticCategory::Error, "Cannot_invoke_an_object_which_is_possibly_null_or_undefined_2723", "Cannot invoke an object which is possibly 'null' or 'undefined'."); + static inline const auto _0_has_no_exported_member_named_1_Did_you_mean_2 = diag(2724, DiagnosticCategory::Error, "_0_has_no_exported_member_named_1_Did_you_mean_2_2724", "'{0}' has no exported member named '{1}'. Did you mean '{2}'?"); + static inline const auto Class_name_cannot_be_Object_when_targeting_ES5_with_module_0 = diag(2725, DiagnosticCategory::Error, "Class_name_cannot_be_Object_when_targeting_ES5_with_module_0_2725", "Class name cannot be 'Object' when targeting ES5 with module {0}."); + static inline const auto Cannot_find_lib_definition_for_0 = diag(2726, DiagnosticCategory::Error, "Cannot_find_lib_definition_for_0_2726", "Cannot find lib definition for '{0}'."); + static inline const auto Cannot_find_lib_definition_for_0_Did_you_mean_1 = diag(2727, DiagnosticCategory::Error, "Cannot_find_lib_definition_for_0_Did_you_mean_1_2727", "Cannot find lib definition for '{0}'. Did you mean '{1}'?"); + static inline const auto _0_is_declared_here = diag(2728, DiagnosticCategory::Message, "_0_is_declared_here_2728", "'{0}' is declared here."); + static inline const auto Property_0_is_used_before_its_initialization = diag(2729, DiagnosticCategory::Error, "Property_0_is_used_before_its_initialization_2729", "Property '{0}' is used before its initialization."); + static inline const auto An_arrow_function_cannot_have_a_this_parameter = diag(2730, DiagnosticCategory::Error, "An_arrow_function_cannot_have_a_this_parameter_2730", "An arrow function cannot have a 'this' parameter."); + static inline const auto Implicit_conversion_of_a_symbol_to_a_string_will_fail_at_runtime_Consider_wrapping_this_expression_in_String = diag(2731, DiagnosticCategory::Error, "Implicit_conversion_of_a_symbol_to_a_string_will_fail_at_runtime_Consider_wrapping_this_expression_i_2731", "Implicit conversion of a 'symbol' to a 'string' will fail at runtime. Consider wrapping this expression in 'String(...)'."); + static inline const auto Cannot_find_module_0_Consider_using_resolveJsonModule_to_import_module_with_json_extension = diag(2732, DiagnosticCategory::Error, "Cannot_find_module_0_Consider_using_resolveJsonModule_to_import_module_with_json_extension_2732", "Cannot find module '{0}'. Consider using '--resolveJsonModule' to import module with '.json' extension."); + static inline const auto Property_0_was_also_declared_here = diag(2733, DiagnosticCategory::Error, "Property_0_was_also_declared_here_2733", "Property '{0}' was also declared here."); + static inline const auto Are_you_missing_a_semicolon = diag(2734, DiagnosticCategory::Error, "Are_you_missing_a_semicolon_2734", "Are you missing a semicolon?"); + static inline const auto Did_you_mean_for_0_to_be_constrained_to_type_new_args_Colon_any_1 = diag(2735, DiagnosticCategory::Error, "Did_you_mean_for_0_to_be_constrained_to_type_new_args_Colon_any_1_2735", "Did you mean for '{0}' to be constrained to type 'new (...args: any[]) => {1}'?"); + static inline const auto Operator_0_cannot_be_applied_to_type_1 = diag(2736, DiagnosticCategory::Error, "Operator_0_cannot_be_applied_to_type_1_2736", "Operator '{0}' cannot be applied to type '{1}'."); + static inline const auto BigInt_literals_are_not_available_when_targeting_lower_than_ES2020 = diag(2737, DiagnosticCategory::Error, "BigInt_literals_are_not_available_when_targeting_lower_than_ES2020_2737", "BigInt literals are not available when targeting lower than ES2020."); + static inline const auto An_outer_value_of_this_is_shadowed_by_this_container = diag(2738, DiagnosticCategory::Message, "An_outer_value_of_this_is_shadowed_by_this_container_2738", "An outer value of 'this' is shadowed by this container."); + static inline const auto Type_0_is_missing_the_following_properties_from_type_1_Colon_2 = diag(2739, DiagnosticCategory::Error, "Type_0_is_missing_the_following_properties_from_type_1_Colon_2_2739", "Type '{0}' is missing the following properties from type '{1}': {2}"); + static inline const auto Type_0_is_missing_the_following_properties_from_type_1_Colon_2_and_3_more = diag(2740, DiagnosticCategory::Error, "Type_0_is_missing_the_following_properties_from_type_1_Colon_2_and_3_more_2740", "Type '{0}' is missing the following properties from type '{1}': {2}, and {3} more."); + static inline const auto Property_0_is_missing_in_type_1_but_required_in_type_2 = diag(2741, DiagnosticCategory::Error, "Property_0_is_missing_in_type_1_but_required_in_type_2_2741", "Property '{0}' is missing in type '{1}' but required in type '{2}'."); + static inline const auto The_inferred_type_of_0_cannot_be_named_without_a_reference_to_1_This_is_likely_not_portable_A_type_annotation_is_necessary = diag(2742, DiagnosticCategory::Error, "The_inferred_type_of_0_cannot_be_named_without_a_reference_to_1_This_is_likely_not_portable_A_type_a_2742", "The inferred type of '{0}' cannot be named without a reference to '{1}'. This is likely not portable. A type annotation is necessary."); + static inline const auto No_overload_expects_0_type_arguments_but_overloads_do_exist_that_expect_either_1_or_2_type_arguments = diag(2743, DiagnosticCategory::Error, "No_overload_expects_0_type_arguments_but_overloads_do_exist_that_expect_either_1_or_2_type_arguments_2743", "No overload expects {0} type arguments, but overloads do exist that expect either {1} or {2} type arguments."); + static inline const auto Type_parameter_defaults_can_only_reference_previously_declared_type_parameters = diag(2744, DiagnosticCategory::Error, "Type_parameter_defaults_can_only_reference_previously_declared_type_parameters_2744", "Type parameter defaults can only reference previously declared type parameters."); + static inline const auto This_JSX_tag_s_0_prop_expects_type_1_which_requires_multiple_children_but_only_a_single_child_was_provided = diag(2745, DiagnosticCategory::Error, "This_JSX_tag_s_0_prop_expects_type_1_which_requires_multiple_children_but_only_a_single_child_was_pr_2745", "This JSX tag's '{0}' prop expects type '{1}' which requires multiple children, but only a single child was provided."); + static inline const auto This_JSX_tag_s_0_prop_expects_a_single_child_of_type_1_but_multiple_children_were_provided = diag(2746, DiagnosticCategory::Error, "This_JSX_tag_s_0_prop_expects_a_single_child_of_type_1_but_multiple_children_were_provided_2746", "This JSX tag's '{0}' prop expects a single child of type '{1}', but multiple children were provided."); + static inline const auto _0_components_don_t_accept_text_as_child_elements_Text_in_JSX_has_the_type_string_but_the_expected_type_of_1_is_2 = diag(2747, DiagnosticCategory::Error, "_0_components_don_t_accept_text_as_child_elements_Text_in_JSX_has_the_type_string_but_the_expected_t_2747", "'{0}' components don't accept text as child elements. Text in JSX has the type 'string', but the expected type of '{1}' is '{2}'."); + static inline const auto Cannot_access_ambient_const_enums_when_the_isolatedModules_flag_is_provided = diag(2748, DiagnosticCategory::Error, "Cannot_access_ambient_const_enums_when_the_isolatedModules_flag_is_provided_2748", "Cannot access ambient const enums when the '--isolatedModules' flag is provided."); + static inline const auto _0_refers_to_a_value_but_is_being_used_as_a_type_here_Did_you_mean_typeof_0 = diag(2749, DiagnosticCategory::Error, "_0_refers_to_a_value_but_is_being_used_as_a_type_here_Did_you_mean_typeof_0_2749", "'{0}' refers to a value, but is being used as a type here. Did you mean 'typeof {0}'?"); + static inline const auto The_implementation_signature_is_declared_here = diag(2750, DiagnosticCategory::Error, "The_implementation_signature_is_declared_here_2750", "The implementation signature is declared here."); + static inline const auto Circularity_originates_in_type_at_this_location = diag(2751, DiagnosticCategory::Error, "Circularity_originates_in_type_at_this_location_2751", "Circularity originates in type at this location."); + static inline const auto The_first_export_default_is_here = diag(2752, DiagnosticCategory::Error, "The_first_export_default_is_here_2752", "The first export default is here."); + static inline const auto Another_export_default_is_here = diag(2753, DiagnosticCategory::Error, "Another_export_default_is_here_2753", "Another export default is here."); + static inline const auto super_may_not_use_type_arguments = diag(2754, DiagnosticCategory::Error, "super_may_not_use_type_arguments_2754", "'super' may not use type arguments."); + static inline const auto No_constituent_of_type_0_is_callable = diag(2755, DiagnosticCategory::Error, "No_constituent_of_type_0_is_callable_2755", "No constituent of type '{0}' is callable."); + static inline const auto Not_all_constituents_of_type_0_are_callable = diag(2756, DiagnosticCategory::Error, "Not_all_constituents_of_type_0_are_callable_2756", "Not all constituents of type '{0}' are callable."); + static inline const auto Type_0_has_no_call_signatures = diag(2757, DiagnosticCategory::Error, "Type_0_has_no_call_signatures_2757", "Type '{0}' has no call signatures."); + static inline const auto Each_member_of_the_union_type_0_has_signatures_but_none_of_those_signatures_are_compatible_with_each_other = diag(2758, DiagnosticCategory::Error, "Each_member_of_the_union_type_0_has_signatures_but_none_of_those_signatures_are_compatible_with_each_2758", "Each member of the union type '{0}' has signatures, but none of those signatures are compatible with each other."); + static inline const auto No_constituent_of_type_0_is_constructable = diag(2759, DiagnosticCategory::Error, "No_constituent_of_type_0_is_constructable_2759", "No constituent of type '{0}' is constructable."); + static inline const auto Not_all_constituents_of_type_0_are_constructable = diag(2760, DiagnosticCategory::Error, "Not_all_constituents_of_type_0_are_constructable_2760", "Not all constituents of type '{0}' are constructable."); + static inline const auto Type_0_has_no_construct_signatures = diag(2761, DiagnosticCategory::Error, "Type_0_has_no_construct_signatures_2761", "Type '{0}' has no construct signatures."); + static inline const auto Each_member_of_the_union_type_0_has_construct_signatures_but_none_of_those_signatures_are_compatible_with_each_other = diag(2762, DiagnosticCategory::Error, "Each_member_of_the_union_type_0_has_construct_signatures_but_none_of_those_signatures_are_compatible_2762", "Each member of the union type '{0}' has construct signatures, but none of those signatures are compatible with each other."); + static inline const auto Cannot_iterate_value_because_the_next_method_of_its_iterator_expects_type_1_but_for_of_will_always_send_0 = diag(2763, DiagnosticCategory::Error, "Cannot_iterate_value_because_the_next_method_of_its_iterator_expects_type_1_but_for_of_will_always_s_2763", "Cannot iterate value because the 'next' method of its iterator expects type '{1}', but for-of will always send '{0}'."); + static inline const auto Cannot_iterate_value_because_the_next_method_of_its_iterator_expects_type_1_but_array_spread_will_always_send_0 = diag(2764, DiagnosticCategory::Error, "Cannot_iterate_value_because_the_next_method_of_its_iterator_expects_type_1_but_array_spread_will_al_2764", "Cannot iterate value because the 'next' method of its iterator expects type '{1}', but array spread will always send '{0}'."); + static inline const auto Cannot_iterate_value_because_the_next_method_of_its_iterator_expects_type_1_but_array_destructuring_will_always_send_0 = diag(2765, DiagnosticCategory::Error, "Cannot_iterate_value_because_the_next_method_of_its_iterator_expects_type_1_but_array_destructuring__2765", "Cannot iterate value because the 'next' method of its iterator expects type '{1}', but array destructuring will always send '{0}'."); + static inline const auto Cannot_delegate_iteration_to_value_because_the_next_method_of_its_iterator_expects_type_1_but_the_containing_generator_will_always_send_0 = diag(2766, DiagnosticCategory::Error, "Cannot_delegate_iteration_to_value_because_the_next_method_of_its_iterator_expects_type_1_but_the_co_2766", "Cannot delegate iteration to value because the 'next' method of its iterator expects type '{1}', but the containing generator will always send '{0}'."); + static inline const auto The_0_property_of_an_iterator_must_be_a_method = diag(2767, DiagnosticCategory::Error, "The_0_property_of_an_iterator_must_be_a_method_2767", "The '{0}' property of an iterator must be a method."); + static inline const auto The_0_property_of_an_async_iterator_must_be_a_method = diag(2768, DiagnosticCategory::Error, "The_0_property_of_an_async_iterator_must_be_a_method_2768", "The '{0}' property of an async iterator must be a method."); + static inline const auto No_overload_matches_this_call = diag(2769, DiagnosticCategory::Error, "No_overload_matches_this_call_2769", "No overload matches this call."); + static inline const auto The_last_overload_gave_the_following_error = diag(2770, DiagnosticCategory::Error, "The_last_overload_gave_the_following_error_2770", "The last overload gave the following error."); + static inline const auto The_last_overload_is_declared_here = diag(2771, DiagnosticCategory::Error, "The_last_overload_is_declared_here_2771", "The last overload is declared here."); + static inline const auto Overload_0_of_1_2_gave_the_following_error = diag(2772, DiagnosticCategory::Error, "Overload_0_of_1_2_gave_the_following_error_2772", "Overload {0} of {1}, '{2}', gave the following error."); + static inline const auto Did_you_forget_to_use_await = diag(2773, DiagnosticCategory::Error, "Did_you_forget_to_use_await_2773", "Did you forget to use 'await'?"); + static inline const auto This_condition_will_always_return_true_since_this_function_is_always_defined_Did_you_mean_to_call_it_instead = diag(2774, DiagnosticCategory::Error, "This_condition_will_always_return_true_since_this_function_is_always_defined_Did_you_mean_to_call_it_2774", "This condition will always return true since this function is always defined. Did you mean to call it instead?"); + static inline const auto Assertions_require_every_name_in_the_call_target_to_be_declared_with_an_explicit_type_annotation = diag(2775, DiagnosticCategory::Error, "Assertions_require_every_name_in_the_call_target_to_be_declared_with_an_explicit_type_annotation_2775", "Assertions require every name in the call target to be declared with an explicit type annotation."); + static inline const auto Assertions_require_the_call_target_to_be_an_identifier_or_qualified_name = diag(2776, DiagnosticCategory::Error, "Assertions_require_the_call_target_to_be_an_identifier_or_qualified_name_2776", "Assertions require the call target to be an identifier or qualified name."); + static inline const auto The_operand_of_an_increment_or_decrement_operator_may_not_be_an_optional_property_access = diag(2777, DiagnosticCategory::Error, "The_operand_of_an_increment_or_decrement_operator_may_not_be_an_optional_property_access_2777", "The operand of an increment or decrement operator may not be an optional property access."); + static inline const auto The_target_of_an_object_rest_assignment_may_not_be_an_optional_property_access = diag(2778, DiagnosticCategory::Error, "The_target_of_an_object_rest_assignment_may_not_be_an_optional_property_access_2778", "The target of an object rest assignment may not be an optional property access."); + static inline const auto The_left_hand_side_of_an_assignment_expression_may_not_be_an_optional_property_access = diag(2779, DiagnosticCategory::Error, "The_left_hand_side_of_an_assignment_expression_may_not_be_an_optional_property_access_2779", "The left-hand side of an assignment expression may not be an optional property access."); + static inline const auto The_left_hand_side_of_a_for_in_statement_may_not_be_an_optional_property_access = diag(2780, DiagnosticCategory::Error, "The_left_hand_side_of_a_for_in_statement_may_not_be_an_optional_property_access_2780", "The left-hand side of a 'for...in' statement may not be an optional property access."); + static inline const auto The_left_hand_side_of_a_for_of_statement_may_not_be_an_optional_property_access = diag(2781, DiagnosticCategory::Error, "The_left_hand_side_of_a_for_of_statement_may_not_be_an_optional_property_access_2781", "The left-hand side of a 'for...of' statement may not be an optional property access."); + static inline const auto _0_needs_an_explicit_type_annotation = diag(2782, DiagnosticCategory::Message, "_0_needs_an_explicit_type_annotation_2782", "'{0}' needs an explicit type annotation."); + static inline const auto _0_is_specified_more_than_once_so_this_usage_will_be_overwritten = diag(2783, DiagnosticCategory::Error, "_0_is_specified_more_than_once_so_this_usage_will_be_overwritten_2783", "'{0}' is specified more than once, so this usage will be overwritten."); + static inline const auto get_and_set_accessors_cannot_declare_this_parameters = diag(2784, DiagnosticCategory::Error, "get_and_set_accessors_cannot_declare_this_parameters_2784", "'get' and 'set' accessors cannot declare 'this' parameters."); + static inline const auto This_spread_always_overwrites_this_property = diag(2785, DiagnosticCategory::Error, "This_spread_always_overwrites_this_property_2785", "This spread always overwrites this property."); + static inline const auto _0_cannot_be_used_as_a_JSX_component = diag(2786, DiagnosticCategory::Error, "_0_cannot_be_used_as_a_JSX_component_2786", "'{0}' cannot be used as a JSX component."); + static inline const auto Its_return_type_0_is_not_a_valid_JSX_element = diag(2787, DiagnosticCategory::Error, "Its_return_type_0_is_not_a_valid_JSX_element_2787", "Its return type '{0}' is not a valid JSX element."); + static inline const auto Its_instance_type_0_is_not_a_valid_JSX_element = diag(2788, DiagnosticCategory::Error, "Its_instance_type_0_is_not_a_valid_JSX_element_2788", "Its instance type '{0}' is not a valid JSX element."); + static inline const auto Its_element_type_0_is_not_a_valid_JSX_element = diag(2789, DiagnosticCategory::Error, "Its_element_type_0_is_not_a_valid_JSX_element_2789", "Its element type '{0}' is not a valid JSX element."); + static inline const auto The_operand_of_a_delete_operator_must_be_optional = diag(2790, DiagnosticCategory::Error, "The_operand_of_a_delete_operator_must_be_optional_2790", "The operand of a 'delete' operator must be optional."); + static inline const auto Exponentiation_cannot_be_performed_on_bigint_values_unless_the_target_option_is_set_to_es2016_or_later = diag(2791, DiagnosticCategory::Error, "Exponentiation_cannot_be_performed_on_bigint_values_unless_the_target_option_is_set_to_es2016_or_lat_2791", "Exponentiation cannot be performed on 'bigint' values unless the 'target' option is set to 'es2016' or later."); + static inline const auto Cannot_find_module_0_Did_you_mean_to_set_the_moduleResolution_option_to_node_or_to_add_aliases_to_the_paths_option = diag(2792, DiagnosticCategory::Error, "Cannot_find_module_0_Did_you_mean_to_set_the_moduleResolution_option_to_node_or_to_add_aliases_to_th_2792", "Cannot find module '{0}'. Did you mean to set the 'moduleResolution' option to 'node', or to add aliases to the 'paths' option?"); + static inline const auto The_call_would_have_succeeded_against_this_implementation_but_implementation_signatures_of_overloads_are_not_externally_visible = diag(2793, DiagnosticCategory::Error, "The_call_would_have_succeeded_against_this_implementation_but_implementation_signatures_of_overloads_2793", "The call would have succeeded against this implementation, but implementation signatures of overloads are not externally visible."); + static inline const auto Expected_0_arguments_but_got_1_Did_you_forget_to_include_void_in_your_type_argument_to_Promise = diag(2794, DiagnosticCategory::Error, "Expected_0_arguments_but_got_1_Did_you_forget_to_include_void_in_your_type_argument_to_Promise_2794", "Expected {0} arguments, but got {1}. Did you forget to include 'void' in your type argument to 'Promise'?"); + static inline const auto The_intrinsic_keyword_can_only_be_used_to_declare_compiler_provided_intrinsic_types = diag(2795, DiagnosticCategory::Error, "The_intrinsic_keyword_can_only_be_used_to_declare_compiler_provided_intrinsic_types_2795", "The 'intrinsic' keyword can only be used to declare compiler provided intrinsic types."); + static inline const auto It_is_likely_that_you_are_missing_a_comma_to_separate_these_two_template_expressions_They_form_a_tagged_template_expression_which_cannot_be_invoked = diag(2796, DiagnosticCategory::Error, "It_is_likely_that_you_are_missing_a_comma_to_separate_these_two_template_expressions_They_form_a_tag_2796", "It is likely that you are missing a comma to separate these two template expressions. They form a tagged template expression which cannot be invoked."); + static inline const auto A_mixin_class_that_extends_from_a_type_variable_containing_an_abstract_construct_signature_must_also_be_declared_abstract = diag(2797, DiagnosticCategory::Error, "A_mixin_class_that_extends_from_a_type_variable_containing_an_abstract_construct_signature_must_also_2797", "A mixin class that extends from a type variable containing an abstract construct signature must also be declared 'abstract'."); + static inline const auto The_declaration_was_marked_as_deprecated_here = diag(2798, DiagnosticCategory::Error, "The_declaration_was_marked_as_deprecated_here_2798", "The declaration was marked as deprecated here."); + static inline const auto Type_produces_a_tuple_type_that_is_too_large_to_represent = diag(2799, DiagnosticCategory::Error, "Type_produces_a_tuple_type_that_is_too_large_to_represent_2799", "Type produces a tuple type that is too large to represent."); + static inline const auto Expression_produces_a_tuple_type_that_is_too_large_to_represent = diag(2800, DiagnosticCategory::Error, "Expression_produces_a_tuple_type_that_is_too_large_to_represent_2800", "Expression produces a tuple type that is too large to represent."); + static inline const auto This_condition_will_always_return_true_since_this_0_is_always_defined = diag(2801, DiagnosticCategory::Error, "This_condition_will_always_return_true_since_this_0_is_always_defined_2801", "This condition will always return true since this '{0}' is always defined."); + static inline const auto Type_0_can_only_be_iterated_through_when_using_the_downlevelIteration_flag_or_with_a_target_of_es2015_or_higher = diag(2802, DiagnosticCategory::Error, "Type_0_can_only_be_iterated_through_when_using_the_downlevelIteration_flag_or_with_a_target_of_es201_2802", "Type '{0}' can only be iterated through when using the '--downlevelIteration' flag or with a '--target' of 'es2015' or higher."); + static inline const auto Cannot_assign_to_private_method_0_Private_methods_are_not_writable = diag(2803, DiagnosticCategory::Error, "Cannot_assign_to_private_method_0_Private_methods_are_not_writable_2803", "Cannot assign to private method '{0}'. Private methods are not writable."); + static inline const auto Duplicate_identifier_0_Static_and_instance_elements_cannot_share_the_same_private_name = diag(2804, DiagnosticCategory::Error, "Duplicate_identifier_0_Static_and_instance_elements_cannot_share_the_same_private_name_2804", "Duplicate identifier '{0}'. Static and instance elements cannot share the same private name."); + static inline const auto Static_fields_with_private_names_can_t_have_initializers_when_the_useDefineForClassFields_flag_is_not_specified_with_a_target_of_esnext_Consider_adding_the_useDefineForClassFields_flag = diag(2805, DiagnosticCategory::Error, "Static_fields_with_private_names_can_t_have_initializers_when_the_useDefineForClassFields_flag_is_no_2805", + "Static fields with private names can't have initializers when the '--useDefineForClassFields' flag is not specified with a '--target' of 'esnext'. Consider adding the '--useDefineForClassFields' flag."); + static inline const auto Private_accessor_was_defined_without_a_getter = diag(2806, DiagnosticCategory::Error, "Private_accessor_was_defined_without_a_getter_2806", "Private accessor was defined without a getter."); + static inline const auto This_syntax_requires_an_imported_helper_named_1_with_2_parameters_which_is_not_compatible_with_the_one_in_0_Consider_upgrading_your_version_of_0 = diag(2807, DiagnosticCategory::Error, "This_syntax_requires_an_imported_helper_named_1_with_2_parameters_which_is_not_compatible_with_the_o_2807", "This syntax requires an imported helper named '{1}' with {2} parameters, which is not compatible with the one in '{0}'. Consider upgrading your version of '{0}'."); + static inline const auto A_get_accessor_must_be_at_least_as_accessible_as_the_setter = diag(2808, DiagnosticCategory::Error, "A_get_accessor_must_be_at_least_as_accessible_as_the_setter_2808", "A get accessor must be at least as accessible as the setter"); + static inline const auto Declaration_or_statement_expected_This_follows_a_block_of_statements_so_if_you_intended_to_write_a_destructuring_assignment_you_might_need_to_wrap_the_the_whole_assignment_in_parentheses = diag(2809, DiagnosticCategory::Error, "Declaration_or_statement_expected_This_follows_a_block_of_statements_so_if_you_intended_to_write_a_d_2809", + "Declaration or statement expected. This '=' follows a block of statements, so if you intended to write a destructuring assignment, you might need to wrap the the whole assignment in parentheses."); + static inline const auto Property_0_may_not_be_used_in_a_static_property_s_initializer_in_the_same_class_when_target_is_esnext_and_useDefineForClassFields_is_false = diag(2810, DiagnosticCategory::Error, "Property_0_may_not_be_used_in_a_static_property_s_initializer_in_the_same_class_when_target_is_esnex_2810", "Property '{0}' may not be used in a static property's initializer in the same class when 'target' is 'esnext' and 'useDefineForClassFields' is 'false'."); + static inline const auto Initializer_for_property_0 = diag(2811, DiagnosticCategory::Error, "Initializer_for_property_0_2811", "Initializer for property '{0}'"); + static inline const auto Property_0_does_not_exist_on_type_1_Try_changing_the_lib_compiler_option_to_include_dom = diag(2812, DiagnosticCategory::Error, "Property_0_does_not_exist_on_type_1_Try_changing_the_lib_compiler_option_to_include_dom_2812", "Property '{0}' does not exist on type '{1}'. Try changing the 'lib' compiler option to include 'dom'."); + static inline const auto Class_declaration_cannot_implement_overload_list_for_0 = diag(2813, DiagnosticCategory::Error, "Class_declaration_cannot_implement_overload_list_for_0_2813", "Class declaration cannot implement overload list for '{0}'."); + static inline const auto Function_with_bodies_can_only_merge_with_classes_that_are_ambient = diag(2814, DiagnosticCategory::Error, "Function_with_bodies_can_only_merge_with_classes_that_are_ambient_2814", "Function with bodies can only merge with classes that are ambient."); + static inline const auto arguments_cannot_be_referenced_in_property_initializers = diag(2815, DiagnosticCategory::Error, "arguments_cannot_be_referenced_in_property_initializers_2815", "'arguments' cannot be referenced in property initializers."); + static inline const auto Cannot_use_this_in_a_static_property_initializer_of_a_decorated_class = diag(2816, DiagnosticCategory::Error, "Cannot_use_this_in_a_static_property_initializer_of_a_decorated_class_2816", "Cannot use 'this' in a static property initializer of a decorated class."); + static inline const auto Property_0_has_no_initializer_and_is_not_definitely_assigned_in_a_class_static_block = diag(2817, DiagnosticCategory::Error, "Property_0_has_no_initializer_and_is_not_definitely_assigned_in_a_class_static_block_2817", "Property '{0}' has no initializer and is not definitely assigned in a class static block."); + static inline const auto Duplicate_identifier_0_Compiler_reserves_name_1_when_emitting_super_references_in_static_initializers = diag(2818, DiagnosticCategory::Error, "Duplicate_identifier_0_Compiler_reserves_name_1_when_emitting_super_references_in_static_initializer_2818", "Duplicate identifier '{0}'. Compiler reserves name '{1}' when emitting 'super' references in static initializers."); + static inline const auto Namespace_name_cannot_be_0 = diag(2819, DiagnosticCategory::Error, "Namespace_name_cannot_be_0_2819", "Namespace name cannot be '{0}'."); + static inline const auto Type_0_is_not_assignable_to_type_1_Did_you_mean_2 = diag(2820, DiagnosticCategory::Error, "Type_0_is_not_assignable_to_type_1_Did_you_mean_2_2820", "Type '{0}' is not assignable to type '{1}'. Did you mean '{2}'?"); + static inline const auto Import_assertions_are_only_supported_when_the_module_option_is_set_to_esnext_or_nodenext = diag(2821, DiagnosticCategory::Error, "Import_assertions_are_only_supported_when_the_module_option_is_set_to_esnext_or_nodenext_2821", "Import assertions are only supported when the '--module' option is set to 'esnext' or 'nodenext'."); + static inline const auto Import_assertions_cannot_be_used_with_type_only_imports_or_exports = diag(2822, DiagnosticCategory::Error, "Import_assertions_cannot_be_used_with_type_only_imports_or_exports_2822", "Import assertions cannot be used with type-only imports or exports."); + static inline const auto Cannot_find_namespace_0_Did_you_mean_1 = diag(2833, DiagnosticCategory::Error, "Cannot_find_namespace_0_Did_you_mean_1_2833", "Cannot find namespace '{0}'. Did you mean '{1}'?"); + static inline const auto Relative_import_paths_need_explicit_file_extensions_in_EcmaScript_imports_when_moduleResolution_is_node12_or_nodenext_Consider_adding_an_extension_to_the_import_path = diag(2834, DiagnosticCategory::Error, "Relative_import_paths_need_explicit_file_extensions_in_EcmaScript_imports_when_moduleResolution_is_n_2834", + "Relative import paths need explicit file extensions in EcmaScript imports when '--moduleResolution' is 'node12' or 'nodenext'. Consider adding an extension to the import path."); + static inline const auto Relative_import_paths_need_explicit_file_extensions_in_EcmaScript_imports_when_moduleResolution_is_node12_or_nodenext_Did_you_mean_0 = diag(2835, DiagnosticCategory::Error, "Relative_import_paths_need_explicit_file_extensions_in_EcmaScript_imports_when_moduleResolution_is_n_2835", "Relative import paths need explicit file extensions in EcmaScript imports when '--moduleResolution' is 'node12' or 'nodenext'. Did you mean '{0}'?"); + static inline const auto Import_assertions_are_not_allowed_on_statements_that_transpile_to_commonjs_require_calls = diag(2836, DiagnosticCategory::Error, "Import_assertions_are_not_allowed_on_statements_that_transpile_to_commonjs_require_calls_2836", "Import assertions are not allowed on statements that transpile to commonjs 'require' calls."); + static inline const auto Import_declaration_0_is_using_private_name_1 = diag(4000, DiagnosticCategory::Error, "Import_declaration_0_is_using_private_name_1_4000", "Import declaration '{0}' is using private name '{1}'."); + static inline const auto Type_parameter_0_of_exported_class_has_or_is_using_private_name_1 = diag(4002, DiagnosticCategory::Error, "Type_parameter_0_of_exported_class_has_or_is_using_private_name_1_4002", "Type parameter '{0}' of exported class has or is using private name '{1}'."); + static inline const auto Type_parameter_0_of_exported_interface_has_or_is_using_private_name_1 = diag(4004, DiagnosticCategory::Error, "Type_parameter_0_of_exported_interface_has_or_is_using_private_name_1_4004", "Type parameter '{0}' of exported interface has or is using private name '{1}'."); + static inline const auto Type_parameter_0_of_constructor_signature_from_exported_interface_has_or_is_using_private_name_1 = diag(4006, DiagnosticCategory::Error, "Type_parameter_0_of_constructor_signature_from_exported_interface_has_or_is_using_private_name_1_4006", "Type parameter '{0}' of constructor signature from exported interface has or is using private name '{1}'."); + static inline const auto Type_parameter_0_of_call_signature_from_exported_interface_has_or_is_using_private_name_1 = diag(4008, DiagnosticCategory::Error, "Type_parameter_0_of_call_signature_from_exported_interface_has_or_is_using_private_name_1_4008", "Type parameter '{0}' of call signature from exported interface has or is using private name '{1}'."); + static inline const auto Type_parameter_0_of_public_static_method_from_exported_class_has_or_is_using_private_name_1 = diag(4010, DiagnosticCategory::Error, "Type_parameter_0_of_public_static_method_from_exported_class_has_or_is_using_private_name_1_4010", "Type parameter '{0}' of public static method from exported class has or is using private name '{1}'."); + static inline const auto Type_parameter_0_of_public_method_from_exported_class_has_or_is_using_private_name_1 = diag(4012, DiagnosticCategory::Error, "Type_parameter_0_of_public_method_from_exported_class_has_or_is_using_private_name_1_4012", "Type parameter '{0}' of public method from exported class has or is using private name '{1}'."); + static inline const auto Type_parameter_0_of_method_from_exported_interface_has_or_is_using_private_name_1 = diag(4014, DiagnosticCategory::Error, "Type_parameter_0_of_method_from_exported_interface_has_or_is_using_private_name_1_4014", "Type parameter '{0}' of method from exported interface has or is using private name '{1}'."); + static inline const auto Type_parameter_0_of_exported_function_has_or_is_using_private_name_1 = diag(4016, DiagnosticCategory::Error, "Type_parameter_0_of_exported_function_has_or_is_using_private_name_1_4016", "Type parameter '{0}' of exported function has or is using private name '{1}'."); + static inline const auto Implements_clause_of_exported_class_0_has_or_is_using_private_name_1 = diag(4019, DiagnosticCategory::Error, "Implements_clause_of_exported_class_0_has_or_is_using_private_name_1_4019", "Implements clause of exported class '{0}' has or is using private name '{1}'."); + static inline const auto extends_clause_of_exported_class_0_has_or_is_using_private_name_1 = diag(4020, DiagnosticCategory::Error, "extends_clause_of_exported_class_0_has_or_is_using_private_name_1_4020", "'extends' clause of exported class '{0}' has or is using private name '{1}'."); + static inline const auto extends_clause_of_exported_class_has_or_is_using_private_name_0 = diag(4021, DiagnosticCategory::Error, "extends_clause_of_exported_class_has_or_is_using_private_name_0_4021", "'extends' clause of exported class has or is using private name '{0}'."); + static inline const auto extends_clause_of_exported_interface_0_has_or_is_using_private_name_1 = diag(4022, DiagnosticCategory::Error, "extends_clause_of_exported_interface_0_has_or_is_using_private_name_1_4022", "'extends' clause of exported interface '{0}' has or is using private name '{1}'."); + static inline const auto Exported_variable_0_has_or_is_using_name_1_from_external_module_2_but_cannot_be_named = diag(4023, DiagnosticCategory::Error, "Exported_variable_0_has_or_is_using_name_1_from_external_module_2_but_cannot_be_named_4023", "Exported variable '{0}' has or is using name '{1}' from external module {2} but cannot be named."); + static inline const auto Exported_variable_0_has_or_is_using_name_1_from_private_module_2 = diag(4024, DiagnosticCategory::Error, "Exported_variable_0_has_or_is_using_name_1_from_private_module_2_4024", "Exported variable '{0}' has or is using name '{1}' from private module '{2}'."); + static inline const auto Exported_variable_0_has_or_is_using_private_name_1 = diag(4025, DiagnosticCategory::Error, "Exported_variable_0_has_or_is_using_private_name_1_4025", "Exported variable '{0}' has or is using private name '{1}'."); + static inline const auto Public_static_property_0_of_exported_class_has_or_is_using_name_1_from_external_module_2_but_cannot_be_named = diag(4026, DiagnosticCategory::Error, "Public_static_property_0_of_exported_class_has_or_is_using_name_1_from_external_module_2_but_cannot__4026", "Public static property '{0}' of exported class has or is using name '{1}' from external module {2} but cannot be named."); + static inline const auto Public_static_property_0_of_exported_class_has_or_is_using_name_1_from_private_module_2 = diag(4027, DiagnosticCategory::Error, "Public_static_property_0_of_exported_class_has_or_is_using_name_1_from_private_module_2_4027", "Public static property '{0}' of exported class has or is using name '{1}' from private module '{2}'."); + static inline const auto Public_static_property_0_of_exported_class_has_or_is_using_private_name_1 = diag(4028, DiagnosticCategory::Error, "Public_static_property_0_of_exported_class_has_or_is_using_private_name_1_4028", "Public static property '{0}' of exported class has or is using private name '{1}'."); + static inline const auto Public_property_0_of_exported_class_has_or_is_using_name_1_from_external_module_2_but_cannot_be_named = diag(4029, DiagnosticCategory::Error, "Public_property_0_of_exported_class_has_or_is_using_name_1_from_external_module_2_but_cannot_be_name_4029", "Public property '{0}' of exported class has or is using name '{1}' from external module {2} but cannot be named."); + static inline const auto Public_property_0_of_exported_class_has_or_is_using_name_1_from_private_module_2 = diag(4030, DiagnosticCategory::Error, "Public_property_0_of_exported_class_has_or_is_using_name_1_from_private_module_2_4030", "Public property '{0}' of exported class has or is using name '{1}' from private module '{2}'."); + static inline const auto Public_property_0_of_exported_class_has_or_is_using_private_name_1 = diag(4031, DiagnosticCategory::Error, "Public_property_0_of_exported_class_has_or_is_using_private_name_1_4031", "Public property '{0}' of exported class has or is using private name '{1}'."); + static inline const auto Property_0_of_exported_interface_has_or_is_using_name_1_from_private_module_2 = diag(4032, DiagnosticCategory::Error, "Property_0_of_exported_interface_has_or_is_using_name_1_from_private_module_2_4032", "Property '{0}' of exported interface has or is using name '{1}' from private module '{2}'."); + static inline const auto Property_0_of_exported_interface_has_or_is_using_private_name_1 = diag(4033, DiagnosticCategory::Error, "Property_0_of_exported_interface_has_or_is_using_private_name_1_4033", "Property '{0}' of exported interface has or is using private name '{1}'."); + static inline const auto Parameter_type_of_public_static_setter_0_from_exported_class_has_or_is_using_name_1_from_private_module_2 = diag(4034, DiagnosticCategory::Error, "Parameter_type_of_public_static_setter_0_from_exported_class_has_or_is_using_name_1_from_private_mod_4034", "Parameter type of public static setter '{0}' from exported class has or is using name '{1}' from private module '{2}'."); + static inline const auto Parameter_type_of_public_static_setter_0_from_exported_class_has_or_is_using_private_name_1 = diag(4035, DiagnosticCategory::Error, "Parameter_type_of_public_static_setter_0_from_exported_class_has_or_is_using_private_name_1_4035", "Parameter type of public static setter '{0}' from exported class has or is using private name '{1}'."); + static inline const auto Parameter_type_of_public_setter_0_from_exported_class_has_or_is_using_name_1_from_private_module_2 = diag(4036, DiagnosticCategory::Error, "Parameter_type_of_public_setter_0_from_exported_class_has_or_is_using_name_1_from_private_module_2_4036", "Parameter type of public setter '{0}' from exported class has or is using name '{1}' from private module '{2}'."); + static inline const auto Parameter_type_of_public_setter_0_from_exported_class_has_or_is_using_private_name_1 = diag(4037, DiagnosticCategory::Error, "Parameter_type_of_public_setter_0_from_exported_class_has_or_is_using_private_name_1_4037", "Parameter type of public setter '{0}' from exported class has or is using private name '{1}'."); + static inline const auto Return_type_of_public_static_getter_0_from_exported_class_has_or_is_using_name_1_from_external_module_2_but_cannot_be_named = diag(4038, DiagnosticCategory::Error, "Return_type_of_public_static_getter_0_from_exported_class_has_or_is_using_name_1_from_external_modul_4038", "Return type of public static getter '{0}' from exported class has or is using name '{1}' from external module {2} but cannot be named."); + static inline const auto Return_type_of_public_static_getter_0_from_exported_class_has_or_is_using_name_1_from_private_module_2 = diag(4039, DiagnosticCategory::Error, "Return_type_of_public_static_getter_0_from_exported_class_has_or_is_using_name_1_from_private_module_4039", "Return type of public static getter '{0}' from exported class has or is using name '{1}' from private module '{2}'."); + static inline const auto Return_type_of_public_static_getter_0_from_exported_class_has_or_is_using_private_name_1 = diag(4040, DiagnosticCategory::Error, "Return_type_of_public_static_getter_0_from_exported_class_has_or_is_using_private_name_1_4040", "Return type of public static getter '{0}' from exported class has or is using private name '{1}'."); + static inline const auto Return_type_of_public_getter_0_from_exported_class_has_or_is_using_name_1_from_external_module_2_but_cannot_be_named = diag(4041, DiagnosticCategory::Error, "Return_type_of_public_getter_0_from_exported_class_has_or_is_using_name_1_from_external_module_2_but_4041", "Return type of public getter '{0}' from exported class has or is using name '{1}' from external module {2} but cannot be named."); + static inline const auto Return_type_of_public_getter_0_from_exported_class_has_or_is_using_name_1_from_private_module_2 = diag(4042, DiagnosticCategory::Error, "Return_type_of_public_getter_0_from_exported_class_has_or_is_using_name_1_from_private_module_2_4042", "Return type of public getter '{0}' from exported class has or is using name '{1}' from private module '{2}'."); + static inline const auto Return_type_of_public_getter_0_from_exported_class_has_or_is_using_private_name_1 = diag(4043, DiagnosticCategory::Error, "Return_type_of_public_getter_0_from_exported_class_has_or_is_using_private_name_1_4043", "Return type of public getter '{0}' from exported class has or is using private name '{1}'."); + static inline const auto Return_type_of_constructor_signature_from_exported_interface_has_or_is_using_name_0_from_private_module_1 = diag(4044, DiagnosticCategory::Error, "Return_type_of_constructor_signature_from_exported_interface_has_or_is_using_name_0_from_private_mod_4044", "Return type of constructor signature from exported interface has or is using name '{0}' from private module '{1}'."); + static inline const auto Return_type_of_constructor_signature_from_exported_interface_has_or_is_using_private_name_0 = diag(4045, DiagnosticCategory::Error, "Return_type_of_constructor_signature_from_exported_interface_has_or_is_using_private_name_0_4045", "Return type of constructor signature from exported interface has or is using private name '{0}'."); + static inline const auto Return_type_of_call_signature_from_exported_interface_has_or_is_using_name_0_from_private_module_1 = diag(4046, DiagnosticCategory::Error, "Return_type_of_call_signature_from_exported_interface_has_or_is_using_name_0_from_private_module_1_4046", "Return type of call signature from exported interface has or is using name '{0}' from private module '{1}'."); + static inline const auto Return_type_of_call_signature_from_exported_interface_has_or_is_using_private_name_0 = diag(4047, DiagnosticCategory::Error, "Return_type_of_call_signature_from_exported_interface_has_or_is_using_private_name_0_4047", "Return type of call signature from exported interface has or is using private name '{0}'."); + static inline const auto Return_type_of_index_signature_from_exported_interface_has_or_is_using_name_0_from_private_module_1 = diag(4048, DiagnosticCategory::Error, "Return_type_of_index_signature_from_exported_interface_has_or_is_using_name_0_from_private_module_1_4048", "Return type of index signature from exported interface has or is using name '{0}' from private module '{1}'."); + static inline const auto Return_type_of_index_signature_from_exported_interface_has_or_is_using_private_name_0 = diag(4049, DiagnosticCategory::Error, "Return_type_of_index_signature_from_exported_interface_has_or_is_using_private_name_0_4049", "Return type of index signature from exported interface has or is using private name '{0}'."); + static inline const auto Return_type_of_public_static_method_from_exported_class_has_or_is_using_name_0_from_external_module_1_but_cannot_be_named = diag(4050, DiagnosticCategory::Error, "Return_type_of_public_static_method_from_exported_class_has_or_is_using_name_0_from_external_module__4050", "Return type of public static method from exported class has or is using name '{0}' from external module {1} but cannot be named."); + static inline const auto Return_type_of_public_static_method_from_exported_class_has_or_is_using_name_0_from_private_module_1 = diag(4051, DiagnosticCategory::Error, "Return_type_of_public_static_method_from_exported_class_has_or_is_using_name_0_from_private_module_1_4051", "Return type of public static method from exported class has or is using name '{0}' from private module '{1}'."); + static inline const auto Return_type_of_public_static_method_from_exported_class_has_or_is_using_private_name_0 = diag(4052, DiagnosticCategory::Error, "Return_type_of_public_static_method_from_exported_class_has_or_is_using_private_name_0_4052", "Return type of public static method from exported class has or is using private name '{0}'."); + static inline const auto Return_type_of_public_method_from_exported_class_has_or_is_using_name_0_from_external_module_1_but_cannot_be_named = diag(4053, DiagnosticCategory::Error, "Return_type_of_public_method_from_exported_class_has_or_is_using_name_0_from_external_module_1_but_c_4053", "Return type of public method from exported class has or is using name '{0}' from external module {1} but cannot be named."); + static inline const auto Return_type_of_public_method_from_exported_class_has_or_is_using_name_0_from_private_module_1 = diag(4054, DiagnosticCategory::Error, "Return_type_of_public_method_from_exported_class_has_or_is_using_name_0_from_private_module_1_4054", "Return type of public method from exported class has or is using name '{0}' from private module '{1}'."); + static inline const auto Return_type_of_public_method_from_exported_class_has_or_is_using_private_name_0 = diag(4055, DiagnosticCategory::Error, "Return_type_of_public_method_from_exported_class_has_or_is_using_private_name_0_4055", "Return type of public method from exported class has or is using private name '{0}'."); + static inline const auto Return_type_of_method_from_exported_interface_has_or_is_using_name_0_from_private_module_1 = diag(4056, DiagnosticCategory::Error, "Return_type_of_method_from_exported_interface_has_or_is_using_name_0_from_private_module_1_4056", "Return type of method from exported interface has or is using name '{0}' from private module '{1}'."); + static inline const auto Return_type_of_method_from_exported_interface_has_or_is_using_private_name_0 = diag(4057, DiagnosticCategory::Error, "Return_type_of_method_from_exported_interface_has_or_is_using_private_name_0_4057", "Return type of method from exported interface has or is using private name '{0}'."); + static inline const auto Return_type_of_exported_function_has_or_is_using_name_0_from_external_module_1_but_cannot_be_named = diag(4058, DiagnosticCategory::Error, "Return_type_of_exported_function_has_or_is_using_name_0_from_external_module_1_but_cannot_be_named_4058", "Return type of exported function has or is using name '{0}' from external module {1} but cannot be named."); + static inline const auto Return_type_of_exported_function_has_or_is_using_name_0_from_private_module_1 = diag(4059, DiagnosticCategory::Error, "Return_type_of_exported_function_has_or_is_using_name_0_from_private_module_1_4059", "Return type of exported function has or is using name '{0}' from private module '{1}'."); + static inline const auto Return_type_of_exported_function_has_or_is_using_private_name_0 = diag(4060, DiagnosticCategory::Error, "Return_type_of_exported_function_has_or_is_using_private_name_0_4060", "Return type of exported function has or is using private name '{0}'."); + static inline const auto Parameter_0_of_constructor_from_exported_class_has_or_is_using_name_1_from_external_module_2_but_cannot_be_named = diag(4061, DiagnosticCategory::Error, "Parameter_0_of_constructor_from_exported_class_has_or_is_using_name_1_from_external_module_2_but_can_4061", "Parameter '{0}' of constructor from exported class has or is using name '{1}' from external module {2} but cannot be named."); + static inline const auto Parameter_0_of_constructor_from_exported_class_has_or_is_using_name_1_from_private_module_2 = diag(4062, DiagnosticCategory::Error, "Parameter_0_of_constructor_from_exported_class_has_or_is_using_name_1_from_private_module_2_4062", "Parameter '{0}' of constructor from exported class has or is using name '{1}' from private module '{2}'."); + static inline const auto Parameter_0_of_constructor_from_exported_class_has_or_is_using_private_name_1 = diag(4063, DiagnosticCategory::Error, "Parameter_0_of_constructor_from_exported_class_has_or_is_using_private_name_1_4063", "Parameter '{0}' of constructor from exported class has or is using private name '{1}'."); + static inline const auto Parameter_0_of_constructor_signature_from_exported_interface_has_or_is_using_name_1_from_private_module_2 = diag(4064, DiagnosticCategory::Error, "Parameter_0_of_constructor_signature_from_exported_interface_has_or_is_using_name_1_from_private_mod_4064", "Parameter '{0}' of constructor signature from exported interface has or is using name '{1}' from private module '{2}'."); + static inline const auto Parameter_0_of_constructor_signature_from_exported_interface_has_or_is_using_private_name_1 = diag(4065, DiagnosticCategory::Error, "Parameter_0_of_constructor_signature_from_exported_interface_has_or_is_using_private_name_1_4065", "Parameter '{0}' of constructor signature from exported interface has or is using private name '{1}'."); + static inline const auto Parameter_0_of_call_signature_from_exported_interface_has_or_is_using_name_1_from_private_module_2 = diag(4066, DiagnosticCategory::Error, "Parameter_0_of_call_signature_from_exported_interface_has_or_is_using_name_1_from_private_module_2_4066", "Parameter '{0}' of call signature from exported interface has or is using name '{1}' from private module '{2}'."); + static inline const auto Parameter_0_of_call_signature_from_exported_interface_has_or_is_using_private_name_1 = diag(4067, DiagnosticCategory::Error, "Parameter_0_of_call_signature_from_exported_interface_has_or_is_using_private_name_1_4067", "Parameter '{0}' of call signature from exported interface has or is using private name '{1}'."); + static inline const auto Parameter_0_of_public_static_method_from_exported_class_has_or_is_using_name_1_from_external_module_2_but_cannot_be_named = diag(4068, DiagnosticCategory::Error, "Parameter_0_of_public_static_method_from_exported_class_has_or_is_using_name_1_from_external_module__4068", "Parameter '{0}' of public static method from exported class has or is using name '{1}' from external module {2} but cannot be named."); + static inline const auto Parameter_0_of_public_static_method_from_exported_class_has_or_is_using_name_1_from_private_module_2 = diag(4069, DiagnosticCategory::Error, "Parameter_0_of_public_static_method_from_exported_class_has_or_is_using_name_1_from_private_module_2_4069", "Parameter '{0}' of public static method from exported class has or is using name '{1}' from private module '{2}'."); + static inline const auto Parameter_0_of_public_static_method_from_exported_class_has_or_is_using_private_name_1 = diag(4070, DiagnosticCategory::Error, "Parameter_0_of_public_static_method_from_exported_class_has_or_is_using_private_name_1_4070", "Parameter '{0}' of public static method from exported class has or is using private name '{1}'."); + static inline const auto Parameter_0_of_public_method_from_exported_class_has_or_is_using_name_1_from_external_module_2_but_cannot_be_named = diag(4071, DiagnosticCategory::Error, "Parameter_0_of_public_method_from_exported_class_has_or_is_using_name_1_from_external_module_2_but_c_4071", "Parameter '{0}' of public method from exported class has or is using name '{1}' from external module {2} but cannot be named."); + static inline const auto Parameter_0_of_public_method_from_exported_class_has_or_is_using_name_1_from_private_module_2 = diag(4072, DiagnosticCategory::Error, "Parameter_0_of_public_method_from_exported_class_has_or_is_using_name_1_from_private_module_2_4072", "Parameter '{0}' of public method from exported class has or is using name '{1}' from private module '{2}'."); + static inline const auto Parameter_0_of_public_method_from_exported_class_has_or_is_using_private_name_1 = diag(4073, DiagnosticCategory::Error, "Parameter_0_of_public_method_from_exported_class_has_or_is_using_private_name_1_4073", "Parameter '{0}' of public method from exported class has or is using private name '{1}'."); + static inline const auto Parameter_0_of_method_from_exported_interface_has_or_is_using_name_1_from_private_module_2 = diag(4074, DiagnosticCategory::Error, "Parameter_0_of_method_from_exported_interface_has_or_is_using_name_1_from_private_module_2_4074", "Parameter '{0}' of method from exported interface has or is using name '{1}' from private module '{2}'."); + static inline const auto Parameter_0_of_method_from_exported_interface_has_or_is_using_private_name_1 = diag(4075, DiagnosticCategory::Error, "Parameter_0_of_method_from_exported_interface_has_or_is_using_private_name_1_4075", "Parameter '{0}' of method from exported interface has or is using private name '{1}'."); + static inline const auto Parameter_0_of_exported_function_has_or_is_using_name_1_from_external_module_2_but_cannot_be_named = diag(4076, DiagnosticCategory::Error, "Parameter_0_of_exported_function_has_or_is_using_name_1_from_external_module_2_but_cannot_be_named_4076", "Parameter '{0}' of exported function has or is using name '{1}' from external module {2} but cannot be named."); + static inline const auto Parameter_0_of_exported_function_has_or_is_using_name_1_from_private_module_2 = diag(4077, DiagnosticCategory::Error, "Parameter_0_of_exported_function_has_or_is_using_name_1_from_private_module_2_4077", "Parameter '{0}' of exported function has or is using name '{1}' from private module '{2}'."); + static inline const auto Parameter_0_of_exported_function_has_or_is_using_private_name_1 = diag(4078, DiagnosticCategory::Error, "Parameter_0_of_exported_function_has_or_is_using_private_name_1_4078", "Parameter '{0}' of exported function has or is using private name '{1}'."); + static inline const auto Exported_type_alias_0_has_or_is_using_private_name_1 = diag(4081, DiagnosticCategory::Error, "Exported_type_alias_0_has_or_is_using_private_name_1_4081", "Exported type alias '{0}' has or is using private name '{1}'."); + static inline const auto Default_export_of_the_module_has_or_is_using_private_name_0 = diag(4082, DiagnosticCategory::Error, "Default_export_of_the_module_has_or_is_using_private_name_0_4082", "Default export of the module has or is using private name '{0}'."); + static inline const auto Type_parameter_0_of_exported_type_alias_has_or_is_using_private_name_1 = diag(4083, DiagnosticCategory::Error, "Type_parameter_0_of_exported_type_alias_has_or_is_using_private_name_1_4083", "Type parameter '{0}' of exported type alias has or is using private name '{1}'."); + static inline const auto Exported_type_alias_0_has_or_is_using_private_name_1_from_module_2 = diag(4084, DiagnosticCategory::Error, "Exported_type_alias_0_has_or_is_using_private_name_1_from_module_2_4084", "Exported type alias '{0}' has or is using private name '{1}' from module {2}."); + static inline const auto Conflicting_definitions_for_0_found_at_1_and_2_Consider_installing_a_specific_version_of_this_library_to_resolve_the_conflict = diag(4090, DiagnosticCategory::Error, "Conflicting_definitions_for_0_found_at_1_and_2_Consider_installing_a_specific_version_of_this_librar_4090", "Conflicting definitions for '{0}' found at '{1}' and '{2}'. Consider installing a specific version of this library to resolve the conflict."); + static inline const auto Parameter_0_of_index_signature_from_exported_interface_has_or_is_using_name_1_from_private_module_2 = diag(4091, DiagnosticCategory::Error, "Parameter_0_of_index_signature_from_exported_interface_has_or_is_using_name_1_from_private_module_2_4091", "Parameter '{0}' of index signature from exported interface has or is using name '{1}' from private module '{2}'."); + static inline const auto Parameter_0_of_index_signature_from_exported_interface_has_or_is_using_private_name_1 = diag(4092, DiagnosticCategory::Error, "Parameter_0_of_index_signature_from_exported_interface_has_or_is_using_private_name_1_4092", "Parameter '{0}' of index signature from exported interface has or is using private name '{1}'."); + static inline const auto Property_0_of_exported_class_expression_may_not_be_private_or_protected = diag(4094, DiagnosticCategory::Error, "Property_0_of_exported_class_expression_may_not_be_private_or_protected_4094", "Property '{0}' of exported class expression may not be private or protected."); + static inline const auto Public_static_method_0_of_exported_class_has_or_is_using_name_1_from_external_module_2_but_cannot_be_named = diag(4095, DiagnosticCategory::Error, "Public_static_method_0_of_exported_class_has_or_is_using_name_1_from_external_module_2_but_cannot_be_4095", "Public static method '{0}' of exported class has or is using name '{1}' from external module {2} but cannot be named."); + static inline const auto Public_static_method_0_of_exported_class_has_or_is_using_name_1_from_private_module_2 = diag(4096, DiagnosticCategory::Error, "Public_static_method_0_of_exported_class_has_or_is_using_name_1_from_private_module_2_4096", "Public static method '{0}' of exported class has or is using name '{1}' from private module '{2}'."); + static inline const auto Public_static_method_0_of_exported_class_has_or_is_using_private_name_1 = diag(4097, DiagnosticCategory::Error, "Public_static_method_0_of_exported_class_has_or_is_using_private_name_1_4097", "Public static method '{0}' of exported class has or is using private name '{1}'."); + static inline const auto Public_method_0_of_exported_class_has_or_is_using_name_1_from_external_module_2_but_cannot_be_named = diag(4098, DiagnosticCategory::Error, "Public_method_0_of_exported_class_has_or_is_using_name_1_from_external_module_2_but_cannot_be_named_4098", "Public method '{0}' of exported class has or is using name '{1}' from external module {2} but cannot be named."); + static inline const auto Public_method_0_of_exported_class_has_or_is_using_name_1_from_private_module_2 = diag(4099, DiagnosticCategory::Error, "Public_method_0_of_exported_class_has_or_is_using_name_1_from_private_module_2_4099", "Public method '{0}' of exported class has or is using name '{1}' from private module '{2}'."); + static inline const auto Public_method_0_of_exported_class_has_or_is_using_private_name_1 = diag(4100, DiagnosticCategory::Error, "Public_method_0_of_exported_class_has_or_is_using_private_name_1_4100", "Public method '{0}' of exported class has or is using private name '{1}'."); + static inline const auto Method_0_of_exported_interface_has_or_is_using_name_1_from_private_module_2 = diag(4101, DiagnosticCategory::Error, "Method_0_of_exported_interface_has_or_is_using_name_1_from_private_module_2_4101", "Method '{0}' of exported interface has or is using name '{1}' from private module '{2}'."); + static inline const auto Method_0_of_exported_interface_has_or_is_using_private_name_1 = diag(4102, DiagnosticCategory::Error, "Method_0_of_exported_interface_has_or_is_using_private_name_1_4102", "Method '{0}' of exported interface has or is using private name '{1}'."); + static inline const auto Type_parameter_0_of_exported_mapped_object_type_is_using_private_name_1 = diag(4103, DiagnosticCategory::Error, "Type_parameter_0_of_exported_mapped_object_type_is_using_private_name_1_4103", "Type parameter '{0}' of exported mapped object type is using private name '{1}'."); + static inline const auto The_type_0_is_readonly_and_cannot_be_assigned_to_the_mutable_type_1 = diag(4104, DiagnosticCategory::Error, "The_type_0_is_readonly_and_cannot_be_assigned_to_the_mutable_type_1_4104", "The type '{0}' is 'readonly' and cannot be assigned to the mutable type '{1}'."); + static inline const auto Private_or_protected_member_0_cannot_be_accessed_on_a_type_parameter = diag(4105, DiagnosticCategory::Error, "Private_or_protected_member_0_cannot_be_accessed_on_a_type_parameter_4105", "Private or protected member '{0}' cannot be accessed on a type parameter."); + static inline const auto Parameter_0_of_accessor_has_or_is_using_private_name_1 = diag(4106, DiagnosticCategory::Error, "Parameter_0_of_accessor_has_or_is_using_private_name_1_4106", "Parameter '{0}' of accessor has or is using private name '{1}'."); + static inline const auto Parameter_0_of_accessor_has_or_is_using_name_1_from_private_module_2 = diag(4107, DiagnosticCategory::Error, "Parameter_0_of_accessor_has_or_is_using_name_1_from_private_module_2_4107", "Parameter '{0}' of accessor has or is using name '{1}' from private module '{2}'."); + static inline const auto Parameter_0_of_accessor_has_or_is_using_name_1_from_external_module_2_but_cannot_be_named = diag(4108, DiagnosticCategory::Error, "Parameter_0_of_accessor_has_or_is_using_name_1_from_external_module_2_but_cannot_be_named_4108", "Parameter '{0}' of accessor has or is using name '{1}' from external module '{2}' but cannot be named."); + static inline const auto Type_arguments_for_0_circularly_reference_themselves = diag(4109, DiagnosticCategory::Error, "Type_arguments_for_0_circularly_reference_themselves_4109", "Type arguments for '{0}' circularly reference themselves."); + static inline const auto Tuple_type_arguments_circularly_reference_themselves = diag(4110, DiagnosticCategory::Error, "Tuple_type_arguments_circularly_reference_themselves_4110", "Tuple type arguments circularly reference themselves."); + static inline const auto Property_0_comes_from_an_index_signature_so_it_must_be_accessed_with_0 = diag(4111, DiagnosticCategory::Error, "Property_0_comes_from_an_index_signature_so_it_must_be_accessed_with_0_4111", "Property '{0}' comes from an index signature, so it must be accessed with ['{0}']."); + static inline const auto This_member_cannot_have_an_override_modifier_because_its_containing_class_0_does_not_extend_another_class = diag(4112, DiagnosticCategory::Error, "This_member_cannot_have_an_override_modifier_because_its_containing_class_0_does_not_extend_another__4112", "This member cannot have an 'override' modifier because its containing class '{0}' does not extend another class."); + static inline const auto This_member_cannot_have_an_override_modifier_because_it_is_not_declared_in_the_base_class_0 = diag(4113, DiagnosticCategory::Error, "This_member_cannot_have_an_override_modifier_because_it_is_not_declared_in_the_base_class_0_4113", "This member cannot have an 'override' modifier because it is not declared in the base class '{0}'."); + static inline const auto This_member_must_have_an_override_modifier_because_it_overrides_a_member_in_the_base_class_0 = diag(4114, DiagnosticCategory::Error, "This_member_must_have_an_override_modifier_because_it_overrides_a_member_in_the_base_class_0_4114", "This member must have an 'override' modifier because it overrides a member in the base class '{0}'."); + static inline const auto This_parameter_property_must_have_an_override_modifier_because_it_overrides_a_member_in_base_class_0 = diag(4115, DiagnosticCategory::Error, "This_parameter_property_must_have_an_override_modifier_because_it_overrides_a_member_in_base_class_0_4115", "This parameter property must have an 'override' modifier because it overrides a member in base class '{0}'."); + static inline const auto This_member_must_have_an_override_modifier_because_it_overrides_an_abstract_method_that_is_declared_in_the_base_class_0 = diag(4116, DiagnosticCategory::Error, "This_member_must_have_an_override_modifier_because_it_overrides_an_abstract_method_that_is_declared__4116", "This member must have an 'override' modifier because it overrides an abstract method that is declared in the base class '{0}'."); + static inline const auto This_member_cannot_have_an_override_modifier_because_it_is_not_declared_in_the_base_class_0_Did_you_mean_1 = diag(4117, DiagnosticCategory::Error, "This_member_cannot_have_an_override_modifier_because_it_is_not_declared_in_the_base_class_0_Did_you__4117", "This member cannot have an 'override' modifier because it is not declared in the base class '{0}'. Did you mean '{1}'?"); + static inline const auto The_type_of_this_node_cannot_be_serialized_because_its_property_0_cannot_be_serialized = diag(4118, DiagnosticCategory::Error, "The_type_of_this_node_cannot_be_serialized_because_its_property_0_cannot_be_serialized_4118", "The type of this node cannot be serialized because its property '{0}' cannot be serialized."); + static inline const auto This_member_must_have_a_JSDoc_comment_with_an_override_tag_because_it_overrides_a_member_in_the_base_class_0 = diag(4119, DiagnosticCategory::Error, "This_member_must_have_a_JSDoc_comment_with_an_override_tag_because_it_overrides_a_member_in_the_base_4119", "This member must have a JSDoc comment with an '@override' tag because it overrides a member in the base class '{0}'."); + static inline const auto This_parameter_property_must_have_a_JSDoc_comment_with_an_override_tag_because_it_overrides_a_member_in_the_base_class_0 = diag(4120, DiagnosticCategory::Error, "This_parameter_property_must_have_a_JSDoc_comment_with_an_override_tag_because_it_overrides_a_member_4120", "This parameter property must have a JSDoc comment with an '@override' tag because it overrides a member in the base class '{0}'."); + static inline const auto This_member_cannot_have_a_JSDoc_comment_with_an_override_tag_because_its_containing_class_0_does_not_extend_another_class = diag(4121, DiagnosticCategory::Error, "This_member_cannot_have_a_JSDoc_comment_with_an_override_tag_because_its_containing_class_0_does_not_4121", "This member cannot have a JSDoc comment with an '@override' tag because its containing class '{0}' does not extend another class."); + static inline const auto This_member_cannot_have_a_JSDoc_comment_with_an_override_tag_because_it_is_not_declared_in_the_base_class_0 = diag(4122, DiagnosticCategory::Error, "This_member_cannot_have_a_JSDoc_comment_with_an_override_tag_because_it_is_not_declared_in_the_base__4122", "This member cannot have a JSDoc comment with an '@override' tag because it is not declared in the base class '{0}'."); + static inline const auto This_member_cannot_have_a_JSDoc_comment_with_an_override_tag_because_it_is_not_declared_in_the_base_class_0_Did_you_mean_1 = diag(4123, DiagnosticCategory::Error, "This_member_cannot_have_a_JSDoc_comment_with_an_override_tag_because_it_is_not_declared_in_the_base__4123", "This member cannot have a JSDoc comment with an 'override' tag because it is not declared in the base class '{0}'. Did you mean '{1}'?"); + static inline const auto Compiler_option_0_of_value_1_is_unstable_Use_nightly_TypeScript_to_silence_this_error_Try_updating_with_npm_install_D_typescript_next = diag(4124, DiagnosticCategory::Error, "Compiler_option_0_of_value_1_is_unstable_Use_nightly_TypeScript_to_silence_this_error_Try_updating_w_4124", "Compiler option '{0}' of value '{1}' is unstable. Use nightly TypeScript to silence this error. Try updating with 'npm install -D typescript@next'."); + static inline const auto The_current_host_does_not_support_the_0_option = diag(5001, DiagnosticCategory::Error, "The_current_host_does_not_support_the_0_option_5001", "The current host does not support the '{0}' option."); + static inline const auto Cannot_find_the_common_subdirectory_path_for_the_input_files = diag(5009, DiagnosticCategory::Error, "Cannot_find_the_common_subdirectory_path_for_the_input_files_5009", "Cannot find the common subdirectory path for the input files."); + static inline const auto File_specification_cannot_end_in_a_recursive_directory_wildcard_Asterisk_Asterisk_Colon_0 = diag(5010, DiagnosticCategory::Error, "File_specification_cannot_end_in_a_recursive_directory_wildcard_Asterisk_Asterisk_Colon_0_5010", "File specification cannot end in a recursive directory wildcard ('**'): '{0}'."); + static inline const auto Cannot_read_file_0_Colon_1 = diag(5012, DiagnosticCategory::Error, "Cannot_read_file_0_Colon_1_5012", "Cannot read file '{0}': {1}."); + static inline const auto Failed_to_parse_file_0_Colon_1 = diag(5014, DiagnosticCategory::Error, "Failed_to_parse_file_0_Colon_1_5014", "Failed to parse file '{0}': {1}."); + static inline const auto Unknown_compiler_option_0 = diag(5023, DiagnosticCategory::Error, "Unknown_compiler_option_0_5023", "Unknown compiler option '{0}'."); + static inline const auto Compiler_option_0_requires_a_value_of_type_1 = diag(5024, DiagnosticCategory::Error, "Compiler_option_0_requires_a_value_of_type_1_5024", "Compiler option '{0}' requires a value of type {1}."); + static inline const auto Unknown_compiler_option_0_Did_you_mean_1 = diag(5025, DiagnosticCategory::Error, "Unknown_compiler_option_0_Did_you_mean_1_5025", "Unknown compiler option '{0}'. Did you mean '{1}'?"); + static inline const auto Could_not_write_file_0_Colon_1 = diag(5033, DiagnosticCategory::Error, "Could_not_write_file_0_Colon_1_5033", "Could not write file '{0}': {1}."); + static inline const auto Option_project_cannot_be_mixed_with_source_files_on_a_command_line = diag(5042, DiagnosticCategory::Error, "Option_project_cannot_be_mixed_with_source_files_on_a_command_line_5042", "Option 'project' cannot be mixed with source files on a command line."); + static inline const auto Option_isolatedModules_can_only_be_used_when_either_option_module_is_provided_or_option_target_is_ES2015_or_higher = diag(5047, DiagnosticCategory::Error, "Option_isolatedModules_can_only_be_used_when_either_option_module_is_provided_or_option_target_is_ES_5047", "Option 'isolatedModules' can only be used when either option '--module' is provided or option 'target' is 'ES2015' or higher."); + static inline const auto Option_0_cannot_be_specified_when_option_target_is_ES3 = diag(5048, DiagnosticCategory::Error, "Option_0_cannot_be_specified_when_option_target_is_ES3_5048", "Option '{0}' cannot be specified when option 'target' is 'ES3'."); + static inline const auto Option_0_can_only_be_used_when_either_option_inlineSourceMap_or_option_sourceMap_is_provided = diag(5051, DiagnosticCategory::Error, "Option_0_can_only_be_used_when_either_option_inlineSourceMap_or_option_sourceMap_is_provided_5051", "Option '{0} can only be used when either option '--inlineSourceMap' or option '--sourceMap' is provided."); + static inline const auto Option_0_cannot_be_specified_without_specifying_option_1 = diag(5052, DiagnosticCategory::Error, "Option_0_cannot_be_specified_without_specifying_option_1_5052", "Option '{0}' cannot be specified without specifying option '{1}'."); + static inline const auto Option_0_cannot_be_specified_with_option_1 = diag(5053, DiagnosticCategory::Error, "Option_0_cannot_be_specified_with_option_1_5053", "Option '{0}' cannot be specified with option '{1}'."); + static inline const auto A_tsconfig_json_file_is_already_defined_at_Colon_0 = diag(5054, DiagnosticCategory::Error, "A_tsconfig_json_file_is_already_defined_at_Colon_0_5054", "A 'tsconfig.json' file is already defined at: '{0}'."); + static inline const auto Cannot_write_file_0_because_it_would_overwrite_input_file = diag(5055, DiagnosticCategory::Error, "Cannot_write_file_0_because_it_would_overwrite_input_file_5055", "Cannot write file '{0}' because it would overwrite input file."); + static inline const auto Cannot_write_file_0_because_it_would_be_overwritten_by_multiple_input_files = diag(5056, DiagnosticCategory::Error, "Cannot_write_file_0_because_it_would_be_overwritten_by_multiple_input_files_5056", "Cannot write file '{0}' because it would be overwritten by multiple input files."); + static inline const auto Cannot_find_a_tsconfig_json_file_at_the_specified_directory_Colon_0 = diag(5057, DiagnosticCategory::Error, "Cannot_find_a_tsconfig_json_file_at_the_specified_directory_Colon_0_5057", "Cannot find a tsconfig.json file at the specified directory: '{0}'."); + static inline const auto The_specified_path_does_not_exist_Colon_0 = diag(5058, DiagnosticCategory::Error, "The_specified_path_does_not_exist_Colon_0_5058", "The specified path does not exist: '{0}'."); + static inline const auto Invalid_value_for_reactNamespace_0_is_not_a_valid_identifier = diag(5059, DiagnosticCategory::Error, "Invalid_value_for_reactNamespace_0_is_not_a_valid_identifier_5059", "Invalid value for '--reactNamespace'. '{0}' is not a valid identifier."); + static inline const auto Pattern_0_can_have_at_most_one_Asterisk_character = diag(5061, DiagnosticCategory::Error, "Pattern_0_can_have_at_most_one_Asterisk_character_5061", "Pattern '{0}' can have at most one '*' character."); + static inline const auto Substitution_0_in_pattern_1_can_have_at_most_one_Asterisk_character = diag(5062, DiagnosticCategory::Error, "Substitution_0_in_pattern_1_can_have_at_most_one_Asterisk_character_5062", "Substitution '{0}' in pattern '{1}' can have at most one '*' character."); + static inline const auto Substitutions_for_pattern_0_should_be_an_array = diag(5063, DiagnosticCategory::Error, "Substitutions_for_pattern_0_should_be_an_array_5063", "Substitutions for pattern '{0}' should be an array."); + static inline const auto Substitution_0_for_pattern_1_has_incorrect_type_expected_string_got_2 = diag(5064, DiagnosticCategory::Error, "Substitution_0_for_pattern_1_has_incorrect_type_expected_string_got_2_5064", "Substitution '{0}' for pattern '{1}' has incorrect type, expected 'string', got '{2}'."); + static inline const auto File_specification_cannot_contain_a_parent_directory_that_appears_after_a_recursive_directory_wildcard_Asterisk_Asterisk_Colon_0 = diag(5065, DiagnosticCategory::Error, "File_specification_cannot_contain_a_parent_directory_that_appears_after_a_recursive_directory_wildca_5065", "File specification cannot contain a parent directory ('..') that appears after a recursive directory wildcard ('**'): '{0}'."); + static inline const auto Substitutions_for_pattern_0_shouldn_t_be_an_empty_array = diag(5066, DiagnosticCategory::Error, "Substitutions_for_pattern_0_shouldn_t_be_an_empty_array_5066", "Substitutions for pattern '{0}' shouldn't be an empty array."); + static inline const auto Invalid_value_for_jsxFactory_0_is_not_a_valid_identifier_or_qualified_name = diag(5067, DiagnosticCategory::Error, "Invalid_value_for_jsxFactory_0_is_not_a_valid_identifier_or_qualified_name_5067", "Invalid value for 'jsxFactory'. '{0}' is not a valid identifier or qualified-name."); + static inline const auto Adding_a_tsconfig_json_file_will_help_organize_projects_that_contain_both_TypeScript_and_JavaScript_files_Learn_more_at_https_Colon_Slash_Slashaka_ms_Slashtsconfig = diag(5068, DiagnosticCategory::Error, "Adding_a_tsconfig_json_file_will_help_organize_projects_that_contain_both_TypeScript_and_JavaScript__5068", "Adding a tsconfig.json file will help organize projects that contain both TypeScript and JavaScript files. Learn more at https://aka.ms/tsconfig."); + static inline const auto Option_0_cannot_be_specified_without_specifying_option_1_or_option_2 = diag(5069, DiagnosticCategory::Error, "Option_0_cannot_be_specified_without_specifying_option_1_or_option_2_5069", "Option '{0}' cannot be specified without specifying option '{1}' or option '{2}'."); + static inline const auto Option_resolveJsonModule_cannot_be_specified_without_node_module_resolution_strategy = diag(5070, DiagnosticCategory::Error, "Option_resolveJsonModule_cannot_be_specified_without_node_module_resolution_strategy_5070", "Option '--resolveJsonModule' cannot be specified without 'node' module resolution strategy."); + static inline const auto Option_resolveJsonModule_can_only_be_specified_when_module_code_generation_is_commonjs_amd_es2015_or_esNext = diag(5071, DiagnosticCategory::Error, "Option_resolveJsonModule_can_only_be_specified_when_module_code_generation_is_commonjs_amd_es2015_or_5071", "Option '--resolveJsonModule' can only be specified when module code generation is 'commonjs', 'amd', 'es2015' or 'esNext'."); + static inline const auto Unknown_build_option_0 = diag(5072, DiagnosticCategory::Error, "Unknown_build_option_0_5072", "Unknown build option '{0}'."); + static inline const auto Build_option_0_requires_a_value_of_type_1 = diag(5073, DiagnosticCategory::Error, "Build_option_0_requires_a_value_of_type_1_5073", "Build option '{0}' requires a value of type {1}."); + static inline const auto Option_incremental_can_only_be_specified_using_tsconfig_emitting_to_single_file_or_when_option_tsBuildInfoFile_is_specified = diag(5074, DiagnosticCategory::Error, "Option_incremental_can_only_be_specified_using_tsconfig_emitting_to_single_file_or_when_option_tsBui_5074", "Option '--incremental' can only be specified using tsconfig, emitting to single file or when option '--tsBuildInfoFile' is specified."); + static inline const auto _0_is_assignable_to_the_constraint_of_type_1_but_1_could_be_instantiated_with_a_different_subtype_of_constraint_2 = diag(5075, DiagnosticCategory::Error, "_0_is_assignable_to_the_constraint_of_type_1_but_1_could_be_instantiated_with_a_different_subtype_of_5075", "'{0}' is assignable to the constraint of type '{1}', but '{1}' could be instantiated with a different subtype of constraint '{2}'."); + static inline const auto _0_and_1_operations_cannot_be_mixed_without_parentheses = diag(5076, DiagnosticCategory::Error, "_0_and_1_operations_cannot_be_mixed_without_parentheses_5076", "'{0}' and '{1}' operations cannot be mixed without parentheses."); + static inline const auto Unknown_build_option_0_Did_you_mean_1 = diag(5077, DiagnosticCategory::Error, "Unknown_build_option_0_Did_you_mean_1_5077", "Unknown build option '{0}'. Did you mean '{1}'?"); + static inline const auto Unknown_watch_option_0 = diag(5078, DiagnosticCategory::Error, "Unknown_watch_option_0_5078", "Unknown watch option '{0}'."); + static inline const auto Unknown_watch_option_0_Did_you_mean_1 = diag(5079, DiagnosticCategory::Error, "Unknown_watch_option_0_Did_you_mean_1_5079", "Unknown watch option '{0}'. Did you mean '{1}'?"); + static inline const auto Watch_option_0_requires_a_value_of_type_1 = diag(5080, DiagnosticCategory::Error, "Watch_option_0_requires_a_value_of_type_1_5080", "Watch option '{0}' requires a value of type {1}."); + static inline const auto Cannot_find_a_tsconfig_json_file_at_the_current_directory_Colon_0 = diag(5081, DiagnosticCategory::Error, "Cannot_find_a_tsconfig_json_file_at_the_current_directory_Colon_0_5081", "Cannot find a tsconfig.json file at the current directory: {0}."); + static inline const auto _0_could_be_instantiated_with_an_arbitrary_type_which_could_be_unrelated_to_1 = diag(5082, DiagnosticCategory::Error, "_0_could_be_instantiated_with_an_arbitrary_type_which_could_be_unrelated_to_1_5082", "'{0}' could be instantiated with an arbitrary type which could be unrelated to '{1}'."); + static inline const auto Cannot_read_file_0 = diag(5083, DiagnosticCategory::Error, "Cannot_read_file_0_5083", "Cannot read file '{0}'."); + static inline const auto Tuple_members_must_all_have_names_or_all_not_have_names = diag(5084, DiagnosticCategory::Error, "Tuple_members_must_all_have_names_or_all_not_have_names_5084", "Tuple members must all have names or all not have names."); + static inline const auto A_tuple_member_cannot_be_both_optional_and_rest = diag(5085, DiagnosticCategory::Error, "A_tuple_member_cannot_be_both_optional_and_rest_5085", "A tuple member cannot be both optional and rest."); + static inline const auto A_labeled_tuple_element_is_declared_as_optional_with_a_question_mark_after_the_name_and_before_the_colon_rather_than_after_the_type = diag(5086, DiagnosticCategory::Error, "A_labeled_tuple_element_is_declared_as_optional_with_a_question_mark_after_the_name_and_before_the_c_5086", "A labeled tuple element is declared as optional with a question mark after the name and before the colon, rather than after the type."); + static inline const auto A_labeled_tuple_element_is_declared_as_rest_with_a_before_the_name_rather_than_before_the_type = diag(5087, DiagnosticCategory::Error, "A_labeled_tuple_element_is_declared_as_rest_with_a_before_the_name_rather_than_before_the_type_5087", "A labeled tuple element is declared as rest with a '...' before the name, rather than before the type."); + static inline const auto The_inferred_type_of_0_references_a_type_with_a_cyclic_structure_which_cannot_be_trivially_serialized_A_type_annotation_is_necessary = diag(5088, DiagnosticCategory::Error, "The_inferred_type_of_0_references_a_type_with_a_cyclic_structure_which_cannot_be_trivially_serialize_5088", "The inferred type of '{0}' references a type with a cyclic structure which cannot be trivially serialized. A type annotation is necessary."); + static inline const auto Option_0_cannot_be_specified_when_option_jsx_is_1 = diag(5089, DiagnosticCategory::Error, "Option_0_cannot_be_specified_when_option_jsx_is_1_5089", "Option '{0}' cannot be specified when option 'jsx' is '{1}'."); + static inline const auto Non_relative_paths_are_not_allowed_when_baseUrl_is_not_set_Did_you_forget_a_leading_Slash = diag(5090, DiagnosticCategory::Error, "Non_relative_paths_are_not_allowed_when_baseUrl_is_not_set_Did_you_forget_a_leading_Slash_5090", "Non-relative paths are not allowed when 'baseUrl' is not set. Did you forget a leading './'?"); + static inline const auto Option_preserveConstEnums_cannot_be_disabled_when_isolatedModules_is_enabled = diag(5091, DiagnosticCategory::Error, "Option_preserveConstEnums_cannot_be_disabled_when_isolatedModules_is_enabled_5091", "Option 'preserveConstEnums' cannot be disabled when 'isolatedModules' is enabled."); + static inline const auto The_root_value_of_a_0_file_must_be_an_object = diag(5092, DiagnosticCategory::Error, "The_root_value_of_a_0_file_must_be_an_object_5092", "The root value of a '{0}' file must be an object."); + static inline const auto Compiler_option_0_may_only_be_used_with_build = diag(5093, DiagnosticCategory::Error, "Compiler_option_0_may_only_be_used_with_build_5093", "Compiler option '--{0}' may only be used with '--build'."); + static inline const auto Compiler_option_0_may_not_be_used_with_build = diag(5094, DiagnosticCategory::Error, "Compiler_option_0_may_not_be_used_with_build_5094", "Compiler option '--{0}' may not be used with '--build'."); + static inline const auto Option_preserveValueImports_can_only_be_used_when_module_is_set_to_es2015_or_later = diag(5095, DiagnosticCategory::Error, "Option_preserveValueImports_can_only_be_used_when_module_is_set_to_es2015_or_later_5095", "Option 'preserveValueImports' can only be used when 'module' is set to 'es2015' or later."); + static inline const auto Generates_a_sourcemap_for_each_corresponding_d_ts_file = diag(6000, DiagnosticCategory::Message, "Generates_a_sourcemap_for_each_corresponding_d_ts_file_6000", "Generates a sourcemap for each corresponding '.d.ts' file."); + static inline const auto Concatenate_and_emit_output_to_single_file = diag(6001, DiagnosticCategory::Message, "Concatenate_and_emit_output_to_single_file_6001", "Concatenate and emit output to single file."); + static inline const auto Generates_corresponding_d_ts_file = diag(6002, DiagnosticCategory::Message, "Generates_corresponding_d_ts_file_6002", "Generates corresponding '.d.ts' file."); + static inline const auto Specify_the_location_where_debugger_should_locate_TypeScript_files_instead_of_source_locations = diag(6004, DiagnosticCategory::Message, "Specify_the_location_where_debugger_should_locate_TypeScript_files_instead_of_source_locations_6004", "Specify the location where debugger should locate TypeScript files instead of source locations."); + static inline const auto Watch_input_files = diag(6005, DiagnosticCategory::Message, "Watch_input_files_6005", "Watch input files."); + static inline const auto Redirect_output_structure_to_the_directory = diag(6006, DiagnosticCategory::Message, "Redirect_output_structure_to_the_directory_6006", "Redirect output structure to the directory."); + static inline const auto Do_not_erase_const_enum_declarations_in_generated_code = diag(6007, DiagnosticCategory::Message, "Do_not_erase_const_enum_declarations_in_generated_code_6007", "Do not erase const enum declarations in generated code."); + static inline const auto Do_not_emit_outputs_if_any_errors_were_reported = diag(6008, DiagnosticCategory::Message, "Do_not_emit_outputs_if_any_errors_were_reported_6008", "Do not emit outputs if any errors were reported."); + static inline const auto Do_not_emit_comments_to_output = diag(6009, DiagnosticCategory::Message, "Do_not_emit_comments_to_output_6009", "Do not emit comments to output."); + static inline const auto Do_not_emit_outputs = diag(6010, DiagnosticCategory::Message, "Do_not_emit_outputs_6010", "Do not emit outputs."); + static inline const auto Allow_default_imports_from_modules_with_no_default_export_This_does_not_affect_code_emit_just_typechecking = diag(6011, DiagnosticCategory::Message, "Allow_default_imports_from_modules_with_no_default_export_This_does_not_affect_code_emit_just_typech_6011", "Allow default imports from modules with no default export. This does not affect code emit, just typechecking."); + static inline const auto Skip_type_checking_of_declaration_files = diag(6012, DiagnosticCategory::Message, "Skip_type_checking_of_declaration_files_6012", "Skip type checking of declaration files."); + static inline const auto Do_not_resolve_the_real_path_of_symlinks = diag(6013, DiagnosticCategory::Message, "Do_not_resolve_the_real_path_of_symlinks_6013", "Do not resolve the real path of symlinks."); + static inline const auto Only_emit_d_ts_declaration_files = diag(6014, DiagnosticCategory::Message, "Only_emit_d_ts_declaration_files_6014", "Only emit '.d.ts' declaration files."); + static inline const auto Specify_ECMAScript_target_version = diag(6015, DiagnosticCategory::Message, "Specify_ECMAScript_target_version_6015", "Specify ECMAScript target version."); + static inline const auto Specify_module_code_generation = diag(6016, DiagnosticCategory::Message, "Specify_module_code_generation_6016", "Specify module code generation."); + static inline const auto Print_this_message = diag(6017, DiagnosticCategory::Message, "Print_this_message_6017", "Print this message."); + static inline const auto Print_the_compiler_s_version = diag(6019, DiagnosticCategory::Message, "Print_the_compiler_s_version_6019", "Print the compiler's version."); + static inline const auto Compile_the_project_given_the_path_to_its_configuration_file_or_to_a_folder_with_a_tsconfig_json = diag(6020, DiagnosticCategory::Message, "Compile_the_project_given_the_path_to_its_configuration_file_or_to_a_folder_with_a_tsconfig_json_6020", "Compile the project given the path to its configuration file, or to a folder with a 'tsconfig.json'."); + static inline const auto Syntax_Colon_0 = diag(6023, DiagnosticCategory::Message, "Syntax_Colon_0_6023", "Syntax: {0}"); + static inline const auto options = diag(6024, DiagnosticCategory::Message, "options_6024", "options"); + static inline const auto file = diag(6025, DiagnosticCategory::Message, "file_6025", "file"); + static inline const auto Examples_Colon_0 = diag(6026, DiagnosticCategory::Message, "Examples_Colon_0_6026", "Examples: {0}"); + static inline const auto Options_Colon = diag(6027, DiagnosticCategory::Message, "Options_Colon_6027", "Options:"); + static inline const auto Version_0 = diag(6029, DiagnosticCategory::Message, "Version_0_6029", "Version {0}"); + static inline const auto Insert_command_line_options_and_files_from_a_file = diag(6030, DiagnosticCategory::Message, "Insert_command_line_options_and_files_from_a_file_6030", "Insert command line options and files from a file."); + static inline const auto Starting_compilation_in_watch_mode = diag(6031, DiagnosticCategory::Message, "Starting_compilation_in_watch_mode_6031", "Starting compilation in watch mode..."); + static inline const auto File_change_detected_Starting_incremental_compilation = diag(6032, DiagnosticCategory::Message, "File_change_detected_Starting_incremental_compilation_6032", "File change detected. Starting incremental compilation..."); + static inline const auto KIND = diag(6034, DiagnosticCategory::Message, "KIND_6034", "KIND"); + static inline const auto FILE = diag(6035, DiagnosticCategory::Message, "FILE_6035", "FILE"); + static inline const auto VERSION = diag(6036, DiagnosticCategory::Message, "VERSION_6036", "VERSION"); + static inline const auto LOCATION = diag(6037, DiagnosticCategory::Message, "LOCATION_6037", "LOCATION"); + static inline const auto DIRECTORY = diag(6038, DiagnosticCategory::Message, "DIRECTORY_6038", "DIRECTORY"); + static inline const auto STRATEGY = diag(6039, DiagnosticCategory::Message, "STRATEGY_6039", "STRATEGY"); + static inline const auto FILE_OR_DIRECTORY = diag(6040, DiagnosticCategory::Message, "FILE_OR_DIRECTORY_6040", "FILE OR DIRECTORY"); + static inline const auto Generates_corresponding_map_file = diag(6043, DiagnosticCategory::Message, "Generates_corresponding_map_file_6043", "Generates corresponding '.map' file."); + static inline const auto Compiler_option_0_expects_an_argument = diag(6044, DiagnosticCategory::Error, "Compiler_option_0_expects_an_argument_6044", "Compiler option '{0}' expects an argument."); + static inline const auto Unterminated_quoted_string_in_response_file_0 = diag(6045, DiagnosticCategory::Error, "Unterminated_quoted_string_in_response_file_0_6045", "Unterminated quoted string in response file '{0}'."); + static inline const auto Argument_for_0_option_must_be_Colon_1 = diag(6046, DiagnosticCategory::Error, "Argument_for_0_option_must_be_Colon_1_6046", "Argument for '{0}' option must be: {1}."); + static inline const auto Locale_must_be_of_the_form_language_or_language_territory_For_example_0_or_1 = diag(6048, DiagnosticCategory::Error, "Locale_must_be_of_the_form_language_or_language_territory_For_example_0_or_1_6048", "Locale must be of the form or -. For example '{0}' or '{1}'."); + static inline const auto Unable_to_open_file_0 = diag(6050, DiagnosticCategory::Error, "Unable_to_open_file_0_6050", "Unable to open file '{0}'."); + static inline const auto Corrupted_locale_file_0 = diag(6051, DiagnosticCategory::Error, "Corrupted_locale_file_0_6051", "Corrupted locale file {0}."); + static inline const auto Raise_error_on_expressions_and_declarations_with_an_implied_any_type = diag(6052, DiagnosticCategory::Message, "Raise_error_on_expressions_and_declarations_with_an_implied_any_type_6052", "Raise error on expressions and declarations with an implied 'any' type."); + static inline const auto File_0_not_found = diag(6053, DiagnosticCategory::Error, "File_0_not_found_6053", "File '{0}' not found."); + static inline const auto File_0_has_an_unsupported_extension_The_only_supported_extensions_are_1 = diag(6054, DiagnosticCategory::Error, "File_0_has_an_unsupported_extension_The_only_supported_extensions_are_1_6054", "File '{0}' has an unsupported extension. The only supported extensions are {1}."); + static inline const auto Suppress_noImplicitAny_errors_for_indexing_objects_lacking_index_signatures = diag(6055, DiagnosticCategory::Message, "Suppress_noImplicitAny_errors_for_indexing_objects_lacking_index_signatures_6055", "Suppress noImplicitAny errors for indexing objects lacking index signatures."); + static inline const auto Do_not_emit_declarations_for_code_that_has_an_internal_annotation = diag(6056, DiagnosticCategory::Message, "Do_not_emit_declarations_for_code_that_has_an_internal_annotation_6056", "Do not emit declarations for code that has an '@internal' annotation."); + static inline const auto Specify_the_root_directory_of_input_files_Use_to_control_the_output_directory_structure_with_outDir = diag(6058, DiagnosticCategory::Message, "Specify_the_root_directory_of_input_files_Use_to_control_the_output_directory_structure_with_outDir_6058", "Specify the root directory of input files. Use to control the output directory structure with --outDir."); + static inline const auto File_0_is_not_under_rootDir_1_rootDir_is_expected_to_contain_all_source_files = diag(6059, DiagnosticCategory::Error, "File_0_is_not_under_rootDir_1_rootDir_is_expected_to_contain_all_source_files_6059", "File '{0}' is not under 'rootDir' '{1}'. 'rootDir' is expected to contain all source files."); + static inline const auto Specify_the_end_of_line_sequence_to_be_used_when_emitting_files_Colon_CRLF_dos_or_LF_unix = diag(6060, DiagnosticCategory::Message, "Specify_the_end_of_line_sequence_to_be_used_when_emitting_files_Colon_CRLF_dos_or_LF_unix_6060", "Specify the end of line sequence to be used when emitting files: 'CRLF' (dos) or 'LF' (unix)."); + static inline const auto NEWLINE = diag(6061, DiagnosticCategory::Message, "NEWLINE_6061", "NEWLINE"); + static inline const auto Option_0_can_only_be_specified_in_tsconfig_json_file_or_set_to_null_on_command_line = diag(6064, DiagnosticCategory::Error, "Option_0_can_only_be_specified_in_tsconfig_json_file_or_set_to_null_on_command_line_6064", "Option '{0}' can only be specified in 'tsconfig.json' file or set to 'null' on command line."); + static inline const auto Enables_experimental_support_for_ES7_decorators = diag(6065, DiagnosticCategory::Message, "Enables_experimental_support_for_ES7_decorators_6065", "Enables experimental support for ES7 decorators."); + static inline const auto Enables_experimental_support_for_emitting_type_metadata_for_decorators = diag(6066, DiagnosticCategory::Message, "Enables_experimental_support_for_emitting_type_metadata_for_decorators_6066", "Enables experimental support for emitting type metadata for decorators."); + static inline const auto Specify_module_resolution_strategy_Colon_node_Node_js_or_classic_TypeScript_pre_1_6 = diag(6069, DiagnosticCategory::Message, "Specify_module_resolution_strategy_Colon_node_Node_js_or_classic_TypeScript_pre_1_6_6069", "Specify module resolution strategy: 'node' (Node.js) or 'classic' (TypeScript pre-1.6)."); + static inline const auto Initializes_a_TypeScript_project_and_creates_a_tsconfig_json_file = diag(6070, DiagnosticCategory::Message, "Initializes_a_TypeScript_project_and_creates_a_tsconfig_json_file_6070", "Initializes a TypeScript project and creates a tsconfig.json file."); + static inline const auto Successfully_created_a_tsconfig_json_file = diag(6071, DiagnosticCategory::Message, "Successfully_created_a_tsconfig_json_file_6071", "Successfully created a tsconfig.json file."); + static inline const auto Suppress_excess_property_checks_for_object_literals = diag(6072, DiagnosticCategory::Message, "Suppress_excess_property_checks_for_object_literals_6072", "Suppress excess property checks for object literals."); + static inline const auto Stylize_errors_and_messages_using_color_and_context_experimental = diag(6073, DiagnosticCategory::Message, "Stylize_errors_and_messages_using_color_and_context_experimental_6073", "Stylize errors and messages using color and context (experimental)."); + static inline const auto Do_not_report_errors_on_unused_labels = diag(6074, DiagnosticCategory::Message, "Do_not_report_errors_on_unused_labels_6074", "Do not report errors on unused labels."); + static inline const auto Report_error_when_not_all_code_paths_in_function_return_a_value = diag(6075, DiagnosticCategory::Message, "Report_error_when_not_all_code_paths_in_function_return_a_value_6075", "Report error when not all code paths in function return a value."); + static inline const auto Report_errors_for_fallthrough_cases_in_switch_statement = diag(6076, DiagnosticCategory::Message, "Report_errors_for_fallthrough_cases_in_switch_statement_6076", "Report errors for fallthrough cases in switch statement."); + static inline const auto Do_not_report_errors_on_unreachable_code = diag(6077, DiagnosticCategory::Message, "Do_not_report_errors_on_unreachable_code_6077", "Do not report errors on unreachable code."); + static inline const auto Disallow_inconsistently_cased_references_to_the_same_file = diag(6078, DiagnosticCategory::Message, "Disallow_inconsistently_cased_references_to_the_same_file_6078", "Disallow inconsistently-cased references to the same file."); + static inline const auto Specify_library_files_to_be_included_in_the_compilation = diag(6079, DiagnosticCategory::Message, "Specify_library_files_to_be_included_in_the_compilation_6079", "Specify library files to be included in the compilation."); + static inline const auto Specify_JSX_code_generation = diag(6080, DiagnosticCategory::Message, "Specify_JSX_code_generation_6080", "Specify JSX code generation."); + static inline const auto File_0_has_an_unsupported_extension_so_skipping_it = diag(6081, DiagnosticCategory::Message, "File_0_has_an_unsupported_extension_so_skipping_it_6081", "File '{0}' has an unsupported extension, so skipping it."); + static inline const auto Only_amd_and_system_modules_are_supported_alongside_0 = diag(6082, DiagnosticCategory::Error, "Only_amd_and_system_modules_are_supported_alongside_0_6082", "Only 'amd' and 'system' modules are supported alongside --{0}."); + static inline const auto Base_directory_to_resolve_non_absolute_module_names = diag(6083, DiagnosticCategory::Message, "Base_directory_to_resolve_non_absolute_module_names_6083", "Base directory to resolve non-absolute module names."); + static inline const auto Deprecated_Use_jsxFactory_instead_Specify_the_object_invoked_for_createElement_when_targeting_react_JSX_emit = diag(6084, DiagnosticCategory::Message, "Deprecated_Use_jsxFactory_instead_Specify_the_object_invoked_for_createElement_when_targeting_react__6084", "[Deprecated] Use '--jsxFactory' instead. Specify the object invoked for createElement when targeting 'react' JSX emit"); + static inline const auto Enable_tracing_of_the_name_resolution_process = diag(6085, DiagnosticCategory::Message, "Enable_tracing_of_the_name_resolution_process_6085", "Enable tracing of the name resolution process."); + static inline const auto Resolving_module_0_from_1 = diag(6086, DiagnosticCategory::Message, "Resolving_module_0_from_1_6086", "======== Resolving module '{0}' from '{1}'. ========"); + static inline const auto Explicitly_specified_module_resolution_kind_Colon_0 = diag(6087, DiagnosticCategory::Message, "Explicitly_specified_module_resolution_kind_Colon_0_6087", "Explicitly specified module resolution kind: '{0}'."); + static inline const auto Module_resolution_kind_is_not_specified_using_0 = diag(6088, DiagnosticCategory::Message, "Module_resolution_kind_is_not_specified_using_0_6088", "Module resolution kind is not specified, using '{0}'."); + static inline const auto Module_name_0_was_successfully_resolved_to_1 = diag(6089, DiagnosticCategory::Message, "Module_name_0_was_successfully_resolved_to_1_6089", "======== Module name '{0}' was successfully resolved to '{1}'. ========"); + static inline const auto Module_name_0_was_not_resolved = diag(6090, DiagnosticCategory::Message, "Module_name_0_was_not_resolved_6090", "======== Module name '{0}' was not resolved. ========"); + static inline const auto paths_option_is_specified_looking_for_a_pattern_to_match_module_name_0 = diag(6091, DiagnosticCategory::Message, "paths_option_is_specified_looking_for_a_pattern_to_match_module_name_0_6091", "'paths' option is specified, looking for a pattern to match module name '{0}'."); + static inline const auto Module_name_0_matched_pattern_1 = diag(6092, DiagnosticCategory::Message, "Module_name_0_matched_pattern_1_6092", "Module name '{0}', matched pattern '{1}'."); + static inline const auto Trying_substitution_0_candidate_module_location_Colon_1 = diag(6093, DiagnosticCategory::Message, "Trying_substitution_0_candidate_module_location_Colon_1_6093", "Trying substitution '{0}', candidate module location: '{1}'."); + static inline const auto Resolving_module_name_0_relative_to_base_url_1_2 = diag(6094, DiagnosticCategory::Message, "Resolving_module_name_0_relative_to_base_url_1_2_6094", "Resolving module name '{0}' relative to base url '{1}' - '{2}'."); + static inline const auto Loading_module_as_file_Slash_folder_candidate_module_location_0_target_file_type_1 = diag(6095, DiagnosticCategory::Message, "Loading_module_as_file_Slash_folder_candidate_module_location_0_target_file_type_1_6095", "Loading module as file / folder, candidate module location '{0}', target file type '{1}'."); + static inline const auto File_0_does_not_exist = diag(6096, DiagnosticCategory::Message, "File_0_does_not_exist_6096", "File '{0}' does not exist."); + static inline const auto File_0_exist_use_it_as_a_name_resolution_result = diag(6097, DiagnosticCategory::Message, "File_0_exist_use_it_as_a_name_resolution_result_6097", "File '{0}' exist - use it as a name resolution result."); + static inline const auto Loading_module_0_from_node_modules_folder_target_file_type_1 = diag(6098, DiagnosticCategory::Message, "Loading_module_0_from_node_modules_folder_target_file_type_1_6098", "Loading module '{0}' from 'node_modules' folder, target file type '{1}'."); + static inline const auto Found_package_json_at_0 = diag(6099, DiagnosticCategory::Message, "Found_package_json_at_0_6099", "Found 'package.json' at '{0}'."); + static inline const auto package_json_does_not_have_a_0_field = diag(6100, DiagnosticCategory::Message, "package_json_does_not_have_a_0_field_6100", "'package.json' does not have a '{0}' field."); + static inline const auto package_json_has_0_field_1_that_references_2 = diag(6101, DiagnosticCategory::Message, "package_json_has_0_field_1_that_references_2_6101", "'package.json' has '{0}' field '{1}' that references '{2}'."); + static inline const auto Allow_javascript_files_to_be_compiled = diag(6102, DiagnosticCategory::Message, "Allow_javascript_files_to_be_compiled_6102", "Allow javascript files to be compiled."); + static inline const auto Checking_if_0_is_the_longest_matching_prefix_for_1_2 = diag(6104, DiagnosticCategory::Message, "Checking_if_0_is_the_longest_matching_prefix_for_1_2_6104", "Checking if '{0}' is the longest matching prefix for '{1}' - '{2}'."); + static inline const auto Expected_type_of_0_field_in_package_json_to_be_1_got_2 = diag(6105, DiagnosticCategory::Message, "Expected_type_of_0_field_in_package_json_to_be_1_got_2_6105", "Expected type of '{0}' field in 'package.json' to be '{1}', got '{2}'."); + static inline const auto baseUrl_option_is_set_to_0_using_this_value_to_resolve_non_relative_module_name_1 = diag(6106, DiagnosticCategory::Message, "baseUrl_option_is_set_to_0_using_this_value_to_resolve_non_relative_module_name_1_6106", "'baseUrl' option is set to '{0}', using this value to resolve non-relative module name '{1}'."); + static inline const auto rootDirs_option_is_set_using_it_to_resolve_relative_module_name_0 = diag(6107, DiagnosticCategory::Message, "rootDirs_option_is_set_using_it_to_resolve_relative_module_name_0_6107", "'rootDirs' option is set, using it to resolve relative module name '{0}'."); + static inline const auto Longest_matching_prefix_for_0_is_1 = diag(6108, DiagnosticCategory::Message, "Longest_matching_prefix_for_0_is_1_6108", "Longest matching prefix for '{0}' is '{1}'."); + static inline const auto Loading_0_from_the_root_dir_1_candidate_location_2 = diag(6109, DiagnosticCategory::Message, "Loading_0_from_the_root_dir_1_candidate_location_2_6109", "Loading '{0}' from the root dir '{1}', candidate location '{2}'."); + static inline const auto Trying_other_entries_in_rootDirs = diag(6110, DiagnosticCategory::Message, "Trying_other_entries_in_rootDirs_6110", "Trying other entries in 'rootDirs'."); + static inline const auto Module_resolution_using_rootDirs_has_failed = diag(6111, DiagnosticCategory::Message, "Module_resolution_using_rootDirs_has_failed_6111", "Module resolution using 'rootDirs' has failed."); + static inline const auto Do_not_emit_use_strict_directives_in_module_output = diag(6112, DiagnosticCategory::Message, "Do_not_emit_use_strict_directives_in_module_output_6112", "Do not emit 'use strict' directives in module output."); + static inline const auto Enable_strict_null_checks = diag(6113, DiagnosticCategory::Message, "Enable_strict_null_checks_6113", "Enable strict null checks."); + static inline const auto Unknown_option_excludes_Did_you_mean_exclude = diag(6114, DiagnosticCategory::Error, "Unknown_option_excludes_Did_you_mean_exclude_6114", "Unknown option 'excludes'. Did you mean 'exclude'?"); + static inline const auto Raise_error_on_this_expressions_with_an_implied_any_type = diag(6115, DiagnosticCategory::Message, "Raise_error_on_this_expressions_with_an_implied_any_type_6115", "Raise error on 'this' expressions with an implied 'any' type."); + static inline const auto Resolving_type_reference_directive_0_containing_file_1_root_directory_2 = diag(6116, DiagnosticCategory::Message, "Resolving_type_reference_directive_0_containing_file_1_root_directory_2_6116", "======== Resolving type reference directive '{0}', containing file '{1}', root directory '{2}'. ========"); + static inline const auto Type_reference_directive_0_was_successfully_resolved_to_1_primary_Colon_2 = diag(6119, DiagnosticCategory::Message, "Type_reference_directive_0_was_successfully_resolved_to_1_primary_Colon_2_6119", "======== Type reference directive '{0}' was successfully resolved to '{1}', primary: {2}. ========"); + static inline const auto Type_reference_directive_0_was_not_resolved = diag(6120, DiagnosticCategory::Message, "Type_reference_directive_0_was_not_resolved_6120", "======== Type reference directive '{0}' was not resolved. ========"); + static inline const auto Resolving_with_primary_search_path_0 = diag(6121, DiagnosticCategory::Message, "Resolving_with_primary_search_path_0_6121", "Resolving with primary search path '{0}'."); + static inline const auto Root_directory_cannot_be_determined_skipping_primary_search_paths = diag(6122, DiagnosticCategory::Message, "Root_directory_cannot_be_determined_skipping_primary_search_paths_6122", "Root directory cannot be determined, skipping primary search paths."); + static inline const auto Resolving_type_reference_directive_0_containing_file_1_root_directory_not_set = diag(6123, DiagnosticCategory::Message, "Resolving_type_reference_directive_0_containing_file_1_root_directory_not_set_6123", "======== Resolving type reference directive '{0}', containing file '{1}', root directory not set. ========"); + static inline const auto Type_declaration_files_to_be_included_in_compilation = diag(6124, DiagnosticCategory::Message, "Type_declaration_files_to_be_included_in_compilation_6124", "Type declaration files to be included in compilation."); + static inline const auto Looking_up_in_node_modules_folder_initial_location_0 = diag(6125, DiagnosticCategory::Message, "Looking_up_in_node_modules_folder_initial_location_0_6125", "Looking up in 'node_modules' folder, initial location '{0}'."); + static inline const auto Containing_file_is_not_specified_and_root_directory_cannot_be_determined_skipping_lookup_in_node_modules_folder = diag(6126, DiagnosticCategory::Message, "Containing_file_is_not_specified_and_root_directory_cannot_be_determined_skipping_lookup_in_node_mod_6126", "Containing file is not specified and root directory cannot be determined, skipping lookup in 'node_modules' folder."); + static inline const auto Resolving_type_reference_directive_0_containing_file_not_set_root_directory_1 = diag(6127, DiagnosticCategory::Message, "Resolving_type_reference_directive_0_containing_file_not_set_root_directory_1_6127", "======== Resolving type reference directive '{0}', containing file not set, root directory '{1}'. ========"); + static inline const auto Resolving_type_reference_directive_0_containing_file_not_set_root_directory_not_set = diag(6128, DiagnosticCategory::Message, "Resolving_type_reference_directive_0_containing_file_not_set_root_directory_not_set_6128", "======== Resolving type reference directive '{0}', containing file not set, root directory not set. ========"); + static inline const auto Resolving_real_path_for_0_result_1 = diag(6130, DiagnosticCategory::Message, "Resolving_real_path_for_0_result_1_6130", "Resolving real path for '{0}', result '{1}'."); + static inline const auto Cannot_compile_modules_using_option_0_unless_the_module_flag_is_amd_or_system = diag(6131, DiagnosticCategory::Error, "Cannot_compile_modules_using_option_0_unless_the_module_flag_is_amd_or_system_6131", "Cannot compile modules using option '{0}' unless the '--module' flag is 'amd' or 'system'."); + static inline const auto File_name_0_has_a_1_extension_stripping_it = diag(6132, DiagnosticCategory::Message, "File_name_0_has_a_1_extension_stripping_it_6132", "File name '{0}' has a '{1}' extension - stripping it."); + static inline const auto _0_is_declared_but_its_value_is_never_read = diag(6133, DiagnosticCategory::Error, "_0_is_declared_but_its_value_is_never_read_6133", "'{0}' is declared but its value is never read.", /*reportsUnnecessary*/ true); + static inline const auto Report_errors_on_unused_locals = diag(6134, DiagnosticCategory::Message, "Report_errors_on_unused_locals_6134", "Report errors on unused locals."); + static inline const auto Report_errors_on_unused_parameters = diag(6135, DiagnosticCategory::Message, "Report_errors_on_unused_parameters_6135", "Report errors on unused parameters."); + static inline const auto The_maximum_dependency_depth_to_search_under_node_modules_and_load_JavaScript_files = diag(6136, DiagnosticCategory::Message, "The_maximum_dependency_depth_to_search_under_node_modules_and_load_JavaScript_files_6136", "The maximum dependency depth to search under node_modules and load JavaScript files."); + static inline const auto Cannot_import_type_declaration_files_Consider_importing_0_instead_of_1 = diag(6137, DiagnosticCategory::Error, "Cannot_import_type_declaration_files_Consider_importing_0_instead_of_1_6137", "Cannot import type declaration files. Consider importing '{0}' instead of '{1}'."); + static inline const auto Property_0_is_declared_but_its_value_is_never_read = diag(6138, DiagnosticCategory::Error, "Property_0_is_declared_but_its_value_is_never_read_6138", "Property '{0}' is declared but its value is never read.", /*reportsUnnecessary*/ true); + static inline const auto Import_emit_helpers_from_tslib = diag(6139, DiagnosticCategory::Message, "Import_emit_helpers_from_tslib_6139", "Import emit helpers from 'tslib'."); + static inline const auto Auto_discovery_for_typings_is_enabled_in_project_0_Running_extra_resolution_pass_for_module_1_using_cache_location_2 = diag(6140, DiagnosticCategory::Error, "Auto_discovery_for_typings_is_enabled_in_project_0_Running_extra_resolution_pass_for_module_1_using__6140", "Auto discovery for typings is enabled in project '{0}'. Running extra resolution pass for module '{1}' using cache location '{2}'."); + static inline const auto Parse_in_strict_mode_and_emit_use_strict_for_each_source_file = diag(6141, DiagnosticCategory::Message, "Parse_in_strict_mode_and_emit_use_strict_for_each_source_file_6141", "Parse in strict mode and emit \"use strict\" for each source file."); + static inline const auto Module_0_was_resolved_to_1_but_jsx_is_not_set = diag(6142, DiagnosticCategory::Error, "Module_0_was_resolved_to_1_but_jsx_is_not_set_6142", "Module '{0}' was resolved to '{1}', but '--jsx' is not set."); + static inline const auto Module_0_was_resolved_as_locally_declared_ambient_module_in_file_1 = diag(6144, DiagnosticCategory::Message, "Module_0_was_resolved_as_locally_declared_ambient_module_in_file_1_6144", "Module '{0}' was resolved as locally declared ambient module in file '{1}'."); + static inline const auto Module_0_was_resolved_as_ambient_module_declared_in_1_since_this_file_was_not_modified = diag(6145, DiagnosticCategory::Message, "Module_0_was_resolved_as_ambient_module_declared_in_1_since_this_file_was_not_modified_6145", "Module '{0}' was resolved as ambient module declared in '{1}' since this file was not modified."); + static inline const auto Specify_the_JSX_factory_function_to_use_when_targeting_react_JSX_emit_e_g_React_createElement_or_h = diag(6146, DiagnosticCategory::Message, "Specify_the_JSX_factory_function_to_use_when_targeting_react_JSX_emit_e_g_React_createElement_or_h_6146", "Specify the JSX factory function to use when targeting 'react' JSX emit, e.g. 'React.createElement' or 'h'."); + static inline const auto Resolution_for_module_0_was_found_in_cache_from_location_1 = diag(6147, DiagnosticCategory::Message, "Resolution_for_module_0_was_found_in_cache_from_location_1_6147", "Resolution for module '{0}' was found in cache from location '{1}'."); + static inline const auto Directory_0_does_not_exist_skipping_all_lookups_in_it = diag(6148, DiagnosticCategory::Message, "Directory_0_does_not_exist_skipping_all_lookups_in_it_6148", "Directory '{0}' does not exist, skipping all lookups in it."); + static inline const auto Show_diagnostic_information = diag(6149, DiagnosticCategory::Message, "Show_diagnostic_information_6149", "Show diagnostic information."); + static inline const auto Show_verbose_diagnostic_information = diag(6150, DiagnosticCategory::Message, "Show_verbose_diagnostic_information_6150", "Show verbose diagnostic information."); + static inline const auto Emit_a_single_file_with_source_maps_instead_of_having_a_separate_file = diag(6151, DiagnosticCategory::Message, "Emit_a_single_file_with_source_maps_instead_of_having_a_separate_file_6151", "Emit a single file with source maps instead of having a separate file."); + static inline const auto Emit_the_source_alongside_the_sourcemaps_within_a_single_file_requires_inlineSourceMap_or_sourceMap_to_be_set = diag(6152, DiagnosticCategory::Message, "Emit_the_source_alongside_the_sourcemaps_within_a_single_file_requires_inlineSourceMap_or_sourceMap__6152", "Emit the source alongside the sourcemaps within a single file; requires '--inlineSourceMap' or '--sourceMap' to be set."); + static inline const auto Transpile_each_file_as_a_separate_module_similar_to_ts_transpileModule = diag(6153, DiagnosticCategory::Message, "Transpile_each_file_as_a_separate_module_similar_to_ts_transpileModule_6153", "Transpile each file as a separate module (similar to 'ts.transpileModule')."); + static inline const auto Print_names_of_generated_files_part_of_the_compilation = diag(6154, DiagnosticCategory::Message, "Print_names_of_generated_files_part_of_the_compilation_6154", "Print names of generated files part of the compilation."); + static inline const auto Print_names_of_files_part_of_the_compilation = diag(6155, DiagnosticCategory::Message, "Print_names_of_files_part_of_the_compilation_6155", "Print names of files part of the compilation."); + static inline const auto The_locale_used_when_displaying_messages_to_the_user_e_g_en_us = diag(6156, DiagnosticCategory::Message, "The_locale_used_when_displaying_messages_to_the_user_e_g_en_us_6156", "The locale used when displaying messages to the user (e.g. 'en-us')"); + static inline const auto Do_not_generate_custom_helper_functions_like_extends_in_compiled_output = diag(6157, DiagnosticCategory::Message, "Do_not_generate_custom_helper_functions_like_extends_in_compiled_output_6157", "Do not generate custom helper functions like '__extends' in compiled output."); + static inline const auto Do_not_include_the_default_library_file_lib_d_ts = diag(6158, DiagnosticCategory::Message, "Do_not_include_the_default_library_file_lib_d_ts_6158", "Do not include the default library file (lib.d.ts)."); + static inline const auto Do_not_add_triple_slash_references_or_imported_modules_to_the_list_of_compiled_files = diag(6159, DiagnosticCategory::Message, "Do_not_add_triple_slash_references_or_imported_modules_to_the_list_of_compiled_files_6159", "Do not add triple-slash references or imported modules to the list of compiled files."); + static inline const auto Deprecated_Use_skipLibCheck_instead_Skip_type_checking_of_default_library_declaration_files = diag(6160, DiagnosticCategory::Message, "Deprecated_Use_skipLibCheck_instead_Skip_type_checking_of_default_library_declaration_files_6160", "[Deprecated] Use '--skipLibCheck' instead. Skip type checking of default library declaration files."); + static inline const auto List_of_folders_to_include_type_definitions_from = diag(6161, DiagnosticCategory::Message, "List_of_folders_to_include_type_definitions_from_6161", "List of folders to include type definitions from."); + static inline const auto Disable_size_limitations_on_JavaScript_projects = diag(6162, DiagnosticCategory::Message, "Disable_size_limitations_on_JavaScript_projects_6162", "Disable size limitations on JavaScript projects."); + static inline const auto The_character_set_of_the_input_files = diag(6163, DiagnosticCategory::Message, "The_character_set_of_the_input_files_6163", "The character set of the input files."); + static inline const auto Do_not_truncate_error_messages = diag(6165, DiagnosticCategory::Message, "Do_not_truncate_error_messages_6165", "Do not truncate error messages."); + static inline const auto Output_directory_for_generated_declaration_files = diag(6166, DiagnosticCategory::Message, "Output_directory_for_generated_declaration_files_6166", "Output directory for generated declaration files."); + static inline const auto A_series_of_entries_which_re_map_imports_to_lookup_locations_relative_to_the_baseUrl = diag(6167, DiagnosticCategory::Message, "A_series_of_entries_which_re_map_imports_to_lookup_locations_relative_to_the_baseUrl_6167", "A series of entries which re-map imports to lookup locations relative to the 'baseUrl'."); + static inline const auto List_of_root_folders_whose_combined_content_represents_the_structure_of_the_project_at_runtime = diag(6168, DiagnosticCategory::Message, "List_of_root_folders_whose_combined_content_represents_the_structure_of_the_project_at_runtime_6168", "List of root folders whose combined content represents the structure of the project at runtime."); + static inline const auto Show_all_compiler_options = diag(6169, DiagnosticCategory::Message, "Show_all_compiler_options_6169", "Show all compiler options."); + static inline const auto Deprecated_Use_outFile_instead_Concatenate_and_emit_output_to_single_file = diag(6170, DiagnosticCategory::Message, "Deprecated_Use_outFile_instead_Concatenate_and_emit_output_to_single_file_6170", "[Deprecated] Use '--outFile' instead. Concatenate and emit output to single file"); + static inline const auto Command_line_Options = diag(6171, DiagnosticCategory::Message, "Command_line_Options_6171", "Command-line Options"); + static inline const auto Provide_full_support_for_iterables_in_for_of_spread_and_destructuring_when_targeting_ES5_or_ES3 = diag(6179, DiagnosticCategory::Message, "Provide_full_support_for_iterables_in_for_of_spread_and_destructuring_when_targeting_ES5_or_ES3_6179", "Provide full support for iterables in 'for-of', spread, and destructuring when targeting 'ES5' or 'ES3'."); + static inline const auto Enable_all_strict_type_checking_options = diag(6180, DiagnosticCategory::Message, "Enable_all_strict_type_checking_options_6180", "Enable all strict type-checking options."); + static inline const auto List_of_language_service_plugins = diag(6181, DiagnosticCategory::Message, "List_of_language_service_plugins_6181", "List of language service plugins."); + static inline const auto Scoped_package_detected_looking_in_0 = diag(6182, DiagnosticCategory::Message, "Scoped_package_detected_looking_in_0_6182", "Scoped package detected, looking in '{0}'"); + static inline const auto Reusing_resolution_of_module_0_from_1_of_old_program_it_was_successfully_resolved_to_2 = diag(6183, DiagnosticCategory::Message, "Reusing_resolution_of_module_0_from_1_of_old_program_it_was_successfully_resolved_to_2_6183", "Reusing resolution of module '{0}' from '{1}' of old program, it was successfully resolved to '{2}'."); + static inline const auto Reusing_resolution_of_module_0_from_1_of_old_program_it_was_successfully_resolved_to_2_with_Package_ID_3 = diag(6184, DiagnosticCategory::Message, "Reusing_resolution_of_module_0_from_1_of_old_program_it_was_successfully_resolved_to_2_with_Package__6184", "Reusing resolution of module '{0}' from '{1}' of old program, it was successfully resolved to '{2}' with Package ID '{3}'."); + static inline const auto Enable_strict_checking_of_function_types = diag(6186, DiagnosticCategory::Message, "Enable_strict_checking_of_function_types_6186", "Enable strict checking of function types."); + static inline const auto Enable_strict_checking_of_property_initialization_in_classes = diag(6187, DiagnosticCategory::Message, "Enable_strict_checking_of_property_initialization_in_classes_6187", "Enable strict checking of property initialization in classes."); + static inline const auto Numeric_separators_are_not_allowed_here = diag(6188, DiagnosticCategory::Error, "Numeric_separators_are_not_allowed_here_6188", "Numeric separators are not allowed here."); + static inline const auto Multiple_consecutive_numeric_separators_are_not_permitted = diag(6189, DiagnosticCategory::Error, "Multiple_consecutive_numeric_separators_are_not_permitted_6189", "Multiple consecutive numeric separators are not permitted."); + static inline const auto Whether_to_keep_outdated_console_output_in_watch_mode_instead_of_clearing_the_screen = diag(6191, DiagnosticCategory::Message, "Whether_to_keep_outdated_console_output_in_watch_mode_instead_of_clearing_the_screen_6191", "Whether to keep outdated console output in watch mode instead of clearing the screen."); + static inline const auto All_imports_in_import_declaration_are_unused = diag(6192, DiagnosticCategory::Error, "All_imports_in_import_declaration_are_unused_6192", "All imports in import declaration are unused.", /*reportsUnnecessary*/ true); + static inline const auto Found_1_error_Watching_for_file_changes = diag(6193, DiagnosticCategory::Message, "Found_1_error_Watching_for_file_changes_6193", "Found 1 error. Watching for file changes."); + static inline const auto Found_0_errors_Watching_for_file_changes = diag(6194, DiagnosticCategory::Message, "Found_0_errors_Watching_for_file_changes_6194", "Found {0} errors. Watching for file changes."); + static inline const auto Resolve_keyof_to_string_valued_property_names_only_no_numbers_or_symbols = diag(6195, DiagnosticCategory::Message, "Resolve_keyof_to_string_valued_property_names_only_no_numbers_or_symbols_6195", "Resolve 'keyof' to string valued property names only (no numbers or symbols)."); + static inline const auto _0_is_declared_but_never_used = diag(6196, DiagnosticCategory::Error, "_0_is_declared_but_never_used_6196", "'{0}' is declared but never used.", /*reportsUnnecessary*/ true); + static inline const auto Include_modules_imported_with_json_extension = diag(6197, DiagnosticCategory::Message, "Include_modules_imported_with_json_extension_6197", "Include modules imported with '.json' extension"); + static inline const auto All_destructured_elements_are_unused = diag(6198, DiagnosticCategory::Error, "All_destructured_elements_are_unused_6198", "All destructured elements are unused.", /*reportsUnnecessary*/ true); + static inline const auto All_variables_are_unused = diag(6199, DiagnosticCategory::Error, "All_variables_are_unused_6199", "All variables are unused.", /*reportsUnnecessary*/ true); + static inline const auto Definitions_of_the_following_identifiers_conflict_with_those_in_another_file_Colon_0 = diag(6200, DiagnosticCategory::Error, "Definitions_of_the_following_identifiers_conflict_with_those_in_another_file_Colon_0_6200", "Definitions of the following identifiers conflict with those in another file: {0}"); + static inline const auto Conflicts_are_in_this_file = diag(6201, DiagnosticCategory::Message, "Conflicts_are_in_this_file_6201", "Conflicts are in this file."); + static inline const auto Project_references_may_not_form_a_circular_graph_Cycle_detected_Colon_0 = diag(6202, DiagnosticCategory::Error, "Project_references_may_not_form_a_circular_graph_Cycle_detected_Colon_0_6202", "Project references may not form a circular graph. Cycle detected: {0}"); + static inline const auto _0_was_also_declared_here = diag(6203, DiagnosticCategory::Message, "_0_was_also_declared_here_6203", "'{0}' was also declared here."); + static inline const auto and_here = diag(6204, DiagnosticCategory::Message, "and_here_6204", "and here."); + static inline const auto All_type_parameters_are_unused = diag(6205, DiagnosticCategory::Error, "All_type_parameters_are_unused_6205", "All type parameters are unused."); + static inline const auto package_json_has_a_typesVersions_field_with_version_specific_path_mappings = diag(6206, DiagnosticCategory::Message, "package_json_has_a_typesVersions_field_with_version_specific_path_mappings_6206", "'package.json' has a 'typesVersions' field with version-specific path mappings."); + static inline const auto package_json_does_not_have_a_typesVersions_entry_that_matches_version_0 = diag(6207, DiagnosticCategory::Message, "package_json_does_not_have_a_typesVersions_entry_that_matches_version_0_6207", "'package.json' does not have a 'typesVersions' entry that matches version '{0}'."); + static inline const auto package_json_has_a_typesVersions_entry_0_that_matches_compiler_version_1_looking_for_a_pattern_to_match_module_name_2 = diag(6208, DiagnosticCategory::Message, "package_json_has_a_typesVersions_entry_0_that_matches_compiler_version_1_looking_for_a_pattern_to_ma_6208", "'package.json' has a 'typesVersions' entry '{0}' that matches compiler version '{1}', looking for a pattern to match module name '{2}'."); + static inline const auto package_json_has_a_typesVersions_entry_0_that_is_not_a_valid_semver_range = diag(6209, DiagnosticCategory::Message, "package_json_has_a_typesVersions_entry_0_that_is_not_a_valid_semver_range_6209", "'package.json' has a 'typesVersions' entry '{0}' that is not a valid semver range."); + static inline const auto An_argument_for_0_was_not_provided = diag(6210, DiagnosticCategory::Message, "An_argument_for_0_was_not_provided_6210", "An argument for '{0}' was not provided."); + static inline const auto An_argument_matching_this_binding_pattern_was_not_provided = diag(6211, DiagnosticCategory::Message, "An_argument_matching_this_binding_pattern_was_not_provided_6211", "An argument matching this binding pattern was not provided."); + static inline const auto Did_you_mean_to_call_this_expression = diag(6212, DiagnosticCategory::Message, "Did_you_mean_to_call_this_expression_6212", "Did you mean to call this expression?"); + static inline const auto Did_you_mean_to_use_new_with_this_expression = diag(6213, DiagnosticCategory::Message, "Did_you_mean_to_use_new_with_this_expression_6213", "Did you mean to use 'new' with this expression?"); + static inline const auto Enable_strict_bind_call_and_apply_methods_on_functions = diag(6214, DiagnosticCategory::Message, "Enable_strict_bind_call_and_apply_methods_on_functions_6214", "Enable strict 'bind', 'call', and 'apply' methods on functions."); + static inline const auto Using_compiler_options_of_project_reference_redirect_0 = diag(6215, DiagnosticCategory::Message, "Using_compiler_options_of_project_reference_redirect_0_6215", "Using compiler options of project reference redirect '{0}'."); + static inline const auto Found_1_error = diag(6216, DiagnosticCategory::Message, "Found_1_error_6216", "Found 1 error."); + static inline const auto Found_0_errors = diag(6217, DiagnosticCategory::Message, "Found_0_errors_6217", "Found {0} errors."); + static inline const auto Module_name_0_was_successfully_resolved_to_1_with_Package_ID_2 = diag(6218, DiagnosticCategory::Message, "Module_name_0_was_successfully_resolved_to_1_with_Package_ID_2_6218", "======== Module name '{0}' was successfully resolved to '{1}' with Package ID '{2}'. ========"); + static inline const auto Type_reference_directive_0_was_successfully_resolved_to_1_with_Package_ID_2_primary_Colon_3 = diag(6219, DiagnosticCategory::Message, "Type_reference_directive_0_was_successfully_resolved_to_1_with_Package_ID_2_primary_Colon_3_6219", "======== Type reference directive '{0}' was successfully resolved to '{1}' with Package ID '{2}', primary: {3}. ========"); + static inline const auto package_json_had_a_falsy_0_field = diag(6220, DiagnosticCategory::Message, "package_json_had_a_falsy_0_field_6220", "'package.json' had a falsy '{0}' field."); + static inline const auto Disable_use_of_source_files_instead_of_declaration_files_from_referenced_projects = diag(6221, DiagnosticCategory::Message, "Disable_use_of_source_files_instead_of_declaration_files_from_referenced_projects_6221", "Disable use of source files instead of declaration files from referenced projects."); + static inline const auto Emit_class_fields_with_Define_instead_of_Set = diag(6222, DiagnosticCategory::Message, "Emit_class_fields_with_Define_instead_of_Set_6222", "Emit class fields with Define instead of Set."); + static inline const auto Generates_a_CPU_profile = diag(6223, DiagnosticCategory::Message, "Generates_a_CPU_profile_6223", "Generates a CPU profile."); + static inline const auto Disable_solution_searching_for_this_project = diag(6224, DiagnosticCategory::Message, "Disable_solution_searching_for_this_project_6224", "Disable solution searching for this project."); + static inline const auto Specify_strategy_for_watching_file_Colon_FixedPollingInterval_default_PriorityPollingInterval_DynamicPriorityPolling_FixedChunkSizePolling_UseFsEvents_UseFsEventsOnParentDirectory = diag(6225, DiagnosticCategory::Message, "Specify_strategy_for_watching_file_Colon_FixedPollingInterval_default_PriorityPollingInterval_Dynami_6225", + "Specify strategy for watching file: 'FixedPollingInterval' (default), 'PriorityPollingInterval', 'DynamicPriorityPolling', 'FixedChunkSizePolling', 'UseFsEvents', 'UseFsEventsOnParentDirectory'."); + static inline const auto Specify_strategy_for_watching_directory_on_platforms_that_don_t_support_recursive_watching_natively_Colon_UseFsEvents_default_FixedPollingInterval_DynamicPriorityPolling_FixedChunkSizePolling = diag(6226, DiagnosticCategory::Message, "Specify_strategy_for_watching_directory_on_platforms_that_don_t_support_recursive_watching_natively__6226", + "Specify strategy for watching directory on platforms that don't support recursive watching natively: 'UseFsEvents' (default), 'FixedPollingInterval', 'DynamicPriorityPolling', 'FixedChunkSizePolling'."); + static inline const auto Specify_strategy_for_creating_a_polling_watch_when_it_fails_to_create_using_file_system_events_Colon_FixedInterval_default_PriorityInterval_DynamicPriority_FixedChunkSize = diag(6227, DiagnosticCategory::Message, "Specify_strategy_for_creating_a_polling_watch_when_it_fails_to_create_using_file_system_events_Colon_6227", + "Specify strategy for creating a polling watch when it fails to create using file system events: 'FixedInterval' (default), 'PriorityInterval', 'DynamicPriority', 'FixedChunkSize'."); + static inline const auto Tag_0_expects_at_least_1_arguments_but_the_JSX_factory_2_provides_at_most_3 = diag(6229, DiagnosticCategory::Error, "Tag_0_expects_at_least_1_arguments_but_the_JSX_factory_2_provides_at_most_3_6229", "Tag '{0}' expects at least '{1}' arguments, but the JSX factory '{2}' provides at most '{3}'."); + static inline const auto Option_0_can_only_be_specified_in_tsconfig_json_file_or_set_to_false_or_null_on_command_line = diag(6230, DiagnosticCategory::Error, "Option_0_can_only_be_specified_in_tsconfig_json_file_or_set_to_false_or_null_on_command_line_6230", "Option '{0}' can only be specified in 'tsconfig.json' file or set to 'false' or 'null' on command line."); + static inline const auto Could_not_resolve_the_path_0_with_the_extensions_Colon_1 = diag(6231, DiagnosticCategory::Error, "Could_not_resolve_the_path_0_with_the_extensions_Colon_1_6231", "Could not resolve the path '{0}' with the extensions: {1}."); + static inline const auto Declaration_augments_declaration_in_another_file_This_cannot_be_serialized = diag(6232, DiagnosticCategory::Error, "Declaration_augments_declaration_in_another_file_This_cannot_be_serialized_6232", "Declaration augments declaration in another file. This cannot be serialized."); + static inline const auto This_is_the_declaration_being_augmented_Consider_moving_the_augmenting_declaration_into_the_same_file = diag(6233, DiagnosticCategory::Error, "This_is_the_declaration_being_augmented_Consider_moving_the_augmenting_declaration_into_the_same_fil_6233", "This is the declaration being augmented. Consider moving the augmenting declaration into the same file."); + static inline const auto This_expression_is_not_callable_because_it_is_a_get_accessor_Did_you_mean_to_use_it_without = diag(6234, DiagnosticCategory::Error, "This_expression_is_not_callable_because_it_is_a_get_accessor_Did_you_mean_to_use_it_without_6234", "This expression is not callable because it is a 'get' accessor. Did you mean to use it without '()'?"); + static inline const auto Disable_loading_referenced_projects = diag(6235, DiagnosticCategory::Message, "Disable_loading_referenced_projects_6235", "Disable loading referenced projects."); + static inline const auto Arguments_for_the_rest_parameter_0_were_not_provided = diag(6236, DiagnosticCategory::Error, "Arguments_for_the_rest_parameter_0_were_not_provided_6236", "Arguments for the rest parameter '{0}' were not provided."); + static inline const auto Generates_an_event_trace_and_a_list_of_types = diag(6237, DiagnosticCategory::Message, "Generates_an_event_trace_and_a_list_of_types_6237", "Generates an event trace and a list of types."); + static inline const auto Specify_the_module_specifier_to_be_used_to_import_the_jsx_and_jsxs_factory_functions_from_eg_react = diag(6238, DiagnosticCategory::Error, "Specify_the_module_specifier_to_be_used_to_import_the_jsx_and_jsxs_factory_functions_from_eg_react_6238", "Specify the module specifier to be used to import the 'jsx' and 'jsxs' factory functions from. eg, react"); + static inline const auto File_0_exists_according_to_earlier_cached_lookups = diag(6239, DiagnosticCategory::Message, "File_0_exists_according_to_earlier_cached_lookups_6239", "File '{0}' exists according to earlier cached lookups."); + static inline const auto File_0_does_not_exist_according_to_earlier_cached_lookups = diag(6240, DiagnosticCategory::Message, "File_0_does_not_exist_according_to_earlier_cached_lookups_6240", "File '{0}' does not exist according to earlier cached lookups."); + static inline const auto Resolution_for_type_reference_directive_0_was_found_in_cache_from_location_1 = diag(6241, DiagnosticCategory::Message, "Resolution_for_type_reference_directive_0_was_found_in_cache_from_location_1_6241", "Resolution for type reference directive '{0}' was found in cache from location '{1}'."); + static inline const auto Resolving_type_reference_directive_0_containing_file_1 = diag(6242, DiagnosticCategory::Message, "Resolving_type_reference_directive_0_containing_file_1_6242", "======== Resolving type reference directive '{0}', containing file '{1}'. ========"); + static inline const auto Interpret_optional_property_types_as_written_rather_than_adding_undefined = diag(6243, DiagnosticCategory::Message, "Interpret_optional_property_types_as_written_rather_than_adding_undefined_6243", "Interpret optional property types as written, rather than adding 'undefined'."); + static inline const auto Modules = diag(6244, DiagnosticCategory::Message, "Modules_6244", "Modules"); + static inline const auto File_Management = diag(6245, DiagnosticCategory::Message, "File_Management_6245", "File Management"); + static inline const auto Emit = diag(6246, DiagnosticCategory::Message, "Emit_6246", "Emit"); + static inline const auto JavaScript_Support = diag(6247, DiagnosticCategory::Message, "JavaScript_Support_6247", "JavaScript Support"); + static inline const auto Type_Checking = diag(6248, DiagnosticCategory::Message, "Type_Checking_6248", "Type Checking"); + static inline const auto Editor_Support = diag(6249, DiagnosticCategory::Message, "Editor_Support_6249", "Editor Support"); + static inline const auto Watch_and_Build_Modes = diag(6250, DiagnosticCategory::Message, "Watch_and_Build_Modes_6250", "Watch and Build Modes"); + static inline const auto Compiler_Diagnostics = diag(6251, DiagnosticCategory::Message, "Compiler_Diagnostics_6251", "Compiler Diagnostics"); + static inline const auto Interop_Constraints = diag(6252, DiagnosticCategory::Message, "Interop_Constraints_6252", "Interop Constraints"); + static inline const auto Backwards_Compatibility = diag(6253, DiagnosticCategory::Message, "Backwards_Compatibility_6253", "Backwards Compatibility"); + static inline const auto Language_and_Environment = diag(6254, DiagnosticCategory::Message, "Language_and_Environment_6254", "Language and Environment"); + static inline const auto Projects = diag(6255, DiagnosticCategory::Message, "Projects_6255", "Projects"); + static inline const auto Output_Formatting = diag(6256, DiagnosticCategory::Message, "Output_Formatting_6256", "Output Formatting"); + static inline const auto Completeness = diag(6257, DiagnosticCategory::Message, "Completeness_6257", "Completeness"); + static inline const auto _0_should_be_set_inside_the_compilerOptions_object_of_the_config_json_file = diag(6258, DiagnosticCategory::Error, "_0_should_be_set_inside_the_compilerOptions_object_of_the_config_json_file_6258", "'{0}' should be set inside the 'compilerOptions' object of the config json file"); + static inline const auto Directory_0_has_no_containing_package_json_scope_Imports_will_not_resolve = diag(6270, DiagnosticCategory::Message, "Directory_0_has_no_containing_package_json_scope_Imports_will_not_resolve_6270", "Directory '{0}' has no containing package.json scope. Imports will not resolve."); + static inline const auto Import_specifier_0_does_not_exist_in_package_json_scope_at_path_1 = diag(6271, DiagnosticCategory::Message, "Import_specifier_0_does_not_exist_in_package_json_scope_at_path_1_6271", "Import specifier '{0}' does not exist in package.json scope at path '{1}'."); + static inline const auto Invalid_import_specifier_0_has_no_possible_resolutions = diag(6272, DiagnosticCategory::Message, "Invalid_import_specifier_0_has_no_possible_resolutions_6272", "Invalid import specifier '{0}' has no possible resolutions."); + static inline const auto package_json_scope_0_has_no_imports_defined = diag(6273, DiagnosticCategory::Message, "package_json_scope_0_has_no_imports_defined_6273", "package.json scope '{0}' has no imports defined."); + static inline const auto package_json_scope_0_explicitly_maps_specifier_1_to_null = diag(6274, DiagnosticCategory::Message, "package_json_scope_0_explicitly_maps_specifier_1_to_null_6274", "package.json scope '{0}' explicitly maps specifier '{1}' to null."); + static inline const auto package_json_scope_0_has_invalid_type_for_target_of_specifier_1 = diag(6275, DiagnosticCategory::Message, "package_json_scope_0_has_invalid_type_for_target_of_specifier_1_6275", "package.json scope '{0}' has invalid type for target of specifier '{1}'"); + static inline const auto Export_specifier_0_does_not_exist_in_package_json_scope_at_path_1 = diag(6276, DiagnosticCategory::Message, "Export_specifier_0_does_not_exist_in_package_json_scope_at_path_1_6276", "Export specifier '{0}' does not exist in package.json scope at path '{1}'."); + static inline const auto Enable_project_compilation = diag(6302, DiagnosticCategory::Message, "Enable_project_compilation_6302", "Enable project compilation"); + static inline const auto Composite_projects_may_not_disable_declaration_emit = diag(6304, DiagnosticCategory::Error, "Composite_projects_may_not_disable_declaration_emit_6304", "Composite projects may not disable declaration emit."); + static inline const auto Output_file_0_has_not_been_built_from_source_file_1 = diag(6305, DiagnosticCategory::Error, "Output_file_0_has_not_been_built_from_source_file_1_6305", "Output file '{0}' has not been built from source file '{1}'."); + static inline const auto Referenced_project_0_must_have_setting_composite_Colon_true = diag(6306, DiagnosticCategory::Error, "Referenced_project_0_must_have_setting_composite_Colon_true_6306", "Referenced project '{0}' must have setting \"composite\": true."); + static inline const auto File_0_is_not_listed_within_the_file_list_of_project_1_Projects_must_list_all_files_or_use_an_include_pattern = diag(6307, DiagnosticCategory::Error, "File_0_is_not_listed_within_the_file_list_of_project_1_Projects_must_list_all_files_or_use_an_includ_6307", "File '{0}' is not listed within the file list of project '{1}'. Projects must list all files or use an 'include' pattern."); + static inline const auto Cannot_prepend_project_0_because_it_does_not_have_outFile_set = diag(6308, DiagnosticCategory::Error, "Cannot_prepend_project_0_because_it_does_not_have_outFile_set_6308", "Cannot prepend project '{0}' because it does not have 'outFile' set"); + static inline const auto Output_file_0_from_project_1_does_not_exist = diag(6309, DiagnosticCategory::Error, "Output_file_0_from_project_1_does_not_exist_6309", "Output file '{0}' from project '{1}' does not exist"); + static inline const auto Referenced_project_0_may_not_disable_emit = diag(6310, DiagnosticCategory::Error, "Referenced_project_0_may_not_disable_emit_6310", "Referenced project '{0}' may not disable emit."); + static inline const auto Project_0_is_out_of_date_because_oldest_output_1_is_older_than_newest_input_2 = diag(6350, DiagnosticCategory::Message, "Project_0_is_out_of_date_because_oldest_output_1_is_older_than_newest_input_2_6350", "Project '{0}' is out of date because oldest output '{1}' is older than newest input '{2}'"); + static inline const auto Project_0_is_up_to_date_because_newest_input_1_is_older_than_oldest_output_2 = diag(6351, DiagnosticCategory::Message, "Project_0_is_up_to_date_because_newest_input_1_is_older_than_oldest_output_2_6351", "Project '{0}' is up to date because newest input '{1}' is older than oldest output '{2}'"); + static inline const auto Project_0_is_out_of_date_because_output_file_1_does_not_exist = diag(6352, DiagnosticCategory::Message, "Project_0_is_out_of_date_because_output_file_1_does_not_exist_6352", "Project '{0}' is out of date because output file '{1}' does not exist"); + static inline const auto Project_0_is_out_of_date_because_its_dependency_1_is_out_of_date = diag(6353, DiagnosticCategory::Message, "Project_0_is_out_of_date_because_its_dependency_1_is_out_of_date_6353", "Project '{0}' is out of date because its dependency '{1}' is out of date"); + static inline const auto Project_0_is_up_to_date_with_d_ts_files_from_its_dependencies = diag(6354, DiagnosticCategory::Message, "Project_0_is_up_to_date_with_d_ts_files_from_its_dependencies_6354", "Project '{0}' is up to date with .d.ts files from its dependencies"); + static inline const auto Projects_in_this_build_Colon_0 = diag(6355, DiagnosticCategory::Message, "Projects_in_this_build_Colon_0_6355", "Projects in this build: {0}"); + static inline const auto A_non_dry_build_would_delete_the_following_files_Colon_0 = diag(6356, DiagnosticCategory::Message, "A_non_dry_build_would_delete_the_following_files_Colon_0_6356", "A non-dry build would delete the following files: {0}"); + static inline const auto A_non_dry_build_would_build_project_0 = diag(6357, DiagnosticCategory::Message, "A_non_dry_build_would_build_project_0_6357", "A non-dry build would build project '{0}'"); + static inline const auto Building_project_0 = diag(6358, DiagnosticCategory::Message, "Building_project_0_6358", "Building project '{0}'..."); + static inline const auto Updating_output_timestamps_of_project_0 = diag(6359, DiagnosticCategory::Message, "Updating_output_timestamps_of_project_0_6359", "Updating output timestamps of project '{0}'..."); + static inline const auto Project_0_is_up_to_date = diag(6361, DiagnosticCategory::Message, "Project_0_is_up_to_date_6361", "Project '{0}' is up to date"); + static inline const auto Skipping_build_of_project_0_because_its_dependency_1_has_errors = diag(6362, DiagnosticCategory::Message, "Skipping_build_of_project_0_because_its_dependency_1_has_errors_6362", "Skipping build of project '{0}' because its dependency '{1}' has errors"); + static inline const auto Project_0_can_t_be_built_because_its_dependency_1_has_errors = diag(6363, DiagnosticCategory::Message, "Project_0_can_t_be_built_because_its_dependency_1_has_errors_6363", "Project '{0}' can't be built because its dependency '{1}' has errors"); + static inline const auto Build_one_or_more_projects_and_their_dependencies_if_out_of_date = diag(6364, DiagnosticCategory::Message, "Build_one_or_more_projects_and_their_dependencies_if_out_of_date_6364", "Build one or more projects and their dependencies, if out of date"); + static inline const auto Delete_the_outputs_of_all_projects = diag(6365, DiagnosticCategory::Message, "Delete_the_outputs_of_all_projects_6365", "Delete the outputs of all projects"); + static inline const auto Show_what_would_be_built_or_deleted_if_specified_with_clean = diag(6367, DiagnosticCategory::Message, "Show_what_would_be_built_or_deleted_if_specified_with_clean_6367", "Show what would be built (or deleted, if specified with '--clean')"); + static inline const auto Option_build_must_be_the_first_command_line_argument = diag(6369, DiagnosticCategory::Error, "Option_build_must_be_the_first_command_line_argument_6369", "Option '--build' must be the first command line argument."); + static inline const auto Options_0_and_1_cannot_be_combined = diag(6370, DiagnosticCategory::Error, "Options_0_and_1_cannot_be_combined_6370", "Options '{0}' and '{1}' cannot be combined."); + static inline const auto Updating_unchanged_output_timestamps_of_project_0 = diag(6371, DiagnosticCategory::Message, "Updating_unchanged_output_timestamps_of_project_0_6371", "Updating unchanged output timestamps of project '{0}'..."); + static inline const auto Project_0_is_out_of_date_because_output_of_its_dependency_1_has_changed = diag(6372, DiagnosticCategory::Message, "Project_0_is_out_of_date_because_output_of_its_dependency_1_has_changed_6372", "Project '{0}' is out of date because output of its dependency '{1}' has changed"); + static inline const auto Updating_output_of_project_0 = diag(6373, DiagnosticCategory::Message, "Updating_output_of_project_0_6373", "Updating output of project '{0}'..."); + static inline const auto A_non_dry_build_would_update_timestamps_for_output_of_project_0 = diag(6374, DiagnosticCategory::Message, "A_non_dry_build_would_update_timestamps_for_output_of_project_0_6374", "A non-dry build would update timestamps for output of project '{0}'"); + static inline const auto A_non_dry_build_would_update_output_of_project_0 = diag(6375, DiagnosticCategory::Message, "A_non_dry_build_would_update_output_of_project_0_6375", "A non-dry build would update output of project '{0}'"); + static inline const auto Cannot_update_output_of_project_0_because_there_was_error_reading_file_1 = diag(6376, DiagnosticCategory::Message, "Cannot_update_output_of_project_0_because_there_was_error_reading_file_1_6376", "Cannot update output of project '{0}' because there was error reading file '{1}'"); + static inline const auto Cannot_write_file_0_because_it_will_overwrite_tsbuildinfo_file_generated_by_referenced_project_1 = diag(6377, DiagnosticCategory::Error, "Cannot_write_file_0_because_it_will_overwrite_tsbuildinfo_file_generated_by_referenced_project_1_6377", "Cannot write file '{0}' because it will overwrite '.tsbuildinfo' file generated by referenced project '{1}'"); + static inline const auto Enable_incremental_compilation = diag(6378, DiagnosticCategory::Message, "Enable_incremental_compilation_6378", "Enable incremental compilation"); + static inline const auto Composite_projects_may_not_disable_incremental_compilation = diag(6379, DiagnosticCategory::Error, "Composite_projects_may_not_disable_incremental_compilation_6379", "Composite projects may not disable incremental compilation."); + static inline const auto Specify_file_to_store_incremental_compilation_information = diag(6380, DiagnosticCategory::Message, "Specify_file_to_store_incremental_compilation_information_6380", "Specify file to store incremental compilation information"); + static inline const auto Project_0_is_out_of_date_because_output_for_it_was_generated_with_version_1_that_differs_with_current_version_2 = diag(6381, DiagnosticCategory::Message, "Project_0_is_out_of_date_because_output_for_it_was_generated_with_version_1_that_differs_with_curren_6381", "Project '{0}' is out of date because output for it was generated with version '{1}' that differs with current version '{2}'"); + static inline const auto Skipping_build_of_project_0_because_its_dependency_1_was_not_built = diag(6382, DiagnosticCategory::Message, "Skipping_build_of_project_0_because_its_dependency_1_was_not_built_6382", "Skipping build of project '{0}' because its dependency '{1}' was not built"); + static inline const auto Project_0_can_t_be_built_because_its_dependency_1_was_not_built = diag(6383, DiagnosticCategory::Message, "Project_0_can_t_be_built_because_its_dependency_1_was_not_built_6383", "Project '{0}' can't be built because its dependency '{1}' was not built"); + static inline const auto Have_recompiles_in_incremental_and_watch_assume_that_changes_within_a_file_will_only_affect_files_directly_depending_on_it = diag(6384, DiagnosticCategory::Message, "Have_recompiles_in_incremental_and_watch_assume_that_changes_within_a_file_will_only_affect_files_di_6384", "Have recompiles in '--incremental' and '--watch' assume that changes within a file will only affect files directly depending on it."); + static inline const auto _0_is_deprecated = diag(6385, DiagnosticCategory::Suggestion, "_0_is_deprecated_6385", "'{0}' is deprecated.", /*reportsUnnecessary*/ false, /*elidedInCompatabilityPyramid*/ false, /*reportsDeprecated*/ true); + static inline const auto Performance_timings_for_diagnostics_or_extendedDiagnostics_are_not_available_in_this_session_A_native_implementation_of_the_Web_Performance_API_could_not_be_found = diag(6386, DiagnosticCategory::Message, "Performance_timings_for_diagnostics_or_extendedDiagnostics_are_not_available_in_this_session_A_nativ_6386", + "Performance timings for '--diagnostics' or '--extendedDiagnostics' are not available in this session. A native implementation of the Web Performance API could not be found."); + static inline const auto The_signature_0_of_1_is_deprecated = diag(6387, DiagnosticCategory::Suggestion, "The_signature_0_of_1_is_deprecated_6387", "The signature '{0}' of '{1}' is deprecated.", /*reportsUnnecessary*/ false, /*elidedInCompatabilityPyramid*/ false, /*reportsDeprecated*/ true); + static inline const auto Project_0_is_being_forcibly_rebuilt = diag(6388, DiagnosticCategory::Message, "Project_0_is_being_forcibly_rebuilt_6388", "Project '{0}' is being forcibly rebuilt"); + static inline const auto Reusing_resolution_of_module_0_from_1_of_old_program_it_was_not_resolved = diag(6389, DiagnosticCategory::Message, "Reusing_resolution_of_module_0_from_1_of_old_program_it_was_not_resolved_6389", "Reusing resolution of module '{0}' from '{1}' of old program, it was not resolved."); + static inline const auto Reusing_resolution_of_type_reference_directive_0_from_1_of_old_program_it_was_successfully_resolved_to_2 = diag(6390, DiagnosticCategory::Message, "Reusing_resolution_of_type_reference_directive_0_from_1_of_old_program_it_was_successfully_resolved__6390", "Reusing resolution of type reference directive '{0}' from '{1}' of old program, it was successfully resolved to '{2}'."); + static inline const auto Reusing_resolution_of_type_reference_directive_0_from_1_of_old_program_it_was_successfully_resolved_to_2_with_Package_ID_3 = diag(6391, DiagnosticCategory::Message, "Reusing_resolution_of_type_reference_directive_0_from_1_of_old_program_it_was_successfully_resolved__6391", "Reusing resolution of type reference directive '{0}' from '{1}' of old program, it was successfully resolved to '{2}' with Package ID '{3}'."); + static inline const auto Reusing_resolution_of_type_reference_directive_0_from_1_of_old_program_it_was_not_resolved = diag(6392, DiagnosticCategory::Message, "Reusing_resolution_of_type_reference_directive_0_from_1_of_old_program_it_was_not_resolved_6392", "Reusing resolution of type reference directive '{0}' from '{1}' of old program, it was not resolved."); + static inline const auto Reusing_resolution_of_module_0_from_1_found_in_cache_from_location_2_it_was_successfully_resolved_to_3 = diag(6393, DiagnosticCategory::Message, "Reusing_resolution_of_module_0_from_1_found_in_cache_from_location_2_it_was_successfully_resolved_to_6393", "Reusing resolution of module '{0}' from '{1}' found in cache from location '{2}', it was successfully resolved to '{3}'."); + static inline const auto Reusing_resolution_of_module_0_from_1_found_in_cache_from_location_2_it_was_successfully_resolved_to_3_with_Package_ID_4 = diag(6394, DiagnosticCategory::Message, "Reusing_resolution_of_module_0_from_1_found_in_cache_from_location_2_it_was_successfully_resolved_to_6394", "Reusing resolution of module '{0}' from '{1}' found in cache from location '{2}', it was successfully resolved to '{3}' with Package ID '{4}'."); + static inline const auto Reusing_resolution_of_module_0_from_1_found_in_cache_from_location_2_it_was_not_resolved = diag(6395, DiagnosticCategory::Message, "Reusing_resolution_of_module_0_from_1_found_in_cache_from_location_2_it_was_not_resolved_6395", "Reusing resolution of module '{0}' from '{1}' found in cache from location '{2}', it was not resolved."); + static inline const auto Reusing_resolution_of_type_reference_directive_0_from_1_found_in_cache_from_location_2_it_was_successfully_resolved_to_3 = diag(6396, DiagnosticCategory::Message, "Reusing_resolution_of_type_reference_directive_0_from_1_found_in_cache_from_location_2_it_was_succes_6396", "Reusing resolution of type reference directive '{0}' from '{1}' found in cache from location '{2}', it was successfully resolved to '{3}'."); + static inline const auto Reusing_resolution_of_type_reference_directive_0_from_1_found_in_cache_from_location_2_it_was_successfully_resolved_to_3_with_Package_ID_4 = diag(6397, DiagnosticCategory::Message, "Reusing_resolution_of_type_reference_directive_0_from_1_found_in_cache_from_location_2_it_was_succes_6397", "Reusing resolution of type reference directive '{0}' from '{1}' found in cache from location '{2}', it was successfully resolved to '{3}' with Package ID '{4}'."); + static inline const auto Reusing_resolution_of_type_reference_directive_0_from_1_found_in_cache_from_location_2_it_was_not_resolved = diag(6398, DiagnosticCategory::Message, "Reusing_resolution_of_type_reference_directive_0_from_1_found_in_cache_from_location_2_it_was_not_re_6398", "Reusing resolution of type reference directive '{0}' from '{1}' found in cache from location '{2}', it was not resolved."); + static inline const auto The_expected_type_comes_from_property_0_which_is_declared_here_on_type_1 = diag(6500, DiagnosticCategory::Message, "The_expected_type_comes_from_property_0_which_is_declared_here_on_type_1_6500", "The expected type comes from property '{0}' which is declared here on type '{1}'"); + static inline const auto The_expected_type_comes_from_this_index_signature = diag(6501, DiagnosticCategory::Message, "The_expected_type_comes_from_this_index_signature_6501", "The expected type comes from this index signature."); + static inline const auto The_expected_type_comes_from_the_return_type_of_this_signature = diag(6502, DiagnosticCategory::Message, "The_expected_type_comes_from_the_return_type_of_this_signature_6502", "The expected type comes from the return type of this signature."); + static inline const auto Print_names_of_files_that_are_part_of_the_compilation_and_then_stop_processing = diag(6503, DiagnosticCategory::Message, "Print_names_of_files_that_are_part_of_the_compilation_and_then_stop_processing_6503", "Print names of files that are part of the compilation and then stop processing."); + static inline const auto File_0_is_a_JavaScript_file_Did_you_mean_to_enable_the_allowJs_option = diag(6504, DiagnosticCategory::Error, "File_0_is_a_JavaScript_file_Did_you_mean_to_enable_the_allowJs_option_6504", "File '{0}' is a JavaScript file. Did you mean to enable the 'allowJs' option?"); + static inline const auto Print_names_of_files_and_the_reason_they_are_part_of_the_compilation = diag(6505, DiagnosticCategory::Message, "Print_names_of_files_and_the_reason_they_are_part_of_the_compilation_6505", "Print names of files and the reason they are part of the compilation."); + static inline const auto Consider_adding_a_declare_modifier_to_this_class = diag(6506, DiagnosticCategory::Message, "Consider_adding_a_declare_modifier_to_this_class_6506", "Consider adding a 'declare' modifier to this class."); + static inline const auto Allow_JavaScript_files_to_be_a_part_of_your_program_Use_the_checkJS_option_to_get_errors_from_these_files = diag(6600, DiagnosticCategory::Message, "Allow_JavaScript_files_to_be_a_part_of_your_program_Use_the_checkJS_option_to_get_errors_from_these__6600", "Allow JavaScript files to be a part of your program. Use the `checkJS` option to get errors from these files."); + static inline const auto Allow_import_x_from_y_when_a_module_doesn_t_have_a_default_export = diag(6601, DiagnosticCategory::Message, "Allow_import_x_from_y_when_a_module_doesn_t_have_a_default_export_6601", "Allow 'import x from y' when a module doesn't have a default export."); + static inline const auto Allow_accessing_UMD_globals_from_modules = diag(6602, DiagnosticCategory::Message, "Allow_accessing_UMD_globals_from_modules_6602", "Allow accessing UMD globals from modules."); + static inline const auto Disable_error_reporting_for_unreachable_code = diag(6603, DiagnosticCategory::Message, "Disable_error_reporting_for_unreachable_code_6603", "Disable error reporting for unreachable code."); + static inline const auto Disable_error_reporting_for_unused_labels = diag(6604, DiagnosticCategory::Message, "Disable_error_reporting_for_unused_labels_6604", "Disable error reporting for unused labels."); + static inline const auto Ensure_use_strict_is_always_emitted = diag(6605, DiagnosticCategory::Message, "Ensure_use_strict_is_always_emitted_6605", "Ensure 'use strict' is always emitted."); + static inline const auto Have_recompiles_in_projects_that_use_incremental_and_watch_mode_assume_that_changes_within_a_file_will_only_affect_files_directly_depending_on_it = diag(6606, DiagnosticCategory::Message, "Have_recompiles_in_projects_that_use_incremental_and_watch_mode_assume_that_changes_within_a_file_wi_6606", "Have recompiles in projects that use `incremental` and `watch` mode assume that changes within a file will only affect files directly depending on it."); + static inline const auto Specify_the_base_directory_to_resolve_non_relative_module_names = diag(6607, DiagnosticCategory::Message, "Specify_the_base_directory_to_resolve_non_relative_module_names_6607", "Specify the base directory to resolve non-relative module names."); + static inline const auto No_longer_supported_In_early_versions_manually_set_the_text_encoding_for_reading_files = diag(6608, DiagnosticCategory::Message, "No_longer_supported_In_early_versions_manually_set_the_text_encoding_for_reading_files_6608", "No longer supported. In early versions, manually set the text encoding for reading files."); + static inline const auto Enable_error_reporting_in_type_checked_JavaScript_files = diag(6609, DiagnosticCategory::Message, "Enable_error_reporting_in_type_checked_JavaScript_files_6609", "Enable error reporting in type-checked JavaScript files."); + static inline const auto Enable_constraints_that_allow_a_TypeScript_project_to_be_used_with_project_references = diag(6611, DiagnosticCategory::Message, "Enable_constraints_that_allow_a_TypeScript_project_to_be_used_with_project_references_6611", "Enable constraints that allow a TypeScript project to be used with project references."); + static inline const auto Generate_d_ts_files_from_TypeScript_and_JavaScript_files_in_your_project = diag(6612, DiagnosticCategory::Message, "Generate_d_ts_files_from_TypeScript_and_JavaScript_files_in_your_project_6612", "Generate .d.ts files from TypeScript and JavaScript files in your project."); + static inline const auto Specify_the_output_directory_for_generated_declaration_files = diag(6613, DiagnosticCategory::Message, "Specify_the_output_directory_for_generated_declaration_files_6613", "Specify the output directory for generated declaration files."); + static inline const auto Create_sourcemaps_for_d_ts_files = diag(6614, DiagnosticCategory::Message, "Create_sourcemaps_for_d_ts_files_6614", "Create sourcemaps for d.ts files."); + static inline const auto Output_compiler_performance_information_after_building = diag(6615, DiagnosticCategory::Message, "Output_compiler_performance_information_after_building_6615", "Output compiler performance information after building."); + static inline const auto Disables_inference_for_type_acquisition_by_looking_at_filenames_in_a_project = diag(6616, DiagnosticCategory::Message, "Disables_inference_for_type_acquisition_by_looking_at_filenames_in_a_project_6616", "Disables inference for type acquisition by looking at filenames in a project."); + static inline const auto Reduce_the_number_of_projects_loaded_automatically_by_TypeScript = diag(6617, DiagnosticCategory::Message, "Reduce_the_number_of_projects_loaded_automatically_by_TypeScript_6617", "Reduce the number of projects loaded automatically by TypeScript."); + static inline const auto Remove_the_20mb_cap_on_total_source_code_size_for_JavaScript_files_in_the_TypeScript_language_server = diag(6618, DiagnosticCategory::Message, "Remove_the_20mb_cap_on_total_source_code_size_for_JavaScript_files_in_the_TypeScript_language_server_6618", "Remove the 20mb cap on total source code size for JavaScript files in the TypeScript language server."); + static inline const auto Opt_a_project_out_of_multi_project_reference_checking_when_editing = diag(6619, DiagnosticCategory::Message, "Opt_a_project_out_of_multi_project_reference_checking_when_editing_6619", "Opt a project out of multi-project reference checking when editing."); + static inline const auto Disable_preferring_source_files_instead_of_declaration_files_when_referencing_composite_projects = diag(6620, DiagnosticCategory::Message, "Disable_preferring_source_files_instead_of_declaration_files_when_referencing_composite_projects_6620", "Disable preferring source files instead of declaration files when referencing composite projects"); + static inline const auto Emit_more_compliant_but_verbose_and_less_performant_JavaScript_for_iteration = diag(6621, DiagnosticCategory::Message, "Emit_more_compliant_but_verbose_and_less_performant_JavaScript_for_iteration_6621", "Emit more compliant, but verbose and less performant JavaScript for iteration."); + static inline const auto Emit_a_UTF_8_Byte_Order_Mark_BOM_in_the_beginning_of_output_files = diag(6622, DiagnosticCategory::Message, "Emit_a_UTF_8_Byte_Order_Mark_BOM_in_the_beginning_of_output_files_6622", "Emit a UTF-8 Byte Order Mark (BOM) in the beginning of output files."); + static inline const auto Only_output_d_ts_files_and_not_JavaScript_files = diag(6623, DiagnosticCategory::Message, "Only_output_d_ts_files_and_not_JavaScript_files_6623", "Only output d.ts files and not JavaScript files."); + static inline const auto Emit_design_type_metadata_for_decorated_declarations_in_source_files = diag(6624, DiagnosticCategory::Message, "Emit_design_type_metadata_for_decorated_declarations_in_source_files_6624", "Emit design-type metadata for decorated declarations in source files."); + static inline const auto Disable_the_type_acquisition_for_JavaScript_projects = diag(6625, DiagnosticCategory::Message, "Disable_the_type_acquisition_for_JavaScript_projects_6625", "Disable the type acquisition for JavaScript projects"); + static inline const auto Emit_additional_JavaScript_to_ease_support_for_importing_CommonJS_modules_This_enables_allowSyntheticDefaultImports_for_type_compatibility = diag(6626, DiagnosticCategory::Message, "Emit_additional_JavaScript_to_ease_support_for_importing_CommonJS_modules_This_enables_allowSyntheti_6626", "Emit additional JavaScript to ease support for importing CommonJS modules. This enables `allowSyntheticDefaultImports` for type compatibility."); + static inline const auto Filters_results_from_the_include_option = diag(6627, DiagnosticCategory::Message, "Filters_results_from_the_include_option_6627", "Filters results from the `include` option."); + static inline const auto Remove_a_list_of_directories_from_the_watch_process = diag(6628, DiagnosticCategory::Message, "Remove_a_list_of_directories_from_the_watch_process_6628", "Remove a list of directories from the watch process."); + static inline const auto Remove_a_list_of_files_from_the_watch_mode_s_processing = diag(6629, DiagnosticCategory::Message, "Remove_a_list_of_files_from_the_watch_mode_s_processing_6629", "Remove a list of files from the watch mode's processing."); + static inline const auto Enable_experimental_support_for_TC39_stage_2_draft_decorators = diag(6630, DiagnosticCategory::Message, "Enable_experimental_support_for_TC39_stage_2_draft_decorators_6630", "Enable experimental support for TC39 stage 2 draft decorators."); + static inline const auto Print_files_read_during_the_compilation_including_why_it_was_included = diag(6631, DiagnosticCategory::Message, "Print_files_read_during_the_compilation_including_why_it_was_included_6631", "Print files read during the compilation including why it was included."); + static inline const auto Output_more_detailed_compiler_performance_information_after_building = diag(6632, DiagnosticCategory::Message, "Output_more_detailed_compiler_performance_information_after_building_6632", "Output more detailed compiler performance information after building."); + static inline const auto Specify_one_or_more_path_or_node_module_references_to_base_configuration_files_from_which_settings_are_inherited = diag(6633, DiagnosticCategory::Message, "Specify_one_or_more_path_or_node_module_references_to_base_configuration_files_from_which_settings_a_6633", "Specify one or more path or node module references to base configuration files from which settings are inherited."); + static inline const auto Specify_what_approach_the_watcher_should_use_if_the_system_runs_out_of_native_file_watchers = diag(6634, DiagnosticCategory::Message, "Specify_what_approach_the_watcher_should_use_if_the_system_runs_out_of_native_file_watchers_6634", "Specify what approach the watcher should use if the system runs out of native file watchers."); + static inline const auto Include_a_list_of_files_This_does_not_support_glob_patterns_as_opposed_to_include = diag(6635, DiagnosticCategory::Message, "Include_a_list_of_files_This_does_not_support_glob_patterns_as_opposed_to_include_6635", "Include a list of files. This does not support glob patterns, as opposed to `include`."); + static inline const auto Build_all_projects_including_those_that_appear_to_be_up_to_date = diag(6636, DiagnosticCategory::Message, "Build_all_projects_including_those_that_appear_to_be_up_to_date_6636", "Build all projects, including those that appear to be up to date"); + static inline const auto Ensure_that_casing_is_correct_in_imports = diag(6637, DiagnosticCategory::Message, "Ensure_that_casing_is_correct_in_imports_6637", "Ensure that casing is correct in imports."); + static inline const auto Emit_a_v8_CPU_profile_of_the_compiler_run_for_debugging = diag(6638, DiagnosticCategory::Message, "Emit_a_v8_CPU_profile_of_the_compiler_run_for_debugging_6638", "Emit a v8 CPU profile of the compiler run for debugging."); + static inline const auto Allow_importing_helper_functions_from_tslib_once_per_project_instead_of_including_them_per_file = diag(6639, DiagnosticCategory::Message, "Allow_importing_helper_functions_from_tslib_once_per_project_instead_of_including_them_per_file_6639", "Allow importing helper functions from tslib once per project, instead of including them per-file."); + static inline const auto Specify_a_list_of_glob_patterns_that_match_files_to_be_included_in_compilation = diag(6641, DiagnosticCategory::Message, "Specify_a_list_of_glob_patterns_that_match_files_to_be_included_in_compilation_6641", "Specify a list of glob patterns that match files to be included in compilation."); + static inline const auto Save_tsbuildinfo_files_to_allow_for_incremental_compilation_of_projects = diag(6642, DiagnosticCategory::Message, "Save_tsbuildinfo_files_to_allow_for_incremental_compilation_of_projects_6642", "Save .tsbuildinfo files to allow for incremental compilation of projects."); + static inline const auto Include_sourcemap_files_inside_the_emitted_JavaScript = diag(6643, DiagnosticCategory::Message, "Include_sourcemap_files_inside_the_emitted_JavaScript_6643", "Include sourcemap files inside the emitted JavaScript."); + static inline const auto Include_source_code_in_the_sourcemaps_inside_the_emitted_JavaScript = diag(6644, DiagnosticCategory::Message, "Include_source_code_in_the_sourcemaps_inside_the_emitted_JavaScript_6644", "Include source code in the sourcemaps inside the emitted JavaScript."); + static inline const auto Ensure_that_each_file_can_be_safely_transpiled_without_relying_on_other_imports = diag(6645, DiagnosticCategory::Message, "Ensure_that_each_file_can_be_safely_transpiled_without_relying_on_other_imports_6645", "Ensure that each file can be safely transpiled without relying on other imports."); + static inline const auto Specify_what_JSX_code_is_generated = diag(6646, DiagnosticCategory::Message, "Specify_what_JSX_code_is_generated_6646", "Specify what JSX code is generated."); + static inline const auto Specify_the_JSX_factory_function_used_when_targeting_React_JSX_emit_e_g_React_createElement_or_h = diag(6647, DiagnosticCategory::Message, "Specify_the_JSX_factory_function_used_when_targeting_React_JSX_emit_e_g_React_createElement_or_h_6647", "Specify the JSX factory function used when targeting React JSX emit, e.g. 'React.createElement' or 'h'"); + static inline const auto Specify_the_JSX_Fragment_reference_used_for_fragments_when_targeting_React_JSX_emit_e_g_React_Fragment_or_Fragment = diag(6648, DiagnosticCategory::Message, "Specify_the_JSX_Fragment_reference_used_for_fragments_when_targeting_React_JSX_emit_e_g_React_Fragme_6648", "Specify the JSX Fragment reference used for fragments when targeting React JSX emit e.g. 'React.Fragment' or 'Fragment'."); + static inline const auto Specify_module_specifier_used_to_import_the_JSX_factory_functions_when_using_jsx_Colon_react_jsx_Asterisk = diag(6649, DiagnosticCategory::Message, "Specify_module_specifier_used_to_import_the_JSX_factory_functions_when_using_jsx_Colon_react_jsx_Ast_6649", "Specify module specifier used to import the JSX factory functions when using `jsx: react-jsx*`.`"); + static inline const auto Make_keyof_only_return_strings_instead_of_string_numbers_or_symbols_Legacy_option = diag(6650, DiagnosticCategory::Message, "Make_keyof_only_return_strings_instead_of_string_numbers_or_symbols_Legacy_option_6650", "Make keyof only return strings instead of string, numbers or symbols. Legacy option."); + static inline const auto Specify_a_set_of_bundled_library_declaration_files_that_describe_the_target_runtime_environment = diag(6651, DiagnosticCategory::Message, "Specify_a_set_of_bundled_library_declaration_files_that_describe_the_target_runtime_environment_6651", "Specify a set of bundled library declaration files that describe the target runtime environment."); + static inline const auto Print_the_names_of_emitted_files_after_a_compilation = diag(6652, DiagnosticCategory::Message, "Print_the_names_of_emitted_files_after_a_compilation_6652", "Print the names of emitted files after a compilation."); + static inline const auto Print_all_of_the_files_read_during_the_compilation = diag(6653, DiagnosticCategory::Message, "Print_all_of_the_files_read_during_the_compilation_6653", "Print all of the files read during the compilation."); + static inline const auto Set_the_language_of_the_messaging_from_TypeScript_This_does_not_affect_emit = diag(6654, DiagnosticCategory::Message, "Set_the_language_of_the_messaging_from_TypeScript_This_does_not_affect_emit_6654", "Set the language of the messaging from TypeScript. This does not affect emit."); + static inline const auto Specify_the_location_where_debugger_should_locate_map_files_instead_of_generated_locations = diag(6655, DiagnosticCategory::Message, "Specify_the_location_where_debugger_should_locate_map_files_instead_of_generated_locations_6655", "Specify the location where debugger should locate map files instead of generated locations."); + static inline const auto Specify_the_maximum_folder_depth_used_for_checking_JavaScript_files_from_node_modules_Only_applicable_with_allowJs = diag(6656, DiagnosticCategory::Message, "Specify_the_maximum_folder_depth_used_for_checking_JavaScript_files_from_node_modules_Only_applicabl_6656", "Specify the maximum folder depth used for checking JavaScript files from `node_modules`. Only applicable with `allowJs`."); + static inline const auto Specify_what_module_code_is_generated = diag(6657, DiagnosticCategory::Message, "Specify_what_module_code_is_generated_6657", "Specify what module code is generated."); + static inline const auto Specify_how_TypeScript_looks_up_a_file_from_a_given_module_specifier = diag(6658, DiagnosticCategory::Message, "Specify_how_TypeScript_looks_up_a_file_from_a_given_module_specifier_6658", "Specify how TypeScript looks up a file from a given module specifier."); + static inline const auto Set_the_newline_character_for_emitting_files = diag(6659, DiagnosticCategory::Message, "Set_the_newline_character_for_emitting_files_6659", "Set the newline character for emitting files."); + static inline const auto Disable_emitting_files_from_a_compilation = diag(6660, DiagnosticCategory::Message, "Disable_emitting_files_from_a_compilation_6660", "Disable emitting files from a compilation."); + static inline const auto Disable_generating_custom_helper_functions_like_extends_in_compiled_output = diag(6661, DiagnosticCategory::Message, "Disable_generating_custom_helper_functions_like_extends_in_compiled_output_6661", "Disable generating custom helper functions like `__extends` in compiled output."); + static inline const auto Disable_emitting_files_if_any_type_checking_errors_are_reported = diag(6662, DiagnosticCategory::Message, "Disable_emitting_files_if_any_type_checking_errors_are_reported_6662", "Disable emitting files if any type checking errors are reported."); + static inline const auto Disable_truncating_types_in_error_messages = diag(6663, DiagnosticCategory::Message, "Disable_truncating_types_in_error_messages_6663", "Disable truncating types in error messages."); + static inline const auto Enable_error_reporting_for_fallthrough_cases_in_switch_statements = diag(6664, DiagnosticCategory::Message, "Enable_error_reporting_for_fallthrough_cases_in_switch_statements_6664", "Enable error reporting for fallthrough cases in switch statements."); + static inline const auto Enable_error_reporting_for_expressions_and_declarations_with_an_implied_any_type = diag(6665, DiagnosticCategory::Message, "Enable_error_reporting_for_expressions_and_declarations_with_an_implied_any_type_6665", "Enable error reporting for expressions and declarations with an implied `any` type.."); + static inline const auto Ensure_overriding_members_in_derived_classes_are_marked_with_an_override_modifier = diag(6666, DiagnosticCategory::Message, "Ensure_overriding_members_in_derived_classes_are_marked_with_an_override_modifier_6666", "Ensure overriding members in derived classes are marked with an override modifier."); + static inline const auto Enable_error_reporting_for_codepaths_that_do_not_explicitly_return_in_a_function = diag(6667, DiagnosticCategory::Message, "Enable_error_reporting_for_codepaths_that_do_not_explicitly_return_in_a_function_6667", "Enable error reporting for codepaths that do not explicitly return in a function."); + static inline const auto Enable_error_reporting_when_this_is_given_the_type_any = diag(6668, DiagnosticCategory::Message, "Enable_error_reporting_when_this_is_given_the_type_any_6668", "Enable error reporting when `this` is given the type `any`."); + static inline const auto Disable_adding_use_strict_directives_in_emitted_JavaScript_files = diag(6669, DiagnosticCategory::Message, "Disable_adding_use_strict_directives_in_emitted_JavaScript_files_6669", "Disable adding 'use strict' directives in emitted JavaScript files."); + static inline const auto Disable_including_any_library_files_including_the_default_lib_d_ts = diag(6670, DiagnosticCategory::Message, "Disable_including_any_library_files_including_the_default_lib_d_ts_6670", "Disable including any library files, including the default lib.d.ts."); + static inline const auto Enforces_using_indexed_accessors_for_keys_declared_using_an_indexed_type = diag(6671, DiagnosticCategory::Message, "Enforces_using_indexed_accessors_for_keys_declared_using_an_indexed_type_6671", "Enforces using indexed accessors for keys declared using an indexed type"); + static inline const auto Disallow_import_s_require_s_or_reference_s_from_expanding_the_number_of_files_TypeScript_should_add_to_a_project = diag(6672, DiagnosticCategory::Message, "Disallow_import_s_require_s_or_reference_s_from_expanding_the_number_of_files_TypeScript_should_add__6672", "Disallow `import`s, `require`s or ``s from expanding the number of files TypeScript should add to a project."); + static inline const auto Disable_strict_checking_of_generic_signatures_in_function_types = diag(6673, DiagnosticCategory::Message, "Disable_strict_checking_of_generic_signatures_in_function_types_6673", "Disable strict checking of generic signatures in function types."); + static inline const auto Add_undefined_to_a_type_when_accessed_using_an_index = diag(6674, DiagnosticCategory::Message, "Add_undefined_to_a_type_when_accessed_using_an_index_6674", "Add `undefined` to a type when accessed using an index."); + static inline const auto Enable_error_reporting_when_a_local_variables_aren_t_read = diag(6675, DiagnosticCategory::Message, "Enable_error_reporting_when_a_local_variables_aren_t_read_6675", "Enable error reporting when a local variables aren't read."); + static inline const auto Raise_an_error_when_a_function_parameter_isn_t_read = diag(6676, DiagnosticCategory::Message, "Raise_an_error_when_a_function_parameter_isn_t_read_6676", "Raise an error when a function parameter isn't read"); + static inline const auto Deprecated_setting_Use_outFile_instead = diag(6677, DiagnosticCategory::Message, "Deprecated_setting_Use_outFile_instead_6677", "Deprecated setting. Use `outFile` instead."); + static inline const auto Specify_an_output_folder_for_all_emitted_files = diag(6678, DiagnosticCategory::Message, "Specify_an_output_folder_for_all_emitted_files_6678", "Specify an output folder for all emitted files."); + static inline const auto Specify_a_file_that_bundles_all_outputs_into_one_JavaScript_file_If_declaration_is_true_also_designates_a_file_that_bundles_all_d_ts_output = diag(6679, DiagnosticCategory::Message, "Specify_a_file_that_bundles_all_outputs_into_one_JavaScript_file_If_declaration_is_true_also_designa_6679", "Specify a file that bundles all outputs into one JavaScript file. If `declaration` is true, also designates a file that bundles all .d.ts output."); + static inline const auto Specify_a_set_of_entries_that_re_map_imports_to_additional_lookup_locations = diag(6680, DiagnosticCategory::Message, "Specify_a_set_of_entries_that_re_map_imports_to_additional_lookup_locations_6680", "Specify a set of entries that re-map imports to additional lookup locations."); + static inline const auto Specify_a_list_of_language_service_plugins_to_include = diag(6681, DiagnosticCategory::Message, "Specify_a_list_of_language_service_plugins_to_include_6681", "Specify a list of language service plugins to include."); + static inline const auto Disable_erasing_const_enum_declarations_in_generated_code = diag(6682, DiagnosticCategory::Message, "Disable_erasing_const_enum_declarations_in_generated_code_6682", "Disable erasing `const enum` declarations in generated code."); + static inline const auto Disable_resolving_symlinks_to_their_realpath_This_correlates_to_the_same_flag_in_node = diag(6683, DiagnosticCategory::Message, "Disable_resolving_symlinks_to_their_realpath_This_correlates_to_the_same_flag_in_node_6683", "Disable resolving symlinks to their realpath. This correlates to the same flag in node."); + static inline const auto Disable_wiping_the_console_in_watch_mode = diag(6684, DiagnosticCategory::Message, "Disable_wiping_the_console_in_watch_mode_6684", "Disable wiping the console in watch mode"); + static inline const auto Enable_color_and_formatting_in_TypeScript_s_output_to_make_compiler_errors_easier_to_read = diag(6685, DiagnosticCategory::Message, "Enable_color_and_formatting_in_TypeScript_s_output_to_make_compiler_errors_easier_to_read_6685", "Enable color and formatting in TypeScript's output to make compiler errors easier to read"); + static inline const auto Specify_the_object_invoked_for_createElement_This_only_applies_when_targeting_react_JSX_emit = diag(6686, DiagnosticCategory::Message, "Specify_the_object_invoked_for_createElement_This_only_applies_when_targeting_react_JSX_emit_6686", "Specify the object invoked for `createElement`. This only applies when targeting `react` JSX emit."); + static inline const auto Specify_an_array_of_objects_that_specify_paths_for_projects_Used_in_project_references = diag(6687, DiagnosticCategory::Message, "Specify_an_array_of_objects_that_specify_paths_for_projects_Used_in_project_references_6687", "Specify an array of objects that specify paths for projects. Used in project references."); + static inline const auto Disable_emitting_comments = diag(6688, DiagnosticCategory::Message, "Disable_emitting_comments_6688", "Disable emitting comments."); + static inline const auto Enable_importing_json_files = diag(6689, DiagnosticCategory::Message, "Enable_importing_json_files_6689", "Enable importing .json files"); + static inline const auto Specify_the_root_folder_within_your_source_files = diag(6690, DiagnosticCategory::Message, "Specify_the_root_folder_within_your_source_files_6690", "Specify the root folder within your source files."); + static inline const auto Allow_multiple_folders_to_be_treated_as_one_when_resolving_modules = diag(6691, DiagnosticCategory::Message, "Allow_multiple_folders_to_be_treated_as_one_when_resolving_modules_6691", "Allow multiple folders to be treated as one when resolving modules."); + static inline const auto Skip_type_checking_d_ts_files_that_are_included_with_TypeScript = diag(6692, DiagnosticCategory::Message, "Skip_type_checking_d_ts_files_that_are_included_with_TypeScript_6692", "Skip type checking .d.ts files that are included with TypeScript."); + static inline const auto Skip_type_checking_all_d_ts_files = diag(6693, DiagnosticCategory::Message, "Skip_type_checking_all_d_ts_files_6693", "Skip type checking all .d.ts files."); + static inline const auto Create_source_map_files_for_emitted_JavaScript_files = diag(6694, DiagnosticCategory::Message, "Create_source_map_files_for_emitted_JavaScript_files_6694", "Create source map files for emitted JavaScript files."); + static inline const auto Specify_the_root_path_for_debuggers_to_find_the_reference_source_code = diag(6695, DiagnosticCategory::Message, "Specify_the_root_path_for_debuggers_to_find_the_reference_source_code_6695", "Specify the root path for debuggers to find the reference source code."); + static inline const auto Check_that_the_arguments_for_bind_call_and_apply_methods_match_the_original_function = diag(6697, DiagnosticCategory::Message, "Check_that_the_arguments_for_bind_call_and_apply_methods_match_the_original_function_6697", "Check that the arguments for `bind`, `call`, and `apply` methods match the original function."); + static inline const auto When_assigning_functions_check_to_ensure_parameters_and_the_return_values_are_subtype_compatible = diag(6698, DiagnosticCategory::Message, "When_assigning_functions_check_to_ensure_parameters_and_the_return_values_are_subtype_compatible_6698", "When assigning functions, check to ensure parameters and the return values are subtype-compatible."); + static inline const auto When_type_checking_take_into_account_null_and_undefined = diag(6699, DiagnosticCategory::Message, "When_type_checking_take_into_account_null_and_undefined_6699", "When type checking, take into account `null` and `undefined`."); + static inline const auto Check_for_class_properties_that_are_declared_but_not_set_in_the_constructor = diag(6700, DiagnosticCategory::Message, "Check_for_class_properties_that_are_declared_but_not_set_in_the_constructor_6700", "Check for class properties that are declared but not set in the constructor."); + static inline const auto Disable_emitting_declarations_that_have_internal_in_their_JSDoc_comments = diag(6701, DiagnosticCategory::Message, "Disable_emitting_declarations_that_have_internal_in_their_JSDoc_comments_6701", "Disable emitting declarations that have `@internal` in their JSDoc comments."); + static inline const auto Disable_reporting_of_excess_property_errors_during_the_creation_of_object_literals = diag(6702, DiagnosticCategory::Message, "Disable_reporting_of_excess_property_errors_during_the_creation_of_object_literals_6702", "Disable reporting of excess property errors during the creation of object literals."); + static inline const auto Suppress_noImplicitAny_errors_when_indexing_objects_that_lack_index_signatures = diag(6703, DiagnosticCategory::Message, "Suppress_noImplicitAny_errors_when_indexing_objects_that_lack_index_signatures_6703", "Suppress `noImplicitAny` errors when indexing objects that lack index signatures."); + static inline const auto Synchronously_call_callbacks_and_update_the_state_of_directory_watchers_on_platforms_that_don_t_support_recursive_watching_natively = diag(6704, DiagnosticCategory::Message, "Synchronously_call_callbacks_and_update_the_state_of_directory_watchers_on_platforms_that_don_t_supp_6704", "Synchronously call callbacks and update the state of directory watchers on platforms that don`t support recursive watching natively."); + static inline const auto Set_the_JavaScript_language_version_for_emitted_JavaScript_and_include_compatible_library_declarations = diag(6705, DiagnosticCategory::Message, "Set_the_JavaScript_language_version_for_emitted_JavaScript_and_include_compatible_library_declaratio_6705", "Set the JavaScript language version for emitted JavaScript and include compatible library declarations."); + static inline const auto Log_paths_used_during_the_moduleResolution_process = diag(6706, DiagnosticCategory::Message, "Log_paths_used_during_the_moduleResolution_process_6706", "Log paths used during the `moduleResolution` process."); + static inline const auto Specify_the_folder_for_tsbuildinfo_incremental_compilation_files = diag(6707, DiagnosticCategory::Message, "Specify_the_folder_for_tsbuildinfo_incremental_compilation_files_6707", "Specify the folder for .tsbuildinfo incremental compilation files."); + static inline const auto Specify_options_for_automatic_acquisition_of_declaration_files = diag(6709, DiagnosticCategory::Message, "Specify_options_for_automatic_acquisition_of_declaration_files_6709", "Specify options for automatic acquisition of declaration files."); + static inline const auto Specify_multiple_folders_that_act_like_Slashnode_modules_Slash_types = diag(6710, DiagnosticCategory::Message, "Specify_multiple_folders_that_act_like_Slashnode_modules_Slash_types_6710", "Specify multiple folders that act like `./node_modules/@types`."); + static inline const auto Specify_type_package_names_to_be_included_without_being_referenced_in_a_source_file = diag(6711, DiagnosticCategory::Message, "Specify_type_package_names_to_be_included_without_being_referenced_in_a_source_file_6711", "Specify type package names to be included without being referenced in a source file."); + static inline const auto Emit_ECMAScript_standard_compliant_class_fields = diag(6712, DiagnosticCategory::Message, "Emit_ECMAScript_standard_compliant_class_fields_6712", "Emit ECMAScript-standard-compliant class fields."); + static inline const auto Enable_verbose_logging = diag(6713, DiagnosticCategory::Message, "Enable_verbose_logging_6713", "Enable verbose logging"); + static inline const auto Specify_how_directories_are_watched_on_systems_that_lack_recursive_file_watching_functionality = diag(6714, DiagnosticCategory::Message, "Specify_how_directories_are_watched_on_systems_that_lack_recursive_file_watching_functionality_6714", "Specify how directories are watched on systems that lack recursive file-watching functionality."); + static inline const auto Specify_how_the_TypeScript_watch_mode_works = diag(6715, DiagnosticCategory::Message, "Specify_how_the_TypeScript_watch_mode_works_6715", "Specify how the TypeScript watch mode works."); + static inline const auto Include_undefined_in_index_signature_results = diag(6716, DiagnosticCategory::Message, "Include_undefined_in_index_signature_results_6716", "Include 'undefined' in index signature results"); + static inline const auto Require_undeclared_properties_from_index_signatures_to_use_element_accesses = diag(6717, DiagnosticCategory::Message, "Require_undeclared_properties_from_index_signatures_to_use_element_accesses_6717", "Require undeclared properties from index signatures to use element accesses."); + static inline const auto Specify_emit_Slashchecking_behavior_for_imports_that_are_only_used_for_types = diag(6718, DiagnosticCategory::Message, "Specify_emit_Slashchecking_behavior_for_imports_that_are_only_used_for_types_6718", "Specify emit/checking behavior for imports that are only used for types"); + static inline const auto Type_catch_clause_variables_as_unknown_instead_of_any = diag(6803, DiagnosticCategory::Message, "Type_catch_clause_variables_as_unknown_instead_of_any_6803", "Type catch clause variables as 'unknown' instead of 'any'."); + static inline const auto one_of_Colon = diag(6900, DiagnosticCategory::Message, "one_of_Colon_6900", "one of:"); + static inline const auto one_or_more_Colon = diag(6901, DiagnosticCategory::Message, "one_or_more_Colon_6901", "one or more:"); + static inline const auto type_Colon = diag(6902, DiagnosticCategory::Message, "type_Colon_6902", "type:"); + static inline const auto default_Colon = diag(6903, DiagnosticCategory::Message, "default_Colon_6903", "default:"); + static inline const auto module_system_or_esModuleInterop = diag(6904, DiagnosticCategory::Message, "module_system_or_esModuleInterop_6904", "module === \"system\" or esModuleInterop"); + static inline const auto false_unless_strict_is_set = diag(6905, DiagnosticCategory::Message, "false_unless_strict_is_set_6905", "`false`, unless `strict` is set"); + static inline const auto false_unless_composite_is_set = diag(6906, DiagnosticCategory::Message, "false_unless_composite_is_set_6906", "`false`, unless `composite` is set"); + static inline const auto node_modules_bower_components_jspm_packages_plus_the_value_of_outDir_if_one_is_specified = diag(6907, DiagnosticCategory::Message, "node_modules_bower_components_jspm_packages_plus_the_value_of_outDir_if_one_is_specified_6907", "`[\"node_modules\", \"bower_components\", \"jspm_packages\"]`, plus the value of `outDir` if one is specified."); + static inline const auto if_files_is_specified_otherwise_Asterisk_Asterisk_Slash_Asterisk = diag(6908, DiagnosticCategory::Message, "if_files_is_specified_otherwise_Asterisk_Asterisk_Slash_Asterisk_6908", "`[]` if `files` is specified, otherwise `[\"**/*\"]`"); + static inline const auto true_if_composite_false_otherwise = diag(6909, DiagnosticCategory::Message, "true_if_composite_false_otherwise_6909", "`true` if `composite`, `false` otherwise"); + static inline const auto module_AMD_or_UMD_or_System_or_ES6_then_Classic_Otherwise_Node = diag(69010, DiagnosticCategory::Message, "module_AMD_or_UMD_or_System_or_ES6_then_Classic_Otherwise_Node_69010", "module === `AMD` or `UMD` or `System` or `ES6`, then `Classic`, Otherwise `Node`"); + static inline const auto Computed_from_the_list_of_input_files = diag(6911, DiagnosticCategory::Message, "Computed_from_the_list_of_input_files_6911", "Computed from the list of input files"); + static inline const auto Platform_specific = diag(6912, DiagnosticCategory::Message, "Platform_specific_6912", "Platform specific"); + static inline const auto You_can_learn_about_all_of_the_compiler_options_at_0 = diag(6913, DiagnosticCategory::Message, "You_can_learn_about_all_of_the_compiler_options_at_0_6913", "You can learn about all of the compiler options at {0}"); + static inline const auto Including_watch_w_will_start_watching_the_current_project_for_the_file_changes_Once_set_you_can_config_watch_mode_with_Colon = diag(6914, DiagnosticCategory::Message, "Including_watch_w_will_start_watching_the_current_project_for_the_file_changes_Once_set_you_can_conf_6914", "Including --watch, -w will start watching the current project for the file changes. Once set, you can config watch mode with:"); + static inline const auto Using_build_b_will_make_tsc_behave_more_like_a_build_orchestrator_than_a_compiler_This_is_used_to_trigger_building_composite_projects_which_you_can_learn_more_about_at_0 = diag(6915, DiagnosticCategory::Message, "Using_build_b_will_make_tsc_behave_more_like_a_build_orchestrator_than_a_compiler_This_is_used_to_tr_6915", + "Using --build, -b will make tsc behave more like a build orchestrator than a compiler. This is used to trigger building composite projects which you can learn more about at {0}"); + static inline const auto COMMON_COMMANDS = diag(6916, DiagnosticCategory::Message, "COMMON_COMMANDS_6916", "COMMON COMMANDS"); + static inline const auto ALL_COMPILER_OPTIONS = diag(6917, DiagnosticCategory::Message, "ALL_COMPILER_OPTIONS_6917", "ALL COMPILER OPTIONS"); + static inline const auto WATCH_OPTIONS = diag(6918, DiagnosticCategory::Message, "WATCH_OPTIONS_6918", "WATCH OPTIONS"); + static inline const auto BUILD_OPTIONS = diag(6919, DiagnosticCategory::Message, "BUILD_OPTIONS_6919", "BUILD OPTIONS"); + static inline const auto COMMON_COMPILER_OPTIONS = diag(6920, DiagnosticCategory::Message, "COMMON_COMPILER_OPTIONS_6920", "COMMON COMPILER OPTIONS"); + static inline const auto COMMAND_LINE_FLAGS = diag(6921, DiagnosticCategory::Message, "COMMAND_LINE_FLAGS_6921", "COMMAND LINE FLAGS"); + static inline const auto tsc_Colon_The_TypeScript_Compiler = diag(6922, DiagnosticCategory::Message, "tsc_Colon_The_TypeScript_Compiler_6922", "tsc: The TypeScript Compiler"); + static inline const auto Compiles_the_current_project_tsconfig_json_in_the_working_directory = diag(6923, DiagnosticCategory::Message, "Compiles_the_current_project_tsconfig_json_in_the_working_directory_6923", "Compiles the current project (tsconfig.json in the working directory.)"); + static inline const auto Ignoring_tsconfig_json_compiles_the_specified_files_with_default_compiler_options = diag(6924, DiagnosticCategory::Message, "Ignoring_tsconfig_json_compiles_the_specified_files_with_default_compiler_options_6924", "Ignoring tsconfig.json, compiles the specified files with default compiler options."); + static inline const auto Build_a_composite_project_in_the_working_directory = diag(6925, DiagnosticCategory::Message, "Build_a_composite_project_in_the_working_directory_6925", "Build a composite project in the working directory."); + static inline const auto Creates_a_tsconfig_json_with_the_recommended_settings_in_the_working_directory = diag(6926, DiagnosticCategory::Message, "Creates_a_tsconfig_json_with_the_recommended_settings_in_the_working_directory_6926", "Creates a tsconfig.json with the recommended settings in the working directory."); + static inline const auto Compiles_the_TypeScript_project_located_at_the_specified_path = diag(6927, DiagnosticCategory::Message, "Compiles_the_TypeScript_project_located_at_the_specified_path_6927", "Compiles the TypeScript project located at the specified path."); + static inline const auto An_expanded_version_of_this_information_showing_all_possible_compiler_options = diag(6928, DiagnosticCategory::Message, "An_expanded_version_of_this_information_showing_all_possible_compiler_options_6928", "An expanded version of this information, showing all possible compiler options"); + static inline const auto Compiles_the_current_project_with_additional_settings = diag(6929, DiagnosticCategory::Message, "Compiles_the_current_project_with_additional_settings_6929", "Compiles the current project, with additional settings."); + static inline const auto true_for_ES2022_and_above_including_ESNext = diag(6930, DiagnosticCategory::Message, "true_for_ES2022_and_above_including_ESNext_6930", "`true` for ES2022 and above, including ESNext."); + static inline const auto Variable_0_implicitly_has_an_1_type = diag(7005, DiagnosticCategory::Error, "Variable_0_implicitly_has_an_1_type_7005", "Variable '{0}' implicitly has an '{1}' type."); + static inline const auto Parameter_0_implicitly_has_an_1_type = diag(7006, DiagnosticCategory::Error, "Parameter_0_implicitly_has_an_1_type_7006", "Parameter '{0}' implicitly has an '{1}' type."); + static inline const auto Member_0_implicitly_has_an_1_type = diag(7008, DiagnosticCategory::Error, "Member_0_implicitly_has_an_1_type_7008", "Member '{0}' implicitly has an '{1}' type."); + static inline const auto new_expression_whose_target_lacks_a_construct_signature_implicitly_has_an_any_type = diag(7009, DiagnosticCategory::Error, "new_expression_whose_target_lacks_a_construct_signature_implicitly_has_an_any_type_7009", "'new' expression, whose target lacks a construct signature, implicitly has an 'any' type."); + static inline const auto _0_which_lacks_return_type_annotation_implicitly_has_an_1_return_type = diag(7010, DiagnosticCategory::Error, "_0_which_lacks_return_type_annotation_implicitly_has_an_1_return_type_7010", "'{0}', which lacks return-type annotation, implicitly has an '{1}' return type."); + static inline const auto Function_expression_which_lacks_return_type_annotation_implicitly_has_an_0_return_type = diag(7011, DiagnosticCategory::Error, "Function_expression_which_lacks_return_type_annotation_implicitly_has_an_0_return_type_7011", "Function expression, which lacks return-type annotation, implicitly has an '{0}' return type."); + static inline const auto Construct_signature_which_lacks_return_type_annotation_implicitly_has_an_any_return_type = diag(7013, DiagnosticCategory::Error, "Construct_signature_which_lacks_return_type_annotation_implicitly_has_an_any_return_type_7013", "Construct signature, which lacks return-type annotation, implicitly has an 'any' return type."); + static inline const auto Function_type_which_lacks_return_type_annotation_implicitly_has_an_0_return_type = diag(7014, DiagnosticCategory::Error, "Function_type_which_lacks_return_type_annotation_implicitly_has_an_0_return_type_7014", "Function type, which lacks return-type annotation, implicitly has an '{0}' return type."); + static inline const auto Element_implicitly_has_an_any_type_because_index_expression_is_not_of_type_number = diag(7015, DiagnosticCategory::Error, "Element_implicitly_has_an_any_type_because_index_expression_is_not_of_type_number_7015", "Element implicitly has an 'any' type because index expression is not of type 'number'."); + static inline const auto Could_not_find_a_declaration_file_for_module_0_1_implicitly_has_an_any_type = diag(7016, DiagnosticCategory::Error, "Could_not_find_a_declaration_file_for_module_0_1_implicitly_has_an_any_type_7016", "Could not find a declaration file for module '{0}'. '{1}' implicitly has an 'any' type."); + static inline const auto Element_implicitly_has_an_any_type_because_type_0_has_no_index_signature = diag(7017, DiagnosticCategory::Error, "Element_implicitly_has_an_any_type_because_type_0_has_no_index_signature_7017", "Element implicitly has an 'any' type because type '{0}' has no index signature."); + static inline const auto Object_literal_s_property_0_implicitly_has_an_1_type = diag(7018, DiagnosticCategory::Error, "Object_literal_s_property_0_implicitly_has_an_1_type_7018", "Object literal's property '{0}' implicitly has an '{1}' type."); + static inline const auto Rest_parameter_0_implicitly_has_an_any_type = diag(7019, DiagnosticCategory::Error, "Rest_parameter_0_implicitly_has_an_any_type_7019", "Rest parameter '{0}' implicitly has an 'any[]' type."); + static inline const auto Call_signature_which_lacks_return_type_annotation_implicitly_has_an_any_return_type = diag(7020, DiagnosticCategory::Error, "Call_signature_which_lacks_return_type_annotation_implicitly_has_an_any_return_type_7020", "Call signature, which lacks return-type annotation, implicitly has an 'any' return type."); + static inline const auto _0_implicitly_has_type_any_because_it_does_not_have_a_type_annotation_and_is_referenced_directly_or_indirectly_in_its_own_initializer = diag(7022, DiagnosticCategory::Error, "_0_implicitly_has_type_any_because_it_does_not_have_a_type_annotation_and_is_referenced_directly_or__7022", "'{0}' implicitly has type 'any' because it does not have a type annotation and is referenced directly or indirectly in its own initializer."); + static inline const auto _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 = diag(7023, DiagnosticCategory::Error, "_0_implicitly_has_return_type_any_because_it_does_not_have_a_return_type_annotation_and_is_reference_7023", + "'{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."); + static inline const auto Function_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 = diag(7024, DiagnosticCategory::Error, "Function_implicitly_has_return_type_any_because_it_does_not_have_a_return_type_annotation_and_is_ref_7024", + "Function 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."); + static inline const auto Generator_implicitly_has_yield_type_0_because_it_does_not_yield_any_values_Consider_supplying_a_return_type_annotation = diag(7025, DiagnosticCategory::Error, "Generator_implicitly_has_yield_type_0_because_it_does_not_yield_any_values_Consider_supplying_a_retu_7025", "Generator implicitly has yield type '{0}' because it does not yield any values. Consider supplying a return type annotation."); + static inline const auto JSX_element_implicitly_has_type_any_because_no_interface_JSX_0_exists = diag(7026, DiagnosticCategory::Error, "JSX_element_implicitly_has_type_any_because_no_interface_JSX_0_exists_7026", "JSX element implicitly has type 'any' because no interface 'JSX.{0}' exists."); + static inline const auto Unreachable_code_detected = diag(7027, DiagnosticCategory::Error, "Unreachable_code_detected_7027", "Unreachable code detected.", /*reportsUnnecessary*/ true); + static inline const auto Unused_label = diag(7028, DiagnosticCategory::Error, "Unused_label_7028", "Unused label.", /*reportsUnnecessary*/ true); + static inline const auto Fallthrough_case_in_switch = diag(7029, DiagnosticCategory::Error, "Fallthrough_case_in_switch_7029", "Fallthrough case in switch."); + static inline const auto Not_all_code_paths_return_a_value = diag(7030, DiagnosticCategory::Error, "Not_all_code_paths_return_a_value_7030", "Not all code paths return a value."); + static inline const auto Binding_element_0_implicitly_has_an_1_type = diag(7031, DiagnosticCategory::Error, "Binding_element_0_implicitly_has_an_1_type_7031", "Binding element '{0}' implicitly has an '{1}' type."); + static inline const auto Property_0_implicitly_has_type_any_because_its_set_accessor_lacks_a_parameter_type_annotation = diag(7032, DiagnosticCategory::Error, "Property_0_implicitly_has_type_any_because_its_set_accessor_lacks_a_parameter_type_annotation_7032", "Property '{0}' implicitly has type 'any', because its set accessor lacks a parameter type annotation."); + static inline const auto Property_0_implicitly_has_type_any_because_its_get_accessor_lacks_a_return_type_annotation = diag(7033, DiagnosticCategory::Error, "Property_0_implicitly_has_type_any_because_its_get_accessor_lacks_a_return_type_annotation_7033", "Property '{0}' implicitly has type 'any', because its get accessor lacks a return type annotation."); + static inline const auto Variable_0_implicitly_has_type_1_in_some_locations_where_its_type_cannot_be_determined = diag(7034, DiagnosticCategory::Error, "Variable_0_implicitly_has_type_1_in_some_locations_where_its_type_cannot_be_determined_7034", "Variable '{0}' implicitly has type '{1}' in some locations where its type cannot be determined."); + static inline const auto Try_npm_i_save_dev_types_Slash_1_if_it_exists_or_add_a_new_declaration_d_ts_file_containing_declare_module_0 = diag(7035, DiagnosticCategory::Error, "Try_npm_i_save_dev_types_Slash_1_if_it_exists_or_add_a_new_declaration_d_ts_file_containing_declare__7035", "Try `npm i --save-dev @types/{1}` if it exists or add a new declaration (.d.ts) file containing `declare module '{0}';`"); + static inline const auto Dynamic_import_s_specifier_must_be_of_type_string_but_here_has_type_0 = diag(7036, DiagnosticCategory::Error, "Dynamic_import_s_specifier_must_be_of_type_string_but_here_has_type_0_7036", "Dynamic import's specifier must be of type 'string', but here has type '{0}'."); + static inline const auto Enables_emit_interoperability_between_CommonJS_and_ES_Modules_via_creation_of_namespace_objects_for_all_imports_Implies_allowSyntheticDefaultImports = diag(7037, DiagnosticCategory::Message, "Enables_emit_interoperability_between_CommonJS_and_ES_Modules_via_creation_of_namespace_objects_for__7037", "Enables emit interoperability between CommonJS and ES Modules via creation of namespace objects for all imports. Implies 'allowSyntheticDefaultImports'."); + static inline const auto Type_originates_at_this_import_A_namespace_style_import_cannot_be_called_or_constructed_and_will_cause_a_failure_at_runtime_Consider_using_a_default_import_or_import_require_here_instead = diag(7038, DiagnosticCategory::Message, "Type_originates_at_this_import_A_namespace_style_import_cannot_be_called_or_constructed_and_will_cau_7038", + "Type originates at this import. A namespace-style import cannot be called or constructed, and will cause a failure at runtime. Consider using a default import or import require here instead."); + static inline const auto Mapped_object_type_implicitly_has_an_any_template_type = diag(7039, DiagnosticCategory::Error, "Mapped_object_type_implicitly_has_an_any_template_type_7039", "Mapped object type implicitly has an 'any' template type."); + static inline const auto If_the_0_package_actually_exposes_this_module_consider_sending_a_pull_request_to_amend_https_Colon_Slash_Slashgithub_com_SlashDefinitelyTyped_SlashDefinitelyTyped_Slashtree_Slashmaster_Slashtypes_Slash_1 = diag(7040, DiagnosticCategory::Error, "If_the_0_package_actually_exposes_this_module_consider_sending_a_pull_request_to_amend_https_Colon_S_7040", + "If the '{0}' package actually exposes this module, consider sending a pull request to amend 'https://github.com/DefinitelyTyped/DefinitelyTyped/tree/master/types/{1}'"); + static inline const auto The_containing_arrow_function_captures_the_global_value_of_this = diag(7041, DiagnosticCategory::Error, "The_containing_arrow_function_captures_the_global_value_of_this_7041", "The containing arrow function captures the global value of 'this'."); + static inline const auto Module_0_was_resolved_to_1_but_resolveJsonModule_is_not_used = diag(7042, DiagnosticCategory::Error, "Module_0_was_resolved_to_1_but_resolveJsonModule_is_not_used_7042", "Module '{0}' was resolved to '{1}', but '--resolveJsonModule' is not used."); + static inline const auto Variable_0_implicitly_has_an_1_type_but_a_better_type_may_be_inferred_from_usage = diag(7043, DiagnosticCategory::Suggestion, "Variable_0_implicitly_has_an_1_type_but_a_better_type_may_be_inferred_from_usage_7043", "Variable '{0}' implicitly has an '{1}' type, but a better type may be inferred from usage."); + static inline const auto Parameter_0_implicitly_has_an_1_type_but_a_better_type_may_be_inferred_from_usage = diag(7044, DiagnosticCategory::Suggestion, "Parameter_0_implicitly_has_an_1_type_but_a_better_type_may_be_inferred_from_usage_7044", "Parameter '{0}' implicitly has an '{1}' type, but a better type may be inferred from usage."); + static inline const auto Member_0_implicitly_has_an_1_type_but_a_better_type_may_be_inferred_from_usage = diag(7045, DiagnosticCategory::Suggestion, "Member_0_implicitly_has_an_1_type_but_a_better_type_may_be_inferred_from_usage_7045", "Member '{0}' implicitly has an '{1}' type, but a better type may be inferred from usage."); + static inline const auto Variable_0_implicitly_has_type_1_in_some_locations_but_a_better_type_may_be_inferred_from_usage = diag(7046, DiagnosticCategory::Suggestion, "Variable_0_implicitly_has_type_1_in_some_locations_but_a_better_type_may_be_inferred_from_usage_7046", "Variable '{0}' implicitly has type '{1}' in some locations, but a better type may be inferred from usage."); + static inline const auto Rest_parameter_0_implicitly_has_an_any_type_but_a_better_type_may_be_inferred_from_usage = diag(7047, DiagnosticCategory::Suggestion, "Rest_parameter_0_implicitly_has_an_any_type_but_a_better_type_may_be_inferred_from_usage_7047", "Rest parameter '{0}' implicitly has an 'any[]' type, but a better type may be inferred from usage."); + static inline const auto Property_0_implicitly_has_type_any_but_a_better_type_for_its_get_accessor_may_be_inferred_from_usage = diag(7048, DiagnosticCategory::Suggestion, "Property_0_implicitly_has_type_any_but_a_better_type_for_its_get_accessor_may_be_inferred_from_usage_7048", "Property '{0}' implicitly has type 'any', but a better type for its get accessor may be inferred from usage."); + static inline const auto Property_0_implicitly_has_type_any_but_a_better_type_for_its_set_accessor_may_be_inferred_from_usage = diag(7049, DiagnosticCategory::Suggestion, "Property_0_implicitly_has_type_any_but_a_better_type_for_its_set_accessor_may_be_inferred_from_usage_7049", "Property '{0}' implicitly has type 'any', but a better type for its set accessor may be inferred from usage."); + static inline const auto _0_implicitly_has_an_1_return_type_but_a_better_type_may_be_inferred_from_usage = diag(7050, DiagnosticCategory::Suggestion, "_0_implicitly_has_an_1_return_type_but_a_better_type_may_be_inferred_from_usage_7050", "'{0}' implicitly has an '{1}' return type, but a better type may be inferred from usage."); + static inline const auto Parameter_has_a_name_but_no_type_Did_you_mean_0_Colon_1 = diag(7051, DiagnosticCategory::Error, "Parameter_has_a_name_but_no_type_Did_you_mean_0_Colon_1_7051", "Parameter has a name but no type. Did you mean '{0}: {1}'?"); + static inline const auto Element_implicitly_has_an_any_type_because_type_0_has_no_index_signature_Did_you_mean_to_call_1 = diag(7052, DiagnosticCategory::Error, "Element_implicitly_has_an_any_type_because_type_0_has_no_index_signature_Did_you_mean_to_call_1_7052", "Element implicitly has an 'any' type because type '{0}' has no index signature. Did you mean to call '{1}'?"); + static inline const auto Element_implicitly_has_an_any_type_because_expression_of_type_0_can_t_be_used_to_index_type_1 = diag(7053, DiagnosticCategory::Error, "Element_implicitly_has_an_any_type_because_expression_of_type_0_can_t_be_used_to_index_type_1_7053", "Element implicitly has an 'any' type because expression of type '{0}' can't be used to index type '{1}'."); + static inline const auto No_index_signature_with_a_parameter_of_type_0_was_found_on_type_1 = diag(7054, DiagnosticCategory::Error, "No_index_signature_with_a_parameter_of_type_0_was_found_on_type_1_7054", "No index signature with a parameter of type '{0}' was found on type '{1}'."); + static inline const auto _0_which_lacks_return_type_annotation_implicitly_has_an_1_yield_type = diag(7055, DiagnosticCategory::Error, "_0_which_lacks_return_type_annotation_implicitly_has_an_1_yield_type_7055", "'{0}', which lacks return-type annotation, implicitly has an '{1}' yield type."); + static inline const auto The_inferred_type_of_this_node_exceeds_the_maximum_length_the_compiler_will_serialize_An_explicit_type_annotation_is_needed = diag(7056, DiagnosticCategory::Error, "The_inferred_type_of_this_node_exceeds_the_maximum_length_the_compiler_will_serialize_An_explicit_ty_7056", "The inferred type of this node exceeds the maximum length the compiler will serialize. An explicit type annotation is needed."); + static inline const auto yield_expression_implicitly_results_in_an_any_type_because_its_containing_generator_lacks_a_return_type_annotation = diag(7057, DiagnosticCategory::Error, "yield_expression_implicitly_results_in_an_any_type_because_its_containing_generator_lacks_a_return_t_7057", "'yield' expression implicitly results in an 'any' type because its containing generator lacks a return-type annotation."); + static inline const auto If_the_0_package_actually_exposes_this_module_try_adding_a_new_declaration_d_ts_file_containing_declare_module_1 = diag(7058, DiagnosticCategory::Error, "If_the_0_package_actually_exposes_this_module_try_adding_a_new_declaration_d_ts_file_containing_decl_7058", "If the '{0}' package actually exposes this module, try adding a new declaration (.d.ts) file containing `declare module '{1}';`"); + static inline const auto This_syntax_is_reserved_in_files_with_the_mts_or_cts_extension_Use_an_as_expression_instead = diag(7059, DiagnosticCategory::Error, "This_syntax_is_reserved_in_files_with_the_mts_or_cts_extension_Use_an_as_expression_instead_7059", "This syntax is reserved in files with the .mts or .cts extension. Use an `as` expression instead."); + static inline const auto This_syntax_is_reserved_in_files_with_the_mts_or_cts_extension_Add_a_trailing_comma_or_explicit_constraint = diag(7060, DiagnosticCategory::Error, "This_syntax_is_reserved_in_files_with_the_mts_or_cts_extension_Add_a_trailing_comma_or_explicit_cons_7060", "This syntax is reserved in files with the .mts or .cts extension. Add a trailing comma or explicit constraint."); + static inline const auto A_mapped_type_may_not_declare_properties_or_methods = diag(7061, DiagnosticCategory::Error, "A_mapped_type_may_not_declare_properties_or_methods_7061", "A mapped type may not declare properties or methods."); + static inline const auto JSON_imports_are_experimental_in_ES_module_mode_imports = diag(7062, DiagnosticCategory::Error, "JSON_imports_are_experimental_in_ES_module_mode_imports_7062", "JSON imports are experimental in ES module mode imports."); + static inline const auto You_cannot_rename_this_element = diag(8000, DiagnosticCategory::Error, "You_cannot_rename_this_element_8000", "You cannot rename this element."); + static inline const auto You_cannot_rename_elements_that_are_defined_in_the_standard_TypeScript_library = diag(8001, DiagnosticCategory::Error, "You_cannot_rename_elements_that_are_defined_in_the_standard_TypeScript_library_8001", "You cannot rename elements that are defined in the standard TypeScript library."); + static inline const auto import_can_only_be_used_in_TypeScript_files = diag(8002, DiagnosticCategory::Error, "import_can_only_be_used_in_TypeScript_files_8002", "'import ... =' can only be used in TypeScript files."); + static inline const auto export_can_only_be_used_in_TypeScript_files = diag(8003, DiagnosticCategory::Error, "export_can_only_be_used_in_TypeScript_files_8003", "'export =' can only be used in TypeScript files."); + static inline const auto Type_parameter_declarations_can_only_be_used_in_TypeScript_files = diag(8004, DiagnosticCategory::Error, "Type_parameter_declarations_can_only_be_used_in_TypeScript_files_8004", "Type parameter declarations can only be used in TypeScript files."); + static inline const auto implements_clauses_can_only_be_used_in_TypeScript_files = diag(8005, DiagnosticCategory::Error, "implements_clauses_can_only_be_used_in_TypeScript_files_8005", "'implements' clauses can only be used in TypeScript files."); + static inline const auto _0_declarations_can_only_be_used_in_TypeScript_files = diag(8006, DiagnosticCategory::Error, "_0_declarations_can_only_be_used_in_TypeScript_files_8006", "'{0}' declarations can only be used in TypeScript files."); + static inline const auto Type_aliases_can_only_be_used_in_TypeScript_files = diag(8008, DiagnosticCategory::Error, "Type_aliases_can_only_be_used_in_TypeScript_files_8008", "Type aliases can only be used in TypeScript files."); + static inline const auto The_0_modifier_can_only_be_used_in_TypeScript_files = diag(8009, DiagnosticCategory::Error, "The_0_modifier_can_only_be_used_in_TypeScript_files_8009", "The '{0}' modifier can only be used in TypeScript files."); + static inline const auto Type_annotations_can_only_be_used_in_TypeScript_files = diag(8010, DiagnosticCategory::Error, "Type_annotations_can_only_be_used_in_TypeScript_files_8010", "Type annotations can only be used in TypeScript files."); + static inline const auto Type_arguments_can_only_be_used_in_TypeScript_files = diag(8011, DiagnosticCategory::Error, "Type_arguments_can_only_be_used_in_TypeScript_files_8011", "Type arguments can only be used in TypeScript files."); + static inline const auto Parameter_modifiers_can_only_be_used_in_TypeScript_files = diag(8012, DiagnosticCategory::Error, "Parameter_modifiers_can_only_be_used_in_TypeScript_files_8012", "Parameter modifiers can only be used in TypeScript files."); + static inline const auto Non_null_assertions_can_only_be_used_in_TypeScript_files = diag(8013, DiagnosticCategory::Error, "Non_null_assertions_can_only_be_used_in_TypeScript_files_8013", "Non-null assertions can only be used in TypeScript files."); + static inline const auto Type_assertion_expressions_can_only_be_used_in_TypeScript_files = diag(8016, DiagnosticCategory::Error, "Type_assertion_expressions_can_only_be_used_in_TypeScript_files_8016", "Type assertion expressions can only be used in TypeScript files."); + static inline const auto Octal_literal_types_must_use_ES2015_syntax_Use_the_syntax_0 = diag(8017, DiagnosticCategory::Error, "Octal_literal_types_must_use_ES2015_syntax_Use_the_syntax_0_8017", "Octal literal types must use ES2015 syntax. Use the syntax '{0}'."); + static inline const auto Octal_literals_are_not_allowed_in_enums_members_initializer_Use_the_syntax_0 = diag(8018, DiagnosticCategory::Error, "Octal_literals_are_not_allowed_in_enums_members_initializer_Use_the_syntax_0_8018", "Octal literals are not allowed in enums members initializer. Use the syntax '{0}'."); + static inline const auto Report_errors_in_js_files = diag(8019, DiagnosticCategory::Message, "Report_errors_in_js_files_8019", "Report errors in .js files."); + static inline const auto JSDoc_types_can_only_be_used_inside_documentation_comments = diag(8020, DiagnosticCategory::Error, "JSDoc_types_can_only_be_used_inside_documentation_comments_8020", "JSDoc types can only be used inside documentation comments."); + static inline const auto JSDoc_typedef_tag_should_either_have_a_type_annotation_or_be_followed_by_property_or_member_tags = diag(8021, DiagnosticCategory::Error, "JSDoc_typedef_tag_should_either_have_a_type_annotation_or_be_followed_by_property_or_member_tags_8021", "JSDoc '@typedef' tag should either have a type annotation or be followed by '@property' or '@member' tags."); + static inline const auto JSDoc_0_is_not_attached_to_a_class = diag(8022, DiagnosticCategory::Error, "JSDoc_0_is_not_attached_to_a_class_8022", "JSDoc '@{0}' is not attached to a class."); + static inline const auto JSDoc_0_1_does_not_match_the_extends_2_clause = diag(8023, DiagnosticCategory::Error, "JSDoc_0_1_does_not_match_the_extends_2_clause_8023", "JSDoc '@{0} {1}' does not match the 'extends {2}' clause."); + static inline const auto JSDoc_param_tag_has_name_0_but_there_is_no_parameter_with_that_name = diag(8024, DiagnosticCategory::Error, "JSDoc_param_tag_has_name_0_but_there_is_no_parameter_with_that_name_8024", "JSDoc '@param' tag has name '{0}', but there is no parameter with that name."); + static inline const auto Class_declarations_cannot_have_more_than_one_augments_or_extends_tag = diag(8025, DiagnosticCategory::Error, "Class_declarations_cannot_have_more_than_one_augments_or_extends_tag_8025", "Class declarations cannot have more than one '@augments' or '@extends' tag."); + static inline const auto Expected_0_type_arguments_provide_these_with_an_extends_tag = diag(8026, DiagnosticCategory::Error, "Expected_0_type_arguments_provide_these_with_an_extends_tag_8026", "Expected {0} type arguments; provide these with an '@extends' tag."); + static inline const auto Expected_0_1_type_arguments_provide_these_with_an_extends_tag = diag(8027, DiagnosticCategory::Error, "Expected_0_1_type_arguments_provide_these_with_an_extends_tag_8027", "Expected {0}-{1} type arguments; provide these with an '@extends' tag."); + static inline const auto JSDoc_may_only_appear_in_the_last_parameter_of_a_signature = diag(8028, DiagnosticCategory::Error, "JSDoc_may_only_appear_in_the_last_parameter_of_a_signature_8028", "JSDoc '...' may only appear in the last parameter of a signature."); + static inline const auto JSDoc_param_tag_has_name_0_but_there_is_no_parameter_with_that_name_It_would_match_arguments_if_it_had_an_array_type = diag(8029, DiagnosticCategory::Error, "JSDoc_param_tag_has_name_0_but_there_is_no_parameter_with_that_name_It_would_match_arguments_if_it_h_8029", "JSDoc '@param' tag has name '{0}', but there is no parameter with that name. It would match 'arguments' if it had an array type."); + static inline const auto The_type_of_a_function_declaration_must_match_the_function_s_signature = diag(8030, DiagnosticCategory::Error, "The_type_of_a_function_declaration_must_match_the_function_s_signature_8030", "The type of a function declaration must match the function's signature."); + static inline const auto You_cannot_rename_a_module_via_a_global_import = diag(8031, DiagnosticCategory::Error, "You_cannot_rename_a_module_via_a_global_import_8031", "You cannot rename a module via a global import."); + static inline const auto Qualified_name_0_is_not_allowed_without_a_leading_param_object_1 = diag(8032, DiagnosticCategory::Error, "Qualified_name_0_is_not_allowed_without_a_leading_param_object_1_8032", "Qualified name '{0}' is not allowed without a leading '@param {object} {1}'."); + static inline const auto A_JSDoc_typedef_comment_may_not_contain_multiple_type_tags = diag(8033, DiagnosticCategory::Error, "A_JSDoc_typedef_comment_may_not_contain_multiple_type_tags_8033", "A JSDoc '@typedef' comment may not contain multiple '@type' tags."); + static inline const auto The_tag_was_first_specified_here = diag(8034, DiagnosticCategory::Error, "The_tag_was_first_specified_here_8034", "The tag was first specified here."); + static inline const auto Declaration_emit_for_this_file_requires_using_private_name_0_An_explicit_type_annotation_may_unblock_declaration_emit = diag(9005, DiagnosticCategory::Error, "Declaration_emit_for_this_file_requires_using_private_name_0_An_explicit_type_annotation_may_unblock_9005", "Declaration emit for this file requires using private name '{0}'. An explicit type annotation may unblock declaration emit."); + static inline const auto Declaration_emit_for_this_file_requires_using_private_name_0_from_module_1_An_explicit_type_annotation_may_unblock_declaration_emit = diag(9006, DiagnosticCategory::Error, "Declaration_emit_for_this_file_requires_using_private_name_0_from_module_1_An_explicit_type_annotati_9006", "Declaration emit for this file requires using private name '{0}' from module '{1}'. An explicit type annotation may unblock declaration emit."); + static inline const auto JSX_attributes_must_only_be_assigned_a_non_empty_expression = diag(17000, DiagnosticCategory::Error, "JSX_attributes_must_only_be_assigned_a_non_empty_expression_17000", "JSX attributes must only be assigned a non-empty 'expression'."); + static inline const auto JSX_elements_cannot_have_multiple_attributes_with_the_same_name = diag(17001, DiagnosticCategory::Error, "JSX_elements_cannot_have_multiple_attributes_with_the_same_name_17001", "JSX elements cannot have multiple attributes with the same name."); + static inline const auto Expected_corresponding_JSX_closing_tag_for_0 = diag(17002, DiagnosticCategory::Error, "Expected_corresponding_JSX_closing_tag_for_0_17002", "Expected corresponding JSX closing tag for '{0}'."); + static inline const auto Cannot_use_JSX_unless_the_jsx_flag_is_provided = diag(17004, DiagnosticCategory::Error, "Cannot_use_JSX_unless_the_jsx_flag_is_provided_17004", "Cannot use JSX unless the '--jsx' flag is provided."); + static inline const auto A_constructor_cannot_contain_a_super_call_when_its_class_extends_null = diag(17005, DiagnosticCategory::Error, "A_constructor_cannot_contain_a_super_call_when_its_class_extends_null_17005", "A constructor cannot contain a 'super' call when its class extends 'null'."); + static inline const auto An_unary_expression_with_the_0_operator_is_not_allowed_in_the_left_hand_side_of_an_exponentiation_expression_Consider_enclosing_the_expression_in_parentheses = diag(17006, DiagnosticCategory::Error, "An_unary_expression_with_the_0_operator_is_not_allowed_in_the_left_hand_side_of_an_exponentiation_ex_17006", + "An unary expression with the '{0}' operator is not allowed in the left-hand side of an exponentiation expression. Consider enclosing the expression in parentheses."); + static inline const auto A_type_assertion_expression_is_not_allowed_in_the_left_hand_side_of_an_exponentiation_expression_Consider_enclosing_the_expression_in_parentheses = diag(17007, DiagnosticCategory::Error, "A_type_assertion_expression_is_not_allowed_in_the_left_hand_side_of_an_exponentiation_expression_Con_17007", "A type assertion expression is not allowed in the left-hand side of an exponentiation expression. Consider enclosing the expression in parentheses."); + static inline const auto JSX_element_0_has_no_corresponding_closing_tag = diag(17008, DiagnosticCategory::Error, "JSX_element_0_has_no_corresponding_closing_tag_17008", "JSX element '{0}' has no corresponding closing tag."); + static inline const auto super_must_be_called_before_accessing_this_in_the_constructor_of_a_derived_class = diag(17009, DiagnosticCategory::Error, "super_must_be_called_before_accessing_this_in_the_constructor_of_a_derived_class_17009", "'super' must be called before accessing 'this' in the constructor of a derived class."); + static inline const auto Unknown_type_acquisition_option_0 = diag(17010, DiagnosticCategory::Error, "Unknown_type_acquisition_option_0_17010", "Unknown type acquisition option '{0}'."); + static inline const auto super_must_be_called_before_accessing_a_property_of_super_in_the_constructor_of_a_derived_class = diag(17011, DiagnosticCategory::Error, "super_must_be_called_before_accessing_a_property_of_super_in_the_constructor_of_a_derived_class_17011", "'super' must be called before accessing a property of 'super' in the constructor of a derived class."); + static inline const auto _0_is_not_a_valid_meta_property_for_keyword_1_Did_you_mean_2 = diag(17012, DiagnosticCategory::Error, "_0_is_not_a_valid_meta_property_for_keyword_1_Did_you_mean_2_17012", "'{0}' is not a valid meta-property for keyword '{1}'. Did you mean '{2}'?"); + static inline const auto Meta_property_0_is_only_allowed_in_the_body_of_a_function_declaration_function_expression_or_constructor = diag(17013, DiagnosticCategory::Error, "Meta_property_0_is_only_allowed_in_the_body_of_a_function_declaration_function_expression_or_constru_17013", "Meta-property '{0}' is only allowed in the body of a function declaration, function expression, or constructor."); + static inline const auto JSX_fragment_has_no_corresponding_closing_tag = diag(17014, DiagnosticCategory::Error, "JSX_fragment_has_no_corresponding_closing_tag_17014", "JSX fragment has no corresponding closing tag."); + static inline const auto Expected_corresponding_closing_tag_for_JSX_fragment = diag(17015, DiagnosticCategory::Error, "Expected_corresponding_closing_tag_for_JSX_fragment_17015", "Expected corresponding closing tag for JSX fragment."); + static inline const auto The_jsxFragmentFactory_compiler_option_must_be_provided_to_use_JSX_fragments_with_the_jsxFactory_compiler_option = diag(17016, DiagnosticCategory::Error, "The_jsxFragmentFactory_compiler_option_must_be_provided_to_use_JSX_fragments_with_the_jsxFactory_com_17016", "The 'jsxFragmentFactory' compiler option must be provided to use JSX fragments with the 'jsxFactory' compiler option."); + static inline const auto An_jsxFrag_pragma_is_required_when_using_an_jsx_pragma_with_JSX_fragments = diag(17017, DiagnosticCategory::Error, "An_jsxFrag_pragma_is_required_when_using_an_jsx_pragma_with_JSX_fragments_17017", "An @jsxFrag pragma is required when using an @jsx pragma with JSX fragments."); + static inline const auto Unknown_type_acquisition_option_0_Did_you_mean_1 = diag(17018, DiagnosticCategory::Error, "Unknown_type_acquisition_option_0_Did_you_mean_1_17018", "Unknown type acquisition option '{0}'. Did you mean '{1}'?"); + static inline const auto Circularity_detected_while_resolving_configuration_Colon_0 = diag(18000, DiagnosticCategory::Error, "Circularity_detected_while_resolving_configuration_Colon_0_18000", "Circularity detected while resolving configuration: {0}"); + static inline const auto The_files_list_in_config_file_0_is_empty = diag(18002, DiagnosticCategory::Error, "The_files_list_in_config_file_0_is_empty_18002", "The 'files' list in config file '{0}' is empty."); + static inline const auto No_inputs_were_found_in_config_file_0_Specified_include_paths_were_1_and_exclude_paths_were_2 = diag(18003, DiagnosticCategory::Error, "No_inputs_were_found_in_config_file_0_Specified_include_paths_were_1_and_exclude_paths_were_2_18003", "No inputs were found in config file '{0}'. Specified 'include' paths were '{1}' and 'exclude' paths were '{2}'."); + static inline const auto File_is_a_CommonJS_module_it_may_be_converted_to_an_ES_module = diag(80001, DiagnosticCategory::Suggestion, "File_is_a_CommonJS_module_it_may_be_converted_to_an_ES_module_80001", "File is a CommonJS module; it may be converted to an ES module."); + static inline const auto This_constructor_function_may_be_converted_to_a_class_declaration = diag(80002, DiagnosticCategory::Suggestion, "This_constructor_function_may_be_converted_to_a_class_declaration_80002", "This constructor function may be converted to a class declaration."); + static inline const auto Import_may_be_converted_to_a_default_import = diag(80003, DiagnosticCategory::Suggestion, "Import_may_be_converted_to_a_default_import_80003", "Import may be converted to a default import."); + static inline const auto JSDoc_types_may_be_moved_to_TypeScript_types = diag(80004, DiagnosticCategory::Suggestion, "JSDoc_types_may_be_moved_to_TypeScript_types_80004", "JSDoc types may be moved to TypeScript types."); + static inline const auto require_call_may_be_converted_to_an_import = diag(80005, DiagnosticCategory::Suggestion, "require_call_may_be_converted_to_an_import_80005", "'require' call may be converted to an import."); + static inline const auto This_may_be_converted_to_an_async_function = diag(80006, DiagnosticCategory::Suggestion, "This_may_be_converted_to_an_async_function_80006", "This may be converted to an async function."); + static inline const auto await_has_no_effect_on_the_type_of_this_expression = diag(80007, DiagnosticCategory::Suggestion, "await_has_no_effect_on_the_type_of_this_expression_80007", "'await' has no effect on the type of this expression."); + static inline const auto Numeric_literals_with_absolute_values_equal_to_2_53_or_greater_are_too_large_to_be_represented_accurately_as_integers = diag(80008, DiagnosticCategory::Suggestion, "Numeric_literals_with_absolute_values_equal_to_2_53_or_greater_are_too_large_to_be_represented_accur_80008", "Numeric literals with absolute values equal to 2^53 or greater are too large to be represented accurately as integers."); + static inline const auto Add_missing_super_call = diag(90001, DiagnosticCategory::Message, "Add_missing_super_call_90001", "Add missing 'super()' call"); + static inline const auto Make_super_call_the_first_statement_in_the_constructor = diag(90002, DiagnosticCategory::Message, "Make_super_call_the_first_statement_in_the_constructor_90002", "Make 'super()' call the first statement in the constructor"); + static inline const auto Change_extends_to_implements = diag(90003, DiagnosticCategory::Message, "Change_extends_to_implements_90003", "Change 'extends' to 'implements'"); + static inline const auto Remove_unused_declaration_for_Colon_0 = diag(90004, DiagnosticCategory::Message, "Remove_unused_declaration_for_Colon_0_90004", "Remove unused declaration for: '{0}'"); + static inline const auto Remove_import_from_0 = diag(90005, DiagnosticCategory::Message, "Remove_import_from_0_90005", "Remove import from '{0}'"); + static inline const auto Implement_interface_0 = diag(90006, DiagnosticCategory::Message, "Implement_interface_0_90006", "Implement interface '{0}'"); + static inline const auto Implement_inherited_abstract_class = diag(90007, DiagnosticCategory::Message, "Implement_inherited_abstract_class_90007", "Implement inherited abstract class"); + static inline const auto Add_0_to_unresolved_variable = diag(90008, DiagnosticCategory::Message, "Add_0_to_unresolved_variable_90008", "Add '{0}.' to unresolved variable"); + static inline const auto Remove_variable_statement = diag(90010, DiagnosticCategory::Message, "Remove_variable_statement_90010", "Remove variable statement"); + static inline const auto Remove_template_tag = diag(90011, DiagnosticCategory::Message, "Remove_template_tag_90011", "Remove template tag"); + static inline const auto Remove_type_parameters = diag(90012, DiagnosticCategory::Message, "Remove_type_parameters_90012", "Remove type parameters"); + static inline const auto Import_0_from_module_1 = diag(90013, DiagnosticCategory::Message, "Import_0_from_module_1_90013", "Import '{0}' from module \"{1}\""); + static inline const auto Change_0_to_1 = diag(90014, DiagnosticCategory::Message, "Change_0_to_1_90014", "Change '{0}' to '{1}'"); + static inline const auto Add_0_to_existing_import_declaration_from_1 = diag(90015, DiagnosticCategory::Message, "Add_0_to_existing_import_declaration_from_1_90015", "Add '{0}' to existing import declaration from \"{1}\""); + static inline const auto Declare_property_0 = diag(90016, DiagnosticCategory::Message, "Declare_property_0_90016", "Declare property '{0}'"); + static inline const auto Add_index_signature_for_property_0 = diag(90017, DiagnosticCategory::Message, "Add_index_signature_for_property_0_90017", "Add index signature for property '{0}'"); + static inline const auto Disable_checking_for_this_file = diag(90018, DiagnosticCategory::Message, "Disable_checking_for_this_file_90018", "Disable checking for this file"); + static inline const auto Ignore_this_error_message = diag(90019, DiagnosticCategory::Message, "Ignore_this_error_message_90019", "Ignore this error message"); + static inline const auto Initialize_property_0_in_the_constructor = diag(90020, DiagnosticCategory::Message, "Initialize_property_0_in_the_constructor_90020", "Initialize property '{0}' in the constructor"); + static inline const auto Initialize_static_property_0 = diag(90021, DiagnosticCategory::Message, "Initialize_static_property_0_90021", "Initialize static property '{0}'"); + static inline const auto Change_spelling_to_0 = diag(90022, DiagnosticCategory::Message, "Change_spelling_to_0_90022", "Change spelling to '{0}'"); + static inline const auto Declare_method_0 = diag(90023, DiagnosticCategory::Message, "Declare_method_0_90023", "Declare method '{0}'"); + static inline const auto Declare_static_method_0 = diag(90024, DiagnosticCategory::Message, "Declare_static_method_0_90024", "Declare static method '{0}'"); + static inline const auto Prefix_0_with_an_underscore = diag(90025, DiagnosticCategory::Message, "Prefix_0_with_an_underscore_90025", "Prefix '{0}' with an underscore"); + static inline const auto Rewrite_as_the_indexed_access_type_0 = diag(90026, DiagnosticCategory::Message, "Rewrite_as_the_indexed_access_type_0_90026", "Rewrite as the indexed access type '{0}'"); + static inline const auto Declare_static_property_0 = diag(90027, DiagnosticCategory::Message, "Declare_static_property_0_90027", "Declare static property '{0}'"); + static inline const auto Call_decorator_expression = diag(90028, DiagnosticCategory::Message, "Call_decorator_expression_90028", "Call decorator expression"); + static inline const auto Add_async_modifier_to_containing_function = diag(90029, DiagnosticCategory::Message, "Add_async_modifier_to_containing_function_90029", "Add async modifier to containing function"); + static inline const auto Replace_infer_0_with_unknown = diag(90030, DiagnosticCategory::Message, "Replace_infer_0_with_unknown_90030", "Replace 'infer {0}' with 'unknown'"); + static inline const auto Replace_all_unused_infer_with_unknown = diag(90031, DiagnosticCategory::Message, "Replace_all_unused_infer_with_unknown_90031", "Replace all unused 'infer' with 'unknown'"); + static inline const auto Import_default_0_from_module_1 = diag(90032, DiagnosticCategory::Message, "Import_default_0_from_module_1_90032", "Import default '{0}' from module \"{1}\""); + static inline const auto Add_default_import_0_to_existing_import_declaration_from_1 = diag(90033, DiagnosticCategory::Message, "Add_default_import_0_to_existing_import_declaration_from_1_90033", "Add default import '{0}' to existing import declaration from \"{1}\""); + static inline const auto Add_parameter_name = diag(90034, DiagnosticCategory::Message, "Add_parameter_name_90034", "Add parameter name"); + static inline const auto Declare_private_property_0 = diag(90035, DiagnosticCategory::Message, "Declare_private_property_0_90035", "Declare private property '{0}'"); + static inline const auto Replace_0_with_Promise_1 = diag(90036, DiagnosticCategory::Message, "Replace_0_with_Promise_1_90036", "Replace '{0}' with 'Promise<{1}>'"); + static inline const auto Fix_all_incorrect_return_type_of_an_async_functions = diag(90037, DiagnosticCategory::Message, "Fix_all_incorrect_return_type_of_an_async_functions_90037", "Fix all incorrect return type of an async functions"); + static inline const auto Declare_private_method_0 = diag(90038, DiagnosticCategory::Message, "Declare_private_method_0_90038", "Declare private method '{0}'"); + static inline const auto Remove_unused_destructuring_declaration = diag(90039, DiagnosticCategory::Message, "Remove_unused_destructuring_declaration_90039", "Remove unused destructuring declaration"); + static inline const auto Remove_unused_declarations_for_Colon_0 = diag(90041, DiagnosticCategory::Message, "Remove_unused_declarations_for_Colon_0_90041", "Remove unused declarations for: '{0}'"); + static inline const auto Declare_a_private_field_named_0 = diag(90053, DiagnosticCategory::Message, "Declare_a_private_field_named_0_90053", "Declare a private field named '{0}'."); + static inline const auto Includes_imports_of_types_referenced_by_0 = diag(90054, DiagnosticCategory::Message, "Includes_imports_of_types_referenced_by_0_90054", "Includes imports of types referenced by '{0}'"); + static inline const auto Convert_function_to_an_ES2015_class = diag(95001, DiagnosticCategory::Message, "Convert_function_to_an_ES2015_class_95001", "Convert function to an ES2015 class"); + static inline const auto Convert_0_to_1_in_0 = diag(95003, DiagnosticCategory::Message, "Convert_0_to_1_in_0_95003", "Convert '{0}' to '{1} in {0}'"); + static inline const auto Extract_to_0_in_1 = diag(95004, DiagnosticCategory::Message, "Extract_to_0_in_1_95004", "Extract to {0} in {1}"); + static inline const auto Extract_function = diag(95005, DiagnosticCategory::Message, "Extract_function_95005", "Extract function"); + static inline const auto Extract_constant = diag(95006, DiagnosticCategory::Message, "Extract_constant_95006", "Extract constant"); + static inline const auto Extract_to_0_in_enclosing_scope = diag(95007, DiagnosticCategory::Message, "Extract_to_0_in_enclosing_scope_95007", "Extract to {0} in enclosing scope"); + static inline const auto Extract_to_0_in_1_scope = diag(95008, DiagnosticCategory::Message, "Extract_to_0_in_1_scope_95008", "Extract to {0} in {1} scope"); + static inline const auto Annotate_with_type_from_JSDoc = diag(95009, DiagnosticCategory::Message, "Annotate_with_type_from_JSDoc_95009", "Annotate with type from JSDoc"); + static inline const auto Infer_type_of_0_from_usage = diag(95011, DiagnosticCategory::Message, "Infer_type_of_0_from_usage_95011", "Infer type of '{0}' from usage"); + static inline const auto Infer_parameter_types_from_usage = diag(95012, DiagnosticCategory::Message, "Infer_parameter_types_from_usage_95012", "Infer parameter types from usage"); + static inline const auto Convert_to_default_import = diag(95013, DiagnosticCategory::Message, "Convert_to_default_import_95013", "Convert to default import"); + static inline const auto Install_0 = diag(95014, DiagnosticCategory::Message, "Install_0_95014", "Install '{0}'"); + static inline const auto Replace_import_with_0 = diag(95015, DiagnosticCategory::Message, "Replace_import_with_0_95015", "Replace import with '{0}'."); + static inline const auto Use_synthetic_default_member = diag(95016, DiagnosticCategory::Message, "Use_synthetic_default_member_95016", "Use synthetic 'default' member."); + static inline const auto Convert_to_ES_module = diag(95017, DiagnosticCategory::Message, "Convert_to_ES_module_95017", "Convert to ES module"); + static inline const auto Add_undefined_type_to_property_0 = diag(95018, DiagnosticCategory::Message, "Add_undefined_type_to_property_0_95018", "Add 'undefined' type to property '{0}'"); + static inline const auto Add_initializer_to_property_0 = diag(95019, DiagnosticCategory::Message, "Add_initializer_to_property_0_95019", "Add initializer to property '{0}'"); + static inline const auto Add_definite_assignment_assertion_to_property_0 = diag(95020, DiagnosticCategory::Message, "Add_definite_assignment_assertion_to_property_0_95020", "Add definite assignment assertion to property '{0}'"); + static inline const auto Convert_all_type_literals_to_mapped_type = diag(95021, DiagnosticCategory::Message, "Convert_all_type_literals_to_mapped_type_95021", "Convert all type literals to mapped type"); + static inline const auto Add_all_missing_members = diag(95022, DiagnosticCategory::Message, "Add_all_missing_members_95022", "Add all missing members"); + static inline const auto Infer_all_types_from_usage = diag(95023, DiagnosticCategory::Message, "Infer_all_types_from_usage_95023", "Infer all types from usage"); + static inline const auto Delete_all_unused_declarations = diag(95024, DiagnosticCategory::Message, "Delete_all_unused_declarations_95024", "Delete all unused declarations"); + static inline const auto Prefix_all_unused_declarations_with_where_possible = diag(95025, DiagnosticCategory::Message, "Prefix_all_unused_declarations_with_where_possible_95025", "Prefix all unused declarations with '_' where possible"); + static inline const auto Fix_all_detected_spelling_errors = diag(95026, DiagnosticCategory::Message, "Fix_all_detected_spelling_errors_95026", "Fix all detected spelling errors"); + static inline const auto Add_initializers_to_all_uninitialized_properties = diag(95027, DiagnosticCategory::Message, "Add_initializers_to_all_uninitialized_properties_95027", "Add initializers to all uninitialized properties"); + static inline const auto Add_definite_assignment_assertions_to_all_uninitialized_properties = diag(95028, DiagnosticCategory::Message, "Add_definite_assignment_assertions_to_all_uninitialized_properties_95028", "Add definite assignment assertions to all uninitialized properties"); + static inline const auto Add_undefined_type_to_all_uninitialized_properties = diag(95029, DiagnosticCategory::Message, "Add_undefined_type_to_all_uninitialized_properties_95029", "Add undefined type to all uninitialized properties"); + static inline const auto Change_all_jsdoc_style_types_to_TypeScript = diag(95030, DiagnosticCategory::Message, "Change_all_jsdoc_style_types_to_TypeScript_95030", "Change all jsdoc-style types to TypeScript"); + static inline const auto Change_all_jsdoc_style_types_to_TypeScript_and_add_undefined_to_nullable_types = diag(95031, DiagnosticCategory::Message, "Change_all_jsdoc_style_types_to_TypeScript_and_add_undefined_to_nullable_types_95031", "Change all jsdoc-style types to TypeScript (and add '| undefined' to nullable types)"); + static inline const auto Implement_all_unimplemented_interfaces = diag(95032, DiagnosticCategory::Message, "Implement_all_unimplemented_interfaces_95032", "Implement all unimplemented interfaces"); + static inline const auto Install_all_missing_types_packages = diag(95033, DiagnosticCategory::Message, "Install_all_missing_types_packages_95033", "Install all missing types packages"); + static inline const auto Rewrite_all_as_indexed_access_types = diag(95034, DiagnosticCategory::Message, "Rewrite_all_as_indexed_access_types_95034", "Rewrite all as indexed access types"); + static inline const auto Convert_all_to_default_imports = diag(95035, DiagnosticCategory::Message, "Convert_all_to_default_imports_95035", "Convert all to default imports"); + static inline const auto Make_all_super_calls_the_first_statement_in_their_constructor = diag(95036, DiagnosticCategory::Message, "Make_all_super_calls_the_first_statement_in_their_constructor_95036", "Make all 'super()' calls the first statement in their constructor"); + static inline const auto Add_qualifier_to_all_unresolved_variables_matching_a_member_name = diag(95037, DiagnosticCategory::Message, "Add_qualifier_to_all_unresolved_variables_matching_a_member_name_95037", "Add qualifier to all unresolved variables matching a member name"); + static inline const auto Change_all_extended_interfaces_to_implements = diag(95038, DiagnosticCategory::Message, "Change_all_extended_interfaces_to_implements_95038", "Change all extended interfaces to 'implements'"); + static inline const auto Add_all_missing_super_calls = diag(95039, DiagnosticCategory::Message, "Add_all_missing_super_calls_95039", "Add all missing super calls"); + static inline const auto Implement_all_inherited_abstract_classes = diag(95040, DiagnosticCategory::Message, "Implement_all_inherited_abstract_classes_95040", "Implement all inherited abstract classes"); + static inline const auto Add_all_missing_async_modifiers = diag(95041, DiagnosticCategory::Message, "Add_all_missing_async_modifiers_95041", "Add all missing 'async' modifiers"); + static inline const auto Add_ts_ignore_to_all_error_messages = diag(95042, DiagnosticCategory::Message, "Add_ts_ignore_to_all_error_messages_95042", "Add '@ts-ignore' to all error messages"); + static inline const auto Annotate_everything_with_types_from_JSDoc = diag(95043, DiagnosticCategory::Message, "Annotate_everything_with_types_from_JSDoc_95043", "Annotate everything with types from JSDoc"); + static inline const auto Add_to_all_uncalled_decorators = diag(95044, DiagnosticCategory::Message, "Add_to_all_uncalled_decorators_95044", "Add '()' to all uncalled decorators"); + static inline const auto Convert_all_constructor_functions_to_classes = diag(95045, DiagnosticCategory::Message, "Convert_all_constructor_functions_to_classes_95045", "Convert all constructor functions to classes"); + static inline const auto Generate_get_and_set_accessors = diag(95046, DiagnosticCategory::Message, "Generate_get_and_set_accessors_95046", "Generate 'get' and 'set' accessors"); + static inline const auto Convert_require_to_import = diag(95047, DiagnosticCategory::Message, "Convert_require_to_import_95047", "Convert 'require' to 'import'"); + static inline const auto Convert_all_require_to_import = diag(95048, DiagnosticCategory::Message, "Convert_all_require_to_import_95048", "Convert all 'require' to 'import'"); + static inline const auto Move_to_a_new_file = diag(95049, DiagnosticCategory::Message, "Move_to_a_new_file_95049", "Move to a new file"); + static inline const auto Remove_unreachable_code = diag(95050, DiagnosticCategory::Message, "Remove_unreachable_code_95050", "Remove unreachable code"); + static inline const auto Remove_all_unreachable_code = diag(95051, DiagnosticCategory::Message, "Remove_all_unreachable_code_95051", "Remove all unreachable code"); + static inline const auto Add_missing_typeof = diag(95052, DiagnosticCategory::Message, "Add_missing_typeof_95052", "Add missing 'typeof'"); + static inline const auto Remove_unused_label = diag(95053, DiagnosticCategory::Message, "Remove_unused_label_95053", "Remove unused label"); + static inline const auto Remove_all_unused_labels = diag(95054, DiagnosticCategory::Message, "Remove_all_unused_labels_95054", "Remove all unused labels"); + static inline const auto Convert_0_to_mapped_object_type = diag(95055, DiagnosticCategory::Message, "Convert_0_to_mapped_object_type_95055", "Convert '{0}' to mapped object type"); + static inline const auto Convert_namespace_import_to_named_imports = diag(95056, DiagnosticCategory::Message, "Convert_namespace_import_to_named_imports_95056", "Convert namespace import to named imports"); + static inline const auto Convert_named_imports_to_namespace_import = diag(95057, DiagnosticCategory::Message, "Convert_named_imports_to_namespace_import_95057", "Convert named imports to namespace import"); + static inline const auto Add_or_remove_braces_in_an_arrow_function = diag(95058, DiagnosticCategory::Message, "Add_or_remove_braces_in_an_arrow_function_95058", "Add or remove braces in an arrow function"); + static inline const auto Add_braces_to_arrow_function = diag(95059, DiagnosticCategory::Message, "Add_braces_to_arrow_function_95059", "Add braces to arrow function"); + static inline const auto Remove_braces_from_arrow_function = diag(95060, DiagnosticCategory::Message, "Remove_braces_from_arrow_function_95060", "Remove braces from arrow function"); + static inline const auto Convert_default_export_to_named_export = diag(95061, DiagnosticCategory::Message, "Convert_default_export_to_named_export_95061", "Convert default export to named export"); + static inline const auto Convert_named_export_to_default_export = diag(95062, DiagnosticCategory::Message, "Convert_named_export_to_default_export_95062", "Convert named export to default export"); + static inline const auto Add_missing_enum_member_0 = diag(95063, DiagnosticCategory::Message, "Add_missing_enum_member_0_95063", "Add missing enum member '{0}'"); + static inline const auto Add_all_missing_imports = diag(95064, DiagnosticCategory::Message, "Add_all_missing_imports_95064", "Add all missing imports"); + static inline const auto Convert_to_async_function = diag(95065, DiagnosticCategory::Message, "Convert_to_async_function_95065", "Convert to async function"); + static inline const auto Convert_all_to_async_functions = diag(95066, DiagnosticCategory::Message, "Convert_all_to_async_functions_95066", "Convert all to async functions"); + static inline const auto Add_missing_call_parentheses = diag(95067, DiagnosticCategory::Message, "Add_missing_call_parentheses_95067", "Add missing call parentheses"); + static inline const auto Add_all_missing_call_parentheses = diag(95068, DiagnosticCategory::Message, "Add_all_missing_call_parentheses_95068", "Add all missing call parentheses"); + static inline const auto Add_unknown_conversion_for_non_overlapping_types = diag(95069, DiagnosticCategory::Message, "Add_unknown_conversion_for_non_overlapping_types_95069", "Add 'unknown' conversion for non-overlapping types"); + static inline const auto Add_unknown_to_all_conversions_of_non_overlapping_types = diag(95070, DiagnosticCategory::Message, "Add_unknown_to_all_conversions_of_non_overlapping_types_95070", "Add 'unknown' to all conversions of non-overlapping types"); + static inline const auto Add_missing_new_operator_to_call = diag(95071, DiagnosticCategory::Message, "Add_missing_new_operator_to_call_95071", "Add missing 'new' operator to call"); + static inline const auto Add_missing_new_operator_to_all_calls = diag(95072, DiagnosticCategory::Message, "Add_missing_new_operator_to_all_calls_95072", "Add missing 'new' operator to all calls"); + static inline const auto Add_names_to_all_parameters_without_names = diag(95073, DiagnosticCategory::Message, "Add_names_to_all_parameters_without_names_95073", "Add names to all parameters without names"); + static inline const auto Enable_the_experimentalDecorators_option_in_your_configuration_file = diag(95074, DiagnosticCategory::Message, "Enable_the_experimentalDecorators_option_in_your_configuration_file_95074", "Enable the 'experimentalDecorators' option in your configuration file"); + static inline const auto Convert_parameters_to_destructured_object = diag(95075, DiagnosticCategory::Message, "Convert_parameters_to_destructured_object_95075", "Convert parameters to destructured object"); + static inline const auto Extract_type = diag(95077, DiagnosticCategory::Message, "Extract_type_95077", "Extract type"); + static inline const auto Extract_to_type_alias = diag(95078, DiagnosticCategory::Message, "Extract_to_type_alias_95078", "Extract to type alias"); + static inline const auto Extract_to_typedef = diag(95079, DiagnosticCategory::Message, "Extract_to_typedef_95079", "Extract to typedef"); + static inline const auto Infer_this_type_of_0_from_usage = diag(95080, DiagnosticCategory::Message, "Infer_this_type_of_0_from_usage_95080", "Infer 'this' type of '{0}' from usage"); + static inline const auto Add_const_to_unresolved_variable = diag(95081, DiagnosticCategory::Message, "Add_const_to_unresolved_variable_95081", "Add 'const' to unresolved variable"); + static inline const auto Add_const_to_all_unresolved_variables = diag(95082, DiagnosticCategory::Message, "Add_const_to_all_unresolved_variables_95082", "Add 'const' to all unresolved variables"); + static inline const auto Add_await = diag(95083, DiagnosticCategory::Message, "Add_await_95083", "Add 'await'"); + static inline const auto Add_await_to_initializer_for_0 = diag(95084, DiagnosticCategory::Message, "Add_await_to_initializer_for_0_95084", "Add 'await' to initializer for '{0}'"); + static inline const auto Fix_all_expressions_possibly_missing_await = diag(95085, DiagnosticCategory::Message, "Fix_all_expressions_possibly_missing_await_95085", "Fix all expressions possibly missing 'await'"); + static inline const auto Remove_unnecessary_await = diag(95086, DiagnosticCategory::Message, "Remove_unnecessary_await_95086", "Remove unnecessary 'await'"); + static inline const auto Remove_all_unnecessary_uses_of_await = diag(95087, DiagnosticCategory::Message, "Remove_all_unnecessary_uses_of_await_95087", "Remove all unnecessary uses of 'await'"); + static inline const auto Enable_the_jsx_flag_in_your_configuration_file = diag(95088, DiagnosticCategory::Message, "Enable_the_jsx_flag_in_your_configuration_file_95088", "Enable the '--jsx' flag in your configuration file"); + static inline const auto Add_await_to_initializers = diag(95089, DiagnosticCategory::Message, "Add_await_to_initializers_95089", "Add 'await' to initializers"); + static inline const auto Extract_to_interface = diag(95090, DiagnosticCategory::Message, "Extract_to_interface_95090", "Extract to interface"); + static inline const auto Convert_to_a_bigint_numeric_literal = diag(95091, DiagnosticCategory::Message, "Convert_to_a_bigint_numeric_literal_95091", "Convert to a bigint numeric literal"); + static inline const auto Convert_all_to_bigint_numeric_literals = diag(95092, DiagnosticCategory::Message, "Convert_all_to_bigint_numeric_literals_95092", "Convert all to bigint numeric literals"); + static inline const auto Convert_const_to_let = diag(95093, DiagnosticCategory::Message, "Convert_const_to_let_95093", "Convert 'const' to 'let'"); + static inline const auto Prefix_with_declare = diag(95094, DiagnosticCategory::Message, "Prefix_with_declare_95094", "Prefix with 'declare'"); + static inline const auto Prefix_all_incorrect_property_declarations_with_declare = diag(95095, DiagnosticCategory::Message, "Prefix_all_incorrect_property_declarations_with_declare_95095", "Prefix all incorrect property declarations with 'declare'"); + static inline const auto Convert_to_template_string = diag(95096, DiagnosticCategory::Message, "Convert_to_template_string_95096", "Convert to template string"); + static inline const auto Add_export_to_make_this_file_into_a_module = diag(95097, DiagnosticCategory::Message, "Add_export_to_make_this_file_into_a_module_95097", "Add 'export {}' to make this file into a module"); + static inline const auto Set_the_target_option_in_your_configuration_file_to_0 = diag(95098, DiagnosticCategory::Message, "Set_the_target_option_in_your_configuration_file_to_0_95098", "Set the 'target' option in your configuration file to '{0}'"); + static inline const auto Set_the_module_option_in_your_configuration_file_to_0 = diag(95099, DiagnosticCategory::Message, "Set_the_module_option_in_your_configuration_file_to_0_95099", "Set the 'module' option in your configuration file to '{0}'"); + static inline const auto Convert_invalid_character_to_its_html_entity_code = diag(95100, DiagnosticCategory::Message, "Convert_invalid_character_to_its_html_entity_code_95100", "Convert invalid character to its html entity code"); + static inline const auto Convert_all_invalid_characters_to_HTML_entity_code = diag(95101, DiagnosticCategory::Message, "Convert_all_invalid_characters_to_HTML_entity_code_95101", "Convert all invalid characters to HTML entity code"); + static inline const auto Convert_function_expression_0_to_arrow_function = diag(95105, DiagnosticCategory::Message, "Convert_function_expression_0_to_arrow_function_95105", "Convert function expression '{0}' to arrow function"); + static inline const auto Convert_function_declaration_0_to_arrow_function = diag(95106, DiagnosticCategory::Message, "Convert_function_declaration_0_to_arrow_function_95106", "Convert function declaration '{0}' to arrow function"); + static inline const auto Fix_all_implicit_this_errors = diag(95107, DiagnosticCategory::Message, "Fix_all_implicit_this_errors_95107", "Fix all implicit-'this' errors"); + static inline const auto Wrap_invalid_character_in_an_expression_container = diag(95108, DiagnosticCategory::Message, "Wrap_invalid_character_in_an_expression_container_95108", "Wrap invalid character in an expression container"); + static inline const auto Wrap_all_invalid_characters_in_an_expression_container = diag(95109, DiagnosticCategory::Message, "Wrap_all_invalid_characters_in_an_expression_container_95109", "Wrap all invalid characters in an expression container"); + static inline const auto Visit_https_Colon_Slash_Slashaka_ms_Slashtsconfig_json_to_read_more_about_this_file = diag(95110, DiagnosticCategory::Message, "Visit_https_Colon_Slash_Slashaka_ms_Slashtsconfig_json_to_read_more_about_this_file_95110", "Visit https://aka.ms/tsconfig.json to read more about this file"); + static inline const auto Add_a_return_statement = diag(95111, DiagnosticCategory::Message, "Add_a_return_statement_95111", "Add a return statement"); + static inline const auto Remove_braces_from_arrow_function_body = diag(95112, DiagnosticCategory::Message, "Remove_braces_from_arrow_function_body_95112", "Remove braces from arrow function body"); + static inline const auto Wrap_the_following_body_with_parentheses_which_should_be_an_object_literal = diag(95113, DiagnosticCategory::Message, "Wrap_the_following_body_with_parentheses_which_should_be_an_object_literal_95113", "Wrap the following body with parentheses which should be an object literal"); + static inline const auto Add_all_missing_return_statement = diag(95114, DiagnosticCategory::Message, "Add_all_missing_return_statement_95114", "Add all missing return statement"); + static inline const auto Remove_braces_from_all_arrow_function_bodies_with_relevant_issues = diag(95115, DiagnosticCategory::Message, "Remove_braces_from_all_arrow_function_bodies_with_relevant_issues_95115", "Remove braces from all arrow function bodies with relevant issues"); + static inline const auto Wrap_all_object_literal_with_parentheses = diag(95116, DiagnosticCategory::Message, "Wrap_all_object_literal_with_parentheses_95116", "Wrap all object literal with parentheses"); + static inline const auto Move_labeled_tuple_element_modifiers_to_labels = diag(95117, DiagnosticCategory::Message, "Move_labeled_tuple_element_modifiers_to_labels_95117", "Move labeled tuple element modifiers to labels"); + static inline const auto Convert_overload_list_to_single_signature = diag(95118, DiagnosticCategory::Message, "Convert_overload_list_to_single_signature_95118", "Convert overload list to single signature"); + static inline const auto Generate_get_and_set_accessors_for_all_overriding_properties = diag(95119, DiagnosticCategory::Message, "Generate_get_and_set_accessors_for_all_overriding_properties_95119", "Generate 'get' and 'set' accessors for all overriding properties"); + static inline const auto Wrap_in_JSX_fragment = diag(95120, DiagnosticCategory::Message, "Wrap_in_JSX_fragment_95120", "Wrap in JSX fragment"); + static inline const auto Wrap_all_unparented_JSX_in_JSX_fragment = diag(95121, DiagnosticCategory::Message, "Wrap_all_unparented_JSX_in_JSX_fragment_95121", "Wrap all unparented JSX in JSX fragment"); + static inline const auto Convert_arrow_function_or_function_expression = diag(95122, DiagnosticCategory::Message, "Convert_arrow_function_or_function_expression_95122", "Convert arrow function or function expression"); + static inline const auto Convert_to_anonymous_function = diag(95123, DiagnosticCategory::Message, "Convert_to_anonymous_function_95123", "Convert to anonymous function"); + static inline const auto Convert_to_named_function = diag(95124, DiagnosticCategory::Message, "Convert_to_named_function_95124", "Convert to named function"); + static inline const auto Convert_to_arrow_function = diag(95125, DiagnosticCategory::Message, "Convert_to_arrow_function_95125", "Convert to arrow function"); + static inline const auto Remove_parentheses = diag(95126, DiagnosticCategory::Message, "Remove_parentheses_95126", "Remove parentheses"); + static inline const auto Could_not_find_a_containing_arrow_function = diag(95127, DiagnosticCategory::Message, "Could_not_find_a_containing_arrow_function_95127", "Could not find a containing arrow function"); + static inline const auto Containing_function_is_not_an_arrow_function = diag(95128, DiagnosticCategory::Message, "Containing_function_is_not_an_arrow_function_95128", "Containing function is not an arrow function"); + static inline const auto Could_not_find_export_statement = diag(95129, DiagnosticCategory::Message, "Could_not_find_export_statement_95129", "Could not find export statement"); + static inline const auto This_file_already_has_a_default_export = diag(95130, DiagnosticCategory::Message, "This_file_already_has_a_default_export_95130", "This file already has a default export"); + static inline const auto Could_not_find_import_clause = diag(95131, DiagnosticCategory::Message, "Could_not_find_import_clause_95131", "Could not find import clause"); + static inline const auto Could_not_find_namespace_import_or_named_imports = diag(95132, DiagnosticCategory::Message, "Could_not_find_namespace_import_or_named_imports_95132", "Could not find namespace import or named imports"); + static inline const auto Selection_is_not_a_valid_type_node = diag(95133, DiagnosticCategory::Message, "Selection_is_not_a_valid_type_node_95133", "Selection is not a valid type node"); + static inline const auto No_type_could_be_extracted_from_this_type_node = diag(95134, DiagnosticCategory::Message, "No_type_could_be_extracted_from_this_type_node_95134", "No type could be extracted from this type node"); + static inline const auto Could_not_find_property_for_which_to_generate_accessor = diag(95135, DiagnosticCategory::Message, "Could_not_find_property_for_which_to_generate_accessor_95135", "Could not find property for which to generate accessor"); + static inline const auto Name_is_not_valid = diag(95136, DiagnosticCategory::Message, "Name_is_not_valid_95136", "Name is not valid"); + static inline const auto Can_only_convert_property_with_modifier = diag(95137, DiagnosticCategory::Message, "Can_only_convert_property_with_modifier_95137", "Can only convert property with modifier"); + static inline const auto Switch_each_misused_0_to_1 = diag(95138, DiagnosticCategory::Message, "Switch_each_misused_0_to_1_95138", "Switch each misused '{0}' to '{1}'"); + static inline const auto Convert_to_optional_chain_expression = diag(95139, DiagnosticCategory::Message, "Convert_to_optional_chain_expression_95139", "Convert to optional chain expression"); + static inline const auto Could_not_find_convertible_access_expression = diag(95140, DiagnosticCategory::Message, "Could_not_find_convertible_access_expression_95140", "Could not find convertible access expression"); + static inline const auto Could_not_find_matching_access_expressions = diag(95141, DiagnosticCategory::Message, "Could_not_find_matching_access_expressions_95141", "Could not find matching access expressions"); + static inline const auto Can_only_convert_logical_AND_access_chains = diag(95142, DiagnosticCategory::Message, "Can_only_convert_logical_AND_access_chains_95142", "Can only convert logical AND access chains"); + static inline const auto Add_void_to_Promise_resolved_without_a_value = diag(95143, DiagnosticCategory::Message, "Add_void_to_Promise_resolved_without_a_value_95143", "Add 'void' to Promise resolved without a value"); + static inline const auto Add_void_to_all_Promises_resolved_without_a_value = diag(95144, DiagnosticCategory::Message, "Add_void_to_all_Promises_resolved_without_a_value_95144", "Add 'void' to all Promises resolved without a value"); + static inline const auto Use_element_access_for_0 = diag(95145, DiagnosticCategory::Message, "Use_element_access_for_0_95145", "Use element access for '{0}'"); + static inline const auto Use_element_access_for_all_undeclared_properties = diag(95146, DiagnosticCategory::Message, "Use_element_access_for_all_undeclared_properties_95146", "Use element access for all undeclared properties."); + static inline const auto Delete_all_unused_imports = diag(95147, DiagnosticCategory::Message, "Delete_all_unused_imports_95147", "Delete all unused imports"); + static inline const auto Infer_function_return_type = diag(95148, DiagnosticCategory::Message, "Infer_function_return_type_95148", "Infer function return type"); + static inline const auto Return_type_must_be_inferred_from_a_function = diag(95149, DiagnosticCategory::Message, "Return_type_must_be_inferred_from_a_function_95149", "Return type must be inferred from a function"); + static inline const auto Could_not_determine_function_return_type = diag(95150, DiagnosticCategory::Message, "Could_not_determine_function_return_type_95150", "Could not determine function return type"); + static inline const auto Could_not_convert_to_arrow_function = diag(95151, DiagnosticCategory::Message, "Could_not_convert_to_arrow_function_95151", "Could not convert to arrow function"); + static inline const auto Could_not_convert_to_named_function = diag(95152, DiagnosticCategory::Message, "Could_not_convert_to_named_function_95152", "Could not convert to named function"); + static inline const auto Could_not_convert_to_anonymous_function = diag(95153, DiagnosticCategory::Message, "Could_not_convert_to_anonymous_function_95153", "Could not convert to anonymous function"); + static inline const auto Can_only_convert_string_concatenation = diag(95154, DiagnosticCategory::Message, "Can_only_convert_string_concatenation_95154", "Can only convert string concatenation"); + static inline const auto Selection_is_not_a_valid_statement_or_statements = diag(95155, DiagnosticCategory::Message, "Selection_is_not_a_valid_statement_or_statements_95155", "Selection is not a valid statement or statements"); + static inline const auto Add_missing_function_declaration_0 = diag(95156, DiagnosticCategory::Message, "Add_missing_function_declaration_0_95156", "Add missing function declaration '{0}'"); + static inline const auto Add_all_missing_function_declarations = diag(95157, DiagnosticCategory::Message, "Add_all_missing_function_declarations_95157", "Add all missing function declarations"); + static inline const auto Method_not_implemented = diag(95158, DiagnosticCategory::Message, "Method_not_implemented_95158", "Method not implemented."); + static inline const auto Function_not_implemented = diag(95159, DiagnosticCategory::Message, "Function_not_implemented_95159", "Function not implemented."); + static inline const auto Add_override_modifier = diag(95160, DiagnosticCategory::Message, "Add_override_modifier_95160", "Add 'override' modifier"); + static inline const auto Remove_override_modifier = diag(95161, DiagnosticCategory::Message, "Remove_override_modifier_95161", "Remove 'override' modifier"); + static inline const auto Add_all_missing_override_modifiers = diag(95162, DiagnosticCategory::Message, "Add_all_missing_override_modifiers_95162", "Add all missing 'override' modifiers"); + static inline const auto Remove_all_unnecessary_override_modifiers = diag(95163, DiagnosticCategory::Message, "Remove_all_unnecessary_override_modifiers_95163", "Remove all unnecessary 'override' modifiers"); + static inline const auto Can_only_convert_named_export = diag(95164, DiagnosticCategory::Message, "Can_only_convert_named_export_95164", "Can only convert named export"); + static inline const auto Add_missing_properties = diag(95165, DiagnosticCategory::Message, "Add_missing_properties_95165", "Add missing properties"); + static inline const auto Add_all_missing_properties = diag(95166, DiagnosticCategory::Message, "Add_all_missing_properties_95166", "Add all missing properties"); + static inline const auto Add_missing_attributes = diag(95167, DiagnosticCategory::Message, "Add_missing_attributes_95167", "Add missing attributes"); + static inline const auto Add_all_missing_attributes = diag(95168, DiagnosticCategory::Message, "Add_all_missing_attributes_95168", "Add all missing attributes"); + static inline const auto Add_undefined_to_optional_property_type = diag(95169, DiagnosticCategory::Message, "Add_undefined_to_optional_property_type_95169", "Add 'undefined' to optional property type"); + static inline const auto No_value_exists_in_scope_for_the_shorthand_property_0_Either_declare_one_or_provide_an_initializer = diag(18004, DiagnosticCategory::Error, "No_value_exists_in_scope_for_the_shorthand_property_0_Either_declare_one_or_provide_an_initializer_18004", "No value exists in scope for the shorthand property '{0}'. Either declare one or provide an initializer."); + static inline const auto Classes_may_not_have_a_field_named_constructor = diag(18006, DiagnosticCategory::Error, "Classes_may_not_have_a_field_named_constructor_18006", "Classes may not have a field named 'constructor'."); + static inline const auto JSX_expressions_may_not_use_the_comma_operator_Did_you_mean_to_write_an_array = diag(18007, DiagnosticCategory::Error, "JSX_expressions_may_not_use_the_comma_operator_Did_you_mean_to_write_an_array_18007", "JSX expressions may not use the comma operator. Did you mean to write an array?"); + static inline const auto Private_identifiers_cannot_be_used_as_parameters = diag(18009, DiagnosticCategory::Error, "Private_identifiers_cannot_be_used_as_parameters_18009", "Private identifiers cannot be used as parameters."); + static inline const auto An_accessibility_modifier_cannot_be_used_with_a_private_identifier = diag(18010, DiagnosticCategory::Error, "An_accessibility_modifier_cannot_be_used_with_a_private_identifier_18010", "An accessibility modifier cannot be used with a private identifier."); + static inline const auto The_operand_of_a_delete_operator_cannot_be_a_private_identifier = diag(18011, DiagnosticCategory::Error, "The_operand_of_a_delete_operator_cannot_be_a_private_identifier_18011", "The operand of a 'delete' operator cannot be a private identifier."); + static inline const auto constructor_is_a_reserved_word = diag(18012, DiagnosticCategory::Error, "constructor_is_a_reserved_word_18012", "'#constructor' is a reserved word."); + static inline const auto Property_0_is_not_accessible_outside_class_1_because_it_has_a_private_identifier = diag(18013, DiagnosticCategory::Error, "Property_0_is_not_accessible_outside_class_1_because_it_has_a_private_identifier_18013", "Property '{0}' is not accessible outside class '{1}' because it has a private identifier."); + static inline const auto The_property_0_cannot_be_accessed_on_type_1_within_this_class_because_it_is_shadowed_by_another_private_identifier_with_the_same_spelling = diag(18014, DiagnosticCategory::Error, "The_property_0_cannot_be_accessed_on_type_1_within_this_class_because_it_is_shadowed_by_another_priv_18014", "The property '{0}' cannot be accessed on type '{1}' within this class because it is shadowed by another private identifier with the same spelling."); + static inline const auto Property_0_in_type_1_refers_to_a_different_member_that_cannot_be_accessed_from_within_type_2 = diag(18015, DiagnosticCategory::Error, "Property_0_in_type_1_refers_to_a_different_member_that_cannot_be_accessed_from_within_type_2_18015", "Property '{0}' in type '{1}' refers to a different member that cannot be accessed from within type '{2}'."); + static inline const auto Private_identifiers_are_not_allowed_outside_class_bodies = diag(18016, DiagnosticCategory::Error, "Private_identifiers_are_not_allowed_outside_class_bodies_18016", "Private identifiers are not allowed outside class bodies."); + static inline const auto The_shadowing_declaration_of_0_is_defined_here = diag(18017, DiagnosticCategory::Error, "The_shadowing_declaration_of_0_is_defined_here_18017", "The shadowing declaration of '{0}' is defined here"); + static inline const auto The_declaration_of_0_that_you_probably_intended_to_use_is_defined_here = diag(18018, DiagnosticCategory::Error, "The_declaration_of_0_that_you_probably_intended_to_use_is_defined_here_18018", "The declaration of '{0}' that you probably intended to use is defined here"); + static inline const auto _0_modifier_cannot_be_used_with_a_private_identifier = diag(18019, DiagnosticCategory::Error, "_0_modifier_cannot_be_used_with_a_private_identifier_18019", "'{0}' modifier cannot be used with a private identifier."); + static inline const auto An_enum_member_cannot_be_named_with_a_private_identifier = diag(18024, DiagnosticCategory::Error, "An_enum_member_cannot_be_named_with_a_private_identifier_18024", "An enum member cannot be named with a private identifier."); + static inline const auto can_only_be_used_at_the_start_of_a_file = diag(18026, DiagnosticCategory::Error, "can_only_be_used_at_the_start_of_a_file_18026", "'#!' can only be used at the start of a file."); + static inline const auto Compiler_reserves_name_0_when_emitting_private_identifier_downlevel = diag(18027, DiagnosticCategory::Error, "Compiler_reserves_name_0_when_emitting_private_identifier_downlevel_18027", "Compiler reserves name '{0}' when emitting private identifier downlevel."); + static inline const auto Private_identifiers_are_only_available_when_targeting_ECMAScript_2015_and_higher = diag(18028, DiagnosticCategory::Error, "Private_identifiers_are_only_available_when_targeting_ECMAScript_2015_and_higher_18028", "Private identifiers are only available when targeting ECMAScript 2015 and higher."); + static inline const auto Private_identifiers_are_not_allowed_in_variable_declarations = diag(18029, DiagnosticCategory::Error, "Private_identifiers_are_not_allowed_in_variable_declarations_18029", "Private identifiers are not allowed in variable declarations."); + static inline const auto An_optional_chain_cannot_contain_private_identifiers = diag(18030, DiagnosticCategory::Error, "An_optional_chain_cannot_contain_private_identifiers_18030", "An optional chain cannot contain private identifiers."); + static inline const auto The_intersection_0_was_reduced_to_never_because_property_1_has_conflicting_types_in_some_constituents = diag(18031, DiagnosticCategory::Error, "The_intersection_0_was_reduced_to_never_because_property_1_has_conflicting_types_in_some_constituent_18031", "The intersection '{0}' was reduced to 'never' because property '{1}' has conflicting types in some constituents."); + static inline const auto The_intersection_0_was_reduced_to_never_because_property_1_exists_in_multiple_constituents_and_is_private_in_some = diag(18032, DiagnosticCategory::Error, "The_intersection_0_was_reduced_to_never_because_property_1_exists_in_multiple_constituents_and_is_pr_18032", "The intersection '{0}' was reduced to 'never' because property '{1}' exists in multiple constituents and is private in some."); + static inline const auto Only_numeric_enums_can_have_computed_members_but_this_expression_has_type_0_If_you_do_not_need_exhaustiveness_checks_consider_using_an_object_literal_instead = diag(18033, DiagnosticCategory::Error, "Only_numeric_enums_can_have_computed_members_but_this_expression_has_type_0_If_you_do_not_need_exhau_18033", + "Only numeric enums can have computed members, but this expression has type '{0}'. If you do not need exhaustiveness checks, consider using an object literal instead."); + static inline const auto Specify_the_JSX_fragment_factory_function_to_use_when_targeting_react_JSX_emit_with_jsxFactory_compiler_option_is_specified_e_g_Fragment = diag(18034, DiagnosticCategory::Message, "Specify_the_JSX_fragment_factory_function_to_use_when_targeting_react_JSX_emit_with_jsxFactory_compi_18034", "Specify the JSX fragment factory function to use when targeting 'react' JSX emit with 'jsxFactory' compiler option is specified, e.g. 'Fragment'."); + static inline const auto Invalid_value_for_jsxFragmentFactory_0_is_not_a_valid_identifier_or_qualified_name = diag(18035, DiagnosticCategory::Error, "Invalid_value_for_jsxFragmentFactory_0_is_not_a_valid_identifier_or_qualified_name_18035", "Invalid value for 'jsxFragmentFactory'. '{0}' is not a valid identifier or qualified-name."); + static inline const auto Class_decorators_can_t_be_used_with_static_private_identifier_Consider_removing_the_experimental_decorator = diag(18036, DiagnosticCategory::Error, "Class_decorators_can_t_be_used_with_static_private_identifier_Consider_removing_the_experimental_dec_18036", "Class decorators can't be used with static private identifier. Consider removing the experimental decorator."); + static inline const auto Await_expression_cannot_be_used_inside_a_class_static_block = diag(18037, DiagnosticCategory::Error, "Await_expression_cannot_be_used_inside_a_class_static_block_18037", "Await expression cannot be used inside a class static block."); + static inline const auto For_await_loops_cannot_be_used_inside_a_class_static_block = diag(18038, DiagnosticCategory::Error, "For_await_loops_cannot_be_used_inside_a_class_static_block_18038", "'For await' loops cannot be used inside a class static block."); + static inline const auto Invalid_use_of_0_It_cannot_be_used_inside_a_class_static_block = diag(18039, DiagnosticCategory::Error, "Invalid_use_of_0_It_cannot_be_used_inside_a_class_static_block_18039", "Invalid use of '{0}'. It cannot be used inside a class static block."); + static inline const auto A_return_statement_cannot_be_used_inside_a_class_static_block = diag(18041, DiagnosticCategory::Error, "A_return_statement_cannot_be_used_inside_a_class_static_block_18041", "A 'return' statement cannot be used inside a class static block."); +}; \ No newline at end of file diff --git a/src/factory.h b/src/factory.h new file mode 100644 index 0000000..21af1e2 --- /dev/null +++ b/src/factory.h @@ -0,0 +1,16 @@ +#pragma once + +#include "types.h" + +namespace ts { + template + concept CBaseNodeStructure = std::is_base_of::value; + + template + NodeType createBaseNode() { + NodeType node; + node.data = reinterpret_cast(new T); + node.data->kind = (types::SyntaxKind)T::KIND; + return node; + } +} diff --git a/src/node_test.h b/src/node_test.h new file mode 100644 index 0000000..4a46473 --- /dev/null +++ b/src/node_test.h @@ -0,0 +1,946 @@ +#pragma once + +#include "types.h"; + +namespace ts { + // Literals + + bool isNumericLiteral(Node node) { + return node.kind() == SyntaxKind::NumericLiteral; + } + + bool isBigIntLiteral(Node node) { + return node.kind() == SyntaxKind::BigIntLiteral; + } + + bool isStringLiteral(Node node) { + return node.kind() == SyntaxKind::StringLiteral; + } + + bool isJsxText(Node node) { + return node.kind() == SyntaxKind::JsxText; + } + + bool isRegularExpressionLiteral(Node node) { + return node.kind() == SyntaxKind::RegularExpressionLiteral; + } + + bool isNoSubstitutionTemplateLiteral(Node node) { + return node.kind() == SyntaxKind::NoSubstitutionTemplateLiteral; + } + + // Pseudo-literals + + bool isTemplateHead(Node node) { + return node.kind() == SyntaxKind::TemplateHead; + } + + bool isTemplateMiddle(Node node) { + return node.kind() == SyntaxKind::TemplateMiddle; + } + + bool isTemplateTail(Node node) { + return node.kind() == SyntaxKind::TemplateTail; + } + + // Punctuation + + bool isDotDotDotToken(Node node) { + return node.kind() == SyntaxKind::DotDotDotToken; + } + + /*@internal*/ + bool isCommaToken(Node node) { + return node.kind() == SyntaxKind::CommaToken; + } + + bool isPlusToken(Node node) { + return node.kind() == SyntaxKind::PlusToken; + } + + bool isMinusToken(Node node) { + return node.kind() == SyntaxKind::MinusToken; + } + + bool isAsteriskToken(Node node) { + return node.kind() == SyntaxKind::AsteriskToken; + } + + /*@internal*/ + bool isExclamationToken(Node node) { + return node.kind() == SyntaxKind::ExclamationToken; + } + + /*@internal*/ + bool isQuestionToken(Node node) { + return node.kind() == SyntaxKind::QuestionToken; + } + + /*@internal*/ + bool isColonToken(Node node) { + return node.kind() == SyntaxKind::ColonToken; + } + + /*@internal*/ + bool isQuestionDotToken(Node node) { + return node.kind() == SyntaxKind::QuestionDotToken; + } + + /*@internal*/ + bool isEqualsGreaterThanToken(Node node) { + return node.kind() == SyntaxKind::EqualsGreaterThanToken; + } + + // Identifiers + + bool isIdentifier(Node node) { + return node.kind() == SyntaxKind::Identifier; + } + + bool isPrivateIdentifier(Node node) { + return node.kind() == SyntaxKind::PrivateIdentifier; + } + + // Reserved Words + + /* @internal */ + bool isExportModifier(Node node) { + return node.kind() == SyntaxKind::ExportKeyword; + } + + /* @internal */ + bool isAsyncModifier(Node node) { + return node.kind() == SyntaxKind::AsyncKeyword; + } + + /* @internal */ + bool isAssertsKeyword(Node node) { + return node.kind() == SyntaxKind::AssertsKeyword; + } + + /* @internal */ + bool isAwaitKeyword(Node node) { + return node.kind() == SyntaxKind::AwaitKeyword; + } + + /* @internal */ + bool isReadonlyKeyword(Node node) { + return node.kind() == SyntaxKind::ReadonlyKeyword; + } + + /* @internal */ + bool isStaticModifier(Node node) { + return node.kind() == SyntaxKind::StaticKeyword; + } + + /* @internal */ + bool isAbstractModifier(Node node) { + return node.kind() == SyntaxKind::AbstractKeyword; + } + + /*@internal*/ + bool isSuperKeyword(Node node) { + return node.kind() == SyntaxKind::SuperKeyword; + } + + /*@internal*/ + bool isImportKeyword(Node node) { + return node.kind() == SyntaxKind::ImportKeyword; + } + + // Names + + bool isQualifiedName(Node node) { + return node.kind() == SyntaxKind::QualifiedName; + } + + bool isComputedPropertyName(Node node) { + return node.kind() == SyntaxKind::ComputedPropertyName; + } + + // Signature elements + + bool isTypeParameterDeclaration(Node node) { + return node.kind() == SyntaxKind::TypeParameter; + } + + // TODO(rbuckton): Rename to 'isParameterDeclaration' + bool isParameter(Node node) { + return node.kind() == SyntaxKind::Parameter; + } + + bool isDecorator(Node node) { + return node.kind() == SyntaxKind::Decorator; + } + + // TypeMember + + bool isPropertySignature(Node node) { + return node.kind() == SyntaxKind::PropertySignature; + } + + bool isPropertyDeclaration(Node node) { + return node.kind() == SyntaxKind::PropertyDeclaration; + } + + bool isMethodSignature(Node node) { + return node.kind() == SyntaxKind::MethodSignature; + } + + bool isMethodDeclaration(Node node) { + return node.kind() == SyntaxKind::MethodDeclaration; + } + + bool isClassStaticBlockDeclaration(Node node) { + return node.kind() == SyntaxKind::ClassStaticBlockDeclaration; + } + + bool isConstructorDeclaration(Node node) { + return node.kind() == SyntaxKind::Constructor; + } + + bool isGetAccessorDeclaration(Node node) { + return node.kind() == SyntaxKind::GetAccessor; + } + + bool isSetAccessorDeclaration(Node node) { + return node.kind() == SyntaxKind::SetAccessor; + } + + bool isCallSignatureDeclaration(Node node) { + return node.kind() == SyntaxKind::CallSignature; + } + + bool isConstructSignatureDeclaration(Node node) { + return node.kind() == SyntaxKind::ConstructSignature; + } + + bool isIndexSignatureDeclaration(Node node) { + return node.kind() == SyntaxKind::IndexSignature; + } + + // Type + + bool isTypePredicateNode(Node node) { + return node.kind() == SyntaxKind::TypePredicate; + } + + bool isTypeReferenceNode(Node node) { + return node.kind() == SyntaxKind::TypeReference; + } + + bool isFunctionTypeNode(Node node) { + return node.kind() == SyntaxKind::FunctionType; + } + + bool isConstructorTypeNode(Node node) { + return node.kind() == SyntaxKind::ConstructorType; + } + + bool isTypeQueryNode(Node node) { + return node.kind() == SyntaxKind::TypeQuery; + } + + bool isTypeLiteralNode(Node node) { + return node.kind() == SyntaxKind::TypeLiteral; + } + + bool isArrayTypeNode(Node node) { + return node.kind() == SyntaxKind::ArrayType; + } + + bool isTupleTypeNode(Node node) { + return node.kind() == SyntaxKind::TupleType; + } + + bool isNamedTupleMember(Node node) { + return node.kind() == SyntaxKind::NamedTupleMember; + } + + bool isOptionalTypeNode(Node node) { + return node.kind() == SyntaxKind::OptionalType; + } + + bool isRestTypeNode(Node node) { + return node.kind() == SyntaxKind::RestType; + } + + bool isUnionTypeNode(Node node) { + return node.kind() == SyntaxKind::UnionType; + } + + bool isIntersectionTypeNode(Node node) { + return node.kind() == SyntaxKind::IntersectionType; + } + + bool isConditionalTypeNode(Node node) { + return node.kind() == SyntaxKind::ConditionalType; + } + + bool isInferTypeNode(Node node) { + return node.kind() == SyntaxKind::InferType; + } + + bool isParenthesizedTypeNode(Node node) { + return node.kind() == SyntaxKind::ParenthesizedType; + } + + bool isThisTypeNode(Node node) { + return node.kind() == SyntaxKind::ThisType; + } + + bool isTypeOperatorNode(Node node) { + return node.kind() == SyntaxKind::TypeOperator; + } + + bool isIndexedAccessTypeNode(Node node) { + return node.kind() == SyntaxKind::IndexedAccessType; + } + + bool isMappedTypeNode(Node node) { + return node.kind() == SyntaxKind::MappedType; + } + + bool isLiteralTypeNode(Node node) { + return node.kind() == SyntaxKind::LiteralType; + } + + bool isImportTypeNode(Node node) { + return node.kind() == SyntaxKind::ImportType; + } + + bool isTemplateLiteralTypeSpan(Node node) { + return node.kind() == SyntaxKind::TemplateLiteralTypeSpan; + } + + bool isTemplateLiteralTypeNode(Node node) { + return node.kind() == SyntaxKind::TemplateLiteralType; + } + + // Binding patterns + + bool isObjectBindingPattern(Node node) { + return node.kind() == SyntaxKind::ObjectBindingPattern; + } + + bool isArrayBindingPattern(Node node) { + return node.kind() == SyntaxKind::ArrayBindingPattern; + } + + bool isBindingElement(Node node) { + return node.kind() == SyntaxKind::BindingElement; + } + + // Expression + + bool isArrayLiteralExpression(Node node) { + return node.kind() == SyntaxKind::ArrayLiteralExpression; + } + + bool isObjectLiteralExpression(Node node) { + return node.kind() == SyntaxKind::ObjectLiteralExpression; + } + + bool isPropertyAccessExpression(Node node) { + return node.kind() == SyntaxKind::PropertyAccessExpression; + } + + bool isElementAccessExpression(Node node) { + return node.kind() == SyntaxKind::ElementAccessExpression; + } + + bool isCallExpression(Node node) { + return node.kind() == SyntaxKind::CallExpression; + } + + bool isNewExpression(Node node) { + return node.kind() == SyntaxKind::NewExpression; + } + + bool isTaggedTemplateExpression(Node node) { + return node.kind() == SyntaxKind::TaggedTemplateExpression; + } + + bool isTypeAssertionExpression(Node node) { + return node.kind() == SyntaxKind::TypeAssertionExpression; + } + + bool isParenthesizedExpression(Node node) { + return node.kind() == SyntaxKind::ParenthesizedExpression; + } + + bool isFunctionExpression(Node node) { + return node.kind() == SyntaxKind::FunctionExpression; + } + + bool isArrowFunction(Node node) { + return node.kind() == SyntaxKind::ArrowFunction; + } + + bool isDeleteExpression(Node node) { + return node.kind() == SyntaxKind::DeleteExpression; + } + + bool isTypeOfExpression(Node node) { + return node.kind() == SyntaxKind::TypeOfExpression; + } + + bool isVoidExpression(Node node) { + return node.kind() == SyntaxKind::VoidExpression; + } + + bool isAwaitExpression(Node node) { + return node.kind() == SyntaxKind::AwaitExpression; + } + + bool isPrefixUnaryExpression(Node node) { + return node.kind() == SyntaxKind::PrefixUnaryExpression; + } + + bool isPostfixUnaryExpression(Node node) { + return node.kind() == SyntaxKind::PostfixUnaryExpression; + } + + bool isBinaryExpression(Node node) { + return node.kind() == SyntaxKind::BinaryExpression; + } + + bool isConditionalExpression(Node node) { + return node.kind() == SyntaxKind::ConditionalExpression; + } + + bool isTemplateExpression(Node node) { + return node.kind() == SyntaxKind::TemplateExpression; + } + + bool isYieldExpression(Node node) { + return node.kind() == SyntaxKind::YieldExpression; + } + + bool isSpreadElement(Node node) { + return node.kind() == SyntaxKind::SpreadElement; + } + + bool isClassExpression(Node node) { + return node.kind() == SyntaxKind::ClassExpression; + } + + bool isOmittedExpression(Node node) { + return node.kind() == SyntaxKind::OmittedExpression; + } + + bool isExpressionWithTypeArguments(Node node) { + return node.kind() == SyntaxKind::ExpressionWithTypeArguments; + } + + bool isAsExpression(Node node) { + return node.kind() == SyntaxKind::AsExpression; + } + + bool isNonNullExpression(Node node) { + return node.kind() == SyntaxKind::NonNullExpression; + } + + bool isMetaProperty(Node node) { + return node.kind() == SyntaxKind::MetaProperty; + } + + bool isSyntheticExpression(Node node) { + return node.kind() == SyntaxKind::SyntheticExpression; + } + + bool isPartiallyEmittedExpression(Node node) { + return node.kind() == SyntaxKind::PartiallyEmittedExpression; + } + + bool isCommaListExpression(Node node) { + return node.kind() == SyntaxKind::CommaListExpression; + } + + // Misc + + bool isTemplateSpan(Node node) { + return node.kind() == SyntaxKind::TemplateSpan; + } + + bool isSemicolonClassElement(Node node) { + return node.kind() == SyntaxKind::SemicolonClassElement; + } + + // Elements + + bool isBlock(Node node) { + return node.kind() == SyntaxKind::Block; + } + + bool isVariableStatement(Node node) { + return node.kind() == SyntaxKind::VariableStatement; + } + + bool isEmptyStatement(Node node) { + return node.kind() == SyntaxKind::EmptyStatement; + } + + bool isExpressionStatement(Node node) { + return node.kind() == SyntaxKind::ExpressionStatement; + } + + bool isIfStatement(Node node) { + return node.kind() == SyntaxKind::IfStatement; + } + + bool isDoStatement(Node node) { + return node.kind() == SyntaxKind::DoStatement; + } + + bool isWhileStatement(Node node) { + return node.kind() == SyntaxKind::WhileStatement; + } + + bool isForStatement(Node node) { + return node.kind() == SyntaxKind::ForStatement; + } + + bool isForInStatement(Node node) { + return node.kind() == SyntaxKind::ForInStatement; + } + + bool isForOfStatement(Node node) { + return node.kind() == SyntaxKind::ForOfStatement; + } + + bool isContinueStatement(Node node) { + return node.kind() == SyntaxKind::ContinueStatement; + } + + bool isBreakStatement(Node node) { + return node.kind() == SyntaxKind::BreakStatement; + } + + bool isReturnStatement(Node node) { + return node.kind() == SyntaxKind::ReturnStatement; + } + + bool isWithStatement(Node node) { + return node.kind() == SyntaxKind::WithStatement; + } + + bool isSwitchStatement(Node node) { + return node.kind() == SyntaxKind::SwitchStatement; + } + + bool isLabeledStatement(Node node) { + return node.kind() == SyntaxKind::LabeledStatement; + } + + bool isThrowStatement(Node node) { + return node.kind() == SyntaxKind::ThrowStatement; + } + + bool isTryStatement(Node node) { + return node.kind() == SyntaxKind::TryStatement; + } + + bool isDebuggerStatement(Node node) { + return node.kind() == SyntaxKind::DebuggerStatement; + } + + bool isVariableDeclaration(Node node) { + return node.kind() == SyntaxKind::VariableDeclaration; + } + + bool isVariableDeclarationList(Node node) { + return node.kind() == SyntaxKind::VariableDeclarationList; + } + + bool isFunctionDeclaration(Node node) { + return node.kind() == SyntaxKind::FunctionDeclaration; + } + + bool isClassDeclaration(Node node) { + return node.kind() == SyntaxKind::ClassDeclaration; + } + + bool isInterfaceDeclaration(Node node) { + return node.kind() == SyntaxKind::InterfaceDeclaration; + } + + bool isTypeAliasDeclaration(Node node) { + return node.kind() == SyntaxKind::TypeAliasDeclaration; + } + + bool isEnumDeclaration(Node node) { + return node.kind() == SyntaxKind::EnumDeclaration; + } + + bool isModuleDeclaration(Node node) { + return node.kind() == SyntaxKind::ModuleDeclaration; + } + + bool isModuleBlock(Node node) { + return node.kind() == SyntaxKind::ModuleBlock; + } + + bool isCaseBlock(Node node) { + return node.kind() == SyntaxKind::CaseBlock; + } + + bool isNamespaceExportDeclaration(Node node) { + return node.kind() == SyntaxKind::NamespaceExportDeclaration; + } + + bool isImportEqualsDeclaration(Node node) { + return node.kind() == SyntaxKind::ImportEqualsDeclaration; + } + + bool isImportDeclaration(Node node) { + return node.kind() == SyntaxKind::ImportDeclaration; + } + + bool isImportClause(Node node) { + return node.kind() == SyntaxKind::ImportClause; + } + + bool isAssertClause(Node node) { + return node.kind() == SyntaxKind::AssertClause; + } + + bool isAssertEntry(Node node) { + return node.kind() == SyntaxKind::AssertEntry; + } + + bool isNamespaceImport(Node node) { + return node.kind() == SyntaxKind::NamespaceImport; + } + + bool isNamespaceExport(Node node) { + return node.kind() == SyntaxKind::NamespaceExport; + } + + bool isNamedImports(Node node) { + return node.kind() == SyntaxKind::NamedImports; + } + + bool isImportSpecifier(Node node) { + return node.kind() == SyntaxKind::ImportSpecifier; + } + + bool isExportAssignment(Node node) { + return node.kind() == SyntaxKind::ExportAssignment; + } + + bool isExportDeclaration(Node node) { + return node.kind() == SyntaxKind::ExportDeclaration; + } + + bool isNamedExports(Node node) { + return node.kind() == SyntaxKind::NamedExports; + } + + bool isExportSpecifier(Node node) { + return node.kind() == SyntaxKind::ExportSpecifier; + } + + bool isMissingDeclaration(Node node) { + return node.kind() == SyntaxKind::MissingDeclaration; + } + + bool isNotEmittedStatement(Node node) { + return node.kind() == SyntaxKind::NotEmittedStatement; + } + + /* @internal */ + bool isSyntheticReference(Node node) { + return node.kind() == SyntaxKind::SyntheticReferenceExpression; + } + + /* @internal */ + bool isMergeDeclarationMarker(Node node) { + return node.kind() == SyntaxKind::MergeDeclarationMarker; + } + + /* @internal */ + bool isEndOfDeclarationMarker(Node node) { + return node.kind() == SyntaxKind::EndOfDeclarationMarker; + } + + // Module References + + bool isExternalModuleReference(Node node) { + return node.kind() == SyntaxKind::ExternalModuleReference; + } + + // JSX + + bool isJsxElement(Node node) { + return node.kind() == SyntaxKind::JsxElement; + } + + bool isJsxSelfClosingElement(Node node) { + return node.kind() == SyntaxKind::JsxSelfClosingElement; + } + + bool isJsxOpeningElement(Node node) { + return node.kind() == SyntaxKind::JsxOpeningElement; + } + + bool isJsxClosingElement(Node node) { + return node.kind() == SyntaxKind::JsxClosingElement; + } + + bool isJsxFragment(Node node) { + return node.kind() == SyntaxKind::JsxFragment; + } + + bool isJsxOpeningFragment(Node node) { + return node.kind() == SyntaxKind::JsxOpeningFragment; + } + + bool isJsxClosingFragment(Node node) { + return node.kind() == SyntaxKind::JsxClosingFragment; + } + + bool isJsxAttribute(Node node) { + return node.kind() == SyntaxKind::JsxAttribute; + } + + bool isJsxAttributes(Node node) { + return node.kind() == SyntaxKind::JsxAttributes; + } + + bool isJsxSpreadAttribute(Node node) { + return node.kind() == SyntaxKind::JsxSpreadAttribute; + } + + bool isJsxExpression(Node node) { + return node.kind() == SyntaxKind::JsxExpression; + } + + // Clauses + + bool isCaseClause(Node node) { + return node.kind() == SyntaxKind::CaseClause; + } + + bool isDefaultClause(Node node) { + return node.kind() == SyntaxKind::DefaultClause; + } + + bool isHeritageClause(Node node) { + return node.kind() == SyntaxKind::HeritageClause; + } + + bool isCatchClause(Node node) { + return node.kind() == SyntaxKind::CatchClause; + } + + // Property assignments + + bool isPropertyAssignment(Node node) { + return node.kind() == SyntaxKind::PropertyAssignment; + } + + bool isShorthandPropertyAssignment(Node node) { + return node.kind() == SyntaxKind::ShorthandPropertyAssignment; + } + + bool isSpreadAssignment(Node node) { + return node.kind() == SyntaxKind::SpreadAssignment; + } + + // Enum + + bool isEnumMember(Node node) { + return node.kind() == SyntaxKind::EnumMember; + } + + // Unparsed + + // TODO(rbuckton): isUnparsedPrologue + + bool isUnparsedPrepend(Node node) { + return node.kind() == SyntaxKind::UnparsedPrepend; + } + + // TODO(rbuckton): isUnparsedText + // TODO(rbuckton): isUnparsedInternalText + // TODO(rbuckton): isUnparsedSyntheticReference + + // Top-level nodes + bool isSourceFile(Node node) { + return node.kind() == SyntaxKind::SourceFile; + } + + bool isBundle(Node node) { + return node.kind() == SyntaxKind::Bundle; + } + + bool isUnparsedSource(Node node) { + return node.kind() == SyntaxKind::UnparsedSource; + } + + // TODO(rbuckton): isInputFiles + + // JSDoc Elements + + bool isJSDocTypeExpression(Node node) { + return node.kind() == SyntaxKind::JSDocTypeExpression; + } + + bool isJSDocNameReference(Node node) { + return node.kind() == SyntaxKind::JSDocNameReference; + } + + bool isJSDocMemberName(Node node) { + return node.kind() == SyntaxKind::JSDocMemberName; + } + + bool isJSDocLink(Node node) { + return node.kind() == SyntaxKind::JSDocLink; + } + + bool isJSDocLinkCode(Node node) { + return node.kind() == SyntaxKind::JSDocLinkCode; + } + + bool isJSDocLinkPlain(Node node) { + return node.kind() == SyntaxKind::JSDocLinkPlain; + } + + bool isJSDocAllType(Node node) { + return node.kind() == SyntaxKind::JSDocAllType; + } + + bool isJSDocUnknownType(Node node) { + return node.kind() == SyntaxKind::JSDocUnknownType; + } + + bool isJSDocNullableType(Node node) { + return node.kind() == SyntaxKind::JSDocNullableType; + } + + bool isJSDocNonNullableType(Node node) { + return node.kind() == SyntaxKind::JSDocNonNullableType; + } + + bool isJSDocOptionalType(Node node) { + return node.kind() == SyntaxKind::JSDocOptionalType; + } + + bool isJSDocFunctionType(Node node) { + return node.kind() == SyntaxKind::JSDocFunctionType; + } + + bool isJSDocVariadicType(Node node) { + return node.kind() == SyntaxKind::JSDocVariadicType; + } + + bool isJSDocNamepathType(Node node) { + return node.kind() == SyntaxKind::JSDocNamepathType; + } + + bool isJSDoc(Node node) { + return node.kind() == SyntaxKind::JSDoc; + } + + bool isJSDocTypeLiteral(Node node) { + return node.kind() == SyntaxKind::JSDocTypeLiteral; + } + + bool isJSDocSignature(Node node) { + return node.kind() == SyntaxKind::JSDocSignature; + } + + // JSDoc Tags + + bool isJSDocAugmentsTag(Node node) { + return node.kind() == SyntaxKind::JSDocAugmentsTag; + } + + bool isJSDocAuthorTag(Node node) { + return node.kind() == SyntaxKind::JSDocAuthorTag; + } + + bool isJSDocClassTag(Node node) { + return node.kind() == SyntaxKind::JSDocClassTag; + } + + bool isJSDocCallbackTag(Node node) { + return node.kind() == SyntaxKind::JSDocCallbackTag; + } + + bool isJSDocPublicTag(Node node) { + return node.kind() == SyntaxKind::JSDocPublicTag; + } + + bool isJSDocPrivateTag(Node node) { + return node.kind() == SyntaxKind::JSDocPrivateTag; + } + + bool isJSDocProtectedTag(Node node) { + return node.kind() == SyntaxKind::JSDocProtectedTag; + } + + bool isJSDocReadonlyTag(Node node) { + return node.kind() == SyntaxKind::JSDocReadonlyTag; + } + + bool isJSDocOverrideTag(Node node) { + return node.kind() == SyntaxKind::JSDocOverrideTag; + } + + bool isJSDocDeprecatedTag(Node node) { + return node.kind() == SyntaxKind::JSDocDeprecatedTag; + } + + bool isJSDocSeeTag(Node node) { + return node.kind() == SyntaxKind::JSDocSeeTag; + } + + bool isJSDocEnumTag(Node node) { + return node.kind() == SyntaxKind::JSDocEnumTag; + } + + bool isJSDocParameterTag(Node node) { + return node.kind() == SyntaxKind::JSDocParameterTag; + } + + bool isJSDocReturnTag(Node node) { + return node.kind() == SyntaxKind::JSDocReturnTag; + } + + bool isJSDocThisTag(Node node) { + return node.kind() == SyntaxKind::JSDocThisTag; + } + + bool isJSDocTypeTag(Node node) { + return node.kind() == SyntaxKind::JSDocTypeTag; + } + + bool isJSDocTemplateTag(Node node) { + return node.kind() == SyntaxKind::JSDocTemplateTag; + } + + bool isJSDocTypedefTag(Node node) { + return node.kind() == SyntaxKind::JSDocTypedefTag; + } + + bool isJSDocUnknownTag(Node node) { + return node.kind() == SyntaxKind::JSDocTag; + } + + bool isJSDocPropertyTag(Node node) { + return node.kind() == SyntaxKind::JSDocPropertyTag; + } + + bool isJSDocImplementsTag(Node node) { + return node.kind() == SyntaxKind::JSDocImplementsTag; + } + + // Synthesized list + + /* @internal */ + bool isSyntaxList(Node node){ + return node.kind() == SyntaxKind::SyntaxList; + } +} diff --git a/src/parser.cpp b/src/parser.cpp new file mode 100644 index 0000000..2f16226 --- /dev/null +++ b/src/parser.cpp @@ -0,0 +1,527 @@ +#include +#include "parser.h" +#include "diagnostic_messages.h" + +using namespace ts; + +ts::SourceFile Parser::parse() { + // Prime the scanner. + scanner.scan(); + +// auto statements = parseList(ParsingContext::SourceElements, parseStatement); +} + +bool Parser::isListTerminator(ParsingContext kind) { + if (token() == SyntaxKind::EndOfFileToken) { + // Being at the end of the file ends all lists. + return true; + } + + switch (kind) { + case ParsingContext::BlockStatements: + case ParsingContext::SwitchClauses: + case ParsingContext::TypeMembers: + case ParsingContext::ClassMembers: + case ParsingContext::EnumMembers: + case ParsingContext::ObjectLiteralMembers: + case ParsingContext::ObjectBindingElements: + case ParsingContext::ImportOrExportSpecifiers: + case ParsingContext::AssertEntries: + return token() == SyntaxKind::CloseBraceToken; + case ParsingContext::SwitchClauseStatements: + return token() == SyntaxKind::CloseBraceToken || token() == SyntaxKind::CaseKeyword || token() == SyntaxKind::DefaultKeyword; + case ParsingContext::HeritageClauseElement: + return token() == SyntaxKind::OpenBraceToken || token() == SyntaxKind::ExtendsKeyword || token() == SyntaxKind::ImplementsKeyword; + case ParsingContext::VariableDeclarations: + return isVariableDeclaratorListTerminator(); + case ParsingContext::TypeParameters: + // Tokens other than '>' are here for better error recovery + return token() == SyntaxKind::GreaterThanToken || token() == SyntaxKind::OpenParenToken || token() == SyntaxKind::OpenBraceToken || token() == SyntaxKind::ExtendsKeyword || token() == SyntaxKind::ImplementsKeyword; + case ParsingContext::ArgumentExpressions: + // Tokens other than ')' are here for better error recovery + return token() == SyntaxKind::CloseParenToken || token() == SyntaxKind::SemicolonToken; + case ParsingContext::ArrayLiteralMembers: + case ParsingContext::TupleElementTypes: + case ParsingContext::ArrayBindingElements: + return token() == SyntaxKind::CloseBracketToken; + case ParsingContext::JSDocParameters: + case ParsingContext::Parameters: + case ParsingContext::RestProperties: + // Tokens other than ')' and ']' (the latter for index signatures) are here for better error recovery + return token() == SyntaxKind::CloseParenToken || token() == SyntaxKind::CloseBracketToken /*|| token == SyntaxKind::OpenBraceToken*/; + case ParsingContext::TypeArguments: + // All other tokens should cause the type-argument to terminate except comma token + return token() != SyntaxKind::CommaToken; + case ParsingContext::HeritageClauses: + return token() == SyntaxKind::OpenBraceToken || token() == SyntaxKind::CloseBraceToken; + case ParsingContext::JsxAttributes: + return token() == SyntaxKind::GreaterThanToken || token() == SyntaxKind::SlashToken; + case ParsingContext::JsxChildren: + return token() == SyntaxKind::LessThanToken && lookAhead([this] { return this->nextTokenIsSlash(); }); + default: + return false; + } +} + +SyntaxKind Parser::token() { + return currentToken; +} + +SyntaxKind Parser::nextToken() { + // if the keyword had an escape + if (isKeyword(currentToken) && (scanner.hasUnicodeEscape() || scanner.hasExtendedUnicodeEscape())) { + // issue a parse error for the escape + parseErrorAt(scanner.getTokenPos(), scanner.getTextPos(), Diagnostics::Keywords_cannot_contain_escape_characters); + } + return nextTokenWithoutCheck(); +} + +bool Parser::nextTokenIsSlash() { + return nextToken() == SyntaxKind::SlashToken; +} + +SyntaxKind Parser::nextTokenWithoutCheck() { + return currentToken = scanner.scan(); +} + +bool Parser::lookAhead(function callback) { + return speculationHelper(callback, SpeculationKind::Lookahead); +} + +bool Parser::tryParse(function callback) { + return speculationHelper(callback, SpeculationKind::TryParse); +} + +bool Parser::speculationHelper(function callback, SpeculationKind speculationKind) { + // Keep track of the state we'll need to rollback to if lookahead fails (or if the + // caller asked us to always reset our state). + auto saveToken = currentToken; + auto saveParseDiagnosticsLength = parseDiagnostics.size(); + auto saveParseErrorBeforeNextFinishedNode = parseErrorBeforeNextFinishedNode; + + // Note: it is not actually necessary to save/restore the context flags here. That's + // because the saving/restoring of these flags happens naturally through the recursive + // descent nature of our parser. However, we still store this here just so we can + // assert that invariant holds. + auto saveContextFlags = contextFlags; + + // If we're only looking ahead, then tell the scanner to only lookahead as well. + // Otherwise, if we're actually speculatively parsing, then tell the scanner to do the + // same. + auto result = speculationKind != SpeculationKind::TryParse + ? scanner.lookAhead(callback) + : scanner.tryScan(callback); + + assert(saveContextFlags == contextFlags); + + // If our callback returned something 'falsy' or we're just looking ahead, + // then unconditionally restore us to where we were. + if (!result || speculationKind != SpeculationKind::TryParse) { + currentToken = saveToken; + if (speculationKind != SpeculationKind::Reparse) { + parseDiagnostics.resize(saveParseDiagnosticsLength); + } + parseErrorBeforeNextFinishedNode = saveParseErrorBeforeNextFinishedNode; + } + + return result; +} + +bool isInOrOfKeyword(SyntaxKind t) { + return t == SyntaxKind::InKeyword || t == SyntaxKind::OfKeyword; +} + +bool Parser::isVariableDeclaratorListTerminator() { + // If we can consume a semicolon (either explicitly, or with ASI), then consider us done + // with parsing the list of variable declarators. + if (canParseSemicolon()) { + return true; + } + + // in the case where we're parsing the variable declarator of a 'for-in' statement, we + // are done if we see an 'in' keyword in front of us. Same with for-of + if (isInOrOfKeyword(token())) { + return true; + } + + // ERROR RECOVERY TWEAK: + // For better error recovery, if we see an '=>' then we just stop immediately. We've got an + // arrow function here and it's going to be very unlikely that we'll resynchronize and get + // another variable declaration. + if (token() == SyntaxKind::EqualsGreaterThanToken) { + return true; + } + + // Keep trying to parse out variable declarators. + return false; +} + +bool Parser::canParseSemicolon() { + // If there's a real semicolon, then we can always parse it out. + if (token() == SyntaxKind::SemicolonToken) { + return true; + } + + // We can parse out an optional semicolon in ASI cases in the following cases. + return token() == SyntaxKind::CloseBraceToken || token() == SyntaxKind::EndOfFileToken || scanner.hasPrecedingLineBreak(); +} + +Statement Parser::parseStatement() { + return Statement{}; +} + +//NodeArray Parser::createNodeArray(vector nodes, int pos, int end, bool hasTrailingComma) { +// auto array = NodeArray{.list = nodes, pos, .end = end == -1 ? scanner.getStartPos() : end, hasTrailingComma}; +// +// return array; +//} + +//optional Parser::currentNode(int parsingContext) { +// // If we don't have a cursor or the parsing context isn't reusable, there's nothing to reuse. +// // +// // If there is an outstanding parse error that we've encountered, but not attached to +// // some node, then we cannot get a node from the old source tree. This is because we +// // want to mark the next node we encounter as being unusable. +// // +// // Note: This may be too conservative. Perhaps we could reuse the node and set the bit +// // on it (or its leftmost child) as having the error. For now though, being conservative +// // is nice and likely won't ever affect perf. +// if (!syntaxCursor || !isReusableParsingContext(parsingContext) || parseErrorBeforeNextFinishedNode) { +// return nullopt; +// } +// +// const node = syntaxCursor.currentNode(scanner.getStartPos()); +// +// // Can't reuse a missing node. +// // Can't reuse a node that intersected the change range. +// // Can't reuse a node that contains a parse error. This is necessary so that we +// // produce the same set of errors again. +// if (nodeIsMissing(node) || node.intersectsChange || containsParseError(node)) { +// return nullopt; +// } +// +// // We can only reuse a node if it was parsed under the same strict mode that we're +// // currently in. i.e. if we originally parsed a node in non-strict mode, but then +// // the user added 'using strict' at the top of the file, then we can't use that node +// // again as the presence of strict mode may cause us to parse the tokens in the file +// // differently. +// // +// // Note: we *can* reuse tokens when the strict mode changes. That's because tokens +// // are unaffected by strict mode. It's just the parser will decide what to do with it +// // differently depending on what mode it is in. +// // +// // This also applies to all our other context flags as well. +// auto nodeContextFlags = node.flags & NodeFlags::ContextFlags; +// if (nodeContextFlags != contextFlags) { +// return nullopt; +// } +// +// // Ok, we have a node that looks like it could be reused. Now verify that it is valid +// // in the current list parsing context that we're currently at. +// if (!canReuseNode(node, parsingContext)) { +// return nullopt; +// } +// +//// if ((node as JSDocContainer).jsDocCache) { +//// // jsDocCache may include tags from parent nodes, which might have been modified. +//// (node as JSDocContainer).jsDocCache = undefined; +//// } +// +// return node; +//} + +bool Parser::isListElement(int parsingContext, bool inErrorRecovery) { + //see signature of currentNode +// auto node = currentNode(parsingContext); +// if (node) { +// return true; +// } + +// switch (parsingContext) { +// case ParsingContext::SourceElements: +// case ParsingContext::BlockStatements: +// case ParsingContext::SwitchClauseStatements: +// // If we're in error recovery, then we don't want to treat ';' as an empty statement. +// // The problem is that ';' can show up in far too many contexts, and if we see one +// // and assume it's a statement, then we may bail out inappropriately from whatever +// // we're parsing. For example, if we have a semicolon in the middle of a class, then +// // we really don't want to assume the class is over and we're on a statement in the +// // outer module. We just want to consume and move on. +// return !(token() == SyntaxKind::SemicolonToken && inErrorRecovery) && isStartOfStatement(); +// case ParsingContext::SwitchClauses: +// return token() == SyntaxKind::CaseKeyword || token() == SyntaxKind::DefaultKeyword; +// case ParsingContext::TypeMembers: +// return lookAhead(isTypeMemberStart); +// case ParsingContext::ClassMembers: +// // We allow semicolons as class elements (as specified by ES6) as long as we're +// // not in error recovery. If we're in error recovery, we don't want an errant +// // semicolon to be treated as a class member (since they're almost always used +// // for statements. +// return lookAhead(isClassMemberStart) || (token() == SyntaxKind::SemicolonToken && !inErrorRecovery); +// case ParsingContext::EnumMembers: +// // Include open bracket computed properties. This technically also lets in indexers, +// // which would be a candidate for improved error reporting. +// return token() == SyntaxKind::OpenBracketToken || isLiteralPropertyName(); +// case ParsingContext::ObjectLiteralMembers: +// switch (token()) { +// case SyntaxKind::OpenBracketToken: +// case SyntaxKind::AsteriskToken: +// case SyntaxKind::DotDotDotToken: +// case SyntaxKind::DotToken: // Not an object literal member, but don't want to close the object (see `tests/cases/fourslash/completionsDotInObjectLiteral.ts`) +// return true; +// default: +// return isLiteralPropertyName(); +// } +// case ParsingContext::RestProperties: +// return isLiteralPropertyName(); +// case ParsingContext::ObjectBindingElements: +// return token() == SyntaxKind::OpenBracketToken || token() == SyntaxKind::DotDotDotToken || isLiteralPropertyName(); +// case ParsingContext::AssertEntries: +// return isAssertionKey(); +// case ParsingContext::HeritageClauseElement: +// // If we see `{ ... }` then only consume it as an expression if it is followed by `,` or `{` +// // That way we won't consume the body of a class in its heritage clause. +// if (token() == SyntaxKind::OpenBraceToken) { +// return lookAhead(isValidHeritageClauseObjectLiteral); +// } +// +// if (!inErrorRecovery) { +// return isStartOfLeftHandSideExpression() && !isHeritageClauseExtendsOrImplementsKeyword(); +// } else { +// // If we're in error recovery we tighten up what we're willing to match. +// // That way we don't treat something like "this" as a valid heritage clause +// // element during recovery. +// return isIdentifier() && !isHeritageClauseExtendsOrImplementsKeyword(); +// } +// case ParsingContext::VariableDeclarations: +// return isBindingIdentifierOrPrivateIdentifierOrPattern(); +// case ParsingContext::ArrayBindingElements: +// return token() == SyntaxKind::CommaToken || token() == SyntaxKind::DotDotDotToken || isBindingIdentifierOrPrivateIdentifierOrPattern(); +// case ParsingContext::TypeParameters: +// return token() == SyntaxKind::InKeyword || isIdentifier(); +// case ParsingContext::ArrayLiteralMembers: +// switch (token()) { +// case SyntaxKind::CommaToken: +// case SyntaxKind::DotToken: // Not an array literal member, but don't want to close the array (see `tests/cases/fourslash/completionsDotInArrayLiteralInObjectLiteral.ts`) +// return true; +// } +// // falls through +// case ParsingContext::ArgumentExpressions: +// return token() == SyntaxKind::DotDotDotToken || isStartOfExpression(); +// case ParsingContext::Parameters: +// return isStartOfParameter(/*isJSDocParameter*/ false); +// case ParsingContext::JSDocParameters: +// return isStartOfParameter(/*isJSDocParameter*/ true); +// case ParsingContext::TypeArguments: +// case ParsingContext::TupleElementTypes: +// return token() == SyntaxKind::CommaToken || isStartOfType(); +// case ParsingContext::HeritageClauses: +// return isHeritageClause(); +// case ParsingContext::ImportOrExportSpecifiers: +// return tokenIsIdentifierOrKeyword(token()); +// case ParsingContext::JsxAttributes: +// return tokenIsIdentifierOrKeyword(token()) || token() == SyntaxKind::OpenBraceToken; +// case ParsingContext::JsxChildren: +// return true; +// } +// +// return Debug.fail("Non-exhaustive case in 'isListElement'."); +} +bool Parser::isIdentifier() { + if (token() == SyntaxKind::Identifier) { + return true; + } + +// // If we have a 'yield' keyword, and we're in the [yield] context, then 'yield' is +// // considered a keyword and is not an identifier. +// if (token() == SyntaxKind::YieldKeyword && inYieldContext()) { +// return false; +// } +// +// // If we have a 'await' keyword, and we're in the [Await] context, then 'await' is +// // considered a keyword and is not an identifier. +// if (token() == SyntaxKind::AwaitKeyword && inAwaitContext()) { +// return false; +// } + + return token() > SyntaxKind::LastReservedWord; +} + +bool tokenIsIdentifierOrKeyword(SyntaxKind token) { + return token >= SyntaxKind::Identifier; +} + +bool Parser::nextTokenIsIdentifierOnSameLine() { + nextToken(); + return !scanner.hasPrecedingLineBreak() && isIdentifier(); +} + +bool Parser::nextTokenIsIdentifierOrStringLiteralOnSameLine() { + nextToken(); + return !scanner.hasPrecedingLineBreak() && (isIdentifier() || token() == SyntaxKind::StringLiteral); +} + +bool Parser::isDeclaration() { + while (true) { + switch (token()) { + case SyntaxKind::VarKeyword: + case SyntaxKind::LetKeyword: + case SyntaxKind::ConstKeyword: + case SyntaxKind::FunctionKeyword: + case SyntaxKind::ClassKeyword: + case SyntaxKind::EnumKeyword: + return true; + + // 'declare', 'module', 'namespace', 'interface'* and 'type' are all legal JavaScript identifiers; + // however, an identifier cannot be followed by another identifier on the same line. This is what we + // count on to parse out the respective declarations. For instance, we exploit this to say that + // + // namespace n + // + // can be none other than the beginning of a namespace declaration, but need to respect that JavaScript sees + // + // namespace + // n + // + // as the identifier 'namespace' on one line followed by the identifier 'n' on another. + // We need to look one token ahead to see if it permissible to try parsing a declaration. + // + // *Note*: 'interface' is actually a strict mode reserved word. So while + // + // "use strict" + // interface + // I {} + // + // could be legal, it would add complexity for very little gain. + case SyntaxKind::InterfaceKeyword: + case SyntaxKind::TypeKeyword: + return nextTokenIsIdentifierOnSameLine(); + case SyntaxKind::ModuleKeyword: + case SyntaxKind::NamespaceKeyword: + return nextTokenIsIdentifierOrStringLiteralOnSameLine(); + case SyntaxKind::AbstractKeyword: + case SyntaxKind::AsyncKeyword: + case SyntaxKind::DeclareKeyword: + case SyntaxKind::PrivateKeyword: + case SyntaxKind::ProtectedKeyword: + case SyntaxKind::PublicKeyword: + case SyntaxKind::ReadonlyKeyword: + nextToken(); + // ASI takes effect for this modifier. + if (scanner.hasPrecedingLineBreak()) { + return false; + } + continue; + + case SyntaxKind::GlobalKeyword: + nextToken(); + return token() == SyntaxKind::OpenBraceToken || token() == SyntaxKind::Identifier || token() == SyntaxKind::ExportKeyword; + + case SyntaxKind::ImportKeyword: + nextToken(); + return token() == SyntaxKind::StringLiteral || token() == SyntaxKind::AsteriskToken || + token() == SyntaxKind::OpenBraceToken || tokenIsIdentifierOrKeyword(token()); +// case SyntaxKind::ExportKeyword: +// auto currentToken = nextToken(); +// if (currentToken == SyntaxKind::TypeKeyword) { +// currentToken = lookAhead([this] { return this->nextToken(); }); +// } +// if (currentToken == SyntaxKind::EqualsToken || currentToken == SyntaxKind::AsteriskToken || +// currentToken == SyntaxKind::OpenBraceToken || currentToken == SyntaxKind::DefaultKeyword || +// currentToken == SyntaxKind::AsKeyword) { +// return true; +// } +// continue; + + case SyntaxKind::StaticKeyword: + nextToken(); + continue; + default: + return false; + } + } +} +bool Parser::isStartOfDeclaration() { + return lookAhead([this] { return this->isDeclaration(); }); +} +bool Parser::isStartOfStatement() { + switch (token()) { + case SyntaxKind::AtToken: + case SyntaxKind::SemicolonToken: + case SyntaxKind::OpenBraceToken: + case SyntaxKind::VarKeyword: + case SyntaxKind::LetKeyword: + case SyntaxKind::FunctionKeyword: + case SyntaxKind::ClassKeyword: + case SyntaxKind::EnumKeyword: + case SyntaxKind::IfKeyword: + case SyntaxKind::DoKeyword: + case SyntaxKind::WhileKeyword: + case SyntaxKind::ForKeyword: + case SyntaxKind::ContinueKeyword: + case SyntaxKind::BreakKeyword: + case SyntaxKind::ReturnKeyword: + case SyntaxKind::WithKeyword: + case SyntaxKind::SwitchKeyword: + case SyntaxKind::ThrowKeyword: + case SyntaxKind::TryKeyword: + case SyntaxKind::DebuggerKeyword: + // 'catch' and 'finally' do not actually indicate that the code is part of a statement, + // however, we say they are here so that we may gracefully parse them and error later. + // falls through + case SyntaxKind::CatchKeyword: + case SyntaxKind::FinallyKeyword: + return true; + +// case SyntaxKind::ImportKeyword: +// return isStartOfDeclaration() || lookAhead(nextTokenIsOpenParenOrLessThanOrDot); + + case SyntaxKind::ConstKeyword: + case SyntaxKind::ExportKeyword: + return isStartOfDeclaration(); + + case SyntaxKind::AsyncKeyword: + case SyntaxKind::DeclareKeyword: + case SyntaxKind::InterfaceKeyword: + case SyntaxKind::ModuleKeyword: + case SyntaxKind::NamespaceKeyword: + case SyntaxKind::TypeKeyword: + case SyntaxKind::GlobalKeyword: + // When these don't start a declaration, they're an identifier in an expression statement + return true; + +// case SyntaxKind::PublicKeyword: +// case SyntaxKind::PrivateKeyword: +// case SyntaxKind::ProtectedKeyword: +// case SyntaxKind::StaticKeyword: +// case SyntaxKind::ReadonlyKeyword: +// // When these don't start a declaration, they may be the start of a class member if an identifier +// // immediately follows. Otherwise they're an identifier in an expression statement. +// return isStartOfDeclaration() || !lookAhead(nextTokenIsIdentifierOrKeywordOnSameLine); +// +// default: +// return isStartOfExpression(); + } +} + +//NodeArray Parser::parseList(ParsingContext kind, function parseElement) { +// auto saveParsingContext = parsingContext; +// parsingContext |= 1 << kind; +// vector list; +// auto listPos = getNodePos(); +// +// while (!isListTerminator(kind)) { +// if (isListElement(kind, /*inErrorRecovery*/ false)) { +// list.push(parseListElement(kind, parseElement)); +// +// continue; +// } +// +// if (abortParsingListOrMoveToNextToken(kind)) { +// break; +// } +// } +// +// parsingContext = saveParsingContext; +// return createNodeArray(list, listPos); +//} diff --git a/src/parser.h b/src/parser.h new file mode 100644 index 0000000..2ae9267 --- /dev/null +++ b/src/parser.h @@ -0,0 +1,225 @@ +#pragma once + +#include +#include +#include +#include +#include "types.h" +#include "scanner.h" +#include "utilities.h" + +using namespace std; + +namespace ts { + enum class SignatureFlags { + None = 0, + Yield = 1 << 0, + Await = 1 << 1, + Type = 1 << 2, + IgnoreMissingOpenBrace = 1 << 4, + JSDoc = 1 << 5 + }; + + enum class SpeculationKind { + TryParse, + Lookahead, + Reparse + }; + enum ParsingContext { + SourceElements, // Elements in source file + BlockStatements, // Statements in block + SwitchClauses, // Clauses in switch statement + SwitchClauseStatements, // Statements in switch clause + TypeMembers, // Members in interface or type literal + ClassMembers, // Members in class declaration + EnumMembers, // Members in enum declaration + HeritageClauseElement, // Elements in a heritage clause + VariableDeclarations, // Variable declarations in variable statement + ObjectBindingElements, // Binding elements in object binding list + ArrayBindingElements, // Binding elements in array binding list + ArgumentExpressions, // Expressions in argument list + ObjectLiteralMembers, // Members in object literal + JsxAttributes, // Attributes in jsx element + JsxChildren, // Things between opening and closing JSX tags + ArrayLiteralMembers, // Members in array literal + Parameters, // Parameters in parameter list + JSDocParameters, // JSDoc parameters in parameter list of JSDoc function type + RestProperties, // Property names in a rest type list + TypeParameters, // Type parameters in type parameter list + TypeArguments, // Type arguments in type argument list + TupleElementTypes, // Element types in tuple element type list + HeritageClauses, // Heritage clauses for a class or interface declaration. + ImportOrExportSpecifiers, // Named import clause's import specifier list, + AssertEntries, // Import entries list. + Count // Number of parsing contexts + }; + + class Parser { + public: + string fileName; + string sourceText; + ScriptKind scriptKind; + ScriptTarget languageVersion; + LanguageVariant languageVariant; + Scanner scanner; + + // Flags that dictate what parsing context we're in. For example: + // Whether or not we are in strict parsing mode. All that changes in strict parsing mode is + // that some tokens that would be considered identifiers may be considered keywords. + // + // When adding more parser context flags, consider which is the more common case that the + // flag will be in. This should be the 'false' state for that flag. The reason for this is + // that we don't store data in our nodes unless the value is in the *non-default* state. So, + // for example, more often than code 'allows-in' (or doesn't 'disallow-in'). We opt for + // 'disallow-in' set to 'false'. Otherwise, if we had 'allowsIn' set to 'true', then almost + // all nodes would need extra state on them to store this info. + // + // Note: 'allowIn' and 'allowYield' track 1:1 with the [in] and [yield] concepts in the ES6 + // grammar specification. + // + // An important thing about these context concepts. By default they are effectively inherited + // while parsing through every grammar production. i.e. if you don't change them, then when + // you parse a sub-production, it will have the same context values as the parent production. + // This is great most of the time. After all, consider all the 'expression' grammar productions + // and how nearly all of them pass along the 'in' and 'yield' context values: + // + // EqualityExpression[In, Yield] : + // RelationalExpression[?In, ?Yield] + // EqualityExpression[?In, ?Yield] == RelationalExpression[?In, ?Yield] + // EqualityExpression[?In, ?Yield] != RelationalExpression[?In, ?Yield] + // EqualityExpression[?In, ?Yield] === RelationalExpression[?In, ?Yield] + // EqualityExpression[?In, ?Yield] !== RelationalExpression[?In, ?Yield] + // + // Where you have to be careful is then understanding what the points are in the grammar + // where the values are *not* passed along. For example: + // + // SingleNameBinding[Yield,GeneratorParameter] + // [+GeneratorParameter]BindingIdentifier[Yield] Initializer[In]opt + // [~GeneratorParameter]BindingIdentifier[?Yield]Initializer[In, ?Yield]opt + // + // Here this is saying that if the GeneratorParameter context flag is set, that we should + // explicitly set the 'yield' context flag to false before calling into the BindingIdentifier + // and we should explicitly unset the 'yield' context flag before calling into the Initializer. + // production. Conversely, if the GeneratorParameter context flag is not set, then we + // should leave the 'yield' context flag alone. + // + // Getting this all correct is tricky and requires careful reading of the grammar to + // understand when these values should be changed versus when they should be inherited. + // + // Note: it should not be necessary to save/restore these flags during speculative/lookahead + // parsing. These context flags are naturally stored and restored through normal recursive + // descent parsing and unwinding. + /*NodeFlags*/ int contextFlags = 0; + + // Whether or not we've had a parse error since creating the last AST node. If we have + // encountered an error, it will be stored on the next AST node we create. Parse errors + // can be broken down into three categories: + // + // 1) An error that occurred during scanning. For example, an unterminated literal, or a + // character that was completely not understood. + // + // 2) A token was expected, but was not present. This type of error is commonly produced + // by the 'parseExpected' function. + // + // 3) A token was present that no parsing function was able to consume. This type of error + // only occurs in the 'abortParsingListOrMoveToNextToken' function when the parser + // decides to skip the token. + // + // In all of these cases, we want to mark the next node as having had an error before it. + // With this mark, we can know in incremental settings if this node can be reused, or if + // we have to reparse it. If we don't keep this information around, we may just reuse the + // node. in that event we would then not produce the same errors as we did before, causing + // significant confusion problems. + // + // Note: it is necessary that this value be saved/restored during speculative/lookahead + // parsing. During lookahead parsing, we will often create a node. That node will have + // this value attached, and then this value will be set back to 'false'. If we decide to + // rewind, we must get back to the same value we had prior to the lookahead. + // + // Note: any errors at the end of the file that do not precede a regular node, should get + // attached to the EOF token. + bool parseErrorBeforeNextFinishedNode = false; + + SyntaxKind currentToken; + int nodeCount{}; + int identifierCount{}; + /*ParsingContext */ int parsingContext = ParsingContext::SourceElements; + + vector parseDiagnostics; + + Parser(string fileName, string sourceText, ScriptKind scriptKind = ScriptKind::TS, ScriptTarget languageVersion = ScriptTarget::ES2020, LanguageVariant languageVariant = LanguageVariant::Standard) : + fileName(fileName), + sourceText(sourceText), + scriptKind(scriptKind), + languageVersion(languageVersion), + languageVariant(languageVariant), + scanner(Scanner{sourceText} + ) { + scanner.languageVersion = languageVersion; + scanner.languageVariant = languageVariant; + + switch (scriptKind) { + case ScriptKind::JS: + case ScriptKind::JSX: + contextFlags = (int) NodeFlags::JavaScriptFile; + break; + case ScriptKind::JSON: + contextFlags = (int) NodeFlags::JavaScriptFile | (int) NodeFlags::JsonFile; + break; + default: + contextFlags = (int) NodeFlags::None; + break; + } + } + + ts::SourceFile parse(); + + bool isListTerminator(ParsingContext kind); + + private: + SyntaxKind token(); + SyntaxKind nextTokenWithoutCheck(); + SyntaxKind nextToken(); + + int getNodePos() { + return scanner.getStartPos(); + } + + Statement parseStatement(); +// NodeArray parseList(ParsingContext kind, function parseElement); +// NodeArray createNodeArray(vector nodes, int pos, int end = -1, bool hasTrailingComma = false); + bool isListElement(int parsingContext, bool inErrorRecovery); + + //excluded since it seems it not necessary as its an optimization likely not needed in C++ +// optional currentNode(int parsingContext); + + bool nextTokenIsIdentifierOrStringLiteralOnSameLine(); + bool isIdentifier(); + bool nextTokenIsIdentifierOnSameLine(); + bool isDeclaration(); + bool isStartOfDeclaration(); + bool isStartOfStatement(); + bool nextTokenIsSlash(); + bool isVariableDeclaratorListTerminator(); + bool canParseSemicolon(); + + bool lookAhead(function callback); + bool tryParse(function callback); + bool speculationHelper(function callback, SpeculationKind speculationKind); + + void parseErrorAt(int start, int end, DiagnosticMessage message) { + return parseErrorAtPosition(start, end - start, message); + } + + void parseErrorAtPosition(int start, int length, DiagnosticMessage message) { + // Mark that we've encountered an error. We'll set an appropriate bit on the next + // node we finish so that it can't be reused incrementally. + parseErrorBeforeNextFinishedNode = true; + + // Don't report another error if it would just be at the same position as the last error. + if (!parseDiagnostics.empty() || start != parseDiagnostics.back().start) { + parseDiagnostics.push_back(createDetachedDiagnostic(fileName, start, length, message)); + } + } + }; +} diff --git a/src/parser2.h b/src/parser2.h new file mode 100644 index 0000000..94887fb --- /dev/null +++ b/src/parser2.h @@ -0,0 +1,9666 @@ +#pragma once + +#include +#include +#include +#include +#include +#include "types.h" +#include "core.h" +#include "node_test.h" +#include "factory.h" + +using namespace ts::types; + +namespace ts { + using std::string; + using std::vector; + using std::optional; + using std::function; + using std::variant; + + enum class SignatureFlags { + None = 0, + Yield = 1 << 0, + Await = 1 << 1, + Type = 1 << 2, + IgnoreMissingOpenBrace = 1 << 4, + JSDoc = 1 << 5, + }; + + enum class SpeculationKind { + TryParse, + Lookahead, + Reparse + }; + +//// let NodeConstructor: new (kind: SyntaxKind, pos?: number, end?: number) => Node; +//// let TokenConstructor: new (kind: SyntaxKind, pos?: number, end?: number) => Node; +//// let IdentifierConstructor: new (kind: SyntaxKind, pos?: number, end?: number) => Node; +//// let PrivateIdentifierConstructor: new (kind: SyntaxKind, pos?: number, end?: number) => Node; +//// let SourceFileConstructor: new (kind: SyntaxKind, pos?: number, end?: number) => Node; +// +// /** +// * NOTE: You should not use this, it is only exported to support `createNode` in `~/src/deprecatedCompat/deprecations.ts`. +// */ +//// /* @internal */ +//// export const parseBaseNodeFactory: BaseNodeFactory = { +//// createBaseSourceFileNode: kind => new (SourceFileConstructor || (SourceFileConstructor = objectAllocator.getSourceFileConstructor()))(kind, -1, -1), +//// createBaseIdentifierNode: kind => new (IdentifierConstructor || (IdentifierConstructor = objectAllocator.getIdentifierConstructor()))(kind, -1, -1), +//// createBasePrivateIdentifierNode: kind => new (PrivateIdentifierConstructor || (PrivateIdentifierConstructor = objectAllocator.getPrivateIdentifierConstructor()))(kind, -1, -1), +//// createBaseTokenNode: kind => new (TokenConstructor || (TokenConstructor = objectAllocator.getTokenConstructor()))(kind, -1, -1), +//// createBaseNode: kind => new (NodeConstructor || (NodeConstructor = objectAllocator.getNodeConstructor()))(kind, -1, -1), +//// }; +//// +//// /* @internal */ +//// export const parseNodeFactory = createNodeFactory(NodeFactoryFlags.NoParenthesizerRules, parseBaseNodeFactory); + + LogicalOrReturnLast> visitNode(function(Node &)> cbNode, optional node) { + if (node) LogicalOrReturnLast(cbNode(*node)); + return LogicalOrReturnLast>(nullopt); +// return LogicalOrReturnLast(node ? cbNode(*node) : nullptr); + } + +// Node *visitNode(function cbNode, Node &node) { +// return cbNode(node); +// } + + LogicalOrReturnLast> visitNodes( + function(Node &)> cbNode, + optional(BaseNodeArray)>> cbNodes, + optional nodes + ) { + if (nodes) { + if (cbNodes) { + return (*cbNodes)(*nodes); + } + for (auto node: nodes->list) { + auto result = cbNode(node); + if (result) { + return result; + } + } + } + return LogicalOrReturnLast>(nullopt); + } + + /** + * Iterates through 'array' by index and performs the callback on each element of array until the callback + * returns a truthy value, then returns that value. + * If no such value is found, the callback is applied to each element of array and undefined is returned. + */ + optional forEach(optional array, function(Node &element, int index)> callback) { + if (array) { + for (int i = 0; i < array->list.size(); i ++) { + auto result = callback((*array).list[i], i); + if (result) { + return result; + } + } + } + return nullopt; + } + + bool some(optional array, optional> predicate) { + if (array) { + if (predicate) { + for (auto &v: array->list) { + if ((*predicate)(v)) { + return true; + } + } + } + else { + return array->list.size() > 0; + } + } + return false; + } + + optional forEachChild(Node &node, function(Node &)> cbNode, optional(BaseNodeArray)>> cbNodes = nullopt); + + /** Do not use hasModifier inside the parser; it relies on parent pointers. Use this instead. */ + bool hasModifierOfKind(Node &node, SyntaxKind kind) { + return some(node.toBase().modifiers, [kind](auto m) { return m.kind() == kind; }); + } + + optional isAnExternalModuleIndicatorNode(Node &node, int) { + if (hasModifierOfKind(node, SyntaxKind::ExportKeyword) + || (node.is() && isExternalModuleReference(node.to().moduleReference)) + || isImportDeclaration(node) + || isExportAssignment(node) + || isExportDeclaration(node)) return node; + return nullopt; + } + + bool isImportMeta(Node &node) { + if (isMetaProperty(node)) { + MetaProperty &meta = node.to(); + return meta.keywordToken == SyntaxKind::ImportKeyword && meta.name.to().escapedText == "meta"; + } + return false; + } + + optional walkTreeForImportMeta(Node &node) { + if (isImportMeta(node)) return node; + return forEachChild(node, walkTreeForImportMeta, nullopt); + } + + optional getImportMetaIfNecessary(NodeType &sourceFile) { + return sourceFile.to().flags & (int) NodeFlags::PossiblyContainsImportMeta ? + walkTreeForImportMeta(sourceFile) : + nullptr; + } + + /*@internal*/ + optional isFileProbablyExternalModule(SourceFile &sourceFile) { + // Try to use the first top-level import/export when available, then + // fall back to looking for an 'import.meta' somewhere in the tree if necessary. + auto r = forEach(sourceFile.statements, isAnExternalModuleIndicatorNode); + if (r) return r; + + Node a((SourceFile*)&sourceFile); + return getImportMetaIfNecessary(a); + } + + /** + * Invokes a callback for each child of the given node. The 'cbNode' callback is invoked for all child nodes + * stored in properties. If a 'cbNodes' callback is specified, it is invoked for embedded arrays; otherwise, + * embedded arrays are flattened and the 'cbNode' callback is invoked for each element. If a callback returns + * a truthy value, iteration stops and that value is returned. Otherwise, undefined is returned. + * + * @param node a given node to visit its children + * @param cbNode a callback to be invoked for all child nodes + * @param cbNodes a callback to be invoked for embedded array + * + * @remarks `forEachChild` must visit the children of a node in the order + * that they appear in the source code. The language service depends on this property to locate nodes by position. + */ + optional forEachChild(Node &node, function(Node &)> cbNode, optional(BaseNodeArray)>> cbNodes) { + if (node.kind() <= SyntaxKind::LastToken) { + return nullopt; + } + switch (node.kind()) { + case SyntaxKind::QualifiedName: + //short-circuit evaluation is always boolean ... not last value in c++ + return visitNode(cbNode, node.to().left) || + visitNode(cbNode, node.to().right); + case SyntaxKind::TypeParameter: + return visitNodes(cbNode, cbNodes, node.to().modifiers) || + visitNode(cbNode, node.to().name) || + visitNode(cbNode, node.to().constraint) || + visitNode(cbNode, node.to().defaultType) || + visitNode(cbNode, node.to().expression); + case SyntaxKind::ShorthandPropertyAssignment: + return visitNodes(cbNode, cbNodes, node.to().decorators) || + visitNodes(cbNode, cbNodes, node.to().modifiers) || + visitNode(cbNode, node.to().name) || + visitNode(cbNode, node.to().questionToken) || + visitNode(cbNode, node.to().exclamationToken) || + visitNode(cbNode, node.to().equalsToken) || + visitNode(cbNode, node.to().objectAssignmentInitializer); + case SyntaxKind::SpreadAssignment: + return visitNode(cbNode, node.to().expression); + case SyntaxKind::Parameter: + return visitNodes(cbNode, cbNodes, node.to().decorators) || + visitNodes(cbNode, cbNodes, node.to().modifiers) || + visitNode(cbNode, node.to().dotDotDotToken) || + visitNode(cbNode, node.to().name) || + visitNode(cbNode, node.to().questionToken) || + visitNode(cbNode, node.to().type) || + visitNode(cbNode, node.to().initializer); + case SyntaxKind::PropertyDeclaration: + return visitNodes(cbNode, cbNodes, node.to().decorators) || + visitNodes(cbNode, cbNodes, node.to().modifiers) || + visitNode(cbNode, node.to().name) || + visitNode(cbNode, node.to().questionToken) || + visitNode(cbNode, node.to().exclamationToken) || + visitNode(cbNode, node.to().type) || + visitNode(cbNode, node.to().initializer); + case SyntaxKind::PropertySignature: + return visitNodes(cbNode, cbNodes, node.to().decorators) || + visitNodes(cbNode, cbNodes, node.to().modifiers) || + visitNode(cbNode, node.to().name) || + visitNode(cbNode, node.to().questionToken) || + visitNode(cbNode, node.to().type) || + visitNode(cbNode, node.to().initializer); + case SyntaxKind::PropertyAssignment: + return visitNodes(cbNode, cbNodes, node.to().decorators) || + visitNodes(cbNode, cbNodes, node.to().modifiers) || + visitNode(cbNode, node.to().name) || + visitNode(cbNode, node.to().questionToken) || + visitNode(cbNode, node.to().initializer); + case SyntaxKind::VariableDeclaration: + return visitNodes(cbNode, cbNodes, node.to().decorators) || + visitNodes(cbNode, cbNodes, node.to().modifiers) || + visitNode(cbNode, node.to().name) || + visitNode(cbNode, node.to().exclamationToken) || + visitNode(cbNode, node.to().type) || + visitNode(cbNode, node.to().initializer); + case SyntaxKind::BindingElement: + return visitNodes(cbNode, cbNodes, node.to().decorators) || + visitNodes(cbNode, cbNodes, node.to().modifiers) || + visitNode(cbNode, node.to().dotDotDotToken) || + visitNode(cbNode, node.to().propertyName) || + visitNode(cbNode, node.to().name) || + visitNode(cbNode, node.to().initializer); + case SyntaxKind::FunctionType: + case SyntaxKind::ConstructorType: + case SyntaxKind::CallSignature: + case SyntaxKind::ConstructSignature: + case SyntaxKind::IndexSignature: + return visitNodes(cbNode, cbNodes, node.to().decorators) || + visitNodes(cbNode, cbNodes, node.to().modifiers) || + visitNodes(cbNode, cbNodes, node.to().typeParameters) || + visitNodes(cbNode, cbNodes, node.to().parameters) || + visitNode(cbNode, node.to().type); + case SyntaxKind::MethodDeclaration: + case SyntaxKind::MethodSignature: + case SyntaxKind::Constructor: + case SyntaxKind::GetAccessor: + case SyntaxKind::SetAccessor: + case SyntaxKind::FunctionExpression: + case SyntaxKind::FunctionDeclaration: + case SyntaxKind::ArrowFunction: { + return visitNodes(cbNode, cbNodes, node.toBase().decorators) || + visitNodes(cbNode, cbNodes, node.toBase().modifiers) || + visitNode(cbNode, node.toBase().asteriskToken) || + visitNode(cbNode, node.toBase().name) || + visitNode(cbNode, node.toBase().questionToken) || + visitNode(cbNode, node.toBase().exclamationToken) || + visitNodes(cbNode, cbNodes, node.toBase().typeParameters) || + visitNodes(cbNode, cbNodes, node.toBase().parameters) || + visitNode(cbNode, node.toBase().type) || + (node.kind() == SyntaxKind::ArrowFunction ? visitNode(cbNode, node.to().equalsGreaterThanToken) : LogicalOrReturnLast>(nullopt)) || + visitNode(cbNode, node.toBase().body); + } + case SyntaxKind::ClassStaticBlockDeclaration: + return visitNodes(cbNode, cbNodes, node.to().decorators) || + visitNodes(cbNode, cbNodes, node.to().modifiers) || + visitNode(cbNode, node.to().body); + case SyntaxKind::TypeReference: + return visitNode(cbNode, node.to().typeName) || + visitNodes(cbNode, cbNodes, node.to().typeArguments); + case SyntaxKind::TypePredicate: + return visitNode(cbNode, node.to().assertsModifier) || + visitNode(cbNode, node.to().parameterName) || + visitNode(cbNode, node.to().type); + case SyntaxKind::TypeQuery: + return visitNode(cbNode, node.to().exprName) || + visitNodes(cbNode, cbNodes, node.to().typeArguments); + case SyntaxKind::TypeLiteral: + return visitNodes(cbNode, cbNodes, node.to().members); + case SyntaxKind::ArrayType: + return visitNode(cbNode, node.to().elementType); + case SyntaxKind::TupleType: + return visitNodes(cbNode, cbNodes, node.to().elements); + case SyntaxKind::UnionType: + return visitNodes(cbNode, cbNodes, node.to().types); + case SyntaxKind::IntersectionType: + return visitNodes(cbNode, cbNodes, node.to().types); + case SyntaxKind::ConditionalType: + return visitNode(cbNode, node.to().checkType) || + visitNode(cbNode, node.to().extendsType) || + visitNode(cbNode, node.to().trueType) || + visitNode(cbNode, node.to().falseType); + case SyntaxKind::InferType: + return visitNode(cbNode, node.to().typeParameter); + case SyntaxKind::ImportType: + return visitNode(cbNode, node.to().argument) || + visitNode(cbNode, node.to().assertions) || + visitNode(cbNode, node.to().qualifier) || + visitNodes(cbNode, cbNodes, node.to().typeArguments); + case SyntaxKind::ImportTypeAssertionContainer: + return visitNode(cbNode, node.to().assertClause); + case SyntaxKind::ParenthesizedType: + return visitNode(cbNode, node.to().type); + case SyntaxKind::TypeOperator: + return visitNode(cbNode, node.to().type); + case SyntaxKind::IndexedAccessType: + return visitNode(cbNode, node.to().objectType) || + visitNode(cbNode, node.to().indexType); + case SyntaxKind::MappedType: + return visitNode(cbNode, node.to().readonlyToken) || + visitNode(cbNode, node.to().typeParameter) || + visitNode(cbNode, node.to().nameType) || + visitNode(cbNode, node.to().questionToken) || + visitNode(cbNode, node.to().type) || + visitNodes(cbNode, cbNodes, node.to().members); + case SyntaxKind::LiteralType: + return visitNode(cbNode, node.to().literal); + case SyntaxKind::NamedTupleMember: + return visitNode(cbNode, node.to().dotDotDotToken) || + visitNode(cbNode, node.to().name) || + visitNode(cbNode, node.to().questionToken) || + visitNode(cbNode, node.to().type); + case SyntaxKind::ObjectBindingPattern: + return visitNodes(cbNode, cbNodes, node.to().elements); + case SyntaxKind::ArrayBindingPattern: + return visitNodes(cbNode, cbNodes, node.to().elements); + case SyntaxKind::ArrayLiteralExpression: + return visitNodes(cbNode, cbNodes, node.to().elements); + case SyntaxKind::ObjectLiteralExpression: + return visitNodes(cbNode, cbNodes, node.to().properties); + case SyntaxKind::PropertyAccessExpression: + return visitNode(cbNode, node.to().expression) || + visitNode(cbNode, node.to().questionDotToken) || + visitNode(cbNode, node.to().name); + case SyntaxKind::ElementAccessExpression: + return visitNode(cbNode, node.to().expression) || + visitNode(cbNode, node.to().questionDotToken) || + visitNode(cbNode, node.to().argumentExpression); + case SyntaxKind::CallExpression: + case SyntaxKind::NewExpression: + return visitNode(cbNode, node.to().expression) || + visitNode(cbNode, node.to().questionDotToken) || + visitNodes(cbNode, cbNodes, node.to().typeArguments) || + visitNodes(cbNode, cbNodes, node.to().arguments); + case SyntaxKind::TaggedTemplateExpression: + return visitNode(cbNode, node.to().tag) || + visitNode(cbNode, node.to().questionDotToken) || + visitNodes(cbNode, cbNodes, node.to().typeArguments) || + visitNode(cbNode, node.to().templateLiteral); + case SyntaxKind::TypeAssertionExpression: + return visitNode(cbNode, node.to().type) || + visitNode(cbNode, node.to().expression); + case SyntaxKind::ParenthesizedExpression: + return visitNode(cbNode, node.to().expression); + case SyntaxKind::DeleteExpression: + return visitNode(cbNode, node.to().expression); + case SyntaxKind::TypeOfExpression: + return visitNode(cbNode, node.to().expression); + case SyntaxKind::VoidExpression: + return visitNode(cbNode, node.to().expression); + case SyntaxKind::PrefixUnaryExpression: + return visitNode(cbNode, node.to().operand); + case SyntaxKind::YieldExpression: + return visitNode(cbNode, node.to().asteriskToken) || + visitNode(cbNode, node.to().expression); + case SyntaxKind::AwaitExpression: + return visitNode(cbNode, node.to().expression); + case SyntaxKind::PostfixUnaryExpression: + return visitNode(cbNode, node.to().operand); + case SyntaxKind::BinaryExpression: + return visitNode(cbNode, node.to().left) || + visitNode(cbNode, node.to().operatorToken) || + visitNode(cbNode, node.to().right); + case SyntaxKind::AsExpression: + return visitNode(cbNode, node.to().expression) || + visitNode(cbNode, node.to().type); + case SyntaxKind::NonNullExpression: + return visitNode(cbNode, node.to().expression); + case SyntaxKind::MetaProperty: + return visitNode(cbNode, node.to().name); + case SyntaxKind::ConditionalExpression: + return visitNode(cbNode, node.to().condition) || + visitNode(cbNode, node.to().questionToken) || + visitNode(cbNode, node.to().whenTrue) || + visitNode(cbNode, node.to().colonToken) || + visitNode(cbNode, node.to().whenFalse); + case SyntaxKind::SpreadElement: + return visitNode(cbNode, node.to().expression); + case SyntaxKind::Block: + case SyntaxKind::ModuleBlock: + return visitNodes(cbNode, cbNodes, node.to().statements); + case SyntaxKind::SourceFile: + return visitNodes(cbNode, cbNodes, node.to().statements) || + visitNode(cbNode, node.to().endOfFileToken); + case SyntaxKind::VariableStatement: + return visitNodes(cbNode, cbNodes, node.to().decorators) || + visitNodes(cbNode, cbNodes, node.to().modifiers) || + visitNode(cbNode, node.to().declarationList); + case SyntaxKind::VariableDeclarationList: + return visitNodes(cbNode, cbNodes, node.to().declarations); + case SyntaxKind::ExpressionStatement: + return visitNode(cbNode, node.to().expression); + case SyntaxKind::IfStatement: + return visitNode(cbNode, node.to().expression) || + visitNode(cbNode, node.to().thenStatement) || + visitNode(cbNode, node.to().elseStatement); + case SyntaxKind::DoStatement: + return visitNode(cbNode, node.to().statement) || + visitNode(cbNode, node.to().expression); + case SyntaxKind::WhileStatement: + return visitNode(cbNode, node.to().expression) || + visitNode(cbNode, node.to().statement); + case SyntaxKind::ForStatement: + return visitNode(cbNode, node.to().initializer) || + visitNode(cbNode, node.to().condition) || + visitNode(cbNode, node.to().incrementor) || + visitNode(cbNode, node.to().statement); + case SyntaxKind::ForInStatement: + return visitNode(cbNode, node.to().initializer) || + visitNode(cbNode, node.to().expression) || + visitNode(cbNode, node.to().statement); + case SyntaxKind::ForOfStatement: + return visitNode(cbNode, node.to().awaitModifier) || + visitNode(cbNode, node.to().initializer) || + visitNode(cbNode, node.to().expression) || + visitNode(cbNode, node.to().statement); + case SyntaxKind::ContinueStatement: + return visitNode(cbNode, node.to().label); + case SyntaxKind::BreakStatement: + return visitNode(cbNode, node.to().label); + case SyntaxKind::ReturnStatement: + return visitNode(cbNode, node.to().expression); + case SyntaxKind::WithStatement: + return visitNode(cbNode, node.to().expression) || + visitNode(cbNode, node.to().statement); + case SyntaxKind::SwitchStatement: + return visitNode(cbNode, node.to().expression) || + visitNode(cbNode, node.to().caseBlock); + case SyntaxKind::CaseBlock: + return visitNodes(cbNode, cbNodes, node.to().clauses); + case SyntaxKind::CaseClause: + return visitNode(cbNode, node.to().expression) || + visitNodes(cbNode, cbNodes, node.to().statements); + case SyntaxKind::DefaultClause: + return visitNodes(cbNode, cbNodes, node.to().statements); + case SyntaxKind::LabeledStatement: + return visitNode(cbNode, node.to().label) || + visitNode(cbNode, node.to().statement); + case SyntaxKind::ThrowStatement: + return visitNode(cbNode, node.to().expression); + case SyntaxKind::TryStatement: + return visitNode(cbNode, node.to().tryBlock) || + visitNode(cbNode, node.to().catchClause) || + visitNode(cbNode, node.to().finallyBlock); + case SyntaxKind::CatchClause: + return visitNode(cbNode, node.to().variableDeclaration) || + visitNode(cbNode, node.to().block); + case SyntaxKind::Decorator: + return visitNode(cbNode, node.to().expression); + case SyntaxKind::ClassDeclaration: + return visitNodes(cbNode, cbNodes, node.to().decorators) || + visitNodes(cbNode, cbNodes, node.to().modifiers) || + visitNode(cbNode, node.to().name) || + visitNodes(cbNode, cbNodes, node.to().typeParameters) || + visitNodes(cbNode, cbNodes, node.to().heritageClauses) || + visitNodes(cbNode, cbNodes, node.to().members); + case SyntaxKind::ClassExpression: + return visitNodes(cbNode, cbNodes, node.to().decorators) || + visitNodes(cbNode, cbNodes, node.to().modifiers) || + visitNode(cbNode, node.to().name) || + visitNodes(cbNode, cbNodes, node.to().typeParameters) || + visitNodes(cbNode, cbNodes, node.to().heritageClauses) || + visitNodes(cbNode, cbNodes, node.to().members); + case SyntaxKind::InterfaceDeclaration: + return visitNodes(cbNode, cbNodes, node.to().decorators) || + visitNodes(cbNode, cbNodes, node.to().modifiers) || + visitNode(cbNode, node.to().name) || + visitNodes(cbNode, cbNodes, node.to().typeParameters) || + visitNodes(cbNode, cbNodes, node.to().heritageClauses) || + visitNodes(cbNode, cbNodes, node.to().members); + case SyntaxKind::TypeAliasDeclaration: + return visitNodes(cbNode, cbNodes, node.to().decorators) || + visitNodes(cbNode, cbNodes, node.to().modifiers) || + visitNode(cbNode, node.to().name) || + visitNodes(cbNode, cbNodes, node.to().typeParameters) || + visitNode(cbNode, node.to().type); + case SyntaxKind::EnumDeclaration: + return visitNodes(cbNode, cbNodes, node.to().decorators) || + visitNodes(cbNode, cbNodes, node.to().modifiers) || + visitNode(cbNode, node.to().name) || + visitNodes(cbNode, cbNodes, node.to().members); + case SyntaxKind::EnumMember: + return visitNode(cbNode, node.to().name) || + visitNode(cbNode, node.to().initializer); + case SyntaxKind::ModuleDeclaration: + return visitNodes(cbNode, cbNodes, node.to().decorators) || + visitNodes(cbNode, cbNodes, node.to().modifiers) || + visitNode(cbNode, node.to().name) || + visitNode(cbNode, node.to().body); + case SyntaxKind::ImportEqualsDeclaration: + return visitNodes(cbNode, cbNodes, node.to().decorators) || + visitNodes(cbNode, cbNodes, node.to().modifiers) || + visitNode(cbNode, node.to().name) || + visitNode(cbNode, node.to().moduleReference); + case SyntaxKind::ImportDeclaration: + return visitNodes(cbNode, cbNodes, node.to().decorators) || + visitNodes(cbNode, cbNodes, node.to().modifiers) || + visitNode(cbNode, node.to().importClause) || + visitNode(cbNode, node.to().moduleSpecifier) || + visitNode(cbNode, node.to().assertClause); + case SyntaxKind::ImportClause: + return visitNode(cbNode, node.to().name) || + visitNode(cbNode, node.to().namedBindings); + case SyntaxKind::AssertClause: + return visitNodes(cbNode, cbNodes, node.to().elements); + case SyntaxKind::AssertEntry: + return visitNode(cbNode, node.to().name) || + visitNode(cbNode, node.to().value); + case SyntaxKind::NamespaceExportDeclaration: + return visitNode(cbNode, node.to().name); + case SyntaxKind::NamespaceImport: + return visitNode(cbNode, node.to().name); + case SyntaxKind::NamespaceExport: + return visitNode(cbNode, node.to().name); + case SyntaxKind::NamedImports: + return visitNodes(cbNode, cbNodes, node.to().elements); + case SyntaxKind::NamedExports: + return visitNodes(cbNode, cbNodes, node.to().elements); + case SyntaxKind::ExportDeclaration: + return visitNodes(cbNode, cbNodes, node.to().decorators) || + visitNodes(cbNode, cbNodes, node.to().modifiers) || + visitNode(cbNode, node.to().exportClause) || + visitNode(cbNode, node.to().moduleSpecifier) || + visitNode(cbNode, node.to().assertClause); + case SyntaxKind::ImportSpecifier: + return visitNode(cbNode, node.to().propertyName) || + visitNode(cbNode, node.to().name); + case SyntaxKind::ExportSpecifier: + return visitNode(cbNode, node.to().propertyName) || + visitNode(cbNode, node.to().name); + case SyntaxKind::ExportAssignment: + return visitNodes(cbNode, cbNodes, node.to().decorators) || + visitNodes(cbNode, cbNodes, node.to().modifiers) || + visitNode(cbNode, node.to().expression); + case SyntaxKind::TemplateExpression: + return visitNode(cbNode, node.to().head) || visitNodes(cbNode, cbNodes, node.to().templateSpans); + case SyntaxKind::TemplateSpan: + return visitNode(cbNode, node.to().expression) || visitNode(cbNode, node.to().literal); + case SyntaxKind::TemplateLiteralType: + return visitNode(cbNode, node.to().head) || visitNodes(cbNode, cbNodes, node.to().templateSpans); + case SyntaxKind::TemplateLiteralTypeSpan: + return visitNode(cbNode, node.to().type) || visitNode(cbNode, node.to().literal); + case SyntaxKind::ComputedPropertyName: + return visitNode(cbNode, node.to().expression); + case SyntaxKind::HeritageClause: + return visitNodes(cbNode, cbNodes, node.to().types); + case SyntaxKind::ExpressionWithTypeArguments: + return visitNode(cbNode, node.to().expression) || + visitNodes(cbNode, cbNodes, node.to().typeArguments); + case SyntaxKind::ExternalModuleReference: + return visitNode(cbNode, node.to().expression); + case SyntaxKind::MissingDeclaration: + return visitNodes(cbNode, cbNodes, node.to().decorators); + case SyntaxKind::CommaListExpression: + return visitNodes(cbNode, cbNodes, node.to().elements); + + case SyntaxKind::JsxElement: + return visitNode(cbNode, node.to().openingElement) || + visitNodes(cbNode, cbNodes, node.to().children) || + visitNode(cbNode, node.to().closingElement); + case SyntaxKind::JsxFragment: + return visitNode(cbNode, node.to().openingFragment) || + visitNodes(cbNode, cbNodes, node.to().children) || + visitNode(cbNode, node.to().closingFragment); + case SyntaxKind::JsxSelfClosingElement: + return visitNode(cbNode, node.to().tagName) || + visitNodes(cbNode, cbNodes, node.to().typeArguments) || + visitNode(cbNode, node.to().attributes); + case SyntaxKind::JsxOpeningElement: + return visitNode(cbNode, node.to().tagName) || + visitNodes(cbNode, cbNodes, node.to().typeArguments) || + visitNode(cbNode, node.to().attributes); + case SyntaxKind::JsxAttributes: + return visitNodes(cbNode, cbNodes, node.to().properties); + case SyntaxKind::JsxAttribute: + return visitNode(cbNode, node.to().name) || + visitNode(cbNode, node.to().initializer); + case SyntaxKind::JsxSpreadAttribute: + return visitNode(cbNode, node.to().expression); + case SyntaxKind::JsxExpression: + return visitNode(cbNode, node.to().dotDotDotToken) || + visitNode(cbNode, node.to().expression); + case SyntaxKind::JsxClosingElement: + return visitNode(cbNode, node.to().tagName); + + case SyntaxKind::OptionalType: + return visitNode(cbNode, node.to().type); + case SyntaxKind::RestType: + return visitNode(cbNode, node.to().type); + case SyntaxKind::PartiallyEmittedExpression: + return visitNode(cbNode, node.to().expression); + } + } + + //@note: not in use inside Parser +// /** @internal */ +// /** +// * Invokes a callback for each child of the given node. The 'cbNode' callback is invoked for all child nodes +// * stored in properties. If a 'cbNodes' callback is specified, it is invoked for embedded arrays; additionally, +// * unlike `forEachChild`, embedded arrays are flattened and the 'cbNode' callback is invoked for each element. +// * If a callback returns a truthy value, iteration stops and that value is returned. Otherwise, undefined is returned. +// * +// * @param node a given node to visit its children +// * @param cbNode a callback to be invoked for all child nodes +// * @param cbNodes a callback to be invoked for embedded array +// * +// * @remarks Unlike `forEachChild`, `forEachChildRecursively` handles recursively invoking the traversal on each child node found, +// * and while doing so, handles traversing the structure without relying on the callstack to encode the tree structure. +// */ +// Node *forEachChildRecursively( +// Node rootNode, +// cbNode: (node: Node, parent: Node) => T | "skip" | undefined, +// cbNodes?: (nodes: NodeArray, parent: Node) => T | "skip" | undefined +// ) { +// const queue: (Node | NodeArray)[] = gatherPossibleChildren(rootNode); +// const parents: Node[] = []; // tracks parent references for elements in queue +// while (parents.length < queue.length) { +// parents.push(rootNode); +// } +// while (queue.length !== 0) { +// const current = queue.pop()!; +// const parent = parents.pop()!; +// if (isArray(current)) { +// if (cbNodes) { +// const res = cbNodes(current, parent); +// if (res) { +// if (res == "skip") continue; +// return res; +// } +// } +// for (let i = current.length - 1; i >= 0; --i) { +// queue.push(current[i]); +// parents.push(parent); +// } +// } +// else { +// const res = cbNode(current, parent); +// if (res) { +// if (res == "skip") continue; +// return res; +// } +// if (current.kind >= SyntaxKind::FirstNode) { +// // add children in reverse order to the queue, so popping gives the first child +// for (const child of gatherPossibleChildren(current)) { +// queue.push(child); +// parents.push(current); +// } +// } +// } +// } +// } +// function gatherPossibleChildren(node: Node) { +// const children: (Node | NodeArray)[] = []; +// forEachChild(node, addWorkItem, addWorkItem); // By using a stack above and `unshift` here, we emulate a depth-first preorder traversal +// return children; +// +// function addWorkItem(n: Node | NodeArray) { +// children.unshift(n); +// } +// } +// + struct CreateSourceFileOptions { + ScriptTarget languageVersion; + /** + * Controls the format the file is detected as - this can be derived from only the path + * and files on disk, but needs to be done with a module resolution cache in scope to be performant. + * This is usually `undefined` for compilations that do not have `moduleResolution` values of `node16` or `nodenext`. + */ + optional impliedNodeFormat; //?: ModuleKind.ESNext | ModuleKind.CommonJS; + + /** + * Controls how module-y-ness is set for the given file. Usually the result of calling + * `getSetExternalModuleIndicator` on a valid `CompilerOptions` object. If not present, the default + * check specified by `isFileProbablyExternalModule` will be used to set the field. + */ + optional> setExternalModuleIndicator; + }; + +// +// function setExternalModuleIndicator(sourceFile: SourceFile) { +// sourceFile.externalModuleIndicator = isFileProbablyExternalModule(sourceFile); +// } + + void setExternalModuleIndicator(SourceFile sourceFile) { + sourceFile.externalModuleIndicator = isFileProbablyExternalModule(sourceFile); + } + + NodeType createSourceFile(string fileName, string sourceText, variant languageVersionOrOptions, bool setParentNodes = false, optional scriptKind = {}) { +// tracing?.push(tracing.Phase.Parse, "createSourceFile", { path: fileName }, /*separateBeginAndEnd*/ true); +// performance.mark("beforeParse"); + NodeType result = createBaseNode(); + optional> overrideSetExternalModuleIndicator; + optional format; + +// perfLogger.logStartParseSourceFile(fileName); + ScriptTarget languageVersion; + if (std::holds_alternative(languageVersionOrOptions)) { + languageVersion = std::get(languageVersionOrOptions); + } else { + auto options = std::get(languageVersionOrOptions); + languageVersion = options.languageVersion; + format = options.impliedNodeFormat; + overrideSetExternalModuleIndicator = options.setExternalModuleIndicator; + } + + if (languageVersion == ScriptTarget::JSON) { + result = Parser.parseSourceFile(fileName, sourceText, languageVersion, /*syntaxCursor*/ {}, setParentNodes, ScriptKind::JSON); + } else { + optional> setIndicator = ! format.has_value() ? overrideSetExternalModuleIndicator : [format, overrideSetExternalModuleIndicator](SourceFile file) { + file.impliedNodeFormat = format; + if (overrideSetExternalModuleIndicator) { + (*overrideSetExternalModuleIndicator)(file); + } else { + setExternalModuleIndicator(file); + } + }; + result = Parser.parseSourceFile(fileName, sourceText, languageVersion, /*syntaxCursor*/ {}, setParentNodes, scriptKind, setIndicator); + } +// perfLogger.logStopParseSourceFile(); +// +// performance.mark("afterParse"); +// performance.measure("Parse", "beforeParse", "afterParse"); +// tracing?.pop(); + return result; + } +// +// export function parseIsolatedEntityName(text: string, languageVersion: ScriptTarget): EntityName | undefined { +// return Parser.parseIsolatedEntityName(text, languageVersion); +// } +// +// /** +// * Parse json text into SyntaxTree and return node and parse errors if any +// * @param fileName +// * @param sourceText +// */ +// export function parseJsonText(fileName: string, sourceText: string): JsonSourceFile { +// return Parser.parseJsonText(fileName, sourceText); +// } +// +// // See also `isExternalOrCommonJsModule` in utilities.ts +// export function isExternalModule(file: SourceFile): boolean { +// return file.externalModuleIndicator !== undefined; +// } +// +// // Produces a new SourceFile for the 'newText' provided. The 'textChangeRange' parameter +// // indicates what changed between the 'text' that this SourceFile has and the 'newText'. +// // The SourceFile will be created with the compiler attempting to reuse as many nodes from +// // this file as possible. +// // +// // Note: this function mutates nodes from this SourceFile. That means any existing nodes +// // from this SourceFile that are being held onto may change as a result (including +// // becoming detached from any SourceFile). It is recommended that this SourceFile not +// // be used once 'update' is called on it. +// export function updateSourceFile(sourceFile: SourceFile, newText: string, textChangeRange: TextChangeRange, aggressiveChecks = false): SourceFile { +// const newSourceFile = IncrementalParser.updateSourceFile(sourceFile, newText, textChangeRange, aggressiveChecks); +// // Because new source file node is created, it may not have the flag PossiblyContainDynamicImport. This is the case if there is no new edit to add dynamic import. +// // We will manually port the flag to the new source file. +// (newSourceFile as Mutable).flags |= (sourceFile.flags & NodeFlags::PermanentlySetIncrementalFlags); +// return newSourceFile; +// } +// +// /* @internal */ +// export function parseIsolatedJSDocComment(content: string, start?: number, length?: number) { +// const result = Parser.JSDocParser.parseIsolatedJSDocComment(content, start, length); +// if (result && result.jsDoc) { +// // because the jsDocComment was parsed out of the source file, it might +// // not be covered by the fixupParentReferences. +// Parser.fixupParentReferences(result.jsDoc); +// } +// +// return result; +// } +// +// /* @internal */ +// // Exposed only for testing. +// export function parseJSDocTypeExpressionForTests(content: string, start?: number, length?: number) { +// return Parser.JSDocParser.parseJSDocTypeExpressionForTests(content, start, length); +// } +// +// // Implement the parser as a singleton module. We do this for perf reasons because creating +// // parser instances can actually be expensive enough to impact us on projects with many source +// // files. + namespace Parser { +// // Share a single scanner across all calls to parse a source file. This helps speed things +// // up by avoiding the cost of creating/compiling scanners over and over again. +// const scanner = createScanner(ScriptTarget.Latest, /*skipTrivia*/ true); +// +// const disallowInAndDecoratorContext = NodeFlags::DisallowInContext | NodeFlags::DecoratorContext; +// +// // capture constructors in 'initializeState' to avoid null checks +// // tslint:disable variable-name +// let NodeConstructor: new (kind: SyntaxKind, pos: number, end: number) => Node; +// let TokenConstructor: new (kind: SyntaxKind, pos: number, end: number) => Node; +// let IdentifierConstructor: new (kind: SyntaxKind, pos: number, end: number) => Node; +// let PrivateIdentifierConstructor: new (kind: SyntaxKind, pos: number, end: number) => Node; +// let SourceFileConstructor: new (kind: SyntaxKind, pos: number, end: number) => Node; +// // tslint:enable variable-name +// +// function countNode(node: Node) { +// nodeCount++; +// return node; +// } +// +// // Rather than using `createBaseNodeFactory` here, we establish a `BaseNodeFactory` that closes over the +// // constructors above, which are reset each time `initializeState` is called. +// const baseNodeFactory: BaseNodeFactory = { +// createBaseSourceFileNode: kind => countNode(new SourceFileConstructor(kind, /*pos*/ 0, /*end*/ 0)), +// createBaseIdentifierNode: kind => countNode(new IdentifierConstructor(kind, /*pos*/ 0, /*end*/ 0)), +// createBasePrivateIdentifierNode: kind => countNode(new PrivateIdentifierConstructor(kind, /*pos*/ 0, /*end*/ 0)), +// createBaseTokenNode: kind => countNode(new TokenConstructor(kind, /*pos*/ 0, /*end*/ 0)), +// createBaseNode: kind => countNode(new NodeConstructor(kind, /*pos*/ 0, /*end*/ 0)) +// }; +// +// const factory = createNodeFactory(NodeFactoryFlags.NoParenthesizerRules | NodeFactoryFlags.NoNodeConverters | NodeFactoryFlags.NoOriginalNode, baseNodeFactory); +// +// let fileName: string; +// let sourceFlags: NodeFlags; +// let sourceText: string; +// let languageVersion: ScriptTarget; +// let scriptKind: ScriptKind; +// let languageVariant: LanguageVariant; +// let parseDiagnostics: DiagnosticWithDetachedLocation[]; +// let jsDocDiagnostics: DiagnosticWithDetachedLocation[]; +// let syntaxCursor: IncrementalParser.SyntaxCursor | undefined; +// +// let currentToken: SyntaxKind; +// let nodeCount: number; +// let identifiers: ESMap; +// let privateIdentifiers: ESMap; +// let identifierCount: number; +// +// let parsingContext: ParsingContext; +// +// let notParenthesizedArrow: Set | undefined; +// +// // Flags that dictate what parsing context we're in. For example: +// // Whether or not we are in strict parsing mode. All that changes in strict parsing mode is +// // that some tokens that would be considered identifiers may be considered keywords. +// // +// // When adding more parser context flags, consider which is the more common case that the +// // flag will be in. This should be the 'false' state for that flag. The reason for this is +// // that we don't store data in our nodes unless the value is in the *non-default* state. So, +// // for example, more often than code 'allows-in' (or doesn't 'disallow-in'). We opt for +// // 'disallow-in' set to 'false'. Otherwise, if we had 'allowsIn' set to 'true', then almost +// // all nodes would need extra state on them to store this info. +// // +// // Note: 'allowIn' and 'allowYield' track 1:1 with the [in] and [yield] concepts in the ES6 +// // grammar specification. +// // +// // An important thing about these context concepts. By default they are effectively inherited +// // while parsing through every grammar production. i.e. if you don't change them, then when +// // you parse a sub-production, it will have the same context values as the parent production. +// // This is great most of the time. After all, consider all the 'expression' grammar productions +// // and how nearly all of them pass along the 'in' and 'yield' context values: +// // +// // EqualityExpression[In, Yield] : +// // RelationalExpression[?In, ?Yield] +// // EqualityExpression[?In, ?Yield] == RelationalExpression[?In, ?Yield] +// // EqualityExpression[?In, ?Yield] != RelationalExpression[?In, ?Yield] +// // EqualityExpression[?In, ?Yield] == RelationalExpression[?In, ?Yield] +// // EqualityExpression[?In, ?Yield] !== RelationalExpression[?In, ?Yield] +// // +// // Where you have to be careful is then understanding what the points are in the grammar +// // where the values are *not* passed along. For example: +// // +// // SingleNameBinding[Yield,GeneratorParameter] +// // [+GeneratorParameter]BindingIdentifier[Yield] Initializer[In]opt +// // [~GeneratorParameter]BindingIdentifier[?Yield]Initializer[In, ?Yield]opt +// // +// // Here this is saying that if the GeneratorParameter context flag is set, that we should +// // explicitly set the 'yield' context flag to false before calling into the BindingIdentifier +// // and we should explicitly unset the 'yield' context flag before calling into the Initializer. +// // production. Conversely, if the GeneratorParameter context flag is not set, then we +// // should leave the 'yield' context flag alone. +// // +// // Getting this all correct is tricky and requires careful reading of the grammar to +// // understand when these values should be changed versus when they should be inherited. +// // +// // Note: it should not be necessary to save/restore these flags during speculative/lookahead +// // parsing. These context flags are naturally stored and restored through normal recursive +// // descent parsing and unwinding. +// let contextFlags: NodeFlags; +// +// // Indicates whether we are currently parsing top-level statements. +// let topLevel = true; +// +// // Whether or not we've had a parse error since creating the last AST node. If we have +// // encountered an error, it will be stored on the next AST node we create. Parse errors +// // can be broken down into three categories: +// // +// // 1) An error that occurred during scanning. For example, an unterminated literal, or a +// // character that was completely not understood. +// // +// // 2) A token was expected, but was not present. This type of error is commonly produced +// // by the 'parseExpected' function. +// // +// // 3) A token was present that no parsing function was able to consume. This type of error +// // only occurs in the 'abortParsingListOrMoveToNextToken' function when the parser +// // decides to skip the token. +// // +// // In all of these cases, we want to mark the next node as having had an error before it. +// // With this mark, we can know in incremental settings if this node can be reused, or if +// // we have to reparse it. If we don't keep this information around, we may just reuse the +// // node. in that event we would then not produce the same errors as we did before, causing +// // significant confusion problems. +// // +// // Note: it is necessary that this value be saved/restored during speculative/lookahead +// // parsing. During lookahead parsing, we will often create a node. That node will have +// // this value attached, and then this value will be set back to 'false'. If we decide to +// // rewind, we must get back to the same value we had prior to the lookahead. +// // +// // Note: any errors at the end of the file that do not precede a regular node, should get +// // attached to the EOF token. +// let parseErrorBeforeNextFinishedNode = false; +// +// export function parseSourceFile(fileName: string, sourceText: string, languageVersion: ScriptTarget, syntaxCursor: IncrementalParser.SyntaxCursor | undefined, setParentNodes = false, scriptKind?: ScriptKind, setExternalModuleIndicatorOverride?: (file: SourceFile) => void): SourceFile { +// scriptKind = ensureScriptKind(fileName, scriptKind); +// if (scriptKind == ScriptKind.JSON) { +// const result = parseJsonText(fileName, sourceText, languageVersion, syntaxCursor, setParentNodes); +// convertToObjectWorker(result, result.statements[0]?.expression, result.parseDiagnostics, /*returnValue*/ false, /*knownRootOptions*/ undefined, /*jsonConversionNotifier*/ undefined); +// result.referencedFiles = emptyArray; +// result.typeReferenceDirectives = emptyArray; +// result.libReferenceDirectives = emptyArray; +// result.amdDependencies = emptyArray; +// result.hasNoDefaultLib = false; +// result.pragmas = emptyMap as ReadonlyPragmaMap; +// return result; +// } +// +// initializeState(fileName, sourceText, languageVersion, syntaxCursor, scriptKind); +// +// const result = parseSourceFileWorker(languageVersion, setParentNodes, scriptKind, setExternalModuleIndicatorOverride || setExternalModuleIndicator); +// +// clearState(); +// +// return result; +// } +// +// export function parseIsolatedEntityName(content: string, languageVersion: ScriptTarget): EntityName | undefined { +// // Choice of `isDeclarationFile` should be arbitrary +// initializeState("", content, languageVersion, /*syntaxCursor*/ undefined, ScriptKind.JS); +// // Prime the scanner. +// nextToken(); +// const entityName = parseEntityName(/*allowReservedWords*/ true); +// const isInvalid = token() == SyntaxKind::EndOfFileToken && !parseDiagnostics.length; +// clearState(); +// return isInvalid ? entityName : undefined; +// } +// +// export function parseJsonText(fileName: string, sourceText: string, languageVersion: ScriptTarget = ScriptTarget.ES2015, syntaxCursor?: IncrementalParser.SyntaxCursor, setParentNodes = false): JsonSourceFile { +// initializeState(fileName, sourceText, languageVersion, syntaxCursor, ScriptKind.JSON); +// sourceFlags = contextFlags; +// +// // Prime the scanner. +// nextToken(); +// const pos = getNodePos(); +// let statements, endOfFileToken; +// if (token() == SyntaxKind::EndOfFileToken) { +// statements = createNodeArray([], pos, pos); +// endOfFileToken = parseTokenNode(); +// } +// else { +// // Loop and synthesize an ArrayLiteralExpression if there are more than +// // one top-level expressions to ensure all input text is consumed. +// let expressions: Expression[] | Expression | undefined; +// while (token() !== SyntaxKind::EndOfFileToken) { +// let expression; +// switch (token()) { +// case SyntaxKind::OpenBracketToken: +// expression = parseArrayLiteralExpression(); +// break; +// case SyntaxKind::TrueKeyword: +// case SyntaxKind::FalseKeyword: +// case SyntaxKind::NullKeyword: +// expression = parseTokenNode(); +// break; +// case SyntaxKind::MinusToken: +// if (lookAhead(() => nextToken() == SyntaxKind::NumericLiteral && nextToken() !== SyntaxKind::ColonToken)) { +// expression = parsePrefixUnaryExpression() as JsonMinusNumericLiteral; +// } +// else { +// expression = parseObjectLiteralExpression(); +// } +// break; +// case SyntaxKind::NumericLiteral: +// case SyntaxKind::StringLiteral: +// if (lookAhead(() => nextToken() !== SyntaxKind::ColonToken)) { +// expression = parseLiteralNode() as StringLiteral | NumericLiteral; +// break; +// } +// // falls through +// default: +// expression = parseObjectLiteralExpression(); +// break; +// } +// +// // Error recovery: collect multiple top-level expressions +// if (expressions && isArray(expressions)) { +// expressions.push(expression); +// } +// else if (expressions) { +// expressions = [expressions, expression]; +// } +// else { +// expressions = expression; +// if (token() !== SyntaxKind::EndOfFileToken) { +// parseErrorAtCurrentToken(Diagnostics.Unexpected_token); +// } +// } +// } +// +// const expression = isArray(expressions) ? finishNode(factory.createArrayLiteralExpression(expressions), pos) : Debug.checkDefined(expressions); +// const statement = factory.createExpressionStatement(expression) as JsonObjectExpressionStatement; +// finishNode(statement, pos); +// statements = createNodeArray([statement], pos); +// endOfFileToken = parseExpectedToken(SyntaxKind::EndOfFileToken, Diagnostics.Unexpected_token); +// } +// +// // Set source file so that errors will be reported with this file name +// const sourceFile = createSourceFile(fileName, ScriptTarget.ES2015, ScriptKind.JSON, /*isDeclaration*/ false, statements, endOfFileToken, sourceFlags, noop); +// +// if (setParentNodes) { +// fixupParentReferences(sourceFile); +// } +// +// sourceFile.nodeCount = nodeCount; +// sourceFile.identifierCount = identifierCount; +// sourceFile.identifiers = identifiers; +// sourceFile.parseDiagnostics = attachFileToDiagnostics(parseDiagnostics, sourceFile); +// if (jsDocDiagnostics) { +// sourceFile.jsDocDiagnostics = attachFileToDiagnostics(jsDocDiagnostics, sourceFile); +// } +// +// const result = sourceFile as JsonSourceFile; +// clearState(); +// return result; +// } +// +// function initializeState(_fileName: string, _sourceText: string, _languageVersion: ScriptTarget, _syntaxCursor: IncrementalParser.SyntaxCursor | undefined, _scriptKind: ScriptKind) { +// NodeConstructor = objectAllocator.getNodeConstructor(); +// TokenConstructor = objectAllocator.getTokenConstructor(); +// IdentifierConstructor = objectAllocator.getIdentifierConstructor(); +// PrivateIdentifierConstructor = objectAllocator.getPrivateIdentifierConstructor(); +// SourceFileConstructor = objectAllocator.getSourceFileConstructor(); +// +// fileName = normalizePath(_fileName); +// sourceText = _sourceText; +// languageVersion = _languageVersion; +// syntaxCursor = _syntaxCursor; +// scriptKind = _scriptKind; +// languageVariant = getLanguageVariant(_scriptKind); +// +// parseDiagnostics = []; +// parsingContext = 0; +// identifiers = new Map(); +// privateIdentifiers = new Map(); +// identifierCount = 0; +// nodeCount = 0; +// sourceFlags = 0; +// topLevel = true; +// +// switch (scriptKind) { +// case ScriptKind.JS: +// case ScriptKind.JSX: +// contextFlags = NodeFlags::JavaScriptFile; +// break; +// case ScriptKind.JSON: +// contextFlags = NodeFlags::JavaScriptFile | NodeFlags::JsonFile; +// break; +// default: +// contextFlags = NodeFlags::None; +// break; +// } +// parseErrorBeforeNextFinishedNode = false; +// +// // Initialize and prime the scanner before parsing the source elements. +// scanner.setText(sourceText); +// scanner.setOnError(scanError); +// scanner.setScriptTarget(languageVersion); +// scanner.setLanguageVariant(languageVariant); +// } +// +// function clearState() { +// // Clear out the text the scanner is pointing at, so it doesn't keep anything alive unnecessarily. +// scanner.clearCommentDirectives(); +// scanner.setText(""); +// scanner.setOnError(undefined); +// +// // Clear any data. We don't want to accidentally hold onto it for too long. +// sourceText = undefined!; +// languageVersion = undefined!; +// syntaxCursor = undefined; +// scriptKind = undefined!; +// languageVariant = undefined!; +// sourceFlags = 0; +// parseDiagnostics = undefined!; +// jsDocDiagnostics = undefined!; +// parsingContext = 0; +// identifiers = undefined!; +// notParenthesizedArrow = undefined; +// topLevel = true; +// } +// +// function parseSourceFileWorker(languageVersion: ScriptTarget, setParentNodes: boolean, scriptKind: ScriptKind, setExternalModuleIndicator: (file: SourceFile) => void): SourceFile { +// const isDeclarationFile = isDeclarationFileName(fileName); +// if (isDeclarationFile) { +// contextFlags |= NodeFlags::Ambient; +// } +// +// sourceFlags = contextFlags; +// +// // Prime the scanner. +// nextToken(); +// +// const statements = parseList(ParsingContext.SourceElements, parseStatement); +// Debug.assert(token() == SyntaxKind::EndOfFileToken); +// const endOfFileToken = addJSDocComment(parseTokenNode()); +// +// const sourceFile = createSourceFile(fileName, languageVersion, scriptKind, isDeclarationFile, statements, endOfFileToken, sourceFlags, setExternalModuleIndicator); +// +// // A member of ReadonlyArray isn't assignable to a member of T[] (and prevents a direct cast) - but this is where we set up those members so they can be readonly in the future +// processCommentPragmas(sourceFile as {} as PragmaContext, sourceText); +// processPragmasIntoFields(sourceFile as {} as PragmaContext, reportPragmaDiagnostic); +// +// sourceFile.commentDirectives = scanner.getCommentDirectives(); +// sourceFile.nodeCount = nodeCount; +// sourceFile.identifierCount = identifierCount; +// sourceFile.identifiers = identifiers; +// sourceFile.parseDiagnostics = attachFileToDiagnostics(parseDiagnostics, sourceFile); +// if (jsDocDiagnostics) { +// sourceFile.jsDocDiagnostics = attachFileToDiagnostics(jsDocDiagnostics, sourceFile); +// } +// +// if (setParentNodes) { +// fixupParentReferences(sourceFile); +// } +// +// return sourceFile; +// +// function reportPragmaDiagnostic(pos: number, end: number, diagnostic: DiagnosticMessage) { +// parseDiagnostics.push(createDetachedDiagnostic(fileName, pos, end, diagnostic)); +// } +// } +// +// function withJSDoc(node: T, hasJSDoc: boolean): T { +// return hasJSDoc ? addJSDocComment(node) : node; +// } +// +// let hasDeprecatedTag = false; +// function addJSDocComment(node: T): T { +// Debug.assert(!node.jsDoc); // Should only be called once per node +// const jsDoc = mapDefined(getJSDocCommentRanges(node, sourceText), comment => JSDocParser.parseJSDocComment(node, comment.pos, comment.end - comment.pos)); +// if (jsDoc.length) node.jsDoc = jsDoc; +// if (hasDeprecatedTag) { +// hasDeprecatedTag = false; +// reinterpret_cast&>(node).flags |= NodeFlags::Deprecated; +// } +// return node; +// } +// +// function reparseTopLevelAwait(sourceFile: SourceFile) { +// const savedSyntaxCursor = syntaxCursor; +// const baseSyntaxCursor = IncrementalParser.createSyntaxCursor(sourceFile); +// syntaxCursor = { currentNode }; +// +// const statements: Statement[] = []; +// const savedParseDiagnostics = parseDiagnostics; +// +// parseDiagnostics = []; +// +// let pos = 0; +// let start = findNextStatementWithAwait(sourceFile.statements, 0); +// while (start !== -1) { +// // append all statements between pos and start +// const prevStatement = sourceFile.statements[pos]; +// const nextStatement = sourceFile.statements[start]; +// addRange(statements, sourceFile.statements, pos, start); +// pos = findNextStatementWithoutAwait(sourceFile.statements, start); +// +// // append all diagnostics associated with the copied range +// const diagnosticStart = findIndex(savedParseDiagnostics, diagnostic => diagnostic.start >= prevStatement.pos); +// const diagnosticEnd = diagnosticStart >= 0 ? findIndex(savedParseDiagnostics, diagnostic => diagnostic.start >= nextStatement.pos, diagnosticStart) : -1; +// if (diagnosticStart >= 0) { +// addRange(parseDiagnostics, savedParseDiagnostics, diagnosticStart, diagnosticEnd >= 0 ? diagnosticEnd : undefined); +// } +// +// // reparse all statements between start and pos. We skip existing diagnostics for the same range and allow the parser to generate new ones. +// speculationHelper(() => { +// const savedContextFlags = contextFlags; +// contextFlags |= NodeFlags::AwaitContext; +// scanner.setTextPos(nextStatement.pos); +// nextToken(); +// +// while (token() !== SyntaxKind::EndOfFileToken) { +// const startPos = scanner.getStartPos(); +// const statement = parseListElement(ParsingContext.SourceElements, parseStatement); +// statements.push(statement); +// if (startPos == scanner.getStartPos()) { +// nextToken(); +// } +// +// if (pos >= 0) { +// const nonAwaitStatement = sourceFile.statements[pos]; +// if (statement.end == nonAwaitStatement.pos) { +// // done reparsing this section +// break; +// } +// if (statement.end > nonAwaitStatement.pos) { +// // we ate into the next statement, so we must reparse it. +// pos = findNextStatementWithoutAwait(sourceFile.statements, pos + 1); +// } +// } +// } +// +// contextFlags = savedContextFlags; +// }, SpeculationKind.Reparse); +// +// // find the next statement containing an `await` +// start = pos >= 0 ? findNextStatementWithAwait(sourceFile.statements, pos) : -1; +// } +// +// // append all statements between pos and the end of the list +// if (pos >= 0) { +// const prevStatement = sourceFile.statements[pos]; +// addRange(statements, sourceFile.statements, pos); +// +// // append all diagnostics associated with the copied range +// const diagnosticStart = findIndex(savedParseDiagnostics, diagnostic => diagnostic.start >= prevStatement.pos); +// if (diagnosticStart >= 0) { +// addRange(parseDiagnostics, savedParseDiagnostics, diagnosticStart); +// } +// } +// +// syntaxCursor = savedSyntaxCursor; +// return factory.updateSourceFile(sourceFile, setTextRange(factory.createNodeArray(statements), sourceFile.statements)); +// +// function containsPossibleTopLevelAwait(node: Node) { +// return !(node.flags & NodeFlags::AwaitContext) +// && !!(node.transformFlags & TransformFlags.ContainsPossibleTopLevelAwait); +// } +// +// function findNextStatementWithAwait(statements: NodeArray, start: number) { +// for (let i = start; i < statements.length; i++) { +// if (containsPossibleTopLevelAwait(statements[i])) { +// return i; +// } +// } +// return -1; +// } +// +// function findNextStatementWithoutAwait(statements: NodeArray, start: number) { +// for (let i = start; i < statements.length; i++) { +// if (!containsPossibleTopLevelAwait(statements[i])) { +// return i; +// } +// } +// return -1; +// } +// +// function currentNode(position: number) { +// const node = baseSyntaxCursor.currentNode(position); +// if (topLevel && node && containsPossibleTopLevelAwait(node)) { +// node.intersectsChange = true; +// } +// return node; +// } +// +// } +// +// export function fixupParentReferences(rootNode: Node) { +// // normally parent references are set during binding. However, for clients that only need +// // a syntax tree, and no semantic features, then the binding process is an unnecessary +// // overhead. This functions allows us to set all the parents, without all the expense of +// // binding. +// setParentRecursive(rootNode, /*incremental*/ true); +// } +// +// function createSourceFile( +// fileName: string, +// languageVersion: ScriptTarget, +// scriptKind: ScriptKind, +// isDeclarationFile: boolean, +// statements: readonly Statement[], +// endOfFileToken: EndOfFileToken, +// flags: NodeFlags, +// setExternalModuleIndicator: (sourceFile: SourceFile) => void): SourceFile { +// // code from createNode is inlined here so createNode won't have to deal with special case of creating source files +// // this is quite rare comparing to other nodes and createNode should be as fast as possible +// let sourceFile = factory.createSourceFile(statements, endOfFileToken, flags); +// setTextRangePosWidth(sourceFile, 0, sourceText.length); +// setFields(sourceFile); +// +// // If we parsed this as an external module, it may contain top-level await +// if (!isDeclarationFile && isExternalModule(sourceFile) && sourceFile.transformFlags & TransformFlags.ContainsPossibleTopLevelAwait) { +// sourceFile = reparseTopLevelAwait(sourceFile); +// setFields(sourceFile); +// } +// +// return sourceFile; +// +// function setFields(sourceFile: SourceFile) { +// sourceFile.text = sourceText; +// sourceFile.bindDiagnostics = []; +// sourceFile.bindSuggestionDiagnostics = undefined; +// sourceFile.languageVersion = languageVersion; +// sourceFile.fileName = fileName; +// sourceFile.languageVariant = getLanguageVariant(scriptKind); +// sourceFile.isDeclarationFile = isDeclarationFile; +// sourceFile.scriptKind = scriptKind; +// +// setExternalModuleIndicator(sourceFile); +// sourceFile.setExternalModuleIndicator = setExternalModuleIndicator; +// } +// } +// +// function setContextFlag(val: boolean, flag: NodeFlags) { +// if (val) { +// contextFlags |= flag; +// } +// else { +// contextFlags &= ~flag; +// } +// } +// +// function setDisallowInContext(val: boolean) { +// setContextFlag(val, NodeFlags::DisallowInContext); +// } +// +// function setYieldContext(val: boolean) { +// setContextFlag(val, NodeFlags::YieldContext); +// } +// +// function setDecoratorContext(val: boolean) { +// setContextFlag(val, NodeFlags::DecoratorContext); +// } +// +// function setAwaitContext(val: boolean) { +// setContextFlag(val, NodeFlags::AwaitContext); +// } +// +// function doOutsideOfContext(context: NodeFlags, func: () => T): T { +// // contextFlagsToClear will contain only the context flags that are +// // currently set that we need to temporarily clear +// // We don't just blindly reset to the previous flags to ensure +// // that we do not mutate cached flags for the incremental +// // parser (ThisNodeHasError, ThisNodeOrAnySubNodesHasError, and +// // HasAggregatedChildData). +// const contextFlagsToClear = context & contextFlags; +// if (contextFlagsToClear) { +// // clear the requested context flags +// setContextFlag(/*val*/ false, contextFlagsToClear); +// const result = func(); +// // restore the context flags we just cleared +// setContextFlag(/*val*/ true, contextFlagsToClear); +// return result; +// } +// +// // no need to do anything special as we are not in any of the requested contexts +// return func(); +// } +// +// function doInsideOfContext(context: NodeFlags, func: () => T): T { +// // contextFlagsToSet will contain only the context flags that +// // are not currently set that we need to temporarily enable. +// // We don't just blindly reset to the previous flags to ensure +// // that we do not mutate cached flags for the incremental +// // parser (ThisNodeHasError, ThisNodeOrAnySubNodesHasError, and +// // HasAggregatedChildData). +// const contextFlagsToSet = context & ~contextFlags; +// if (contextFlagsToSet) { +// // set the requested context flags +// setContextFlag(/*val*/ true, contextFlagsToSet); +// const result = func(); +// // reset the context flags we just set +// setContextFlag(/*val*/ false, contextFlagsToSet); +// return result; +// } +// +// // no need to do anything special as we are already in all of the requested contexts +// return func(); +// } +// +// function allowInAnd(func: () => T): T { +// return doOutsideOfContext(NodeFlags::DisallowInContext, func); +// } +// +// function disallowInAnd(func: () => T): T { +// return doInsideOfContext(NodeFlags::DisallowInContext, func); +// } +// +// function allowConditionalTypesAnd(func: () => T): T { +// return doOutsideOfContext(NodeFlags::DisallowConditionalTypesContext, func); +// } +// +// function disallowConditionalTypesAnd(func: () => T): T { +// return doInsideOfContext(NodeFlags::DisallowConditionalTypesContext, func); +// } +// +// function doInYieldContext(func: () => T): T { +// return doInsideOfContext(NodeFlags::YieldContext, func); +// } +// +// function doInDecoratorContext(func: () => T): T { +// return doInsideOfContext(NodeFlags::DecoratorContext, func); +// } +// +// function doInAwaitContext(func: () => T): T { +// return doInsideOfContext(NodeFlags::AwaitContext, func); +// } +// +// function doOutsideOfAwaitContext(func: () => T): T { +// return doOutsideOfContext(NodeFlags::AwaitContext, func); +// } +// +// function doInYieldAndAwaitContext(func: () => T): T { +// return doInsideOfContext(NodeFlags::YieldContext | NodeFlags::AwaitContext, func); +// } +// +// function doOutsideOfYieldAndAwaitContext(func: () => T): T { +// return doOutsideOfContext(NodeFlags::YieldContext | NodeFlags::AwaitContext, func); +// } +// +// function inContext(flags: NodeFlags) { +// return (contextFlags & flags) !== 0; +// } +// +// function inYieldContext() { +// return inContext(NodeFlags::YieldContext); +// } +// +// function inDisallowInContext() { +// return inContext(NodeFlags::DisallowInContext); +// } +// +// function inDisallowConditionalTypesContext() { +// return inContext(NodeFlags::DisallowConditionalTypesContext); +// } +// +// function inDecoratorContext() { +// return inContext(NodeFlags::DecoratorContext); +// } +// +// function inAwaitContext() { +// return inContext(NodeFlags::AwaitContext); +// } +// +// function parseErrorAtCurrentToken(message: DiagnosticMessage, arg0?: any): DiagnosticWithDetachedLocation | undefined { +// return parseErrorAt(scanner.getTokenPos(), scanner.getTextPos(), message, arg0); +// } +// +// function parseErrorAtPosition(start: number, length: number, message: DiagnosticMessage, arg0?: any): DiagnosticWithDetachedLocation | undefined { +// // Don't report another error if it would just be at the same position as the last error. +// const lastError = lastOrUndefined(parseDiagnostics); +// let result: DiagnosticWithDetachedLocation | undefined; +// if (!lastError || start !== lastError.start) { +// result = createDetachedDiagnostic(fileName, start, length, message, arg0); +// parseDiagnostics.push(result); +// } +// +// // Mark that we've encountered an error. We'll set an appropriate bit on the next +// // node we finish so that it can't be reused incrementally. +// parseErrorBeforeNextFinishedNode = true; +// return result; +// } +// +// function parseErrorAt(start: number, end: number, message: DiagnosticMessage, arg0?: any): DiagnosticWithDetachedLocation | undefined { +// return parseErrorAtPosition(start, end - start, message, arg0); +// } +// +// function parseErrorAtRange(range: TextRange, message: DiagnosticMessage, arg0?: any): void { +// parseErrorAt(range.pos, range.end, message, arg0); +// } +// +// function scanError(message: DiagnosticMessage, length: number): void { +// parseErrorAtPosition(scanner.getTextPos(), length, message); +// } +// +// function getNodePos(): number { +// return scanner.getStartPos(); +// } +// +// function hasPrecedingJSDocComment() { +// return scanner.hasPrecedingJSDocComment(); +// } +// +// // Use this function to access the current token instead of reading the currentToken +// // variable. Since function results aren't narrowed in control flow analysis, this ensures +// // that the type checker doesn't make wrong assumptions about the type of the current +// // token (e.g. a call to nextToken() changes the current token but the checker doesn't +// // reason about this side effect). Mainstream VMs inline simple functions like this, so +// // there is no performance penalty. +// function token(): SyntaxKind { +// return currentToken; +// } +// +// function nextTokenWithoutCheck() { +// return currentToken = scanner.scan(); +// } +// +// function nextTokenAnd(func: () => T): T { +// nextToken(); +// return func(); +// } +// +// function nextToken(): SyntaxKind { +// // if the keyword had an escape +// if (isKeyword(currentToken) && (scanner.hasUnicodeEscape() || scanner.hasExtendedUnicodeEscape())) { +// // issue a parse error for the escape +// parseErrorAt(scanner.getTokenPos(), scanner.getTextPos(), Diagnostics.Keywords_cannot_contain_escape_characters); +// } +// return nextTokenWithoutCheck(); +// } +// +// function nextTokenJSDoc(): JSDocSyntaxKind { +// return currentToken = scanner.scanJsDocToken(); +// } +// +// function reScanGreaterToken(): SyntaxKind { +// return currentToken = scanner.reScanGreaterToken(); +// } +// +// function reScanSlashToken(): SyntaxKind { +// return currentToken = scanner.reScanSlashToken(); +// } +// +// function reScanTemplateToken(isTaggedTemplate: boolean): SyntaxKind { +// return currentToken = scanner.reScanTemplateToken(isTaggedTemplate); +// } +// +// function reScanTemplateHeadOrNoSubstitutionTemplate(): SyntaxKind { +// return currentToken = scanner.reScanTemplateHeadOrNoSubstitutionTemplate(); +// } +// +// function reScanLessThanToken(): SyntaxKind { +// return currentToken = scanner.reScanLessThanToken(); +// } +// +// function reScanHashToken(): SyntaxKind { +// return currentToken = scanner.reScanHashToken(); +// } +// +// function scanJsxIdentifier(): SyntaxKind { +// return currentToken = scanner.scanJsxIdentifier(); +// } +// +// function scanJsxText(): SyntaxKind { +// return currentToken = scanner.scanJsxToken(); +// } +// +// function scanJsxAttributeValue(): SyntaxKind { +// return currentToken = scanner.scanJsxAttributeValue(); +// } +// +// function speculationHelper(callback: () => T, speculationKind: SpeculationKind): T { +// // Keep track of the state we'll need to rollback to if lookahead fails (or if the +// // caller asked us to always reset our state). +// const saveToken = currentToken; +// const saveParseDiagnosticsLength = parseDiagnostics.length; +// const saveParseErrorBeforeNextFinishedNode = parseErrorBeforeNextFinishedNode; +// +// // Note: it is not actually necessary to save/restore the context flags here. That's +// // because the saving/restoring of these flags happens naturally through the recursive +// // descent nature of our parser. However, we still store this here just so we can +// // assert that invariant holds. +// const saveContextFlags = contextFlags; +// +// // If we're only looking ahead, then tell the scanner to only lookahead as well. +// // Otherwise, if we're actually speculatively parsing, then tell the scanner to do the +// // same. +// const result = speculationKind !== SpeculationKind.TryParse +// ? scanner.lookAhead(callback) +// : scanner.tryScan(callback); +// +// Debug.assert(saveContextFlags == contextFlags); +// +// // If our callback returned something 'falsy' or we're just looking ahead, +// // then unconditionally restore us to where we were. +// if (!result || speculationKind !== SpeculationKind.TryParse) { +// currentToken = saveToken; +// if (speculationKind !== SpeculationKind.Reparse) { +// parseDiagnostics.length = saveParseDiagnosticsLength; +// } +// parseErrorBeforeNextFinishedNode = saveParseErrorBeforeNextFinishedNode; +// } +// +// return result; +// } +// +// /** Invokes the provided callback then unconditionally restores the parser to the state it +// * was in immediately prior to invoking the callback. The result of invoking the callback +// * is returned from this function. +// */ +// function lookAhead(callback: () => T): T { +// return speculationHelper(callback, SpeculationKind.Lookahead); +// } +// +// /** Invokes the provided callback. If the callback returns something falsy, then it restores +// * the parser to the state it was in immediately prior to invoking the callback. If the +// * callback returns something truthy, then the parser state is not rolled back. The result +// * of invoking the callback is returned from this function. +// */ +// function tryParse(callback: () => T): T { +// return speculationHelper(callback, SpeculationKind.TryParse); +// } +// +// function isBindingIdentifier(): boolean { +// if (token() == SyntaxKind::Identifier) { +// return true; +// } +// +// // `let await`/`let yield` in [Yield] or [Await] are allowed here and disallowed in the binder. +// return token() > SyntaxKind::LastReservedWord; +// } +// +// // Ignore strict mode flag because we will report an error in type checker instead. +// function isIdentifier(): boolean { +// if (token() == SyntaxKind::Identifier) { +// return true; +// } +// +// // If we have a 'yield' keyword, and we're in the [yield] context, then 'yield' is +// // considered a keyword and is not an identifier. +// if (token() == SyntaxKind::YieldKeyword && inYieldContext()) { +// return false; +// } +// +// // If we have a 'await' keyword, and we're in the [Await] context, then 'await' is +// // considered a keyword and is not an identifier. +// if (token() == SyntaxKind::AwaitKeyword && inAwaitContext()) { +// return false; +// } +// +// return token() > SyntaxKind::LastReservedWord; +// } +// +// function parseExpected(kind: SyntaxKind, diagnosticMessage?: DiagnosticMessage, shouldAdvance = true): boolean { +// if (token() == kind) { +// if (shouldAdvance) { +// nextToken(); +// } +// return true; +// } +// +// // Report specific message if provided with one. Otherwise, report generic fallback message. +// if (diagnosticMessage) { +// parseErrorAtCurrentToken(diagnosticMessage); +// } +// else { +// parseErrorAtCurrentToken(Diagnostics._0_expected, tokenToString(kind)); +// } +// return false; +// } +// +// const viableKeywordSuggestions = Object.keys(textToKeywordObj).filter(keyword => keyword.length > 2); +// +// /** +// * Provides a better error message than the generic "';' expected" if possible for +// * known common variants of a missing semicolon, such as from a mispelled names. +// * +// * @param node Node preceding the expected semicolon location. +// */ +// function parseErrorForMissingSemicolonAfter(node: Expression | PropertyName): void { +// // Tagged template literals are sometimes used in places where only simple strings are allowed, i.e.: +// // module `M1` { +// // ^^^^^^^^^^^ This block is parsed as a template literal like module`M1`. +// if (isTaggedTemplateExpression(node)) { +// parseErrorAt(skipTrivia(sourceText, node.template.pos), node.template.end, Diagnostics.Module_declaration_names_may_only_use_or_quoted_strings); +// return; +// } +// +// // Otherwise, if this isn't a well-known keyword-like identifier, give the generic fallback message. +// const expressionText = ts.isIdentifier(node) ? idText(node) : undefined; +// if (!expressionText || !isIdentifierText(expressionText, languageVersion)) { +// parseErrorAtCurrentToken(Diagnostics._0_expected, tokenToString(SyntaxKind::SemicolonToken)); +// return; +// } +// +// const pos = skipTrivia(sourceText, node.pos); +// +// // Some known keywords are likely signs of syntax being used improperly. +// switch (expressionText) { +// case "const": +// case "let": +// case "var": +// parseErrorAt(pos, node.end, Diagnostics.Variable_declaration_not_allowed_at_this_location); +// return; +// +// case "declare": +// // If a declared node failed to parse, it would have emitted a diagnostic already. +// return; +// +// case "interface": +// parseErrorForInvalidName(Diagnostics.Interface_name_cannot_be_0, Diagnostics.Interface_must_be_given_a_name, SyntaxKind::OpenBraceToken); +// return; +// +// case "is": +// parseErrorAt(pos, scanner.getTextPos(), Diagnostics.A_type_predicate_is_only_allowed_in_return_type_position_for_functions_and_methods); +// return; +// +// case "module": +// case "namespace": +// parseErrorForInvalidName(Diagnostics.Namespace_name_cannot_be_0, Diagnostics.Namespace_must_be_given_a_name, SyntaxKind::OpenBraceToken); +// return; +// +// case "type": +// parseErrorForInvalidName(Diagnostics.Type_alias_name_cannot_be_0, Diagnostics.Type_alias_must_be_given_a_name, SyntaxKind::EqualsToken); +// return; +// } +// +// // The user alternatively might have misspelled or forgotten to add a space after a common keyword. +// const suggestion = getSpellingSuggestion(expressionText, viableKeywordSuggestions, n => n) ?? getSpaceSuggestion(expressionText); +// if (suggestion) { +// parseErrorAt(pos, node.end, Diagnostics.Unknown_keyword_or_identifier_Did_you_mean_0, suggestion); +// return; +// } +// +// // Unknown tokens are handled with their own errors in the scanner +// if (token() == SyntaxKind::Unknown) { +// return; +// } +// +// // Otherwise, we know this some kind of unknown word, not just a missing expected semicolon. +// parseErrorAt(pos, node.end, Diagnostics.Unexpected_keyword_or_identifier); +// } +// +// /** +// * Reports a diagnostic error for the current token being an invalid name. +// * +// * @param blankDiagnostic Diagnostic to report for the case of the name being blank (matched tokenIfBlankName). +// * @param nameDiagnostic Diagnostic to report for all other cases. +// * @param tokenIfBlankName Current token if the name was invalid for being blank (not provided / skipped). +// */ +// function parseErrorForInvalidName(nameDiagnostic: DiagnosticMessage, blankDiagnostic: DiagnosticMessage, tokenIfBlankName: SyntaxKind) { +// if (token() == tokenIfBlankName) { +// parseErrorAtCurrentToken(blankDiagnostic); +// } +// else { +// parseErrorAtCurrentToken(nameDiagnostic, scanner.getTokenValue()); +// } +// } +// +// function getSpaceSuggestion(expressionText: string) { +// for (const keyword of viableKeywordSuggestions) { +// if (expressionText.length > keyword.length + 2 && startsWith(expressionText, keyword)) { +// return `${keyword} ${expressionText.slice(keyword.length)}`; +// } +// } +// +// return undefined; +// } +// +// function parseSemicolonAfterPropertyName(name: PropertyName, type: TypeNode | undefined, initializer: Expression | undefined) { +// if (token() == SyntaxKind::AtToken && !scanner.hasPrecedingLineBreak()) { +// parseErrorAtCurrentToken(Diagnostics.Decorators_must_precede_the_name_and_all_keywords_of_property_declarations); +// return; +// } +// +// if (token() == SyntaxKind::OpenParenToken) { +// parseErrorAtCurrentToken(Diagnostics.Cannot_start_a_function_call_in_a_type_annotation); +// nextToken(); +// return; +// } +// +// if (type && !canParseSemicolon()) { +// if (initializer) { +// parseErrorAtCurrentToken(Diagnostics._0_expected, tokenToString(SyntaxKind::SemicolonToken)); +// } +// else { +// parseErrorAtCurrentToken(Diagnostics.Expected_for_property_initializer); +// } +// return; +// } +// +// if (tryParseSemicolon()) { +// return; +// } +// +// if (initializer) { +// parseErrorAtCurrentToken(Diagnostics._0_expected, tokenToString(SyntaxKind::SemicolonToken)); +// return; +// } +// +// parseErrorForMissingSemicolonAfter(name); +// } +// +// function parseExpectedJSDoc(kind: JSDocSyntaxKind) { +// if (token() == kind) { +// nextTokenJSDoc(); +// return true; +// } +// parseErrorAtCurrentToken(Diagnostics._0_expected, tokenToString(kind)); +// return false; +// } +// +// function parseExpectedMatchingBrackets(openKind: SyntaxKind, closeKind: SyntaxKind, openParsed: boolean, openPosition: number) { +// if (token() == closeKind) { +// nextToken(); +// return; +// } +// const lastError = parseErrorAtCurrentToken(Diagnostics._0_expected, tokenToString(closeKind)); +// if (!openParsed) { +// return; +// } +// if (lastError) { +// addRelatedInfo( +// lastError, +// createDetachedDiagnostic(fileName, openPosition, 1, Diagnostics.The_parser_expected_to_find_a_1_to_match_the_0_token_here, tokenToString(openKind), tokenToString(closeKind)) +// ); +// } +// } +// +// function parseOptional(t: SyntaxKind): boolean { +// if (token() == t) { +// nextToken(); +// return true; +// } +// return false; +// } +// +// function parseOptionalToken(t: TKind): Token; +// function parseOptionalToken(t: SyntaxKind): Node | undefined { +// if (token() == t) { +// return parseTokenNode(); +// } +// return undefined; +// } +// +// function parseOptionalTokenJSDoc(t: TKind): Token; +// function parseOptionalTokenJSDoc(t: JSDocSyntaxKind): Node | undefined { +// if (token() == t) { +// return parseTokenNodeJSDoc(); +// } +// return undefined; +// } +// +// function parseExpectedToken(t: TKind, diagnosticMessage?: DiagnosticMessage, arg0?: any): Token; +// function parseExpectedToken(t: SyntaxKind, diagnosticMessage?: DiagnosticMessage, arg0?: any): Node { +// return parseOptionalToken(t) || +// createMissingNode(t, /*reportAtCurrentPosition*/ false, diagnosticMessage || Diagnostics._0_expected, arg0 || tokenToString(t)); +// } +// +// function parseExpectedTokenJSDoc(t: TKind): Token; +// function parseExpectedTokenJSDoc(t: JSDocSyntaxKind): Node { +// return parseOptionalTokenJSDoc(t) || +// createMissingNode(t, /*reportAtCurrentPosition*/ false, Diagnostics._0_expected, tokenToString(t)); +// } +// +// function parseTokenNode(): T { +// const pos = getNodePos(); +// const kind = token(); +// nextToken(); +// return finishNode(factory.createToken(kind), pos) as T; +// } +// +// function parseTokenNodeJSDoc(): T { +// const pos = getNodePos(); +// const kind = token(); +// nextTokenJSDoc(); +// return finishNode(factory.createToken(kind), pos) as T; +// } +// +// function canParseSemicolon() { +// // If there's a real semicolon, then we can always parse it out. +// if (token() == SyntaxKind::SemicolonToken) { +// return true; +// } +// +// // We can parse out an optional semicolon in ASI cases in the following cases. +// return token() == SyntaxKind::CloseBraceToken || token() == SyntaxKind::EndOfFileToken || scanner.hasPrecedingLineBreak(); +// } +// +// function tryParseSemicolon() { +// if (!canParseSemicolon()) { +// return false; +// } +// +// if (token() == SyntaxKind::SemicolonToken) { +// // consume the semicolon if it was explicitly provided. +// nextToken(); +// } +// +// return true; +// } +// +// function parseSemicolon(): boolean { +// return tryParseSemicolon() || parseExpected(SyntaxKind::SemicolonToken); +// } +// +// function createNodeArray(elements: T[], pos: number, end?: number, hasTrailingComma?: boolean): NodeArray { +// const array = factory.createNodeArray(elements, hasTrailingComma); +// setTextRangePosEnd(array, pos, end ?? scanner.getStartPos()); +// return array; +// } +// +// function finishNode(node: T, pos: number, end?: number): T { +// setTextRangePosEnd(node, pos, end ?? scanner.getStartPos()); +// if (contextFlags) { +// reinterpret_cast&>(node).flags |= contextFlags; +// } +// +// // Keep track on the node if we encountered an error while parsing it. If we did, then +// // we cannot reuse the node incrementally. Once we've marked this node, clear out the +// // flag so that we don't mark any subsequent nodes. +// if (parseErrorBeforeNextFinishedNode) { +// parseErrorBeforeNextFinishedNode = false; +// reinterpret_cast&>(node).flags |= NodeFlags::ThisNodeHasError; +// } +// +// return node; +// } +// +// function createMissingNode(kind: T["kind"], reportAtCurrentPosition: false, diagnosticMessage?: DiagnosticMessage, arg0?: any): T; +// function createMissingNode(kind: T["kind"], reportAtCurrentPosition: boolean, diagnosticMessage: DiagnosticMessage, arg0?: any): T; +// function createMissingNode(kind: T["kind"], reportAtCurrentPosition: boolean, diagnosticMessage: DiagnosticMessage, arg0?: any): T { +// if (reportAtCurrentPosition) { +// parseErrorAtPosition(scanner.getStartPos(), 0, diagnosticMessage, arg0); +// } +// else if (diagnosticMessage) { +// parseErrorAtCurrentToken(diagnosticMessage, arg0); +// } +// +// const pos = getNodePos(); +// const result = +// kind == SyntaxKind::Identifier ? factory.createIdentifier("", /*typeArguments*/ undefined, /*originalKeywordKind*/ undefined) : +// isTemplateLiteralKind(kind) ? factory.createTemplateLiteralLikeNode(kind, "", "", /*templateFlags*/ undefined) : +// kind == SyntaxKind::NumericLiteral ? factory.createNumericLiteral("", /*numericLiteralFlags*/ undefined) : +// kind == SyntaxKind::StringLiteral ? factory.createStringLiteral("", /*isSingleQuote*/ undefined) : +// kind == SyntaxKind::MissingDeclaration ? factory.createMissingDeclaration() : +// factory.createToken(kind); +// return finishNode(result, pos) as T; +// } +// +// function internIdentifier(text: string): string { +// let identifier = identifiers.get(text); +// if (identifier == undefined) { +// identifiers.set(text, identifier = text); +// } +// return identifier; +// } +// +// // An identifier that starts with two underscores has an extra underscore character prepended to it to avoid issues +// // with magic property names like '__proto__'. The 'identifiers' object is used to share a single string instance for +// // each identifier in order to reduce memory consumption. +// function createIdentifier(isIdentifier: boolean, diagnosticMessage?: DiagnosticMessage, privateIdentifierDiagnosticMessage?: DiagnosticMessage): Identifier { +// if (isIdentifier) { +// identifierCount++; +// const pos = getNodePos(); +// // Store original token kind if it is not just an Identifier so we can report appropriate error later in type checker +// const originalKeywordKind = token(); +// const text = internIdentifier(scanner.getTokenValue()); +// nextTokenWithoutCheck(); +// return finishNode(factory.createIdentifier(text, /*typeArguments*/ undefined, originalKeywordKind), pos); +// } +// +// if (token() == SyntaxKind::PrivateIdentifier) { +// parseErrorAtCurrentToken(privateIdentifierDiagnosticMessage || Diagnostics.Private_identifiers_are_not_allowed_outside_class_bodies); +// return createIdentifier(/*isIdentifier*/ true); +// } +// +// if (token() == SyntaxKind::Unknown && scanner.tryScan(() => scanner.reScanInvalidIdentifier() == SyntaxKind::Identifier)) { +// // Scanner has already recorded an 'Invalid character' error, so no need to add another from the parser. +// return createIdentifier(/*isIdentifier*/ true); +// } +// +// identifierCount++; +// // Only for end of file because the error gets reported incorrectly on embedded script tags. +// const reportAtCurrentPosition = token() == SyntaxKind::EndOfFileToken; +// +// const isReservedWord = scanner.isReservedWord(); +// const msgArg = scanner.getTokenText(); +// +// const defaultMessage = isReservedWord ? +// Diagnostics.Identifier_expected_0_is_a_reserved_word_that_cannot_be_used_here : +// Diagnostics.Identifier_expected; +// +// return createMissingNode(SyntaxKind::Identifier, reportAtCurrentPosition, diagnosticMessage || defaultMessage, msgArg); +// } +// +// function parseBindingIdentifier(privateIdentifierDiagnosticMessage?: DiagnosticMessage) { +// return createIdentifier(isBindingIdentifier(), /*diagnosticMessage*/ undefined, privateIdentifierDiagnosticMessage); +// } +// +// function parseIdentifier(diagnosticMessage?: DiagnosticMessage, privateIdentifierDiagnosticMessage?: DiagnosticMessage): Identifier { +// return createIdentifier(isIdentifier(), diagnosticMessage, privateIdentifierDiagnosticMessage); +// } +// +// function parseIdentifierName(diagnosticMessage?: DiagnosticMessage): Identifier { +// return createIdentifier(tokenIsIdentifierOrKeyword(token()), diagnosticMessage); +// } +// +// function isLiteralPropertyName(): boolean { +// return tokenIsIdentifierOrKeyword(token()) || +// token() == SyntaxKind::StringLiteral || +// token() == SyntaxKind::NumericLiteral; +// } +// +// function isAssertionKey(): boolean { +// return tokenIsIdentifierOrKeyword(token()) || +// token() == SyntaxKind::StringLiteral; +// } +// +// function parsePropertyNameWorker(allowComputedPropertyNames: boolean): PropertyName { +// if (token() == SyntaxKind::StringLiteral || token() == SyntaxKind::NumericLiteral) { +// const node = parseLiteralNode() as StringLiteral | NumericLiteral; +// node.text = internIdentifier(node.text); +// return node; +// } +// if (allowComputedPropertyNames && token() == SyntaxKind::OpenBracketToken) { +// return parseComputedPropertyName(); +// } +// if (token() == SyntaxKind::PrivateIdentifier) { +// return parsePrivateIdentifier(); +// } +// return parseIdentifierName(); +// } +// +// function parsePropertyName(): PropertyName { +// return parsePropertyNameWorker(/*allowComputedPropertyNames*/ true); +// } +// +// function parseComputedPropertyName(): ComputedPropertyName { +// // PropertyName [Yield]: +// // LiteralPropertyName +// // ComputedPropertyName[?Yield] +// const pos = getNodePos(); +// parseExpected(SyntaxKind::OpenBracketToken); +// // We parse any expression (including a comma expression). But the grammar +// // says that only an assignment expression is allowed, so the grammar checker +// // will error if it sees a comma expression. +// const expression = allowInAnd(parseExpression); +// parseExpected(SyntaxKind::CloseBracketToken); +// return finishNode(factory.createComputedPropertyName(expression), pos); +// } +// +// function internPrivateIdentifier(text: string): string { +// let privateIdentifier = privateIdentifiers.get(text); +// if (privateIdentifier == undefined) { +// privateIdentifiers.set(text, privateIdentifier = text); +// } +// return privateIdentifier; +// } +// +// function parsePrivateIdentifier(): PrivateIdentifier { +// const pos = getNodePos(); +// const node = factory.createPrivateIdentifier(internPrivateIdentifier(scanner.getTokenText())); +// nextToken(); +// return finishNode(node, pos); +// } +// +// function parseContextualModifier(t: SyntaxKind): boolean { +// return token() == t && tryParse(nextTokenCanFollowModifier); +// } +// +// function nextTokenIsOnSameLineAndCanFollowModifier() { +// nextToken(); +// if (scanner.hasPrecedingLineBreak()) { +// return false; +// } +// return canFollowModifier(); +// } +// +// function nextTokenCanFollowModifier() { +// switch (token()) { +// case SyntaxKind::ConstKeyword: +// // 'const' is only a modifier if followed by 'enum'. +// return nextToken() == SyntaxKind::EnumKeyword; +// case SyntaxKind::ExportKeyword: +// nextToken(); +// if (token() == SyntaxKind::DefaultKeyword) { +// return lookAhead(nextTokenCanFollowDefaultKeyword); +// } +// if (token() == SyntaxKind::TypeKeyword) { +// return lookAhead(nextTokenCanFollowExportModifier); +// } +// return canFollowExportModifier(); +// case SyntaxKind::DefaultKeyword: +// return nextTokenCanFollowDefaultKeyword(); +// case SyntaxKind::StaticKeyword: +// case SyntaxKind::GetKeyword: +// case SyntaxKind::SetKeyword: +// nextToken(); +// return canFollowModifier(); +// default: +// return nextTokenIsOnSameLineAndCanFollowModifier(); +// } +// } +// +// function canFollowExportModifier(): boolean { +// return token() !== SyntaxKind::AsteriskToken +// && token() !== SyntaxKind::AsKeyword +// && token() !== SyntaxKind::OpenBraceToken +// && canFollowModifier(); +// } +// +// function nextTokenCanFollowExportModifier(): boolean { +// nextToken(); +// return canFollowExportModifier(); +// } +// +// function parseAnyContextualModifier(): boolean { +// return isModifierKind(token()) && tryParse(nextTokenCanFollowModifier); +// } +// +// function canFollowModifier(): boolean { +// return token() == SyntaxKind::OpenBracketToken +// || token() == SyntaxKind::OpenBraceToken +// || token() == SyntaxKind::AsteriskToken +// || token() == SyntaxKind::DotDotDotToken +// || isLiteralPropertyName(); +// } +// +// function nextTokenCanFollowDefaultKeyword(): boolean { +// nextToken(); +// return token() == SyntaxKind::ClassKeyword || token() == SyntaxKind::FunctionKeyword || +// token() == SyntaxKind::InterfaceKeyword || +// (token() == SyntaxKind::AbstractKeyword && lookAhead(nextTokenIsClassKeywordOnSameLine)) || +// (token() == SyntaxKind::AsyncKeyword && lookAhead(nextTokenIsFunctionKeywordOnSameLine)); +// } +// +// // True if positioned at the start of a list element +// function isListElement(parsingContext: ParsingContext, inErrorRecovery: boolean): boolean { +// const node = currentNode(parsingContext); +// if (node) { +// return true; +// } +// +// switch (parsingContext) { +// case ParsingContext.SourceElements: +// case ParsingContext.BlockStatements: +// case ParsingContext.SwitchClauseStatements: +// // If we're in error recovery, then we don't want to treat ';' as an empty statement. +// // The problem is that ';' can show up in far too many contexts, and if we see one +// // and assume it's a statement, then we may bail out inappropriately from whatever +// // we're parsing. For example, if we have a semicolon in the middle of a class, then +// // we really don't want to assume the class is over and we're on a statement in the +// // outer module. We just want to consume and move on. +// return !(token() == SyntaxKind::SemicolonToken && inErrorRecovery) && isStartOfStatement(); +// case ParsingContext.SwitchClauses: +// return token() == SyntaxKind::CaseKeyword || token() == SyntaxKind::DefaultKeyword; +// case ParsingContext.TypeMembers: +// return lookAhead(isTypeMemberStart); +// case ParsingContext.ClassMembers: +// // We allow semicolons as class elements (as specified by ES6) as long as we're +// // not in error recovery. If we're in error recovery, we don't want an errant +// // semicolon to be treated as a class member (since they're almost always used +// // for statements. +// return lookAhead(isClassMemberStart) || (token() == SyntaxKind::SemicolonToken && !inErrorRecovery); +// case ParsingContext.EnumMembers: +// // Include open bracket computed properties. This technically also lets in indexers, +// // which would be a candidate for improved error reporting. +// return token() == SyntaxKind::OpenBracketToken || isLiteralPropertyName(); +// case ParsingContext.ObjectLiteralMembers: +// switch (token()) { +// case SyntaxKind::OpenBracketToken: +// case SyntaxKind::AsteriskToken: +// case SyntaxKind::DotDotDotToken: +// case SyntaxKind::DotToken: // Not an object literal member, but don't want to close the object (see `tests/cases/fourslash/completionsDotInObjectLiteral.ts`) +// return true; +// default: +// return isLiteralPropertyName(); +// } +// case ParsingContext.RestProperties: +// return isLiteralPropertyName(); +// case ParsingContext.ObjectBindingElements: +// return token() == SyntaxKind::OpenBracketToken || token() == SyntaxKind::DotDotDotToken || isLiteralPropertyName(); +// case ParsingContext.AssertEntries: +// return isAssertionKey(); +// case ParsingContext.HeritageClauseElement: +// // If we see `{ ... }` then only consume it as an expression if it is followed by `,` or `{` +// // That way we won't consume the body of a class in its heritage clause. +// if (token() == SyntaxKind::OpenBraceToken) { +// return lookAhead(isValidHeritageClauseObjectLiteral); +// } +// +// if (!inErrorRecovery) { +// return isStartOfLeftHandSideExpression() && !isHeritageClauseExtendsOrImplementsKeyword(); +// } +// else { +// // If we're in error recovery we tighten up what we're willing to match. +// // That way we don't treat something like "this" as a valid heritage clause +// // element during recovery. +// return isIdentifier() && !isHeritageClauseExtendsOrImplementsKeyword(); +// } +// case ParsingContext.VariableDeclarations: +// return isBindingIdentifierOrPrivateIdentifierOrPattern(); +// case ParsingContext.ArrayBindingElements: +// return token() == SyntaxKind::CommaToken || token() == SyntaxKind::DotDotDotToken || isBindingIdentifierOrPrivateIdentifierOrPattern(); +// case ParsingContext.TypeParameters: +// return token() == SyntaxKind::InKeyword || isIdentifier(); +// case ParsingContext.ArrayLiteralMembers: +// switch (token()) { +// case SyntaxKind::CommaToken: +// case SyntaxKind::DotToken: // Not an array literal member, but don't want to close the array (see `tests/cases/fourslash/completionsDotInArrayLiteralInObjectLiteral.ts`) +// return true; +// } +// // falls through +// case ParsingContext.ArgumentExpressions: +// return token() == SyntaxKind::DotDotDotToken || isStartOfExpression(); +// case ParsingContext.Parameters: +// return isStartOfParameter(/*isJSDocParameter*/ false); +// case ParsingContext.JSDocParameters: +// return isStartOfParameter(/*isJSDocParameter*/ true); +// case ParsingContext.TypeArguments: +// case ParsingContext.TupleElementTypes: +// return token() == SyntaxKind::CommaToken || isStartOfType(); +// case ParsingContext.HeritageClauses: +// return isHeritageClause(); +// case ParsingContext.ImportOrExportSpecifiers: +// return tokenIsIdentifierOrKeyword(token()); +// case ParsingContext.JsxAttributes: +// return tokenIsIdentifierOrKeyword(token()) || token() == SyntaxKind::OpenBraceToken; +// case ParsingContext.JsxChildren: +// return true; +// } +// +// return Debug.fail("Non-exhaustive case in 'isListElement'."); +// } +// +// function isValidHeritageClauseObjectLiteral() { +// Debug.assert(token() == SyntaxKind::OpenBraceToken); +// if (nextToken() == SyntaxKind::CloseBraceToken) { +// // if we see "extends {}" then only treat the {} as what we're extending (and not +// // the class body) if we have: +// // +// // extends {} { +// // extends {}, +// // extends {} extends +// // extends {} implements +// +// const next = nextToken(); +// return next == SyntaxKind::CommaToken || next == SyntaxKind::OpenBraceToken || next == SyntaxKind::ExtendsKeyword || next == SyntaxKind::ImplementsKeyword; +// } +// +// return true; +// } +// +// function nextTokenIsIdentifier() { +// nextToken(); +// return isIdentifier(); +// } +// +// function nextTokenIsIdentifierOrKeyword() { +// nextToken(); +// return tokenIsIdentifierOrKeyword(token()); +// } +// +// function nextTokenIsIdentifierOrKeywordOrGreaterThan() { +// nextToken(); +// return tokenIsIdentifierOrKeywordOrGreaterThan(token()); +// } +// +// function isHeritageClauseExtendsOrImplementsKeyword(): boolean { +// if (token() == SyntaxKind::ImplementsKeyword || +// token() == SyntaxKind::ExtendsKeyword) { +// +// return lookAhead(nextTokenIsStartOfExpression); +// } +// +// return false; +// } +// +// function nextTokenIsStartOfExpression() { +// nextToken(); +// return isStartOfExpression(); +// } +// +// function nextTokenIsStartOfType() { +// nextToken(); +// return isStartOfType(); +// } +// +// // True if positioned at a list terminator +// function isListTerminator(kind: ParsingContext): boolean { +// if (token() == SyntaxKind::EndOfFileToken) { +// // Being at the end of the file ends all lists. +// return true; +// } +// +// switch (kind) { +// case ParsingContext.BlockStatements: +// case ParsingContext.SwitchClauses: +// case ParsingContext.TypeMembers: +// case ParsingContext.ClassMembers: +// case ParsingContext.EnumMembers: +// case ParsingContext.ObjectLiteralMembers: +// case ParsingContext.ObjectBindingElements: +// case ParsingContext.ImportOrExportSpecifiers: +// case ParsingContext.AssertEntries: +// return token() == SyntaxKind::CloseBraceToken; +// case ParsingContext.SwitchClauseStatements: +// return token() == SyntaxKind::CloseBraceToken || token() == SyntaxKind::CaseKeyword || token() == SyntaxKind::DefaultKeyword; +// case ParsingContext.HeritageClauseElement: +// return token() == SyntaxKind::OpenBraceToken || token() == SyntaxKind::ExtendsKeyword || token() == SyntaxKind::ImplementsKeyword; +// case ParsingContext.VariableDeclarations: +// return isVariableDeclaratorListTerminator(); +// case ParsingContext.TypeParameters: +// // Tokens other than '>' are here for better error recovery +// return token() == SyntaxKind::GreaterThanToken || token() == SyntaxKind::OpenParenToken || token() == SyntaxKind::OpenBraceToken || token() == SyntaxKind::ExtendsKeyword || token() == SyntaxKind::ImplementsKeyword; +// case ParsingContext.ArgumentExpressions: +// // Tokens other than ')' are here for better error recovery +// return token() == SyntaxKind::CloseParenToken || token() == SyntaxKind::SemicolonToken; +// case ParsingContext.ArrayLiteralMembers: +// case ParsingContext.TupleElementTypes: +// case ParsingContext.ArrayBindingElements: +// return token() == SyntaxKind::CloseBracketToken; +// case ParsingContext.JSDocParameters: +// case ParsingContext.Parameters: +// case ParsingContext.RestProperties: +// // Tokens other than ')' and ']' (the latter for index signatures) are here for better error recovery +// return token() == SyntaxKind::CloseParenToken || token() == SyntaxKind::CloseBracketToken /*|| token == SyntaxKind::OpenBraceToken*/; +// case ParsingContext.TypeArguments: +// // All other tokens should cause the type-argument to terminate except comma token +// return token() !== SyntaxKind::CommaToken; +// case ParsingContext.HeritageClauses: +// return token() == SyntaxKind::OpenBraceToken || token() == SyntaxKind::CloseBraceToken; +// case ParsingContext.JsxAttributes: +// return token() == SyntaxKind::GreaterThanToken || token() == SyntaxKind::SlashToken; +// case ParsingContext.JsxChildren: +// return token() == SyntaxKind::LessThanToken && lookAhead(nextTokenIsSlash); +// default: +// return false; +// } +// } +// +// function isVariableDeclaratorListTerminator(): boolean { +// // If we can consume a semicolon (either explicitly, or with ASI), then consider us done +// // with parsing the list of variable declarators. +// if (canParseSemicolon()) { +// return true; +// } +// +// // in the case where we're parsing the variable declarator of a 'for-in' statement, we +// // are done if we see an 'in' keyword in front of us. Same with for-of +// if (isInOrOfKeyword(token())) { +// return true; +// } +// +// // ERROR RECOVERY TWEAK: +// // For better error recovery, if we see an '=>' then we just stop immediately. We've got an +// // arrow function here and it's going to be very unlikely that we'll resynchronize and get +// // another variable declaration. +// if (token() == SyntaxKind::EqualsGreaterThanToken) { +// return true; +// } +// +// // Keep trying to parse out variable declarators. +// return false; +// } +// +// // True if positioned at element or terminator of the current list or any enclosing list +// function isInSomeParsingContext(): boolean { +// for (let kind = 0; kind < ParsingContext.Count; kind++) { +// if (parsingContext & (1 << kind)) { +// if (isListElement(kind, /*inErrorRecovery*/ true) || isListTerminator(kind)) { +// return true; +// } +// } +// } +// +// return false; +// } +// +// // Parses a list of elements +// function parseList(kind: ParsingContext, parseElement: () => T): NodeArray { +// const saveParsingContext = parsingContext; +// parsingContext |= 1 << kind; +// const list = []; +// const listPos = getNodePos(); +// +// while (!isListTerminator(kind)) { +// if (isListElement(kind, /*inErrorRecovery*/ false)) { +// list.push(parseListElement(kind, parseElement)); +// +// continue; +// } +// +// if (abortParsingListOrMoveToNextToken(kind)) { +// break; +// } +// } +// +// parsingContext = saveParsingContext; +// return createNodeArray(list, listPos); +// } +// +// function parseListElement(parsingContext: ParsingContext, parseElement: () => T): T { +// const node = currentNode(parsingContext); +// if (node) { +// return consumeNode(node) as T; +// } +// +// return parseElement(); +// } +// +// function currentNode(parsingContext: ParsingContext): Node | undefined { +// // If we don't have a cursor or the parsing context isn't reusable, there's nothing to reuse. +// // +// // If there is an outstanding parse error that we've encountered, but not attached to +// // some node, then we cannot get a node from the old source tree. This is because we +// // want to mark the next node we encounter as being unusable. +// // +// // Note: This may be too conservative. Perhaps we could reuse the node and set the bit +// // on it (or its leftmost child) as having the error. For now though, being conservative +// // is nice and likely won't ever affect perf. +// if (!syntaxCursor || !isReusableParsingContext(parsingContext) || parseErrorBeforeNextFinishedNode) { +// return undefined; +// } +// +// const node = syntaxCursor.currentNode(scanner.getStartPos()); +// +// // Can't reuse a missing node. +// // Can't reuse a node that intersected the change range. +// // Can't reuse a node that contains a parse error. This is necessary so that we +// // produce the same set of errors again. +// if (nodeIsMissing(node) || node.intersectsChange || containsParseError(node)) { +// return undefined; +// } +// +// // We can only reuse a node if it was parsed under the same strict mode that we're +// // currently in. i.e. if we originally parsed a node in non-strict mode, but then +// // the user added 'using strict' at the top of the file, then we can't use that node +// // again as the presence of strict mode may cause us to parse the tokens in the file +// // differently. +// // +// // Note: we *can* reuse tokens when the strict mode changes. That's because tokens +// // are unaffected by strict mode. It's just the parser will decide what to do with it +// // differently depending on what mode it is in. +// // +// // This also applies to all our other context flags as well. +// const nodeContextFlags = node.flags & NodeFlags::ContextFlags; +// if (nodeContextFlags !== contextFlags) { +// return undefined; +// } +// +// // Ok, we have a node that looks like it could be reused. Now verify that it is valid +// // in the current list parsing context that we're currently at. +// if (!canReuseNode(node, parsingContext)) { +// return undefined; +// } +// +// if (reinterpret_cast(node).jsDocCache) { +// // jsDocCache may include tags from parent nodes, which might have been modified. +// reinterpret_cast(node).jsDocCache = undefined; +// } +// +// return node; +// } +// +// function consumeNode(node: Node) { +// // Move the scanner so it is after the node we just consumed. +// scanner.setTextPos(node.end); +// nextToken(); +// return node; +// } +// +// function isReusableParsingContext(parsingContext: ParsingContext): boolean { +// switch (parsingContext) { +// case ParsingContext.ClassMembers: +// case ParsingContext.SwitchClauses: +// case ParsingContext.SourceElements: +// case ParsingContext.BlockStatements: +// case ParsingContext.SwitchClauseStatements: +// case ParsingContext.EnumMembers: +// case ParsingContext.TypeMembers: +// case ParsingContext.VariableDeclarations: +// case ParsingContext.JSDocParameters: +// case ParsingContext.Parameters: +// return true; +// } +// return false; +// } +// +// function canReuseNode(node: Node, parsingContext: ParsingContext): boolean { +// switch (parsingContext) { +// case ParsingContext.ClassMembers: +// return isReusableClassMember(node); +// +// case ParsingContext.SwitchClauses: +// return isReusableSwitchClause(node); +// +// case ParsingContext.SourceElements: +// case ParsingContext.BlockStatements: +// case ParsingContext.SwitchClauseStatements: +// return isReusableStatement(node); +// +// case ParsingContext.EnumMembers: +// return isReusableEnumMember(node); +// +// case ParsingContext.TypeMembers: +// return isReusableTypeMember(node); +// +// case ParsingContext.VariableDeclarations: +// return isReusableVariableDeclaration(node); +// +// case ParsingContext.JSDocParameters: +// case ParsingContext.Parameters: +// return isReusableParameter(node); +// +// // Any other lists we do not care about reusing nodes in. But feel free to add if +// // you can do so safely. Danger areas involve nodes that may involve speculative +// // parsing. If speculative parsing is involved with the node, then the range the +// // parser reached while looking ahead might be in the edited range (see the example +// // in canReuseVariableDeclaratorNode for a good case of this). +// +// // case ParsingContext.HeritageClauses: +// // This would probably be safe to reuse. There is no speculative parsing with +// // heritage clauses. +// +// // case ParsingContext.TypeParameters: +// // This would probably be safe to reuse. There is no speculative parsing with +// // type parameters. Note that that's because type *parameters* only occur in +// // unambiguous *type* contexts. While type *arguments* occur in very ambiguous +// // *expression* contexts. +// +// // case ParsingContext.TupleElementTypes: +// // This would probably be safe to reuse. There is no speculative parsing with +// // tuple types. +// +// // Technically, type argument list types are probably safe to reuse. While +// // speculative parsing is involved with them (since type argument lists are only +// // produced from speculative parsing a < as a type argument list), we only have +// // the types because speculative parsing succeeded. Thus, the lookahead never +// // went past the end of the list and rewound. +// // case ParsingContext.TypeArguments: +// +// // Note: these are almost certainly not safe to ever reuse. Expressions commonly +// // need a large amount of lookahead, and we should not reuse them as they may +// // have actually intersected the edit. +// // case ParsingContext.ArgumentExpressions: +// +// // This is not safe to reuse for the same reason as the 'AssignmentExpression' +// // cases. i.e. a property assignment may end with an expression, and thus might +// // have lookahead far beyond it's old node. +// // case ParsingContext.ObjectLiteralMembers: +// +// // This is probably not safe to reuse. There can be speculative parsing with +// // type names in a heritage clause. There can be generic names in the type +// // name list, and there can be left hand side expressions (which can have type +// // arguments.) +// // case ParsingContext.HeritageClauseElement: +// +// // Perhaps safe to reuse, but it's unlikely we'd see more than a dozen attributes +// // on any given element. Same for children. +// // case ParsingContext.JsxAttributes: +// // case ParsingContext.JsxChildren: +// +// } +// +// return false; +// } +// +// function isReusableClassMember(node: Node) { +// if (node) { +// switch (node.kind) { +// case SyntaxKind::Constructor: +// case SyntaxKind::IndexSignature: +// case SyntaxKind::GetAccessor: +// case SyntaxKind::SetAccessor: +// case SyntaxKind::PropertyDeclaration: +// case SyntaxKind::SemicolonClassElement: +// return true; +// case SyntaxKind::MethodDeclaration: +// // Method declarations are not necessarily reusable. An object-literal +// // may have a method calls "constructor(...)" and we must reparse that +// // into an actual .ConstructorDeclaration. +// const methodDeclaration = node as MethodDeclaration; +// const nameIsConstructor = methodDeclaration.name.kind == SyntaxKind::Identifier && +// methodDeclaration.name.originalKeywordKind == SyntaxKind::ConstructorKeyword; +// +// return !nameIsConstructor; +// } +// } +// +// return false; +// } +// +// function isReusableSwitchClause(node: Node) { +// if (node) { +// switch (node.kind) { +// case SyntaxKind::CaseClause: +// case SyntaxKind::DefaultClause: +// return true; +// } +// } +// +// return false; +// } +// +// function isReusableStatement(node: Node) { +// if (node) { +// switch (node.kind) { +// case SyntaxKind::FunctionDeclaration: +// case SyntaxKind::VariableStatement: +// case SyntaxKind::Block: +// case SyntaxKind::IfStatement: +// case SyntaxKind::ExpressionStatement: +// case SyntaxKind::ThrowStatement: +// case SyntaxKind::ReturnStatement: +// case SyntaxKind::SwitchStatement: +// case SyntaxKind::BreakStatement: +// case SyntaxKind::ContinueStatement: +// case SyntaxKind::ForInStatement: +// case SyntaxKind::ForOfStatement: +// case SyntaxKind::ForStatement: +// case SyntaxKind::WhileStatement: +// case SyntaxKind::WithStatement: +// case SyntaxKind::EmptyStatement: +// case SyntaxKind::TryStatement: +// case SyntaxKind::LabeledStatement: +// case SyntaxKind::DoStatement: +// case SyntaxKind::DebuggerStatement: +// case SyntaxKind::ImportDeclaration: +// case SyntaxKind::ImportEqualsDeclaration: +// case SyntaxKind::ExportDeclaration: +// case SyntaxKind::ExportAssignment: +// case SyntaxKind::ModuleDeclaration: +// case SyntaxKind::ClassDeclaration: +// case SyntaxKind::InterfaceDeclaration: +// case SyntaxKind::EnumDeclaration: +// case SyntaxKind::TypeAliasDeclaration: +// return true; +// } +// } +// +// return false; +// } +// +// function isReusableEnumMember(node: Node) { +// return node.kind == SyntaxKind::EnumMember; +// } +// +// function isReusableTypeMember(node: Node) { +// if (node) { +// switch (node.kind) { +// case SyntaxKind::ConstructSignature: +// case SyntaxKind::MethodSignature: +// case SyntaxKind::IndexSignature: +// case SyntaxKind::PropertySignature: +// case SyntaxKind::CallSignature: +// return true; +// } +// } +// +// return false; +// } +// +// function isReusableVariableDeclaration(node: Node) { +// if (node.kind !== SyntaxKind::VariableDeclaration) { +// return false; +// } +// +// // Very subtle incremental parsing bug. Consider the following code: +// // +// // let v = new List < A, B +// // +// // This is actually legal code. It's a list of variable declarators "v = new List() +// // +// // then we have a problem. "v = new List(kind: ParsingContext, parseElement: () => T, considerSemicolonAsDelimiter?: boolean): NodeArray; +// function parseDelimitedList(kind: ParsingContext, parseElement: () => T, considerSemicolonAsDelimiter?: boolean): NodeArray> | undefined; +// function parseDelimitedList(kind: ParsingContext, parseElement: () => T, considerSemicolonAsDelimiter?: boolean): NodeArray> | undefined { +// const saveParsingContext = parsingContext; +// parsingContext |= 1 << kind; +// const list = []; +// const listPos = getNodePos(); +// +// let commaStart = -1; // Meaning the previous token was not a comma +// while (true) { +// if (isListElement(kind, /*inErrorRecovery*/ false)) { +// const startPos = scanner.getStartPos(); +// const result = parseListElement(kind, parseElement); +// if (!result) { +// parsingContext = saveParsingContext; +// return undefined; +// } +// list.push(result as NonNullable); +// commaStart = scanner.getTokenPos(); +// +// if (parseOptional(SyntaxKind::CommaToken)) { +// // No need to check for a zero length node since we know we parsed a comma +// continue; +// } +// +// commaStart = -1; // Back to the state where the last token was not a comma +// if (isListTerminator(kind)) { +// break; +// } +// +// // We didn't get a comma, and the list wasn't terminated, explicitly parse +// // out a comma so we give a good error message. +// parseExpected(SyntaxKind::CommaToken, getExpectedCommaDiagnostic(kind)); +// +// // If the token was a semicolon, and the caller allows that, then skip it and +// // continue. This ensures we get back on track and don't result in tons of +// // parse errors. For example, this can happen when people do things like use +// // a semicolon to delimit object literal members. Note: we'll have already +// // reported an error when we called parseExpected above. +// if (considerSemicolonAsDelimiter && token() == SyntaxKind::SemicolonToken && !scanner.hasPrecedingLineBreak()) { +// nextToken(); +// } +// if (startPos == scanner.getStartPos()) { +// // What we're parsing isn't actually remotely recognizable as a element and we've consumed no tokens whatsoever +// // Consume a token to advance the parser in some way and avoid an infinite loop +// // This can happen when we're speculatively parsing parenthesized expressions which we think may be arrow functions, +// // or when a modifier keyword which is disallowed as a parameter name (ie, `static` in strict mode) is supplied +// nextToken(); +// } +// continue; +// } +// +// if (isListTerminator(kind)) { +// break; +// } +// +// if (abortParsingListOrMoveToNextToken(kind)) { +// break; +// } +// } +// +// parsingContext = saveParsingContext; +// // Recording the trailing comma is deliberately done after the previous +// // loop, and not just if we see a list terminator. This is because the list +// // may have ended incorrectly, but it is still important to know if there +// // was a trailing comma. +// // Check if the last token was a comma. +// // Always preserve a trailing comma by marking it on the NodeArray +// return createNodeArray(list, listPos, /*end*/ undefined, commaStart >= 0); +// } +// +// function getExpectedCommaDiagnostic(kind: ParsingContext) { +// return kind == ParsingContext.EnumMembers ? Diagnostics.An_enum_member_name_must_be_followed_by_a_or : undefined; +// } +// +// interface MissingList extends NodeArray { +// isMissingList: true; +// } +// +// function createMissingList(): MissingList { +// const list = createNodeArray([], getNodePos()) as MissingList; +// list.isMissingList = true; +// return list; +// } +// +// function isMissingList(arr: NodeArray): boolean { +// return !!(arr as MissingList).isMissingList; +// } +// +// function parseBracketedList(kind: ParsingContext, parseElement: () => T, open: SyntaxKind, close: SyntaxKind): NodeArray { +// if (parseExpected(open)) { +// const result = parseDelimitedList(kind, parseElement); +// parseExpected(close); +// return result; +// } +// +// return createMissingList(); +// } +// +// function parseEntityName(allowReservedWords: boolean, diagnosticMessage?: DiagnosticMessage): EntityName { +// const pos = getNodePos(); +// let entity: EntityName = allowReservedWords ? parseIdentifierName(diagnosticMessage) : parseIdentifier(diagnosticMessage); +// let dotPos = getNodePos(); +// while (parseOptional(SyntaxKind::DotToken)) { +// if (token() == SyntaxKind::LessThanToken) { +// // the entity is part of a JSDoc-style generic, so record the trailing dot for later error reporting +// entity.jsdocDotPos = dotPos; +// break; +// } +// dotPos = getNodePos(); +// entity = finishNode( +// factory.createQualifiedName( +// entity, +// parseRightSideOfDot(allowReservedWords, /* allowPrivateIdentifiers */ false) as Identifier +// ), +// pos +// ); +// } +// return entity; +// } +// +// function createQualifiedName(entity: EntityName, name: Identifier): QualifiedName { +// return finishNode(factory.createQualifiedName(entity, name), entity.pos); +// } +// +// function parseRightSideOfDot(allowIdentifierNames: boolean, allowPrivateIdentifiers: boolean): Identifier | PrivateIdentifier { +// // Technically a keyword is valid here as all identifiers and keywords are identifier names. +// // However, often we'll encounter this in error situations when the identifier or keyword +// // is actually starting another valid construct. +// // +// // So, we check for the following specific case: +// // +// // name. +// // identifierOrKeyword identifierNameOrKeyword +// // +// // Note: the newlines are important here. For example, if that above code +// // were rewritten into: +// // +// // name.identifierOrKeyword +// // identifierNameOrKeyword +// // +// // Then we would consider it valid. That's because ASI would take effect and +// // the code would be implicitly: "name.identifierOrKeyword; identifierNameOrKeyword". +// // In the first case though, ASI will not take effect because there is not a +// // line terminator after the identifier or keyword. +// if (scanner.hasPrecedingLineBreak() && tokenIsIdentifierOrKeyword(token())) { +// const matchesPattern = lookAhead(nextTokenIsIdentifierOrKeywordOnSameLine); +// +// if (matchesPattern) { +// // Report that we need an identifier. However, report it right after the dot, +// // and not on the next token. This is because the next token might actually +// // be an identifier and the error would be quite confusing. +// return createMissingNode(SyntaxKind::Identifier, /*reportAtCurrentPosition*/ true, Diagnostics.Identifier_expected); +// } +// } +// +// if (token() == SyntaxKind::PrivateIdentifier) { +// const node = parsePrivateIdentifier(); +// return allowPrivateIdentifiers ? node : createMissingNode(SyntaxKind::Identifier, /*reportAtCurrentPosition*/ true, Diagnostics.Identifier_expected); +// } +// +// return allowIdentifierNames ? parseIdentifierName() : parseIdentifier(); +// } +// +// function parseTemplateSpans(isTaggedTemplate: boolean) { +// const pos = getNodePos(); +// const list = []; +// let node: TemplateSpan; +// do { +// node = parseTemplateSpan(isTaggedTemplate); +// list.push(node); +// } +// while (node.literal.kind == SyntaxKind::TemplateMiddle); +// return createNodeArray(list, pos); +// } +// +// function parseTemplateExpression(isTaggedTemplate: boolean): TemplateExpression { +// const pos = getNodePos(); +// return finishNode( +// factory.createTemplateExpression( +// parseTemplateHead(isTaggedTemplate), +// parseTemplateSpans(isTaggedTemplate) +// ), +// pos +// ); +// } +// +// function parseTemplateType(): TemplateLiteralTypeNode { +// const pos = getNodePos(); +// return finishNode( +// factory.createTemplateLiteralType( +// parseTemplateHead(/*isTaggedTemplate*/ false), +// parseTemplateTypeSpans() +// ), +// pos +// ); +// } +// +// function parseTemplateTypeSpans() { +// const pos = getNodePos(); +// const list = []; +// let node: TemplateLiteralTypeSpan; +// do { +// node = parseTemplateTypeSpan(); +// list.push(node); +// } +// while (node.literal.kind == SyntaxKind::TemplateMiddle); +// return createNodeArray(list, pos); +// } +// +// function parseTemplateTypeSpan(): TemplateLiteralTypeSpan { +// const pos = getNodePos(); +// return finishNode( +// factory.createTemplateLiteralTypeSpan( +// parseType(), +// parseLiteralOfTemplateSpan(/*isTaggedTemplate*/ false) +// ), +// pos +// ); +// } +// +// function parseLiteralOfTemplateSpan(isTaggedTemplate: boolean) { +// if (token() == SyntaxKind::CloseBraceToken) { +// reScanTemplateToken(isTaggedTemplate); +// return parseTemplateMiddleOrTemplateTail(); +// } +// else { +// // TODO(rbuckton): Do we need to call `parseExpectedToken` or can we just call `createMissingNode` directly? +// return parseExpectedToken(SyntaxKind::TemplateTail, Diagnostics._0_expected, tokenToString(SyntaxKind::CloseBraceToken)) as TemplateTail; +// } +// } +// +// function parseTemplateSpan(isTaggedTemplate: boolean): TemplateSpan { +// const pos = getNodePos(); +// return finishNode( +// factory.createTemplateSpan( +// allowInAnd(parseExpression), +// parseLiteralOfTemplateSpan(isTaggedTemplate) +// ), +// pos +// ); +// } +// +// function parseLiteralNode(): LiteralExpression { +// return parseLiteralLikeNode(token()) as LiteralExpression; +// } +// +// function parseTemplateHead(isTaggedTemplate: boolean): TemplateHead { +// if (isTaggedTemplate) { +// reScanTemplateHeadOrNoSubstitutionTemplate(); +// } +// const fragment = parseLiteralLikeNode(token()); +// Debug.assert(fragment.kind == SyntaxKind::TemplateHead, "Template head has wrong token kind"); +// return fragment as TemplateHead; +// } +// +// function parseTemplateMiddleOrTemplateTail(): TemplateMiddle | TemplateTail { +// const fragment = parseLiteralLikeNode(token()); +// Debug.assert(fragment.kind == SyntaxKind::TemplateMiddle || fragment.kind == SyntaxKind::TemplateTail, "Template fragment has wrong token kind"); +// return fragment as TemplateMiddle | TemplateTail; +// } +// +// function getTemplateLiteralRawText(kind: TemplateLiteralToken["kind"]) { +// const isLast = kind == SyntaxKind::NoSubstitutionTemplateLiteral || kind == SyntaxKind::TemplateTail; +// const tokenText = scanner.getTokenText(); +// return tokenText.substring(1, tokenText.length - (scanner.isUnterminated() ? 0 : isLast ? 1 : 2)); +// } +// +// function parseLiteralLikeNode(kind: SyntaxKind): LiteralLikeNode { +// const pos = getNodePos(); +// const node = +// isTemplateLiteralKind(kind) ? factory.createTemplateLiteralLikeNode(kind, scanner.getTokenValue(), getTemplateLiteralRawText(kind), scanner.getTokenFlags() & TokenFlags.TemplateLiteralLikeFlags) : +// // Octal literals are not allowed in strict mode or ES5 +// // Note that theoretically the following condition would hold true literals like 009, +// // which is not octal. But because of how the scanner separates the tokens, we would +// // never get a token like this. Instead, we would get 00 and 9 as two separate tokens. +// // We also do not need to check for negatives because any prefix operator would be part of a +// // parent unary expression. +// kind == SyntaxKind::NumericLiteral ? factory.createNumericLiteral(scanner.getTokenValue(), scanner.getNumericLiteralFlags()) : +// kind == SyntaxKind::StringLiteral ? factory.createStringLiteral(scanner.getTokenValue(), /*isSingleQuote*/ undefined, scanner.hasExtendedUnicodeEscape()) : +// isLiteralKind(kind) ? factory.createLiteralLikeNode(kind, scanner.getTokenValue()) : +// Debug.fail(); +// +// if (scanner.hasExtendedUnicodeEscape()) { +// node.hasExtendedUnicodeEscape = true; +// } +// +// if (scanner.isUnterminated()) { +// node.isUnterminated = true; +// } +// +// nextToken(); +// return finishNode(node, pos); +// } +// +// // TYPES +// +// function parseEntityNameOfTypeReference() { +// return parseEntityName(/*allowReservedWords*/ true, Diagnostics.Type_expected); +// } +// +// function parseTypeArgumentsOfTypeReference() { +// if (!scanner.hasPrecedingLineBreak() && reScanLessThanToken() == SyntaxKind::LessThanToken) { +// return parseBracketedList(ParsingContext.TypeArguments, parseType, SyntaxKind::LessThanToken, SyntaxKind::GreaterThanToken); +// } +// } +// +// function parseTypeReference(): TypeReferenceNode { +// const pos = getNodePos(); +// return finishNode( +// factory.createTypeReferenceNode( +// parseEntityNameOfTypeReference(), +// parseTypeArgumentsOfTypeReference() +// ), +// pos +// ); +// } +// +// // If true, we should abort parsing an error function. +// function typeHasArrowFunctionBlockingParseError(node: TypeNode): boolean { +// switch (node.kind) { +// case SyntaxKind::TypeReference: +// return nodeIsMissing(reinterpret_cast(node).typeName); +// case SyntaxKind::FunctionType: +// case SyntaxKind::ConstructorType: { +// const { parameters, type } = node as FunctionOrConstructorTypeNode; +// return isMissingList(parameters) || typeHasArrowFunctionBlockingParseError(type); +// } +// case SyntaxKind::ParenthesizedType: +// return typeHasArrowFunctionBlockingParseError(reinterpret_cast(node).type); +// default: +// return false; +// } +// } +// +// function parseThisTypePredicate(lhs: ThisTypeNode): TypePredicateNode { +// nextToken(); +// return finishNode(factory.createTypePredicateNode(/*assertsModifier*/ undefined, lhs, parseType()), lhs.pos); +// } +// +// function parseThisTypeNode(): ThisTypeNode { +// const pos = getNodePos(); +// nextToken(); +// return finishNode(factory.createThisTypeNode(), pos); +// } +// +// function parseJSDocAllType(): JSDocAllType | JSDocOptionalType { +// const pos = getNodePos(); +// nextToken(); +// return finishNode(factory.createJSDocAllType(), pos); +// } +// +// function parseJSDocNonNullableType(): TypeNode { +// const pos = getNodePos(); +// nextToken(); +// return finishNode(factory.createJSDocNonNullableType(parseNonArrayType(), /*postfix*/ false), pos); +// } +// +// function parseJSDocUnknownOrNullableType(): JSDocUnknownType | JSDocNullableType { +// const pos = getNodePos(); +// // skip the ? +// nextToken(); +// +// // Need to lookahead to decide if this is a nullable or unknown type. +// +// // Here are cases where we'll pick the unknown type: +// // +// // Foo(?, +// // { a: ? } +// // Foo(?) +// // Foo +// // Foo(?= +// // (?| +// if (token() == SyntaxKind::CommaToken || +// token() == SyntaxKind::CloseBraceToken || +// token() == SyntaxKind::CloseParenToken || +// token() == SyntaxKind::GreaterThanToken || +// token() == SyntaxKind::EqualsToken || +// token() == SyntaxKind::BarToken) { +// return finishNode(factory.createJSDocUnknownType(), pos); +// } +// else { +// return finishNode(factory.createJSDocNullableType(parseType(), /*postfix*/ false), pos); +// } +// } +// +// function parseJSDocFunctionType(): JSDocFunctionType | TypeReferenceNode { +// const pos = getNodePos(); +// const hasJSDoc = hasPrecedingJSDocComment(); +// if (lookAhead(nextTokenIsOpenParen)) { +// nextToken(); +// const parameters = parseParameters(SignatureFlags.Type | SignatureFlags.JSDoc); +// const type = parseReturnType(SyntaxKind::ColonToken, /*isType*/ false); +// return withJSDoc(finishNode(factory.createJSDocFunctionType(parameters, type), pos), hasJSDoc); +// } +// return finishNode(factory.createTypeReferenceNode(parseIdentifierName(), /*typeArguments*/ undefined), pos); +// } +// +// function parseJSDocParameter(): ParameterDeclaration { +// const pos = getNodePos(); +// let name: Identifier | undefined; +// if (token() == SyntaxKind::ThisKeyword || token() == SyntaxKind::NewKeyword) { +// name = parseIdentifierName(); +// parseExpected(SyntaxKind::ColonToken); +// } +// return finishNode( +// factory.createParameterDeclaration( +// /*decorators*/ undefined, +// /*modifiers*/ undefined, +// /*dotDotDotToken*/ undefined, +// // TODO(rbuckton): JSDoc parameters don't have names (except `this`/`new`), should we manufacture an empty identifier? +// name!, +// /*questionToken*/ undefined, +// parseJSDocType(), +// /*initializer*/ undefined +// ), +// pos +// ); +// } +// +// function parseJSDocType(): TypeNode { +// scanner.setInJSDocType(true); +// const pos = getNodePos(); +// if (parseOptional(SyntaxKind::ModuleKeyword)) { +// // TODO(rbuckton): We never set the type for a JSDocNamepathType. What should we put here? +// const moduleTag = factory.createJSDocNamepathType(/*type*/ undefined!); +// terminate: while (true) { +// switch (token()) { +// case SyntaxKind::CloseBraceToken: +// case SyntaxKind::EndOfFileToken: +// case SyntaxKind::CommaToken: +// case SyntaxKind::WhitespaceTrivia: +// break terminate; +// default: +// nextTokenJSDoc(); +// } +// } +// +// scanner.setInJSDocType(false); +// return finishNode(moduleTag, pos); +// } +// +// const hasDotDotDot = parseOptional(SyntaxKind::DotDotDotToken); +// let type = parseTypeOrTypePredicate(); +// scanner.setInJSDocType(false); +// if (hasDotDotDot) { +// type = finishNode(factory.createJSDocVariadicType(type), pos); +// } +// if (token() == SyntaxKind::EqualsToken) { +// nextToken(); +// return finishNode(factory.createJSDocOptionalType(type), pos); +// } +// return type; +// } +// +// function parseTypeQuery(): TypeQueryNode { +// const pos = getNodePos(); +// parseExpected(SyntaxKind::TypeOfKeyword); +// const entityName = parseEntityName(/*allowReservedWords*/ true); +// // Make sure we perform ASI to prevent parsing the next line's type arguments as part of an instantiation expression. +// const typeArguments = !scanner.hasPrecedingLineBreak() ? tryParseTypeArguments() : undefined; +// return finishNode(factory.createTypeQueryNode(entityName, typeArguments), pos); +// } +// +// function parseTypeParameter(): TypeParameterDeclaration { +// const pos = getNodePos(); +// const modifiers = parseModifiers(); +// const name = parseIdentifier(); +// let constraint: TypeNode | undefined; +// let expression: Expression | undefined; +// if (parseOptional(SyntaxKind::ExtendsKeyword)) { +// // It's not uncommon for people to write improper constraints to a generic. If the +// // user writes a constraint that is an expression and not an actual type, then parse +// // it out as an expression (so we can recover well), but report that a type is needed +// // instead. +// if (isStartOfType() || !isStartOfExpression()) { +// constraint = parseType(); +// } +// else { +// // It was not a type, and it looked like an expression. Parse out an expression +// // here so we recover well. Note: it is important that we call parseUnaryExpression +// // and not parseExpression here. If the user has: +// // +// // +// // +// // We do *not* want to consume the `>` as we're consuming the expression for "". +// expression = parseUnaryExpressionOrHigher(); +// } +// } +// +// const defaultType = parseOptional(SyntaxKind::EqualsToken) ? parseType() : undefined; +// const node = factory.createTypeParameterDeclaration(modifiers, name, constraint, defaultType); +// node.expression = expression; +// return finishNode(node, pos); +// } +// +// function parseTypeParameters(): NodeArray | undefined { +// if (token() == SyntaxKind::LessThanToken) { +// return parseBracketedList(ParsingContext.TypeParameters, parseTypeParameter, SyntaxKind::LessThanToken, SyntaxKind::GreaterThanToken); +// } +// } +// +// function isStartOfParameter(isJSDocParameter: boolean): boolean { +// return token() == SyntaxKind::DotDotDotToken || +// isBindingIdentifierOrPrivateIdentifierOrPattern() || +// isModifierKind(token()) || +// token() == SyntaxKind::AtToken || +// isStartOfType(/*inStartOfParameter*/ !isJSDocParameter); +// } +// +// function parseNameOfParameter(modifiers: ModifiersArray | undefined) { +// // FormalParameter [Yield,Await]: +// // BindingElement[?Yield,?Await] +// const name = parseIdentifierOrPattern(Diagnostics.Private_identifiers_cannot_be_used_as_parameters); +// if (getFullWidth(name) == 0 && !some(modifiers) && isModifierKind(token())) { +// // in cases like +// // 'use strict' +// // function foo(static) +// // isParameter('static') == true, because of isModifier('static') +// // however 'static' is not a legal identifier in a strict mode. +// // so result of this function will be ParameterDeclaration (flags = 0, name = missing, type = undefined, initializer = undefined) +// // and current token will not change => parsing of the enclosing parameter list will last till the end of time (or OOM) +// // to avoid this we'll advance cursor to the next token. +// nextToken(); +// } +// return name; +// } +// +// function isParameterNameStart() { +// // Be permissive about await and yield by calling isBindingIdentifier instead of isIdentifier; disallowing +// // them during a speculative parse leads to many more follow-on errors than allowing the function to parse then later +// // complaining about the use of the keywords. +// return isBindingIdentifier() || token() == SyntaxKind::OpenBracketToken || token() == SyntaxKind::OpenBraceToken; +// } +// +// function parseParameter(inOuterAwaitContext: boolean): ParameterDeclaration { +// return parseParameterWorker(inOuterAwaitContext); +// } +// +// function parseParameterForSpeculation(inOuterAwaitContext: boolean): ParameterDeclaration | undefined { +// return parseParameterWorker(inOuterAwaitContext, /*allowAmbiguity*/ false); +// } +// +// function parseParameterWorker(inOuterAwaitContext: boolean): ParameterDeclaration; +// function parseParameterWorker(inOuterAwaitContext: boolean, allowAmbiguity: false): ParameterDeclaration | undefined; +// function parseParameterWorker(inOuterAwaitContext: boolean, allowAmbiguity = true): ParameterDeclaration | undefined { +// const pos = getNodePos(); +// const hasJSDoc = hasPrecedingJSDocComment(); +// +// // FormalParameter [Yield,Await]: +// // BindingElement[?Yield,?Await] +// +// // Decorators are parsed in the outer [Await] context, the rest of the parameter is parsed in the function's [Await] context. +// const decorators = inOuterAwaitContext ? doInAwaitContext(parseDecorators) : parseDecorators(); +// +// if (token() == SyntaxKind::ThisKeyword) { +// const node = factory.createParameterDeclaration( +// decorators, +// /*modifiers*/ undefined, +// /*dotDotDotToken*/ undefined, +// createIdentifier(/*isIdentifier*/ true), +// /*questionToken*/ undefined, +// parseTypeAnnotation(), +// /*initializer*/ undefined +// ); +// +// if (decorators) { +// parseErrorAtRange(decorators[0], Diagnostics.Decorators_may_not_be_applied_to_this_parameters); +// } +// +// return withJSDoc(finishNode(node, pos), hasJSDoc); +// } +// +// const savedTopLevel = topLevel; +// topLevel = false; +// +// const modifiers = parseModifiers(); +// const dotDotDotToken = parseOptionalToken(SyntaxKind::DotDotDotToken); +// +// if (!allowAmbiguity && !isParameterNameStart()) { +// return undefined; +// } +// +// const node = withJSDoc( +// finishNode( +// factory.createParameterDeclaration( +// decorators, +// modifiers, +// dotDotDotToken, +// parseNameOfParameter(modifiers), +// parseOptionalToken(SyntaxKind::QuestionToken), +// parseTypeAnnotation(), +// parseInitializer() +// ), +// pos +// ), +// hasJSDoc +// ); +// topLevel = savedTopLevel; +// return node; +// } +// +// function parseReturnType(returnToken: SyntaxKind::EqualsGreaterThanToken, isType: boolean): TypeNode; +// function parseReturnType(returnToken: SyntaxKind::ColonToken | SyntaxKind::EqualsGreaterThanToken, isType: boolean): TypeNode | undefined; +// function parseReturnType(returnToken: SyntaxKind::ColonToken | SyntaxKind::EqualsGreaterThanToken, isType: boolean) { +// if (shouldParseReturnType(returnToken, isType)) { +// return allowConditionalTypesAnd(parseTypeOrTypePredicate); +// } +// } +// +// function shouldParseReturnType(returnToken: SyntaxKind::ColonToken | SyntaxKind::EqualsGreaterThanToken, isType: boolean): boolean { +// if (returnToken == SyntaxKind::EqualsGreaterThanToken) { +// parseExpected(returnToken); +// return true; +// } +// else if (parseOptional(SyntaxKind::ColonToken)) { +// return true; +// } +// else if (isType && token() == SyntaxKind::EqualsGreaterThanToken) { +// // This is easy to get backward, especially in type contexts, so parse the type anyway +// parseErrorAtCurrentToken(Diagnostics._0_expected, tokenToString(SyntaxKind::ColonToken)); +// nextToken(); +// return true; +// } +// return false; +// } +// +// function parseParametersWorker(flags: SignatureFlags, allowAmbiguity: true): NodeArray; +// function parseParametersWorker(flags: SignatureFlags, allowAmbiguity: false): NodeArray | undefined; +// function parseParametersWorker(flags: SignatureFlags, allowAmbiguity: boolean): NodeArray | undefined { +// // FormalParameters [Yield,Await]: (modified) +// // [empty] +// // FormalParameterList[?Yield,Await] +// // +// // FormalParameter[Yield,Await]: (modified) +// // BindingElement[?Yield,Await] +// // +// // BindingElement [Yield,Await]: (modified) +// // SingleNameBinding[?Yield,?Await] +// // BindingPattern[?Yield,?Await]Initializer [In, ?Yield,?Await] opt +// // +// // SingleNameBinding [Yield,Await]: +// // BindingIdentifier[?Yield,?Await]Initializer [In, ?Yield,?Await] opt +// const savedYieldContext = inYieldContext(); +// const savedAwaitContext = inAwaitContext(); +// +// setYieldContext(!!(flags & SignatureFlags.Yield)); +// setAwaitContext(!!(flags & SignatureFlags.Await)); +// +// const parameters = flags & SignatureFlags.JSDoc ? +// parseDelimitedList(ParsingContext.JSDocParameters, parseJSDocParameter) : +// parseDelimitedList(ParsingContext.Parameters, () => allowAmbiguity ? parseParameter(savedAwaitContext) : parseParameterForSpeculation(savedAwaitContext)); +// +// setYieldContext(savedYieldContext); +// setAwaitContext(savedAwaitContext); +// +// return parameters; +// } +// +// function parseParameters(flags: SignatureFlags): NodeArray { +// // FormalParameters [Yield,Await]: (modified) +// // [empty] +// // FormalParameterList[?Yield,Await] +// // +// // FormalParameter[Yield,Await]: (modified) +// // BindingElement[?Yield,Await] +// // +// // BindingElement [Yield,Await]: (modified) +// // SingleNameBinding[?Yield,?Await] +// // BindingPattern[?Yield,?Await]Initializer [In, ?Yield,?Await] opt +// // +// // SingleNameBinding [Yield,Await]: +// // BindingIdentifier[?Yield,?Await]Initializer [In, ?Yield,?Await] opt +// if (!parseExpected(SyntaxKind::OpenParenToken)) { +// return createMissingList(); +// } +// +// const parameters = parseParametersWorker(flags, /*allowAmbiguity*/ true); +// parseExpected(SyntaxKind::CloseParenToken); +// return parameters; +// } +// +// function parseTypeMemberSemicolon() { +// // We allow type members to be separated by commas or (possibly ASI) semicolons. +// // First check if it was a comma. If so, we're done with the member. +// if (parseOptional(SyntaxKind::CommaToken)) { +// return; +// } +// +// // Didn't have a comma. We must have a (possible ASI) semicolon. +// parseSemicolon(); +// } +// +// function parseSignatureMember(kind: SyntaxKind::CallSignature | SyntaxKind::ConstructSignature): CallSignatureDeclaration | ConstructSignatureDeclaration { +// const pos = getNodePos(); +// const hasJSDoc = hasPrecedingJSDocComment(); +// if (kind == SyntaxKind::ConstructSignature) { +// parseExpected(SyntaxKind::NewKeyword); +// } +// +// const typeParameters = parseTypeParameters(); +// const parameters = parseParameters(SignatureFlags.Type); +// const type = parseReturnType(SyntaxKind::ColonToken, /*isType*/ true); +// parseTypeMemberSemicolon(); +// const node = kind == SyntaxKind::CallSignature +// ? factory.createCallSignature(typeParameters, parameters, type) +// : factory.createConstructSignature(typeParameters, parameters, type); +// return withJSDoc(finishNode(node, pos), hasJSDoc); +// } +// +// function isIndexSignature(): boolean { +// return token() == SyntaxKind::OpenBracketToken && lookAhead(isUnambiguouslyIndexSignature); +// } +// +// function isUnambiguouslyIndexSignature() { +// // The only allowed sequence is: +// // +// // [id: +// // +// // However, for error recovery, we also check the following cases: +// // +// // [... +// // [id, +// // [id?, +// // [id?: +// // [id?] +// // [public id +// // [private id +// // [protected id +// // [] +// // +// nextToken(); +// if (token() == SyntaxKind::DotDotDotToken || token() == SyntaxKind::CloseBracketToken) { +// return true; +// } +// +// if (isModifierKind(token())) { +// nextToken(); +// if (isIdentifier()) { +// return true; +// } +// } +// else if (!isIdentifier()) { +// return false; +// } +// else { +// // Skip the identifier +// nextToken(); +// } +// +// // A colon signifies a well formed indexer +// // A comma should be a badly formed indexer because comma expressions are not allowed +// // in computed properties. +// if (token() == SyntaxKind::ColonToken || token() == SyntaxKind::CommaToken) { +// return true; +// } +// +// // Question mark could be an indexer with an optional property, +// // or it could be a conditional expression in a computed property. +// if (token() !== SyntaxKind::QuestionToken) { +// return false; +// } +// +// // If any of the following tokens are after the question mark, it cannot +// // be a conditional expression, so treat it as an indexer. +// nextToken(); +// return token() == SyntaxKind::ColonToken || token() == SyntaxKind::CommaToken || token() == SyntaxKind::CloseBracketToken; +// } +// +// function parseIndexSignatureDeclaration(pos: number, hasJSDoc: boolean, decorators: NodeArray | undefined, modifiers: NodeArray | undefined): IndexSignatureDeclaration { +// const parameters = parseBracketedList(ParsingContext.Parameters, () => parseParameter(/*inOuterAwaitContext*/ false), SyntaxKind::OpenBracketToken, SyntaxKind::CloseBracketToken); +// const type = parseTypeAnnotation(); +// parseTypeMemberSemicolon(); +// const node = factory.createIndexSignature(decorators, modifiers, parameters, type); +// return withJSDoc(finishNode(node, pos), hasJSDoc); +// } +// +// function parsePropertyOrMethodSignature(pos: number, hasJSDoc: boolean, modifiers: NodeArray | undefined): PropertySignature | MethodSignature { +// const name = parsePropertyName(); +// const questionToken = parseOptionalToken(SyntaxKind::QuestionToken); +// let node: PropertySignature | MethodSignature; +// if (token() == SyntaxKind::OpenParenToken || token() == SyntaxKind::LessThanToken) { +// // Method signatures don't exist in expression contexts. So they have neither +// // [Yield] nor [Await] +// const typeParameters = parseTypeParameters(); +// const parameters = parseParameters(SignatureFlags.Type); +// const type = parseReturnType(SyntaxKind::ColonToken, /*isType*/ true); +// node = factory.createMethodSignature(modifiers, name, questionToken, typeParameters, parameters, type); +// } +// else { +// const type = parseTypeAnnotation(); +// node = factory.createPropertySignature(modifiers, name, questionToken, type); +// // Although type literal properties cannot not have initializers, we attempt +// // to parse an initializer so we can report in the checker that an interface +// // property or type literal property cannot have an initializer. +// if (token() == SyntaxKind::EqualsToken) node.initializer = parseInitializer(); +// } +// parseTypeMemberSemicolon(); +// return withJSDoc(finishNode(node, pos), hasJSDoc); +// } +// +// function isTypeMemberStart(): boolean { +// // Return true if we have the start of a signature member +// if (token() == SyntaxKind::OpenParenToken || +// token() == SyntaxKind::LessThanToken || +// token() == SyntaxKind::GetKeyword || +// token() == SyntaxKind::SetKeyword) { +// return true; +// } +// let idToken = false; +// // Eat up all modifiers, but hold on to the last one in case it is actually an identifier +// while (isModifierKind(token())) { +// idToken = true; +// nextToken(); +// } +// // Index signatures and computed property names are type members +// if (token() == SyntaxKind::OpenBracketToken) { +// return true; +// } +// // Try to get the first property-like token following all modifiers +// if (isLiteralPropertyName()) { +// idToken = true; +// nextToken(); +// } +// // If we were able to get any potential identifier, check that it is +// // the start of a member declaration +// if (idToken) { +// return token() == SyntaxKind::OpenParenToken || +// token() == SyntaxKind::LessThanToken || +// token() == SyntaxKind::QuestionToken || +// token() == SyntaxKind::ColonToken || +// token() == SyntaxKind::CommaToken || +// canParseSemicolon(); +// } +// return false; +// } +// +// function parseTypeMember(): TypeElement { +// if (token() == SyntaxKind::OpenParenToken || token() == SyntaxKind::LessThanToken) { +// return parseSignatureMember(SyntaxKind::CallSignature); +// } +// if (token() == SyntaxKind::NewKeyword && lookAhead(nextTokenIsOpenParenOrLessThan)) { +// return parseSignatureMember(SyntaxKind::ConstructSignature); +// } +// const pos = getNodePos(); +// const hasJSDoc = hasPrecedingJSDocComment(); +// const modifiers = parseModifiers(); +// if (parseContextualModifier(SyntaxKind::GetKeyword)) { +// return parseAccessorDeclaration(pos, hasJSDoc, /*decorators*/ undefined, modifiers, SyntaxKind::GetAccessor); +// } +// +// if (parseContextualModifier(SyntaxKind::SetKeyword)) { +// return parseAccessorDeclaration(pos, hasJSDoc, /*decorators*/ undefined, modifiers, SyntaxKind::SetAccessor); +// } +// +// if (isIndexSignature()) { +// return parseIndexSignatureDeclaration(pos, hasJSDoc, /*decorators*/ undefined, modifiers); +// } +// return parsePropertyOrMethodSignature(pos, hasJSDoc, modifiers); +// } +// +// function nextTokenIsOpenParenOrLessThan() { +// nextToken(); +// return token() == SyntaxKind::OpenParenToken || token() == SyntaxKind::LessThanToken; +// } +// +// function nextTokenIsDot() { +// return nextToken() == SyntaxKind::DotToken; +// } +// +// function nextTokenIsOpenParenOrLessThanOrDot() { +// switch (nextToken()) { +// case SyntaxKind::OpenParenToken: +// case SyntaxKind::LessThanToken: +// case SyntaxKind::DotToken: +// return true; +// } +// return false; +// } +// +// function parseTypeLiteral(): TypeLiteralNode { +// const pos = getNodePos(); +// return finishNode(factory.createTypeLiteralNode(parseObjectTypeMembers()), pos); +// } +// +// function parseObjectTypeMembers(): NodeArray { +// let members: NodeArray; +// if (parseExpected(SyntaxKind::OpenBraceToken)) { +// members = parseList(ParsingContext.TypeMembers, parseTypeMember); +// parseExpected(SyntaxKind::CloseBraceToken); +// } +// else { +// members = createMissingList(); +// } +// +// return members; +// } +// +// function isStartOfMappedType() { +// nextToken(); +// if (token() == SyntaxKind::PlusToken || token() == SyntaxKind::MinusToken) { +// return nextToken() == SyntaxKind::ReadonlyKeyword; +// } +// if (token() == SyntaxKind::ReadonlyKeyword) { +// nextToken(); +// } +// return token() == SyntaxKind::OpenBracketToken && nextTokenIsIdentifier() && nextToken() == SyntaxKind::InKeyword; +// } +// +// function parseMappedTypeParameter() { +// const pos = getNodePos(); +// const name = parseIdentifierName(); +// parseExpected(SyntaxKind::InKeyword); +// const type = parseType(); +// return finishNode(factory.createTypeParameterDeclaration(/*modifiers*/ undefined, name, type, /*defaultType*/ undefined), pos); +// } +// +// function parseMappedType() { +// const pos = getNodePos(); +// parseExpected(SyntaxKind::OpenBraceToken); +// let readonlyToken: ReadonlyKeyword | PlusToken | MinusToken | undefined; +// if (token() == SyntaxKind::ReadonlyKeyword || token() == SyntaxKind::PlusToken || token() == SyntaxKind::MinusToken) { +// readonlyToken = parseTokenNode(); +// if (readonlyToken.kind !== SyntaxKind::ReadonlyKeyword) { +// parseExpected(SyntaxKind::ReadonlyKeyword); +// } +// } +// parseExpected(SyntaxKind::OpenBracketToken); +// const typeParameter = parseMappedTypeParameter(); +// const nameType = parseOptional(SyntaxKind::AsKeyword) ? parseType() : undefined; +// parseExpected(SyntaxKind::CloseBracketToken); +// let questionToken: QuestionToken | PlusToken | MinusToken | undefined; +// if (token() == SyntaxKind::QuestionToken || token() == SyntaxKind::PlusToken || token() == SyntaxKind::MinusToken) { +// questionToken = parseTokenNode(); +// if (questionToken.kind !== SyntaxKind::QuestionToken) { +// parseExpected(SyntaxKind::QuestionToken); +// } +// } +// const type = parseTypeAnnotation(); +// parseSemicolon(); +// const members = parseList(ParsingContext.TypeMembers, parseTypeMember); +// parseExpected(SyntaxKind::CloseBraceToken); +// return finishNode(factory.createMappedTypeNode(readonlyToken, typeParameter, nameType, questionToken, type, members), pos); +// } +// +// function parseTupleElementType() { +// const pos = getNodePos(); +// if (parseOptional(SyntaxKind::DotDotDotToken)) { +// return finishNode(factory.createRestTypeNode(parseType()), pos); +// } +// const type = parseType(); +// if (isJSDocNullableType(type) && type.pos == type.type.pos) { +// const node = factory.createOptionalTypeNode(type.type); +// setTextRange(node, type); +// reinterpret_cast&>(node).flags = type.flags; +// return node; +// } +// return type; +// } +// +// function isNextTokenColonOrQuestionColon() { +// return nextToken() == SyntaxKind::ColonToken || (token() == SyntaxKind::QuestionToken && nextToken() == SyntaxKind::ColonToken); +// } +// +// function isTupleElementName() { +// if (token() == SyntaxKind::DotDotDotToken) { +// return tokenIsIdentifierOrKeyword(nextToken()) && isNextTokenColonOrQuestionColon(); +// } +// return tokenIsIdentifierOrKeyword(token()) && isNextTokenColonOrQuestionColon(); +// } +// +// function parseTupleElementNameOrTupleElementType() { +// if (lookAhead(isTupleElementName)) { +// const pos = getNodePos(); +// const hasJSDoc = hasPrecedingJSDocComment(); +// const dotDotDotToken = parseOptionalToken(SyntaxKind::DotDotDotToken); +// const name = parseIdentifierName(); +// const questionToken = parseOptionalToken(SyntaxKind::QuestionToken); +// parseExpected(SyntaxKind::ColonToken); +// const type = parseTupleElementType(); +// const node = factory.createNamedTupleMember(dotDotDotToken, name, questionToken, type); +// return withJSDoc(finishNode(node, pos), hasJSDoc); +// } +// return parseTupleElementType(); +// } +// +// function parseTupleType(): TupleTypeNode { +// const pos = getNodePos(); +// return finishNode( +// factory.createTupleTypeNode( +// parseBracketedList(ParsingContext.TupleElementTypes, parseTupleElementNameOrTupleElementType, SyntaxKind::OpenBracketToken, SyntaxKind::CloseBracketToken) +// ), +// pos +// ); +// } +// +// function parseParenthesizedType(): TypeNode { +// const pos = getNodePos(); +// parseExpected(SyntaxKind::OpenParenToken); +// const type = parseType(); +// parseExpected(SyntaxKind::CloseParenToken); +// return finishNode(factory.createParenthesizedType(type), pos); +// } +// +// function parseModifiersForConstructorType(): NodeArray | undefined { +// let modifiers: NodeArray | undefined; +// if (token() == SyntaxKind::AbstractKeyword) { +// const pos = getNodePos(); +// nextToken(); +// const modifier = finishNode(factory.createToken(SyntaxKind::AbstractKeyword), pos); +// modifiers = createNodeArray([modifier], pos); +// } +// return modifiers; +// } +// +// function parseFunctionOrConstructorType(): TypeNode { +// const pos = getNodePos(); +// const hasJSDoc = hasPrecedingJSDocComment(); +// const modifiers = parseModifiersForConstructorType(); +// const isConstructorType = parseOptional(SyntaxKind::NewKeyword); +// const typeParameters = parseTypeParameters(); +// const parameters = parseParameters(SignatureFlags.Type); +// const type = parseReturnType(SyntaxKind::EqualsGreaterThanToken, /*isType*/ false); +// const node = isConstructorType +// ? factory.createConstructorTypeNode(modifiers, typeParameters, parameters, type) +// : factory.createFunctionTypeNode(typeParameters, parameters, type); +// if (!isConstructorType) reinterpret_cast&>(node).modifiers = modifiers; +// return withJSDoc(finishNode(node, pos), hasJSDoc); +// } +// +// function parseKeywordAndNoDot(): TypeNode | undefined { +// const node = parseTokenNode(); +// return token() == SyntaxKind::DotToken ? undefined : node; +// } +// +// function parseLiteralTypeNode(negative?: boolean): LiteralTypeNode { +// const pos = getNodePos(); +// if (negative) { +// nextToken(); +// } +// let expression: BooleanLiteral | NullLiteral | LiteralExpression | PrefixUnaryExpression = +// token() == SyntaxKind::TrueKeyword || token() == SyntaxKind::FalseKeyword || token() == SyntaxKind::NullKeyword ? +// parseTokenNode() : +// parseLiteralLikeNode(token()) as LiteralExpression; +// if (negative) { +// expression = finishNode(factory.createPrefixUnaryExpression(SyntaxKind::MinusToken, expression), pos); +// } +// return finishNode(factory.createLiteralTypeNode(expression), pos); +// } +// +// function isStartOfTypeOfImportType() { +// nextToken(); +// return token() == SyntaxKind::ImportKeyword; +// } +// +// function parseImportTypeAssertions(): ImportTypeAssertionContainer { +// const pos = getNodePos(); +// const openBracePosition = scanner.getTokenPos(); +// parseExpected(SyntaxKind::OpenBraceToken); +// const multiLine = scanner.hasPrecedingLineBreak(); +// parseExpected(SyntaxKind::AssertKeyword); +// parseExpected(SyntaxKind::ColonToken); +// const clause = parseAssertClause(/*skipAssertKeyword*/ true); +// if (!parseExpected(SyntaxKind::CloseBraceToken)) { +// const lastError = lastOrUndefined(parseDiagnostics); +// if (lastError && lastError.code == Diagnostics._0_expected.code) { +// addRelatedInfo( +// lastError, +// createDetachedDiagnostic(fileName, openBracePosition, 1, Diagnostics.The_parser_expected_to_find_a_1_to_match_the_0_token_here, "{", "}") +// ); +// } +// } +// return finishNode(factory.createImportTypeAssertionContainer(clause, multiLine), pos); +// } +// +// function parseImportType(): ImportTypeNode { +// sourceFlags |= NodeFlags::PossiblyContainsDynamicImport; +// const pos = getNodePos(); +// const isTypeOf = parseOptional(SyntaxKind::TypeOfKeyword); +// parseExpected(SyntaxKind::ImportKeyword); +// parseExpected(SyntaxKind::OpenParenToken); +// const type = parseType(); +// let assertions: ImportTypeAssertionContainer | undefined; +// if (parseOptional(SyntaxKind::CommaToken)) { +// assertions = parseImportTypeAssertions(); +// } +// parseExpected(SyntaxKind::CloseParenToken); +// const qualifier = parseOptional(SyntaxKind::DotToken) ? parseEntityNameOfTypeReference() : undefined; +// const typeArguments = parseTypeArgumentsOfTypeReference(); +// return finishNode(factory.createImportTypeNode(type, assertions, qualifier, typeArguments, isTypeOf), pos); +// } +// +// function nextTokenIsNumericOrBigIntLiteral() { +// nextToken(); +// return token() == SyntaxKind::NumericLiteral || token() == SyntaxKind::BigIntLiteral; +// } +// +// function parseNonArrayType(): TypeNode { +// switch (token()) { +// case SyntaxKind::AnyKeyword: +// case SyntaxKind::UnknownKeyword: +// case SyntaxKind::StringKeyword: +// case SyntaxKind::NumberKeyword: +// case SyntaxKind::BigIntKeyword: +// case SyntaxKind::SymbolKeyword: +// case SyntaxKind::BooleanKeyword: +// case SyntaxKind::UndefinedKeyword: +// case SyntaxKind::NeverKeyword: +// case SyntaxKind::ObjectKeyword: +// // If these are followed by a dot, then parse these out as a dotted type reference instead. +// return tryParse(parseKeywordAndNoDot) || parseTypeReference(); +// case SyntaxKind::AsteriskEqualsToken: +// // If there is '*=', treat it as * followed by postfix = +// scanner.reScanAsteriskEqualsToken(); +// // falls through +// case SyntaxKind::AsteriskToken: +// return parseJSDocAllType(); +// case SyntaxKind::QuestionQuestionToken: +// // If there is '??', treat it as prefix-'?' in JSDoc type. +// scanner.reScanQuestionToken(); +// // falls through +// case SyntaxKind::QuestionToken: +// return parseJSDocUnknownOrNullableType(); +// case SyntaxKind::FunctionKeyword: +// return parseJSDocFunctionType(); +// case SyntaxKind::ExclamationToken: +// return parseJSDocNonNullableType(); +// case SyntaxKind::NoSubstitutionTemplateLiteral: +// case SyntaxKind::StringLiteral: +// case SyntaxKind::NumericLiteral: +// case SyntaxKind::BigIntLiteral: +// case SyntaxKind::TrueKeyword: +// case SyntaxKind::FalseKeyword: +// case SyntaxKind::NullKeyword: +// return parseLiteralTypeNode(); +// case SyntaxKind::MinusToken: +// return lookAhead(nextTokenIsNumericOrBigIntLiteral) ? parseLiteralTypeNode(/*negative*/ true) : parseTypeReference(); +// case SyntaxKind::VoidKeyword: +// return parseTokenNode(); +// case SyntaxKind::ThisKeyword: { +// const thisKeyword = parseThisTypeNode(); +// if (token() == SyntaxKind::IsKeyword && !scanner.hasPrecedingLineBreak()) { +// return parseThisTypePredicate(thisKeyword); +// } +// else { +// return thisKeyword; +// } +// } +// case SyntaxKind::TypeOfKeyword: +// return lookAhead(isStartOfTypeOfImportType) ? parseImportType() : parseTypeQuery(); +// case SyntaxKind::OpenBraceToken: +// return lookAhead(isStartOfMappedType) ? parseMappedType() : parseTypeLiteral(); +// case SyntaxKind::OpenBracketToken: +// return parseTupleType(); +// case SyntaxKind::OpenParenToken: +// return parseParenthesizedType(); +// case SyntaxKind::ImportKeyword: +// return parseImportType(); +// case SyntaxKind::AssertsKeyword: +// return lookAhead(nextTokenIsIdentifierOrKeywordOnSameLine) ? parseAssertsTypePredicate() : parseTypeReference(); +// case SyntaxKind::TemplateHead: +// return parseTemplateType(); +// default: +// return parseTypeReference(); +// } +// } +// +// function isStartOfType(inStartOfParameter?: boolean): boolean { +// switch (token()) { +// case SyntaxKind::AnyKeyword: +// case SyntaxKind::UnknownKeyword: +// case SyntaxKind::StringKeyword: +// case SyntaxKind::NumberKeyword: +// case SyntaxKind::BigIntKeyword: +// case SyntaxKind::BooleanKeyword: +// case SyntaxKind::ReadonlyKeyword: +// case SyntaxKind::SymbolKeyword: +// case SyntaxKind::UniqueKeyword: +// case SyntaxKind::VoidKeyword: +// case SyntaxKind::UndefinedKeyword: +// case SyntaxKind::NullKeyword: +// case SyntaxKind::ThisKeyword: +// case SyntaxKind::TypeOfKeyword: +// case SyntaxKind::NeverKeyword: +// case SyntaxKind::OpenBraceToken: +// case SyntaxKind::OpenBracketToken: +// case SyntaxKind::LessThanToken: +// case SyntaxKind::BarToken: +// case SyntaxKind::AmpersandToken: +// case SyntaxKind::NewKeyword: +// case SyntaxKind::StringLiteral: +// case SyntaxKind::NumericLiteral: +// case SyntaxKind::BigIntLiteral: +// case SyntaxKind::TrueKeyword: +// case SyntaxKind::FalseKeyword: +// case SyntaxKind::ObjectKeyword: +// case SyntaxKind::AsteriskToken: +// case SyntaxKind::QuestionToken: +// case SyntaxKind::ExclamationToken: +// case SyntaxKind::DotDotDotToken: +// case SyntaxKind::InferKeyword: +// case SyntaxKind::ImportKeyword: +// case SyntaxKind::AssertsKeyword: +// case SyntaxKind::NoSubstitutionTemplateLiteral: +// case SyntaxKind::TemplateHead: +// return true; +// case SyntaxKind::FunctionKeyword: +// return !inStartOfParameter; +// case SyntaxKind::MinusToken: +// return !inStartOfParameter && lookAhead(nextTokenIsNumericOrBigIntLiteral); +// case SyntaxKind::OpenParenToken: +// // Only consider '(' the start of a type if followed by ')', '...', an identifier, a modifier, +// // or something that starts a type. We don't want to consider things like '(1)' a type. +// return !inStartOfParameter && lookAhead(isStartOfParenthesizedOrFunctionType); +// default: +// return isIdentifier(); +// } +// } +// +// function isStartOfParenthesizedOrFunctionType() { +// nextToken(); +// return token() == SyntaxKind::CloseParenToken || isStartOfParameter(/*isJSDocParameter*/ false) || isStartOfType(); +// } +// +// function parsePostfixTypeOrHigher(): TypeNode { +// const pos = getNodePos(); +// let type = parseNonArrayType(); +// while (!scanner.hasPrecedingLineBreak()) { +// switch (token()) { +// case SyntaxKind::ExclamationToken: +// nextToken(); +// type = finishNode(factory.createJSDocNonNullableType(type, /*postfix*/ true), pos); +// break; +// case SyntaxKind::QuestionToken: +// // If next token is start of a type we have a conditional type +// if (lookAhead(nextTokenIsStartOfType)) { +// return type; +// } +// nextToken(); +// type = finishNode(factory.createJSDocNullableType(type, /*postfix*/ true), pos); +// break; +// case SyntaxKind::OpenBracketToken: +// parseExpected(SyntaxKind::OpenBracketToken); +// if (isStartOfType()) { +// const indexType = parseType(); +// parseExpected(SyntaxKind::CloseBracketToken); +// type = finishNode(factory.createIndexedAccessTypeNode(type, indexType), pos); +// } +// else { +// parseExpected(SyntaxKind::CloseBracketToken); +// type = finishNode(factory.createArrayTypeNode(type), pos); +// } +// break; +// default: +// return type; +// } +// } +// return type; +// } +// +// function parseTypeOperator(operator: SyntaxKind::KeyOfKeyword | SyntaxKind::UniqueKeyword | SyntaxKind::ReadonlyKeyword) { +// const pos = getNodePos(); +// parseExpected(operator); +// return finishNode(factory.createTypeOperatorNode(operator, parseTypeOperatorOrHigher()), pos); +// } +// +// function tryParseConstraintOfInferType() { +// if (parseOptional(SyntaxKind::ExtendsKeyword)) { +// const constraint = disallowConditionalTypesAnd(parseType); +// if (inDisallowConditionalTypesContext() || token() !== SyntaxKind::QuestionToken) { +// return constraint; +// } +// } +// } +// +// function parseTypeParameterOfInferType(): TypeParameterDeclaration { +// const pos = getNodePos(); +// const name = parseIdentifier(); +// const constraint = tryParse(tryParseConstraintOfInferType); +// const node = factory.createTypeParameterDeclaration(/*modifiers*/ undefined, name, constraint); +// return finishNode(node, pos); +// } +// +// function parseInferType(): InferTypeNode { +// const pos = getNodePos(); +// parseExpected(SyntaxKind::InferKeyword); +// return finishNode(factory.createInferTypeNode(parseTypeParameterOfInferType()), pos); +// } +// +// function parseTypeOperatorOrHigher(): TypeNode { +// const operator = token(); +// switch (operator) { +// case SyntaxKind::KeyOfKeyword: +// case SyntaxKind::UniqueKeyword: +// case SyntaxKind::ReadonlyKeyword: +// return parseTypeOperator(operator); +// case SyntaxKind::InferKeyword: +// return parseInferType(); +// } +// return allowConditionalTypesAnd(parsePostfixTypeOrHigher); +// } +// +// function parseFunctionOrConstructorTypeToError( +// isInUnionType: boolean +// ): TypeNode | undefined { +// // the function type and constructor type shorthand notation +// // are not allowed directly in unions and intersections, but we'll +// // try to parse them gracefully and issue a helpful message. +// if (isStartOfFunctionTypeOrConstructorType()) { +// const type = parseFunctionOrConstructorType(); +// let diagnostic: DiagnosticMessage; +// if (isFunctionTypeNode(type)) { +// diagnostic = isInUnionType +// ? Diagnostics.Function_type_notation_must_be_parenthesized_when_used_in_a_union_type +// : Diagnostics.Function_type_notation_must_be_parenthesized_when_used_in_an_intersection_type; +// } +// else { +// diagnostic = isInUnionType +// ? Diagnostics.Constructor_type_notation_must_be_parenthesized_when_used_in_a_union_type +// : Diagnostics.Constructor_type_notation_must_be_parenthesized_when_used_in_an_intersection_type; +// +// } +// parseErrorAtRange(type, diagnostic); +// return type; +// } +// return undefined; +// } +// +// function parseUnionOrIntersectionType( +// operator: SyntaxKind::BarToken | SyntaxKind::AmpersandToken, +// parseConstituentType: () => TypeNode, +// createTypeNode: (types: NodeArray) => UnionOrIntersectionTypeNode +// ): TypeNode { +// const pos = getNodePos(); +// const isUnionType = operator == SyntaxKind::BarToken; +// const hasLeadingOperator = parseOptional(operator); +// let type = hasLeadingOperator && parseFunctionOrConstructorTypeToError(isUnionType) +// || parseConstituentType(); +// if (token() == operator || hasLeadingOperator) { +// const types = [type]; +// while (parseOptional(operator)) { +// types.push(parseFunctionOrConstructorTypeToError(isUnionType) || parseConstituentType()); +// } +// type = finishNode(createTypeNode(createNodeArray(types, pos)), pos); +// } +// return type; +// } +// +// function parseIntersectionTypeOrHigher(): TypeNode { +// return parseUnionOrIntersectionType(SyntaxKind::AmpersandToken, parseTypeOperatorOrHigher, factory.createIntersectionTypeNode); +// } +// +// function parseUnionTypeOrHigher(): TypeNode { +// return parseUnionOrIntersectionType(SyntaxKind::BarToken, parseIntersectionTypeOrHigher, factory.createUnionTypeNode); +// } +// +// function nextTokenIsNewKeyword(): boolean { +// nextToken(); +// return token() == SyntaxKind::NewKeyword; +// } +// +// function isStartOfFunctionTypeOrConstructorType(): boolean { +// if (token() == SyntaxKind::LessThanToken) { +// return true; +// } +// if (token() == SyntaxKind::OpenParenToken && lookAhead(isUnambiguouslyStartOfFunctionType)) { +// return true; +// } +// return token() == SyntaxKind::NewKeyword || +// token() == SyntaxKind::AbstractKeyword && lookAhead(nextTokenIsNewKeyword); +// } +// +// function skipParameterStart(): boolean { +// if (isModifierKind(token())) { +// // Skip modifiers +// parseModifiers(); +// } +// if (isIdentifier() || token() == SyntaxKind::ThisKeyword) { +// nextToken(); +// return true; +// } +// if (token() == SyntaxKind::OpenBracketToken || token() == SyntaxKind::OpenBraceToken) { +// // Return true if we can parse an array or object binding pattern with no errors +// const previousErrorCount = parseDiagnostics.length; +// parseIdentifierOrPattern(); +// return previousErrorCount == parseDiagnostics.length; +// } +// return false; +// } +// +// function isUnambiguouslyStartOfFunctionType() { +// nextToken(); +// if (token() == SyntaxKind::CloseParenToken || token() == SyntaxKind::DotDotDotToken) { +// // ( ) +// // ( ... +// return true; +// } +// if (skipParameterStart()) { +// // We successfully skipped modifiers (if any) and an identifier or binding pattern, +// // now see if we have something that indicates a parameter declaration +// if (token() == SyntaxKind::ColonToken || token() == SyntaxKind::CommaToken || +// token() == SyntaxKind::QuestionToken || token() == SyntaxKind::EqualsToken) { +// // ( xxx : +// // ( xxx , +// // ( xxx ? +// // ( xxx = +// return true; +// } +// if (token() == SyntaxKind::CloseParenToken) { +// nextToken(); +// if (token() == SyntaxKind::EqualsGreaterThanToken) { +// // ( xxx ) => +// return true; +// } +// } +// } +// return false; +// } +// +// function parseTypeOrTypePredicate(): TypeNode { +// const pos = getNodePos(); +// const typePredicateVariable = isIdentifier() && tryParse(parseTypePredicatePrefix); +// const type = parseType(); +// if (typePredicateVariable) { +// return finishNode(factory.createTypePredicateNode(/*assertsModifier*/ undefined, typePredicateVariable, type), pos); +// } +// else { +// return type; +// } +// } +// +// function parseTypePredicatePrefix() { +// const id = parseIdentifier(); +// if (token() == SyntaxKind::IsKeyword && !scanner.hasPrecedingLineBreak()) { +// nextToken(); +// return id; +// } +// } +// +// function parseAssertsTypePredicate(): TypeNode { +// const pos = getNodePos(); +// const assertsModifier = parseExpectedToken(SyntaxKind::AssertsKeyword); +// const parameterName = token() == SyntaxKind::ThisKeyword ? parseThisTypeNode() : parseIdentifier(); +// const type = parseOptional(SyntaxKind::IsKeyword) ? parseType() : undefined; +// return finishNode(factory.createTypePredicateNode(assertsModifier, parameterName, type), pos); +// } +// +// function parseType(): TypeNode { +// if (contextFlags & NodeFlags::TypeExcludesFlags) { +// return doOutsideOfContext(NodeFlags::TypeExcludesFlags, parseType); +// } +// +// if (isStartOfFunctionTypeOrConstructorType()) { +// return parseFunctionOrConstructorType(); +// } +// const pos = getNodePos(); +// const type = parseUnionTypeOrHigher(); +// if (!inDisallowConditionalTypesContext() && !scanner.hasPrecedingLineBreak() && parseOptional(SyntaxKind::ExtendsKeyword)) { +// // The type following 'extends' is not permitted to be another conditional type +// const extendsType = disallowConditionalTypesAnd(parseType); +// parseExpected(SyntaxKind::QuestionToken); +// const trueType = allowConditionalTypesAnd(parseType); +// parseExpected(SyntaxKind::ColonToken); +// const falseType = allowConditionalTypesAnd(parseType); +// return finishNode(factory.createConditionalTypeNode(type, extendsType, trueType, falseType), pos); +// } +// return type; +// } +// +// function parseTypeAnnotation(): TypeNode | undefined { +// return parseOptional(SyntaxKind::ColonToken) ? parseType() : undefined; +// } +// +// // EXPRESSIONS +// function isStartOfLeftHandSideExpression(): boolean { +// switch (token()) { +// case SyntaxKind::ThisKeyword: +// case SyntaxKind::SuperKeyword: +// case SyntaxKind::NullKeyword: +// case SyntaxKind::TrueKeyword: +// case SyntaxKind::FalseKeyword: +// case SyntaxKind::NumericLiteral: +// case SyntaxKind::BigIntLiteral: +// case SyntaxKind::StringLiteral: +// case SyntaxKind::NoSubstitutionTemplateLiteral: +// case SyntaxKind::TemplateHead: +// case SyntaxKind::OpenParenToken: +// case SyntaxKind::OpenBracketToken: +// case SyntaxKind::OpenBraceToken: +// case SyntaxKind::FunctionKeyword: +// case SyntaxKind::ClassKeyword: +// case SyntaxKind::NewKeyword: +// case SyntaxKind::SlashToken: +// case SyntaxKind::SlashEqualsToken: +// case SyntaxKind::Identifier: +// return true; +// case SyntaxKind::ImportKeyword: +// return lookAhead(nextTokenIsOpenParenOrLessThanOrDot); +// default: +// return isIdentifier(); +// } +// } +// +// function isStartOfExpression(): boolean { +// if (isStartOfLeftHandSideExpression()) { +// return true; +// } +// +// switch (token()) { +// case SyntaxKind::PlusToken: +// case SyntaxKind::MinusToken: +// case SyntaxKind::TildeToken: +// case SyntaxKind::ExclamationToken: +// case SyntaxKind::DeleteKeyword: +// case SyntaxKind::TypeOfKeyword: +// case SyntaxKind::VoidKeyword: +// case SyntaxKind::PlusPlusToken: +// case SyntaxKind::MinusMinusToken: +// case SyntaxKind::LessThanToken: +// case SyntaxKind::AwaitKeyword: +// case SyntaxKind::YieldKeyword: +// case SyntaxKind::PrivateIdentifier: +// // Yield/await always starts an expression. Either it is an identifier (in which case +// // it is definitely an expression). Or it's a keyword (either because we're in +// // a generator or async function, or in strict mode (or both)) and it started a yield or await expression. +// return true; +// default: +// // Error tolerance. If we see the start of some binary operator, we consider +// // that the start of an expression. That way we'll parse out a missing identifier, +// // give a good message about an identifier being missing, and then consume the +// // rest of the binary expression. +// if (isBinaryOperator()) { +// return true; +// } +// +// return isIdentifier(); +// } +// } +// +// function isStartOfExpressionStatement(): boolean { +// // As per the grammar, none of '{' or 'function' or 'class' can start an expression statement. +// return token() !== SyntaxKind::OpenBraceToken && +// token() !== SyntaxKind::FunctionKeyword && +// token() !== SyntaxKind::ClassKeyword && +// token() !== SyntaxKind::AtToken && +// isStartOfExpression(); +// } +// +// function parseExpression(): Expression { +// // Expression[in]: +// // AssignmentExpression[in] +// // Expression[in] , AssignmentExpression[in] +// +// // clear the decorator context when parsing Expression, as it should be unambiguous when parsing a decorator +// const saveDecoratorContext = inDecoratorContext(); +// if (saveDecoratorContext) { +// setDecoratorContext(/*val*/ false); +// } +// +// const pos = getNodePos(); +// let expr = parseAssignmentExpressionOrHigher(); +// let operatorToken: BinaryOperatorToken; +// while ((operatorToken = parseOptionalToken(SyntaxKind::CommaToken))) { +// expr = makeBinaryExpression(expr, operatorToken, parseAssignmentExpressionOrHigher(), pos); +// } +// +// if (saveDecoratorContext) { +// setDecoratorContext(/*val*/ true); +// } +// return expr; +// } +// +// function parseInitializer(): Expression | undefined { +// return parseOptional(SyntaxKind::EqualsToken) ? parseAssignmentExpressionOrHigher() : undefined; +// } +// +// function parseAssignmentExpressionOrHigher(): Expression { +// // AssignmentExpression[in,yield]: +// // 1) ConditionalExpression[?in,?yield] +// // 2) LeftHandSideExpression = AssignmentExpression[?in,?yield] +// // 3) LeftHandSideExpression AssignmentOperator AssignmentExpression[?in,?yield] +// // 4) ArrowFunctionExpression[?in,?yield] +// // 5) AsyncArrowFunctionExpression[in,yield,await] +// // 6) [+Yield] YieldExpression[?In] +// // +// // Note: for ease of implementation we treat productions '2' and '3' as the same thing. +// // (i.e. they're both BinaryExpressions with an assignment operator in it). +// +// // First, do the simple check if we have a YieldExpression (production '6'). +// if (isYieldExpression()) { +// return parseYieldExpression(); +// } +// +// // Then, check if we have an arrow function (production '4' and '5') that starts with a parenthesized +// // parameter list or is an async arrow function. +// // AsyncArrowFunctionExpression: +// // 1) async[no LineTerminator here]AsyncArrowBindingIdentifier[?Yield][no LineTerminator here]=>AsyncConciseBody[?In] +// // 2) CoverCallExpressionAndAsyncArrowHead[?Yield, ?Await][no LineTerminator here]=>AsyncConciseBody[?In] +// // Production (1) of AsyncArrowFunctionExpression is parsed in "tryParseAsyncSimpleArrowFunctionExpression". +// // And production (2) is parsed in "tryParseParenthesizedArrowFunctionExpression". +// // +// // If we do successfully parse arrow-function, we must *not* recurse for productions 1, 2 or 3. An ArrowFunction is +// // not a LeftHandSideExpression, nor does it start a ConditionalExpression. So we are done +// // with AssignmentExpression if we see one. +// const arrowExpression = tryParseParenthesizedArrowFunctionExpression() || tryParseAsyncSimpleArrowFunctionExpression(); +// if (arrowExpression) { +// return arrowExpression; +// } +// +// // Now try to see if we're in production '1', '2' or '3'. A conditional expression can +// // start with a LogicalOrExpression, while the assignment productions can only start with +// // LeftHandSideExpressions. +// // +// // So, first, we try to just parse out a BinaryExpression. If we get something that is a +// // LeftHandSide or higher, then we can try to parse out the assignment expression part. +// // Otherwise, we try to parse out the conditional expression bit. We want to allow any +// // binary expression here, so we pass in the 'lowest' precedence here so that it matches +// // and consumes anything. +// const pos = getNodePos(); +// const expr = parseBinaryExpressionOrHigher(OperatorPrecedence.Lowest); +// +// // To avoid a look-ahead, we did not handle the case of an arrow function with a single un-parenthesized +// // parameter ('x => ...') above. We handle it here by checking if the parsed expression was a single +// // identifier and the current token is an arrow. +// if (expr.kind == SyntaxKind::Identifier && token() == SyntaxKind::EqualsGreaterThanToken) { +// return parseSimpleArrowFunctionExpression(pos, expr as Identifier, /*asyncModifier*/ undefined); +// } +// +// // Now see if we might be in cases '2' or '3'. +// // If the expression was a LHS expression, and we have an assignment operator, then +// // we're in '2' or '3'. Consume the assignment and return. +// // +// // Note: we call reScanGreaterToken so that we get an appropriately merged token +// // for cases like `> > =` becoming `>>=` +// if (isLeftHandSideExpression(expr) && isAssignmentOperator(reScanGreaterToken())) { +// return makeBinaryExpression(expr, parseTokenNode(), parseAssignmentExpressionOrHigher(), pos); +// } +// +// // It wasn't an assignment or a lambda. This is a conditional expression: +// return parseConditionalExpressionRest(expr, pos); +// } +// +// function isYieldExpression(): boolean { +// if (token() == SyntaxKind::YieldKeyword) { +// // If we have a 'yield' keyword, and this is a context where yield expressions are +// // allowed, then definitely parse out a yield expression. +// if (inYieldContext()) { +// return true; +// } +// +// // We're in a context where 'yield expr' is not allowed. However, if we can +// // definitely tell that the user was trying to parse a 'yield expr' and not +// // just a normal expr that start with a 'yield' identifier, then parse out +// // a 'yield expr'. We can then report an error later that they are only +// // allowed in generator expressions. +// // +// // for example, if we see 'yield(foo)', then we'll have to treat that as an +// // invocation expression of something called 'yield'. However, if we have +// // 'yield foo' then that is not legal as a normal expression, so we can +// // definitely recognize this as a yield expression. +// // +// // for now we just check if the next token is an identifier. More heuristics +// // can be added here later as necessary. We just need to make sure that we +// // don't accidentally consume something legal. +// return lookAhead(nextTokenIsIdentifierOrKeywordOrLiteralOnSameLine); +// } +// +// return false; +// } +// +// function nextTokenIsIdentifierOnSameLine() { +// nextToken(); +// return !scanner.hasPrecedingLineBreak() && isIdentifier(); +// } +// +// function parseYieldExpression(): YieldExpression { +// const pos = getNodePos(); +// +// // YieldExpression[In] : +// // yield +// // yield [no LineTerminator here] [Lexical goal InputElementRegExp]AssignmentExpression[?In, Yield] +// // yield [no LineTerminator here] * [Lexical goal InputElementRegExp]AssignmentExpression[?In, Yield] +// nextToken(); +// +// if (!scanner.hasPrecedingLineBreak() && +// (token() == SyntaxKind::AsteriskToken || isStartOfExpression())) { +// return finishNode( +// factory.createYieldExpression( +// parseOptionalToken(SyntaxKind::AsteriskToken), +// parseAssignmentExpressionOrHigher() +// ), +// pos +// ); +// } +// else { +// // if the next token is not on the same line as yield. or we don't have an '*' or +// // the start of an expression, then this is just a simple "yield" expression. +// return finishNode(factory.createYieldExpression(/*asteriskToken*/ undefined, /*expression*/ undefined), pos); +// } +// } +// +// function parseSimpleArrowFunctionExpression(pos: number, identifier: Identifier, asyncModifier?: NodeArray | undefined): ArrowFunction { +// Debug.assert(token() == SyntaxKind::EqualsGreaterThanToken, "parseSimpleArrowFunctionExpression should only have been called if we had a =>"); +// const parameter = factory.createParameterDeclaration( +// /*decorators*/ undefined, +// /*modifiers*/ undefined, +// /*dotDotDotToken*/ undefined, +// identifier, +// /*questionToken*/ undefined, +// /*type*/ undefined, +// /*initializer*/ undefined +// ); +// finishNode(parameter, identifier.pos); +// +// const parameters = createNodeArray([parameter], parameter.pos, parameter.end); +// const equalsGreaterThanToken = parseExpectedToken(SyntaxKind::EqualsGreaterThanToken); +// const body = parseArrowFunctionExpressionBody(/*isAsync*/ !!asyncModifier); +// const node = factory.createArrowFunction(asyncModifier, /*typeParameters*/ undefined, parameters, /*type*/ undefined, equalsGreaterThanToken, body); +// return addJSDocComment(finishNode(node, pos)); +// } +// +// function tryParseParenthesizedArrowFunctionExpression(): Expression | undefined { +// const triState = isParenthesizedArrowFunctionExpression(); +// if (triState == Tristate.False) { +// // It's definitely not a parenthesized arrow function expression. +// return undefined; +// } +// +// // If we definitely have an arrow function, then we can just parse one, not requiring a +// // following => or { token. Otherwise, we *might* have an arrow function. Try to parse +// // it out, but don't allow any ambiguity, and return 'undefined' if this could be an +// // expression instead. +// return triState == Tristate.True ? +// parseParenthesizedArrowFunctionExpression(/*allowAmbiguity*/ true) : +// tryParse(parsePossibleParenthesizedArrowFunctionExpression); +// } +// +// // True -> We definitely expect a parenthesized arrow function here. +// // False -> There *cannot* be a parenthesized arrow function here. +// // Unknown -> There *might* be a parenthesized arrow function here. +// // Speculatively look ahead to be sure, and rollback if not. +// function isParenthesizedArrowFunctionExpression(): Tristate { +// if (token() == SyntaxKind::OpenParenToken || token() == SyntaxKind::LessThanToken || token() == SyntaxKind::AsyncKeyword) { +// return lookAhead(isParenthesizedArrowFunctionExpressionWorker); +// } +// +// if (token() == SyntaxKind::EqualsGreaterThanToken) { +// // ERROR RECOVERY TWEAK: +// // If we see a standalone => try to parse it as an arrow function expression as that's +// // likely what the user intended to write. +// return Tristate.True; +// } +// // Definitely not a parenthesized arrow function. +// return Tristate.False; +// } +// +// function isParenthesizedArrowFunctionExpressionWorker() { +// if (token() == SyntaxKind::AsyncKeyword) { +// nextToken(); +// if (scanner.hasPrecedingLineBreak()) { +// return Tristate.False; +// } +// if (token() !== SyntaxKind::OpenParenToken && token() !== SyntaxKind::LessThanToken) { +// return Tristate.False; +// } +// } +// +// const first = token(); +// const second = nextToken(); +// +// if (first == SyntaxKind::OpenParenToken) { +// if (second == SyntaxKind::CloseParenToken) { +// // Simple cases: "() =>", "(): ", and "() {". +// // This is an arrow function with no parameters. +// // The last one is not actually an arrow function, +// // but this is probably what the user intended. +// const third = nextToken(); +// switch (third) { +// case SyntaxKind::EqualsGreaterThanToken: +// case SyntaxKind::ColonToken: +// case SyntaxKind::OpenBraceToken: +// return Tristate.True; +// default: +// return Tristate.False; +// } +// } +// +// // If encounter "([" or "({", this could be the start of a binding pattern. +// // Examples: +// // ([ x ]) => { } +// // ({ x }) => { } +// // ([ x ]) +// // ({ x }) +// if (second == SyntaxKind::OpenBracketToken || second == SyntaxKind::OpenBraceToken) { +// return Tristate.Unknown; +// } +// +// // Simple case: "(..." +// // This is an arrow function with a rest parameter. +// if (second == SyntaxKind::DotDotDotToken) { +// return Tristate.True; +// } +// +// // Check for "(xxx yyy", where xxx is a modifier and yyy is an identifier. This +// // isn't actually allowed, but we want to treat it as a lambda so we can provide +// // a good error message. +// if (isModifierKind(second) && second !== SyntaxKind::AsyncKeyword && lookAhead(nextTokenIsIdentifier)) { +// if (nextToken() == SyntaxKind::AsKeyword) { +// // https://github.com/microsoft/TypeScript/issues/44466 +// return Tristate.False; +// } +// return Tristate.True; +// } +// +// // If we had "(" followed by something that's not an identifier, +// // then this definitely doesn't look like a lambda. "this" is not +// // valid, but we want to parse it and then give a semantic error. +// if (!isIdentifier() && second !== SyntaxKind::ThisKeyword) { +// return Tristate.False; +// } +// +// switch (nextToken()) { +// case SyntaxKind::ColonToken: +// // If we have something like "(a:", then we must have a +// // type-annotated parameter in an arrow function expression. +// return Tristate.True; +// case SyntaxKind::QuestionToken: +// nextToken(); +// // If we have "(a?:" or "(a?," or "(a?=" or "(a?)" then it is definitely a lambda. +// if (token() == SyntaxKind::ColonToken || token() == SyntaxKind::CommaToken || token() == SyntaxKind::EqualsToken || token() == SyntaxKind::CloseParenToken) { +// return Tristate.True; +// } +// // Otherwise it is definitely not a lambda. +// return Tristate.False; +// case SyntaxKind::CommaToken: +// case SyntaxKind::EqualsToken: +// case SyntaxKind::CloseParenToken: +// // If we have "(a," or "(a=" or "(a)" this *could* be an arrow function +// return Tristate.Unknown; +// } +// // It is definitely not an arrow function +// return Tristate.False; +// } +// else { +// Debug.assert(first == SyntaxKind::LessThanToken); +// +// // If we have "<" not followed by an identifier, +// // then this definitely is not an arrow function. +// if (!isIdentifier()) { +// return Tristate.False; +// } +// +// // JSX overrides +// if (languageVariant == LanguageVariant.JSX) { +// const isArrowFunctionInJsx = lookAhead(() => { +// const third = nextToken(); +// if (third == SyntaxKind::ExtendsKeyword) { +// const fourth = nextToken(); +// switch (fourth) { +// case SyntaxKind::EqualsToken: +// case SyntaxKind::GreaterThanToken: +// return false; +// default: +// return true; +// } +// } +// else if (third == SyntaxKind::CommaToken || third == SyntaxKind::EqualsToken) { +// return true; +// } +// return false; +// }); +// +// if (isArrowFunctionInJsx) { +// return Tristate.True; +// } +// +// return Tristate.False; +// } +// +// // This *could* be a parenthesized arrow function. +// return Tristate.Unknown; +// } +// } +// +// function parsePossibleParenthesizedArrowFunctionExpression(): ArrowFunction | undefined { +// const tokenPos = scanner.getTokenPos(); +// if (notParenthesizedArrow?.has(tokenPos)) { +// return undefined; +// } +// +// const result = parseParenthesizedArrowFunctionExpression(/*allowAmbiguity*/ false); +// if (!result) { +// (notParenthesizedArrow || (notParenthesizedArrow = new Set())).add(tokenPos); +// } +// +// return result; +// } +// +// function tryParseAsyncSimpleArrowFunctionExpression(): ArrowFunction | undefined { +// // We do a check here so that we won't be doing unnecessarily call to "lookAhead" +// if (token() == SyntaxKind::AsyncKeyword) { +// if (lookAhead(isUnParenthesizedAsyncArrowFunctionWorker) == Tristate.True) { +// const pos = getNodePos(); +// const asyncModifier = parseModifiersForArrowFunction(); +// const expr = parseBinaryExpressionOrHigher(OperatorPrecedence.Lowest); +// return parseSimpleArrowFunctionExpression(pos, expr as Identifier, asyncModifier); +// } +// } +// return undefined; +// } +// +// function isUnParenthesizedAsyncArrowFunctionWorker(): Tristate { +// // AsyncArrowFunctionExpression: +// // 1) async[no LineTerminator here]AsyncArrowBindingIdentifier[?Yield][no LineTerminator here]=>AsyncConciseBody[?In] +// // 2) CoverCallExpressionAndAsyncArrowHead[?Yield, ?Await][no LineTerminator here]=>AsyncConciseBody[?In] +// if (token() == SyntaxKind::AsyncKeyword) { +// nextToken(); +// // If the "async" is followed by "=>" token then it is not a beginning of an async arrow-function +// // but instead a simple arrow-function which will be parsed inside "parseAssignmentExpressionOrHigher" +// if (scanner.hasPrecedingLineBreak() || token() == SyntaxKind::EqualsGreaterThanToken) { +// return Tristate.False; +// } +// // Check for un-parenthesized AsyncArrowFunction +// const expr = parseBinaryExpressionOrHigher(OperatorPrecedence.Lowest); +// if (!scanner.hasPrecedingLineBreak() && expr.kind == SyntaxKind::Identifier && token() == SyntaxKind::EqualsGreaterThanToken) { +// return Tristate.True; +// } +// } +// +// return Tristate.False; +// } +// +// function parseParenthesizedArrowFunctionExpression(allowAmbiguity: boolean): ArrowFunction | undefined { +// const pos = getNodePos(); +// const hasJSDoc = hasPrecedingJSDocComment(); +// const modifiers = parseModifiersForArrowFunction(); +// const isAsync = some(modifiers, isAsyncModifier) ? SignatureFlags.Await : SignatureFlags.None; +// // Arrow functions are never generators. +// // +// // If we're speculatively parsing a signature for a parenthesized arrow function, then +// // we have to have a complete parameter list. Otherwise we might see something like +// // a => (b => c) +// // And think that "(b =>" was actually a parenthesized arrow function with a missing +// // close paren. +// const typeParameters = parseTypeParameters(); +// +// let parameters: NodeArray; +// if (!parseExpected(SyntaxKind::OpenParenToken)) { +// if (!allowAmbiguity) { +// return undefined; +// } +// parameters = createMissingList(); +// } +// else { +// if (!allowAmbiguity) { +// const maybeParameters = parseParametersWorker(isAsync, allowAmbiguity); +// if (!maybeParameters) { +// return undefined; +// } +// parameters = maybeParameters; +// } +// else { +// parameters = parseParametersWorker(isAsync, allowAmbiguity); +// } +// if (!parseExpected(SyntaxKind::CloseParenToken) && !allowAmbiguity) { +// return undefined; +// } +// } +// +// const type = parseReturnType(SyntaxKind::ColonToken, /*isType*/ false); +// if (type && !allowAmbiguity && typeHasArrowFunctionBlockingParseError(type)) { +// return undefined; +// } +// +// // Parsing a signature isn't enough. +// // Parenthesized arrow signatures often look like other valid expressions. +// // For instance: +// // - "(x = 10)" is an assignment expression parsed as a signature with a default parameter value. +// // - "(x,y)" is a comma expression parsed as a signature with two parameters. +// // - "a ? (b): c" will have "(b):" parsed as a signature with a return type annotation. +// // - "a ? (b): function() {}" will too, since function() is a valid JSDoc function type. +// // - "a ? (b): (function() {})" as well, but inside of a parenthesized type with an arbitrary amount of nesting. +// // +// // So we need just a bit of lookahead to ensure that it can only be a signature. +// +// let unwrappedType = type; +// while (unwrappedType?.kind == SyntaxKind::ParenthesizedType) { +// unwrappedType = (unwrappedType as ParenthesizedTypeNode).type; // Skip parens if need be +// } +// +// const hasJSDocFunctionType = unwrappedType && isJSDocFunctionType(unwrappedType); +// if (!allowAmbiguity && token() !== SyntaxKind::EqualsGreaterThanToken && (hasJSDocFunctionType || token() !== SyntaxKind::OpenBraceToken)) { +// // Returning undefined here will cause our caller to rewind to where we started from. +// return undefined; +// } +// +// // If we have an arrow, then try to parse the body. Even if not, try to parse if we +// // have an opening brace, just in case we're in an error state. +// const lastToken = token(); +// const equalsGreaterThanToken = parseExpectedToken(SyntaxKind::EqualsGreaterThanToken); +// const body = (lastToken == SyntaxKind::EqualsGreaterThanToken || lastToken == SyntaxKind::OpenBraceToken) +// ? parseArrowFunctionExpressionBody(some(modifiers, isAsyncModifier)) +// : parseIdentifier(); +// +// const node = factory.createArrowFunction(modifiers, typeParameters, parameters, type, equalsGreaterThanToken, body); +// return withJSDoc(finishNode(node, pos), hasJSDoc); +// } +// +// function parseArrowFunctionExpressionBody(isAsync: boolean): Block | Expression { +// if (token() == SyntaxKind::OpenBraceToken) { +// return parseFunctionBlock(isAsync ? SignatureFlags.Await : SignatureFlags.None); +// } +// +// if (token() !== SyntaxKind::SemicolonToken && +// token() !== SyntaxKind::FunctionKeyword && +// token() !== SyntaxKind::ClassKeyword && +// isStartOfStatement() && +// !isStartOfExpressionStatement()) { +// // Check if we got a plain statement (i.e. no expression-statements, no function/class expressions/declarations) +// // +// // Here we try to recover from a potential error situation in the case where the +// // user meant to supply a block. For example, if the user wrote: +// // +// // a => +// // let v = 0; +// // } +// // +// // they may be missing an open brace. Check to see if that's the case so we can +// // try to recover better. If we don't do this, then the next close curly we see may end +// // up preemptively closing the containing construct. +// // +// // Note: even when 'IgnoreMissingOpenBrace' is passed, parseBody will still error. +// return parseFunctionBlock(SignatureFlags.IgnoreMissingOpenBrace | (isAsync ? SignatureFlags.Await : SignatureFlags.None)); +// } +// +// const savedTopLevel = topLevel; +// topLevel = false; +// const node = isAsync +// ? doInAwaitContext(parseAssignmentExpressionOrHigher) +// : doOutsideOfAwaitContext(parseAssignmentExpressionOrHigher); +// topLevel = savedTopLevel; +// return node; +// } +// +// function parseConditionalExpressionRest(leftOperand: Expression, pos: number): Expression { +// // Note: we are passed in an expression which was produced from parseBinaryExpressionOrHigher. +// const questionToken = parseOptionalToken(SyntaxKind::QuestionToken); +// if (!questionToken) { +// return leftOperand; +// } +// +// // Note: we explicitly 'allowIn' in the whenTrue part of the condition expression, and +// // we do not that for the 'whenFalse' part. +// let colonToken; +// return finishNode( +// factory.createConditionalExpression( +// leftOperand, +// questionToken, +// doOutsideOfContext(disallowInAndDecoratorContext, parseAssignmentExpressionOrHigher), +// colonToken = parseExpectedToken(SyntaxKind::ColonToken), +// nodeIsPresent(colonToken) +// ? parseAssignmentExpressionOrHigher() +// : createMissingNode(SyntaxKind::Identifier, /*reportAtCurrentPosition*/ false, Diagnostics._0_expected, tokenToString(SyntaxKind::ColonToken)) +// ), +// pos +// ); +// } +// +// function parseBinaryExpressionOrHigher(precedence: OperatorPrecedence): Expression { +// const pos = getNodePos(); +// const leftOperand = parseUnaryExpressionOrHigher(); +// return parseBinaryExpressionRest(precedence, leftOperand, pos); +// } +// +// function isInOrOfKeyword(t: SyntaxKind) { +// return t == SyntaxKind::InKeyword || t == SyntaxKind::OfKeyword; +// } +// +// function parseBinaryExpressionRest(precedence: OperatorPrecedence, leftOperand: Expression, pos: number): Expression { +// while (true) { +// // We either have a binary operator here, or we're finished. We call +// // reScanGreaterToken so that we merge token sequences like > and = into >= +// +// reScanGreaterToken(); +// const newPrecedence = getBinaryOperatorPrecedence(token()); +// +// // Check the precedence to see if we should "take" this operator +// // - For left associative operator (all operator but **), consume the operator, +// // recursively call the function below, and parse binaryExpression as a rightOperand +// // of the caller if the new precedence of the operator is greater then or equal to the current precedence. +// // For example: +// // a - b - c; +// // ^token; leftOperand = b. Return b to the caller as a rightOperand +// // a * b - c +// // ^token; leftOperand = b. Return b to the caller as a rightOperand +// // a - b * c; +// // ^token; leftOperand = b. Return b * c to the caller as a rightOperand +// // - For right associative operator (**), consume the operator, recursively call the function +// // and parse binaryExpression as a rightOperand of the caller if the new precedence of +// // the operator is strictly grater than the current precedence +// // For example: +// // a ** b ** c; +// // ^^token; leftOperand = b. Return b ** c to the caller as a rightOperand +// // a - b ** c; +// // ^^token; leftOperand = b. Return b ** c to the caller as a rightOperand +// // a ** b - c +// // ^token; leftOperand = b. Return b to the caller as a rightOperand +// const consumeCurrentOperator = token() == SyntaxKind::AsteriskAsteriskToken ? +// newPrecedence >= precedence : +// newPrecedence > precedence; +// +// if (!consumeCurrentOperator) { +// break; +// } +// +// if (token() == SyntaxKind::InKeyword && inDisallowInContext()) { +// break; +// } +// +// if (token() == SyntaxKind::AsKeyword) { +// // Make sure we *do* perform ASI for constructs like this: +// // var x = foo +// // as (Bar) +// // This should be parsed as an initialized variable, followed +// // by a function call to 'as' with the argument 'Bar' +// if (scanner.hasPrecedingLineBreak()) { +// break; +// } +// else { +// nextToken(); +// leftOperand = makeAsExpression(leftOperand, parseType()); +// } +// } +// else { +// leftOperand = makeBinaryExpression(leftOperand, parseTokenNode(), parseBinaryExpressionOrHigher(newPrecedence), pos); +// } +// } +// +// return leftOperand; +// } +// +// function isBinaryOperator() { +// if (inDisallowInContext() && token() == SyntaxKind::InKeyword) { +// return false; +// } +// +// return getBinaryOperatorPrecedence(token()) > 0; +// } +// +// function makeBinaryExpression(left: Expression, operatorToken: BinaryOperatorToken, right: Expression, pos: number): BinaryExpression { +// return finishNode(factory.createBinaryExpression(left, operatorToken, right), pos); +// } +// +// function makeAsExpression(left: Expression, right: TypeNode): AsExpression { +// return finishNode(factory.createAsExpression(left, right), left.pos); +// } +// +// function parsePrefixUnaryExpression() { +// const pos = getNodePos(); +// return finishNode(factory.createPrefixUnaryExpression(token() as PrefixUnaryOperator, nextTokenAnd(parseSimpleUnaryExpression)), pos); +// } +// +// function parseDeleteExpression() { +// const pos = getNodePos(); +// return finishNode(factory.createDeleteExpression(nextTokenAnd(parseSimpleUnaryExpression)), pos); +// } +// +// function parseTypeOfExpression() { +// const pos = getNodePos(); +// return finishNode(factory.createTypeOfExpression(nextTokenAnd(parseSimpleUnaryExpression)), pos); +// } +// +// function parseVoidExpression() { +// const pos = getNodePos(); +// return finishNode(factory.createVoidExpression(nextTokenAnd(parseSimpleUnaryExpression)), pos); +// } +// +// function isAwaitExpression(): boolean { +// if (token() == SyntaxKind::AwaitKeyword) { +// if (inAwaitContext()) { +// return true; +// } +// +// // here we are using similar heuristics as 'isYieldExpression' +// return lookAhead(nextTokenIsIdentifierOrKeywordOrLiteralOnSameLine); +// } +// +// return false; +// } +// +// function parseAwaitExpression() { +// const pos = getNodePos(); +// return finishNode(factory.createAwaitExpression(nextTokenAnd(parseSimpleUnaryExpression)), pos); +// } +// +// /** +// * Parse ES7 exponential expression and await expression +// * +// * ES7 ExponentiationExpression: +// * 1) UnaryExpression[?Yield] +// * 2) UpdateExpression[?Yield] ** ExponentiationExpression[?Yield] +// * +// */ +// function parseUnaryExpressionOrHigher(): UnaryExpression | BinaryExpression { +// /** +// * ES7 UpdateExpression: +// * 1) LeftHandSideExpression[?Yield] +// * 2) LeftHandSideExpression[?Yield][no LineTerminator here]++ +// * 3) LeftHandSideExpression[?Yield][no LineTerminator here]-- +// * 4) ++UnaryExpression[?Yield] +// * 5) --UnaryExpression[?Yield] +// */ +// if (isUpdateExpression()) { +// const pos = getNodePos(); +// const updateExpression = parseUpdateExpression(); +// return token() == SyntaxKind::AsteriskAsteriskToken ? +// parseBinaryExpressionRest(getBinaryOperatorPrecedence(token()), updateExpression, pos) as BinaryExpression : +// updateExpression; +// } +// +// /** +// * ES7 UnaryExpression: +// * 1) UpdateExpression[?yield] +// * 2) delete UpdateExpression[?yield] +// * 3) void UpdateExpression[?yield] +// * 4) typeof UpdateExpression[?yield] +// * 5) + UpdateExpression[?yield] +// * 6) - UpdateExpression[?yield] +// * 7) ~ UpdateExpression[?yield] +// * 8) ! UpdateExpression[?yield] +// */ +// const unaryOperator = token(); +// const simpleUnaryExpression = parseSimpleUnaryExpression(); +// if (token() == SyntaxKind::AsteriskAsteriskToken) { +// const pos = skipTrivia(sourceText, simpleUnaryExpression.pos); +// const { end } = simpleUnaryExpression; +// if (simpleUnaryExpression.kind == SyntaxKind::TypeAssertionExpression) { +// parseErrorAt(pos, end, Diagnostics.A_type_assertion_expression_is_not_allowed_in_the_left_hand_side_of_an_exponentiation_expression_Consider_enclosing_the_expression_in_parentheses); +// } +// else { +// parseErrorAt(pos, end, Diagnostics.An_unary_expression_with_the_0_operator_is_not_allowed_in_the_left_hand_side_of_an_exponentiation_expression_Consider_enclosing_the_expression_in_parentheses, tokenToString(unaryOperator)); +// } +// } +// return simpleUnaryExpression; +// } +// +// /** +// * Parse ES7 simple-unary expression or higher: +// * +// * ES7 UnaryExpression: +// * 1) UpdateExpression[?yield] +// * 2) delete UnaryExpression[?yield] +// * 3) void UnaryExpression[?yield] +// * 4) typeof UnaryExpression[?yield] +// * 5) + UnaryExpression[?yield] +// * 6) - UnaryExpression[?yield] +// * 7) ~ UnaryExpression[?yield] +// * 8) ! UnaryExpression[?yield] +// * 9) [+Await] await UnaryExpression[?yield] +// */ +// function parseSimpleUnaryExpression(): UnaryExpression { +// switch (token()) { +// case SyntaxKind::PlusToken: +// case SyntaxKind::MinusToken: +// case SyntaxKind::TildeToken: +// case SyntaxKind::ExclamationToken: +// return parsePrefixUnaryExpression(); +// case SyntaxKind::DeleteKeyword: +// return parseDeleteExpression(); +// case SyntaxKind::TypeOfKeyword: +// return parseTypeOfExpression(); +// case SyntaxKind::VoidKeyword: +// return parseVoidExpression(); +// case SyntaxKind::LessThanToken: +// // This is modified UnaryExpression grammar in TypeScript +// // UnaryExpression (modified): +// // < type > UnaryExpression +// return parseTypeAssertion(); +// case SyntaxKind::AwaitKeyword: +// if (isAwaitExpression()) { +// return parseAwaitExpression(); +// } +// // falls through +// default: +// return parseUpdateExpression(); +// } +// } +// +// /** +// * Check if the current token can possibly be an ES7 increment expression. +// * +// * ES7 UpdateExpression: +// * LeftHandSideExpression[?Yield] +// * LeftHandSideExpression[?Yield][no LineTerminator here]++ +// * LeftHandSideExpression[?Yield][no LineTerminator here]-- +// * ++LeftHandSideExpression[?Yield] +// * --LeftHandSideExpression[?Yield] +// */ +// function isUpdateExpression(): boolean { +// // This function is called inside parseUnaryExpression to decide +// // whether to call parseSimpleUnaryExpression or call parseUpdateExpression directly +// switch (token()) { +// case SyntaxKind::PlusToken: +// case SyntaxKind::MinusToken: +// case SyntaxKind::TildeToken: +// case SyntaxKind::ExclamationToken: +// case SyntaxKind::DeleteKeyword: +// case SyntaxKind::TypeOfKeyword: +// case SyntaxKind::VoidKeyword: +// case SyntaxKind::AwaitKeyword: +// return false; +// case SyntaxKind::LessThanToken: +// // If we are not in JSX context, we are parsing TypeAssertion which is an UnaryExpression +// if (languageVariant !== LanguageVariant.JSX) { +// return false; +// } +// // We are in JSX context and the token is part of JSXElement. +// // falls through +// default: +// return true; +// } +// } +// +// /** +// * Parse ES7 UpdateExpression. UpdateExpression is used instead of ES6's PostFixExpression. +// * +// * ES7 UpdateExpression[yield]: +// * 1) LeftHandSideExpression[?yield] +// * 2) LeftHandSideExpression[?yield] [[no LineTerminator here]]++ +// * 3) LeftHandSideExpression[?yield] [[no LineTerminator here]]-- +// * 4) ++LeftHandSideExpression[?yield] +// * 5) --LeftHandSideExpression[?yield] +// * In TypeScript (2), (3) are parsed as PostfixUnaryExpression. (4), (5) are parsed as PrefixUnaryExpression +// */ +// function parseUpdateExpression(): UpdateExpression { +// if (token() == SyntaxKind::PlusPlusToken || token() == SyntaxKind::MinusMinusToken) { +// const pos = getNodePos(); +// return finishNode(factory.createPrefixUnaryExpression(token() as PrefixUnaryOperator, nextTokenAnd(parseLeftHandSideExpressionOrHigher)), pos); +// } +// else if (languageVariant == LanguageVariant.JSX && token() == SyntaxKind::LessThanToken && lookAhead(nextTokenIsIdentifierOrKeywordOrGreaterThan)) { +// // JSXElement is part of primaryExpression +// return parseJsxElementOrSelfClosingElementOrFragment(/*inExpressionContext*/ true); +// } +// +// const expression = parseLeftHandSideExpressionOrHigher(); +// +// Debug.assert(isLeftHandSideExpression(expression)); +// if ((token() == SyntaxKind::PlusPlusToken || token() == SyntaxKind::MinusMinusToken) && !scanner.hasPrecedingLineBreak()) { +// const operator = token() as PostfixUnaryOperator; +// nextToken(); +// return finishNode(factory.createPostfixUnaryExpression(expression, operator), expression.pos); +// } +// +// return expression; +// } +// +// function parseLeftHandSideExpressionOrHigher(): LeftHandSideExpression { +// // Original Ecma: +// // LeftHandSideExpression: See 11.2 +// // NewExpression +// // CallExpression +// // +// // Our simplification: +// // +// // LeftHandSideExpression: See 11.2 +// // MemberExpression +// // CallExpression +// // +// // See comment in parseMemberExpressionOrHigher on how we replaced NewExpression with +// // MemberExpression to make our lives easier. +// // +// // to best understand the below code, it's important to see how CallExpression expands +// // out into its own productions: +// // +// // CallExpression: +// // MemberExpression Arguments +// // CallExpression Arguments +// // CallExpression[Expression] +// // CallExpression.IdentifierName +// // import (AssignmentExpression) +// // super Arguments +// // super.IdentifierName +// // +// // Because of the recursion in these calls, we need to bottom out first. There are three +// // bottom out states we can run into: 1) We see 'super' which must start either of +// // the last two CallExpression productions. 2) We see 'import' which must start import call. +// // 3)we have a MemberExpression which either completes the LeftHandSideExpression, +// // or starts the beginning of the first four CallExpression productions. +// const pos = getNodePos(); +// let expression: MemberExpression; +// if (token() == SyntaxKind::ImportKeyword) { +// if (lookAhead(nextTokenIsOpenParenOrLessThan)) { +// // We don't want to eagerly consume all import keyword as import call expression so we look ahead to find "(" +// // For example: +// // var foo3 = require("subfolder +// // import * as foo1 from "module-from-node +// // We want this import to be a statement rather than import call expression +// sourceFlags |= NodeFlags::PossiblyContainsDynamicImport; +// expression = parseTokenNode(); +// } +// else if (lookAhead(nextTokenIsDot)) { +// // This is an 'import.*' metaproperty (i.e. 'import.meta') +// nextToken(); // advance past the 'import' +// nextToken(); // advance past the dot +// expression = finishNode(factory.createMetaProperty(SyntaxKind::ImportKeyword, parseIdentifierName()), pos); +// sourceFlags |= NodeFlags::PossiblyContainsImportMeta; +// } +// else { +// expression = parseMemberExpressionOrHigher(); +// } +// } +// else { +// expression = token() == SyntaxKind::SuperKeyword ? parseSuperExpression() : parseMemberExpressionOrHigher(); +// } +// +// // Now, we *may* be complete. However, we might have consumed the start of a +// // CallExpression or OptionalExpression. As such, we need to consume the rest +// // of it here to be complete. +// return parseCallExpressionRest(pos, expression); +// } +// +// function parseMemberExpressionOrHigher(): MemberExpression { +// // Note: to make our lives simpler, we decompose the NewExpression productions and +// // place ObjectCreationExpression and FunctionExpression into PrimaryExpression. +// // like so: +// // +// // PrimaryExpression : See 11.1 +// // this +// // Identifier +// // Literal +// // ArrayLiteral +// // ObjectLiteral +// // (Expression) +// // FunctionExpression +// // new MemberExpression Arguments? +// // +// // MemberExpression : See 11.2 +// // PrimaryExpression +// // MemberExpression[Expression] +// // MemberExpression.IdentifierName +// // +// // CallExpression : See 11.2 +// // MemberExpression +// // CallExpression Arguments +// // CallExpression[Expression] +// // CallExpression.IdentifierName +// // +// // Technically this is ambiguous. i.e. CallExpression defines: +// // +// // CallExpression: +// // CallExpression Arguments +// // +// // If you see: "new Foo()" +// // +// // Then that could be treated as a single ObjectCreationExpression, or it could be +// // treated as the invocation of "new Foo". We disambiguate that in code (to match +// // the original grammar) by making sure that if we see an ObjectCreationExpression +// // we always consume arguments if they are there. So we treat "new Foo()" as an +// // object creation only, and not at all as an invocation. Another way to think +// // about this is that for every "new" that we see, we will consume an argument list if +// // it is there as part of the *associated* object creation node. Any additional +// // argument lists we see, will become invocation expressions. +// // +// // Because there are no other places in the grammar now that refer to FunctionExpression +// // or ObjectCreationExpression, it is safe to push down into the PrimaryExpression +// // production. +// // +// // Because CallExpression and MemberExpression are left recursive, we need to bottom out +// // of the recursion immediately. So we parse out a primary expression to start with. +// const pos = getNodePos(); +// const expression = parsePrimaryExpression(); +// return parseMemberExpressionRest(pos, expression, /*allowOptionalChain*/ true); +// } +// +// function parseSuperExpression(): MemberExpression { +// const pos = getNodePos(); +// const expression = parseTokenNode(); +// if (token() == SyntaxKind::LessThanToken) { +// const startPos = getNodePos(); +// const typeArguments = tryParse(parseTypeArgumentsInExpression); +// if (typeArguments !== undefined) { +// parseErrorAt(startPos, getNodePos(), Diagnostics.super_may_not_use_type_arguments); +// } +// } +// +// if (token() == SyntaxKind::OpenParenToken || token() == SyntaxKind::DotToken || token() == SyntaxKind::OpenBracketToken) { +// return expression; +// } +// +// // If we have seen "super" it must be followed by '(' or '.'. +// // If it wasn't then just try to parse out a '.' and report an error. +// parseExpectedToken(SyntaxKind::DotToken, Diagnostics.super_must_be_followed_by_an_argument_list_or_member_access); +// // private names will never work with `super` (`super.#foo`), but that's a semantic error, not syntactic +// return finishNode(factory.createPropertyAccessExpression(expression, parseRightSideOfDot(/*allowIdentifierNames*/ true, /*allowPrivateIdentifiers*/ true)), pos); +// } +// +// function parseJsxElementOrSelfClosingElementOrFragment(inExpressionContext: boolean, topInvalidNodePosition?: number, openingTag?: JsxOpeningElement | JsxOpeningFragment): JsxElement | JsxSelfClosingElement | JsxFragment { +// const pos = getNodePos(); +// const opening = parseJsxOpeningOrSelfClosingElementOrOpeningFragment(inExpressionContext); +// let result: JsxElement | JsxSelfClosingElement | JsxFragment; +// if (opening.kind == SyntaxKind::JsxOpeningElement) { +// let children = parseJsxChildren(opening); +// let closingElement: JsxClosingElement; +// +// const lastChild: JsxChild | undefined = children[children.length - 1]; +// if (lastChild?.kind == SyntaxKind::JsxElement +// && !tagNamesAreEquivalent(lastChild.openingElement.tagName, lastChild.closingElement.tagName) +// && tagNamesAreEquivalent(opening.tagName, lastChild.closingElement.tagName)) { +// // when an unclosed JsxOpeningElement incorrectly parses its parent's JsxClosingElement, +// // restructure (
(......
)) --> (
(......)
) +// // (no need to error; the parent will error) +// const end = lastChild.children.end; +// const newLast = finishNode(factory.createJsxElement( +// lastChild.openingElement, +// lastChild.children, +// finishNode(factory.createJsxClosingElement(finishNode(factory.createIdentifier(""), end, end)), end, end)), +// lastChild.openingElement.pos, +// end); +// +// children = createNodeArray([...children.slice(0, children.length - 1), newLast], children.pos, end); +// closingElement = lastChild.closingElement; +// } +// else { +// closingElement = parseJsxClosingElement(opening, inExpressionContext); +// if (!tagNamesAreEquivalent(opening.tagName, closingElement.tagName)) { +// if (openingTag && isJsxOpeningElement(openingTag) && tagNamesAreEquivalent(closingElement.tagName, openingTag.tagName)) { +// // opening incorrectly matched with its parent's closing -- put error on opening +// parseErrorAtRange(opening.tagName, Diagnostics.JSX_element_0_has_no_corresponding_closing_tag, getTextOfNodeFromSourceText(sourceText, opening.tagName)); +// } +// else { +// // other opening/closing mismatches -- put error on closing +// parseErrorAtRange(closingElement.tagName, Diagnostics.Expected_corresponding_JSX_closing_tag_for_0, getTextOfNodeFromSourceText(sourceText, opening.tagName)); +// } +// } +// } +// result = finishNode(factory.createJsxElement(opening, children, closingElement), pos); +// } +// else if (opening.kind == SyntaxKind::JsxOpeningFragment) { +// result = finishNode(factory.createJsxFragment(opening, parseJsxChildren(opening), parseJsxClosingFragment(inExpressionContext)), pos); +// } +// else { +// Debug.assert(opening.kind == SyntaxKind::JsxSelfClosingElement); +// // Nothing else to do for self-closing elements +// result = opening; +// } +// +// // If the user writes the invalid code '
' in an expression context (i.e. not wrapped in +// // an enclosing tag), we'll naively try to parse ^ this as a 'less than' operator and the remainder of the tag +// // as garbage, which will cause the formatter to badly mangle the JSX. Perform a speculative parse of a JSX +// // element if we see a < token so that we can wrap it in a synthetic binary expression so the formatter +// // does less damage and we can report a better error. +// // Since JSX elements are invalid < operands anyway, this lookahead parse will only occur in error scenarios +// // of one sort or another. +// if (inExpressionContext && token() == SyntaxKind::LessThanToken) { +// const topBadPos = typeof topInvalidNodePosition == "undefined" ? result.pos : topInvalidNodePosition; +// const invalidElement = tryParse(() => parseJsxElementOrSelfClosingElementOrFragment(/*inExpressionContext*/ true, topBadPos)); +// if (invalidElement) { +// const operatorToken = createMissingNode(SyntaxKind::CommaToken, /*reportAtCurrentPosition*/ false); +// setTextRangePosWidth(operatorToken, invalidElement.pos, 0); +// parseErrorAt(skipTrivia(sourceText, topBadPos), invalidElement.end, Diagnostics.JSX_expressions_must_have_one_parent_element); +// return finishNode(factory.createBinaryExpression(result, operatorToken as Token, invalidElement), pos) as Node as JsxElement; +// } +// } +// +// return result; +// } +// +// function parseJsxText(): JsxText { +// const pos = getNodePos(); +// const node = factory.createJsxText(scanner.getTokenValue(), currentToken == SyntaxKind::JsxTextAllWhiteSpaces); +// currentToken = scanner.scanJsxToken(); +// return finishNode(node, pos); +// } +// +// function parseJsxChild(openingTag: JsxOpeningElement | JsxOpeningFragment, token: JsxTokenSyntaxKind): JsxChild | undefined { +// switch (token) { +// case SyntaxKind::EndOfFileToken: +// // If we hit EOF, issue the error at the tag that lacks the closing element +// // rather than at the end of the file (which is useless) +// if (isJsxOpeningFragment(openingTag)) { +// parseErrorAtRange(openingTag, Diagnostics.JSX_fragment_has_no_corresponding_closing_tag); +// } +// else { +// // We want the error span to cover only 'Foo.Bar' in < Foo.Bar > +// // or to cover only 'Foo' in < Foo > +// const tag = openingTag.tagName; +// const start = skipTrivia(sourceText, tag.pos); +// parseErrorAt(start, tag.end, Diagnostics.JSX_element_0_has_no_corresponding_closing_tag, getTextOfNodeFromSourceText(sourceText, openingTag.tagName)); +// } +// return undefined; +// case SyntaxKind::LessThanSlashToken: +// case SyntaxKind::ConflictMarkerTrivia: +// return undefined; +// case SyntaxKind::JsxText: +// case SyntaxKind::JsxTextAllWhiteSpaces: +// return parseJsxText(); +// case SyntaxKind::OpenBraceToken: +// return parseJsxExpression(/*inExpressionContext*/ false); +// case SyntaxKind::LessThanToken: +// return parseJsxElementOrSelfClosingElementOrFragment(/*inExpressionContext*/ false, /*topInvalidNodePosition*/ undefined, openingTag); +// default: +// return Debug.assertNever(token); +// } +// } +// +// function parseJsxChildren(openingTag: JsxOpeningElement | JsxOpeningFragment): NodeArray { +// const list = []; +// const listPos = getNodePos(); +// const saveParsingContext = parsingContext; +// parsingContext |= 1 << ParsingContext.JsxChildren; +// +// while (true) { +// const child = parseJsxChild(openingTag, currentToken = scanner.reScanJsxToken()); +// if (!child) break; +// list.push(child); +// if (isJsxOpeningElement(openingTag) +// && child?.kind == SyntaxKind::JsxElement +// && !tagNamesAreEquivalent(child.openingElement.tagName, child.closingElement.tagName) +// && tagNamesAreEquivalent(openingTag.tagName, child.closingElement.tagName)) { +// // stop after parsing a mismatched child like
...(
) in order to reattach the higher +// break; +// } +// } +// +// parsingContext = saveParsingContext; +// return createNodeArray(list, listPos); +// } +// +// function parseJsxAttributes(): JsxAttributes { +// const pos = getNodePos(); +// return finishNode(factory.createJsxAttributes(parseList(ParsingContext.JsxAttributes, parseJsxAttribute)), pos); +// } +// +// function parseJsxOpeningOrSelfClosingElementOrOpeningFragment(inExpressionContext: boolean): JsxOpeningElement | JsxSelfClosingElement | JsxOpeningFragment { +// const pos = getNodePos(); +// +// parseExpected(SyntaxKind::LessThanToken); +// +// if (token() == SyntaxKind::GreaterThanToken) { +// // See below for explanation of scanJsxText +// scanJsxText(); +// return finishNode(factory.createJsxOpeningFragment(), pos); +// } +// const tagName = parseJsxElementName(); +// const typeArguments = (contextFlags & NodeFlags::JavaScriptFile) == 0 ? tryParseTypeArguments() : undefined; +// const attributes = parseJsxAttributes(); +// +// let node: JsxOpeningLikeElement; +// +// if (token() == SyntaxKind::GreaterThanToken) { +// // Closing tag, so scan the immediately-following text with the JSX scanning instead +// // of regular scanning to avoid treating illegal characters (e.g. '#') as immediate +// // scanning errors +// scanJsxText(); +// node = factory.createJsxOpeningElement(tagName, typeArguments, attributes); +// } +// else { +// parseExpected(SyntaxKind::SlashToken); +// if (parseExpected(SyntaxKind::GreaterThanToken, /*diagnostic*/ undefined, /*shouldAdvance*/ false)) { +// // manually advance the scanner in order to look for jsx text inside jsx +// if (inExpressionContext) { +// nextToken(); +// } +// else { +// scanJsxText(); +// } +// } +// node = factory.createJsxSelfClosingElement(tagName, typeArguments, attributes); +// } +// +// return finishNode(node, pos); +// } +// +// function parseJsxElementName(): JsxTagNameExpression { +// const pos = getNodePos(); +// scanJsxIdentifier(); +// // JsxElement can have name in the form of +// // propertyAccessExpression +// // primaryExpression in the form of an identifier and "this" keyword +// // We can't just simply use parseLeftHandSideExpressionOrHigher because then we will start consider class,function etc as a keyword +// // We only want to consider "this" as a primaryExpression +// let expression: JsxTagNameExpression = token() == SyntaxKind::ThisKeyword ? +// parseTokenNode() : parseIdentifierName(); +// while (parseOptional(SyntaxKind::DotToken)) { +// expression = finishNode(factory.createPropertyAccessExpression(expression, parseRightSideOfDot(/*allowIdentifierNames*/ true, /*allowPrivateIdentifiers*/ false)), pos) as JsxTagNamePropertyAccess; +// } +// return expression; +// } +// +// function parseJsxExpression(inExpressionContext: boolean): JsxExpression | undefined { +// const pos = getNodePos(); +// if (!parseExpected(SyntaxKind::OpenBraceToken)) { +// return undefined; +// } +// +// let dotDotDotToken: DotDotDotToken | undefined; +// let expression: Expression | undefined; +// if (token() !== SyntaxKind::CloseBraceToken) { +// dotDotDotToken = parseOptionalToken(SyntaxKind::DotDotDotToken); +// // Only an AssignmentExpression is valid here per the JSX spec, +// // but we can unambiguously parse a comma sequence and provide +// // a better error message in grammar checking. +// expression = parseExpression(); +// } +// if (inExpressionContext) { +// parseExpected(SyntaxKind::CloseBraceToken); +// } +// else { +// if (parseExpected(SyntaxKind::CloseBraceToken, /*message*/ undefined, /*shouldAdvance*/ false)) { +// scanJsxText(); +// } +// } +// +// return finishNode(factory.createJsxExpression(dotDotDotToken, expression), pos); +// } +// +// function parseJsxAttribute(): JsxAttribute | JsxSpreadAttribute { +// if (token() == SyntaxKind::OpenBraceToken) { +// return parseJsxSpreadAttribute(); +// } +// +// scanJsxIdentifier(); +// const pos = getNodePos(); +// return finishNode(factory.createJsxAttribute(parseIdentifierName(), parseJsxAttributeValue()), pos); +// } +// +// function parseJsxAttributeValue(): JsxAttributeValue | undefined { +// if (token() == SyntaxKind::EqualsToken) { +// if (scanJsxAttributeValue() == SyntaxKind::StringLiteral) { +// return parseLiteralNode() as StringLiteral; +// } +// if (token() == SyntaxKind::OpenBraceToken) { +// return parseJsxExpression(/*inExpressionContext*/ true); +// } +// if (token() == SyntaxKind::LessThanToken) { +// return parseJsxElementOrSelfClosingElementOrFragment(/*inExpressionContext*/ true); +// } +// parseErrorAtCurrentToken(Diagnostics.or_JSX_element_expected); +// } +// return undefined; +// } +// +// function parseJsxSpreadAttribute(): JsxSpreadAttribute { +// const pos = getNodePos(); +// parseExpected(SyntaxKind::OpenBraceToken); +// parseExpected(SyntaxKind::DotDotDotToken); +// const expression = parseExpression(); +// parseExpected(SyntaxKind::CloseBraceToken); +// return finishNode(factory.createJsxSpreadAttribute(expression), pos); +// } +// +// function parseJsxClosingElement(open: JsxOpeningElement, inExpressionContext: boolean): JsxClosingElement { +// const pos = getNodePos(); +// parseExpected(SyntaxKind::LessThanSlashToken); +// const tagName = parseJsxElementName(); +// if (parseExpected(SyntaxKind::GreaterThanToken, /*diagnostic*/ undefined, /*shouldAdvance*/ false)) { +// // manually advance the scanner in order to look for jsx text inside jsx +// if (inExpressionContext || !tagNamesAreEquivalent(open.tagName, tagName)) { +// nextToken(); +// } +// else { +// scanJsxText(); +// } +// } +// return finishNode(factory.createJsxClosingElement(tagName), pos); +// } +// +// function parseJsxClosingFragment(inExpressionContext: boolean): JsxClosingFragment { +// const pos = getNodePos(); +// parseExpected(SyntaxKind::LessThanSlashToken); +// if (tokenIsIdentifierOrKeyword(token())) { +// parseErrorAtRange(parseJsxElementName(), Diagnostics.Expected_corresponding_closing_tag_for_JSX_fragment); +// } +// if (parseExpected(SyntaxKind::GreaterThanToken, /*diagnostic*/ undefined, /*shouldAdvance*/ false)) { +// // manually advance the scanner in order to look for jsx text inside jsx +// if (inExpressionContext) { +// nextToken(); +// } +// else { +// scanJsxText(); +// } +// } +// return finishNode(factory.createJsxJsxClosingFragment(), pos); +// } +// +// function parseTypeAssertion(): TypeAssertion { +// const pos = getNodePos(); +// parseExpected(SyntaxKind::LessThanToken); +// const type = parseType(); +// parseExpected(SyntaxKind::GreaterThanToken); +// const expression = parseSimpleUnaryExpression(); +// return finishNode(factory.createTypeAssertion(type, expression), pos); +// } +// +// function nextTokenIsIdentifierOrKeywordOrOpenBracketOrTemplate() { +// nextToken(); +// return tokenIsIdentifierOrKeyword(token()) +// || token() == SyntaxKind::OpenBracketToken +// || isTemplateStartOfTaggedTemplate(); +// } +// +// function isStartOfOptionalPropertyOrElementAccessChain() { +// return token() == SyntaxKind::QuestionDotToken +// && lookAhead(nextTokenIsIdentifierOrKeywordOrOpenBracketOrTemplate); +// } +// +// function tryReparseOptionalChain(node: Expression) { +// if (node.flags & NodeFlags::OptionalChain) { +// return true; +// } +// // check for an optional chain in a non-null expression +// if (isNonNullExpression(node)) { +// let expr = node.expression; +// while (isNonNullExpression(expr) && !(expr.flags & NodeFlags::OptionalChain)) { +// expr = expr.expression; +// } +// if (expr.flags & NodeFlags::OptionalChain) { +// // this is part of an optional chain. Walk down from `node` to `expression` and set the flag. +// while (isNonNullExpression(node)) { +// reinterpret_cast&>(node).flags |= NodeFlags::OptionalChain; +// node = node.expression; +// } +// return true; +// } +// } +// return false; +// } +// +// function parsePropertyAccessExpressionRest(pos: number, expression: LeftHandSideExpression, questionDotToken: QuestionDotToken | undefined) { +// const name = parseRightSideOfDot(/*allowIdentifierNames*/ true, /*allowPrivateIdentifiers*/ true); +// const isOptionalChain = questionDotToken || tryReparseOptionalChain(expression); +// const propertyAccess = isOptionalChain ? +// factory.createPropertyAccessChain(expression, questionDotToken, name) : +// factory.createPropertyAccessExpression(expression, name); +// if (isOptionalChain && isPrivateIdentifier(propertyAccess.name)) { +// parseErrorAtRange(propertyAccess.name, Diagnostics.An_optional_chain_cannot_contain_private_identifiers); +// } +// return finishNode(propertyAccess, pos); +// } +// +// function parseElementAccessExpressionRest(pos: number, expression: LeftHandSideExpression, questionDotToken: QuestionDotToken | undefined) { +// let argumentExpression: Expression; +// if (token() == SyntaxKind::CloseBracketToken) { +// argumentExpression = createMissingNode(SyntaxKind::Identifier, /*reportAtCurrentPosition*/ true, Diagnostics.An_element_access_expression_should_take_an_argument); +// } +// else { +// const argument = allowInAnd(parseExpression); +// if (isStringOrNumericLiteralLike(argument)) { +// argument.text = internIdentifier(argument.text); +// } +// argumentExpression = argument; +// } +// +// parseExpected(SyntaxKind::CloseBracketToken); +// +// const indexedAccess = questionDotToken || tryReparseOptionalChain(expression) ? +// factory.createElementAccessChain(expression, questionDotToken, argumentExpression) : +// factory.createElementAccessExpression(expression, argumentExpression); +// return finishNode(indexedAccess, pos); +// } +// +// function parseMemberExpressionRest(pos: number, expression: LeftHandSideExpression, allowOptionalChain: boolean): MemberExpression { +// while (true) { +// let questionDotToken: QuestionDotToken | undefined; +// let isPropertyAccess = false; +// if (allowOptionalChain && isStartOfOptionalPropertyOrElementAccessChain()) { +// questionDotToken = parseExpectedToken(SyntaxKind::QuestionDotToken); +// isPropertyAccess = tokenIsIdentifierOrKeyword(token()); +// } +// else { +// isPropertyAccess = parseOptional(SyntaxKind::DotToken); +// } +// +// if (isPropertyAccess) { +// expression = parsePropertyAccessExpressionRest(pos, expression, questionDotToken); +// continue; +// } +// +// // when in the [Decorator] context, we do not parse ElementAccess as it could be part of a ComputedPropertyName +// if ((questionDotToken || !inDecoratorContext()) && parseOptional(SyntaxKind::OpenBracketToken)) { +// expression = parseElementAccessExpressionRest(pos, expression, questionDotToken); +// continue; +// } +// +// if (isTemplateStartOfTaggedTemplate()) { +// // Absorb type arguments into TemplateExpression when preceding expression is ExpressionWithTypeArguments +// expression = !questionDotToken && expression.kind == SyntaxKind::ExpressionWithTypeArguments ? +// parseTaggedTemplateRest(pos, (expression as ExpressionWithTypeArguments).expression, questionDotToken, (expression as ExpressionWithTypeArguments).typeArguments) : +// parseTaggedTemplateRest(pos, expression, questionDotToken, /*typeArguments*/ undefined); +// continue; +// } +// +// if (!questionDotToken) { +// if (token() == SyntaxKind::ExclamationToken && !scanner.hasPrecedingLineBreak()) { +// nextToken(); +// expression = finishNode(factory.createNonNullExpression(expression), pos); +// continue; +// } +// const typeArguments = tryParse(parseTypeArgumentsInExpression); +// if (typeArguments) { +// expression = finishNode(factory.createExpressionWithTypeArguments(expression, typeArguments), pos); +// continue; +// } +// } +// +// return expression as MemberExpression; +// } +// } +// +// function isTemplateStartOfTaggedTemplate() { +// return token() == SyntaxKind::NoSubstitutionTemplateLiteral || token() == SyntaxKind::TemplateHead; +// } +// +// function parseTaggedTemplateRest(pos: number, tag: LeftHandSideExpression, questionDotToken: QuestionDotToken | undefined, typeArguments: NodeArray | undefined) { +// const tagExpression = factory.createTaggedTemplateExpression( +// tag, +// typeArguments, +// token() == SyntaxKind::NoSubstitutionTemplateLiteral ? +// (reScanTemplateHeadOrNoSubstitutionTemplate(), parseLiteralNode() as NoSubstitutionTemplateLiteral) : +// parseTemplateExpression(/*isTaggedTemplate*/ true) +// ); +// if (questionDotToken || tag.flags & NodeFlags::OptionalChain) { +// (tagExpression as Mutable).flags |= NodeFlags::OptionalChain; +// } +// tagExpression.questionDotToken = questionDotToken; +// return finishNode(tagExpression, pos); +// } +// +// function parseCallExpressionRest(pos: number, expression: LeftHandSideExpression): LeftHandSideExpression { +// while (true) { +// expression = parseMemberExpressionRest(pos, expression, /*allowOptionalChain*/ true); +// let typeArguments: NodeArray | undefined; +// const questionDotToken = parseOptionalToken(SyntaxKind::QuestionDotToken); +// if (questionDotToken) { +// typeArguments = tryParse(parseTypeArgumentsInExpression); +// if (isTemplateStartOfTaggedTemplate()) { +// expression = parseTaggedTemplateRest(pos, expression, questionDotToken, typeArguments); +// continue; +// } +// } +// if (typeArguments || token() == SyntaxKind::OpenParenToken) { +// // Absorb type arguments into CallExpression when preceding expression is ExpressionWithTypeArguments +// if (!questionDotToken && expression.kind == SyntaxKind::ExpressionWithTypeArguments) { +// typeArguments = (expression as ExpressionWithTypeArguments).typeArguments; +// expression = (expression as ExpressionWithTypeArguments).expression; +// } +// const argumentList = parseArgumentList(); +// const callExpr = questionDotToken || tryReparseOptionalChain(expression) ? +// factory.createCallChain(expression, questionDotToken, typeArguments, argumentList) : +// factory.createCallExpression(expression, typeArguments, argumentList); +// expression = finishNode(callExpr, pos); +// continue; +// } +// if (questionDotToken) { +// // We parsed `?.` but then failed to parse anything, so report a missing identifier here. +// const name = createMissingNode(SyntaxKind::Identifier, /*reportAtCurrentPosition*/ false, Diagnostics.Identifier_expected); +// expression = finishNode(factory.createPropertyAccessChain(expression, questionDotToken, name), pos); +// } +// break; +// } +// return expression; +// } +// +// function parseArgumentList() { +// parseExpected(SyntaxKind::OpenParenToken); +// const result = parseDelimitedList(ParsingContext.ArgumentExpressions, parseArgumentExpression); +// parseExpected(SyntaxKind::CloseParenToken); +// return result; +// } +// +// function parseTypeArgumentsInExpression() { +// if ((contextFlags & NodeFlags::JavaScriptFile) !== 0) { +// // TypeArguments must not be parsed in JavaScript files to avoid ambiguity with binary operators. +// return undefined; +// } +// +// if (reScanLessThanToken() !== SyntaxKind::LessThanToken) { +// return undefined; +// } +// nextToken(); +// +// const typeArguments = parseDelimitedList(ParsingContext.TypeArguments, parseType); +// if (!parseExpected(SyntaxKind::GreaterThanToken)) { +// // If it doesn't have the closing `>` then it's definitely not an type argument list. +// return undefined; +// } +// +// // We successfully parsed a type argument list. The next token determines whether we want to +// // treat it as such. If the type argument list is followed by `(` or a template literal, as in +// // `f(42)`, we favor the type argument interpretation even though JavaScript would view +// // it as a relational expression. +// return typeArguments && canFollowTypeArgumentsInExpression() ? typeArguments : undefined; +// } +// +// function canFollowTypeArgumentsInExpression(): boolean { +// switch (token()) { +// // These tokens can follow a type argument list in a call expression. +// case SyntaxKind::OpenParenToken: // foo( +// case SyntaxKind::NoSubstitutionTemplateLiteral: // foo `...` +// case SyntaxKind::TemplateHead: // foo `...${100}...` +// return true; +// } +// // Consider something a type argument list only if the following token can't start an expression. +// return !isStartOfExpression(); +// } +// +// function parsePrimaryExpression(): PrimaryExpression { +// switch (token()) { +// case SyntaxKind::NumericLiteral: +// case SyntaxKind::BigIntLiteral: +// case SyntaxKind::StringLiteral: +// case SyntaxKind::NoSubstitutionTemplateLiteral: +// return parseLiteralNode(); +// case SyntaxKind::ThisKeyword: +// case SyntaxKind::SuperKeyword: +// case SyntaxKind::NullKeyword: +// case SyntaxKind::TrueKeyword: +// case SyntaxKind::FalseKeyword: +// return parseTokenNode(); +// case SyntaxKind::OpenParenToken: +// return parseParenthesizedExpression(); +// case SyntaxKind::OpenBracketToken: +// return parseArrayLiteralExpression(); +// case SyntaxKind::OpenBraceToken: +// return parseObjectLiteralExpression(); +// case SyntaxKind::AsyncKeyword: +// // Async arrow functions are parsed earlier in parseAssignmentExpressionOrHigher. +// // If we encounter `async [no LineTerminator here] function` then this is an async +// // function; otherwise, its an identifier. +// if (!lookAhead(nextTokenIsFunctionKeywordOnSameLine)) { +// break; +// } +// +// return parseFunctionExpression(); +// case SyntaxKind::ClassKeyword: +// return parseClassExpression(); +// case SyntaxKind::FunctionKeyword: +// return parseFunctionExpression(); +// case SyntaxKind::NewKeyword: +// return parseNewExpressionOrNewDotTarget(); +// case SyntaxKind::SlashToken: +// case SyntaxKind::SlashEqualsToken: +// if (reScanSlashToken() == SyntaxKind::RegularExpressionLiteral) { +// return parseLiteralNode(); +// } +// break; +// case SyntaxKind::TemplateHead: +// return parseTemplateExpression(/* isTaggedTemplate */ false); +// case SyntaxKind::PrivateIdentifier: +// return parsePrivateIdentifier(); +// } +// +// return parseIdentifier(Diagnostics.Expression_expected); +// } +// +// function parseParenthesizedExpression(): ParenthesizedExpression { +// const pos = getNodePos(); +// const hasJSDoc = hasPrecedingJSDocComment(); +// parseExpected(SyntaxKind::OpenParenToken); +// const expression = allowInAnd(parseExpression); +// parseExpected(SyntaxKind::CloseParenToken); +// return withJSDoc(finishNode(factory.createParenthesizedExpression(expression), pos), hasJSDoc); +// } +// +// function parseSpreadElement(): Expression { +// const pos = getNodePos(); +// parseExpected(SyntaxKind::DotDotDotToken); +// const expression = parseAssignmentExpressionOrHigher(); +// return finishNode(factory.createSpreadElement(expression), pos); +// } +// +// function parseArgumentOrArrayLiteralElement(): Expression { +// return token() == SyntaxKind::DotDotDotToken ? parseSpreadElement() : +// token() == SyntaxKind::CommaToken ? finishNode(factory.createOmittedExpression(), getNodePos()) : +// parseAssignmentExpressionOrHigher(); +// } +// +// function parseArgumentExpression(): Expression { +// return doOutsideOfContext(disallowInAndDecoratorContext, parseArgumentOrArrayLiteralElement); +// } +// +// function parseArrayLiteralExpression(): ArrayLiteralExpression { +// const pos = getNodePos(); +// const openBracketPosition = scanner.getTokenPos(); +// const openBracketParsed = parseExpected(SyntaxKind::OpenBracketToken); +// const multiLine = scanner.hasPrecedingLineBreak(); +// const elements = parseDelimitedList(ParsingContext.ArrayLiteralMembers, parseArgumentOrArrayLiteralElement); +// parseExpectedMatchingBrackets(SyntaxKind::OpenBracketToken, SyntaxKind::CloseBracketToken, openBracketParsed, openBracketPosition); +// return finishNode(factory.createArrayLiteralExpression(elements, multiLine), pos); +// } +// +// function parseObjectLiteralElement(): ObjectLiteralElementLike { +// const pos = getNodePos(); +// const hasJSDoc = hasPrecedingJSDocComment(); +// +// if (parseOptionalToken(SyntaxKind::DotDotDotToken)) { +// const expression = parseAssignmentExpressionOrHigher(); +// return withJSDoc(finishNode(factory.createSpreadAssignment(expression), pos), hasJSDoc); +// } +// +// const decorators = parseDecorators(); +// const modifiers = parseModifiers(); +// +// if (parseContextualModifier(SyntaxKind::GetKeyword)) { +// return parseAccessorDeclaration(pos, hasJSDoc, decorators, modifiers, SyntaxKind::GetAccessor); +// } +// if (parseContextualModifier(SyntaxKind::SetKeyword)) { +// return parseAccessorDeclaration(pos, hasJSDoc, decorators, modifiers, SyntaxKind::SetAccessor); +// } +// +// const asteriskToken = parseOptionalToken(SyntaxKind::AsteriskToken); +// const tokenIsIdentifier = isIdentifier(); +// const name = parsePropertyName(); +// +// // Disallowing of optional property assignments and definite assignment assertion happens in the grammar checker. +// const questionToken = parseOptionalToken(SyntaxKind::QuestionToken); +// const exclamationToken = parseOptionalToken(SyntaxKind::ExclamationToken); +// +// if (asteriskToken || token() == SyntaxKind::OpenParenToken || token() == SyntaxKind::LessThanToken) { +// return parseMethodDeclaration(pos, hasJSDoc, decorators, modifiers, asteriskToken, name, questionToken, exclamationToken); +// } +// +// // check if it is short-hand property assignment or normal property assignment +// // NOTE: if token is EqualsToken it is interpreted as CoverInitializedName production +// // CoverInitializedName[Yield] : +// // IdentifierReference[?Yield] Initializer[In, ?Yield] +// // this is necessary because ObjectLiteral productions are also used to cover grammar for ObjectAssignmentPattern +// let node: Mutable; +// const isShorthandPropertyAssignment = tokenIsIdentifier && (token() !== SyntaxKind::ColonToken); +// if (isShorthandPropertyAssignment) { +// const equalsToken = parseOptionalToken(SyntaxKind::EqualsToken); +// const objectAssignmentInitializer = equalsToken ? allowInAnd(parseAssignmentExpressionOrHigher) : undefined; +// node = factory.createShorthandPropertyAssignment(name as Identifier, objectAssignmentInitializer); +// // Save equals token for error reporting. +// // TODO(rbuckton): Consider manufacturing this when we need to report an error as it is otherwise not useful. +// node.equalsToken = equalsToken; +// } +// else { +// parseExpected(SyntaxKind::ColonToken); +// const initializer = allowInAnd(parseAssignmentExpressionOrHigher); +// node = factory.createPropertyAssignment(name, initializer); +// } +// // Decorators, Modifiers, questionToken, and exclamationToken are not supported by property assignments and are reported in the grammar checker +// node.decorators = decorators; +// node.modifiers = modifiers; +// node.questionToken = questionToken; +// node.exclamationToken = exclamationToken; +// return withJSDoc(finishNode(node, pos), hasJSDoc); +// } +// +// function parseObjectLiteralExpression(): ObjectLiteralExpression { +// const pos = getNodePos(); +// const openBracePosition = scanner.getTokenPos(); +// const openBraceParsed = parseExpected(SyntaxKind::OpenBraceToken); +// const multiLine = scanner.hasPrecedingLineBreak(); +// const properties = parseDelimitedList(ParsingContext.ObjectLiteralMembers, parseObjectLiteralElement, /*considerSemicolonAsDelimiter*/ true); +// parseExpectedMatchingBrackets(SyntaxKind::OpenBraceToken, SyntaxKind::CloseBraceToken, openBraceParsed, openBracePosition); +// return finishNode(factory.createObjectLiteralExpression(properties, multiLine), pos); +// } +// +// function parseFunctionExpression(): FunctionExpression { +// // GeneratorExpression: +// // function* BindingIdentifier [Yield][opt](FormalParameters[Yield]){ GeneratorBody } +// // +// // FunctionExpression: +// // function BindingIdentifier[opt](FormalParameters){ FunctionBody } +// const savedDecoratorContext = inDecoratorContext(); +// setDecoratorContext(/*val*/ false); +// +// const pos = getNodePos(); +// const hasJSDoc = hasPrecedingJSDocComment(); +// const modifiers = parseModifiers(); +// parseExpected(SyntaxKind::FunctionKeyword); +// const asteriskToken = parseOptionalToken(SyntaxKind::AsteriskToken); +// const isGenerator = asteriskToken ? SignatureFlags.Yield : SignatureFlags.None; +// const isAsync = some(modifiers, isAsyncModifier) ? SignatureFlags.Await : SignatureFlags.None; +// const name = isGenerator && isAsync ? doInYieldAndAwaitContext(parseOptionalBindingIdentifier) : +// isGenerator ? doInYieldContext(parseOptionalBindingIdentifier) : +// isAsync ? doInAwaitContext(parseOptionalBindingIdentifier) : +// parseOptionalBindingIdentifier(); +// +// const typeParameters = parseTypeParameters(); +// const parameters = parseParameters(isGenerator | isAsync); +// const type = parseReturnType(SyntaxKind::ColonToken, /*isType*/ false); +// const body = parseFunctionBlock(isGenerator | isAsync); +// +// setDecoratorContext(savedDecoratorContext); +// +// const node = factory.createFunctionExpression(modifiers, asteriskToken, name, typeParameters, parameters, type, body); +// return withJSDoc(finishNode(node, pos), hasJSDoc); +// } +// +// function parseOptionalBindingIdentifier(): Identifier | undefined { +// return isBindingIdentifier() ? parseBindingIdentifier() : undefined; +// } +// +// function parseNewExpressionOrNewDotTarget(): NewExpression | MetaProperty { +// const pos = getNodePos(); +// parseExpected(SyntaxKind::NewKeyword); +// if (parseOptional(SyntaxKind::DotToken)) { +// const name = parseIdentifierName(); +// return finishNode(factory.createMetaProperty(SyntaxKind::NewKeyword, name), pos); +// } +// const expressionPos = getNodePos(); +// let expression: LeftHandSideExpression = parseMemberExpressionRest(expressionPos, parsePrimaryExpression(), /*allowOptionalChain*/ false); +// let typeArguments: NodeArray | undefined; +// // Absorb type arguments into NewExpression when preceding expression is ExpressionWithTypeArguments +// if (expression.kind == SyntaxKind::ExpressionWithTypeArguments) { +// typeArguments = (expression as ExpressionWithTypeArguments).typeArguments; +// expression = (expression as ExpressionWithTypeArguments).expression; +// } +// const argumentList = token() == SyntaxKind::OpenParenToken ? parseArgumentList() : undefined; +// return finishNode(factory.createNewExpression(expression, typeArguments, argumentList), pos); +// } +// +// // STATEMENTS +// function parseBlock(ignoreMissingOpenBrace: boolean, diagnosticMessage?: DiagnosticMessage): Block { +// const pos = getNodePos(); +// const hasJSDoc = hasPrecedingJSDocComment(); +// const openBracePosition = scanner.getTokenPos(); +// const openBraceParsed = parseExpected(SyntaxKind::OpenBraceToken, diagnosticMessage); +// if (openBraceParsed || ignoreMissingOpenBrace) { +// const multiLine = scanner.hasPrecedingLineBreak(); +// const statements = parseList(ParsingContext.BlockStatements, parseStatement); +// parseExpectedMatchingBrackets(SyntaxKind::OpenBraceToken, SyntaxKind::CloseBraceToken, openBraceParsed, openBracePosition); +// const result = withJSDoc(finishNode(factory.createBlock(statements, multiLine), pos), hasJSDoc); +// if (token() == SyntaxKind::EqualsToken) { +// parseErrorAtCurrentToken(Diagnostics.Declaration_or_statement_expected_This_follows_a_block_of_statements_so_if_you_intended_to_write_a_destructuring_assignment_you_might_need_to_wrap_the_the_whole_assignment_in_parentheses); +// nextToken(); +// } +// +// return result; +// } +// else { +// const statements = createMissingList(); +// return withJSDoc(finishNode(factory.createBlock(statements, /*multiLine*/ undefined), pos), hasJSDoc); +// } +// } +// +// function parseFunctionBlock(flags: SignatureFlags, diagnosticMessage?: DiagnosticMessage): Block { +// const savedYieldContext = inYieldContext(); +// setYieldContext(!!(flags & SignatureFlags.Yield)); +// +// const savedAwaitContext = inAwaitContext(); +// setAwaitContext(!!(flags & SignatureFlags.Await)); +// +// const savedTopLevel = topLevel; +// topLevel = false; +// +// // We may be in a [Decorator] context when parsing a function expression or +// // arrow function. The body of the function is not in [Decorator] context. +// const saveDecoratorContext = inDecoratorContext(); +// if (saveDecoratorContext) { +// setDecoratorContext(/*val*/ false); +// } +// +// const block = parseBlock(!!(flags & SignatureFlags.IgnoreMissingOpenBrace), diagnosticMessage); +// +// if (saveDecoratorContext) { +// setDecoratorContext(/*val*/ true); +// } +// +// topLevel = savedTopLevel; +// setYieldContext(savedYieldContext); +// setAwaitContext(savedAwaitContext); +// +// return block; +// } +// +// function parseEmptyStatement(): Statement { +// const pos = getNodePos(); +// const hasJSDoc = hasPrecedingJSDocComment(); +// parseExpected(SyntaxKind::SemicolonToken); +// return withJSDoc(finishNode(factory.createEmptyStatement(), pos), hasJSDoc); +// } +// +// function parseIfStatement(): IfStatement { +// const pos = getNodePos(); +// const hasJSDoc = hasPrecedingJSDocComment(); +// parseExpected(SyntaxKind::IfKeyword); +// const openParenPosition = scanner.getTokenPos(); +// const openParenParsed = parseExpected(SyntaxKind::OpenParenToken); +// const expression = allowInAnd(parseExpression); +// parseExpectedMatchingBrackets(SyntaxKind::OpenParenToken, SyntaxKind::CloseParenToken, openParenParsed, openParenPosition); +// const thenStatement = parseStatement(); +// const elseStatement = parseOptional(SyntaxKind::ElseKeyword) ? parseStatement() : undefined; +// return withJSDoc(finishNode(factory.createIfStatement(expression, thenStatement, elseStatement), pos), hasJSDoc); +// } +// +// function parseDoStatement(): DoStatement { +// const pos = getNodePos(); +// const hasJSDoc = hasPrecedingJSDocComment(); +// parseExpected(SyntaxKind::DoKeyword); +// const statement = parseStatement(); +// parseExpected(SyntaxKind::WhileKeyword); +// const openParenPosition = scanner.getTokenPos(); +// const openParenParsed = parseExpected(SyntaxKind::OpenParenToken); +// const expression = allowInAnd(parseExpression); +// parseExpectedMatchingBrackets(SyntaxKind::OpenParenToken, SyntaxKind::CloseParenToken, openParenParsed, openParenPosition); +// +// // From: https://mail.mozilla.org/pipermail/es-discuss/2011-August/016188.html +// // 157 min --- All allen at wirfs-brock.com CONF --- "do{;}while(false)false" prohibited in +// // spec but allowed in consensus reality. Approved -- this is the de-facto standard whereby +// // do;while(0)x will have a semicolon inserted before x. +// parseOptional(SyntaxKind::SemicolonToken); +// return withJSDoc(finishNode(factory.createDoStatement(statement, expression), pos), hasJSDoc); +// } +// +// function parseWhileStatement(): WhileStatement { +// const pos = getNodePos(); +// const hasJSDoc = hasPrecedingJSDocComment(); +// parseExpected(SyntaxKind::WhileKeyword); +// const openParenPosition = scanner.getTokenPos(); +// const openParenParsed = parseExpected(SyntaxKind::OpenParenToken); +// const expression = allowInAnd(parseExpression); +// parseExpectedMatchingBrackets(SyntaxKind::OpenParenToken, SyntaxKind::CloseParenToken, openParenParsed, openParenPosition); +// const statement = parseStatement(); +// return withJSDoc(finishNode(factory.createWhileStatement(expression, statement), pos), hasJSDoc); +// } +// +// function parseForOrForInOrForOfStatement(): Statement { +// const pos = getNodePos(); +// const hasJSDoc = hasPrecedingJSDocComment(); +// parseExpected(SyntaxKind::ForKeyword); +// const awaitToken = parseOptionalToken(SyntaxKind::AwaitKeyword); +// parseExpected(SyntaxKind::OpenParenToken); +// +// let initializer!: VariableDeclarationList | Expression; +// if (token() !== SyntaxKind::SemicolonToken) { +// if (token() == SyntaxKind::VarKeyword || token() == SyntaxKind::LetKeyword || token() == SyntaxKind::ConstKeyword) { +// initializer = parseVariableDeclarationList(/*inForStatementInitializer*/ true); +// } +// else { +// initializer = disallowInAnd(parseExpression); +// } +// } +// +// let node: IterationStatement; +// if (awaitToken ? parseExpected(SyntaxKind::OfKeyword) : parseOptional(SyntaxKind::OfKeyword)) { +// const expression = allowInAnd(parseAssignmentExpressionOrHigher); +// parseExpected(SyntaxKind::CloseParenToken); +// node = factory.createForOfStatement(awaitToken, initializer, expression, parseStatement()); +// } +// else if (parseOptional(SyntaxKind::InKeyword)) { +// const expression = allowInAnd(parseExpression); +// parseExpected(SyntaxKind::CloseParenToken); +// node = factory.createForInStatement(initializer, expression, parseStatement()); +// } +// else { +// parseExpected(SyntaxKind::SemicolonToken); +// const condition = token() !== SyntaxKind::SemicolonToken && token() !== SyntaxKind::CloseParenToken +// ? allowInAnd(parseExpression) +// : undefined; +// parseExpected(SyntaxKind::SemicolonToken); +// const incrementor = token() !== SyntaxKind::CloseParenToken +// ? allowInAnd(parseExpression) +// : undefined; +// parseExpected(SyntaxKind::CloseParenToken); +// node = factory.createForStatement(initializer, condition, incrementor, parseStatement()); +// } +// +// return withJSDoc(finishNode(node, pos) as ForStatement | ForInOrOfStatement, hasJSDoc); +// } +// +// function parseBreakOrContinueStatement(kind: SyntaxKind): BreakOrContinueStatement { +// const pos = getNodePos(); +// const hasJSDoc = hasPrecedingJSDocComment(); +// +// parseExpected(kind == SyntaxKind::BreakStatement ? SyntaxKind::BreakKeyword : SyntaxKind::ContinueKeyword); +// const label = canParseSemicolon() ? undefined : parseIdentifier(); +// +// parseSemicolon(); +// const node = kind == SyntaxKind::BreakStatement +// ? factory.createBreakStatement(label) +// : factory.createContinueStatement(label); +// return withJSDoc(finishNode(node, pos), hasJSDoc); +// } +// +// function parseReturnStatement(): ReturnStatement { +// const pos = getNodePos(); +// const hasJSDoc = hasPrecedingJSDocComment(); +// parseExpected(SyntaxKind::ReturnKeyword); +// const expression = canParseSemicolon() ? undefined : allowInAnd(parseExpression); +// parseSemicolon(); +// return withJSDoc(finishNode(factory.createReturnStatement(expression), pos), hasJSDoc); +// } +// +// function parseWithStatement(): WithStatement { +// const pos = getNodePos(); +// const hasJSDoc = hasPrecedingJSDocComment(); +// parseExpected(SyntaxKind::WithKeyword); +// const openParenPosition = scanner.getTokenPos(); +// const openParenParsed = parseExpected(SyntaxKind::OpenParenToken); +// const expression = allowInAnd(parseExpression); +// parseExpectedMatchingBrackets(SyntaxKind::OpenParenToken, SyntaxKind::CloseParenToken, openParenParsed, openParenPosition); +// const statement = doInsideOfContext(NodeFlags::InWithStatement, parseStatement); +// return withJSDoc(finishNode(factory.createWithStatement(expression, statement), pos), hasJSDoc); +// } +// +// function parseCaseClause(): CaseClause { +// const pos = getNodePos(); +// const hasJSDoc = hasPrecedingJSDocComment(); +// parseExpected(SyntaxKind::CaseKeyword); +// const expression = allowInAnd(parseExpression); +// parseExpected(SyntaxKind::ColonToken); +// const statements = parseList(ParsingContext.SwitchClauseStatements, parseStatement); +// return withJSDoc(finishNode(factory.createCaseClause(expression, statements), pos), hasJSDoc); +// } +// +// function parseDefaultClause(): DefaultClause { +// const pos = getNodePos(); +// parseExpected(SyntaxKind::DefaultKeyword); +// parseExpected(SyntaxKind::ColonToken); +// const statements = parseList(ParsingContext.SwitchClauseStatements, parseStatement); +// return finishNode(factory.createDefaultClause(statements), pos); +// } +// +// function parseCaseOrDefaultClause(): CaseOrDefaultClause { +// return token() == SyntaxKind::CaseKeyword ? parseCaseClause() : parseDefaultClause(); +// } +// +// function parseCaseBlock(): CaseBlock { +// const pos = getNodePos(); +// parseExpected(SyntaxKind::OpenBraceToken); +// const clauses = parseList(ParsingContext.SwitchClauses, parseCaseOrDefaultClause); +// parseExpected(SyntaxKind::CloseBraceToken); +// return finishNode(factory.createCaseBlock(clauses), pos); +// } +// +// function parseSwitchStatement(): SwitchStatement { +// const pos = getNodePos(); +// const hasJSDoc = hasPrecedingJSDocComment(); +// parseExpected(SyntaxKind::SwitchKeyword); +// parseExpected(SyntaxKind::OpenParenToken); +// const expression = allowInAnd(parseExpression); +// parseExpected(SyntaxKind::CloseParenToken); +// const caseBlock = parseCaseBlock(); +// return withJSDoc(finishNode(factory.createSwitchStatement(expression, caseBlock), pos), hasJSDoc); +// } +// +// function parseThrowStatement(): ThrowStatement { +// // ThrowStatement[Yield] : +// // throw [no LineTerminator here]Expression[In, ?Yield]; +// +// const pos = getNodePos(); +// const hasJSDoc = hasPrecedingJSDocComment(); +// parseExpected(SyntaxKind::ThrowKeyword); +// +// // Because of automatic semicolon insertion, we need to report error if this +// // throw could be terminated with a semicolon. Note: we can't call 'parseExpression' +// // directly as that might consume an expression on the following line. +// // Instead, we create a "missing" identifier, but don't report an error. The actual error +// // will be reported in the grammar walker. +// let expression = scanner.hasPrecedingLineBreak() ? undefined : allowInAnd(parseExpression); +// if (expression == undefined) { +// identifierCount++; +// expression = finishNode(factory.createIdentifier(""), getNodePos()); +// } +// if (!tryParseSemicolon()) { +// parseErrorForMissingSemicolonAfter(expression); +// } +// return withJSDoc(finishNode(factory.createThrowStatement(expression), pos), hasJSDoc); +// } +// +// // TODO: Review for error recovery +// function parseTryStatement(): TryStatement { +// const pos = getNodePos(); +// const hasJSDoc = hasPrecedingJSDocComment(); +// +// parseExpected(SyntaxKind::TryKeyword); +// const tryBlock = parseBlock(/*ignoreMissingOpenBrace*/ false); +// const catchClause = token() == SyntaxKind::CatchKeyword ? parseCatchClause() : undefined; +// +// // If we don't have a catch clause, then we must have a finally clause. Try to parse +// // one out no matter what. +// let finallyBlock: Block | undefined; +// if (!catchClause || token() == SyntaxKind::FinallyKeyword) { +// parseExpected(SyntaxKind::FinallyKeyword, Diagnostics.catch_or_finally_expected); +// finallyBlock = parseBlock(/*ignoreMissingOpenBrace*/ false); +// } +// +// return withJSDoc(finishNode(factory.createTryStatement(tryBlock, catchClause, finallyBlock), pos), hasJSDoc); +// } +// +// function parseCatchClause(): CatchClause { +// const pos = getNodePos(); +// parseExpected(SyntaxKind::CatchKeyword); +// +// let variableDeclaration; +// if (parseOptional(SyntaxKind::OpenParenToken)) { +// variableDeclaration = parseVariableDeclaration(); +// parseExpected(SyntaxKind::CloseParenToken); +// } +// else { +// // Keep shape of node to avoid degrading performance. +// variableDeclaration = undefined; +// } +// +// const block = parseBlock(/*ignoreMissingOpenBrace*/ false); +// return finishNode(factory.createCatchClause(variableDeclaration, block), pos); +// } +// +// function parseDebuggerStatement(): Statement { +// const pos = getNodePos(); +// const hasJSDoc = hasPrecedingJSDocComment(); +// parseExpected(SyntaxKind::DebuggerKeyword); +// parseSemicolon(); +// return withJSDoc(finishNode(factory.createDebuggerStatement(), pos), hasJSDoc); +// } +// +// function parseExpressionOrLabeledStatement(): ExpressionStatement | LabeledStatement { +// // Avoiding having to do the lookahead for a labeled statement by just trying to parse +// // out an expression, seeing if it is identifier and then seeing if it is followed by +// // a colon. +// const pos = getNodePos(); +// let hasJSDoc = hasPrecedingJSDocComment(); +// let node: ExpressionStatement | LabeledStatement; +// const hasParen = token() == SyntaxKind::OpenParenToken; +// const expression = allowInAnd(parseExpression); +// if (ts.isIdentifier(expression) && parseOptional(SyntaxKind::ColonToken)) { +// node = factory.createLabeledStatement(expression, parseStatement()); +// } +// else { +// if (!tryParseSemicolon()) { +// parseErrorForMissingSemicolonAfter(expression); +// } +// node = factory.createExpressionStatement(expression); +// if (hasParen) { +// // do not parse the same jsdoc twice +// hasJSDoc = false; +// } +// } +// return withJSDoc(finishNode(node, pos), hasJSDoc); +// } +// +// function nextTokenIsIdentifierOrKeywordOnSameLine() { +// nextToken(); +// return tokenIsIdentifierOrKeyword(token()) && !scanner.hasPrecedingLineBreak(); +// } +// +// function nextTokenIsClassKeywordOnSameLine() { +// nextToken(); +// return token() == SyntaxKind::ClassKeyword && !scanner.hasPrecedingLineBreak(); +// } +// +// function nextTokenIsFunctionKeywordOnSameLine() { +// nextToken(); +// return token() == SyntaxKind::FunctionKeyword && !scanner.hasPrecedingLineBreak(); +// } +// +// function nextTokenIsIdentifierOrKeywordOrLiteralOnSameLine() { +// nextToken(); +// return (tokenIsIdentifierOrKeyword(token()) || token() == SyntaxKind::NumericLiteral || token() == SyntaxKind::BigIntLiteral || token() == SyntaxKind::StringLiteral) && !scanner.hasPrecedingLineBreak(); +// } +// +// function isDeclaration(): boolean { +// while (true) { +// switch (token()) { +// case SyntaxKind::VarKeyword: +// case SyntaxKind::LetKeyword: +// case SyntaxKind::ConstKeyword: +// case SyntaxKind::FunctionKeyword: +// case SyntaxKind::ClassKeyword: +// case SyntaxKind::EnumKeyword: +// return true; +// +// // 'declare', 'module', 'namespace', 'interface'* and 'type' are all legal JavaScript identifiers; +// // however, an identifier cannot be followed by another identifier on the same line. This is what we +// // count on to parse out the respective declarations. For instance, we exploit this to say that +// // +// // namespace n +// // +// // can be none other than the beginning of a namespace declaration, but need to respect that JavaScript sees +// // +// // namespace +// // n +// // +// // as the identifier 'namespace' on one line followed by the identifier 'n' on another. +// // We need to look one token ahead to see if it permissible to try parsing a declaration. +// // +// // *Note*: 'interface' is actually a strict mode reserved word. So while +// // +// // "use strict" +// // interface +// // I {} +// // +// // could be legal, it would add complexity for very little gain. +// case SyntaxKind::InterfaceKeyword: +// case SyntaxKind::TypeKeyword: +// return nextTokenIsIdentifierOnSameLine(); +// case SyntaxKind::ModuleKeyword: +// case SyntaxKind::NamespaceKeyword: +// return nextTokenIsIdentifierOrStringLiteralOnSameLine(); +// case SyntaxKind::AbstractKeyword: +// case SyntaxKind::AsyncKeyword: +// case SyntaxKind::DeclareKeyword: +// case SyntaxKind::PrivateKeyword: +// case SyntaxKind::ProtectedKeyword: +// case SyntaxKind::PublicKeyword: +// case SyntaxKind::ReadonlyKeyword: +// nextToken(); +// // ASI takes effect for this modifier. +// if (scanner.hasPrecedingLineBreak()) { +// return false; +// } +// continue; +// +// case SyntaxKind::GlobalKeyword: +// nextToken(); +// return token() == SyntaxKind::OpenBraceToken || token() == SyntaxKind::Identifier || token() == SyntaxKind::ExportKeyword; +// +// case SyntaxKind::ImportKeyword: +// nextToken(); +// return token() == SyntaxKind::StringLiteral || token() == SyntaxKind::AsteriskToken || +// token() == SyntaxKind::OpenBraceToken || tokenIsIdentifierOrKeyword(token()); +// case SyntaxKind::ExportKeyword: +// let currentToken = nextToken(); +// if (currentToken == SyntaxKind::TypeKeyword) { +// currentToken = lookAhead(nextToken); +// } +// if (currentToken == SyntaxKind::EqualsToken || currentToken == SyntaxKind::AsteriskToken || +// currentToken == SyntaxKind::OpenBraceToken || currentToken == SyntaxKind::DefaultKeyword || +// currentToken == SyntaxKind::AsKeyword) { +// return true; +// } +// continue; +// +// case SyntaxKind::StaticKeyword: +// nextToken(); +// continue; +// default: +// return false; +// } +// } +// } +// +// function isStartOfDeclaration(): boolean { +// return lookAhead(isDeclaration); +// } +// +// function isStartOfStatement(): boolean { +// switch (token()) { +// case SyntaxKind::AtToken: +// case SyntaxKind::SemicolonToken: +// case SyntaxKind::OpenBraceToken: +// case SyntaxKind::VarKeyword: +// case SyntaxKind::LetKeyword: +// case SyntaxKind::FunctionKeyword: +// case SyntaxKind::ClassKeyword: +// case SyntaxKind::EnumKeyword: +// case SyntaxKind::IfKeyword: +// case SyntaxKind::DoKeyword: +// case SyntaxKind::WhileKeyword: +// case SyntaxKind::ForKeyword: +// case SyntaxKind::ContinueKeyword: +// case SyntaxKind::BreakKeyword: +// case SyntaxKind::ReturnKeyword: +// case SyntaxKind::WithKeyword: +// case SyntaxKind::SwitchKeyword: +// case SyntaxKind::ThrowKeyword: +// case SyntaxKind::TryKeyword: +// case SyntaxKind::DebuggerKeyword: +// // 'catch' and 'finally' do not actually indicate that the code is part of a statement, +// // however, we say they are here so that we may gracefully parse them and error later. +// // falls through +// case SyntaxKind::CatchKeyword: +// case SyntaxKind::FinallyKeyword: +// return true; +// +// case SyntaxKind::ImportKeyword: +// return isStartOfDeclaration() || lookAhead(nextTokenIsOpenParenOrLessThanOrDot); +// +// case SyntaxKind::ConstKeyword: +// case SyntaxKind::ExportKeyword: +// return isStartOfDeclaration(); +// +// case SyntaxKind::AsyncKeyword: +// case SyntaxKind::DeclareKeyword: +// case SyntaxKind::InterfaceKeyword: +// case SyntaxKind::ModuleKeyword: +// case SyntaxKind::NamespaceKeyword: +// case SyntaxKind::TypeKeyword: +// case SyntaxKind::GlobalKeyword: +// // When these don't start a declaration, they're an identifier in an expression statement +// return true; +// +// case SyntaxKind::PublicKeyword: +// case SyntaxKind::PrivateKeyword: +// case SyntaxKind::ProtectedKeyword: +// case SyntaxKind::StaticKeyword: +// case SyntaxKind::ReadonlyKeyword: +// // When these don't start a declaration, they may be the start of a class member if an identifier +// // immediately follows. Otherwise they're an identifier in an expression statement. +// return isStartOfDeclaration() || !lookAhead(nextTokenIsIdentifierOrKeywordOnSameLine); +// +// default: +// return isStartOfExpression(); +// } +// } +// +// function nextTokenIsBindingIdentifierOrStartOfDestructuring() { +// nextToken(); +// return isBindingIdentifier() || token() == SyntaxKind::OpenBraceToken || token() == SyntaxKind::OpenBracketToken; +// } +// +// function isLetDeclaration() { +// // In ES6 'let' always starts a lexical declaration if followed by an identifier or { +// // or [. +// return lookAhead(nextTokenIsBindingIdentifierOrStartOfDestructuring); +// } +// +// function parseStatement(): Statement { +// switch (token()) { +// case SyntaxKind::SemicolonToken: +// return parseEmptyStatement(); +// case SyntaxKind::OpenBraceToken: +// return parseBlock(/*ignoreMissingOpenBrace*/ false); +// case SyntaxKind::VarKeyword: +// return parseVariableStatement(getNodePos(), hasPrecedingJSDocComment(), /*decorators*/ undefined, /*modifiers*/ undefined); +// case SyntaxKind::LetKeyword: +// if (isLetDeclaration()) { +// return parseVariableStatement(getNodePos(), hasPrecedingJSDocComment(), /*decorators*/ undefined, /*modifiers*/ undefined); +// } +// break; +// case SyntaxKind::FunctionKeyword: +// return parseFunctionDeclaration(getNodePos(), hasPrecedingJSDocComment(), /*decorators*/ undefined, /*modifiers*/ undefined); +// case SyntaxKind::ClassKeyword: +// return parseClassDeclaration(getNodePos(), hasPrecedingJSDocComment(), /*decorators*/ undefined, /*modifiers*/ undefined); +// case SyntaxKind::IfKeyword: +// return parseIfStatement(); +// case SyntaxKind::DoKeyword: +// return parseDoStatement(); +// case SyntaxKind::WhileKeyword: +// return parseWhileStatement(); +// case SyntaxKind::ForKeyword: +// return parseForOrForInOrForOfStatement(); +// case SyntaxKind::ContinueKeyword: +// return parseBreakOrContinueStatement(SyntaxKind::ContinueStatement); +// case SyntaxKind::BreakKeyword: +// return parseBreakOrContinueStatement(SyntaxKind::BreakStatement); +// case SyntaxKind::ReturnKeyword: +// return parseReturnStatement(); +// case SyntaxKind::WithKeyword: +// return parseWithStatement(); +// case SyntaxKind::SwitchKeyword: +// return parseSwitchStatement(); +// case SyntaxKind::ThrowKeyword: +// return parseThrowStatement(); +// case SyntaxKind::TryKeyword: +// // Include 'catch' and 'finally' for error recovery. +// // falls through +// case SyntaxKind::CatchKeyword: +// case SyntaxKind::FinallyKeyword: +// return parseTryStatement(); +// case SyntaxKind::DebuggerKeyword: +// return parseDebuggerStatement(); +// case SyntaxKind::AtToken: +// return parseDeclaration(); +// case SyntaxKind::AsyncKeyword: +// case SyntaxKind::InterfaceKeyword: +// case SyntaxKind::TypeKeyword: +// case SyntaxKind::ModuleKeyword: +// case SyntaxKind::NamespaceKeyword: +// case SyntaxKind::DeclareKeyword: +// case SyntaxKind::ConstKeyword: +// case SyntaxKind::EnumKeyword: +// case SyntaxKind::ExportKeyword: +// case SyntaxKind::ImportKeyword: +// case SyntaxKind::PrivateKeyword: +// case SyntaxKind::ProtectedKeyword: +// case SyntaxKind::PublicKeyword: +// case SyntaxKind::AbstractKeyword: +// case SyntaxKind::StaticKeyword: +// case SyntaxKind::ReadonlyKeyword: +// case SyntaxKind::GlobalKeyword: +// if (isStartOfDeclaration()) { +// return parseDeclaration(); +// } +// break; +// } +// return parseExpressionOrLabeledStatement(); +// } +// +// function isDeclareModifier(modifier: Modifier) { +// return modifier.kind == SyntaxKind::DeclareKeyword; +// } +// +// function parseDeclaration(): Statement { +// // TODO: Can we hold onto the parsed decorators/modifiers and advance the scanner +// // if we can't reuse the declaration, so that we don't do this work twice? +// // +// // `parseListElement` attempted to get the reused node at this position, +// // but the ambient context flag was not yet set, so the node appeared +// // not reusable in that context. +// const isAmbient = some(lookAhead(() => (parseDecorators(), parseModifiers())), isDeclareModifier); +// if (isAmbient) { +// const node = tryReuseAmbientDeclaration(); +// if (node) { +// return node; +// } +// } +// +// const pos = getNodePos(); +// const hasJSDoc = hasPrecedingJSDocComment(); +// const decorators = parseDecorators(); +// const modifiers = parseModifiers(); +// if (isAmbient) { +// for (const m of modifiers!) { +// (m as Mutable).flags |= NodeFlags::Ambient; +// } +// return doInsideOfContext(NodeFlags::Ambient, () => parseDeclarationWorker(pos, hasJSDoc, decorators, modifiers)); +// } +// else { +// return parseDeclarationWorker(pos, hasJSDoc, decorators, modifiers); +// } +// } +// +// function tryReuseAmbientDeclaration(): Statement | undefined { +// return doInsideOfContext(NodeFlags::Ambient, () => { +// const node = currentNode(parsingContext); +// if (node) { +// return consumeNode(node) as Statement; +// } +// }); +// } +// +// function parseDeclarationWorker(pos: number, hasJSDoc: boolean, decorators: NodeArray | undefined, modifiers: NodeArray | undefined): Statement { +// switch (token()) { +// case SyntaxKind::VarKeyword: +// case SyntaxKind::LetKeyword: +// case SyntaxKind::ConstKeyword: +// return parseVariableStatement(pos, hasJSDoc, decorators, modifiers); +// case SyntaxKind::FunctionKeyword: +// return parseFunctionDeclaration(pos, hasJSDoc, decorators, modifiers); +// case SyntaxKind::ClassKeyword: +// return parseClassDeclaration(pos, hasJSDoc, decorators, modifiers); +// case SyntaxKind::InterfaceKeyword: +// return parseInterfaceDeclaration(pos, hasJSDoc, decorators, modifiers); +// case SyntaxKind::TypeKeyword: +// return parseTypeAliasDeclaration(pos, hasJSDoc, decorators, modifiers); +// case SyntaxKind::EnumKeyword: +// return parseEnumDeclaration(pos, hasJSDoc, decorators, modifiers); +// case SyntaxKind::GlobalKeyword: +// case SyntaxKind::ModuleKeyword: +// case SyntaxKind::NamespaceKeyword: +// return parseModuleDeclaration(pos, hasJSDoc, decorators, modifiers); +// case SyntaxKind::ImportKeyword: +// return parseImportDeclarationOrImportEqualsDeclaration(pos, hasJSDoc, decorators, modifiers); +// case SyntaxKind::ExportKeyword: +// nextToken(); +// switch (token()) { +// case SyntaxKind::DefaultKeyword: +// case SyntaxKind::EqualsToken: +// return parseExportAssignment(pos, hasJSDoc, decorators, modifiers); +// case SyntaxKind::AsKeyword: +// return parseNamespaceExportDeclaration(pos, hasJSDoc, decorators, modifiers); +// default: +// return parseExportDeclaration(pos, hasJSDoc, decorators, modifiers); +// } +// default: +// if (decorators || modifiers) { +// // We reached this point because we encountered decorators and/or modifiers and assumed a declaration +// // would follow. For recovery and error reporting purposes, return an incomplete declaration. +// const missing = createMissingNode(SyntaxKind::MissingDeclaration, /*reportAtCurrentPosition*/ true, Diagnostics.Declaration_expected); +// setTextRangePos(missing, pos); +// missing.decorators = decorators; +// missing.modifiers = modifiers; +// return missing; +// } +// return undefined!; // TODO: GH#18217 +// } +// } +// +// function nextTokenIsIdentifierOrStringLiteralOnSameLine() { +// nextToken(); +// return !scanner.hasPrecedingLineBreak() && (isIdentifier() || token() == SyntaxKind::StringLiteral); +// } +// +// function parseFunctionBlockOrSemicolon(flags: SignatureFlags, diagnosticMessage?: DiagnosticMessage): Block | undefined { +// if (token() !== SyntaxKind::OpenBraceToken && canParseSemicolon()) { +// parseSemicolon(); +// return; +// } +// +// return parseFunctionBlock(flags, diagnosticMessage); +// } +// +// // DECLARATIONS +// +// function parseArrayBindingElement(): ArrayBindingElement { +// const pos = getNodePos(); +// if (token() == SyntaxKind::CommaToken) { +// return finishNode(factory.createOmittedExpression(), pos); +// } +// const dotDotDotToken = parseOptionalToken(SyntaxKind::DotDotDotToken); +// const name = parseIdentifierOrPattern(); +// const initializer = parseInitializer(); +// return finishNode(factory.createBindingElement(dotDotDotToken, /*propertyName*/ undefined, name, initializer), pos); +// } +// +// function parseObjectBindingElement(): BindingElement { +// const pos = getNodePos(); +// const dotDotDotToken = parseOptionalToken(SyntaxKind::DotDotDotToken); +// const tokenIsIdentifier = isBindingIdentifier(); +// let propertyName: PropertyName | undefined = parsePropertyName(); +// let name: BindingName; +// if (tokenIsIdentifier && token() !== SyntaxKind::ColonToken) { +// name = propertyName as Identifier; +// propertyName = undefined; +// } +// else { +// parseExpected(SyntaxKind::ColonToken); +// name = parseIdentifierOrPattern(); +// } +// const initializer = parseInitializer(); +// return finishNode(factory.createBindingElement(dotDotDotToken, propertyName, name, initializer), pos); +// } +// +// function parseObjectBindingPattern(): ObjectBindingPattern { +// const pos = getNodePos(); +// parseExpected(SyntaxKind::OpenBraceToken); +// const elements = parseDelimitedList(ParsingContext.ObjectBindingElements, parseObjectBindingElement); +// parseExpected(SyntaxKind::CloseBraceToken); +// return finishNode(factory.createObjectBindingPattern(elements), pos); +// } +// +// function parseArrayBindingPattern(): ArrayBindingPattern { +// const pos = getNodePos(); +// parseExpected(SyntaxKind::OpenBracketToken); +// const elements = parseDelimitedList(ParsingContext.ArrayBindingElements, parseArrayBindingElement); +// parseExpected(SyntaxKind::CloseBracketToken); +// return finishNode(factory.createArrayBindingPattern(elements), pos); +// } +// +// function isBindingIdentifierOrPrivateIdentifierOrPattern() { +// return token() == SyntaxKind::OpenBraceToken +// || token() == SyntaxKind::OpenBracketToken +// || token() == SyntaxKind::PrivateIdentifier +// || isBindingIdentifier(); +// } +// +// function parseIdentifierOrPattern(privateIdentifierDiagnosticMessage?: DiagnosticMessage): Identifier | BindingPattern { +// if (token() == SyntaxKind::OpenBracketToken) { +// return parseArrayBindingPattern(); +// } +// if (token() == SyntaxKind::OpenBraceToken) { +// return parseObjectBindingPattern(); +// } +// return parseBindingIdentifier(privateIdentifierDiagnosticMessage); +// } +// +// function parseVariableDeclarationAllowExclamation() { +// return parseVariableDeclaration(/*allowExclamation*/ true); +// } +// +// function parseVariableDeclaration(allowExclamation?: boolean): VariableDeclaration { +// const pos = getNodePos(); +// const hasJSDoc = hasPrecedingJSDocComment(); +// const name = parseIdentifierOrPattern(Diagnostics.Private_identifiers_are_not_allowed_in_variable_declarations); +// let exclamationToken: ExclamationToken | undefined; +// if (allowExclamation && name.kind == SyntaxKind::Identifier && +// token() == SyntaxKind::ExclamationToken && !scanner.hasPrecedingLineBreak()) { +// exclamationToken = parseTokenNode>(); +// } +// const type = parseTypeAnnotation(); +// const initializer = isInOrOfKeyword(token()) ? undefined : parseInitializer(); +// const node = factory.createVariableDeclaration(name, exclamationToken, type, initializer); +// return withJSDoc(finishNode(node, pos), hasJSDoc); +// } +// +// function parseVariableDeclarationList(inForStatementInitializer: boolean): VariableDeclarationList { +// const pos = getNodePos(); +// +// let flags: NodeFlags = 0; +// switch (token()) { +// case SyntaxKind::VarKeyword: +// break; +// case SyntaxKind::LetKeyword: +// flags |= NodeFlags::Let; +// break; +// case SyntaxKind::ConstKeyword: +// flags |= NodeFlags::Const; +// break; +// default: +// Debug.fail(); +// } +// +// nextToken(); +// +// // The user may have written the following: +// // +// // for (let of X) { } +// // +// // In this case, we want to parse an empty declaration list, and then parse 'of' +// // as a keyword. The reason this is not automatic is that 'of' is a valid identifier. +// // So we need to look ahead to determine if 'of' should be treated as a keyword in +// // this context. +// // The checker will then give an error that there is an empty declaration list. +// let declarations: readonly VariableDeclaration[]; +// if (token() == SyntaxKind::OfKeyword && lookAhead(canFollowContextualOfKeyword)) { +// declarations = createMissingList(); +// } +// else { +// const savedDisallowIn = inDisallowInContext(); +// setDisallowInContext(inForStatementInitializer); +// +// declarations = parseDelimitedList(ParsingContext.VariableDeclarations, +// inForStatementInitializer ? parseVariableDeclaration : parseVariableDeclarationAllowExclamation); +// +// setDisallowInContext(savedDisallowIn); +// } +// +// return finishNode(factory.createVariableDeclarationList(declarations, flags), pos); +// } +// +// function canFollowContextualOfKeyword(): boolean { +// return nextTokenIsIdentifier() && nextToken() == SyntaxKind::CloseParenToken; +// } +// +// function parseVariableStatement(pos: number, hasJSDoc: boolean, decorators: NodeArray | undefined, modifiers: NodeArray | undefined): VariableStatement { +// const declarationList = parseVariableDeclarationList(/*inForStatementInitializer*/ false); +// parseSemicolon(); +// const node = factory.createVariableStatement(modifiers, declarationList); +// // Decorators are not allowed on a variable statement, so we keep track of them to report them in the grammar checker. +// node.decorators = decorators; +// return withJSDoc(finishNode(node, pos), hasJSDoc); +// } +// +// function parseFunctionDeclaration(pos: number, hasJSDoc: boolean, decorators: NodeArray | undefined, modifiers: NodeArray | undefined): FunctionDeclaration { +// const savedAwaitContext = inAwaitContext(); +// +// const modifierFlags = modifiersToFlags(modifiers); +// parseExpected(SyntaxKind::FunctionKeyword); +// const asteriskToken = parseOptionalToken(SyntaxKind::AsteriskToken); +// // We don't parse the name here in await context, instead we will report a grammar error in the checker. +// const name = modifierFlags & ModifierFlags.Default ? parseOptionalBindingIdentifier() : parseBindingIdentifier(); +// const isGenerator = asteriskToken ? SignatureFlags.Yield : SignatureFlags.None; +// const isAsync = modifierFlags & ModifierFlags.Async ? SignatureFlags.Await : SignatureFlags.None; +// const typeParameters = parseTypeParameters(); +// if (modifierFlags & ModifierFlags.Export) setAwaitContext(/*value*/ true); +// const parameters = parseParameters(isGenerator | isAsync); +// const type = parseReturnType(SyntaxKind::ColonToken, /*isType*/ false); +// const body = parseFunctionBlockOrSemicolon(isGenerator | isAsync, Diagnostics.or_expected); +// setAwaitContext(savedAwaitContext); +// const node = factory.createFunctionDeclaration(decorators, modifiers, asteriskToken, name, typeParameters, parameters, type, body); +// return withJSDoc(finishNode(node, pos), hasJSDoc); +// } +// +// function parseConstructorName() { +// if (token() == SyntaxKind::ConstructorKeyword) { +// return parseExpected(SyntaxKind::ConstructorKeyword); +// } +// if (token() == SyntaxKind::StringLiteral && lookAhead(nextToken) == SyntaxKind::OpenParenToken) { +// return tryParse(() => { +// const literalNode = parseLiteralNode(); +// return literalNode.text == "constructor" ? literalNode : undefined; +// }); +// } +// } +// +// function tryParseConstructorDeclaration(pos: number, hasJSDoc: boolean, decorators: NodeArray | undefined, modifiers: NodeArray | undefined): ConstructorDeclaration | undefined { +// return tryParse(() => { +// if (parseConstructorName()) { +// const typeParameters = parseTypeParameters(); +// const parameters = parseParameters(SignatureFlags.None); +// const type = parseReturnType(SyntaxKind::ColonToken, /*isType*/ false); +// const body = parseFunctionBlockOrSemicolon(SignatureFlags.None, Diagnostics.or_expected); +// const node = factory.createConstructorDeclaration(decorators, modifiers, parameters, body); +// // Attach `typeParameters` and `type` if they exist so that we can report them in the grammar checker. +// node.typeParameters = typeParameters; +// node.type = type; +// return withJSDoc(finishNode(node, pos), hasJSDoc); +// } +// }); +// } +// +// function parseMethodDeclaration( +// pos: number, +// hasJSDoc: boolean, +// decorators: NodeArray | undefined, +// modifiers: NodeArray | undefined, +// asteriskToken: AsteriskToken | undefined, +// name: PropertyName, +// questionToken: QuestionToken | undefined, +// exclamationToken: ExclamationToken | undefined, +// diagnosticMessage?: DiagnosticMessage +// ): MethodDeclaration { +// const isGenerator = asteriskToken ? SignatureFlags.Yield : SignatureFlags.None; +// const isAsync = some(modifiers, isAsyncModifier) ? SignatureFlags.Await : SignatureFlags.None; +// const typeParameters = parseTypeParameters(); +// const parameters = parseParameters(isGenerator | isAsync); +// const type = parseReturnType(SyntaxKind::ColonToken, /*isType*/ false); +// const body = parseFunctionBlockOrSemicolon(isGenerator | isAsync, diagnosticMessage); +// const node = factory.createMethodDeclaration( +// decorators, +// modifiers, +// asteriskToken, +// name, +// questionToken, +// typeParameters, +// parameters, +// type, +// body +// ); +// // An exclamation token on a method is invalid syntax and will be handled by the grammar checker +// node.exclamationToken = exclamationToken; +// return withJSDoc(finishNode(node, pos), hasJSDoc); +// } +// +// function parsePropertyDeclaration( +// pos: number, +// hasJSDoc: boolean, +// decorators: NodeArray | undefined, +// modifiers: NodeArray | undefined, +// name: PropertyName, +// questionToken: QuestionToken | undefined +// ): PropertyDeclaration { +// const exclamationToken = !questionToken && !scanner.hasPrecedingLineBreak() ? parseOptionalToken(SyntaxKind::ExclamationToken) : undefined; +// const type = parseTypeAnnotation(); +// const initializer = doOutsideOfContext(NodeFlags::YieldContext | NodeFlags::AwaitContext | NodeFlags::DisallowInContext, parseInitializer); +// parseSemicolonAfterPropertyName(name, type, initializer); +// const node = factory.createPropertyDeclaration(decorators, modifiers, name, questionToken || exclamationToken, type, initializer); +// return withJSDoc(finishNode(node, pos), hasJSDoc); +// } +// +// function parsePropertyOrMethodDeclaration( +// pos: number, +// hasJSDoc: boolean, +// decorators: NodeArray | undefined, +// modifiers: NodeArray | undefined +// ): PropertyDeclaration | MethodDeclaration { +// const asteriskToken = parseOptionalToken(SyntaxKind::AsteriskToken); +// const name = parsePropertyName(); +// // Note: this is not legal as per the grammar. But we allow it in the parser and +// // report an error in the grammar checker. +// const questionToken = parseOptionalToken(SyntaxKind::QuestionToken); +// if (asteriskToken || token() == SyntaxKind::OpenParenToken || token() == SyntaxKind::LessThanToken) { +// return parseMethodDeclaration(pos, hasJSDoc, decorators, modifiers, asteriskToken, name, questionToken, /*exclamationToken*/ undefined, Diagnostics.or_expected); +// } +// return parsePropertyDeclaration(pos, hasJSDoc, decorators, modifiers, name, questionToken); +// } +// +// function parseAccessorDeclaration(pos: number, hasJSDoc: boolean, decorators: NodeArray | undefined, modifiers: NodeArray | undefined, kind: AccessorDeclaration["kind"]): AccessorDeclaration { +// const name = parsePropertyName(); +// const typeParameters = parseTypeParameters(); +// const parameters = parseParameters(SignatureFlags.None); +// const type = parseReturnType(SyntaxKind::ColonToken, /*isType*/ false); +// const body = parseFunctionBlockOrSemicolon(SignatureFlags.None); +// const node = kind == SyntaxKind::GetAccessor +// ? factory.createGetAccessorDeclaration(decorators, modifiers, name, parameters, type, body) +// : factory.createSetAccessorDeclaration(decorators, modifiers, name, parameters, body); +// // Keep track of `typeParameters` (for both) and `type` (for setters) if they were parsed those indicate grammar errors +// node.typeParameters = typeParameters; +// if (type && node.kind == SyntaxKind::SetAccessor) reinterpret_cast&>(node).type = type; +// return withJSDoc(finishNode(node, pos), hasJSDoc); +// } +// +// function isClassMemberStart(): boolean { +// let idToken: SyntaxKind | undefined; +// +// if (token() == SyntaxKind::AtToken) { +// return true; +// } +// +// // Eat up all modifiers, but hold on to the last one in case it is actually an identifier. +// while (isModifierKind(token())) { +// idToken = token(); +// // If the idToken is a class modifier (protected, private, public, and static), it is +// // certain that we are starting to parse class member. This allows better error recovery +// // Example: +// // public foo() ... // true +// // public @dec blah ... // true; we will then report an error later +// // export public ... // true; we will then report an error later +// if (isClassMemberModifier(idToken)) { +// return true; +// } +// +// nextToken(); +// } +// +// if (token() == SyntaxKind::AsteriskToken) { +// return true; +// } +// +// // Try to get the first property-like token following all modifiers. +// // This can either be an identifier or the 'get' or 'set' keywords. +// if (isLiteralPropertyName()) { +// idToken = token(); +// nextToken(); +// } +// +// // Index signatures and computed properties are class members; we can parse. +// if (token() == SyntaxKind::OpenBracketToken) { +// return true; +// } +// +// // If we were able to get any potential identifier... +// if (idToken !== undefined) { +// // If we have a non-keyword identifier, or if we have an accessor, then it's safe to parse. +// if (!isKeyword(idToken) || idToken == SyntaxKind::SetKeyword || idToken == SyntaxKind::GetKeyword) { +// return true; +// } +// +// // If it *is* a keyword, but not an accessor, check a little farther along +// // to see if it should actually be parsed as a class member. +// switch (token()) { +// case SyntaxKind::OpenParenToken: // Method declaration +// case SyntaxKind::LessThanToken: // Generic Method declaration +// case SyntaxKind::ExclamationToken: // Non-null assertion on property name +// case SyntaxKind::ColonToken: // Type Annotation for declaration +// case SyntaxKind::EqualsToken: // Initializer for declaration +// case SyntaxKind::QuestionToken: // Not valid, but permitted so that it gets caught later on. +// return true; +// default: +// // Covers +// // - Semicolons (declaration termination) +// // - Closing braces (end-of-class, must be declaration) +// // - End-of-files (not valid, but permitted so that it gets caught later on) +// // - Line-breaks (enabling *automatic semicolon insertion*) +// return canParseSemicolon(); +// } +// } +// +// return false; +// } +// +// function parseClassStaticBlockDeclaration(pos: number, hasJSDoc: boolean, decorators: NodeArray | undefined, modifiers: ModifiersArray | undefined): ClassStaticBlockDeclaration { +// parseExpectedToken(SyntaxKind::StaticKeyword); +// const body = parseClassStaticBlockBody(); +// return withJSDoc(finishNode(factory.createClassStaticBlockDeclaration(decorators, modifiers, body), pos), hasJSDoc); +// } +// +// function parseClassStaticBlockBody() { +// const savedYieldContext = inYieldContext(); +// const savedAwaitContext = inAwaitContext(); +// +// setYieldContext(false); +// setAwaitContext(true); +// +// const body = parseBlock(/*ignoreMissingOpenBrace*/ false); +// +// setYieldContext(savedYieldContext); +// setAwaitContext(savedAwaitContext); +// +// return body; +// } +// +// function parseDecoratorExpression() { +// if (inAwaitContext() && token() == SyntaxKind::AwaitKeyword) { +// // `@await` is is disallowed in an [Await] context, but can cause parsing to go off the rails +// // This simply parses the missing identifier and moves on. +// const pos = getNodePos(); +// const awaitExpression = parseIdentifier(Diagnostics.Expression_expected); +// nextToken(); +// const memberExpression = parseMemberExpressionRest(pos, awaitExpression, /*allowOptionalChain*/ true); +// return parseCallExpressionRest(pos, memberExpression); +// } +// return parseLeftHandSideExpressionOrHigher(); +// } +// +// function tryParseDecorator(): Decorator | undefined { +// const pos = getNodePos(); +// if (!parseOptional(SyntaxKind::AtToken)) { +// return undefined; +// } +// const expression = doInDecoratorContext(parseDecoratorExpression); +// return finishNode(factory.createDecorator(expression), pos); +// } +// +// function parseDecorators(): NodeArray | undefined { +// const pos = getNodePos(); +// let list, decorator; +// while (decorator = tryParseDecorator()) { +// list = append(list, decorator); +// } +// return list && createNodeArray(list, pos); +// } +// +// function tryParseModifier(permitInvalidConstAsModifier?: boolean, stopOnStartOfClassStaticBlock?: boolean, hasSeenStaticModifier?: boolean): Modifier | undefined { +// const pos = getNodePos(); +// const kind = token(); +// +// if (token() == SyntaxKind::ConstKeyword && permitInvalidConstAsModifier) { +// // We need to ensure that any subsequent modifiers appear on the same line +// // so that when 'const' is a standalone declaration, we don't issue an error. +// if (!tryParse(nextTokenIsOnSameLineAndCanFollowModifier)) { +// return undefined; +// } +// } +// else if (stopOnStartOfClassStaticBlock && token() == SyntaxKind::StaticKeyword && lookAhead(nextTokenIsOpenBrace)) { +// return undefined; +// } +// else if (hasSeenStaticModifier && token() == SyntaxKind::StaticKeyword) { +// return undefined; +// } +// else { +// if (!parseAnyContextualModifier()) { +// return undefined; +// } +// } +// +// return finishNode(factory.createToken(kind as Modifier["kind"]), pos); +// } +// +// /* +// * There are situations in which a modifier like 'const' will appear unexpectedly, such as on a class member. +// * In those situations, if we are entirely sure that 'const' is not valid on its own (such as when ASI takes effect +// * and turns it into a standalone declaration), then it is better to parse it and report an error later. +// * +// * In such situations, 'permitInvalidConstAsModifier' should be set to true. +// */ +// function parseModifiers(permitInvalidConstAsModifier?: boolean, stopOnStartOfClassStaticBlock?: boolean): NodeArray | undefined { +// const pos = getNodePos(); +// let list, modifier, hasSeenStatic = false; +// while (modifier = tryParseModifier(permitInvalidConstAsModifier, stopOnStartOfClassStaticBlock, hasSeenStatic)) { +// if (modifier.kind == SyntaxKind::StaticKeyword) hasSeenStatic = true; +// list = append(list, modifier); +// } +// return list && createNodeArray(list, pos); +// } +// +// function parseModifiersForArrowFunction(): NodeArray | undefined { +// let modifiers: NodeArray | undefined; +// if (token() == SyntaxKind::AsyncKeyword) { +// const pos = getNodePos(); +// nextToken(); +// const modifier = finishNode(factory.createToken(SyntaxKind::AsyncKeyword), pos); +// modifiers = createNodeArray([modifier], pos); +// } +// return modifiers; +// } +// +// function parseClassElement(): ClassElement { +// const pos = getNodePos(); +// if (token() == SyntaxKind::SemicolonToken) { +// nextToken(); +// return finishNode(factory.createSemicolonClassElement(), pos); +// } +// +// const hasJSDoc = hasPrecedingJSDocComment(); +// const decorators = parseDecorators(); +// const modifiers = parseModifiers(/*permitInvalidConstAsModifier*/ true, /*stopOnStartOfClassStaticBlock*/ true); +// if (token() == SyntaxKind::StaticKeyword && lookAhead(nextTokenIsOpenBrace)) { +// return parseClassStaticBlockDeclaration(pos, hasJSDoc, decorators, modifiers); +// } +// +// if (parseContextualModifier(SyntaxKind::GetKeyword)) { +// return parseAccessorDeclaration(pos, hasJSDoc, decorators, modifiers, SyntaxKind::GetAccessor); +// } +// +// if (parseContextualModifier(SyntaxKind::SetKeyword)) { +// return parseAccessorDeclaration(pos, hasJSDoc, decorators, modifiers, SyntaxKind::SetAccessor); +// } +// +// if (token() == SyntaxKind::ConstructorKeyword || token() == SyntaxKind::StringLiteral) { +// const constructorDeclaration = tryParseConstructorDeclaration(pos, hasJSDoc, decorators, modifiers); +// if (constructorDeclaration) { +// return constructorDeclaration; +// } +// } +// +// if (isIndexSignature()) { +// return parseIndexSignatureDeclaration(pos, hasJSDoc, decorators, modifiers); +// } +// +// // It is very important that we check this *after* checking indexers because +// // the [ token can start an index signature or a computed property name +// if (tokenIsIdentifierOrKeyword(token()) || +// token() == SyntaxKind::StringLiteral || +// token() == SyntaxKind::NumericLiteral || +// token() == SyntaxKind::AsteriskToken || +// token() == SyntaxKind::OpenBracketToken) { +// const isAmbient = some(modifiers, isDeclareModifier); +// if (isAmbient) { +// for (const m of modifiers!) { +// (m as Mutable).flags |= NodeFlags::Ambient; +// } +// return doInsideOfContext(NodeFlags::Ambient, () => parsePropertyOrMethodDeclaration(pos, hasJSDoc, decorators, modifiers)); +// } +// else { +// return parsePropertyOrMethodDeclaration(pos, hasJSDoc, decorators, modifiers); +// } +// } +// +// if (decorators || modifiers) { +// // treat this as a property declaration with a missing name. +// const name = createMissingNode(SyntaxKind::Identifier, /*reportAtCurrentPosition*/ true, Diagnostics.Declaration_expected); +// return parsePropertyDeclaration(pos, hasJSDoc, decorators, modifiers, name, /*questionToken*/ undefined); +// } +// +// // 'isClassMemberStart' should have hinted not to attempt parsing. +// return Debug.fail("Should not have attempted to parse class member declaration."); +// } +// +// function parseClassExpression(): ClassExpression { +// return parseClassDeclarationOrExpression(getNodePos(), hasPrecedingJSDocComment(), /*decorators*/ undefined, /*modifiers*/ undefined, SyntaxKind::ClassExpression) as ClassExpression; +// } +// +// function parseClassDeclaration(pos: number, hasJSDoc: boolean, decorators: NodeArray | undefined, modifiers: NodeArray | undefined): ClassDeclaration { +// return parseClassDeclarationOrExpression(pos, hasJSDoc, decorators, modifiers, SyntaxKind::ClassDeclaration) as ClassDeclaration; +// } +// +// function parseClassDeclarationOrExpression(pos: number, hasJSDoc: boolean, decorators: NodeArray | undefined, modifiers: NodeArray | undefined, kind: ClassLikeDeclaration["kind"]): ClassLikeDeclaration { +// const savedAwaitContext = inAwaitContext(); +// parseExpected(SyntaxKind::ClassKeyword); +// +// // We don't parse the name here in await context, instead we will report a grammar error in the checker. +// const name = parseNameOfClassDeclarationOrExpression(); +// const typeParameters = parseTypeParameters(); +// if (some(modifiers, isExportModifier)) setAwaitContext(/*value*/ true); +// const heritageClauses = parseHeritageClauses(); +// +// let members; +// if (parseExpected(SyntaxKind::OpenBraceToken)) { +// // ClassTail[Yield,Await] : (Modified) See 14.5 +// // ClassHeritage[?Yield,?Await]opt { ClassBody[?Yield,?Await]opt } +// members = parseClassMembers(); +// parseExpected(SyntaxKind::CloseBraceToken); +// } +// else { +// members = createMissingList(); +// } +// setAwaitContext(savedAwaitContext); +// const node = kind == SyntaxKind::ClassDeclaration +// ? factory.createClassDeclaration(decorators, modifiers, name, typeParameters, heritageClauses, members) +// : factory.createClassExpression(decorators, modifiers, name, typeParameters, heritageClauses, members); +// return withJSDoc(finishNode(node, pos), hasJSDoc); +// } +// +// function parseNameOfClassDeclarationOrExpression(): Identifier | undefined { +// // implements is a future reserved word so +// // 'class implements' might mean either +// // - class expression with omitted name, 'implements' starts heritage clause +// // - class with name 'implements' +// // 'isImplementsClause' helps to disambiguate between these two cases +// return isBindingIdentifier() && !isImplementsClause() +// ? createIdentifier(isBindingIdentifier()) +// : undefined; +// } +// +// function isImplementsClause() { +// return token() == SyntaxKind::ImplementsKeyword && lookAhead(nextTokenIsIdentifierOrKeyword); +// } +// +// function parseHeritageClauses(): NodeArray | undefined { +// // ClassTail[Yield,Await] : (Modified) See 14.5 +// // ClassHeritage[?Yield,?Await]opt { ClassBody[?Yield,?Await]opt } +// +// if (isHeritageClause()) { +// return parseList(ParsingContext.HeritageClauses, parseHeritageClause); +// } +// +// return undefined; +// } +// +// function parseHeritageClause(): HeritageClause { +// const pos = getNodePos(); +// const tok = token(); +// Debug.assert(tok == SyntaxKind::ExtendsKeyword || tok == SyntaxKind::ImplementsKeyword); // isListElement() should ensure this. +// nextToken(); +// const types = parseDelimitedList(ParsingContext.HeritageClauseElement, parseExpressionWithTypeArguments); +// return finishNode(factory.createHeritageClause(tok, types), pos); +// } +// +// function parseExpressionWithTypeArguments(): ExpressionWithTypeArguments { +// const pos = getNodePos(); +// const expression = parseLeftHandSideExpressionOrHigher(); +// if (expression.kind == SyntaxKind::ExpressionWithTypeArguments) { +// return expression as ExpressionWithTypeArguments; +// } +// const typeArguments = tryParseTypeArguments(); +// return finishNode(factory.createExpressionWithTypeArguments(expression, typeArguments), pos); +// } +// +// function tryParseTypeArguments(): NodeArray | undefined { +// return token() == SyntaxKind::LessThanToken ? +// parseBracketedList(ParsingContext.TypeArguments, parseType, SyntaxKind::LessThanToken, SyntaxKind::GreaterThanToken) : undefined; +// } +// +// function isHeritageClause(): boolean { +// return token() == SyntaxKind::ExtendsKeyword || token() == SyntaxKind::ImplementsKeyword; +// } +// +// function parseClassMembers(): NodeArray { +// return parseList(ParsingContext.ClassMembers, parseClassElement); +// } +// +// function parseInterfaceDeclaration(pos: number, hasJSDoc: boolean, decorators: NodeArray | undefined, modifiers: NodeArray | undefined): InterfaceDeclaration { +// parseExpected(SyntaxKind::InterfaceKeyword); +// const name = parseIdentifier(); +// const typeParameters = parseTypeParameters(); +// const heritageClauses = parseHeritageClauses(); +// const members = parseObjectTypeMembers(); +// const node = factory.createInterfaceDeclaration(decorators, modifiers, name, typeParameters, heritageClauses, members); +// return withJSDoc(finishNode(node, pos), hasJSDoc); +// } +// +// function parseTypeAliasDeclaration(pos: number, hasJSDoc: boolean, decorators: NodeArray | undefined, modifiers: NodeArray | undefined): TypeAliasDeclaration { +// parseExpected(SyntaxKind::TypeKeyword); +// const name = parseIdentifier(); +// const typeParameters = parseTypeParameters(); +// parseExpected(SyntaxKind::EqualsToken); +// const type = token() == SyntaxKind::IntrinsicKeyword && tryParse(parseKeywordAndNoDot) || parseType(); +// parseSemicolon(); +// const node = factory.createTypeAliasDeclaration(decorators, modifiers, name, typeParameters, type); +// return withJSDoc(finishNode(node, pos), hasJSDoc); +// } +// +// // In an ambient declaration, the grammar only allows integer literals as initializers. +// // In a non-ambient declaration, the grammar allows uninitialized members only in a +// // ConstantEnumMemberSection, which starts at the beginning of an enum declaration +// // or any time an integer literal initializer is encountered. +// function parseEnumMember(): EnumMember { +// const pos = getNodePos(); +// const hasJSDoc = hasPrecedingJSDocComment(); +// const name = parsePropertyName(); +// const initializer = allowInAnd(parseInitializer); +// return withJSDoc(finishNode(factory.createEnumMember(name, initializer), pos), hasJSDoc); +// } +// +// function parseEnumDeclaration(pos: number, hasJSDoc: boolean, decorators: NodeArray | undefined, modifiers: NodeArray | undefined): EnumDeclaration { +// parseExpected(SyntaxKind::EnumKeyword); +// const name = parseIdentifier(); +// let members; +// if (parseExpected(SyntaxKind::OpenBraceToken)) { +// members = doOutsideOfYieldAndAwaitContext(() => parseDelimitedList(ParsingContext.EnumMembers, parseEnumMember)); +// parseExpected(SyntaxKind::CloseBraceToken); +// } +// else { +// members = createMissingList(); +// } +// const node = factory.createEnumDeclaration(decorators, modifiers, name, members); +// return withJSDoc(finishNode(node, pos), hasJSDoc); +// } +// +// function parseModuleBlock(): ModuleBlock { +// const pos = getNodePos(); +// let statements; +// if (parseExpected(SyntaxKind::OpenBraceToken)) { +// statements = parseList(ParsingContext.BlockStatements, parseStatement); +// parseExpected(SyntaxKind::CloseBraceToken); +// } +// else { +// statements = createMissingList(); +// } +// return finishNode(factory.createModuleBlock(statements), pos); +// } +// +// function parseModuleOrNamespaceDeclaration(pos: number, hasJSDoc: boolean, decorators: NodeArray | undefined, modifiers: NodeArray | undefined, flags: NodeFlags): ModuleDeclaration { +// // If we are parsing a dotted namespace name, we want to +// // propagate the 'Namespace' flag across the names if set. +// const namespaceFlag = flags & NodeFlags::Namespace; +// const name = parseIdentifier(); +// const body = parseOptional(SyntaxKind::DotToken) +// ? parseModuleOrNamespaceDeclaration(getNodePos(), /*hasJSDoc*/ false, /*decorators*/ undefined, /*modifiers*/ undefined, NodeFlags::NestedNamespace | namespaceFlag) as NamespaceDeclaration +// : parseModuleBlock(); +// const node = factory.createModuleDeclaration(decorators, modifiers, name, body, flags); +// return withJSDoc(finishNode(node, pos), hasJSDoc); +// } +// +// function parseAmbientExternalModuleDeclaration(pos: number, hasJSDoc: boolean, decorators: NodeArray | undefined, modifiers: NodeArray | undefined): ModuleDeclaration { +// let flags: NodeFlags = 0; +// let name; +// if (token() == SyntaxKind::GlobalKeyword) { +// // parse 'global' as name of global scope augmentation +// name = parseIdentifier(); +// flags |= NodeFlags::GlobalAugmentation; +// } +// else { +// name = parseLiteralNode() as StringLiteral; +// name.text = internIdentifier(name.text); +// } +// let body: ModuleBlock | undefined; +// if (token() == SyntaxKind::OpenBraceToken) { +// body = parseModuleBlock(); +// } +// else { +// parseSemicolon(); +// } +// const node = factory.createModuleDeclaration(decorators, modifiers, name, body, flags); +// return withJSDoc(finishNode(node, pos), hasJSDoc); +// } +// +// function parseModuleDeclaration(pos: number, hasJSDoc: boolean, decorators: NodeArray | undefined, modifiers: NodeArray | undefined): ModuleDeclaration { +// let flags: NodeFlags = 0; +// if (token() == SyntaxKind::GlobalKeyword) { +// // global augmentation +// return parseAmbientExternalModuleDeclaration(pos, hasJSDoc, decorators, modifiers); +// } +// else if (parseOptional(SyntaxKind::NamespaceKeyword)) { +// flags |= NodeFlags::Namespace; +// } +// else { +// parseExpected(SyntaxKind::ModuleKeyword); +// if (token() == SyntaxKind::StringLiteral) { +// return parseAmbientExternalModuleDeclaration(pos, hasJSDoc, decorators, modifiers); +// } +// } +// return parseModuleOrNamespaceDeclaration(pos, hasJSDoc, decorators, modifiers, flags); +// } +// +// function isExternalModuleReference() { +// return token() == SyntaxKind::RequireKeyword && +// lookAhead(nextTokenIsOpenParen); +// } +// +// function nextTokenIsOpenParen() { +// return nextToken() == SyntaxKind::OpenParenToken; +// } +// +// function nextTokenIsOpenBrace() { +// return nextToken() == SyntaxKind::OpenBraceToken; +// } +// +// function nextTokenIsSlash() { +// return nextToken() == SyntaxKind::SlashToken; +// } +// +// function parseNamespaceExportDeclaration(pos: number, hasJSDoc: boolean, decorators: NodeArray | undefined, modifiers: NodeArray | undefined): NamespaceExportDeclaration { +// parseExpected(SyntaxKind::AsKeyword); +// parseExpected(SyntaxKind::NamespaceKeyword); +// const name = parseIdentifier(); +// parseSemicolon(); +// const node = factory.createNamespaceExportDeclaration(name); +// // NamespaceExportDeclaration nodes cannot have decorators or modifiers, so we attach them here so we can report them in the grammar checker +// node.decorators = decorators; +// node.modifiers = modifiers; +// return withJSDoc(finishNode(node, pos), hasJSDoc); +// } +// +// function parseImportDeclarationOrImportEqualsDeclaration(pos: number, hasJSDoc: boolean, decorators: NodeArray | undefined, modifiers: NodeArray | undefined): ImportEqualsDeclaration | ImportDeclaration { +// parseExpected(SyntaxKind::ImportKeyword); +// +// const afterImportPos = scanner.getStartPos(); +// +// // We don't parse the identifier here in await context, instead we will report a grammar error in the checker. +// let identifier: Identifier | undefined; +// if (isIdentifier()) { +// identifier = parseIdentifier(); +// } +// +// let isTypeOnly = false; +// if (token() !== SyntaxKind::FromKeyword && +// identifier?.escapedText == "type" && +// (isIdentifier() || tokenAfterImportDefinitelyProducesImportDeclaration()) +// ) { +// isTypeOnly = true; +// identifier = isIdentifier() ? parseIdentifier() : undefined; +// } +// +// if (identifier && !tokenAfterImportedIdentifierDefinitelyProducesImportDeclaration()) { +// return parseImportEqualsDeclaration(pos, hasJSDoc, decorators, modifiers, identifier, isTypeOnly); +// } +// +// // ImportDeclaration: +// // import ImportClause from ModuleSpecifier ; +// // import ModuleSpecifier; +// let importClause: ImportClause | undefined; +// if (identifier || // import id +// token() == SyntaxKind::AsteriskToken || // import * +// token() == SyntaxKind::OpenBraceToken // import { +// ) { +// importClause = parseImportClause(identifier, afterImportPos, isTypeOnly); +// parseExpected(SyntaxKind::FromKeyword); +// } +// const moduleSpecifier = parseModuleSpecifier(); +// +// let assertClause: AssertClause | undefined; +// if (token() == SyntaxKind::AssertKeyword && !scanner.hasPrecedingLineBreak()) { +// assertClause = parseAssertClause(); +// } +// +// parseSemicolon(); +// const node = factory.createImportDeclaration(decorators, modifiers, importClause, moduleSpecifier, assertClause); +// return withJSDoc(finishNode(node, pos), hasJSDoc); +// } +// +// function parseAssertEntry() { +// const pos = getNodePos(); +// const name = tokenIsIdentifierOrKeyword(token()) ? parseIdentifierName() : parseLiteralLikeNode(SyntaxKind::StringLiteral) as StringLiteral; +// parseExpected(SyntaxKind::ColonToken); +// const value = parseAssignmentExpressionOrHigher(); +// return finishNode(factory.createAssertEntry(name, value), pos); +// } +// +// function parseAssertClause(skipAssertKeyword?: true) { +// const pos = getNodePos(); +// if (!skipAssertKeyword) { +// parseExpected(SyntaxKind::AssertKeyword); +// } +// const openBracePosition = scanner.getTokenPos(); +// if (parseExpected(SyntaxKind::OpenBraceToken)) { +// const multiLine = scanner.hasPrecedingLineBreak(); +// const elements = parseDelimitedList(ParsingContext.AssertEntries, parseAssertEntry, /*considerSemicolonAsDelimiter*/ true); +// if (!parseExpected(SyntaxKind::CloseBraceToken)) { +// const lastError = lastOrUndefined(parseDiagnostics); +// if (lastError && lastError.code == Diagnostics._0_expected.code) { +// addRelatedInfo( +// lastError, +// createDetachedDiagnostic(fileName, openBracePosition, 1, Diagnostics.The_parser_expected_to_find_a_1_to_match_the_0_token_here, "{", "}") +// ); +// } +// } +// return finishNode(factory.createAssertClause(elements, multiLine), pos); +// } +// else { +// const elements = createNodeArray([], getNodePos(), /*end*/ undefined, /*hasTrailingComma*/ false); +// return finishNode(factory.createAssertClause(elements, /*multiLine*/ false), pos); +// } +// } +// +// function tokenAfterImportDefinitelyProducesImportDeclaration() { +// return token() == SyntaxKind::AsteriskToken || token() == SyntaxKind::OpenBraceToken; +// } +// +// function tokenAfterImportedIdentifierDefinitelyProducesImportDeclaration() { +// // In `import id ___`, the current token decides whether to produce +// // an ImportDeclaration or ImportEqualsDeclaration. +// return token() == SyntaxKind::CommaToken || token() == SyntaxKind::FromKeyword; +// } +// +// function parseImportEqualsDeclaration(pos: number, hasJSDoc: boolean, decorators: NodeArray | undefined, modifiers: NodeArray | undefined, identifier: Identifier, isTypeOnly: boolean): ImportEqualsDeclaration { +// parseExpected(SyntaxKind::EqualsToken); +// const moduleReference = parseModuleReference(); +// parseSemicolon(); +// const node = factory.createImportEqualsDeclaration(decorators, modifiers, isTypeOnly, identifier, moduleReference); +// const finished = withJSDoc(finishNode(node, pos), hasJSDoc); +// return finished; +// } +// +// function parseImportClause(identifier: Identifier | undefined, pos: number, isTypeOnly: boolean) { +// // ImportClause: +// // ImportedDefaultBinding +// // NameSpaceImport +// // NamedImports +// // ImportedDefaultBinding, NameSpaceImport +// // ImportedDefaultBinding, NamedImports +// +// // If there was no default import or if there is comma token after default import +// // parse namespace or named imports +// let namedBindings: NamespaceImport | NamedImports | undefined; +// if (!identifier || +// parseOptional(SyntaxKind::CommaToken)) { +// namedBindings = token() == SyntaxKind::AsteriskToken ? parseNamespaceImport() : parseNamedImportsOrExports(SyntaxKind::NamedImports); +// } +// +// return finishNode(factory.createImportClause(isTypeOnly, identifier, namedBindings), pos); +// } +// +// function parseModuleReference() { +// return isExternalModuleReference() +// ? parseExternalModuleReference() +// : parseEntityName(/*allowReservedWords*/ false); +// } +// +// function parseExternalModuleReference() { +// const pos = getNodePos(); +// parseExpected(SyntaxKind::RequireKeyword); +// parseExpected(SyntaxKind::OpenParenToken); +// const expression = parseModuleSpecifier(); +// parseExpected(SyntaxKind::CloseParenToken); +// return finishNode(factory.createExternalModuleReference(expression), pos); +// } +// +// function parseModuleSpecifier(): Expression { +// if (token() == SyntaxKind::StringLiteral) { +// const result = parseLiteralNode(); +// result.text = internIdentifier(result.text); +// return result; +// } +// else { +// // We allow arbitrary expressions here, even though the grammar only allows string +// // literals. We check to ensure that it is only a string literal later in the grammar +// // check pass. +// return parseExpression(); +// } +// } +// +// function parseNamespaceImport(): NamespaceImport { +// // NameSpaceImport: +// // * as ImportedBinding +// const pos = getNodePos(); +// parseExpected(SyntaxKind::AsteriskToken); +// parseExpected(SyntaxKind::AsKeyword); +// const name = parseIdentifier(); +// return finishNode(factory.createNamespaceImport(name), pos); +// } +// +// function parseNamedImportsOrExports(kind: SyntaxKind::NamedImports): NamedImports; +// function parseNamedImportsOrExports(kind: SyntaxKind::NamedExports): NamedExports; +// function parseNamedImportsOrExports(kind: SyntaxKind): NamedImportsOrExports { +// const pos = getNodePos(); +// +// // NamedImports: +// // { } +// // { ImportsList } +// // { ImportsList, } +// +// // ImportsList: +// // ImportSpecifier +// // ImportsList, ImportSpecifier +// const node = kind == SyntaxKind::NamedImports +// ? factory.createNamedImports(parseBracketedList(ParsingContext.ImportOrExportSpecifiers, parseImportSpecifier, SyntaxKind::OpenBraceToken, SyntaxKind::CloseBraceToken)) +// : factory.createNamedExports(parseBracketedList(ParsingContext.ImportOrExportSpecifiers, parseExportSpecifier, SyntaxKind::OpenBraceToken, SyntaxKind::CloseBraceToken)); +// return finishNode(node, pos); +// } +// +// function parseExportSpecifier() { +// const hasJSDoc = hasPrecedingJSDocComment(); +// return withJSDoc(parseImportOrExportSpecifier(SyntaxKind::ExportSpecifier) as ExportSpecifier, hasJSDoc); +// } +// +// function parseImportSpecifier() { +// return parseImportOrExportSpecifier(SyntaxKind::ImportSpecifier) as ImportSpecifier; +// } +// +// function parseImportOrExportSpecifier(kind: SyntaxKind): ImportOrExportSpecifier { +// const pos = getNodePos(); +// // ImportSpecifier: +// // BindingIdentifier +// // IdentifierName as BindingIdentifier +// // ExportSpecifier: +// // IdentifierName +// // IdentifierName as IdentifierName +// let checkIdentifierIsKeyword = isKeyword(token()) && !isIdentifier(); +// let checkIdentifierStart = scanner.getTokenPos(); +// let checkIdentifierEnd = scanner.getTextPos(); +// let isTypeOnly = false; +// let propertyName: Identifier | undefined; +// let canParseAsKeyword = true; +// let name = parseIdentifierName(); +// if (name.escapedText == "type") { +// // If the first token of an import specifier is 'type', there are a lot of possibilities, +// // especially if we see 'as' afterwards: +// // +// // import { type } from "mod"; - isTypeOnly: false, name: type +// // import { type as } from "mod"; - isTypeOnly: true, name: as +// // import { type as as } from "mod"; - isTypeOnly: false, name: as, propertyName: type +// // import { type as as as } from "mod"; - isTypeOnly: true, name: as, propertyName: as +// if (token() == SyntaxKind::AsKeyword) { +// // { type as ...? } +// const firstAs = parseIdentifierName(); +// if (token() == SyntaxKind::AsKeyword) { +// // { type as as ...? } +// const secondAs = parseIdentifierName(); +// if (tokenIsIdentifierOrKeyword(token())) { +// // { type as as something } +// isTypeOnly = true; +// propertyName = firstAs; +// name = parseNameWithKeywordCheck(); +// canParseAsKeyword = false; +// } +// else { +// // { type as as } +// propertyName = name; +// name = secondAs; +// canParseAsKeyword = false; +// } +// } +// else if (tokenIsIdentifierOrKeyword(token())) { +// // { type as something } +// propertyName = name; +// canParseAsKeyword = false; +// name = parseNameWithKeywordCheck(); +// } +// else { +// // { type as } +// isTypeOnly = true; +// name = firstAs; +// } +// } +// else if (tokenIsIdentifierOrKeyword(token())) { +// // { type something ...? } +// isTypeOnly = true; +// name = parseNameWithKeywordCheck(); +// } +// } +// +// if (canParseAsKeyword && token() == SyntaxKind::AsKeyword) { +// propertyName = name; +// parseExpected(SyntaxKind::AsKeyword); +// name = parseNameWithKeywordCheck(); +// } +// if (kind == SyntaxKind::ImportSpecifier && checkIdentifierIsKeyword) { +// parseErrorAt(checkIdentifierStart, checkIdentifierEnd, Diagnostics.Identifier_expected); +// } +// const node = kind == SyntaxKind::ImportSpecifier +// ? factory.createImportSpecifier(isTypeOnly, propertyName, name) +// : factory.createExportSpecifier(isTypeOnly, propertyName, name); +// return finishNode(node, pos); +// +// function parseNameWithKeywordCheck() { +// checkIdentifierIsKeyword = isKeyword(token()) && !isIdentifier(); +// checkIdentifierStart = scanner.getTokenPos(); +// checkIdentifierEnd = scanner.getTextPos(); +// return parseIdentifierName(); +// } +// } +// +// function parseNamespaceExport(pos: number): NamespaceExport { +// return finishNode(factory.createNamespaceExport(parseIdentifierName()), pos); +// } +// +// function parseExportDeclaration(pos: number, hasJSDoc: boolean, decorators: NodeArray | undefined, modifiers: NodeArray | undefined): ExportDeclaration { +// const savedAwaitContext = inAwaitContext(); +// setAwaitContext(/*value*/ true); +// let exportClause: NamedExportBindings | undefined; +// let moduleSpecifier: Expression | undefined; +// let assertClause: AssertClause | undefined; +// const isTypeOnly = parseOptional(SyntaxKind::TypeKeyword); +// const namespaceExportPos = getNodePos(); +// if (parseOptional(SyntaxKind::AsteriskToken)) { +// if (parseOptional(SyntaxKind::AsKeyword)) { +// exportClause = parseNamespaceExport(namespaceExportPos); +// } +// parseExpected(SyntaxKind::FromKeyword); +// moduleSpecifier = parseModuleSpecifier(); +// } +// else { +// exportClause = parseNamedImportsOrExports(SyntaxKind::NamedExports); +// // It is not uncommon to accidentally omit the 'from' keyword. Additionally, in editing scenarios, +// // the 'from' keyword can be parsed as a named export when the export clause is unterminated (i.e. `export { from "moduleName";`) +// // If we don't have a 'from' keyword, see if we have a string literal such that ASI won't take effect. +// if (token() == SyntaxKind::FromKeyword || (token() == SyntaxKind::StringLiteral && !scanner.hasPrecedingLineBreak())) { +// parseExpected(SyntaxKind::FromKeyword); +// moduleSpecifier = parseModuleSpecifier(); +// } +// } +// if (moduleSpecifier && token() == SyntaxKind::AssertKeyword && !scanner.hasPrecedingLineBreak()) { +// assertClause = parseAssertClause(); +// } +// parseSemicolon(); +// setAwaitContext(savedAwaitContext); +// const node = factory.createExportDeclaration(decorators, modifiers, isTypeOnly, exportClause, moduleSpecifier, assertClause); +// return withJSDoc(finishNode(node, pos), hasJSDoc); +// } +// +// function parseExportAssignment(pos: number, hasJSDoc: boolean, decorators: NodeArray | undefined, modifiers: NodeArray | undefined): ExportAssignment { +// const savedAwaitContext = inAwaitContext(); +// setAwaitContext(/*value*/ true); +// let isExportEquals: boolean | undefined; +// if (parseOptional(SyntaxKind::EqualsToken)) { +// isExportEquals = true; +// } +// else { +// parseExpected(SyntaxKind::DefaultKeyword); +// } +// const expression = parseAssignmentExpressionOrHigher(); +// parseSemicolon(); +// setAwaitContext(savedAwaitContext); +// const node = factory.createExportAssignment(decorators, modifiers, isExportEquals, expression); +// return withJSDoc(finishNode(node, pos), hasJSDoc); +// } +// +// const enum ParsingContext { +// SourceElements, // Elements in source file +// BlockStatements, // Statements in block +// SwitchClauses, // Clauses in switch statement +// SwitchClauseStatements, // Statements in switch clause +// TypeMembers, // Members in interface or type literal +// ClassMembers, // Members in class declaration +// EnumMembers, // Members in enum declaration +// HeritageClauseElement, // Elements in a heritage clause +// VariableDeclarations, // Variable declarations in variable statement +// ObjectBindingElements, // Binding elements in object binding list +// ArrayBindingElements, // Binding elements in array binding list +// ArgumentExpressions, // Expressions in argument list +// ObjectLiteralMembers, // Members in object literal +// JsxAttributes, // Attributes in jsx element +// JsxChildren, // Things between opening and closing JSX tags +// ArrayLiteralMembers, // Members in array literal +// Parameters, // Parameters in parameter list +// JSDocParameters, // JSDoc parameters in parameter list of JSDoc function type +// RestProperties, // Property names in a rest type list +// TypeParameters, // Type parameters in type parameter list +// TypeArguments, // Type arguments in type argument list +// TupleElementTypes, // Element types in tuple element type list +// HeritageClauses, // Heritage clauses for a class or interface declaration. +// ImportOrExportSpecifiers, // Named import clause's import specifier list, +// AssertEntries, // Import entries list. +// Count // Number of parsing contexts +// } +// +// const enum Tristate { +// False, +// True, +// Unknown +// } +// +// export namespace JSDocParser { +// export function parseJSDocTypeExpressionForTests(content: string, start: number | undefined, length: number | undefined): { jsDocTypeExpression: JSDocTypeExpression, diagnostics: Diagnostic[] } | undefined { +// initializeState("file.js", content, ScriptTarget.Latest, /*_syntaxCursor:*/ undefined, ScriptKind.JS); +// scanner.setText(content, start, length); +// currentToken = scanner.scan(); +// const jsDocTypeExpression = parseJSDocTypeExpression(); +// +// const sourceFile = createSourceFile("file.js", ScriptTarget.Latest, ScriptKind.JS, /*isDeclarationFile*/ false, [], factory.createToken(SyntaxKind::EndOfFileToken), NodeFlags::None, noop); +// const diagnostics = attachFileToDiagnostics(parseDiagnostics, sourceFile); +// if (jsDocDiagnostics) { +// sourceFile.jsDocDiagnostics = attachFileToDiagnostics(jsDocDiagnostics, sourceFile); +// } +// +// clearState(); +// +// return jsDocTypeExpression ? { jsDocTypeExpression, diagnostics } : undefined; +// } +// +// // Parses out a JSDoc type expression. +// export function parseJSDocTypeExpression(mayOmitBraces?: boolean): JSDocTypeExpression { +// const pos = getNodePos(); +// const hasBrace = (mayOmitBraces ? parseOptional : parseExpected)(SyntaxKind::OpenBraceToken); +// const type = doInsideOfContext(NodeFlags::JSDoc, parseJSDocType); +// if (!mayOmitBraces || hasBrace) { +// parseExpectedJSDoc(SyntaxKind::CloseBraceToken); +// } +// +// const result = factory.createJSDocTypeExpression(type); +// fixupParentReferences(result); +// return finishNode(result, pos); +// } +// +// export function parseJSDocNameReference(): JSDocNameReference { +// const pos = getNodePos(); +// const hasBrace = parseOptional(SyntaxKind::OpenBraceToken); +// const p2 = getNodePos(); +// let entityName: EntityName | JSDocMemberName = parseEntityName(/* allowReservedWords*/ false); +// while (token() == SyntaxKind::PrivateIdentifier) { +// reScanHashToken(); // rescan #id as # id +// nextTokenJSDoc(); // then skip the # +// entityName = finishNode(factory.createJSDocMemberName(entityName, parseIdentifier()), p2); +// } +// if (hasBrace) { +// parseExpectedJSDoc(SyntaxKind::CloseBraceToken); +// } +// +// const result = factory.createJSDocNameReference(entityName); +// fixupParentReferences(result); +// return finishNode(result, pos); +// } +// +// export function parseIsolatedJSDocComment(content: string, start: number | undefined, length: number | undefined): { jsDoc: JSDoc, diagnostics: Diagnostic[] } | undefined { +// initializeState("", content, ScriptTarget.Latest, /*_syntaxCursor:*/ undefined, ScriptKind.JS); +// const jsDoc = doInsideOfContext(NodeFlags::JSDoc, () => parseJSDocCommentWorker(start, length)); +// +// const sourceFile = { languageVariant: LanguageVariant.Standard, text: content } as SourceFile; +// const diagnostics = attachFileToDiagnostics(parseDiagnostics, sourceFile); +// clearState(); +// +// return jsDoc ? { jsDoc, diagnostics } : undefined; +// } +// +// export function parseJSDocComment(parent: HasJSDoc, start: number, length: number): JSDoc | undefined { +// const saveToken = currentToken; +// const saveParseDiagnosticsLength = parseDiagnostics.length; +// const saveParseErrorBeforeNextFinishedNode = parseErrorBeforeNextFinishedNode; +// +// const comment = doInsideOfContext(NodeFlags::JSDoc, () => parseJSDocCommentWorker(start, length)); +// setParent(comment, parent); +// +// if (contextFlags & NodeFlags::JavaScriptFile) { +// if (!jsDocDiagnostics) { +// jsDocDiagnostics = []; +// } +// jsDocDiagnostics.push(...parseDiagnostics); +// } +// currentToken = saveToken; +// parseDiagnostics.length = saveParseDiagnosticsLength; +// parseErrorBeforeNextFinishedNode = saveParseErrorBeforeNextFinishedNode; +// return comment; +// } +// +// const enum JSDocState { +// BeginningOfLine, +// SawAsterisk, +// SavingComments, +// SavingBackticks, // NOTE: Only used when parsing tag comments +// } +// +// const enum PropertyLikeParse { +// Property = 1 << 0, +// Parameter = 1 << 1, +// CallbackParameter = 1 << 2, +// } +// +// function parseJSDocCommentWorker(start = 0, length: number | undefined): JSDoc | undefined { +// const content = sourceText; +// const end = length == undefined ? content.length : start + length; +// length = end - start; +// +// Debug.assert(start >= 0); +// Debug.assert(start <= end); +// Debug.assert(end <= content.length); +// +// // Check for /** (JSDoc opening part) +// if (!isJSDocLikeText(content, start)) { +// return undefined; +// } +// +// let tags: JSDocTag[]; +// let tagsPos: number; +// let tagsEnd: number; +// let linkEnd: number; +// let commentsPos: number | undefined; +// let comments: string[] = []; +// const parts: JSDocComment[] = []; +// +// // + 3 for leading /**, - 5 in total for /** */ +// return scanner.scanRange(start + 3, length - 5, () => { +// // Initially we can parse out a tag. We also have seen a starting asterisk. +// // This is so that /** * @type */ doesn't parse. +// let state = JSDocState.SawAsterisk; +// let margin: number | undefined; +// // + 4 for leading '/** ' +// // + 1 because the last index of \n is always one index before the first character in the line and coincidentally, if there is no \n before start, it is -1, which is also one index before the first character +// let indent = start - (content.lastIndexOf("\n", start) + 1) + 4; +// function pushComment(text: string) { +// if (!margin) { +// margin = indent; +// } +// comments.push(text); +// indent += text.length; +// } +// +// nextTokenJSDoc(); +// while (parseOptionalJsdoc(SyntaxKind::WhitespaceTrivia)); +// if (parseOptionalJsdoc(SyntaxKind::NewLineTrivia)) { +// state = JSDocState.BeginningOfLine; +// indent = 0; +// } +// loop: while (true) { +// switch (token()) { +// case SyntaxKind::AtToken: +// if (state == JSDocState.BeginningOfLine || state == JSDocState.SawAsterisk) { +// removeTrailingWhitespace(comments); +// if (!commentsPos) commentsPos = getNodePos(); +// addTag(parseTag(indent)); +// // NOTE: According to usejsdoc.org, a tag goes to end of line, except the last tag. +// // Real-world comments may break this rule, so "BeginningOfLine" will not be a real line beginning +// // for malformed examples like `/** @param {string} x @returns {number} the length */` +// state = JSDocState.BeginningOfLine; +// margin = undefined; +// } +// else { +// pushComment(scanner.getTokenText()); +// } +// break; +// case SyntaxKind::NewLineTrivia: +// comments.push(scanner.getTokenText()); +// state = JSDocState.BeginningOfLine; +// indent = 0; +// break; +// case SyntaxKind::AsteriskToken: +// const asterisk = scanner.getTokenText(); +// if (state == JSDocState.SawAsterisk || state == JSDocState.SavingComments) { +// // If we've already seen an asterisk, then we can no longer parse a tag on this line +// state = JSDocState.SavingComments; +// pushComment(asterisk); +// } +// else { +// // Ignore the first asterisk on a line +// state = JSDocState.SawAsterisk; +// indent += asterisk.length; +// } +// break; +// case SyntaxKind::WhitespaceTrivia: +// // only collect whitespace if we're already saving comments or have just crossed the comment indent margin +// const whitespace = scanner.getTokenText(); +// if (state == JSDocState.SavingComments) { +// comments.push(whitespace); +// } +// else if (margin !== undefined && indent + whitespace.length > margin) { +// comments.push(whitespace.slice(margin - indent)); +// } +// indent += whitespace.length; +// break; +// case SyntaxKind::EndOfFileToken: +// break loop; +// case SyntaxKind::OpenBraceToken: +// state = JSDocState.SavingComments; +// const commentEnd = scanner.getStartPos(); +// const linkStart = scanner.getTextPos() - 1; +// const link = parseJSDocLink(linkStart); +// if (link) { +// if (!linkEnd) { +// removeLeadingNewlines(comments); +// } +// parts.push(finishNode(factory.createJSDocText(comments.join("")), linkEnd ?? start, commentEnd)); +// parts.push(link); +// comments = []; +// linkEnd = scanner.getTextPos(); +// break; +// } +// // fallthrough if it's not a {@link sequence +// default: +// // Anything else is doc comment text. We just save it. Because it +// // wasn't a tag, we can no longer parse a tag on this line until we hit the next +// // line break. +// state = JSDocState.SavingComments; +// pushComment(scanner.getTokenText()); +// break; +// } +// nextTokenJSDoc(); +// } +// removeTrailingWhitespace(comments); +// if (parts.length && comments.length) { +// parts.push(finishNode(factory.createJSDocText(comments.join("")), linkEnd ?? start, commentsPos)); +// } +// if (parts.length && tags) Debug.assertIsDefined(commentsPos, "having parsed tags implies that the end of the comment span should be set"); +// const tagsArray = tags && createNodeArray(tags, tagsPos, tagsEnd); +// return finishNode(factory.createJSDocComment(parts.length ? createNodeArray(parts, start, commentsPos) : comments.length ? comments.join("") : undefined, tagsArray), start, end); +// }); +// +// function removeLeadingNewlines(comments: string[]) { +// while (comments.length && (comments[0] == "\n" || comments[0] == "\r")) { +// comments.shift(); +// } +// } +// +// function removeTrailingWhitespace(comments: string[]) { +// while (comments.length && comments[comments.length - 1].trim() == "") { +// comments.pop(); +// } +// } +// +// function isNextNonwhitespaceTokenEndOfFile(): boolean { +// // We must use infinite lookahead, as there could be any number of newlines :( +// while (true) { +// nextTokenJSDoc(); +// if (token() == SyntaxKind::EndOfFileToken) { +// return true; +// } +// if (!(token() == SyntaxKind::WhitespaceTrivia || token() == SyntaxKind::NewLineTrivia)) { +// return false; +// } +// } +// } +// +// function skipWhitespace(): void { +// if (token() == SyntaxKind::WhitespaceTrivia || token() == SyntaxKind::NewLineTrivia) { +// if (lookAhead(isNextNonwhitespaceTokenEndOfFile)) { +// return; // Don't skip whitespace prior to EoF (or end of comment) - that shouldn't be included in any node's range +// } +// } +// while (token() == SyntaxKind::WhitespaceTrivia || token() == SyntaxKind::NewLineTrivia) { +// nextTokenJSDoc(); +// } +// } +// +// function skipWhitespaceOrAsterisk(): string { +// if (token() == SyntaxKind::WhitespaceTrivia || token() == SyntaxKind::NewLineTrivia) { +// if (lookAhead(isNextNonwhitespaceTokenEndOfFile)) { +// return ""; // Don't skip whitespace prior to EoF (or end of comment) - that shouldn't be included in any node's range +// } +// } +// +// let precedingLineBreak = scanner.hasPrecedingLineBreak(); +// let seenLineBreak = false; +// let indentText = ""; +// while ((precedingLineBreak && token() == SyntaxKind::AsteriskToken) || token() == SyntaxKind::WhitespaceTrivia || token() == SyntaxKind::NewLineTrivia) { +// indentText += scanner.getTokenText(); +// if (token() == SyntaxKind::NewLineTrivia) { +// precedingLineBreak = true; +// seenLineBreak = true; +// indentText = ""; +// } +// else if (token() == SyntaxKind::AsteriskToken) { +// precedingLineBreak = false; +// } +// nextTokenJSDoc(); +// } +// return seenLineBreak ? indentText : ""; +// } +// +// function parseTag(margin: number) { +// Debug.assert(token() == SyntaxKind::AtToken); +// const start = scanner.getTokenPos(); +// nextTokenJSDoc(); +// +// const tagName = parseJSDocIdentifierName(/*message*/ undefined); +// const indentText = skipWhitespaceOrAsterisk(); +// +// let tag: JSDocTag | undefined; +// switch (tagName.escapedText) { +// case "author": +// tag = parseAuthorTag(start, tagName, margin, indentText); +// break; +// case "implements": +// tag = parseImplementsTag(start, tagName, margin, indentText); +// break; +// case "augments": +// case "extends": +// tag = parseAugmentsTag(start, tagName, margin, indentText); +// break; +// case "class": +// case "constructor": +// tag = parseSimpleTag(start, factory.createJSDocClassTag, tagName, margin, indentText); +// break; +// case "public": +// tag = parseSimpleTag(start, factory.createJSDocPublicTag, tagName, margin, indentText); +// break; +// case "private": +// tag = parseSimpleTag(start, factory.createJSDocPrivateTag, tagName, margin, indentText); +// break; +// case "protected": +// tag = parseSimpleTag(start, factory.createJSDocProtectedTag, tagName, margin, indentText); +// break; +// case "readonly": +// tag = parseSimpleTag(start, factory.createJSDocReadonlyTag, tagName, margin, indentText); +// break; +// case "override": +// tag = parseSimpleTag(start, factory.createJSDocOverrideTag, tagName, margin, indentText); +// break; +// case "deprecated": +// hasDeprecatedTag = true; +// tag = parseSimpleTag(start, factory.createJSDocDeprecatedTag, tagName, margin, indentText); +// break; +// case "this": +// tag = parseThisTag(start, tagName, margin, indentText); +// break; +// case "enum": +// tag = parseEnumTag(start, tagName, margin, indentText); +// break; +// case "arg": +// case "argument": +// case "param": +// return parseParameterOrPropertyTag(start, tagName, PropertyLikeParse.Parameter, margin); +// case "return": +// case "returns": +// tag = parseReturnTag(start, tagName, margin, indentText); +// break; +// case "template": +// tag = parseTemplateTag(start, tagName, margin, indentText); +// break; +// case "type": +// tag = parseTypeTag(start, tagName, margin, indentText); +// break; +// case "typedef": +// tag = parseTypedefTag(start, tagName, margin, indentText); +// break; +// case "callback": +// tag = parseCallbackTag(start, tagName, margin, indentText); +// break; +// case "see": +// tag = parseSeeTag(start, tagName, margin, indentText); +// break; +// default: +// tag = parseUnknownTag(start, tagName, margin, indentText); +// break; +// } +// return tag; +// } +// +// function parseTrailingTagComments(pos: number, end: number, margin: number, indentText: string) { +// // some tags, like typedef and callback, have already parsed their comments earlier +// if (!indentText) { +// margin += end - pos; +// } +// return parseTagComments(margin, indentText.slice(margin)); +// } +// +// function parseTagComments(indent: number, initialMargin?: string): string | NodeArray | undefined { +// const commentsPos = getNodePos(); +// let comments: string[] = []; +// const parts: JSDocComment[] = []; +// let linkEnd; +// let state = JSDocState.BeginningOfLine; +// let previousWhitespace = true; +// let margin: number | undefined; +// function pushComment(text: string) { +// if (!margin) { +// margin = indent; +// } +// comments.push(text); +// indent += text.length; +// } +// if (initialMargin !== undefined) { +// // jump straight to saving comments if there is some initial indentation +// if (initialMargin !== "") { +// pushComment(initialMargin); +// } +// state = JSDocState.SawAsterisk; +// } +// let tok = token() as JSDocSyntaxKind; +// loop: while (true) { +// switch (tok) { +// case SyntaxKind::NewLineTrivia: +// state = JSDocState.BeginningOfLine; +// // don't use pushComment here because we want to keep the margin unchanged +// comments.push(scanner.getTokenText()); +// indent = 0; +// break; +// case SyntaxKind::AtToken: +// if (state == JSDocState.SavingBackticks +// || state == JSDocState.SavingComments && (!previousWhitespace || lookAhead(isNextJSDocTokenWhitespace))) { +// // @ doesn't start a new tag inside ``, and inside a comment, only after whitespace or not before whitespace +// comments.push(scanner.getTokenText()); +// break; +// } +// scanner.setTextPos(scanner.getTextPos() - 1); +// // falls through +// case SyntaxKind::EndOfFileToken: +// // Done +// break loop; +// case SyntaxKind::WhitespaceTrivia: +// if (state == JSDocState.SavingComments || state == JSDocState.SavingBackticks) { +// pushComment(scanner.getTokenText()); +// } +// else { +// const whitespace = scanner.getTokenText(); +// // if the whitespace crosses the margin, take only the whitespace that passes the margin +// if (margin !== undefined && indent + whitespace.length > margin) { +// comments.push(whitespace.slice(margin - indent)); +// } +// indent += whitespace.length; +// } +// break; +// case SyntaxKind::OpenBraceToken: +// state = JSDocState.SavingComments; +// const commentEnd = scanner.getStartPos(); +// const linkStart = scanner.getTextPos() - 1; +// const link = parseJSDocLink(linkStart); +// if (link) { +// parts.push(finishNode(factory.createJSDocText(comments.join("")), linkEnd ?? commentsPos, commentEnd)); +// parts.push(link); +// comments = []; +// linkEnd = scanner.getTextPos(); +// } +// else { +// pushComment(scanner.getTokenText()); +// } +// break; +// case SyntaxKind::BacktickToken: +// if (state == JSDocState.SavingBackticks) { +// state = JSDocState.SavingComments; +// } +// else { +// state = JSDocState.SavingBackticks; +// } +// pushComment(scanner.getTokenText()); +// break; +// case SyntaxKind::AsteriskToken: +// if (state == JSDocState.BeginningOfLine) { +// // leading asterisks start recording on the *next* (non-whitespace) token +// state = JSDocState.SawAsterisk; +// indent += 1; +// break; +// } +// // record the * as a comment +// // falls through +// default: +// if (state !== JSDocState.SavingBackticks) { +// state = JSDocState.SavingComments; // leading identifiers start recording as well +// } +// pushComment(scanner.getTokenText()); +// break; +// } +// previousWhitespace = token() == SyntaxKind::WhitespaceTrivia; +// tok = nextTokenJSDoc(); +// } +// +// removeLeadingNewlines(comments); +// removeTrailingWhitespace(comments); +// if (parts.length) { +// if (comments.length) { +// parts.push(finishNode(factory.createJSDocText(comments.join("")), linkEnd ?? commentsPos)); +// } +// return createNodeArray(parts, commentsPos, scanner.getTextPos()); +// } +// else if (comments.length) { +// return comments.join(""); +// } +// } +// +// function isNextJSDocTokenWhitespace() { +// const next = nextTokenJSDoc(); +// return next == SyntaxKind::WhitespaceTrivia || next == SyntaxKind::NewLineTrivia; +// } +// +// function parseJSDocLink(start: number) { +// const linkType = tryParse(parseJSDocLinkPrefix); +// if (!linkType) { +// return undefined; +// } +// nextTokenJSDoc(); // start at token after link, then skip any whitespace +// skipWhitespace(); +// // parseEntityName logs an error for non-identifier, so create a MissingNode ourselves to avoid the error +// const p2 = getNodePos(); +// let name: EntityName | JSDocMemberName | undefined = tokenIsIdentifierOrKeyword(token()) +// ? parseEntityName(/*allowReservedWords*/ true) +// : undefined; +// if (name) { +// while (token() == SyntaxKind::PrivateIdentifier) { +// reScanHashToken(); // rescan #id as # id +// nextTokenJSDoc(); // then skip the # +// name = finishNode(factory.createJSDocMemberName(name, parseIdentifier()), p2); +// } +// } +// const text = []; +// while (token() !== SyntaxKind::CloseBraceToken && token() !== SyntaxKind::NewLineTrivia && token() !== SyntaxKind::EndOfFileToken) { +// text.push(scanner.getTokenText()); +// nextTokenJSDoc(); +// } +// const create = linkType == "link" ? factory.createJSDocLink +// : linkType == "linkcode" ? factory.createJSDocLinkCode +// : factory.createJSDocLinkPlain; +// return finishNode(create(name, text.join("")), start, scanner.getTextPos()); +// } +// +// function parseJSDocLinkPrefix() { +// skipWhitespaceOrAsterisk(); +// if (token() == SyntaxKind::OpenBraceToken +// && nextTokenJSDoc() == SyntaxKind::AtToken +// && tokenIsIdentifierOrKeyword(nextTokenJSDoc())) { +// const kind = scanner.getTokenValue(); +// if (isJSDocLinkTag(kind)) return kind; +// } +// } +// +// function isJSDocLinkTag(kind: string) { +// return kind == "link" || kind == "linkcode" || kind == "linkplain"; +// } +// +// function parseUnknownTag(start: number, tagName: Identifier, indent: number, indentText: string) { +// return finishNode(factory.createJSDocUnknownTag(tagName, parseTrailingTagComments(start, getNodePos(), indent, indentText)), start); +// } +// +// function addTag(tag: JSDocTag | undefined): void { +// if (!tag) { +// return; +// } +// if (!tags) { +// tags = [tag]; +// tagsPos = tag.pos; +// } +// else { +// tags.push(tag); +// } +// tagsEnd = tag.end; +// } +// +// function tryParseTypeExpression(): JSDocTypeExpression | undefined { +// skipWhitespaceOrAsterisk(); +// return token() == SyntaxKind::OpenBraceToken ? parseJSDocTypeExpression() : undefined; +// } +// +// function parseBracketNameInPropertyAndParamTag(): { name: EntityName, isBracketed: boolean } { +// // Looking for something like '[foo]', 'foo', '[foo.bar]' or 'foo.bar' +// const isBracketed = parseOptionalJsdoc(SyntaxKind::OpenBracketToken); +// if (isBracketed) { +// skipWhitespace(); +// } +// // a markdown-quoted name: `arg` is not legal jsdoc, but occurs in the wild +// const isBackquoted = parseOptionalJsdoc(SyntaxKind::BacktickToken); +// const name = parseJSDocEntityName(); +// if (isBackquoted) { +// parseExpectedTokenJSDoc(SyntaxKind::BacktickToken); +// } +// if (isBracketed) { +// skipWhitespace(); +// // May have an optional default, e.g. '[foo = 42]' +// if (parseOptionalToken(SyntaxKind::EqualsToken)) { +// parseExpression(); +// } +// +// parseExpected(SyntaxKind::CloseBracketToken); +// } +// +// return { name, isBracketed }; +// } +// +// function isObjectOrObjectArrayTypeReference(node: TypeNode): boolean { +// switch (node.kind) { +// case SyntaxKind::ObjectKeyword: +// return true; +// case SyntaxKind::ArrayType: +// return isObjectOrObjectArrayTypeReference(reinterpret_cast(node).elementType); +// default: +// return isTypeReferenceNode(node) && ts.isIdentifier(node.typeName) && node.typeName.escapedText == "Object" && !node.typeArguments; +// } +// } +// +// function parseParameterOrPropertyTag(start: number, tagName: Identifier, target: PropertyLikeParse, indent: number): JSDocParameterTag | JSDocPropertyTag { +// let typeExpression = tryParseTypeExpression(); +// let isNameFirst = !typeExpression; +// skipWhitespaceOrAsterisk(); +// +// const { name, isBracketed } = parseBracketNameInPropertyAndParamTag(); +// const indentText = skipWhitespaceOrAsterisk(); +// +// if (isNameFirst && !lookAhead(parseJSDocLinkPrefix)) { +// typeExpression = tryParseTypeExpression(); +// } +// +// const comment = parseTrailingTagComments(start, getNodePos(), indent, indentText); +// +// const nestedTypeLiteral = target !== PropertyLikeParse.CallbackParameter && parseNestedTypeLiteral(typeExpression, name, target, indent); +// if (nestedTypeLiteral) { +// typeExpression = nestedTypeLiteral; +// isNameFirst = true; +// } +// const result = target == PropertyLikeParse.Property +// ? factory.createJSDocPropertyTag(tagName, name, isBracketed, typeExpression, isNameFirst, comment) +// : factory.createJSDocParameterTag(tagName, name, isBracketed, typeExpression, isNameFirst, comment); +// return finishNode(result, start); +// } +// +// function parseNestedTypeLiteral(typeExpression: JSDocTypeExpression | undefined, name: EntityName, target: PropertyLikeParse, indent: number) { +// if (typeExpression && isObjectOrObjectArrayTypeReference(typeExpression.type)) { +// const pos = getNodePos(); +// let child: JSDocPropertyLikeTag | JSDocTypeTag | false; +// let children: JSDocPropertyLikeTag[] | undefined; +// while (child = tryParse(() => parseChildParameterOrPropertyTag(target, indent, name))) { +// if (child.kind == SyntaxKind::JSDocParameterTag || child.kind == SyntaxKind::JSDocPropertyTag) { +// children = append(children, child); +// } +// } +// if (children) { +// const literal = finishNode(factory.createJSDocTypeLiteral(children, typeExpression.type.kind == SyntaxKind::ArrayType), pos); +// return finishNode(factory.createJSDocTypeExpression(literal), pos); +// } +// } +// } +// +// function parseReturnTag(start: number, tagName: Identifier, indent: number, indentText: string): JSDocReturnTag { +// if (some(tags, isJSDocReturnTag)) { +// parseErrorAt(tagName.pos, scanner.getTokenPos(), Diagnostics._0_tag_already_specified, tagName.escapedText); +// } +// +// const typeExpression = tryParseTypeExpression(); +// return finishNode(factory.createJSDocReturnTag(tagName, typeExpression, parseTrailingTagComments(start, getNodePos(), indent, indentText)), start); +// } +// +// function parseTypeTag(start: number, tagName: Identifier, indent?: number, indentText?: string): JSDocTypeTag { +// if (some(tags, isJSDocTypeTag)) { +// parseErrorAt(tagName.pos, scanner.getTokenPos(), Diagnostics._0_tag_already_specified, tagName.escapedText); +// } +// +// const typeExpression = parseJSDocTypeExpression(/*mayOmitBraces*/ true); +// const comments = indent !== undefined && indentText !== undefined ? parseTrailingTagComments(start, getNodePos(), indent, indentText) : undefined; +// return finishNode(factory.createJSDocTypeTag(tagName, typeExpression, comments), start); +// } +// +// function parseSeeTag(start: number, tagName: Identifier, indent?: number, indentText?: string): JSDocSeeTag { +// const isMarkdownOrJSDocLink = token() == SyntaxKind::OpenBracketToken +// || lookAhead(() => nextTokenJSDoc() == SyntaxKind::AtToken && tokenIsIdentifierOrKeyword(nextTokenJSDoc()) && isJSDocLinkTag(scanner.getTokenValue())); +// const nameExpression = isMarkdownOrJSDocLink ? undefined : parseJSDocNameReference(); +// const comments = indent !== undefined && indentText !== undefined ? parseTrailingTagComments(start, getNodePos(), indent, indentText) : undefined; +// return finishNode(factory.createJSDocSeeTag(tagName, nameExpression, comments), start); +// } +// +// function parseAuthorTag(start: number, tagName: Identifier, indent: number, indentText: string): JSDocAuthorTag { +// const commentStart = getNodePos(); +// const textOnly = parseAuthorNameAndEmail(); +// let commentEnd = scanner.getStartPos(); +// const comments = parseTrailingTagComments(start, commentEnd, indent, indentText); +// if (!comments) { +// commentEnd = scanner.getStartPos(); +// } +// const allParts = typeof comments !== "string" +// ? createNodeArray(concatenate([finishNode(textOnly, commentStart, commentEnd)], comments) as JSDocComment[], commentStart) // cast away readonly +// : textOnly.text + comments; +// return finishNode(factory.createJSDocAuthorTag(tagName, allParts), start); +// } +// +// function parseAuthorNameAndEmail(): JSDocText { +// const comments: string[] = []; +// let inEmail = false; +// let token = scanner.getToken(); +// while (token !== SyntaxKind::EndOfFileToken && token !== SyntaxKind::NewLineTrivia) { +// if (token == SyntaxKind::LessThanToken) { +// inEmail = true; +// } +// else if (token == SyntaxKind::AtToken && !inEmail) { +// break; +// } +// else if (token == SyntaxKind::GreaterThanToken && inEmail) { +// comments.push(scanner.getTokenText()); +// scanner.setTextPos(scanner.getTokenPos() + 1); +// break; +// } +// comments.push(scanner.getTokenText()); +// token = nextTokenJSDoc(); +// } +// +// return factory.createJSDocText(comments.join("")); +// } +// +// function parseImplementsTag(start: number, tagName: Identifier, margin: number, indentText: string): JSDocImplementsTag { +// const className = parseExpressionWithTypeArgumentsForAugments(); +// return finishNode(factory.createJSDocImplementsTag(tagName, className, parseTrailingTagComments(start, getNodePos(), margin, indentText)), start); +// } +// +// function parseAugmentsTag(start: number, tagName: Identifier, margin: number, indentText: string): JSDocAugmentsTag { +// const className = parseExpressionWithTypeArgumentsForAugments(); +// return finishNode(factory.createJSDocAugmentsTag(tagName, className, parseTrailingTagComments(start, getNodePos(), margin, indentText)), start); +// } +// +// function parseExpressionWithTypeArgumentsForAugments(): ExpressionWithTypeArguments & { expression: Identifier | PropertyAccessEntityNameExpression } { +// const usedBrace = parseOptional(SyntaxKind::OpenBraceToken); +// const pos = getNodePos(); +// const expression = parsePropertyAccessEntityNameExpression(); +// const typeArguments = tryParseTypeArguments(); +// const node = factory.createExpressionWithTypeArguments(expression, typeArguments) as ExpressionWithTypeArguments & { expression: Identifier | PropertyAccessEntityNameExpression }; +// const res = finishNode(node, pos); +// if (usedBrace) { +// parseExpected(SyntaxKind::CloseBraceToken); +// } +// return res; +// } +// +// function parsePropertyAccessEntityNameExpression() { +// const pos = getNodePos(); +// let node: Identifier | PropertyAccessEntityNameExpression = parseJSDocIdentifierName(); +// while (parseOptional(SyntaxKind::DotToken)) { +// const name = parseJSDocIdentifierName(); +// node = finishNode(factory.createPropertyAccessExpression(node, name), pos) as PropertyAccessEntityNameExpression; +// } +// return node; +// } +// +// function parseSimpleTag(start: number, createTag: (tagName: Identifier | undefined, comment?: string | NodeArray) => JSDocTag, tagName: Identifier, margin: number, indentText: string): JSDocTag { +// return finishNode(createTag(tagName, parseTrailingTagComments(start, getNodePos(), margin, indentText)), start); +// } +// +// function parseThisTag(start: number, tagName: Identifier, margin: number, indentText: string): JSDocThisTag { +// const typeExpression = parseJSDocTypeExpression(/*mayOmitBraces*/ true); +// skipWhitespace(); +// return finishNode(factory.createJSDocThisTag(tagName, typeExpression, parseTrailingTagComments(start, getNodePos(), margin, indentText)), start); +// } +// +// function parseEnumTag(start: number, tagName: Identifier, margin: number, indentText: string): JSDocEnumTag { +// const typeExpression = parseJSDocTypeExpression(/*mayOmitBraces*/ true); +// skipWhitespace(); +// return finishNode(factory.createJSDocEnumTag(tagName, typeExpression, parseTrailingTagComments(start, getNodePos(), margin, indentText)), start); +// } +// +// function parseTypedefTag(start: number, tagName: Identifier, indent: number, indentText: string): JSDocTypedefTag { +// let typeExpression: JSDocTypeExpression | JSDocTypeLiteral | undefined = tryParseTypeExpression(); +// skipWhitespaceOrAsterisk(); +// +// const fullName = parseJSDocTypeNameWithNamespace(); +// skipWhitespace(); +// let comment = parseTagComments(indent); +// +// let end: number | undefined; +// if (!typeExpression || isObjectOrObjectArrayTypeReference(typeExpression.type)) { +// let child: JSDocTypeTag | JSDocPropertyTag | false; +// let childTypeTag: JSDocTypeTag | undefined; +// let jsDocPropertyTags: JSDocPropertyTag[] | undefined; +// let hasChildren = false; +// while (child = tryParse(() => parseChildPropertyTag(indent))) { +// hasChildren = true; +// if (child.kind == SyntaxKind::JSDocTypeTag) { +// if (childTypeTag) { +// const lastError = parseErrorAtCurrentToken(Diagnostics.A_JSDoc_typedef_comment_may_not_contain_multiple_type_tags); +// if (lastError) { +// addRelatedInfo(lastError, createDetachedDiagnostic(fileName, 0, 0, Diagnostics.The_tag_was_first_specified_here)); +// } +// break; +// } +// else { +// childTypeTag = child; +// } +// } +// else { +// jsDocPropertyTags = append(jsDocPropertyTags, child); +// } +// } +// if (hasChildren) { +// const isArrayType = typeExpression && typeExpression.type.kind == SyntaxKind::ArrayType; +// const jsdocTypeLiteral = factory.createJSDocTypeLiteral(jsDocPropertyTags, isArrayType); +// typeExpression = childTypeTag && childTypeTag.typeExpression && !isObjectOrObjectArrayTypeReference(childTypeTag.typeExpression.type) ? +// childTypeTag.typeExpression : +// finishNode(jsdocTypeLiteral, start); +// end = typeExpression.end; +// } +// } +// +// // Only include the characters between the name end and the next token if a comment was actually parsed out - otherwise it's just whitespace +// end = end || comment !== undefined ? +// getNodePos() : +// (fullName ?? typeExpression ?? tagName).end; +// +// if (!comment) { +// comment = parseTrailingTagComments(start, end, indent, indentText); +// } +// +// const typedefTag = factory.createJSDocTypedefTag(tagName, typeExpression, fullName, comment); +// return finishNode(typedefTag, start, end); +// } +// +// function parseJSDocTypeNameWithNamespace(nested?: boolean) { +// const pos = scanner.getTokenPos(); +// if (!tokenIsIdentifierOrKeyword(token())) { +// return undefined; +// } +// const typeNameOrNamespaceName = parseJSDocIdentifierName(); +// if (parseOptional(SyntaxKind::DotToken)) { +// const body = parseJSDocTypeNameWithNamespace(/*nested*/ true); +// const jsDocNamespaceNode = factory.createModuleDeclaration( +// /*decorators*/ undefined, +// /*modifiers*/ undefined, +// typeNameOrNamespaceName, +// body, +// nested ? NodeFlags::NestedNamespace : undefined +// ) as JSDocNamespaceDeclaration; +// return finishNode(jsDocNamespaceNode, pos); +// } +// +// if (nested) { +// typeNameOrNamespaceName.isInJSDocNamespace = true; +// } +// return typeNameOrNamespaceName; +// } +// +// +// function parseCallbackTagParameters(indent: number) { +// const pos = getNodePos(); +// let child: JSDocParameterTag | false; +// let parameters; +// while (child = tryParse(() => parseChildParameterOrPropertyTag(PropertyLikeParse.CallbackParameter, indent) as JSDocParameterTag)) { +// parameters = append(parameters, child); +// } +// return createNodeArray(parameters || [], pos); +// } +// +// function parseCallbackTag(start: number, tagName: Identifier, indent: number, indentText: string): JSDocCallbackTag { +// const fullName = parseJSDocTypeNameWithNamespace(); +// skipWhitespace(); +// let comment = parseTagComments(indent); +// const parameters = parseCallbackTagParameters(indent); +// const returnTag = tryParse(() => { +// if (parseOptionalJsdoc(SyntaxKind::AtToken)) { +// const tag = parseTag(indent); +// if (tag && tag.kind == SyntaxKind::JSDocReturnTag) { +// return tag as JSDocReturnTag; +// } +// } +// }); +// const typeExpression = finishNode(factory.createJSDocSignature(/*typeParameters*/ undefined, parameters, returnTag), start); +// if (!comment) { +// comment = parseTrailingTagComments(start, getNodePos(), indent, indentText); +// } +// const end = comment !== undefined ? getNodePos() : typeExpression.end; +// return finishNode(factory.createJSDocCallbackTag(tagName, typeExpression, fullName, comment), start, end); +// } +// +// function escapedTextsEqual(a: EntityName, b: EntityName): boolean { +// while (!ts.isIdentifier(a) || !ts.isIdentifier(b)) { +// if (!ts.isIdentifier(a) && !ts.isIdentifier(b) && a.right.escapedText == b.right.escapedText) { +// a = a.left; +// b = b.left; +// } +// else { +// return false; +// } +// } +// return a.escapedText == b.escapedText; +// } +// +// function parseChildPropertyTag(indent: number) { +// return parseChildParameterOrPropertyTag(PropertyLikeParse.Property, indent) as JSDocTypeTag | JSDocPropertyTag | false; +// } +// +// function parseChildParameterOrPropertyTag(target: PropertyLikeParse, indent: number, name?: EntityName): JSDocTypeTag | JSDocPropertyTag | JSDocParameterTag | false { +// let canParseTag = true; +// let seenAsterisk = false; +// while (true) { +// switch (nextTokenJSDoc()) { +// case SyntaxKind::AtToken: +// if (canParseTag) { +// const child = tryParseChildTag(target, indent); +// if (child && (child.kind == SyntaxKind::JSDocParameterTag || child.kind == SyntaxKind::JSDocPropertyTag) && +// target !== PropertyLikeParse.CallbackParameter && +// name && (ts.isIdentifier(child.name) || !escapedTextsEqual(name, child.name.left))) { +// return false; +// } +// return child; +// } +// seenAsterisk = false; +// break; +// case SyntaxKind::NewLineTrivia: +// canParseTag = true; +// seenAsterisk = false; +// break; +// case SyntaxKind::AsteriskToken: +// if (seenAsterisk) { +// canParseTag = false; +// } +// seenAsterisk = true; +// break; +// case SyntaxKind::Identifier: +// canParseTag = false; +// break; +// case SyntaxKind::EndOfFileToken: +// return false; +// } +// } +// } +// +// function tryParseChildTag(target: PropertyLikeParse, indent: number): JSDocTypeTag | JSDocPropertyTag | JSDocParameterTag | false { +// Debug.assert(token() == SyntaxKind::AtToken); +// const start = scanner.getStartPos(); +// nextTokenJSDoc(); +// +// const tagName = parseJSDocIdentifierName(); +// skipWhitespace(); +// let t: PropertyLikeParse; +// switch (tagName.escapedText) { +// case "type": +// return target == PropertyLikeParse.Property && parseTypeTag(start, tagName); +// case "prop": +// case "property": +// t = PropertyLikeParse.Property; +// break; +// case "arg": +// case "argument": +// case "param": +// t = PropertyLikeParse.Parameter | PropertyLikeParse.CallbackParameter; +// break; +// default: +// return false; +// } +// if (!(target & t)) { +// return false; +// } +// return parseParameterOrPropertyTag(start, tagName, target, indent); +// } +// +// function parseTemplateTagTypeParameter() { +// const typeParameterPos = getNodePos(); +// const isBracketed = parseOptionalJsdoc(SyntaxKind::OpenBracketToken); +// if (isBracketed) { +// skipWhitespace(); +// } +// const name = parseJSDocIdentifierName(Diagnostics.Unexpected_token_A_type_parameter_name_was_expected_without_curly_braces); +// +// let defaultType: TypeNode | undefined; +// if (isBracketed) { +// skipWhitespace(); +// parseExpected(SyntaxKind::EqualsToken); +// defaultType = doInsideOfContext(NodeFlags::JSDoc, parseJSDocType); +// parseExpected(SyntaxKind::CloseBracketToken); +// } +// +// if (nodeIsMissing(name)) { +// return undefined; +// } +// return finishNode(factory.createTypeParameterDeclaration(/*modifiers*/ undefined, name, /*constraint*/ undefined, defaultType), typeParameterPos); +// } +// +// function parseTemplateTagTypeParameters() { +// const pos = getNodePos(); +// const typeParameters = []; +// do { +// skipWhitespace(); +// const node = parseTemplateTagTypeParameter(); +// if (node !== undefined) { +// typeParameters.push(node); +// } +// skipWhitespaceOrAsterisk(); +// } while (parseOptionalJsdoc(SyntaxKind::CommaToken)); +// return createNodeArray(typeParameters, pos); +// } +// +// function parseTemplateTag(start: number, tagName: Identifier, indent: number, indentText: string): JSDocTemplateTag { +// // The template tag looks like one of the following: +// // @template T,U,V +// // @template {Constraint} T +// // +// // According to the [closure docs](https://github.com/google/closure-compiler/wiki/Generic-Types#multiple-bounded-template-types): +// // > Multiple bounded generics cannot be declared on the same line. For the sake of clarity, if multiple templates share the same +// // > type bound they must be declared on separate lines. +// // +// // TODO: Determine whether we should enforce this in the checker. +// // TODO: Consider moving the `constraint` to the first type parameter as we could then remove `getEffectiveConstraintOfTypeParameter`. +// // TODO: Consider only parsing a single type parameter if there is a constraint. +// const constraint = token() == SyntaxKind::OpenBraceToken ? parseJSDocTypeExpression() : undefined; +// const typeParameters = parseTemplateTagTypeParameters(); +// return finishNode(factory.createJSDocTemplateTag(tagName, constraint, typeParameters, parseTrailingTagComments(start, getNodePos(), indent, indentText)), start); +// } +// +// function parseOptionalJsdoc(t: JSDocSyntaxKind): boolean { +// if (token() == t) { +// nextTokenJSDoc(); +// return true; +// } +// return false; +// } +// +// function parseJSDocEntityName(): EntityName { +// let entity: EntityName = parseJSDocIdentifierName(); +// if (parseOptional(SyntaxKind::OpenBracketToken)) { +// parseExpected(SyntaxKind::CloseBracketToken); +// // Note that y[] is accepted as an entity name, but the postfix brackets are not saved for checking. +// // Technically usejsdoc.org requires them for specifying a property of a type equivalent to Array<{ x: ...}> +// // but it's not worth it to enforce that restriction. +// } +// while (parseOptional(SyntaxKind::DotToken)) { +// const name = parseJSDocIdentifierName(); +// if (parseOptional(SyntaxKind::OpenBracketToken)) { +// parseExpected(SyntaxKind::CloseBracketToken); +// } +// entity = createQualifiedName(entity, name); +// } +// return entity; +// } +// +// function parseJSDocIdentifierName(message?: DiagnosticMessage): Identifier { +// if (!tokenIsIdentifierOrKeyword(token())) { +// return createMissingNode(SyntaxKind::Identifier, /*reportAtCurrentPosition*/ !message, message || Diagnostics.Identifier_expected); +// } +// +// identifierCount++; +// const pos = scanner.getTokenPos(); +// const end = scanner.getTextPos(); +// const originalKeywordKind = token(); +// const text = internIdentifier(scanner.getTokenValue()); +// const result = finishNode(factory.createIdentifier(text, /*typeArguments*/ undefined, originalKeywordKind), pos, end); +// nextTokenJSDoc(); +// return result; +// } +// } +// } + } +// +// namespace IncrementalParser { +// export function updateSourceFile(sourceFile: SourceFile, newText: string, textChangeRange: TextChangeRange, aggressiveChecks: boolean): SourceFile { +// aggressiveChecks = aggressiveChecks || Debug.shouldAssert(AssertionLevel.Aggressive); +// +// checkChangeRange(sourceFile, newText, textChangeRange, aggressiveChecks); +// if (textChangeRangeIsUnchanged(textChangeRange)) { +// // if the text didn't change, then we can just return our current source file as-is. +// return sourceFile; +// } +// +// if (sourceFile.statements.length == 0) { +// // If we don't have any statements in the current source file, then there's no real +// // way to incrementally parse. So just do a full parse instead. +// return Parser.parseSourceFile(sourceFile.fileName, newText, sourceFile.languageVersion, /*syntaxCursor*/ undefined, /*setParentNodes*/ true, sourceFile.scriptKind, sourceFile.setExternalModuleIndicator); +// } +// +// // Make sure we're not trying to incrementally update a source file more than once. Once +// // we do an update the original source file is considered unusable from that point onwards. +// // +// // This is because we do incremental parsing in-place. i.e. we take nodes from the old +// // tree and give them new positions and parents. From that point on, trusting the old +// // tree at all is not possible as far too much of it may violate invariants. +// const incrementalSourceFile = sourceFile as Node as IncrementalNode; +// Debug.assert(!incrementalSourceFile.hasBeenIncrementallyParsed); +// incrementalSourceFile.hasBeenIncrementallyParsed = true; +// Parser.fixupParentReferences(incrementalSourceFile); +// const oldText = sourceFile.text; +// const syntaxCursor = createSyntaxCursor(sourceFile); +// +// // Make the actual change larger so that we know to reparse anything whose lookahead +// // might have intersected the change. +// const changeRange = extendToAffectedRange(sourceFile, textChangeRange); +// checkChangeRange(sourceFile, newText, changeRange, aggressiveChecks); +// +// // Ensure that extending the affected range only moved the start of the change range +// // earlier in the file. +// Debug.assert(changeRange.span.start <= textChangeRange.span.start); +// Debug.assert(textSpanEnd(changeRange.span) == textSpanEnd(textChangeRange.span)); +// Debug.assert(textSpanEnd(textChangeRangeNewSpan(changeRange)) == textSpanEnd(textChangeRangeNewSpan(textChangeRange))); +// +// // The is the amount the nodes after the edit range need to be adjusted. It can be +// // positive (if the edit added characters), negative (if the edit deleted characters) +// // or zero (if this was a pure overwrite with nothing added/removed). +// const delta = textChangeRangeNewSpan(changeRange).length - changeRange.span.length; +// +// // If we added or removed characters during the edit, then we need to go and adjust all +// // the nodes after the edit. Those nodes may move forward (if we inserted chars) or they +// // may move backward (if we deleted chars). +// // +// // Doing this helps us out in two ways. First, it means that any nodes/tokens we want +// // to reuse are already at the appropriate position in the new text. That way when we +// // reuse them, we don't have to figure out if they need to be adjusted. Second, it makes +// // it very easy to determine if we can reuse a node. If the node's position is at where +// // we are in the text, then we can reuse it. Otherwise we can't. If the node's position +// // is ahead of us, then we'll need to rescan tokens. If the node's position is behind +// // us, then we'll need to skip it or crumble it as appropriate +// // +// // We will also adjust the positions of nodes that intersect the change range as well. +// // By doing this, we ensure that all the positions in the old tree are consistent, not +// // just the positions of nodes entirely before/after the change range. By being +// // consistent, we can then easily map from positions to nodes in the old tree easily. +// // +// // Also, mark any syntax elements that intersect the changed span. We know, up front, +// // that we cannot reuse these elements. +// updateTokenPositionsAndMarkElements(incrementalSourceFile, +// changeRange.span.start, textSpanEnd(changeRange.span), textSpanEnd(textChangeRangeNewSpan(changeRange)), delta, oldText, newText, aggressiveChecks); +// +// // Now that we've set up our internal incremental state just proceed and parse the +// // source file in the normal fashion. When possible the parser will retrieve and +// // reuse nodes from the old tree. +// // +// // Note: passing in 'true' for setNodeParents is very important. When incrementally +// // parsing, we will be reusing nodes from the old tree, and placing it into new +// // parents. If we don't set the parents now, we'll end up with an observably +// // inconsistent tree. Setting the parents on the new tree should be very fast. We +// // will immediately bail out of walking any subtrees when we can see that their parents +// // are already correct. +// const result = Parser.parseSourceFile(sourceFile.fileName, newText, sourceFile.languageVersion, syntaxCursor, /*setParentNodes*/ true, sourceFile.scriptKind, sourceFile.setExternalModuleIndicator); +// result.commentDirectives = getNewCommentDirectives( +// sourceFile.commentDirectives, +// result.commentDirectives, +// changeRange.span.start, +// textSpanEnd(changeRange.span), +// delta, +// oldText, +// newText, +// aggressiveChecks +// ); +// result.impliedNodeFormat = sourceFile.impliedNodeFormat; +// return result; +// } +// +// function getNewCommentDirectives( +// oldDirectives: CommentDirective[] | undefined, +// newDirectives: CommentDirective[] | undefined, +// changeStart: number, +// changeRangeOldEnd: number, +// delta: number, +// oldText: string, +// newText: string, +// aggressiveChecks: boolean +// ): CommentDirective[] | undefined { +// if (!oldDirectives) return newDirectives; +// let commentDirectives: CommentDirective[] | undefined; +// let addedNewlyScannedDirectives = false; +// for (const directive of oldDirectives) { +// const { range, type } = directive; +// // Range before the change +// if (range.end < changeStart) { +// commentDirectives = append(commentDirectives, directive); +// } +// else if (range.pos > changeRangeOldEnd) { +// addNewlyScannedDirectives(); +// // Node is entirely past the change range. We need to move both its pos and +// // end, forward or backward appropriately. +// const updatedDirective: CommentDirective = { +// range: { pos: range.pos + delta, end: range.end + delta }, +// type +// }; +// commentDirectives = append(commentDirectives, updatedDirective); +// if (aggressiveChecks) { +// Debug.assert(oldText.substring(range.pos, range.end) == newText.substring(updatedDirective.range.pos, updatedDirective.range.end)); +// } +// } +// // Ignore ranges that fall in change range +// } +// addNewlyScannedDirectives(); +// return commentDirectives; +// +// function addNewlyScannedDirectives() { +// if (addedNewlyScannedDirectives) return; +// addedNewlyScannedDirectives = true; +// if (!commentDirectives) { +// commentDirectives = newDirectives; +// } +// else if (newDirectives) { +// commentDirectives.push(...newDirectives); +// } +// } +// } +// +// function moveElementEntirelyPastChangeRange(element: IncrementalElement, isArray: boolean, delta: number, oldText: string, newText: string, aggressiveChecks: boolean) { +// if (isArray) { +// visitArray(element as IncrementalNodeArray); +// } +// else { +// visitNode(element as IncrementalNode); +// } +// return; +// +// function visitNode(node: IncrementalNode) { +// let text = ""; +// if (aggressiveChecks && shouldCheckNode(node)) { +// text = oldText.substring(node.pos, node.end); +// } +// +// // Ditch any existing LS children we may have created. This way we can avoid +// // moving them forward. +// if (node._children) { +// node._children = undefined; +// } +// +// setTextRangePosEnd(node, node.pos + delta, node.end + delta); +// +// if (aggressiveChecks && shouldCheckNode(node)) { +// Debug.assert(text == newText.substring(node.pos, node.end)); +// } +// +// forEachChild(node, visitNode, visitArray); +// if (hasJSDocNodes(node)) { +// for (const jsDocComment of node.jsDoc!) { +// visitNode(jsDocComment as Node as IncrementalNode); +// } +// } +// checkNodePositions(node, aggressiveChecks); +// } +// +// function visitArray(array: IncrementalNodeArray) { +// array._children = undefined; +// setTextRangePosEnd(array, array.pos + delta, array.end + delta); +// +// for (const node of array) { +// visitNode(node); +// } +// } +// } +// +// function shouldCheckNode(node: Node) { +// switch (node.kind) { +// case SyntaxKind::StringLiteral: +// case SyntaxKind::NumericLiteral: +// case SyntaxKind::Identifier: +// return true; +// } +// +// return false; +// } +// +// function adjustIntersectingElement(element: IncrementalElement, changeStart: number, changeRangeOldEnd: number, changeRangeNewEnd: number, delta: number) { +// Debug.assert(element.end >= changeStart, "Adjusting an element that was entirely before the change range"); +// Debug.assert(element.pos <= changeRangeOldEnd, "Adjusting an element that was entirely after the change range"); +// Debug.assert(element.pos <= element.end); +// +// // We have an element that intersects the change range in some way. It may have its +// // start, or its end (or both) in the changed range. We want to adjust any part +// // that intersects such that the final tree is in a consistent state. i.e. all +// // children have spans within the span of their parent, and all siblings are ordered +// // properly. +// +// // We may need to update both the 'pos' and the 'end' of the element. +// +// // If the 'pos' is before the start of the change, then we don't need to touch it. +// // If it isn't, then the 'pos' must be inside the change. How we update it will +// // depend if delta is positive or negative. If delta is positive then we have +// // something like: +// // +// // -------------------AAA----------------- +// // -------------------BBBCCCCCCC----------------- +// // +// // In this case, we consider any node that started in the change range to still be +// // starting at the same position. +// // +// // however, if the delta is negative, then we instead have something like this: +// // +// // -------------------XXXYYYYYYY----------------- +// // -------------------ZZZ----------------- +// // +// // In this case, any element that started in the 'X' range will keep its position. +// // However any element that started after that will have their pos adjusted to be +// // at the end of the new range. i.e. any node that started in the 'Y' range will +// // be adjusted to have their start at the end of the 'Z' range. +// // +// // The element will keep its position if possible. Or Move backward to the new-end +// // if it's in the 'Y' range. +// const pos = Math.min(element.pos, changeRangeNewEnd); +// +// // If the 'end' is after the change range, then we always adjust it by the delta +// // amount. However, if the end is in the change range, then how we adjust it +// // will depend on if delta is positive or negative. If delta is positive then we +// // have something like: +// // +// // -------------------AAA----------------- +// // -------------------BBBCCCCCCC----------------- +// // +// // In this case, we consider any node that ended inside the change range to keep its +// // end position. +// // +// // however, if the delta is negative, then we instead have something like this: +// // +// // -------------------XXXYYYYYYY----------------- +// // -------------------ZZZ----------------- +// // +// // In this case, any element that ended in the 'X' range will keep its position. +// // However any element that ended after that will have their pos adjusted to be +// // at the end of the new range. i.e. any node that ended in the 'Y' range will +// // be adjusted to have their end at the end of the 'Z' range. +// const end = element.end >= changeRangeOldEnd ? +// // Element ends after the change range. Always adjust the end pos. +// element.end + delta : +// // Element ends in the change range. The element will keep its position if +// // possible. Or Move backward to the new-end if it's in the 'Y' range. +// Math.min(element.end, changeRangeNewEnd); +// +// Debug.assert(pos <= end); +// if (element.parent) { +// Debug.assertGreaterThanOrEqual(pos, element.parent.pos); +// Debug.assertLessThanOrEqual(end, element.parent.end); +// } +// +// setTextRangePosEnd(element, pos, end); +// } +// +// function checkNodePositions(node: Node, aggressiveChecks: boolean) { +// if (aggressiveChecks) { +// let pos = node.pos; +// const visitNode = (child: Node) => { +// Debug.assert(child.pos >= pos); +// pos = child.end; +// }; +// if (hasJSDocNodes(node)) { +// for (const jsDocComment of node.jsDoc!) { +// visitNode(jsDocComment); +// } +// } +// forEachChild(node, visitNode); +// Debug.assert(pos <= node.end); +// } +// } +// +// function updateTokenPositionsAndMarkElements( +// sourceFile: IncrementalNode, +// changeStart: number, +// changeRangeOldEnd: number, +// changeRangeNewEnd: number, +// delta: number, +// oldText: string, +// newText: string, +// aggressiveChecks: boolean): void { +// +// visitNode(sourceFile); +// return; +// +// function visitNode(child: IncrementalNode) { +// Debug.assert(child.pos <= child.end); +// if (child.pos > changeRangeOldEnd) { +// // Node is entirely past the change range. We need to move both its pos and +// // end, forward or backward appropriately. +// moveElementEntirelyPastChangeRange(child, /*isArray*/ false, delta, oldText, newText, aggressiveChecks); +// return; +// } +// +// // Check if the element intersects the change range. If it does, then it is not +// // reusable. Also, we'll need to recurse to see what constituent portions we may +// // be able to use. +// const fullEnd = child.end; +// if (fullEnd >= changeStart) { +// child.intersectsChange = true; +// child._children = undefined; +// +// // Adjust the pos or end (or both) of the intersecting element accordingly. +// adjustIntersectingElement(child, changeStart, changeRangeOldEnd, changeRangeNewEnd, delta); +// forEachChild(child, visitNode, visitArray); +// if (hasJSDocNodes(child)) { +// for (const jsDocComment of child.jsDoc!) { +// visitNode(jsDocComment as Node as IncrementalNode); +// } +// } +// checkNodePositions(child, aggressiveChecks); +// return; +// } +// +// // Otherwise, the node is entirely before the change range. No need to do anything with it. +// Debug.assert(fullEnd < changeStart); +// } +// +// function visitArray(array: IncrementalNodeArray) { +// Debug.assert(array.pos <= array.end); +// if (array.pos > changeRangeOldEnd) { +// // Array is entirely after the change range. We need to move it, and move any of +// // its children. +// moveElementEntirelyPastChangeRange(array, /*isArray*/ true, delta, oldText, newText, aggressiveChecks); +// return; +// } +// +// // Check if the element intersects the change range. If it does, then it is not +// // reusable. Also, we'll need to recurse to see what constituent portions we may +// // be able to use. +// const fullEnd = array.end; +// if (fullEnd >= changeStart) { +// array.intersectsChange = true; +// array._children = undefined; +// +// // Adjust the pos or end (or both) of the intersecting array accordingly. +// adjustIntersectingElement(array, changeStart, changeRangeOldEnd, changeRangeNewEnd, delta); +// for (const node of array) { +// visitNode(node); +// } +// return; +// } +// +// // Otherwise, the array is entirely before the change range. No need to do anything with it. +// Debug.assert(fullEnd < changeStart); +// } +// } +// +// function extendToAffectedRange(sourceFile: SourceFile, changeRange: TextChangeRange): TextChangeRange { +// // Consider the following code: +// // void foo() { /; } +// // +// // If the text changes with an insertion of / just before the semicolon then we end up with: +// // void foo() { //; } +// // +// // If we were to just use the changeRange a is, then we would not rescan the { token +// // (as it does not intersect the actual original change range). Because an edit may +// // change the token touching it, we actually need to look back *at least* one token so +// // that the prior token sees that change. +// const maxLookahead = 1; +// +// let start = changeRange.span.start; +// +// // the first iteration aligns us with the change start. subsequent iteration move us to +// // the left by maxLookahead tokens. We only need to do this as long as we're not at the +// // start of the tree. +// for (let i = 0; start > 0 && i <= maxLookahead; i++) { +// const nearestNode = findNearestNodeStartingBeforeOrAtPosition(sourceFile, start); +// Debug.assert(nearestNode.pos <= start); +// const position = nearestNode.pos; +// +// start = Math.max(0, position - 1); +// } +// +// const finalSpan = createTextSpanFromBounds(start, textSpanEnd(changeRange.span)); +// const finalLength = changeRange.newLength + (changeRange.span.start - start); +// +// return createTextChangeRange(finalSpan, finalLength); +// } +// +// function findNearestNodeStartingBeforeOrAtPosition(sourceFile: SourceFile, position: number): Node { +// let bestResult: Node = sourceFile; +// let lastNodeEntirelyBeforePosition: Node | undefined; +// +// forEachChild(sourceFile, visit); +// +// if (lastNodeEntirelyBeforePosition) { +// const lastChildOfLastEntireNodeBeforePosition = getLastDescendant(lastNodeEntirelyBeforePosition); +// if (lastChildOfLastEntireNodeBeforePosition.pos > bestResult.pos) { +// bestResult = lastChildOfLastEntireNodeBeforePosition; +// } +// } +// +// return bestResult; +// +// function getLastDescendant(node: Node): Node { +// while (true) { +// const lastChild = getLastChild(node); +// if (lastChild) { +// node = lastChild; +// } +// else { +// return node; +// } +// } +// } +// +// function visit(child: Node) { +// if (nodeIsMissing(child)) { +// // Missing nodes are effectively invisible to us. We never even consider them +// // When trying to find the nearest node before us. +// return; +// } +// +// // If the child intersects this position, then this node is currently the nearest +// // node that starts before the position. +// if (child.pos <= position) { +// if (child.pos >= bestResult.pos) { +// // This node starts before the position, and is closer to the position than +// // the previous best node we found. It is now the new best node. +// bestResult = child; +// } +// +// // Now, the node may overlap the position, or it may end entirely before the +// // position. If it overlaps with the position, then either it, or one of its +// // children must be the nearest node before the position. So we can just +// // recurse into this child to see if we can find something better. +// if (position < child.end) { +// // The nearest node is either this child, or one of the children inside +// // of it. We've already marked this child as the best so far. Recurse +// // in case one of the children is better. +// forEachChild(child, visit); +// +// // Once we look at the children of this node, then there's no need to +// // continue any further. +// return true; +// } +// else { +// Debug.assert(child.end <= position); +// // The child ends entirely before this position. Say you have the following +// // (where $ is the position) +// // +// // ? $ : <...> <...> +// // +// // We would want to find the nearest preceding node in "complex expr 2". +// // To support that, we keep track of this node, and once we're done searching +// // for a best node, we recurse down this node to see if we can find a good +// // result in it. +// // +// // This approach allows us to quickly skip over nodes that are entirely +// // before the position, while still allowing us to find any nodes in the +// // last one that might be what we want. +// lastNodeEntirelyBeforePosition = child; +// } +// } +// else { +// Debug.assert(child.pos > position); +// // We're now at a node that is entirely past the position we're searching for. +// // This node (and all following nodes) could never contribute to the result, +// // so just skip them by returning 'true' here. +// return true; +// } +// } +// } +// +// function checkChangeRange(sourceFile: SourceFile, newText: string, textChangeRange: TextChangeRange, aggressiveChecks: boolean) { +// const oldText = sourceFile.text; +// if (textChangeRange) { +// Debug.assert((oldText.length - textChangeRange.span.length + textChangeRange.newLength) == newText.length); +// +// if (aggressiveChecks || Debug.shouldAssert(AssertionLevel.VeryAggressive)) { +// const oldTextPrefix = oldText.substr(0, textChangeRange.span.start); +// const newTextPrefix = newText.substr(0, textChangeRange.span.start); +// Debug.assert(oldTextPrefix == newTextPrefix); +// +// const oldTextSuffix = oldText.substring(textSpanEnd(textChangeRange.span), oldText.length); +// const newTextSuffix = newText.substring(textSpanEnd(textChangeRangeNewSpan(textChangeRange)), newText.length); +// Debug.assert(oldTextSuffix == newTextSuffix); +// } +// } +// } +// +// interface IncrementalElement extends ReadonlyTextRange { +// readonly parent: Node; +// intersectsChange: boolean; +// length?: number; +// _children: Node[] | undefined; +// } +// +// export interface IncrementalNode extends Node, IncrementalElement { +// hasBeenIncrementallyParsed: boolean; +// } +// +// interface IncrementalNodeArray extends NodeArray, IncrementalElement { +// length: number; +// } +// +// // Allows finding nodes in the source file at a certain position in an efficient manner. +// // The implementation takes advantage of the calling pattern it knows the parser will +// // make in order to optimize finding nodes as quickly as possible. +// export interface SyntaxCursor { +// currentNode(position: number): IncrementalNode; +// } +// +// export function createSyntaxCursor(sourceFile: SourceFile): SyntaxCursor { +// let currentArray: NodeArray = sourceFile.statements; +// let currentArrayIndex = 0; +// +// Debug.assert(currentArrayIndex < currentArray.length); +// let current = currentArray[currentArrayIndex]; +// let lastQueriedPosition = InvalidPosition.Value; +// +// return { +// currentNode(position: number) { +// // Only compute the current node if the position is different than the last time +// // we were asked. The parser commonly asks for the node at the same position +// // twice. Once to know if can read an appropriate list element at a certain point, +// // and then to actually read and consume the node. +// if (position !== lastQueriedPosition) { +// // Much of the time the parser will need the very next node in the array that +// // we just returned a node from.So just simply check for that case and move +// // forward in the array instead of searching for the node again. +// if (current && current.end == position && currentArrayIndex < (currentArray.length - 1)) { +// currentArrayIndex++; +// current = currentArray[currentArrayIndex]; +// } +// +// // If we don't have a node, or the node we have isn't in the right position, +// // then try to find a viable node at the position requested. +// if (!current || current.pos !== position) { +// findHighestListElementThatStartsAtPosition(position); +// } +// } +// +// // Cache this query so that we don't do any extra work if the parser calls back +// // into us. Note: this is very common as the parser will make pairs of calls like +// // 'isListElement -> parseListElement'. If we were unable to find a node when +// // called with 'isListElement', we don't want to redo the work when parseListElement +// // is called immediately after. +// lastQueriedPosition = position; +// +// // Either we don'd have a node, or we have a node at the position being asked for. +// Debug.assert(!current || current.pos == position); +// return current as IncrementalNode; +// } +// }; +// +// // Finds the highest element in the tree we can find that starts at the provided position. +// // The element must be a direct child of some node list in the tree. This way after we +// // return it, we can easily return its next sibling in the list. +// function findHighestListElementThatStartsAtPosition(position: number) { +// // Clear out any cached state about the last node we found. +// currentArray = undefined!; +// currentArrayIndex = InvalidPosition.Value; +// current = undefined!; +// +// // Recurse into the source file to find the highest node at this position. +// forEachChild(sourceFile, visitNode, visitArray); +// return; +// +// function visitNode(node: Node) { +// if (position >= node.pos && position < node.end) { +// // Position was within this node. Keep searching deeper to find the node. +// forEachChild(node, visitNode, visitArray); +// +// // don't proceed any further in the search. +// return true; +// } +// +// // position wasn't in this node, have to keep searching. +// return false; +// } +// +// function visitArray(array: NodeArray) { +// if (position >= array.pos && position < array.end) { +// // position was in this array. Search through this array to see if we find a +// // viable element. +// for (let i = 0; i < array.length; i++) { +// const child = array[i]; +// if (child) { +// if (child.pos == position) { +// // Found the right node. We're done. +// currentArray = array; +// currentArrayIndex = i; +// current = child; +// return true; +// } +// else { +// if (child.pos < position && position < child.end) { +// // Position in somewhere within this child. Search in it and +// // stop searching in this array. +// forEachChild(child, visitNode, visitArray); +// return true; +// } +// } +// } +// } +// } +// +// // position wasn't in this array, have to keep searching. +// return false; +// } +// } +// } +// +// const enum InvalidPosition { +// Value = -1 +// } +// } +// +// /** @internal */ +// export function isDeclarationFileName(fileName: string): boolean { +// return fileExtensionIsOneOf(fileName, supportedDeclarationExtensions); +// } +// +// /*@internal*/ +// export interface PragmaContext { +// languageVersion: ScriptTarget; +// pragmas?: PragmaMap; +// checkJsDirective?: CheckJsDirective; +// referencedFiles: FileReference[]; +// typeReferenceDirectives: FileReference[]; +// libReferenceDirectives: FileReference[]; +// amdDependencies: AmdDependency[]; +// hasNoDefaultLib?: boolean; +// moduleName?: string; +// } +// +// function parseResolutionMode(mode: string | undefined, pos: number, end: number, reportDiagnostic: PragmaDiagnosticReporter): ModuleKind.ESNext | ModuleKind.CommonJS | undefined { +// if (!mode) { +// return undefined; +// } +// if (mode == "import") { +// return ModuleKind.ESNext; +// } +// if (mode == "require") { +// return ModuleKind.CommonJS; +// } +// reportDiagnostic(pos, end - pos, Diagnostics.resolution_mode_should_be_either_require_or_import); +// return undefined; +// } +// +// /*@internal*/ +// export function processCommentPragmas(context: PragmaContext, sourceText: string): void { +// const pragmas: PragmaPseudoMapEntry[] = []; +// +// for (const range of getLeadingCommentRanges(sourceText, 0) || emptyArray) { +// const comment = sourceText.substring(range.pos, range.end); +// extractPragmas(pragmas, range, comment); +// } +// +// context.pragmas = new Map() as PragmaMap; +// for (const pragma of pragmas) { +// if (context.pragmas.has(pragma.name)) { +// const currentValue = context.pragmas.get(pragma.name); +// if (currentValue instanceof Array) { +// currentValue.push(pragma.args); +// } +// else { +// context.pragmas.set(pragma.name, [currentValue, pragma.args]); +// } +// continue; +// } +// context.pragmas.set(pragma.name, pragma.args); +// } +// } +// +// /*@internal*/ +// type PragmaDiagnosticReporter = (pos: number, length: number, message: DiagnosticMessage) => void; +// +// /*@internal*/ +// export function processPragmasIntoFields(context: PragmaContext, reportDiagnostic: PragmaDiagnosticReporter): void { +// context.checkJsDirective = undefined; +// context.referencedFiles = []; +// context.typeReferenceDirectives = []; +// context.libReferenceDirectives = []; +// context.amdDependencies = []; +// context.hasNoDefaultLib = false; +// context.pragmas!.forEach((entryOrList, key) => { // TODO: GH#18217 +// // TODO: The below should be strongly type-guarded and not need casts/explicit annotations, since entryOrList is related to +// // key and key is constrained to a union; but it's not (see GH#21483 for at least partial fix) :( +// switch (key) { +// case "reference": { +// const referencedFiles = context.referencedFiles; +// const typeReferenceDirectives = context.typeReferenceDirectives; +// const libReferenceDirectives = context.libReferenceDirectives; +// forEach(toArray(entryOrList) as PragmaPseudoMap["reference"][], arg => { +// const { types, lib, path, ["resolution-mode"]: res } = arg.arguments; +// if (arg.arguments["no-default-lib"]) { +// context.hasNoDefaultLib = true; +// } +// else if (types) { +// const parsed = parseResolutionMode(res, types.pos, types.end, reportDiagnostic); +// typeReferenceDirectives.push({ pos: types.pos, end: types.end, fileName: types.value, ...(parsed ? { resolutionMode: parsed } : {}) }); +// } +// else if (lib) { +// libReferenceDirectives.push({ pos: lib.pos, end: lib.end, fileName: lib.value }); +// } +// else if (path) { +// referencedFiles.push({ pos: path.pos, end: path.end, fileName: path.value }); +// } +// else { +// reportDiagnostic(arg.range.pos, arg.range.end - arg.range.pos, Diagnostics.Invalid_reference_directive_syntax); +// } +// }); +// break; +// } +// case "amd-dependency": { +// context.amdDependencies = map( +// toArray(entryOrList) as PragmaPseudoMap["amd-dependency"][], +// x => ({ name: x.arguments.name, path: x.arguments.path })); +// break; +// } +// case "amd-module": { +// if (entryOrList instanceof Array) { +// for (const entry of entryOrList) { +// if (context.moduleName) { +// // TODO: It's probably fine to issue this diagnostic on all instances of the pragma +// reportDiagnostic(entry.range.pos, entry.range.end - entry.range.pos, Diagnostics.An_AMD_module_cannot_have_multiple_name_assignments); +// } +// context.moduleName = (entry as PragmaPseudoMap["amd-module"]).arguments.name; +// } +// } +// else { +// context.moduleName = (entryOrList as PragmaPseudoMap["amd-module"]).arguments.name; +// } +// break; +// } +// case "ts-nocheck": +// case "ts-check": { +// // _last_ of either nocheck or check in a file is the "winner" +// forEach(toArray(entryOrList), entry => { +// if (!context.checkJsDirective || entry.range.pos > context.checkJsDirective.pos) { +// context.checkJsDirective = { +// enabled: key == "ts-check", +// end: entry.range.end, +// pos: entry.range.pos +// }; +// } +// }); +// break; +// } +// case "jsx": +// case "jsxfrag": +// case "jsximportsource": +// case "jsxruntime": +// return; // Accessed directly +// default: Debug.fail("Unhandled pragma kind"); // Can this be made into an assertNever in the future? +// } +// }); +// } +// +// const namedArgRegExCache = new Map(); +// function getNamedArgRegEx(name: string): RegExp { +// if (namedArgRegExCache.has(name)) { +// return namedArgRegExCache.get(name)!; +// } +// const result = new RegExp(`(\\s${name}\\s*=\\s*)(?:(?:'([^']*)')|(?:"([^"]*)"))`, "im"); +// namedArgRegExCache.set(name, result); +// return result; +// } +// +// const tripleSlashXMLCommentStartRegEx = /^\/\/\/\s*<(\S+)\s.*?\/>/im; +// const singleLinePragmaRegEx = /^\/\/\/?\s*@(\S+)\s*(.*)\s*$/im; +// function extractPragmas(pragmas: PragmaPseudoMapEntry[], range: CommentRange, text: string) { +// const tripleSlash = range.kind == SyntaxKind::SingleLineCommentTrivia && tripleSlashXMLCommentStartRegEx.exec(text); +// if (tripleSlash) { +// const name = tripleSlash[1].toLowerCase() as keyof PragmaPseudoMap; // Technically unsafe cast, but we do it so the below check to make it safe typechecks +// const pragma = commentPragmas[name] as PragmaDefinition; +// if (!pragma || !(pragma.kind! & PragmaKindFlags.TripleSlashXML)) { +// return; +// } +// if (pragma.args) { +// const argument: {[index: string]: string | {value: string, pos: number, end: number}} = {}; +// for (const arg of pragma.args) { +// const matcher = getNamedArgRegEx(arg.name); +// const matchResult = matcher.exec(text); +// if (!matchResult && !arg.optional) { +// return; // Missing required argument, don't parse +// } +// else if (matchResult) { +// const value = matchResult[2] || matchResult[3]; +// if (arg.captureSpan) { +// const startPos = range.pos + matchResult.index + matchResult[1].length + 1; +// argument[arg.name] = { +// value, +// pos: startPos, +// end: startPos + value.length +// }; +// } +// else { +// argument[arg.name] = value; +// } +// } +// } +// pragmas.push({ name, args: { arguments: argument, range } } as PragmaPseudoMapEntry); +// } +// else { +// pragmas.push({ name, args: { arguments: {}, range } } as PragmaPseudoMapEntry); +// } +// return; +// } +// +// const singleLine = range.kind == SyntaxKind::SingleLineCommentTrivia && singleLinePragmaRegEx.exec(text); +// if (singleLine) { +// return addPragmaForMatch(pragmas, range, PragmaKindFlags.SingleLine, singleLine); +// } +// +// if (range.kind == SyntaxKind::MultiLineCommentTrivia) { +// const multiLinePragmaRegEx = /@(\S+)(\s+.*)?$/gim; // Defined inline since it uses the "g" flag, which keeps a persistent index (for iterating) +// let multiLineMatch: RegExpExecArray | null; +// while (multiLineMatch = multiLinePragmaRegEx.exec(text)) { +// addPragmaForMatch(pragmas, range, PragmaKindFlags.MultiLine, multiLineMatch); +// } +// } +// } +// +// function addPragmaForMatch(pragmas: PragmaPseudoMapEntry[], range: CommentRange, kind: PragmaKindFlags, match: RegExpExecArray) { +// if (!match) return; +// const name = match[1].toLowerCase() as keyof PragmaPseudoMap; // Technically unsafe cast, but we do it so they below check to make it safe typechecks +// const pragma = commentPragmas[name] as PragmaDefinition; +// if (!pragma || !(pragma.kind! & kind)) { +// return; +// } +// const args = match[2]; // Split on spaces and match up positionally with definition +// const argument = getNamedPragmaArguments(pragma, args); +// if (argument == "fail") return; // Missing required argument, fail to parse it +// pragmas.push({ name, args: { arguments: argument, range } } as PragmaPseudoMapEntry); +// return; +// } +// +// function getNamedPragmaArguments(pragma: PragmaDefinition, text: string | undefined): {[index: string]: string} | "fail" { +// if (!text) return {}; +// if (!pragma.args) return {}; +// const args = trimString(text).split(/\s+/); +// const argMap: {[index: string]: string} = {}; +// for (let i = 0; i < pragma.args.length; i++) { +// const argument = pragma.args[i]; +// if (!args[i] && !argument.optional) { +// return "fail"; +// } +// if (argument.captureSpan) { +// return Debug.fail("Capture spans not yet implemented for non-xml pragmas"); +// } +// argMap[argument.name] = args[i]; +// } +// return argMap; +// } +// +// /** @internal */ +// export function tagNamesAreEquivalent(lhs: JsxTagNameExpression, rhs: JsxTagNameExpression): boolean { +// if (lhs.kind !== rhs.kind) { +// return false; +// } +// +// if (lhs.kind == SyntaxKind::Identifier) { +// return lhs.escapedText == (rhs as Identifier).escapedText; +// } +// +// if (lhs.kind == SyntaxKind::ThisKeyword) { +// return true; +// } +// +// // If we are at this statement then we must have PropertyAccessExpression and because tag name in Jsx element can only +// // take forms of JsxTagNameExpression which includes an identifier, "this" expression, or another propertyAccessExpression +// // it is safe to case the expression property as such. See parseJsxElementName for how we parse tag name in Jsx element +// return (lhs as PropertyAccessExpression).name.escapedText == (rhs as PropertyAccessExpression).name.escapedText && +// tagNamesAreEquivalent((lhs as PropertyAccessExpression).expression as JsxTagNameExpression, (rhs as PropertyAccessExpression).expression as JsxTagNameExpression); +// } +} diff --git a/src/scanner.cpp b/src/scanner.cpp new file mode 100644 index 0000000..868607d --- /dev/null +++ b/src/scanner.cpp @@ -0,0 +1,1693 @@ +#include +#include +#include "scanner.h" +#include "utf.h" +#include "core.h" +#include "utilities.h" +#include "diagnostic_messages.h" +#include + +using namespace ts; +using namespace std; + +bool isShebangTrivia(string &text, int pos) { + // Shebangs check must only be done at the start of the file + // Debug.assert(pos == 0); + // return shebangTriviaRegex.test(text); + //todo: implement + return false; +} + +bool isWhiteSpaceSingleLine(CharCode ch) { + // Note: nextLine is in the Zs space, and should be considered to be a whitespace. + // It is explicitly not a line-break as it isn't in the exact set specified by EcmaScript. + return ch.code == CharacterCodes::space || + ch.code == CharacterCodes::tab || + ch.code == CharacterCodes::verticalTab || + ch.code == CharacterCodes::formFeed || + ch.code == CharacterCodes::nonBreakingSpace || + ch.code == CharacterCodes::nextLine || + ch.code == CharacterCodes::ogham || + (ch.code >= CharacterCodes::enQuad && ch.code <= CharacterCodes::zeroWidthSpace) || + ch.code == CharacterCodes::narrowNoBreakSpace || + ch.code == CharacterCodes::mathematicalSpace || + ch.code == CharacterCodes::ideographicSpace || + ch.code == CharacterCodes::byteOrderMark; +} + +bool isLineBreak(CharCode ch) { + // ES5 7.3: + // The ECMAScript line terminator characters are listed in Table 3. + // Table 3: Line Terminator Characters + // Code Unit Value Name Formal Name + // \u000A Line Feed + // \u000D Carriage Return + // \u2028 Line separator + // \u2029 Paragraph separator + // Only the characters in Table 3 are treated as line terminators. Other new line or line + // breaking characters are treated as white space but not as line terminators. + + return ch.code == CharacterCodes::lineFeed || + ch.code == CharacterCodes::carriageReturn || + ch.code == CharacterCodes::lineSeparator || + ch.code == CharacterCodes::paragraphSeparator; +} + +string Scanner::scanString(bool jsxAttributeString) { + auto quote = charCodeAt(text, pos); + pos++; + string result = ""; + auto start = pos; + while (true) { + if (pos >= end) { + result += text.substr(start, pos); + tokenFlags |= TokenFlags::Unterminated; +// error(Diagnostics::Unterminated_string_literal); + break; + } + auto ch = charCodeAt(text, pos); + if (ch.code == quote.code) { + result += text.substr(start, pos); + pos++; + break; + } + if (ch.code == CharacterCodes::backslash && !jsxAttributeString) { + result += text.substr(start, pos); + result += scanEscapeSequence(); + start = pos; + continue; + } + if (isLineBreak(ch) && !jsxAttributeString) { + result += text.substr(start, pos); + tokenFlags |= TokenFlags::Unterminated; +// error(Diagnostics::Unterminated_string_literal); + break; + } + pos++; + } + return result; +} + +bool isDigit(CharCode ch) { + return ch.code >= CharacterCodes::_0 && ch.code <= CharacterCodes::_9; +} + +bool isHexDigit(CharCode ch) { + return isDigit(ch) || (ch.code >= CharacterCodes::A && ch.code <= CharacterCodes::F) || + (ch.code >= CharacterCodes::a && ch.code <= CharacterCodes::f); +} + +string Scanner::scanMinimumNumberOfHexDigits(int count, bool canHaveSeparators) { + return scanHexDigits(/*minCount*/ count, /*scanAsManyAsPossible*/ true, canHaveSeparators); +} + +string Scanner::scanHexDigits(int minCount, bool scanAsManyAsPossible, bool canHaveSeparators) { + auto allowSeparator = false; + auto isPreviousTokenSeparator = false; + auto found = 0; + string result; + while (found < minCount || scanAsManyAsPossible) { + auto ch = charCodeAt(text, pos); + if (canHaveSeparators && ch.code == CharacterCodes::_) { + tokenFlags |= TokenFlags::ContainsSeparator; + if (allowSeparator) { + allowSeparator = false; + isPreviousTokenSeparator = true; + } else if (isPreviousTokenSeparator) { +// error(Diagnostics::Multiple_consecutive_numeric_separators_are_not_permitted, pos, 1); + } else { +// error(Diagnostics::Numeric_separators_are_not_allowed_here, pos, 1); + } + pos++; + continue; + } + allowSeparator = canHaveSeparators; + if (ch.code >= CharacterCodes::A && ch.code <= CharacterCodes::F) { + ch.code += CharacterCodes::a - CharacterCodes::A; // standardize hex literals to lowercase + } else if (!((ch.code >= CharacterCodes::_0 && ch.code <= CharacterCodes::_9) || + (ch.code >= CharacterCodes::a && ch.code <= CharacterCodes::f) + )) { + break; + } + found++; + result.append(text.substr(pos, ch.length)); + pos++; + isPreviousTokenSeparator = false; + } + +// if (text.charCodeAt(pos - 1) === CharacterCodes::_) { +// error(Diagnostics::Numeric_separators_are_not_allowed_here, pos - 1, 1); +// } + + return result; +} + +bool isCodePoint(CharCode ch) { + return ch.code <= 0x10FFFF; +} + + +int Scanner::scanExactNumberOfHexDigits(int count, bool canHaveSeparators) { + auto valueString = scanHexDigits(/*minCount*/ count, /*scanAsManyAsPossible*/ false, canHaveSeparators); + return !valueString.empty() ? stoi(valueString, nullptr, 16) : -1; +} + +string Scanner::scanHexadecimalEscape(int numDigits) { + auto escapedValue = scanExactNumberOfHexDigits(numDigits, /*canHaveSeparators*/ false); + + if (escapedValue >= 0) { + return fromCharCode(escapedValue); + } else { +// error(Diagnostics::Hexadecimal_digit_expected); + return ""; + } +} + +string Scanner::scanExtendedUnicodeEscape() { + auto escapedValueString = scanMinimumNumberOfHexDigits(1, /*canHaveSeparators*/ false); + auto escapedValue = !escapedValueString.empty() ? stoi(escapedValueString, nullptr, 16) : -1; + auto isInvalidExtendedEscape = false; + + // Validate the value of the digit + if (escapedValue < 0) { +// error(Diagnostics::Hexadecimal_digit_expected); + isInvalidExtendedEscape = true; + } else if (escapedValue > 0x10FFFF) { +// error(Diagnostics::An_extended_Unicode_escape_value_must_be_between_0x0_and_0x10FFFF_inclusive); + isInvalidExtendedEscape = true; + } + + if (pos >= end) { +// error(Diagnostics::Unexpected_end_of_text); + isInvalidExtendedEscape = true; + } else if (charCodeAt(text, pos).code == CharacterCodes::closeBrace) { + // Only swallow the following character up if it's a '}'. + pos++; + } else { +// error(Diagnostics::Unterminated_Unicode_escape_sequence); + isInvalidExtendedEscape = true; + } + + if (isInvalidExtendedEscape) { + return ""; + } + + return fromCharCode(escapedValue); +// return utf16EncodeAsString(escapedValue); +} + +string Scanner::scanEscapeSequence(bool isTaggedTemplate) { + auto start = pos; + pos++; + if (pos >= end) { +// error(Diagnostics::Unexpected_end_of_text); + return ""; + } + auto ch = charCodeAt(text, pos); + pos++; + switch (ch.code) { + case CharacterCodes::_0: + // '\01' + if (isTaggedTemplate && pos < end && isDigit(charCodeAt(text, pos))) { + pos++; + tokenFlags |= TokenFlags::ContainsInvalidEscape; + return text.substr(start, pos); + } + return "\0"; + case CharacterCodes::b: + return "\b"; + case CharacterCodes::t: + return "\t"; + case CharacterCodes::n: + return "\n"; + case CharacterCodes::v: + return "\v"; + case CharacterCodes::f: + return "\f"; + case CharacterCodes::r: + return "\r"; + case CharacterCodes::singleQuote: + return "\'"; + case CharacterCodes::doubleQuote: + return "\""; + case CharacterCodes::u: + if (isTaggedTemplate) { + // '\u' or '\u0' or '\u00' or '\u000' + for (auto escapePos = pos; escapePos < pos + 4; escapePos++) { + if (escapePos < end && !isHexDigit(charCodeAt(text, escapePos)) && + charCodeAt(text, escapePos).code != CharacterCodes::openBrace) { + pos = escapePos; + tokenFlags |= TokenFlags::ContainsInvalidEscape; + return text.substr(start, pos); + } + } + } + // '\u{DDDDDDDD}' + if (pos < end && charCodeAt(text, pos).code == CharacterCodes::openBrace) { + pos++; + + // '\u{' + if (isTaggedTemplate && !isHexDigit(charCodeAt(text, pos))) { + tokenFlags |= TokenFlags::ContainsInvalidEscape; + return text.substr(start, pos); + } + + if (isTaggedTemplate) { + auto savePos = pos; + auto escapedValueString = scanMinimumNumberOfHexDigits(1, /*canHaveSeparators*/ false); + + try { + auto escapedValue = !escapedValueString.empty() ? stoi(escapedValueString, nullptr, 16) : -1; + + // '\u{Not Code Point' or '\u{CodePoint' + if (charCodeAt(text, pos).code != CharacterCodes::closeBrace) { + tokenFlags |= TokenFlags::ContainsInvalidEscape; + return text.substr(start, pos); + } else { + pos = savePos; + } + } catch (invalid_argument &error) { + tokenFlags |= TokenFlags::ContainsInvalidEscape; + return text.substr(start, pos); + } + } + tokenFlags |= TokenFlags::ExtendedUnicodeEscape; + return scanExtendedUnicodeEscape(); + } + + tokenFlags |= TokenFlags::UnicodeEscape; + // '\uDDDD' + return scanHexadecimalEscape(/*numDigits*/ 4); + + case CharacterCodes::x: + if (isTaggedTemplate) { + if (!isHexDigit(charCodeAt(text, pos))) { + tokenFlags |= TokenFlags::ContainsInvalidEscape; + return text.substr(start, pos); + } else if (!isHexDigit(charCodeAt(text, pos + 1))) { + pos++; + tokenFlags |= TokenFlags::ContainsInvalidEscape; + return text.substr(start, pos); + } + } + // '\xDD' + return scanHexadecimalEscape(/*numDigits*/ 2); + + // when encountering a LineContinuation (i.e. a backslash and a line terminator sequence), + // the line terminator is interpreted to be "the empty code unit sequence". + case CharacterCodes::carriageReturn: + if (pos < end && charCodeAt(text, pos).code == CharacterCodes::lineFeed) { + pos++; + } + // falls through + case CharacterCodes::lineFeed: + case CharacterCodes::lineSeparator: + case CharacterCodes::paragraphSeparator: + return ""; + default: + return fromCharCode(ch.code); + } +} + +SyntaxKind Scanner::scanTemplateAndSetTokenValue(bool isTaggedTemplate) { + auto startedWithBacktick = charCodeAt(text, pos).code == CharacterCodes::backtick; + + pos++; + auto start = pos; + string contents; + SyntaxKind resultingToken; + + while (true) { + if (pos >= end) { + contents += text.substr(start, pos); + tokenFlags |= TokenFlags::Unterminated; +// error(Diagnostics::Unterminated_template_literal); + resultingToken = startedWithBacktick ? SyntaxKind::NoSubstitutionTemplateLiteral : SyntaxKind::TemplateTail; + break; + } + + auto currChar = charCodeAt(text, pos); + + // '`' + if (currChar.code == CharacterCodes::backtick) { + contents += text.substr(start, pos); + pos++; + resultingToken = startedWithBacktick ? SyntaxKind::NoSubstitutionTemplateLiteral : SyntaxKind::TemplateTail; + break; + } + + // '${' + if (currChar.code == CharacterCodes::$ && pos + 1 < end && charCodeAt(text, pos + 1).code == CharacterCodes::openBrace) { + contents += text.substr(start, pos); + pos += 2; + resultingToken = startedWithBacktick ? SyntaxKind::TemplateHead : SyntaxKind::TemplateMiddle; + break; + } + + // Escape character + if (currChar.code == CharacterCodes::backslash) { + contents += text.substr(start, pos); + contents += scanEscapeSequence(isTaggedTemplate); + start = pos; + continue; + } + + // Speculated ECMAScript 6 Spec 11.8.6.1: + // and LineTerminatorSequences are normalized to for Template Values + if (currChar.code == CharacterCodes::carriageReturn) { + contents += text.substr(start, pos); + pos++; + + if (pos < end && charCodeAt(text, pos).code == CharacterCodes::lineFeed) { + pos++; + } + + contents += "\n"; + start = pos; + continue; + } + + pos++; + } + +// Debug.assert(resultingToken !== undefined); + + tokenValue = contents; + return resultingToken; +} + +string Scanner::scanNumberFragment() { + auto start = pos; + auto allowSeparator = false; + auto isPreviousTokenSeparator = false; + string result; + while (true) { + auto ch = charCodeAt(text, pos); + if (ch.code == CharacterCodes::_) { + tokenFlags |= TokenFlags::ContainsSeparator; + if (allowSeparator) { + allowSeparator = false; + isPreviousTokenSeparator = true; + result += text.substr(start, pos); + } else if (isPreviousTokenSeparator) { +// error(Diagnostics::Multiple_consecutive_numeric_separators_are_not_permitted, pos, 1); + } else { +// error(Diagnostics::Numeric_separators_are_not_allowed_here, pos, 1); + } + pos++; + start = pos; + continue; + } + if (isDigit(ch)) { + allowSeparator = true; + isPreviousTokenSeparator = false; + pos++; + continue; + } + break; + } + if (charCodeAt(text, pos - 1).code == CharacterCodes::_) { +// error(Diagnostics::Numeric_separators_are_not_allowed_here, pos - 1, 1); + } + return result + text.substr(start, pos); +} + +map textToKeyword{ + {"abstract", SyntaxKind::AbstractKeyword}, + {"any", SyntaxKind::AnyKeyword}, + {"as", SyntaxKind::AsKeyword}, + {"asserts", SyntaxKind::AssertsKeyword}, + {"assert", SyntaxKind::AssertKeyword}, + {"bigint", SyntaxKind::BigIntKeyword}, + {"boolean", SyntaxKind::BooleanKeyword}, + {"break", SyntaxKind::BreakKeyword}, + {"case", SyntaxKind::CaseKeyword}, + {"catch", SyntaxKind::CatchKeyword}, + {"class", SyntaxKind::ClassKeyword}, + {"continue", SyntaxKind::ContinueKeyword}, + {"const", SyntaxKind::ConstKeyword}, + {"constructor", SyntaxKind::ConstructorKeyword}, + {"debugger", SyntaxKind::DebuggerKeyword}, + {"declare", SyntaxKind::DeclareKeyword}, + {"default", SyntaxKind::DefaultKeyword}, + {"delete", SyntaxKind::DeleteKeyword}, + {"do", SyntaxKind::DoKeyword}, + {"else", SyntaxKind::ElseKeyword}, + {"enum", SyntaxKind::EnumKeyword}, + {"export", SyntaxKind::ExportKeyword}, + {"extends", SyntaxKind::ExtendsKeyword}, + {"false", SyntaxKind::FalseKeyword}, + {"finally", SyntaxKind::FinallyKeyword}, + {"for", SyntaxKind::ForKeyword}, + {"from", SyntaxKind::FromKeyword}, + {"function", SyntaxKind::FunctionKeyword}, + {"get", SyntaxKind::GetKeyword}, + {"if", SyntaxKind::IfKeyword}, + {"implements", SyntaxKind::ImplementsKeyword}, + {"import", SyntaxKind::ImportKeyword}, + {"in", SyntaxKind::InKeyword}, + {"infer", SyntaxKind::InferKeyword}, + {"instanceof", SyntaxKind::InstanceOfKeyword}, + {"interface", SyntaxKind::InterfaceKeyword}, + {"intrinsic", SyntaxKind::IntrinsicKeyword}, + {"is", SyntaxKind::IsKeyword}, + {"keyof", SyntaxKind::KeyOfKeyword}, + {"let", SyntaxKind::LetKeyword}, + {"module", SyntaxKind::ModuleKeyword}, + {"namespace", SyntaxKind::NamespaceKeyword}, + {"never", SyntaxKind::NeverKeyword}, + {"new", SyntaxKind::NewKeyword}, + {"null", SyntaxKind::NullKeyword}, + {"number", SyntaxKind::NumberKeyword}, + {"object", SyntaxKind::ObjectKeyword}, + {"package", SyntaxKind::PackageKeyword}, + {"private", SyntaxKind::PrivateKeyword}, + {"protected", SyntaxKind::ProtectedKeyword}, + {"public", SyntaxKind::PublicKeyword}, + {"override", SyntaxKind::OverrideKeyword}, + {"out", SyntaxKind::OutKeyword}, + {"readonly", SyntaxKind::ReadonlyKeyword}, + {"require", SyntaxKind::RequireKeyword}, + {"global", SyntaxKind::GlobalKeyword}, + {"return", SyntaxKind::ReturnKeyword}, + {"set", SyntaxKind::SetKeyword}, + {"static", SyntaxKind::StaticKeyword}, + {"string", SyntaxKind::StringKeyword}, + {"super", SyntaxKind::SuperKeyword}, + {"switch", SyntaxKind::SwitchKeyword}, + {"symbol", SyntaxKind::SymbolKeyword}, + {"this", SyntaxKind::ThisKeyword}, + {"throw", SyntaxKind::ThrowKeyword}, + {"true", SyntaxKind::TrueKeyword}, + {"try", SyntaxKind::TryKeyword}, + {"type", SyntaxKind::TypeKeyword}, + {"typeof", SyntaxKind::TypeOfKeyword}, + {"undefined", SyntaxKind::UndefinedKeyword}, + {"unique", SyntaxKind::UniqueKeyword}, + {"unknown", SyntaxKind::UnknownKeyword}, + {"var", SyntaxKind::VarKeyword}, + {"void", SyntaxKind::VoidKeyword}, + {"while", SyntaxKind::WhileKeyword}, + {"with", SyntaxKind::WithKeyword}, + {"yield", SyntaxKind::YieldKeyword}, + {"async", SyntaxKind::AsyncKeyword}, + {"await", SyntaxKind::AwaitKeyword}, + {"of", SyntaxKind::OfKeyword}, +}; + +/* + As per ECMAScript Language Specification 3th Edition, Section 7.6: Identifiers + IdentifierStart :: + Can contain Unicode 3.0.0 categories: + Uppercase letter (Lu), + Lowercase letter (Ll), + Titlecase letter (Lt), + Modifier letter (Lm), + Other letter (Lo), or + Letter number (Nl). + IdentifierPart :: = + Can contain IdentifierStart + Unicode 3.0.0 categories: + Non-spacing mark (Mn), + Combining spacing mark (Mc), + Decimal number (Nd), or + Connector punctuation (Pc). + + Codepoint ranges for ES3 Identifiers are extracted from the Unicode 3.0.0 specification at: + http://www.unicode.org/Public/3.0-Update/UnicodeData-3.0.0.txt +*/ +vector 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,}; +vector 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,}; + +/* + As per ECMAScript Language Specification 5th Edition, Section 7.6: ISyntaxToken Names and Identifiers + IdentifierStart :: + Can contain Unicode 6.2 categories: + Uppercase letter (Lu), + Lowercase letter (Ll), + Titlecase letter (Lt), + Modifier letter (Lm), + Other letter (Lo), or + Letter number (Nl). + IdentifierPart :: + Can contain IdentifierStart + Unicode 6.2 categories: + Non-spacing mark (Mn), + Combining spacing mark (Mc), + Decimal number (Nd), + Connector punctuation (Pc), + , or + . + + Codepoint ranges for ES5 Identifiers are extracted from the Unicode 6.2 specification at: + http://www.unicode.org/Public/6.2.0/ucd/UnicodeData.txt +*/ +vector unicodeES5IdentifierStart = {170, 170, 181, 181, 186, 186, 192, 214, 216, 246, 248, 705, 710, 721, 736, 740, 748, 748, 750, 750, 880, 884, 886, 887, 890, 893, 902, + 902, 904, 906, 908, 908, 910, 929, 931, 1013, 1015, 1153, 1162, 1319, 1329, 1366, 1369, 1369, 1377, 1415, 1488, 1514, 1520, 1522, + 1568, 1610, 1646, 1647, 1649, 1747, 1749, 1749, 1765, 1766, 1774, 1775, 1786, 1788, 1791, 1791, 1808, 1808, 1810, 1839, 1869, 1957, + 1969, 1969, 1994, 2026, 2036, 2037, 2042, 2042, 2048, 2069, 2074, 2074, 2084, 2084, 2088, 2088, 2112, 2136, 2208, 2208, 2210, 2220, + 2308, 2361, 2365, 2365, 2384, 2384, 2392, 2401, 2417, 2423, 2425, 2431, 2437, 2444, 2447, 2448, 2451, 2472, 2474, 2480, 2482, 2482, + 2486, 2489, 2493, 2493, 2510, 2510, 2524, 2525, 2527, 2529, 2544, 2545, 2565, 2570, 2575, 2576, 2579, 2600, 2602, 2608, 2610, 2611, + 2613, 2614, 2616, 2617, 2649, 2652, 2654, 2654, 2674, 2676, 2693, 2701, 2703, 2705, 2707, 2728, 2730, 2736, 2738, 2739, 2741, 2745, + 2749, 2749, 2768, 2768, 2784, 2785, 2821, 2828, 2831, 2832, 2835, 2856, 2858, 2864, 2866, 2867, 2869, 2873, 2877, 2877, 2908, 2909, + 2911, 2913, 2929, 2929, 2947, 2947, 2949, 2954, 2958, 2960, 2962, 2965, 2969, 2970, 2972, 2972, 2974, 2975, 2979, 2980, 2984, 2986, + 2990, 3001, 3024, 3024, 3077, 3084, 3086, 3088, 3090, 3112, 3114, 3123, 3125, 3129, 3133, 3133, 3160, 3161, 3168, 3169, 3205, 3212, + 3214, 3216, 3218, 3240, 3242, 3251, 3253, 3257, 3261, 3261, 3294, 3294, 3296, 3297, 3313, 3314, 3333, 3340, 3342, 3344, 3346, 3386, + 3389, 3389, 3406, 3406, 3424, 3425, 3450, 3455, 3461, 3478, 3482, 3505, 3507, 3515, 3517, 3517, 3520, 3526, 3585, 3632, 3634, 3635, + 3648, 3654, 3713, 3714, 3716, 3716, 3719, 3720, 3722, 3722, 3725, 3725, 3732, 3735, 3737, 3743, 3745, 3747, 3749, 3749, 3751, 3751, + 3754, 3755, 3757, 3760, 3762, 3763, 3773, 3773, 3776, 3780, 3782, 3782, 3804, 3807, 3840, 3840, 3904, 3911, 3913, 3948, 3976, 3980, + 4096, 4138, 4159, 4159, 4176, 4181, 4186, 4189, 4193, 4193, 4197, 4198, 4206, 4208, 4213, 4225, 4238, 4238, 4256, 4293, 4295, 4295, + 4301, 4301, 4304, 4346, 4348, 4680, 4682, 4685, 4688, 4694, 4696, 4696, 4698, 4701, 4704, 4744, 4746, 4749, 4752, 4784, 4786, 4789, + 4792, 4798, 4800, 4800, 4802, 4805, 4808, 4822, 4824, 4880, 4882, 4885, 4888, 4954, 4992, 5007, 5024, 5108, 5121, 5740, 5743, 5759, + 5761, 5786, 5792, 5866, 5870, 5872, 5888, 5900, 5902, 5905, 5920, 5937, 5952, 5969, 5984, 5996, 5998, 6000, 6016, 6067, 6103, 6103, + 6108, 6108, 6176, 6263, 6272, 6312, 6314, 6314, 6320, 6389, 6400, 6428, 6480, 6509, 6512, 6516, 6528, 6571, 6593, 6599, 6656, 6678, + 6688, 6740, 6823, 6823, 6917, 6963, 6981, 6987, 7043, 7072, 7086, 7087, 7098, 7141, 7168, 7203, 7245, 7247, 7258, 7293, 7401, 7404, + 7406, 7409, 7413, 7414, 7424, 7615, 7680, 7957, 7960, 7965, 7968, 8005, 8008, 8013, 8016, 8023, 8025, 8025, 8027, 8027, 8029, 8029, + 8031, 8061, 8064, 8116, 8118, 8124, 8126, 8126, 8130, 8132, 8134, 8140, 8144, 8147, 8150, 8155, 8160, 8172, 8178, 8180, 8182, 8188, + 8305, 8305, 8319, 8319, 8336, 8348, 8450, 8450, 8455, 8455, 8458, 8467, 8469, 8469, 8473, 8477, 8484, 8484, 8486, 8486, 8488, 8488, + 8490, 8493, 8495, 8505, 8508, 8511, 8517, 8521, 8526, 8526, 8544, 8584, 11264, 11310, 11312, 11358, 11360, 11492, 11499, 11502, 11506, + 11507, 11520, 11557, 11559, 11559, 11565, 11565, 11568, 11623, 11631, 11631, 11648, 11670, 11680, 11686, 11688, 11694, 11696, 11702, + 11704, 11710, 11712, 11718, 11720, 11726, 11728, 11734, 11736, 11742, 11823, 11823, 12293, 12295, 12321, 12329, 12337, 12341, 12344, + 12348, 12353, 12438, 12445, 12447, 12449, 12538, 12540, 12543, 12549, 12589, 12593, 12686, 12704, 12730, 12784, 12799, 13312, 19893, + 19968, 40908, 40960, 42124, 42192, 42237, 42240, 42508, 42512, 42527, 42538, 42539, 42560, 42606, 42623, 42647, 42656, 42735, 42775, + 42783, 42786, 42888, 42891, 42894, 42896, 42899, 42912, 42922, 43000, 43009, 43011, 43013, 43015, 43018, 43020, 43042, 43072, 43123, + 43138, 43187, 43250, 43255, 43259, 43259, 43274, 43301, 43312, 43334, 43360, 43388, 43396, 43442, 43471, 43471, 43520, 43560, 43584, + 43586, 43588, 43595, 43616, 43638, 43642, 43642, 43648, 43695, 43697, 43697, 43701, 43702, 43705, 43709, 43712, 43712, 43714, 43714, + 43739, 43741, 43744, 43754, 43762, 43764, 43777, 43782, 43785, 43790, 43793, 43798, 43808, 43814, 43816, 43822, 43968, 44002, 44032, + 55203, 55216, 55238, 55243, 55291, 63744, 64109, 64112, 64217, 64256, 64262, 64275, 64279, 64285, 64285, 64287, 64296, 64298, 64310, + 64312, 64316, 64318, 64318, 64320, 64321, 64323, 64324, 64326, 64433, 64467, 64829, 64848, 64911, 64914, 64967, 65008, 65019, 65136, + 65140, 65142, 65276, 65313, 65338, 65345, 65370, 65382, 65470, 65474, 65479, 65482, 65487, 65490, 65495, 65498, 65500,}; +vector unicodeES5IdentifierPart = {170, 170, 181, 181, 186, 186, 192, 214, 216, 246, 248, 705, 710, 721, 736, 740, 748, 748, 750, 750, 768, 884, 886, 887, 890, 893, 902, + 902, 904, 906, 908, 908, 910, 929, 931, 1013, 1015, 1153, 1155, 1159, 1162, 1319, 1329, 1366, 1369, 1369, 1377, 1415, 1425, 1469, 1471, + 1471, 1473, 1474, 1476, 1477, 1479, 1479, 1488, 1514, 1520, 1522, 1552, 1562, 1568, 1641, 1646, 1747, 1749, 1756, 1759, 1768, 1770, + 1788, 1791, 1791, 1808, 1866, 1869, 1969, 1984, 2037, 2042, 2042, 2048, 2093, 2112, 2139, 2208, 2208, 2210, 2220, 2276, 2302, 2304, + 2403, 2406, 2415, 2417, 2423, 2425, 2431, 2433, 2435, 2437, 2444, 2447, 2448, 2451, 2472, 2474, 2480, 2482, 2482, 2486, 2489, 2492, + 2500, 2503, 2504, 2507, 2510, 2519, 2519, 2524, 2525, 2527, 2531, 2534, 2545, 2561, 2563, 2565, 2570, 2575, 2576, 2579, 2600, 2602, + 2608, 2610, 2611, 2613, 2614, 2616, 2617, 2620, 2620, 2622, 2626, 2631, 2632, 2635, 2637, 2641, 2641, 2649, 2652, 2654, 2654, 2662, + 2677, 2689, 2691, 2693, 2701, 2703, 2705, 2707, 2728, 2730, 2736, 2738, 2739, 2741, 2745, 2748, 2757, 2759, 2761, 2763, 2765, 2768, + 2768, 2784, 2787, 2790, 2799, 2817, 2819, 2821, 2828, 2831, 2832, 2835, 2856, 2858, 2864, 2866, 2867, 2869, 2873, 2876, 2884, 2887, + 2888, 2891, 2893, 2902, 2903, 2908, 2909, 2911, 2915, 2918, 2927, 2929, 2929, 2946, 2947, 2949, 2954, 2958, 2960, 2962, 2965, 2969, + 2970, 2972, 2972, 2974, 2975, 2979, 2980, 2984, 2986, 2990, 3001, 3006, 3010, 3014, 3016, 3018, 3021, 3024, 3024, 3031, 3031, 3046, + 3055, 3073, 3075, 3077, 3084, 3086, 3088, 3090, 3112, 3114, 3123, 3125, 3129, 3133, 3140, 3142, 3144, 3146, 3149, 3157, 3158, 3160, + 3161, 3168, 3171, 3174, 3183, 3202, 3203, 3205, 3212, 3214, 3216, 3218, 3240, 3242, 3251, 3253, 3257, 3260, 3268, 3270, 3272, 3274, + 3277, 3285, 3286, 3294, 3294, 3296, 3299, 3302, 3311, 3313, 3314, 3330, 3331, 3333, 3340, 3342, 3344, 3346, 3386, 3389, 3396, 3398, + 3400, 3402, 3406, 3415, 3415, 3424, 3427, 3430, 3439, 3450, 3455, 3458, 3459, 3461, 3478, 3482, 3505, 3507, 3515, 3517, 3517, 3520, + 3526, 3530, 3530, 3535, 3540, 3542, 3542, 3544, 3551, 3570, 3571, 3585, 3642, 3648, 3662, 3664, 3673, 3713, 3714, 3716, 3716, 3719, + 3720, 3722, 3722, 3725, 3725, 3732, 3735, 3737, 3743, 3745, 3747, 3749, 3749, 3751, 3751, 3754, 3755, 3757, 3769, 3771, 3773, 3776, + 3780, 3782, 3782, 3784, 3789, 3792, 3801, 3804, 3807, 3840, 3840, 3864, 3865, 3872, 3881, 3893, 3893, 3895, 3895, 3897, 3897, 3902, + 3911, 3913, 3948, 3953, 3972, 3974, 3991, 3993, 4028, 4038, 4038, 4096, 4169, 4176, 4253, 4256, 4293, 4295, 4295, 4301, 4301, 4304, + 4346, 4348, 4680, 4682, 4685, 4688, 4694, 4696, 4696, 4698, 4701, 4704, 4744, 4746, 4749, 4752, 4784, 4786, 4789, 4792, 4798, 4800, + 4800, 4802, 4805, 4808, 4822, 4824, 4880, 4882, 4885, 4888, 4954, 4957, 4959, 4992, 5007, 5024, 5108, 5121, 5740, 5743, 5759, 5761, + 5786, 5792, 5866, 5870, 5872, 5888, 5900, 5902, 5908, 5920, 5940, 5952, 5971, 5984, 5996, 5998, 6000, 6002, 6003, 6016, 6099, 6103, + 6103, 6108, 6109, 6112, 6121, 6155, 6157, 6160, 6169, 6176, 6263, 6272, 6314, 6320, 6389, 6400, 6428, 6432, 6443, 6448, 6459, 6470, + 6509, 6512, 6516, 6528, 6571, 6576, 6601, 6608, 6617, 6656, 6683, 6688, 6750, 6752, 6780, 6783, 6793, 6800, 6809, 6823, 6823, 6912, + 6987, 6992, 7001, 7019, 7027, 7040, 7155, 7168, 7223, 7232, 7241, 7245, 7293, 7376, 7378, 7380, 7414, 7424, 7654, 7676, 7957, 7960, + 7965, 7968, 8005, 8008, 8013, 8016, 8023, 8025, 8025, 8027, 8027, 8029, 8029, 8031, 8061, 8064, 8116, 8118, 8124, 8126, 8126, 8130, + 8132, 8134, 8140, 8144, 8147, 8150, 8155, 8160, 8172, 8178, 8180, 8182, 8188, 8204, 8205, 8255, 8256, 8276, 8276, 8305, 8305, 8319, + 8319, 8336, 8348, 8400, 8412, 8417, 8417, 8421, 8432, 8450, 8450, 8455, 8455, 8458, 8467, 8469, 8469, 8473, 8477, 8484, 8484, 8486, + 8486, 8488, 8488, 8490, 8493, 8495, 8505, 8508, 8511, 8517, 8521, 8526, 8526, 8544, 8584, 11264, 11310, 11312, 11358, 11360, 11492, + 11499, 11507, 11520, 11557, 11559, 11559, 11565, 11565, 11568, 11623, 11631, 11631, 11647, 11670, 11680, 11686, 11688, 11694, 11696, + 11702, 11704, 11710, 11712, 11718, 11720, 11726, 11728, 11734, 11736, 11742, 11744, 11775, 11823, 11823, 12293, 12295, 12321, 12335, + 12337, 12341, 12344, 12348, 12353, 12438, 12441, 12442, 12445, 12447, 12449, 12538, 12540, 12543, 12549, 12589, 12593, 12686, 12704, + 12730, 12784, 12799, 13312, 19893, 19968, 40908, 40960, 42124, 42192, 42237, 42240, 42508, 42512, 42539, 42560, 42607, 42612, 42621, + 42623, 42647, 42655, 42737, 42775, 42783, 42786, 42888, 42891, 42894, 42896, 42899, 42912, 42922, 43000, 43047, 43072, 43123, 43136, + 43204, 43216, 43225, 43232, 43255, 43259, 43259, 43264, 43309, 43312, 43347, 43360, 43388, 43392, 43456, 43471, 43481, 43520, 43574, + 43584, 43597, 43600, 43609, 43616, 43638, 43642, 43643, 43648, 43714, 43739, 43741, 43744, 43759, 43762, 43766, 43777, 43782, 43785, + 43790, 43793, 43798, 43808, 43814, 43816, 43822, 43968, 44010, 44012, 44013, 44016, 44025, 44032, 55203, 55216, 55238, 55243, 55291, + 63744, 64109, 64112, 64217, 64256, 64262, 64275, 64279, 64285, 64296, 64298, 64310, 64312, 64316, 64318, 64318, 64320, 64321, 64323, + 64324, 64326, 64433, 64467, 64829, 64848, 64911, 64914, 64967, 65008, 65019, 65024, 65039, 65056, 65062, 65075, 65076, 65101, 65103, + 65136, 65140, 65142, 65276, 65296, 65305, 65313, 65338, 65343, 65343, 65345, 65370, 65382, 65470, 65474, 65479, 65482, 65487, 65490, + 65495, 65498, 65500,}; + + +/** + * Generated by scripts/regenerate-unicode-identifier-parts.js on node v12.4.0 with unicode 12.1 + * based on http://www.unicode.org/reports/tr31/ and https://www.ecma-international.org/ecma-262/6.0/#sec-names-and-keywords + * unicodeESNextIdentifierStart corresponds to the ID_Start and Other_ID_Start property, and + * unicodeESNextIdentifierPart corresponds to ID_Continue, Other_ID_Continue, plus ID_Start and Other_ID_Start + */ +vector unicodeESNextIdentifierStart = {65, 90, 97, 122, 170, 170, 181, 181, 186, 186, 192, 214, 216, 246, 248, 705, 710, 721, 736, 740, 748, 748, 750, 750, 880, 884, 886, + 887, 890, 893, 895, 895, 902, 902, 904, 906, 908, 908, 910, 929, 931, 1013, 1015, 1153, 1162, 1327, 1329, 1366, 1369, 1369, 1376, + 1416, 1488, 1514, 1519, 1522, 1568, 1610, 1646, 1647, 1649, 1747, 1749, 1749, 1765, 1766, 1774, 1775, 1786, 1788, 1791, 1791, 1808, + 1808, 1810, 1839, 1869, 1957, 1969, 1969, 1994, 2026, 2036, 2037, 2042, 2042, 2048, 2069, 2074, 2074, 2084, 2084, 2088, 2088, 2112, + 2136, 2144, 2154, 2208, 2228, 2230, 2237, 2308, 2361, 2365, 2365, 2384, 2384, 2392, 2401, 2417, 2432, 2437, 2444, 2447, 2448, 2451, + 2472, 2474, 2480, 2482, 2482, 2486, 2489, 2493, 2493, 2510, 2510, 2524, 2525, 2527, 2529, 2544, 2545, 2556, 2556, 2565, 2570, 2575, + 2576, 2579, 2600, 2602, 2608, 2610, 2611, 2613, 2614, 2616, 2617, 2649, 2652, 2654, 2654, 2674, 2676, 2693, 2701, 2703, 2705, 2707, + 2728, 2730, 2736, 2738, 2739, 2741, 2745, 2749, 2749, 2768, 2768, 2784, 2785, 2809, 2809, 2821, 2828, 2831, 2832, 2835, 2856, 2858, + 2864, 2866, 2867, 2869, 2873, 2877, 2877, 2908, 2909, 2911, 2913, 2929, 2929, 2947, 2947, 2949, 2954, 2958, 2960, 2962, 2965, 2969, + 2970, 2972, 2972, 2974, 2975, 2979, 2980, 2984, 2986, 2990, 3001, 3024, 3024, 3077, 3084, 3086, 3088, 3090, 3112, 3114, 3129, 3133, + 3133, 3160, 3162, 3168, 3169, 3200, 3200, 3205, 3212, 3214, 3216, 3218, 3240, 3242, 3251, 3253, 3257, 3261, 3261, 3294, 3294, 3296, + 3297, 3313, 3314, 3333, 3340, 3342, 3344, 3346, 3386, 3389, 3389, 3406, 3406, 3412, 3414, 3423, 3425, 3450, 3455, 3461, 3478, 3482, + 3505, 3507, 3515, 3517, 3517, 3520, 3526, 3585, 3632, 3634, 3635, 3648, 3654, 3713, 3714, 3716, 3716, 3718, 3722, 3724, 3747, 3749, + 3749, 3751, 3760, 3762, 3763, 3773, 3773, 3776, 3780, 3782, 3782, 3804, 3807, 3840, 3840, 3904, 3911, 3913, 3948, 3976, 3980, 4096, + 4138, 4159, 4159, 4176, 4181, 4186, 4189, 4193, 4193, 4197, 4198, 4206, 4208, 4213, 4225, 4238, 4238, 4256, 4293, 4295, 4295, 4301, + 4301, 4304, 4346, 4348, 4680, 4682, 4685, 4688, 4694, 4696, 4696, 4698, 4701, 4704, 4744, 4746, 4749, 4752, 4784, 4786, 4789, 4792, + 4798, 4800, 4800, 4802, 4805, 4808, 4822, 4824, 4880, 4882, 4885, 4888, 4954, 4992, 5007, 5024, 5109, 5112, 5117, 5121, 5740, 5743, + 5759, 5761, 5786, 5792, 5866, 5870, 5880, 5888, 5900, 5902, 5905, 5920, 5937, 5952, 5969, 5984, 5996, 5998, 6000, 6016, 6067, 6103, + 6103, 6108, 6108, 6176, 6264, 6272, 6312, 6314, 6314, 6320, 6389, 6400, 6430, 6480, 6509, 6512, 6516, 6528, 6571, 6576, 6601, 6656, + 6678, 6688, 6740, 6823, 6823, 6917, 6963, 6981, 6987, 7043, 7072, 7086, 7087, 7098, 7141, 7168, 7203, 7245, 7247, 7258, 7293, 7296, + 7304, 7312, 7354, 7357, 7359, 7401, 7404, 7406, 7411, 7413, 7414, 7418, 7418, 7424, 7615, 7680, 7957, 7960, 7965, 7968, 8005, 8008, + 8013, 8016, 8023, 8025, 8025, 8027, 8027, 8029, 8029, 8031, 8061, 8064, 8116, 8118, 8124, 8126, 8126, 8130, 8132, 8134, 8140, 8144, + 8147, 8150, 8155, 8160, 8172, 8178, 8180, 8182, 8188, 8305, 8305, 8319, 8319, 8336, 8348, 8450, 8450, 8455, 8455, 8458, 8467, 8469, + 8469, 8472, 8477, 8484, 8484, 8486, 8486, 8488, 8488, 8490, 8505, 8508, 8511, 8517, 8521, 8526, 8526, 8544, 8584, 11264, 11310, + 11312, 11358, 11360, 11492, 11499, 11502, 11506, 11507, 11520, 11557, 11559, 11559, 11565, 11565, 11568, 11623, 11631, 11631, + 11648, 11670, 11680, 11686, 11688, 11694, 11696, 11702, 11704, 11710, 11712, 11718, 11720, 11726, 11728, 11734, 11736, 11742, + 12293, 12295, 12321, 12329, 12337, 12341, 12344, 12348, 12353, 12438, 12443, 12447, 12449, 12538, 12540, 12543, 12549, 12591, + 12593, 12686, 12704, 12730, 12784, 12799, 13312, 19893, 19968, 40943, 40960, 42124, 42192, 42237, 42240, 42508, 42512, 42527, + 42538, 42539, 42560, 42606, 42623, 42653, 42656, 42735, 42775, 42783, 42786, 42888, 42891, 42943, 42946, 42950, 42999, 43009, + 43011, 43013, 43015, 43018, 43020, 43042, 43072, 43123, 43138, 43187, 43250, 43255, 43259, 43259, 43261, 43262, 43274, 43301, + 43312, 43334, 43360, 43388, 43396, 43442, 43471, 43471, 43488, 43492, 43494, 43503, 43514, 43518, 43520, 43560, 43584, 43586, + 43588, 43595, 43616, 43638, 43642, 43642, 43646, 43695, 43697, 43697, 43701, 43702, 43705, 43709, 43712, 43712, 43714, 43714, + 43739, 43741, 43744, 43754, 43762, 43764, 43777, 43782, 43785, 43790, 43793, 43798, 43808, 43814, 43816, 43822, 43824, 43866, + 43868, 43879, 43888, 44002, 44032, 55203, 55216, 55238, 55243, 55291, 63744, 64109, 64112, 64217, 64256, 64262, 64275, 64279, + 64285, 64285, 64287, 64296, 64298, 64310, 64312, 64316, 64318, 64318, 64320, 64321, 64323, 64324, 64326, 64433, 64467, 64829, + 64848, 64911, 64914, 64967, 65008, 65019, 65136, 65140, 65142, 65276, 65313, 65338, 65345, 65370, 65382, 65470, 65474, 65479, + 65482, 65487, 65490, 65495, 65498, 65500, 65536, 65547, 65549, 65574, 65576, 65594, 65596, 65597, 65599, 65613, 65616, 65629, + 65664, 65786, 65856, 65908, 66176, 66204, 66208, 66256, 66304, 66335, 66349, 66378, 66384, 66421, 66432, 66461, 66464, 66499, + 66504, 66511, 66513, 66517, 66560, 66717, 66736, 66771, 66776, 66811, 66816, 66855, 66864, 66915, 67072, 67382, 67392, 67413, + 67424, 67431, 67584, 67589, 67592, 67592, 67594, 67637, 67639, 67640, 67644, 67644, 67647, 67669, 67680, 67702, 67712, 67742, + 67808, 67826, 67828, 67829, 67840, 67861, 67872, 67897, 67968, 68023, 68030, 68031, 68096, 68096, 68112, 68115, 68117, 68119, + 68121, 68149, 68192, 68220, 68224, 68252, 68288, 68295, 68297, 68324, 68352, 68405, 68416, 68437, 68448, 68466, 68480, 68497, + 68608, 68680, 68736, 68786, 68800, 68850, 68864, 68899, 69376, 69404, 69415, 69415, 69424, 69445, 69600, 69622, 69635, 69687, + 69763, 69807, 69840, 69864, 69891, 69926, 69956, 69956, 69968, 70002, 70006, 70006, 70019, 70066, 70081, 70084, 70106, 70106, + 70108, 70108, 70144, 70161, 70163, 70187, 70272, 70278, 70280, 70280, 70282, 70285, 70287, 70301, 70303, 70312, 70320, 70366, + 70405, 70412, 70415, 70416, 70419, 70440, 70442, 70448, 70450, 70451, 70453, 70457, 70461, 70461, 70480, 70480, 70493, 70497, + 70656, 70708, 70727, 70730, 70751, 70751, 70784, 70831, 70852, 70853, 70855, 70855, 71040, 71086, 71128, 71131, 71168, 71215, + 71236, 71236, 71296, 71338, 71352, 71352, 71424, 71450, 71680, 71723, 71840, 71903, 71935, 71935, 72096, 72103, 72106, 72144, + 72161, 72161, 72163, 72163, 72192, 72192, 72203, 72242, 72250, 72250, 72272, 72272, 72284, 72329, 72349, 72349, 72384, 72440, + 72704, 72712, 72714, 72750, 72768, 72768, 72818, 72847, 72960, 72966, 72968, 72969, 72971, 73008, 73030, 73030, 73056, 73061, + 73063, 73064, 73066, 73097, 73112, 73112, 73440, 73458, 73728, 74649, 74752, 74862, 74880, 75075, 77824, 78894, 82944, 83526, + 92160, 92728, 92736, 92766, 92880, 92909, 92928, 92975, 92992, 92995, 93027, 93047, 93053, 93071, 93760, 93823, 93952, 94026, + 94032, 94032, 94099, 94111, 94176, 94177, 94179, 94179, 94208, 100343, 100352, 101106, 110592, 110878, 110928, 110930, 110948, + 110951, 110960, 111355, 113664, 113770, 113776, 113788, 113792, 113800, 113808, 113817, 119808, 119892, 119894, 119964, 119966, + 119967, 119970, 119970, 119973, 119974, 119977, 119980, 119982, 119993, 119995, 119995, 119997, 120003, 120005, 120069, 120071, + 120074, 120077, 120084, 120086, 120092, 120094, 120121, 120123, 120126, 120128, 120132, 120134, 120134, 120138, 120144, 120146, + 120485, 120488, 120512, 120514, 120538, 120540, 120570, 120572, 120596, 120598, 120628, 120630, 120654, 120656, 120686, 120688, + 120712, 120714, 120744, 120746, 120770, 120772, 120779, 123136, 123180, 123191, 123197, 123214, 123214, 123584, 123627, 124928, + 125124, 125184, 125251, 125259, 125259, 126464, 126467, 126469, 126495, 126497, 126498, 126500, 126500, 126503, 126503, 126505, + 126514, 126516, 126519, 126521, 126521, 126523, 126523, 126530, 126530, 126535, 126535, 126537, 126537, 126539, 126539, 126541, + 126543, 126545, 126546, 126548, 126548, 126551, 126551, 126553, 126553, 126555, 126555, 126557, 126557, 126559, 126559, 126561, + 126562, 126564, 126564, 126567, 126570, 126572, 126578, 126580, 126583, 126585, 126588, 126590, 126590, 126592, 126601, 126603, + 126619, 126625, 126627, 126629, 126633, 126635, 126651, 131072, 173782, 173824, 177972, 177984, 178205, 178208, 183969, 183984, + 191456, 194560, 195101}; +vector unicodeESNextIdentifierPart = {48, 57, 65, 90, 95, 95, 97, 122, 170, 170, 181, 181, 183, 183, 186, 186, 192, 214, 216, 246, 248, 705, 710, 721, 736, 740, 748, 748, + 750, 750, 768, 884, 886, 887, 890, 893, 895, 895, 902, 906, 908, 908, 910, 929, 931, 1013, 1015, 1153, 1155, 1159, 1162, 1327, 1329, + 1366, 1369, 1369, 1376, 1416, 1425, 1469, 1471, 1471, 1473, 1474, 1476, 1477, 1479, 1479, 1488, 1514, 1519, 1522, 1552, 1562, 1568, + 1641, 1646, 1747, 1749, 1756, 1759, 1768, 1770, 1788, 1791, 1791, 1808, 1866, 1869, 1969, 1984, 2037, 2042, 2042, 2045, 2045, 2048, + 2093, 2112, 2139, 2144, 2154, 2208, 2228, 2230, 2237, 2259, 2273, 2275, 2403, 2406, 2415, 2417, 2435, 2437, 2444, 2447, 2448, 2451, + 2472, 2474, 2480, 2482, 2482, 2486, 2489, 2492, 2500, 2503, 2504, 2507, 2510, 2519, 2519, 2524, 2525, 2527, 2531, 2534, 2545, 2556, + 2556, 2558, 2558, 2561, 2563, 2565, 2570, 2575, 2576, 2579, 2600, 2602, 2608, 2610, 2611, 2613, 2614, 2616, 2617, 2620, 2620, 2622, + 2626, 2631, 2632, 2635, 2637, 2641, 2641, 2649, 2652, 2654, 2654, 2662, 2677, 2689, 2691, 2693, 2701, 2703, 2705, 2707, 2728, 2730, + 2736, 2738, 2739, 2741, 2745, 2748, 2757, 2759, 2761, 2763, 2765, 2768, 2768, 2784, 2787, 2790, 2799, 2809, 2815, 2817, 2819, 2821, + 2828, 2831, 2832, 2835, 2856, 2858, 2864, 2866, 2867, 2869, 2873, 2876, 2884, 2887, 2888, 2891, 2893, 2902, 2903, 2908, 2909, 2911, + 2915, 2918, 2927, 2929, 2929, 2946, 2947, 2949, 2954, 2958, 2960, 2962, 2965, 2969, 2970, 2972, 2972, 2974, 2975, 2979, 2980, 2984, + 2986, 2990, 3001, 3006, 3010, 3014, 3016, 3018, 3021, 3024, 3024, 3031, 3031, 3046, 3055, 3072, 3084, 3086, 3088, 3090, 3112, 3114, + 3129, 3133, 3140, 3142, 3144, 3146, 3149, 3157, 3158, 3160, 3162, 3168, 3171, 3174, 3183, 3200, 3203, 3205, 3212, 3214, 3216, 3218, + 3240, 3242, 3251, 3253, 3257, 3260, 3268, 3270, 3272, 3274, 3277, 3285, 3286, 3294, 3294, 3296, 3299, 3302, 3311, 3313, 3314, 3328, + 3331, 3333, 3340, 3342, 3344, 3346, 3396, 3398, 3400, 3402, 3406, 3412, 3415, 3423, 3427, 3430, 3439, 3450, 3455, 3458, 3459, 3461, + 3478, 3482, 3505, 3507, 3515, 3517, 3517, 3520, 3526, 3530, 3530, 3535, 3540, 3542, 3542, 3544, 3551, 3558, 3567, 3570, 3571, 3585, + 3642, 3648, 3662, 3664, 3673, 3713, 3714, 3716, 3716, 3718, 3722, 3724, 3747, 3749, 3749, 3751, 3773, 3776, 3780, 3782, 3782, 3784, + 3789, 3792, 3801, 3804, 3807, 3840, 3840, 3864, 3865, 3872, 3881, 3893, 3893, 3895, 3895, 3897, 3897, 3902, 3911, 3913, 3948, 3953, + 3972, 3974, 3991, 3993, 4028, 4038, 4038, 4096, 4169, 4176, 4253, 4256, 4293, 4295, 4295, 4301, 4301, 4304, 4346, 4348, 4680, 4682, + 4685, 4688, 4694, 4696, 4696, 4698, 4701, 4704, 4744, 4746, 4749, 4752, 4784, 4786, 4789, 4792, 4798, 4800, 4800, 4802, 4805, 4808, + 4822, 4824, 4880, 4882, 4885, 4888, 4954, 4957, 4959, 4969, 4977, 4992, 5007, 5024, 5109, 5112, 5117, 5121, 5740, 5743, 5759, 5761, + 5786, 5792, 5866, 5870, 5880, 5888, 5900, 5902, 5908, 5920, 5940, 5952, 5971, 5984, 5996, 5998, 6000, 6002, 6003, 6016, 6099, 6103, + 6103, 6108, 6109, 6112, 6121, 6155, 6157, 6160, 6169, 6176, 6264, 6272, 6314, 6320, 6389, 6400, 6430, 6432, 6443, 6448, 6459, 6470, + 6509, 6512, 6516, 6528, 6571, 6576, 6601, 6608, 6618, 6656, 6683, 6688, 6750, 6752, 6780, 6783, 6793, 6800, 6809, 6823, 6823, 6832, + 6845, 6912, 6987, 6992, 7001, 7019, 7027, 7040, 7155, 7168, 7223, 7232, 7241, 7245, 7293, 7296, 7304, 7312, 7354, 7357, 7359, 7376, + 7378, 7380, 7418, 7424, 7673, 7675, 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, 8276, 8276, 8305, 8305, 8319, 8319, 8336, 8348, 8400, 8412, 8417, 8417, 8421, 8432, 8450, 8450, 8455, 8455, 8458, 8467, 8469, + 8469, 8472, 8477, 8484, 8484, 8486, 8486, 8488, 8488, 8490, 8505, 8508, 8511, 8517, 8521, 8526, 8526, 8544, 8584, 11264, 11310, + 11312, 11358, 11360, 11492, 11499, 11507, 11520, 11557, 11559, 11559, 11565, 11565, 11568, 11623, 11631, 11631, 11647, 11670, 11680, + 11686, 11688, 11694, 11696, 11702, 11704, 11710, 11712, 11718, 11720, 11726, 11728, 11734, 11736, 11742, 11744, 11775, 12293, 12295, + 12321, 12335, 12337, 12341, 12344, 12348, 12353, 12438, 12441, 12447, 12449, 12538, 12540, 12543, 12549, 12591, 12593, 12686, 12704, + 12730, 12784, 12799, 13312, 19893, 19968, 40943, 40960, 42124, 42192, 42237, 42240, 42508, 42512, 42539, 42560, 42607, 42612, 42621, + 42623, 42737, 42775, 42783, 42786, 42888, 42891, 42943, 42946, 42950, 42999, 43047, 43072, 43123, 43136, 43205, 43216, 43225, 43232, + 43255, 43259, 43259, 43261, 43309, 43312, 43347, 43360, 43388, 43392, 43456, 43471, 43481, 43488, 43518, 43520, 43574, 43584, 43597, + 43600, 43609, 43616, 43638, 43642, 43714, 43739, 43741, 43744, 43759, 43762, 43766, 43777, 43782, 43785, 43790, 43793, 43798, 43808, + 43814, 43816, 43822, 43824, 43866, 43868, 43879, 43888, 44010, 44012, 44013, 44016, 44025, 44032, 55203, 55216, 55238, 55243, 55291, + 63744, 64109, 64112, 64217, 64256, 64262, 64275, 64279, 64285, 64296, 64298, 64310, 64312, 64316, 64318, 64318, 64320, 64321, 64323, + 64324, 64326, 64433, 64467, 64829, 64848, 64911, 64914, 64967, 65008, 65019, 65024, 65039, 65056, 65071, 65075, 65076, 65101, 65103, + 65136, 65140, 65142, 65276, 65296, 65305, 65313, 65338, 65343, 65343, 65345, 65370, 65382, 65470, 65474, 65479, 65482, 65487, 65490, + 65495, 65498, 65500, 65536, 65547, 65549, 65574, 65576, 65594, 65596, 65597, 65599, 65613, 65616, 65629, 65664, 65786, 65856, 65908, + 66045, 66045, 66176, 66204, 66208, 66256, 66272, 66272, 66304, 66335, 66349, 66378, 66384, 66426, 66432, 66461, 66464, 66499, 66504, + 66511, 66513, 66517, 66560, 66717, 66720, 66729, 66736, 66771, 66776, 66811, 66816, 66855, 66864, 66915, 67072, 67382, 67392, 67413, + 67424, 67431, 67584, 67589, 67592, 67592, 67594, 67637, 67639, 67640, 67644, 67644, 67647, 67669, 67680, 67702, 67712, 67742, 67808, + 67826, 67828, 67829, 67840, 67861, 67872, 67897, 67968, 68023, 68030, 68031, 68096, 68099, 68101, 68102, 68108, 68115, 68117, 68119, + 68121, 68149, 68152, 68154, 68159, 68159, 68192, 68220, 68224, 68252, 68288, 68295, 68297, 68326, 68352, 68405, 68416, 68437, 68448, + 68466, 68480, 68497, 68608, 68680, 68736, 68786, 68800, 68850, 68864, 68903, 68912, 68921, 69376, 69404, 69415, 69415, 69424, 69456, + 69600, 69622, 69632, 69702, 69734, 69743, 69759, 69818, 69840, 69864, 69872, 69881, 69888, 69940, 69942, 69951, 69956, 69958, 69968, + 70003, 70006, 70006, 70016, 70084, 70089, 70092, 70096, 70106, 70108, 70108, 70144, 70161, 70163, 70199, 70206, 70206, 70272, 70278, + 70280, 70280, 70282, 70285, 70287, 70301, 70303, 70312, 70320, 70378, 70384, 70393, 70400, 70403, 70405, 70412, 70415, 70416, 70419, + 70440, 70442, 70448, 70450, 70451, 70453, 70457, 70459, 70468, 70471, 70472, 70475, 70477, 70480, 70480, 70487, 70487, 70493, 70499, + 70502, 70508, 70512, 70516, 70656, 70730, 70736, 70745, 70750, 70751, 70784, 70853, 70855, 70855, 70864, 70873, 71040, 71093, 71096, + 71104, 71128, 71133, 71168, 71232, 71236, 71236, 71248, 71257, 71296, 71352, 71360, 71369, 71424, 71450, 71453, 71467, 71472, 71481, + 71680, 71738, 71840, 71913, 71935, 71935, 72096, 72103, 72106, 72151, 72154, 72161, 72163, 72164, 72192, 72254, 72263, 72263, 72272, + 72345, 72349, 72349, 72384, 72440, 72704, 72712, 72714, 72758, 72760, 72768, 72784, 72793, 72818, 72847, 72850, 72871, 72873, 72886, + 72960, 72966, 72968, 72969, 72971, 73014, 73018, 73018, 73020, 73021, 73023, 73031, 73040, 73049, 73056, 73061, 73063, 73064, 73066, + 73102, 73104, 73105, 73107, 73112, 73120, 73129, 73440, 73462, 73728, 74649, 74752, 74862, 74880, 75075, 77824, 78894, 82944, 83526, + 92160, 92728, 92736, 92766, 92768, 92777, 92880, 92909, 92912, 92916, 92928, 92982, 92992, 92995, 93008, 93017, 93027, 93047, 93053, + 93071, 93760, 93823, 93952, 94026, 94031, 94087, 94095, 94111, 94176, 94177, 94179, 94179, 94208, 100343, 100352, 101106, 110592, + 110878, 110928, 110930, 110948, 110951, 110960, 111355, 113664, 113770, 113776, 113788, 113792, 113800, 113808, 113817, 113821, + 113822, 119141, 119145, 119149, 119154, 119163, 119170, 119173, 119179, 119210, 119213, 119362, 119364, 119808, 119892, 119894, + 119964, 119966, 119967, 119970, 119970, 119973, 119974, 119977, 119980, 119982, 119993, 119995, 119995, 119997, 120003, 120005, + 120069, 120071, 120074, 120077, 120084, 120086, 120092, 120094, 120121, 120123, 120126, 120128, 120132, 120134, 120134, 120138, + 120144, 120146, 120485, 120488, 120512, 120514, 120538, 120540, 120570, 120572, 120596, 120598, 120628, 120630, 120654, 120656, + 120686, 120688, 120712, 120714, 120744, 120746, 120770, 120772, 120779, 120782, 120831, 121344, 121398, 121403, 121452, 121461, + 121461, 121476, 121476, 121499, 121503, 121505, 121519, 122880, 122886, 122888, 122904, 122907, 122913, 122915, 122916, 122918, + 122922, 123136, 123180, 123184, 123197, 123200, 123209, 123214, 123214, 123584, 123641, 124928, 125124, 125136, 125142, 125184, + 125259, 125264, 125273, 126464, 126467, 126469, 126495, 126497, 126498, 126500, 126500, 126503, 126503, 126505, 126514, 126516, + 126519, 126521, 126521, 126523, 126523, 126530, 126530, 126535, 126535, 126537, 126537, 126539, 126539, 126541, 126543, 126545, + 126546, 126548, 126548, 126551, 126551, 126553, 126553, 126555, 126555, 126557, 126557, 126559, 126559, 126561, 126562, 126564, + 126564, 126567, 126570, 126572, 126578, 126580, 126583, 126585, 126588, 126590, 126590, 126592, 126601, 126603, 126619, 126625, + 126627, 126629, 126633, 126635, 126651, 131072, 173782, 173824, 177972, 177984, 178205, 178208, 183969, 183984, 191456, 194560, + 195101, 917760, 917999}; + +/** + * Test for whether a single line comment with leading whitespace trimmed's text contains a directive. + */ +const regex commentDirectiveRegExSingleLine("^///?\\s*@(ts-expect-error|ts-ignore)"); + +/** + * Test for whether a multi-line comment with leading whitespace trimmed's last line contains a directive. + */ +const regex commentDirectiveRegExMultiLine("^(?:/|\\*)*\\s*@(ts-expect-error|ts-ignore)"); + +// All conflict markers consist of the same character repeated seven times. If it is +// a <<<<<<< or >>>>>>> marker then it is also followed by a space. +const unsigned long mergeConflictMarkerLength = size("<<<<<<<") - 1; + +bool isConflictMarkerTrivia(const string text, int pos) { + assert(pos >= 0); + + // Conflict markers must be at the start of a line. + if (pos == 0 || isLineBreak(charCodeAt(text, pos - 1))) { + auto ch = charCodeAt(text, pos); + + if ((pos + mergeConflictMarkerLength) < text.size()) { + for (int i = 0; i < mergeConflictMarkerLength; i++) { + if (charCodeAt(text, pos + i).code != ch.code) { + return false; + } + } + + return ch.code == CharacterCodes::equals || charCodeAt(text, pos + mergeConflictMarkerLength).code == CharacterCodes::space; + } + } + + return false; +} + +int Scanner::error(DiagnosticMessage message, int errPos, int length) { + if (errPos == -1) errPos = pos; + + cout << "Error: " << message.code << ": " << message.message << " at " << errPos << "\n"; +} + +int Scanner::scanConflictMarkerTrivia(string &text, int pos) { + error(Diagnostics::Merge_conflict_marker_encountered, pos, mergeConflictMarkerLength); + + auto ch = charCodeAt(text, pos); + auto len = text.size(); + + if (ch.code == CharacterCodes::lessThan || ch.code == CharacterCodes::greaterThan) { + while (pos < len && !isLineBreak(charCodeAt(text, pos))) { + pos++; + } + } else { + assert(ch.code == CharacterCodes::bar || ch.code == CharacterCodes::equals); + // Consume everything from the start of a ||||||| or ======= marker to the start + // of the next ======= or >>>>>>> marker. + while (pos < len) { + auto currentChar = charCodeAt(text, pos); + if ((currentChar.code == CharacterCodes::equals || currentChar.code == CharacterCodes::greaterThan) && currentChar.code != ch.code && isConflictMarkerTrivia(text, pos)) { + break; + } + + pos++; + } + } + + return pos; +} + +bool lookupInUnicodeMap(CharCode code, vector &map) { + // Bail out quickly if it couldn't possibly be in the map. + if (code.code < map[0]) { + return false; + } + + // Perform binary search in one of the Unicode range maps + auto lo = 0; + auto hi = map.size(); + int mid; + + while (lo + 1 < hi) { + mid = lo + (hi - lo) / 2; + // mid has to be even to catch a range's beginning + mid -= mid % 2; + if (map[mid] <= code.code && code.code <= map[mid + 1]) { + return true; + } + + if (code.code < map[mid]) { + hi = mid; + } else { + lo = mid + 2; + } + } + + return false; +} + +bool isUnicodeIdentifierStart(CharCode code, ScriptTarget languageVersion) { + return languageVersion >= ScriptTarget::ES2015 ? + lookupInUnicodeMap(code, unicodeESNextIdentifierStart) : + languageVersion == ScriptTarget::ES5 ? lookupInUnicodeMap(code, unicodeES5IdentifierStart) : + lookupInUnicodeMap(code, unicodeES3IdentifierStart); +} + +bool isUnicodeIdentifierPart(CharCode ch, ScriptTarget languageVersion) { + return languageVersion >= ScriptTarget::ES2015 ? + lookupInUnicodeMap(ch, unicodeESNextIdentifierPart) : + languageVersion == ScriptTarget::ES5 ? lookupInUnicodeMap(ch, unicodeES5IdentifierPart) : + lookupInUnicodeMap(ch, unicodeES3IdentifierPart); +} + +bool isIdentifierStart(CharCode ch, ScriptTarget languageVersion) { + return (ch.code >= CharacterCodes::A && ch.code <= CharacterCodes::Z) || (ch.code >= CharacterCodes::a && ch.code <= CharacterCodes::z) || + ch.code == CharacterCodes::$ || ch.code == CharacterCodes::_ || + (ch.code > CharacterCodes::maxAsciiCharacter && isUnicodeIdentifierStart(ch, languageVersion)); +} + +bool isIdentifierPart(CharCode ch, ScriptTarget languageVersion, LanguageVariant identifierVariant = LanguageVariant::Standard) { + return (ch.code >= CharacterCodes::A && ch.code <= CharacterCodes::Z) || (ch.code >= CharacterCodes::a && ch.code <= CharacterCodes::z) || + (ch.code >= CharacterCodes::_0 && ch.code <= CharacterCodes::_9) || ch.code == CharacterCodes::$ || ch.code == CharacterCodes::_ || + // "-" and ":" are valid in JSX Identifiers + (identifierVariant == LanguageVariant::JSX ? (ch.code == CharacterCodes::minus || ch.code == CharacterCodes::colon) : false) || + (ch.code > CharacterCodes::maxAsciiCharacter && isUnicodeIdentifierPart(ch, languageVersion)); +} + +CharCode Scanner::peekExtendedUnicodeEscape() { + if (languageVersion >= ScriptTarget::ES2015 && charCodeAt(text, pos + 1).code == CharacterCodes::u && charCodeAt(text, pos + 2).code == CharacterCodes::openBrace) { + auto start = pos; + pos += 3; + auto escapedValueString = scanMinimumNumberOfHexDigits(1, /*canHaveSeparators*/ false); + auto escapedValue = escapedValueString.size() ? stoi(escapedValueString, nullptr, 16) : -1; + pos = start; + return {escapedValue, 1}; + } + return {-1, 0}; +} + +CharCode Scanner::peekUnicodeEscape() { + if (pos + 5 < end && charCodeAt(text, pos + 1).code == CharacterCodes::u) { + auto start = pos; + pos += 2; + auto value = scanExactNumberOfHexDigits(4, /*canHaveSeparators*/ false); + pos = start; + return {value, 1}; + } + return {-1, 0}; +} + +string Scanner::scanIdentifierParts() { + string result; + auto start = pos; + while (pos < end) { + auto ch = charCodeAt(text, pos); + if (isIdentifierPart(ch, languageVersion)) { + pos += ch.length; + } else if (ch.code == CharacterCodes::backslash) { + ch = peekExtendedUnicodeEscape(); + if (ch.code >= 0 && isIdentifierPart(ch, languageVersion)) { + pos += 3; + tokenFlags |= TokenFlags::ExtendedUnicodeEscape; + result += scanExtendedUnicodeEscape(); + start = pos; + continue; + } + ch = peekUnicodeEscape(); + if (!(ch.code >= 0 && isIdentifierPart(ch, languageVersion))) { + break; + } + tokenFlags |= TokenFlags::UnicodeEscape; + result += text.substr(start, pos); + result += fromCharCode(ch.code); + // Valid Unicode escape is always six characters + pos += 6; + start = pos; + } else { + break; + } + } + result += text.substr(start, pos); + return result; +} + +void Scanner::checkForIdentifierStartAfterNumericLiteral(int numericStart, bool isScientific) { + if (!isIdentifierStart(charCodeAt(text, pos), languageVersion)) { + return; + } + + auto identifierStart = pos; + auto parts = scanIdentifierParts(); + + if (parts.size() == 1 && text[identifierStart] == 'n') { + if (isScientific) { + error(Diagnostics::A_bigint_literal_cannot_use_exponential_notation, numericStart, identifierStart - numericStart + 1); + } else { + error(Diagnostics::A_bigint_literal_must_be_an_integer, numericStart, identifierStart - numericStart + 1); + } + } else { + error(Diagnostics::An_identifier_or_keyword_cannot_immediately_follow_a_numeric_literal, identifierStart, parts.size()); + pos = identifierStart; + } +} + +SyntaxKind Scanner::checkBigIntSuffix() { + if (charCodeAt(text, pos).code == CharacterCodes::n) { + tokenValue += "n"; + // Use base 10 instead of base 2 or base 8 for shorter literals + if (tokenFlags & TokenFlags::BinaryOrOctalSpecifier) { + tokenValue = parsePseudoBigInt(tokenValue) + "n"; + } + pos++; + return SyntaxKind::BigIntLiteral; + } else { + // not a bigint, so can convert to number in simplified form + // Number() may not support 0b or 0o, so use parseInt() instead + auto numericValue = tokenFlags & TokenFlags::BinarySpecifier + ? stoi(tokenValue.substr(2), 0, 2) // skip "0b" + : tokenFlags & TokenFlags::OctalSpecifier + ? stoi(tokenValue.substr(2), 0, 8) // skip "0o" + : stoi(tokenValue); + tokenValue = "" + std::to_string(numericValue); + return SyntaxKind::NumericLiteral; + } +} + +optional getDirectiveFromComment(const string &text, const regex &commentDirectiveRegEx) { + cmatch match; + if (regex_search("//@ts-ignore", match, commentDirectiveRegEx)) { + if (match[1] == "ts-expect-error") return CommentDirectiveType::ExpectError; + if (match[1] == "ts-ignore") return CommentDirectiveType::Ignore; + } +} + +vector Scanner::appendIfCommentDirective( + vector &commentDirectives, + const string &text, + const regex &commentDirectiveRegEx, + int lineStart +) { + auto type = getDirectiveFromComment(trimStringStart(text), commentDirectiveRegEx); + if (!type.has_value()) { + return commentDirectives; + } + + commentDirectives.push_back(CommentDirective{.range = {.pos = lineStart, .end = pos}, .type = type.value()}); + return commentDirectives; +} + +ScanNumber Scanner::scanNumber() { + auto start = pos; + auto mainFragment = scanNumberFragment(); + string decimalFragment; + bool decimalFragmentSet = false; + string scientificFragment; + bool scientificFragmentSet = false; + if (charCodeAt(text, pos).code == CharacterCodes::dot) { + pos++; + decimalFragment = scanNumberFragment(); + decimalFragmentSet = true; + } + auto end = pos; + if (charCodeAt(text, pos).code == CharacterCodes::E || charCodeAt(text, pos).code == CharacterCodes::e) { + pos++; + tokenFlags |= TokenFlags::Scientific; + if (charCodeAt(text, pos).code == CharacterCodes::plus || charCodeAt(text, pos).code == CharacterCodes::minus) pos++; + auto preNumericPart = pos; + auto finalFragment = scanNumberFragment(); + if (!finalFragment.size()) { +// error(Diagnostics::Digit_expected); + } else { + scientificFragment = text.substr(end, preNumericPart) + finalFragment; + scientificFragmentSet = true; + end = pos; + } + } + string result; + if (tokenFlags & TokenFlags::ContainsSeparator) { + result = mainFragment; + if (decimalFragment.size()) { + result += "." + decimalFragment; + } + if (scientificFragment.size()) { + result += scientificFragment; + } + } else { + result = text.substr(start, end); // No need to use all the fragments; no _ removal needed + } + + if (decimalFragmentSet || tokenFlags & TokenFlags::Scientific) { + checkForIdentifierStartAfterNumericLiteral(start, !decimalFragmentSet && !!(tokenFlags & TokenFlags::Scientific)); + return { + .type = SyntaxKind::NumericLiteral, + .value = "" + stoi(result) // if value is not an integer, it can be safely coerced to a number + }; + } else { + tokenValue = result; + auto type = checkBigIntSuffix(); // if value is an integer, check whether it is a bigint + checkForIdentifierStartAfterNumericLiteral(start); + return {type, .value = tokenValue}; + } +} + +string Scanner::scanBinaryOrOctalDigits(int base) { + string value; + // For counting number of digits; Valid binaryIntegerLiteral must have at least one binary digit following B or b. + // Similarly valid octalIntegerLiteral must have at least one octal digit following o or O. + bool separatorAllowed = false; + bool isPreviousTokenSeparator = false; + while (true) { + auto ch = charCodeAt(text, pos); + // Numeric separators are allowed anywhere within a numeric literal, except not at the beginning, or following another separator + if (ch.code == CharacterCodes::_) { + tokenFlags |= TokenFlags::ContainsSeparator; + if (separatorAllowed) { + separatorAllowed = false; + isPreviousTokenSeparator = true; + } else if (isPreviousTokenSeparator) { +// error(Diagnostics::Multiple_consecutive_numeric_separators_are_not_permitted, pos, 1); + } else { +// error(Diagnostics::Numeric_separators_are_not_allowed_here, pos, 1); + } + pos++; + continue; + } + separatorAllowed = true; + if (!isDigit(ch) || ch.code - CharacterCodes::_0 >= base) { + break; + } + value += text[pos]; + pos++; + isPreviousTokenSeparator = false; + } + if (charCodeAt(text, pos - 1).code == CharacterCodes::_) { + // Literal ends with underscore - not allowed +// error(Diagnostics::Numeric_separators_are_not_allowed_here, pos - 1, 1); + } + return value; +} + +SyntaxKind Scanner::getIdentifierToken() { + // Reserved words are between 2 and 12 characters long and start with a lowercase letter + auto len = tokenValue.size(); + if (len >= 2 && len <= 12) { + auto ch = charCodeAt(tokenValue, 0); + if (ch.code >= CharacterCodes::a && ch.code <= CharacterCodes::z) { + auto it = textToKeyword.find(tokenValue); + if (it != textToKeyword.end()) { + return token = it->second; + } + } + } + return token = SyntaxKind::Identifier; +} + +SyntaxKind Scanner::scanIdentifier(CharCode startCharacter, ScriptTarget languageVersion) { + auto ch = startCharacter; + if (isIdentifierStart(ch, languageVersion)) { + pos += ch.length; + while (pos < end && isIdentifierPart(ch = charCodeAt(text, pos), languageVersion)) pos += ch.length; + tokenValue = text.substr(tokenPos, pos); + if (ch.code == CharacterCodes::backslash) { + tokenValue += scanIdentifierParts(); + } + return getIdentifierToken(); + } +} + +const regex shebangTriviaRegex("^#!.*"); + +int scanShebangTrivia(const string &text, int pos) { + smatch m; + if (regex_search(text, m, shebangTriviaRegex)) { + pos = pos + m[1].length(); + } + return pos; +} + +SyntaxKind Scanner::scan() { + startPos = pos; + tokenFlags = TokenFlags::None; + bool asteriskSeen = false; + + while (true) { + tokenPos = pos; + + if (pos >= end) { + return token = SyntaxKind::EndOfFileToken; + } + + auto ch = charCodeAt(text, pos); + + // Special handling for shebang + if (ch.code == CharacterCodes::hash && pos == 0 && isShebangTrivia(text, pos)) { + pos = scanShebangTrivia(text, pos); + if (skipTrivia) { + continue; + } else { + return token = SyntaxKind::ShebangTrivia; + } + } + + switch (ch.code) { + case CharacterCodes::lineFeed: + case CharacterCodes::carriageReturn: + tokenFlags |= TokenFlags::PrecedingLineBreak; + if (skipTrivia) { + pos++; + continue; + } else { + if (ch.code == CharacterCodes::carriageReturn && pos + 1 < end && + charCodeAt(text, pos + 1).code == CharacterCodes::lineFeed) { + // consume both CR and LF + pos += 2; + } else { + pos++; + } + return token = SyntaxKind::NewLineTrivia; + } +// case CharacterCodes::tab: + + case CharacterCodes::tab: + case CharacterCodes::verticalTab: + case CharacterCodes::formFeed: + case CharacterCodes::space: + case CharacterCodes::nonBreakingSpace: + case CharacterCodes::ogham: + case CharacterCodes::enQuad: + case CharacterCodes::emQuad: + case CharacterCodes::enSpace: + case CharacterCodes::emSpace: + case CharacterCodes::threePerEmSpace: + case CharacterCodes::fourPerEmSpace: + case CharacterCodes::sixPerEmSpace: + case CharacterCodes::figureSpace: + case CharacterCodes::punctuationSpace: + case CharacterCodes::thinSpace: + case CharacterCodes::hairSpace: + case CharacterCodes::zeroWidthSpace: + case CharacterCodes::narrowNoBreakSpace: + case CharacterCodes::mathematicalSpace: + case CharacterCodes::ideographicSpace: + case CharacterCodes::byteOrderMark: + if (skipTrivia) { + pos++; + continue; + } else { + int size; + while (pos < end && isWhiteSpaceSingleLine(charCodeAt(text, pos, &size))) { + pos += size; + } + return token = SyntaxKind::WhitespaceTrivia; + } + case CharacterCodes::exclamation: + if (charCodeAt(text, pos + 1).code == CharacterCodes::equals) { + if (charCodeAt(text, pos + 2).code == CharacterCodes::equals) { + return pos += 3, token = SyntaxKind::ExclamationEqualsEqualsToken; + } + return pos += 2, token = SyntaxKind::ExclamationEqualsToken; + } + pos++; + return token = SyntaxKind::ExclamationToken; + case CharacterCodes::doubleQuote: + case CharacterCodes::singleQuote: + tokenValue = scanString(); + return token = SyntaxKind::StringLiteral; + case CharacterCodes::backtick: + return token = scanTemplateAndSetTokenValue(/* isTaggedTemplate */ false); + case CharacterCodes::percent: + if (charCodeAt(text, pos + 1).code == CharacterCodes::equals) { + return pos += 2, token = SyntaxKind::PercentEqualsToken; + } + pos++; + return token = SyntaxKind::PercentToken; + case CharacterCodes::ampersand: + if (charCodeAt(text, pos + 1).code == CharacterCodes::ampersand) { + if (charCodeAt(text, pos + 2).code == CharacterCodes::equals) { + return pos += 3, token = SyntaxKind::AmpersandAmpersandEqualsToken; + } + return pos += 2, token = SyntaxKind::AmpersandAmpersandToken; + } + if (charCodeAt(text, pos + 1).code == CharacterCodes::equals) { + return pos += 2, token = SyntaxKind::AmpersandEqualsToken; + } + pos++; + return token = SyntaxKind::AmpersandToken; + case CharacterCodes::openParen: + pos++; + return token = SyntaxKind::OpenParenToken; + case CharacterCodes::closeParen: + pos++; + return token = SyntaxKind::CloseParenToken; + case CharacterCodes::asterisk: + if (charCodeAt(text, pos + 1).code == CharacterCodes::equals) { + return pos += 2, token = SyntaxKind::AsteriskEqualsToken; + } + if (charCodeAt(text, pos + 1).code == CharacterCodes::asterisk) { + if (charCodeAt(text, pos + 2).code == CharacterCodes::equals) { + return pos += 3, token = SyntaxKind::AsteriskAsteriskEqualsToken; + } + return pos += 2, token = SyntaxKind::AsteriskAsteriskToken; + } + pos++; + if (inJSDocType && !asteriskSeen && (tokenFlags & TokenFlags::PrecedingLineBreak)) { + // decoration at the start of a JSDoc comment line + asteriskSeen = true; + continue; + } + return token = SyntaxKind::AsteriskToken; + case CharacterCodes::plus: + if (charCodeAt(text, pos + 1).code == CharacterCodes::plus) { + return pos += 2, token = SyntaxKind::PlusPlusToken; + } + if (charCodeAt(text, pos + 1).code == CharacterCodes::equals) { + return pos += 2, token = SyntaxKind::PlusEqualsToken; + } + pos++; + return token = SyntaxKind::PlusToken; + case CharacterCodes::comma: + pos++; + return token = SyntaxKind::CommaToken; + case CharacterCodes::minus: + if (charCodeAt(text, pos + 1).code == CharacterCodes::minus) { + return pos += 2, token = SyntaxKind::MinusMinusToken; + } + if (charCodeAt(text, pos + 1).code == CharacterCodes::equals) { + return pos += 2, token = SyntaxKind::MinusEqualsToken; + } + pos++; + return token = SyntaxKind::MinusToken; + case CharacterCodes::dot: + if (isDigit(charCodeAt(text, pos + 1))) { + tokenValue = scanNumber().value; + return token = SyntaxKind::NumericLiteral; + } + if (charCodeAt(text, pos + 1).code == CharacterCodes::dot && charCodeAt(text, pos + 2).code == CharacterCodes::dot) { + return pos += 3, token = SyntaxKind::DotDotDotToken; + } + pos++; + return token = SyntaxKind::DotToken; + case CharacterCodes::slash: + // Single-line comment + if (charCodeAt(text, pos + 1).code == CharacterCodes::slash) { + pos += 2; + + while (pos < end) { + if (isLineBreak(charCodeAt(text, pos))) { + break; + } + pos++; + } + + commentDirectives = appendIfCommentDirective( + commentDirectives, + text.substr(tokenPos, pos), + commentDirectiveRegExSingleLine, + tokenPos + ); + + if (skipTrivia) { + continue; + } else { + return token = SyntaxKind::SingleLineCommentTrivia; + } + } + // Multi-line comment + if (charCodeAt(text, pos + 1).code == CharacterCodes::asterisk) { + pos += 2; + if (charCodeAt(text, pos).code == CharacterCodes::asterisk && charCodeAt(text, pos + 1).code != CharacterCodes::slash) { + tokenFlags |= TokenFlags::PrecedingJSDocComment; + } + + auto commentClosed = false; + auto lastLineStart = tokenPos; + while (pos < end) { + auto ch = charCodeAt(text, pos); + + if (ch.code == CharacterCodes::asterisk && charCodeAt(text, pos + 1).code == CharacterCodes::slash) { + pos += 2; + commentClosed = true; + break; + } + + pos++; + + if (isLineBreak(ch)) { + lastLineStart = pos; + tokenFlags |= TokenFlags::PrecedingLineBreak; + } + } + + commentDirectives = appendIfCommentDirective(commentDirectives, text.substr(lastLineStart, pos), + commentDirectiveRegExMultiLine, lastLineStart); + + if (!commentClosed) { +// error(Diagnostics::Asterisk_Slash_expected); + } + + if (skipTrivia) { + continue; + } else { + if (!commentClosed) { + tokenFlags |= TokenFlags::Unterminated; + } + return token = SyntaxKind::MultiLineCommentTrivia; + } + } + + if (charCodeAt(text, pos + 1).code == CharacterCodes::equals) { + return pos += 2, token = SyntaxKind::SlashEqualsToken; + } + + pos++; + return token = SyntaxKind::SlashToken; + + case CharacterCodes::_0: + if (pos + 2 < end && (charCodeAt(text, pos + 1).code == + CharacterCodes::X || charCodeAt(text, pos + 1).code == CharacterCodes::x)) { + pos += 2; + tokenValue = scanMinimumNumberOfHexDigits(1, /*canHaveSeparators*/ true); + if (tokenValue.empty()) { +// error(Diagnostics::Hexadecimal_digit_expected); + tokenValue = "0"; + } + tokenValue = "0x" + tokenValue; + tokenFlags |= TokenFlags::HexSpecifier; + return token = checkBigIntSuffix(); + } else if (pos + 2 < end && (charCodeAt(text, pos + 1).code == + CharacterCodes::B || charCodeAt(text, pos + 1).code == CharacterCodes::b)) { + pos += 2; + tokenValue = scanBinaryOrOctalDigits(/* base */ 2); + if (tokenValue.empty()) { +// error(Diagnostics::Binary_digit_expected); + tokenValue = "0"; + } + tokenValue = "0b" + tokenValue; + tokenFlags |= TokenFlags::BinarySpecifier; + return token = checkBigIntSuffix(); + } else if (pos + 2 < end && (charCodeAt(text, pos + 1).code == CharacterCodes::O || charCodeAt(text, pos + 1).code == CharacterCodes::o)) { + pos += 2; + tokenValue = scanBinaryOrOctalDigits(/* base */ 8); + if (tokenValue.empty()) { +// error(Diagnostics::Octal_digit_expected); + tokenValue = "0"; + } + tokenValue = "0o" + tokenValue; + tokenFlags |= TokenFlags::OctalSpecifier; + return token = checkBigIntSuffix(); + } + // Try to parse as an octal + if (pos + 1 < end && isOctalDigit(charCodeAt(text, pos + 1))) { + tokenValue = "" + scanOctalDigits(); + tokenFlags |= TokenFlags::Octal; + return token = SyntaxKind::NumericLiteral; + } + // This fall-through is a deviation from the EcmaScript grammar. The grammar says that a leading zero + // can only be followed by an octal digit, a dot, or the end of the number literal. However, we are being + // permissive and allowing decimal digits of the form 08* and 09* (which many browsers also do). + // falls through + case CharacterCodes::_1: + case CharacterCodes::_2: + case CharacterCodes::_3: + case CharacterCodes::_4: + case CharacterCodes::_5: + case CharacterCodes::_6: + case CharacterCodes::_7: + case CharacterCodes::_8: + case CharacterCodes::_9: { + auto n = scanNumber(); + token = n.type; + tokenValue = n.value; + return token; + } + case CharacterCodes::colon: + pos++; + return token = SyntaxKind::ColonToken; + case CharacterCodes::semicolon: + pos++; + return token = SyntaxKind::SemicolonToken; + case CharacterCodes::lessThan: + if (isConflictMarkerTrivia(text, pos)) { + pos = scanConflictMarkerTrivia(text, pos); + if (skipTrivia) { + continue; + } else { + return token = SyntaxKind::ConflictMarkerTrivia; + } + } + + if (charCodeAt(text, pos + 1).code == CharacterCodes::lessThan) { + if (charCodeAt(text, pos + 2).code == CharacterCodes::equals) { + return pos += 3, token = SyntaxKind::LessThanLessThanEqualsToken; + } + return pos += 2, token = SyntaxKind::LessThanLessThanToken; + } + if (charCodeAt(text, pos + 1).code == CharacterCodes::equals) { + return pos += 2, token = SyntaxKind::LessThanEqualsToken; + } + if (languageVariant == LanguageVariant::JSX && + charCodeAt(text, pos + 1).code == CharacterCodes::slash && + charCodeAt(text, pos + 2).code != CharacterCodes::asterisk) { + return pos += 2, token = SyntaxKind::LessThanSlashToken; + } + pos++; + return token = SyntaxKind::LessThanToken; + case CharacterCodes::equals: + if (isConflictMarkerTrivia(text, pos)) { + pos = scanConflictMarkerTrivia(text, pos); + if (skipTrivia) { + continue; + } else { + return token = SyntaxKind::ConflictMarkerTrivia; + } + } + + if (charCodeAt(text, pos + 1).code == CharacterCodes::equals) { + if (charCodeAt(text, pos + 2).code == CharacterCodes::equals) { + return pos += 3, token = SyntaxKind::EqualsEqualsEqualsToken; + } + return pos += 2, token = SyntaxKind::EqualsEqualsToken; + } + if (charCodeAt(text, pos + 1).code == CharacterCodes::greaterThan) { + return pos += 2, token = SyntaxKind::EqualsGreaterThanToken; + } + pos++; + return token = SyntaxKind::EqualsToken; + case CharacterCodes::greaterThan: + if (isConflictMarkerTrivia(text, pos)) { + pos = scanConflictMarkerTrivia(text, pos); + if (skipTrivia) { + continue; + } else { + return token = SyntaxKind::ConflictMarkerTrivia; + } + } + + pos++; + return token = SyntaxKind::GreaterThanToken; + case CharacterCodes::question: + if (charCodeAt(text, pos + 1).code == CharacterCodes::dot && !isDigit(charCodeAt(text, pos + 2))) { + return pos += 2, token = SyntaxKind::QuestionDotToken; + } + if (charCodeAt(text, pos + 1).code == CharacterCodes::question) { + if (charCodeAt(text, pos + 2).code == CharacterCodes::equals) { + return pos += 3, token = SyntaxKind::QuestionQuestionEqualsToken; + } + return pos += 2, token = SyntaxKind::QuestionQuestionToken; + } + pos++; + return token = SyntaxKind::QuestionToken; + case CharacterCodes::openBracket: + pos++; + return token = SyntaxKind::OpenBracketToken; + case CharacterCodes::closeBracket: + pos++; + return token = SyntaxKind::CloseBracketToken; + case CharacterCodes::caret: + if (charCodeAt(text, pos + 1).code == CharacterCodes::equals) { + return pos += 2, token = SyntaxKind::CaretEqualsToken; + } + pos++; + return token = SyntaxKind::CaretToken; + case CharacterCodes::openBrace: + pos++; + return token = SyntaxKind::OpenBraceToken; + case CharacterCodes::bar: + if (isConflictMarkerTrivia(text, pos)) { + pos = scanConflictMarkerTrivia(text, pos); + if (skipTrivia) { + continue; + } else { + return token = SyntaxKind::ConflictMarkerTrivia; + } + } + + if (charCodeAt(text, pos + 1).code == CharacterCodes::bar) { + if (charCodeAt(text, pos + 2).code == CharacterCodes::equals) { + return pos += 3, token = SyntaxKind::BarBarEqualsToken; + } + return pos += 2, token = SyntaxKind::BarBarToken; + } + if (charCodeAt(text, pos + 1).code == CharacterCodes::equals) { + return pos += 2, token = SyntaxKind::BarEqualsToken; + } + pos++; + return token = SyntaxKind::BarToken; + case CharacterCodes::closeBrace: + pos++; + return token = SyntaxKind::CloseBraceToken; + case CharacterCodes::tilde: + pos++; + return token = SyntaxKind::TildeToken; + case CharacterCodes::at: + pos++; + return token = SyntaxKind::AtToken; + case CharacterCodes::backslash: { + auto extendedCookedChar = peekExtendedUnicodeEscape(); + if (extendedCookedChar.code >= 0 && isIdentifierStart(extendedCookedChar, languageVersion)) { + pos += 3; + tokenFlags |= TokenFlags::ExtendedUnicodeEscape; + tokenValue = scanExtendedUnicodeEscape() + scanIdentifierParts(); + return token = getIdentifierToken(); + } + + auto cookedChar = peekUnicodeEscape(); + if (cookedChar.code >= 0 && isIdentifierStart(cookedChar, languageVersion)) { + pos += 6; + tokenFlags |= TokenFlags::UnicodeEscape; + tokenValue = fromCharCode(cookedChar.code) + scanIdentifierParts(); + return token = getIdentifierToken(); + } + + error(Diagnostics::Invalid_character); + pos++; + return token = SyntaxKind::Unknown; + } + case CharacterCodes::hash: + if (pos != 0 && text[pos + 1] == '!') { + error(Diagnostics::can_only_be_used_at_the_start_of_a_file); + pos++; + return token = SyntaxKind::Unknown; + } + + if (isIdentifierStart(charCodeAt(text, pos + 1), languageVersion)) { + pos++; + scanIdentifier(charCodeAt(text, pos), languageVersion); + } else { + tokenValue = fromCharCode(charCodeAt(text, pos).code); + error(Diagnostics::Invalid_character, pos++, ch.length); + } + return token = SyntaxKind::PrivateIdentifier; + default: { + auto identifierKind = scanIdentifier(ch, languageVersion); + if (identifierKind) { + return token = identifierKind; + } else if (isWhiteSpaceSingleLine(ch)) { + pos += ch.length; + continue; + } else if (isLineBreak(ch)) { + tokenFlags |= TokenFlags::PrecedingLineBreak; + pos += ch.length; + continue; + } + auto size = ch.length; + error(Diagnostics::Invalid_character, pos, size); + pos += size; + return token = SyntaxKind::Unknown; + } + } + } + + return SyntaxKind::EndOfFileToken; +} + +bool Scanner::isOctalDigit(CharCode ch) { + return ch.code >= CharacterCodes::_0 && ch.code <= CharacterCodes::_7; +} + +int Scanner::scanOctalDigits() { + auto start = pos; + while (isOctalDigit(charCodeAt(text, pos))) { + pos++; + } + return stoi(text.substr(start, pos)); +} + +bool Scanner::lookAhead(function callback) { + return speculationHelper(callback, /*isLookahead*/ true); +} + +bool Scanner::tryScan(function callback) { + return speculationHelper(callback, /*isLookahead*/ false); +} + +bool Scanner::speculationHelper(function callback, bool isLookahead) { + return false; +}; \ No newline at end of file diff --git a/src/scanner.h b/src/scanner.h new file mode 100644 index 0000000..1916d7a --- /dev/null +++ b/src/scanner.h @@ -0,0 +1,133 @@ +#pragma once + +#include +#include +#include +#include "types.h" +#include "utf.h" + +using namespace ts::types; +using namespace std; + +namespace ts { + struct ScanNumber { + SyntaxKind type; + string value; + }; + + class Scanner { + public: + string text; + + // Current position (end position of text of current token) + int pos{}; + + // end of text + int end{}; + + // Start position of whitespace before current token + int startPos{}; + + // Start position of text of current token + int tokenPos{}; + + bool skipTrivia = false; + + ScriptTarget languageVersion; + + int inJSDocType = 0; + + SyntaxKind token; + string tokenValue; + int tokenFlags{}; + + LanguageVariant languageVariant = LanguageVariant::Standard; + + vector commentDirectives; + + explicit Scanner(const string &text) : text(text) { + end = text.size(); + } + + SyntaxKind scan(); + + SyntaxKind scanIdentifier(CharCode startCharacter, ScriptTarget languageVersion); + + bool hasUnicodeEscape() { + //todo + return false; + } + + bool hasExtendedUnicodeEscape() { + //todo + return false; + } + + int getTextPos() { + return pos; + } + + int getTokenPos() { + return tokenPos; + } + + int getStartPos() { + return startPos; + } + + bool lookAhead(function callback); + + bool tryScan(function callback); + + bool speculationHelper(function callback, bool isLookahead); + + bool hasPrecedingLineBreak() { + return (tokenFlags & TokenFlags::PrecedingLineBreak) != 0; + } + + private: + string scanBinaryOrOctalDigits(int base); + + int scanExactNumberOfHexDigits(int count, bool canHaveSeparators); + + SyntaxKind scanTemplateAndSetTokenValue(bool isTaggedTemplate); + + ScanNumber scanNumber(); + + CharCode peekExtendedUnicodeEscape(); + + CharCode peekUnicodeEscape(); + + SyntaxKind checkBigIntSuffix(); + + string scanIdentifierParts(); + + string scanNumberFragment(); + + void checkForIdentifierStartAfterNumericLiteral(int numericStart, bool isScientific = false); + + string scanExtendedUnicodeEscape(); + + string scanHexadecimalEscape(int numDigits); + + string scanMinimumNumberOfHexDigits(int count, bool canHaveSeparators); + + string scanHexDigits(int minCount, bool scanAsManyAsPossible, bool canHaveSeparators); + + string scanEscapeSequence(bool isTaggedTemplate = false); + + string scanString(bool jsxAttributeString = false); + + bool isOctalDigit(CharCode code); + + int error(DiagnosticMessage message, int errPos = -1, int length = -1); + + vector appendIfCommentDirective(vector &commentDirectives, const string &text, const regex &commentDirectiveRegEx, int lineStart); + + int scanOctalDigits(); + + int scanConflictMarkerTrivia(string &text, int pos); + + SyntaxKind getIdentifierToken(); + }; +} diff --git a/src/syntax_cursor.cpp b/src/syntax_cursor.cpp new file mode 100644 index 0000000..eacb603 --- /dev/null +++ b/src/syntax_cursor.cpp @@ -0,0 +1,90 @@ +#include "syntax_cursor.h" + +using namespace ts; + +Node SyntaxCursor::currentNode(int position) { + // Only compute the current node if the position is different than the last time + // we were asked. The parser commonly asks for the node at the same position + // twice. Once to know if can read an appropriate list element at a certain point, + // and then to actually read and consume the node. +// if (position != lastQueriedPosition) { +// // Much of the time the parser will need the very next node in the array that +// // we just returned a node from.So just simply check for that case and move +// // forward in the array instead of searching for the node again. +// if (current && current->end == position && currentArrayIndex < (currentArray->length() - 1)) { +// currentArrayIndex++; +// current = ¤tArray->list[currentArrayIndex]; +// } +// +// // If we don't have a node, or the node we have isn't in the right position, +// // then try to find a viable node at the position requested. +// if (!current || current->pos != position) { +// findHighestListElementThatStartsAtPosition(position); +// } +// } + + // Cache this query so that we don't do any extra work if the parser calls back + // into us. Note: this is very common as the parser will make pairs of calls like + // 'isListElement -> parseListElement'. If we were unable to find a node when + // called with 'isListElement', we don't want to redo the work when parseListElement + // is called immediately after. + lastQueriedPosition = position; + + // Either we don'd have a node, or we have a node at the position being asked for. +// assert(!current || current->pos == position); + return *current; +} + +void SyntaxCursor::findHighestListElementThatStartsAtPosition(int position) { +// Clear out any cached state about the last node we found. +// currentArray = nullptr; +// currentArrayIndex = InvalidPosition::Value; +// current = nullptr; +// +// // Recurse into the source file to find the highest node at this position. +// forEachChild(sourceFile, visitNode, visitArray); +// return; +// +// function visitNode(node: Node) { +// if (position >= node.pos && position < node.end) { +// // Position was within this node. Keep searching deeper to find the node. +// forEachChild(node, visitNode, visitArray); +// +// // don't proceed any further in the search. +// return true; +// } +// +// // position wasn't in this node, have to keep searching. +// return false; +// } +// +// function visitArray(array: NodeArray) { +// if (position >= array.pos && position < array.end) { +// // position was in this array. Search through this array to see if we find a +// // viable element. +// for (let i = 0; i < array.length; i++) { +// const child = array[i]; +// if (child) { +// if (child.pos === position) { +// // Found the right node. We're done. +// currentArray = array; +// currentArrayIndex = i; +// current = child; +// return true; +// } +// else { +// if (child.pos < position && position < child.end) { +// // Position in somewhere within this child. Search in it and +// // stop searching in this array. +// forEachChild(child, visitNode, visitArray); +// return true; +// } +// } +// } +// } +// } +// +// // position wasn't in this array, have to keep searching. +// return false; +// } +} diff --git a/src/syntax_cursor.h b/src/syntax_cursor.h new file mode 100644 index 0000000..35faf36 --- /dev/null +++ b/src/syntax_cursor.h @@ -0,0 +1,51 @@ +#pragma once + +#include +#include "types.h" + +using namespace std; + +namespace ts { + struct IncrementalElement : ReadonlyTextRange { + Node *parent = nullptr; + bool intersectsChange; + int length; +// _children: Node[] | undefined; + int pos; + int end; + }; + + enum InvalidPosition { + Value = -1 + }; + + //not used +// struct IncrementalNode : Node, IncrementalElement { +// bool hasBeenIncrementallyParsed; +// }; + + class SyntaxCursor { + SourceFile *sourceFile; +// NodeArray *currentArray; + + int currentArrayIndex = 0; + +// assert(currentArrayIndex < currentArray.length); + Node *current; + int lastQueriedPosition = InvalidPosition::Value; + public: + SyntaxCursor(SourceFile *sourceFile) : sourceFile(sourceFile) { +// currentArray = &sourceFile->statements; +// current = ¤tArray->list[currentArrayIndex]; + } + + Node currentNode(int position); + + // Finds the highest element in the tree we can find that starts at the provided position. + // The element must be a direct child of some node list in the tree. This way after we + // return it, we can easily return its next sibling in the list. + void findHighestListElementThatStartsAtPosition(int position); + }; + +} // ts + diff --git a/src/tests/CmakeLists.txt b/src/tests/CmakeLists.txt new file mode 100644 index 0000000..c4b8acd --- /dev/null +++ b/src/tests/CmakeLists.txt @@ -0,0 +1,43 @@ +cmake_minimum_required(VERSION 3.10) +project(typescript) + +#add_library(catch ../../../libs/Catch2/single_include/catch.hpp) +#set_target_properties(catch PROPERTIES LINKER_LANGUAGE CXX) + +Include(FetchContent) + +#FetchContent_Declare( +# Catch2 +# GIT_REPOSITORY https://github.com/catchorg/Catch2.git +# GIT_TAG v3.0.1 +#) +# +#FetchContent_MakeAvailable(Catch2) + +FetchContent_Declare( + googletest + GIT_REPOSITORY https://github.com/google/googletest.git + GIT_TAG release-1.11.0 +) +# For Windows: Prevent overriding the parent project's compiler/linker settings +set(gtest_force_shared_crt ON CACHE BOOL "" FORCE) +FetchContent_MakeAvailable(googletest) + +include_directories(../../libs) + +# These tests can use the Catch2-provided main +#add_executable(tests test.cpp) +#link_libraries(PRIVATE Catch2::Catch2WithMain) + +#link_libraries(PRIVATE Catch2::Catch2WithMain) +#link_libraries(typescript) + +file(GLOB TESTS test*.cpp) +foreach(file ${TESTS}) + get_filename_component(name ${file} NAME_WE) + MESSAGE("Test found typescript_${name}.") + add_executable(typescript_${name} ${file}) + target_link_libraries(typescript_${name} gtest_main typescript) +# target_link_libraries(typescript_${name} PRIVATE Catch2::Catch2WithMain) +# target_link_libraries(typescript_${name} PRIVATE Catch2::Catch2WithMain typescript) +endforeach() diff --git a/src/tests/test_core.cpp b/src/tests/test_core.cpp new file mode 100644 index 0000000..48c8378 --- /dev/null +++ b/src/tests/test_core.cpp @@ -0,0 +1,166 @@ +#include + +#include +#include +#include +#include +#include "../core.h" +#include "../types.h" +#include "../factory.h" + +using namespace std; +using namespace ts; + +TEST(core, regexp) { + std::regex regex("^///?\\s*@(ts-expect-error|ts-ignore)"); + + { + std::cmatch m; + if (std::regex_search("//@ts-ignore", m, regex)) { + std::cout << m[1] << " " << m[1].length() << " = " << (m[1] == "ts-ignore") << "\n"; + } + } + + { + std::smatch m; + const std::string bla = "//@ts-ignore"; + if (std::regex_search(bla, m, regex)) { + std::cout << m[1] << " " << m[1].length() << " = " << (m[1] == "ts-ignore") << "\n"; + } + } +} + +TEST(core, sharedptr) { + struct Node { + shared_ptr> decorators; + }; + + Node a; + + EXPECT_EQ(!!a.decorators, false); +} + +TEST(core, node) { + auto node = createBaseNode(); + node.to().escapedText = "id"; + + EXPECT_EQ(node.is(), false); + EXPECT_EQ(node.is(), true); + EXPECT_EQ(node.to().escapedText, "id"); +} + +TEST(core, nodeUnion) { + NodeType node; + + EXPECT_EQ(node.kinds()[0], SyntaxKind::Identifier); + EXPECT_EQ(node.kinds()[1], SyntaxKind::QualifiedName); + + EXPECT_EQ(node.contains(SyntaxKind::Identifier), true); + EXPECT_EQ(node.contains(SyntaxKind::QualifiedName), true); + EXPECT_EQ(node.contains(SyntaxKind::TypeParameter), false); + +// using MyIds = variant; +//// struct MyIds: NodeType{}; +// +// auto id = createBaseNode(); +// id.to().escapedText = "id"; +// +// auto id2 = id.toUnion(); +} + +struct A { + constexpr static auto kind = types::SyntaxKind::TypeParameter; +}; + +#include +struct B { +// using kind = types::SyntaxKind::Identifier; + constexpr static auto kind = types::SyntaxKind::Identifier; +}; + +//template