mirror of
https://github.com/facebook/react.git
synced 2025-11-01 09:12:30 +00:00
Improved Flowtypes in response to code review feedback
This commit is contained in:
@@ -37,7 +37,7 @@ if (__DEV__) {
|
||||
}
|
||||
|
||||
let contextStackCursor : StackCursor<?Object> = createCursor((null: ?Object));
|
||||
let didPerformWorkStackCursor : StackCursor<?boolean> = createCursor((null: ?boolean));
|
||||
let didPerformWorkStackCursor : StackCursor<boolean> = createCursor(false);
|
||||
|
||||
function getUnmaskedContext() {
|
||||
return contextStackCursor.current || emptyObject;
|
||||
@@ -66,7 +66,7 @@ exports.getMaskedContext = function(workInProgress : Fiber) {
|
||||
};
|
||||
|
||||
exports.hasContextChanged = function() : boolean {
|
||||
return Boolean(didPerformWorkStackCursor.current);
|
||||
return didPerformWorkStackCursor.current;
|
||||
};
|
||||
|
||||
function isContextProvider(fiber : Fiber) : boolean {
|
||||
@@ -136,8 +136,10 @@ exports.pushContextProvider = function(workInProgress : Fiber, didPerformWork :
|
||||
};
|
||||
|
||||
exports.resetContext = function() : void {
|
||||
reset(contextStackCursor);
|
||||
reset(didPerformWorkStackCursor);
|
||||
reset();
|
||||
|
||||
contextStackCursor.current = null;
|
||||
didPerformWorkStackCursor.current = false;
|
||||
};
|
||||
|
||||
exports.findCurrentUnmaskedContext = function(fiber: Fiber) : Object {
|
||||
|
||||
@@ -114,8 +114,10 @@ module.exports = function<T, P, I, TI, C, CX>(
|
||||
}
|
||||
|
||||
function resetHostContainer() {
|
||||
reset(contextStackCursor);
|
||||
reset(rootInstanceStackCursor);
|
||||
reset();
|
||||
|
||||
contextStackCursor.current = null;
|
||||
rootInstanceStackCursor.current = null;
|
||||
}
|
||||
|
||||
return {
|
||||
|
||||
@@ -55,9 +55,7 @@ exports.pop = function<T>(
|
||||
}
|
||||
}
|
||||
|
||||
cursor.current = index > 0
|
||||
? valueStack[index]
|
||||
: (null : any);
|
||||
cursor.current = valueStack[index];
|
||||
|
||||
valueStack[index] = null;
|
||||
|
||||
@@ -70,7 +68,7 @@ exports.pop = function<T>(
|
||||
|
||||
exports.push = function<T>(
|
||||
cursor : StackCursor<T>,
|
||||
value : any,
|
||||
value : T,
|
||||
fiber: Fiber,
|
||||
) : void {
|
||||
index++;
|
||||
@@ -84,9 +82,7 @@ exports.push = function<T>(
|
||||
cursor.current = value;
|
||||
};
|
||||
|
||||
exports.reset = function<T>(
|
||||
cursor : StackCursor<T>,
|
||||
) : void {
|
||||
exports.reset = function() : void {
|
||||
while (index > -1) {
|
||||
valueStack[index] = null;
|
||||
|
||||
@@ -96,6 +92,4 @@ exports.reset = function<T>(
|
||||
|
||||
index--;
|
||||
}
|
||||
|
||||
cursor.current = (null : any);
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user