Skip to content

Commit

Permalink
Fmt
Browse files Browse the repository at this point in the history
  • Loading branch information
azdavis committed Dec 20, 2023
1 parent 3d75ccf commit c1906bf
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 11 deletions.
10 changes: 3 additions & 7 deletions crates/sml-hir-lower/src/dec.rs
Original file line number Diff line number Diff line change
Expand Up @@ -583,11 +583,8 @@ fn get_one(st: &mut St<'_>, dec: ast::DecOne) -> Option<sml_hir::DecIdx> {
}
}
}
let pat = if pats.len() == 1 {
pats.pop().unwrap()
} else {
st.pat(pat::tuple(pats), ptr)
};
let pat =
if pats.len() == 1 { pats.pop().unwrap() } else { st.pat(pat::tuple(pats), ptr) };
let ty = case.ty_annotation().map(|ty_ann| {
forbid_opaque_asc(st, ty_ann.ascription());
ty::get(st, ty_ann.ty())
Expand Down Expand Up @@ -620,8 +617,7 @@ fn get_one(st: &mut St<'_>, dec: ast::DecOne) -> Option<sml_hir::DecIdx> {
}
let exp = {
let arg_names: Vec<_> = (0..num_pats.unwrap_or(1)).map(|_| st.fresh()).collect();
let mut arg_exprs =
arg_names.iter().map(|name| st.exp(exp::name(name.as_str()), ptr));
let mut arg_exprs = arg_names.iter().map(|name| st.exp(exp::name(name.as_str()), ptr));
let head = if arg_exprs.len() == 1 {
arg_exprs.next().unwrap()
} else {
Expand Down
6 changes: 2 additions & 4 deletions crates/sml-hir-lower/src/exp.rs
Original file line number Diff line number Diff line change
Expand Up @@ -63,8 +63,7 @@ pub(crate) fn get(st: &mut St<'_>, exp: Option<ast::Exp>) -> sml_hir::ExpIdx {
let lab = get_lab(st, exp.lab()?);
let fresh = st.fresh();
let pat = st.pat(pat::name(fresh.as_str()), ptr);
let param =
st.pat(sml_hir::Pat::Record { rows: vec![(lab, pat)], allows_other: true }, ptr);
let param = st.pat(sml_hir::Pat::Record { rows: vec![(lab, pat)], allows_other: true }, ptr);
let body = st.exp(name(fresh.as_str()), ptr);
let arm = sml_hir::Arm { pat: param, exp: body };
sml_hir::Exp::Fn(vec![arm], sml_hir::FnFlavor::Selector)
Expand Down Expand Up @@ -248,8 +247,7 @@ pub(crate) fn get(st: &mut St<'_>, exp: Option<ast::Exp>) -> sml_hir::ExpIdx {
let fn_exp = st.exp(sml_hir::Exp::Fn(vec![arm], sml_hir::FnFlavor::While), ptr);
let vid_pat = st.pat(pat::name(vid.as_str()), ptr);
let bind = sml_hir::ValBind { rec: true, pat: vid_pat, exp: fn_exp };
let val =
st.dec(sml_hir::Dec::Val(vec![], vec![bind], sml_hir::ValFlavor::While), ptr);
let val = st.dec(sml_hir::Dec::Val(vec![], vec![bind], sml_hir::ValFlavor::While), ptr);
sml_hir::Exp::Let(vec![val], call_unit_fn(st, &vid, ptr))
}
ast::Exp::CaseExp(exp) => {
Expand Down

0 comments on commit c1906bf

Please sign in to comment.