File tree 1 file changed +14
-1
lines changed
packages/svelte/src/compiler/phases/3-transform/server/visitors/shared
1 file changed +14
-1
lines changed Original file line number Diff line number Diff line change @@ -163,13 +163,26 @@ export function build_element_attributes(node, context) {
163
163
] )
164
164
) ;
165
165
} else {
166
+ /** @type {Expression } */
167
+ let expression = attribute . expression ;
168
+
169
+ if ( attribute . type === 'BindDirective' && expression . type === 'SequenceExpression' ) {
170
+ const getter = expression . expressions [ 0 ] ;
171
+ expression =
172
+ getter . type === 'ArrowFunctionExpression' &&
173
+ getter . params . length === 0 &&
174
+ getter . body . type !== 'BlockStatement'
175
+ ? getter . body
176
+ : b . call ( getter ) ;
177
+ }
178
+
166
179
attributes . push (
167
180
create_attribute ( attribute . name , - 1 , - 1 , [
168
181
{
169
182
type : 'ExpressionTag' ,
170
183
start : - 1 ,
171
184
end : - 1 ,
172
- expression : attribute . expression ,
185
+ expression,
173
186
metadata : {
174
187
expression : create_expression_metadata ( )
175
188
}
You can’t perform that action at this time.
0 commit comments