Fix feedback

This commit is contained in:
Andre Medeiros 2018-08-30 13:01:13 -04:00
parent bc5de4ef90
commit 2c2e54b613
3 changed files with 6 additions and 9 deletions

View File

@ -97,7 +97,7 @@ class ContractSource {
} }
} }
/*eslint complexity: ["error", 34]*/ /*eslint complexity: ["error", 36]*/
generateCodeCoverage(trace) { generateCodeCoverage(trace) {
if(!this.ast || !this.contractBytecode) throw new Error('Error generating coverage: solc output was not assigned'); if(!this.ast || !this.contractBytecode) throw new Error('Error generating coverage: solc output was not assigned');
@ -198,8 +198,6 @@ class ContractSource {
parent: node._parent parent: node._parent
}); });
//children = node.expression ? [node.expression] : [];
markLocations = [location]; markLocations = [location];
break; break;
@ -298,7 +296,7 @@ class ContractSource {
trace.structLogs.forEach((step) => { trace.structLogs.forEach((step) => {
step = bytecode[step.pc]; step = bytecode[step.pc];
if(!step.sourceMap || step.sourceMap == '' || step.sourceMap == SourceMap.empty()) return; if(!step.sourceMap || step.sourceMap === '' || step.sourceMap === SourceMap.empty()) return;
let sourceMapString = step.sourceMap.toString(this.id); let sourceMapString = step.sourceMap.toString(this.id);
var nodes = sourceMapToNodeType[sourceMapString]; var nodes = sourceMapToNodeType[sourceMapString];

View File

@ -10,7 +10,6 @@ web3.extend({
methods: [{name: 'traceTransaction', call: 'debug_traceTransaction', params: 2}] methods: [{name: 'traceTransaction', call: 'debug_traceTransaction', params: 2}]
}); });
class CodeCoverage { class CodeCoverage {
constructor(embark, _options) { constructor(embark, _options) {
this.events = embark.events; this.events = embark.events;

View File

@ -1,6 +1,6 @@
class EmptySourceMap { class EmptySourceMap {
static createRelativeTo(sourceMapString) { static createRelativeTo(sourceMapString) {
if(sourceMapString == '') return EmptySourceMap; if(sourceMapString === '') return EmptySourceMap;
return new SourceMap(sourceMapString); return new SourceMap(sourceMapString);
} }
@ -29,12 +29,12 @@ class SourceMap {
} }
createRelativeTo(sourceMapString) { createRelativeTo(sourceMapString) {
if(sourceMapString == '' || sourceMapString == undefined) return EmptySourceMap; if(!sourceMapString) return EmptySourceMap;
let [offset, length, id, jump] = sourceMapString.split(":"); let [offset, length, id, jump] = sourceMapString.split(":");
offset = (offset == '') ? this.offset : parseInt(offset, 10); offset = (offset) ? parseInt(offset, 10) : this.offset;
id = (id == '' || id == undefined) ? this.id : parseInt(id, 10); id = (id) ? parseInt(id, 10) : this.id;
length = parseInt(length, 10); length = parseInt(length, 10);
return new SourceMap(offset, length, id, jump); return new SourceMap(offset, length, id, jump);