Skip to content

Commit 1aac486

Browse files
author
Micah Zoltu
authored
Merge branch 'master' into master
2 parents e7e2a7e + c3b0d91 commit 1aac486

File tree

3 files changed

+17
-3
lines changed

3 files changed

+17
-3
lines changed

linker.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ var linkBytecode = function (bytecode, libraries) {
22
// NOTE: for backwards compatibility support old compiler which didn't use file names
33
var librariesComplete = {};
44
for (var libraryName in libraries) {
5-
if (typeof libraryName === 'object') {
5+
if (typeof libraries[libraryName] === 'object') {
66
// API compatible with the standard JSON i/o
77
for (var lib in libraries[libraryName]) {
88
librariesComplete[lib] = libraries[libraryName][lib];

package.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "solc",
3-
"version": "0.4.20",
3+
"version": "0.4.24",
44
"description": "Solidity compiler",
55
"main": "index.js",
66
"types": "index.d.ts",
@@ -9,7 +9,7 @@
99
},
1010
"scripts": {
1111
"lint": "semistandard",
12-
"prepublish": "./downloadCurrentVersion.js && ./verifyVersion.js",
12+
"prepublish": "node downloadCurrentVersion.js && node verifyVersion.js",
1313
"pretest": "npm run lint",
1414
"test": "tape ./test/index.js",
1515
"coverage": "istanbul cover node_modules/tape/bin/tape ./test/index.js",

test/package.js

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -456,6 +456,20 @@ tape('Linking', function (t) {
456456
st.end();
457457
});
458458

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+
459473
t.test('linker to fail with missing library', function (st) {
460474
var input = {
461475
'lib.sol': 'library L { function f() returns (uint) { return 7; } }',

0 commit comments

Comments
 (0)