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

Commits on Jul 10, 2015

  1. Copy the full SHA
    8f0c1cf View commit details
  2. Copy the full SHA
    f1b7d5b View commit details
13 changes: 0 additions & 13 deletions spec/truffle/tags/core/kernel/public_send_tags.txt
Original file line number Diff line number Diff line change
@@ -1,16 +1,3 @@
fails:Kernel#public_send invokes the named public method
fails:Kernel#public_send invokes the named alias of a public method
fails:Kernel#public_send invokes the named method
fails:Kernel#public_send accepts a String method name
fails:Kernel#public_send invokes a class method if called on a class
fails:Kernel#public_send raises an ArgumentError if called with fewer arguments than required parameters
fails:Kernel#public_send succeeds if passed an arbitrary number of arguments as a splat parameter
fails:Kernel#public_send succeeds when passing 1 or more arguments as a required and a splat parameter
fails:Kernel#public_send succeeds when passing 0 arguments to a method with one parameter with a default
fails:Kernel#public_send has an arity of -1
fails:Kernel#public_send raises a NoMethodError if the method is protected
fails:Kernel#public_send raises a NoMethodError if the named method is private
fails:Kernel#public_send raises a NoMethodError if the named method is an alias of a private method
fails:Kernel#public_send raises a NoMethodError if the named method is an alias of a protected method
fails:Kernel#public_send raises a NameError if the corresponding method can't be found
fails:Kernel#public_send raises a NameError if the corresponding singleton method can't be found
Original file line number Diff line number Diff line change
@@ -1303,6 +1303,37 @@ public RubyBasicObject publicMethods(VirtualFrame frame, Object self, boolean in

}

@CoreMethod(names = "public_send", needsBlock = true, required = 1, argumentsAsArray = true)
public abstract static class PublicSendNode extends CoreMethodArrayArgumentsNode {

@Child private CallDispatchHeadNode dispatchNode;

public PublicSendNode(RubyContext context, SourceSection sourceSection) {
super(context, sourceSection);

dispatchNode = new CallDispatchHeadNode(context, false,
DispatchNode.DISPATCH_METAPROGRAMMING_ALWAYS_INDIRECT,
MissingBehavior.CALL_METHOD_MISSING);

if (DispatchNode.DISPATCH_METAPROGRAMMING_ALWAYS_UNCACHED) {
dispatchNode.forceUncached();
}
}

@Specialization
public Object send(VirtualFrame frame, Object self, Object[] args, NotProvided block) {
return send(frame, self, args, (RubyProc) null);
}

@Specialization
public Object send(VirtualFrame frame, Object self, Object[] args, RubyProc block) {
final Object name = args[0];
final Object[] sendArgs = ArrayUtils.extractRange(args, 1, args.length);
return dispatchNode.call(frame, self, name, block, sendArgs);
}

}

@CoreMethod(names = "rand", isModuleFunction = true, optional = 1)
public abstract static class RandNode extends CoreMethodArrayArgumentsNode {

Original file line number Diff line number Diff line change
@@ -1007,7 +1007,7 @@ public RubyException noMethodErrorOnReceiver(String name, Object receiver, Node

public RubyException privateMethodError(String name, RubyModule module, Node currentNode) {
CompilerAsserts.neverPartOfCompilation();
return noMethodError(String.format("private method `%s' called for %s", name, module.toString()), name, currentNode);
return noMethodError(String.format("private method `%s' called for %s", name, module.getName()), name, currentNode);
}

public RubyException loadError(String message, Node currentNode) {