// Path: Support/rsense-0.2/src/org/cx4a/rsense/typing/Propagation.java
// public class Propagation {
//     private Graph graph;
//     private Set<Object> visited;
//     private int refCount;
// 
//     public Propagation(Graph graph) {
//         this.graph = graph;
//         this.refCount = 0;
//     }
// 
//     public Graph getGraph() {
//         return graph;
//     }
// 
//     public boolean isVisited(Vertex vertex) {
//         return visited != null ? visited.contains(getVisitTag(vertex)) : false;
//     }
// 
//     public void addVisited(Vertex vertex) {
//         if (visited == null) {
//             // lazy allocation
//             visited = new HashSet<Object>();
//         }
//         visited.add(getVisitTag(vertex));
//     }
// 
//     public boolean checkVisited(Vertex vertex) {
//         if (isVisited(vertex)) {
//             return true;
//         } else {
//             addVisited(vertex);
//             return false;
//         }
//     }
// 
//     public void retain() {
//         refCount++;
//     }
// 
//     public boolean release() {
//         return --refCount == 0;
//     }
// 
//     private Object getVisitTag(Vertex vertex) {
//         return vertex.getNode() != null ? vertex.getNode() : vertex;
//     }
// }
// 
// Path: Support/rsense-0.2/src/org/cx4a/rsense/typing/Template.java
// public class Template {
//     private Method method;
//     private TemplateAttribute attr;
//     private Vertex returnVertex;
//     private Frame frame;
//     private Scope scope;
//     
//     public Template(Method method, Frame frame, Scope scope, TemplateAttribute attr) {
//         this.method = method;
//         this.attr = attr;
//         this.frame = frame;
//         this.scope = scope;
//         this.returnVertex = new Vertex();
//     }
// 
//     public Method getMethod() {
//         return method;
//     }
// 
//     public TemplateAttribute getAttribute() {
//         return attr;
//     }
// 
//     public Vertex getReturnVertex() {
//         return returnVertex;
//     }
// 
//     public Frame getFrame() {
//         return frame;
//     }
// 
//     public Scope getScope() {
//         return scope;
//     }
// 
//     public void reproduceSideEffect(Graph graph, IRubyObject receiver, IRubyObject[] args, Block block) {
//         reproduceSideEffect(graph, attr.getMutableReceiver(false), receiver);
//         for (int i = 0; i < attr.getArgs().length && i < args.length; i++) {
//             reproduceSideEffect(graph, attr.getMutableArg(i, false), args[i]);
//         }
//         reproduceYield(graph, receiver, args, block);
//     }
// 
//     private void reproduceSideEffect(Graph graph, IRubyObject from, IRubyObject to) {
//         if (from instanceof MonomorphicObject && to instanceof MonomorphicObject) {
//             MonomorphicObject a = (MonomorphicObject) from;
//             MonomorphicObject b = (MonomorphicObject) to;
//             for (Map.Entry<TypeVariable, Vertex> entry : a.getTypeVarMap().entrySet()) {
//                 Vertex src = entry.getValue();
//                 Vertex dest = b.getTypeVarMap().get(entry.getKey());
//                 if (dest != null) {
//                     graph.propagateEdge(src, dest);
//                 }
//             }
//         }
//     }
// 
//     private void reproduceYield(Graph graph, IRubyObject receiver, IRubyObject[] args, Block block) {
//         Proc templateProc = (Proc) attr.getBlock();
//         if (templateProc != null && block != null) {
//             Proc proc = (Proc) block;
//             for (YieldVertex vertex : templateProc.getYields()) {
//                 RuntimeHelper.yield(graph, new YieldVertex(vertex.getNode(), this, block, vertex.getArgsVertex(), vertex.getExpandArguments()));
//             }
//         }
//     }
// }


import org.jruby.ast.Node;
import org.cx4a.rsense.ruby.Block;
import org.cx4a.rsense.typing.Propagation;
import org.cx4a.rsense.typing.Template;
package org.cx4a.rsense.typing.vertex;



public class YieldVertex extends Vertex {
    private Template template;
    private Block block;
    private Vertex argsVertex;
    private boolean expandArguments;

    public YieldVertex(Node node, Template template, Block block, Vertex argsVertex, boolean expandArguments) {
        super(node);
        this.template = template;
        this.block = block;
        this.argsVertex = argsVertex;
        this.expandArguments = expandArguments;
        if (argsVertex != null) {
            argsVertex.addEdge(this);
        }
    }

    public Template getTemplate() {
        return template;
    }
    
    public Block getBlock() {
        return block;
    }
    
    public Vertex getArgsVertex() {
        return argsVertex;
    }

    public boolean getExpandArguments() {
        return expandArguments;
    }

    @Override
// Path: Support/rsense-0.2/src/org/cx4a/rsense/typing/Propagation.java
// public class Propagation {
//     private Graph graph;
//     private Set<Object> visited;
//     private int refCount;
// 
//     public Propagation(Graph graph) {
//         this.graph = graph;
//         this.refCount = 0;
//     }
// 
//     public Graph getGraph() {
//         return graph;
//     }
// 
//     public boolean isVisited(Vertex vertex) {
//         return visited != null ? visited.contains(getVisitTag(vertex)) : false;
//     }
// 
//     public void addVisited(Vertex vertex) {
//         if (visited == null) {
//             // lazy allocation
//             visited = new HashSet<Object>();
//         }
//         visited.add(getVisitTag(vertex));
//     }
// 
//     public boolean checkVisited(Vertex vertex) {
//         if (isVisited(vertex)) {
//             return true;
//         } else {
//             addVisited(vertex);
//             return false;
//         }
//     }
// 
//     public void retain() {
//         refCount++;
//     }
// 
//     public boolean release() {
//         return --refCount == 0;
//     }
// 
//     private Object getVisitTag(Vertex vertex) {
//         return vertex.getNode() != null ? vertex.getNode() : vertex;
//     }
// }
// 
// Path: Support/rsense-0.2/src/org/cx4a/rsense/typing/Template.java
// public class Template {
//     private Method method;
//     private TemplateAttribute attr;
//     private Vertex returnVertex;
//     private Frame frame;
//     private Scope scope;
//     
//     public Template(Method method, Frame frame, Scope scope, TemplateAttribute attr) {
//         this.method = method;
//         this.attr = attr;
//         this.frame = frame;
//         this.scope = scope;
//         this.returnVertex = new Vertex();
//     }
// 
//     public Method getMethod() {
//         return method;
//     }
// 
//     public TemplateAttribute getAttribute() {
//         return attr;
//     }
// 
//     public Vertex getReturnVertex() {
//         return returnVertex;
//     }
// 
//     public Frame getFrame() {
//         return frame;
//     }
// 
//     public Scope getScope() {
//         return scope;
//     }
// 
//     public void reproduceSideEffect(Graph graph, IRubyObject receiver, IRubyObject[] args, Block block) {
//         reproduceSideEffect(graph, attr.getMutableReceiver(false), receiver);
//         for (int i = 0; i < attr.getArgs().length && i < args.length; i++) {
//             reproduceSideEffect(graph, attr.getMutableArg(i, false), args[i]);
//         }
//         reproduceYield(graph, receiver, args, block);
//     }
// 
//     private void reproduceSideEffect(Graph graph, IRubyObject from, IRubyObject to) {
//         if (from instanceof MonomorphicObject && to instanceof MonomorphicObject) {
//             MonomorphicObject a = (MonomorphicObject) from;
//             MonomorphicObject b = (MonomorphicObject) to;
//             for (Map.Entry<TypeVariable, Vertex> entry : a.getTypeVarMap().entrySet()) {
//                 Vertex src = entry.getValue();
//                 Vertex dest = b.getTypeVarMap().get(entry.getKey());
//                 if (dest != null) {
//                     graph.propagateEdge(src, dest);
//                 }
//             }
//         }
//     }
// 
//     private void reproduceYield(Graph graph, IRubyObject receiver, IRubyObject[] args, Block block) {
//         Proc templateProc = (Proc) attr.getBlock();
//         if (templateProc != null && block != null) {
//             Proc proc = (Proc) block;
//             for (YieldVertex vertex : templateProc.getYields()) {
//                 RuntimeHelper.yield(graph, new YieldVertex(vertex.getNode(), this, block, vertex.getArgsVertex(), vertex.getExpandArguments()));
//             }
//         }
//     }
// }


// Path: Support/rsense-0.2/src/org/cx4a/rsense/typing/vertex/YieldVertex.java
import org.jruby.ast.Node;
import org.cx4a.rsense.ruby.Block;
import org.cx4a.rsense.typing.Propagation;
import org.cx4a.rsense.typing.Template;

package org.cx4a.rsense.typing.vertex;



public class YieldVertex extends Vertex {
    private Template template;
    private Block block;
    private Vertex argsVertex;
    private boolean expandArguments;

    public YieldVertex(Node node, Template template, Block block, Vertex argsVertex, boolean expandArguments) {
        super(node);
        this.template = template;
        this.block = block;
        this.argsVertex = argsVertex;
        this.expandArguments = expandArguments;
        if (argsVertex != null) {
            argsVertex.addEdge(this);
        }
    }

    public Template getTemplate() {
        return template;
    }
    
    public Block getBlock() {
        return block;
    }
    
    public Vertex getArgsVertex() {
        return argsVertex;
    }

    public boolean getExpandArguments() {
        return expandArguments;
    }

    @Override
    public boolean accept(Propagation propagation, Vertex src) {