diff dmd/func.c @ 1617:6820110de311

Merge DMD r301: a little refactor and harmonize --- dmd/declaration.h | 1 + dmd/func.c | 30 ++++++++++++++++++++++++++++++ dmd/mtype.c | 51 +++++++++++++++++++++++++++++++++++++-------------- 3 files changed, 68 insertions(+), 14 deletions(-)
author Leandro Lucarella <llucax@gmail.com>
date Wed, 06 Jan 2010 15:18:21 -0300
parents 679d101395e8
children 44b145be2ef5
line wrap: on
line diff
--- a/dmd/func.c	Wed Jan 06 15:18:21 2010 -0300
+++ b/dmd/func.c	Wed Jan 06 15:18:21 2010 -0300
@@ -850,6 +850,7 @@
         }
 #endif
 
+#if 0
 	// Propagate storage class from tuple parameters to their element-parameters.
 	if (f->parameters)
 	{
@@ -867,6 +868,7 @@
 		}
 	    }
 	}
+#endif
 
 	/* Declare all the function parameters as variables
 	 * and install them in parameters[]
@@ -2491,6 +2493,34 @@
 }
 #endif
 
+/*********************************************
+ * Return the function's parameter list, and whether
+ * it is variadic or not.
+ */
+
+Parameters *FuncDeclaration::getParameters(int *pvarargs)
+{   Parameters *fparameters;
+    int fvarargs;
+
+    if (type)
+    {
+	assert(type->ty == Tfunction);
+	TypeFunction *fdtype = (TypeFunction *)type;
+	fparameters = fdtype->parameters;
+	fvarargs = fdtype->varargs;
+    }
+    else // Constructors don't have type's
+    {   CtorDeclaration *fctor = isCtorDeclaration();
+	assert(fctor);
+	fparameters = fctor->arguments;
+	fvarargs = fctor->varargs;
+    }
+    if (pvarargs)
+	*pvarargs = fvarargs;
+    return fparameters;
+}
+
+
 /****************************** FuncAliasDeclaration ************************/
 
 // Used as a way to import a set of functions from another scope into this one.