Get rid of ugly and difficult to follow breaks in switch
Because pattern matching or something.
Sebastian Markbage committed
Jun 7, 2016 at 17:12 UTC
ed215634bea3030b9fd19c2929fcd13ab412f8fe
1 file changed
+5
-6
src/renderers/shared/fiber/ReactFiberCompleteWork.js
+5
-6
@@ -95,14 +95,14 @@ exports.completeWork = function(current : ?Fiber, workInProgress : Fiber) : ?Fib
95
case FunctionalComponent:
96
console.log('/functional component', workInProgress.type.name);
97
transferOutput(workInProgress.child, workInProgress);
98
- break;
98
+ return null;
99
case ClassComponent:
100
console.log('/class component', workInProgress.type.name);
101
transferOutput(workInProgress.child, workInProgress);
102
- break;
102
+ return null;
103
case HostComponent:
104
console.log('/host component', workInProgress.type);
105
- break;
105
+ return null;
106
case CoroutineComponent:
107
console.log('/coroutine component', workInProgress.input.handler.name);
108
return moveCoroutineToHandlerPhase(current, workInProgress);
@@ -110,10 +110,10 @@ exports.completeWork = function(current : ?Fiber, workInProgress : Fiber) : ?Fib
110
transferOutput(workInProgress.stateNode, workInProgress);
111
// Reset the tag to now be a first phase coroutine.
112
workInProgress.tag = CoroutineComponent;
113
- break;
113
+ return null;
114
case YieldComponent:
115
// Does nothing.
116
- break;
116
+ return null;
117
118
// Error cases
119
case IndeterminateComponent:
@@ -121,5 +121,4 @@ exports.completeWork = function(current : ?Fiber, workInProgress : Fiber) : ?Fib
121
default:
122
throw new Error('Unknown unit of work tag');
123
}
124
- return null;
124
};