[IMP] update owl to v1.4.9

This commit is contained in:
Samuel Degueldre
2021-12-07 10:32:08 +01:00
parent 2a8f5e95d2
commit c313ab9dd5
+31 -5
View File
@@ -359,6 +359,7 @@
* the list of variables so it does not get replaced by a lookup in the context
*/
function compileExprToArray(expr, scope) {
const localVars = new Set();
scope = Object.create(scope);
const tokens = tokenize(expr);
let i = 0;
@@ -407,12 +408,14 @@
if (tokens[j].type === "SYMBOL" && tokens[j].originalValue) {
tokens[j].value = tokens[j].originalValue;
scope[tokens[j].value] = { id: tokens[j].value, expr: tokens[j].value };
localVars.add(tokens[j].value);
}
j--;
}
}
else {
scope[token.value] = { id: token.value, expr: token.value };
localVars.add(token.value);
}
}
if (isVar) {
@@ -427,6 +430,13 @@
}
i++;
}
// Mark all variables that have been used locally.
// This assumes the expression has only one scope (incorrect but "good enough for now")
for (const token of tokens) {
if (token.type === "SYMBOL" && localVars.has(token.value)) {
token.isLocal = true;
}
}
return tokens;
}
function compileExpr(expr, scope) {
@@ -578,7 +588,18 @@
const done = new Set();
return tokens
.map((tok) => {
if (tok.varName) {
// "this" in captured expressions should be the current component
if (tok.value === "this") {
if (!done.has("this")) {
done.add("this");
this.addLine(`const this_${argId} = utils.getComponent(context);`);
}
tok.value = `this_${argId}`;
}
// Variables that should be looked up in the scope. isLocal is for arrow
// function arguments that should stay untouched (eg "ev => ev" should
// not become "const ev_1 = scope['ev']; ev_1 => ev_1")
if (tok.varName && !tok.isLocal) {
if (!done.has(tok.varName)) {
done.add(tok.varName);
this.addLine(`const ${tok.varName}_${argId} = ${tok.value};`);
@@ -3176,7 +3197,12 @@ See https://github.com/odoo/owl/blob/master/doc/reference/config.md#mode for mor
else if (!name.startsWith("t-")) {
if (name !== "class" && name !== "style") {
// this is a prop!
props[name] = ctx.formatExpression(value) || "undefined";
if (value.includes("=>")) {
props[name] = ctx.captureExpression(value);
}
else {
props[name] = ctx.formatExpression(value) || "undefined";
}
}
}
}
@@ -5546,9 +5572,9 @@ See https://github.com/odoo/owl/blob/master/doc/reference/config.md#mode for mor
Object.defineProperty(exports, '__esModule', { value: true });
__info__.version = '1.4.8';
__info__.date = '2021-11-03T12:45:06.330Z';
__info__.hash = '307b936';
__info__.version = '1.4.9';
__info__.date = '2021-12-07T09:22:06.573Z';
__info__.hash = '73f94fb';
__info__.url = 'https://github.com/odoo/owl';