-
-
Notifications
You must be signed in to change notification settings - Fork 4.3k
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
quoted method names are treated as undefined
when validating / checking for duplicates
#914
Comments
If we do want quoted method names to work, I can probably do the PR. |
I was just doing some poking around, and this seems to be an issue in a number of other places as well. When traversing the AST and looking at the properties of an We could probably do with some common helper function that extracts the As for the original issue you were trying to work around, it seems like we could get at that in a couple different ways - One by making it easier to ignore specific warnings (#824) - Or by providing some way in the component definition |
treat quoted property names the same way as identifiers -
This is fixed in 1.42. For the warnings, I think #824 is the way to go |
This is broken:
REPL
Stack Trace
bundle.35d793bc40a79d89436e63d8b274bfd88d0208bd.js:1 ValidationError: Duplicate property 'undefined' at ValidationError.CompileError [as constructor] (https://unpkg.com/svelte@1.41.2/compiler/svelte.js:11347:28) at new ValidationError (https://unpkg.com/svelte@1.41.2/compiler/svelte.js:12555:28) at Validator.error (https://unpkg.com/svelte@1.41.2/compiler/svelte.js:12576:15) at https://unpkg.com/svelte@1.41.2/compiler/svelte.js:11501:23 at Array.forEach () at checkForDupes (https://unpkg.com/svelte@1.41.2/compiler/svelte.js:11499:16) at methods (https://unpkg.com/svelte@1.41.2/compiler/svelte.js:11685:5) at https://unpkg.com/svelte@1.41.2/compiler/svelte.js:12067:21 at Array.forEach () at https://unpkg.com/svelte@1.41.2/compiler/svelte.js:12064:41Admittedly, I encountered this whilst trying to hack svelte's static analysis of my method names. So, perhaps it is best that method names are not permitted to be quoted. I need to call some functions that are created at runtime, so I did this in oncreate
this.someFunctions = makeSomeFunctions(args)
, in the viewon:stuff="someFunctions.foo()", and
methods: { 'someFunctions.foo': noop }`. It was just a thought to get svelte to stop yelling at me. But quite hacky. Maybe it is good to prevent me and everyone from doing this.The text was updated successfully, but these errors were encountered: