Skip to content

Commit 2b13874

Browse files
committed
Revert "one down"
This reverts commit 9f6c4cf.
1 parent 4e3bd94 commit 2b13874

File tree

2 files changed

+6
-12
lines changed

2 files changed

+6
-12
lines changed

packages/svelte/src/compiler/phases/3-transform/client/visitors/shared/component.js

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -261,10 +261,10 @@ export function build_component(node, component_name, context, anchor = context.
261261
let expression = /** @type {Expression} */ (context.visit(attribute.expression));
262262

263263
if (attribute.metadata.expression.has_state) {
264-
push_prop(b.get(b.call('$.attachment'), [b.return(expression)], true));
265-
} else {
266-
push_prop(b.prop('init', b.call('$.attachment'), expression, true));
264+
expression = b.arrow([b.id('$$node')], b.call(expression, b.id('$$node')));
267265
}
266+
267+
push_prop(b.prop('get', b.call('$.attachment'), expression, true));
268268
}
269269
}
270270

packages/svelte/src/compiler/utils/builders.js

Lines changed: 3 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -231,18 +231,12 @@ export function function_declaration(id, params, body) {
231231
}
232232

233233
/**
234-
* @param {ESTree.Expression | string} name
234+
* @param {string} name
235235
* @param {ESTree.Statement[]} body
236-
* @param {boolean} computed
237236
* @returns {ESTree.Property & { value: ESTree.FunctionExpression}}}
238237
*/
239-
export function get(name, body, computed = false) {
240-
return prop(
241-
'get',
242-
typeof name === 'string' ? key(name) : name,
243-
function_builder(null, [], block(body)),
244-
computed
245-
);
238+
export function get(name, body) {
239+
return prop('get', key(name), function_builder(null, [], block(body)));
246240
}
247241

248242
/**

0 commit comments

Comments
 (0)