use of st.gravel.support.compiler.jvm.JVMMethod in project gravel by gravel-st.
the class JVMBlockCompiler method compileBlock.
public JVMClass compileBlock() {
final JVMMethod _m;
final JVMField[] _fields;
final JVMMethodCompiler _methodCompiler;
final JVMClass _jvmClass;
_fields = st.gravel.support.jvm.ArrayExtensions.collect_(_block.copiedVariables(), ((st.gravel.support.jvm.Block1<JVMField, JVMVariable>) (new st.gravel.support.jvm.Block1<JVMField, JVMVariable>() {
@Override
public JVMField value_(final JVMVariable _each) {
return (JVMField) _each.asField_isStatic_(_block.ownerType(), false);
}
})));
_methodCompiler = JVMMethodCompiler.factory.parent_(_parent);
_methodCompiler.isStatic_(false);
_m = _methodCompiler.buildBlock_copiedVariables_blockType_(_block.blockNode(), _fields, _block.ownerType());
_jvmClass = JVMClass.factory.type_superType_fields_methods_astConstants_(_block.ownerType(), this.superType(), _fields, st.gravel.support.jvm.ArrayFactory.with_with_(_m, this.createInit()), new BlockSendArgument[] {});
if (_block.blockNode().sourcePosition() != null) {
_jvmClass.source_(_block.blockNode().sourcePosition().sourceFile().name());
}
return _jvmClass;
}
use of st.gravel.support.compiler.jvm.JVMMethod in project gravel by gravel-st.
the class ASMClassWriter method createBytes.
protected byte[] createBytes() {
cw = newClassWriter();
cw.visit(V1_7, ACC_PUBLIC + ACC_SUPER, jvmClass.type().className(), null, jvmClass.superType().className(), new String[] { "java/lang/Cloneable" });
if (jvmClass.source() != null) {
cw.visitSource(jvmClass.source(), null);
}
for (JVMField field : jvmClass.fields()) {
createField(field);
}
for (JVMMethod method : jvmClass.methods()) {
createMethod(method);
}
cw.visitEnd();
return cw.toByteArray();
}
Aggregations