mirror of
https://github.com/odoo/owl.git
synced 2025-10-06 19:59:41 +07:00
t-debug now add a debugger in top of the compiled function
This commit is contained in:
@@ -233,6 +233,7 @@ export class QWeb {
|
|||||||
}
|
}
|
||||||
|
|
||||||
const mainNode = this.processedTemplates[name];
|
const mainNode = this.processedTemplates[name];
|
||||||
|
const isDebug = (<Element>mainNode).attributes.hasOwnProperty("t-debug");
|
||||||
const ctx = new Context();
|
const ctx = new Context();
|
||||||
this._compileNode(mainNode, ctx);
|
this._compileNode(mainNode, ctx);
|
||||||
|
|
||||||
@@ -249,12 +250,15 @@ export class QWeb {
|
|||||||
throw new Error("A template should have one root node");
|
throw new Error("A template should have one root node");
|
||||||
}
|
}
|
||||||
ctx.addLine(`return vn${ctx.rootNode};`);
|
ctx.addLine(`return vn${ctx.rootNode};`);
|
||||||
|
if (isDebug) {
|
||||||
|
ctx.code.unshift(" debugger");
|
||||||
|
}
|
||||||
let template = new Function(
|
let template = new Function(
|
||||||
"context",
|
"context",
|
||||||
"extra",
|
"extra",
|
||||||
ctx.code.join("\n")
|
ctx.code.join("\n")
|
||||||
) as CompiledTemplate<VNode>;
|
) as CompiledTemplate<VNode>;
|
||||||
if ((<Element>mainNode).attributes.hasOwnProperty("t-debug")) {
|
if (isDebug) {
|
||||||
console.log(
|
console.log(
|
||||||
`Template: ${
|
`Template: ${
|
||||||
this.processedTemplates[name].outerHTML
|
this.processedTemplates[name].outerHTML
|
||||||
|
|||||||
Reference in New Issue
Block a user