diff --git a/src/core/Match.pm b/src/core/Match.pm index dea3da6956c..0f2bc694be7 100644 --- a/src/core/Match.pm +++ b/src/core/Match.pm @@ -1,4 +1,15 @@ class Match is Regex::Match is Cool does Positional does Associative { + method create(:$from, :$to, :$orig) { + my $new = self.bless(*); + pir::setattribute__vpsp($new, '$!from', $from); + pir::setattribute__vpsp($new, '$!to', $to); + pir::setattribute__vpsp($new, '$!target', $orig); + + # TODO: handle :@positional, :%named + + $new; + } + method ast() { my $x = self.Regex::Match::ast; pir::isa__IPs($x, 'Undef') ?? Any !! $x;