summaryrefslogtreecommitdiffstats
path: root/lib/handlebars/compiler/helpers.js
diff options
context:
space:
mode:
Diffstat (limited to 'lib/handlebars/compiler/helpers.js')
-rw-r--r--lib/handlebars/compiler/helpers.js22
1 files changed, 14 insertions, 8 deletions
diff --git a/lib/handlebars/compiler/helpers.js b/lib/handlebars/compiler/helpers.js
index 50a3c53..3a3ece6 100644
--- a/lib/handlebars/compiler/helpers.js
+++ b/lib/handlebars/compiler/helpers.js
@@ -1,5 +1,17 @@
import Exception from "../exception";
+export function SourceLocation(source, locInfo) {
+ this.source = source;
+ this.start = {
+ line: locInfo.first_line,
+ column: locInfo.first_column
+ };
+ this.end = {
+ line: locInfo.last_line,
+ column: locInfo.last_column
+ };
+}
+
export function stripFlags(open, close) {
return {
left: open.charAt(2) === '~',
@@ -15,10 +27,7 @@ export function stripComment(comment) {
export function prepareRawBlock(openRawBlock, content, close, locInfo) {
/*jshint -W040 */
if (openRawBlock.sexpr.id.original !== close) {
- var errorNode = {
- firstLine: openRawBlock.sexpr.firstLine,
- firstColumn: openRawBlock.sexpr.firstColumn
- };
+ var errorNode = {loc: openRawBlock.sexpr.loc};
throw new Exception(openRawBlock.sexpr.id.original + " doesn't match " + close, errorNode);
}
@@ -32,10 +41,7 @@ export function prepareBlock(openBlock, program, inverseAndProgram, close, inver
/*jshint -W040 */
// When we are chaining inverse calls, we will not have a close path
if (close && close.path && openBlock.sexpr.id.original !== close.path.original) {
- var errorNode = {
- firstLine: openBlock.sexpr.firstLine,
- firstColumn: openBlock.sexpr.firstColumn
- };
+ var errorNode = {loc: openBlock.sexpr.loc};
throw new Exception(openBlock.sexpr.id.original + ' doesn\'t match ' + close.path.original, errorNode);
}