mirror of
https://github.com/status-im/embark-area-51.git
synced 2025-01-10 22:16:20 +00:00
Address feedback
This commit is contained in:
parent
0b183c0280
commit
f2939ae91b
@ -2,22 +2,18 @@ const SourceMap = require('./source_map');
|
||||
|
||||
class ContractSource {
|
||||
constructor(file, body) {
|
||||
let self = this;
|
||||
|
||||
this.file = file;
|
||||
this.body = body;
|
||||
|
||||
this.lineLengths = body.split("\n").map((line) => { return line.length; });
|
||||
this.lineCount = this.lineLengths.length;
|
||||
|
||||
this.lineOffsets = [];
|
||||
this.lineLengths.forEach((length, line) => {
|
||||
if(line == 0) {
|
||||
this.lineOffsets[0] = 0;
|
||||
return;
|
||||
}
|
||||
|
||||
// +1 here factors in newline characters.
|
||||
this.lineOffsets[line] = this.lineOffsets[line-1] + this.lineLengths[line-1] + 1;
|
||||
});
|
||||
this.lineOffsets = this.lineLengths.reduce((sum, _elt, i) => {
|
||||
sum[i] = (i == 0) ? 0 : self.lineLengths[i-1] + sum[i-1] + 1;
|
||||
return sum;
|
||||
}, []);
|
||||
|
||||
this.contracts = {};
|
||||
}
|
||||
|
@ -31,11 +31,10 @@ class CodeCoverage {
|
||||
}
|
||||
|
||||
compileSolc(input) {
|
||||
var sources = {};
|
||||
|
||||
Object.keys(input.sources).forEach((path) => {
|
||||
sources[path] = input.sources[path].content;
|
||||
});
|
||||
var sources = Object.keys(input.sources).reduce((sum, elm, _i) => {
|
||||
sum[elm] = input.sources[elm].content;
|
||||
return sum;
|
||||
}, {});
|
||||
|
||||
this.contractSources = new ContractSources(sources);
|
||||
}
|
||||
|
@ -108,7 +108,6 @@ class Solidity {
|
||||
}
|
||||
}
|
||||
|
||||
//self.plugins.emitAndRunActionsForEvent('contracts:compiled:solc', output);
|
||||
self.events.emit('contracts:compiled:solc', output);
|
||||
|
||||
callback(null, output);
|
||||
|
@ -193,7 +193,6 @@ contract x {
|
||||
|
||||
var trace = JSON.parse(loadFixture('geth-debugtrace-output-h-5.json'));
|
||||
var coverage = cs.generateCodeCoverage(trace);
|
||||
// dumpToFile(coverage, '/tmp/coverage.json');
|
||||
|
||||
done();
|
||||
});
|
||||
|
Loading…
x
Reference in New Issue
Block a user