trivago / melody

Melody is a library for building JavaScript web applications.
https://melody.js.org
Apache License 2.0
215 stars 39 forks source link

Mark BinaryConcatExpressions generated by Melody #141

Closed twbartel closed 4 years ago

twbartel commented 4 years ago

What changed in this PR:

The Parser turns

<img title="Testing: {{ variable }} foo">

into

<img title="{{ 'Testing: ' ~ variable ~ ' foo' }}">

That is, it generates a string concatenation (BinaryConcatExpression) from strings that contain dynamic expressions. This destroys the information if the original input was a string containing expressions, or if the original input was already a concatenation expression using ~. However, this information can be useful for pretty printers.

This PR adds the boolean isMelodyGenerated to those string concatenations that were generated by this Parser.