@@ -19,7 +19,7 @@ use syntax::ast;
1919use syntax:: errors:: DiagnosticBuilder ;
2020use syntax:: ext:: base:: { self , Determinacy , MultiModifier , MultiDecorator , MultiItemModifier } ;
2121use syntax:: ext:: base:: { NormalTT , SyntaxExtension } ;
22- use syntax:: ext:: expand:: { Expansion , Invocation , InvocationKind } ;
22+ use syntax:: ext:: expand:: Expansion ;
2323use syntax:: ext:: hygiene:: Mark ;
2424use syntax:: ext:: tt:: macro_rules;
2525use syntax:: parse:: token:: intern;
@@ -162,30 +162,22 @@ impl<'a> base::Resolver for Resolver<'a> {
162162 None
163163 }
164164
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 )
166166 -> 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 ;
180172
181173 let invocation = self . invocations [ & scope] ;
182174 if let LegacyScope :: Expansion ( parent) = invocation. legacy_scope . get ( ) {
183175 invocation. legacy_scope . set ( LegacyScope :: simplify_expansion ( parent) ) ;
184176 }
185177 self . resolve_macro_name ( invocation. legacy_scope . get ( ) , name, true ) . ok_or_else ( || {
186178 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 ) ;
189181 self . suggest_macro_name ( & name. as_str ( ) , & mut err) ;
190182 err. emit ( ) ;
191183 Determinacy :: Determined
0 commit comments