Package org.cx4a.rsense.ruby

Examples of org.cx4a.rsense.ruby.Scope


    public static Vertex localAssign(Graph graph, LocalAsgnNode node) {
        return localAssign(graph, node, null);
    }

    public static Vertex localAssign(Graph graph, LocalAsgnNode node, Vertex src) {
        Scope scope = graph.getRuntime().getContext().getCurrentScope();
        VertexHolder holder = (VertexHolder) scope.getValue(node.getName());
        if (src == null) {
            src = graph.createVertex(node.getValueNode());
        }
        if (holder == null) {
            holder = graph.createFreeVertexHolder();
            scope.setValue(node.getName(), holder);
        }
        graph.addEdgeAndPropagate(src, holder.getVertex());
        return src;
    }
View Full Code Here


    public static Vertex dynamicAssign(Graph graph, DAsgnNode node) {
        return dynamicAssign(graph, node, null);
    }

    public static Vertex dynamicAssign(Graph graph, DAsgnNode node, Vertex src) {
        Scope scope = graph.getRuntime().getContext().getCurrentScope();
        VertexHolder holder = (VertexHolder) scope.getValue(node.getName());
        if (src == null) {
            src = graph.createVertex(node.getValueNode());
        }
        if (holder == null) {
            holder = graph.createFreeVertexHolder();
            scope.setValue(node.getName(), holder);
        }
        graph.addEdgeAndPropagate(src, holder.getVertex());
        return src;
    }
View Full Code Here

    public static void blockAssign(Graph graph, BlockArgNode node, Block block) {
        if (block == null)
            return;
       
        Scope scope = graph.getRuntime().getContext().getCurrentScope();
        VertexHolder holder = (VertexHolder) scope.getValue(node.getName());
        if (holder == null) {
            holder = graph.createFreeVertexHolder();
            scope.setValue(node.getName(), holder);
        }
        holder.getVertex().addType((Proc) block);
    }
View Full Code Here

        }
        holder.getVertex().addType((Proc) block);
    }

    public static void argsAssign(Graph graph, ArgsNode argsNode, Vertex[] args, Block block) {
        Scope scope = graph.getRuntime().getContext().getCurrentScope();
        ListNode pre = argsNode.getPre();
        ListNode post = argsNode.getPost();
        int preCount = argsNode.getPreCount();
        int postCount = argsNode.getPostCount();
        if (preCount > 0) {
View Full Code Here

            blockAssign(graph, argsNode.getBlock(), block);
        }
    }

    public static Vertex argumentAssign(Graph graph, ArgumentNode node, Vertex src) {
        Scope scope = graph.getRuntime().getContext().getCurrentScope();
        VertexHolder holder = graph.createFreeVertexHolder();
        scope.setValue(node.getName(), holder);
        if (src != null) {
            graph.addEdgeAndUpdate(src, holder.getVertex());
        }
        return src;
    }
View Full Code Here

        Ruby runtime = graph.getRuntime();
        Context context = runtime.getContext();

        Block block = attr.getBlock();
        Scope scope = new LocalScope(method.getModule());
        context.pushFrame(context.getFrameModule(), name, receiver, block, Visibility.PUBLIC);
        context.pushScope(scope);

        Template template = new Template(method, context.getCurrentFrame(), scope, attr);
        method.addTemplate(attr, template);
View Full Code Here

TOP

Related Classes of org.cx4a.rsense.ruby.Scope

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.