Browse Source

Fix delete when the property is not configurable (#1024)

* Fix delete when the property is not configurable

* Implement suggestion

Co-authored-by: Halid Odat <halidodat@gmail.com>

Co-authored-by: tofpie <tofpie@users.noreply.github.com>
Co-authored-by: Halid Odat <halidodat@gmail.com>
pull/1031/head
tofpie 4 years ago committed by GitHub
parent
commit
14ef50ce47
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
  1. 7
      boa/src/syntax/ast/node/operator/unary_op/mod.rs

7
boa/src/syntax/ast/node/operator/unary_op/mod.rs

@ -90,12 +90,15 @@ impl Executable for UnaryOp {
get_const_field get_const_field
.obj() .obj()
.run(context)? .run(context)?
.remove_property(get_const_field.field()), .to_object(context)?
.delete(&get_const_field.field().into()),
), ),
Node::GetField(ref get_field) => { Node::GetField(ref get_field) => {
let obj = get_field.obj().run(context)?; let obj = get_field.obj().run(context)?;
let field = &get_field.field().run(context)?; let field = &get_field.field().run(context)?;
let res = obj.remove_property(field.to_string(context)?.as_str()); let res = obj
.to_object(context)?
.delete(&field.to_property_key(context)?);
return Ok(Value::boolean(res)); return Ok(Value::boolean(res));
} }
Node::Identifier(_) => Value::boolean(false), Node::Identifier(_) => Value::boolean(false),

Loading…
Cancel
Save