Skip to content

fix extract names from ThisExpression #5036

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

Merged

Conversation

tanhauhau
Copy link
Member

Fixes #5033

We assumed object of MemberExpression to be Identifier only, ThisExpression does not have .name, causing .name[0] to be accessing property 0 of undefined

Before submitting the PR, please make sure you do the following

  • It's really useful if your PR relates to an outstanding issue, so please reference it in your PR, or create an explanatory one for discussion. In many cases features are absent for a reason.
  • This message body should clearly illustrate what problems it solves. If there are related issues, remember to reference them.
  • Ideally, include a test that fails without this PR but passes with it. PRs will only be merged once they pass CI. (Remember to npm run lint!)

Tests

  • Run the tests tests with npm test or yarn test)

@Conduitry
Copy link
Member

Can we get by without making this a js sample test? The reported issue was that the component wouldn't compile at all, which a runtime test would still catch. To test for the correct behavior of the generated code, we could have something like <button on:click={function () {}}> that uses this in some way.

@tanhauhau tanhauhau force-pushed the tanhauhau/fix-extract-name-from-this branch from e130151 to aa661cf Compare June 18, 2020 13:28
@Conduitry Conduitry merged commit 6e2b816 into sveltejs:master Jun 23, 2020
taylorzane pushed a commit to taylorzane/svelte that referenced this pull request Dec 17, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Compiler fails with "can't access property 0"
2 participants