File tree Expand file tree Collapse file tree 3 files changed +17
-3
lines changed Expand file tree Collapse file tree 3 files changed +17
-3
lines changed Original file line number Diff line number Diff line change @@ -2,7 +2,7 @@ var linkBytecode = function (bytecode, libraries) {
2
2
// NOTE: for backwards compatibility support old compiler which didn't use file names
3
3
var librariesComplete = { } ;
4
4
for ( var libraryName in libraries ) {
5
- if ( typeof libraryName === 'object' ) {
5
+ if ( typeof libraries [ libraryName ] === 'object' ) {
6
6
// API compatible with the standard JSON i/o
7
7
for ( var lib in libraries [ libraryName ] ) {
8
8
librariesComplete [ lib ] = libraries [ libraryName ] [ lib ] ;
Original file line number Diff line number Diff line change 1
1
{
2
2
"name" : " solc" ,
3
- "version" : " 0.4.20 " ,
3
+ "version" : " 0.4.24 " ,
4
4
"description" : " Solidity compiler" ,
5
5
"main" : " index.js" ,
6
6
"types" : " index.d.ts" ,
9
9
},
10
10
"scripts" : {
11
11
"lint" : " semistandard" ,
12
- "prepublish" : " ./ downloadCurrentVersion.js && ./ verifyVersion.js" ,
12
+ "prepublish" : " node downloadCurrentVersion.js && node verifyVersion.js" ,
13
13
"pretest" : " npm run lint" ,
14
14
"test" : " tape ./test/index.js" ,
15
15
"coverage" : " istanbul cover node_modules/tape/bin/tape ./test/index.js" ,
Original file line number Diff line number Diff line change @@ -456,6 +456,20 @@ tape('Linking', function (t) {
456
456
st . end ( ) ;
457
457
} ) ;
458
458
459
+ t . test ( 'link properly with two-level configuration (from standard JSON)' , function ( st ) {
460
+ var input = {
461
+ 'lib.sol' : 'library L { function f() returns (uint) { return 7; } }' ,
462
+ 'cont.sol' : 'import "lib.sol"; contract x { function g() { L.f(); } }'
463
+ } ;
464
+ var output = solc . compile ( { sources : input } ) ;
465
+ var bytecode = getBytecode ( output , 'cont.sol' , 'x' ) ;
466
+ st . ok ( bytecode ) ;
467
+ st . ok ( bytecode . length > 0 ) ;
468
+ bytecode = solc . linkBytecode ( bytecode , { 'lib.sol' : { 'L' : '0x123456' } } ) ;
469
+ st . ok ( bytecode . indexOf ( '_' ) < 0 ) ;
470
+ st . end ( ) ;
471
+ } ) ;
472
+
459
473
t . test ( 'linker to fail with missing library' , function ( st ) {
460
474
var input = {
461
475
'lib.sol' : 'library L { function f() returns (uint) { return 7; } }' ,
You can’t perform that action at this time.
0 commit comments