Skip to content

Prevent invalid JS being generated from awkward record labels - #3486

Merged
hdgarrood merged 2 commits into
masterfrom
fix-3481
Dec 17, 2018
Merged

Prevent invalid JS being generated from awkward record labels#3486
hdgarrood merged 2 commits into
masterfrom
fix-3481

Conversation

@hdgarrood

Copy link
Copy Markdown
Contributor

Fixes #3481. I've also included a commit with a small refactoring and improvement of some docs: in particular, I've removed a the now-misleading comment about what is done with symbols, because Ident values no longer contain symbols since we started requiring symbols to be aliases for named functions. I'd suggest reviewing each commit separately.

Since it is only used for ProperName values at all but one call site,
refactor to require that the argument is a ProperName rather than any
old Text.
Fixes #3481; the check for whether a string represents a valid JS
identifier was previously too permissive, i.e. it would allow through
some strings are not valid as JS identifiers, leading to invalid syntax
in the generated JS. For example, a string beginning with a digit is
not a valid JS identifier but it was previously considered to be by
the codegen phase of the compiler.
@hdgarrood hdgarrood changed the title Fix 3481 Prevent invalid JS being generated from awkward record labels Dec 17, 2018

@kritzcreek kritzcreek left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

All looks good to me 👍

@hdgarrood
hdgarrood merged commit 91886cb into master Dec 17, 2018
@hdgarrood

Copy link
Copy Markdown
Contributor Author

Thanks!

@hdgarrood
hdgarrood deleted the fix-3481 branch December 17, 2018 11:57
@garyb garyb mentioned this pull request Jan 12, 2019
3 tasks
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants