Search in sources :

Example 1 with AnnotatableVisitor

use of dyvilx.tools.asm.AnnotatableVisitor in project Dyvil by Dyvil.

the class IParameter method writeParameter.

default void writeParameter(MethodWriter writer) {
    final AttributeList annotations = this.getAttributes();
    final IType type = this.getInternalType();
    final long flags = ModifierUtil.getFlags(this);
    final int index = this.getIndex();
    final int localIndex = writer.localCount();
    this.setLocalIndex(localIndex);
    // Add the ACC_VARARGS modifier if necessary
    final int javaModifiers = ModifierUtil.getJavaModifiers(flags) | (this.isVarargs() ? Modifiers.ACC_VARARGS : 0);
    writer.visitParameter(localIndex, this.getQualifiedLabel(), type, javaModifiers);
    // Annotations
    final AnnotatableVisitor visitor = (desc, visible) -> writer.visitParameterAnnotation(index, desc, visible);
    if (annotations != null) {
        annotations.write(visitor);
    }
    ModifierUtil.writeModifiers(visitor, flags);
    IType.writeAnnotations(type, writer, TypeReference.newFormalParameterReference(index), "");
}
Also used : IValue(dyvilx.tools.compiler.ast.expression.IValue) MethodWriterImpl(dyvilx.tools.compiler.backend.MethodWriterImpl) Name(dyvil.lang.Name) IContext(dyvilx.tools.compiler.ast.context.IContext) IClassMember(dyvilx.tools.compiler.ast.member.IClassMember) AnnotationReader(dyvilx.tools.compiler.backend.visitor.AnnotationReader) IType(dyvilx.tools.compiler.ast.type.IType) Annotation(dyvilx.tools.compiler.ast.attribute.annotation.Annotation) Opcodes(dyvil.reflect.Opcodes) IVariable(dyvilx.tools.compiler.ast.field.IVariable) AttributeList(dyvilx.tools.compiler.ast.attribute.AttributeList) AnnotatableVisitor(dyvilx.tools.asm.AnnotatableVisitor) ModifierUtil(dyvilx.tools.compiler.ast.attribute.modifiers.ModifierUtil) ClassWriter(dyvilx.tools.compiler.backend.ClassWriter) ICallableMember(dyvilx.tools.compiler.ast.method.ICallableMember) BytecodeException(dyvilx.tools.compiler.backend.exception.BytecodeException) DummyValue(dyvilx.tools.compiler.ast.expression.DummyValue) Modifiers(dyvil.reflect.Modifiers) AnnotationVisitor(dyvilx.tools.asm.AnnotationVisitor) MethodWriter(dyvilx.tools.compiler.backend.MethodWriter) TypeReference(dyvilx.tools.asm.TypeReference) IClass(dyvilx.tools.compiler.ast.classes.IClass) InternalType(dyvilx.tools.compiler.ast.type.raw.InternalType) ExternalAnnotation(dyvilx.tools.compiler.ast.attribute.annotation.ExternalAnnotation) AttributeList(dyvilx.tools.compiler.ast.attribute.AttributeList) AnnotatableVisitor(dyvilx.tools.asm.AnnotatableVisitor) IType(dyvilx.tools.compiler.ast.type.IType)

Aggregations

Name (dyvil.lang.Name)1 Modifiers (dyvil.reflect.Modifiers)1 Opcodes (dyvil.reflect.Opcodes)1 AnnotatableVisitor (dyvilx.tools.asm.AnnotatableVisitor)1 AnnotationVisitor (dyvilx.tools.asm.AnnotationVisitor)1 TypeReference (dyvilx.tools.asm.TypeReference)1 AttributeList (dyvilx.tools.compiler.ast.attribute.AttributeList)1 Annotation (dyvilx.tools.compiler.ast.attribute.annotation.Annotation)1 ExternalAnnotation (dyvilx.tools.compiler.ast.attribute.annotation.ExternalAnnotation)1 ModifierUtil (dyvilx.tools.compiler.ast.attribute.modifiers.ModifierUtil)1 IClass (dyvilx.tools.compiler.ast.classes.IClass)1 IContext (dyvilx.tools.compiler.ast.context.IContext)1 DummyValue (dyvilx.tools.compiler.ast.expression.DummyValue)1 IValue (dyvilx.tools.compiler.ast.expression.IValue)1 IVariable (dyvilx.tools.compiler.ast.field.IVariable)1 IClassMember (dyvilx.tools.compiler.ast.member.IClassMember)1 ICallableMember (dyvilx.tools.compiler.ast.method.ICallableMember)1 IType (dyvilx.tools.compiler.ast.type.IType)1 InternalType (dyvilx.tools.compiler.ast.type.raw.InternalType)1 ClassWriter (dyvilx.tools.compiler.backend.ClassWriter)1