@@ -336,7 +336,7 @@ fn resolve_names(e: @env, c: @ast::crate) {
336336 visit_expr: bind walk_expr ( e, _, _, _) ,
337337 visit_ty: bind walk_ty ( e, _, _, _) ,
338338 visit_constr: bind walk_constr ( e, _, _, _, _, _) ,
339- visit_fn: bind visit_fn_with_scope ( e, _, _, _, _, _, _, _, _ )
339+ visit_fn: bind visit_fn_with_scope ( e, _, _, _, _, _, _, _)
340340 with * visit:: default_visitor ( ) } ;
341341 visit:: visit_crate ( * c, cons ( scope_crate, @nil) , visit:: mk_vt ( v) ) ;
342342 e. used_imports . track = false ;
@@ -350,7 +350,7 @@ fn resolve_names(e: @env, c: @ast::crate) {
350350 lookup_path_strict ( * e, sc, exp. span , p. node ,
351351 ns_value) ) ;
352352 }
353- ast:: expr_fn ( _, _, cap_clause) {
353+ ast:: expr_fn ( _, _, _ , cap_clause) {
354354 let rci = bind resolve_capture_item ( e, sc, _) ;
355355 vec:: iter ( cap_clause. copies , rci) ;
356356 vec:: iter ( cap_clause. moves , rci) ;
@@ -403,8 +403,9 @@ fn visit_item_with_scope(i: @ast::item, sc: scopes, v: vt<scopes>) {
403403 alt ifce { some( ty) { v. visit_ty ( ty, sc, v) ; } _ { } }
404404 v. visit_ty ( sty, sc, v) ;
405405 for m in methods {
406- v. visit_fn ( m. decl , tps + m. tps , m. body , m. span ,
407- some ( m. ident ) , m. id , sc, v) ;
406+ v. visit_fn ( visit:: fk_method ( m. ident , tps + m. tps ) ,
407+ m. decl , m. body , m. span ,
408+ m. id , sc, v) ;
408409 }
409410 }
410411 _ { visit : : visit_item ( i, sc, v) ; }
@@ -416,30 +417,35 @@ fn visit_native_item_with_scope(ni: @ast::native_item, sc: scopes,
416417 visit:: visit_native_item ( ni, cons ( scope_native_item ( ni) , @sc) , v) ;
417418}
418419
419- fn visit_fn_with_scope ( e : @env , decl : ast :: fn_decl , tp : [ ast:: ty_param ] ,
420- body : ast:: blk , sp : span , name : fn_ident ,
420+ fn visit_fn_with_scope ( e : @env , fk : visit :: fn_kind , decl : ast:: fn_decl ,
421+ body : ast:: blk , sp : span ,
421422 id : node_id , sc : scopes , v : vt < scopes > ) {
422423 // is this a main fn declaration?
423- alt name {
424- some ( nm) {
424+ alt fk {
425+ visit : : fk_item_fn ( nm, _ ) {
425426 if is_main_name ( [ nm] ) && !e. sess . building_library ( ) {
426427 // This is a main function -- set it in the session
427428 // as the main ID
428429 e. sess . set_main_id ( id) ;
429430 }
430431 }
431- _ { }
432+ _ { /* fallthrough */ }
432433 }
433434
434435 // here's where we need to set up the mapping
435436 // for f's constrs in the table.
436437 for c: @ast:: constr in decl. constraints { resolve_constr ( e, c, sc, v) ; }
437- let scope = alt decl. proto {
438- ast:: proto_bare. { scope_bare_fn ( decl, id, tp) }
439- _ { scope_fn_expr( decl, id, tp) }
438+ let scope = alt fk {
439+ visit : : fk_item_fn ( _, tps) | visit:: fk_method ( _, tps) |
440+ visit:: fk_res ( _, tps) {
441+ scope_bare_fn ( decl, id, tps)
442+ }
443+ visit:: fk_anon ( _) | visit:: fk_fn_block. {
444+ scope_fn_expr ( decl, id, [ ] )
445+ }
440446 } ;
441447
442- visit:: visit_fn ( decl , tp , body, sp, name , id, cons ( scope, @sc) , v) ;
448+ visit:: visit_fn ( fk , decl , body, sp, id, cons ( scope, @sc) , v) ;
443449}
444450
445451fn visit_block_with_scope ( b : ast:: blk , sc : scopes , v : vt < scopes > ) {
0 commit comments