|
|
@ -11,6 +11,13 @@ function createOrAppendInjectionPoint(contract, key, value) { |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
instrumenter.prePosition = function prePosition(expression){ |
|
|
|
|
|
|
|
if (expression.right.type === 'ConditionalExpression' &&
|
|
|
|
|
|
|
|
expression.left.type === 'MemberExpression'){ |
|
|
|
|
|
|
|
expression.start -= 2; |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
instrumenter.instrumentAssignmentExpression = function instrumentAssignmentExpression(contract, expression) { |
|
|
|
instrumenter.instrumentAssignmentExpression = function instrumentAssignmentExpression(contract, expression) { |
|
|
|
// The only time we instrument an assignment expression is if there's a conditional expression on
|
|
|
|
// The only time we instrument an assignment expression is if there's a conditional expression on
|
|
|
|
// the right
|
|
|
|
// the right
|
|
|
@ -22,8 +29,17 @@ instrumenter.instrumentAssignmentExpression = function instrumentAssignmentExpre |
|
|
|
type: 'literal', string: '; (,' + expression.left.name + ')', |
|
|
|
type: 'literal', string: '; (,' + expression.left.name + ')', |
|
|
|
}); |
|
|
|
}); |
|
|
|
instrumenter.instrumentConditionalExpression(contract, expression.right); |
|
|
|
instrumenter.instrumentConditionalExpression(contract, expression.right); |
|
|
|
|
|
|
|
} else if (expression.left.type === 'MemberExpression'){ |
|
|
|
|
|
|
|
createOrAppendInjectionPoint(contract, expression.left.start, { |
|
|
|
|
|
|
|
type: 'literal', string: '(,', |
|
|
|
|
|
|
|
}); |
|
|
|
|
|
|
|
createOrAppendInjectionPoint(contract, expression.left.end, { |
|
|
|
|
|
|
|
type: 'literal', string: ')', |
|
|
|
|
|
|
|
}); |
|
|
|
|
|
|
|
instrumenter.instrumentConditionalExpression(contract, expression.right); |
|
|
|
} else { |
|
|
|
} else { |
|
|
|
console.log(contract, expression.left); |
|
|
|
const err = 'Error instrumenting assignment expression @ solidity-coverage/lib/instrumenter.js'; |
|
|
|
|
|
|
|
console.log(err, contract, expression.left); |
|
|
|
process.exit(); |
|
|
|
process.exit(); |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|