1208: [WIP] Goto for Macro's r=matklad a=Lapz

Adds goto definition for macros. Currently only works for macros in the current crate ~~otherwise it panics~~. Proper macro resolution needs to be added for it to resolve macros in other crates.

Todo
- [X] Allow goto from macro calls
- [X] Fix panics
- [x] Add tests



![Screen Recording 2019-04-25 at 18 00 24](https://user-images.githubusercontent.com/19998186/56754499-1dd01c00-6785-11e9-9e9a-1e36de70cfa3.gif)



Co-authored-by: Lenard Pratt <l3np27@gmail.com>
This commit is contained in:
bors[bot]
2019-05-04 18:38:10 +00:00
9 changed files with 97 additions and 6 deletions

View File

@@ -1761,6 +1761,7 @@ impl ToOwned for MacroCall {
impl ast::NameOwner for MacroCall {}
impl ast::AttrsOwner for MacroCall {}
impl ast::DocCommentsOwner for MacroCall {}
impl MacroCall {
pub fn token_tree(&self) -> Option<&TokenTree> {
super::child_opt(self)

View File

@@ -552,7 +552,7 @@ Grammar(
"Name": (),
"NameRef": (),
"MacroCall": (
traits: [ "NameOwner", "AttrsOwner" ],
traits: [ "NameOwner", "AttrsOwner","DocCommentsOwner" ],
options: [ "TokenTree", "Path" ],
),
"Attr": ( options: [ ["value", "TokenTree"] ] ),