@@ -7022,7 +7022,7 @@ fn trans_anon_obj(@block_ctxt bcx, &span sp, &ast::anon_obj anon_obj,
7022
7022
// create_vtbl() with no "additional methods". What's happening
7023
7023
// is that, since *all* of the methods are "additional", we can
7024
7024
// get away with acting like none of them are.
7025
- vtbl = create_vtbl( bcx. fcx. lcx, llouter_obj_ty, outer_obj_ty,
7025
+ vtbl = create_vtbl( bcx. fcx. lcx, sp , llouter_obj_ty, outer_obj_ty,
7026
7026
wrapper_obj, ty_params, none,
7027
7027
additional_field_tys) ;
7028
7028
}
@@ -7045,7 +7045,7 @@ fn trans_anon_obj(@block_ctxt bcx, &span sp, &ast::anon_obj anon_obj,
7045
7045
// one with a matching name and type being added, we'll need to
7046
7046
// create a forwarding slot. And, of course, we need to create a
7047
7047
// normal vtable entry for every method being added.
7048
- vtbl = create_vtbl( bcx. fcx. lcx, llouter_obj_ty, outer_obj_ty,
7048
+ vtbl = create_vtbl( bcx. fcx. lcx, sp , llouter_obj_ty, outer_obj_ty,
7049
7049
wrapper_obj, ty_params,
7050
7050
some( with_obj_ty) ,
7051
7051
additional_field_tys) ;
@@ -7822,8 +7822,9 @@ fn trans_fn(@local_ctxt cx, &span sp, &ast::_fn f, ValueRef llfndecl,
7822
7822
// process_fwding_mthd: Create the forwarding function that appears in a
7823
7823
// vtable slot for method calls that "fall through" to an inner object. A
7824
7824
// helper function for create_vtbl.
7825
- fn process_fwding_mthd( @local_ctxt cx, @ty:: method m, TypeRef llself_ty,
7826
- ty:: t self_ty, & vec[ ast:: ty_param] ty_params,
7825
+ fn process_fwding_mthd( @local_ctxt cx, & span sp, @ty:: method m,
7826
+ TypeRef llself_ty, ty:: t self_ty,
7827
+ & vec[ ast:: ty_param] ty_params,
7827
7828
ty:: t with_obj_ty,
7828
7829
ty:: t[ ] additional_field_tys) -> ValueRef {
7829
7830
@@ -7840,11 +7841,6 @@ fn process_fwding_mthd(@local_ctxt cx, @ty::method m, TypeRef llself_ty,
7840
7841
// on. That object won't exist until run-time, but we know its type
7841
7842
// statically.
7842
7843
7843
- // Create a fake span for functions that expect it. Shouldn't matter what
7844
- // it is, since this isn't user-written code. (Possibly better: have
7845
- // create_vtable take a span argument and pass it in here?)
7846
- let span fake_span = rec( lo=0 u, hi=0 u) ;
7847
-
7848
7844
// Create a local context that's aware of the name of the method we're
7849
7845
// creating.
7850
7846
let @local_ctxt mcx =
@@ -7857,15 +7853,15 @@ fn process_fwding_mthd(@local_ctxt cx, @ty::method m, TypeRef llself_ty,
7857
7853
// Get the forwarding function's type and declare it.
7858
7854
let TypeRef llforwarding_fn_ty =
7859
7855
type_of_fn_full(
7860
- cx. ccx, fake_span , m. proto,
7856
+ cx. ccx, sp , m. proto,
7861
7857
some[ TypeRef ] ( llself_ty) , m. inputs, m. output,
7862
7858
vec:: len[ ast:: ty_param] ( ty_params) ) ;
7863
7859
let ValueRef llforwarding_fn =
7864
7860
decl_internal_fastcall_fn( cx. ccx. llmod, s, llforwarding_fn_ty) ;
7865
7861
7866
7862
// Create a new function context and block context for the forwarding
7867
7863
// function, holding onto a pointer to the first block.
7868
- auto fcx = new_fn_ctxt( cx, fake_span , llforwarding_fn) ;
7864
+ auto fcx = new_fn_ctxt( cx, sp , llforwarding_fn) ;
7869
7865
auto bcx = new_top_block_ctxt( fcx) ;
7870
7866
auto lltop = bcx. llbb;
7871
7867
@@ -7926,8 +7922,7 @@ fn process_fwding_mthd(@local_ctxt cx, @ty::method m, TypeRef llself_ty,
7926
7922
7927
7923
// And cast to that type.
7928
7924
llself_obj_body = bcx. build. PointerCast ( llself_obj_body,
7929
- T_ptr ( type_of( cx. ccx,
7930
- fake_span,
7925
+ T_ptr ( type_of( cx. ccx, sp,
7931
7926
body_ty) ) ) ;
7932
7927
7933
7928
// Now, reach into the body and grab the with_obj.
@@ -7950,7 +7945,7 @@ fn process_fwding_mthd(@local_ctxt cx, @ty::method m, TypeRef llself_ty,
7950
7945
let uint ix = 0 u;
7951
7946
alt ( ty:: struct ( bcx. fcx. lcx. ccx. tcx, with_obj_ty) ) {
7952
7947
case ( ty:: ty_obj( ?methods) ) {
7953
- ix = ty:: method_idx( cx. ccx. sess, fake_span , m. ident, methods) ;
7948
+ ix = ty:: method_idx( cx. ccx. sess, sp , m. ident, methods) ;
7954
7949
}
7955
7950
case ( _) {
7956
7951
// Shouldn't happen.
@@ -7968,7 +7963,7 @@ fn process_fwding_mthd(@local_ctxt cx, @ty::method m, TypeRef llself_ty,
7968
7963
auto orig_mthd_ty = ty:: method_ty_to_fn_ty( cx. ccx. tcx, * m) ;
7969
7964
auto llwith_obj_ty = val_ty( llwith_obj. val) ;
7970
7965
auto llorig_mthd_ty =
7971
- type_of_fn_full( bcx. fcx. lcx. ccx, fake_span ,
7966
+ type_of_fn_full( bcx. fcx. lcx. ccx, sp ,
7972
7967
ty:: ty_fn_proto( bcx. fcx. lcx. ccx. tcx, orig_mthd_ty) ,
7973
7968
some[ TypeRef ] ( llwith_obj_ty) ,
7974
7969
m. inputs,
@@ -8042,7 +8037,7 @@ fn process_normal_mthd(@local_ctxt cx, @ast::method m, TypeRef llself_ty,
8042
8037
8043
8038
// Create a vtable for an object being translated. Returns a pointer into
8044
8039
// read-only memory.
8045
- fn create_vtbl( @local_ctxt cx, TypeRef llself_ty, ty:: t self_ty,
8040
+ fn create_vtbl( @local_ctxt cx, & span sp , TypeRef llself_ty, ty:: t self_ty,
8046
8041
& ast:: _obj ob, & vec[ ast:: ty_param] ty_params,
8047
8042
option:: t[ ty:: t] with_obj_ty,
8048
8043
ty:: t[ ] additional_field_tys) -> ValueRef {
@@ -8187,7 +8182,7 @@ fn create_vtbl(@local_ctxt cx, TypeRef llself_ty, ty::t self_ty,
8187
8182
}
8188
8183
case ( some( ?t) ) {
8189
8184
llmethods += [ process_fwding_mthd(
8190
- cx, fm, llself_ty,
8185
+ cx, sp , fm, llself_ty,
8191
8186
self_ty, ty_params,
8192
8187
t,
8193
8188
additional_field_tys) ] ;
@@ -8285,7 +8280,8 @@ fn trans_obj(@local_ctxt cx, &span sp, &ast::_obj ob, ast::node_id ctor_id,
8285
8280
// It will be located in the read-only memory of the executable we're
8286
8281
// creating and will contain ValueRefs for all of this object's methods.
8287
8282
// create_vtbl returns a pointer to the vtable, which we store.
8288
- auto vtbl = create_vtbl( cx, llself_ty, self_ty, ob, ty_params, none, ~[ ] ) ;
8283
+ auto vtbl = create_vtbl( cx, sp, llself_ty, self_ty, ob, ty_params, none,
8284
+ ~[ ] ) ;
8289
8285
8290
8286
bcx. build. Store ( vtbl, pair_vtbl) ;
8291
8287
0 commit comments