Skip to content

Commit

Permalink
Remove !HOW fossil
Browse files Browse the repository at this point in the history
  • Loading branch information
sorear committed Jul 25, 2010
1 parent b417e13 commit 872f958
Show file tree
Hide file tree
Showing 4 changed files with 15 additions and 20 deletions.
20 changes: 10 additions & 10 deletions CORE.setting
Expand Up @@ -24,7 +24,7 @@ my module CORE;
# }
#
# to augment:
# BEGIN { $Foo_HOW.add-method("baz", anon method baz { ... }); }
# BEGIN { Foo.HOW.add-method("baz", anon method baz { ... }); }
my class ClassHOW { ... }

PRE-INIT {
Expand All @@ -42,12 +42,12 @@ PRE-INIT {
[ns (l $self)])
} }
# $how.add-super($how)
# $how.add-super($p)
sub add-super { Q:CgOp { (prog
[rawcall
(getfield superclasses (unwrap DynMetaObject
(getattr meta-object (@ (pos 0))))) Add
(unwrap DynMetaObject (getattr meta-object (@ (pos 1))))]
(unwrap DynMetaObject (getattr meta-object (how (@ (pos 1)))))]
[null Variable])
} }

Expand Down Expand Up @@ -99,7 +99,6 @@ PRE-INIT {
(wrap (clr_string "create-protoobject")) (l &create-protoobject))]

[l ClassHOW (subcall (@ (l &create-protoobject)) (l $chch))]
[l ClassHOW!HOW (l $chch)]

[null Variable])
}
Expand All @@ -126,30 +125,31 @@ PRE-INIT {
} }
Q:CgOp {
(withtypes !plist List<DynMetaObject>
(withtypes !plist List<DynMetaObject> Mu!HOW Variable Any!HOW Variable
Cool!HOW Variable Scalar!HOW Variable Sub!HOW Variable

[l Mu!HOW (methodcall (l ClassHOW) new (w (clr_string Mu)))]
[l Mu (methodcall (l Mu!HOW) create-protoobject)]

[l Any!HOW (methodcall (l ClassHOW) new (w (clr_string Any)))]
[sink (methodcall (l Any!HOW) add-super (l Mu!HOW))]
[sink (methodcall (l Any!HOW) add-super (l Mu))]
[l Any (methodcall (l Any!HOW) create-protoobject)]

[rawsset Kernel.AnyP (@ (l Any))]

[l Cool!HOW (methodcall (l ClassHOW) new (w (clr_string Cool)))]
[sink (methodcall (l Cool!HOW) add-super (l Any!HOW))]
[sink (methodcall (l Cool!HOW) add-super (l Any))]
[l Cool (methodcall (l Cool!HOW) create-protoobject)]

[sink (methodcall (l ClassHOW!HOW) add-super (l Any!HOW))]
[sink (methodcall (ns (how (@ (l ClassHOW)))) add-super (l Any))]
[rawcall (getfield klass (cast DynObject (@ (l ClassHOW)))) BuildC3MRO]

[l Sub!HOW (subcall (@ (l &wrap-dpmo))
(w (rawsget Kernel.SubMO)) (l Any!HOW))]
(w (rawsget Kernel.SubMO)) (l Any))]
[l Sub (methodcall (l Sub!HOW) create-protoobject)]

[l Scalar!HOW (subcall (@ (l &wrap-dpmo))
(w (rawsget Kernel.ScalarMO)) (l Any!HOW))]
(w (rawsget Kernel.ScalarMO)) (l Any))]
[l Scalar (methodcall (l Scalar!HOW) create-protoobject)]

[null Variable])
Expand Down
12 changes: 4 additions & 8 deletions Decl.pm
Expand Up @@ -279,11 +279,10 @@ use CgOp;

sub extra_decls { $_[0]->body ? ($_[0]->body->floated_decls) : () }
sub stashvar { $_[0]->var . '::' }
sub metavar { $_[0]->var . '!HOW' }

sub used_slots {
my ($self) = @_;
$self->var, 'Variable', $self->stashvar, 'Variable', $self->metavar,
$self->var, 'Variable', $self->stashvar,
'Variable', (!$self->stub ? ($self->bodyvar, 'Variable') : ());
}

Expand All @@ -296,7 +295,6 @@ use CgOp;
if ($self->stub) {
return CgOp::prog(
CgOp::proto_var($self->var, CgOp::newscalar(CgOp::null('IP6'))),
CgOp::proto_var($self->metavar, CgOp::newscalar(CgOp::null('IP6'))),
CgOp::proto_var($self->stashvar,
CgOp::wrap(CgOp::rawnew('Dictionary<string,Variable>'))));
}
Expand All @@ -308,7 +306,6 @@ use CgOp;
CgOp::letn("how", $self->make_how,
# catch usages before the closing brace
CgOp::proto_var($self->var, CgOp::newscalar(CgOp::null('IP6'))),
CgOp::proto_var($self->var . '!HOW', CgOp::letvar("how")),
CgOp::proto_var($self->var . "::", CgOp::letvar("pkg")),

CgOp::proto_var($self->bodyvar,
Expand All @@ -322,7 +319,6 @@ use CgOp;
CgOp::prog(
CgOp::share_lex($self->var),
CgOp::share_lex($self->var . "::"),
CgOp::share_lex($self->var . "!HOW"),
($self->stub ? () :
($body->mainline ?
CgOp::share_lex($self->bodyvar) :
Expand Down Expand Up @@ -360,7 +356,7 @@ use CgOp;
CgOp::wrap(CgOp::clr_string($self->name // 'ANON')));
}

sub defsuper { 'Any!HOW' }
sub defsuper { 'Any' }

sub finish_obj {
my ($self) = @_;
Expand All @@ -382,7 +378,7 @@ use CgOp;
use Moose;
extends 'Decl::Class';

sub defsuper { 'Grammar!HOW' }
sub defsuper { 'Grammar' }

__PACKAGE__->meta->make_immutable;
no Moose;
Expand Down Expand Up @@ -428,7 +424,7 @@ use CgOp;

CgOp::sink(
CgOp::methodcall(CgOp::letvar('how'), "add-super",
CgOp::scopedlex($self->name . "!HOW")));
CgOp::scopedlex($self->name)));
}

__PACKAGE__->meta->make_immutable;
Expand Down
1 change: 0 additions & 1 deletion Niecza/Actions.pm
Expand Up @@ -1026,7 +1026,6 @@ sub statement_control__S_use { my ($cl, $M) = @_;
my %symbols;
$symbols{$name} = [ $name ];
$symbols{$name . '::'} = [ $name . '::' ];
$symbols{$name . '!HOW'} = [ $name . '!HOW' ];

my $pkg = $M->find_stash($name);
if ($pkg->{really}) {
Expand Down
2 changes: 1 addition & 1 deletion Op.pm
Expand Up @@ -435,7 +435,7 @@ use CgOp;
bodyvar => $self->bodyvar)));

for my $tag (@{ $self->exports }) {
for my $sym ($self->var, $self->var . '::', $self->var . '!HOW') {
for my $sym ($self->var, $self->var . '::') {
push @r, Decl::PackageAlias->new(slot => $sym,
name => $sym, path => [ 'OUR', 'EXPORT', $tag ]);
}
Expand Down

0 comments on commit 872f958

Please sign in to comment.