From fcca35969dd7c63a83ee34c4ce7d54cefdb72bbe Mon Sep 17 00:00:00 2001 From: Aleksey Kladov Date: Sat, 23 Mar 2019 16:28:47 +0300 Subject: allow dyn diagnostics --- crates/ra_syntax/src/ptr.rs | 6 ++++++ 1 file changed, 6 insertions(+) (limited to 'crates/ra_syntax') diff --git a/crates/ra_syntax/src/ptr.rs b/crates/ra_syntax/src/ptr.rs index aae590cb6..d8de1c4c1 100644 --- a/crates/ra_syntax/src/ptr.rs +++ b/crates/ra_syntax/src/ptr.rs @@ -64,6 +64,12 @@ impl AstPtr { } } +impl From> for SyntaxNodePtr { + fn from(ptr: AstPtr) -> SyntaxNodePtr { + ptr.raw + } +} + #[test] fn test_local_syntax_ptr() { use crate::{ast, AstNode}; -- cgit v1.2.3 From c947c15ce1ec02261803f10568e4659e9396109e Mon Sep 17 00:00:00 2001 From: Florian Diebold Date: Sun, 24 Mar 2019 17:36:15 +0100 Subject: Basics for trait method resolution --- crates/ra_syntax/src/ast/generated.rs | 6 +++++- crates/ra_syntax/src/grammar.ron | 5 ++++- 2 files changed, 9 insertions(+), 2 deletions(-) (limited to 'crates/ra_syntax') 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 {} impl ast::AttrsOwner for TraitDef {} impl ast::DocCommentsOwner for TraitDef {} impl ast::TypeParamsOwner for TraitDef {} -impl TraitDef {} +impl TraitDef { + pub fn item_list(&self) -> Option<&ItemList> { + super::child_opt(self) + } +} // TrueKw #[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( ], options: [["variant_list", "EnumVariantList"]] ), "EnumVariantList": ( collections: [["variants", "EnumVariant"]] ), "EnumVariant": ( traits: ["NameOwner", "DocCommentsOwner", "AttrsOwner"], options: ["Expr"] ), - "TraitDef": ( traits: ["VisibilityOwner", "NameOwner", "AttrsOwner", "DocCommentsOwner", "TypeParamsOwner"] ), + "TraitDef": ( + traits: ["VisibilityOwner", "NameOwner", "AttrsOwner", "DocCommentsOwner", "TypeParamsOwner"], + options: ["ItemList"] + ), "Module": ( traits: ["VisibilityOwner", "NameOwner", "AttrsOwner", "DocCommentsOwner" ], options: [ "ItemList" ] -- cgit v1.2.3 From 7a06282d71d41508f30a9b7513eecfba998b9aa9 Mon Sep 17 00:00:00 2001 From: memoryruins Date: Thu, 28 Mar 2019 12:15:44 -0400 Subject: Add tests to ra_syntax for extern_crate_self --- .../ra_syntax/tests/data/parser/ok/0007_extern_crate.rs | 1 + .../tests/data/parser/ok/0007_extern_crate.txt | 17 ++++++++++++++++- 2 files changed, 17 insertions(+), 1 deletion(-) (limited to 'crates/ra_syntax') diff --git a/crates/ra_syntax/tests/data/parser/ok/0007_extern_crate.rs b/crates/ra_syntax/tests/data/parser/ok/0007_extern_crate.rs index 3ce336676..ab81a608c 100644 --- a/crates/ra_syntax/tests/data/parser/ok/0007_extern_crate.rs +++ b/crates/ra_syntax/tests/data/parser/ok/0007_extern_crate.rs @@ -1,2 +1,3 @@ extern crate foo; extern crate foo as bar; +extern crate self as baz; diff --git a/crates/ra_syntax/tests/data/parser/ok/0007_extern_crate.txt b/crates/ra_syntax/tests/data/parser/ok/0007_extern_crate.txt index 5558d952e..0176260c1 100644 --- a/crates/ra_syntax/tests/data/parser/ok/0007_extern_crate.txt +++ b/crates/ra_syntax/tests/data/parser/ok/0007_extern_crate.txt @@ -1,4 +1,4 @@ -SOURCE_FILE@[0; 43) +SOURCE_FILE@[0; 69) EXTERN_CRATE_ITEM@[0; 17) EXTERN_KW@[0; 6) WHITESPACE@[6; 7) @@ -23,3 +23,18 @@ SOURCE_FILE@[0; 43) IDENT@[38; 41) "bar" SEMI@[41; 42) WHITESPACE@[42; 43) + EXTERN_CRATE_ITEM@[43; 68) + EXTERN_KW@[43; 49) + WHITESPACE@[49; 50) + CRATE_KW@[50; 55) + WHITESPACE@[55; 56) + SELF_KW@[56; 60) + SELF_KW@[56; 60) + WHITESPACE@[60; 61) + ALIAS@[61; 67) + AS_KW@[61; 63) + WHITESPACE@[63; 64) + NAME@[64; 67) + IDENT@[64; 67) "baz" + SEMI@[67; 68) + WHITESPACE@[68; 69) -- cgit v1.2.3