Don't recover from "adjacent jsx elements" parser error (#10682)

This commit is contained in:
Nicolò Ribaudo
2019-11-08 23:23:04 +03:00
committed by GitHub
parent c2bace4b73
commit 0287c0f02f
3 changed files with 5 additions and 197 deletions

View File

@@ -484,18 +484,12 @@ export default (superClass: Class<Parser>): Class<Parser> =>
node.closingElement = closingElement;
}
node.children = children;
while (this.isRelational("<")) {
// In case we encounter an lt token here it will always be the start of
// jsx as the lt sign is not allowed in places that expect an expression
this.finishToken(tt.jsxTagStart);
this.raise(
if (this.isRelational("<")) {
throw this.raise(
this.state.start,
"Adjacent JSX elements must be wrapped in an enclosing tag. " +
"Did you want a JSX fragment <>...</>?",
);
this.jsxParseElement();
}
return isFragment(openingElement)