Expr::Stmt takes a statements block.

This commit is contained in:
Stephen Chung
2020-11-04 11:49:02 +08:00
parent 32f41c69bd
commit 2168fd5361
6 changed files with 80 additions and 44 deletions

View File

@@ -908,7 +908,7 @@ pub enum Expr {
/// Property access - (getter, setter), prop
Property(Box<((String, String), IdentX)>),
/// { stmt }
Stmt(Box<Stmt>, Position),
Stmt(Box<StaticVec<Stmt>>, Position),
/// Wrapped expression - should not be optimized away.
Expr(Box<Expr>),
/// func(expr, ... )
@@ -1092,7 +1092,7 @@ impl Expr {
x.lhs.is_pure() && x.rhs.is_pure()
}
Self::Stmt(x, _) => x.is_pure(),
Self::Stmt(x, _) => x.iter().all(Stmt::is_pure),
Self::Variable(_) => true,