Skip to content
Permalink

Comparing changes

Choose two branches to see what’s changed or to start a new pull request. If you need to, you can also or learn more about diff comparisons.

Open a pull request

Create a new pull request by comparing changes across two branches. If you need to, you can also . Learn more about diff comparisons here.
base repository: jruby/jruby
Failed to load repositories. Confirm that selected base ref is valid, then try again.
Loading
base: 583bfde4b8ec
Choose a base ref
...
head repository: jruby/jruby
Failed to load repositories. Confirm that selected head ref is valid, then try again.
Loading
compare: 0568106c6298
Choose a head ref
  • 2 commits
  • 3 files changed
  • 1 contributor

Commits on Apr 28, 2018

  1. Copy the full SHA
    021f497 View commit details
  2. Copy the full SHA
    0568106 View commit details
Showing with 11 additions and 2 deletions.
  1. +6 −0 core/src/main/java/org/jruby/RubyModule.java
  2. +5 −0 core/src/main/java/org/jruby/ir/interpreter/Interpreter.java
  3. +0 −2 test/mri/excludes/TestRefinement.rb
6 changes: 6 additions & 0 deletions core/src/main/java/org/jruby/RubyModule.java
Original file line number Diff line number Diff line change
@@ -996,6 +996,9 @@ public synchronized void prependModule(IRubyObject arg) {
throw getRuntime().newTypeError("Wrong argument type " + arg.getMetaClass().getName() +
" (expected Module).");
}
if (((RubyModule) arg).refinedClass != null) {
throw getRuntime().newArgumentError("refinement module is not allowed");
}

RubyModule module = (RubyModule) arg;

@@ -1030,6 +1033,9 @@ public synchronized void includeModule(IRubyObject arg) {
throw getRuntime().newTypeError("Wrong argument type " + arg.getMetaClass().getName() +
" (expected Module).");
}
if (((RubyModule) arg).refinedClass != null) {
throw getRuntime().newArgumentError("refinement module is not allowed");
}

RubyModule module = (RubyModule) arg;

5 changes: 5 additions & 0 deletions core/src/main/java/org/jruby/ir/interpreter/Interpreter.java
Original file line number Diff line number Diff line change
@@ -211,6 +211,11 @@ private static BeginEndInterpreterContext prepareIC(ThreadContext context, Dynam
// Top-level script!
IREvalScript script = new IREvalScript(runtime.getIRManager(), containingIRScope, file, lineNumber, staticScope, evalType);

// enable refinements if incoming scope already has an overlay active
if (staticScope.getOverlayModuleForRead() != null) {
script.setIsMaybeUsingRefinements();
}

// We link IRScope to StaticScope because we may add additional variables (like %block). During execution
// we end up growing dynamicscope potentially based on any changes made.
staticScope.setIRScope(script);
2 changes: 0 additions & 2 deletions test/mri/excludes/TestRefinement.rb
Original file line number Diff line number Diff line change
@@ -1,9 +1,7 @@
exclude :test_adding_private_method, "needs investigation"
exclude :test_call_refined_method_in_duplicate_module, "needs investigation"
exclude :test_case_dispatch_is_aware_of_refinements, "needs investigation"
exclude :test_eval_with_binding_scoping, "needs investigation"
exclude :test_include_into_refinement, "needs investigation"
exclude :test_include_refinement, "needs investigation"
exclude :test_inspect, "needs investigation"
exclude :test_main_using_is_private, "needs investigation"
exclude :test_making_private_method_public, "needs investigation"