From 460b4a23b0daca34c61cffcb558aca0ff511e876 Mon Sep 17 00:00:00 2001 From: Halid Odat Date: Wed, 2 Sep 2020 16:26:35 +0200 Subject: [PATCH] Add `#[track_caller]` to `GcObject` methods that can panic (#673) --- boa/src/builtins/object/gcobject.rs | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/boa/src/builtins/object/gcobject.rs b/boa/src/builtins/object/gcobject.rs index 17d172acda..b13e4c9090 100644 --- a/boa/src/builtins/object/gcobject.rs +++ b/boa/src/builtins/object/gcobject.rs @@ -55,6 +55,7 @@ impl GcObject { ///# Panics /// Panics if the object is currently mutably borrowed. #[inline] + #[track_caller] pub fn borrow(&self) -> Ref<'_> { self.try_borrow().expect("Object already mutably borrowed") } @@ -67,6 +68,7 @@ impl GcObject { ///# Panics /// Panics if the object is currently borrowed. #[inline] + #[track_caller] pub fn borrow_mut(&self) -> RefMut<'_> { self.try_borrow_mut().expect("Object already borrowed") } @@ -105,6 +107,7 @@ impl GcObject { /// Panics if the object is currently mutably borrowed. // // + #[track_caller] pub fn call(&self, this: &Value, args: &[Value], ctx: &mut Interpreter) -> Result { let this_function_object = self.clone(); let f_body = if let Some(function) = self.borrow().as_function() { @@ -186,6 +189,7 @@ impl GcObject { ///# Panics /// Panics if the object is currently mutably borrowed. // + #[track_caller] pub fn construct(&self, args: &[Value], ctx: &mut Interpreter) -> Result { let this = Object::create(self.borrow().get(&PROTOTYPE.into())).into();