~ubuntu-branches/ubuntu/vivid/nqp/vivid-proposed

« back to all changes in this revision

Viewing changes to src/how/NQPCurriedRoleHOW.nqp

  • Committer: Package Import Robot
  • Author(s): Alessandro Ghedini
  • Date: 2013-11-01 12:09:18 UTC
  • mfrom: (1.1.4)
  • Revision ID: package-import@ubuntu.com-20131101120918-kx51sl0sxl3exsxi
Tags: 2013.10-1
* New upstream release
* Bump versioned (Build-)Depends on parrot
* Update patches
* Install new README.pod
* Fix vcs-field-not-canonical
* Do not install rubyish examples
* Do not Depends on parrot-devel anymore
* Add 07_disable-serialization-tests.patch

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
knowhow NQPCurriedRoleHOW {
 
2
    has $!curried_role;
 
3
    has @!pos_args;
 
4
    
 
5
    my $archetypes := Archetypes.new( :nominal(1), :composable(1), :parametric(1) );
 
6
    method archetypes() {
 
7
        $archetypes
 
8
    }
 
9
    
 
10
    method new(:$curried_role!, :@pos_args!) {
 
11
        my $obj := nqp::create(self);
 
12
        $obj.BUILD(:$curried_role, :@pos_args);
 
13
        $obj
 
14
    }
 
15
 
 
16
    method BUILD(:$curried_role!, :@pos_args!) {
 
17
        $!curried_role := $curried_role;
 
18
        @!pos_args := @pos_args;
 
19
    }
 
20
    
 
21
    method new_type($curried_role!, *@pos_args) {
 
22
        my $meta := self.new(:curried_role($curried_role), :pos_args(@pos_args));
 
23
        nqp::newtype($meta, 'Uninstantiable');
 
24
    }
 
25
    
 
26
    method specialize($obj, $class_arg) {
 
27
        $!curried_role.HOW.specialize($!curried_role, $class_arg, |@!pos_args);
 
28
    }
 
29
    
 
30
    method name($obj) {
 
31
        $!curried_role.HOW.name($!curried_role)
 
32
    }
 
33
    
 
34
    method curried_role($obj) {
 
35
        $!curried_role
 
36
    }
 
37
}