mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2025-01-09 04:37:52 +03:00
LibJS: Add JSON.stringify function to the intrinsics
This is needed for some Web APIs.
This commit is contained in:
parent
b42b950688
commit
4e536eaf98
Notes:
sideshowbarker
2024-07-17 06:36:51 +09:00
Author: https://github.com/linusg Commit: https://github.com/SerenityOS/serenity/commit/4e536eaf98 Pull-request: https://github.com/SerenityOS/serenity/pull/15359 Reviewed-by: https://github.com/alimpfard Reviewed-by: https://github.com/davidot ✅ Reviewed-by: https://github.com/kennethmyhra
@ -310,6 +310,7 @@ void Intrinsics::initialize_intrinsics(Realm& realm)
|
||||
m_array_prototype_values_function = &m_array_prototype->get_without_side_effects(vm.names.values).as_function();
|
||||
m_date_constructor_now_function = &m_date_constructor->get_without_side_effects(vm.names.now).as_function();
|
||||
m_json_parse_function = &m_json_object->get_without_side_effects(vm.names.parse).as_function();
|
||||
m_json_stringify_function = &m_json_object->get_without_side_effects(vm.names.stringify).as_function();
|
||||
m_object_prototype_to_string_function = &m_object_prototype->get_without_side_effects(vm.names.toString).as_function();
|
||||
}
|
||||
|
||||
@ -327,6 +328,7 @@ void Intrinsics::visit_edges(Visitor& visitor)
|
||||
visitor.visit(m_date_constructor_now_function);
|
||||
visitor.visit(m_eval_function);
|
||||
visitor.visit(m_json_parse_function);
|
||||
visitor.visit(m_json_stringify_function);
|
||||
visitor.visit(m_object_prototype_to_string_function);
|
||||
visitor.visit(m_throw_type_error_function);
|
||||
|
||||
|
@ -55,6 +55,7 @@ public:
|
||||
FunctionObject* array_prototype_values_function() const { return m_array_prototype_values_function; }
|
||||
FunctionObject* date_constructor_now_function() const { return m_date_constructor_now_function; }
|
||||
FunctionObject* json_parse_function() const { return m_json_parse_function; }
|
||||
FunctionObject* json_stringify_function() const { return m_json_stringify_function; }
|
||||
FunctionObject* object_prototype_to_string_function() const { return m_object_prototype_to_string_function; }
|
||||
FunctionObject* throw_type_error_function() const { return m_throw_type_error_function; }
|
||||
|
||||
@ -149,6 +150,7 @@ private:
|
||||
FunctionObject* m_array_prototype_values_function { nullptr };
|
||||
FunctionObject* m_date_constructor_now_function { nullptr };
|
||||
FunctionObject* m_json_parse_function { nullptr };
|
||||
FunctionObject* m_json_stringify_function { nullptr };
|
||||
FunctionObject* m_object_prototype_to_string_function { nullptr };
|
||||
FunctionObject* m_throw_type_error_function { nullptr };
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user