package de.dhbwstuttgart.target.tree;

import de.dhbwstuttgart.target.tree.expression.TargetPattern;
import de.dhbwstuttgart.target.tree.expression.TargetTypePattern;
import de.dhbwstuttgart.target.tree.type.TargetType;

public record MethodParameter(TargetPattern pattern) {
    public MethodParameter(TargetType type, String name) {
        this(new TargetTypePattern(type, name));
    }
    public MethodParameter withType(TargetType type) {
        return new MethodParameter(pattern.withType(type));
    }

    public MethodParameter withName(String name) {
        return new MethodParameter(pattern.withName(name));
    }

    @Override
    public String toString() {
        return pattern.toString();
    }
}
