changeset 13659:62bfc12dc9e1

Ruby: more tidy up.
author Chris Seaton <chris.seaton@oracle.com>
date Wed, 15 Jan 2014 19:54:48 +0000
parents 50c11b9a7fdf
children d2976008ce63
files graal/com.oracle.truffle.ruby.nodes/src/com/oracle/truffle/ruby/nodes/core/KernelNodes.java graal/com.oracle.truffle.ruby.nodes/src/com/oracle/truffle/ruby/nodes/literal/HashLiteralNode.java graal/com.oracle.truffle.ruby.nodes/src/com/oracle/truffle/ruby/nodes/methods/CatchNextNode.java graal/com.oracle.truffle.ruby.nodes/src/com/oracle/truffle/ruby/nodes/methods/MethodDefinitionNode.java graal/com.oracle.truffle.ruby.runtime/src/com/oracle/truffle/ruby/runtime/configuration/Configuration.java graal/com.oracle.truffle.ruby.runtime/src/com/oracle/truffle/ruby/runtime/configuration/ConfigurationBuilder.java graal/com.oracle.truffle.ruby.shell/src/com/oracle/truffle/ruby/shell/CommandLineParser.java graal/com.oracle.truffle.ruby.test/src/com/oracle/truffle/ruby/test/core/ContinuationTests.java
diffstat 8 files changed, 15 insertions(+), 32 deletions(-) [+]
line wrap: on
line diff
--- a/graal/com.oracle.truffle.ruby.nodes/src/com/oracle/truffle/ruby/nodes/core/KernelNodes.java	Wed Jan 15 19:33:33 2014 +0000
+++ b/graal/com.oracle.truffle.ruby.nodes/src/com/oracle/truffle/ruby/nodes/core/KernelNodes.java	Wed Jan 15 19:54:48 2014 +0000
@@ -629,13 +629,6 @@
 
         @Specialization(order = 3)
         public Object raise(VirtualFrame frame, RubyClass exceptionClass, RubyString message) {
-            final RubyContext context = getContext();
-
-            if (context.getConfiguration().getPrintRubyExceptions()) {
-                context.implementationMessage("Ruby raise: %s", message);
-                new Exception().printStackTrace();
-            }
-
             final RubyBasicObject exception = exceptionClass.newInstance();
             initialize.dispatch(frame, exception, null, message);
             throw new RaiseException(exception);
--- a/graal/com.oracle.truffle.ruby.nodes/src/com/oracle/truffle/ruby/nodes/literal/HashLiteralNode.java	Wed Jan 15 19:33:33 2014 +0000
+++ b/graal/com.oracle.truffle.ruby.nodes/src/com/oracle/truffle/ruby/nodes/literal/HashLiteralNode.java	Wed Jan 15 19:54:48 2014 +0000
@@ -41,4 +41,9 @@
         return hash;
     }
 
+    @Override
+    public Object isDefined(VirtualFrame frame) {
+        return getContext().makeString("expression");
+    }
+
 }
--- a/graal/com.oracle.truffle.ruby.nodes/src/com/oracle/truffle/ruby/nodes/methods/CatchNextNode.java	Wed Jan 15 19:33:33 2014 +0000
+++ b/graal/com.oracle.truffle.ruby.nodes/src/com/oracle/truffle/ruby/nodes/methods/CatchNextNode.java	Wed Jan 15 19:54:48 2014 +0000
@@ -39,4 +39,5 @@
             return e.getResult();
         }
     }
+
 }
--- a/graal/com.oracle.truffle.ruby.nodes/src/com/oracle/truffle/ruby/nodes/methods/MethodDefinitionNode.java	Wed Jan 15 19:33:33 2014 +0000
+++ b/graal/com.oracle.truffle.ruby.nodes/src/com/oracle/truffle/ruby/nodes/methods/MethodDefinitionNode.java	Wed Jan 15 19:54:48 2014 +0000
@@ -91,4 +91,8 @@
         return name;
     }
 
+    public CallTarget getCallTarget() {
+        return callTarget;
+    }
+
 }
--- a/graal/com.oracle.truffle.ruby.runtime/src/com/oracle/truffle/ruby/runtime/configuration/Configuration.java	Wed Jan 15 19:33:33 2014 +0000
+++ b/graal/com.oracle.truffle.ruby.runtime/src/com/oracle/truffle/ruby/runtime/configuration/Configuration.java	Wed Jan 15 19:54:48 2014 +0000
@@ -34,7 +34,6 @@
     private final boolean printParseTree;
     private final boolean printUninitializedCalls;
     private final boolean printJavaExceptions;
-    private final boolean printRubyExceptions;
 
     private final PrintStream standardOut;
     private final InputReader inputReader;
@@ -58,7 +57,6 @@
         printParseTree = builder.getPrintParseTree();
         printUninitializedCalls = builder.getPrintUninitializedCalls();
         printJavaExceptions = builder.getPrintJavaExceptions();
-        printRubyExceptions = builder.getPrintRubyExceptions();
 
         standardOut = builder.getStandardOut();
         inputReader = builder.getInputReader();
@@ -112,10 +110,6 @@
         return printJavaExceptions;
     }
 
-    public boolean getPrintRubyExceptions() {
-        return printRubyExceptions;
-    }
-
     public PrintStream getStandardOut() {
         return standardOut;
     }
--- a/graal/com.oracle.truffle.ruby.runtime/src/com/oracle/truffle/ruby/runtime/configuration/ConfigurationBuilder.java	Wed Jan 15 19:33:33 2014 +0000
+++ b/graal/com.oracle.truffle.ruby.runtime/src/com/oracle/truffle/ruby/runtime/configuration/ConfigurationBuilder.java	Wed Jan 15 19:54:48 2014 +0000
@@ -39,7 +39,6 @@
     private boolean printParseTree = false;
     private boolean printUninitializedCalls = false;
     private boolean printJavaExceptions = false;
-    private boolean printRubyExceptions = false;
 
     private PrintStream standardOut = System.out;
 
@@ -77,7 +76,6 @@
         printParseTree = configuration.getPrintParseTree();
         printUninitializedCalls = configuration.getPrintUninitializedCalls();
         printJavaExceptions = configuration.getPrintJavaExceptions();
-        printRubyExceptions = configuration.getPrintRubyExceptions();
 
         standardOut = configuration.getStandardOut();
     }
@@ -181,14 +179,6 @@
         this.printJavaExceptions = printJavaExceptions;
     }
 
-    public boolean getPrintRubyExceptions() {
-        return printRubyExceptions;
-    }
-
-    public void setPrintRubyExceptions(boolean printRubyExceptions) {
-        this.printRubyExceptions = printRubyExceptions;
-    }
-
     public PrintStream getStandardOut() {
         return standardOut;
     }
--- a/graal/com.oracle.truffle.ruby.shell/src/com/oracle/truffle/ruby/shell/CommandLineParser.java	Wed Jan 15 19:33:33 2014 +0000
+++ b/graal/com.oracle.truffle.ruby.shell/src/com/oracle/truffle/ruby/shell/CommandLineParser.java	Wed Jan 15 19:54:48 2014 +0000
@@ -223,9 +223,6 @@
                         case "--print-java-exceptions":
                             configurationBuilder.setPrintJavaExceptions(true);
                             break;
-                        case "--print-ruby-exceptions":
-                            configurationBuilder.setPrintRubyExceptions(true);
-                            break;
                         default:
                             throw new IllegalArgumentException("unknown flag " + arg);
                     }
@@ -333,7 +330,6 @@
         out.println("  --print-parse-tree                print the result of parsing");
         out.println("  --print-uninitialized-calls       print each time a method call is uninitialized");
         out.println("  --print-java-exceptions           print Java exception back traces at the point of translating them to Ruby exceptions");
-        out.println("  --print-ruby-exceptions           print the Java exception back traces at the point of raising Ruby exceptions");
         out.println("Relevant environment variables:");
         out.println("  RUBYHOME                          location of the Ruby Truffle installation");
         out.println("  RUBYOPT                           extra command line arguments");
--- a/graal/com.oracle.truffle.ruby.test/src/com/oracle/truffle/ruby/test/core/ContinuationTests.java	Wed Jan 15 19:33:33 2014 +0000
+++ b/graal/com.oracle.truffle.ruby.test/src/com/oracle/truffle/ruby/test/core/ContinuationTests.java	Wed Jan 15 19:54:48 2014 +0000
@@ -20,23 +20,23 @@
 
     @Test
     public void testRequired() {
-        assertPrints("", "require \"continuation\"; callcc { |c| c.call }");
+        assertPrints("", "callcc { |c| c.call }");
     }
 
     @Test
     public void testOneShotGoingUpCallstack() {
-        assertPrints("1\n3\n", "require \"continuation\"; callcc { |c| puts 1; c.call; puts 2 }; puts 3");
+        assertPrints("1\n3\n", "callcc { |c| puts 1; c.call; puts 2 }; puts 3");
     }
 
     @Test
     public void testOneShotGoingUpCallstackReturnValue() {
-        assertPrints("14\n", "require \"continuation\"; puts callcc { |c| c.call 14 }");
+        assertPrints("14\n", "puts callcc { |c| c.call 14 }");
     }
 
     @Test
     public void testNestedOneShotGoingUpCallstack() {
-        assertPrints("1\n2\n4\n5\n", "require \"continuation\"; callcc { |c1| puts 1; callcc { |c2| puts 2; c2.call; puts 3 }; puts 4 }; puts 5");
-        assertPrints("1\n2\n5\n", "require \"continuation\"; callcc { |c1| puts 1; callcc { |c2| puts 2; c1.call; puts 3 }; puts 4 }; puts 5");
+        assertPrints("1\n2\n4\n5\n", "callcc { |c1| puts 1; callcc { |c2| puts 2; c2.call; puts 3 }; puts 4 }; puts 5");
+        assertPrints("1\n2\n5\n", "callcc { |c1| puts 1; callcc { |c2| puts 2; c1.call; puts 3 }; puts 4 }; puts 5");
     }
 
 }