forked from google/starlark-go
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
resolve: retain globals across REPL chunks (google#247)
Previously, in the REPL, the globals bound by one chunk would become the "predeclared" bindings of the next chunk. However, this produced the wrong result for [x = x + 1] because both occurrences of x would resolve to the same global x, which was undefined when the right-hand side expression was evaluated, leading to a dynamic error. It would fail for [x += 1] for a similar reason. This change extends the resolver to allow clients to provide it with a non-empty set of module globals. Thus the globals of one chunk remain the globals of the next chunk, and the predeclared set is always empty. The new API functions is intended for use only by the REPL. Fixes google#233
- Loading branch information
Showing
4 changed files
with
104 additions
and
26 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters