File tree Expand file tree Collapse file tree 2 files changed +68
-9
lines changed Expand file tree Collapse file tree 2 files changed +68
-9
lines changed Original file line number Diff line number Diff line change @@ -244,15 +244,8 @@ module.exports = function(acorn) {
244
244
// at the beginning of the next one (right brace).
245
245
246
246
pp . jsx_parseEmptyExpression = function ( ) {
247
- var tmp = this . start ;
248
- this . start = this . lastTokEnd ;
249
- this . lastTokEnd = tmp ;
250
-
251
- tmp = this . startLoc ;
252
- this . startLoc = this . lastTokEndLoc ;
253
- this . lastTokEndLoc = tmp ;
254
-
255
- return this . finishNode ( this . startNode ( ) , 'JSXEmptyExpression' ) ;
247
+ var node = this . startNodeAt ( this . lastTokEnd , this . lastTokEndLoc ) ;
248
+ return this . finishNodeAt ( node , 'JSXEmptyExpression' , this . start , this . startLoc ) ;
256
249
} ;
257
250
258
251
// Parses JSX expression enclosed into curly brackets.
Original file line number Diff line number Diff line change @@ -3634,10 +3634,76 @@ var fbTestFixture = {
3634
3634
if ( typeof exports !== "undefined" ) {
3635
3635
var test = require ( "./driver.js" ) . test ;
3636
3636
var testFail = require ( "./driver.js" ) . testFail ;
3637
+ var tokTypes = require ( "../" ) . tokTypes ;
3637
3638
}
3638
3639
3639
3640
testFail ( "var x = <div>one</div><div>two</div>;" , "Adjacent JSX elements must be wrapped in an enclosing tag (1:22)" ) ;
3640
3641
3642
+ test ( '<a>{/* foo */}</a>' , { } , {
3643
+ onToken : [
3644
+ {
3645
+ type : tokTypes . jsxTagStart ,
3646
+ value : undefined ,
3647
+ start : 0 ,
3648
+ end : 1
3649
+ } ,
3650
+ {
3651
+ type : tokTypes . jsxName ,
3652
+ value : 'a' ,
3653
+ start : 1 ,
3654
+ end : 2
3655
+ } ,
3656
+ {
3657
+ type : tokTypes . jsxTagEnd ,
3658
+ value : undefined ,
3659
+ start : 2 ,
3660
+ end : 3
3661
+ } ,
3662
+ {
3663
+ type : tokTypes . braceL ,
3664
+ value : undefined ,
3665
+ start : 3 ,
3666
+ end : 4
3667
+ } ,
3668
+ {
3669
+ type : tokTypes . braceR ,
3670
+ value : undefined ,
3671
+ start : 13 ,
3672
+ end : 14
3673
+ } ,
3674
+ {
3675
+ type : tokTypes . jsxTagStart ,
3676
+ value : undefined ,
3677
+ start : 14 ,
3678
+ end : 15
3679
+ } ,
3680
+ {
3681
+ type : tokTypes . slash ,
3682
+ value : '/' ,
3683
+ start : 15 ,
3684
+ end : 16
3685
+ } ,
3686
+ {
3687
+ type : tokTypes . jsxName ,
3688
+ value : 'a' ,
3689
+ start : 16 ,
3690
+ end : 17
3691
+ } ,
3692
+ {
3693
+ type : tokTypes . jsxTagEnd ,
3694
+ value : undefined ,
3695
+ start : 17 ,
3696
+ end : 18
3697
+ } ,
3698
+ {
3699
+ type : tokTypes . eof ,
3700
+ value : undefined ,
3701
+ start : 18 ,
3702
+ end : 18
3703
+ }
3704
+ ]
3705
+ } ) ;
3706
+
3641
3707
for ( var ns in fbTestFixture ) {
3642
3708
ns = fbTestFixture [ ns ] ;
3643
3709
for ( var code in ns ) {
You can’t perform that action at this time.
0 commit comments