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: fix swapped key/value using t-foreach on Map #1502

Merged
merged 1 commit into from
Aug 2, 2023

Conversation

sdegueldre
Copy link
Contributor

In #1352 we added support for using t-foreach on Map objects, maps should behave the same as objects where keys are available under the name specified in t-as and values under that same name with the suffix _value. Unfortunately, because the code for objects was written in a confusing way (values were stored in a variable named keys and vice versa), the implementation for Map was incorrect and keys and values were swapped.

This commit fixes that and rewrites the code to be less confusing: keys are extracted from the variables k_block and values from v_block, which swaps the behaviour, and the code to prepare a list from an object now extracts the keys in keys and the values in values

In #1352 we added support for using t-foreach on Map objects,
maps should behave the same as objects where keys are available under
the name specified in t-as and values under that same name with the
suffix `_value`. Unfortunately, because the code for objects was written
in a confusing way (values were stored in a variable named `keys` and
vice versa), the implementation for Map was incorrect and keys and
values were swapped.

This commit fixes that and rewrites the code to be less confusing: keys
are extracted from the variables `k_block` and values from `v_block`,
which swaps the behaviour, and the code to prepare a list from an object
now extracts the keys in `keys` and the values in `values`
@aab-odoo aab-odoo merged commit 8f9ad98 into master Aug 2, 2023
3 checks passed
@aab-odoo aab-odoo deleted the master-fix-map-foreach-sad branch August 2, 2023 06:15
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