Skip to content

Commit

Permalink
Revert "Make Match.STR faster if there are no captures"
Browse files Browse the repository at this point in the history
This reverts commit 495ddcc.

This was only an optimization in an area that could use a lot of
thinking and reorganization.  Since it apparently causes issues:

    https://colabti.org/irclogger/irclogger_log/moarvm?date=2020-02-21#l112

revert it.
  • Loading branch information
lizmat committed Feb 21, 2020
1 parent 1d946e1 commit 21aa02b
Showing 1 changed file with 5 additions and 8 deletions.
13 changes: 5 additions & 8 deletions src/core.c/Match.pm6
Expand Up @@ -12,14 +12,11 @@ my class Match is Capture is Cool does NQPMatchRole {
method Int(--> Int:D) { self.Str.Int }

method STR() {
nqp::getattr(self,Match,'$!regexsub').CAPS.has-captures
?? self!MATCH.Str
!! nqp::substr(
self.orig,
nqp::getattr_i(self,Match,'$!from'),
nqp::getattr_i(self,Match,'$!pos')
- nqp::getattr_i(self,Match,'$!from')
)
nqp::if(
nqp::istype(nqp::getattr(self,Match,'$!match'), NQPdidMATCH),
self.Str,
self!MATCH.Str
)
}

method MATCH() {
Expand Down

0 comments on commit 21aa02b

Please sign in to comment.