@@ -19,7 +19,7 @@ use syntax::ast;
19
19
use syntax:: errors:: DiagnosticBuilder ;
20
20
use syntax:: ext:: base:: { self , Determinacy , MultiModifier , MultiDecorator , MultiItemModifier } ;
21
21
use syntax:: ext:: base:: { NormalTT , SyntaxExtension } ;
22
- use syntax:: ext:: expand:: { Expansion , Invocation , InvocationKind } ;
22
+ use syntax:: ext:: expand:: Expansion ;
23
23
use syntax:: ext:: hygiene:: Mark ;
24
24
use syntax:: ext:: tt:: macro_rules;
25
25
use syntax:: parse:: token:: intern;
@@ -162,30 +162,22 @@ impl<'a> base::Resolver for Resolver<'a> {
162
162
None
163
163
}
164
164
165
- fn resolve_invoc ( & mut self , scope : Mark , invoc : & Invocation , force : bool )
165
+ fn resolve_macro ( & mut self , scope : Mark , path : & ast :: Path , force : bool )
166
166
-> Result < Rc < SyntaxExtension > , Determinacy > {
167
- let ( name, span) = match invoc. kind {
168
- InvocationKind :: Bang { ref mac, .. } => {
169
- let path = & mac. node . path ;
170
- if path. segments . len ( ) > 1 || path. global ||
171
- !path. segments [ 0 ] . parameters . is_empty ( ) {
172
- self . session . span_err ( path. span ,
173
- "expected macro name without module separators" ) ;
174
- return Err ( Determinacy :: Determined ) ;
175
- }
176
- ( path. segments [ 0 ] . identifier . name , path. span )
177
- }
178
- InvocationKind :: Attr { ref attr, .. } => ( intern ( & * attr. name ( ) ) , attr. span ) ,
179
- } ;
167
+ if path. segments . len ( ) > 1 || path. global || !path. segments [ 0 ] . parameters . is_empty ( ) {
168
+ self . session . span_err ( path. span , "expected macro name without module separators" ) ;
169
+ return Err ( Determinacy :: Determined ) ;
170
+ }
171
+ let name = path. segments [ 0 ] . identifier . name ;
180
172
181
173
let invocation = self . invocations [ & scope] ;
182
174
if let LegacyScope :: Expansion ( parent) = invocation. legacy_scope . get ( ) {
183
175
invocation. legacy_scope . set ( LegacyScope :: simplify_expansion ( parent) ) ;
184
176
}
185
177
self . resolve_macro_name ( invocation. legacy_scope . get ( ) , name, true ) . ok_or_else ( || {
186
178
if force {
187
- let mut err =
188
- self . session . struct_span_err ( span, & format ! ( "macro undefined: '{}!'" , name ) ) ;
179
+ let msg = format ! ( "macro undefined: '{}!'" , name ) ;
180
+ let mut err = self . session . struct_span_err ( path . span , & msg ) ;
189
181
self . suggest_macro_name ( & name. as_str ( ) , & mut err) ;
190
182
err. emit ( ) ;
191
183
Determinacy :: Determined
0 commit comments