Allow characters in JsxText inside JsxFragment that would not normally scan

This commit is contained in:
uniqueiniquity 2018-02-22 15:56:34 -08:00
parent bb2c58b977
commit 71ff6dd91e
9 changed files with 20 additions and 5 deletions

View File

@ -4176,8 +4176,9 @@ namespace ts {
parseExpected(SyntaxKind.LessThanToken);
if (token() === SyntaxKind.GreaterThanToken) {
parseExpected(SyntaxKind.GreaterThanToken);
// See below for explanation of scanJsxText
const node: JsxOpeningFragment = <JsxOpeningFragment>createNode(SyntaxKind.JsxOpeningFragment, fullStart);
scanJsxText();
return finishNode(node);
}

View File

@ -12,7 +12,8 @@ declare var React: any;
< /*starting wrap*/ ></ /*ending wrap*/>; // comments in the tags
<>hi</>; // text inside
<><span>hi</span><div>bye</div></>; // children
<><span>1</span><><span>2.1</span><span>2.2</span></><span>3</span></>; // nested fragments
<><span>1</span><><span>2.1</span><span>2.2</span></><span>3</span></>; // nested fragments
<>#</>; // # would cause scanning error if not in jsxtext
//// [file.jsx]
<></>; // no whitespace
@ -21,3 +22,4 @@ declare var React: any;
<>hi</>; // text inside
<><span>hi</span><div>bye</div></>; // children
<><span>1</span><><span>2.1</span><span>2.2</span></><span>3</span></>; // nested fragments
<>#</>; // # would cause scanning error if not in jsxtext

View File

@ -35,3 +35,4 @@ declare var React: any;
>span : Symbol(JSX.IntrinsicElements, Decl(file.tsx, 1, 22))
>span : Symbol(JSX.IntrinsicElements, Decl(file.tsx, 1, 22))
<>#</>; // # would cause scanning error if not in jsxtext

View File

@ -52,3 +52,6 @@ declare var React: any;
>span : any
>span : any
<>#</>; // # would cause scanning error if not in jsxtext
><>#</> : JSX.Element

View File

@ -12,7 +12,8 @@ declare var React: any;
< /*starting wrap*/ ></ /*ending wrap*/>; // comments in the tags
<>hi</>; // text inside
<><span>hi</span><div>bye</div></>; // children
<><span>1</span><><span>2.1</span><span>2.2</span></><span>3</span></>; // nested fragments
<><span>1</span><><span>2.1</span><span>2.2</span></><span>3</span></>; // nested fragments
<>#</>; // # would cause scanning error if not in jsxtext
//// [file.js]
React.createElement(React.Fragment, null); // no whitespace
@ -28,3 +29,4 @@ React.createElement(React.Fragment, null,
React.createElement("span", null, "2.1"),
React.createElement("span", null, "2.2")),
React.createElement("span", null, "3")); // nested fragments
React.createElement(React.Fragment, null, "#"); // # would cause scanning error if not in jsxtext

View File

@ -35,3 +35,4 @@ declare var React: any;
>span : Symbol(JSX.IntrinsicElements, Decl(file.tsx, 1, 22))
>span : Symbol(JSX.IntrinsicElements, Decl(file.tsx, 1, 22))
<>#</>; // # would cause scanning error if not in jsxtext

View File

@ -52,3 +52,6 @@ declare var React: any;
>span : any
>span : any
<>#</>; // # would cause scanning error if not in jsxtext
><>#</> : JSX.Element

View File

@ -14,4 +14,5 @@ declare var React: any;
< /*starting wrap*/ ></ /*ending wrap*/>; // comments in the tags
<>hi</>; // text inside
<><span>hi</span><div>bye</div></>; // children
<><span>1</span><><span>2.1</span><span>2.2</span></><span>3</span></>; // nested fragments
<><span>1</span><><span>2.1</span><span>2.2</span></><span>3</span></>; // nested fragments
<>#</>; // # would cause scanning error if not in jsxtext

View File

@ -14,4 +14,5 @@ declare var React: any;
< /*starting wrap*/ ></ /*ending wrap*/>; // comments in the tags
<>hi</>; // text inside
<><span>hi</span><div>bye</div></>; // children
<><span>1</span><><span>2.1</span><span>2.2</span></><span>3</span></>; // nested fragments
<><span>1</span><><span>2.1</span><span>2.2</span></><span>3</span></>; // nested fragments
<>#</>; // # would cause scanning error if not in jsxtext