dillon1000/react

Commit

BuildReactiveBlocks to construct scopes in ReactiveFunction

The primary goal of this stack is to change HIRTreeVisitor to make it easier to 
handle value blocks. That's complicated by the fact that the visitor is a 
general-purpose visitor, used in several analysis passes including 
BuildReactiveFunction (which translates HIR->ReactiveFunction while also 
grouping instructions into scopes) and InferReactiveScopes (which is actually 
two passes, one to align scopes to block boundaries, one to merge overlapping 
scopes). The long-term goal then is as follows: 

1. Make BuildReactiveFunction transform HIR->ReactiveFunction but _without_ 
reactive scopes. 

2. Align scopes to block boundaries, but rewritten to operate on 
ReactiveFunction 

3. Merge overlapping scopes, again rewritten to operate on ReactiveFunction 

4. Group statements within ReactiveFunction into ReactiveScopeBlocks (today this 
occurs when constructing the ReactiveFunction). 

This PR implements 1 and 4. Because the implementation is incomplete this would 
break the whole compiler, so for now both versions are still around. By default 
compilation uses the old pipeline, but if a feature flag is enabled we use the 
new version. The plan is to incrementally fix up the new version of the passes 
in this stack, and then cutover: removing the flag and the old version of the 
passes.
Browse files
Changed paths12 files
First-parent comparison
A compiler/forget/src/CompilerFlags.ts AddedM compiler/forget/src/CompilerPipeline.ts ModifiedM compiler/forget/src/HIR/HIR.ts ModifiedM compiler/forget/src/HIR/HIRTreeVisitor.ts ModifiedA compiler/forget/src/ReactiveScopes/AlignReactiveScopesToBlockScopes.ts AddedA compiler/forget/src/ReactiveScopes/BuildReactiveBlocks.ts AddedM compiler/forget/src/ReactiveScopes/BuildReactiveFunction.ts ModifiedA compiler/forget/src/ReactiveScopes/BuildReactiveFunctionWithoutScopes.ts AddedA compiler/forget/src/ReactiveScopes/MergeOverlappingReactiveScopes.ts AddedM compiler/forget/src/ReactiveScopes/index.ts ModifiedM compiler/forget/src/__tests__/hir-test.ts ModifiedM compiler/forget/src/index.ts Modified
Patch

Files changed

Rendering syntax-highlighted changes…