Package org.cx4a.rsense.typing.runtime

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


        RubyClass objectClass = runtime.getObject();
        RubyClass classClass = runtime.getClassClass();
        RubyClass procClass = runtime.getProc();
       
        objectClass.addMethod("class", new DefaultMethod(objectClass, "class", null, null, Visibility.PUBLIC, null) {
                public Vertex call(Graph graph, Template template, IRubyObject receiver, IRubyObject[] args, Vertex[] argVertices, Block block) {
                    return graph.createFreeSingleTypeVertex(receiver.getMetaClass());
                }
            });

        classClass.addMethod("superclass", new DefaultMethod(classClass, "superclass", null, null, Visibility.PUBLIC, null) {
                public Vertex call(Graph graph, Template template, IRubyObject receiver, IRubyObject[] args, Vertex[] argVertices, Block block) {
                    if (receiver instanceof RubyClass) {
                        return graph.createFreeSingleTypeVertex(((RubyClass) receiver).getSuperClass());
                    } else {
                        return null;
View Full Code Here


        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

                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

TOP

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

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.