refactor: 表驱动化直接 builtin 绑定模块

This commit is contained in:
2026-06-09 00:02:08 +08:00
parent 6e7f4ed440
commit 0d5a26592b
10 changed files with 141 additions and 486 deletions
+4 -14
View File
@@ -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;