package p.studio.compiler.models;

import p.studio.compiler.backend.bytecode.BytecodeModule;
import p.studio.compiler.backend.irvm.IRVMProgram;
import p.studio.compiler.messages.BuildingIssue;

import java.util.Arrays;
import java.util.List;

public record CompileResult(
        AnalysisSnapshot analysisSnapshot,
        List<BuildingIssue> diagnostics,
        IRVMProgram irvm,
        IRVMProgram optimizedIrvm,
        BytecodeModule bytecodeModule,
        byte[] bytecodeBytes) {
    public CompileResult {
        diagnostics = List.copyOf(diagnostics);
        bytecodeBytes = bytecodeBytes == null ? null : Arrays.copyOf(bytecodeBytes, bytecodeBytes.length);
    }
}
