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

Functions are available where they shouldn't be #1079

Closed
Rich-Harris opened this issue Jan 7, 2018 · 1 comment · Fixed by #1092
Closed

Functions are available where they shouldn't be #1079

Rich-Harris opened this issue Jan 7, 2018 · 1 comment · Fixed by #1092
Labels

Comments

@Rich-Harris
Copy link
Member

REPL:

<script>
  export default {
    data: () => ({
      foo: 'bar'
    }),
		
    oncreate() {
      alert(JSON.stringify(data()));
    }
  };
</script>

The reference to data in oncreate should imply the existence of a global window.data function, which means that Svelte should call the actual data function something else, like data$1.

Tip o' the hat to @bm-stschneider

@Rich-Harris Rich-Harris added the bug label Jan 7, 2018
@Conduitry
Copy link
Member

Huh interesting. I thought we'd gotten all these name collision issues sorted, but apparently not. Something like https://www.npmjs.com/package/acorn-globals might be useful if we don't already have a way to detect these.

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