dillon1000/react

Commit

[new-arch] Scaffolding and fixtures for mutability lifetime inference

Scaffolds out mutable lifetime inference and the potential two-pass approach, 
with motivating examples. Also adds some fixtures that collectively demonstrate 
a bunch of cases of aliasing: 

* direct assignment `a = b` 

* property assignment `a.b = b` 

* array literals `a = [b]` 

* object literals `a = {b}` 

* mutable arguments to the same call `foo(mut a, mut b)` 

* return values aliasing arguments `a = foo(mut b)` 

* aliasing that occurs only after multiple loop iterations 

All of these fixtures use an empty `if (varName) {}` as a way to check that an 
otherwise readonly usage of a variable is correctly inferred as mutable.
Browse files
Changed paths5 files
First-parent comparison
A compiler/forget/src/HIR/InferMutableLifetimes.ts AddedA compiler/forget/src/__tests__/fixtures/hir/mutable-lifetime-loops.expect.md AddedA compiler/forget/src/__tests__/fixtures/hir/mutable-lifetime-loops.js AddedA compiler/forget/src/__tests__/fixtures/hir/mutable-lifetime-with-aliasing.expect.md AddedA compiler/forget/src/__tests__/fixtures/hir/mutable-lifetime-with-aliasing.js Added
Patch

Files changed

Rendering syntax-highlighted changes…