mirror of https://github.com/embarklabs/embark.git
fix(@embark/solidity): fix binding in method call
This commit fixes a bug where it throws while trying to compile solidity files as it dereferences its `this`. Unfortunately passing methods as lambda callbacks doesn't correctly resolve its `this` scope even within fat arrow functions, resulting in unexpected behaviour where `this` inside lambda is `undefined`.
This commit is contained in:
parent
e0fd641df9
commit
3eeeec31e4
|
@ -67,7 +67,7 @@ class SolcProcess extends ProcessWrapper {
|
||||||
if (semver.gte(this.solc.version(), '0.5.0')) {
|
if (semver.gte(this.solc.version(), '0.5.0')) {
|
||||||
func = this.solc.compile;
|
func = this.solc.compile;
|
||||||
}
|
}
|
||||||
let output = func(JSON.stringify(jsonObj), this.findImports);
|
let output = func(JSON.stringify(jsonObj), this.findImports.bind(this));
|
||||||
cb(null, output);
|
cb(null, output);
|
||||||
} catch (err) {
|
} catch (err) {
|
||||||
cb(err.message);
|
cb(err.message);
|
||||||
|
|
Loading…
Reference in New Issue