@@ -28,7 +28,6 @@ use syntax::abi;
28
28
use syntax:: parse:: token;
29
29
use syntax;
30
30
31
- use std:: int;
32
31
use std:: hashmap:: HashMap ;
33
32
34
33
#[ deriving( Eq ) ]
@@ -217,58 +216,57 @@ pub struct Session_ {
217
216
building_library : @mut bool ,
218
217
working_dir : Path ,
219
218
lints : @mut HashMap < ast:: NodeId , ~[ ( lint:: lint , codemap:: Span , ~str ) ] > ,
220
- node_id : @mut uint ,
221
219
}
222
220
223
221
pub type Session = @Session_ ;
224
222
225
223
impl Session_ {
226
- pub fn span_fatal ( & self , sp : Span , msg : & str ) -> ! {
224
+ pub fn span_fatal ( @ self , sp : Span , msg : & str ) -> ! {
227
225
self . span_diagnostic . span_fatal ( sp, msg)
228
226
}
229
- pub fn fatal ( & self , msg : & str ) -> ! {
227
+ pub fn fatal ( @ self , msg : & str ) -> ! {
230
228
self . span_diagnostic . handler ( ) . fatal ( msg)
231
229
}
232
- pub fn span_err ( & self , sp : Span , msg : & str ) {
230
+ pub fn span_err ( @ self , sp : Span , msg : & str ) {
233
231
self . span_diagnostic . span_err ( sp, msg)
234
232
}
235
- pub fn err ( & self , msg : & str ) {
233
+ pub fn err ( @ self , msg : & str ) {
236
234
self . span_diagnostic . handler ( ) . err ( msg)
237
235
}
238
- pub fn err_count ( & self ) -> uint {
236
+ pub fn err_count ( @ self ) -> uint {
239
237
self . span_diagnostic . handler ( ) . err_count ( )
240
238
}
241
- pub fn has_errors ( & self ) -> bool {
239
+ pub fn has_errors ( @ self ) -> bool {
242
240
self . span_diagnostic . handler ( ) . has_errors ( )
243
241
}
244
- pub fn abort_if_errors ( & self ) {
242
+ pub fn abort_if_errors ( @ self ) {
245
243
self . span_diagnostic . handler ( ) . abort_if_errors ( )
246
244
}
247
- pub fn span_warn ( & self , sp : Span , msg : & str ) {
245
+ pub fn span_warn ( @ self , sp : Span , msg : & str ) {
248
246
self . span_diagnostic . span_warn ( sp, msg)
249
247
}
250
- pub fn warn ( & self , msg : & str ) {
248
+ pub fn warn ( @ self , msg : & str ) {
251
249
self . span_diagnostic . handler ( ) . warn ( msg)
252
250
}
253
- pub fn span_note ( & self , sp : Span , msg : & str ) {
251
+ pub fn span_note ( @ self , sp : Span , msg : & str ) {
254
252
self . span_diagnostic . span_note ( sp, msg)
255
253
}
256
- pub fn note ( & self , msg : & str ) {
254
+ pub fn note ( @ self , msg : & str ) {
257
255
self . span_diagnostic . handler ( ) . note ( msg)
258
256
}
259
- pub fn span_bug ( & self , sp : Span , msg : & str ) -> ! {
257
+ pub fn span_bug ( @ self , sp : Span , msg : & str ) -> ! {
260
258
self . span_diagnostic . span_bug ( sp, msg)
261
259
}
262
- pub fn bug ( & self , msg : & str ) -> ! {
260
+ pub fn bug ( @ self , msg : & str ) -> ! {
263
261
self . span_diagnostic . handler ( ) . bug ( msg)
264
262
}
265
- pub fn span_unimpl ( & self , sp : Span , msg : & str ) -> ! {
263
+ pub fn span_unimpl ( @ self , sp : Span , msg : & str ) -> ! {
266
264
self . span_diagnostic . span_unimpl ( sp, msg)
267
265
}
268
- pub fn unimpl ( & self , msg : & str ) -> ! {
266
+ pub fn unimpl ( @ self , msg : & str ) -> ! {
269
267
self . span_diagnostic . handler ( ) . unimpl ( msg)
270
268
}
271
- pub fn add_lint ( & self ,
269
+ pub fn add_lint ( @ self ,
272
270
lint : lint:: lint ,
273
271
id : ast:: NodeId ,
274
272
sp : Span ,
@@ -279,85 +277,77 @@ impl Session_ {
279
277
}
280
278
self . lints . insert ( id, ~[ ( lint, sp, msg) ] ) ;
281
279
}
282
- pub fn next_node_id ( & self ) -> ast:: NodeId {
283
- self . reserve_node_ids ( 1 )
280
+ pub fn next_node_id ( @ self ) -> ast:: NodeId {
281
+ return syntax :: parse :: next_node_id ( self . parse_sess ) ;
284
282
}
285
- pub fn reserve_node_ids ( & self , count : uint ) -> ast:: NodeId {
286
- let v = * self . node_id ;
287
- * self . node_id += count;
288
- if v > ( int:: max_value as uint ) {
289
- self . bug ( "Input too large, ran out of node ids!" ) ;
290
- }
291
- v as int
292
- }
293
- pub fn diagnostic ( & self ) -> @mut diagnostic:: span_handler {
283
+ pub fn diagnostic ( @self ) -> @mut diagnostic:: span_handler {
294
284
self . span_diagnostic
295
285
}
296
- pub fn debugging_opt ( & self , opt : uint ) -> bool {
286
+ pub fn debugging_opt ( @ self , opt : uint ) -> bool {
297
287
( self . opts . debugging_opts & opt) != 0 u
298
288
}
299
289
// This exists to help with refactoring to eliminate impossible
300
290
// cases later on
301
- pub fn impossible_case ( & self , sp : Span , msg : & str ) -> ! {
291
+ pub fn impossible_case ( @ self , sp : Span , msg : & str ) -> ! {
302
292
self . span_bug ( sp, fmt ! ( "Impossible case reached: %s" , msg) ) ;
303
293
}
304
- pub fn verbose ( & self ) -> bool { self . debugging_opt ( verbose) }
305
- pub fn time_passes ( & self ) -> bool { self . debugging_opt ( time_passes) }
306
- pub fn count_llvm_insns ( & self ) -> bool {
294
+ pub fn verbose ( @ self ) -> bool { self . debugging_opt ( verbose) }
295
+ pub fn time_passes ( @ self ) -> bool { self . debugging_opt ( time_passes) }
296
+ pub fn count_llvm_insns ( @ self ) -> bool {
307
297
self . debugging_opt ( count_llvm_insns)
308
298
}
309
- pub fn count_type_sizes ( & self ) -> bool {
299
+ pub fn count_type_sizes ( @ self ) -> bool {
310
300
self . debugging_opt ( count_type_sizes)
311
301
}
312
- pub fn time_llvm_passes ( & self ) -> bool {
302
+ pub fn time_llvm_passes ( @ self ) -> bool {
313
303
self . debugging_opt ( time_llvm_passes)
314
304
}
315
- pub fn trans_stats ( & self ) -> bool { self . debugging_opt ( trans_stats) }
316
- pub fn meta_stats ( & self ) -> bool { self . debugging_opt ( meta_stats) }
317
- pub fn asm_comments ( & self ) -> bool { self . debugging_opt ( asm_comments) }
318
- pub fn no_verify ( & self ) -> bool { self . debugging_opt ( no_verify) }
319
- pub fn lint_llvm ( & self ) -> bool { self . debugging_opt ( lint_llvm) }
320
- pub fn trace ( & self ) -> bool { self . debugging_opt ( trace) }
321
- pub fn coherence ( & self ) -> bool { self . debugging_opt ( coherence) }
322
- pub fn borrowck_stats ( & self ) -> bool { self . debugging_opt ( borrowck_stats) }
323
- pub fn borrowck_note_pure ( & self ) -> bool {
305
+ pub fn trans_stats ( @ self ) -> bool { self . debugging_opt ( trans_stats) }
306
+ pub fn meta_stats ( @ self ) -> bool { self . debugging_opt ( meta_stats) }
307
+ pub fn asm_comments ( @ self ) -> bool { self . debugging_opt ( asm_comments) }
308
+ pub fn no_verify ( @ self ) -> bool { self . debugging_opt ( no_verify) }
309
+ pub fn lint_llvm ( @ self ) -> bool { self . debugging_opt ( lint_llvm) }
310
+ pub fn trace ( @ self ) -> bool { self . debugging_opt ( trace) }
311
+ pub fn coherence ( @ self ) -> bool { self . debugging_opt ( coherence) }
312
+ pub fn borrowck_stats ( @ self ) -> bool { self . debugging_opt ( borrowck_stats) }
313
+ pub fn borrowck_note_pure ( @ self ) -> bool {
324
314
self . debugging_opt ( borrowck_note_pure)
325
315
}
326
- pub fn borrowck_note_loan ( & self ) -> bool {
316
+ pub fn borrowck_note_loan ( @ self ) -> bool {
327
317
self . debugging_opt ( borrowck_note_loan)
328
318
}
329
- pub fn no_monomorphic_collapse ( & self ) -> bool {
319
+ pub fn no_monomorphic_collapse ( @ self ) -> bool {
330
320
self . debugging_opt ( no_monomorphic_collapse)
331
321
}
332
- pub fn debug_borrows ( & self ) -> bool {
322
+ pub fn debug_borrows ( @ self ) -> bool {
333
323
self . opts . optimize == No && !self . debugging_opt ( no_debug_borrows)
334
324
}
335
- pub fn once_fns ( & self ) -> bool { self . debugging_opt ( once_fns) }
336
- pub fn print_llvm_passes ( & self ) -> bool {
325
+ pub fn once_fns ( @ self ) -> bool { self . debugging_opt ( once_fns) }
326
+ pub fn print_llvm_passes ( @ self ) -> bool {
337
327
self . debugging_opt ( print_llvm_passes)
338
328
}
339
- pub fn no_prepopulate_passes ( & self ) -> bool {
329
+ pub fn no_prepopulate_passes ( @ self ) -> bool {
340
330
self . debugging_opt ( no_prepopulate_passes)
341
331
}
342
- pub fn no_vectorize_loops ( & self ) -> bool {
332
+ pub fn no_vectorize_loops ( @ self ) -> bool {
343
333
self . debugging_opt ( no_vectorize_loops)
344
334
}
345
- pub fn no_vectorize_slp ( & self ) -> bool {
335
+ pub fn no_vectorize_slp ( @ self ) -> bool {
346
336
self . debugging_opt ( no_vectorize_slp)
347
337
}
348
338
349
339
// pointless function, now...
350
- pub fn str_of ( & self , id : ast:: Ident ) -> @str {
340
+ pub fn str_of ( @ self , id : ast:: Ident ) -> @str {
351
341
token:: ident_to_str ( & id)
352
342
}
353
343
354
344
// pointless function, now...
355
- pub fn ident_of ( & self , st : & str ) -> ast:: Ident {
345
+ pub fn ident_of ( @ self , st : & str ) -> ast:: Ident {
356
346
token:: str_to_ident ( st)
357
347
}
358
348
359
349
// pointless function, now...
360
- pub fn intr ( & self ) -> @syntax:: parse:: token:: ident_interner {
350
+ pub fn intr ( @ self ) -> @syntax:: parse:: token:: ident_interner {
361
351
token:: get_ident_interner ( )
362
352
}
363
353
}
0 commit comments