@@ -121,6 +121,10 @@ tag block_parent {
121
121
state type result = rec ( mutable @block_ctxt bcx,
122
122
mutable ValueRef val) ;
123
123
124
+ fn sep ( ) -> str {
125
+ ret "_" ;
126
+ }
127
+
124
128
fn res ( @block_ctxt bcx , ValueRef val) -> result {
125
129
ret rec ( mutable bcx = bcx,
126
130
mutable val = val) ;
@@ -1104,7 +1108,7 @@ fn make_generic_glue(@crate_ctxt cx, @ty.t t, str name,
1104
1108
vec[ ast. def_id] typaram_defs) -> ValueRef {
1105
1109
auto llfnty = T_glue_fn ( ) ;
1106
1110
1107
- auto fn_name = cx. names. next( "_rust_" + name) + "." + ty. ty_to_str( t) ;
1111
+ auto fn_name = cx. names. next( "_rust_" + name) + sep ( ) + ty. ty_to_str( t) ;
1108
1112
fn_name = sanitize( fn_name) ;
1109
1113
auto llfn = decl_fastcall_fn( cx. llmod, fn_name, llfnty) ;
1110
1114
@@ -2498,7 +2502,7 @@ fn trans_bind_thunk(@crate_ctxt cx,
2498
2502
// Construct a thunk-call with signature incoming_fty, and that copies
2499
2503
// args forward into a call to outgoing_fty.
2500
2504
2501
- let str s = cx. names . next ( "_rust_thunk" ) + "." + cx. path ;
2505
+ let str s = cx. names . next ( "_rust_thunk" ) + sep ( ) + cx. path ;
2502
2506
let TypeRef llthunk_ty = get_pair_fn_ty ( type_of ( cx, incoming_fty) ) ;
2503
2507
let ValueRef llthunk = decl_fastcall_fn ( cx. llmod , s, llthunk_ty) ;
2504
2508
@@ -3592,10 +3596,10 @@ fn trans_vtbl(@crate_ctxt cx, TypeRef self_ty,
3592
3596
}
3593
3597
}
3594
3598
3595
- let @crate_ctxt mcx = @rec( path=cx. path + "." + m. node. ident
3599
+ let @crate_ctxt mcx = @rec( path=cx. path + sep ( ) + m. node. ident
3596
3600
with * cx) ;
3597
3601
3598
- let str s = cx. names. next( "_rust_method" ) + "." + mcx. path;
3602
+ let str s = cx. names. next( "_rust_method" ) + sep ( ) + mcx. path;
3599
3603
let ValueRef llfn = decl_fastcall_fn( cx. llmod, s, llfnty) ;
3600
3604
cx. item_ids. insert( m. node. id, llfn) ;
3601
3605
@@ -3606,7 +3610,7 @@ fn trans_vtbl(@crate_ctxt cx, TypeRef self_ty,
3606
3610
auto vtbl = C_struct ( methods) ;
3607
3611
auto gvar = llvm. LLVMAddGlobal ( cx. llmod,
3608
3612
val_ty( vtbl) ,
3609
- _str. buf( "_rust_vtbl" + "." + cx. path) ) ;
3613
+ _str. buf( "_rust_vtbl" + sep ( ) + cx. path) ) ;
3610
3614
llvm. LLVMSetInitializer ( gvar, vtbl) ;
3611
3615
llvm. LLVMSetGlobalConstant ( gvar, True ) ;
3612
3616
llvm. LLVMSetLinkage ( gvar, lib. llvm. LLVMPrivateLinkage
@@ -3837,29 +3841,29 @@ fn trans_const(@crate_ctxt cx, @ast.expr e,
3837
3841
fn trans_item( @crate_ctxt cx, & ast. item item) {
3838
3842
alt ( item. node) {
3839
3843
case ( ast. item_fn( ?name, ?f, ?tps, ?fid, ?ann) ) {
3840
- auto sub_cx = @rec( path=cx. path + "." + name with * cx) ;
3844
+ auto sub_cx = @rec( path=cx. path + sep ( ) + name with * cx) ;
3841
3845
trans_fn( sub_cx, f, fid, none[ TypeRef ] , tps, ann) ;
3842
3846
}
3843
3847
case ( ast. item_obj( ?name, ?ob, ?tps, ?oid, ?ann) ) {
3844
- auto sub_cx = @rec( path=cx. path + "." + name,
3848
+ auto sub_cx = @rec( path=cx. path + sep ( ) + name,
3845
3849
obj_typarams=tps,
3846
3850
obj_fields=ob. fields with * cx) ;
3847
3851
trans_obj( sub_cx, ob, oid, tps, ann) ;
3848
3852
}
3849
3853
case ( ast. item_mod( ?name, ?m, _) ) {
3850
- auto sub_cx = @rec( path=cx. path + "." + name with * cx) ;
3854
+ auto sub_cx = @rec( path=cx. path + sep ( ) + name with * cx) ;
3851
3855
trans_mod( sub_cx, m) ;
3852
3856
}
3853
3857
case ( ast. item_tag( ?name, ?variants, ?tps, ?tag_id) ) {
3854
- auto sub_cx = @rec( path=cx. path + "." + name with * cx) ;
3858
+ auto sub_cx = @rec( path=cx. path + sep ( ) + name with * cx) ;
3855
3859
auto i = 0 ;
3856
3860
for ( ast. variant variant in variants) {
3857
3861
trans_tag_variant( sub_cx, tag_id, variant, i, tps) ;
3858
3862
i += 1 ;
3859
3863
}
3860
3864
}
3861
3865
case ( ast. item_const( ?name, _, ?expr, ?cid, ?ann) ) {
3862
- auto sub_cx = @rec( path=cx. path + "." + name with * cx) ;
3866
+ auto sub_cx = @rec( path=cx. path + sep ( ) + name with * cx) ;
3863
3867
trans_const( sub_cx, expr, cid, ann) ;
3864
3868
}
3865
3869
case ( _) { /* fall through */ }
@@ -3890,11 +3894,11 @@ fn decl_fn_and_pair(@crate_ctxt cx,
3890
3894
auto llfty = get_pair_fn_ty( llpairty) ;
3891
3895
3892
3896
// Declare the function itself.
3893
- let str s = cx. names. next( "_rust_" + kind) + "." + name;
3897
+ let str s = cx. names. next( "_rust_" + kind) + sep ( ) + name;
3894
3898
let ValueRef llfn = decl_fastcall_fn( cx. llmod, s, llfty) ;
3895
3899
3896
3900
// Declare the global constant pair that points to it.
3897
- let str ps = cx. names. next( "_rust_" + kind + "_pair" ) + "." + name;
3901
+ let str ps = cx. names. next( "_rust_" + kind + "_pair" ) + sep ( ) + name;
3898
3902
let ValueRef gvar = llvm. LLVMAddGlobal ( cx. llmod, llpairty,
3899
3903
_str. buf( ps) ) ;
3900
3904
auto pair = C_struct ( vec( llfn,
@@ -4208,8 +4212,8 @@ fn trans_main_fn(@crate_ctxt cx, ValueRef llcrate) {
4208
4212
4209
4213
auto llargc = llvm. LLVMGetParam ( llmain, 0 u) ;
4210
4214
auto llargv = llvm. LLVMGetParam ( llmain, 1 u) ;
4211
- check ( cx. item_names . contains_key ( "_rust. main" ) ) ;
4212
- auto llrust_main = cx. item_names . get ( "_rust. main" ) ;
4215
+ check ( cx. item_names . contains_key ( "_rust" + sep ( ) + " main") ) ;
4216
+ auto llrust_main = cx. item_names . get ( "_rust" + sep ( ) + " main") ;
4213
4217
4214
4218
//
4215
4219
// Emit the moral equivalent of:
0 commit comments