@property

Adam D. Ruppe destructionator at gmail.com
Sat Aug 4 13:53:51 PDT 2012


On Saturday, 4 August 2012 at 19:08:58 UTC, Jacob Carlborg wrote:
> foo += 10;
>
> Is rewritten as:
>
> auto __tmp = foo;
> foo = __tmp + 10;


I did this and now I think this thing is almost done

===
int a;
@property int funcprop() {
         writeln("calling the getter and getting ", a);
	return a;
}
@property int funcprop(int s) {
	writeln("calling the setter with ", s);
	return a = s;
}
void main() {
	funcprop = 40;
	funcprop += 10;
}
===

run:

calling the setter with 40
calling the getter and getting 40
calling the setter with 50




Looks right to me. Now I just have to check for the @property tag 
on some of these rewrites and then clean it up and test for a 
pull request.


More information about the Digitalmars-d mailing list