summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/flags.rs24
-rw-r--r--src/isolate.rs9
-rw-r--r--src/msg.fbs1
-rw-r--r--src/ops.rs7
4 files changed, 33 insertions, 8 deletions
diff --git a/src/flags.rs b/src/flags.rs
index 82b7f528d..e4e3c28df 100644
--- a/src/flags.rs
+++ b/src/flags.rs
@@ -26,6 +26,7 @@ pub struct DenoFlags {
pub allow_net: bool,
pub allow_env: bool,
pub deps_flag: bool,
+ pub types_flag: bool,
}
pub fn process(flags: &DenoFlags) {
@@ -58,7 +59,8 @@ pub fn print_usage() {
-D or --log-debug Log debug output.
-h or --help Print this message.
--v8-options Print V8 command line options.
---deps Print module dependencies."
+--deps Print module dependencies.
+--types Print runtime TypeScript declarations."
);
}
@@ -82,6 +84,7 @@ pub fn set_flags(args: Vec<String>) -> (DenoFlags, Vec<String>) {
"--allow-net" => flags.allow_net = true,
"--allow-env" => flags.allow_env = true,
"--deps" => flags.deps_flag = true,
+ "--types" => flags.types_flag = true,
"--" => break,
_ => unimplemented!(),
}
@@ -165,6 +168,19 @@ fn test_set_flags_4() {
);
}
+#[test]
+fn test_set_flags_5() {
+ let (flags, rest) = set_flags(svec!["deno", "--types"]);
+ assert_eq!(rest, svec!["deno"]);
+ assert_eq!(
+ flags,
+ DenoFlags {
+ types_flag: true,
+ ..DenoFlags::default()
+ }
+ )
+}
+
// Returns args passed to V8, followed by args passed to JS
fn v8_set_flags_preprocess(args: Vec<String>) -> (Vec<String>, Vec<String>) {
let mut rest = vec![];
@@ -179,7 +195,8 @@ fn v8_set_flags_preprocess(args: Vec<String>) -> (Vec<String>, Vec<String>) {
}
true
- }).collect();
+ })
+ .collect();
// Replace args being sent to V8
for idx in 0..args.len() {
@@ -248,6 +265,7 @@ pub fn v8_set_flags(args: Vec<String>) -> Vec<String> {
let cstr = CStr::from_ptr(*ptr as *const i8);
let slice = cstr.to_str().unwrap();
slice.to_string()
- }).chain(rest.into_iter())
+ })
+ .chain(rest.into_iter())
.collect()
}
diff --git a/src/isolate.rs b/src/isolate.rs
index e24471356..40dff5ed2 100644
--- a/src/isolate.rs
+++ b/src/isolate.rs
@@ -348,7 +348,8 @@ mod tests {
throw Error("assert error");
}
"#,
- ).expect("execute error");
+ )
+ .expect("execute error");
isolate.event_loop();
});
}
@@ -392,7 +393,8 @@ mod tests {
const data = new Uint8Array([42, 43, 44, 45, 46]);
libdeno.send(control, data);
"#,
- ).expect("execute error");
+ )
+ .expect("execute error");
isolate.event_loop();
let metrics = isolate.state.metrics.lock().unwrap();
assert_eq!(metrics.ops_dispatched, 1);
@@ -427,7 +429,8 @@ mod tests {
let r = libdeno.send(control, data);
if (r != null) throw Error("expected null");
"#,
- ).expect("execute error");
+ )
+ .expect("execute error");
// Make sure relevant metrics are updated before task is executed.
{
diff --git a/src/msg.fbs b/src/msg.fbs
index 40179fc14..43fde4d68 100644
--- a/src/msg.fbs
+++ b/src/msg.fbs
@@ -111,6 +111,7 @@ table StartRes {
debug_flag: bool;
deps_flag: bool;
recompile_flag: bool;
+ types_flag: bool;
}
table CodeFetch {
diff --git a/src/ops.rs b/src/ops.rs
index c32f53634..a58532baf 100644
--- a/src/ops.rs
+++ b/src/ops.rs
@@ -185,6 +185,7 @@ fn op_start(
argv: Some(argv_off),
debug_flag: state.flags.log_debug,
recompile_flag: state.flags.recompile,
+ types_flag: state.flags.types_flag,
..Default::default()
},
);
@@ -342,7 +343,8 @@ fn op_env(
..Default::default()
},
)
- }).collect();
+ })
+ .collect();
let tables = builder.create_vector(&vars);
let inner = msg::EnvironRes::create(
builder,
@@ -891,7 +893,8 @@ fn op_read_dir(
..Default::default()
},
)
- }).collect();
+ })
+ .collect();
let entries = builder.create_vector(&entries);
let inner = msg::ReadDirRes::create(