Skip to content

Commit

Permalink
Improve handling of <-> so any traits explicitly set in the signature…
Browse files Browse the repository at this point in the history
… are not overridden with rw.
  • Loading branch information
jnthn committed Feb 11, 2009
1 parent bb2cdb7 commit 2e70f2d
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 2 deletions.
2 changes: 2 additions & 0 deletions src/classes/Signature.pir
Expand Up @@ -162,6 +162,8 @@ Makes all parameters have readtype rw (used to implement e.g. <->).
it_loop:
unless it goto it_loop_end
param = shift it
$P0 = param['readtype']
unless null $P0 goto it_loop
param['readtype'] = 'rw'
goto it_loop
it_loop_end:
Expand Down
6 changes: 4 additions & 2 deletions src/parser/actions.pm
Expand Up @@ -1111,14 +1111,16 @@ method signature($/, $key) {
$sigparam.push($trait);
}

my $readtype := trait_readtype( $var<traitlist> ) || 'readonly';
my $readtype := trait_readtype( $var<traitlist> );
if $readtype eq 'CONFLICT' {
$<parameter>[$i].panic(
"Can use only one of readonly, rw, and copy on "
~ $name ~ " parameter"
);
}
$sigparam.push(PAST::Val.new(:value($readtype),:named('readtype')));
if $readtype {
$sigparam.push(PAST::Val.new(:value($readtype),:named('readtype')));
}

## if it's an invocant, flag it as such and make the var be a
## lexical that has self register bound to it
Expand Down

0 comments on commit 2e70f2d

Please sign in to comment.