summaryrefslogtreecommitdiff
path: root/crates/typst-syntax
diff options
context:
space:
mode:
authorLaurenz <laurmaedje@gmail.com>2023-09-16 12:28:07 +0200
committerLaurenz <laurmaedje@gmail.com>2023-09-16 12:37:35 +0200
commitb7430f6da01550d8388d6a3bcccf0ef0aca9130c (patch)
treeacc95f8cb7dbd36bdeb18ac15ffcc17cddc8cee5 /crates/typst-syntax
parent961d70dadec2872a139018ae2aaf936f5b179251 (diff)
Fix incremental compilation by fixing closure capturing
Fixes #1958
Diffstat (limited to 'crates/typst-syntax')
-rw-r--r--crates/typst-syntax/src/ast.rs14
1 files changed, 13 insertions, 1 deletions
diff --git a/crates/typst-syntax/src/ast.rs b/crates/typst-syntax/src/ast.rs
index e1741403..0df3d6d3 100644
--- a/crates/typst-syntax/src/ast.rs
+++ b/crates/typst-syntax/src/ast.rs
@@ -42,7 +42,7 @@ macro_rules! node {
impl<'a> AstNode<'a> for $name<'a> {
#[inline]
fn from_untyped(node: &'a SyntaxNode) -> Option<Self> {
- if matches!(node.kind(), SyntaxKind::$name) {
+ if node.kind() == SyntaxKind::$name {
Some(Self(node))
} else {
Option::None
@@ -1440,6 +1440,18 @@ impl BinOp {
})
}
+ /// Whether this is an assignment operator.
+ pub fn is_assignment(self) -> bool {
+ matches!(
+ self,
+ Self::Assign
+ | Self::AddAssign
+ | Self::SubAssign
+ | Self::MulAssign
+ | Self::DivAssign
+ )
+ }
+
/// The precedence of this operator.
pub fn precedence(self) -> usize {
match self {