mirror of
https://github.com/marko-js/marko.git
synced 2025-12-08 19:26:05 +00:00
Change how static code is wrapped in a Node
This commit is contained in:
parent
3ac2e0daca
commit
1c37a6f56c
@ -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 {
|
||||||
|
|||||||
@ -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);
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user