Skip to content

Commit

Permalink
For [GH #44] - Rename impl of pragma base to fileless_base
Browse files Browse the repository at this point in the history
* Now pragma `base` is an alias of `parent`
  • Loading branch information
hkoba committed Sep 3, 2018
1 parent ff32de4 commit f485aee
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 5 deletions.
6 changes: 4 additions & 2 deletions Declare.pm
Expand Up @@ -180,14 +180,16 @@ sub declare_c3 {
mro::set_mro($opts->{destpkg}, 'c3');
}

sub declare_base {
sub declare_fileless_base {
(my $myPack, my Opts $opts, my (@base)) = m4i_args(@_);

$myPack->declare___add_isa($opts->{objpkg}, @base);

$myPack->declare_fields($opts);
}

*declare_base = *declare_parent; *declare_base = *declare_parent;

sub declare_parent {
(my $myPack, my Opts $opts, my (@base)) = m4i_args(@_);

Expand All @@ -196,7 +198,7 @@ sub declare_parent {
require "$cp.pm";
}

$myPack->declare_base($opts, @base);
$myPack->declare_fileless_base($opts, @base);
}

sub declare_as_base {
Expand Down
6 changes: 3 additions & 3 deletions Declare/Type.pm
Expand Up @@ -13,9 +13,9 @@ sub declare_type {
if ($opts->{extending}) {
my $sub = $opts->{destpkg}->can($name)
or croak "Can't find base class $name in parents of $opts->{destpkg}";
unshift @spec, [base => $sub->($opts->{destpkg})];
unshift @spec, [fileless_base => $sub->($opts->{destpkg})];
} elsif ($opts->{basepkg}) {
unshift @spec, [base => $opts->{basepkg}];
unshift @spec, [fileless_base => $opts->{basepkg}];
}

$myPack->declare___inner_class_in($opts
Expand All @@ -34,7 +34,7 @@ sub declare_extend {

$myPack->declare___inner_class_in($opts
, $opts->{destpkg}, $extended
, [base => $sub->($opts->{destpkg})]
, [fileless_base => $sub->($opts->{destpkg})]
, @spec);
}

Expand Down

0 comments on commit f485aee

Please sign in to comment.