feat: 补充 Object 内置方法

This commit is contained in:
2026-06-08 00:08:03 +08:00
parent 1e44c375da
commit 09a891cdd9
3 changed files with 138 additions and 0 deletions
+49
View File
@@ -18,6 +18,13 @@ pub struct ObjectMethods {
pub assign: *const (),
pub define_property: *const (),
pub get_own_property_descriptor: *const (),
pub freeze: *const (),
pub seal: *const (),
pub prevent_extensions: *const (),
pub is_frozen: *const (),
pub is_sealed: *const (),
pub is_extensible: *const (),
pub get_own_property_names: *const (),
}
pub struct ArrayMethods {
@@ -328,6 +335,48 @@ impl BuiltinWorld {
methods.get_own_property_descriptor,
2,
);
let _ = self.bind_method(ctor, shape_forge, string_forge, "freeze", methods.freeze, 1);
let _ = self.bind_method(ctor, shape_forge, string_forge, "seal", methods.seal, 1);
let _ = self.bind_method(
ctor,
shape_forge,
string_forge,
"preventExtensions",
methods.prevent_extensions,
1,
);
let _ = self.bind_method(
ctor,
shape_forge,
string_forge,
"isFrozen",
methods.is_frozen,
1,
);
let _ = self.bind_method(
ctor,
shape_forge,
string_forge,
"isSealed",
methods.is_sealed,
1,
);
let _ = self.bind_method(
ctor,
shape_forge,
string_forge,
"isExtensible",
methods.is_extensible,
1,
);
let _ = self.bind_method(
ctor,
shape_forge,
string_forge,
"getOwnPropertyNames",
methods.get_own_property_names,
1,
);
}
pub fn bind_array_methods(