-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add bindings to
eval
in the ffi
module.
- Loading branch information
Showing
1 changed file
with
12 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,6 +1,18 @@ | ||
//! JavaScript FFI. | ||
use prelude::*; | ||
|
||
/// The integer type of JavaScript. | ||
type Int = u32; | ||
|
||
mod object; | ||
|
||
/// Evaluate arbitrary JavaScript code. | ||
/// | ||
/// # Safety | ||
/// | ||
/// You can break invariants, and thus it's marked `unsafe`. | ||
pub unsafe fn eval(js: &JsString) { | ||
asm!("eval(__ObjectPool[$0])" | ||
:: "r"(js.get_inner_object().get_id())); | ||
} |