mirror of https://github.com/embarklabs/embark.git
Account for empty initialization in loops
This commit is contained in:
parent
a59ec4e91f
commit
f0f0235591
|
@ -249,18 +249,20 @@ class ContractSource {
|
|||
let sourceMap = new SourceMap(node.src);
|
||||
let bodySourceMap = new SourceMap(node.body.src);
|
||||
let forLoopDeclaration = sourceMap.subtract(bodySourceMap).toString();
|
||||
let initializationLocation = this.sourceMapToLocations(node.initializationExpression.src);
|
||||
|
||||
location = this.sourceMapToLocations(forLoopDeclaration);
|
||||
|
||||
let markExpression = node.initializationExpression || node.loopExpression;
|
||||
let expressionLocation = this.sourceMapToLocations(markExpression.src);
|
||||
|
||||
if(!sourceMapToNodeType[markExpression.src]) sourceMapToNodeType[markExpression.src] = [];
|
||||
sourceMapToNodeType[markExpression.src].push({type: 's', id: node.id, body: {loc: location}});
|
||||
markLocations = [expressionLocation];
|
||||
|
||||
coverage.s[node.id] = 0;
|
||||
coverage.statementMap[node.id] = location;
|
||||
|
||||
if(!sourceMapToNodeType[node.initializationExpression.src]) sourceMapToNodeType[node.initializationExpression.src] = [];
|
||||
sourceMapToNodeType[node.initializationExpression.src].push({type: 's', id: node.id, body: {loc: location}});
|
||||
|
||||
children = node.body.statements;
|
||||
markLocations = [initializationLocation];
|
||||
break;
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue