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

fix(parser): Parse event name when using an identifier (#1) #46

Merged
merged 2 commits into from
Jan 25, 2021

Conversation

soft-decay
Copy link
Contributor

@soft-decay soft-decay commented Jan 17, 2021

  • Add utils functions to help parse identifiers:
    • isPunctuatorToken (used internally in utils)
    • buildObjectFromObjectExpression (used internally in utils)
    • buildPropertyAccessorChainFromTokens (v2 parser only)
    • buildPropertyAccessorChainFromAst (v3 parser only)
    • getValueForPropertyAccessorChain (_v2 and v3 parsers)
  • 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 (9) for new utils function

TODO:

  • Add missing tests for utils functions edge cases
  • Add missing tests for event name parsing in other contexts
  • Finish documentation
  • Cleanup code

- 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
@alexprey
Copy link
Collaborator

Great, thanks for your work!

@alexprey alexprey added the enhancement New feature or request label Jan 22, 2021
@alexprey alexprey added this to the 4.0.0 milestone Jan 22, 2021
@alexprey
Copy link
Collaborator

Please let me know when you are ready with this PR, for me the current status is OK

…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
@soft-decay soft-decay marked this pull request as ready for review January 23, 2021 21:02
@soft-decay
Copy link
Contributor Author

I've completed the missing tasks. It should be good to merge.
There were some minor code change so you should check if everything is ok with you.

@alexprey alexprey merged commit 660d246 into KatChaotic:master Jan 25, 2021
@alexprey
Copy link
Collaborator

Thanks!

@alexprey alexprey linked an issue Feb 13, 2021 that may be closed by this pull request
3 tasks
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Event name is not parsed correct if fired with identifier instead string constant
2 participants