Removed the 'needsstorage' thing from Dsymbol. Arguments are not always given storage when applicable. This is not longer treat specially

in this regard. Code for accessing nested variables and contexts rewritten. Probably more. Fairly well tested.
This commit is contained in:
Tomas Lindquist Olsen
2008-08-04 02:59:34 +02:00
parent b0a5f554d6
commit daad516579
17 changed files with 232 additions and 259 deletions

24
tests/mini/foreach9.d Normal file
View File

@@ -0,0 +1,24 @@
module mini.foreach9;
extern(C) int printf(char* str, ...);
struct array2d(T) {
int test() {
printf("%p\n", cast(void*) this);
foreach (x; *this) {
printf("%p\n", cast(void*) this);
}
return true;
}
int opApply(int delegate(ref int) dg) {
int x;
return dg(x), 0;
}
}
unittest {
array2d!(int) test;
test.test();
//int i = 0; i /= i;
}
void main() { }

35
tests/mini/nested15.d Normal file
View File

@@ -0,0 +1,35 @@
// $HeadURL: svn://svn.berlios.de/dstress/trunk/run/t/this_13_A.d $
// $Date: 2006-12-31 20:59:08 +0100 (Sun, 31 Dec 2006) $
// $Author: thomask $
// @author@ Frank Benoit <benoit@tionex.de>
// @date@ 2006-10-09
// @uri@ http://d.puremagic.com/issues/show_bug.cgi?id=419
// @desc@ [Issue 419] New: Anonymous classes are not working.
// added to mini to catch regressions earlier
module mini.nested15;
class I {
abstract void get( char[] s );
}
class C{
void init(){
I i = new class() I {
void get( char[] s ){
func();
}
};
}
void func( ){ }
}
int main(){
C c = new C();
c.init();
return 0;
}

View File

@@ -11,12 +11,13 @@ void main()
{
void func()
{
printf("Hello world %d\n", i++);
printf("Hello nested world %d\n", i++);
//i++;
}
}
scope c = new C;
auto c = new C;
c.func();
printf("i = %d\n", i);
assert(i == 44);
}

View File

@@ -12,28 +12,31 @@ void main()
int j;
void func()
{
int k;
int k;
printf("C.func() %d\n", i++);
class C2
{
int l;
int l;
void func2()
{
printf("in C2.func2()\n");
printf("C2.func2() %d\n", i++);
}
int m;
int m;
}
{
scope c2 = new C2;
printf("new C2\n");
auto c2 = new C2;
printf("C2.func2()\n");
c2.func2();
}
int n;
int n;
}
int o;
int o;
}
scope c = new C;
auto c = new C;
c.func();
}

View File

@@ -55,6 +55,8 @@ int main(string[] args)
cmd ~= v;
}
int cl = classify(testname);
if (cl == COMPILE || cl == NOCOMPILE)
cmd ~= " -c";
writefln(cmd);
if (system(cmd) != 0) {
if (cl != NOCOMPILE)