Skip to content

Commit

Permalink
[Truffle] Remove prettyprint shims and import real code.
Browse files Browse the repository at this point in the history
  • Loading branch information
chrisseaton committed Jan 7, 2015
1 parent 88d03a9 commit fe48a1f
Show file tree
Hide file tree
Showing 4 changed files with 2 additions and 32 deletions.
27 changes: 0 additions & 27 deletions core/src/main/java/org/jruby/truffle/nodes/core/KernelNodes.java
Expand Up @@ -1379,33 +1379,6 @@ public ObjectIDNode(ObjectIDNode prev) {

}

/*
* Kernel#pretty_inspect is normally part of stdlib, in pp.rb, but we aren't able to execute
* that file yet. Instead we implement a very simple version here, which is the solution
* suggested by RubySpec.
*/

@CoreMethod(names = "pretty_inspect")
public abstract static class PrettyInspectNode extends CoreMethodNode {

@Child protected DispatchHeadNode inspectNode;

public PrettyInspectNode(RubyContext context, SourceSection sourceSection) {
super(context, sourceSection);
inspectNode = DispatchHeadNode.onSelf(context);
}

public PrettyInspectNode(PrettyInspectNode prev) {
super(prev);
inspectNode = prev.inspectNode;
}

@Specialization
public Object prettyInspect(VirtualFrame frame, Object self) {
return inspectNode.call(frame, self, "inspect", null);
}
}

@CoreMethod(names = "print", isModuleFunction = true, argumentsAsArray = true)
public abstract static class PrintNode extends CoreMethodNode {

Expand Down
Expand Up @@ -62,11 +62,6 @@ public boolean require(String path, String feature, RubyNode currentNode) throws
return true;
}

if (feature.equals("pp")) {
// Kernel#pretty_inspect is always there
return true;
}

if (feature.equals("thread")) {
return true;
}
Expand Down
1 change: 1 addition & 0 deletions lib/ruby/truffle/mri/pp.rb
@@ -0,0 +1 @@
require_relative '../../stdlib/pp'
1 change: 1 addition & 0 deletions lib/ruby/truffle/mri/prettyprint.rb
@@ -0,0 +1 @@
require_relative '../../stdlib/prettyprint'

0 comments on commit fe48a1f

Please sign in to comment.