Skip to content

Commit fe64b20

Browse files
committed
restrict to literals
1 parent cd8b708 commit fe64b20

File tree

1 file changed

+6
-1
lines changed
  • packages/svelte/src/compiler/phases/3-transform/client

1 file changed

+6
-1
lines changed

packages/svelte/src/compiler/phases/3-transform/client/utils.js

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -344,5 +344,10 @@ export function push_template_expression(state, expression_to_add) {
344344
* @returns {boolean}
345345
*/
346346
export function can_inline_variable(binding) {
347-
return !!binding && !binding.scope.parent;
347+
return (
348+
!!binding &&
349+
!binding.scope.parent &&
350+
// to prevent the need for escaping
351+
binding.initial?.type === 'Literal'
352+
);
348353
}

0 commit comments

Comments
 (0)