use of st.gravel.support.compiler.jvm.JVMClassCompiler in project gravel by gravel-st.
the class SystemMappingUpdater method compileClass_extensionPostfix_isStatic_identityClass_.
public Class compileClass_extensionPostfix_isStatic_identityClass_(final ClassDescriptionNode _aClassDescriptionNode, final String _extensionPostfix, final boolean _isStatic, final Class _identityClass) {
final JVMClassCompiler _compiler;
final Class _extensionClass;
final JVMClass _jvmClass;
_compiler = JVMClassCompiler.factory.classDescriptionNode_systemNode_systemMappingUpdater_isStatic_(_aClassDescriptionNode, _systemMapping.systemNode(), this, _isStatic);
if (_extensionPostfix != null) {
_compiler.extensionPostfix_(_extensionPostfix);
}
if (_identityClass != null) {
_compiler.selfType_(((JVMNonPrimitiveType) _compilerTools.jvmTypeForClass_(_identityClass)));
}
_jvmClass = _compiler.compileClassNode();
_extensionClass = _compilerTools.writeClass_(_jvmClass);
_compiler.extraClassesDo_(new st.gravel.support.jvm.Block1<Object, JVMClass>() {
@Override
public Object value_(final JVMClass _each) {
return _compilerTools.writeClass_(_each);
}
});
_compilerTools.runAstInit_(_jvmClass);
_compiler.extraClassesDo_(new st.gravel.support.jvm.Block1<Object, JVMClass>() {
@Override
public Object value_(final JVMClass _each) {
return _compilerTools.runAstInit_(_each);
}
});
return _extensionClass;
}
use of st.gravel.support.compiler.jvm.JVMClassCompiler in project gravel by gravel-st.
the class SystemMapping method compileInlinedMethod_selfType_allowBlockInlining_.
public Class compileInlinedMethod_selfType_allowBlockInlining_(final MethodNode _aMethodNode, final JVMNonPrimitiveType _selfType, final boolean _allowBlockInlining) {
final JVMClassCompiler _jvmClassCompiler;
final JVMClass _inlinedMethodClass;
final JVMClass[] _jvmClasses;
_jvmClassCompiler = JVMClassCompiler.factory.classDescriptionNode_systemNode_systemMappingUpdater_isStatic_(null, _systemNode, this.newSystemMappingUpdater(), true);
_jvmClassCompiler.allowBlockInlining_(_allowBlockInlining);
_jvmClassCompiler.selfType_(_selfType);
_jvmClassCompiler.superType_(JVMDefinedObjectType.factory.object());
_jvmClassCompiler.ownerType_(JVMDefinedObjectType.factory.dottedClassName_("InlinedMethod$" + _compilerTools.nextExtensionPostfix()));
_inlinedMethodClass = _jvmClassCompiler.compileInlinedMethod_(_aMethodNode);
_jvmClasses = st.gravel.support.jvm.ArrayExtensions.copyWith_(_jvmClassCompiler.extraClasses(), _inlinedMethodClass);
return this.compileJVMClasses_(_jvmClasses);
}
use of st.gravel.support.compiler.jvm.JVMClassCompiler in project gravel by gravel-st.
the class SystemMapping method compileExpression_reference_.
public JVMClass[] compileExpression_reference_(final Node _anExpression, final Reference _aReference) {
final JVMDefinedObjectType _ownerType;
final BlockNode _fieldAccessed;
final BlockInnerClass _aBlockInnerClass;
final BlockNode _intermediate;
final BlockNode _holderized;
final JVMClassCompiler _jvmClassCompiler;
final JVMClass _blockClass;
_intermediate = ((BlockNode) IntermediateNodeRewriter.factory.visit_(BlockNode.factory.expression_(_anExpression)));
_holderized = ((BlockNode) NonLocalTempWritesToHolderConverter.factory.visit_(_intermediate));
_fieldAccessed = ((BlockNode) VariableAccessToFieldAccessConverter.factory.instVars_owner_ownerReference_(new VariableDeclarationNode[] {}, NilLiteralNode.factory.basicNew(), _aReference).visit_(_holderized));
_ownerType = JVMDefinedObjectType.factory.dottedClassName_("Expression$" + _compilerTools.nextExtensionPostfix());
_aBlockInnerClass = BlockInnerClass.factory.ownerType_blockNode_copiedVariables_(_ownerType, _fieldAccessed, new JVMVariable[] {});
_jvmClassCompiler = JVMClassCompiler.factory.classDescriptionNode_systemNode_systemMappingUpdater_isStatic_(null, _systemNode, this.newSystemMappingUpdater(), false);
_jvmClassCompiler.ownerType_(JVMDefinedObjectType.factory.dottedClassName_("ExpressionContainer$" + _compilerTools.nextExtensionPostfix()));
_blockClass = _jvmClassCompiler.compileBlockNoAdd_(_aBlockInnerClass);
return _jvmClassCompiler.withContainerAndExtraClasses_(_blockClass);
}
Aggregations