dillon1000/react

Commit

[rust][sema] Resolve all references after traversing program

Previously we attempted to resolve each reference at the close of its defining 
scope, and if it couldn't be resolved yet we bubbled the unresolved reference up 
to the parent scope. That approach isn't ideal for two reasons: 

* First, it's inefficient since we may have to make multiple attempts to resolve 
the same reference. 

* Second, it's incorrect. There can be cases where we think we can resolve a 
reference to a value defined in an outer scope, but there is a hoisted 
declaration from an intermediate scope that we haven't seen yet. 

The safest and most optimal thing is to just queue all references and resolve 
them at the end.
Browse files
Changed paths5 files
First-parent comparison
M compiler/forget/crates/forget_semantic_analysis/src/analyzer.rs ModifiedM compiler/forget/crates/forget_semantic_analysis/src/scope_manager.rs 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] Modified
Patch

Files changed

Rendering syntax-highlighted changes…