Skip to content

Better error recovery for adjacent JSX elements in expression positions #5295

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

Merged

Conversation

RyanCavanaugh
Copy link
Member

Fixes #5286

@@ -72,8 +72,8 @@ baz
<div>@test content</div>;
<div><br />7x invalid-js-identifier</div>;
<LeftRight left={<a />} right={<b>monkeys /> gorillas</b> / > }/>
< a.b > ;
a.b > ;
,
Copy link
Contributor

Choose a reason for hiding this comment

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

is this , comes from synthesized missing node?

Copy link
Member Author

Choose a reason for hiding this comment

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

Correct

Copy link
Contributor

Choose a reason for hiding this comment

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

interesting, I didn't realize that we print missing nodes. In this case I'm not sure that user would expect to see it - this is our internal recovery strategy and I don' think it should leak outside. Maybe we should not emit missing nodes (since they are ...missed in the source code)

Copy link
Member Author

Choose a reason for hiding this comment

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

This is consistent with what we've done for a while. For example if you write

var x = a b;

we emit

var x = a, b;

As I've said before, I don't think emitting in the presence of syntax errors is a rational thing to do, but since we're doing it anyway, I think the code we emit should at least be syntactically valid (even if it makes guesses at the intent).

@DanielRosenwasser
Copy link
Member

👍

1 similar comment
@vladima
Copy link
Contributor

vladima commented Oct 20, 2015

👍

RyanCavanaugh added a commit that referenced this pull request Oct 20, 2015
Better error recovery for adjacent JSX elements in expression positions
@RyanCavanaugh RyanCavanaugh merged commit 853e9a2 into microsoft:master Oct 20, 2015
@RyanCavanaugh RyanCavanaugh deleted the detectAdjacentJsxElements branch October 20, 2015 20:16
@microsoft microsoft locked and limited conversation to collaborators Jun 19, 2018
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants