@@ -38,33 +38,32 @@ function checkReactTypeSpec(
3838 // only during reconciliation (begin and complete phase).
3939 workInProgressOrDebugID
4040) {
41- function formatMessage ( message ) {
41+ function getStack ( ) {
42+ let stack = '' ;
4243 if ( __DEV__ ) {
43- let componentStackInfo = '' ;
4444 if ( ! ReactComponentTreeHook ) {
4545 ReactComponentTreeHook = require ( 'ReactComponentTreeHook' ) ;
4646 }
4747 if ( workInProgressOrDebugID != null ) {
4848 if ( typeof workInProgressOrDebugID === 'number' ) {
4949 // DebugID from Stack.
5050 const debugID = workInProgressOrDebugID ;
51- componentStackInfo = ReactComponentTreeHook . getStackAddendumByID ( debugID ) ;
51+ stack = ReactComponentTreeHook . getStackAddendumByID ( debugID ) ;
5252 } else if ( typeof workInProgressOrDebugID . tag === 'number' ) {
5353 // This is a Fiber.
5454 // The stack will only be correct if this is a work in progress
5555 // version and we're calling it during reconciliation.
5656 const workInProgress = workInProgressOrDebugID ;
57- componentStackInfo = ReactComponentTreeHook . getStackAddendumByWorkInProgressFiber ( workInProgress ) ;
57+ stack = ReactComponentTreeHook . getStackAddendumByWorkInProgressFiber ( workInProgress ) ;
5858 }
5959 } else if ( element !== null ) {
60- componentStackInfo = ReactComponentTreeHook . getCurrentStackAddendum ( element ) ;
60+ stack = ReactComponentTreeHook . getCurrentStackAddendum ( element ) ;
6161 }
62- message += componentStackInfo ;
6362 }
64- return message ;
63+ return stack ;
6564 }
6665
67- checkPropTypes ( typeSpecs , values , location , componentName , formatMessage ) ;
66+ checkPropTypes ( typeSpecs , values , location , componentName , getStack ) ;
6867}
6968
7069module . exports = checkReactTypeSpec ;
0 commit comments