dillon1000/react

Commit

[rust][sema] Handle var/let/const redeclaration

JavaScript has ~sane~ fun rules around where variables can be redeclared or not, 
and which kinds of variables this applies to. Actually the rules are pretty 
straightforward: 

* `var` can be redeclared any number of times. 

* In strict mode, other declarations cannot be redeclared within the same scope. 
This implies that a `var` declaration cannot conflict with these other forms, 
which must take into account hoisting. So you can't have a `var a; let a` in the 
same scope, but you also can't have a `let a` at a scope and then a `var a` 
which will hoist to that same scope.
Browse files
Changed paths16 files
First-parent comparison
M compiler/forget/crates/forget_fixtures/tests/fixtures/use-memo.js ModifiedM compiler/forget/crates/forget_fixtures/tests/fixtures_test.rs ModifiedM compiler/forget/crates/forget_fixtures/tests/snapshots/[email protected] ModifiedM compiler/forget/crates/forget_semantic_analysis/src/analyzer.rs ModifiedM compiler/forget/crates/forget_semantic_analysis/src/scope_manager.rs ModifiedA compiler/forget/crates/forget_semantic_analysis/tests/fixtures/block-item-duplication.js AddedA compiler/forget/crates/forget_semantic_analysis/tests/fixtures/var-duplication.js AddedA compiler/forget/crates/forget_semantic_analysis/tests/snapshots/[email protected] AddedM compiler/forget/crates/forget_semantic_analysis/tests/snapshots/[email protected] ModifiedM compiler/forget/crates/forget_semantic_analysis/tests/snapshots/[email protected] ModifiedM compiler/forget/crates/forget_semantic_analysis/tests/snapshots/[email protected] ModifiedM compiler/forget/crates/forget_semantic_analysis/tests/snapshots/[email protected] ModifiedM compiler/forget/crates/forget_semantic_analysis/tests/snapshots/[email protected] ModifiedM compiler/forget/crates/forget_semantic_analysis/tests/snapshots/[email protected] ModifiedA compiler/forget/crates/forget_semantic_analysis/tests/snapshots/[email protected] AddedM compiler/forget/crates/forget_semantic_analysis/tests/snapshots/[email protected] Modified
Patch

Files changed

Rendering syntax-highlighted changes…