csyonghe / Spire

Other
174 stars 22 forks source link

Scope work #65

Closed tangent-vector closed 7 years ago

tangent-vector commented 7 years ago

The basic gist of this PR is moving towards having the Scope type be used for all name lookup, instead of things going through a variety of different lists stored in different places.

For right now, the Scope type is still only used for variable declarations, but the changes here at least make it truly be a lookup table on declarations, not for VariableEntry values.

The first couple changes just clean up the statement syntax in cases where it could possibly introduce a variable declaration, so that it always used a true Decl. Then the final change just alters how the Scope stores declarations.

Note: It might be best to hold off on merging this PR until I can put some more tests into place, since I don't have any tests right now that cover for loops, for example.