From 2e70f2dc7eb31ba2214ee9261dc64a0a64f797ea Mon Sep 17 00:00:00 2001 From: jnthn Date: Wed, 11 Feb 2009 18:23:33 +0100 Subject: [PATCH] Improve handling of <-> so any traits explicitly set in the signature are not overridden with rw. --- src/classes/Signature.pir | 2 ++ src/parser/actions.pm | 6 ++++-- 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/src/classes/Signature.pir b/src/classes/Signature.pir index 41dabcf597a..dc178fb13f2 100644 --- a/src/classes/Signature.pir +++ b/src/classes/Signature.pir @@ -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: diff --git a/src/parser/actions.pm b/src/parser/actions.pm index 5c0ada3bd9e..c54160ede76 100644 --- a/src/parser/actions.pm +++ b/src/parser/actions.pm @@ -1111,14 +1111,16 @@ method signature($/, $key) { $sigparam.push($trait); } - my $readtype := trait_readtype( $var ) || 'readonly'; + my $readtype := trait_readtype( $var ); if $readtype eq 'CONFLICT' { $[$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