Changeset 630:bc83491463f0
- Timestamp:
- 10/01/08 15:14:15
(3 months ago)
- Author:
- Christian Kamm <kamm incasoftware de>
- branch:
- default
- Message:
Nicer error message on some invalid default args.
-
Files:
-
Legend:
- Unmodified
- Added
- Removed
- Modified
- Copied
- Moved
| r599 |
r630 |
|
| 2935 | 2935 | arg->defaultArg = resolveProperties(sc, arg->defaultArg); |
|---|
| 2936 | 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 | |
|---|