1
1
Fork 0
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:
azur 2023-03-11 01:18:45 +07:00
parent e6b31b39b0
commit 6624983ae3
3 changed files with 6 additions and 6 deletions

View file

@ -23,7 +23,7 @@ fn main() {
let ast = past.into_iter().map(|(e, _)| translate_stmt(e)).collect::<Vec<_>>(); let ast = past.into_iter().map(|(e, _)| translate_stmt(e)).collect::<Vec<_>>();
let js = ast.into_iter().map(translate_js_stmt).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"); .expect("Failed to create file");
let s = js let s = js
.into_iter() .into_iter()

View file

@ -515,7 +515,7 @@ pub fn parse(
) -> (Option<Vec<Spanned<PStmt>>>, Vec<Simple<Token>>) { ) -> (Option<Vec<Spanned<PStmt>>>, Vec<Simple<Token>>) {
let (ast, parse_error) = stmts_parser() let (ast, parse_error) = stmts_parser()
.then_ignore(end()) .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) (ast, parse_error)
} }

View file

@ -88,9 +88,9 @@ pub fn translate_expr(expr: PExpr) -> Expr {
} }
expr expr
} else { } else {
Expr::Defines(vars.into_iter().map(|(name, _ty, val)| { Expr::Defines(vars.into_iter().map(|(name, _ty, val)|
(name, translate_expr(val.0)) (name, translate_expr(val.0))
}).collect()) ).collect())
} }
}, },
PExpr::If { cond, t, f } => Expr::If { 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)), t: Box::new(translate_js_expr(*t)),
f: Box::new(translate_js_expr(*f)), 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)) (name, translate_js_expr(val))
}).collect()), ).collect()),
Expr::Return(e) => JSExpr::Return(Box::new(translate_js_expr(*e))), Expr::Return(e) => JSExpr::Return(Box::new(translate_js_expr(*e))),
} }
} }