Mercurial > projects > ldc
comparison dmd/func.c @ 1103:b30fe7e1dbb9
- Updated to DMD frontend 1.041.
- Removed dmd/inifile.c , it's not under a free license, replaced with libconfig based config file.
author | Tomas Lindquist Olsen <tomas.l.olsen gmail.com> |
---|---|
date | Thu, 12 Mar 2009 20:37:27 +0100 |
parents | 31bbc7f3b817 |
children | eeb8b95ea92e |
comparison
equal
deleted
inserted
replaced
1102:ae950bd712d3 | 1103:b30fe7e1dbb9 |
---|---|
335 // This function is covariant with fdv | 335 // This function is covariant with fdv |
336 if (fdv->isFinal()) | 336 if (fdv->isFinal()) |
337 error("cannot override final function %s", fdv->toPrettyChars()); | 337 error("cannot override final function %s", fdv->toPrettyChars()); |
338 | 338 |
339 #if DMDV2 | 339 #if DMDV2 |
340 if (!isOverride() && global.params.warnings) | 340 if (!isOverride()) |
341 warning("%s: overrides base class function %s, but is not marked with 'override'", locToChars() fdv->toPrettyChars()); | 341 warning(loc, "overrides base class function %s, but is not marked with 'override'", fdv->toPrettyChars()); |
342 #endif | 342 #endif |
343 | 343 |
344 if (fdv->toParent() == parent) | 344 if (fdv->toParent() == parent) |
345 { | 345 { |
346 // If both are mixins, then error. | 346 // If both are mixins, then error. |
1081 else | 1081 else |
1082 { | 1082 { |
1083 if (offend) | 1083 if (offend) |
1084 { Expression *e; | 1084 { Expression *e; |
1085 | 1085 |
1086 if (global.params.warnings) | 1086 warning(loc, "no return at end of function"); |
1087 { warning("%s: no return at end of function", locToChars()); | |
1088 } | |
1089 | 1087 |
1090 if (global.params.useAssert && | 1088 if (global.params.useAssert && |
1091 !global.params.useInline) | 1089 !global.params.useInline) |
1092 { /* Add an assert(0, msg); where the missing return | 1090 { /* Add an assert(0, msg); where the missing return |
1093 * should be. | 1091 * should be. |
1094 */ | 1092 */ |
1095 e = new AssertExp( | 1093 e = new AssertExp( |
1096 endloc, | 1094 endloc, |
1097 new IntegerExp(0), | 1095 new IntegerExp(0), |
1098 new StringExp(loc, "missing return expression") | 1096 new StringExp(loc, (char *)"missing return expression") |
1099 ); | 1097 ); |
1100 } | 1098 } |
1101 else | 1099 else |
1102 e = new HaltExp(endloc); | 1100 e = new HaltExp(endloc); |
1103 e = new CommaExp(0, e, type->nextOf()->defaultInit()); | 1101 e = new CommaExp(0, e, type->nextOf()->defaultInit()); |
2163 | 2161 |
2164 FuncLiteralDeclaration::FuncLiteralDeclaration(Loc loc, Loc endloc, Type *type, | 2162 FuncLiteralDeclaration::FuncLiteralDeclaration(Loc loc, Loc endloc, Type *type, |
2165 enum TOK tok, ForeachStatement *fes) | 2163 enum TOK tok, ForeachStatement *fes) |
2166 : FuncDeclaration(loc, endloc, NULL, STCundefined, type) | 2164 : FuncDeclaration(loc, endloc, NULL, STCundefined, type) |
2167 { | 2165 { |
2168 char *id; | 2166 const char *id; |
2169 | 2167 |
2170 if (fes) | 2168 if (fes) |
2171 id = "__foreachbody"; | 2169 id = "__foreachbody"; |
2172 else if (tok == TOKdelegate) | 2170 else if (tok == TOKdelegate) |
2173 id = "__dgliteral"; | 2171 id = "__dgliteral"; |
2308 return "constructor"; | 2306 return "constructor"; |
2309 } | 2307 } |
2310 | 2308 |
2311 char *CtorDeclaration::toChars() | 2309 char *CtorDeclaration::toChars() |
2312 { | 2310 { |
2313 return "this"; | 2311 return (char *)"this"; |
2314 } | 2312 } |
2315 | 2313 |
2316 int CtorDeclaration::isVirtual() | 2314 int CtorDeclaration::isVirtual() |
2317 { | 2315 { |
2318 return FALSE; | 2316 return FALSE; |
2650 parent = sc->parent; | 2648 parent = sc->parent; |
2651 Dsymbol *parent = toParent(); | 2649 Dsymbol *parent = toParent(); |
2652 ad = parent->isAggregateDeclaration(); | 2650 ad = parent->isAggregateDeclaration(); |
2653 if (!ad) | 2651 if (!ad) |
2654 { | 2652 { |
2655 error("invariants only are for struct/union/class definitions"); | 2653 error("invariants are only for struct/union/class definitions"); |
2656 return; | 2654 return; |
2657 } | 2655 } |
2658 else if (ad->inv && ad->inv != this) | 2656 else if (ad->inv && ad->inv != this) |
2659 { | 2657 { |
2660 error("more than one invariant for %s", ad->toChars()); | 2658 error("more than one invariant for %s", ad->toChars()); |