|
|
@ -160,7 +160,6 @@ instrumenter.instrumentFunctionDeclaration = function instrumentFunctionDeclarat |
|
|
|
const startcol = expression.start - contract.instrumented.slice(0, expression.start).lastIndexOf('\n') - 1; |
|
|
|
const startcol = expression.start - contract.instrumented.slice(0, expression.start).lastIndexOf('\n') - 1; |
|
|
|
const endlineDelta = contract.instrumented.slice(expression.start).indexOf('{'); |
|
|
|
const endlineDelta = contract.instrumented.slice(expression.start).indexOf('{'); |
|
|
|
const functionDefinition = contract.instrumented.slice(expression.start, expression.start + endlineDelta); |
|
|
|
const functionDefinition = contract.instrumented.slice(expression.start, expression.start + endlineDelta); |
|
|
|
const lastChar = contract.instrumented.slice(expression.start, expression.start + endlineDelta + 1).slice(-1); |
|
|
|
|
|
|
|
const endline = startline + (functionDefinition.match(/\n/g) || []).length; |
|
|
|
const endline = startline + (functionDefinition.match(/\n/g) || []).length; |
|
|
|
const endcol = functionDefinition.length - functionDefinition.lastIndexOf('\n'); |
|
|
|
const endcol = functionDefinition.length - functionDefinition.lastIndexOf('\n'); |
|
|
|
contract.fnMap[contract.fnId] = { |
|
|
|
contract.fnMap[contract.fnId] = { |
|
|
@ -175,15 +174,9 @@ instrumenter.instrumentFunctionDeclaration = function instrumentFunctionDeclarat |
|
|
|
}, |
|
|
|
}, |
|
|
|
}, |
|
|
|
}, |
|
|
|
}; |
|
|
|
}; |
|
|
|
if (lastChar === '}') { |
|
|
|
|
|
|
|
createOrAppendInjectionPoint(contract, expression.start + endlineDelta, { |
|
|
|
|
|
|
|
type: 'callFunctionEvent', fnId: contract.fnId, |
|
|
|
|
|
|
|
}); |
|
|
|
|
|
|
|
} else { |
|
|
|
|
|
|
|
createOrAppendInjectionPoint(contract, expression.start + endlineDelta + 1, { |
|
|
|
createOrAppendInjectionPoint(contract, expression.start + endlineDelta + 1, { |
|
|
|
type: 'callFunctionEvent', fnId: contract.fnId, |
|
|
|
type: 'callFunctionEvent', fnId: contract.fnId, |
|
|
|
}); |
|
|
|
}); |
|
|
|
} |
|
|
|
|
|
|
|
}; |
|
|
|
}; |
|
|
|
|
|
|
|
|
|
|
|
instrumenter.addNewBranch = function addNewBranch(contract, expression) { |
|
|
|
instrumenter.addNewBranch = function addNewBranch(contract, expression) { |
|
|
|