Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
Optimize match object construction somewhat.
  • Loading branch information
jnthn committed Nov 20, 2011
1 parent 0786d96 commit 0ad267e
Showing 1 changed file with 5 additions and 6 deletions.
11 changes: 5 additions & 6 deletions src/core/Cursor.pm
Expand Up @@ -2,12 +2,11 @@ my class Cursor does NQPCursorRole {
method MATCH() {
my $match := nqp::getattr(self, Cursor, '$!match');
return $match if pir::type_check__IPP($match, Match) && $match.defined;
$match := Match.new(
orig => nqp::getattr(self, Cursor, '$!orig'),
from => nqp::p6box_i(nqp::getattr_i(self, Cursor, '$!from')),
to => nqp::p6box_i(nqp::getattr_i(self, Cursor, '$!pos')),
cursor => self,
);
$match := nqp::create(Match);
nqp::bindattr($match, Match, '$!orig', nqp::getattr(self, Cursor, '$!orig'));
nqp::bindattr($match, Match, '$!from', nqp::p6box_i(nqp::getattr_i(self, Cursor, '$!from')));
nqp::bindattr($match, Match, '$!to', nqp::p6box_i(nqp::getattr_i(self, Cursor, '$!pos')));
nqp::bindattr($match, Match, '$!CURSOR', self);
my Mu $list := nqp::list();
my Mu $hash := nqp::hash();
if $match.Bool {
Expand Down

0 comments on commit 0ad267e

Please sign in to comment.