diff options
author | bors[bot] <bors[bot]@users.noreply.github.com> | 2019-03-25 21:00:16 +0000 |
---|---|---|
committer | bors[bot] <bors[bot]@users.noreply.github.com> | 2019-03-25 21:00:16 +0000 |
commit | dc94f3612583c5e960b334761ad0c18d328840ea (patch) | |
tree | c79204bca4912574614eafff8f9e18775d5aa963 /crates/ra_syntax | |
parent | bb77bc5c2f6c6b9681d9b3d0a068791db7eec0e2 (diff) | |
parent | 99711c1863fc712dc14ca61809055b283415acbe (diff) |
Merge #1040
1040: Trait beginnings r=matklad a=flodiebold
This adds some very simple trait method resolution, going through traits in scope, looking for methods of the given name, and checking very naively whether there's an impl for the given type and trait.
Co-authored-by: Florian Diebold <[email protected]>
Diffstat (limited to 'crates/ra_syntax')
-rw-r--r-- | crates/ra_syntax/src/ast/generated.rs | 6 | ||||
-rw-r--r-- | crates/ra_syntax/src/grammar.ron | 5 |
2 files changed, 9 insertions, 2 deletions
diff --git a/crates/ra_syntax/src/ast/generated.rs b/crates/ra_syntax/src/ast/generated.rs index 54b72f8c5..47a37e4d1 100644 --- a/crates/ra_syntax/src/ast/generated.rs +++ b/crates/ra_syntax/src/ast/generated.rs | |||
@@ -4061,7 +4061,11 @@ impl ast::NameOwner for TraitDef {} | |||
4061 | impl ast::AttrsOwner for TraitDef {} | 4061 | impl ast::AttrsOwner for TraitDef {} |
4062 | impl ast::DocCommentsOwner for TraitDef {} | 4062 | impl ast::DocCommentsOwner for TraitDef {} |
4063 | impl ast::TypeParamsOwner for TraitDef {} | 4063 | impl ast::TypeParamsOwner for TraitDef {} |
4064 | impl TraitDef {} | 4064 | impl TraitDef { |
4065 | pub fn item_list(&self) -> Option<&ItemList> { | ||
4066 | super::child_opt(self) | ||
4067 | } | ||
4068 | } | ||
4065 | 4069 | ||
4066 | // TrueKw | 4070 | // TrueKw |
4067 | #[derive(Debug, PartialEq, Eq, Hash)] | 4071 | #[derive(Debug, PartialEq, Eq, Hash)] |
diff --git a/crates/ra_syntax/src/grammar.ron b/crates/ra_syntax/src/grammar.ron index 4f8e19bd0..ad6d74162 100644 --- a/crates/ra_syntax/src/grammar.ron +++ b/crates/ra_syntax/src/grammar.ron | |||
@@ -292,7 +292,10 @@ Grammar( | |||
292 | ], options: [["variant_list", "EnumVariantList"]] ), | 292 | ], options: [["variant_list", "EnumVariantList"]] ), |
293 | "EnumVariantList": ( collections: [["variants", "EnumVariant"]] ), | 293 | "EnumVariantList": ( collections: [["variants", "EnumVariant"]] ), |
294 | "EnumVariant": ( traits: ["NameOwner", "DocCommentsOwner", "AttrsOwner"], options: ["Expr"] ), | 294 | "EnumVariant": ( traits: ["NameOwner", "DocCommentsOwner", "AttrsOwner"], options: ["Expr"] ), |
295 | "TraitDef": ( traits: ["VisibilityOwner", "NameOwner", "AttrsOwner", "DocCommentsOwner", "TypeParamsOwner"] ), | 295 | "TraitDef": ( |
296 | traits: ["VisibilityOwner", "NameOwner", "AttrsOwner", "DocCommentsOwner", "TypeParamsOwner"], | ||
297 | options: ["ItemList"] | ||
298 | ), | ||
296 | "Module": ( | 299 | "Module": ( |
297 | traits: ["VisibilityOwner", "NameOwner", "AttrsOwner", "DocCommentsOwner" ], | 300 | traits: ["VisibilityOwner", "NameOwner", "AttrsOwner", "DocCommentsOwner" ], |
298 | options: [ "ItemList" ] | 301 | options: [ "ItemList" ] |