Skip to content

Commit

Permalink
Implement <-> (lambda that makes things rw), which gets S04-statement…
Browse files Browse the repository at this point in the history
…s/for.t passing again.
  • Loading branch information
jnthn committed Feb 11, 2009
1 parent c66322e commit bb2cdb7
Show file tree
Hide file tree
Showing 2 changed files with 29 additions and 0 deletions.
19 changes: 19 additions & 0 deletions src/classes/Signature.pir
Expand Up @@ -149,6 +149,25 @@ Ensures that if there is no explicit invocant, we add one.
.end
=item !make_parameters_rw
Makes all parameters have readtype rw (used to implement e.g. <->).
=cut
.sub '!make_parameters_rw' :method
.local pmc params, it, param
params = self.'params'()
it = iter params
it_loop:
unless it goto it_loop_end
param = shift it
param['readtype'] = 'rw'
goto it_loop
it_loop_end:
.end
=item params
Get the array of parameter describing hashes.
Expand Down
10 changes: 10 additions & 0 deletions src/parser/actions.pm
Expand Up @@ -324,6 +324,16 @@ method pblock($/) {
$block[0].push(
PAST::Op.new( :pasttype('call'), :name('!SIGNATURE_BIND') )
);
if $<lambda>[0] eq '<->' {
$block.loadinit().push(PAST::Op.new(
:pasttype('callmethod'),
:name('!make_parameters_rw'),
PAST::Var.new(
:name('signature'),
:scope('register')
)
));
}
}
make $block;
}
Expand Down

0 comments on commit bb2cdb7

Please sign in to comment.