Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
Register Capture type so we can use it in the binder.
  • Loading branch information
jnthn committed Jul 31, 2011
1 parent 7bfa218 commit e028411
Show file tree
Hide file tree
Showing 4 changed files with 28 additions and 0 deletions.
7 changes: 7 additions & 0 deletions src/Perl6/Metamodel/BOOTSTRAP.pm
Expand Up @@ -572,9 +572,16 @@ my stub Hash metaclass Perl6::Metamodel::ClassHOW { ... };
Hash.HOW.add_parent(Hash, EnumMap);
Hash.HOW.add_attribute(Hash, BOOTSTRAPATTR.new(:name<$!descriptor>, :type(Mu)));

# class Capture {
# ...
# }
my stub Capture metaclass Perl6::Metamodel::ClassHOW { ... };
Capture.HOW.add_parent(Capture, Any);

# Configure declarative listy/hashy types.
pir::perl6_set_types_list_array_lol__vPP(List, ListIter, Array, LoL, Parcel);
pir::perl6_set_types_enummap_hash__vPP(EnumMap, Hash);
pir::perl6_set_type_capture__vP(Capture);

# XXX Quick and dirty Bool. Probably done by EnumHOW in the end.
my stub Bool metaclass Perl6::Metamodel::ClassHOW { ... };
Expand Down
4 changes: 4 additions & 0 deletions src/binder/types.c
Expand Up @@ -20,6 +20,7 @@ static PMC * Array = NULL;
static PMC * LoL = NULL;
static PMC * EnumMap = NULL;
static PMC * _Hash = NULL;
static PMC * Capture = NULL;
static PMC * BoolFalse = NULL;
static PMC * BoolTrue = NULL;
static PMC * PackageHOW = NULL;
Expand Down Expand Up @@ -61,6 +62,9 @@ PMC * Rakudo_types_enummap_get(void) { return EnumMap; }
void Rakudo_types_hash_set(PMC * type) { _Hash = type; }
PMC * Rakudo_types_hash_get(void) { return _Hash; }

void Rakudo_types_capture_set(PMC * type) { Capture = type; }
PMC * Rakudo_types_capture_get(void) { return Capture; }

void Rakudo_types_bool_false_set(PMC * type) { BoolFalse = type; }
PMC * Rakudo_types_bool_false_get(void) { return BoolFalse; }

Expand Down
3 changes: 3 additions & 0 deletions src/binder/types.h
Expand Up @@ -37,6 +37,9 @@ PMC * Rakudo_types_enummap_get(void);
void Rakudo_types_hash_set(PMC * type);
PMC * Rakudo_types_hash_get(void);

void Rakudo_types_capture_set(PMC * type);
PMC * Rakudo_types_capture_get(void);

void Rakudo_types_bool_false_set(PMC * type);
PMC * Rakudo_types_bool_false_get(void);

Expand Down
14 changes: 14 additions & 0 deletions src/ops/perl6.ops
Expand Up @@ -314,6 +314,20 @@ inline op perl6_set_types_enummap_hash(in PMC, in PMC) :base_core {
}


/*

=item perl6_set_type_capture(in PMC)

Sets the Capture type.

=cut

*/
inline op perl6_set_type_capture(in PMC) :base_core {
Rakudo_types_capture_set($1);
}


/*

=item perl6_set_type_packagehow(in PMC)
Expand Down

0 comments on commit e028411

Please sign in to comment.