File tree Expand file tree Collapse file tree 1 file changed +13
-4
lines changed Expand file tree Collapse file tree 1 file changed +13
-4
lines changed Original file line number Diff line number Diff line change @@ -2,11 +2,20 @@ 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
- var parsed = libraryName . match ( / ^ ( [ ^ : ] * ) : ? ( .* ) $ / ) ;
6
- if ( parsed ) {
7
- librariesComplete [ parsed [ 2 ] ] = libraries [ libraryName ] ;
5
+ if ( typeof libraryName === 'object' ) {
6
+ // API compatible with the standard JSON i/o
7
+ for ( var lib in libraries [ libraryName ] ) {
8
+ librariesComplete [ lib ] = libraries [ libraryName ] [ lib ] ;
9
+ librariesComplete [ libraryName + ':' + lib ] = libraries [ libraryName ] [ lib ] ;
10
+ }
11
+ } else {
12
+ // backwards compatible API for early solc-js verisons
13
+ var parsed = libraryName . match ( / ^ ( [ ^ : ] * ) : ? ( .* ) $ / ) ;
14
+ if ( parsed ) {
15
+ librariesComplete [ parsed [ 2 ] ] = libraries [ libraryName ] ;
16
+ }
17
+ librariesComplete [ libraryName ] = libraries [ libraryName ] ;
8
18
}
9
- librariesComplete [ libraryName ] = libraries [ libraryName ] ;
10
19
}
11
20
12
21
for ( libraryName in librariesComplete ) {
You can’t perform that action at this time.
0 commit comments