Skip to content

Commit

Permalink
dup'd binding copy all existing values into new eval scope
Browse files Browse the repository at this point in the history
  • Loading branch information
enebo committed May 1, 2024
1 parent 2b9b9d9 commit 0cc945b
Show file tree
Hide file tree
Showing 4 changed files with 7 additions and 4 deletions.
7 changes: 6 additions & 1 deletion core/src/main/java/org/jruby/runtime/DynamicScope.java
Original file line number Diff line number Diff line change
Expand Up @@ -601,6 +601,11 @@ public DynamicScope cloneScope() {
}

public DynamicScope dup() {
return new ManyVarsDynamicScope(staticScope.duplicate(), parent);
DynamicScope newScope = new ManyVarsDynamicScope(staticScope.duplicate(), parent);
IRubyObject[] values = getValues();
for (int i = 0; i < values.length; i++) {
newScope.setValueDepthZero(values[i], i);
}
return newScope;
}
}
2 changes: 1 addition & 1 deletion spec/tags/ruby/core/kernel/eval_tags.txt
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
fails:Kernel#eval raises a LocalJumpError if there is no lambda-style closure in the chain
fails:Kernel#eval with a magic encoding comment ignores the magic encoding comment if it is after a frozen_string_literal magic comment
fails:Kernel#eval makes flip-flop operator work correctly

1 change: 0 additions & 1 deletion spec/tags/ruby/library/erb/result_tags.txt

This file was deleted.

1 change: 0 additions & 1 deletion spec/tags/ruby/library/erb/run_tags.txt

This file was deleted.

0 comments on commit 0cc945b

Please sign in to comment.