Package org.jruby.ast

Examples of org.jruby.ast.FCallNode


        context.pollThreadEvents();
    }

    public void compileFCall(Node node, BodyCompiler context) {
        final FCallNode fcallNode = (FCallNode) node;

        ArgumentsCallback argsCallback = getArgsCallback(fcallNode.getArgsNode());
       
        CompilerCallback closureArg = getBlock(fcallNode.getIterNode());

        context.getInvocationCompiler().invokeDynamic(fcallNode.getName(), null, argsCallback, CallType.FUNCTIONAL, closureArg, fcallNode.getIterNode() instanceof IterNode);
    }
View Full Code Here


            context.pollThreadEvents();
        }
    }

    public void compileFCall(Node node, BodyCompiler context, boolean expr) {
        final FCallNode fcallNode = (FCallNode) node;

        ArgumentsCallback argsCallback = getArgsCallback(fcallNode.getArgsNode());
       
        CompilerCallback closureArg = getBlock(fcallNode.getIterNode());

        DYNOPT: if (RubyInstanceConfig.DYNOPT_COMPILE_ENABLED) {
            // dynopt does not handle non-local block flow control yet, so we bail out
            if (fcallNode.getIterNode() != null) break DYNOPT;
            if (fcallNode.callAdapter instanceof CachingCallSite) {
                CachingCallSite cacheSite = (CachingCallSite)fcallNode.callAdapter;
                if (cacheSite.isOptimizable()) {
                    CacheEntry entry = cacheSite.getCache();

                    if (closureArg == null && (argsCallback == null || (argsCallback.getArity() >= 0 && argsCallback.getArity() <= 3))) {
                        // recursive calls
                        if (compileRecursiveCall(fcallNode.getName(), entry.token, CallType.FUNCTIONAL, fcallNode.getIterNode() instanceof IterNode, entry.method, context, argsCallback, closureArg, expr)) return;

                        // peephole inlining for trivial targets
                        if (closureArg == null &&
                                argsCallback == null &&
                                compileTrivialCall(fcallNode.getName(), entry.method, entry.token, context, expr)) return;
                    }
                }
            }
        }

        if (fcallNode instanceof SpecialArgs) {
            context.getInvocationCompiler().invokeDynamicVarargs(fcallNode.getName(), null, argsCallback, CallType.FUNCTIONAL, closureArg, fcallNode.getIterNode() instanceof IterNode);
        } else {
            context.getInvocationCompiler().invokeDynamic(fcallNode.getName(), null, argsCallback, CallType.FUNCTIONAL, closureArg, fcallNode.getIterNode() instanceof IterNode);
        }
       
        // TODO: don't require pop
        if (!expr) context.consumeCurrentValue();
    }
View Full Code Here

    RubyModuleFinder finder = new RubyModuleFinder();
    ModuleNode foundModule = finder.findModule(result.getAST(), functionModuleFQN);
    if(foundModule == null)
      return functions;
    // find the function
    FCallNode foundFunction = new RubyFunctionCallFinder().findFuntion(foundModule, functionDefinition);
    if(foundFunction == null)
      return functions;
    Object arguments = new ConstEvaluator().eval(foundFunction.getArgsNode());
    // Result should be a list with a String, and a Map
    if(!(arguments instanceof List))
      return functions;
    List<?> argList = (List<?>)arguments;
    if(argList.size() != 2)
View Full Code Here

TOP

Related Classes of org.jruby.ast.FCallNode

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.