@@ -196,10 +196,10 @@ module.exports = function(acorn) {
196
196
// Parse namespaced identifier.
197
197
198
198
pp . jsx_parseNamespacedName = function ( ) {
199
- var start = this . markPosition ( ) ;
199
+ var startPos = this . start , startLoc = this . startLoc ;
200
200
var name = this . jsx_parseIdentifier ( ) ;
201
201
if ( ! this . eat ( tt . colon ) ) return name ;
202
- var node = this . startNodeAt ( start ) ;
202
+ var node = this . startNodeAt ( startPos , startLoc ) ;
203
203
node . namespace = name ;
204
204
node . name = this . jsx_parseIdentifier ( ) ;
205
205
return this . finishNode ( node , 'JSXNamespacedName' ) ;
@@ -209,10 +209,10 @@ module.exports = function(acorn) {
209
209
// or single identifier.
210
210
211
211
pp . jsx_parseElementName = function ( ) {
212
- var start = this . markPosition ( ) ;
212
+ var startPos = this . start , startLoc = this . startLoc ;
213
213
var node = this . jsx_parseNamespacedName ( ) ;
214
214
while ( this . eat ( tt . dot ) ) {
215
- var newNode = this . startNodeAt ( start ) ;
215
+ var newNode = this . startNodeAt ( startPos , startLoc ) ;
216
216
newNode . object = node ;
217
217
newNode . property = this . jsx_parseIdentifier ( ) ;
218
218
node = this . finishNode ( newNode , 'JSXMemberExpression' ) ;
@@ -285,8 +285,8 @@ module.exports = function(acorn) {
285
285
286
286
// Parses JSX opening tag starting after '<'.
287
287
288
- pp . jsx_parseOpeningElementAt = function ( start ) {
289
- var node = this . startNodeAt ( start ) ;
288
+ pp . jsx_parseOpeningElementAt = function ( startPos , startLoc ) {
289
+ var node = this . startNodeAt ( startPos , startLoc ) ;
290
290
node . attributes = [ ] ;
291
291
node . name = this . jsx_parseElementName ( ) ;
292
292
while ( this . type !== tt . slash && this . type !== tt . jsxTagEnd )
@@ -298,8 +298,8 @@ module.exports = function(acorn) {
298
298
299
299
// Parses JSX closing tag starting after '</'.
300
300
301
- pp . jsx_parseClosingElementAt = function ( start ) {
302
- var node = this . startNodeAt ( start ) ;
301
+ pp . jsx_parseClosingElementAt = function ( startPos , startLoc ) {
302
+ var node = this . startNodeAt ( startPos , startLoc ) ;
303
303
node . name = this . jsx_parseElementName ( ) ;
304
304
this . expect ( tt . jsxTagEnd ) ;
305
305
return this . finishNode ( node , 'JSXClosingElement' ) ;
@@ -308,23 +308,23 @@ module.exports = function(acorn) {
308
308
// Parses entire JSX element, including it's opening tag
309
309
// (starting after '<'), attributes, contents and closing tag.
310
310
311
- pp . jsx_parseElementAt = function ( start ) {
312
- var node = this . startNodeAt ( start ) ;
311
+ pp . jsx_parseElementAt = function ( startPos , startLoc ) {
312
+ var node = this . startNodeAt ( startPos , startLoc ) ;
313
313
var children = [ ] ;
314
- var openingElement = this . jsx_parseOpeningElementAt ( start ) ;
314
+ var openingElement = this . jsx_parseOpeningElementAt ( startPos , startLoc ) ;
315
315
var closingElement = null ;
316
316
317
317
if ( ! openingElement . selfClosing ) {
318
318
contents: for ( ; ; ) {
319
319
switch ( this . type ) {
320
320
case tt . jsxTagStart :
321
- start = this . markPosition ( ) ;
321
+ startPos = this . start ; startLoc = this . startLoc ;
322
322
this . next ( ) ;
323
323
if ( this . eat ( tt . slash ) ) {
324
- closingElement = this . jsx_parseClosingElementAt ( start ) ;
324
+ closingElement = this . jsx_parseClosingElementAt ( startPos , startLoc ) ;
325
325
break contents;
326
326
}
327
- children . push ( this . jsx_parseElementAt ( start ) ) ;
327
+ children . push ( this . jsx_parseElementAt ( startPos , startLoc ) ) ;
328
328
break ;
329
329
330
330
case tt . jsxText :
@@ -339,10 +339,11 @@ module.exports = function(acorn) {
339
339
this . unexpected ( ) ;
340
340
}
341
341
}
342
- if ( getQualifiedJSXName ( closingElement . name ) !== getQualifiedJSXName ( openingElement . name ) )
342
+ if ( getQualifiedJSXName ( closingElement . name ) !== getQualifiedJSXName ( openingElement . name ) ) {
343
343
this . raise (
344
344
closingElement . start ,
345
345
'Expected corresponding JSX closing tag for <' + getQualifiedJSXName ( openingElement . name ) + '>' ) ;
346
+ }
346
347
}
347
348
348
349
node . openingElement = openingElement ;
@@ -357,9 +358,9 @@ module.exports = function(acorn) {
357
358
// Parses entire JSX element from current position.
358
359
359
360
pp . jsx_parseElement = function ( ) {
360
- var start = this . markPosition ( ) ;
361
+ var startPos = this . start , startLoc = this . startLoc ;
361
362
this . next ( ) ;
362
- return this . jsx_parseElementAt ( start ) ;
363
+ return this . jsx_parseElementAt ( startPos , startLoc ) ;
363
364
} ;
364
365
365
366
acorn . plugins . jsx = function ( instance ) {
0 commit comments