Sha256: bc20857ac52bf17c179a355577f3913e50e708d06e589bf519586d36d3290897
Contents?: true
Size: 1.63 KB
Versions: 119
Compression:
Stored size: 1.63 KB
Contents
/** * Copyright 2007 Ye Zheng * Distributed under the BSD License */ package com.xruby.runtime.lang.util; /* import java.lang.annotation.Annotation; import org.objectweb.asm.Type; import org.objectweb.asm.commons.GeneratorAdapter; import org.objectweb.asm.commons.Method; import com.xruby.compiler.codegen.CgUtil; import com.xruby.compiler.codegen.Types; import com.xruby.runtime.lang.annotation.RubyLevelModule; class RubyModuleFactory extends RubyTypeFactory { private static final Method RubyModuleBuilderCreateRubyModuleMethod = CgUtil.getMethod("createRubyModule", Types.RUBY_MODULE_TYPE); private static final Method RubyAPIDefineModuleMethod = CgUtil.getMethod("defineModule", Types.RUBY_MODULE_TYPE, Type.getType(String.class)); private static final Type BuilderInterface = Type.getType(RubyModuleBuilder.class); RubyModuleFactory(Class klass) { super(klass); } protected boolean isModule() { return true; } protected Class getTypeAnnotationClass() { return RubyLevelModule.class; } protected String getBuilderName(Class klass) { return CgUtil.getInternalName(klass.getName() + "$ModuleBuilder"); } protected Type getInterface() { return BuilderInterface; } protected Method getBuilderMethod() { return RubyModuleBuilderCreateRubyModuleMethod; } protected int createRubyType(GeneratorAdapter mg, Annotation annotation) { RubyLevelModule moduleAnnotation = (RubyLevelModule)annotation; mg.push(moduleAnnotation.name()); mg.invokeStatic(Types.RUBY_API_TYPE, RubyAPIDefineModuleMethod); int rubyTypeIdx = mg.newLocal(Types.RUBY_MODULE_TYPE); mg.storeLocal(rubyTypeIdx); return rubyTypeIdx; } }*/
Version data entries
119 entries across 119 versions & 1 rubygems