Skip to content

Instantly share code, notes, and snippets.

@headius
Created October 20, 2014 19:07
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save headius/98fdf1f7e8a6c3b037b9 to your computer and use it in GitHub Desktop.
Save headius/98fdf1f7e8a6c3b037b9 to your computer and use it in GitHub Desktop.
diff --git a/core/src/main/java/org/jruby/RubyEncoding.java b/core/src/main/java/org/jruby/RubyEncoding.java
index f872076..5e2c025 100755
--- a/core/src/main/java/org/jruby/RubyEncoding.java
+++ b/core/src/main/java/org/jruby/RubyEncoding.java
@@ -81,7 +81,7 @@ public class RubyEncoding extends RubyObject implements Constantizable {
private final Object constant;
private RubyEncoding(Ruby runtime, byte[] name, int p, int end, boolean isDummy) {
- this(runtime, new ByteList(name, p, end), null, false);
+ this(runtime, new ByteList(name, p, end), null, isDummy);
}
private RubyEncoding(Ruby runtime, byte[] name, boolean isDummy) {
diff --git a/core/src/main/java/org/jruby/runtime/Block.java b/core/src/main/java/org/jruby/runtime/Block.java
index e0f4ea5..4143818 100644
--- a/core/src/main/java/org/jruby/runtime/Block.java
+++ b/core/src/main/java/org/jruby/runtime/Block.java
@@ -184,7 +184,12 @@ public final class Block {
}
public Block cloneBlockForEval(IRubyObject self, EvalType evalType) {
- Block block = cloneBlock();
+ Binding newBinding = new Binding(self, binding.getFrame().duplicate(), binding.getVisibility(), binding.getDynamicScope(), binding.getBacktrace());
+
+ Block block = new Block(body, newBinding);
+
+ block.type = type;
+ block.escapeBlock = this;
block.getBinding().setSelf(self);
block.getBinding().getFrame().setSelf(self);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment