@@ -100,7 +100,7 @@ impl Program {
100
100
// It's easy to initialize things if we don't run things...
101
101
for ( name, var) in self . local_vars . iter ( ) {
102
102
let mt = var. mt ( ) ;
103
- code. push_str ( fmt ! ( "let%s %s: %s = fail!();\n " , mt, * name, var. ty) ) ;
103
+ code. push_str ( format ! ( "let{} {}: {} = fail!();\n " , mt, * name, var. ty) ) ;
104
104
var. alter ( * name, & mut code) ;
105
105
}
106
106
code. push_str ( "{\n " ) ;
@@ -115,7 +115,7 @@ impl Program {
115
115
}
116
116
117
117
for p in new_locals. iter ( ) {
118
- code. push_str ( fmt ! ( "assert_encodable(&%s );\n " , * p. first_ref( ) ) ) ;
118
+ code. push_str ( format ! ( "assert_encodable(&{} );\n " , * p. first_ref( ) ) ) ;
119
119
}
120
120
code. push_str ( "};}" ) ;
121
121
return code;
@@ -138,22 +138,22 @@ impl Program {
138
138
// variables. This works by totally legitimately using the 'code'
139
139
// pointer of the 'tls_key' function as a uint, and then casting it back
140
140
// up to a function
141
- code. push_str ( fmt ! ( "
142
- let __tls_map: @mut ::std::hashmap::HashMap<~str, @~[u8]> = unsafe {
143
- let key = ::std::cast::transmute(%u );
141
+ code. push_str ( format ! ( "
142
+ let __tls_map: @mut ::std::hashmap::HashMap<~str, @~[u8]> = unsafe \\ {
143
+ let key = ::std::cast::transmute({} );
144
144
::std::local_data::get(key, |k| k.map(|&x| *x)).unwrap()
145
- };\n " , key as uint ) ) ;
145
+ \\ };\n " , key) ) ;
146
146
147
147
// Using this __tls_map handle, deserialize each variable binding that
148
148
// we know about
149
149
for ( name, var) in self . local_vars . iter ( ) {
150
150
let mt = var. mt ( ) ;
151
- code. push_str ( fmt ! ( "let%s %s: %s = {
152
- let data = __tls_map.get_copy(&~\" %s \" );
151
+ code. push_str ( format ! ( "let{} {}: {} = \\ {
152
+ let data = __tls_map.get_copy(&~\" {} \" );
153
153
let doc = ::extra::ebml::reader::Doc(data);
154
154
let mut decoder = ::extra::ebml::reader::Decoder(doc);
155
155
::extra::serialize::Decodable::decode(&mut decoder)
156
- };\n " , mt, * name, var. ty, * name) ) ;
156
+ \\ };\n " , mt, * name, var. ty, * name) ) ;
157
157
var. alter ( * name, & mut code) ;
158
158
}
159
159
@@ -162,7 +162,7 @@ impl Program {
162
162
code. push_char ( '\n' ) ;
163
163
164
164
match * to_print {
165
- Some ( ref s) => { code. push_str ( fmt ! ( "pp({\n %s \n });" , * s) ) ; }
165
+ Some ( ref s) => { code. push_str ( format ! ( "pp(\\ {\n {} \n \\ });" , * s) ) ; }
166
166
None => { }
167
167
}
168
168
@@ -174,14 +174,14 @@ impl Program {
174
174
// After the input code is run, we can re-serialize everything back out
175
175
// into tls map (to be read later on by this task)
176
176
for ( name, var) in self . local_vars . iter ( ) {
177
- code. push_str ( fmt ! ( "{
178
- let local: %s = %s ;
179
- let bytes = do ::std::io::with_bytes_writer |io| {
177
+ code. push_str ( format ! ( "\\ {
178
+ let local: {} = {} ;
179
+ let bytes = do ::std::io::with_bytes_writer |io| \\ {
180
180
let mut enc = ::extra::ebml::writer::Encoder(io);
181
181
local.encode(&mut enc);
182
- };
183
- __tls_map.insert(~\" %s \" , @bytes);
184
- }\n " , var. real_ty( ) , * name, * name) ) ;
182
+ \\ };
183
+ __tls_map.insert(~\" {} \" , @bytes);
184
+ \\ }\n " , var. real_ty( ) , * name, * name) ) ;
185
185
}
186
186
187
187
// Close things up, and we're done.
@@ -193,14 +193,14 @@ impl Program {
193
193
fn program_header ( & self ) -> ~str {
194
194
// up front, disable lots of annoying lints, then include all global
195
195
// state such as items, view items, and extern mods.
196
- let mut code = fmt ! ( "
197
- #[allow(warnings)];
196
+ let mut code = format ! ( "
197
+ \\ #[allow(warnings)];
198
198
199
199
extern mod extra;
200
- %s // extern mods
200
+ {} // extern mods
201
201
202
202
use extra::serialize::*;
203
- %s // view items
203
+ {} // view items
204
204
" , self . externs, self . view_items) ;
205
205
for ( _, s) in self . structs . iter ( ) {
206
206
// The structs aren't really useful unless they're encodable
@@ -236,7 +236,7 @@ impl Program {
236
236
for ( name, value) in cons_map. move_iter ( ) {
237
237
match self . local_vars . find_mut ( & name) {
238
238
Some ( v) => { v. data = ( * value) . clone ( ) ; }
239
- None => { fail ! ( "unknown variable %s " , name) }
239
+ None => { fail2 ! ( "unknown variable {} " , name) }
240
240
}
241
241
}
242
242
}
@@ -272,7 +272,7 @@ impl Program {
272
272
/// Once the types are known, they are inserted into the local_vars map in
273
273
/// this Program (to be deserialized later on
274
274
pub fn register_new_vars ( & mut self , blk : & ast:: Block , tcx : ty:: ctxt ) {
275
- debug ! ( "looking for new variables" ) ;
275
+ debug2 ! ( "looking for new variables" ) ;
276
276
let newvars = @mut HashMap :: new ( ) ;
277
277
do each_user_local ( blk) |local| {
278
278
let mutable = local. is_mutbl ;
@@ -378,7 +378,7 @@ impl Program {
378
378
_ => { }
379
379
}
380
380
}
381
- fail ! ( "couldn't find user block" ) ;
381
+ fail2 ! ( "couldn't find user block" ) ;
382
382
}
383
383
}
384
384
}
@@ -389,9 +389,9 @@ impl LocalVariable {
389
389
fn alter ( & self , name : & str , code : & mut ~str ) {
390
390
match self . alterations {
391
391
Some ( ( ref real_ty, ref prefix) ) => {
392
- code. push_str ( fmt ! ( "let%s %s: %s = %s%s ;\n " ,
393
- self . mt( ) , name,
394
- * real_ty, * prefix, name) ) ;
392
+ code. push_str ( format ! ( "let{} {}: {} = {}{} ;\n " ,
393
+ self . mt( ) , name,
394
+ * real_ty, * prefix, name) ) ;
395
395
}
396
396
None => { }
397
397
}
0 commit comments