Deprecate variableLookups on LHS of assign.
charlespwd opened this issue · comments
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.
liquid/lib/liquid/tags/assign.rb
Line 38 in 81f44e3
liquid/lib/liquid/tags/assign.rb
Line 17 in 81f44e3
Line 33 in 81f44e3
While we're there, we should probably cleanup our regex for variable segment, variable signature, etc.