More feedback
This commit is contained in:
parent
774a14c850
commit
8fe69c59dc
|
@ -114,6 +114,7 @@ class ContractSource {
|
||||||
case 'Identifier':
|
case 'Identifier':
|
||||||
case 'Literal':
|
case 'Literal':
|
||||||
case 'VariableDeclaration':
|
case 'VariableDeclaration':
|
||||||
|
case 'PragmaDirective':
|
||||||
// We don't need to do anything with these. Just carry on.
|
// We don't need to do anything with these. Just carry on.
|
||||||
break;
|
break;
|
||||||
|
|
||||||
|
@ -190,10 +191,6 @@ class ContractSource {
|
||||||
children = node.nodes;
|
children = node.nodes;
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case 'PragmaDirective':
|
|
||||||
// These nodes do nothing, so we move on.
|
|
||||||
break;
|
|
||||||
|
|
||||||
case 'FunctionDefinition':
|
case 'FunctionDefinition':
|
||||||
// Istanbul only wants the function definition, not the body, so we're
|
// Istanbul only wants the function definition, not the body, so we're
|
||||||
// going to do some fun math here.
|
// 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,
|
// Try to match the contract to the bytecode. If it doesn't,
|
||||||
// then we bail.
|
// then we bail.
|
||||||
trace.structLogs.forEach((step) => {
|
contractMatches = trace.structLogs.every((step) => { return bytecode[step.pc]; });
|
||||||
if(!contractMatches) return;
|
|
||||||
|
|
||||||
if(!bytecode[step.pc]) {
|
|
||||||
// This contract won't match so we bail
|
|
||||||
contractMatches = false;
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
});
|
|
||||||
|
|
||||||
if(!contractMatches) break;
|
if(!contractMatches) break;
|
||||||
|
|
||||||
trace.structLogs.forEach((step) => {
|
trace.structLogs.forEach((step) => {
|
||||||
|
|
|
@ -50,8 +50,7 @@ class ContractSources {
|
||||||
|
|
||||||
parseSolcOutput(output) {
|
parseSolcOutput(output) {
|
||||||
for(var file in output.contracts) {
|
for(var file in output.contracts) {
|
||||||
var basename = path.basename(file);
|
var contractSource = this.files[path.basename(file)];
|
||||||
var contractSource = this.files[basename];
|
|
||||||
if(!contractSource) continue;
|
if(!contractSource) continue;
|
||||||
|
|
||||||
contractSource.parseSolcOutput(output.sources[file], output.contracts[file]);
|
contractSource.parseSolcOutput(output.sources[file], output.contracts[file]);
|
||||||
|
@ -62,8 +61,7 @@ class ContractSources {
|
||||||
var coverageReport = {};
|
var coverageReport = {};
|
||||||
|
|
||||||
for(var file in this.files) {
|
for(var file in this.files) {
|
||||||
var contractSource = this.files[file];
|
coverageReport[file] = this.files[file].generateCodeCoverage(trace);
|
||||||
coverageReport[file] = contractSource.generateCodeCoverage(trace);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if(!this.coverageReport) {
|
if(!this.coverageReport) {
|
||||||
|
|
|
@ -15,8 +15,7 @@ class SourceMap {
|
||||||
}
|
}
|
||||||
|
|
||||||
subtract(sourceMap) {
|
subtract(sourceMap) {
|
||||||
var length = sourceMap.offset - this.offset;
|
return new SourceMap(this.offset, sourceMap.offset - this.offset);
|
||||||
return new SourceMap(this.offset, length);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
toString() {
|
toString() {
|
||||||
|
|
Loading…
Reference in New Issue