dillon1000/react
Commit
Browse files [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.Changed paths5 files
First-parent comparisoncompiler/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 AddedPatch
Files changed
Rendering syntax-highlighted changes…