Skip to content

Commit

Permalink
Merge pull request #3333 from Conduitry/gh-3179
Browse files Browse the repository at this point in the history
preserve async/generator-ness of hoisted function expressions
  • Loading branch information
Rich-Harris committed Aug 3, 2019
2 parents 76d04dc + bfa0bc9 commit 21e3db1
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 1 deletion.
2 changes: 1 addition & 1 deletion src/compiler/compile/nodes/shared/Expression.ts
Original file line number Diff line number Diff line change
Expand Up @@ -363,7 +363,7 @@ export default class Expression {
}

const fn = deindent`
function ${name}(${args.join(', ')}) ${body}
${node.async && 'async '}function${node.generator && '*'} ${name}(${args.join(', ')}) ${body}
`;

if (dependencies.size === 0 && contextual_dependencies.size === 0) {
Expand Down
5 changes: 5 additions & 0 deletions test/runtime/samples/event-handler-async/_config.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
export default {
html: `
<button>nothing</button>
`,
};
1 change: 1 addition & 0 deletions test/runtime/samples/event-handler-async/main.svelte
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
<button on:click={async () => { await null; }}>nothing</button>

0 comments on commit 21e3db1

Please sign in to comment.