Enforce 100% code coverage

This commit is contained in:
kpdecker
2015-08-03 17:28:05 -05:00
parent c3cbaa25a4
commit 324d615726
5 changed files with 47 additions and 15 deletions
+7 -6
View File
@@ -90,7 +90,8 @@ CodeGen.prototype = {
}
},
empty: function(loc = this.currentLocation || {start: {}}) {
empty: function() {
let loc = this.currentLocation || {start: {}};
return new SourceNode(loc.start.line, loc.start.column, this.srcFile);
},
wrap: function(chunk, loc = this.currentLocation || {start: {}}) {
@@ -137,22 +138,22 @@ CodeGen.prototype = {
},
generateList: function(entries, loc) {
let ret = this.empty(loc);
generateList: function(entries) {
let ret = this.empty();
for (let i = 0, len = entries.length; i < len; i++) {
if (i) {
ret.add(',');
}
ret.add(castChunk(entries[i], this, loc));
ret.add(castChunk(entries[i], this));
}
return ret;
},
generateArray: function(entries, loc) {
let ret = this.generateList(entries, loc);
generateArray: function(entries) {
let ret = this.generateList(entries);
ret.prepend('[');
ret.add(']');