mirror of
https://github.com/rust-lang/rust-analyzer.git
synced 2025-09-18 00:00:03 +00:00
fix: Fix float parser hack creating empty NameRef tokens
This commit is contained in:
parent
d9e9ca2981
commit
cba39f8553
4 changed files with 46 additions and 7 deletions
|
@ -195,11 +195,16 @@ impl ast::TokenTree {
|
|||
// Tag the token as joint if it is float with a fractional part
|
||||
// we use this jointness to inform the parser about what token split
|
||||
// event to emit when we encounter a float literal in a field access
|
||||
if kind == SyntaxKind::FLOAT_NUMBER && !t.text().ends_with('.') {
|
||||
parser_input.was_joint();
|
||||
if kind == SyntaxKind::FLOAT_NUMBER {
|
||||
if !t.text().ends_with('.') {
|
||||
parser_input.was_joint();
|
||||
} else {
|
||||
was_joint = false;
|
||||
}
|
||||
} else {
|
||||
was_joint = true;
|
||||
}
|
||||
}
|
||||
was_joint = true;
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -250,6 +255,7 @@ impl ast::TokenTree {
|
|||
if has_pseudo_dot {
|
||||
assert!(right.is_empty(), "{left}.{right}");
|
||||
} else {
|
||||
assert!(!right.is_empty(), "{left}.{right}");
|
||||
builder.start_node(SyntaxKind::NAME_REF);
|
||||
builder.token(SyntaxKind::INT_NUMBER, right);
|
||||
builder.finish_node();
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue