changeset 329:8c1dc3e705da trunk

[svn r350] Fixed incorrect function types for lazy arguments. looks like lazy arguments have never even worked :o well.. now they should.
author lindquist
date Fri, 11 Jul 2008 01:34:04 +0200
parents 7086a84ab3d6
children 5bea8a1ef905
files gen/functions.cpp tangotests/lazy1.d
diffstat 2 files changed, 24 insertions(+), 0 deletions(-) [+]
line wrap: on
line diff
--- a/gen/functions.cpp	Fri Jul 11 00:17:00 2008 +0200
+++ b/gen/functions.cpp	Fri Jul 11 01:34:04 2008 +0200
@@ -141,6 +141,17 @@
             paramvec.push_back(at);
         }
 
+        // handle lazy args
+        if (arg->storageClass & STClazy)
+        {
+            Logger::cout() << "for lazy got: " << *paramvec.back() << '\n';
+            TypeFunction *ltf = new TypeFunction(NULL, arg->type, 0, LINKd);
+            TypeDelegate *ltd = new TypeDelegate(ltf);
+            at = getPtrToType(DtoType(ltd));
+            Logger::cout() << "lazy updated to: " << *at << '\n';
+            paramvec.back() = at;
+        }
+
         if (arg->llvmByVal)
             nbyval++;
     }
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/tangotests/lazy1.d	Fri Jul 11 01:34:04 2008 +0200
@@ -0,0 +1,13 @@
+module tangotests.lazy1;
+
+extern(C) int printf(char*, ...);
+
+void main()
+{
+    lazystr("whee\n");
+}
+
+void lazystr(lazy char[] msg)
+{
+    printf("%.*s", msg.length, msg.ptr);
+}