Deprecate variableLookups on LHS of assign.
Nobody has claimed this yet.
- Dominant language
- Ruby
- Stars
- 11.9k
- Forks
- 1.5k
- Avg merge
- 17h 55m
- Merged PRs (30d)
- 3
Description
This is obscure and we do support it but behaves rather strangely. We should deprecate this.
{% assign product.img = "hi" %}
{% # prints nothing %}
{{ product.img }}
{% # prints "hi" %}
{{ ["product.img"] }}
It's because we parse the entire assign LHS as a string and then assign the context's <stringValueOfLHS> to be the value of the RHS. And our VariableSegment regex accepts dots and square brackets.
https://github.com/Shopify/liquid/blob/81f44e36be5f2110c26b6532fd4ccd22edaf59f2/lib/liquid.rb#L33
While we're there, we should probably cleanup our regex for variable segment, variable signature, etc.
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start with lib/liquid/tags/assign.rb and the referenced variable parsing code in lib/liquid.rb. Trace how the assign LHS becomes a context string value, then review the VariableSegment and variable signature regexes. Done means the current LHS lookup behavior is deprecated and the related regex handling is cleaned up without preserving the confusing semantics.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- ruby
- Domain
- compilers
- Issue type
- Refactor
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 35/100