Package org.cx4a.rsense.typing.runtime

Examples of org.cx4a.rsense.typing.runtime.Method


        return vertex;
    }

    public static void methodPartialUpdate(Graph graph, MethodDefNode node, DynamicMethod newMethod, DynamicMethod oldMethod, IRubyObject receiver) {
        if (newMethod instanceof Method && oldMethod instanceof Method) {
            Method newmeth = (Method) newMethod;
            Method oldmeth = (Method) oldMethod;
            NodeDiff nodeDiff = graph.getNodeDiff();

            if (nodeDiff != null
                && nodeDiff.noDiff(node.getArgsNode(), oldmeth.getArgsNode())
                && nodeDiff.noDiff(node.getBodyNode(), oldmeth.getBodyNode())) { // XXX nested class, defn
                // FIXME annotation diff
                newmeth.shareTemplates(oldmeth);
            } else {
                Logger.debug(SourceLocation.of(node), "templates not shared: %s", newmeth);
            }
View Full Code Here


            }
        } else if (receiver != null) {
            receiverType = receiver.getMetaClass();
        }
        if (receiverType != null) {
            Method method = (Method) receiverType.searchMethod(name);
            if (method != null
                && (method.getVisibility() != Visibility.PRIVATE
                    || vertex.hasPrivateVisibility())) {
                Template template = method.getTemplate(attr);
                if (template == null) {
                    template = createTemplate(graph, vertex, name, method, attr);
                    Logger.debug(SourceLocation.of(vertex), "template created: %s", method);
                } else {
                    template.reproduceSideEffect(graph, receiver, args, vertex.getBlock());
View Full Code Here

        boolean moduleFunction = visibility == Visibility.MODULE_FUNCTION;
        if (name == "initialize" || name == "initialize_copy" || moduleFunction) {
            visibility = Visibility.PRIVATE;
        }

        Method oldMethod = (Method) klass.getMethod(name);
        Method newMethod = new DefaultMethod(cbase, name, bodyNode, argsNode, visibility, SourceLocation.of(node));
        klass.addMethod(name, newMethod);
       
        if (moduleFunction) {
            Method singletonMethod = new DefaultMethod(cbase, name, bodyNode, argsNode, visibility, SourceLocation.of(node));
            singletonMethod.setVisibility(Visibility.PUBLIC);
            klass.getSingletonClass().addMethod(name, singletonMethod);
        }

        IRubyObject receiver = newInstanceOf((klass instanceof RubyClass) ? (RubyClass) klass : runtime.getObject());
       
View Full Code Here

            if (receiver instanceof RubyModule) {
                RubyClass rubyClass = receiver.getSingletonClass();
                Node bodyNode = node.getBodyNode();
                Node argsNode = node.getArgsNode();

                Method oldMethod = (Method) rubyClass.getMethod(name);
                Method newMethod = new DefaultMethod(cbase, name, bodyNode, argsNode, Visibility.PUBLIC, SourceLocation.of(node));
                rubyClass.addMethod(name, newMethod);

                RuntimeHelper.methodPartialUpdate(this, node, newMethod, oldMethod, receiver);
                RuntimeHelper.setMethodTag(newMethod, node, AnnotationHelper.parseAnnotations(node.getCommentList(), node.getPosition().getStartLine()));
View Full Code Here

                    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;
View Full Code Here

TOP

Related Classes of org.cx4a.rsense.typing.runtime.Method

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.