1. my class Scalar { # declared in BOOTSTRAP
  2. # class Scalar is Any
  3. # has Mu $!descriptor;
  4. # has Mu $!value;
  5. # has Mu $!whence;
  6. method new(|) { X::Cannot::New.new(class => self.WHAT).throw }
  7. multi method WHICH(Scalar:D:) {
  8. 'Scalar|' ~ nqp::objectid($!descriptor);
  9. }
  10. method name() {
  11. my $d := $!descriptor;
  12. nqp::isnull($d) ?? Nil !! $d.name()
  13. }
  14. method of() {
  15. my $d := $!descriptor;
  16. nqp::isnull($d) ?? Mu !! $d.of;
  17. }
  18. method default() {
  19. my $d := $!descriptor;
  20. nqp::isnull($d) ?? Any !! $d.default;
  21. }
  22. method dynamic() {
  23. my $d := $!descriptor;
  24. nqp::isnull($d) ?? False !! nqp::p6bool($d.dynamic);
  25. }
  26. }
  27. # Also compose native reference classes declared in BOOTSTRAP.
  28. my class IntLexRef { }
  29. my class NumLexRef { }
  30. my class StrLexRef { }
  31. my class IntAttrRef { }
  32. my class NumAttrRef { }
  33. my class StrAttrRef { }
  34. my class IntPosRef { }
  35. my class NumPosRef { }
  36. my class StrPosRef { }