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:
Pascal Precht 2019-02-01 14:11:40 +01:00 committed by Pascal Precht
parent e0fd641df9
commit 3eeeec31e4
1 changed files with 1 additions and 1 deletions

View File

@ -67,7 +67,7 @@ class SolcProcess extends ProcessWrapper {
if (semver.gte(this.solc.version(), '0.5.0')) {
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);
} catch (err) {
cb(err.message);