[svn r133] Fixed some problems with inlining not happening :P

Fixed problems with certain cases of deeply nested classes/functions.
This commit is contained in:
Tomas Lindquist Olsen
2007-12-28 22:55:24 +01:00
parent f420bc1265
commit 5eb88f9e80
17 changed files with 263 additions and 59 deletions
+6 -1
View File
@@ -11,4 +11,9 @@ int find(char[] s, dchar c)
void main()
{
}
char[] hello = "hello world";
int i = find(hello, 'w');
assert(i == 6);
i = find(hello, 'z');
assert(i == -1);
}
+20
View File
@@ -0,0 +1,20 @@
module nested10;
void main()
{
int j = 3;
void F()
{
int i = j;
printf("F: i = %d, j = %d\n", i, j);
void G()
{
printf("G: i = %d, j = %d\n", i, j);
j += i;
}
G();
}
F();
printf("6 = %d\n", j);
assert(j == 6);
}
+2
View File
@@ -11,9 +11,11 @@ void main()
void func()
{
printf("Hello world %d\n", i++);
//i++;
}
}
scope c = new C;
c.func();
assert(i == 44);
}
+3 -3
View File
@@ -4,19 +4,19 @@ void main()
{
int i = 42;
printf("Hello world %d\n", i++);
printf("main() %d\n", i++);
class C
{
void func()
{
printf("Hello world %d\n", i++);
printf("C.func() %d\n", i++);
class C2
{
void func2()
{
printf("Hello world %d\n", i++);
printf("C2.func2() %d\n", i++);
}
}
+32
View File
@@ -0,0 +1,32 @@
module nested7;
void main()
{
int i;
i = 52;
printf("i = %d\n", i);
void func()
{
i++;
void func2()
{
i++;
void func3()
{
i++;
}
func3();
}
func2();
}
func();
printf("i = %d\n", i);
assert(i == 55);
}
+30
View File
@@ -0,0 +1,30 @@
module nested8;
void main()
{
int i = 1;
void func()
{
printf("func()\n");
i++;
void func2()
{
printf(" func2()\n");
int j = i + 1;
void func3()
{
printf(" func3()\n");
j++;
printf(" done = %d\n", j);
}
func3();
i = j;
printf(" done = %d\n", j);
}
func2();
printf("done\n");
}
func();
printf("i == %d\n", i);
assert(i == 4);
}
+13
View File
@@ -0,0 +1,13 @@
module nested9;
void main()
{
int i = 42;
int func()
{
return i + 1;
}
int j = func();
printf("j = %d\n", j);
assert(j == 43);
}