mirror of
https://github.com/azur1s/bobbylisp.git
synced 2024-10-16 02:37:40 -05:00
make deepsource happy
This commit is contained in:
parent
e6b31b39b0
commit
6624983ae3
|
@ -23,7 +23,7 @@ fn main() {
|
|||
let ast = past.into_iter().map(|(e, _)| translate_stmt(e)).collect::<Vec<_>>();
|
||||
let js = ast.into_iter().map(translate_js_stmt).collect::<Vec<_>>();
|
||||
|
||||
let mut file = std::fs::File::create(opt.output.unwrap_or("out.js".into()))
|
||||
let mut file = std::fs::File::create(opt.output.unwrap_or_else(|| "out.js".to_owned()))
|
||||
.expect("Failed to create file");
|
||||
let s = js
|
||||
.into_iter()
|
||||
|
|
|
@ -515,7 +515,7 @@ pub fn parse(
|
|||
) -> (Option<Vec<Spanned<PStmt>>>, Vec<Simple<Token>>) {
|
||||
let (ast, parse_error) = stmts_parser()
|
||||
.then_ignore(end())
|
||||
.parse_recovery(Stream::from_iter(len..len + 1, tokens.into_iter()));
|
||||
.parse_recovery(Stream::from_iter(len..=len, tokens.into_iter()));
|
||||
|
||||
(ast, parse_error)
|
||||
}
|
|
@ -88,9 +88,9 @@ pub fn translate_expr(expr: PExpr) -> Expr {
|
|||
}
|
||||
expr
|
||||
} else {
|
||||
Expr::Defines(vars.into_iter().map(|(name, _ty, val)| {
|
||||
Expr::Defines(vars.into_iter().map(|(name, _ty, val)|
|
||||
(name, translate_expr(val.0))
|
||||
}).collect())
|
||||
).collect())
|
||||
}
|
||||
},
|
||||
PExpr::If { cond, t, f } => Expr::If {
|
||||
|
@ -190,9 +190,9 @@ pub fn translate_js_expr(expr: Expr) -> JSExpr {
|
|||
t: Box::new(translate_js_expr(*t)),
|
||||
f: Box::new(translate_js_expr(*f)),
|
||||
},
|
||||
Expr::Defines(defs) => JSExpr::Defines(defs.into_iter().map(|(name, val)| {
|
||||
Expr::Defines(defs) => JSExpr::Defines(defs.into_iter().map(|(name, val)|
|
||||
(name, translate_js_expr(val))
|
||||
}).collect()),
|
||||
).collect()),
|
||||
Expr::Return(e) => JSExpr::Return(Box::new(translate_js_expr(*e))),
|
||||
}
|
||||
}
|
Loading…
Reference in a new issue