Examples of ManyVarsDynamicScope


Examples of org.jruby.runtime.scope.ManyVarsDynamicScope

        case 3:
            return new ThreeVarDynamicScope(staticScope, parent);
        case 4:
            return new FourVarDynamicScope(staticScope, parent);
        default:
            return new ManyVarsDynamicScope(staticScope, parent);
        }
    }
View Full Code Here

Examples of org.jruby.runtime.scope.ManyVarsDynamicScope

            return new ManyVarsDynamicScope(staticScope, parent);
        }
    }
   
    public static DynamicScope newDummyScope(StaticScope staticScope, DynamicScope parent) {
        return new ManyVarsDynamicScope(staticScope, parent);
    }
View Full Code Here

Examples of org.jruby.runtime.scope.ManyVarsDynamicScope

            DynamicScope parent = getNextCapturedScope();
            if (parent != null && parent.getEvalScope() == this) {
                evalScope = this;
            } else {
                // bindings scopes must always be ManyVars scopes since evals can grow them
                evalScope = new ManyVarsDynamicScope(new EvalStaticScope(getStaticScope()), this);
            }
        }
       
        return evalScope;
    }
View Full Code Here

Examples of org.jruby.runtime.scope.ManyVarsDynamicScope

        errorInfo = runtime.getNil();
       
        // TOPLEVEL self and a few others want a top-level scope.  We create this one right
        // away and then pass it into top-level parse so it ends up being the top level.
        StaticScope topStaticScope = new LocalStaticScope(null);
        pushScope(new ManyVarsDynamicScope(topStaticScope, null));
           
        for (int i = 0; i < frameStack.length; i++) {
            frameStack[i] = new Frame();
        }
    }
View Full Code Here

Examples of org.jruby.runtime.scope.ManyVarsDynamicScope

        pushFrameCopy();
        getCurrentFrame().setSelf(type);
        getCurrentFrame().setVisibility(Visibility.PUBLIC);
        StaticScope staticScope = new LocalStaticScope(getCurrentScope().getStaticScope(), scopeNames);
        staticScope.setModule(type);
        pushScope(new ManyVarsDynamicScope(staticScope, null));
    }
View Full Code Here

Examples of org.jruby.runtime.scope.ManyVarsDynamicScope

     * @returns The result of the eval
     */
    public IRubyObject evalScriptlet(String script) {
        ThreadContext context = getCurrentContext();
        DynamicScope currentScope = context.getCurrentScope();
        ManyVarsDynamicScope newScope = new ManyVarsDynamicScope(new EvalStaticScope(currentScope.getStaticScope()), currentScope);
        Node node = parseEval(script, "<script>", newScope, 0);
       
        try {
            context.preEvalScriptlet(newScope);
            return node.interpret(this, context, context.getFrameSelf(), Block.NULL_BLOCK);
View Full Code Here

Examples of org.jruby.runtime.scope.ManyVarsDynamicScope

     */
    public IRubyObject exec(ThreadContext context, StaticScope scope, Instruction[] bytecodes) {
        try {
            IRubyObject self = context.getRuntime().getObject();
           
            context.preScopedBody(new ManyVarsDynamicScope(scope));
       
            if (scope.getModule() == null) {
                scope.setModule(context.getRuntime().getObject());
            }
           
View Full Code Here

Examples of org.jruby.runtime.scope.ManyVarsDynamicScope

     * @param runtime Ruby runtime
     * @param receiver receiver object returned when a script is evaluated.
     * @param vars map to save retrieved local variables.
     */
    public static void retrieve(RubyObject receiver, BiVariableMap vars) {
        ManyVarsDynamicScope scope =
            (ManyVarsDynamicScope) receiver.getRuntime().getCurrentContext().getCurrentScope();
        if (scope == null) {
            return;
        }
        String[] names = scope.getAllNamesInScope();
        IRubyObject[] values = scope.getValues();
        if (names == null || values == null || names.length == 0 || values.length == 0) {
            return;
        }
        // Local variable is always saved as a top level variable.
        for (int i=0; i<names.length; i++) {
View Full Code Here

Examples of org.jruby.runtime.scope.ManyVarsDynamicScope

     */
    public void remove() {
        ThreadContext context = receiver.getRuntime().getCurrentContext();
        try {
            DynamicScope currentScope = context.getCurrentScope();
            ManyVarsDynamicScope scope = (ManyVarsDynamicScope) context.getCurrentScope();
            scope = new ManyVarsDynamicScope(new EvalStaticScope(currentScope.getStaticScope()), currentScope);
        } catch (ArrayIndexOutOfBoundsException e) {
            //no context is left.
            //no operation is needed.
        }
    }
View Full Code Here

Examples of org.jruby.runtime.scope.ManyVarsDynamicScope

        // of the AST before parsing.  This makes us end up needing to readjust
        // this dynamic scope coming out of parse (and for local static scopes it
        // will always happen because of $~ and $_).
        // FIXME: Because we end up adjusting this after-the-fact, we can't use
        // any of the specific-size scopes.
        return new ManyVarsDynamicScope(new LocalStaticScope(null), existingScope);
    }
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. 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.