dillon1000/react
Commit
Browse files Codegen is from ReactiveFunction->AST only
Other than BuildReactiveFunction (HIR -> ReactiveFunction), Codegen.ts was the only other remaining place that we use HIRTreeVisitor. However, we've already switched the compiler to use the new form of codegen, CodegenReactiveFunction.ts. This PR extracts the shared code from Codegen.ts into the latter, and deletes the unused bits of Codegen.ts which relied on the visitor API. This now frees us up to merge BuildReactiveFunction and HIRTreeVisitor, removing all the complexity of the visitor trait and type params. Note that the `ReactiveFunction` data type can represent non-reactive functions. So we can still compile non-React code after this change, the pipeline is `AST` -> (BuildHIR) -> `HIR` -> (BuildReactiveFunction) -> `ReactiveFunction` -> (CodegenReactiveFunction) -> `AST`. Which is the exact sequence I mapped out at the start of this project ;-) (happy that worked out!)
Changed paths3 files
First-parent comparisoncompiler/forget/src/HIR/Codegen.ts DeletedM compiler/forget/src/ReactiveScopes/CodegenReactiveFunction.ts ModifiedM compiler/forget/src/index.ts ModifiedPatch
Files changed
Rendering syntax-highlighted changes…