Mercurial > projects > ldc
diff dmd/func.c @ 1607:207a8a438dea
Merge DMD r253: refactor: Argument => Parameter
---
dmd/arrayop.c | 30 ++++----
dmd/arraytypes.h | 2 +-
dmd/class.c | 8 +-
dmd/declaration.c | 10 ++--
dmd/declaration.h | 16 ++--
dmd/doc.c | 12 ++--
dmd/dsymbol.c | 4 +-
dmd/expression.c | 48 +++++++-------
dmd/expression.h | 32 +++++-----
dmd/func.c | 78 +++++++++++-----------
dmd/init.c | 2 +-
dmd/interpret.c | 8 +-
dmd/mtype.c | 190 ++++++++++++++++++++++++++--------------------------
dmd/mtype.h | 32 +++++-----
dmd/opover.c | 34 +++++-----
dmd/parse.c | 40 ++++++------
dmd/parse.h | 2 +-
dmd/statement.c | 90 +++++++++++++-------------
dmd/statement.h | 14 ++--
dmd/struct.c | 8 +-
dmd/template.c | 30 ++++----
gen/functions.cpp | 10 ++--
gen/functions.h | 2 +-
gen/tocall.cpp | 10 ++--
gen/typinf.cpp | 6 +-
25 files changed, 359 insertions(+), 359 deletions(-)
author | Leandro Lucarella <llucax@gmail.com> |
---|---|
date | Wed, 06 Jan 2010 15:18:20 -0300 |
parents | a413ae7329bf |
children | 679d101395e8 |
line wrap: on
line diff
--- a/dmd/func.c Wed Jan 06 15:18:19 2010 -0300 +++ b/dmd/func.c Wed Jan 06 15:18:20 2010 -0300 @@ -178,7 +178,7 @@ return; } f = (TypeFunction *)(type); - size_t nparams = Argument::dim(f->parameters); + size_t nparams = Parameter::dim(f->parameters); linkage = sc->linkage; // if (!parent) @@ -546,7 +546,7 @@ case 1: { - Argument *arg0 = Argument::getNth(f->parameters, 0); + Parameter *arg0 = Parameter::getNth(f->parameters, 0); if (arg0->type->ty != Tarray || arg0->type->nextOf()->ty != Tarray || arg0->type->nextOf()->nextOf()->ty != Tchar || @@ -580,7 +580,7 @@ } else { - Argument *arg0 = Argument::getNth(f->parameters, 0); + Parameter *arg0 = Parameter::getNth(f->parameters, 0); Type *t0 = arg0->type->toBasetype(); Type *tb = sd ? sd->type : cd->type; if (arg0->type->implicitConvTo(tb) || @@ -589,7 +589,7 @@ { if (nparams == 1) goto Lassignerr; - Argument *arg1 = Argument::getNth(f->parameters, 1); + Parameter *arg1 = Parameter::getNth(f->parameters, 1); if (arg1->defaultArg) goto Lassignerr; } @@ -630,10 +630,10 @@ outId = Id::result; // provide a default Loc loc = fensure->loc; - Arguments *arguments = new Arguments(); - Argument *a = NULL; + Parameters *arguments = new Parameters(); + Parameter *a = NULL; if (outId) - { a = new Argument(STCref, f->nextOf(), outId, NULL); + { a = new Parameter(STCref, f->nextOf(), outId, NULL); arguments->push(a); } TypeFunction *tf = new TypeFunction(arguments, Type::tvoid, 0, LINKd); @@ -833,8 +833,8 @@ // Turns TypeTuple!(int, int) into two int parameters, for instance. if (f->parameters) { - for (size_t i = 0; i < Argument::dim(f->parameters); i++) - { Argument *arg = (Argument *)Argument::getNth(f->parameters, i); + for (size_t i = 0; i < Parameter::dim(f->parameters); i++) + { Parameter *arg = (Parameter *)Parameter::getNth(f->parameters, i); Type* nw = arg->type->semantic(0, sc); if (arg->type != nw) { arg->type = nw; @@ -854,14 +854,14 @@ if (f->parameters) { for (size_t i = 0; i < f->parameters->dim; i++) - { Argument *arg = (Argument *)f->parameters->data[i]; + { Parameter *arg = (Parameter *)f->parameters->data[i]; //printf("[%d] arg->type->ty = %d %s\n", i, arg->type->ty, arg->type->toChars()); if (arg->type->ty == Ttuple) { TypeTuple *t = (TypeTuple *)arg->type; - size_t dim = Argument::dim(t->arguments); + size_t dim = Parameter::dim(t->arguments); for (size_t j = 0; j < dim; j++) - { Argument *narg = Argument::getNth(t->arguments, j); + { Parameter *narg = Parameter::getNth(t->arguments, j); narg->storageClass = arg->storageClass; } } @@ -871,7 +871,7 @@ /* Declare all the function parameters as variables * and install them in parameters[] */ - size_t nparams = Argument::dim(f->parameters); + size_t nparams = Parameter::dim(f->parameters); if (nparams) { /* parameters[] has all the tuples removed, as the back end * doesn't know about tuples @@ -880,7 +880,7 @@ parameters->reserve(nparams); for (size_t i = 0; i < nparams; i++) { - Argument *arg = Argument::getNth(f->parameters, i); + Parameter *arg = Parameter::getNth(f->parameters, i); Identifier *id = arg->ident; if (!id) { @@ -913,17 +913,17 @@ if (f->parameters) { for (size_t i = 0; i < f->parameters->dim; i++) - { Argument *arg = (Argument *)f->parameters->data[i]; + { Parameter *arg = (Parameter *)f->parameters->data[i]; if (!arg->ident) continue; // never used, so ignore if (arg->type->ty == Ttuple) { TypeTuple *t = (TypeTuple *)arg->type; - size_t dim = Argument::dim(t->arguments); + size_t dim = Parameter::dim(t->arguments); Objects *exps = new Objects(); exps->setDim(dim); for (size_t j = 0; j < dim; j++) - { Argument *narg = Argument::getNth(t->arguments, j); + { Parameter *narg = Parameter::getNth(t->arguments, j); assert(narg->ident); VarDeclaration *v = sc2->search(0, narg->ident, NULL)->isVarDeclaration(); assert(v); @@ -1985,7 +1985,7 @@ //printf("tf = %s, args = %s\n", tf->deco, ((Expression *)arguments->data[0])->type->deco); error(loc, "%s does not match parameter types (%s)", - Argument::argsTypesToChars(tf->parameters, tf->varargs), + Parameter::argsTypesToChars(tf->parameters, tf->varargs), buf.toChars()); return m.anyf; // as long as it's not a FuncAliasDeclaration } @@ -1997,8 +1997,8 @@ error(loc, "called with argument types:\n\t(%s)\nmatches both:\n\t%s%s\nand:\n\t%s%s", buf.toChars(), - m.lastf->toPrettyChars(), Argument::argsTypesToChars(t1->parameters, t1->varargs), - m.nextf->toPrettyChars(), Argument::argsTypesToChars(t2->parameters, t2->varargs)); + m.lastf->toPrettyChars(), Parameter::argsTypesToChars(t1->parameters, t1->varargs), + m.nextf->toPrettyChars(), Parameter::argsTypesToChars(t2->parameters, t2->varargs)); #else error(loc, "overloads %s and %s both match argument list for %s", m.lastf->type->toChars(), @@ -2034,8 +2034,8 @@ TypeFunction *tf = (TypeFunction *)type; TypeFunction *tg = (TypeFunction *)g->type; - size_t nfparams = Argument::dim(tf->parameters); - size_t ngparams = Argument::dim(tg->parameters); + size_t nfparams = Parameter::dim(tf->parameters); + size_t ngparams = Parameter::dim(tg->parameters); MATCH match = MATCHexact; /* If both functions have a 'this' pointer, and the mods are not @@ -2058,7 +2058,7 @@ args.setDim(nfparams); for (int u = 0; u < nfparams; u++) { - Argument *p = Argument::getNth(tf->parameters, u); + Parameter *p = Parameter::getNth(tf->parameters, u); Expression *e; if (p->storageClass & (STCref | STCout)) { @@ -2393,12 +2393,12 @@ // LDC: Adjusted to give argument info to the runtime function decl. // -FuncDeclaration *FuncDeclaration::genCfunc(Arguments *args, Type *treturn, const char *name) +FuncDeclaration *FuncDeclaration::genCfunc(Parameters *args, Type *treturn, const char *name) { return genCfunc(args, treturn, Lexer::idPool(name)); } -FuncDeclaration *FuncDeclaration::genCfunc(Arguments *args, Type *treturn, Identifier *id) +FuncDeclaration *FuncDeclaration::genCfunc(Parameters *args, Type *treturn, Identifier *id) { FuncDeclaration *fd; TypeFunction *tf; @@ -2575,7 +2575,7 @@ /********************************* CtorDeclaration ****************************/ -CtorDeclaration::CtorDeclaration(Loc loc, Loc endloc, Arguments *arguments, int varargs) +CtorDeclaration::CtorDeclaration(Loc loc, Loc endloc, Parameters *arguments, int varargs) : FuncDeclaration(loc, endloc, Id::ctor, STCundefined, NULL) { this->arguments = arguments; @@ -2595,7 +2595,7 @@ f->fbody = fbody ? fbody->syntaxCopy() : NULL; assert(!fthrows); // deprecated - f->arguments = Argument::arraySyntaxCopy(arguments); + f->arguments = Parameter::arraySyntaxCopy(arguments); return f; } @@ -2650,7 +2650,7 @@ sc->pop(); // See if it's the default constructor - if (cd && varargs == 0 && Argument::dim(arguments) == 0) + if (cd && varargs == 0 && Parameter::dim(arguments) == 0) cd->defaultCtor = this; } @@ -2683,7 +2683,7 @@ void CtorDeclaration::toCBuffer(OutBuffer *buf, HdrGenState *hgs) { buf->writestring("this"); - Argument::argsToCBuffer(buf, hgs, arguments, varargs); + Parameter::argsToCBuffer(buf, hgs, arguments, varargs); bodyToCBuffer(buf, hgs); } @@ -3216,7 +3216,7 @@ /********************************* NewDeclaration ****************************/ -NewDeclaration::NewDeclaration(Loc loc, Loc endloc, Arguments *arguments, int varargs) +NewDeclaration::NewDeclaration(Loc loc, Loc endloc, Parameters *arguments, int varargs) : FuncDeclaration(loc, endloc, Id::classNew, STCstatic, NULL) { this->arguments = arguments; @@ -3231,7 +3231,7 @@ FuncDeclaration::syntaxCopy(f); - f->arguments = Argument::arraySyntaxCopy(arguments); + f->arguments = Parameter::arraySyntaxCopy(arguments); return f; } @@ -3259,13 +3259,13 @@ // Check that there is at least one argument of type size_t TypeFunction *tf = (TypeFunction *)type; - if (Argument::dim(tf->parameters) < 1) + if (Parameter::dim(tf->parameters) < 1) { error("at least one argument of type size_t expected"); } else { - Argument *a = Argument::getNth(tf->parameters, 0); + Parameter *a = Parameter::getNth(tf->parameters, 0); if (!a->type->equals(Type::tsize_t)) error("first argument must be type size_t, not %s", a->type->toChars()); } @@ -3296,14 +3296,14 @@ void NewDeclaration::toCBuffer(OutBuffer *buf, HdrGenState *hgs) { buf->writestring("new"); - Argument::argsToCBuffer(buf, hgs, arguments, varargs); + Parameter::argsToCBuffer(buf, hgs, arguments, varargs); bodyToCBuffer(buf, hgs); } /********************************* DeleteDeclaration ****************************/ -DeleteDeclaration::DeleteDeclaration(Loc loc, Loc endloc, Arguments *arguments) +DeleteDeclaration::DeleteDeclaration(Loc loc, Loc endloc, Parameters *arguments) : FuncDeclaration(loc, endloc, Id::classDelete, STCstatic, NULL) { this->arguments = arguments; @@ -3317,7 +3317,7 @@ FuncDeclaration::syntaxCopy(f); - f->arguments = Argument::arraySyntaxCopy(arguments); + f->arguments = Parameter::arraySyntaxCopy(arguments); return f; } @@ -3343,13 +3343,13 @@ // Check that there is only one argument of type void* TypeFunction *tf = (TypeFunction *)type; - if (Argument::dim(tf->parameters) != 1) + if (Parameter::dim(tf->parameters) != 1) { error("one argument of type void* expected"); } else { - Argument *a = Argument::getNth(tf->parameters, 0); + Parameter *a = Parameter::getNth(tf->parameters, 0); if (!a->type->equals(Type::tvoid->pointerTo())) error("one argument of type void* expected, not %s", a->type->toChars()); } @@ -3385,7 +3385,7 @@ void DeleteDeclaration::toCBuffer(OutBuffer *buf, HdrGenState *hgs) { buf->writestring("delete"); - Argument::argsToCBuffer(buf, hgs, arguments, 0); + Parameter::argsToCBuffer(buf, hgs, arguments, 0); bodyToCBuffer(buf, hgs); }