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

Pretty print lowercase jsx as attr of a jsx with braces. #1843

Merged
merged 2 commits into from
Mar 8, 2018

Conversation

IwanKaramazow
Copy link
Contributor

Prints braces around jsx attributes containing lowercase jsx:

<form label=<div /> />;
/* post-refmt: */
<form label={<div />} />;

Makes lowercase jsx as jsx attribute consistent with #1745

| (Nolabel, _) :: rest -> false
| _ :: rest -> hasSingleNonLabelledUnitAndIsAtTheEnd rest
in
if List.length jsxAttrs > 0
Copy link
Member

Choose a reason for hiding this comment

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

Doing jsxAttrs = [] is O(1) instead of O(n). Or just match on a 3-tuple

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Thanks! Should have thought about this...

Doing jsxAttrs != [] is O(1) instead of O(n)
@chenglou
Copy link
Member

chenglou commented Mar 7, 2018

Thanks! So what caused the small regression before?

@IwanKaramazow
Copy link
Contributor Author

I wrongly assumed that 'createElement' was part of lowercase jsx

@chenglou
Copy link
Member

chenglou commented Mar 8, 2018

Oh so you thought it was div.createElement? kk.

Thanks!

@chenglou chenglou merged commit 40d40f5 into reasonml:master Mar 8, 2018
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.

3 participants