@@ -402,6 +402,57 @@ var ReactComponentTreeHook = {
402
402
403
403
getRootIDs ,
404
404
getRegisteredIDs : getItemIDs ,
405
+
406
+ pushNonStandardWarningStack (
407
+ isCreatingElement : boolean ,
408
+ currentSource : ?Source ,
409
+ ) {
410
+ if ( typeof console . stack !== 'function' ) {
411
+ return ;
412
+ }
413
+
414
+ var stack = [ ] ;
415
+ var currentOwner = ReactCurrentOwner . current ;
416
+ var id = currentOwner && currentOwner . _debugID ;
417
+
418
+ try {
419
+ if ( isCreatingElement ) {
420
+ stack . push ( {
421
+ fileName : currentSource ? currentSource . fileName : null ,
422
+ lineNumber : currentSource ? currentSource . lineNumber : null ,
423
+ functionName : id ? ReactComponentTreeHook . getDisplayName ( id ) : null ,
424
+ } ) ;
425
+ }
426
+
427
+ while ( id ) {
428
+ var element = ReactComponentTreeHook . getElement ( id ) ;
429
+ var ownerID = ReactComponentTreeHook . getOwnerID ( id ) ;
430
+ var ownerName = ownerID
431
+ ? ReactComponentTreeHook . getDisplayName ( ownerID )
432
+ : null ;
433
+ var source = element && element . _source ;
434
+ stack . push ( {
435
+ fileName : source ? source . fileName : null ,
436
+ lineNumber : source ? source . lineNumber : null ,
437
+ functionName : ownerName ,
438
+ } ) ;
439
+ // Owner stack is more useful for visual representation
440
+ id = ownerID || ReactComponentTreeHook . getParentID ( id ) ;
441
+ }
442
+ } catch ( err ) {
443
+ // Internal state is messed up.
444
+ // Stop building the stack (it's just a nice to have).
445
+ }
446
+
447
+ console . stack ( stack ) ;
448
+ } ,
449
+
450
+ popNonStandardWarningStack ( ) {
451
+ if ( typeof console . stackEnd !== 'function' ) {
452
+ return ;
453
+ }
454
+ console . stackEnd ( ) ;
455
+ } ,
405
456
} ;
406
457
407
458
module . exports = ReactComponentTreeHook ;
0 commit comments