diff options
author | Joshua Nelson <[email protected]> | 2020-01-17 03:20:17 +0000 |
---|---|---|
committer | Joshua Nelson <[email protected]> | 2020-01-17 03:20:17 +0000 |
commit | f077d5c303ecc4f38471b37be985bb0c5ab2f68c (patch) | |
tree | fd91936b72ea9334034f8b97f790b7fb419c2f32 | |
parent | c78e34968ff24bf8b195ea02be54835a09f53abd (diff) |
move inline function closer to relevant code
also updates generated inline tests
5 files changed, 44 insertions, 119 deletions
diff --git a/crates/ra_parser/src/grammar/expressions.rs b/crates/ra_parser/src/grammar/expressions.rs index d8105c382..95564b602 100644 --- a/crates/ra_parser/src/grammar/expressions.rs +++ b/crates/ra_parser/src/grammar/expressions.rs | |||
@@ -535,15 +535,15 @@ fn cast_expr(p: &mut Parser, lhs: CompletedMarker) -> CompletedMarker { | |||
535 | m.complete(p, CAST_EXPR) | 535 | m.complete(p, CAST_EXPR) |
536 | } | 536 | } |
537 | 537 | ||
538 | // test arg_with_attr | ||
539 | // fn main() { | ||
540 | // foo(#[attr] 92) | ||
541 | // } | ||
542 | fn arg_list(p: &mut Parser) { | 538 | fn arg_list(p: &mut Parser) { |
543 | assert!(p.at(T!['('])); | 539 | assert!(p.at(T!['('])); |
544 | let m = p.start(); | 540 | let m = p.start(); |
545 | p.bump(T!['(']); | 541 | p.bump(T!['(']); |
546 | while !p.at(T![')']) && !p.at(EOF) { | 542 | while !p.at(T![')']) && !p.at(EOF) { |
543 | // test arg_with_attr | ||
544 | // fn main() { | ||
545 | // foo(#[attr] 92) | ||
546 | // } | ||
547 | attributes::outer_attributes(p); | 547 | attributes::outer_attributes(p); |
548 | if !p.at_ts(EXPR_FIRST) { | 548 | if !p.at_ts(EXPR_FIRST) { |
549 | p.error("expected expression"); | 549 | p.error("expected expression"); |
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 deleted file mode 100644 index a4009b392..000000000 --- a/crates/ra_syntax/test_data/parser/inline/ok/0152_arg_list.rs +++ /dev/null | |||
@@ -1,9 +0,0 @@ | |||
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 deleted file mode 100644 index 6b1992dac..000000000 --- a/crates/ra_syntax/test_data/parser/inline/ok/0152_arg_list.txt +++ /dev/null | |||
@@ -1,106 +0,0 @@ | |||
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" | ||
diff --git a/crates/ra_syntax/test_data/parser/inline/ok/0152_arg_with_attr.rs b/crates/ra_syntax/test_data/parser/inline/ok/0152_arg_with_attr.rs new file mode 100644 index 000000000..5daf1d7b0 --- /dev/null +++ b/crates/ra_syntax/test_data/parser/inline/ok/0152_arg_with_attr.rs | |||
@@ -0,0 +1,3 @@ | |||
1 | fn main() { | ||
2 | foo(#[attr] 92) | ||
3 | } | ||
diff --git a/crates/ra_syntax/test_data/parser/inline/ok/0152_arg_with_attr.txt b/crates/ra_syntax/test_data/parser/inline/ok/0152_arg_with_attr.txt new file mode 100644 index 000000000..6b80ca8d0 --- /dev/null +++ b/crates/ra_syntax/test_data/parser/inline/ok/0152_arg_with_attr.txt | |||
@@ -0,0 +1,37 @@ | |||
1 | SOURCE_FILE@[0; 34) | ||
2 | FN_DEF@[0; 33) | ||
3 | FN_KW@[0; 2) "fn" | ||
4 | WHITESPACE@[2; 3) " " | ||
5 | NAME@[3; 7) | ||
6 | IDENT@[3; 7) "main" | ||
7 | PARAM_LIST@[7; 9) | ||
8 | L_PAREN@[7; 8) "(" | ||
9 | R_PAREN@[8; 9) ")" | ||
10 | WHITESPACE@[9; 10) " " | ||
11 | BLOCK_EXPR@[10; 33) | ||
12 | BLOCK@[10; 33) | ||
13 | L_CURLY@[10; 11) "{" | ||
14 | WHITESPACE@[11; 16) "\n " | ||
15 | CALL_EXPR@[16; 31) | ||
16 | PATH_EXPR@[16; 19) | ||
17 | PATH@[16; 19) | ||
18 | PATH_SEGMENT@[16; 19) | ||
19 | NAME_REF@[16; 19) | ||
20 | IDENT@[16; 19) "foo" | ||
21 | ARG_LIST@[19; 31) | ||
22 | L_PAREN@[19; 20) "(" | ||
23 | ATTR@[20; 27) | ||
24 | POUND@[20; 21) "#" | ||
25 | L_BRACK@[21; 22) "[" | ||
26 | PATH@[22; 26) | ||
27 | PATH_SEGMENT@[22; 26) | ||
28 | NAME_REF@[22; 26) | ||
29 | IDENT@[22; 26) "attr" | ||
30 | R_BRACK@[26; 27) "]" | ||
31 | WHITESPACE@[27; 28) " " | ||
32 | LITERAL@[28; 30) | ||
33 | INT_NUMBER@[28; 30) "92" | ||
34 | R_PAREN@[30; 31) ")" | ||
35 | WHITESPACE@[31; 32) "\n" | ||
36 | R_CURLY@[32; 33) "}" | ||
37 | WHITESPACE@[33; 34) "\n" | ||