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: 9a8acd1772fd
Choose a base ref
...
head repository: jruby/jruby
Failed to load repositories. Confirm that selected head ref is valid, then try again.
Loading
compare: 977fbcb9b387
Choose a head ref
  • 2 commits
  • 2 files changed
  • 1 contributor

Commits on Nov 7, 2014

  1. Copy the full SHA
    522036f View commit details
  2. Copy the full SHA
    977fbcb View commit details
Showing with 4 additions and 18 deletions.
  1. +2 −0 core/src/main/java/org/jruby/truffle/nodes/core/ClassNodes.java
  2. +2 −18 core/src/main/java/org/jruby/truffle/nodes/core/KernelNodes.java
Original file line number Diff line number Diff line change
@@ -9,6 +9,7 @@
*/
package org.jruby.truffle.nodes.core;

import com.oracle.truffle.api.CompilerDirectives;
import com.oracle.truffle.api.source.SourceSection;
import com.oracle.truffle.api.dsl.Specialization;
import com.oracle.truffle.api.frame.VirtualFrame;
@@ -44,6 +45,7 @@ public AllocateNode(AllocateNode prev) {
@Specialization
public RubyBasicObject allocate(RubyClass rubyClass) {
if (rubyClass.isSingleton()) {
CompilerDirectives.transferToInterpreter();
throw new RaiseException(getContext().getCoreLibrary().typeError("can't create instance of singleton class", this));
}
return rubyClass.newInstance(this);
20 changes: 2 additions & 18 deletions core/src/main/java/org/jruby/truffle/nodes/core/KernelNodes.java
Original file line number Diff line number Diff line change
@@ -1083,7 +1083,7 @@ public Object loop(VirtualFrame frame) {
}

@CoreMethod(names = "methods", optional = 1)
public abstract static class MethodsNode extends CoreMethodNode {
public abstract static class MethodsNode extends ModuleNodes.InstanceMethodsNode {

public MethodsNode(RubyContext context, SourceSection sourceSection) {
super(context, sourceSection);
@@ -1102,23 +1102,7 @@ public RubyArray methods(RubyObject self, @SuppressWarnings("unused") UndefinedP
public RubyArray methods(RubyObject self, boolean includeInherited) {
notDesignedForCompilation();

final RubyArray array = new RubyArray(self.getContext().getCoreLibrary().getArrayClass());

Map<String, RubyMethod> methods;

if (includeInherited) {
methods = ModuleOperations.getAllMethods(self.getMetaClass());
} else {
methods = self.getMetaClass().getMethods();
}

for (RubyMethod method : methods.values()) {
if (method.getVisibility() == Visibility.PUBLIC || method.getVisibility() == Visibility.PROTECTED) {
array.slowPush(self.getContext().newSymbol(method.getName()));
}
}

return array;
return super.instanceMethods(self.getMetaClass(), includeInherited);
}

}