Search in sources :

Example 1 with Ast2Class

use of kalang.compiler.codegen.Ast2Class in project kalang by kasonyang.

the class KalangClassLoader method generate.

@Override
public void generate(ClassNode classNode) {
    final MemoryOutputManager outputManager = new MemoryOutputManager();
    Ast2Class ast2Class = new Ast2Class(outputManager);
    ast2Class.generate(classNode);
    String[] names = outputManager.getClassNames();
    for (String name : names) {
        byte[] bs = outputManager.getBytes(name);
        if (bs != null) {
            Class<?> clazz = defineClass(name, bs, 0, bs.length);
            loadedClasses.put(name, clazz);
        }
    }
}
Also used : MemoryOutputManager(kalang.tool.MemoryOutputManager) Ast2Class(kalang.compiler.codegen.Ast2Class)

Example 2 with Ast2Class

use of kalang.compiler.codegen.Ast2Class in project kalang by kasonyang.

the class ClassWriter method generate.

@Override
public void generate(ClassNode classNode) {
    if (outputManager != null) {
        Ast2Class ast2class = new Ast2Class(outputManager);
        ast2class.generate(classNode);
    }
}
Also used : Ast2Class(kalang.compiler.codegen.Ast2Class)

Aggregations

Ast2Class (kalang.compiler.codegen.Ast2Class)2 MemoryOutputManager (kalang.tool.MemoryOutputManager)1