Skip to content

Commit 4f0724d

Browse files
saito828kokikokisaito
andauthored
Add is_constructing method to JS::CallArgs (#497)
* feat: Add is_constructing to CallArgs which corresponds to `callargs_is_constructing` in servo repo Signed-off-by: Koki Saito <saitoto828@gmail.com> * fix: Use unsafe block Signed-off-by: Koki Saito <saitoto828@gmail.com> --------- Signed-off-by: Koki Saito <saitoto828@gmail.com> Co-authored-by: kokisaito <kosaito@indeed.com>
1 parent 573f194 commit 4f0724d

File tree

1 file changed

+5
-0
lines changed

1 file changed

+5
-0
lines changed

mozjs-sys/src/jsimpls.rs

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -302,6 +302,11 @@ impl JS::CallArgs {
302302
JS::MutableHandleValue::from_marked_location(self.argv_.offset(self.argc_ as isize))
303303
}
304304
}
305+
306+
#[inline]
307+
pub fn is_constructing(&self) -> bool {
308+
unsafe { (*self.argv_.offset(-1)).is_magic() }
309+
}
305310
}
306311

307312
impl JSJitSetterCallArgs {

0 commit comments

Comments
 (0)