File tree Expand file tree Collapse file tree 2 files changed +20
-11
lines changed Expand file tree Collapse file tree 2 files changed +20
-11
lines changed Original file line number Diff line number Diff line change @@ -351,6 +351,15 @@ module.exports = function(acorn) {
351
351
return this . finishNode ( node , 'JSXElement' ) ;
352
352
} ;
353
353
354
+ // Parse JSX text
355
+
356
+ pp . jsx_parseText = function ( value ) {
357
+ var node = this . parseLiteral ( value ) ;
358
+ node . type = "JSXText" ;
359
+
360
+ return node ;
361
+ } ;
362
+
354
363
// Parses entire JSX element from current position.
355
364
356
365
pp . jsx_parseElement = function ( ) {
@@ -376,7 +385,7 @@ module.exports = function(acorn) {
376
385
instance . extend ( 'parseExprAtom' , function ( inner ) {
377
386
return function ( refShortHandDefaultPos ) {
378
387
if ( this . type === tt . jsxText )
379
- return this . parseLiteral ( this . value ) ;
388
+ return this . jsx_parseText ( this . value ) ;
380
389
else if ( this . type === tt . jsxTagStart )
381
390
return this . jsx_parseElement ( ) ;
382
391
else
Original file line number Diff line number Diff line change @@ -214,7 +214,7 @@ var fbTestFixture = {
214
214
}
215
215
} ,
216
216
children : [ {
217
- type : 'Literal ' ,
217
+ type : 'JSXText ' ,
218
218
value : ' ' ,
219
219
raw : ' ' ,
220
220
range : [ 15 , 16 ] ,
@@ -239,7 +239,7 @@ var fbTestFixture = {
239
239
end : { line : 1 , column : 23 }
240
240
}
241
241
} , {
242
- type : 'Literal ' ,
242
+ type : 'JSXText ' ,
243
243
value : ' ' ,
244
244
raw : ' ' ,
245
245
range : [ 23 , 24 ] ,
@@ -735,7 +735,7 @@ var fbTestFixture = {
735
735
} ,
736
736
children : [
737
737
{
738
- type : "Literal " ,
738
+ type : "JSXText " ,
739
739
value : "\nbar\nbaz\n" ,
740
740
raw : "\nbar\nbaz\n" ,
741
741
range : [
@@ -1238,7 +1238,7 @@ var fbTestFixture = {
1238
1238
}
1239
1239
} ,
1240
1240
children : [ {
1241
- type : 'Literal ' ,
1241
+ type : 'JSXText ' ,
1242
1242
value : '@test content' ,
1243
1243
raw : '@test content' ,
1244
1244
range : [ 5 , 18 ] ,
@@ -1392,7 +1392,7 @@ var fbTestFixture = {
1392
1392
}
1393
1393
}
1394
1394
} , {
1395
- type : 'Literal ' ,
1395
+ type : 'JSXText ' ,
1396
1396
value : '7x invalid-js-identifier' ,
1397
1397
raw : '7x invalid-js-identifier' ,
1398
1398
range : [
@@ -1654,7 +1654,7 @@ var fbTestFixture = {
1654
1654
} ,
1655
1655
"children" : [
1656
1656
{
1657
- "type" : "Literal " ,
1657
+ "type" : "JSXText " ,
1658
1658
"value" : "monkeys /> gorillas" ,
1659
1659
"raw" : "monkeys /> gorillas" ,
1660
1660
"range" : [
@@ -3200,7 +3200,7 @@ var fbTestFixture = {
3200
3200
} ,
3201
3201
children : [
3202
3202
{
3203
- type : "Literal " ,
3203
+ type : "JSXText " ,
3204
3204
start : 3 ,
3205
3205
end : 7 ,
3206
3206
value : "foo " ,
@@ -3252,15 +3252,15 @@ var fbTestFixture = {
3252
3252
}
3253
3253
} ,
3254
3254
children : [ {
3255
- type : "Literal " ,
3255
+ type : "JSXText " ,
3256
3256
start : 22 ,
3257
3257
end : 26 ,
3258
3258
value : " bar" ,
3259
3259
raw : " bar"
3260
3260
} ]
3261
3261
} ,
3262
3262
{
3263
- type : "Literal " ,
3263
+ type : "JSXText " ,
3264
3264
start : 30 ,
3265
3265
end : 34 ,
3266
3266
value : " baz" ,
@@ -3441,7 +3441,7 @@ var fbTestFixture = {
3441
3441
}
3442
3442
} ,
3443
3443
children : [ {
3444
- type : "Literal " ,
3444
+ type : "JSXText " ,
3445
3445
start : 5 ,
3446
3446
end : 10 ,
3447
3447
value : "/text" ,
You can’t perform that action at this time.
0 commit comments