Mercurial > projects > dstress
changeset 595:8c65d48f3d79
inline / opMul /with
Victor Nakoryakov <nail-mail@mail.ru>
2005-06-25
news:d9e3af$1olf$1@digitaldaemon.com
author | thomask |
---|---|
date | Fri, 24 Jun 2005 08:01:20 +0000 |
parents | 1f473003ec30 |
children | 0dbcc53bad57 |
files | run/i/inline_11_A.d run/i/inline_11_B.d run/i/inline_11_C.d run/i/inline_11_D.d |
diffstat | 4 files changed, 158 insertions(+), 0 deletions(-) [+] |
line wrap: on
line diff
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/run/i/inline_11_A.d Fri Jun 24 08:01:20 2005 +0000 @@ -0,0 +1,41 @@ +// $HeadURL$ +// $Date$ +// $Author$ + +// @author@ Victor Nakoryakov <nail-mail@mail.ru> +// @date@ 2005-06-25 +// @uri@ news:d9e3af$1olf$1@digitaldaemon.com + +module dstress.run.i.inline_11_A; + +struct Struct{ + int i; + + Struct foo(){ + Struct s; + int a = i; + int b = s.i; + with (s) { + i+=2; + } + assert(a==i); + assert(b+2==s.i); + return s; + } + + Struct bar(){ + return Struct.foo() * Struct.foo(); + } + + Struct opMul(Struct s){ + Struct ss; + ss.i = s.i * i; + return ss; + } +} + +int main(){ + Struct s; + assert(s.bar().i==4); + return 0; +}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/run/i/inline_11_B.d Fri Jun 24 08:01:20 2005 +0000 @@ -0,0 +1,43 @@ +// $HeadURL$ +// $Date$ +// $Author$ + +// @author@ Victor Nakoryakov <nail-mail@mail.ru> +// @date@ 2005-06-25 +// @uri@ news:d9e3af$1olf$1@digitaldaemon.com + +// __DSTRESS_DFLAGS__ -inline + +module dstress.run.i.inline_11_B; + +struct Struct{ + int i; + + Struct foo(){ + Struct s; + int a = i; + int b = s.i; + with (s) { + i+=2; + } + assert(a==i); + assert(b+2==s.i); + return s; + } + + Struct bar(){ + return Struct.foo() * Struct.foo(); + } + + Struct opMul(Struct s){ + Struct ss; + ss.i = s.i * i; + return ss; + } +} + +int main(){ + Struct s; + assert(s.bar().i==4); + return 0; +}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/run/i/inline_11_C.d Fri Jun 24 08:01:20 2005 +0000 @@ -0,0 +1,37 @@ +// $HeadURL$ +// $Date$ +// $Author$ + +// @author@ Victor Nakoryakov <nail-mail@mail.ru> +// @date@ 2005-06-25 +// @uri@ news:d9e3af$1olf$1@digitaldaemon.com + +// __DSTRESS_DFLAGS__ -inline + +module dstress.run.i.inline_11_C; + +struct Struct{ + int i; + + Struct foo(){ + Struct s; + int a = i; + int b = s.i; + with (s) { + i+=2; + } + assert(a==i); + assert(b+2==s.i); + return s; + } + + Struct bar(){ + return Struct.foo(); + } +} + +int main(){ + Struct s; + assert(s.bar().i==2); + return 0; +}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/run/i/inline_11_D.d Fri Jun 24 08:01:20 2005 +0000 @@ -0,0 +1,37 @@ +// $HeadURL$ +// $Date$ +// $Author$ + +// @author@ Victor Nakoryakov <nail-mail@mail.ru> +// @date@ 2005-06-25 +// @uri@ news:d9e3af$1olf$1@digitaldaemon.com + +// __DSTRESS_DFLAGS__ -inline + +module dstress.run.i.inline_11_D; + +struct Struct{ + int i; + + Struct foo(){ + Struct s; + s.i=2; + return s; + } + + Struct bar(){ + return Struct.foo() * Struct.foo(); + } + + Struct opMul(Struct s){ + Struct ss; + ss.i = s.i * i; + return ss; + } +} + +int main(){ + Struct s; + assert(s.bar().i==4); + return 0; +}