mirror of
https://github.com/rust-lang/rust-analyzer.git
synced 2025-09-27 20:42:04 +00:00
Parse and infer tuple indices
This commit is contained in:
parent
0372eca5b2
commit
ca40ca93a5
13 changed files with 210 additions and 14 deletions
|
@ -379,6 +379,14 @@ fn method_call_expr(p: &mut Parser, lhs: CompletedMarker) -> CompletedMarker {
|
|||
// fn foo() {
|
||||
// x.foo;
|
||||
// x.0.bar;
|
||||
// x.0();
|
||||
// }
|
||||
|
||||
// test_err bad_tuple_index_expr
|
||||
// fn foo() {
|
||||
// x.0.;
|
||||
// x.1i32;
|
||||
// x.0x01;
|
||||
// }
|
||||
fn field_expr(p: &mut Parser, lhs: CompletedMarker) -> CompletedMarker {
|
||||
assert!(p.at(DOT));
|
||||
|
@ -387,7 +395,10 @@ fn field_expr(p: &mut Parser, lhs: CompletedMarker) -> CompletedMarker {
|
|||
if p.at(IDENT) {
|
||||
name_ref(p)
|
||||
} else if p.at(INT_NUMBER) {
|
||||
p.bump()
|
||||
p.bump();
|
||||
} else if p.at(FLOAT_NUMBER) {
|
||||
// FIXME: How to recover and instead parse INT + DOT?
|
||||
p.bump();
|
||||
} else {
|
||||
p.error("expected field name or number")
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue