Examples of ManyVarsDynamicScope


Examples of org.jruby.runtime.scope.ManyVarsDynamicScope

        this.runtimeCache = runtime.getRuntimeCache();
       
        // 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));

        Frame[] stack = frameStack;
        int length = stack.length;
        for (int i = 0; i < length; i++) {
            stack[i] = new Frame();
View Full Code Here

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

            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

        int line = 0;
        if (lines != null && lines.length > 0) {
            line = lines[0];
        }
        try {
            ManyVarsDynamicScope scope  = null;
            boolean sharing_variables = true;
            Object obj = container.getAttribute(AttributeName.SHARING_VARIABLES);
            if (obj != null && obj instanceof Boolean && ((Boolean) obj) == false) {
                sharing_variables = false;
            }
View Full Code Here

Examples of org.jruby.runtime.scope.ManyVarsDynamicScope

            }
        }
    }

    static ManyVarsDynamicScope getManyVarsDynamicScope(ScriptingContainer container, int depth) {
        ManyVarsDynamicScope scope;

        // root our parsing scope with a dummy scope
        StaticScope topStaticScope = new LocalStaticScope(null);
        topStaticScope.setModule(container.getProvider().getRuntime().getObject());

        DynamicScope currentScope = new ManyVarsDynamicScope(topStaticScope, null);
        String[] names4Injection = container.getVarMap().getLocalVarNames();
        if (names4Injection == null || names4Injection.length == 0) {
            scope =
                new ManyVarsDynamicScope(new EvalStaticScope(currentScope.getStaticScope()), currentScope);
        } else {
            scope =
                new ManyVarsDynamicScope(new EvalStaticScope(currentScope.getStaticScope(), names4Injection), currentScope);
        }

        // JRUBY-5501: ensure we've set up a cref for the scope too
        scope.getStaticScope().determineModule();
       
View Full Code Here

Examples of org.jruby.runtime.scope.ManyVarsDynamicScope

     * execution in the current Thread.
     */
    static void pre(ThreadContext context, IRubyObject self, RubyModule klazz, String name) {
        context.preMethodFrameOnly(klazz, name, self, Block.NULL_BLOCK);
        DynamicScope currentScope = context.getCurrentScope();
        context.pushScope(new ManyVarsDynamicScope(currentScope.getStaticScope(), currentScope));
        GIL.acquire();
    }
View Full Code Here

Examples of org.jruby.runtime.scope.ManyVarsDynamicScope

    /** see {@link #pre(ThreadContext, IRubyObject, RubyModule, String)}  */
    static void pre(ThreadContext context, IRubyObject self, RubyModule klazz, String name, Block block) {
        context.preMethodFrameOnly(klazz, name, self, block);
        DynamicScope currentScope = context.getCurrentScope();
        context.pushScope(new ManyVarsDynamicScope(currentScope.getStaticScope(), currentScope));
        GIL.acquire();
    }
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);

        return evalScriptlet(script, newScope);
    }
View Full Code Here

Examples of org.jruby.runtime.scope.ManyVarsDynamicScope

        if (obj != null && obj instanceof Boolean && ((Boolean) obj) == false) {
            sharing_variables = false;
        }
        try {
            if (sharing_variables) {
                ManyVarsDynamicScope scope;
                if (unit != null && unit.getScope() != null) scope = unit.getScope();
                else scope = EmbedRubyRuntimeAdapterImpl.getManyVarsDynamicScope(container, 0);
                container.getVarMap().inject(scope, 0, rubyReceiver);
                runtime.getCurrentContext().pushScope(scope);
            }
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.