diff --git a/Userland/Libraries/LibJS/AST.cpp b/Userland/Libraries/LibJS/AST.cpp index 0cce9e4665c..be39096cef1 100644 --- a/Userland/Libraries/LibJS/AST.cpp +++ b/Userland/Libraries/LibJS/AST.cpp @@ -3023,7 +3023,7 @@ Completion ObjectExpression::execute(Interpreter& interpreter, GlobalObject& glo object->define_direct_accessor(property_key, nullptr, &value.as_function(), Attribute::Configurable | Attribute::Enumerable); break; case ObjectProperty::Type::KeyValue: - object->define_direct_property(property_key, value, JS::default_attributes); + object->define_direct_property(property_key, value, default_attributes); break; case ObjectProperty::Type::Spread: default: @@ -3104,7 +3104,7 @@ void OptionalChain::dump(int indent) const } } -ThrowCompletionOr OptionalChain::to_reference_and_value(JS::Interpreter& interpreter, JS::GlobalObject& global_object) const +ThrowCompletionOr OptionalChain::to_reference_and_value(Interpreter& interpreter, GlobalObject& global_object) const { auto base_reference = TRY(m_base->to_reference(interpreter, global_object)); auto base = base_reference.is_unresolvable() diff --git a/Userland/Libraries/LibJS/Console.cpp b/Userland/Libraries/LibJS/Console.cpp index 8de157dc6c2..c398f09695e 100644 --- a/Userland/Libraries/LibJS/Console.cpp +++ b/Userland/Libraries/LibJS/Console.cpp @@ -113,7 +113,7 @@ ThrowCompletionOr Console::trace() } // 3. Perform Printer("trace", « trace »). - return m_client->printer(JS::Console::LogLevel::Trace, trace); + return m_client->printer(Console::LogLevel::Trace, trace); } // 1.2.1. count(label), https://console.spec.whatwg.org/#count @@ -183,7 +183,7 @@ ThrowCompletionOr Console::assert_() auto message = js_string(vm(), "Assertion failed"); // NOTE: Assemble `data` from the function arguments. - Vector data; + Vector data; if (vm().argument_count() > 1) { data.ensure_capacity(vm().argument_count() - 1); for (size_t i = 1; i < vm().argument_count(); ++i) { @@ -407,19 +407,19 @@ void Console::output_debug_message([[maybe_unused]] LogLevel log_level, [[maybe_ { #ifdef __serenity__ switch (log_level) { - case JS::Console::LogLevel::Debug: + case Console::LogLevel::Debug: dbgln("\033[32;1m(js debug)\033[0m {}", output); break; - case JS::Console::LogLevel::Error: + case Console::LogLevel::Error: dbgln("\033[32;1m(js error)\033[0m {}", output); break; - case JS::Console::LogLevel::Info: + case Console::LogLevel::Info: dbgln("\033[32;1m(js info)\033[0m {}", output); break; - case JS::Console::LogLevel::Log: + case Console::LogLevel::Log: dbgln("\033[32;1m(js log)\033[0m {}", output); break; - case JS::Console::LogLevel::Warn: + case Console::LogLevel::Warn: dbgln("\033[32;1m(js warn)\033[0m {}", output); break; default: diff --git a/Userland/Libraries/LibJS/MarkupGenerator.cpp b/Userland/Libraries/LibJS/MarkupGenerator.cpp index 4f9d4bdc887..eae5ad4c808 100644 --- a/Userland/Libraries/LibJS/MarkupGenerator.cpp +++ b/Userland/Libraries/LibJS/MarkupGenerator.cpp @@ -142,16 +142,16 @@ void MarkupGenerator::function_to_html(Object const& function, StringBuilder& ht void MarkupGenerator::date_to_html(Object const& date, StringBuilder& html_output, HashTable&) { - html_output.appendff("Date {}", JS::to_date_string(static_cast(date).date_value())); + html_output.appendff("Date {}", to_date_string(static_cast(date).date_value())); } void MarkupGenerator::error_to_html(Object const& object, StringBuilder& html_output, HashTable&) { auto& vm = object.vm(); - auto name = object.get_without_side_effects(vm.names.name).value_or(JS::js_undefined()); - auto message = object.get_without_side_effects(vm.names.message).value_or(JS::js_undefined()); + auto name = object.get_without_side_effects(vm.names.name).value_or(js_undefined()); + auto message = object.get_without_side_effects(vm.names.message).value_or(js_undefined()); if (name.is_accessor() || message.is_accessor()) { - html_output.append(wrap_string_in_style(JS::Value(&object).to_string_without_side_effects(), StyleType::Invalid)); + html_output.append(wrap_string_in_style(Value(&object).to_string_without_side_effects(), StyleType::Invalid)); } else { auto name_string = name.to_string_without_side_effects(); auto message_string = message.to_string_without_side_effects(); diff --git a/Userland/Libraries/LibJS/Runtime/AbstractOperations.cpp b/Userland/Libraries/LibJS/Runtime/AbstractOperations.cpp index 09f3d241acb..2833e88c8f7 100644 --- a/Userland/Libraries/LibJS/Runtime/AbstractOperations.cpp +++ b/Userland/Libraries/LibJS/Runtime/AbstractOperations.cpp @@ -580,13 +580,13 @@ ThrowCompletionOr perform_eval(Value x, GlobalObject& caller_realm, Calle Optional eval_result; if (auto* bytecode_interpreter = Bytecode::Interpreter::current()) { - auto executable_result = JS::Bytecode::Generator::generate(program); + auto executable_result = Bytecode::Generator::generate(program); if (executable_result.is_error()) return vm.throw_completion(bytecode_interpreter->global_object(), ErrorType::NotImplemented, executable_result.error().to_string()); auto executable = executable_result.release_value(); executable->name = "eval"sv; - if (JS::Bytecode::g_dump_bytecode) + if (Bytecode::g_dump_bytecode) executable->dump(); eval_result = TRY(bytecode_interpreter->run(*executable)); // Turn potentially empty JS::Value from the bytecode interpreter into an empty Optional @@ -1009,7 +1009,7 @@ Object* create_mapped_arguments_object(GlobalObject& global_object, FunctionObje // 3. Perform map.[[DefineOwnProperty]](! ToString(𝔽(index)), PropertyDescriptor { [[Set]]: p, [[Get]]: g, [[Enumerable]]: false, [[Configurable]]: true }). object->parameter_map().define_native_accessor( PropertyKey { index }, - [&environment, name](VM&, GlobalObject& global_object_getter) -> JS::ThrowCompletionOr { + [&environment, name](VM&, GlobalObject& global_object_getter) -> ThrowCompletionOr { return MUST(environment.get_binding_value(global_object_getter, name, false)); }, [&environment, name](VM& vm, GlobalObject& global_object_setter) { diff --git a/Userland/Libraries/LibJS/Runtime/ECMAScriptFunctionObject.cpp b/Userland/Libraries/LibJS/Runtime/ECMAScriptFunctionObject.cpp index dcb04428b3c..eb354b98661 100644 --- a/Userland/Libraries/LibJS/Runtime/ECMAScriptFunctionObject.cpp +++ b/Userland/Libraries/LibJS/Runtime/ECMAScriptFunctionObject.cpp @@ -777,19 +777,19 @@ Completion ECMAScriptFunctionObject::ordinary_call_evaluate_body() if (bytecode_interpreter) { if (!m_bytecode_executable) { auto compile = [&](auto& node, auto kind, auto name) -> ThrowCompletionOr> { - auto executable_result = JS::Bytecode::Generator::generate(node, kind); + auto executable_result = Bytecode::Generator::generate(node, kind); if (executable_result.is_error()) return vm.throw_completion(bytecode_interpreter->global_object(), ErrorType::NotImplemented, executable_result.error().to_string()); auto bytecode_executable = executable_result.release_value(); bytecode_executable->name = name; - auto& passes = JS::Bytecode::Interpreter::optimization_pipeline(); + auto& passes = Bytecode::Interpreter::optimization_pipeline(); passes.perform(*bytecode_executable); if constexpr (JS_BYTECODE_DEBUG) { dbgln("Optimisation passes took {}us", passes.elapsed()); dbgln("Compiled Bytecode::Block for function '{}':", m_name); } - if (JS::Bytecode::g_dump_bytecode) + if (Bytecode::g_dump_bytecode) bytecode_executable->dump(); return bytecode_executable; diff --git a/Userland/Libraries/LibJS/Runtime/FinalizationRegistry.cpp b/Userland/Libraries/LibJS/Runtime/FinalizationRegistry.cpp index 8415a7d2670..7651f5999e8 100644 --- a/Userland/Libraries/LibJS/Runtime/FinalizationRegistry.cpp +++ b/Userland/Libraries/LibJS/Runtime/FinalizationRegistry.cpp @@ -9,10 +9,10 @@ namespace JS { -FinalizationRegistry::FinalizationRegistry(Realm& realm, JS::JobCallback cleanup_callback, Object& prototype) +FinalizationRegistry::FinalizationRegistry(Realm& realm, JobCallback cleanup_callback, Object& prototype) : Object(prototype) , WeakContainer(heap()) - , m_realm(JS::make_handle(realm)) + , m_realm(make_handle(realm)) , m_cleanup_callback(move(cleanup_callback)) { } diff --git a/Userland/Libraries/LibJS/Runtime/FinalizationRegistry.h b/Userland/Libraries/LibJS/Runtime/FinalizationRegistry.h index cf0aaa9ccce..7967cacf927 100644 --- a/Userland/Libraries/LibJS/Runtime/FinalizationRegistry.h +++ b/Userland/Libraries/LibJS/Runtime/FinalizationRegistry.h @@ -22,7 +22,7 @@ class FinalizationRegistry final JS_OBJECT(FinalizationRegistry, Object); public: - explicit FinalizationRegistry(Realm&, JS::JobCallback, Object& prototype); + explicit FinalizationRegistry(Realm&, JobCallback, Object& prototype); virtual ~FinalizationRegistry() override = default; void add_finalization_record(Cell& target, Value held_value, Object* unregister_token); @@ -41,7 +41,7 @@ private: virtual void visit_edges(Visitor& visitor) override; Handle m_realm; - JS::JobCallback m_cleanup_callback; + JobCallback m_cleanup_callback; struct FinalizationRecord { Cell* target { nullptr }; diff --git a/Userland/Libraries/LibJS/Runtime/GeneratorObject.cpp b/Userland/Libraries/LibJS/Runtime/GeneratorObject.cpp index cc11d8ab60f..26f5169a643 100644 --- a/Userland/Libraries/LibJS/Runtime/GeneratorObject.cpp +++ b/Userland/Libraries/LibJS/Runtime/GeneratorObject.cpp @@ -72,10 +72,10 @@ ThrowCompletionOr GeneratorObject::next_impl(VM& vm, GlobalObject& global auto previous_generated_value = TRY(generated_value(m_previous_value)); auto result = Object::create(global_object, global_object.object_prototype()); - result->define_direct_property("value", previous_generated_value, JS::default_attributes); + result->define_direct_property("value", previous_generated_value, default_attributes); if (m_done) { - result->define_direct_property("done", Value(true), JS::default_attributes); + result->define_direct_property("done", Value(true), default_attributes); return result; } @@ -85,7 +85,7 @@ ThrowCompletionOr GeneratorObject::next_impl(VM& vm, GlobalObject& global if (!next_block) { // The generator has terminated, now we can simply return done=true. m_done = true; - result->define_direct_property("done", Value(true), JS::default_attributes); + result->define_direct_property("done", Value(true), default_attributes); return result; } @@ -116,8 +116,8 @@ ThrowCompletionOr GeneratorObject::next_impl(VM& vm, GlobalObject& global m_previous_value = TRY(next_result); - result->define_direct_property("value", TRY(generated_value(m_previous_value)), JS::default_attributes); - result->define_direct_property("done", Value(m_done), JS::default_attributes); + result->define_direct_property("value", TRY(generated_value(m_previous_value)), default_attributes); + result->define_direct_property("done", Value(m_done), default_attributes); return result; } diff --git a/Userland/Libraries/LibJS/Runtime/GlobalObject.cpp b/Userland/Libraries/LibJS/Runtime/GlobalObject.cpp index 84f83e394ce..163107937e1 100644 --- a/Userland/Libraries/LibJS/Runtime/GlobalObject.cpp +++ b/Userland/Libraries/LibJS/Runtime/GlobalObject.cpp @@ -488,7 +488,7 @@ JS_DEFINE_NATIVE_FUNCTION(GlobalObject::eval) } // 19.2.6.1.1 Encode ( string, unescapedSet ), https://tc39.es/ecma262/#sec-encode -static ThrowCompletionOr encode([[maybe_unused]] JS::GlobalObject& global_object, String const& string, StringView unescaped_set) +static ThrowCompletionOr encode(GlobalObject& global_object, String const& string, StringView unescaped_set) { auto& vm = global_object.vm(); auto utf16_string = Utf16String(string); @@ -544,7 +544,7 @@ static ThrowCompletionOr encode([[maybe_unused]] JS::GlobalObject& globa } // 19.2.6.1.2 Decode ( string, reservedSet ), https://tc39.es/ecma262/#sec-decode -static ThrowCompletionOr decode(JS::GlobalObject& global_object, String const& string, StringView reserved_set) +static ThrowCompletionOr decode(GlobalObject& global_object, String const& string, StringView reserved_set) { StringBuilder decoded_builder; auto code_point_start_offset = 0u; diff --git a/Userland/Libraries/LibJS/Runtime/Intl/DisplayNames.cpp b/Userland/Libraries/LibJS/Runtime/Intl/DisplayNames.cpp index e7075e59549..ebbea247d48 100644 --- a/Userland/Libraries/LibJS/Runtime/Intl/DisplayNames.cpp +++ b/Userland/Libraries/LibJS/Runtime/Intl/DisplayNames.cpp @@ -117,7 +117,7 @@ ThrowCompletionOr canonical_code_for_display_names(GlobalObject& global_o return vm.throw_completion(global_object, ErrorType::IntlInvalidLanguageTag, code); // c. Return ! CanonicalizeUnicodeLocaleId(code). - auto canonicalized_tag = JS::Intl::canonicalize_unicode_locale_id(*locale_id); + auto canonicalized_tag = Intl::canonicalize_unicode_locale_id(*locale_id); return js_string(vm, move(canonicalized_tag)); } diff --git a/Userland/Libraries/LibJS/Runtime/Intl/LocaleConstructor.cpp b/Userland/Libraries/LibJS/Runtime/Intl/LocaleConstructor.cpp index 63f95312f36..c3a818b79fb 100644 --- a/Userland/Libraries/LibJS/Runtime/Intl/LocaleConstructor.cpp +++ b/Userland/Libraries/LibJS/Runtime/Intl/LocaleConstructor.cpp @@ -69,7 +69,7 @@ static ThrowCompletionOr apply_options_to_tag(GlobalObject& global_objec auto region = TRY(get_string_option(global_object, options, vm.names.region, Unicode::is_unicode_region_subtag)); // 10. Set tag to ! CanonicalizeUnicodeLocaleId(tag). - auto canonicalized_tag = JS::Intl::canonicalize_unicode_locale_id(*locale_id); + auto canonicalized_tag = Intl::canonicalize_unicode_locale_id(*locale_id); // 11. Assert: tag matches the unicode_locale_id production. locale_id = Unicode::parse_unicode_locale_id(canonicalized_tag); diff --git a/Userland/Libraries/LibJS/Runtime/JSONObject.cpp b/Userland/Libraries/LibJS/Runtime/JSONObject.cpp index 60118b88325..36a30160aa1 100644 --- a/Userland/Libraries/LibJS/Runtime/JSONObject.cpp +++ b/Userland/Libraries/LibJS/Runtime/JSONObject.cpp @@ -431,7 +431,7 @@ Object* JSONObject::parse_json_object(GlobalObject& global_object, JsonObject co { auto* object = Object::create(global_object, global_object.object_prototype()); json_object.for_each_member([&](auto& key, auto& value) { - object->define_direct_property(key, parse_json_value(global_object, value), JS::default_attributes); + object->define_direct_property(key, parse_json_value(global_object, value), default_attributes); }); return object; } @@ -441,7 +441,7 @@ Array* JSONObject::parse_json_array(GlobalObject& global_object, JsonArray const auto* array = MUST(Array::create(global_object, 0)); size_t index = 0; json_array.for_each([&](auto& value) { - array->define_direct_property(index++, parse_json_value(global_object, value), JS::default_attributes); + array->define_direct_property(index++, parse_json_value(global_object, value), default_attributes); }); return array; } diff --git a/Userland/Libraries/LibJS/Runtime/PromiseJobs.cpp b/Userland/Libraries/LibJS/Runtime/PromiseJobs.cpp index 163fe1c1589..ca59ef716b9 100644 --- a/Userland/Libraries/LibJS/Runtime/PromiseJobs.cpp +++ b/Userland/Libraries/LibJS/Runtime/PromiseJobs.cpp @@ -77,14 +77,14 @@ static ThrowCompletionOr run_reaction_job(GlobalObject& global_object, Pr // i. Let status be Call(promiseCapability.[[Reject]], undefined, « handlerResult.[[Value]] »). auto* reject_function = promise_capability.value().reject; dbgln_if(PROMISE_DEBUG, "run_reaction_job: Calling PromiseCapability's reject function @ {}", reject_function); - return JS::call(global_object, *reject_function, js_undefined(), *handler_result.value()); + return call(global_object, *reject_function, js_undefined(), *handler_result.value()); } // i. Else, else { // i. Let status be Call(promiseCapability.[[Resolve]], undefined, « handlerResult.[[Value]] »). auto* resolve_function = promise_capability.value().resolve; dbgln_if(PROMISE_DEBUG, "[PromiseReactionJob]: Calling PromiseCapability's resolve function @ {}", resolve_function); - return JS::call(global_object, *resolve_function, js_undefined(), *handler_result.value()); + return call(global_object, *resolve_function, js_undefined(), *handler_result.value()); } // j. Return Completion(status). @@ -95,7 +95,7 @@ PromiseJob create_promise_reaction_job(GlobalObject& global_object, PromiseReact { // 1. Let job be a new Job Abstract Closure with no parameters that captures reaction and argument and performs the following steps when called: // See run_reaction_job for "the following steps". - auto job = [global_object = JS::make_handle(&global_object), reaction = JS::make_handle(&reaction), argument = JS::make_handle(argument)]() mutable { + auto job = [global_object = make_handle(&global_object), reaction = make_handle(&reaction), argument = make_handle(argument)]() mutable { return run_reaction_job(*global_object.cell(), *reaction.cell(), argument.value()); }; @@ -142,7 +142,7 @@ static ThrowCompletionOr run_resolve_thenable_job(GlobalObject& global_ob if (then_call_result.is_error()) { // i. Let status be Call(resolvingFunctions.[[Reject]], undefined, « thenCallResult.[[Value]] »). dbgln_if(PROMISE_DEBUG, "run_resolve_thenable_job: then_call_result is an abrupt completion, calling reject function with value {}", *then_call_result.throw_completion().value()); - auto status = JS::call(global_object, &reject_function, js_undefined(), *then_call_result.throw_completion().value()); + auto status = call(global_object, &reject_function, js_undefined(), *then_call_result.throw_completion().value()); // ii. Return Completion(status). return status; @@ -174,7 +174,7 @@ PromiseJob create_promise_resolve_thenable_job(GlobalObject& global_object, Prom // 1. Let job be a new Job Abstract Closure with no parameters that captures promiseToResolve, thenable, and then and performs the following steps when called: // See PromiseResolveThenableJob::call() for "the following steps". // NOTE: This is done out of order, since `then` is moved into the lambda and `then` would be invalid if it was done at the start. - auto job = [global_object = JS::make_handle(&global_object), promise_to_resolve = JS::make_handle(&promise_to_resolve), thenable = JS::make_handle(thenable), then = move(then)]() mutable { + auto job = [global_object = make_handle(&global_object), promise_to_resolve = make_handle(&promise_to_resolve), thenable = make_handle(thenable), then = move(then)]() mutable { return run_resolve_thenable_job(*global_object.cell(), *promise_to_resolve.cell(), thenable.value(), then); }; diff --git a/Userland/Libraries/LibJS/Runtime/ShadowRealm.cpp b/Userland/Libraries/LibJS/Runtime/ShadowRealm.cpp index 0ca9657588e..97aa9185a78 100644 --- a/Userland/Libraries/LibJS/Runtime/ShadowRealm.cpp +++ b/Userland/Libraries/LibJS/Runtime/ShadowRealm.cpp @@ -109,7 +109,7 @@ ThrowCompletionOr perform_shadow_realm_eval(GlobalObject& global_object, // b. If script is a List of errors, throw a SyntaxError exception. if (parser.has_errors()) { auto& error = parser.errors()[0]; - return vm.throw_completion(global_object, error.to_string()); + return vm.throw_completion(global_object, error.to_string()); } // c. If script Contains ScriptBody is false, return undefined. diff --git a/Userland/Libraries/LibJS/Runtime/Value.cpp b/Userland/Libraries/LibJS/Runtime/Value.cpp index 7f5c80a90ce..5b10f0085aa 100644 --- a/Userland/Libraries/LibJS/Runtime/Value.cpp +++ b/Userland/Libraries/LibJS/Runtime/Value.cpp @@ -1598,7 +1598,7 @@ ThrowCompletionOr is_less_than(GlobalObject& global_object, bool left_ } // 7.3.21 Invoke ( V, P [ , argumentsList ] ), https://tc39.es/ecma262/#sec-invoke -ThrowCompletionOr Value::invoke_internal(GlobalObject& global_object, JS::PropertyKey const& property_key, Optional> arguments) +ThrowCompletionOr Value::invoke_internal(GlobalObject& global_object, PropertyKey const& property_key, Optional> arguments) { auto& vm = global_object.vm(); auto property = TRY(get(global_object, property_key)); diff --git a/Userland/Libraries/LibJS/SyntaxHighlighter.cpp b/Userland/Libraries/LibJS/SyntaxHighlighter.cpp index c527dc42b33..0cd788fb8a5 100644 --- a/Userland/Libraries/LibJS/SyntaxHighlighter.cpp +++ b/Userland/Libraries/LibJS/SyntaxHighlighter.cpp @@ -12,24 +12,24 @@ namespace JS { -static Syntax::TextStyle style_for_token_type(Gfx::Palette const& palette, JS::TokenType type) +static Syntax::TextStyle style_for_token_type(Gfx::Palette const& palette, TokenType type) { - switch (JS::Token::category(type)) { - case JS::TokenCategory::Invalid: + switch (Token::category(type)) { + case TokenCategory::Invalid: return { palette.syntax_comment() }; - case JS::TokenCategory::Number: + case TokenCategory::Number: return { palette.syntax_number() }; - case JS::TokenCategory::String: + case TokenCategory::String: return { palette.syntax_string() }; - case JS::TokenCategory::Punctuation: + case TokenCategory::Punctuation: return { palette.syntax_punctuation() }; - case JS::TokenCategory::Operator: + case TokenCategory::Operator: return { palette.syntax_operator() }; - case JS::TokenCategory::Keyword: + case TokenCategory::Keyword: return { palette.syntax_keyword(), true }; - case JS::TokenCategory::ControlKeyword: + case TokenCategory::ControlKeyword: return { palette.syntax_control_keyword(), true }; - case JS::TokenCategory::Identifier: + case TokenCategory::Identifier: return { palette.syntax_identifier() }; default: return { palette.base_text() }; @@ -38,8 +38,8 @@ static Syntax::TextStyle style_for_token_type(Gfx::Palette const& palette, JS::T bool SyntaxHighlighter::is_identifier(u64 token) const { - auto js_token = static_cast(static_cast(token)); - return js_token == JS::TokenType::Identifier; + auto js_token = static_cast(static_cast(token)); + return js_token == TokenType::Identifier; } bool SyntaxHighlighter::is_navigatable([[maybe_unused]] u64 token) const @@ -51,7 +51,7 @@ void SyntaxHighlighter::rehighlight(Palette const& palette) { auto text = m_client->get_text(); - JS::Lexer lexer(text); + Lexer lexer(text); Vector spans; GUI::TextPosition position { 0, 0 }; @@ -65,7 +65,7 @@ void SyntaxHighlighter::rehighlight(Palette const& palette) position.set_column(position.column() + 1); }; - auto append_token = [&](StringView str, const JS::Token& token, bool is_trivia) { + auto append_token = [&](StringView str, Token const& token, bool is_trivia) { if (str.is_empty()) return; @@ -76,7 +76,7 @@ void SyntaxHighlighter::rehighlight(Palette const& palette) GUI::TextDocumentSpan span; span.range.set_start(start); span.range.set_end({ position.line(), position.column() }); - auto type = is_trivia ? JS::TokenType::Invalid : token.type(); + auto type = is_trivia ? TokenType::Invalid : token.type(); auto style = style_for_token_type(palette, type); span.attributes.color = style.color; span.attributes.bold = style.bold; @@ -97,7 +97,7 @@ void SyntaxHighlighter::rehighlight(Palette const& palette) append_token(token.trivia(), token, true); append_token(token.value(), token, false); - if (token.type() == JS::TokenType::Eof) + if (token.type() == TokenType::Eof) was_eof = true; } @@ -113,15 +113,16 @@ Vector SyntaxHighlighter::matching_token { static Vector pairs; if (pairs.is_empty()) { - pairs.append({ static_cast(JS::TokenType::CurlyOpen), static_cast(JS::TokenType::CurlyClose) }); - pairs.append({ static_cast(JS::TokenType::ParenOpen), static_cast(JS::TokenType::ParenClose) }); - pairs.append({ static_cast(JS::TokenType::BracketOpen), static_cast(JS::TokenType::BracketClose) }); + pairs.append({ static_cast(TokenType::CurlyOpen), static_cast(TokenType::CurlyClose) }); + pairs.append({ static_cast(TokenType::ParenOpen), static_cast(TokenType::ParenClose) }); + pairs.append({ static_cast(TokenType::BracketOpen), static_cast(TokenType::BracketClose) }); } return pairs; } bool SyntaxHighlighter::token_types_equal(u64 token1, u64 token2) const { - return static_cast(token1) == static_cast(token2); + return static_cast(token1) == static_cast(token2); } + } diff --git a/Userland/Libraries/LibJS/SyntheticModule.cpp b/Userland/Libraries/LibJS/SyntheticModule.cpp index f0c8878d6b9..ea07e4ec61d 100644 --- a/Userland/Libraries/LibJS/SyntheticModule.cpp +++ b/Userland/Libraries/LibJS/SyntheticModule.cpp @@ -23,14 +23,14 @@ SyntheticModule::SyntheticModule(Vector export_names, SyntheticModule } // 1.2.3.1 GetExportedNames( exportStarSet ), https://tc39.es/proposal-json-modules/#sec-smr-getexportednames -ThrowCompletionOr> JS::SyntheticModule::get_exported_names(VM&, Vector) +ThrowCompletionOr> SyntheticModule::get_exported_names(VM&, Vector) { // 1. Return module.[[ExportNames]]. return m_export_names; } // 1.2.3.2 ResolveExport( exportName, resolveSet ), https://tc39.es/proposal-json-modules/#sec-smr-resolveexport -ThrowCompletionOr JS::SyntheticModule::resolve_export(VM&, FlyString const& export_name, Vector) +ThrowCompletionOr SyntheticModule::resolve_export(VM&, FlyString const& export_name, Vector) { // 1. If module.[[ExportNames]] does not contain exportName, return null. if (!m_export_names.contains_slow(export_name)) @@ -41,7 +41,7 @@ ThrowCompletionOr JS::SyntheticModule::resolve_export(VM&, FlyS } // 1.2.3.3 Link ( ), https://tc39.es/proposal-json-modules/#sec-smr-instantiate -ThrowCompletionOr JS::SyntheticModule::link(VM& vm) +ThrowCompletionOr SyntheticModule::link(VM& vm) { // Note: Has some changes from PR: https://github.com/tc39/proposal-json-modules/pull/13. // Which includes renaming it from Instantiate ( ) to Link ( ). @@ -73,7 +73,7 @@ ThrowCompletionOr JS::SyntheticModule::link(VM& vm) } // 1.2.3.4 Evaluate ( ), https://tc39.es/proposal-json-modules/#sec-smr-Evaluate -ThrowCompletionOr JS::SyntheticModule::evaluate(VM& vm) +ThrowCompletionOr SyntheticModule::evaluate(VM& vm) { // Note: Has some changes from PR: https://github.com/tc39/proposal-json-modules/pull/13. // 1. Suspend the currently running execution context.