1
0
Fork 0
mirror of https://github.com/denoland/deno.git synced 2025-01-03 04:48:52 -05:00

Use default filename for Isolate::execute.

This commit is contained in:
Ryan Dahl 2018-12-11 14:03:58 -05:00
parent bba1a0d44a
commit 81c8926ee9
5 changed files with 12 additions and 8 deletions

View file

@ -197,7 +197,14 @@ impl Isolate {
}
}
pub fn execute(
/// Same as execute2() but the filename defaults to "<anonymous>".
pub fn execute(&self, js_source: &str) -> Result<(), JSError> {
self.execute2("<anonymous>", js_source)
}
/// Executes the provided JavaScript source code. The js_filename argument is
/// provided only for debugging purposes.
pub fn execute2(
&self,
js_filename: &str,
js_source: &str,
@ -396,7 +403,6 @@ mod tests {
tokio_util::init(|| {
isolate
.execute(
"y.js",
r#"
const m = new Uint8Array([4, 5, 6]);
let n = libdeno.send(m);
@ -448,7 +454,6 @@ mod tests {
isolate
.execute(
"y.js",
r#"
const control = new Uint8Array([4, 5, 6]);
const data = new Uint8Array([42, 43, 44, 45, 46]);
@ -485,7 +490,6 @@ mod tests {
isolate
.execute(
"y.js",
r#"
const control = new Uint8Array([4, 5, 6]);
const data = new Uint8Array([42, 43, 44, 45, 46]);

View file

@ -109,7 +109,7 @@ fn main() {
let isolate = isolate::Isolate::new(snapshot, state, ops::dispatch);
tokio_util::init(|| {
isolate
.execute("deno_main.js", "denoMain();")
.execute("denoMain();")
.unwrap_or_else(print_err_and_exit);
isolate.event_loop().unwrap_or_else(print_err_and_exit);
});

View file

@ -7,4 +7,4 @@ Error: error
at _gatherDependencies ([WILDCARD]/js/runner.ts:[WILDCARD])
at run ([WILDCARD]/js/runner.ts:[WILDCARD])
at denoMain ([WILDCARD]/js/main.ts:[WILDCARD])
at deno_main.js:1:1
at <anonymous>:1:1

View file

@ -5,4 +5,4 @@
at _gatherDependencies ([WILDCARD]/js/runner.ts:[WILDCARD])
at run ([WILDCARD]/js/runner.ts:[WILDCARD])
at denoMain ([WILDCARD]/js/main.ts:[WILDCARD])
at deno_main.js:1:1
at <anonymous>:1:1

View file

@ -5,4 +5,4 @@
at _drainRunQueue ([WILDCARD]/js/runner.ts:[WILDCARD])
at run ([WILDCARD]/js/runner.ts:[WILDCARD])
at denoMain ([WILDCARD]/js/main.ts:[WILDCARD])
at deno_main.js:1:1
at <anonymous>:1:1