Browse Source

Fix `ThrowTypeError` intrinsic (#2797)

Fixes the remaining failing tests on the `ThrowTypeError` test suite
pull/2805/head
Haled Odat 2 years ago
parent
commit
09d57e75fb
  1. 3
      boa_engine/src/builtins/error/type.rs
  2. 2
      boa_engine/src/object/mod.rs

3
boa_engine/src/builtins/error/type.rs

@ -127,12 +127,13 @@ impl IntrinsicObject for ThrowTypeError {
let obj = BuiltInBuilder::with_intrinsic::<Self>(realm) let obj = BuiltInBuilder::with_intrinsic::<Self>(realm)
.prototype(realm.intrinsics().constructors().function().prototype()) .prototype(realm.intrinsics().constructors().function().prototype())
.static_property(utf16!("name"), "ThrowTypeError", Attribute::empty())
.static_property(utf16!("length"), 0, Attribute::empty()) .static_property(utf16!("length"), 0, Attribute::empty())
.static_property(utf16!("name"), "", Attribute::empty())
.build(); .build();
let mut obj = obj.borrow_mut(); let mut obj = obj.borrow_mut();
obj.extensible = false;
obj.data = ObjectData::function(Function::new( obj.data = ObjectData::function(Function::new(
FunctionKind::Native { FunctionKind::Native {
function: NativeFunction::from_fn_ptr(throw_type_error), function: NativeFunction::from_fn_ptr(throw_type_error),

2
boa_engine/src/object/mod.rs

@ -125,7 +125,7 @@ pub struct Object {
/// Instance prototype `__proto__`. /// Instance prototype `__proto__`.
prototype: JsPrototype, prototype: JsPrototype,
/// Whether it can have new properties added to it. /// Whether it can have new properties added to it.
extensible: bool, pub(crate) extensible: bool,
/// The `[[PrivateElements]]` internal slot. /// The `[[PrivateElements]]` internal slot.
private_elements: ThinVec<(PrivateName, PrivateElement)>, private_elements: ThinVec<(PrivateName, PrivateElement)>,
} }

Loading…
Cancel
Save