@@ -3,11 +3,12 @@ let solcProcess;
33let compilerLoaded = false ;
44var npm = require ( '../pipeline/npm.js' ) ;
55let path = require ( 'path' ) ;
6+ let currentSolcVersion = require ( '../../package.json' ) . dependencies . solc ;
67
78class SolcW {
89
9- constructor ( version ) {
10- this . solcVersion = version ;
10+ constructor ( solcVersion ) {
11+ this . solcVersion = solcVersion ;
1112 }
1213
1314 load_compiler ( done ) {
@@ -22,13 +23,16 @@ class SolcW {
2223 compilerLoaded = true ;
2324 done ( ) ;
2425 } ) ;
25- npm . getPackageVersion ( 'solc' , '0.4.10' , false , function ( location ) {
26- console . log ( "new compiler installed at " + location ) ;
27- //let requirePath = path.join(process.env.PWD, location.substr(2));
28- let requirePath = path . join ( process . env . PWD , location ) ;
29- console . log ( requirePath ) ;
30- solcProcess . send ( { action : 'loadCompiler' , solcLocation : requirePath } ) ;
31- } ) ;
26+
27+ if ( this . solcVersion === currentSolcVersion ) {
28+ solcProcess . send ( { action : 'loadCompiler' , solcLocation : 'solc' } ) ;
29+ } else {
30+ npm . getPackageVersion ( 'solc' , this . solcVersion , false , function ( location ) {
31+ let requirePath = path . join ( process . env . PWD , location ) ;
32+ solcProcess . send ( { action : 'loadCompiler' , solcLocation : requirePath } ) ;
33+ } ) ;
34+ }
35+
3236 }
3337
3438 isCompilerLoaded ( ) {
0 commit comments