aboutsummaryrefslogtreecommitdiffstats
path: root/src/transpile_scheme.rs
diff options
context:
space:
mode:
Diffstat (limited to 'src/transpile_scheme.rs')
-rw-r--r--src/transpile_scheme.rs12
1 files changed, 6 insertions, 6 deletions
diff --git a/src/transpile_scheme.rs b/src/transpile_scheme.rs
index 8e6d642..362dfdd 100644
--- a/src/transpile_scheme.rs
+++ b/src/transpile_scheme.rs
@@ -2,14 +2,15 @@
extern crate modelica_parser;
use self::modelica_parser::*;
+use errors::Result;
pub trait TranspileScheme {
- fn repr_scheme(&self) -> Result<String, String>;
+ fn repr_scheme(&self) -> Result<String>;
}
impl TranspileScheme for ModelicaModel {
- fn repr_scheme(&self) -> Result<String, String> {
+ fn repr_scheme(&self) -> Result<String> {
let mut constants = vec![];
for (c, e) in self.get_constant_vars() {
if let Some(v) = e {
@@ -23,8 +24,7 @@ impl TranspileScheme for ModelicaModel {
binds.push(format!("({} {})", symb, try!(eq.rhs.repr_scheme())));
outputs.push(symb.to_string());
} else {
- return Err("Expected an identifier on LHS (in this partial implementation)"
- .to_string());
+ bail!("Expected an identifier on LHS (in this partial implementation)")
}
}
let args: Vec<String> = self.get_free_vars().iter().map(|s| s.clone()).collect();
@@ -40,7 +40,7 @@ impl TranspileScheme for ModelicaModel {
}
impl TranspileScheme for Expr {
- fn repr_scheme(&self) -> Result<String, String> {
+ fn repr_scheme(&self) -> Result<String> {
use modelica_parser::Expr::*;
match *self {
Integer(e) => Ok(format!("{}", e)),
@@ -58,7 +58,7 @@ impl TranspileScheme for Expr {
try!(l.repr_scheme()),
try!(r.repr_scheme())))
}
- Array(_) => Err("Array unimplemented".to_string()),
+ Array(_) => bail!("Array unimplemented"),
}
}
}