Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[FIX] compiler: better support for arrow function and function call #1619

Merged
merged 1 commit into from
Jun 17, 2024
Merged

[FIX] compiler: better support for arrow function and function call #1619

merged 1 commit into from
Jun 17, 2024

Conversation

rfr-odoo
Copy link
Contributor

This commit fixes inline expressions when we have these conditions:

  • inline expression that contains an arrow function
  • inside the arrow function call a function with multiple arguments (3+)
  • the second argument (not the first and not the last) must be a variable

In the compileExprToArray we have a code to handle missing tokens in an object
e.g.: {a} (equivalent to {a:a})

When OWL match all 3 conditions listed above we execute the code to handle the missing tokens and so it alter the tokens and adds a new token: { type: "COLON", value: ":" }
This result in a Javascript compilation error:
OwlError: Failed to compile template "XXX": missing ) after argument list

To fix the error and avoid execute the code to handle the missing tokens, now, we track also the parentheses in our local stack.

This commit fixes inline expressions when we have these conditions:
* inline expression that contains an arrow function
* inside the arrow function call a function with multiple arguments (3+)
* the second argument (not the first and not the last) must be a variable

In the `compileExprToArray` we have a code to handle missing tokens in an object
e.g.: {a} (equivalent to {a:a})

When OWL match all 3 conditions listed above we execute the code to handle
the missing tokens and so it alter the tokens and adds a new token:
`{ type: "COLON", value: ":" }`
This result in a Javascript compilation error:
OwlError: Failed to compile template "XXX": missing ) after argument list

To fix the error and avoid execute the code to handle the missing tokens, now,
we track also the parentheses in our local stack.
@ged-odoo ged-odoo merged commit e7f405c into odoo:master Jun 17, 2024
3 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants