Skip to content

Commit

Permalink
Implement introspection of type captures.
Browse files Browse the repository at this point in the history
  • Loading branch information
jnthn committed Oct 9, 2009
1 parent 837cd09 commit f6397bc
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 3 deletions.
14 changes: 11 additions & 3 deletions src/classes/Signature.pir
Expand Up @@ -54,10 +54,10 @@ Returns a C<List> of C<Parameter> descriptors.
unless cur_param < count goto param_done

# Get all curent parameter info.
.local pmc nom_type, cons_type, names
.local pmc nom_type, cons_type, names, type_captures
.local int flags, optional, invocant, multi_invocant, slurpy, rw, ref, copy, named
.local string name
get_signature_elem signature, cur_param, name, flags, nom_type, cons_type, names, $P1
get_signature_elem signature, cur_param, name, flags, nom_type, cons_type, names, type_captures
optional = flags & SIG_ELEM_IS_OPTIONAL
invocant = flags & SIG_ELEM_INVOCANT
multi_invocant = flags & SIG_ELEM_MULTI_INVOCANT
Expand All @@ -84,8 +84,16 @@ Returns a C<List> of C<Parameter> descriptors.
named = 1
names_done:

# Any type captures?
if null type_captures goto no_type_captures
type_captures = 'list'(type_captures :flat)
goto type_captures_done
no_type_captures:
type_captures = 'list'()
type_captures_done:

# Create parameter instance. XXX Missing $.default, $.signature
$P0 = parameter.'new'('name'=>name, 'type'=>nom_type, 'constraint'=>cons_type, 'optional'=>optional, 'slurpy'=>slurpy, 'invocant'=>invocant, 'multi_invocant'=>multi_invocant, 'rw'=>rw, 'ref'=>ref, 'copy'=>copy, 'named'=>named, 'named_names'=>names)
$P0 = parameter.'new'('name'=>name, 'type'=>nom_type, 'constraint'=>cons_type, 'optional'=>optional, 'slurpy'=>slurpy, 'invocant'=>invocant, 'multi_invocant'=>multi_invocant, 'rw'=>rw, 'ref'=>ref, 'copy'=>copy, 'named'=>named, 'named_names'=>names, 'type_captures'=>type_captures)
push result, $P0
goto param_loop
param_done:
Expand Down
1 change: 1 addition & 0 deletions src/setting/Parameter.pm
Expand Up @@ -20,6 +20,7 @@ class Parameter {
has $.default;
has $.invocant;
has $.multi_invocant;
has $.type_captures;
has $.signature;
}

Expand Down

0 comments on commit f6397bc

Please sign in to comment.