mirror of
https://github.com/facebook/react.git
synced 2025-11-01 09:12:30 +00:00
InferTypes traverses function expressions
This commit is contained in:
@@ -16,7 +16,6 @@ import {
|
||||
Place,
|
||||
ReactiveScopeDependency,
|
||||
} from "../HIR";
|
||||
import { inferTypes } from "../TypeInference";
|
||||
import { logHIRFunction } from "../Utils/logger";
|
||||
import { inferMutableRanges } from "./InferMutableRanges";
|
||||
import inferReferenceEffects from "./InferReferenceEffects";
|
||||
@@ -87,7 +86,6 @@ export default function analyseFunctions(func: HIRFunction): void {
|
||||
}
|
||||
|
||||
function lower(func: HIRFunction): void {
|
||||
inferTypes(func);
|
||||
analyseFunctions(func);
|
||||
inferReferenceEffects(func, { isFunctionExpression: true });
|
||||
inferMutableRanges(func);
|
||||
|
||||
@@ -45,7 +45,7 @@ function isPrimitiveBinaryOp(op: t.BinaryExpression["operator"]): boolean {
|
||||
}
|
||||
}
|
||||
|
||||
export default function (func: HIRFunction): void {
|
||||
export function inferTypes(func: HIRFunction): void {
|
||||
const unifier = new Unifier(func.env);
|
||||
for (const e of generate(func)) {
|
||||
unifier.unify(e.left, e.right);
|
||||
@@ -244,6 +244,11 @@ function* generateInstructionTypes(
|
||||
break;
|
||||
}
|
||||
|
||||
case "FunctionExpression": {
|
||||
inferTypes(value.loweredFunc);
|
||||
break;
|
||||
}
|
||||
|
||||
case "DeclareLocal":
|
||||
case "DeclareContext":
|
||||
case "NewExpression":
|
||||
@@ -253,7 +258,6 @@ function* generateInstructionTypes(
|
||||
case "PropertyStore":
|
||||
case "ComputedStore":
|
||||
case "ComputedLoad":
|
||||
case "FunctionExpression":
|
||||
case "TaggedTemplateExpression":
|
||||
case "Await":
|
||||
case "NextIterableOf":
|
||||
|
||||
@@ -5,4 +5,4 @@
|
||||
* LICENSE file in the root directory of this source tree.
|
||||
*/
|
||||
|
||||
export { default as inferTypes } from "./InferTypes";
|
||||
export { inferTypes } from "./InferTypes";
|
||||
|
||||
Reference in New Issue
Block a user