Skip to content

Commit 71e0d27

Browse files
authored
Merge pull request #3151 from sveltejs/gh-2906
correctly transform inline shorthand methods
2 parents b498829 + eff7f50 commit 71e0d27

File tree

4 files changed

+21
-0
lines changed

4 files changed

+21
-0
lines changed

src/compiler/compile/nodes/shared/Expression.ts

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -442,6 +442,10 @@ export default class Expression {
442442
`);
443443
}
444444

445+
if (parent && parent.method) {
446+
code.prependRight(node.start, ': ');
447+
}
448+
445449
function_expression = null;
446450
dependencies = null;
447451
contextual_dependencies = null;
Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
<script>
2+
export let bar;
3+
</script>
4+
5+
{bar.answer()}
Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
export default {
2+
html: '42'
3+
};
Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
<script>
2+
import Foo from './Foo.svelte';
3+
</script>
4+
5+
<Foo bar={{
6+
answer() {
7+
return 42;
8+
}
9+
}} />

0 commit comments

Comments
 (0)