Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Await Parenthesis #4267

Closed
j3rem1e opened this issue Jan 15, 2020 · 2 comments · Fixed by #4283
Closed

Await Parenthesis #4267

j3rem1e opened this issue Jan 15, 2020 · 2 comments · Fixed by #4283
Labels

Comments

@j3rem1e
Copy link

j3rem1e commented Jan 15, 2020

Describe the bug

If a component contains a javascript statement "await (expression)", then svelte removes the parenthesis in the generated javascript. However, the execution order is not the same (at least in chrome) :

"await a || b" is executed as "(await a) || b"

The bug is probably a regression between 3.12 and 3.17.1

To Reproduce

https://svelte.dev/repl/79a4dad98f3f41d7ae9840d3eb8209ea?version=3.17.1

	async function myTest() {
		let a, b;
		let c = await (a || b);
	}

has been outputed as

async function myTest() {
	let a, b;
	let c = await a || b;
}

Expected behavior

The parenthesis should not be removed in the generated javascript.

Information about your Svelte project:

  • Chrome 77
  • Svelte 3.17.1
  • Windows 7
  • Webpack

Severity

This is a minor issue because a workaround is easy to write, however the generated javascript is not correct and it's a regression with a previous version of svelte. it was not easy to find the cause of this new bugs in my application.

@Conduitry
Copy link
Member

Thanks, opened Rich-Harris/code-red#24 for the underlying issue.

@Conduitry
Copy link
Member

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants