1. class CompUnit::Repository::NQP does CompUnit::Repository {
  2. method need(
  3. CompUnit::DependencySpecification $spec,
  4. CompUnit::PrecompilationRepository $precomp = self.precomp-repository(),
  5. --> CompUnit:D)
  6. {
  7. if $spec.from eq 'NQP' {
  8. my $nqp := nqp::gethllsym('perl6', 'ModuleLoader');
  9. return CompUnit.new(
  10. :short-name($spec.short-name),
  11. :handle(CompUnit::Handle.new($nqp.load_module($spec.short-name, {:from<NQP>}))),
  12. :repo(self),
  13. :repo-id($spec.short-name),
  14. :from($spec.from),
  15. );
  16. }
  17. return self.next-repo.need($spec, $precomp) if self.next-repo;
  18. X::CompUnit::UnsatisfiedDependency.new(:specification($spec)).throw;
  19. }
  20. method loaded() {
  21. []
  22. }
  23. method id() {
  24. 'NQP'
  25. }
  26. method path-spec() {
  27. 'nqp#'
  28. }
  29. }