Better error messages.
This commit is contained in:
@@ -469,7 +469,10 @@ impl fmt::Debug for Expr {
|
||||
Self::Dot(_, _, _) => "Dot",
|
||||
Self::And(_, _) => "And",
|
||||
Self::Or(_, _) => "Or",
|
||||
_ => unreachable!(),
|
||||
expr => unreachable!(
|
||||
"Self::Dot or Self::And or Self::Or expected but gets {:?}",
|
||||
expr
|
||||
),
|
||||
};
|
||||
|
||||
display_pos = *pos;
|
||||
|
@@ -480,7 +480,11 @@ impl Stmt {
|
||||
match self {
|
||||
Self::Var(_, _, _, _) => true,
|
||||
|
||||
Self::FnCall(x, _) if x.name == KEYWORD_EVAL => true,
|
||||
Self::Expr(Expr::Stmt(s)) => s.iter().all(Stmt::is_block_dependent),
|
||||
|
||||
Self::FnCall(x, _) | Self::Expr(Expr::FnCall(x, _)) => {
|
||||
x.namespace.is_none() && x.name == KEYWORD_EVAL
|
||||
}
|
||||
|
||||
#[cfg(not(feature = "no_module"))]
|
||||
Self::Import(_, _, _) | Self::Export(_, _) => true,
|
||||
@@ -500,6 +504,8 @@ impl Stmt {
|
||||
match self {
|
||||
Self::Var(expr, _, _, _) => expr.is_pure(),
|
||||
|
||||
Self::Expr(Expr::Stmt(s)) => s.iter().all(Stmt::is_internally_pure),
|
||||
|
||||
#[cfg(not(feature = "no_module"))]
|
||||
Self::Import(expr, _, _) => expr.is_pure(),
|
||||
#[cfg(not(feature = "no_module"))]
|
||||
|
Reference in New Issue
Block a user