simolus3 / zap

Zap is a fast web framework built on Dart
https://simonbinder.eu/zap/
MIT License
233 stars 12 forks source link

fix(zap_dev): Wrap interpolated identifiers in braces #23

Closed dnys1 closed 9 months ago

dnys1 commented 9 months ago

When component variables are interpolated in strings, the replacement identifier can cause invalidate Dart code to be generated if the identifier is not wrapped in braces already.

For example:

<script>
  String? value;
  String? interpolated;

  $: interpolated = '$value';
</script>

Here, the interpolated string currently becomes something like $_$v2 /* value */ which is invalid Dart code, when we really want ${_$v2 /* value */}.