Skip to content

Commit 4ac210f

Browse files
committed
Refactor entry point detection for clarity
1 parent a6b830f commit 4ac210f

File tree

1 file changed

+17
-14
lines changed

1 file changed

+17
-14
lines changed

wrapper.js

Lines changed: 17 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -52,29 +52,32 @@ function setupMethods (soljson) {
5252
if ('_compileJSON' in soljson) {
5353
compileJSON = soljson.cwrap('compileJSON', 'string', ['string', 'number']);
5454
}
55+
5556
var compileJSONMulti = null;
5657
if ('_compileJSONMulti' in soljson) {
5758
compileJSONMulti = soljson.cwrap('compileJSONMulti', 'string', ['string', 'number']);
5859
}
60+
5961
var compileJSONCallback = null;
60-
var compileStandard = null;
61-
if (('_compileJSONCallback' in soljson) || ('_compileStandard' in soljson) || ('_solidity_compile' in soljson)) {
62+
if ('_compileJSONCallback' in soljson) {
6263
var compileInternal = soljson.cwrap('compileJSONCallback', 'string', ['string', 'number', 'number']);
6364
compileJSONCallback = function (input, optimize, readCallback) {
6465
return runWithReadCallback(readCallback, compileInternal, [ input, optimize ]);
6566
};
66-
if ('_compileStandard' in soljson) {
67-
var compileStandardInternal = soljson.cwrap('compileStandard', 'string', ['string', 'number']);
68-
compileStandard = function (input, readCallback) {
69-
return runWithReadCallback(readCallback, compileStandardInternal, [ input ]);
70-
};
71-
}
72-
if ('_solidity_compile' in soljson) {
73-
var solidityCompile = soljson.cwrap('solidity_compile', 'string', ['string', 'number']);
74-
compileStandard = function (input, readCallback) {
75-
return runWithReadCallback(readCallback, solidityCompile, [ input ]);
76-
};
77-
}
67+
}
68+
69+
var compileStandard = null;
70+
if ('_compileStandard' in soljson) {
71+
var compileStandardInternal = soljson.cwrap('compileStandard', 'string', ['string', 'number']);
72+
compileStandard = function (input, readCallback) {
73+
return runWithReadCallback(readCallback, compileStandardInternal, [ input ]);
74+
};
75+
}
76+
if ('_solidity_compile' in soljson) {
77+
var solidityCompile = soljson.cwrap('solidity_compile', 'string', ['string', 'number']);
78+
compileStandard = function (input, readCallback) {
79+
return runWithReadCallback(readCallback, solidityCompile, [ input ]);
80+
};
7881
}
7982

8083
var compile = function (input, optimise, readCallback) {

0 commit comments

Comments
 (0)