1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-07-26 06:57:46 +00:00

LibJS: Replace GlobalObject with VM in JSON AOs [Part 13/19]

This commit is contained in:
Linus Groh 2022-08-21 17:41:49 +01:00
parent 90bf33241d
commit 9930302efb
3 changed files with 44 additions and 40 deletions

View file

@ -20,9 +20,9 @@ public:
// The base implementation of stringify is exposed because it is used by
// test-js to communicate between the JS tests and the C++ test runner.
static ThrowCompletionOr<String> stringify_impl(GlobalObject&, Value value, Value replacer, Value space);
static ThrowCompletionOr<String> stringify_impl(VM&, Value value, Value replacer, Value space);
static Value parse_json_value(GlobalObject&, JsonValue const&);
static Value parse_json_value(VM&, JsonValue const&);
private:
struct StringifyState {
@ -34,15 +34,15 @@ private:
};
// Stringify helpers
static ThrowCompletionOr<String> serialize_json_property(GlobalObject&, StringifyState&, PropertyKey const& key, Object* holder);
static ThrowCompletionOr<String> serialize_json_object(GlobalObject&, StringifyState&, Object&);
static ThrowCompletionOr<String> serialize_json_array(GlobalObject&, StringifyState&, Object&);
static ThrowCompletionOr<String> serialize_json_property(VM&, StringifyState&, PropertyKey const& key, Object* holder);
static ThrowCompletionOr<String> serialize_json_object(VM&, StringifyState&, Object&);
static ThrowCompletionOr<String> serialize_json_array(VM&, StringifyState&, Object&);
static String quote_json_string(String);
// Parse helpers
static Object* parse_json_object(GlobalObject&, JsonObject const&);
static Array* parse_json_array(GlobalObject&, JsonArray const&);
static ThrowCompletionOr<Value> internalize_json_property(GlobalObject&, Object* holder, PropertyKey const& name, FunctionObject& reviver);
static Object* parse_json_object(VM&, JsonObject const&);
static Array* parse_json_array(VM&, JsonArray const&);
static ThrowCompletionOr<Value> internalize_json_property(VM&, Object* holder, PropertyKey const& name, FunctionObject& reviver);
JS_DECLARE_NATIVE_FUNCTION(stringify);
JS_DECLARE_NATIVE_FUNCTION(parse);