[FIX] compiler: fix swapped key/value using t-foreach on Map #1502
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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 namedkeys
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 fromv_block
, which swaps the behaviour, and the code to prepare a list from an object now extracts the keys inkeys
and the values invalues