fix bind:group

pull/16607/head
Jack Goodall 4 weeks ago
parent 805ca34a96
commit 4c3c658bfa

@ -14,6 +14,11 @@ import { init_spread_bindings } from '../../shared/spread_bindings.js';
* @param {ComponentContext} context
*/
export function BindDirective(node, context) {
const expression = /** @type {Expression} */ (context.visit(node.expression));
const property = binding_properties[node.name];
const parent = /** @type {AST.SvelteNode} */ (context.path.at(-1));
let get, set;
// Handle SpreadElement by creating a variable declaration before visiting
@ -21,10 +26,7 @@ export function BindDirective(node, context) {
const { get: getter, set: setter } = init_spread_bindings(node.expression, context);
get = getter;
set = setter;
} else {
const expression = /** @type {Expression} */ (context.visit(node.expression));
if (expression.type === 'SequenceExpression') {
} else if (expression.type === 'SequenceExpression') {
[get, set] = expression.expressions;
} else {
if (
@ -62,11 +64,6 @@ export function BindDirective(node, context) {
set = undefined;
}
}
}
const property = binding_properties[node.name];
const parent = /** @type {AST.SvelteNode} */ (context.path.at(-1));
/** @type {CallExpression} */
let call;
@ -231,7 +228,7 @@ export function BindDirective(node, context) {
if (value !== undefined) {
group_getter = b.thunk(
b.block([b.stmt(build_attribute_value(value, context).value), b.return(get)])
b.block([b.stmt(build_attribute_value(value, context).value), b.return(b.call(get))])
);
}
}

Loading…
Cancel
Save