File tree Expand file tree Collapse file tree 1 file changed +14
-5
lines changed
packages/svelte/src/compiler/phases/3-transform/client/visitors/shared Expand file tree Collapse file tree 1 file changed +14
-5
lines changed Original file line number Diff line number Diff line change @@ -130,12 +130,21 @@ export function build_template_chunk(
130130 value = { ...value , right : b . literal ( '' ) } ;
131131 }
132132 } else if (
133- state . analysis . props_id &&
134- value . type === 'Identifier' &&
135- value . name === state . analysis . props_id . name
133+ // $props.id() is never null/undefined
134+ ! (
135+ state . analysis . props_id &&
136+ value . type === 'Identifier' &&
137+ value . name === state . analysis . props_id . name
138+ ) &&
139+ // Binary expressions are never null/undefined
140+ value . type !== 'BinaryExpression' &&
141+ // Unary expressions are never null/undefined (except for void/delete)
142+ ! (
143+ value . type === 'UnaryExpression' &&
144+ value . operator !== 'void' &&
145+ value . operator !== 'delete'
146+ )
136147 ) {
137- // do nothing ($props.id() is never null/undefined)
138- } else {
139148 value = b . logical ( '??' , value , b . literal ( '' ) ) ;
140149 }
141150
You can’t perform that action at this time.
0 commit comments