From 7b5610802a919b472d1cecedd3d535c2834ead10 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?G=C3=A9ry=20Debongnie?= Date: Wed, 6 Feb 2019 11:20:45 +0100 Subject: [PATCH] t-debug now add a debugger in top of the compiled function --- web/static/src/ts/core/qweb_vdom.ts | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/web/static/src/ts/core/qweb_vdom.ts b/web/static/src/ts/core/qweb_vdom.ts index a591f309..813c5f88 100644 --- a/web/static/src/ts/core/qweb_vdom.ts +++ b/web/static/src/ts/core/qweb_vdom.ts @@ -233,6 +233,7 @@ export class QWeb { } const mainNode = this.processedTemplates[name]; + const isDebug = (mainNode).attributes.hasOwnProperty("t-debug"); const ctx = new Context(); this._compileNode(mainNode, ctx); @@ -249,12 +250,15 @@ export class QWeb { throw new Error("A template should have one root node"); } ctx.addLine(`return vn${ctx.rootNode};`); + if (isDebug) { + ctx.code.unshift(" debugger"); + } let template = new Function( "context", "extra", ctx.code.join("\n") ) as CompiledTemplate; - if ((mainNode).attributes.hasOwnProperty("t-debug")) { + if (isDebug) { console.log( `Template: ${ this.processedTemplates[name].outerHTML