-
Notifications
You must be signed in to change notification settings - Fork 46.4k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Format owner stack in captureOwnerStack
- Loading branch information
1 parent
eaf9c8f
commit 9c6179d
Showing
5 changed files
with
423 additions
and
52 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,38 @@ | ||
/** | ||
* Copyright (c) Meta Platforms, Inc. and affiliates. | ||
* | ||
* This source code is licensed under the MIT license found in the | ||
* LICENSE file in the root directory of this source tree. | ||
* | ||
* @flow | ||
*/ | ||
|
||
import type {LazyComponent} from 'react/src/ReactLazy'; | ||
|
||
// These indirections exists so we can exclude its stack frame in DEV (and anything below it). | ||
// TODO: Consider marking the whole bundle instead of these boundaries. | ||
|
||
/** @noinline */ | ||
export function callComponentInDEV<Props, Arg, R>( | ||
Component: (p: Props, arg: Arg) => R, | ||
props: Props, | ||
secondArg: Arg, | ||
): R { | ||
return Component(props, secondArg); | ||
} | ||
|
||
interface ClassInstance<R> { | ||
render(): R; | ||
} | ||
|
||
/** @noinline */ | ||
export function callRenderInDEV<R>(instance: ClassInstance<R>): R { | ||
return instance.render(); | ||
} | ||
|
||
/** @noinline */ | ||
export function callLazyInitInDEV(lazy: LazyComponent<any, any>): any { | ||
const payload = lazy._payload; | ||
const init = lazy._init; | ||
return init(payload); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.