|
|
@ -151,7 +151,7 @@ module.exports = function(pathToFile, instrumentingActive){ |
|
|
|
var startcol = expression.start - contract.slice(0,expression.start).lastIndexOf('\n') -1; |
|
|
|
var startcol = expression.start - contract.slice(0,expression.start).lastIndexOf('\n') -1; |
|
|
|
//NB locations for if branches in istanbul are zero length and associated with the start of the if.
|
|
|
|
//NB locations for if branches in istanbul are zero length and associated with the start of the if.
|
|
|
|
branchMap[branchId] = {line:linecount, type:'if', locations:[{start:{line:startline, column:startcol},end:{line:startline,column:startcol}},{start:{line:startline, column:startcol},end:{line:startline,column:startcol}}]} |
|
|
|
branchMap[branchId] = {line:linecount, type:'if', locations:[{start:{line:startline, column:startcol},end:{line:startline,column:startcol}},{start:{line:startline, column:startcol},end:{line:startline,column:startcol}}]} |
|
|
|
if (contract.slice(expression.consequent.start,1)==='{'){ |
|
|
|
if (contract.slice(expression.consequent.start,expression.consequent.end).trim().indexOf('{')===0){ |
|
|
|
createOrAppendInjectionPoint(expression.consequent.start+1,{type: "callBranchEvent", branchId: branchId, locationIdx: 0} ) |
|
|
|
createOrAppendInjectionPoint(expression.consequent.start+1,{type: "callBranchEvent", branchId: branchId, locationIdx: 0} ) |
|
|
|
}else{ |
|
|
|
}else{ |
|
|
|
createOrAppendInjectionPoint(expression.consequent.start,{type: "callBranchEvent", branchId: branchId, locationIdx: 0, openBracket:true} ) |
|
|
|
createOrAppendInjectionPoint(expression.consequent.start,{type: "callBranchEvent", branchId: branchId, locationIdx: 0, openBracket:true} ) |
|
|
@ -368,7 +368,7 @@ module.exports = function(pathToFile, instrumentingActive){ |
|
|
|
injectionPoint = sortedPoints[x]; |
|
|
|
injectionPoint = sortedPoints[x]; |
|
|
|
//Line instrumentation has to happen first
|
|
|
|
//Line instrumentation has to happen first
|
|
|
|
injectionPoints[injectionPoint].sort(function(a,b){ |
|
|
|
injectionPoints[injectionPoint].sort(function(a,b){ |
|
|
|
var eventTypes = ["openParen", "closeBracket","callBranchEvent","callEmptyBranchEvent","callEvent"]; |
|
|
|
var eventTypes = ["openParen", "callBranchEvent","callEmptyBranchEvent","callEvent", "closeBracket"]; |
|
|
|
return eventTypes.indexOf(b.type) - eventTypes.indexOf(a.type); |
|
|
|
return eventTypes.indexOf(b.type) - eventTypes.indexOf(a.type); |
|
|
|
}); |
|
|
|
}); |
|
|
|
for (y in injectionPoints[injectionPoint]){ |
|
|
|
for (y in injectionPoints[injectionPoint]){ |
|
|
|