From a596dc4129f2d8dea35d33984a597d6159be4dc3 Mon Sep 17 00:00:00 2001 From: Jamen Marz Date: Mon, 25 Jun 2018 12:57:02 -0600 Subject: [PATCH] Make JS use a '.wasm' extension when importing the binary --- crates/cli-support/src/js/mod.rs | 14 +++++++------- crates/cli-support/src/lib.rs | 8 ++++---- 2 files changed, 11 insertions(+), 11 deletions(-) diff --git a/crates/cli-support/src/js/mod.rs b/crates/cli-support/src/js/mod.rs index 7ed67ad2..fde0e40a 100644 --- a/crates/cli-support/src/js/mod.rs +++ b/crates/cli-support/src/js/mod.rs @@ -132,8 +132,8 @@ impl<'a> Context<'a> { self.bind("__wbindgen_object_drop_ref", &|me| { me.expose_drop_ref(); - Ok("function(i) { - dropRef(i); + Ok("function(i) { + dropRef(i); }".to_string()) })?; @@ -149,8 +149,8 @@ impl<'a> Context<'a> { self.bind("__wbindgen_number_new", &|me| { me.expose_add_heap_object(); - Ok(String::from("function(i) { - return addHeapObject(i); + Ok(String::from("function(i) { + return addHeapObject(i); }")) })?; @@ -169,8 +169,8 @@ impl<'a> Context<'a> { self.bind("__wbindgen_undefined_new", &|me| { me.expose_add_heap_object(); - Ok(String::from("function() { - return addHeapObject(undefined); + Ok(String::from("function() { + return addHeapObject(undefined); }")) })?; @@ -365,7 +365,7 @@ impl<'a> Context<'a> { module_name)); format!("var wasm;") } else { - format!("import * as wasm from './{}_bg';", module_name) + format!("import * as wasm from './{}_bg.wasm';", module_name) }; format!("\ diff --git a/crates/cli-support/src/lib.rs b/crates/cli-support/src/lib.rs index 092f8f2c..da74b3d2 100644 --- a/crates/cli-support/src/lib.rs +++ b/crates/cli-support/src/lib.rs @@ -403,11 +403,11 @@ fn indent_recurse(mut lines: ::std::str::Lines, current_indent: usize) -> String next_indent += 1; } if trimmed.starts_with('}') || trimmed.ends_with('}') { - if current_indent > 0 { - current_indent -= 1; + if current_indent > 0 { + current_indent -= 1; } - if next_indent > 0 { - next_indent -= 1; + if next_indent > 0 { + next_indent -= 1; } } if trimmed.starts_with('?') || trimmed.starts_with(':') {