Skip to content

Commit

Permalink
fix(@embark/solidity): fix binding in method call
Browse files Browse the repository at this point in the history
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`.
  • Loading branch information
0x-r4bbit committed Feb 4, 2019
1 parent e0fd641 commit 3eeeec3
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion src/lib/modules/solidity/solcP.js
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down

0 comments on commit 3eeeec3

Please sign in to comment.