# HG changeset patch # User Leandro Lucarella # Date 1262801900 10800 # Node ID 207a8a438deaa90583599ad07e61a1fafa6a9c6d # Parent 1b24e9c7cc261b7ec0c72b4b69b6566e12f1d7f8 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(-) diff -r 1b24e9c7cc26 -r 207a8a438dea dmd/arrayop.c --- a/dmd/arrayop.c Wed Jan 06 15:18:19 2010 -0300 +++ b/dmd/arrayop.c Wed Jan 06 15:18:20 2010 -0300 @@ -253,9 +253,9 @@ * return p; */ - Arguments *fparams = new Arguments(); + Parameters *fparams = new Parameters(); Expression *loopbody = buildArrayLoop(fparams); - Argument *p = (Argument *)fparams->data[0 /*fparams->dim - 1*/]; + Parameter *p = (Parameter *)fparams->data[0 /*fparams->dim - 1*/]; #if DMDV1 // for (size_t i = 0; i < p.length; i++) Initializer *init = new ExpInitializer(0, new IntegerExp(0, 0, Type::tsize_t)); @@ -268,7 +268,7 @@ #else // foreach (i; 0 .. p.length) Statement *s1 = new ForeachRangeStatement(0, TOKforeach, - new Argument(0, NULL, Id::p, NULL), + new Parameter(0, NULL, Id::p, NULL), new IntegerExp(0, 0, Type::tint32), new ArrayLengthExp(0, new IdentifierExp(0, p->ident)), new ExpStatement(0, loopbody)); @@ -414,16 +414,16 @@ * and build the parameter list. */ -Expression *Expression::buildArrayLoop(Arguments *fparams) +Expression *Expression::buildArrayLoop(Parameters *fparams) { Identifier *id = Identifier::generateId("c", fparams->dim); - Argument *param = new Argument(0, type, id, NULL); + Parameter *param = new Parameter(0, type, id, NULL); fparams->shift(param); Expression *e = new IdentifierExp(0, id); return e; } -Expression *CastExp::buildArrayLoop(Arguments *fparams) +Expression *CastExp::buildArrayLoop(Parameters *fparams) { Type *tb = type->toBasetype(); if (tb->ty == Tarray || tb->ty == Tsarray) @@ -434,10 +434,10 @@ return Expression::buildArrayLoop(fparams); } -Expression *SliceExp::buildArrayLoop(Arguments *fparams) +Expression *SliceExp::buildArrayLoop(Parameters *fparams) { Identifier *id = Identifier::generateId("p", fparams->dim); - Argument *param = new Argument(STCconst, type, id, NULL); + Parameter *param = new Parameter(STCconst, type, id, NULL); fparams->shift(param); Expression *e = new IdentifierExp(0, id); Expressions *arguments = new Expressions(); @@ -447,7 +447,7 @@ return e; } -Expression *AssignExp::buildArrayLoop(Arguments *fparams) +Expression *AssignExp::buildArrayLoop(Parameters *fparams) { /* Evaluate assign expressions right to left */ @@ -461,20 +461,20 @@ ex2 = new CastExp(0, ex2, e1->type->nextOf()); #endif Expression *ex1 = e1->buildArrayLoop(fparams); - Argument *param = (Argument *)fparams->data[0]; + Parameter *param = (Parameter *)fparams->data[0]; param->storageClass = 0; Expression *e = new AssignExp(0, ex1, ex2); return e; } #define X(Str) \ -Expression *Str##AssignExp::buildArrayLoop(Arguments *fparams) \ +Expression *Str##AssignExp::buildArrayLoop(Parameters *fparams) \ { \ /* Evaluate assign expressions right to left \ */ \ Expression *ex2 = e2->buildArrayLoop(fparams); \ Expression *ex1 = e1->buildArrayLoop(fparams); \ - Argument *param = (Argument *)fparams->data[0]; \ + Parameter *param = (Parameter *)fparams->data[0]; \ param->storageClass = 0; \ Expression *e = new Str##AssignExp(0, ex1, ex2); \ return e; \ @@ -491,14 +491,14 @@ #undef X -Expression *NegExp::buildArrayLoop(Arguments *fparams) +Expression *NegExp::buildArrayLoop(Parameters *fparams) { Expression *ex1 = e1->buildArrayLoop(fparams); Expression *e = new NegExp(0, ex1); return e; } -Expression *ComExp::buildArrayLoop(Arguments *fparams) +Expression *ComExp::buildArrayLoop(Parameters *fparams) { Expression *ex1 = e1->buildArrayLoop(fparams); Expression *e = new ComExp(0, ex1); @@ -506,7 +506,7 @@ } #define X(Str) \ -Expression *Str##Exp::buildArrayLoop(Arguments *fparams) \ +Expression *Str##Exp::buildArrayLoop(Parameters *fparams) \ { \ /* Evaluate assign expressions left to right \ */ \ diff -r 1b24e9c7cc26 -r 207a8a438dea dmd/arraytypes.h --- a/dmd/arraytypes.h Wed Jan 06 15:18:19 2010 -0300 +++ b/dmd/arraytypes.h Wed Jan 06 15:18:20 2010 -0300 @@ -42,7 +42,7 @@ struct FuncDeclarations : Array { }; -struct Arguments : Array { }; +struct Parameters : Array { }; struct Identifiers : Array { }; diff -r 1b24e9c7cc26 -r 207a8a438dea dmd/class.c --- a/dmd/class.c Wed Jan 06 15:18:19 2010 -0300 +++ b/dmd/class.c Wed Jan 06 15:18:20 2010 -0300 @@ -283,9 +283,9 @@ { TypeTuple *tup = (TypeTuple *)tb; enum PROT protection = b->protection; baseclasses.remove(i); - size_t dim = Argument::dim(tup->arguments); + size_t dim = Parameter::dim(tup->arguments); for (size_t j = 0; j < dim; j++) - { Argument *arg = Argument::getNth(tup->arguments, j); + { Parameter *arg = Parameter::getNth(tup->arguments, j); b = new BaseClass(arg->type, protection); baseclasses.insert(i + j, b); } @@ -1087,9 +1087,9 @@ { TypeTuple *tup = (TypeTuple *)tb; enum PROT protection = b->protection; baseclasses.remove(i); - size_t dim = Argument::dim(tup->arguments); + size_t dim = Parameter::dim(tup->arguments); for (size_t j = 0; j < dim; j++) - { Argument *arg = Argument::getNth(tup->arguments, j); + { Parameter *arg = Parameter::getNth(tup->arguments, j); b = new BaseClass(arg->type, protection); baseclasses.insert(i + j, b); } diff -r 1b24e9c7cc26 -r 207a8a438dea dmd/declaration.c --- a/dmd/declaration.c Wed Jan 06 15:18:19 2010 -0300 +++ b/dmd/declaration.c Wed Jan 06 15:18:20 2010 -0300 @@ -201,7 +201,7 @@ /* We know it's a type tuple, so build the TypeTuple */ - Arguments *args = new Arguments(); + Parameters *args = new Parameters(); args->setDim(objects->dim); OutBuffer buf; int hasdeco = 1; @@ -213,9 +213,9 @@ buf.printf("_%s_%d", ident->toChars(), i); char *name = (char *)buf.extractData(); Identifier *id = new Identifier(name, TOKidentifier); - Argument *arg = new Argument(STCin, t, id, NULL); + Parameter *arg = new Parameter(STCin, t, id, NULL); #else - Argument *arg = new Argument(STCin, t, NULL, NULL); + Parameter *arg = new Parameter(STCin, t, NULL, NULL); #endif args->data[i] = (void *)arg; if (!t->deco) @@ -802,13 +802,13 @@ * and add those. */ TypeTuple *tt = (TypeTuple *)tb; - size_t nelems = Argument::dim(tt->arguments); + size_t nelems = Parameter::dim(tt->arguments); Objects *exps = new Objects(); exps->setDim(nelems); Expression *ie = init ? init->toExpression() : NULL; for (size_t i = 0; i < nelems; i++) - { Argument *arg = Argument::getNth(tt->arguments, i); + { Parameter *arg = Parameter::getNth(tt->arguments, i); OutBuffer buf; buf.printf("_%s_field_%zu", ident->toChars(), i); diff -r 1b24e9c7cc26 -r 207a8a438dea dmd/declaration.h --- a/dmd/declaration.h Wed Jan 06 15:18:19 2010 -0300 +++ b/dmd/declaration.h Wed Jan 06 15:18:20 2010 -0300 @@ -765,8 +765,8 @@ Statement *mergeFensure(Statement *); // LDC: give argument types to runtime functions - static FuncDeclaration *genCfunc(Arguments *args, Type *treturn, const char *name); - static FuncDeclaration *genCfunc(Arguments *args, Type *treturn, Identifier *id); + static FuncDeclaration *genCfunc(Parameters *args, Type *treturn, const char *name); + static FuncDeclaration *genCfunc(Parameters *args, Type *treturn, Identifier *id); #if IN_DMD Symbol *toSymbol(); @@ -848,10 +848,10 @@ }; struct CtorDeclaration : FuncDeclaration -{ Arguments *arguments; +{ Parameters *arguments; int varargs; - CtorDeclaration(Loc loc, Loc endloc, Arguments *arguments, int varargs); + CtorDeclaration(Loc loc, Loc endloc, Parameters *arguments, int varargs); Dsymbol *syntaxCopy(Dsymbol *); void semantic(Scope *sc); void toCBuffer(OutBuffer *buf, HdrGenState *hgs); @@ -969,10 +969,10 @@ }; struct NewDeclaration : FuncDeclaration -{ Arguments *arguments; +{ Parameters *arguments; int varargs; - NewDeclaration(Loc loc, Loc endloc, Arguments *arguments, int varargs); + NewDeclaration(Loc loc, Loc endloc, Parameters *arguments, int varargs); Dsymbol *syntaxCopy(Dsymbol *); void semantic(Scope *sc); void toCBuffer(OutBuffer *buf, HdrGenState *hgs); @@ -986,9 +986,9 @@ struct DeleteDeclaration : FuncDeclaration -{ Arguments *arguments; +{ Parameters *arguments; - DeleteDeclaration(Loc loc, Loc endloc, Arguments *arguments); + DeleteDeclaration(Loc loc, Loc endloc, Parameters *arguments); Dsymbol *syntaxCopy(Dsymbol *); void semantic(Scope *sc); void toCBuffer(OutBuffer *buf, HdrGenState *hgs); diff -r 1b24e9c7cc26 -r 207a8a438dea dmd/doc.c --- a/dmd/doc.c Wed Jan 06 15:18:19 2010 -0300 +++ b/dmd/doc.c Wed Jan 06 15:18:20 2010 -0300 @@ -96,7 +96,7 @@ void highlightText(Scope *sc, Dsymbol *s, OutBuffer *buf, unsigned offset); void highlightCode(Scope *sc, Dsymbol *s, OutBuffer *buf, unsigned offset); void highlightCode2(Scope *sc, Dsymbol *s, OutBuffer *buf, unsigned offset); -Argument *isFunctionParameter(Dsymbol *s, unsigned char *p, unsigned len); +Parameter *isFunctionParameter(Dsymbol *s, unsigned char *p, unsigned len); int isIdStart(unsigned char *p); int isIdTail(unsigned char *p); @@ -773,7 +773,7 @@ tp->toCBuffer(buf, &hgs); } buf->writeByte(')'); - Argument::argsToCBuffer(buf, &hgs, tf->parameters, tf->varargs); + Parameter::argsToCBuffer(buf, &hgs, tf->parameters, tf->varargs); buf->writestring(";\n"); highlightCode(NULL, this, buf, o); @@ -790,7 +790,7 @@ HdrGenState hgs; buf->writestring("this"); - Argument::argsToCBuffer(buf, &hgs, arguments, varargs); + Parameter::argsToCBuffer(buf, &hgs, arguments, varargs); buf->writestring(";\n"); } @@ -1154,7 +1154,7 @@ unsigned textlen; unsigned o; - Argument *arg; + Parameter *arg; buf->writestring("$(DDOC_PARAMS \n"); while (p < pend) @@ -1621,7 +1621,7 @@ /**************************************************** */ -Argument *isFunctionParameter(Dsymbol *s, unsigned char *p, unsigned len) +Parameter *isFunctionParameter(Dsymbol *s, unsigned char *p, unsigned len) { FuncDeclaration *f = s->isFuncDeclaration(); @@ -1640,7 +1640,7 @@ if (tf->parameters) { for (size_t k = 0; k < tf->parameters->dim; k++) - { Argument *arg = (Argument *)tf->parameters->data[k]; + { Parameter *arg = (Parameter *)tf->parameters->data[k]; if (arg->ident && cmp(arg->ident->toChars(), p, len) == 0) { diff -r 1b24e9c7cc26 -r 207a8a438dea dmd/dsymbol.c --- a/dmd/dsymbol.c Wed Jan 06 15:18:19 2010 -0300 +++ b/dmd/dsymbol.c Wed Jan 06 15:18:20 2010 -0300 @@ -1005,8 +1005,8 @@ if (!tfgetmembers) { Scope sc; - Arguments *arguments = new Arguments; - Arguments *arg = new Argument(STCin, Type::tchar->constOf()->arrayOf(), NULL, NULL); + Parameters *arguments = new Parameters; + Parameters *arg = new Parameter(STCin, Type::tchar->constOf()->arrayOf(), NULL, NULL); arguments->push(arg); Type *tret = NULL; diff -r 1b24e9c7cc26 -r 207a8a438dea dmd/expression.c --- a/dmd/expression.c Wed Jan 06 15:18:19 2010 -0300 +++ b/dmd/expression.c Wed Jan 06 15:18:20 2010 -0300 @@ -556,7 +556,7 @@ * Preprocess arguments to function. */ -void preFunctionArguments(Loc loc, Scope *sc, Expressions *exps) +void preFunctionParameters(Loc loc, Scope *sc, Expressions *exps) { if (exps) { @@ -627,14 +627,14 @@ * 4. add hidden _arguments[] argument */ -void functionArguments(Loc loc, Scope *sc, TypeFunction *tf, Expressions *arguments) +void functionParameters(Loc loc, Scope *sc, TypeFunction *tf, Expressions *arguments) { unsigned n; - //printf("functionArguments()\n"); + //printf("functionParameters()\n"); assert(arguments); size_t nargs = arguments ? arguments->dim : 0; - size_t nparams = Argument::dim(tf->parameters); + size_t nparams = Parameter::dim(tf->parameters); if (nargs > nparams && tf->varargs == 0) error(loc, "expected %zu arguments, not %zu for non-variadic function type %s", nparams, nargs, tf->toChars()); @@ -654,7 +654,7 @@ if (i < nparams) { - Argument *p = Argument::getNth(tf->parameters, i); + Parameter *p = Parameter::getNth(tf->parameters, i); if (!arg) { @@ -3610,9 +3610,9 @@ //printf("tb: %s, deco = %s\n", tb->toChars(), tb->deco); arrayExpressionSemantic(newargs, sc); - preFunctionArguments(loc, sc, newargs); + preFunctionParameters(loc, sc, newargs); arrayExpressionSemantic(arguments, sc); - preFunctionArguments(loc, sc, arguments); + preFunctionParameters(loc, sc, arguments); if (thisexp && tb->ty != Tclass) error("e.new is only for allocating nested classes, not %s", tb->toChars()); @@ -3727,7 +3727,7 @@ if (!arguments) arguments = new Expressions(); - functionArguments(loc, sc, tf, arguments); + functionParameters(loc, sc, tf, arguments); } else { @@ -3748,7 +3748,7 @@ assert(allocator); tf = (TypeFunction *)f->type; - functionArguments(loc, sc, tf, newargs); + functionParameters(loc, sc, tf, newargs); } else { @@ -3781,7 +3781,7 @@ assert(allocator); tf = (TypeFunction *)f->type; - functionArguments(loc, sc, tf, newargs); + functionParameters(loc, sc, tf, newargs); e = new VarExp(loc, f); e = new CallExp(loc, e, newargs); @@ -4749,11 +4749,11 @@ goto Lno; else { ClassDeclaration *cd = ((TypeClass *)targ)->sym; - Arguments *args = new Arguments; + Parameters *args = new Parameters; args->reserve(cd->baseclasses.dim); for (size_t i = 0; i < cd->baseclasses.dim; i++) { BaseClass *b = (BaseClass *)cd->baseclasses.data[i]; - args->push(new Argument(STCin, b->type, NULL, NULL)); + args->push(new Parameter(STCin, b->type, NULL, NULL)); } tded = new TypeTuple(args); } @@ -4780,14 +4780,14 @@ /* Generate tuple from function parameter types. */ assert(tded->ty == Tfunction); - Arguments *params = ((TypeFunction *)tded)->parameters; - size_t dim = Argument::dim(params); - Arguments *args = new Arguments; + Parameters *params = ((TypeFunction *)tded)->parameters; + size_t dim = Parameter::dim(params); + Parameters *args = new Parameters; args->reserve(dim); for (size_t i = 0; i < dim; i++) - { Argument *arg = Argument::getNth(params, i); + { Parameter *arg = Parameter::getNth(params, i); assert(arg && arg->type); - args->push(new Argument(arg->storageClass, arg->type, NULL, NULL)); + args->push(new Parameter(arg->storageClass, arg->type, NULL, NULL)); } tded = new TypeTuple(args); break; @@ -6387,7 +6387,7 @@ } arrayExpressionSemantic(arguments, sc); - preFunctionArguments(loc, sc, arguments); + preFunctionParameters(loc, sc, arguments); if (e1->op == TOKdotvar && t1->ty == Tfunction || e1->op == TOKdottd) @@ -6668,7 +6668,7 @@ if (!arguments) arguments = new Expressions(); - functionArguments(loc, sc, tf, arguments); + functionParameters(loc, sc, tf, arguments); assert(type); @@ -7471,7 +7471,7 @@ } else if (e1->op == TOKtype) // slicing a type tuple { tup = (TypeTuple *)t; - length = Argument::dim(tup->arguments); + length = Parameter::dim(tup->arguments); } else assert(0); @@ -7490,10 +7490,10 @@ e = new TupleExp(loc, exps); } else - { Arguments *args = new Arguments; + { Parameters *args = new Parameters; args->reserve(j2 - j1); for (size_t i = j1; i < j2; i++) - { Argument *arg = Argument::getNth(tup->arguments, i); + { Parameter *arg = Parameter::getNth(tup->arguments, i); args->push(arg); } e = new TypeExp(e1->loc, new TypeTuple(args)); @@ -7871,7 +7871,7 @@ else if (e1->op == TOKtype) { tup = (TypeTuple *)t1; - length = Argument::dim(tup->arguments); + length = Parameter::dim(tup->arguments); } else assert(0); @@ -7882,7 +7882,7 @@ if (e1->op == TOKtuple) e = (Expression *)te->exps->data[(size_t)index]; else - e = new TypeExp(e1->loc, Argument::getNth(tup->arguments, (size_t)index)->type); + e = new TypeExp(e1->loc, Parameter::getNth(tup->arguments, (size_t)index)->type); } else { diff -r 1b24e9c7cc26 -r 207a8a438dea dmd/expression.h --- a/dmd/expression.h Wed Jan 06 15:18:19 2010 -0300 +++ b/dmd/expression.h Wed Jan 06 15:18:20 2010 -0300 @@ -73,7 +73,7 @@ Expression *resolveProperties(Scope *sc, Expression *e); void accessCheck(Loc loc, Scope *sc, Expression *e, Declaration *d); Dsymbol *search_function(AggregateDeclaration *ad, Identifier *funcid); -void inferApplyArgTypes(enum TOK op, Arguments *arguments, Expression *aggr, Module* from); +void inferApplyArgTypes(enum TOK op, Parameters *arguments, Expression *aggr, Module* from); void argExpTypesToCBuffer(OutBuffer *buf, Expressions *arguments, HdrGenState *hgs); void argsToCBuffer(OutBuffer *buf, Expressions *arguments, HdrGenState *hgs); void expandTuples(Expressions *exps); @@ -161,7 +161,7 @@ // For array ops virtual void buildArrayIdent(OutBuffer *buf, Expressions *arguments); - virtual Expression *buildArrayLoop(Arguments *fparams); + virtual Expression *buildArrayLoop(Parameters *fparams); int isArrayOperand(); #if IN_DMD @@ -1090,7 +1090,7 @@ Expression *optimize(int result); Expression *interpret(InterState *istate); void buildArrayIdent(OutBuffer *buf, Expressions *arguments); - Expression *buildArrayLoop(Arguments *fparams); + Expression *buildArrayLoop(Parameters *fparams); // For operator overloading Identifier *opId(); @@ -1120,7 +1120,7 @@ Expression *optimize(int result); Expression *interpret(InterState *istate); void buildArrayIdent(OutBuffer *buf, Expressions *arguments); - Expression *buildArrayLoop(Arguments *fparams); + Expression *buildArrayLoop(Parameters *fparams); // For operator overloading Identifier *opId(); @@ -1196,7 +1196,7 @@ void checkEscape(); void toCBuffer(OutBuffer *buf, HdrGenState *hgs); void buildArrayIdent(OutBuffer *buf, Expressions *arguments); - Expression *buildArrayLoop(Arguments *fparams); + Expression *buildArrayLoop(Parameters *fparams); #if IN_DMD elem *toElem(IRState *irs); #endif @@ -1232,7 +1232,7 @@ #endif void scanForNestedRef(Scope *sc); void buildArrayIdent(OutBuffer *buf, Expressions *arguments); - Expression *buildArrayLoop(Arguments *fparams); + Expression *buildArrayLoop(Parameters *fparams); int inlineCost(InlineCostState *ics); Expression *doInline(InlineDoState *ids); @@ -1360,7 +1360,7 @@ Expression *interpret(InterState *istate); Identifier *opId(); // For operator overloading void buildArrayIdent(OutBuffer *buf, Expressions *arguments); - Expression *buildArrayLoop(Arguments *fparams); + Expression *buildArrayLoop(Parameters *fparams); #if IN_DMD elem *toElem(IRState *irs); #endif @@ -1385,7 +1385,7 @@ Expression *semantic(Scope *sc); \ Expression *interpret(InterState *istate); \ X(void buildArrayIdent(OutBuffer *buf, Expressions *arguments);) \ - X(Expression *buildArrayLoop(Arguments *fparams);) \ + X(Expression *buildArrayLoop(Parameters *fparams);) \ \ Identifier *opId(); /* For operator overloading */ \ \ @@ -1421,7 +1421,7 @@ Expression *optimize(int result); Expression *interpret(InterState *istate); void buildArrayIdent(OutBuffer *buf, Expressions *arguments); - Expression *buildArrayLoop(Arguments *fparams); + Expression *buildArrayLoop(Parameters *fparams); // For operator overloading int isCommutative(); @@ -1444,7 +1444,7 @@ Expression *optimize(int result); Expression *interpret(InterState *istate); void buildArrayIdent(OutBuffer *buf, Expressions *arguments); - Expression *buildArrayLoop(Arguments *fparams); + Expression *buildArrayLoop(Parameters *fparams); // For operator overloading Identifier *opId(); @@ -1486,7 +1486,7 @@ Expression *optimize(int result); Expression *interpret(InterState *istate); void buildArrayIdent(OutBuffer *buf, Expressions *arguments); - Expression *buildArrayLoop(Arguments *fparams); + Expression *buildArrayLoop(Parameters *fparams); // For operator overloading int isCommutative(); @@ -1509,7 +1509,7 @@ Expression *optimize(int result); Expression *interpret(InterState *istate); void buildArrayIdent(OutBuffer *buf, Expressions *arguments); - Expression *buildArrayLoop(Arguments *fparams); + Expression *buildArrayLoop(Parameters *fparams); // For operator overloading Identifier *opId(); @@ -1531,7 +1531,7 @@ Expression *optimize(int result); Expression *interpret(InterState *istate); void buildArrayIdent(OutBuffer *buf, Expressions *arguments); - Expression *buildArrayLoop(Arguments *fparams); + Expression *buildArrayLoop(Parameters *fparams); // For operator overloading Identifier *opId(); @@ -1613,7 +1613,7 @@ Expression *optimize(int result); Expression *interpret(InterState *istate); void buildArrayIdent(OutBuffer *buf, Expressions *arguments); - Expression *buildArrayLoop(Arguments *fparams); + Expression *buildArrayLoop(Parameters *fparams); // For operator overloading int isCommutative(); @@ -1636,7 +1636,7 @@ Expression *optimize(int result); Expression *interpret(InterState *istate); void buildArrayIdent(OutBuffer *buf, Expressions *arguments); - Expression *buildArrayLoop(Arguments *fparams); + Expression *buildArrayLoop(Parameters *fparams); // For operator overloading int isCommutative(); @@ -1659,7 +1659,7 @@ Expression *optimize(int result); Expression *interpret(InterState *istate); void buildArrayIdent(OutBuffer *buf, Expressions *arguments); - Expression *buildArrayLoop(Arguments *fparams); + Expression *buildArrayLoop(Parameters *fparams); // For operator overloading int isCommutative(); diff -r 1b24e9c7cc26 -r 207a8a438dea dmd/func.c --- 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); } diff -r 1b24e9c7cc26 -r 207a8a438dea dmd/init.c --- a/dmd/init.c Wed Jan 06 15:18:19 2010 -0300 +++ b/dmd/init.c Wed Jan 06 15:18:20 2010 -0300 @@ -213,7 +213,7 @@ else if (t->ty == Tdelegate && value.dim == 0) { /* Rewrite as empty delegate literal { } */ - Arguments *arguments = new Arguments; + Parameters *arguments = new Parameters; Type *tf = new TypeFunction(arguments, NULL, 0, LINKd); FuncLiteralDeclaration *fd = new FuncLiteralDeclaration(loc, 0, tf, TOKdelegate, NULL); fd->fbody = new CompoundStatement(loc, new Statements()); diff -r 1b24e9c7cc26 -r 207a8a438dea dmd/interpret.c --- a/dmd/interpret.c Wed Jan 06 15:18:19 2010 -0300 +++ b/dmd/interpret.c Wed Jan 06 15:18:20 2010 -0300 @@ -102,9 +102,9 @@ // Ensure there are no lazy parameters if (tf->parameters) - { size_t dim = Argument::dim(tf->parameters); + { size_t dim = Parameter::dim(tf->parameters); for (size_t i = 0; i < dim; i++) - { Argument *arg = Argument::getNth(tf->parameters, i); + { Parameter *arg = Parameter::getNth(tf->parameters, i); if (arg->storageClass & STClazy) { cantInterpret = 1; return NULL; @@ -139,7 +139,7 @@ for (size_t i = 0; i < dim; i++) { Expression *earg = (Expression *)arguments->data[i]; - Argument *arg = Argument::getNth(tf->parameters, i); + Parameter *arg = Parameter::getNth(tf->parameters, i); if (arg->storageClass & (STCout | STCref)) { @@ -166,7 +166,7 @@ for (size_t i = 0; i < dim; i++) { Expression *earg = (Expression *)eargs.data[i]; - Argument *arg = Argument::getNth(tf->parameters, i); + Parameter *arg = Parameter::getNth(tf->parameters, i); VarDeclaration *v = (VarDeclaration *)parameters->data[i]; vsave.data[i] = v->value; #if LOG diff -r 1b24e9c7cc26 -r 207a8a438dea dmd/mtype.c --- a/dmd/mtype.c Wed Jan 06 15:18:19 2010 -0300 +++ b/dmd/mtype.c Wed Jan 06 15:18:20 2010 -0300 @@ -1594,16 +1594,16 @@ //LDC: Build arguments. static FuncDeclaration *adReverseChar_fd = NULL; if(!adReverseChar_fd) { - Arguments* args = new Arguments; + Parameters* args = new Parameters; Type* arrty = Type::tchar->arrayOf(); - args->push(new Argument(STCin, arrty, NULL, NULL)); + args->push(new Parameter(STCin, arrty, NULL, NULL)); adReverseChar_fd = FuncDeclaration::genCfunc(args, arrty, "_adReverseChar"); } static FuncDeclaration *adReverseWchar_fd = NULL; if(!adReverseWchar_fd) { - Arguments* args = new Arguments; + Parameters* args = new Parameters; Type* arrty = Type::twchar->arrayOf(); - args->push(new Argument(STCin, arrty, NULL, NULL)); + args->push(new Parameter(STCin, arrty, NULL, NULL)); adReverseWchar_fd = FuncDeclaration::genCfunc(args, arrty, "_adReverseWchar"); } @@ -1625,16 +1625,16 @@ //LDC: Build arguments. static FuncDeclaration *adSortChar_fd = NULL; if(!adSortChar_fd) { - Arguments* args = new Arguments; + Parameters* args = new Parameters; Type* arrty = Type::tchar->arrayOf(); - args->push(new Argument(STCin, arrty, NULL, NULL)); + args->push(new Parameter(STCin, arrty, NULL, NULL)); adSortChar_fd = FuncDeclaration::genCfunc(args, arrty, "_adSortChar"); } static FuncDeclaration *adSortWchar_fd = NULL; if(!adSortWchar_fd) { - Arguments* args = new Arguments; + Parameters* args = new Parameters; Type* arrty = Type::twchar->arrayOf(); - args->push(new Argument(STCin, arrty, NULL, NULL)); + args->push(new Parameter(STCin, arrty, NULL, NULL)); adSortWchar_fd = FuncDeclaration::genCfunc(args, arrty, "_adSortWchar"); } @@ -1660,16 +1660,16 @@ //LDC: Build arguments. static FuncDeclaration *adDup_fd = NULL; if(!adDup_fd) { - Arguments* args = new Arguments; - args->push(new Argument(STCin, Type::typeinfo->type, NULL, NULL)); - args->push(new Argument(STCin, Type::tvoid->arrayOf(), NULL, NULL)); + Parameters* args = new Parameters; + args->push(new Parameter(STCin, Type::typeinfo->type, NULL, NULL)); + args->push(new Parameter(STCin, Type::tvoid->arrayOf(), NULL, NULL)); adDup_fd = FuncDeclaration::genCfunc(args, Type::tvoid->arrayOf(), Id::adDup); } static FuncDeclaration *adReverse_fd = NULL; if(!adReverse_fd) { - Arguments* args = new Arguments; - args->push(new Argument(STCin, Type::tvoid->arrayOf(), NULL, NULL)); - args->push(new Argument(STCin, Type::tsize_t, NULL, NULL)); + Parameters* args = new Parameters; + args->push(new Parameter(STCin, Type::tvoid->arrayOf(), NULL, NULL)); + args->push(new Parameter(STCin, Type::tsize_t, NULL, NULL)); adReverse_fd = FuncDeclaration::genCfunc(args, Type::tvoid->arrayOf(), Id::adReverse); } @@ -1703,16 +1703,16 @@ //LDC: Build arguments. static FuncDeclaration *adSort_fd = NULL; if(!adSort_fd) { - Arguments* args = new Arguments; - args->push(new Argument(STCin, Type::tvoid->arrayOf(), NULL, NULL)); - args->push(new Argument(STCin, Type::typeinfo->type, NULL, NULL)); + Parameters* args = new Parameters; + args->push(new Parameter(STCin, Type::tvoid->arrayOf(), NULL, NULL)); + args->push(new Parameter(STCin, Type::typeinfo->type, NULL, NULL)); adSort_fd = FuncDeclaration::genCfunc(args, Type::tvoid->arrayOf(), "_adSort"); } static FuncDeclaration *adSortBit_fd = NULL; if(!adSortBit_fd) { - Arguments* args = new Arguments; - args->push(new Argument(STCin, Type::tvoid->arrayOf(), NULL, NULL)); - args->push(new Argument(STCin, Type::typeinfo->type, NULL, NULL)); + Parameters* args = new Parameters; + args->push(new Parameter(STCin, Type::tvoid->arrayOf(), NULL, NULL)); + args->push(new Parameter(STCin, Type::typeinfo->type, NULL, NULL)); adSortBit_fd = FuncDeclaration::genCfunc(args, Type::tvoid->arrayOf(), "_adSortBit"); } @@ -1981,7 +1981,7 @@ { error(loc, "tuple index %ju exceeds %u", d, tt->arguments->dim); return Type::terror; } - Argument *arg = (Argument *)tt->arguments->data[(size_t)d]; + Parameter *arg = (Parameter *)tt->arguments->data[(size_t)d]; return arg->type; } case Tfunction: @@ -2401,8 +2401,8 @@ //LDC: Build arguments. static FuncDeclaration *aaLen_fd = NULL; if(!aaLen_fd) { - Arguments* args = new Arguments; - args->push(new Argument(STCin, Type::tvoid->pointerTo(), NULL, NULL)); + Parameters* args = new Parameters; + args->push(new Parameter(STCin, Type::tvoid->pointerTo(), NULL, NULL)); aaLen_fd = FuncDeclaration::genCfunc(args, Type::tsize_t, Id::aaLen); } @@ -2422,9 +2422,9 @@ //LDC: Build arguments. static FuncDeclaration *aaKeys_fd = NULL; if(!aaKeys_fd) { - Arguments* args = new Arguments; - args->push(new Argument(STCin, Type::tvoid->pointerTo(), NULL, NULL)); - args->push(new Argument(STCin, Type::tsize_t, NULL, NULL)); + Parameters* args = new Parameters; + args->push(new Parameter(STCin, Type::tvoid->pointerTo(), NULL, NULL)); + args->push(new Parameter(STCin, Type::tsize_t, NULL, NULL)); aaKeys_fd = FuncDeclaration::genCfunc(args, Type::tvoid->arrayOf(), Id::aaKeys); } @@ -2443,10 +2443,10 @@ //LDC: Build arguments. static FuncDeclaration *aaValues_fd = NULL; if(!aaValues_fd) { - Arguments* args = new Arguments; - args->push(new Argument(STCin, Type::tvoid->pointerTo(), NULL, NULL)); - args->push(new Argument(STCin, Type::tsize_t, NULL, NULL)); - args->push(new Argument(STCin, Type::tsize_t, NULL, NULL)); + Parameters* args = new Parameters; + args->push(new Parameter(STCin, Type::tvoid->pointerTo(), NULL, NULL)); + args->push(new Parameter(STCin, Type::tsize_t, NULL, NULL)); + args->push(new Parameter(STCin, Type::tsize_t, NULL, NULL)); aaValues_fd = FuncDeclaration::genCfunc(args, Type::tvoid->arrayOf(), Id::aaValues); } @@ -2468,9 +2468,9 @@ //LDC: Build arguments. static FuncDeclaration *aaRehash_fd = NULL; if(!aaRehash_fd) { - Arguments* args = new Arguments; - args->push(new Argument(STCin, Type::tvoid->pointerTo(), NULL, NULL)); - args->push(new Argument(STCin, Type::typeinfo->type, NULL, NULL)); + Parameters* args = new Parameters; + args->push(new Parameter(STCin, Type::tvoid->pointerTo(), NULL, NULL)); + args->push(new Parameter(STCin, Type::typeinfo->type, NULL, NULL)); aaRehash_fd = FuncDeclaration::genCfunc(args, Type::tvoidptr, Id::aaRehash); } @@ -2708,7 +2708,7 @@ /***************************** TypeFunction *****************************/ -TypeFunction::TypeFunction(Arguments *parameters, Type *treturn, int varargs, enum LINK linkage) +TypeFunction::TypeFunction(Parameters *parameters, Type *treturn, int varargs, enum LINK linkage) : Type(Tfunction, treturn) { //if (!treturn) *(char*)0=0; @@ -2726,8 +2726,8 @@ Type *TypeFunction::syntaxCopy() { Type *treturn = next ? next->syntaxCopy() : NULL; - Arguments *params = Argument::arraySyntaxCopy(parameters); - TypeFunction *t = new TypeFunction(params, treturn, varargs, linkage); + Parameters *params = Parameter::arraySyntaxCopy(parameters); + Type *t = new TypeFunction(params, treturn, varargs, linkage); return t; } @@ -2764,13 +2764,13 @@ if (t1->parameters && t2->parameters) { - size_t dim = Argument::dim(t1->parameters); - if (dim != Argument::dim(t2->parameters)) + size_t dim = Parameter::dim(t1->parameters); + if (dim != Parameter::dim(t2->parameters)) goto Ldistinct; for (size_t i = 0; i < dim; i++) - { Argument *arg1 = Argument::getNth(t1->parameters, i); - Argument *arg2 = Argument::getNth(t2->parameters, i); + { Parameter *arg1 = Parameter::getNth(t1->parameters, i); + Parameter *arg2 = Parameter::getNth(t2->parameters, i); if (!arg1->type->equals(arg2->type)) goto Ldistinct; @@ -2875,7 +2875,7 @@ } // Write argument types - Argument::argsToDecoBuffer(buf, parameters, mangle); + Parameter::argsToDecoBuffer(buf, parameters, mangle); //if (buf->data[buf->offset - 1] == '@') halt(); buf->writeByte('Z' - varargs); // mark end of arg list next->toDecoBuffer(buf, mangle); @@ -2917,7 +2917,7 @@ { buf->writeByte(' '); buf->writestring(ident->toHChars2()); } - Argument::argsToCBuffer(buf, hgs, parameters, varargs); + Parameter::argsToCBuffer(buf, hgs, parameters, varargs); inuse--; } @@ -2953,7 +2953,7 @@ if (!hgs->hdrgen && p) buf->writestring(p); buf->writestring(" function"); - Argument::argsToCBuffer(buf, hgs, parameters, varargs); + Parameter::argsToCBuffer(buf, hgs, parameters, varargs); inuse--; } @@ -2969,11 +2969,11 @@ TypeFunction *tf = (TypeFunction *)mem.malloc(sizeof(TypeFunction)); memcpy(tf, this, sizeof(TypeFunction)); if (parameters) - { tf->parameters = (Arguments *)parameters->copy(); + { tf->parameters = (Parameters *)parameters->copy(); for (size_t i = 0; i < parameters->dim; i++) - { Argument *arg = (Argument *)parameters->data[i]; - Argument *cpy = (Argument *)mem.malloc(sizeof(Argument)); - memcpy(cpy, arg, sizeof(Argument)); + { Parameter *arg = (Parameter *)parameters->data[i]; + Parameter *cpy = (Parameter *)mem.malloc(sizeof(Parameter)); + memcpy(cpy, arg, sizeof(Parameter)); tf->parameters->data[i] = (void *)cpy; } } @@ -3006,9 +3006,9 @@ argsc->stc = 0; // don't inherit storage class argsc->protection = PROTpublic; - size_t dim = Argument::dim(tf->parameters); + size_t dim = Parameter::dim(tf->parameters); for (size_t i = 0; i < dim; i++) - { Argument *arg = Argument::getNth(tf->parameters, i); + { Parameter *arg = Parameter::getNth(tf->parameters, i); tf->inuse++; arg->type = arg->type->semantic(loc, argsc); @@ -3044,7 +3044,7 @@ * change. */ if (t->ty == Ttuple) - { dim = Argument::dim(tf->parameters); + { dim = Parameter::dim(tf->parameters); i--; } } @@ -3059,7 +3059,7 @@ return terror; } - if (tf->varargs == 1 && tf->linkage != LINKd && Argument::dim(tf->parameters) == 0) + if (tf->varargs == 1 && tf->linkage != LINKd && Parameter::dim(tf->parameters) == 0) error(loc, "variadic functions with non-D linkage must have at least one parameter"); /* Don't return merge(), because arg identifiers and default args @@ -3081,7 +3081,7 @@ //printf("TypeFunction::callMatch()\n"); int match = MATCHexact; // assume exact match - size_t nparams = Argument::dim(parameters); + size_t nparams = Parameter::dim(parameters); size_t nargs = args ? args->dim : 0; if (nparams == nargs) ; @@ -3098,7 +3098,7 @@ // BUG: what about out and ref? - Argument *p = Argument::getNth(parameters, u); + Parameter *p = Parameter::getNth(parameters, u); assert(p); if (u >= nargs) { @@ -3196,7 +3196,7 @@ if (parameters) { for (size_t i = 0; i < parameters->dim; i++) - { Argument *arg = (Argument *)parameters->data[i]; + { Parameter *arg = (Parameter *)parameters->data[i]; Type *t = arg->type->reliesOnTident(); if (t) return t; @@ -3257,7 +3257,7 @@ tf->next->toCBuffer2(buf, hgs, 0); buf->writestring(" delegate"); - Argument::argsToCBuffer(buf, hgs, tf->parameters, tf->varargs); + Parameter::argsToCBuffer(buf, hgs, tf->parameters, tf->varargs); } Expression *TypeDelegate::defaultInit(Loc loc) @@ -5173,7 +5173,7 @@ /***************************** TypeTuple *****************************/ -TypeTuple::TypeTuple(Arguments *arguments) +TypeTuple::TypeTuple(Parameters *arguments) : Type(Ttuple, NULL) { //printf("TypeTuple(this = %p)\n", this); @@ -5184,7 +5184,7 @@ { for (size_t i = 0; i < arguments->dim; i++) { - Argument *arg = (Argument *)arguments->data[i]; + Parameter *arg = (Parameter *)arguments->data[i]; assert(arg && arg->type); } } @@ -5199,7 +5199,7 @@ TypeTuple::TypeTuple(Expressions *exps) : Type(Ttuple, NULL) { - Arguments *arguments = new Arguments; + Parameters *arguments = new Parameters; if (exps) { arguments->setDim(exps->dim); @@ -5207,7 +5207,7 @@ { Expression *e = (Expression *)exps->data[i]; if (e->type->ty == Ttuple) e->error("cannot form tuple of tuples"); - Argument *arg = new Argument(STCin, e->type, NULL, NULL); + Parameter *arg = new Parameter(STCin, e->type, NULL, NULL); arguments->data[i] = (void *)arg; } } @@ -5216,7 +5216,7 @@ Type *TypeTuple::syntaxCopy() { - Arguments *args = Argument::arraySyntaxCopy(arguments); + Parameters *args = Parameter::arraySyntaxCopy(arguments); Type *t = new TypeTuple(args); return t; } @@ -5249,8 +5249,8 @@ if (arguments->dim == tt->arguments->dim) { for (size_t i = 0; i < tt->arguments->dim; i++) - { Argument *arg1 = (Argument *)arguments->data[i]; - Argument *arg2 = (Argument *)tt->arguments->data[i]; + { Parameter *arg1 = (Parameter *)arguments->data[i]; + Parameter *arg2 = (Parameter *)tt->arguments->data[i]; if (!arg1->type->equals(arg2->type)) return 0; @@ -5267,7 +5267,7 @@ { for (size_t i = 0; i < arguments->dim; i++) { - Argument *arg = (Argument *)arguments->data[i]; + Parameter *arg = (Parameter *)arguments->data[i]; Type *t = arg->type->reliesOnTident(); if (t) return t; @@ -5278,14 +5278,14 @@ void TypeTuple::toCBuffer2(OutBuffer *buf, HdrGenState *hgs, int mod) { - Argument::argsToCBuffer(buf, hgs, arguments, 0); + Parameter::argsToCBuffer(buf, hgs, arguments, 0); } void TypeTuple::toDecoBuffer(OutBuffer *buf, bool mangle) { //printf("TypeTuple::toDecoBuffer() this = %p\n", this); OutBuffer buf2; - Argument::argsToDecoBuffer(&buf2, arguments, mangle); + Parameter::argsToDecoBuffer(&buf2, arguments, mangle); unsigned len = buf2.offset; buf->printf("%c%d%.*s", mangleChar[ty], len, len, (char *)buf2.extractData()); } @@ -5352,10 +5352,10 @@ return Type::terror; } - Arguments *args = new Arguments; + Parameters *args = new Parameters; args->reserve(i2 - i1); for (size_t i = i1; i < i2; i++) - { Argument *arg = (Argument *)tt->arguments->data[i]; + { Parameter *arg = (Parameter *)tt->arguments->data[i]; args->push(arg); } @@ -5438,9 +5438,9 @@ buf->printf("%s]", upr->toChars()); } -/***************************** Argument *****************************/ - -Argument::Argument(unsigned storageClass, Type *type, Identifier *ident, Expression *defaultArg) +/***************************** Parameter *****************************/ + +Parameter::Parameter(unsigned storageClass, Type *type, Identifier *ident, Expression *defaultArg) { this->type = type; this->ident = ident; @@ -5448,24 +5448,24 @@ this->defaultArg = defaultArg; } -Argument *Argument::syntaxCopy() -{ - Argument *a = new Argument(storageClass, +Parameter *Parameter::syntaxCopy() +{ + Parameter *a = new Parameter(storageClass, type ? type->syntaxCopy() : NULL, ident, defaultArg ? defaultArg->syntaxCopy() : NULL); return a; } -Arguments *Argument::arraySyntaxCopy(Arguments *args) -{ Arguments *a = NULL; +Parameters *Parameter::arraySyntaxCopy(Parameters *args) +{ Parameters *a = NULL; if (args) { - a = new Arguments(); + a = new Parameters(); a->setDim(args->dim); for (size_t i = 0; i < a->dim; i++) - { Argument *arg = (Argument *)args->data[i]; + { Parameter *arg = (Parameter *)args->data[i]; arg = arg->syntaxCopy(); a->data[i] = (void *)arg; @@ -5474,7 +5474,7 @@ return a; } -char *Argument::argsTypesToChars(Arguments *args, int varargs) +char *Parameter::argsTypesToChars(Parameters *args, int varargs) { OutBuffer *buf; buf = new OutBuffer(); @@ -5486,11 +5486,11 @@ HdrGenState hgs; for (i = 0; i < args->dim; i++) - { Argument *arg; + { Parameter *arg; if (i) buf->writeByte(','); - arg = (Argument *)args->data[i]; + arg = (Parameter *)args->data[i]; argbuf.reset(); arg->type->toCBuffer2(&argbuf, &hgs, 0); buf->write(&argbuf); @@ -5507,7 +5507,7 @@ return buf->toChars(); } -void Argument::argsToCBuffer(OutBuffer *buf, HdrGenState *hgs, Arguments *arguments, int varargs) +void Parameter::argsToCBuffer(OutBuffer *buf, HdrGenState *hgs, Parameters *arguments, int varargs) { buf->writeByte('('); if (arguments) @@ -5515,11 +5515,11 @@ OutBuffer argbuf; for (i = 0; i < arguments->dim; i++) - { Argument *arg; + { Parameter *arg; if (i) buf->writestring(", "); - arg = (Argument *)arguments->data[i]; + arg = (Parameter *)arguments->data[i]; if (arg->storageClass & STCout) buf->writestring("out "); else if (arg->storageClass & STCref) @@ -5547,17 +5547,17 @@ } -void Argument::argsToDecoBuffer(OutBuffer *buf, Arguments *arguments, bool mangle) -{ - //printf("Argument::argsToDecoBuffer()\n"); +void Parameter::argsToDecoBuffer(OutBuffer *buf, Parameters *arguments, bool mangle) +{ + //printf("Parameter::argsToDecoBuffer()\n"); // Write argument types if (arguments) { - size_t dim = Argument::dim(arguments); + size_t dim = Parameter::dim(arguments); for (size_t i = 0; i < dim; i++) { - Argument *arg = Argument::getNth(arguments, i); + Parameter *arg = Parameter::getNth(arguments, i); arg->toDecoBuffer(buf, mangle); } } @@ -5569,7 +5569,7 @@ * If not, return NULL. */ -Type *Argument::isLazyArray() +Type *Parameter::isLazyArray() { // if (inout == Lazy) { @@ -5582,7 +5582,7 @@ TypeDelegate *td = (TypeDelegate *)tel; TypeFunction *tf = (TypeFunction *)td->next; - if (!tf->varargs && Argument::dim(tf->parameters) == 0) + if (!tf->varargs && Parameter::dim(tf->parameters) == 0) { return tf->next; // return type of delegate } @@ -5592,7 +5592,7 @@ return NULL; } -void Argument::toDecoBuffer(OutBuffer *buf, bool mangle) +void Parameter::toDecoBuffer(OutBuffer *buf, bool mangle) { switch (storageClass & (STCin | STCout | STCref | STClazy)) { case 0: @@ -5620,13 +5620,13 @@ * Determine number of arguments, folding in tuples. */ -size_t Argument::dim(Arguments *args) +size_t Parameter::dim(Parameters *args) { size_t n = 0; if (args) { for (size_t i = 0; i < args->dim; i++) - { Argument *arg = (Argument *)args->data[i]; + { Parameter *arg = (Parameter *)args->data[i]; Type *t = arg->type->toBasetype(); if (t->ty == Ttuple) @@ -5641,21 +5641,21 @@ } /*************************************** - * Get nth Argument, folding in tuples. + * Get nth Parameter, folding in tuples. * Returns: - * Argument* nth Argument + * Parameter* nth Parameter * NULL not found, *pn gets incremented by the number - * of Arguments + * of Parameters */ -Argument *Argument::getNth(Arguments *args, size_t nth, size_t *pn) +Parameter *Parameter::getNth(Parameters *args, size_t nth, size_t *pn) { if (!args) return NULL; size_t n = 0; for (size_t i = 0; i < args->dim; i++) - { Argument *arg = (Argument *)args->data[i]; + { Parameter *arg = (Parameter *)args->data[i]; Type *t = arg->type->toBasetype(); if (t->ty == Ttuple) diff -r 1b24e9c7cc26 -r 207a8a438dea dmd/mtype.h --- a/dmd/mtype.h Wed Jan 06 15:18:19 2010 -0300 +++ b/dmd/mtype.h Wed Jan 06 15:18:20 2010 -0300 @@ -44,7 +44,7 @@ struct TypeBasic; struct HdrGenState; -struct Argument; +struct Parameter; // Back end #if IN_GCC @@ -451,14 +451,14 @@ struct TypeFunction : Type { - Arguments *parameters; // function parameters + Parameters *parameters; // function parameters int varargs; // 1: T t, ...) style for variable number of arguments // 2: T t ...) style for variable number of arguments enum LINK linkage; // calling convention int inuse; - TypeFunction(Arguments *parameters, Type *treturn, int varargs, enum LINK linkage); + TypeFunction(Parameters *parameters, Type *treturn, int varargs, enum LINK linkage); Type *syntaxCopy(); Type *semantic(Loc loc, Scope *sc); void toDecoBuffer(OutBuffer *buf, bool mangle); @@ -718,9 +718,9 @@ struct TypeTuple : Type { - Arguments *arguments; // types making up the tuple + Parameters *arguments; // types making up the tuple - TypeTuple(Arguments *arguments); + TypeTuple(Parameters *arguments); TypeTuple(Expressions *exps); Type *syntaxCopy(); Type *semantic(Loc loc, Scope *sc); @@ -748,7 +748,7 @@ //enum InOut { None, In, Out, InOut, Lazy }; -struct Argument : Object +struct Parameter : Object { //enum InOut inout; StorageClass storageClass; @@ -756,18 +756,18 @@ Identifier *ident; Expression *defaultArg; - Argument(StorageClass storageClass, Type *type, Identifier *ident, Expression *defaultArg); - Argument *syntaxCopy(); + Parameter(StorageClass storageClass, Type *type, Identifier *ident, Expression *defaultArg); + Parameter *syntaxCopy(); Type *isLazyArray(); void toDecoBuffer(OutBuffer *buf, bool mangle); - static Arguments *arraySyntaxCopy(Arguments *args); - static char *argsTypesToChars(Arguments *args, int varargs); - static void argsCppMangle(OutBuffer *buf, CppMangleState *cms, Arguments *arguments, int varargs); - static void argsToCBuffer(OutBuffer *buf, HdrGenState *hgs, Arguments *arguments, int varargs); - static void argsToDecoBuffer(OutBuffer *buf, Arguments *arguments, bool mangle); - static int isTPL(Arguments *arguments); - static size_t dim(Arguments *arguments); - static Argument *getNth(Arguments *arguments, size_t nth, size_t *pn = NULL); + static Parameters *arraySyntaxCopy(Parameters *args); + static char *argsTypesToChars(Parameters *args, int varargs); + static void argsCppMangle(OutBuffer *buf, CppMangleState *cms, Parameters *arguments, int varargs); + static void argsToCBuffer(OutBuffer *buf, HdrGenState *hgs, Parameters *arguments, int varargs); + static void argsToDecoBuffer(OutBuffer *buf, Parameters *arguments, bool mangle); + static int isTPL(Parameters *arguments); + static size_t dim(Parameters *arguments); + static Parameter *getNth(Parameters *arguments, size_t nth, size_t *pn = NULL); }; extern int PTRSIZE; diff -r 1b24e9c7cc26 -r 207a8a438dea dmd/opover.c --- a/dmd/opover.c Wed Jan 06 15:18:19 2010 -0300 +++ b/dmd/opover.c Wed Jan 06 15:18:20 2010 -0300 @@ -31,8 +31,8 @@ #include "scope.h" static Expression *build_overload(Loc loc, Scope *sc, Expression *ethis, Expression *earg, Identifier *id); -static void inferApplyArgTypesX(Module* from, FuncDeclaration *fstart, Arguments *arguments); -static int inferApplyArgTypesY(TypeFunction *tf, Arguments *arguments); +static void inferApplyArgTypesX(Module* from, FuncDeclaration *fstart, Parameters *arguments); +static int inferApplyArgTypesY(TypeFunction *tf, Parameters *arguments); static void templateResolve(Match *m, TemplateDeclaration *td, Scope *sc, Loc loc, Objects *targsi, Expression *ethis, Expressions *arguments); /******************************** Expression **************************/ @@ -527,7 +527,7 @@ * them from the aggregate type. */ -void inferApplyArgTypes(enum TOK op, Arguments *arguments, Expression *aggr, Module* from) +void inferApplyArgTypes(enum TOK op, Parameters *arguments, Expression *aggr, Module* from) { if (!arguments || !arguments->dim) return; @@ -537,14 +537,14 @@ for (size_t u = 0; 1; u++) { if (u == arguments->dim) return; - Argument *arg = (Argument *)arguments->data[u]; + Parameter *arg = (Parameter *)arguments->data[u]; if (!arg->type) break; } AggregateDeclaration *ad; - Argument *arg = (Argument *)arguments->data[0]; + Parameter *arg = (Parameter *)arguments->data[0]; Type *taggr = aggr->type; if (!taggr) return; @@ -558,7 +558,7 @@ { if (!arg->type) arg->type = Type::tsize_t; // key type - arg = (Argument *)arguments->data[1]; + arg = (Parameter *)arguments->data[1]; } if (!arg->type && tab->ty != Ttuple) arg->type = tab->nextOf(); // value type @@ -571,7 +571,7 @@ { if (!arg->type) arg->type = taa->index; // key type - arg = (Argument *)arguments->data[1]; + arg = (Parameter *)arguments->data[1]; } if (!arg->type) arg->type = taa->next; // value type @@ -648,7 +648,7 @@ int fp3(void *param, FuncDeclaration *f) { - Arguments *arguments = (Arguments *)param; + Parameters *arguments = (Parameters *)param; TypeFunction *tf = (TypeFunction *)f->type; if (inferApplyArgTypesY(tf, arguments) == 1) return 0; @@ -657,13 +657,13 @@ return 0; } -static void inferApplyArgTypesX(Module* from, FuncDeclaration *fstart, Arguments *arguments) +static void inferApplyArgTypesX(Module* from, FuncDeclaration *fstart, Parameters *arguments) { overloadApply(from, fstart, &fp3, arguments); } #if 0 -static void inferApplyArgTypesX(FuncDeclaration *fstart, Arguments *arguments) +static void inferApplyArgTypesX(FuncDeclaration *fstart, Parameters *arguments) { Declaration *d; Declaration *next; @@ -714,13 +714,13 @@ * 1 no match for this function */ -static int inferApplyArgTypesY(TypeFunction *tf, Arguments *arguments) +static int inferApplyArgTypesY(TypeFunction *tf, Parameters *arguments) { size_t nparams; - Argument *p; + Parameter *p; - if (Argument::dim(tf->parameters) != 1) + if (Parameter::dim(tf->parameters) != 1) goto Lnomatch; - p = Argument::getNth(tf->parameters, 0); + p = Parameter::getNth(tf->parameters, 0); if (p->type->ty != Tdelegate) goto Lnomatch; tf = (TypeFunction *)p->type->nextOf(); @@ -729,7 +729,7 @@ /* We now have tf, the type of the delegate. Match it against * the arguments, filling in missing argument types. */ - nparams = Argument::dim(tf->parameters); + nparams = Parameter::dim(tf->parameters); if (nparams == 0 || tf->varargs) goto Lnomatch; // not enough parameters if (arguments->dim != nparams) @@ -737,8 +737,8 @@ for (size_t u = 0; u < nparams; u++) { - Argument *arg = (Argument *)arguments->data[u]; - Argument *param = Argument::getNth(tf->parameters, u); + Parameter *arg = (Parameter *)arguments->data[u]; + Parameter *param = Parameter::getNth(tf->parameters, u); if (arg->type) { if (!arg->type->equals(param->type)) { diff -r 1b24e9c7cc26 -r 207a8a438dea dmd/parse.c --- a/dmd/parse.c Wed Jan 06 15:18:19 2010 -0300 +++ b/dmd/parse.c Wed Jan 06 15:18:20 2010 -0300 @@ -788,7 +788,7 @@ Dsymbol *Parser::parseCtor() { CtorDeclaration *f; - Arguments *arguments; + Parameters *arguments; int varargs; Loc loc = this->loc; @@ -914,7 +914,7 @@ NewDeclaration *Parser::parseNew() { NewDeclaration *f; - Arguments *arguments; + Parameters *arguments; int varargs; Loc loc = this->loc; @@ -934,7 +934,7 @@ DeleteDeclaration *Parser::parseDelete() { DeleteDeclaration *f; - Arguments *arguments; + Parameters *arguments; int varargs; Loc loc = this->loc; @@ -951,9 +951,9 @@ * Parse parameter list. */ -Arguments *Parser::parseParameters(int *pvarargs) +Parameters *Parser::parseParameters(int *pvarargs) { - Arguments *arguments = new Arguments(); + Parameters *arguments = new Parameters(); int varargs = 0; int hasdefault = 0; @@ -962,7 +962,7 @@ { Type *tb; Identifier *ai = NULL; Type *at; - Argument *a; + Parameter *a; StorageClass storageClass = 0; Expression *ae; @@ -1021,12 +1021,12 @@ if (storageClass & (STCout | STCref)) error("variadic argument cannot be out or ref"); varargs = 2; - a = new Argument(storageClass, at, ai, ae); + a = new Parameter(storageClass, at, ai, ae); arguments->push(a); nextToken(); break; } - a = new Argument(storageClass, at, ai, ae); + a = new Parameter(storageClass, at, ai, ae); arguments->push(a); if (token.value == TOKcomma) { nextToken(); @@ -1950,7 +1950,7 @@ { // Handle delegate declaration: // t delegate(parameter list) // t function(parameter list) - Arguments *arguments; + Parameters *arguments; int varargs; enum TOK save = token.value; @@ -2058,7 +2058,7 @@ } #endif case TOKlparen: - { Arguments *arguments; + { Parameters *arguments; int varargs; if (tpl) @@ -3009,7 +3009,7 @@ case TOKforeach_reverse: { enum TOK op = token.value; - Arguments *arguments; + Parameters *arguments; Statement *d; Statement *body; @@ -3018,7 +3018,7 @@ nextToken(); check(TOKlparen); - arguments = new Arguments(); + arguments = new Parameters(); while (1) { @@ -3026,7 +3026,7 @@ Identifier *ai = NULL; Type *at; unsigned storageClass; - Argument *a; + Parameter *a; storageClass = STCin; if (token.value == TOKinout || token.value == TOKref) @@ -3048,7 +3048,7 @@ if (!ai) error("no identifier for declarator %s", at->toChars()); Larg: - a = new Argument(storageClass, at, ai, NULL); + a = new Parameter(storageClass, at, ai, NULL); arguments->push(a); if (token.value == TOKcomma) { nextToken(); @@ -3066,7 +3066,7 @@ } case TOKif: - { Argument *arg = NULL; + { Parameter *arg = NULL; Expression *condition; Statement *ifbody; Statement *elsebody; @@ -3082,7 +3082,7 @@ Token *t = peek(&token); if (t->value == TOKassign) { - arg = new Argument(STCin, NULL, token.ident, NULL); + arg = new Parameter(STCin, NULL, token.ident, NULL); nextToken(); nextToken(); } @@ -3105,7 +3105,7 @@ tb = parseBasicType(); at = parseDeclarator(tb, &ai); check(TOKassign); - arg = new Argument(STCin, at, ai, NULL); + arg = new Parameter(STCin, at, ai, NULL); } // Check for " ident;" @@ -3114,7 +3114,7 @@ Token *t = peek(&token); if (t->value == TOKcomma || t->value == TOKsemicolon) { - arg = new Argument(STCin, NULL, token.ident, NULL); + arg = new Parameter(STCin, NULL, token.ident, NULL); nextToken(); nextToken(); if (1 || !global.params.useDeprecated) @@ -4488,7 +4488,7 @@ /* function type(parameters) { body } * delegate type(parameters) { body } */ - Arguments *arguments; + Parameters *arguments; int varargs; FuncLiteralDeclaration *fd; Type *t; @@ -4497,7 +4497,7 @@ { t = NULL; varargs = 0; - arguments = new Arguments(); + arguments = new Parameters(); } else { diff -r 1b24e9c7cc26 -r 207a8a438dea dmd/parse.h --- a/dmd/parse.h Wed Jan 06 15:18:19 2010 -0300 +++ b/dmd/parse.h Wed Jan 06 15:18:20 2010 -0300 @@ -93,7 +93,7 @@ UnitTestDeclaration *parseUnitTest(); NewDeclaration *parseNew(); DeleteDeclaration *parseDelete(); - Arguments *parseParameters(int *pvarargs); + Parameters *parseParameters(int *pvarargs); EnumDeclaration *parseEnum(); Dsymbol *parseAggregate(); BaseClasses *parseBaseClasses(); diff -r 1b24e9c7cc26 -r 207a8a438dea dmd/statement.c --- a/dmd/statement.c Wed Jan 06 15:18:19 2010 -0300 +++ b/dmd/statement.c Wed Jan 06 15:18:20 2010 -0300 @@ -1254,7 +1254,7 @@ /******************************** ForeachStatement ***************************/ -ForeachStatement::ForeachStatement(Loc loc, enum TOK op, Arguments *arguments, +ForeachStatement::ForeachStatement(Loc loc, enum TOK op, Parameters *arguments, Expression *aggr, Statement *body) : Statement(loc) { @@ -1271,7 +1271,7 @@ Statement *ForeachStatement::syntaxCopy() { - Arguments *args = Argument::arraySyntaxCopy(arguments); + Parameters *args = Parameter::arraySyntaxCopy(arguments); Expression *exp = aggr->syntaxCopy(); ForeachStatement *s = new ForeachStatement(loc, op, args, exp, body ? body->syntaxCopy() : NULL); @@ -1334,7 +1334,7 @@ } else if (aggr->op == TOKtype) // type tuple { - n = Argument::dim(tuple->arguments); + n = Parameter::dim(tuple->arguments); } else assert(0); @@ -1345,8 +1345,8 @@ if (te) e = (Expression *)te->exps->data[k]; else - t = Argument::getNth(tuple->arguments, k)->type; - Argument *arg = (Argument *)arguments->data[0]; + t = Parameter::getNth(tuple->arguments, k)->type; + Parameter *arg = (Parameter *)arguments->data[0]; Statements *st = new Statements(); if (dim == 2) @@ -1369,7 +1369,7 @@ var->storage_class |= STCconst; DeclarationExp *de = new DeclarationExp(loc, var); st->push(new ExpStatement(loc, de)); - arg = (Argument *)arguments->data[1]; // value + arg = (Parameter *)arguments->data[1]; // value } // Declare value if (arg->storageClass & (STCout | STCref | STClazy)) @@ -1410,7 +1410,7 @@ } for (size_t i = 0; i < dim; i++) - { Argument *arg = (Argument *)arguments->data[i]; + { Parameter *arg = (Parameter *)arguments->data[i]; if (!arg->type) { error("cannot infer type for %s", arg->ident->toChars()); @@ -1439,10 +1439,10 @@ */ tn = tab->nextOf()->toBasetype(); if (tn->ty == Tchar || tn->ty == Twchar || tn->ty == Tdchar) - { Argument *arg; + { Parameter *arg; int i = (dim == 1) ? 0 : 1; // index of value - arg = (Argument *)arguments->data[i]; + arg = (Parameter *)arguments->data[i]; arg->type = arg->type->semantic(loc, sc); tnv = arg->type->toBasetype(); if (tnv->ty != tn->ty && @@ -1451,7 +1451,7 @@ if (arg->storageClass & STCref) error("foreach: value of UTF conversion cannot be ref"); if (dim == 2) - { arg = (Argument *)arguments->data[0]; + { arg = (Parameter *)arguments->data[0]; if (arg->storageClass & STCref) error("foreach: key cannot be ref"); } @@ -1461,7 +1461,7 @@ for (size_t i = 0; i < dim; i++) { // Declare args - Argument *arg = (Argument *)arguments->data[i]; + Parameter *arg = (Parameter *)arguments->data[i]; Type *argtype = arg->type->semantic(loc, sc); VarDeclaration *var; @@ -1639,7 +1639,7 @@ e = new VarExp(loc, r); Expression *einit = new DotIdExp(loc, e, idhead); // einit = einit->semantic(sc); - Argument *arg = (Argument *)arguments->data[0]; + Parameter *arg = (Parameter *)arguments->data[0]; VarDeclaration *ve = new VarDeclaration(loc, arg->type, arg->ident, new ExpInitializer(loc, einit)); ve->storage_class |= STCforeach; ve->storage_class |= arg->storageClass & (STCin | STCout | STCref | STC_TYPECTOR); @@ -1663,11 +1663,11 @@ case Tdelegate: Lapply: { FuncDeclaration *fdapply; - Arguments *args; + Parameters *args; Expression *ec; Expression *e; FuncLiteralDeclaration *fld; - Argument *a; + Parameter *a; Type *t; Expression *flde; Identifier *id; @@ -1694,9 +1694,9 @@ /* Turn body into the function literal: * int delegate(ref T arg) { body } */ - args = new Arguments(); + args = new Parameters(); for (size_t i = 0; i < dim; i++) - { Argument *arg = (Argument *)arguments->data[i]; + { Parameter *arg = (Parameter *)arguments->data[i]; arg->type = arg->type->semantic(loc, sc); if (arg->storageClass & STCref) @@ -1714,7 +1714,7 @@ s = new DeclarationStatement(0, v); body = new CompoundStatement(loc, s, body); } - a = new Argument(STCref, arg->type, id, NULL); + a = new Parameter(STCref, arg->type, id, NULL); args->push(a); } t = new TypeFunction(args, Type::tint32, 0, LINKd); @@ -1739,14 +1739,14 @@ if (tab->ty == Taarray) { // Check types - Argument *arg = (Argument *)arguments->data[0]; + Parameter *arg = (Parameter *)arguments->data[0]; if (dim == 2) { if (arg->storageClass & STCref) error("foreach: index cannot be ref"); if (!arg->type->equals(taa->index)) error("foreach: index must be type %s, not %s", taa->index->toChars(), arg->type->toChars()); - arg = (Argument *)arguments->data[1]; + arg = (Parameter *)arguments->data[1]; } if (!arg->type->equals(taa->nextOf())) error("foreach: value must be type %s, not %s", taa->nextOf()->toChars(), arg->type->toChars()); @@ -1758,26 +1758,26 @@ static FuncDeclaration *aaApply2_fd = NULL; static TypeDelegate* aaApply2_dg; if(!aaApply2_fd) { - Arguments* args = new Arguments; - args->push(new Argument(STCin, Type::tvoid->pointerTo(), NULL, NULL)); - args->push(new Argument(STCin, Type::tsize_t, NULL, NULL)); - Arguments* dgargs = new Arguments; - dgargs->push(new Argument(STCin, Type::tvoidptr, NULL, NULL)); - dgargs->push(new Argument(STCin, Type::tvoidptr, NULL, NULL)); + Parameters* args = new Parameters; + args->push(new Parameter(STCin, Type::tvoid->pointerTo(), NULL, NULL)); + args->push(new Parameter(STCin, Type::tsize_t, NULL, NULL)); + Parameters* dgargs = new Parameters; + dgargs->push(new Parameter(STCin, Type::tvoidptr, NULL, NULL)); + dgargs->push(new Parameter(STCin, Type::tvoidptr, NULL, NULL)); aaApply2_dg = new TypeDelegate(new TypeFunction(dgargs, Type::tindex, 0, LINKd)); - args->push(new Argument(STCin, aaApply2_dg, NULL, NULL)); + args->push(new Parameter(STCin, aaApply2_dg, NULL, NULL)); aaApply2_fd = FuncDeclaration::genCfunc(args, Type::tindex, "_aaApply2"); } static FuncDeclaration *aaApply_fd = NULL; static TypeDelegate* aaApply_dg; if(!aaApply_fd) { - Arguments* args = new Arguments; - args->push(new Argument(STCin, Type::tvoid->pointerTo(), NULL, NULL)); - args->push(new Argument(STCin, Type::tsize_t, NULL, NULL)); - Arguments* dgargs = new Arguments; - dgargs->push(new Argument(STCin, Type::tvoidptr, NULL, NULL)); + Parameters* args = new Parameters; + args->push(new Parameter(STCin, Type::tvoid->pointerTo(), NULL, NULL)); + args->push(new Parameter(STCin, Type::tsize_t, NULL, NULL)); + Parameters* dgargs = new Parameters; + dgargs->push(new Parameter(STCin, Type::tvoidptr, NULL, NULL)); aaApply_dg = new TypeDelegate(new TypeFunction(dgargs, Type::tindex, 0, LINKd)); - args->push(new Argument(STCin, aaApply_dg, NULL, NULL)); + args->push(new Parameter(STCin, aaApply_dg, NULL, NULL)); aaApply_fd = FuncDeclaration::genCfunc(args, Type::tindex, "_aaApply"); } if (dim == 2) { @@ -1839,20 +1839,20 @@ #endif assert(j < sizeof(fdname)); //LDC: Build arguments. - Arguments* args = new Arguments; - args->push(new Argument(STCin, tn->arrayOf(), NULL, NULL)); + Parameters* args = new Parameters; + args->push(new Parameter(STCin, tn->arrayOf(), NULL, NULL)); if (dim == 2) { - Arguments* dgargs = new Arguments; - dgargs->push(new Argument(STCin, Type::tvoidptr, NULL, NULL)); - dgargs->push(new Argument(STCin, Type::tvoidptr, NULL, NULL)); + Parameters* dgargs = new Parameters; + dgargs->push(new Parameter(STCin, Type::tvoidptr, NULL, NULL)); + dgargs->push(new Parameter(STCin, Type::tvoidptr, NULL, NULL)); dgty = new TypeDelegate(new TypeFunction(dgargs, Type::tindex, 0, LINKd)); - args->push(new Argument(STCin, dgty, NULL, NULL)); + args->push(new Parameter(STCin, dgty, NULL, NULL)); fdapply = FuncDeclaration::genCfunc(args, Type::tindex, fdname); } else { - Arguments* dgargs = new Arguments; - dgargs->push(new Argument(STCin, Type::tvoidptr, NULL, NULL)); + Parameters* dgargs = new Parameters; + dgargs->push(new Parameter(STCin, Type::tvoidptr, NULL, NULL)); dgty = new TypeDelegate(new TypeFunction(dgargs, Type::tindex, 0, LINKd)); - args->push(new Argument(STCin, dgty, NULL, NULL)); + args->push(new Parameter(STCin, dgty, NULL, NULL)); fdapply = FuncDeclaration::genCfunc(args, Type::tindex, fdname); } @@ -1980,7 +1980,7 @@ buf->writestring(" ("); for (int i = 0; i < arguments->dim; i++) { - Argument *a = (Argument *)arguments->data[i]; + Parameter *a = (Parameter *)arguments->data[i]; if (i) buf->writestring(", "); if (a->storageClass & STCref) @@ -2007,7 +2007,7 @@ #if DMDV2 -ForeachRangeStatement::ForeachRangeStatement(Loc loc, enum TOK op, Argument *arg, +ForeachRangeStatement::ForeachRangeStatement(Loc loc, enum TOK op, Parameter *arg, Expression *lwr, Expression *upr, Statement *body) : Statement(loc) { @@ -2215,7 +2215,7 @@ /******************************** IfStatement ***************************/ -IfStatement::IfStatement(Loc loc, Argument *arg, Expression *condition, Statement *ifbody, Statement *elsebody) +IfStatement::IfStatement(Loc loc, Parameter *arg, Expression *condition, Statement *ifbody, Statement *elsebody) : Statement(loc) { this->arg = arg; @@ -2235,7 +2235,7 @@ if (elsebody) e = elsebody->syntaxCopy(); - Argument *a = arg ? arg->syntaxCopy() : NULL; + Parameter *a = arg ? arg->syntaxCopy() : NULL; IfStatement *s = new IfStatement(loc, a, condition->syntaxCopy(), i, e); return s; } diff -r 1b24e9c7cc26 -r 207a8a438dea dmd/statement.h --- a/dmd/statement.h Wed Jan 06 15:18:19 2010 -0300 +++ b/dmd/statement.h Wed Jan 06 15:18:20 2010 -0300 @@ -38,7 +38,7 @@ struct InlineScanState; struct ReturnStatement; struct CompoundStatement; -struct Argument; +struct Parameter; struct StaticAssert; struct AsmStatement; struct AsmBlockStatement; @@ -354,7 +354,7 @@ struct ForeachStatement : Statement { enum TOK op; // TOKforeach or TOKforeach_reverse - Arguments *arguments; // array of Argument*'s + Parameters *arguments; // array of Parameter*'s Expression *aggr; Statement *body; @@ -366,7 +366,7 @@ Array cases; // put breaks, continues, gotos and returns here Array gotos; // forward referenced goto's go here - ForeachStatement(Loc loc, enum TOK op, Arguments *arguments, Expression *aggr, Statement *body); + ForeachStatement(Loc loc, enum TOK op, Parameters *arguments, Expression *aggr, Statement *body); Statement *syntaxCopy(); Statement *semantic(Scope *sc); int hasBreak(); @@ -386,14 +386,14 @@ struct ForeachRangeStatement : Statement { enum TOK op; // TOKforeach or TOKforeach_reverse - Argument *arg; // loop index variable + Parameter *arg; // loop index variable Expression *lwr; Expression *upr; Statement *body; VarDeclaration *key; - ForeachRangeStatement(Loc loc, enum TOK op, Argument *arg, + ForeachRangeStatement(Loc loc, enum TOK op, Parameter *arg, Expression *lwr, Expression *upr, Statement *body); Statement *syntaxCopy(); Statement *semantic(Scope *sc); @@ -413,14 +413,14 @@ struct IfStatement : Statement { - Argument *arg; + Parameter *arg; Expression *condition; Statement *ifbody; Statement *elsebody; VarDeclaration *match; // for MatchExpression results - IfStatement(Loc loc, Argument *arg, Expression *condition, Statement *ifbody, Statement *elsebody); + IfStatement(Loc loc, Parameter *arg, Expression *condition, Statement *ifbody, Statement *elsebody); Statement *syntaxCopy(); Statement *semantic(Scope *sc); Expression *interpret(InterState *istate); diff -r 1b24e9c7cc26 -r 207a8a438dea dmd/struct.c --- a/dmd/struct.c Wed Jan 06 15:18:19 2010 -0300 +++ b/dmd/struct.c Wed Jan 06 15:18:20 2010 -0300 @@ -330,8 +330,8 @@ TypeFunction *tfeqptr; { - Arguments *arguments = new Arguments; - Argument *arg = new Argument(STCin, handle, Id::p, NULL); + Parameters *arguments = new Parameters; + Parameter *arg = new Parameter(STCin, handle, Id::p, NULL); arguments->push(arg); tfeqptr = new TypeFunction(arguments, Type::tint32, 0, LINKd); @@ -340,8 +340,8 @@ TypeFunction *tfeq; { - Arguments *arguments = new Arguments; - Argument *arg = new Argument(STCin, type, NULL, NULL); + Parameters *arguments = new Parameters; + Parameter *arg = new Parameter(STCin, type, NULL, NULL); arguments->push(arg); tfeq = new TypeFunction(arguments, Type::tint32, 0, LINKd); diff -r 1b24e9c7cc26 -r 207a8a438dea dmd/template.c --- a/dmd/template.c Wed Jan 06 15:18:19 2010 -0300 +++ b/dmd/template.c Wed Jan 06 15:18:20 2010 -0300 @@ -847,7 +847,7 @@ assert(fd->type->ty == Tfunction); fdtype = (TypeFunction *)fd->type; - nfparams = Argument::dim(fdtype->parameters); // number of function parameters + nfparams = Parameter::dim(fdtype->parameters); // number of function parameters nfargs = fargs ? fargs->dim : 0; // number of function arguments /* Check for match of function arguments with variadic template @@ -877,7 +877,7 @@ */ for (fptupindex = 0; fptupindex < nfparams; fptupindex++) { - Argument *fparam = (Argument *)fdtype->parameters->data[fptupindex]; + Parameter *fparam = (Parameter *)fdtype->parameters->data[fptupindex]; if (fparam->type->ty != Tident) continue; TypeIdentifier *tid = (TypeIdentifier *)fparam->type; @@ -951,7 +951,7 @@ continue; } - Argument *fparam = Argument::getNth(fdtype->parameters, i); + Parameter *fparam = Parameter::getNth(fdtype->parameters, i); if (i >= nfargs) // if not enough arguments { @@ -996,7 +996,7 @@ TypeDelegate *td = (TypeDelegate *)fparam->type->toBasetype(); TypeFunction *tf = (TypeFunction *)td->next; - if (!tf->varargs && Argument::dim(tf->parameters) == 0) + if (!tf->varargs && Parameter::dim(tf->parameters) == 0) { m = farg->type->deduceType(paramscope, tf->next, parameters, &dedtypes); if (!m && tf->next->toBasetype()->ty == Tvoid) @@ -1744,8 +1744,8 @@ linkage != tp->linkage) return MATCHnomatch; - size_t nfargs = Argument::dim(this->parameters); - size_t nfparams = Argument::dim(tp->parameters); + size_t nfargs = Parameter::dim(this->parameters); + size_t nfparams = Parameter::dim(tp->parameters); /* See if tuple match */ @@ -1754,7 +1754,7 @@ /* See if 'A' of the template parameter matches 'A' * of the type of the last function parameter. */ - Argument *fparam = Argument::getNth(tp->parameters, nfparams - 1); + Parameter *fparam = Parameter::getNth(tp->parameters, nfparams - 1); if (fparam->type->ty != Tident) goto L1; TypeIdentifier *tid = (TypeIdentifier *)fparam->type; @@ -1787,7 +1787,7 @@ if (!t || t->objects.dim != tuple_dim) return MATCHnomatch; for (size_t i = 0; i < tuple_dim; i++) - { Argument *arg = Argument::getNth(this->parameters, nfparams - 1 + i); + { Parameter *arg = Parameter::getNth(this->parameters, nfparams - 1 + i); if (!arg->type->equals((Object *)t->objects.data[i])) return MATCHnomatch; } @@ -1797,7 +1797,7 @@ Tuple *t = new Tuple(); t->objects.setDim(tuple_dim); for (size_t i = 0; i < tuple_dim; i++) - { Argument *arg = Argument::getNth(this->parameters, nfparams - 1 + i); + { Parameter *arg = Parameter::getNth(this->parameters, nfparams - 1 + i); t->objects.data[i] = (void *)arg->type; } dedtypes->data[tupi] = (void *)t; @@ -1812,8 +1812,8 @@ L2: for (size_t i = 0; i < nfparams; i++) { - Argument *a = Argument::getNth(this->parameters, i); - Argument *ap = Argument::getNth(tp->parameters, i); + Parameter *a = Parameter::getNth(this->parameters, i); + Parameter *ap = Parameter::getNth(tp->parameters, i); if (a->storageClass != ap->storageClass || !a->type->deduceType(sc, ap->type, parameters, dedtypes)) return MATCHnomatch; @@ -2406,7 +2406,7 @@ printf("\tSpecialization: %s\n", specType->toChars()); if (defaultType) printf("\tDefault: %s\n", defaultType->toChars()); - printf("\tArgument: %s\n", t ? t->toChars() : "NULL"); + printf("\tParameter: %s\n", t ? t->toChars() : "NULL"); printf("\tDeduced Type: %s\n", ta->toChars()); } @@ -2622,7 +2622,7 @@ Dsymbol *sa = isDsymbol(oded); assert(sa); - printf("\tArgument alias: %s\n", sa->toChars()); + printf("\tParameter alias: %s\n", sa->toChars()); } void TemplateAliasParameter::toCBuffer(OutBuffer *buf, HdrGenState *hgs) @@ -2866,7 +2866,7 @@ if (specValue) printf("\tSpecialization: %s\n", specValue->toChars()); - printf("\tArgument Value: %s\n", ea ? ea->toChars() : "NULL"); + printf("\tParameter Value: %s\n", ea ? ea->toChars() : "NULL"); } @@ -3580,7 +3580,7 @@ if (dim) { tiargs->reserve(dim); for (size_t i = 0; i < dim; i++) - { Argument *arg = (Argument *)tt->arguments->data[i]; + { Parameter *arg = (Parameter *)tt->arguments->data[i]; tiargs->insert(j + i, arg->type); } } diff -r 1b24e9c7cc26 -r 207a8a438dea gen/functions.cpp --- a/gen/functions.cpp Wed Jan 06 15:18:19 2010 -0300 +++ b/gen/functions.cpp Wed Jan 06 15:18:20 2010 -0300 @@ -116,7 +116,7 @@ } // if this _Dmain() doesn't have an argument, we force it to have one - int nargs = Argument::dim(f->parameters); + int nargs = Parameter::dim(f->parameters); if (ismain && nargs == 0) { @@ -128,7 +128,7 @@ else for (int i = 0; i < nargs; i++) { // get argument - Argument* arg = Argument::getNth(f->parameters, i); + Parameter* arg = Parameter::getNth(f->parameters, i); // reference semantics? ref, out and static arrays are bool byref = (arg->storageClass & (STCref|STCout)) || (arg->type->toBasetype()->ty == Tsarray); @@ -381,12 +381,12 @@ #undef ADD_PA // set attrs on the rest of the arguments - size_t n = Argument::dim(f->parameters); + size_t n = Parameter::dim(f->parameters); LLSmallVector attrptr(n, 0); for (size_t k = 0; k < n; ++k) { - Argument* fnarg = Argument::getNth(f->parameters, k); + Parameter* fnarg = Parameter::getNth(f->parameters, k); assert(fnarg); attrptr[k] = f->fty.args[k]->attrs; @@ -862,7 +862,7 @@ ////////////////////////////////////////////////////////////////////////////////////////// -DValue* DtoArgument(Argument* fnarg, Expression* argexp) +DValue* DtoArgument(Parameter* fnarg, Expression* argexp) { Logger::println("DtoArgument"); LOG_SCOPE; diff -r 1b24e9c7cc26 -r 207a8a438dea gen/functions.h --- a/gen/functions.h Wed Jan 06 15:18:19 2010 -0300 +++ b/gen/functions.h Wed Jan 06 15:18:20 2010 -0300 @@ -25,7 +25,7 @@ void DtoDefineNakedFunction(FuncDeclaration* fd); void emitABIReturnAsmStmt(IRAsmBlock* asmblock, Loc loc, FuncDeclaration* fdecl); -DValue* DtoArgument(Argument* fnarg, Expression* argexp); +DValue* DtoArgument(Parameter* fnarg, Expression* argexp); void DtoVariadicArgument(Expression* argexp, llvm::Value* dst); #endif diff -r 1b24e9c7cc26 -r 207a8a438dea gen/tocall.cpp --- a/gen/tocall.cpp Wed Jan 06 15:18:19 2010 -0300 +++ b/gen/tocall.cpp Wed Jan 06 15:18:20 2010 -0300 @@ -128,7 +128,7 @@ std::vector vtypes; // number of non variadic args - int begin = Argument::dim(tf->parameters); + int begin = Parameter::dim(tf->parameters); Logger::println("num non vararg params = %d", begin); // get n args in arguments list @@ -232,7 +232,7 @@ // pass non variadic args for (int i=0; iparameters, i); + Parameter* fnarg = Parameter::getNth(tf->parameters, i); DValue* argval = DtoArgument(fnarg, (Expression*)arguments->data[i]); args.push_back(argval->getRVal()); @@ -420,7 +420,7 @@ //Logger::cout() << "LLVM functype: " << *callable->getType() << '\n'; } - size_t n = Argument::dim(tf->parameters); + size_t n = Parameter::dim(tf->parameters); LLSmallVector attrptr(n, 0); @@ -428,7 +428,7 @@ int beg = argiter-argbegin; for (int i=0; iparameters, i); + Parameter* fnarg = Parameter::getNth(tf->parameters, i); assert(fnarg); DValue* argval = DtoArgument(fnarg, (Expression*)arguments->data[i]); @@ -504,7 +504,7 @@ { for (int i=n; iparameters, i); + Parameter* fnarg = Parameter::getNth(tf->parameters, i); DValue* argval = DtoArgument(fnarg, (Expression*)arguments->data[i]); LLValue* arg = argval->getRVal(); diff -r 1b24e9c7cc26 -r 207a8a438dea gen/typinf.cpp --- a/gen/typinf.cpp Wed Jan 06 15:18:19 2010 -0300 +++ b/gen/typinf.cpp Wed Jan 06 15:18:20 2010 -0300 @@ -617,8 +617,8 @@ TypeFunction *tfeqptr; { Scope sc; - Arguments *arguments = new Arguments; - Argument *arg = new Argument(STCin, tc->pointerTo(), NULL, NULL); + Parameters *arguments = new Parameters; + Parameter *arg = new Parameter(STCin, tc->pointerTo(), NULL, NULL); arguments->push(arg); tfeqptr = new TypeFunction(arguments, Type::tint32, 0, LINKd); tfeqptr = (TypeFunction *)tfeqptr->semantic(0, &sc); @@ -732,7 +732,7 @@ for (size_t i = 0; i < dim; i++) { - Argument *arg = (Argument *)tu->arguments->data[i]; + Parameter *arg = (Parameter *)tu->arguments->data[i]; arrInits.push_back(DtoTypeInfoOf(arg->type, true)); }