mirror of
https://github.com/facebook/react.git
synced 2025-11-01 09:12:30 +00:00
[typer] Type hook callee as Hook type
This commit is contained in:
@@ -9,6 +9,7 @@ import {
|
||||
TypeVar,
|
||||
} from "../HIR/HIR";
|
||||
import { eachInstructionOperand } from "../HIR/visitors";
|
||||
import { parseHookCall } from "../Inference/InferReferenceEffects";
|
||||
|
||||
function isPrimitiveBinaryOp(op: t.BinaryExpression["operator"]) {
|
||||
switch (op) {
|
||||
@@ -120,7 +121,14 @@ function* generateInstructionTypes(
|
||||
}
|
||||
|
||||
case "CallExpression": {
|
||||
yield equation(value.callee.identifier.type, { kind: "Function" });
|
||||
const hook = parseHookCall(value.callee);
|
||||
let type: Type;
|
||||
if (hook !== null) {
|
||||
type = { kind: "Hook", name: hook.name };
|
||||
} else {
|
||||
type = { kind: "Function" };
|
||||
}
|
||||
yield equation(value.callee.identifier.type, type);
|
||||
break;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user