Package org.jruby.runtime

Examples of org.jruby.runtime.Block


       
    @Override
    public IRubyObject interpret(Ruby runtime, ThreadContext context, IRubyObject self, Block aBlock) {
        IRubyObject receiver = getReceiverNode().interpret(runtime, context, self, aBlock);
        IRubyObject arg = getArgsNode().interpret(runtime, context, self, aBlock);
        Block block = getBlock(context, self);

        if (arg instanceof RubyArray) {
            RubyArray nodes = (RubyArray) arg;

            switch (nodes.size()) {
View Full Code Here


        // Each root node has a top-level scope that we need to push
        context.preScopedBody(scope);

        // FIXME: I use a for block to implement END node because we need a proc which captures
        // its enclosing scope.   ForBlock now represents these node and should be renamed.
        Block block = InterpretedBlock.newInterpretedClosure(context, this, self);
       
        try {
            block.yield(context, null);
        } finally {
            context.postScopedBody();
        }

        return runtime.getNil();
View Full Code Here

        arg3 = args.get(2);
    }

    @Override
    public IRubyObject interpret(Ruby runtime, ThreadContext context, IRubyObject self, Block aBlock) {
        Block block = getBlock(runtime, context, self, aBlock);
       
        return callAdapter.call(context, self, self,
                arg1.interpret(runtime, context, self, aBlock),
                arg2.interpret(runtime, context, self, aBlock),
                arg3.interpret(runtime, context, self, aBlock), block);
View Full Code Here

    }
       
    @Override
    public IRubyObject interpret(Ruby runtime, ThreadContext context, IRubyObject self, Block aBlock) {
        IRubyObject receiver = getReceiverNode().interpret(runtime, context, self, aBlock);
        Block block = getBlock(context, self);
           
        return callAdapter.call(context, self, receiver,
                arg1.interpret(runtime, context, self, aBlock), block);
    }
View Full Code Here

            throw context.getRuntime().newArgumentError("wrong # of arguments(" + args.length + " for 2)");
        }
    }
   
    private DynamicMethod createProcMethod(String name, Visibility visibility, RubyProc proc) {
        Block block = proc.getBlock();
        block.getBinding().getFrame().setKlazz(this);
        block.getBinding().getFrame().setName(name);
       
        StaticScope scope = block.getBody().getStaticScope();

        // for zsupers in define_method (blech!) we tell the proc scope to act as the "argument" scope
        scope.setArgumentScope(true);

        Arity arity = block.arity();
        // just using required is broken...but no more broken than before zsuper refactoring
        scope.setRequiredArgs(arity.required());

        if(!arity.isFixed()) {
            scope.setRestArg(arity.required());
View Full Code Here

        return Node.createList(getVarNode(), getBodyNode(), iterNode);
    }
   
    @Override
    public IRubyObject interpret(Ruby runtime, ThreadContext context, IRubyObject self, Block aBlock) {
        Block block = SharedScopeBlock.newInterpretedSharedScopeClosure(context, this, context.getCurrentScope(), self);
  
        try {
            while (true) {
                try {
                    String savedFile = context.getFile();
View Full Code Here

    }
       
    @Override
    public IRubyObject interpret(Ruby runtime, ThreadContext context, IRubyObject self, Block aBlock) {
        IRubyObject receiver = getReceiverNode().interpret(runtime, context, self, aBlock);
        Block block = getBlock(context, self);
           
        while (true) {
            try {
                return callAdapter.call(context, self, receiver, block);
            } catch (JumpException.RetryJump rj) {
                // allow loop to retry
            } finally {
                block.escape();
            }
        }   
    }
View Full Code Here

    @Override
    public IRubyObject interpret(Ruby runtime, ThreadContext context, IRubyObject self, Block aBlock) {
        RuntimeHelpers.checkSuperDisabledOrOutOfMethod(context);

        IRubyObject[] args = ASTInterpreter.setupArgs(runtime, context, argsNode, self, aBlock);
        Block block = ASTInterpreter.getBlock(runtime, context, self, aBlock, iterNode);
       
        // If no explicit block passed to super, then use the one passed in, unless it's explicitly cleared with nil
        if (iterNode == null && !block.isGiven()) block = aBlock;
       
        return RuntimeHelpers.invokeSuper(context, self, args, block);
    }
View Full Code Here

    }
       
    @Override
    public IRubyObject interpret(Ruby runtime, ThreadContext context, IRubyObject self, Block aBlock) {
        IRubyObject receiver = getReceiverNode().interpret(runtime, context, self, aBlock);
        Block block = getBlock(runtime, context, self, aBlock);
           
        return callAdapter.call(context, self, receiver,
                arg1.interpret(runtime, context, self, aBlock),
                arg2.interpret(runtime, context, self, aBlock),
                arg3.interpret(runtime, context, self, aBlock), block);
View Full Code Here

    }
   
    @Override
    public IRubyObject interpret(Ruby runtime, ThreadContext context, IRubyObject self, Block aBlock) {
        IRubyObject[] args = ((ArrayNode) getArgsNode()).interpretPrimitive(runtime, context, self, aBlock);
        Block block = getBlock(context, self);

        return callAdapter.call(context, self, self, args, block);
    }
View Full Code Here

TOP

Related Classes of org.jruby.runtime.Block

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.