-
Notifications
You must be signed in to change notification settings - Fork 1.9k
feat: Implement attribute input token mapping, fix attribute item token mapping #9970
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -223,7 +223,7 @@ fn parse_macro_expansion( | |
| Ok(it) => it, | ||
| Err(err) => { | ||
| log::debug!( | ||
| "failed to parse expanstion to {:?} = {}", | ||
| "failed to parse expansion to {:?} = {}", | ||
| fragment_kind, | ||
| tt.as_debug_string() | ||
| ); | ||
|
|
@@ -386,11 +386,15 @@ fn expand_proc_macro(db: &dyn AstDatabase, id: MacroCallId) -> ExpandResult<tt:: | |
| }; | ||
|
|
||
| let attr_arg = match &loc.kind { | ||
| MacroCallKind::Attr { attr_args, .. } => Some(attr_args), | ||
| MacroCallKind::Attr { attr_args, .. } => { | ||
| let mut attr_args = attr_args.0.clone(); | ||
| mbe::Shift::new(¯o_arg.0).shift_all(&mut attr_args); | ||
|
Member
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This creates a new shift instance on every expansion, is this fine? If not we can either have the I'm unsure which approach is best of the three(the current one and the two proposed ones) but I believe turning the shifting around and storing in |
||
| Some(attr_args) | ||
| } | ||
| _ => None, | ||
| }; | ||
|
|
||
| expander.expand(db, loc.krate, ¯o_arg.0, attr_arg) | ||
| expander.expand(db, loc.krate, ¯o_arg.0, attr_arg.as_ref()) | ||
| } | ||
|
|
||
| fn is_self_replicating(from: &SyntaxNode, to: &SyntaxNode) -> bool { | ||
|
|
||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yeah, it seems like we need to add TokenMap here, this is a fundamentally missing info.