@@ -517,35 +517,30 @@ fn main(args: vec[str]) {
517
517
none. {
518
518
// "-" as input file will cause the parser to read from stdin so we
519
519
// have to make up a name
520
+ // We want to toss everything after the final '.'
520
521
let parts = if !input_is_stdin ( ifile) {
521
522
str:: split ( ifile, '.' as u8 )
522
523
} else {
523
524
~[ "default" , "rs" ]
524
525
} ;
525
526
ivec:: pop ( parts) ;
526
- saved_out_filename = parts. ( 0 ) ;
527
- alt sopts. output_type {
528
- link:: output_type_none. { parts += ~[ "none" ] ; }
529
- link:: output_type_bitcode. { parts += ~[ "bc" ] ; }
530
- link:: output_type_assembly. { parts += ~[ "s" ] ; }
531
-
527
+ saved_out_filename = str:: connect ( parts, "." ) ;
528
+ let suffix = alt sopts. output_type {
529
+ link:: output_type_none. { "none" }
530
+ link:: output_type_bitcode. { "bc" }
531
+ link:: output_type_assembly. { "s" }
532
532
// Object and exe output both use the '.o' extension here
533
- link:: output_type_object. {
534
- parts += ~[ "o" ] ;
535
- }
536
- link:: output_type_exe. { parts += ~[ "o" ] ; }
537
- }
538
- let ofile = str:: connect ( parts, "." ) ;
533
+ link:: output_type_object. | link:: output_type_exe. { "o" }
534
+ } ;
535
+ let ofile = saved_out_filename + "." + suffix;
539
536
compile_input ( sess, cfg, ifile, ofile) ;
540
537
}
541
538
some( ofile) {
542
539
// FIXME: what about windows? This will create a foo.exe.o.
543
-
544
540
saved_out_filename = ofile;
545
- let temp_filename;
546
- if !stop_after_codegen {
547
- temp_filename = ofile + ".o" ;
548
- } else { temp_filename = ofile; }
541
+ let temp_filename = if !stop_after_codegen {
542
+ ofile + ".o"
543
+ } else { ofile } ;
549
544
compile_input ( sess, cfg, ifile, temp_filename) ;
550
545
}
551
546
}
0 commit comments