Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
Turn NQPCursorRole.{target,orig} into accessors.
  • Loading branch information
peschwa committed Mar 26, 2015
1 parent e45d8de commit 8aeba2a
Showing 1 changed file with 16 additions and 2 deletions.
18 changes: 16 additions & 2 deletions src/QRegex/Cursor.nqp
Expand Up @@ -36,8 +36,22 @@ role NQPCursorRole is export {
has $!regexsub;
has $!restart;

method orig() { nqp::getattr($!shared, ParseShared, '$!orig') }
method target() { nqp::getattr_s($!shared, ParseShared, '$!target') }
method orig($value = '') {
my $orig := nqp::getattr($!shared, ParseShared, '$!orig');
if $value ne '' {
$orig := $orig ~ $value;
nqp::bindattr($!shared, ParseShared, '$!orig', $orig);
}
$orig
}
method target($value = '') {
my $target := nqp::getattr_s($!shared, ParseShared, '$!target');
if $value ne '' {
$target := $target ~ $value;
nqp::bindattr_s($!shared, ParseShared, '$!target', $target);
}
$target
}
method from() { $!from }
method pos() { $!pos }

Expand Down

0 comments on commit 8aeba2a

Please sign in to comment.