package de.dhbwstuttgart.target.tree;

import de.dhbwstuttgart.syntaxtree.Method;
import de.dhbwstuttgart.target.tree.expression.TargetBlock;
import de.dhbwstuttgart.target.tree.type.TargetType;

import java.util.List;
import java.util.Set;

public record TargetConstructor(int access, Set<TargetGeneric> generics, Set<TargetGeneric> txGenerics, List<MethodParameter> parameters, List<MethodParameter> txParameters, TargetBlock block, TargetBlock fieldInitializer) {

    public String getDescriptor() {
        return TargetMethod.getDescriptor(null, parameters.stream().map(mp -> mp.pattern().type()).toArray(TargetType[]::new));
    }

    public String getSignature() {
        return TargetMethod.getSignature(generics, parameters, null);
    }

    public String getTXSignature() {
        return TargetMethod.getSignature(txGenerics, txParameters, null);
    }
}

