Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
Fix signatures, simplify some methods
  • Loading branch information
lizmat committed Oct 26, 2014
1 parent d9c80f4 commit 5513af3
Showing 1 changed file with 11 additions and 14 deletions.
25 changes: 11 additions & 14 deletions src/core/CompUnit.pm
Expand Up @@ -14,7 +14,7 @@ class CompUnit {
my $default-from = 'Perl6';
my %instances;

method new(
method new(CompUnit:U:
$path,
:$name is copy,
:$extension is copy,
Expand Down Expand Up @@ -49,14 +49,11 @@ class CompUnit {
) } );
}

multi method WHICH(CompUnit:D:) { $!WHICH //= "{self.^name}|$!path" }
method Str(--> Str) { self.DEFINITE ?? $!path.Str !! Nil }
method gist(--> Str) {
self.DEFINITE ?? "{self.name}:{$!path.Str}" !! self.^name;
}
method perl(--> Str) { self.DEFINITE ?? nextsame() !! self.^name }
multi method WHICH(CompUnit:D:) { $!WHICH //= "{self.^name}|$!path.abspath()" }
multi method Str(CompUnit:D: --> Str) { $!path.abspath }
multi method gist(CompUnit:D: --> Str) { "{self.name}:{$!path.abspath}" }

method key(--> Str) {
method key(CompUnit:D: --> Str) {
$!has-precomp ?? $!precomp-ext !! $!extension;
}

Expand All @@ -73,7 +70,7 @@ class CompUnit {
}

# do the actual work
method load(
method load(CompUnit:D:
$module_name,
%opts,
*@GLOBALish is rw,
Expand Down Expand Up @@ -106,9 +103,9 @@ class CompUnit {
} );
}

method precomp-path(--> Str) { "$!path.$!precomp-ext" }
method precomp-path(CompUnit:D: --> Str) { "$!path.$!precomp-ext" }

method precomp($out = self.precomp-path, :$force --> Bool) {
method precomp(CompUnit:D: $out = self.precomp-path, :$force --> Bool) {
die "Cannot pre-compile an already pre-compiled file: $!path"
if $.has-precomp;
die "Cannot pre-compile over an existing file: $out"
Expand All @@ -127,7 +124,7 @@ class CompUnit {
}

# TEMPORARY ACCESS TO COMPUNIT INTERNALS UNTIL WE CAN LOAD DIRECTLY
multi postcircumfix:<{ }> (CompUnit \c, "provides" ) {
multi postcircumfix:<{ }> (CompUnit:D \c, "provides" ) {
my % = (
c.name => {
pm => {
Expand All @@ -139,9 +136,9 @@ multi postcircumfix:<{ }> (CompUnit \c, "provides" ) {
}
);
}
multi postcircumfix:<{ }> (CompUnit \c, "key" ) {
multi postcircumfix:<{ }> (CompUnit:D \c, "key" ) {
c.key;
}
multi postcircumfix:<{ }> (CompUnit \c, "ver" ) {
multi postcircumfix:<{ }> (CompUnit:D \c, "ver" ) {
Version.new('0');
}

0 comments on commit 5513af3

Please sign in to comment.