aboutsummaryrefslogtreecommitdiffstats
path: root/src/transpile_js.rs
diff options
context:
space:
mode:
authorbnewbold <bnewbold@robocracy.org>2017-01-28 21:25:37 -0800
committerbnewbold <bnewbold@robocracy.org>2017-01-28 21:25:37 -0800
commit1aec9b6479beecd327456780ae7c711040011933 (patch)
tree036c4beb4ac2732d67adab5b9fc68ef0c384c7a2 /src/transpile_js.rs
parent26737fe52301080b6c0573cd19c1c53715835e9e (diff)
downloadmodelthing-1aec9b6479beecd327456780ae7c711040011933.tar.gz
modelthing-1aec9b6479beecd327456780ae7c711040011933.zip
fiddling with whitespace for other reprs
Diffstat (limited to 'src/transpile_js.rs')
-rw-r--r--src/transpile_js.rs32
1 files changed, 17 insertions, 15 deletions
diff --git a/src/transpile_js.rs b/src/transpile_js.rs
index 97eff68..586abc1 100644
--- a/src/transpile_js.rs
+++ b/src/transpile_js.rs
@@ -40,11 +40,12 @@ impl TranspileJS for ModelicaModel {
let mut args: Vec<String> = self.get_free_vars().iter().map(|s| s.clone()).collect();
args.sort();
args.extend(params);
- Ok(format!(r#"function ({args}) {{
- {constants}
- {binds}
- return [{outputs}];
- }};"#,
+ Ok(format!(
+r#"function ({args}) {{
+ {constants}
+ {binds}
+ return [{outputs}];
+}};"#,
args = args.join(", "),
constants = constants.join("\n "),
binds = binds.join("\n "),
@@ -83,18 +84,19 @@ impl TranspileJSODE for ModelicaModel {
}
let mut args: Vec<String> = self.get_free_vars().iter().map(|s| s.clone()).collect();
args.sort();
- Ok(format!(r#"function ({params}) {{
- return function({args}) {{
- {constants}
- return [
- {expressions}
- ];
- }};
- }};"#,
+ Ok(format!(
+r#"function ({params}) {{
+ return function({args}) {{
+ {constants}
+ return [
+ {expressions}
+ ];
+ }};
+}};"#,
params = params.join(", "),
args = args.join(", "),
- constants = constants.join("\n "),
- expressions = exprs.join(",\n ")))
+ constants = constants.join("\n "), // NB: whitespace
+ expressions = exprs.join(",\n "))) // NB: whitespace
}
}