diff options
author | bors[bot] <26634292+bors[bot]@users.noreply.github.com> | 2021-01-18 16:13:06 +0000 |
---|---|---|
committer | GitHub <noreply@github.com> | 2021-01-18 16:13:06 +0000 |
commit | 9daba961f236750c3a5d831c9775606271b37eff (patch) | |
tree | 6d8c037ea915434701e573bf5eb2eb1f696eef07 /crates/syntax | |
parent | cc58459ee39db804c0b4a660d1f0bb5c9c0bb648 (diff) | |
parent | 98718e0544f42e55642d2838b00d6a7bef1e2414 (diff) |
Merge #7291
7291: Wrap remaining self/super/crate in Name{Ref} r=matklad a=Veykril
That should be the remaining special casing for `self` 🎉
Co-authored-by: Lukas Wirth <lukastw97@gmail.com>
Diffstat (limited to 'crates/syntax')
15 files changed, 147 insertions, 67 deletions
diff --git a/crates/syntax/src/ast/generated/nodes.rs b/crates/syntax/src/ast/generated/nodes.rs index 1d722db3c..6407d7c85 100644 --- a/crates/syntax/src/ast/generated/nodes.rs +++ b/crates/syntax/src/ast/generated/nodes.rs | |||
@@ -11,6 +11,7 @@ pub struct Name { | |||
11 | } | 11 | } |
12 | impl Name { | 12 | impl Name { |
13 | pub fn ident_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![ident]) } | 13 | pub fn ident_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![ident]) } |
14 | pub fn self_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![self]) } | ||
14 | } | 15 | } |
15 | #[derive(Debug, Clone, PartialEq, Eq, Hash)] | 16 | #[derive(Debug, Clone, PartialEq, Eq, Hash)] |
16 | pub struct NameRef { | 17 | pub struct NameRef { |
@@ -238,7 +239,6 @@ impl ExternCrate { | |||
238 | pub fn extern_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![extern]) } | 239 | pub fn extern_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![extern]) } |
239 | pub fn crate_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![crate]) } | 240 | pub fn crate_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![crate]) } |
240 | pub fn name_ref(&self) -> Option<NameRef> { support::child(&self.syntax) } | 241 | pub fn name_ref(&self) -> Option<NameRef> { support::child(&self.syntax) } |
241 | pub fn self_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![self]) } | ||
242 | pub fn rename(&self) -> Option<Rename> { support::child(&self.syntax) } | 242 | pub fn rename(&self) -> Option<Rename> { support::child(&self.syntax) } |
243 | pub fn semicolon_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![;]) } | 243 | pub fn semicolon_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![;]) } |
244 | } | 244 | } |
@@ -406,9 +406,6 @@ pub struct Visibility { | |||
406 | impl Visibility { | 406 | impl Visibility { |
407 | pub fn pub_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![pub]) } | 407 | pub fn pub_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![pub]) } |
408 | pub fn l_paren_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T!['(']) } | 408 | pub fn l_paren_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T!['(']) } |
409 | pub fn super_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![super]) } | ||
410 | pub fn self_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![self]) } | ||
411 | pub fn crate_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![crate]) } | ||
412 | pub fn in_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![in]) } | 409 | pub fn in_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![in]) } |
413 | pub fn path(&self) -> Option<Path> { support::child(&self.syntax) } | 410 | pub fn path(&self) -> Option<Path> { support::child(&self.syntax) } |
414 | pub fn r_paren_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![')']) } | 411 | pub fn r_paren_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![')']) } |
@@ -492,11 +489,11 @@ pub struct SelfParam { | |||
492 | pub(crate) syntax: SyntaxNode, | 489 | pub(crate) syntax: SyntaxNode, |
493 | } | 490 | } |
494 | impl ast::AttrsOwner for SelfParam {} | 491 | impl ast::AttrsOwner for SelfParam {} |
492 | impl ast::NameOwner for SelfParam {} | ||
495 | impl SelfParam { | 493 | impl SelfParam { |
496 | pub fn amp_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![&]) } | 494 | pub fn amp_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![&]) } |
497 | pub fn lifetime(&self) -> Option<Lifetime> { support::child(&self.syntax) } | 495 | pub fn lifetime(&self) -> Option<Lifetime> { support::child(&self.syntax) } |
498 | pub fn mut_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![mut]) } | 496 | pub fn mut_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![mut]) } |
499 | pub fn self_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![self]) } | ||
500 | pub fn colon_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![:]) } | 497 | pub fn colon_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![:]) } |
501 | pub fn ty(&self) -> Option<Type> { support::child(&self.syntax) } | 498 | pub fn ty(&self) -> Option<Type> { support::child(&self.syntax) } |
502 | } | 499 | } |
diff --git a/crates/syntax/src/ast/node_ext.rs b/crates/syntax/src/ast/node_ext.rs index b8ce71d27..738c92a5b 100644 --- a/crates/syntax/src/ast/node_ext.rs +++ b/crates/syntax/src/ast/node_ext.rs | |||
@@ -198,6 +198,13 @@ impl ast::Path { | |||
198 | pub fn parent_path(&self) -> Option<ast::Path> { | 198 | pub fn parent_path(&self) -> Option<ast::Path> { |
199 | self.syntax().parent().and_then(ast::Path::cast) | 199 | self.syntax().parent().and_then(ast::Path::cast) |
200 | } | 200 | } |
201 | |||
202 | pub fn as_single_segment(&self) -> Option<ast::PathSegment> { | ||
203 | match self.qualifier() { | ||
204 | Some(_) => None, | ||
205 | None => self.segment(), | ||
206 | } | ||
207 | } | ||
201 | } | 208 | } |
202 | 209 | ||
203 | impl ast::UseTreeList { | 210 | impl ast::UseTreeList { |
@@ -448,16 +455,22 @@ pub enum VisibilityKind { | |||
448 | 455 | ||
449 | impl ast::Visibility { | 456 | impl ast::Visibility { |
450 | pub fn kind(&self) -> VisibilityKind { | 457 | pub fn kind(&self) -> VisibilityKind { |
451 | if let Some(path) = support::children(self.syntax()).next() { | 458 | match self.path() { |
452 | VisibilityKind::In(path) | 459 | Some(path) => { |
453 | } else if self.crate_token().is_some() { | 460 | if let Some(segment) = |
454 | VisibilityKind::PubCrate | 461 | path.as_single_segment().filter(|it| it.coloncolon_token().is_none()) |
455 | } else if self.super_token().is_some() { | 462 | { |
456 | VisibilityKind::PubSuper | 463 | if segment.crate_token().is_some() { |
457 | } else if self.self_token().is_some() { | 464 | return VisibilityKind::PubCrate; |
458 | VisibilityKind::PubSelf | 465 | } else if segment.super_token().is_some() { |
459 | } else { | 466 | return VisibilityKind::PubSuper; |
460 | VisibilityKind::Pub | 467 | } else if segment.self_token().is_some() { |
468 | return VisibilityKind::PubSelf; | ||
469 | } | ||
470 | } | ||
471 | VisibilityKind::In(path) | ||
472 | } | ||
473 | None => VisibilityKind::Pub, | ||
461 | } | 474 | } |
462 | } | 475 | } |
463 | } | 476 | } |
diff --git a/crates/syntax/test_data/parser/err/0037_visibility_in_traits.rast b/crates/syntax/test_data/parser/err/0037_visibility_in_traits.rast index faf87d6e5..ae4dd2f3b 100644 --- a/crates/syntax/test_data/parser/err/0037_visibility_in_traits.rast +++ b/crates/syntax/test_data/parser/err/0037_visibility_in_traits.rast | |||
@@ -50,7 +50,10 @@ SOURCE_FILE@0..118 | |||
50 | VISIBILITY@56..66 | 50 | VISIBILITY@56..66 |
51 | PUB_KW@56..59 "pub" | 51 | PUB_KW@56..59 "pub" |
52 | L_PAREN@59..60 "(" | 52 | L_PAREN@59..60 "(" |
53 | CRATE_KW@60..65 "crate" | 53 | PATH@60..65 |
54 | PATH_SEGMENT@60..65 | ||
55 | NAME_REF@60..65 | ||
56 | CRATE_KW@60..65 "crate" | ||
54 | R_PAREN@65..66 ")" | 57 | R_PAREN@65..66 ")" |
55 | WHITESPACE@66..67 " " | 58 | WHITESPACE@66..67 " " |
56 | TYPE_KW@67..71 "type" | 59 | TYPE_KW@67..71 "type" |
@@ -69,7 +72,10 @@ SOURCE_FILE@0..118 | |||
69 | VISIBILITY@86..96 | 72 | VISIBILITY@86..96 |
70 | PUB_KW@86..89 "pub" | 73 | PUB_KW@86..89 "pub" |
71 | L_PAREN@89..90 "(" | 74 | L_PAREN@89..90 "(" |
72 | CRATE_KW@90..95 "crate" | 75 | PATH@90..95 |
76 | PATH_SEGMENT@90..95 | ||
77 | NAME_REF@90..95 | ||
78 | CRATE_KW@90..95 "crate" | ||
73 | R_PAREN@95..96 ")" | 79 | R_PAREN@95..96 ")" |
74 | WHITESPACE@96..97 " " | 80 | WHITESPACE@96..97 " " |
75 | CONST_KW@97..102 "const" | 81 | CONST_KW@97..102 "const" |
diff --git a/crates/syntax/test_data/parser/inline/ok/0006_self_param.rast b/crates/syntax/test_data/parser/inline/ok/0006_self_param.rast index 8048f5fad..f0d152d33 100644 --- a/crates/syntax/test_data/parser/inline/ok/0006_self_param.rast +++ b/crates/syntax/test_data/parser/inline/ok/0006_self_param.rast | |||
@@ -19,7 +19,8 @@ SOURCE_FILE@0..128 | |||
19 | PARAM_LIST@17..23 | 19 | PARAM_LIST@17..23 |
20 | L_PAREN@17..18 "(" | 20 | L_PAREN@17..18 "(" |
21 | SELF_PARAM@18..22 | 21 | SELF_PARAM@18..22 |
22 | SELF_KW@18..22 "self" | 22 | NAME@18..22 |
23 | SELF_KW@18..22 "self" | ||
23 | R_PAREN@22..23 ")" | 24 | R_PAREN@22..23 ")" |
24 | WHITESPACE@23..24 " " | 25 | WHITESPACE@23..24 " " |
25 | BLOCK_EXPR@24..26 | 26 | BLOCK_EXPR@24..26 |
@@ -35,7 +36,8 @@ SOURCE_FILE@0..128 | |||
35 | L_PAREN@35..36 "(" | 36 | L_PAREN@35..36 "(" |
36 | SELF_PARAM@36..41 | 37 | SELF_PARAM@36..41 |
37 | AMP@36..37 "&" | 38 | AMP@36..37 "&" |
38 | SELF_KW@37..41 "self" | 39 | NAME@37..41 |
40 | SELF_KW@37..41 "self" | ||
39 | COMMA@41..42 "," | 41 | COMMA@41..42 "," |
40 | R_PAREN@42..43 ")" | 42 | R_PAREN@42..43 ")" |
41 | WHITESPACE@43..44 " " | 43 | WHITESPACE@43..44 " " |
@@ -55,7 +57,8 @@ SOURCE_FILE@0..128 | |||
55 | LIFETIME@57..59 | 57 | LIFETIME@57..59 |
56 | LIFETIME_IDENT@57..59 "\'a" | 58 | LIFETIME_IDENT@57..59 "\'a" |
57 | WHITESPACE@59..60 " " | 59 | WHITESPACE@59..60 " " |
58 | SELF_KW@60..64 "self" | 60 | NAME@60..64 |
61 | SELF_KW@60..64 "self" | ||
59 | COMMA@64..65 "," | 62 | COMMA@64..65 "," |
60 | R_PAREN@65..66 ")" | 63 | R_PAREN@65..66 ")" |
61 | WHITESPACE@66..67 " " | 64 | WHITESPACE@66..67 " " |
@@ -77,7 +80,8 @@ SOURCE_FILE@0..128 | |||
77 | WHITESPACE@82..83 " " | 80 | WHITESPACE@82..83 " " |
78 | MUT_KW@83..86 "mut" | 81 | MUT_KW@83..86 "mut" |
79 | WHITESPACE@86..87 " " | 82 | WHITESPACE@86..87 " " |
80 | SELF_KW@87..91 "self" | 83 | NAME@87..91 |
84 | SELF_KW@87..91 "self" | ||
81 | COMMA@91..92 "," | 85 | COMMA@91..92 "," |
82 | WHITESPACE@92..93 " " | 86 | WHITESPACE@92..93 " " |
83 | PARAM@93..99 | 87 | PARAM@93..99 |
@@ -107,7 +111,8 @@ SOURCE_FILE@0..128 | |||
107 | SELF_PARAM@113..121 | 111 | SELF_PARAM@113..121 |
108 | MUT_KW@113..116 "mut" | 112 | MUT_KW@113..116 "mut" |
109 | WHITESPACE@116..117 " " | 113 | WHITESPACE@116..117 " " |
110 | SELF_KW@117..121 "self" | 114 | NAME@117..121 |
115 | SELF_KW@117..121 "self" | ||
111 | R_PAREN@121..122 ")" | 116 | R_PAREN@121..122 ")" |
112 | WHITESPACE@122..123 " " | 117 | WHITESPACE@122..123 " " |
113 | BLOCK_EXPR@123..125 | 118 | BLOCK_EXPR@123..125 |
diff --git a/crates/syntax/test_data/parser/inline/ok/0018_arb_self_types.rast b/crates/syntax/test_data/parser/inline/ok/0018_arb_self_types.rast index ddbd66588..df59f37a2 100644 --- a/crates/syntax/test_data/parser/inline/ok/0018_arb_self_types.rast +++ b/crates/syntax/test_data/parser/inline/ok/0018_arb_self_types.rast | |||
@@ -19,7 +19,8 @@ SOURCE_FILE@0..69 | |||
19 | PARAM_LIST@17..30 | 19 | PARAM_LIST@17..30 |
20 | L_PAREN@17..18 "(" | 20 | L_PAREN@17..18 "(" |
21 | SELF_PARAM@18..29 | 21 | SELF_PARAM@18..29 |
22 | SELF_KW@18..22 "self" | 22 | NAME@18..22 |
23 | SELF_KW@18..22 "self" | ||
23 | COLON@22..23 ":" | 24 | COLON@22..23 ":" |
24 | WHITESPACE@23..24 " " | 25 | WHITESPACE@23..24 " " |
25 | REF_TYPE@24..29 | 26 | REF_TYPE@24..29 |
@@ -45,7 +46,8 @@ SOURCE_FILE@0..69 | |||
45 | SELF_PARAM@43..62 | 46 | SELF_PARAM@43..62 |
46 | MUT_KW@43..46 "mut" | 47 | MUT_KW@43..46 "mut" |
47 | WHITESPACE@46..47 " " | 48 | WHITESPACE@46..47 " " |
48 | SELF_KW@47..51 "self" | 49 | NAME@47..51 |
50 | SELF_KW@47..51 "self" | ||
49 | COLON@51..52 ":" | 51 | COLON@51..52 ":" |
50 | WHITESPACE@52..53 " " | 52 | WHITESPACE@52..53 " " |
51 | PATH_TYPE@53..62 | 53 | PATH_TYPE@53..62 |
diff --git a/crates/syntax/test_data/parser/inline/ok/0021_impl_item_list.rast b/crates/syntax/test_data/parser/inline/ok/0021_impl_item_list.rast index ca0702aba..dc7f6295b 100644 --- a/crates/syntax/test_data/parser/inline/ok/0021_impl_item_list.rast +++ b/crates/syntax/test_data/parser/inline/ok/0021_impl_item_list.rast | |||
@@ -67,7 +67,8 @@ SOURCE_FILE@0..89 | |||
67 | L_PAREN@76..77 "(" | 67 | L_PAREN@76..77 "(" |
68 | SELF_PARAM@77..82 | 68 | SELF_PARAM@77..82 |
69 | AMP@77..78 "&" | 69 | AMP@77..78 "&" |
70 | SELF_KW@78..82 "self" | 70 | NAME@78..82 |
71 | SELF_KW@78..82 "self" | ||
71 | R_PAREN@82..83 ")" | 72 | R_PAREN@82..83 ")" |
72 | WHITESPACE@83..84 " " | 73 | WHITESPACE@83..84 " " |
73 | BLOCK_EXPR@84..86 | 74 | BLOCK_EXPR@84..86 |
diff --git a/crates/syntax/test_data/parser/inline/ok/0022_crate_visibility.rast b/crates/syntax/test_data/parser/inline/ok/0022_crate_visibility.rast index 50742cbcf..f2ead8a62 100644 --- a/crates/syntax/test_data/parser/inline/ok/0022_crate_visibility.rast +++ b/crates/syntax/test_data/parser/inline/ok/0022_crate_visibility.rast | |||
@@ -1,9 +1,12 @@ | |||
1 | SOURCE_FILE@0..81 | 1 | SOURCE_FILE@0..62 |
2 | STRUCT@0..20 | 2 | STRUCT@0..20 |
3 | VISIBILITY@0..10 | 3 | VISIBILITY@0..10 |
4 | PUB_KW@0..3 "pub" | 4 | PUB_KW@0..3 "pub" |
5 | L_PAREN@3..4 "(" | 5 | L_PAREN@3..4 "(" |
6 | CRATE_KW@4..9 "crate" | 6 | PATH@4..9 |
7 | PATH_SEGMENT@4..9 | ||
8 | NAME_REF@4..9 | ||
9 | CRATE_KW@4..9 "crate" | ||
7 | R_PAREN@9..10 ")" | 10 | R_PAREN@9..10 ")" |
8 | WHITESPACE@10..11 " " | 11 | WHITESPACE@10..11 " " |
9 | STRUCT_KW@11..17 "struct" | 12 | STRUCT_KW@11..17 "struct" |
@@ -16,7 +19,10 @@ SOURCE_FILE@0..81 | |||
16 | VISIBILITY@21..30 | 19 | VISIBILITY@21..30 |
17 | PUB_KW@21..24 "pub" | 20 | PUB_KW@21..24 "pub" |
18 | L_PAREN@24..25 "(" | 21 | L_PAREN@24..25 "(" |
19 | SELF_KW@25..29 "self" | 22 | PATH@25..29 |
23 | PATH_SEGMENT@25..29 | ||
24 | NAME_REF@25..29 | ||
25 | SELF_KW@25..29 "self" | ||
20 | R_PAREN@29..30 ")" | 26 | R_PAREN@29..30 ")" |
21 | WHITESPACE@30..31 " " | 27 | WHITESPACE@30..31 " " |
22 | STRUCT_KW@31..37 "struct" | 28 | STRUCT_KW@31..37 "struct" |
@@ -25,29 +31,19 @@ SOURCE_FILE@0..81 | |||
25 | IDENT@38..39 "S" | 31 | IDENT@38..39 "S" |
26 | SEMICOLON@39..40 ";" | 32 | SEMICOLON@39..40 ";" |
27 | WHITESPACE@40..41 "\n" | 33 | WHITESPACE@40..41 "\n" |
28 | STRUCT@41..60 | 34 | STRUCT@41..61 |
29 | VISIBILITY@41..50 | 35 | VISIBILITY@41..51 |
30 | PUB_KW@41..44 "pub" | 36 | PUB_KW@41..44 "pub" |
31 | L_PAREN@44..45 "(" | 37 | L_PAREN@44..45 "(" |
32 | SELF_KW@45..49 "self" | 38 | PATH@45..50 |
33 | R_PAREN@49..50 ")" | 39 | PATH_SEGMENT@45..50 |
34 | WHITESPACE@50..51 " " | 40 | NAME_REF@45..50 |
35 | STRUCT_KW@51..57 "struct" | 41 | SUPER_KW@45..50 "super" |
36 | WHITESPACE@57..58 " " | 42 | R_PAREN@50..51 ")" |
37 | NAME@58..59 | 43 | WHITESPACE@51..52 " " |
38 | IDENT@58..59 "S" | 44 | STRUCT_KW@52..58 "struct" |
39 | SEMICOLON@59..60 ";" | 45 | WHITESPACE@58..59 " " |
40 | WHITESPACE@60..61 "\n" | 46 | NAME@59..60 |
41 | STRUCT@61..80 | 47 | IDENT@59..60 "S" |
42 | VISIBILITY@61..70 | 48 | SEMICOLON@60..61 ";" |
43 | PUB_KW@61..64 "pub" | 49 | WHITESPACE@61..62 "\n" |
44 | L_PAREN@64..65 "(" | ||
45 | SELF_KW@65..69 "self" | ||
46 | R_PAREN@69..70 ")" | ||
47 | WHITESPACE@70..71 " " | ||
48 | STRUCT_KW@71..77 "struct" | ||
49 | WHITESPACE@77..78 " " | ||
50 | NAME@78..79 | ||
51 | IDENT@78..79 "S" | ||
52 | SEMICOLON@79..80 ";" | ||
53 | WHITESPACE@80..81 "\n" | ||
diff --git a/crates/syntax/test_data/parser/inline/ok/0022_crate_visibility.rs b/crates/syntax/test_data/parser/inline/ok/0022_crate_visibility.rs index faeefde94..a790a485f 100644 --- a/crates/syntax/test_data/parser/inline/ok/0022_crate_visibility.rs +++ b/crates/syntax/test_data/parser/inline/ok/0022_crate_visibility.rs | |||
@@ -1,4 +1,3 @@ | |||
1 | pub(crate) struct S; | 1 | pub(crate) struct S; |
2 | pub(self) struct S; | 2 | pub(self) struct S; |
3 | pub(self) struct S; | 3 | pub(super) struct S; |
4 | pub(self) struct S; | ||
diff --git a/crates/syntax/test_data/parser/inline/ok/0138_self_param_outer_attr.rast b/crates/syntax/test_data/parser/inline/ok/0138_self_param_outer_attr.rast index d3219f0b2..c54e64e3f 100644 --- a/crates/syntax/test_data/parser/inline/ok/0138_self_param_outer_attr.rast +++ b/crates/syntax/test_data/parser/inline/ok/0138_self_param_outer_attr.rast | |||
@@ -16,7 +16,8 @@ SOURCE_FILE@0..26 | |||
16 | IDENT@7..15 "must_use" | 16 | IDENT@7..15 "must_use" |
17 | R_BRACK@15..16 "]" | 17 | R_BRACK@15..16 "]" |
18 | WHITESPACE@16..17 " " | 18 | WHITESPACE@16..17 " " |
19 | SELF_KW@17..21 "self" | 19 | NAME@17..21 |
20 | SELF_KW@17..21 "self" | ||
20 | R_PAREN@21..22 ")" | 21 | R_PAREN@21..22 ")" |
21 | WHITESPACE@22..23 " " | 22 | WHITESPACE@22..23 " " |
22 | BLOCK_EXPR@23..25 | 23 | BLOCK_EXPR@23..25 |
diff --git a/crates/syntax/test_data/parser/inline/ok/0160_crate_visibility_in.rast b/crates/syntax/test_data/parser/inline/ok/0160_crate_visibility_in.rast new file mode 100644 index 000000000..3d855fc6b --- /dev/null +++ b/crates/syntax/test_data/parser/inline/ok/0160_crate_visibility_in.rast | |||
@@ -0,0 +1,42 @@ | |||
1 | SOURCE_FILE@0..51 | ||
2 | STRUCT@0..26 | ||
3 | VISIBILITY@0..16 | ||
4 | PUB_KW@0..3 "pub" | ||
5 | L_PAREN@3..4 "(" | ||
6 | IN_KW@4..6 "in" | ||
7 | WHITESPACE@6..7 " " | ||
8 | PATH@7..15 | ||
9 | PATH@7..12 | ||
10 | PATH_SEGMENT@7..12 | ||
11 | NAME_REF@7..12 | ||
12 | SUPER_KW@7..12 "super" | ||
13 | COLON2@12..14 "::" | ||
14 | PATH_SEGMENT@14..15 | ||
15 | NAME_REF@14..15 | ||
16 | IDENT@14..15 "A" | ||
17 | R_PAREN@15..16 ")" | ||
18 | WHITESPACE@16..17 " " | ||
19 | STRUCT_KW@17..23 "struct" | ||
20 | WHITESPACE@23..24 " " | ||
21 | NAME@24..25 | ||
22 | IDENT@24..25 "S" | ||
23 | SEMICOLON@25..26 ";" | ||
24 | WHITESPACE@26..27 "\n" | ||
25 | STRUCT@27..50 | ||
26 | VISIBILITY@27..40 | ||
27 | PUB_KW@27..30 "pub" | ||
28 | L_PAREN@30..31 "(" | ||
29 | IN_KW@31..33 "in" | ||
30 | WHITESPACE@33..34 " " | ||
31 | PATH@34..39 | ||
32 | PATH_SEGMENT@34..39 | ||
33 | NAME_REF@34..39 | ||
34 | CRATE_KW@34..39 "crate" | ||
35 | R_PAREN@39..40 ")" | ||
36 | WHITESPACE@40..41 " " | ||
37 | STRUCT_KW@41..47 "struct" | ||
38 | WHITESPACE@47..48 " " | ||
39 | NAME@48..49 | ||
40 | IDENT@48..49 "S" | ||
41 | SEMICOLON@49..50 ";" | ||
42 | WHITESPACE@50..51 "\n" | ||
diff --git a/crates/syntax/test_data/parser/inline/ok/0160_crate_visibility_in.rs b/crates/syntax/test_data/parser/inline/ok/0160_crate_visibility_in.rs new file mode 100644 index 000000000..2856dbd84 --- /dev/null +++ b/crates/syntax/test_data/parser/inline/ok/0160_crate_visibility_in.rs | |||
@@ -0,0 +1,2 @@ | |||
1 | pub(in super::A) struct S; | ||
2 | pub(in crate) struct S; | ||
diff --git a/crates/syntax/test_data/parser/ok/0007_extern_crate.rast b/crates/syntax/test_data/parser/ok/0007_extern_crate.rast index 594c2f8f2..4babdba92 100644 --- a/crates/syntax/test_data/parser/ok/0007_extern_crate.rast +++ b/crates/syntax/test_data/parser/ok/0007_extern_crate.rast | |||
@@ -28,7 +28,8 @@ SOURCE_FILE@0..69 | |||
28 | WHITESPACE@49..50 " " | 28 | WHITESPACE@49..50 " " |
29 | CRATE_KW@50..55 "crate" | 29 | CRATE_KW@50..55 "crate" |
30 | WHITESPACE@55..56 " " | 30 | WHITESPACE@55..56 " " |
31 | SELF_KW@56..60 "self" | 31 | NAME_REF@56..60 |
32 | SELF_KW@56..60 "self" | ||
32 | WHITESPACE@60..61 " " | 33 | WHITESPACE@60..61 " " |
33 | RENAME@61..67 | 34 | RENAME@61..67 |
34 | AS_KW@61..63 "as" | 35 | AS_KW@61..63 "as" |
diff --git a/crates/syntax/test_data/parser/ok/0012_visibility.rast b/crates/syntax/test_data/parser/ok/0012_visibility.rast index 83a93b5a9..c5dbfb702 100644 --- a/crates/syntax/test_data/parser/ok/0012_visibility.rast +++ b/crates/syntax/test_data/parser/ok/0012_visibility.rast | |||
@@ -32,7 +32,10 @@ SOURCE_FILE@0..98 | |||
32 | VISIBILITY@24..34 | 32 | VISIBILITY@24..34 |
33 | PUB_KW@24..27 "pub" | 33 | PUB_KW@24..27 "pub" |
34 | L_PAREN@27..28 "(" | 34 | L_PAREN@27..28 "(" |
35 | CRATE_KW@28..33 "crate" | 35 | PATH@28..33 |
36 | PATH_SEGMENT@28..33 | ||
37 | NAME_REF@28..33 | ||
38 | CRATE_KW@28..33 "crate" | ||
36 | R_PAREN@33..34 ")" | 39 | R_PAREN@33..34 ")" |
37 | WHITESPACE@34..35 " " | 40 | WHITESPACE@34..35 " " |
38 | FN_KW@35..37 "fn" | 41 | FN_KW@35..37 "fn" |
@@ -51,7 +54,10 @@ SOURCE_FILE@0..98 | |||
51 | VISIBILITY@45..55 | 54 | VISIBILITY@45..55 |
52 | PUB_KW@45..48 "pub" | 55 | PUB_KW@45..48 "pub" |
53 | L_PAREN@48..49 "(" | 56 | L_PAREN@48..49 "(" |
54 | SUPER_KW@49..54 "super" | 57 | PATH@49..54 |
58 | PATH_SEGMENT@49..54 | ||
59 | NAME_REF@49..54 | ||
60 | SUPER_KW@49..54 "super" | ||
55 | R_PAREN@54..55 ")" | 61 | R_PAREN@54..55 ")" |
56 | WHITESPACE@55..56 " " | 62 | WHITESPACE@55..56 " " |
57 | FN_KW@56..58 "fn" | 63 | FN_KW@56..58 "fn" |
diff --git a/crates/syntax/test_data/parser/ok/0045_block_inner_attrs.rast b/crates/syntax/test_data/parser/ok/0045_block_inner_attrs.rast index 0ac56df6d..6afed5f05 100644 --- a/crates/syntax/test_data/parser/ok/0045_block_inner_attrs.rast +++ b/crates/syntax/test_data/parser/ok/0045_block_inner_attrs.rast | |||
@@ -110,7 +110,8 @@ SOURCE_FILE@0..686 | |||
110 | L_PAREN@558..559 "(" | 110 | L_PAREN@558..559 "(" |
111 | SELF_PARAM@559..564 | 111 | SELF_PARAM@559..564 |
112 | AMP@559..560 "&" | 112 | AMP@559..560 "&" |
113 | SELF_KW@560..564 "self" | 113 | NAME@560..564 |
114 | SELF_KW@560..564 "self" | ||
114 | COMMA@564..565 "," | 115 | COMMA@564..565 "," |
115 | WHITESPACE@565..566 " " | 116 | WHITESPACE@565..566 " " |
116 | PARAM@566..600 | 117 | PARAM@566..600 |
diff --git a/crates/syntax/test_data/parser/ok/0051_parameter_attrs.rast b/crates/syntax/test_data/parser/ok/0051_parameter_attrs.rast index 3fed11838..e10521d85 100644 --- a/crates/syntax/test_data/parser/ok/0051_parameter_attrs.rast +++ b/crates/syntax/test_data/parser/ok/0051_parameter_attrs.rast | |||
@@ -281,7 +281,8 @@ SOURCE_FILE@0..519 | |||
281 | IDENT@259..267 "must_use" | 281 | IDENT@259..267 "must_use" |
282 | R_BRACK@267..268 "]" | 282 | R_BRACK@267..268 "]" |
283 | WHITESPACE@268..269 " " | 283 | WHITESPACE@268..269 " " |
284 | SELF_KW@269..273 "self" | 284 | NAME@269..273 |
285 | SELF_KW@269..273 "self" | ||
285 | R_PAREN@273..274 ")" | 286 | R_PAREN@273..274 ")" |
286 | WHITESPACE@274..275 " " | 287 | WHITESPACE@274..275 " " |
287 | BLOCK_EXPR@275..277 | 288 | BLOCK_EXPR@275..277 |
@@ -305,7 +306,8 @@ SOURCE_FILE@0..519 | |||
305 | IDENT@291..295 "attr" | 306 | IDENT@291..295 "attr" |
306 | R_BRACK@295..296 "]" | 307 | R_BRACK@295..296 "]" |
307 | WHITESPACE@296..297 " " | 308 | WHITESPACE@296..297 " " |
308 | SELF_KW@297..301 "self" | 309 | NAME@297..301 |
310 | SELF_KW@297..301 "self" | ||
309 | R_PAREN@301..302 ")" | 311 | R_PAREN@301..302 ")" |
310 | WHITESPACE@302..303 " " | 312 | WHITESPACE@302..303 " " |
311 | BLOCK_EXPR@303..305 | 313 | BLOCK_EXPR@303..305 |
@@ -330,7 +332,8 @@ SOURCE_FILE@0..519 | |||
330 | R_BRACK@323..324 "]" | 332 | R_BRACK@323..324 "]" |
331 | WHITESPACE@324..325 " " | 333 | WHITESPACE@324..325 " " |
332 | AMP@325..326 "&" | 334 | AMP@325..326 "&" |
333 | SELF_KW@326..330 "self" | 335 | NAME@326..330 |
336 | SELF_KW@326..330 "self" | ||
334 | R_PAREN@330..331 ")" | 337 | R_PAREN@330..331 ")" |
335 | WHITESPACE@331..332 " " | 338 | WHITESPACE@331..332 " " |
336 | BLOCK_EXPR@332..334 | 339 | BLOCK_EXPR@332..334 |
@@ -363,7 +366,8 @@ SOURCE_FILE@0..519 | |||
363 | AMP@358..359 "&" | 366 | AMP@358..359 "&" |
364 | MUT_KW@359..362 "mut" | 367 | MUT_KW@359..362 "mut" |
365 | WHITESPACE@362..363 " " | 368 | WHITESPACE@362..363 " " |
366 | SELF_KW@363..367 "self" | 369 | NAME@363..367 |
370 | SELF_KW@363..367 "self" | ||
367 | R_PAREN@367..368 ")" | 371 | R_PAREN@367..368 ")" |
368 | WHITESPACE@368..369 " " | 372 | WHITESPACE@368..369 " " |
369 | BLOCK_EXPR@369..371 | 373 | BLOCK_EXPR@369..371 |
@@ -397,7 +401,8 @@ SOURCE_FILE@0..519 | |||
397 | LIFETIME@396..398 | 401 | LIFETIME@396..398 |
398 | LIFETIME_IDENT@396..398 "\'a" | 402 | LIFETIME_IDENT@396..398 "\'a" |
399 | WHITESPACE@398..399 " " | 403 | WHITESPACE@398..399 " " |
400 | SELF_KW@399..403 "self" | 404 | NAME@399..403 |
405 | SELF_KW@399..403 "self" | ||
401 | R_PAREN@403..404 ")" | 406 | R_PAREN@403..404 ")" |
402 | WHITESPACE@404..405 " " | 407 | WHITESPACE@404..405 " " |
403 | BLOCK_EXPR@405..407 | 408 | BLOCK_EXPR@405..407 |
@@ -433,7 +438,8 @@ SOURCE_FILE@0..519 | |||
433 | WHITESPACE@434..435 " " | 438 | WHITESPACE@434..435 " " |
434 | MUT_KW@435..438 "mut" | 439 | MUT_KW@435..438 "mut" |
435 | WHITESPACE@438..439 " " | 440 | WHITESPACE@438..439 " " |
436 | SELF_KW@439..443 "self" | 441 | NAME@439..443 |
442 | SELF_KW@439..443 "self" | ||
437 | R_PAREN@443..444 ")" | 443 | R_PAREN@443..444 ")" |
438 | WHITESPACE@444..445 " " | 444 | WHITESPACE@444..445 " " |
439 | BLOCK_EXPR@445..447 | 445 | BLOCK_EXPR@445..447 |
@@ -457,7 +463,8 @@ SOURCE_FILE@0..519 | |||
457 | IDENT@460..464 "attr" | 463 | IDENT@460..464 "attr" |
458 | R_BRACK@464..465 "]" | 464 | R_BRACK@464..465 "]" |
459 | WHITESPACE@465..466 " " | 465 | WHITESPACE@465..466 " " |
460 | SELF_KW@466..470 "self" | 466 | NAME@466..470 |
467 | SELF_KW@466..470 "self" | ||
461 | COLON@470..471 ":" | 468 | COLON@470..471 ":" |
462 | WHITESPACE@471..472 " " | 469 | WHITESPACE@471..472 " " |
463 | PATH_TYPE@472..476 | 470 | PATH_TYPE@472..476 |
@@ -488,7 +495,8 @@ SOURCE_FILE@0..519 | |||
488 | IDENT@493..497 "attr" | 495 | IDENT@493..497 "attr" |
489 | R_BRACK@497..498 "]" | 496 | R_BRACK@497..498 "]" |
490 | WHITESPACE@498..499 " " | 497 | WHITESPACE@498..499 " " |
491 | SELF_KW@499..503 "self" | 498 | NAME@499..503 |
499 | SELF_KW@499..503 "self" | ||
492 | COLON@503..504 ":" | 500 | COLON@503..504 ":" |
493 | WHITESPACE@504..505 " " | 501 | WHITESPACE@504..505 " " |
494 | PATH_TYPE@505..513 | 502 | PATH_TYPE@505..513 |