fix: remove exprCache, as formatting is contextual

Formatting expressions now depends on the currently defined variables, so
it cannot be put in a cache.
This commit is contained in:
Géry Debongnie
2019-03-22 14:46:47 +01:00
parent a444e3dcac
commit 6ea9ccf56f
-5
View File
@@ -147,7 +147,6 @@ export class Context {
export class QWeb {
processedTemplates: { [name: string]: ProcessedTemplate } = {};
templates: { [name: string]: CompiledTemplate<VNode> } = {};
exprCache: { [key: string]: string } = {};
directives: Directive[] = [];
constructor() {
@@ -592,9 +591,6 @@ export class QWeb {
_formatExpression(e: string, ctx?: Context): string {
e = e.trim();
if (e in this.exprCache) {
return this.exprCache[e];
}
if (e[0] === "{" && e[e.length - 1] === "}") {
const innerExpr = e
.slice(1, -1)
@@ -649,7 +645,6 @@ export class QWeb {
r += c;
}
const result = r.slice(0, -1);
this.exprCache[e] = result;
return result;
}
}