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