refactor: 表驱动化直接 builtin 绑定模块
This commit is contained in:
@@ -1,6 +1,6 @@
|
||||
use std::sync::Arc;
|
||||
|
||||
use oxide_kernel::bind_method;
|
||||
use oxide_kernel::bind_methods;
|
||||
use oxide_kernel::kernel::OxideKernel;
|
||||
use oxide_types::object::JsObject;
|
||||
use oxide_types::value::JsValue;
|
||||
@@ -9,23 +9,13 @@ pub fn bind_json(kernel: &Arc<OxideKernel>, global: &mut JsObject) {
|
||||
let json_ptr = kernel.builtin_world().json_object.as_ptr() as *mut JsObject;
|
||||
let json = unsafe { &mut *json_ptr };
|
||||
|
||||
bind_method!(
|
||||
bind_methods!(
|
||||
kernel.builtin_world(),
|
||||
json,
|
||||
kernel.string_forge().as_ref(),
|
||||
kernel.shape_forge().as_ref(),
|
||||
"parse",
|
||||
crate::builtins::json::json_parse,
|
||||
1
|
||||
);
|
||||
bind_method!(
|
||||
kernel.builtin_world(),
|
||||
json,
|
||||
kernel.string_forge().as_ref(),
|
||||
kernel.shape_forge().as_ref(),
|
||||
"stringify",
|
||||
crate::builtins::json::json_stringify,
|
||||
1
|
||||
("parse", crate::builtins::json::json_parse, 1),
|
||||
("stringify", crate::builtins::json::json_stringify, 1),
|
||||
);
|
||||
|
||||
let si_j = kernel.string_forge().intern("JSON").0;
|
||||
|
||||
Reference in New Issue
Block a user