Mercurial > projects > ldc
comparison dmd/func.c @ 1617:6820110de311
Merge DMD r301: a little refactor and harmonize
---
dmd/declaration.h | 1 +
dmd/func.c | 30 ++++++++++++++++++++++++++++++
dmd/mtype.c | 51 +++++++++++++++++++++++++++++++++++++--------------
3 files changed, 68 insertions(+), 14 deletions(-)
author | Leandro Lucarella <llucax@gmail.com> |
---|---|
date | Wed, 06 Jan 2010 15:18:21 -0300 |
parents | 679d101395e8 |
children | 44b145be2ef5 |
comparison
equal
deleted
inserted
replaced
1616:c94049033c20 | 1617:6820110de311 |
---|---|
848 } | 848 } |
849 } | 849 } |
850 } | 850 } |
851 #endif | 851 #endif |
852 | 852 |
853 #if 0 | |
853 // Propagate storage class from tuple parameters to their element-parameters. | 854 // Propagate storage class from tuple parameters to their element-parameters. |
854 if (f->parameters) | 855 if (f->parameters) |
855 { | 856 { |
856 for (size_t i = 0; i < f->parameters->dim; i++) | 857 for (size_t i = 0; i < f->parameters->dim; i++) |
857 { Parameter *arg = (Parameter *)f->parameters->data[i]; | 858 { Parameter *arg = (Parameter *)f->parameters->data[i]; |
865 narg->storageClass = arg->storageClass; | 866 narg->storageClass = arg->storageClass; |
866 } | 867 } |
867 } | 868 } |
868 } | 869 } |
869 } | 870 } |
871 #endif | |
870 | 872 |
871 /* Declare all the function parameters as variables | 873 /* Declare all the function parameters as variables |
872 * and install them in parameters[] | 874 * and install them in parameters[] |
873 */ | 875 */ |
874 size_t nparams = Parameter::dim(f->parameters); | 876 size_t nparams = Parameter::dim(f->parameters); |
2489 //printf("\tneeds closure\n"); | 2491 //printf("\tneeds closure\n"); |
2490 return 1; | 2492 return 1; |
2491 } | 2493 } |
2492 #endif | 2494 #endif |
2493 | 2495 |
2496 /********************************************* | |
2497 * Return the function's parameter list, and whether | |
2498 * it is variadic or not. | |
2499 */ | |
2500 | |
2501 Parameters *FuncDeclaration::getParameters(int *pvarargs) | |
2502 { Parameters *fparameters; | |
2503 int fvarargs; | |
2504 | |
2505 if (type) | |
2506 { | |
2507 assert(type->ty == Tfunction); | |
2508 TypeFunction *fdtype = (TypeFunction *)type; | |
2509 fparameters = fdtype->parameters; | |
2510 fvarargs = fdtype->varargs; | |
2511 } | |
2512 else // Constructors don't have type's | |
2513 { CtorDeclaration *fctor = isCtorDeclaration(); | |
2514 assert(fctor); | |
2515 fparameters = fctor->arguments; | |
2516 fvarargs = fctor->varargs; | |
2517 } | |
2518 if (pvarargs) | |
2519 *pvarargs = fvarargs; | |
2520 return fparameters; | |
2521 } | |
2522 | |
2523 | |
2494 /****************************** FuncAliasDeclaration ************************/ | 2524 /****************************** FuncAliasDeclaration ************************/ |
2495 | 2525 |
2496 // Used as a way to import a set of functions from another scope into this one. | 2526 // Used as a way to import a set of functions from another scope into this one. |
2497 | 2527 |
2498 FuncAliasDeclaration::FuncAliasDeclaration(FuncDeclaration *funcalias) | 2528 FuncAliasDeclaration::FuncAliasDeclaration(FuncDeclaration *funcalias) |