fix the indexOf instead by simulating what solc does

This commit is contained in:
Jonathan Rainville 2018-07-12 11:18:03 -04:00
parent 5e210a67fa
commit f49d21d491
1 changed files with 3 additions and 3 deletions

View File

@ -178,12 +178,12 @@ class ContractDeployer {
deployedAddress = deployedAddress.substr(2); deployedAddress = deployedAddress.substr(2);
} }
let linkReference = '__' + filename + ":" + contractObj.className; let linkReference = '__' + filename + ":" + contractObj.className;
if (contractCode.indexOf(linkReference.substr(0, 38)) < 0) { // substr to simulate the cut that solc does
continue;
}
if (linkReference.length > 40) { if (linkReference.length > 40) {
return next(new Error(__("{{linkReference}} is too long, try reducing the path of the contract ({{filename}}) and/or its name {{contractName}}", {linkReference: linkReference, filename: filename, contractName: contractObj.className}))); return next(new Error(__("{{linkReference}} is too long, try reducing the path of the contract ({{filename}}) and/or its name {{contractName}}", {linkReference: linkReference, filename: filename, contractName: contractObj.className})));
} }
if (contractCode.indexOf(linkReference) < 0) {
continue;
}
let toReplace = linkReference + "_".repeat(40 - linkReference.length); let toReplace = linkReference + "_".repeat(40 - linkReference.length);
if (deployedAddress === undefined) { if (deployedAddress === undefined) {
let libraryName = contractObj.className; let libraryName = contractObj.className;