Skip to content

Commit

Permalink
Implement cursor_fresh and mixin
Browse files Browse the repository at this point in the history
  • Loading branch information
sorear committed Oct 24, 2010
1 parent 07fbac0 commit d1fae71
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 0 deletions.
4 changes: 4 additions & 0 deletions lib/Cursor.cs
Expand Up @@ -407,6 +407,10 @@ public Cursor(Cursor parent, string method, int from, int to)
return new Cursor(global, mo, nstate, xact, npos, null);
}

public Cursor FreshClass(IP6 from) {
return new Cursor(global, from.mo, nstate, xact, pos, null);
}

public Cursor StripCaps() {
return new Cursor(global, save_klass, from, pos, null);
}
Expand Down
1 change: 1 addition & 0 deletions src/CgOp.pm
Expand Up @@ -214,6 +214,7 @@ use warnings;
sub cursor_O { rawcall($_[0], 'O:m,Variable', $_[1]) }
sub cursor_synthetic { rawnew('cursor', @_[0,1,2,3]) }
sub cursor_synthcap{ rawcall($_[0], 'SynPushCapture:m,Void', @_[1,2]) }
sub cursor_fresh { rawcall($_[0], 'FreshClass:m,Cursor', $_[1]) }
sub rxstripcaps { rawcall($_[0], 'StripCaps:m,Cursor') }

sub fcclist_new { rawnewarr('cc', @_) }
Expand Down
8 changes: 8 additions & 0 deletions v6/tryfile
@@ -1,6 +1,8 @@
# vim: ft=perl6
use MONKEY_TYPING;

#use STD;

sub infix:<min>($a,$b) { $a > $b ?? $b !! $a }

augment class Cursor {
Expand Down Expand Up @@ -57,4 +59,10 @@ augment class Cursor {
}

method deb($str) { note $str }

method cursor_fresh($k = self) { Q:CgOp {
(ns (cursor_fresh (cast cursor (@ {self})) (@ {$k})))
} }
method mixin($role) { self.cursor_fresh(self.WHAT but $role) }
}

0 comments on commit d1fae71

Please sign in to comment.