summaryrefslogtreecommitdiffstats
path: root/lib/handlebars/compiler
diff options
context:
space:
mode:
authorkpdecker <kpdecker@gmail.com>2015-08-03 17:28:05 -0500
committerkpdecker <kpdecker@gmail.com>2015-08-03 17:49:47 -0500
commit324d61572655e251ad2b06032a04cfab09bb0076 (patch)
treebb9a92f45c6b383f05700ce840f1119eb51e2334 /lib/handlebars/compiler
parentc3cbaa25a48d1a0c52ead31bfab28cb803cace1f (diff)
downloadhandlebars.js-324d61572655e251ad2b06032a04cfab09bb0076.zip
handlebars.js-324d61572655e251ad2b06032a04cfab09bb0076.tar.gz
handlebars.js-324d61572655e251ad2b06032a04cfab09bb0076.tar.bz2
Enforce 100% code coverage
Diffstat (limited to 'lib/handlebars/compiler')
-rw-r--r--lib/handlebars/compiler/code-gen.js13
-rw-r--r--lib/handlebars/compiler/helpers.js17
2 files changed, 16 insertions, 14 deletions
diff --git a/lib/handlebars/compiler/code-gen.js b/lib/handlebars/compiler/code-gen.js
index bc7bc07..3af4f8c 100644
--- a/lib/handlebars/compiler/code-gen.js
+++ b/lib/handlebars/compiler/code-gen.js
@@ -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(']');
diff --git a/lib/handlebars/compiler/helpers.js b/lib/handlebars/compiler/helpers.js
index 1c8ab0d..f2edfa1 100644
--- a/lib/handlebars/compiler/helpers.js
+++ b/lib/handlebars/compiler/helpers.js
@@ -124,19 +124,20 @@ export function prepareBlock(openBlock, program, inverseAndProgram, close, inver
export function prepareProgram(statements, loc) {
if (!loc && statements.length) {
- const first = statements[0].loc,
- last = statements[statements.length - 1].loc;
+ const firstLoc = statements[0].loc,
+ lastLoc = statements[statements.length - 1].loc;
- if (first && last) {
+ /* istanbul ignore else */
+ if (firstLoc && lastLoc) {
loc = {
- source: first.source,
+ source: firstLoc.source,
start: {
- line: first.start.line,
- column: first.start.column
+ line: firstLoc.start.line,
+ column: firstLoc.start.column
},
end: {
- line: last.end.line,
- column: last.end.column
+ line: lastLoc.end.line,
+ column: lastLoc.end.column
}
};
}