diff options
Diffstat (limited to 'crates/ra_syntax')
5 files changed, 46 insertions, 2 deletions
diff --git a/crates/ra_syntax/Cargo.toml b/crates/ra_syntax/Cargo.toml index 05cf41a8d..c50dc6c67 100644 --- a/crates/ra_syntax/Cargo.toml +++ b/crates/ra_syntax/Cargo.toml | |||
@@ -13,7 +13,7 @@ unicode-xid = "0.1.0" | |||
13 | itertools = "0.8.0" | 13 | itertools = "0.8.0" |
14 | drop_bomb = "0.1.4" | 14 | drop_bomb = "0.1.4" |
15 | parking_lot = "0.7.0" | 15 | parking_lot = "0.7.0" |
16 | rowan = "0.3.1" | 16 | rowan = "0.3.2" |
17 | 17 | ||
18 | # ideally, `serde` should be enabled by `ra_lsp_serder`, but we enable it here | 18 | # ideally, `serde` should be enabled by `ra_lsp_serder`, but we enable it here |
19 | # to reduce number of compilations | 19 | # to reduce number of compilations |
diff --git a/crates/ra_syntax/src/grammar/params.rs b/crates/ra_syntax/src/grammar/params.rs index 658fc5820..13158429a 100644 --- a/crates/ra_syntax/src/grammar/params.rs +++ b/crates/ra_syntax/src/grammar/params.rs | |||
@@ -79,7 +79,12 @@ fn value_parameter(p: &mut Parser, flavor: Flavor) { | |||
79 | let la1 = p.nth(1); | 79 | let la1 = p.nth(1); |
80 | let la2 = p.nth(2); | 80 | let la2 = p.nth(2); |
81 | let la3 = p.nth(3); | 81 | let la3 = p.nth(3); |
82 | if la0 == IDENT && la1 == COLON | 82 | |
83 | // test trait_fn_placeholder_parameter | ||
84 | // trait Foo { | ||
85 | // fn bar(_: u64); | ||
86 | // } | ||
87 | if (la0 == IDENT || la0 == UNDERSCORE) && la1 == COLON | ||
83 | || la0 == AMP && la1 == IDENT && la2 == COLON | 88 | || la0 == AMP && la1 == IDENT && la2 == COLON |
84 | || la0 == AMP && la1 == MUT_KW && la2 == IDENT && la3 == COLON | 89 | || la0 == AMP && la1 == MUT_KW && la2 == IDENT && la3 == COLON |
85 | { | 90 | { |
diff --git a/crates/ra_syntax/src/yellow.rs b/crates/ra_syntax/src/yellow.rs index 9b93945cc..a7bfb80e2 100644 --- a/crates/ra_syntax/src/yellow.rs +++ b/crates/ra_syntax/src/yellow.rs | |||
@@ -177,6 +177,10 @@ impl SyntaxNode { | |||
177 | pub fn children(&self) -> SyntaxNodeChildren { | 177 | pub fn children(&self) -> SyntaxNodeChildren { |
178 | SyntaxNodeChildren(self.0.children()) | 178 | SyntaxNodeChildren(self.0.children()) |
179 | } | 179 | } |
180 | |||
181 | pub fn memory_size_of_subtree(&self) -> usize { | ||
182 | self.0.memory_size_of_subtree() | ||
183 | } | ||
180 | } | 184 | } |
181 | 185 | ||
182 | impl fmt::Debug for SyntaxNode { | 186 | impl fmt::Debug for SyntaxNode { |
diff --git a/crates/ra_syntax/tests/data/parser/inline/ok/0116_trait_fn_placeholder_parameter.rs b/crates/ra_syntax/tests/data/parser/inline/ok/0116_trait_fn_placeholder_parameter.rs new file mode 100644 index 000000000..aede3f4fe --- /dev/null +++ b/crates/ra_syntax/tests/data/parser/inline/ok/0116_trait_fn_placeholder_parameter.rs | |||
@@ -0,0 +1,3 @@ | |||
1 | trait Foo { | ||
2 | fn bar(_: u64); | ||
3 | } | ||
diff --git a/crates/ra_syntax/tests/data/parser/inline/ok/0116_trait_fn_placeholder_parameter.txt b/crates/ra_syntax/tests/data/parser/inline/ok/0116_trait_fn_placeholder_parameter.txt new file mode 100644 index 000000000..248d491df --- /dev/null +++ b/crates/ra_syntax/tests/data/parser/inline/ok/0116_trait_fn_placeholder_parameter.txt | |||
@@ -0,0 +1,32 @@ | |||
1 | SOURCE_FILE@[0; 34) | ||
2 | TRAIT_DEF@[0; 33) | ||
3 | TRAIT_KW@[0; 5) | ||
4 | WHITESPACE@[5; 6) | ||
5 | NAME@[6; 9) | ||
6 | IDENT@[6; 9) "Foo" | ||
7 | WHITESPACE@[9; 10) | ||
8 | ITEM_LIST@[10; 33) | ||
9 | L_CURLY@[10; 11) | ||
10 | WHITESPACE@[11; 16) | ||
11 | FN_DEF@[16; 31) | ||
12 | FN_KW@[16; 18) | ||
13 | WHITESPACE@[18; 19) | ||
14 | NAME@[19; 22) | ||
15 | IDENT@[19; 22) "bar" | ||
16 | PARAM_LIST@[22; 30) | ||
17 | L_PAREN@[22; 23) | ||
18 | PARAM@[23; 29) | ||
19 | PLACEHOLDER_PAT@[23; 24) | ||
20 | UNDERSCORE@[23; 24) | ||
21 | COLON@[24; 25) | ||
22 | WHITESPACE@[25; 26) | ||
23 | PATH_TYPE@[26; 29) | ||
24 | PATH@[26; 29) | ||
25 | PATH_SEGMENT@[26; 29) | ||
26 | NAME_REF@[26; 29) | ||
27 | IDENT@[26; 29) "u64" | ||
28 | R_PAREN@[29; 30) | ||
29 | SEMI@[30; 31) | ||
30 | WHITESPACE@[31; 32) | ||
31 | R_CURLY@[32; 33) | ||
32 | WHITESPACE@[33; 34) | ||