Skip to content
This repository was archived by the owner on May 28, 2025. It is now read-only.

Commit 27cd509

Browse files
committed
fix jointess for floats not being set properly
1 parent e59487d commit 27cd509

File tree

1 file changed

+7
-9
lines changed

1 file changed

+7
-9
lines changed

crates/parser/src/shortcuts.rs

Lines changed: 7 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -43,18 +43,16 @@ impl<'a> LexedStr<'a> {
4343
res.was_joint();
4444
}
4545
res.push(kind);
46-
}
47-
if kind == SyntaxKind::FLOAT_NUMBER {
4846
// we set jointness for floating point numbers as a hack to inform the
4947
// parser about whether we have a `0.` or `0.1` style float
50-
if self.text(i).split_once('.').map_or(false, |(_, it)| it.is_empty()) {
51-
was_joint = false;
52-
} else {
53-
was_joint = true;
48+
if kind == SyntaxKind::FLOAT_NUMBER {
49+
if !self.text(i).split_once('.').map_or(true, |(_, it)| it.is_empty()) {
50+
res.was_joint();
51+
}
5452
}
55-
} else {
56-
was_joint = true;
5753
}
54+
55+
was_joint = true;
5856
}
5957
}
6058
res
@@ -202,7 +200,7 @@ impl Builder<'_, '_> {
202200
(self.sink)(StrStep::Token { kind: SyntaxKind::DOT, text: "." });
203201

204202
if has_pseudo_dot {
205-
assert!(right.is_empty());
203+
assert!(right.is_empty(), "{left}.{right}");
206204
self.state = State::Normal;
207205
} else {
208206
(self.sink)(StrStep::Enter { kind: SyntaxKind::NAME_REF });

0 commit comments

Comments
 (0)