Skip to content

Commit

Permalink
Only reset "before" code in the REPL when we can
Browse files Browse the repository at this point in the history
Fixes #4088
  • Loading branch information
lizmat committed Dec 5, 2020
1 parent 6c7044e commit 6f7718c
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion src/core.c/REPL.pm6
Expand Up @@ -318,7 +318,6 @@ do {
my @before;
my $code;
sub reset(--> Nil) {
@before = ();
$code = '';
$prompt = self.interactive_prompt;
}
Expand Down Expand Up @@ -388,6 +387,13 @@ do {
}
}

# No errors seen, and explicit output done, so assume that
# the "before" code is now solidified so we don't need to
# recompile that again and again.
else {
@before = ();
}

# Start with clean slate otherwise
if $*MAIN_CTX {
$!save_ctx := $*MAIN_CTX;
Expand Down

0 comments on commit 6f7718c

Please sign in to comment.