Skip to content

Commit cb1cee7

Browse files
committed
Reorder functions in wrapper (move version/license early)
1 parent ec9a55e commit cb1cee7

File tree

1 file changed

+23
-23
lines changed

1 file changed

+23
-23
lines changed

wrapper.js

Lines changed: 23 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,29 @@ var https = require('https');
55
var MemoryStream = require('memorystream');
66

77
function setupMethods (soljson) {
8+
var version;
9+
if ('_solidity_version' in soljson) {
10+
version = soljson.cwrap('solidity_version', 'string', []);
11+
} else {
12+
version = soljson.cwrap('version', 'string', []);
13+
}
14+
15+
var versionToSemver = function () {
16+
return translate.versionToSemver(version());
17+
};
18+
19+
var license;
20+
if ('_solidity_license' in soljson) {
21+
license = soljson.cwrap('solidity_license', 'string', []);
22+
} else if ('_license' in soljson) {
23+
license = soljson.cwrap('license', 'string', []);
24+
} else {
25+
// pre 0.4.14
26+
license = function () {
27+
// return undefined
28+
};
29+
}
30+
831
var copyString = function (str, ptr) {
932
var length = soljson.lengthBytesUTF8(str);
1033
var buffer = soljson._malloc(length + 1);
@@ -199,29 +222,6 @@ function setupMethods (soljson) {
199222
return formatFatalError('Compiler does not support any known interface.');
200223
};
201224

202-
var version;
203-
if ('_solidity_version' in soljson) {
204-
version = soljson.cwrap('solidity_version', 'string', []);
205-
} else {
206-
version = soljson.cwrap('version', 'string', []);
207-
}
208-
209-
var versionToSemver = function () {
210-
return translate.versionToSemver(version());
211-
};
212-
213-
var license;
214-
if ('_solidity_license' in soljson) {
215-
license = soljson.cwrap('solidity_license', 'string', []);
216-
} else if ('_license' in soljson) {
217-
license = soljson.cwrap('license', 'string', []);
218-
} else {
219-
// pre 0.4.14
220-
license = function () {
221-
// return undefined
222-
};
223-
}
224-
225225
return {
226226
version: version,
227227
semver: versionToSemver,

0 commit comments

Comments
 (0)