Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
Rename .ast to .made, as per S05.
The .ast method is still around, though now it's deprecated.
  • Loading branch information
ShimmerFairy committed Mar 12, 2014
1 parent 1aeb7c3 commit a0a5990
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 12 deletions.
4 changes: 2 additions & 2 deletions src/core/Cursor.pm
@@ -1,5 +1,5 @@
my class Cursor does NQPCursorRole {
has $!ast; # Need it to survive re-creations of the match object.
has $!made; # Need it to survive re-creations of the match object.

method MATCH() {
my $match := nqp::getattr(self, Cursor, '$!match');
Expand All @@ -8,7 +8,7 @@ my class Cursor does NQPCursorRole {
nqp::bindattr($match, Match, '$!orig', nqp::findmethod(self, 'orig')(self));
nqp::bindattr_i($match, Match, '$!from', nqp::getattr_i(self, Cursor, '$!from'));
nqp::bindattr_i($match, Match, '$!to', nqp::getattr_i(self, Cursor, '$!pos'));
nqp::bindattr($match, Match, '$!ast', nqp::getattr(self, Cursor, '$!ast'));
nqp::bindattr($match, Match, '$!made', nqp::getattr(self, Cursor, '$!made'));
nqp::bindattr($match, Match, '$!CURSOR', self);
my Mu $list := nqp::list();
my Mu $hash := nqp::hash();
Expand Down
25 changes: 15 additions & 10 deletions src/core/Match.pm
Expand Up @@ -3,7 +3,12 @@ my class Match is Capture is Cool {
has int $.from;
has int $.to;
has $.CURSOR;
has $.ast;
has $.made;

method ast(Match:D:) {
DEPRECATED("the .made method");
$!made;
}

multi method Str(Match:D:) {
$!to > $!from ?? $!orig.substr($!from, $!to-$!from) !! ''
Expand Down Expand Up @@ -69,29 +74,29 @@ my class Match is Capture is Cool {
$r;
}

method make(Match:D: Mu \ast) {
$!ast = ast;
method make(Match:D: Mu \made) {
$!made = made;
nqp::bindattr(
nqp::decont(self.CURSOR),
Cursor,
'$!ast',
ast
'$!made',
made
);
}
}

sub make(Mu \ast) {
sub make(Mu \made) {
nqp::bindattr(
nqp::decont(nqp::getlexcaller('$/')),
Match,
'$!ast',
ast
'$!made',
made
);
nqp::bindattr(
nqp::decont(nqp::getlexcaller('$/').CURSOR),
Cursor,
'$!ast',
ast
'$!made',
made
);
}

Expand Down

0 comments on commit a0a5990

Please sign in to comment.