comparison runtime/internal/genobj.d @ 834:f466f475b654

Added proper "need 'this' to access member foo" errors instead of "variable foo not resolved" for some cases, added FIXME for the old error! Added a bit more information to the runtime's cyclic dependency detection exception.
author Tomas Lindquist Olsen <tomas.l.olsen@gmail.com>
date Tue, 09 Dec 2008 01:56:39 +0100
parents d63741d00ee3
children 8208374e5bed
comparison
equal deleted inserted replaced
833:482cd74d1c71 834:f466f475b654
1058 } 1058 }
1059 1059
1060 _moduleinfo_dtors = new ModuleInfo[_moduleinfo_array.length]; 1060 _moduleinfo_dtors = new ModuleInfo[_moduleinfo_array.length];
1061 debug(PRINTF) printf("_moduleinfo_dtors = x%x\n", cast(void *)_moduleinfo_dtors); 1061 debug(PRINTF) printf("_moduleinfo_dtors = x%x\n", cast(void *)_moduleinfo_dtors);
1062 _moduleIndependentCtors(); 1062 _moduleIndependentCtors();
1063 _moduleCtor2(_moduleinfo_array, 0); 1063 _moduleCtor2(null, _moduleinfo_array, 0);
1064 } 1064 }
1065 1065
1066 extern (C) void _moduleIndependentCtors() 1066 extern (C) void _moduleIndependentCtors()
1067 { 1067 {
1068 debug(PRINTF) printf("_moduleIndependentCtors()\n"); 1068 debug(PRINTF) printf("_moduleIndependentCtors()\n");
1074 } 1074 }
1075 } 1075 }
1076 debug(PRINTF) printf("_moduleIndependentCtors() DONE\n"); 1076 debug(PRINTF) printf("_moduleIndependentCtors() DONE\n");
1077 } 1077 }
1078 1078
1079 void _moduleCtor2(ModuleInfo[] mi, int skip) 1079 void _moduleCtor2(ModuleInfo from, ModuleInfo[] mi, int skip)
1080 { 1080 {
1081 debug(PRINTF) printf("_moduleCtor2(): %d modules\n", mi.length); 1081 debug(PRINTF) printf("_moduleCtor2(): %d modules\n", mi.length);
1082 for (uint i = 0; i < mi.length; i++) 1082 for (uint i = 0; i < mi.length; i++)
1083 { 1083 {
1084 ModuleInfo m = mi[i]; 1084 ModuleInfo m = mi[i];
1094 if (m.ctor || m.dtor) 1094 if (m.ctor || m.dtor)
1095 { 1095 {
1096 if (m.flags & MIctorstart) 1096 if (m.flags & MIctorstart)
1097 { if (skip || m.flags & MIstandalone) 1097 { if (skip || m.flags & MIstandalone)
1098 continue; 1098 continue;
1099 throw new Exception( "Cyclic dependency in module " ~ m.name ); 1099 assert(from !is null);
1100 throw new Exception( "Cyclic dependency in module " ~ from.name ~ " for import " ~ m.name);
1100 } 1101 }
1101 1102
1102 m.flags |= MIctorstart; 1103 m.flags |= MIctorstart;
1103 _moduleCtor2(m.importedModules, 0); 1104 _moduleCtor2(m, m.importedModules, 0);
1104 if (m.ctor) 1105 if (m.ctor)
1105 (*m.ctor)(); 1106 (*m.ctor)();
1106 m.flags &= ~MIctorstart; 1107 m.flags &= ~MIctorstart;
1107 m.flags |= MIctordone; 1108 m.flags |= MIctordone;
1108 1109
1112 _moduleinfo_dtors[_moduleinfo_dtors_i++] = m; 1113 _moduleinfo_dtors[_moduleinfo_dtors_i++] = m;
1113 } 1114 }
1114 else 1115 else
1115 { 1116 {
1116 m.flags |= MIctordone; 1117 m.flags |= MIctordone;
1117 _moduleCtor2(m.importedModules, 1); 1118 _moduleCtor2(m, m.importedModules, 1);
1118 } 1119 }
1119 } 1120 }
1120 debug(PRINTF) printf("_moduleCtor2() DONE\n"); 1121 debug(PRINTF) printf("_moduleCtor2() DONE\n");
1121 } 1122 }
1122 1123