Skip to content

Conversation

@jasmith-hs
Copy link
Contributor

So that deferred words that aren't in the combined scope aren't attempted to be reconstructed in the wrong scope

Follow up on #1032

This test demonstrates the problem:

{% set my_list = [] %}
{% set foo %}
{% do my_list.append(deferred) %}a
{% endset %}
{{ my_list }}

We don't want my_list to get reconstructed inside the set tag so we should filter the deferred words that we reconstruct before deferring them to only reconstruct those within the current scope.

… the combined scope aren't attempted to be reconstructed in the wrong scope
Set<String> deferredWordBases = deferredWords
.stream()
.map(w -> w.split("\\.", 2)[0])
.filter(combinedScope::containsKey)
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This line is the change, the rest is refactoring duplicated code

@jasmith-hs jasmith-hs merged commit 3c1852e into master Mar 30, 2023
@jasmith-hs jasmith-hs deleted the improve-deferred-word-filter branch March 30, 2023 13:57
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants