Mercurial > projects > ldc
comparison dmd/mtype.c @ 633:d208fc4291df
merge
author | Tomas Lindquist Olsen <tomas.l.olsen@gmail.com> |
---|---|
date | Wed, 01 Oct 2008 23:17:36 +0200 |
parents | bc83491463f0 |
children | 307ae566885f |
comparison
equal
deleted
inserted
replaced
632:df196c8dea26 | 633:d208fc4291df |
---|---|
2932 if (arg->defaultArg) | 2932 if (arg->defaultArg) |
2933 { | 2933 { |
2934 arg->defaultArg = arg->defaultArg->semantic(sc); | 2934 arg->defaultArg = arg->defaultArg->semantic(sc); |
2935 arg->defaultArg = resolveProperties(sc, arg->defaultArg); | 2935 arg->defaultArg = resolveProperties(sc, arg->defaultArg); |
2936 arg->defaultArg = arg->defaultArg->implicitCastTo(sc, arg->type); | 2936 arg->defaultArg = arg->defaultArg->implicitCastTo(sc, arg->type); |
2937 | |
2938 // make sure default arguments only use variables with lower protection | |
2939 // this check only catches the common case that the default arg Exp is a VarExp | |
2940 if(arg->defaultArg->op == TOKvar) | |
2941 { VarExp *ve = (VarExp *)arg->defaultArg; | |
2942 if(ve->var->protection < sc->protection) | |
2943 error(loc, "default argument %s has stronger protection than function %s", ve->var->toChars(), toChars()); | |
2944 } | |
2937 } | 2945 } |
2938 | 2946 |
2939 /* If arg turns out to be a tuple, the number of parameters may | 2947 /* If arg turns out to be a tuple, the number of parameters may |
2940 * change. | 2948 * change. |
2941 */ | 2949 */ |