Skip to content
This repository was archived by the owner on Jan 19, 2019. It is now read-only.

Commit b680953

Browse files
committed
Treat SyntaxKind.JsxText like a token, to prevent traversing into its contents
1 parent d613bff commit b680953

File tree

1 file changed

+5
-1
lines changed

1 file changed

+5
-1
lines changed

lib/ast-converter.js

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -436,7 +436,11 @@ function convertTokens(ast) {
436436
* @returns {undefined}
437437
*/
438438
function walk(node) {
439-
if (isToken(node) && node.kind !== ts.SyntaxKind.EndOfFileToken) {
439+
/**
440+
* Note: We treat JsxText like a token, to prevent traversing into it and creating
441+
* unintended addiontal tokens from its contents
442+
*/
443+
if (node.kind === ts.SyntaxKind.JsxText || (isToken(node) && node.kind !== ts.SyntaxKind.EndOfFileToken)) {
440444
var converted = convertToken(node, ast);
441445
if (converted) {
442446
result.push(converted);

0 commit comments

Comments
 (0)