@samitouri / QOS-React-2 / commits / a6c6855dd1

[be] Remove unused properties arg from addHook

This is never used by any caller.

Sathya Gunasekaran committed Mar 28, 2024 at 12:26 UTC a6c6855dd12b0e3fb40b6b987e6c7ad60045c026
3 files changed +7 -13
compiler/packages/babel-plugin-react-forget/src/HIR/Environment.ts
+1 -1
@@ -455,7 +455,7 @@ export class Environment {
455 });
456 this.#globals.set(
457 hookName,
458 - addHook(this.#shapes, [], {
458 + addHook(this.#shapes, {
459 positionalParams: [],
460 restParam: hook.effectKind,
461 returnType: hook.transitiveMixedData
compiler/packages/babel-plugin-react-forget/src/HIR/Globals.ts
+5 -8
@@ -242,7 +242,7 @@ const TYPED_GLOBALS: Array<[string, BuiltInType]> = [
242 const BUILTIN_HOOKS: Array<[string, BuiltInType]> = [
243 [
244 "useContext",
245 - addHook(DEFAULT_SHAPES, [], {
245 + addHook(DEFAULT_SHAPES, {
246 positionalParams: [],
247 restParam: Effect.Read,
248 returnType: { kind: "Poly" },
@@ -254,7 +254,7 @@ const BUILTIN_HOOKS: Array<[string, BuiltInType]> = [
254 ],
255 [
256 "useState",
257 - addHook(DEFAULT_SHAPES, [], {
257 + addHook(DEFAULT_SHAPES, {
258 positionalParams: [],
259 restParam: Effect.Freeze,
260 returnType: { kind: "Object", shapeId: BuiltInUseStateId },
@@ -266,7 +266,7 @@ const BUILTIN_HOOKS: Array<[string, BuiltInType]> = [
266 ],
267 [
268 "useRef",
269 - addHook(DEFAULT_SHAPES, [], {
269 + addHook(DEFAULT_SHAPES, {
270 positionalParams: [],
271 restParam: Effect.Capture,
272 returnType: { kind: "Object", shapeId: BuiltInUseRefId },
@@ -277,7 +277,7 @@ const BUILTIN_HOOKS: Array<[string, BuiltInType]> = [
277 ],
278 [
279 "useMemo",
280 - addHook(DEFAULT_SHAPES, [], {
280 + addHook(DEFAULT_SHAPES, {
281 positionalParams: [],
282 restParam: Effect.Freeze,
283 returnType: { kind: "Poly" },
@@ -288,7 +288,7 @@ const BUILTIN_HOOKS: Array<[string, BuiltInType]> = [
288 ],
289 [
290 "useCallback",
291 - addHook(DEFAULT_SHAPES, [], {
291 + addHook(DEFAULT_SHAPES, {
292 positionalParams: [],
293 restParam: Effect.Freeze,
294 returnType: { kind: "Poly" },
@@ -301,7 +301,6 @@ const BUILTIN_HOOKS: Array<[string, BuiltInType]> = [
301 "useEffect",
302 addHook(
303 DEFAULT_SHAPES,
304 - [],
304 {
305 positionalParams: [],
306 restParam: Effect.Freeze,
@@ -317,7 +316,6 @@ const BUILTIN_HOOKS: Array<[string, BuiltInType]> = [
316 "useLayoutEffect",
317 addHook(
318 DEFAULT_SHAPES,
320 - [],
319 {
320 positionalParams: [],
321 restParam: Effect.Freeze,
@@ -333,7 +331,6 @@ const BUILTIN_HOOKS: Array<[string, BuiltInType]> = [
331 "useInsertionEffect",
332 addHook(
333 DEFAULT_SHAPES,
336 - [],
334 {
335 positionalParams: [],
336 restParam: Effect.Freeze,
compiler/packages/babel-plugin-react-forget/src/HIR/ObjectShape.ts
+1 -4
@@ -64,12 +64,11 @@ export function addFunction(
64 */
65 export function addHook(
66 registry: ShapeRegistry,
67 - properties: Iterable<[string, BuiltInType | PolyType]>,
67 fn: FunctionSignature & { hookKind: HookKind },
68 id: string | null = null
69 ): FunctionType {
70 const shapeId = id ?? createAnonId();
72 - addShape(registry, shapeId, properties, fn);
71 + addShape(registry, shapeId, [], fn);
72 return {
73 kind: "Function",
74 return: fn.returnType,
@@ -431,7 +430,6 @@ addObject(BUILTIN_SHAPES, BuiltInMixedReadonlyId, [
430
431 export const DefaultMutatingHook = addHook(
432 BUILTIN_SHAPES,
434 - [],
433 {
434 positionalParams: [],
435 restParam: Effect.ConditionallyMutate,
@@ -445,7 +443,6 @@ export const DefaultMutatingHook = addHook(
443
444 export const DefaultNonmutatingHook = addHook(
445 BUILTIN_SHAPES,
448 - [],
446 {
447 positionalParams: [],
448 restParam: Effect.Freeze,