Change how static code is wrapped in a Node

This commit is contained in:
Patrick Steele-Idem 2015-12-31 15:08:37 -07:00
parent 3ac2e0daca
commit 1c37a6f56c
2 changed files with 7 additions and 1 deletions

View File

@ -90,6 +90,12 @@ class CompileContext {
return; 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) { if (this._staticCode == null) {
this._staticCode = [code]; this._staticCode = [code];
} else { } else {

View File

@ -51,7 +51,7 @@ class TemplateRoot extends Node {
var staticContent = [vars(createVarsArray(staticVars))]; var staticContent = [vars(createVarsArray(staticVars))];
if (staticCodeArray) { if (staticCodeArray) {
staticCodeArray.forEach((code) => { staticCodeArray.forEach((code) => {
staticContent.push(builder.code(code)); staticContent.push(code);
}); });
} }