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

This commit is contained in:
爱特每羊队
2026-06-09 00:02:08 +08:00
parent bbfde72dfb
commit a0c1181fdc
10 changed files with 141 additions and 486 deletions
+8 -50
View File
@@ -1,7 +1,7 @@
use std::sync::Arc;
use crate::bind_constructor_hash;
use oxide_kernel::bind_method;
use oxide_kernel::bind_methods;
use oxide_kernel::kernel::OxideKernel;
use oxide_types::object::JsObject;
@@ -16,59 +16,17 @@ pub fn bind_map(kernel: &Arc<OxideKernel>, global: &mut JsObject) {
let sf = kernel.string_forge().as_ref();
let sh = kernel.shape_forge().as_ref();
bind_method!(
bind_methods!(
kernel.builtin_world(),
proto,
sf,
sh,
"set",
crate::builtins::map::map_set,
2
);
bind_method!(
kernel.builtin_world(),
proto,
sf,
sh,
"get",
crate::builtins::map::map_get,
1
);
bind_method!(
kernel.builtin_world(),
proto,
sf,
sh,
"has",
crate::builtins::map::map_has,
1
);
bind_method!(
kernel.builtin_world(),
proto,
sf,
sh,
"delete",
crate::builtins::map::map_delete,
1
);
bind_method!(
kernel.builtin_world(),
proto,
sf,
sh,
"clear",
crate::builtins::map::map_clear,
0
);
bind_method!(
kernel.builtin_world(),
proto,
sf,
sh,
"size",
crate::builtins::map::map_size,
0
("set", crate::builtins::map::map_set, 2),
("get", crate::builtins::map::map_get, 1),
("has", crate::builtins::map::map_has, 1),
("delete", crate::builtins::map::map_delete, 1),
("clear", crate::builtins::map::map_clear, 0),
("size", crate::builtins::map::map_size, 0),
);
bind_constructor_hash!(