<commit_before>class CompUnit::Repository::NQP does CompUnit::Repository {
    method need(
        CompUnit::DependencySpecification $spec,
        CompUnit::PrecompilationRepository $precomp = self.precomp-repository(),
        --> CompUnit:D)
    {
        if $spec.from eq 'NQP' {
            my $nqp := nqp::gethllsym('Raku', 'ModuleLoader');

            return CompUnit.new(
                :short-name($spec.short-name),
                :handle(CompUnit::Handle.new($nqp.load_module($spec.short-name, {:from<NQP>}))),
                :repo(self),
                :repo-id($spec.short-name),
                :from($spec.from),
            );
        }

        return self.next-repo.need($spec, $precomp) if self.next-repo;
        X::CompUnit::UnsatisfiedDependency.new(:specification($spec)).throw;
    }

    method loaded() {
        []
    }

    method id() {
        'NQP'
    }

    method path-spec() {
        'nqp#'
    }

    multi method gist(CompUnit::Repository::NQP:D:) {
        self.path-spec
    }
}

# vim: expandtab shiftwidth=4<commit_msg>Streamline CompUnit::Repository::NQP<commit_after>class CompUnit::Repository::NQP does CompUnit::Repository {
    my constant %opts = :from<NQP>,;  # comma needed to make a Map

    method need(CompUnit::Repository::NQP:D:
      CompUnit::DependencySpecification $spec,
      CompUnit::PrecompilationRepository $precomp?,
    --> CompUnit:D) {
        if $spec.from eq 'NQP' {
            my $key := $spec.short-name;
            CompUnit.new:
              :short-name($key),
              :handle(CompUnit::Handle.new(
                 nqp::gethllsym('Raku','ModuleLoader').load_module($key, %opts)
              )),
              :repo(self),
              :repo-id($key),
              :from<NQP>;
        }
        elsif self.next-repo -> $repo {
            $repo.need($spec, $precomp // self.precomp-repository)
        }
        else {
            X::CompUnit::UnsatisfiedDependency.new(:specification($spec)).throw;
        }
    }

    method loaded(CompUnit::Repository::NQP:D: --> Empty) { }

    method id(--> Str:D) { 'NQP' }

    method path-spec(--> Str:D) { 'nqp#' }

    multi method gist(CompUnit::Repository::NQP:D: --> Str:D) {
        self.path-spec
    }
}

# vim: expandtab shiftwidth=4
{'fraction_non_alphanumeric': 0.15539947322212466, 'fraction_numerical': 0.000877963125548727, 'mean_word_length': 2.1091405184174623, 'pattern_counts': {'":': 0, '<': 6, '<?xml version=': 0, '>': 13, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '3417975', 'n_tokens_mistral': 744, 'n_tokens_neox': 702, 'n_words': 112}