dillon1000/react
Commit
Browse files Support await expressions
Adds support for `await` expressions. We have primarily seen await used inside callbacks, not directly within component render logic, but because we construct HIR for lambdas it is helpful to be able to model await rather than require everyone to rewrite to use the Promise API. Note a subtlety: awaiting a promise is a mutative operation, so we a) model it as a Mutate effect and b) avoid DCE of await expressions since they may cause side effects. See the test cases for examples.
Changed paths13 files
First-parent comparisoncompiler/forget/src/HIR/BuildHIR.ts ModifiedM compiler/forget/src/HIR/HIR.ts ModifiedM compiler/forget/src/HIR/PrintHIR.ts ModifiedM compiler/forget/src/HIR/visitors.ts ModifiedM compiler/forget/src/Inference/InferReferenceEffects.ts ModifiedM compiler/forget/src/Optimization/DeadCodeElimination.ts ModifiedM compiler/forget/src/ReactiveScopes/CodegenReactiveFunction.ts ModifiedM compiler/forget/src/ReactiveScopes/InferReactiveScopeVariables.ts ModifiedM compiler/forget/src/ReactiveScopes/PruneNonEscapingScopes.ts ModifiedA compiler/forget/src/__tests__/fixtures/compiler/await-side-effecting-promise.expect.md AddedA compiler/forget/src/__tests__/fixtures/compiler/await-side-effecting-promise.js AddedA compiler/forget/src/__tests__/fixtures/compiler/await.expect.md AddedA compiler/forget/src/__tests__/fixtures/compiler/await.js AddedPatch
Files changed
Rendering syntax-highlighted changes…