use of dyvilx.tools.compiler.ast.method.ICallableMember in project Dyvil by Dyvil.
the class IParameter method writeGetDefaultValue.
default void writeGetDefaultValue(MethodWriter writer) {
final ICallableMember method = this.getMethod();
final IClass enclosingClass = this.getEnclosingClass();
final String name = (method == null ? DEFAULT_PREFIX_INIT : method.getInternalName() + DEFAULT_PREFIX) + this.getInternalName();
final String desc = "()" + this.getDescriptor();
writer.visitMethodInsn(Opcodes.INVOKESTATIC, enclosingClass.getInternalName(), name, desc, enclosingClass.isInterface());
}
use of dyvilx.tools.compiler.ast.method.ICallableMember in project Dyvil by Dyvil.
the class IParameter method writeDefaultValue.
default void writeDefaultValue(ClassWriter writer) {
final IValue value = this.getValue();
assert value != null;
final ICallableMember method = this.getMethod();
final IType type = this.getType();
final String name;
final int access;
if (method == null) {
name = "init$paramDefault$" + this.getInternalName();
access = Modifiers.STATIC;
} else {
name = method.getInternalName() + "$paramDefault$" + this.getInternalName();
access = (method.getAttributes().flags() & Modifiers.MEMBER_MODIFIERS) | Modifiers.STATIC;
}
final String desc = "()" + this.getDescriptor();
final String signature = "()" + this.getSignature();
final MethodWriter mw = new MethodWriterImpl(writer, writer.visitMethod(access, name, desc, signature, null));
mw.visitCode();
value.writeExpression(mw, type);
mw.visitEnd(type);
}
Aggregations