dillon1000/react

Commit

Validate destructuring assignment to globals

Fixes one more category of bug. For assignment expressions, we validating 
against redeclaring a global variable when the assignment target was an 
identifier, but not when the global was reassigned via destructuring. This PR 
adds a `lowerIdentifierForAssignment()` helper and uses it for assignment of all 
identifier variants, including destructuring.
Browse files
Changed paths10 files
First-parent comparison
M compiler/forget/src/HIR/BuildHIR.ts ModifiedM compiler/forget/src/SSA/EnterSSA.ts ModifiedD compiler/forget/src/__tests__/fixtures/compiler/_bug.destructure-assignment-to-global.expect.md DeletedD compiler/forget/src/__tests__/fixtures/compiler/_bug.destructure-to-local-global-variables.expect.md DeletedM compiler/forget/src/__tests__/fixtures/compiler/error.hoisted-function-declaration.expect.md ModifiedA compiler/forget/src/__tests__/fixtures/compiler/error.invalid-destructure-assignment-to-global.expect.md AddedR compiler/forget/src/__tests__/fixtures/compiler/_bug.destructure-assignment-to-global.js →compiler/forget/src/__tests__/fixtures/compiler/error.invalid-destructure-assignment-to-global.js RenamedA compiler/forget/src/__tests__/fixtures/compiler/error.invalid-destructure-to-local-global-variables.expect.md AddedR compiler/forget/src/__tests__/fixtures/compiler/_bug.destructure-to-local-global-variables.js →compiler/forget/src/__tests__/fixtures/compiler/error.invalid-destructure-to-local-global-variables.js RenamedM compiler/forget/src/__tests__/fixtures/compiler/error.mutate-captured-arg-separately.expect.md Modified
Patch

Files changed

Rendering syntax-highlighted changes…