@@ -38,10 +38,14 @@ pub fn expand_expr(extsbox: @mut SyntaxEnv,
38
38
// entry-point for all syntax extensions.
39
39
expr_mac( ref mac) => {
40
40
match ( * mac) . node {
41
- // Token-tree macros, these will be the only case when we're
42
- // finished transitioning.
41
+ // Token-tree macros:
43
42
mac_invoc_tt( pth, ref tts) => {
44
- assert ( vec:: len ( pth. idents ) == 1 u) ;
43
+ if ( pth. idents . len ( ) > 1 u) {
44
+ cx. span_fatal (
45
+ pth. span ,
46
+ fmt ! ( "expected macro name without module \
47
+ separators, got: '%?'", pth) ) ;
48
+ }
45
49
/* using idents and token::special_idents would make the
46
50
the macro names be hygienic */
47
51
let extname = cx. parse_sess ( ) . interner . get ( pth. idents [ 0 ] ) ;
@@ -320,8 +324,12 @@ pub fn expand_stmt(extsbox: @mut SyntaxEnv,
320
324
}
321
325
_ => return orig(s, sp, fld)
322
326
};
323
-
324
- assert(vec::len(pth.idents) == 1u);
327
+ if (pth.idents.len() > 1u) {
328
+ cx.span_fatal(
329
+ pth.span,
330
+ fmt!(" expected macro name without module \
331
+ separators, got: ' %?' ", pth) ) ;
332
+ }
325
333
let extname = cx. parse_sess ( ) . interner . get ( pth. idents [ 0 ] ) ;
326
334
let ( fully_expanded, sp) = match ( * extsbox) . find ( & extname) {
327
335
None =>
0 commit comments