@ -190,20 +190,38 @@ Compile.prototype.compile = function (source, options, filters) {
} ) ;
return self . env . enqueue ( function ( ) {
return compileToAsmPromise . then ( function ( result ) {
if ( result . dirPath ) {
fs . remove ( result . dirPath ) ;
result . dirPath = undefined ;
}
if ( result . okToCache ) {
result . asm = asm . processAsm ( result . asm , filters ) ;
self . env . cachePut ( key , result ) ;
} else {
result . asm = { text : result . asm } ;
}
return compileToAsmPromise
. then ( function ( result ) {
if ( result . dirPath ) {
fs . remove ( result . dirPath ) ;
result . dirPath = undefined ;
}
if ( result . okToCache ) {
result . asm = asm . processAsm ( result . asm , filters ) ;
} else {
result . asm = { text : result . asm } ;
}
return result ;
} )
. then ( _ . bind ( self . postProcessAsm , self ) )
. then ( function ( result ) {
if ( result . okToCache ) self . env . cachePut ( key , result ) ;
return result ;
} ) ;
} ) ;
} ;
Compile . prototype . postProcessAsm = function ( result ) {
if ( ! result . okToCache ) return result ;
var demangler = this . compiler . demangler ;
if ( ! demangler ) return result ;
return this . exec ( demangler , [ ] , { input : _ . pluck ( result . asm , 'text' ) . join ( "\n" ) } )
. then ( function ( demangleResult ) {
var lines = utils . splitLines ( demangleResult . stdout ) ;
for ( var i = 0 ; i < result . asm . length ; ++ i )
result . asm [ i ] . text = lines [ i ] ;
return result ;
} ) ;
} ) ;
} ;
Compile . prototype . postProcess = function ( result , outputFilename , filters ) {
@ -321,6 +339,7 @@ Compile.prototype.exec = function (command, args, options) {
} ) ;
} , 0 ) ;
} ) ;
if ( options . input ) child . stdin . write ( options . input ) ;
child . stdin . end ( ) ;
} ) ;
} ;