Fix bug with transitive values containing spaces #56
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.
Summary
Fixes a bug which caused some values to be corrupted during compilation. This bug occurs when a
@valuereferences another value, which in turn is long and contains spaces (e.g. a CSS relative color). For example, these two value statements trigger the bug:Cause
The regex used to fetch and resolve the value of an
@value foo: bar;declaration (i.e. a value declaration, not a value import) was unnecessarily iterative, since only a single value can be declared at a time in this manner. The iteration contained a flaw where the cursor of the regex was not adjusted for the length of the resolved value. So if the replaced value was longer than the variable it replaced, the next iteration would start parsing the resolved value as though it were another name/value pair.Fix
Removed the iteration, since only a single value can be declared at a time. An alternative fix would have been to add code to update the
lastIndexof theRegExpmatcher to account for the difference in length between the resolved value & the name it replaced.