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.js19
1 files changed, 19 insertions, 0 deletions
diff --git a/lib/handlebars/compiler/helpers.js b/lib/handlebars/compiler/helpers.js
index bf72034..e04f4dd 100644
--- a/lib/handlebars/compiler/helpers.js
+++ b/lib/handlebars/compiler/helpers.js
@@ -185,3 +185,22 @@ export function prepareProgram(statements, loc) {
}
+export function preparePartialBlock(openPartialBlock, program, close, locInfo) {
+ if (openPartialBlock.name.original !== close.path.original) {
+ let errorNode = {loc: openPartialBlock.name.loc};
+
+ throw new Exception(openPartialBlock.name.original + " doesn't match " + close.path.original, errorNode);
+ }
+
+ return {
+ type: 'PartialBlockStatement',
+ path: openPartialBlock.name,
+ params: openPartialBlock.params,
+ hash: openPartialBlock.hash,
+ program,
+ openStrip: openPartialBlock.strip,
+ closeStrip: close && close.strip,
+ loc: this.locInfo(locInfo)
+ };
+}
+