Fix injection issue with else statements without brackets

uport
cgewecke 8 years ago
parent f0c5f08f09
commit 971e65272d
  1. 4
      instrumentSolidity.js

@ -158,8 +158,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