summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRyan Dahl <ry@tinyclouds.org>2018-12-11 14:03:58 -0500
committerRyan Dahl <ry@tinyclouds.org>2018-12-11 15:07:55 -0500
commit81c8926ee9469a792d33e650eb8b8ac007de1977 (patch)
tree40e058b2ecc77351d0097c05e0570175d7d30c31
parentbba1a0d44aa3dd58bd0de53f37982ef270c7a176 (diff)
Use default filename for Isolate::execute.
-rw-r--r--src/isolate.rs12
-rw-r--r--src/main.rs2
-rw-r--r--tests/async_error.ts.out2
-rw-r--r--tests/error_001.ts.out2
-rw-r--r--tests/error_002.ts.out2
5 files changed, 12 insertions, 8 deletions
diff --git a/src/isolate.rs b/src/isolate.rs
index 8e78f770b..99e3670f2 100644
--- a/src/isolate.rs
+++ b/src/isolate.rs
@@ -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]);
diff --git a/src/main.rs b/src/main.rs
index bcc18511c..f8888feea 100644
--- a/src/main.rs
+++ b/src/main.rs
@@ -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);
});
diff --git a/tests/async_error.ts.out b/tests/async_error.ts.out
index dd844f9a9..8d276c739 100644
--- a/tests/async_error.ts.out
+++ b/tests/async_error.ts.out
@@ -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
diff --git a/tests/error_001.ts.out b/tests/error_001.ts.out
index b9ad7938c..b015c6098 100644
--- a/tests/error_001.ts.out
+++ b/tests/error_001.ts.out
@@ -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
diff --git a/tests/error_002.ts.out b/tests/error_002.ts.out
index 6ea4ede78..a7511b82c 100644
--- a/tests/error_002.ts.out
+++ b/tests/error_002.ts.out
@@ -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