Now it becomes clear that the contents of this dictionary are never read by their keys. All you do with this dictionary is 1) put key/values in it and 2) list the *items* (i.e., only the values) once at the end.

So, unless you put several times with the same key (which would be pretty bad, considering what it's used for, but I don't think you do that), you're essentially using this dictionary simply as a collection, in more mundane words, a (mutable) list.

So, unless I'm wrong, I strongly suggest to

1. turn this into a cell named `TopLevelDeclsBuffer` containing a list, initialized with `nil`
2. rename `PutDecl` as `AddTopLevelDecl`, remove its `Name` parameter and have it prepend the `Value` to that list
3. remove `PutDeclIndex` and use `AddTopLevelDecl` instead
4. rename `DeclareAllDict` as `GetTopLevelDecls` and have it return the list