diff options
author | Joshua Nelson <[email protected]> | 2020-01-12 15:19:17 +0000 |
---|---|---|
committer | Joshua Nelson <[email protected]> | 2020-01-12 15:25:41 +0000 |
commit | c3ac2c93fb446329b09882ef452fd6820290bfc5 (patch) | |
tree | 44734cc34641cfab04cb1c71611ee0a299a90c96 /crates/ra_syntax/test_data/parser/inline | |
parent | f7a7092d691aea5c254412d9fd4b3f76a355f11f (diff) |
Allow attributes before function arguments
This adds support for function calls of the form:
```rust
(
#[attr(...)] 1.2,
#[attr_one(...)]
#[attr_two(...)]
1.5,
... etc ...
)
```
Closes https://github.com/rust-analyzer/rust-analyzer/issues/2801
Diffstat (limited to 'crates/ra_syntax/test_data/parser/inline')
-rw-r--r-- | crates/ra_syntax/test_data/parser/inline/ok/0152_arg_list.rs | 9 | ||||
-rw-r--r-- | crates/ra_syntax/test_data/parser/inline/ok/0152_arg_list.txt | 106 |
2 files changed, 115 insertions, 0 deletions
diff --git a/crates/ra_syntax/test_data/parser/inline/ok/0152_arg_list.rs b/crates/ra_syntax/test_data/parser/inline/ok/0152_arg_list.rs new file mode 100644 index 000000000..a4009b392 --- /dev/null +++ b/crates/ra_syntax/test_data/parser/inline/ok/0152_arg_list.rs | |||
@@ -0,0 +1,9 @@ | |||
1 | fn assert_float(s: &str, n: f64) {} | ||
2 | fn foo() { | ||
3 | assert_float( | ||
4 | "1.797693134862315708e+308L", | ||
5 | #[allow(clippy::excessive_precision)] | ||
6 | #[allow(dead_code)] | ||
7 | 1.797_693_134_862_315_730_8e+308, | ||
8 | ); | ||
9 | } | ||
diff --git a/crates/ra_syntax/test_data/parser/inline/ok/0152_arg_list.txt b/crates/ra_syntax/test_data/parser/inline/ok/0152_arg_list.txt new file mode 100644 index 000000000..6b1992dac --- /dev/null +++ b/crates/ra_syntax/test_data/parser/inline/ok/0152_arg_list.txt | |||
@@ -0,0 +1,106 @@ | |||
1 | SOURCE_FILE@[0; 228) | ||
2 | FN_DEF@[0; 35) | ||
3 | FN_KW@[0; 2) "fn" | ||
4 | WHITESPACE@[2; 3) " " | ||
5 | NAME@[3; 15) | ||
6 | IDENT@[3; 15) "assert_float" | ||
7 | PARAM_LIST@[15; 32) | ||
8 | L_PAREN@[15; 16) "(" | ||
9 | PARAM@[16; 23) | ||
10 | BIND_PAT@[16; 17) | ||
11 | NAME@[16; 17) | ||
12 | IDENT@[16; 17) "s" | ||
13 | COLON@[17; 18) ":" | ||
14 | WHITESPACE@[18; 19) " " | ||
15 | REFERENCE_TYPE@[19; 23) | ||
16 | AMP@[19; 20) "&" | ||
17 | PATH_TYPE@[20; 23) | ||
18 | PATH@[20; 23) | ||
19 | PATH_SEGMENT@[20; 23) | ||
20 | NAME_REF@[20; 23) | ||
21 | IDENT@[20; 23) "str" | ||
22 | COMMA@[23; 24) "," | ||
23 | WHITESPACE@[24; 25) " " | ||
24 | PARAM@[25; 31) | ||
25 | BIND_PAT@[25; 26) | ||
26 | NAME@[25; 26) | ||
27 | IDENT@[25; 26) "n" | ||
28 | COLON@[26; 27) ":" | ||
29 | WHITESPACE@[27; 28) " " | ||
30 | PATH_TYPE@[28; 31) | ||
31 | PATH@[28; 31) | ||
32 | PATH_SEGMENT@[28; 31) | ||
33 | NAME_REF@[28; 31) | ||
34 | IDENT@[28; 31) "f64" | ||
35 | R_PAREN@[31; 32) ")" | ||
36 | WHITESPACE@[32; 33) " " | ||
37 | BLOCK_EXPR@[33; 35) | ||
38 | BLOCK@[33; 35) | ||
39 | L_CURLY@[33; 34) "{" | ||
40 | R_CURLY@[34; 35) "}" | ||
41 | WHITESPACE@[35; 36) "\n" | ||
42 | FN_DEF@[36; 227) | ||
43 | FN_KW@[36; 38) "fn" | ||
44 | WHITESPACE@[38; 39) " " | ||
45 | NAME@[39; 42) | ||
46 | IDENT@[39; 42) "foo" | ||
47 | PARAM_LIST@[42; 44) | ||
48 | L_PAREN@[42; 43) "(" | ||
49 | R_PAREN@[43; 44) ")" | ||
50 | WHITESPACE@[44; 45) " " | ||
51 | BLOCK_EXPR@[45; 227) | ||
52 | BLOCK@[45; 227) | ||
53 | L_CURLY@[45; 46) "{" | ||
54 | WHITESPACE@[46; 51) "\n " | ||
55 | EXPR_STMT@[51; 225) | ||
56 | CALL_EXPR@[51; 224) | ||
57 | PATH_EXPR@[51; 63) | ||
58 | PATH@[51; 63) | ||
59 | PATH_SEGMENT@[51; 63) | ||
60 | NAME_REF@[51; 63) | ||
61 | IDENT@[51; 63) "assert_float" | ||
62 | ARG_LIST@[63; 224) | ||
63 | L_PAREN@[63; 64) "(" | ||
64 | WHITESPACE@[64; 73) "\n " | ||
65 | LITERAL@[73; 101) | ||
66 | STRING@[73; 101) "\"1.797693134862315708 ..." | ||
67 | COMMA@[101; 102) "," | ||
68 | WHITESPACE@[102; 111) "\n " | ||
69 | ATTR@[111; 148) | ||
70 | POUND@[111; 112) "#" | ||
71 | L_BRACK@[112; 113) "[" | ||
72 | PATH@[113; 118) | ||
73 | PATH_SEGMENT@[113; 118) | ||
74 | NAME_REF@[113; 118) | ||
75 | IDENT@[113; 118) "allow" | ||
76 | TOKEN_TREE@[118; 147) | ||
77 | L_PAREN@[118; 119) "(" | ||
78 | IDENT@[119; 125) "clippy" | ||
79 | COLON@[125; 126) ":" | ||
80 | COLON@[126; 127) ":" | ||
81 | IDENT@[127; 146) "excessive_precision" | ||
82 | R_PAREN@[146; 147) ")" | ||
83 | R_BRACK@[147; 148) "]" | ||
84 | WHITESPACE@[148; 157) "\n " | ||
85 | ATTR@[157; 176) | ||
86 | POUND@[157; 158) "#" | ||
87 | L_BRACK@[158; 159) "[" | ||
88 | PATH@[159; 164) | ||
89 | PATH_SEGMENT@[159; 164) | ||
90 | NAME_REF@[159; 164) | ||
91 | IDENT@[159; 164) "allow" | ||
92 | TOKEN_TREE@[164; 175) | ||
93 | L_PAREN@[164; 165) "(" | ||
94 | IDENT@[165; 174) "dead_code" | ||
95 | R_PAREN@[174; 175) ")" | ||
96 | R_BRACK@[175; 176) "]" | ||
97 | WHITESPACE@[176; 185) "\n " | ||
98 | LITERAL@[185; 217) | ||
99 | FLOAT_NUMBER@[185; 217) "1.797_693_134_862_315 ..." | ||
100 | COMMA@[217; 218) "," | ||
101 | WHITESPACE@[218; 223) "\n " | ||
102 | R_PAREN@[223; 224) ")" | ||
103 | SEMI@[224; 225) ";" | ||
104 | WHITESPACE@[225; 226) "\n" | ||
105 | R_CURLY@[226; 227) "}" | ||
106 | WHITESPACE@[227; 228) "\n" | ||