Delete lastchar special case

pull/89/head
Alex Rea 7 years ago
parent cc0fe764c5
commit 3177f3877a
  1. 13
      lib/instrumenter.js

@ -160,7 +160,6 @@ instrumenter.instrumentFunctionDeclaration = function instrumentFunctionDeclarat
const startcol = expression.start - contract.instrumented.slice(0, expression.start).lastIndexOf('\n') - 1;
const endlineDelta = contract.instrumented.slice(expression.start).indexOf('{');
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 endcol = functionDefinition.length - functionDefinition.lastIndexOf('\n');
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, {
type: 'callFunctionEvent', fnId: contract.fnId,
});
}
createOrAppendInjectionPoint(contract, expression.start + endlineDelta + 1, {
type: 'callFunctionEvent', fnId: contract.fnId,
});
};
instrumenter.addNewBranch = function addNewBranch(contract, expression) {

Loading…
Cancel
Save