Examples of RubyModule


Examples of org.jruby.RubyModule

        this.name = name;
    }
   
    @Override
    public IRubyObject interpret(Ruby runtime, ThreadContext context, IRubyObject self, Block aBlock) {
        RubyModule rubyClass = ASTInterpreter.getClassVariableBase(context, runtime);
  
        if (rubyClass == null) rubyClass = self.getMetaClass();

        return rubyClass.getClassVar(name);
    }
View Full Code Here

Examples of org.jruby.RubyModule

    }
   
    @Override
    public String definition(Ruby runtime, ThreadContext context, IRubyObject self, Block aBlock) {
        //RubyModule module = context.getRubyClass();
        RubyModule module = context.getCurrentScope().getStaticScope().getModule();
       
        if (module == null && self.getMetaClass().fastIsClassVarDefined(name)) {
            return "class variable";
        } else if (module.fastIsClassVarDefined(name)) {
            return "class variable";
        }

        IRubyObject attached = module.isSingleton() ? ((MetaClass)module).getAttached() : null;
       
        if (attached instanceof RubyModule && ((RubyModule) attached).fastIsClassVarDefined(name)) {
            return "class variable";
        }
View Full Code Here

Examples of org.jruby.truffle.runtime.core.RubyModule

    protected void lookup(VirtualFrame frame) {
        CompilerAsserts.neverPartOfCompilation();

        // TODO: this is wrong, we need the lexically enclosing method (or define_method)'s module
        final RubyModule declaringModule = RubyCallStack.getCurrentMethod().getDeclaringModule();
        final RubyClass selfMetaClass = getContext().getCoreLibrary().box(RubyArguments.getSelf(frame.getArguments())).getMetaClass();

        method = ModuleOperations.lookupSuperMethod(declaringModule, name, selfMetaClass);

        if (method == null || method.isUndefined()) {
            method = null;
            // TODO: should add " for #{receiver.inspect}" in error message
            throw new RaiseException(getContext().getCoreLibrary().noMethodError("super: no superclass method `"+name+"'", this));
        }

        final DirectCallNode newCallNode = Truffle.getRuntime().createDirectCallNode(method.getCallTarget());

        if (callNode == null) {
            callNode = insert(newCallNode);
        } else {
            callNode.replace(newCallNode);
        }

        unmodifiedAssumption = declaringModule.getUnmodifiedAssumption();
    }
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.