diff --git a/src/compiler/compile/nodes/shared/Expression.ts b/src/compiler/compile/nodes/shared/Expression.ts index a773355e3117..0603c15589d2 100644 --- a/src/compiler/compile/nodes/shared/Expression.ts +++ b/src/compiler/compile/nodes/shared/Expression.ts @@ -323,7 +323,7 @@ export default class Expression { const func_expression = func_declaration[0]; - if (node.type === 'InlineComponent') { + if (node.type === 'InlineComponent' || node.type === 'SlotTemplate') { // this.replace(func_expression); } else { diff --git a/test/runtime/samples/component-slot-let-inline-function/Inner.svelte b/test/runtime/samples/component-slot-let-inline-function/Inner.svelte new file mode 100644 index 000000000000..5a30e1855b69 --- /dev/null +++ b/test/runtime/samples/component-slot-let-inline-function/Inner.svelte @@ -0,0 +1,8 @@ + + \ No newline at end of file diff --git a/test/runtime/samples/component-slot-let-inline-function/Outer.svelte b/test/runtime/samples/component-slot-let-inline-function/Outer.svelte new file mode 100644 index 000000000000..40ed99ca63c9 --- /dev/null +++ b/test/runtime/samples/component-slot-let-inline-function/Outer.svelte @@ -0,0 +1,12 @@ + + + + + innerCall(a)} /> + + \ No newline at end of file diff --git a/test/runtime/samples/component-slot-let-inline-function/_config.js b/test/runtime/samples/component-slot-let-inline-function/_config.js new file mode 100644 index 000000000000..55318efaea5e --- /dev/null +++ b/test/runtime/samples/component-slot-let-inline-function/_config.js @@ -0,0 +1,27 @@ +let logs; +function log(value) { + logs.push(value); +} + +export default { + html: '', + props: { + a: 'a', + b: 'b', + log + }, + before_test() { + logs = []; + }, + async test({ assert, component, target, window }) { + const button = target.querySelector('button'); + await button.dispatchEvent(new window.MouseEvent('click')); + + assert.deepEqual(logs, ['a: a, b: b']); + + component.a = '1'; + component.b = '2'; + await button.dispatchEvent(new window.MouseEvent('click')); + assert.deepEqual(logs, ['a: a, b: b', 'a: 1, b: 2']); + } +}; diff --git a/test/runtime/samples/component-slot-let-inline-function/main.svelte b/test/runtime/samples/component-slot-let-inline-function/main.svelte new file mode 100644 index 000000000000..6ea417d0f29e --- /dev/null +++ b/test/runtime/samples/component-slot-let-inline-function/main.svelte @@ -0,0 +1,12 @@ + + + + +