-
Notifications
You must be signed in to change notification settings - Fork 7
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
Event name is not parsed correct if fired with identifier instead string constant #1
Comments
The same issue for svelte3 syntax import { createEventDispatcher } from 'svelte';
const dispatch = createEventDispatcher();
const CLOSE_EVENT_NAME = 'modalWasClosed';
dispatch(CLOSE_EVENT_NAME); |
Yeah, having the same problem with svelte 3 |
If there is something like: function dismiss() {
visible = false;
dispatch('dismiss', {
visible,
});
} The event export function dismiss() {
visible = false;
dispatch('dismiss', {
visible,
});
} The event |
@TheComputerM it looks like a new issue, I'm create a new one, thanks you for reporting! |
- Add utils functions to help parse identifiers: - Fix potential bugs: - utils.value was mutating the argument - parseEventDeclaration could attempt to read property of 'undefined' - Add/Update tests (3) for event name parsing in parser v2 and v3 - Add unit tests (3) for new utils function
Hi @alexprey. I Hope you had good holidays. This is a very old issue, but I saw it was also affecting the v3 parser, so I worked on it and opened a PR (#46) for a fix.
If you want to see support for more types of node, or if you think it should support bracket notation for identifier parsing, let me know. I also left some TODOs in the PR that I'm going to complete soon. |
…atChaotic#1) - Add util function isPunctuatorToken - Improve documentation for utils functions: - buildPropertyAccessorChainFromTokens - buildPropertyAccessorChainFromAst - getValueForPropertyAccessorChain - Add unit tests (6) for the functions mentioned above - Improve examples/alert: use identifer for event
fix(parser): Parse event name when using an identifier (#1)
At 4.0.0 point this issue are partially fixed. However to complete this issue we need more work. Not sure that supporting of left cases should be solved in the area of this library. For example - support of imported identifiers. Actually the library dont have any logic to resolve import files or analyze them. But if we can support that it will be nice. |
The bracket notation support would be nice to have, but indeed it is not that important. However, supporting imports parsing is a whole other story, and I feel like it should have its own separate issue. The way I see it, if the library supports the resolution and parsing of imported files, imported identifiers become top level identifiers, so the same logic can be applied to them. What do you think about creating a new issue that is more specific to the new problem (Resolve imported identifiers)? |
You are right, the imported identifiers handling looks like a new story. Keep only bracets notation in this issue and create a new one to support external references |
@soft-decay I create a new issue to discuss the architecture for imported identifiers - #48. I mark it with low priority, due TypeScript support is more important for that. |
…atChaotic#1) - parser v3: bracket notation for string 'Literal' nodes - parser v2: bracket notation for String tokens - Add unit tests (2 per parser) for bracket notation support
I added support for bracket notation with string literals in this PR #54. I did not implement nested computed Identifier. e.g. : dispatch(EVENT[OTHER.CONSTANT].NOTIFY) // Not supported
dispatch(EVENT["NESTED"].NOTIFY) // Supported |
I think that is out of scope, so ok |
enhance(parser): Support bracket notation when parsing event names (#1)
Event name is not parsed correct if fired with identifier instead string constant
Actual result
Expected result
UPD. At 4.0.0 point this issue are partially fixed.
EVENT_MODAL_CLOSE
)EVENT.MODAL.CLOSE
)EVENT['MODAL']['CLOSE']
). Actually, I'm not sure that this are requiredThe text was updated successfully, but these errors were encountered: