relax
relax copied to clipboard
[Refactor][BlockBuilder] Associate BlockBuilder::ExprMemo with the scope to avoid breaking scope rules
This PR fixes the issue noted in #288 in which the BlockBuilder
's ExprMemo
can store entries between visits, which resulted in violating scoping rules when an expression was visited twice (the first visit populated the memo and the second visit would find the variable in the memo even though the variable was not bound the second time). In #288, the bug was fixed by manually resetting the memo, breaking the visitor's abstraction. By contrast, this PR automatically removes entries from the memo when they go out of scope, not requiring a manual reset.
LOL, the C++ linter checks for trailing whitespace in comments (which my C++ reformatter does not...). :pensive:
handled in #308 Thanks to @slyubomirsky bringing up this initial issue