@@ -333,11 +333,12 @@ function mdxExpression(node, context) {
333333 /** @type {EstreeProgram } */
334334 // @ts -expect-error Assume program.
335335 const estree = node . data && node . data . estree
336+ const comments = ( estree && estree . comments ) || [ ]
336337 /** @type {EstreeExpression|undefined } */
337338 let expression
338339
339340 if ( estree ) {
340- context . comments . push ( ...( estree . comments || [ ] ) )
341+ context . comments . push ( ...comments )
341342 attachComments ( estree , estree . comments )
342343 expression =
343344 ( estree . body [ 0 ] &&
@@ -393,12 +394,15 @@ function mdxJsxElement(node, context) {
393394 /** @type {EstreeProgram } */
394395 // @ts -expect-error Assume program.
395396 const estree = value . data && value . data . estree
397+ const comments = ( estree && estree . comments ) || [ ]
396398 /** @type {EstreeExpression|undefined } */
397399 let expression
398400
399401 if ( estree ) {
400- context . comments . push ( ...( estree . comments || [ ] ) )
402+ context . comments . push ( ...comments )
401403 attachComments ( estree , estree . comments )
404+ // Should exist.
405+ /* c8 ignore next 5 */
402406 expression =
403407 ( estree . body [ 0 ] &&
404408 estree . body [ 0 ] . type === 'ExpressionStatement' &&
@@ -429,12 +433,15 @@ function mdxJsxElement(node, context) {
429433 /** @type {EstreeProgram } */
430434 // @ts -expect-error Assume program.
431435 const estree = attr . data && attr . data . estree
436+ const comments = ( estree && estree . comments ) || [ ]
432437 /** @type {EstreeJsxSpreadAttribute['argument']|undefined } */
433438 let argumentValue
434439
435440 if ( estree ) {
436- context . comments . push ( ...( estree . comments || [ ] ) )
441+ context . comments . push ( ...comments )
437442 attachComments ( estree , estree . comments )
443+ // Should exist.
444+ /* c8 ignore next 10 */
438445 argumentValue =
439446 ( estree . body [ 0 ] &&
440447 estree . body [ 0 ] . type === 'ExpressionStatement' &&
0 commit comments