Merge pull request #5 from cgewecke/fix-else-statement-handling

Fix injection issue for else's without brackets
uport
area 8 years ago committed by GitHub
commit fba1fd28c5
  1. 4
      instrumentSolidity.js

@ -155,8 +155,10 @@ module.exports = function(contract, fileName, instrumentingActive){
createOrAppendInjectionPoint(expression.alternate.start, {type: "callBranchEvent", branchId: branchId, locationIdx:1, openBracket: true})
createOrAppendInjectionPoint(expression.alternate.end, {type:"closeBracketEnd"});
//It should get instrumented when we parse it
} else if (expression.alternate){
} else if (expression.alternate && contract.slice(expression.alternate.start,expression.alternate.end).trim().indexOf('{')===0){
createOrAppendInjectionPoint(expression.alternate.start+1, {type: "callBranchEvent", branchId: branchId, locationIdx: 1})
} else if (expression.alternate){
createOrAppendInjectionPoint(expression.alternate.start, {type: "callBranchEvent", branchId: branchId, locationIdx: 1})
} else {
createOrAppendInjectionPoint(expression.consequent.end, {type: "callEmptyBranchEvent", branchId: branchId, locationIdx: 1});
}

Loading…
Cancel
Save