mirror of
https://github.com/odoo/owl.git
synced 2025-10-06 19:59:41 +07:00
[FIX] compiler: handle t-set as functions
This commit is contained in:
committed by
Aaron Bohy
parent
75ad0835e9
commit
5bf47500d5
@@ -966,10 +966,17 @@ export class CodeGenerator {
|
||||
this.helpers.add("isBoundary").add("withDefault");
|
||||
const expr = ast.value ? compileExpr(ast.value || "") : "null";
|
||||
if (ast.body) {
|
||||
const initialTarget = this.target;
|
||||
this.helpers.add("LazyValue");
|
||||
let name = this.generateId("value");
|
||||
const fn = new CodeTarget(name);
|
||||
this.targets.push(fn);
|
||||
this.target = fn;
|
||||
const subCtx: Context = createContext(ctx);
|
||||
const nextId = `b${BlockDescription.nextBlockId}`;
|
||||
this.compileAST({ type: ASTType.Multi, content: ast.body }, subCtx);
|
||||
const value = ast.value ? (nextId ? `withDefault(${expr}, ${nextId})` : expr) : nextId;
|
||||
this.target = initialTarget;
|
||||
let value = `new LazyValue(${name}, ctx, node)`;
|
||||
value = ast.value ? (value ? `withDefault(${expr}, ${value})` : expr) : value;
|
||||
this.addLine(`ctx[\`${ast.name}\`] = ${value};`);
|
||||
} else {
|
||||
let value: string;
|
||||
|
||||
Reference in New Issue
Block a user