Open
Description
Edit: See my comment below.
This is a tracking issue regarding the use of ScopedId
s in the AST (currently in the typeck branch). These de Bruijn indices currently have some properties that I try to uphold but don't depend on; the structure of a ScopedId
could be useful in the future (if the AST design is upheld.
When creating ScopedId
s on variables:
- The
default()
of[0]
is never assigned (this is depended upon). - Top-level items in
visit_unit
are numbered[0, 0] .. [0, n]
. - If
visit_unit
is calledk
times then items in unitk
are numbered[k, 0] .. [k, n]
. - The
k
parameters of function[0, n]
are numbered[0, n, 0] .. [0, n, k]
. - The opening block of a function
[0, n]
is[0, n, 0, 0]
- The
k
th top-level variable defined in a function[0, n]
is[0, n, 0, k]
.
When creating ScopedIds
on types:
()
,bool
, andfloat
are[1]
,[2]
, and[3]
respectively.- The types of functions are equivalent to the functions'
ScopedId
s, i.e.[0, n]
Additional things we could do:
[ ] Dump function parameters into the top level scope (seeidentify/names/item_identifier.rs
These changes are all in the typeck branch. I'll revisit this issue after that is merged in.