diff options
Diffstat (limited to 'src/syntax/expr.rs')
| -rw-r--r-- | src/syntax/expr.rs | 11 |
1 files changed, 11 insertions, 0 deletions
diff --git a/src/syntax/expr.rs b/src/syntax/expr.rs index d18d3404..5b37bb56 100644 --- a/src/syntax/expr.rs +++ b/src/syntax/expr.rs @@ -54,6 +54,17 @@ impl Expr { Self::For(v) => v.span, } } + + /// Whether the expression can be shorten in markup with a hashtag. + pub fn has_short_form(&self) -> bool { + matches!(self, + Expr::Ident(_) + | Expr::Call(_) + | Expr::Let(_) + | Expr::If(_) + | Expr::For(_) + ) + } } /// A literal. |
