cl-ast: Remove tail from let (it caused more problems that it could've solved)
This commit is contained in:
@@ -402,7 +402,6 @@ pub struct Let {
|
||||
pub name: Sym,
|
||||
pub ty: Option<Box<Ty>>,
|
||||
pub init: Option<Box<Expr>>,
|
||||
pub tail: Option<Box<Expr>>,
|
||||
}
|
||||
|
||||
/// An [Assign]ment expression: [`Expr`] ([`ModifyKind`] [`Expr`])\+
|
||||
|
||||
@@ -443,7 +443,7 @@ mod display {
|
||||
|
||||
impl Display for Let {
|
||||
fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
|
||||
let Self { mutable, name, ty, init, tail } = self;
|
||||
let Self { mutable, name, ty, init } = self;
|
||||
write!(f, "let {mutable}{name}")?;
|
||||
if let Some(value) = ty {
|
||||
write!(f, ": {value}")?;
|
||||
@@ -451,9 +451,6 @@ mod display {
|
||||
if let Some(value) = init {
|
||||
write!(f, " = {value}")?;
|
||||
}
|
||||
if let Some(value) = tail {
|
||||
write!(f, ";\n{value}")?;
|
||||
}
|
||||
Ok(())
|
||||
}
|
||||
}
|
||||
|
||||
@@ -227,13 +227,12 @@ pub trait Fold {
|
||||
s
|
||||
}
|
||||
fn fold_let(&mut self, l: Let) -> Let {
|
||||
let Let { mutable, name, ty, init, tail } = l;
|
||||
let Let { mutable, name, ty, init } = l;
|
||||
Let {
|
||||
mutable: self.fold_mutability(mutable),
|
||||
name: self.fold_sym(name),
|
||||
ty: ty.map(|t| Box::new(self.fold_ty(*t))),
|
||||
init: init.map(|e| Box::new(self.fold_expr(*e))),
|
||||
tail: tail.map(|e| Box::new(self.fold_expr(*e))),
|
||||
}
|
||||
}
|
||||
fn fold_expr(&mut self, e: Expr) -> Expr {
|
||||
|
||||
@@ -192,7 +192,7 @@ pub trait Visit<'a>: Sized {
|
||||
}
|
||||
fn visit_semi(&mut self, _s: &'a Semi) {}
|
||||
fn visit_let(&mut self, l: &'a Let) {
|
||||
let Let { mutable, name, ty, init, tail } = l;
|
||||
let Let { mutable, name, ty, init } = l;
|
||||
self.visit_mutability(mutable);
|
||||
self.visit_sym(name);
|
||||
if let Some(ty) = ty {
|
||||
@@ -201,9 +201,6 @@ pub trait Visit<'a>: Sized {
|
||||
if let Some(init) = init {
|
||||
self.visit_expr(init)
|
||||
}
|
||||
if let Some(tail) = tail {
|
||||
self.visit_expr(tail)
|
||||
}
|
||||
}
|
||||
fn visit_expr(&mut self, e: &'a Expr) {
|
||||
let Expr { extents, kind } = e;
|
||||
|
||||
Reference in New Issue
Block a user