Browse Source

Added error propagation in Field access (#500)

pull/502/head
neeldug 5 years ago committed by GitHub
parent
commit
b43e92afa5
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
  1. 8
      boa/src/exec/field/mod.rs

8
boa/src/exec/field/mod.rs

@ -8,9 +8,7 @@ impl Executable for GetConstField {
fn run(&self, interpreter: &mut Interpreter) -> ResultValue {
let mut obj = self.obj().run(interpreter)?;
if obj.get_type() != Type::Object || obj.get_type() != Type::Symbol {
obj = interpreter
.to_object(&obj)
.expect("failed to convert to object");
obj = interpreter.to_object(&obj)?;
}
Ok(obj.get_field(self.field()))
@ -21,9 +19,7 @@ impl Executable for GetField {
fn run(&self, interpreter: &mut Interpreter) -> ResultValue {
let mut obj = self.obj().run(interpreter)?;
if obj.get_type() != Type::Object || obj.get_type() != Type::Symbol {
obj = interpreter
.to_object(&obj)
.expect("failed to convert to object");
obj = interpreter.to_object(&obj)?;
}
let field = self.field().run(interpreter)?;

Loading…
Cancel
Save