More feedback

This commit is contained in:
Andre Medeiros 2018-08-10 10:58:18 -04:00 committed by Iuri Matias
parent 774a14c850
commit 8fe69c59dc
3 changed files with 5 additions and 20 deletions

View File

@ -114,6 +114,7 @@ class ContractSource {
case 'Identifier':
case 'Literal':
case 'VariableDeclaration':
case 'PragmaDirective':
// We don't need to do anything with these. Just carry on.
break;
@ -190,10 +191,6 @@ class ContractSource {
children = node.nodes;
break;
case 'PragmaDirective':
// These nodes do nothing, so we move on.
break;
case 'FunctionDefinition':
// Istanbul only wants the function definition, not the body, so we're
// going to do some fun math here.
@ -243,16 +240,7 @@ class ContractSource {
// Try to match the contract to the bytecode. If it doesn't,
// then we bail.
trace.structLogs.forEach((step) => {
if(!contractMatches) return;
if(!bytecode[step.pc]) {
// This contract won't match so we bail
contractMatches = false;
return;
}
});
contractMatches = trace.structLogs.every((step) => { return bytecode[step.pc]; });
if(!contractMatches) break;
trace.structLogs.forEach((step) => {

View File

@ -50,8 +50,7 @@ class ContractSources {
parseSolcOutput(output) {
for(var file in output.contracts) {
var basename = path.basename(file);
var contractSource = this.files[basename];
var contractSource = this.files[path.basename(file)];
if(!contractSource) continue;
contractSource.parseSolcOutput(output.sources[file], output.contracts[file]);
@ -62,8 +61,7 @@ class ContractSources {
var coverageReport = {};
for(var file in this.files) {
var contractSource = this.files[file];
coverageReport[file] = contractSource.generateCodeCoverage(trace);
coverageReport[file] = this.files[file].generateCodeCoverage(trace);
}
if(!this.coverageReport) {

View File

@ -15,8 +15,7 @@ class SourceMap {
}
subtract(sourceMap) {
var length = sourceMap.offset - this.offset;
return new SourceMap(this.offset, length);
return new SourceMap(this.offset, sourceMap.offset - this.offset);
}
toString() {