Package org.jruby.runtime

Examples of org.jruby.runtime.Frame


                // popFrame clears the frame before returning, getFrames clones them for backtrace
                // i.e. only name and backtrace data is copied...
                Stack<Frame> frames = new Stack<>();
                Stack<IRubyObject> selfs = new Stack<>();
                for (Frame cur = context.getCurrentFrame(); cur != null; ) {
                    Frame clone = new Frame();
                    clone.updateFrame(cur); // clone...
                    frames.push(clone);
                    selfs.push(context.getFrameSelf());
                    context.popFrame();
                    try {
                        cur = context.getCurrentFrame();
                    } catch (ArrayIndexOutOfBoundsException e) {
                        break;
                    }
                }
                Stack<DynamicScope> scopes = new Stack<>();
                for (DynamicScope scope = context.getCurrentScope(); scopes.size() != frames.size(); ) {
                    scopes.push(scope);
                    context.popScope();
                    try {
                        scope = context.getCurrentScope();
                    } catch (ArrayIndexOutOfBoundsException aioe) {
                        break;
                    }
                }

                RubyStackTraceElement[] trace = TraceType.Gather.NORMAL.getBacktraceData(context, false).getBacktrace(runtime);
                /*int traceEnd = trace.length;
                for (int i = 0; i < traceEnd; i++) {
                    RubyStackTraceElement rste = trace[i];
                    if (!rste.getFileName().equals(getName())) {
                        trace[i] = null;
                        if (i + 1 < traceEnd)
                            System.arraycopy(trace, i + 1, trace, i, (traceEnd - i) - 1);
                        traceEnd--;
                        trace[traceEnd] = null;
                    }
                }*/
                assert frames.size() == scopes.size() : "Frames don't match scopes :S";
                for (int i = 0; i < frames.size(); i++) {
                    Frame frame = frames.get(i);
                    IRubyObject s = selfs.get(i);
                    DynamicScope scope = scopes.get(i);
                    RubyStackTraceElement stackElement = trace[i];
                    StaticScope sScope = scope.getStaticScope();
                    Map<String, Object> var = new HashMap<>();
View Full Code Here


        }

        // FIXME:  This determine module is in a strange location and should somehow be in block
        evalScope.getStaticScope().determineModule();

        Frame lastFrame = context.preEvalWithBinding(binding);
        try {
            // Binding provided for scope, use it
            RubyString source = src.convertToString();
            Node node = runtime.parseEval(source.getByteList(), binding.getFile(), evalScope, binding.getLine());
            Block block = binding.getFrame().getBlock();
View Full Code Here

TOP

Related Classes of org.jruby.runtime.Frame

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.