@@ -1533,37 +1533,8 @@ function serialize_template_literal(values, visit, state) {
15331533 if ( node . type === 'ExpressionTag' && node . metadata . contains_call_expression ) {
15341534 contains_call_expression = true ;
15351535 }
1536- let expression = visit ( node . expression ) ;
1537- if ( node . expression . type === 'Identifier' ) {
1538- const name = node . expression . name ;
1539- const binding = scope . get ( name ) ;
1540- // When we combine expressions as part of a single template element, we might
1541- // be referencing variables that can be mutated, but are not actually state.
1542- // In order to prevent this undesired behavior, we need ensure we cache the
1543- // latest value we have of that variable before we process the template, enforcing
1544- // the value remains static through the lifetime of the template.
1545- if ( binding !== null && binding . kind === 'normal' && binding . mutated ) {
1546- let has_already_cached = false ;
1547- // Check if we already create a const of this expression
1548- for ( let node of state . init ) {
1549- if (
1550- node . type === 'VariableDeclaration' &&
1551- node . declarations [ 0 ] . id . type === 'Identifier' &&
1552- node . declarations [ 0 ] . id . name === name + '_const'
1553- ) {
1554- has_already_cached = true ;
1555- expression = b . id ( name + '_const' ) ;
1556- break ;
1557- }
1558- }
1559- if ( ! has_already_cached ) {
1560- const tmp_id = scope . generate ( name + '_const' ) ;
1561- state . init . push ( b . const ( tmp_id , expression ) ) ;
1562- expression = b . id ( tmp_id ) ;
1563- }
1564- }
1565- }
1566- expressions . push ( b . call ( '$.stringify' , expression ) ) ;
1536+
1537+ expressions . push ( b . call ( '$.stringify' , visit ( node . expression ) ) ) ;
15671538 quasis . push ( b . quasi ( '' , i + 1 === values . length ) ) ;
15681539 }
15691540 }
0 commit comments