Package org.jruby.ir.operands

Examples of org.jruby.ir.operands.ScopeModule


        c.addInstr(new ReceiveSelfInstr(c.getSelf()));
        // Set %current_scope = <c>
        // Set %current_module = module<c>
        c.addInstr(new CopyInstr(c.getCurrentScopeVariable(), new CurrentScope(c)));
        c.addInstr(new CopyInstr(c.getCurrentModuleVariable(), new ScopeModule(c)));
        // Create a new nested builder to ensure this gets its own IR builder state
        Operand rv = createIRBuilder(manager, is1_9()).build(classNode.getBodyNode(), c);
        if (rv != null) c.addInstr(new ReturnInstr(rv));

        return ret;
View Full Code Here


        mc.addInstr(new ReceiveSelfInstr(mc.getSelf()));
        // Set %current_scope = <current-scope>
        // Set %current_module = <current-module>
        mc.addInstr(new ReceiveClosureInstr(mc.getImplicitBlockArg()));
        mc.addInstr(new CopyInstr(mc.getCurrentScopeVariable(), new CurrentScope(mc)));
        mc.addInstr(new CopyInstr(mc.getCurrentModuleVariable(), new ScopeModule(mc)));
        // Create a new nested builder to ensure this gets its own IR builder state
        Operand rv = createIRBuilder(manager, is1_9()).build(sclassNode.getBodyNode(), mc);
        if (rv != null) mc.addInstr(new ReturnInstr(rv));

        return ret;
View Full Code Here

        while (cvarScope != null && !(cvarScope instanceof IREvalScript) && !cvarScope.isNonSingletonClassBody()) {
            cvarScope = cvarScope.getLexicalParent();
        }

        if ((cvarScope != null) && cvarScope.isNonSingletonClassBody()) {
            return new ScopeModule(cvarScope);
        } else {
            Variable tmp = s.getNewTemporaryVariable();
            s.addInstr(new GetClassVarContainerModuleInstr(tmp, s.getCurrentScopeVariable(), declContext ? null : getSelf(s)));
            return tmp;
        }
View Full Code Here

        return buildConstDeclAssignment(node, s, val);
    }

    private Operand findContainerModule(IRScope s) {
        IRScope nearestModuleBody = s.getNearestModuleReferencingScope();
        return (nearestModuleBody == null) ? s.getCurrentModuleVariable() : new ScopeModule(nearestModuleBody);
    }
View Full Code Here

            s.addInstr(new PutConstInstr(findContainerModule(s), constDeclNode.getName(), val));
        } else if (constNode.getNodeType() == NodeType.COLON2NODE) {
            Operand module = build(((Colon2Node) constNode).getLeftNode(), s);
            s.addInstr(new PutConstInstr(module, constDeclNode.getName(), val));
        } else { // colon3, assign in Object
            ScopeModule object = new ScopeModule(manager.getObject());           
            s.addInstr(new PutConstInstr(object, constDeclNode.getName(), val));           
        }

        return val;
    }
View Full Code Here

        // Set %current_scope = <current-scope>
        // Set %current_module = isInstanceMethod ? %self.metaclass : %self
        IRScope nearestScope = s.getNearestModuleReferencingScope();
        method.addInstr(new CopyInstr(method.getCurrentScopeVariable(), new CurrentScope(nearestScope == null ? s : nearestScope)));
        method.addInstr(new CopyInstr(method.getCurrentModuleVariable(), new ScopeModule(nearestScope == null ? s : nearestScope)));

        // Build IR for arguments (including the block arg)
        receiveMethodArgs(defNode.getArgsNode(), method);

        // Thread poll on entry to method
View Full Code Here

        if (varNode != null && varNode.getNodeType() != null) forBuilder.receiveBlockArgs(forNode, closure);

        // Set %current_scope = <current-scope>
        // Set %current_module = <current-module>
        closure.addInstr(new CopyInstr(closure.getCurrentScopeVariable(), new CurrentScope(closure)));
        closure.addInstr(new CopyInstr(closure.getCurrentModuleVariable(), new ScopeModule(closure)));

        // Thread poll on entry of closure
        closure.addInstr(new ThreadPollInstr());

            // Start label -- used by redo!
View Full Code Here

        closureBuilder.receiveBlockClosureArg(iterNode.getBlockVarNode(), closure);

        // Set %current_scope = <current-scope>
        // Set %current_module = <current-module>
        closure.addInstr(new CopyInstr(closure.getCurrentScopeVariable(), new CurrentScope(closure)));
        closure.addInstr(new CopyInstr(closure.getCurrentModuleVariable(), new ScopeModule(closure)));

        // Thread poll on entry of closure
        closure.addInstr(new ThreadPollInstr());

        // start label -- used by redo!
View Full Code Here

                container = build(leftNode, s);
            } else { // Only name with no left-side Bar <- Note no :: on left
                container = findContainerModule(s);
            }
        } else { //::Bar
            container = new ScopeModule(manager.getObject());
        }

        return container;
    }
View Full Code Here

        m.addInstr(new ReceiveSelfInstr(m.getSelf()));
        // Set %current_scope = <c>
        // Set %current_module = module<c>
        m.addInstr(new CopyInstr(m.getCurrentScopeVariable(), new CurrentScope(m)));
        m.addInstr(new CopyInstr(m.getCurrentModuleVariable(), new ScopeModule(m)));
        // Create a new nested builder to ensure this gets its own IR builder state
        Operand rv = createIRBuilder(manager, is1_9()).build(moduleNode.getBodyNode(), m);
        if (rv != null) m.addInstr(new ReturnInstr(rv));

        return ret;
View Full Code Here

TOP

Related Classes of org.jruby.ir.operands.ScopeModule

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.