pyret-lang
pyret-lang copied to clipboard
[Internal API] default-map-visitor doesn't respect include from
In ast-util, there is a visitor called default-map-visitor with a helper called bind-handlers.
Together, these are supposed to provide a good jumping-off point for mapping an AST while tracking its scope.
Unfortunately, the right information isn't available or computed for using cross-module included names.
Nothing in the compiler relies on this... right now. But it's a lurking incompleteness in the way the map visitor is written, and it is used internally for e.g. resolving which letrec bindings can need a separate set! and so on, so critical code is close to this incompleteness.
The right implementation probably takes a ScopeResolution result and uses that information rather than recomputing it, while allowing the visitor extender to override scope with its own augmentation (as the letrec visitor does).