mirror of
https://github.com/rust-lang/rust-analyzer
synced 2025-01-14 14:13:58 +00:00
Nest attrs into exprs in function args
This commit is contained in:
parent
b7c45fba57
commit
3a859e587f
3 changed files with 23 additions and 32 deletions
|
@ -564,12 +564,9 @@ fn arg_list(p: &mut Parser) {
|
|||
// fn main() {
|
||||
// foo(#[attr] 92)
|
||||
// }
|
||||
attributes::outer_attributes(p);
|
||||
if !p.at_ts(EXPR_FIRST) {
|
||||
p.error("expected expression");
|
||||
if !expr_with_attrs(p) {
|
||||
break;
|
||||
}
|
||||
expr(p);
|
||||
if !p.at(T![')']) && !p.expect(T![,]) {
|
||||
break;
|
||||
}
|
||||
|
|
|
@ -54,14 +54,14 @@ SOURCE_FILE@[0; 112)
|
|||
BLOCK@[41; 68)
|
||||
L_CURLY@[41; 42) "{"
|
||||
WHITESPACE@[42; 43) " "
|
||||
EXPR_STMT@[43; 52)
|
||||
CALL_EXPR@[43; 52)
|
||||
EXPR_STMT@[43; 54)
|
||||
CALL_EXPR@[43; 54)
|
||||
PATH_EXPR@[43; 46)
|
||||
PATH@[43; 46)
|
||||
PATH_SEGMENT@[43; 46)
|
||||
NAME_REF@[43; 46)
|
||||
IDENT@[43; 46) "foo"
|
||||
ARG_LIST@[46; 52)
|
||||
ARG_LIST@[46; 54)
|
||||
L_PAREN@[46; 47) "("
|
||||
LITERAL@[47; 48)
|
||||
INT_NUMBER@[47; 48) "1"
|
||||
|
@ -71,7 +71,6 @@ SOURCE_FILE@[0; 112)
|
|||
INT_NUMBER@[50; 51) "2"
|
||||
COMMA@[51; 52) ","
|
||||
WHITESPACE@[52; 53) " "
|
||||
EXPR_STMT@[53; 54)
|
||||
ERROR@[53; 54)
|
||||
AT@[53; 54) "@"
|
||||
EXPR_STMT@[54; 55)
|
||||
|
@ -104,8 +103,8 @@ SOURCE_FILE@[0; 112)
|
|||
BLOCK@[76; 111)
|
||||
L_CURLY@[76; 77) "{"
|
||||
WHITESPACE@[77; 78) " "
|
||||
EXPR_STMT@[78; 91)
|
||||
METHOD_CALL_EXPR@[78; 91)
|
||||
EXPR_STMT@[78; 93)
|
||||
METHOD_CALL_EXPR@[78; 93)
|
||||
PATH_EXPR@[78; 81)
|
||||
PATH@[78; 81)
|
||||
PATH_SEGMENT@[78; 81)
|
||||
|
@ -114,7 +113,7 @@ SOURCE_FILE@[0; 112)
|
|||
DOT@[81; 82) "."
|
||||
NAME_REF@[82; 85)
|
||||
IDENT@[82; 85) "bar"
|
||||
ARG_LIST@[85; 91)
|
||||
ARG_LIST@[85; 93)
|
||||
L_PAREN@[85; 86) "("
|
||||
LITERAL@[86; 87)
|
||||
INT_NUMBER@[86; 87) "1"
|
||||
|
@ -124,7 +123,6 @@ SOURCE_FILE@[0; 112)
|
|||
INT_NUMBER@[89; 90) "2"
|
||||
COMMA@[90; 91) ","
|
||||
WHITESPACE@[91; 92) " "
|
||||
EXPR_STMT@[92; 93)
|
||||
ERROR@[92; 93)
|
||||
AT@[92; 93) "@"
|
||||
EXPR_STMT@[93; 94)
|
||||
|
@ -159,8 +157,6 @@ error 25: expected a name
|
|||
error 26: expected `;`, `{`, or `(`
|
||||
error 30: expected pattern
|
||||
error 31: expected SEMI
|
||||
error 52: expected expression
|
||||
error 52: expected SEMI
|
||||
error 53: expected expression
|
||||
error 54: expected SEMI
|
||||
error 54: expected expression
|
||||
|
@ -172,8 +168,6 @@ error 61: expected SEMI
|
|||
error 65: expected pattern
|
||||
error 65: expected SEMI
|
||||
error 65: expected expression
|
||||
error 91: expected expression
|
||||
error 91: expected SEMI
|
||||
error 92: expected expression
|
||||
error 93: expected SEMI
|
||||
error 93: expected expression
|
||||
|
|
|
@ -20,6 +20,7 @@ SOURCE_FILE@[0; 34)
|
|||
IDENT@[16; 19) "foo"
|
||||
ARG_LIST@[19; 31)
|
||||
L_PAREN@[19; 20) "("
|
||||
LITERAL@[20; 30)
|
||||
ATTR@[20; 27)
|
||||
POUND@[20; 21) "#"
|
||||
L_BRACK@[21; 22) "["
|
||||
|
@ -29,7 +30,6 @@ SOURCE_FILE@[0; 34)
|
|||
IDENT@[22; 26) "attr"
|
||||
R_BRACK@[26; 27) "]"
|
||||
WHITESPACE@[27; 28) " "
|
||||
LITERAL@[28; 30)
|
||||
INT_NUMBER@[28; 30) "92"
|
||||
R_PAREN@[30; 31) ")"
|
||||
WHITESPACE@[31; 32) "\n"
|
||||
|
|
Loading…
Reference in a new issue