Rename ReactTypeOfWork to ReactWorkTags, ReactTypeOfSideEffect to ReactSideEffectTags (#13476)

* Rename ReactTypeOfWork to ReactWorkTags

And `type TypeOfWork` to `type WorkTag`.

* Rename ReactTypeOfSideEffect too
This commit is contained in:
Sophie Alpert
2018-08-26 13:40:27 -07:00
committed by GitHub
parent 53ddcec4f1
commit 340bfd9393
25 changed files with 42 additions and 46 deletions
@@ -9,7 +9,7 @@
'use strict';
const {HostComponent} = require('shared/ReactTypeOfWork');
const {HostComponent} = require('shared/ReactWorkTags');
let EventPluginHub;
let ResponderEventPlugin;
+1 -1
View File
@@ -5,7 +5,7 @@
* LICENSE file in the root directory of this source tree.
*/
import {HostComponent, HostText} from 'shared/ReactTypeOfWork';
import {HostComponent, HostText} from 'shared/ReactWorkTags';
import invariant from 'shared/invariant';
const randomKey = Math.random()
+1 -1
View File
@@ -14,7 +14,7 @@ import type {DOMTopLevelEventType} from 'events/TopLevelEventTypes';
import {batchedUpdates, interactiveUpdates} from 'events/ReactGenericBatching';
import {runExtractedEventsInBatch} from 'events/EventPluginHub';
import {isFiberMounted} from 'react-reconciler/reflection';
import {HostRoot} from 'shared/ReactTypeOfWork';
import {HostRoot} from 'shared/ReactWorkTags';
import {addEventBubbleListener, addEventCaptureListener} from './EventListener';
import getEventTarget from './getEventTarget';
+1 -1
View File
@@ -16,7 +16,7 @@ import {
FunctionalComponentLazy,
HostComponent,
HostText,
} from 'shared/ReactTypeOfWork';
} from 'shared/ReactWorkTags';
import SyntheticEvent from 'events/SyntheticEvent';
import invariant from 'shared/invariant';
import lowPriorityWarning from 'shared/lowPriorityWarning';
@@ -14,7 +14,7 @@ import {
findCurrentFiberUsingSlowPath,
} from 'react-reconciler/reflection';
import getComponentName from 'shared/getComponentName';
import {HostComponent} from 'shared/ReactTypeOfWork';
import {HostComponent} from 'shared/ReactWorkTags';
import invariant from 'shared/invariant';
// Module provided by RN:
import UIManager from 'UIManager';
+2 -2
View File
@@ -13,7 +13,7 @@ import type {Fiber} from 'react-reconciler/src/ReactFiber';
import type {ExpirationTime} from 'react-reconciler/src/ReactFiberExpirationTime';
import getComponentName from 'shared/getComponentName';
import {Placement, Deletion} from 'shared/ReactTypeOfSideEffect';
import {Placement, Deletion} from 'shared/ReactSideEffectTags';
import {
getIteratorFn,
REACT_ELEMENT_TYPE,
@@ -27,7 +27,7 @@ import {
HostText,
HostPortal,
Fragment,
} from 'shared/ReactTypeOfWork';
} from 'shared/ReactWorkTags';
import invariant from 'shared/invariant';
import warning from 'shared/warning';
import warningWithoutStack from 'shared/warningWithoutStack';
+1 -1
View File
@@ -16,7 +16,7 @@ import {
ClassComponentLazy,
HostComponent,
Mode,
} from 'shared/ReactTypeOfWork';
} from 'shared/ReactWorkTags';
import describeComponentFrame from 'shared/describeComponentFrame';
import getComponentName from 'shared/getComponentName';
+1 -1
View File
@@ -20,7 +20,7 @@ import {
ContextProvider,
ContextConsumer,
Mode,
} from 'shared/ReactTypeOfWork';
} from 'shared/ReactWorkTags';
type MeasurementPhase =
| 'componentWillMount'
+9 -9
View File
@@ -9,16 +9,16 @@
import type {ReactElement, Source} from 'shared/ReactElementType';
import type {ReactFragment, ReactPortal, RefObject} from 'shared/ReactTypes';
import type {TypeOfWork} from 'shared/ReactTypeOfWork';
import type {WorkTag} from 'shared/ReactWorkTags';
import type {TypeOfMode} from './ReactTypeOfMode';
import type {TypeOfSideEffect} from 'shared/ReactTypeOfSideEffect';
import type {SideEffectTag} from 'shared/ReactSideEffectTags';
import type {ExpirationTime} from './ReactFiberExpirationTime';
import type {UpdateQueue} from './ReactUpdateQueue';
import type {ContextDependency} from './ReactFiberNewContext';
import invariant from 'shared/invariant';
import {enableProfilerTimer} from 'shared/ReactFeatureFlags';
import {NoEffect} from 'shared/ReactTypeOfSideEffect';
import {NoEffect} from 'shared/ReactSideEffectTags';
import {
IndeterminateComponent,
ClassComponent,
@@ -36,7 +36,7 @@ import {
FunctionalComponentLazy,
ClassComponentLazy,
ForwardRefLazy,
} from 'shared/ReactTypeOfWork';
} from 'shared/ReactWorkTags';
import getComponentName from 'shared/getComponentName';
import {isDevToolsPresent} from './ReactFiberDevToolsHook';
@@ -86,7 +86,7 @@ export type Fiber = {|
// minimize the number of objects created during the initial render.
// Tag identifying the type of fiber.
tag: TypeOfWork,
tag: WorkTag,
// Unique identifier of this child.
key: null | string,
@@ -140,7 +140,7 @@ export type Fiber = {|
mode: TypeOfMode,
// Effect
effectTag: TypeOfSideEffect,
effectTag: SideEffectTag,
// Singly linked list fast path to the next fiber with side-effects.
nextEffect: Fiber | null,
@@ -201,7 +201,7 @@ if (__DEV__) {
}
function FiberNode(
tag: TypeOfWork,
tag: WorkTag,
pendingProps: mixed,
key: null | string,
mode: TypeOfMode,
@@ -272,7 +272,7 @@ function FiberNode(
// 5) It should be easy to port this to a C struct and keep a C implementation
// compatible.
const createFiber = function(
tag: TypeOfWork,
tag: WorkTag,
pendingProps: mixed,
key: null | string,
mode: TypeOfMode,
@@ -294,7 +294,7 @@ function shouldConstruct(Component: Function) {
export function resolveLazyComponentTag(
fiber: Fiber,
Component: Function,
): TypeOfWork {
): WorkTag {
if (typeof Component === 'function') {
return shouldConstruct(Component)
? ClassComponentLazy
+2 -2
View File
@@ -31,7 +31,7 @@ import {
ContextConsumer,
Profiler,
PlaceholderComponent,
} from 'shared/ReactTypeOfWork';
} from 'shared/ReactWorkTags';
import {
NoEffect,
PerformedWork,
@@ -40,7 +40,7 @@ import {
DidCapture,
Update,
Ref,
} from 'shared/ReactTypeOfSideEffect';
} from 'shared/ReactSideEffectTags';
import ReactSharedInternals from 'shared/ReactSharedInternals';
import {
enableGetDerivedStateFromCatch,
+1 -1
View File
@@ -11,7 +11,7 @@ import type {Fiber} from './ReactFiber';
import type {ExpirationTime} from './ReactFiberExpirationTime';
import React from 'react';
import {Update, Snapshot} from 'shared/ReactTypeOfSideEffect';
import {Update, Snapshot} from 'shared/ReactSideEffectTags';
import {
debugRenderPhaseSideEffects,
debugRenderPhaseSideEffectsForStrictMode,
+2 -2
View File
@@ -29,7 +29,7 @@ import {
HostPortal,
Profiler,
PlaceholderComponent,
} from 'shared/ReactTypeOfWork';
} from 'shared/ReactWorkTags';
import {
invokeGuardedCallback,
hasCaughtError,
@@ -41,7 +41,7 @@ import {
Placement,
Snapshot,
Update,
} from 'shared/ReactTypeOfSideEffect';
} from 'shared/ReactSideEffectTags';
import getComponentName from 'shared/getComponentName';
import invariant from 'shared/invariant';
import warningWithoutStack from 'shared/warningWithoutStack';
+2 -2
View File
@@ -38,8 +38,8 @@ import {
Profiler,
PlaceholderComponent,
ForwardRefLazy,
} from 'shared/ReactTypeOfWork';
import {Placement, Ref, Update} from 'shared/ReactTypeOfSideEffect';
} from 'shared/ReactWorkTags';
import {Placement, Ref, Update} from 'shared/ReactSideEffectTags';
import invariant from 'shared/invariant';
import {getResultFromResolvedThenable} from 'shared/ReactLazyComponent';
+1 -1
View File
@@ -15,7 +15,7 @@ import {
ClassComponent,
HostRoot,
ClassComponentLazy,
} from 'shared/ReactTypeOfWork';
} from 'shared/ReactWorkTags';
import getComponentName from 'shared/getComponentName';
import invariant from 'shared/invariant';
import warningWithoutStack from 'shared/warningWithoutStack';
@@ -16,8 +16,8 @@ import type {
HostContext,
} from './ReactFiberHostConfig';
import {HostComponent, HostText, HostRoot} from 'shared/ReactTypeOfWork';
import {Deletion, Placement} from 'shared/ReactTypeOfSideEffect';
import {HostComponent, HostText, HostRoot} from 'shared/ReactWorkTags';
import {Deletion, Placement} from 'shared/ReactSideEffectTags';
import invariant from 'shared/invariant';
import {createFiberFromHostInstanceForDeletion} from './ReactFiber';
+1 -1
View File
@@ -27,7 +27,7 @@ import {
ContextProvider,
ClassComponent,
ClassComponentLazy,
} from 'shared/ReactTypeOfWork';
} from 'shared/ReactWorkTags';
import invariant from 'shared/invariant';
import warning from 'shared/warning';
+1 -1
View File
@@ -27,7 +27,7 @@ import {
HostComponent,
ClassComponent,
ClassComponentLazy,
} from 'shared/ReactTypeOfWork';
} from 'shared/ReactWorkTags';
import getComponentName from 'shared/getComponentName';
import invariant from 'shared/invariant';
import warningWithoutStack from 'shared/warningWithoutStack';
+2 -2
View File
@@ -32,7 +32,7 @@ import {
Ref,
Incomplete,
HostEffectMask,
} from 'shared/ReactTypeOfSideEffect';
} from 'shared/ReactSideEffectTags';
import {
HostRoot,
ClassComponent,
@@ -40,7 +40,7 @@ import {
HostComponent,
ContextProvider,
HostPortal,
} from 'shared/ReactTypeOfWork';
} from 'shared/ReactWorkTags';
import {
enableProfilerTimer,
enableUserTimingAPI,
+2 -2
View File
@@ -22,8 +22,8 @@ import {
HostRoot,
HostPortal,
HostText,
} from 'shared/ReactTypeOfWork';
import {NoEffect, Placement} from 'shared/ReactTypeOfSideEffect';
} from 'shared/ReactWorkTags';
import {NoEffect, Placement} from 'shared/ReactSideEffectTags';
const ReactCurrentOwner = ReactSharedInternals.ReactCurrentOwner;
+2 -2
View File
@@ -24,7 +24,7 @@ import {
HostPortal,
ContextProvider,
PlaceholderComponent,
} from 'shared/ReactTypeOfWork';
} from 'shared/ReactWorkTags';
import {
DidCapture,
Incomplete,
@@ -32,7 +32,7 @@ import {
ShouldCapture,
Update as UpdateEffect,
LifecycleEffectMask,
} from 'shared/ReactTypeOfSideEffect';
} from 'shared/ReactSideEffectTags';
import {
enableGetDerivedStateFromCatch,
enableSuspense,
+2 -6
View File
@@ -88,12 +88,8 @@ import type {Fiber} from './ReactFiber';
import type {ExpirationTime} from './ReactFiberExpirationTime';
import {NoWork} from './ReactFiberExpirationTime';
import {
Callback,
ShouldCapture,
DidCapture,
} from 'shared/ReactTypeOfSideEffect';
import {ClassComponent, ClassComponentLazy} from 'shared/ReactTypeOfWork';
import {Callback, ShouldCapture, DidCapture} from 'shared/ReactSideEffectTags';
import {ClassComponent, ClassComponentLazy} from 'shared/ReactWorkTags';
import {
debugRenderPhaseSideEffects,
+1 -1
View File
@@ -30,7 +30,7 @@ import {
ForwardRef,
Profiler,
ForwardRefLazy,
} from 'shared/ReactTypeOfWork';
} from 'shared/ReactWorkTags';
import invariant from 'shared/invariant';
import ReactVersion from 'shared/ReactVersion';
@@ -7,7 +7,7 @@
* @flow
*/
export type TypeOfSideEffect = number;
export type SideEffectTag = number;
// Don't change these two values. They're used by React Dev Tools.
export const NoEffect = /* */ 0b00000000000;
+1 -1
View File
@@ -5,7 +5,7 @@
* LICENSE file in the root directory of this source tree.
*/
import {HostComponent} from './ReactTypeOfWork';
import {HostComponent} from './ReactWorkTags';
function getParent(inst) {
do {
@@ -7,7 +7,7 @@
* @flow
*/
export type TypeOfWork =
export type WorkTag =
| 0
| 1
| 2