diff --git a/compiler/forget/src/HIR/BuildHIR.ts b/compiler/forget/src/HIR/BuildHIR.ts index 641df8a6a6..cb7e2c5938 100644 --- a/compiler/forget/src/HIR/BuildHIR.ts +++ b/compiler/forget/src/HIR/BuildHIR.ts @@ -12,7 +12,6 @@ import { invariant } from "../CompilerError"; import { Capability, HIRFunction, - Identifier, IfTerminal, InstructionKind, InstructionValue, @@ -55,10 +54,18 @@ export function lower(func: NodePath): HIRFunction { ? builder.resolveIdentifier(func.node.id) : null; - const params: Array = []; + const params: Array = []; func.node.params.forEach((param) => { todoInvariant(t.isIdentifier(param), "todo: support non-identifier params"); - params.push(builder.resolveIdentifier(param)); + const identifier = builder.resolveIdentifier(param); + const place: Place = { + kind: "Identifier", + value: identifier, + memberPath: null, + capability: Capability.Unknown, + path: null as any, + }; + params.push(place); }); const body = func.get("body"); diff --git a/compiler/forget/src/HIR/Codegen.ts b/compiler/forget/src/HIR/Codegen.ts index 459a95c8fe..b3d6edff75 100644 --- a/compiler/forget/src/HIR/Codegen.ts +++ b/compiler/forget/src/HIR/Codegen.ts @@ -50,7 +50,7 @@ export default function codegen(fn: HIRFunction): t.Function { t.isFunctionDeclaration(node), "todo: handle other than function declaration" ); - const params = fn.params.map((param) => convertIdentifier(param)); + const params = fn.params.map((param) => convertIdentifier(param.value)); return t.functionDeclaration( fn.id !== null ? convertIdentifier(fn.id) : null, params, diff --git a/compiler/forget/src/HIR/HIR.ts b/compiler/forget/src/HIR/HIR.ts index 4aa9e44754..b1abfdbadb 100644 --- a/compiler/forget/src/HIR/HIR.ts +++ b/compiler/forget/src/HIR/HIR.ts @@ -39,7 +39,7 @@ import { invariant } from "../CompilerError"; export type ReactFunction = { path: NodePath; id: Identifier | null; - params: Array; + params: Array; returnScope: ScopeId; scopes: Map; }; @@ -61,7 +61,7 @@ export type ReactiveScope = { export type HIRFunction = { path: NodePath; id: Identifier | null; - params: Array; + params: Array; body: HIR; }; diff --git a/compiler/forget/src/HIR/InferReferenceCapability.ts b/compiler/forget/src/HIR/InferReferenceCapability.ts index 19043577ac..9f5d467733 100644 --- a/compiler/forget/src/HIR/InferReferenceCapability.ts +++ b/compiler/forget/src/HIR/InferReferenceCapability.ts @@ -86,7 +86,7 @@ export default function inferReferenceCapability(fn: HIRFunction) { const place: Place = { kind: "Identifier", memberPath: null, - value: param, + value: param.value, path: null as any, // TODO capability: Capability.Freeze, }; diff --git a/compiler/forget/src/HIR/ScopeAnalysis.ts b/compiler/forget/src/HIR/ScopeAnalysis.ts index 29ec69fe9b..37191a5af5 100644 --- a/compiler/forget/src/HIR/ScopeAnalysis.ts +++ b/compiler/forget/src/HIR/ScopeAnalysis.ts @@ -64,7 +64,7 @@ export default function analyzeScopes(fn: HIRFunction): ReactFunction { inputs: new Set( fn.params.map((param) => ({ kind: "Identifier", - value: param, + value: param.value, memberPath: null, capability: Capability.Freeze, path: null as any,