private KObject evalBlock(CTX ctx, Block bk) { CompilerContext cc = ctx.cc; ctx.gamma.cc = cc; if (!bk.tyCheckAll(ctx, ctx.gamma)) return null; cc.evalBlock(bk); try { cc.writeClassFile("."); LocalCtx.set(ctx); // exec ClassLoader cl = cc.createClassLoader(); Class<?> c = cl.loadClass("Script"); Object r = c.getMethod("main").invoke(null); if (r != null) { return (KObject) r; } else { return null; } } catch (InvocationTargetException e) { e.getCause().printStackTrace(); } catch (Exception e) { e.printStackTrace(); } return null; }