Examples of fastFetchConstant()


Examples of org.jruby.RubyModule.fastFetchConstant()

        IRubyObject result;
       
        // flipped from while to do to search current class first
        for (StaticScope scope = getCurrentScope().getStaticScope(); scope != null; scope = scope.getPreviousCRefScope()) {
            RubyModule module = scope.getModule();
            if ((result = module.fastFetchConstant(internedName)) != null) {
                if (result != RubyObject.UNDEF) return true;
                return runtime.getLoadService().autoloadFor(module.getName() + "::" + internedName) != null;
            }
        }
       
View Full Code Here

Examples of org.jruby.RubyModule.fastFetchConstant()

        if (obj instanceof Type) {
            return (Type) obj;
        }

        final RubyModule ffi = context.getRuntime().fastGetModule("FFI");
        final IRubyObject typeDefs = ffi.fastFetchConstant("TypeDefs");

        if (!(typeDefs instanceof RubyHash)) {
            throw context.getRuntime().newRuntimeError("invalid or corrupted FFI::TypeDefs");
        }
View Full Code Here

Examples of org.jruby.RubyModule.fastFetchConstant()

    public static final Type findType(ThreadContext context, IRubyObject name) {
        if (name instanceof Type) {
            return (Type) name;
        }
        final RubyModule ffi = context.getRuntime().fastGetModule("FFI");
        final IRubyObject typeDefs = ffi.fastFetchConstant("TypeDefs");
        final IRubyObject type = ((RubyHash) typeDefs).fastARef(name);
        return type instanceof Type ? (Type) type : (Type) ffi.callMethod(context, "find_type", name);
    }

    public static ByteOrder parseByteOrder(Ruby runtime, IRubyObject byte_order) {
View Full Code Here

Examples of org.jruby.RubyModule.fastFetchConstant()

        return getTypeSize(ffi.callMethod(context, "type_size", sizeArg));
    }

    public static final int getTypeSize(ThreadContext context, IRubyObject sizeArg) {
        final RubyModule ffi = context.getRuntime().fastGetModule("FFI");
        final IRubyObject typeDefs = ffi.fastFetchConstant("TypeDefs");
        final IRubyObject type = ((RubyHash) typeDefs).fastARef(sizeArg);
        final int size = type != null && !type.isNil() ? getTypeSize(type) : 0;
        return size > 0 ? size : callTypeSize(context, ffi, sizeArg);
    }
}
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.