use of st.gravel.support.compiler.jvm.JVMMethodConstant in project gravel by gravel-st.
the class JVMClassCompiler method compileClinit.
public JVMClassCompiler compileClinit() {
final List<JVMInstruction>[] _instructions;
_instructions = new List[1];
_instructions[0] = new java.util.ArrayList();
for (final JVMMethodConstant _each : _constants) {
st.gravel.support.jvm.OrderedCollectionExtensions.addAll_(_instructions[0], _each.clinitInstructions());
_fields.add(_each.fieldDefinition());
}
_instructions[0].add(Return.factory.basicNew());
_jvmMethods.add(JVMMethod.factory.name_locals_instructions_isStatic_signature_("<clinit>", new JVMLocalDeclaration[] {}, _instructions[0].toArray(new JVMInstruction[_instructions[0].size()]), true, JVMMethodType.factory.r_void()));
return this;
}
use of st.gravel.support.compiler.jvm.JVMMethodConstant in project gravel by gravel-st.
the class JVMClassCompiler method constantAt_ifAbsentPut_.
public JVMMethodConstant constantAt_ifAbsentPut_(final Expression _anObject, final st.gravel.support.jvm.Block0<JVMMethodConstant> _aBlock) {
return ((JVMMethodConstant) st.gravel.support.jvm.OrderedCollectionExtensions.detect_ifNone_(_constants, new st.gravel.support.jvm.Predicate1<JVMMethodConstant>() {
@Override
public boolean value_(final JVMMethodConstant _each) {
return st.gravel.support.jvm.ObjectExtensions.equals_(_each.expression(), _anObject);
}
}, ((st.gravel.support.jvm.Block0<JVMMethodConstant>) (new st.gravel.support.jvm.Block0<JVMMethodConstant>() {
@Override
public JVMMethodConstant value() {
final JVMMethodConstant _constant;
_constant = _aBlock.value();
_constants.add(_constant);
return (JVMMethodConstant) _constant;
}
}))));
}
use of st.gravel.support.compiler.jvm.JVMMethodConstant in project gravel by gravel-st.
the class JVMMethodCompiler method produceConstant_ifAbsentPut_.
public JVMMethodCompiler produceConstant_ifAbsentPut_(final Expression _anExpression, final st.gravel.support.jvm.Block0<Object> _aBlock) {
final JVMMethodConstant _const;
_const = _parent.constantAt_ifAbsentPut_(_anExpression, ((st.gravel.support.jvm.Block0<JVMMethodConstant>) (new st.gravel.support.jvm.Block0<JVMMethodConstant>() {
@Override
public JVMMethodConstant value() {
return (JVMMethodConstant) JVMMethodConstant.factory.expression_name_frame_ownerType_(_anExpression, _parent.newConstantName(), JVMMethodCompiler.this.newFrame_(_aBlock), JVMMethodCompiler.this.ownerType());
}
})));
this.emit_(_const.asReadInstruction());
return this;
}
Aggregations