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:
parent
bba1a0d44a
commit
81c8926ee9
5 changed files with 12 additions and 8 deletions
|
@ -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,
|
&self,
|
||||||
js_filename: &str,
|
js_filename: &str,
|
||||||
js_source: &str,
|
js_source: &str,
|
||||||
|
@ -396,7 +403,6 @@ mod tests {
|
||||||
tokio_util::init(|| {
|
tokio_util::init(|| {
|
||||||
isolate
|
isolate
|
||||||
.execute(
|
.execute(
|
||||||
"y.js",
|
|
||||||
r#"
|
r#"
|
||||||
const m = new Uint8Array([4, 5, 6]);
|
const m = new Uint8Array([4, 5, 6]);
|
||||||
let n = libdeno.send(m);
|
let n = libdeno.send(m);
|
||||||
|
@ -448,7 +454,6 @@ mod tests {
|
||||||
|
|
||||||
isolate
|
isolate
|
||||||
.execute(
|
.execute(
|
||||||
"y.js",
|
|
||||||
r#"
|
r#"
|
||||||
const control = new Uint8Array([4, 5, 6]);
|
const control = new Uint8Array([4, 5, 6]);
|
||||||
const data = new Uint8Array([42, 43, 44, 45, 46]);
|
const data = new Uint8Array([42, 43, 44, 45, 46]);
|
||||||
|
@ -485,7 +490,6 @@ mod tests {
|
||||||
|
|
||||||
isolate
|
isolate
|
||||||
.execute(
|
.execute(
|
||||||
"y.js",
|
|
||||||
r#"
|
r#"
|
||||||
const control = new Uint8Array([4, 5, 6]);
|
const control = new Uint8Array([4, 5, 6]);
|
||||||
const data = new Uint8Array([42, 43, 44, 45, 46]);
|
const data = new Uint8Array([42, 43, 44, 45, 46]);
|
||||||
|
|
|
@ -109,7 +109,7 @@ fn main() {
|
||||||
let isolate = isolate::Isolate::new(snapshot, state, ops::dispatch);
|
let isolate = isolate::Isolate::new(snapshot, state, ops::dispatch);
|
||||||
tokio_util::init(|| {
|
tokio_util::init(|| {
|
||||||
isolate
|
isolate
|
||||||
.execute("deno_main.js", "denoMain();")
|
.execute("denoMain();")
|
||||||
.unwrap_or_else(print_err_and_exit);
|
.unwrap_or_else(print_err_and_exit);
|
||||||
isolate.event_loop().unwrap_or_else(print_err_and_exit);
|
isolate.event_loop().unwrap_or_else(print_err_and_exit);
|
||||||
});
|
});
|
||||||
|
|
|
@ -7,4 +7,4 @@ Error: error
|
||||||
at _gatherDependencies ([WILDCARD]/js/runner.ts:[WILDCARD])
|
at _gatherDependencies ([WILDCARD]/js/runner.ts:[WILDCARD])
|
||||||
at run ([WILDCARD]/js/runner.ts:[WILDCARD])
|
at run ([WILDCARD]/js/runner.ts:[WILDCARD])
|
||||||
at denoMain ([WILDCARD]/js/main.ts:[WILDCARD])
|
at denoMain ([WILDCARD]/js/main.ts:[WILDCARD])
|
||||||
at deno_main.js:1:1
|
at <anonymous>:1:1
|
||||||
|
|
|
@ -5,4 +5,4 @@
|
||||||
at _gatherDependencies ([WILDCARD]/js/runner.ts:[WILDCARD])
|
at _gatherDependencies ([WILDCARD]/js/runner.ts:[WILDCARD])
|
||||||
at run ([WILDCARD]/js/runner.ts:[WILDCARD])
|
at run ([WILDCARD]/js/runner.ts:[WILDCARD])
|
||||||
at denoMain ([WILDCARD]/js/main.ts:[WILDCARD])
|
at denoMain ([WILDCARD]/js/main.ts:[WILDCARD])
|
||||||
at deno_main.js:1:1
|
at <anonymous>:1:1
|
||||||
|
|
|
@ -5,4 +5,4 @@
|
||||||
at _drainRunQueue ([WILDCARD]/js/runner.ts:[WILDCARD])
|
at _drainRunQueue ([WILDCARD]/js/runner.ts:[WILDCARD])
|
||||||
at run ([WILDCARD]/js/runner.ts:[WILDCARD])
|
at run ([WILDCARD]/js/runner.ts:[WILDCARD])
|
||||||
at denoMain ([WILDCARD]/js/main.ts:[WILDCARD])
|
at denoMain ([WILDCARD]/js/main.ts:[WILDCARD])
|
||||||
at deno_main.js:1:1
|
at <anonymous>:1:1
|
||||||
|
|
Loading…
Reference in a new issue