Package org.jruby

Examples of org.jruby.RubyLocalJumpError


     * @param runtime
     */
    public static Throwable unwrapRedoNextBreakOrJustLocalJump(RaiseException re, ThreadContext context) {
        RubyException exception = re.getException();
        if (context.getRuntime().getLocalJumpError().isInstance(exception)) {
            RubyLocalJumpError jumpError = (RubyLocalJumpError)re.getException();

            switch (jumpError.getReason()) {
            case REDO:
                return JumpException.REDO_JUMP;
            case NEXT:
                return new JumpException.NextJump(jumpError.exit_value());
            case BREAK:
                return new JumpException.BreakJump(context.getFrameJumpTarget(), jumpError.exit_value());
            }
        }
        return re;
    }
View Full Code Here


   
    public static String getLocalJumpTypeOrRethrow(RaiseException re) {
        RubyException exception = re.getException();
        Ruby runtime = exception.getRuntime();
        if (runtime.getLocalJumpError().isInstance(exception)) {
            RubyLocalJumpError jumpError = (RubyLocalJumpError)re.getException();

            IRubyObject reason = jumpError.reason();

            return reason.asJavaString();
        }

        throw re;
View Full Code Here

                try {
                    bodyNode.interpret(runtime,context, self, aBlock);
                    break loop;
                } catch (RaiseException re) {
                    if (runtime.getLocalJumpError().isInstance(re.getException())) {
                        RubyLocalJumpError jumpError = (RubyLocalJumpError)re.getException();
                       
                        IRubyObject reason = jumpError.reason();
                       
                        // admittedly inefficient
                        if (reason.asJavaString().equals("break")) {
                            return jumpError.exit_value();
                        } else if (reason.asJavaString().equals("next")) {
                            break loop;
                        } else if (reason.asJavaString().equals("redo")) {
                            continue;
                        }
View Full Code Here

     * @param runtime
     */
    public static Throwable unwrapRedoNextBreakOrJustLocalJump(RaiseException re, ThreadContext context) {
        RubyException exception = re.getException();
        if (context.getRuntime().getLocalJumpError().isInstance(exception)) {
            RubyLocalJumpError jumpError = (RubyLocalJumpError)re.getException();

            switch (jumpError.getReason()) {
            case REDO:
                return JumpException.REDO_JUMP;
            case NEXT:
                return new JumpException.NextJump(jumpError.exit_value());
            case BREAK:
                return new JumpException.BreakJump(context.getFrameJumpTarget(), jumpError.exit_value());
            }
        }
        return re;
    }
View Full Code Here

   
    public static String getLocalJumpTypeOrRethrow(RaiseException re) {
        RubyException exception = re.getException();
        Ruby runtime = exception.getRuntime();
        if (runtime.getLocalJumpError().isInstance(exception)) {
            RubyLocalJumpError jumpError = (RubyLocalJumpError)re.getException();

            IRubyObject reason = jumpError.reason();

            return reason.asJavaString();
        }

        throw re;
View Full Code Here

                try {
                    bodyNode.interpret(runtime,context, self, aBlock);
                    break loop;
                } catch (RaiseException re) {
                    if (runtime.getLocalJumpError().isInstance(re.getException())) {
                        RubyLocalJumpError jumpError = (RubyLocalJumpError)re.getException();
                       
                        IRubyObject reason = jumpError.reason();
                       
                        // admittedly inefficient
                        if (reason.asJavaString().equals("break")) {
                            return jumpError.exit_value();
                        } else if (reason.asJavaString().equals("next")) {
                            break loop;
                        } else if (reason.asJavaString().equals("redo")) {
                            continue;
                        }
View Full Code Here

TOP

Related Classes of org.jruby.RubyLocalJumpError

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.