Examples of CallVertex


Examples of org.cx4a.rsense.typing.vertex.CallVertex

        public Collection<SourceLocation> getLocations() {
            return locations;
        }

        public void update(Event event) {
            CallVertex vertex;
            if (context.main
                && event.type == EventType.METHOD_MISSING
                && (vertex = (CallVertex) event.vertex) != null
                && vertex.getName().startsWith(prefix)
                && vertex.getReceiverVertex() != null) {
                String realName = vertex.getName().substring(prefix.length());
                for (IRubyObject receiver : vertex.getReceiverVertex().getTypeSet()) {
                    RubyClass receiverType = receiver.getMetaClass();
                    if (receiverType != null) {
                        SourceLocation location = null;

                        // Try to find method
                        // TODO callSuper
                        Method method = (Method) receiverType.searchMethod(realName);
                        if (method != null) {
                            if (method.getLocation() != null)
                                locations.add(method.getLocation());
                        } else {
                            // Try to find constant
                            RubyModule klass = null;
                            if (receiverType instanceof MetaClass) {
                                MetaClass metaClass = (MetaClass) receiverType;
                                if (metaClass.getAttached() instanceof RubyModule)
                                    klass = (RubyModule) metaClass.getAttached();
                            } else
                                klass = context.project.getGraph().getRuntime().getContext().getCurrentScope().getModule();
                            if (klass != null) {
                                IRubyObject constant = klass.getConstant(realName);
                                if (constant instanceof VertexHolder)
                                    location = SourceLocation.of(((VertexHolder) constant).getVertex().getNode());
                                else if (constant instanceof RubyModule)
                                    location = ((RubyModule) constant).getLocation();
                            }
                        }

                        if (location != null)
                            locations.add(location);
                    }
                }
                vertex.cutout();
            }
        }
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. 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.