From 1c37a6f56ce9653a92f27e17750d3a5a86b6b2c1 Mon Sep 17 00:00:00 2001 From: Patrick Steele-Idem Date: Thu, 31 Dec 2015 15:08:37 -0700 Subject: [PATCH] Change how static code is wrapped in a Node --- compiler/CompileContext.js | 6 ++++++ compiler/ast/TemplateRoot.js | 2 +- 2 files changed, 7 insertions(+), 1 deletion(-) diff --git a/compiler/CompileContext.js b/compiler/CompileContext.js index a9e168cda..12b19e361 100644 --- a/compiler/CompileContext.js +++ b/compiler/CompileContext.js @@ -90,6 +90,12 @@ class CompileContext { return; } + if (typeof code === 'string') { + // Wrap the String code in a Code AST node so that + // the code will be indented properly + code = this.builder.code(code); + } + if (this._staticCode == null) { this._staticCode = [code]; } else { diff --git a/compiler/ast/TemplateRoot.js b/compiler/ast/TemplateRoot.js index 59187092c..768051ec0 100644 --- a/compiler/ast/TemplateRoot.js +++ b/compiler/ast/TemplateRoot.js @@ -51,7 +51,7 @@ class TemplateRoot extends Node { var staticContent = [vars(createVarsArray(staticVars))]; if (staticCodeArray) { staticCodeArray.forEach((code) => { - staticContent.push(builder.code(code)); + staticContent.push(code); }); }