diff dmd/func.c @ 846:bc982f1ad106

Merged DMD 1.037 frontend
author Tomas Lindquist Olsen <tomas.l.olsen@gmail.com>
date Sat, 13 Dec 2008 13:15:31 +0100
parents a26b0c5d5942
children 330f999ade44
line wrap: on
line diff
--- a/dmd/func.c	Sat Dec 13 06:48:00 2008 +0100
+++ b/dmd/func.c	Sat Dec 13 13:15:31 2008 +0100
@@ -1965,6 +1965,23 @@
 	toParent()->isClassDeclaration();
 }
 
+int FuncDeclaration::isFinal()
+{
+    ClassDeclaration *cd;
+#if 0
+    printf("FuncDeclaration::isFinal(%s)\n", toChars());
+    printf("%p %d %d %d %d\n", isMember(), isStatic(), protection == PROTprivate, isCtorDeclaration(), linkage != LINKd);
+    printf("result is %d\n",
+	isMember() &&
+	!(isStatic() || protection == PROTprivate || protection == PROTpackage) &&
+	(cd = toParent()->isClassDeclaration()) != NULL &&
+	cd->storage_class & STCfinal);
+#endif
+    return isMember() &&
+	(Declaration::isFinal() ||
+	 ((cd = toParent()->isClassDeclaration()) != NULL && cd->storage_class & STCfinal));
+}
+
 int FuncDeclaration::isAbstract()
 {
     return storage_class & STCabstract;
@@ -2708,10 +2725,11 @@
 {
     if (global.params.useUnitTests)
     {
-	Type *tret;
-
 	type = new TypeFunction(NULL, Type::tvoid, FALSE, LINKd);
-	FuncDeclaration::semantic(sc);
+	Scope *sc2 = sc->push();
+	sc2->linkage = LINKd;
+	FuncDeclaration::semantic(sc2);
+	sc2->pop();
     }
 
     // We're going to need ModuleInfo even if the unit tests are not