Mercurial > projects > ldc
comparison dmd/mtype.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 | def7a1d494fd |
children | 081c48283153 |
comparison
equal
deleted
inserted
replaced
1606:1b24e9c7cc26 | 1607:207a8a438dea |
---|---|
1592 Expressions *arguments; | 1592 Expressions *arguments; |
1593 | 1593 |
1594 //LDC: Build arguments. | 1594 //LDC: Build arguments. |
1595 static FuncDeclaration *adReverseChar_fd = NULL; | 1595 static FuncDeclaration *adReverseChar_fd = NULL; |
1596 if(!adReverseChar_fd) { | 1596 if(!adReverseChar_fd) { |
1597 Arguments* args = new Arguments; | 1597 Parameters* args = new Parameters; |
1598 Type* arrty = Type::tchar->arrayOf(); | 1598 Type* arrty = Type::tchar->arrayOf(); |
1599 args->push(new Argument(STCin, arrty, NULL, NULL)); | 1599 args->push(new Parameter(STCin, arrty, NULL, NULL)); |
1600 adReverseChar_fd = FuncDeclaration::genCfunc(args, arrty, "_adReverseChar"); | 1600 adReverseChar_fd = FuncDeclaration::genCfunc(args, arrty, "_adReverseChar"); |
1601 } | 1601 } |
1602 static FuncDeclaration *adReverseWchar_fd = NULL; | 1602 static FuncDeclaration *adReverseWchar_fd = NULL; |
1603 if(!adReverseWchar_fd) { | 1603 if(!adReverseWchar_fd) { |
1604 Arguments* args = new Arguments; | 1604 Parameters* args = new Parameters; |
1605 Type* arrty = Type::twchar->arrayOf(); | 1605 Type* arrty = Type::twchar->arrayOf(); |
1606 args->push(new Argument(STCin, arrty, NULL, NULL)); | 1606 args->push(new Parameter(STCin, arrty, NULL, NULL)); |
1607 adReverseWchar_fd = FuncDeclaration::genCfunc(args, arrty, "_adReverseWchar"); | 1607 adReverseWchar_fd = FuncDeclaration::genCfunc(args, arrty, "_adReverseWchar"); |
1608 } | 1608 } |
1609 | 1609 |
1610 if(n->ty == Twchar) | 1610 if(n->ty == Twchar) |
1611 ec = new VarExp(0, adReverseWchar_fd); | 1611 ec = new VarExp(0, adReverseWchar_fd); |
1623 Expressions *arguments; | 1623 Expressions *arguments; |
1624 | 1624 |
1625 //LDC: Build arguments. | 1625 //LDC: Build arguments. |
1626 static FuncDeclaration *adSortChar_fd = NULL; | 1626 static FuncDeclaration *adSortChar_fd = NULL; |
1627 if(!adSortChar_fd) { | 1627 if(!adSortChar_fd) { |
1628 Arguments* args = new Arguments; | 1628 Parameters* args = new Parameters; |
1629 Type* arrty = Type::tchar->arrayOf(); | 1629 Type* arrty = Type::tchar->arrayOf(); |
1630 args->push(new Argument(STCin, arrty, NULL, NULL)); | 1630 args->push(new Parameter(STCin, arrty, NULL, NULL)); |
1631 adSortChar_fd = FuncDeclaration::genCfunc(args, arrty, "_adSortChar"); | 1631 adSortChar_fd = FuncDeclaration::genCfunc(args, arrty, "_adSortChar"); |
1632 } | 1632 } |
1633 static FuncDeclaration *adSortWchar_fd = NULL; | 1633 static FuncDeclaration *adSortWchar_fd = NULL; |
1634 if(!adSortWchar_fd) { | 1634 if(!adSortWchar_fd) { |
1635 Arguments* args = new Arguments; | 1635 Parameters* args = new Parameters; |
1636 Type* arrty = Type::twchar->arrayOf(); | 1636 Type* arrty = Type::twchar->arrayOf(); |
1637 args->push(new Argument(STCin, arrty, NULL, NULL)); | 1637 args->push(new Parameter(STCin, arrty, NULL, NULL)); |
1638 adSortWchar_fd = FuncDeclaration::genCfunc(args, arrty, "_adSortWchar"); | 1638 adSortWchar_fd = FuncDeclaration::genCfunc(args, arrty, "_adSortWchar"); |
1639 } | 1639 } |
1640 | 1640 |
1641 if(n->ty == Twchar) | 1641 if(n->ty == Twchar) |
1642 ec = new VarExp(0, adSortWchar_fd); | 1642 ec = new VarExp(0, adSortWchar_fd); |
1658 assert(size); | 1658 assert(size); |
1659 dup = (ident == Id::dup); | 1659 dup = (ident == Id::dup); |
1660 //LDC: Build arguments. | 1660 //LDC: Build arguments. |
1661 static FuncDeclaration *adDup_fd = NULL; | 1661 static FuncDeclaration *adDup_fd = NULL; |
1662 if(!adDup_fd) { | 1662 if(!adDup_fd) { |
1663 Arguments* args = new Arguments; | 1663 Parameters* args = new Parameters; |
1664 args->push(new Argument(STCin, Type::typeinfo->type, NULL, NULL)); | 1664 args->push(new Parameter(STCin, Type::typeinfo->type, NULL, NULL)); |
1665 args->push(new Argument(STCin, Type::tvoid->arrayOf(), NULL, NULL)); | 1665 args->push(new Parameter(STCin, Type::tvoid->arrayOf(), NULL, NULL)); |
1666 adDup_fd = FuncDeclaration::genCfunc(args, Type::tvoid->arrayOf(), Id::adDup); | 1666 adDup_fd = FuncDeclaration::genCfunc(args, Type::tvoid->arrayOf(), Id::adDup); |
1667 } | 1667 } |
1668 static FuncDeclaration *adReverse_fd = NULL; | 1668 static FuncDeclaration *adReverse_fd = NULL; |
1669 if(!adReverse_fd) { | 1669 if(!adReverse_fd) { |
1670 Arguments* args = new Arguments; | 1670 Parameters* args = new Parameters; |
1671 args->push(new Argument(STCin, Type::tvoid->arrayOf(), NULL, NULL)); | 1671 args->push(new Parameter(STCin, Type::tvoid->arrayOf(), NULL, NULL)); |
1672 args->push(new Argument(STCin, Type::tsize_t, NULL, NULL)); | 1672 args->push(new Parameter(STCin, Type::tsize_t, NULL, NULL)); |
1673 adReverse_fd = FuncDeclaration::genCfunc(args, Type::tvoid->arrayOf(), Id::adReverse); | 1673 adReverse_fd = FuncDeclaration::genCfunc(args, Type::tvoid->arrayOf(), Id::adReverse); |
1674 } | 1674 } |
1675 | 1675 |
1676 if(dup) | 1676 if(dup) |
1677 ec = new VarExp(0, adDup_fd); | 1677 ec = new VarExp(0, adDup_fd); |
1701 bool isBit = (n->ty == Tbit); | 1701 bool isBit = (n->ty == Tbit); |
1702 | 1702 |
1703 //LDC: Build arguments. | 1703 //LDC: Build arguments. |
1704 static FuncDeclaration *adSort_fd = NULL; | 1704 static FuncDeclaration *adSort_fd = NULL; |
1705 if(!adSort_fd) { | 1705 if(!adSort_fd) { |
1706 Arguments* args = new Arguments; | 1706 Parameters* args = new Parameters; |
1707 args->push(new Argument(STCin, Type::tvoid->arrayOf(), NULL, NULL)); | 1707 args->push(new Parameter(STCin, Type::tvoid->arrayOf(), NULL, NULL)); |
1708 args->push(new Argument(STCin, Type::typeinfo->type, NULL, NULL)); | 1708 args->push(new Parameter(STCin, Type::typeinfo->type, NULL, NULL)); |
1709 adSort_fd = FuncDeclaration::genCfunc(args, Type::tvoid->arrayOf(), "_adSort"); | 1709 adSort_fd = FuncDeclaration::genCfunc(args, Type::tvoid->arrayOf(), "_adSort"); |
1710 } | 1710 } |
1711 static FuncDeclaration *adSortBit_fd = NULL; | 1711 static FuncDeclaration *adSortBit_fd = NULL; |
1712 if(!adSortBit_fd) { | 1712 if(!adSortBit_fd) { |
1713 Arguments* args = new Arguments; | 1713 Parameters* args = new Parameters; |
1714 args->push(new Argument(STCin, Type::tvoid->arrayOf(), NULL, NULL)); | 1714 args->push(new Parameter(STCin, Type::tvoid->arrayOf(), NULL, NULL)); |
1715 args->push(new Argument(STCin, Type::typeinfo->type, NULL, NULL)); | 1715 args->push(new Parameter(STCin, Type::typeinfo->type, NULL, NULL)); |
1716 adSortBit_fd = FuncDeclaration::genCfunc(args, Type::tvoid->arrayOf(), "_adSortBit"); | 1716 adSortBit_fd = FuncDeclaration::genCfunc(args, Type::tvoid->arrayOf(), "_adSortBit"); |
1717 } | 1717 } |
1718 | 1718 |
1719 if(isBit) | 1719 if(isBit) |
1720 ec = new VarExp(0, adSortBit_fd); | 1720 ec = new VarExp(0, adSortBit_fd); |
1979 | 1979 |
1980 if (d >= tt->arguments->dim) | 1980 if (d >= tt->arguments->dim) |
1981 { error(loc, "tuple index %ju exceeds %u", d, tt->arguments->dim); | 1981 { error(loc, "tuple index %ju exceeds %u", d, tt->arguments->dim); |
1982 return Type::terror; | 1982 return Type::terror; |
1983 } | 1983 } |
1984 Argument *arg = (Argument *)tt->arguments->data[(size_t)d]; | 1984 Parameter *arg = (Parameter *)tt->arguments->data[(size_t)d]; |
1985 return arg->type; | 1985 return arg->type; |
1986 } | 1986 } |
1987 case Tfunction: | 1987 case Tfunction: |
1988 case Tnone: | 1988 case Tnone: |
1989 error(loc, "can't have array of %s", tbn->toChars()); | 1989 error(loc, "can't have array of %s", tbn->toChars()); |
2399 Expressions *arguments; | 2399 Expressions *arguments; |
2400 | 2400 |
2401 //LDC: Build arguments. | 2401 //LDC: Build arguments. |
2402 static FuncDeclaration *aaLen_fd = NULL; | 2402 static FuncDeclaration *aaLen_fd = NULL; |
2403 if(!aaLen_fd) { | 2403 if(!aaLen_fd) { |
2404 Arguments* args = new Arguments; | 2404 Parameters* args = new Parameters; |
2405 args->push(new Argument(STCin, Type::tvoid->pointerTo(), NULL, NULL)); | 2405 args->push(new Parameter(STCin, Type::tvoid->pointerTo(), NULL, NULL)); |
2406 aaLen_fd = FuncDeclaration::genCfunc(args, Type::tsize_t, Id::aaLen); | 2406 aaLen_fd = FuncDeclaration::genCfunc(args, Type::tsize_t, Id::aaLen); |
2407 } | 2407 } |
2408 | 2408 |
2409 ec = new VarExp(0, aaLen_fd); | 2409 ec = new VarExp(0, aaLen_fd); |
2410 arguments = new Expressions(); | 2410 arguments = new Expressions(); |
2420 | 2420 |
2421 assert(size); | 2421 assert(size); |
2422 //LDC: Build arguments. | 2422 //LDC: Build arguments. |
2423 static FuncDeclaration *aaKeys_fd = NULL; | 2423 static FuncDeclaration *aaKeys_fd = NULL; |
2424 if(!aaKeys_fd) { | 2424 if(!aaKeys_fd) { |
2425 Arguments* args = new Arguments; | 2425 Parameters* args = new Parameters; |
2426 args->push(new Argument(STCin, Type::tvoid->pointerTo(), NULL, NULL)); | 2426 args->push(new Parameter(STCin, Type::tvoid->pointerTo(), NULL, NULL)); |
2427 args->push(new Argument(STCin, Type::tsize_t, NULL, NULL)); | 2427 args->push(new Parameter(STCin, Type::tsize_t, NULL, NULL)); |
2428 aaKeys_fd = FuncDeclaration::genCfunc(args, Type::tvoid->arrayOf(), Id::aaKeys); | 2428 aaKeys_fd = FuncDeclaration::genCfunc(args, Type::tvoid->arrayOf(), Id::aaKeys); |
2429 } | 2429 } |
2430 | 2430 |
2431 ec = new VarExp(0, aaKeys_fd); | 2431 ec = new VarExp(0, aaKeys_fd); |
2432 arguments = new Expressions(); | 2432 arguments = new Expressions(); |
2441 Expressions *arguments; | 2441 Expressions *arguments; |
2442 | 2442 |
2443 //LDC: Build arguments. | 2443 //LDC: Build arguments. |
2444 static FuncDeclaration *aaValues_fd = NULL; | 2444 static FuncDeclaration *aaValues_fd = NULL; |
2445 if(!aaValues_fd) { | 2445 if(!aaValues_fd) { |
2446 Arguments* args = new Arguments; | 2446 Parameters* args = new Parameters; |
2447 args->push(new Argument(STCin, Type::tvoid->pointerTo(), NULL, NULL)); | 2447 args->push(new Parameter(STCin, Type::tvoid->pointerTo(), NULL, NULL)); |
2448 args->push(new Argument(STCin, Type::tsize_t, NULL, NULL)); | 2448 args->push(new Parameter(STCin, Type::tsize_t, NULL, NULL)); |
2449 args->push(new Argument(STCin, Type::tsize_t, NULL, NULL)); | 2449 args->push(new Parameter(STCin, Type::tsize_t, NULL, NULL)); |
2450 aaValues_fd = FuncDeclaration::genCfunc(args, Type::tvoid->arrayOf(), Id::aaValues); | 2450 aaValues_fd = FuncDeclaration::genCfunc(args, Type::tvoid->arrayOf(), Id::aaValues); |
2451 } | 2451 } |
2452 | 2452 |
2453 ec = new VarExp(0, aaValues_fd); | 2453 ec = new VarExp(0, aaValues_fd); |
2454 arguments = new Expressions(); | 2454 arguments = new Expressions(); |
2466 Expressions *arguments; | 2466 Expressions *arguments; |
2467 | 2467 |
2468 //LDC: Build arguments. | 2468 //LDC: Build arguments. |
2469 static FuncDeclaration *aaRehash_fd = NULL; | 2469 static FuncDeclaration *aaRehash_fd = NULL; |
2470 if(!aaRehash_fd) { | 2470 if(!aaRehash_fd) { |
2471 Arguments* args = new Arguments; | 2471 Parameters* args = new Parameters; |
2472 args->push(new Argument(STCin, Type::tvoid->pointerTo(), NULL, NULL)); | 2472 args->push(new Parameter(STCin, Type::tvoid->pointerTo(), NULL, NULL)); |
2473 args->push(new Argument(STCin, Type::typeinfo->type, NULL, NULL)); | 2473 args->push(new Parameter(STCin, Type::typeinfo->type, NULL, NULL)); |
2474 aaRehash_fd = FuncDeclaration::genCfunc(args, Type::tvoidptr, Id::aaRehash); | 2474 aaRehash_fd = FuncDeclaration::genCfunc(args, Type::tvoidptr, Id::aaRehash); |
2475 } | 2475 } |
2476 | 2476 |
2477 ec = new VarExp(0, aaRehash_fd); | 2477 ec = new VarExp(0, aaRehash_fd); |
2478 arguments = new Expressions(); | 2478 arguments = new Expressions(); |
2706 } | 2706 } |
2707 | 2707 |
2708 | 2708 |
2709 /***************************** TypeFunction *****************************/ | 2709 /***************************** TypeFunction *****************************/ |
2710 | 2710 |
2711 TypeFunction::TypeFunction(Arguments *parameters, Type *treturn, int varargs, enum LINK linkage) | 2711 TypeFunction::TypeFunction(Parameters *parameters, Type *treturn, int varargs, enum LINK linkage) |
2712 : Type(Tfunction, treturn) | 2712 : Type(Tfunction, treturn) |
2713 { | 2713 { |
2714 //if (!treturn) *(char*)0=0; | 2714 //if (!treturn) *(char*)0=0; |
2715 // assert(treturn); | 2715 // assert(treturn); |
2716 this->parameters = parameters; | 2716 this->parameters = parameters; |
2724 } | 2724 } |
2725 | 2725 |
2726 Type *TypeFunction::syntaxCopy() | 2726 Type *TypeFunction::syntaxCopy() |
2727 { | 2727 { |
2728 Type *treturn = next ? next->syntaxCopy() : NULL; | 2728 Type *treturn = next ? next->syntaxCopy() : NULL; |
2729 Arguments *params = Argument::arraySyntaxCopy(parameters); | 2729 Parameters *params = Parameter::arraySyntaxCopy(parameters); |
2730 TypeFunction *t = new TypeFunction(params, treturn, varargs, linkage); | 2730 Type *t = new TypeFunction(params, treturn, varargs, linkage); |
2731 return t; | 2731 return t; |
2732 } | 2732 } |
2733 | 2733 |
2734 /******************************* | 2734 /******************************* |
2735 * Returns: | 2735 * Returns: |
2762 if (t1->varargs != t2->varargs) | 2762 if (t1->varargs != t2->varargs) |
2763 goto Ldistinct; | 2763 goto Ldistinct; |
2764 | 2764 |
2765 if (t1->parameters && t2->parameters) | 2765 if (t1->parameters && t2->parameters) |
2766 { | 2766 { |
2767 size_t dim = Argument::dim(t1->parameters); | 2767 size_t dim = Parameter::dim(t1->parameters); |
2768 if (dim != Argument::dim(t2->parameters)) | 2768 if (dim != Parameter::dim(t2->parameters)) |
2769 goto Ldistinct; | 2769 goto Ldistinct; |
2770 | 2770 |
2771 for (size_t i = 0; i < dim; i++) | 2771 for (size_t i = 0; i < dim; i++) |
2772 { Argument *arg1 = Argument::getNth(t1->parameters, i); | 2772 { Parameter *arg1 = Parameter::getNth(t1->parameters, i); |
2773 Argument *arg2 = Argument::getNth(t2->parameters, i); | 2773 Parameter *arg2 = Parameter::getNth(t2->parameters, i); |
2774 | 2774 |
2775 if (!arg1->type->equals(arg2->type)) | 2775 if (!arg1->type->equals(arg2->type)) |
2776 goto Ldistinct; | 2776 goto Ldistinct; |
2777 if (arg1->storageClass != arg2->storageClass) | 2777 if (arg1->storageClass != arg2->storageClass) |
2778 inoutmismatch = 1; | 2778 inoutmismatch = 1; |
2873 } | 2873 } |
2874 }*/ | 2874 }*/ |
2875 } | 2875 } |
2876 | 2876 |
2877 // Write argument types | 2877 // Write argument types |
2878 Argument::argsToDecoBuffer(buf, parameters, mangle); | 2878 Parameter::argsToDecoBuffer(buf, parameters, mangle); |
2879 //if (buf->data[buf->offset - 1] == '@') halt(); | 2879 //if (buf->data[buf->offset - 1] == '@') halt(); |
2880 buf->writeByte('Z' - varargs); // mark end of arg list | 2880 buf->writeByte('Z' - varargs); // mark end of arg list |
2881 next->toDecoBuffer(buf, mangle); | 2881 next->toDecoBuffer(buf, mangle); |
2882 inuse--; | 2882 inuse--; |
2883 } | 2883 } |
2915 buf->writestring(p); | 2915 buf->writestring(p); |
2916 if (ident) | 2916 if (ident) |
2917 { buf->writeByte(' '); | 2917 { buf->writeByte(' '); |
2918 buf->writestring(ident->toHChars2()); | 2918 buf->writestring(ident->toHChars2()); |
2919 } | 2919 } |
2920 Argument::argsToCBuffer(buf, hgs, parameters, varargs); | 2920 Parameter::argsToCBuffer(buf, hgs, parameters, varargs); |
2921 inuse--; | 2921 inuse--; |
2922 } | 2922 } |
2923 | 2923 |
2924 void TypeFunction::toCBuffer2(OutBuffer *buf, HdrGenState *hgs, int mod) | 2924 void TypeFunction::toCBuffer2(OutBuffer *buf, HdrGenState *hgs, int mod) |
2925 { | 2925 { |
2951 } | 2951 } |
2952 | 2952 |
2953 if (!hgs->hdrgen && p) | 2953 if (!hgs->hdrgen && p) |
2954 buf->writestring(p); | 2954 buf->writestring(p); |
2955 buf->writestring(" function"); | 2955 buf->writestring(" function"); |
2956 Argument::argsToCBuffer(buf, hgs, parameters, varargs); | 2956 Parameter::argsToCBuffer(buf, hgs, parameters, varargs); |
2957 inuse--; | 2957 inuse--; |
2958 } | 2958 } |
2959 | 2959 |
2960 Type *TypeFunction::semantic(Loc loc, Scope *sc) | 2960 Type *TypeFunction::semantic(Loc loc, Scope *sc) |
2961 { | 2961 { |
2967 //printf("TypeFunction::semantic() this = %p\n", this); | 2967 //printf("TypeFunction::semantic() this = %p\n", this); |
2968 | 2968 |
2969 TypeFunction *tf = (TypeFunction *)mem.malloc(sizeof(TypeFunction)); | 2969 TypeFunction *tf = (TypeFunction *)mem.malloc(sizeof(TypeFunction)); |
2970 memcpy(tf, this, sizeof(TypeFunction)); | 2970 memcpy(tf, this, sizeof(TypeFunction)); |
2971 if (parameters) | 2971 if (parameters) |
2972 { tf->parameters = (Arguments *)parameters->copy(); | 2972 { tf->parameters = (Parameters *)parameters->copy(); |
2973 for (size_t i = 0; i < parameters->dim; i++) | 2973 for (size_t i = 0; i < parameters->dim; i++) |
2974 { Argument *arg = (Argument *)parameters->data[i]; | 2974 { Parameter *arg = (Parameter *)parameters->data[i]; |
2975 Argument *cpy = (Argument *)mem.malloc(sizeof(Argument)); | 2975 Parameter *cpy = (Parameter *)mem.malloc(sizeof(Parameter)); |
2976 memcpy(cpy, arg, sizeof(Argument)); | 2976 memcpy(cpy, arg, sizeof(Parameter)); |
2977 tf->parameters->data[i] = (void *)cpy; | 2977 tf->parameters->data[i] = (void *)cpy; |
2978 } | 2978 } |
2979 } | 2979 } |
2980 | 2980 |
2981 tf->linkage = sc->linkage; | 2981 tf->linkage = sc->linkage; |
3004 */ | 3004 */ |
3005 Scope *argsc = sc->push(); | 3005 Scope *argsc = sc->push(); |
3006 argsc->stc = 0; // don't inherit storage class | 3006 argsc->stc = 0; // don't inherit storage class |
3007 argsc->protection = PROTpublic; | 3007 argsc->protection = PROTpublic; |
3008 | 3008 |
3009 size_t dim = Argument::dim(tf->parameters); | 3009 size_t dim = Parameter::dim(tf->parameters); |
3010 for (size_t i = 0; i < dim; i++) | 3010 for (size_t i = 0; i < dim; i++) |
3011 { Argument *arg = Argument::getNth(tf->parameters, i); | 3011 { Parameter *arg = Parameter::getNth(tf->parameters, i); |
3012 | 3012 |
3013 tf->inuse++; | 3013 tf->inuse++; |
3014 arg->type = arg->type->semantic(loc, argsc); | 3014 arg->type = arg->type->semantic(loc, argsc); |
3015 if (tf->inuse == 1) tf->inuse--; | 3015 if (tf->inuse == 1) tf->inuse--; |
3016 | 3016 |
3042 | 3042 |
3043 /* If arg turns out to be a tuple, the number of parameters may | 3043 /* If arg turns out to be a tuple, the number of parameters may |
3044 * change. | 3044 * change. |
3045 */ | 3045 */ |
3046 if (t->ty == Ttuple) | 3046 if (t->ty == Ttuple) |
3047 { dim = Argument::dim(tf->parameters); | 3047 { dim = Parameter::dim(tf->parameters); |
3048 i--; | 3048 i--; |
3049 } | 3049 } |
3050 } | 3050 } |
3051 argsc->pop(); | 3051 argsc->pop(); |
3052 } | 3052 } |
3057 { error(loc, "recursive type"); | 3057 { error(loc, "recursive type"); |
3058 tf->inuse = 0; | 3058 tf->inuse = 0; |
3059 return terror; | 3059 return terror; |
3060 } | 3060 } |
3061 | 3061 |
3062 if (tf->varargs == 1 && tf->linkage != LINKd && Argument::dim(tf->parameters) == 0) | 3062 if (tf->varargs == 1 && tf->linkage != LINKd && Parameter::dim(tf->parameters) == 0) |
3063 error(loc, "variadic functions with non-D linkage must have at least one parameter"); | 3063 error(loc, "variadic functions with non-D linkage must have at least one parameter"); |
3064 | 3064 |
3065 /* Don't return merge(), because arg identifiers and default args | 3065 /* Don't return merge(), because arg identifiers and default args |
3066 * can be different | 3066 * can be different |
3067 * even though the types match | 3067 * even though the types match |
3079 int TypeFunction::callMatch(Expressions *args) | 3079 int TypeFunction::callMatch(Expressions *args) |
3080 { | 3080 { |
3081 //printf("TypeFunction::callMatch()\n"); | 3081 //printf("TypeFunction::callMatch()\n"); |
3082 int match = MATCHexact; // assume exact match | 3082 int match = MATCHexact; // assume exact match |
3083 | 3083 |
3084 size_t nparams = Argument::dim(parameters); | 3084 size_t nparams = Parameter::dim(parameters); |
3085 size_t nargs = args ? args->dim : 0; | 3085 size_t nargs = args ? args->dim : 0; |
3086 if (nparams == nargs) | 3086 if (nparams == nargs) |
3087 ; | 3087 ; |
3088 else if (nargs > nparams) | 3088 else if (nargs > nparams) |
3089 { | 3089 { |
3096 { int m; | 3096 { int m; |
3097 Expression *arg; | 3097 Expression *arg; |
3098 | 3098 |
3099 // BUG: what about out and ref? | 3099 // BUG: what about out and ref? |
3100 | 3100 |
3101 Argument *p = Argument::getNth(parameters, u); | 3101 Parameter *p = Parameter::getNth(parameters, u); |
3102 assert(p); | 3102 assert(p); |
3103 if (u >= nargs) | 3103 if (u >= nargs) |
3104 { | 3104 { |
3105 if (p->defaultArg) | 3105 if (p->defaultArg) |
3106 continue; | 3106 continue; |
3194 Type *TypeFunction::reliesOnTident() | 3194 Type *TypeFunction::reliesOnTident() |
3195 { | 3195 { |
3196 if (parameters) | 3196 if (parameters) |
3197 { | 3197 { |
3198 for (size_t i = 0; i < parameters->dim; i++) | 3198 for (size_t i = 0; i < parameters->dim; i++) |
3199 { Argument *arg = (Argument *)parameters->data[i]; | 3199 { Parameter *arg = (Parameter *)parameters->data[i]; |
3200 Type *t = arg->type->reliesOnTident(); | 3200 Type *t = arg->type->reliesOnTident(); |
3201 if (t) | 3201 if (t) |
3202 return t; | 3202 return t; |
3203 } | 3203 } |
3204 } | 3204 } |
3255 } | 3255 } |
3256 TypeFunction *tf = (TypeFunction *)next; | 3256 TypeFunction *tf = (TypeFunction *)next; |
3257 | 3257 |
3258 tf->next->toCBuffer2(buf, hgs, 0); | 3258 tf->next->toCBuffer2(buf, hgs, 0); |
3259 buf->writestring(" delegate"); | 3259 buf->writestring(" delegate"); |
3260 Argument::argsToCBuffer(buf, hgs, tf->parameters, tf->varargs); | 3260 Parameter::argsToCBuffer(buf, hgs, tf->parameters, tf->varargs); |
3261 } | 3261 } |
3262 | 3262 |
3263 Expression *TypeDelegate::defaultInit(Loc loc) | 3263 Expression *TypeDelegate::defaultInit(Loc loc) |
3264 { | 3264 { |
3265 #if LOGDEFAULTINIT | 3265 #if LOGDEFAULTINIT |
5171 return TRUE; | 5171 return TRUE; |
5172 } | 5172 } |
5173 | 5173 |
5174 /***************************** TypeTuple *****************************/ | 5174 /***************************** TypeTuple *****************************/ |
5175 | 5175 |
5176 TypeTuple::TypeTuple(Arguments *arguments) | 5176 TypeTuple::TypeTuple(Parameters *arguments) |
5177 : Type(Ttuple, NULL) | 5177 : Type(Ttuple, NULL) |
5178 { | 5178 { |
5179 //printf("TypeTuple(this = %p)\n", this); | 5179 //printf("TypeTuple(this = %p)\n", this); |
5180 this->arguments = arguments; | 5180 this->arguments = arguments; |
5181 //printf("TypeTuple() %s\n", toChars()); | 5181 //printf("TypeTuple() %s\n", toChars()); |
5182 #ifdef DEBUG | 5182 #ifdef DEBUG |
5183 if (arguments) | 5183 if (arguments) |
5184 { | 5184 { |
5185 for (size_t i = 0; i < arguments->dim; i++) | 5185 for (size_t i = 0; i < arguments->dim; i++) |
5186 { | 5186 { |
5187 Argument *arg = (Argument *)arguments->data[i]; | 5187 Parameter *arg = (Parameter *)arguments->data[i]; |
5188 assert(arg && arg->type); | 5188 assert(arg && arg->type); |
5189 } | 5189 } |
5190 } | 5190 } |
5191 #endif | 5191 #endif |
5192 } | 5192 } |
5197 */ | 5197 */ |
5198 | 5198 |
5199 TypeTuple::TypeTuple(Expressions *exps) | 5199 TypeTuple::TypeTuple(Expressions *exps) |
5200 : Type(Ttuple, NULL) | 5200 : Type(Ttuple, NULL) |
5201 { | 5201 { |
5202 Arguments *arguments = new Arguments; | 5202 Parameters *arguments = new Parameters; |
5203 if (exps) | 5203 if (exps) |
5204 { | 5204 { |
5205 arguments->setDim(exps->dim); | 5205 arguments->setDim(exps->dim); |
5206 for (size_t i = 0; i < exps->dim; i++) | 5206 for (size_t i = 0; i < exps->dim; i++) |
5207 { Expression *e = (Expression *)exps->data[i]; | 5207 { Expression *e = (Expression *)exps->data[i]; |
5208 if (e->type->ty == Ttuple) | 5208 if (e->type->ty == Ttuple) |
5209 e->error("cannot form tuple of tuples"); | 5209 e->error("cannot form tuple of tuples"); |
5210 Argument *arg = new Argument(STCin, e->type, NULL, NULL); | 5210 Parameter *arg = new Parameter(STCin, e->type, NULL, NULL); |
5211 arguments->data[i] = (void *)arg; | 5211 arguments->data[i] = (void *)arg; |
5212 } | 5212 } |
5213 } | 5213 } |
5214 this->arguments = arguments; | 5214 this->arguments = arguments; |
5215 } | 5215 } |
5216 | 5216 |
5217 Type *TypeTuple::syntaxCopy() | 5217 Type *TypeTuple::syntaxCopy() |
5218 { | 5218 { |
5219 Arguments *args = Argument::arraySyntaxCopy(arguments); | 5219 Parameters *args = Parameter::arraySyntaxCopy(arguments); |
5220 Type *t = new TypeTuple(args); | 5220 Type *t = new TypeTuple(args); |
5221 return t; | 5221 return t; |
5222 } | 5222 } |
5223 | 5223 |
5224 Type *TypeTuple::semantic(Loc loc, Scope *sc) | 5224 Type *TypeTuple::semantic(Loc loc, Scope *sc) |
5247 { TypeTuple *tt = (TypeTuple *)t; | 5247 { TypeTuple *tt = (TypeTuple *)t; |
5248 | 5248 |
5249 if (arguments->dim == tt->arguments->dim) | 5249 if (arguments->dim == tt->arguments->dim) |
5250 { | 5250 { |
5251 for (size_t i = 0; i < tt->arguments->dim; i++) | 5251 for (size_t i = 0; i < tt->arguments->dim; i++) |
5252 { Argument *arg1 = (Argument *)arguments->data[i]; | 5252 { Parameter *arg1 = (Parameter *)arguments->data[i]; |
5253 Argument *arg2 = (Argument *)tt->arguments->data[i]; | 5253 Parameter *arg2 = (Parameter *)tt->arguments->data[i]; |
5254 | 5254 |
5255 if (!arg1->type->equals(arg2->type)) | 5255 if (!arg1->type->equals(arg2->type)) |
5256 return 0; | 5256 return 0; |
5257 } | 5257 } |
5258 return 1; | 5258 return 1; |
5265 { | 5265 { |
5266 if (arguments) | 5266 if (arguments) |
5267 { | 5267 { |
5268 for (size_t i = 0; i < arguments->dim; i++) | 5268 for (size_t i = 0; i < arguments->dim; i++) |
5269 { | 5269 { |
5270 Argument *arg = (Argument *)arguments->data[i]; | 5270 Parameter *arg = (Parameter *)arguments->data[i]; |
5271 Type *t = arg->type->reliesOnTident(); | 5271 Type *t = arg->type->reliesOnTident(); |
5272 if (t) | 5272 if (t) |
5273 return t; | 5273 return t; |
5274 } | 5274 } |
5275 } | 5275 } |
5276 return NULL; | 5276 return NULL; |
5277 } | 5277 } |
5278 | 5278 |
5279 void TypeTuple::toCBuffer2(OutBuffer *buf, HdrGenState *hgs, int mod) | 5279 void TypeTuple::toCBuffer2(OutBuffer *buf, HdrGenState *hgs, int mod) |
5280 { | 5280 { |
5281 Argument::argsToCBuffer(buf, hgs, arguments, 0); | 5281 Parameter::argsToCBuffer(buf, hgs, arguments, 0); |
5282 } | 5282 } |
5283 | 5283 |
5284 void TypeTuple::toDecoBuffer(OutBuffer *buf, bool mangle) | 5284 void TypeTuple::toDecoBuffer(OutBuffer *buf, bool mangle) |
5285 { | 5285 { |
5286 //printf("TypeTuple::toDecoBuffer() this = %p\n", this); | 5286 //printf("TypeTuple::toDecoBuffer() this = %p\n", this); |
5287 OutBuffer buf2; | 5287 OutBuffer buf2; |
5288 Argument::argsToDecoBuffer(&buf2, arguments, mangle); | 5288 Parameter::argsToDecoBuffer(&buf2, arguments, mangle); |
5289 unsigned len = buf2.offset; | 5289 unsigned len = buf2.offset; |
5290 buf->printf("%c%d%.*s", mangleChar[ty], len, len, (char *)buf2.extractData()); | 5290 buf->printf("%c%d%.*s", mangleChar[ty], len, len, (char *)buf2.extractData()); |
5291 } | 5291 } |
5292 | 5292 |
5293 Expression *TypeTuple::getProperty(Loc loc, Identifier *ident) | 5293 Expression *TypeTuple::getProperty(Loc loc, Identifier *ident) |
5350 if (!(i1 <= i2 && i2 <= tt->arguments->dim)) | 5350 if (!(i1 <= i2 && i2 <= tt->arguments->dim)) |
5351 { error(loc, "slice [%ju..%ju] is out of range of [0..%u]", i1, i2, tt->arguments->dim); | 5351 { error(loc, "slice [%ju..%ju] is out of range of [0..%u]", i1, i2, tt->arguments->dim); |
5352 return Type::terror; | 5352 return Type::terror; |
5353 } | 5353 } |
5354 | 5354 |
5355 Arguments *args = new Arguments; | 5355 Parameters *args = new Parameters; |
5356 args->reserve(i2 - i1); | 5356 args->reserve(i2 - i1); |
5357 for (size_t i = i1; i < i2; i++) | 5357 for (size_t i = i1; i < i2; i++) |
5358 { Argument *arg = (Argument *)tt->arguments->data[i]; | 5358 { Parameter *arg = (Parameter *)tt->arguments->data[i]; |
5359 args->push(arg); | 5359 args->push(arg); |
5360 } | 5360 } |
5361 | 5361 |
5362 return new TypeTuple(args); | 5362 return new TypeTuple(args); |
5363 } | 5363 } |
5436 | 5436 |
5437 buf->printf("[%s .. ", lwr->toChars()); | 5437 buf->printf("[%s .. ", lwr->toChars()); |
5438 buf->printf("%s]", upr->toChars()); | 5438 buf->printf("%s]", upr->toChars()); |
5439 } | 5439 } |
5440 | 5440 |
5441 /***************************** Argument *****************************/ | 5441 /***************************** Parameter *****************************/ |
5442 | 5442 |
5443 Argument::Argument(unsigned storageClass, Type *type, Identifier *ident, Expression *defaultArg) | 5443 Parameter::Parameter(unsigned storageClass, Type *type, Identifier *ident, Expression *defaultArg) |
5444 { | 5444 { |
5445 this->type = type; | 5445 this->type = type; |
5446 this->ident = ident; | 5446 this->ident = ident; |
5447 this->storageClass = storageClass; | 5447 this->storageClass = storageClass; |
5448 this->defaultArg = defaultArg; | 5448 this->defaultArg = defaultArg; |
5449 } | 5449 } |
5450 | 5450 |
5451 Argument *Argument::syntaxCopy() | 5451 Parameter *Parameter::syntaxCopy() |
5452 { | 5452 { |
5453 Argument *a = new Argument(storageClass, | 5453 Parameter *a = new Parameter(storageClass, |
5454 type ? type->syntaxCopy() : NULL, | 5454 type ? type->syntaxCopy() : NULL, |
5455 ident, | 5455 ident, |
5456 defaultArg ? defaultArg->syntaxCopy() : NULL); | 5456 defaultArg ? defaultArg->syntaxCopy() : NULL); |
5457 return a; | 5457 return a; |
5458 } | 5458 } |
5459 | 5459 |
5460 Arguments *Argument::arraySyntaxCopy(Arguments *args) | 5460 Parameters *Parameter::arraySyntaxCopy(Parameters *args) |
5461 { Arguments *a = NULL; | 5461 { Parameters *a = NULL; |
5462 | 5462 |
5463 if (args) | 5463 if (args) |
5464 { | 5464 { |
5465 a = new Arguments(); | 5465 a = new Parameters(); |
5466 a->setDim(args->dim); | 5466 a->setDim(args->dim); |
5467 for (size_t i = 0; i < a->dim; i++) | 5467 for (size_t i = 0; i < a->dim; i++) |
5468 { Argument *arg = (Argument *)args->data[i]; | 5468 { Parameter *arg = (Parameter *)args->data[i]; |
5469 | 5469 |
5470 arg = arg->syntaxCopy(); | 5470 arg = arg->syntaxCopy(); |
5471 a->data[i] = (void *)arg; | 5471 a->data[i] = (void *)arg; |
5472 } | 5472 } |
5473 } | 5473 } |
5474 return a; | 5474 return a; |
5475 } | 5475 } |
5476 | 5476 |
5477 char *Argument::argsTypesToChars(Arguments *args, int varargs) | 5477 char *Parameter::argsTypesToChars(Parameters *args, int varargs) |
5478 { OutBuffer *buf; | 5478 { OutBuffer *buf; |
5479 | 5479 |
5480 buf = new OutBuffer(); | 5480 buf = new OutBuffer(); |
5481 | 5481 |
5482 buf->writeByte('('); | 5482 buf->writeByte('('); |
5484 { int i; | 5484 { int i; |
5485 OutBuffer argbuf; | 5485 OutBuffer argbuf; |
5486 HdrGenState hgs; | 5486 HdrGenState hgs; |
5487 | 5487 |
5488 for (i = 0; i < args->dim; i++) | 5488 for (i = 0; i < args->dim; i++) |
5489 { Argument *arg; | 5489 { Parameter *arg; |
5490 | 5490 |
5491 if (i) | 5491 if (i) |
5492 buf->writeByte(','); | 5492 buf->writeByte(','); |
5493 arg = (Argument *)args->data[i]; | 5493 arg = (Parameter *)args->data[i]; |
5494 argbuf.reset(); | 5494 argbuf.reset(); |
5495 arg->type->toCBuffer2(&argbuf, &hgs, 0); | 5495 arg->type->toCBuffer2(&argbuf, &hgs, 0); |
5496 buf->write(&argbuf); | 5496 buf->write(&argbuf); |
5497 } | 5497 } |
5498 if (varargs) | 5498 if (varargs) |
5505 buf->writeByte(')'); | 5505 buf->writeByte(')'); |
5506 | 5506 |
5507 return buf->toChars(); | 5507 return buf->toChars(); |
5508 } | 5508 } |
5509 | 5509 |
5510 void Argument::argsToCBuffer(OutBuffer *buf, HdrGenState *hgs, Arguments *arguments, int varargs) | 5510 void Parameter::argsToCBuffer(OutBuffer *buf, HdrGenState *hgs, Parameters *arguments, int varargs) |
5511 { | 5511 { |
5512 buf->writeByte('('); | 5512 buf->writeByte('('); |
5513 if (arguments) | 5513 if (arguments) |
5514 { int i; | 5514 { int i; |
5515 OutBuffer argbuf; | 5515 OutBuffer argbuf; |
5516 | 5516 |
5517 for (i = 0; i < arguments->dim; i++) | 5517 for (i = 0; i < arguments->dim; i++) |
5518 { Argument *arg; | 5518 { Parameter *arg; |
5519 | 5519 |
5520 if (i) | 5520 if (i) |
5521 buf->writestring(", "); | 5521 buf->writestring(", "); |
5522 arg = (Argument *)arguments->data[i]; | 5522 arg = (Parameter *)arguments->data[i]; |
5523 if (arg->storageClass & STCout) | 5523 if (arg->storageClass & STCout) |
5524 buf->writestring("out "); | 5524 buf->writestring("out "); |
5525 else if (arg->storageClass & STCref) | 5525 else if (arg->storageClass & STCref) |
5526 buf->writestring((global.params.Dversion == 1) | 5526 buf->writestring((global.params.Dversion == 1) |
5527 ? (char *)"inout " : (char *)"ref "); | 5527 ? (char *)"inout " : (char *)"ref "); |
5545 } | 5545 } |
5546 buf->writeByte(')'); | 5546 buf->writeByte(')'); |
5547 } | 5547 } |
5548 | 5548 |
5549 | 5549 |
5550 void Argument::argsToDecoBuffer(OutBuffer *buf, Arguments *arguments, bool mangle) | 5550 void Parameter::argsToDecoBuffer(OutBuffer *buf, Parameters *arguments, bool mangle) |
5551 { | 5551 { |
5552 //printf("Argument::argsToDecoBuffer()\n"); | 5552 //printf("Parameter::argsToDecoBuffer()\n"); |
5553 | 5553 |
5554 // Write argument types | 5554 // Write argument types |
5555 if (arguments) | 5555 if (arguments) |
5556 { | 5556 { |
5557 size_t dim = Argument::dim(arguments); | 5557 size_t dim = Parameter::dim(arguments); |
5558 for (size_t i = 0; i < dim; i++) | 5558 for (size_t i = 0; i < dim; i++) |
5559 { | 5559 { |
5560 Argument *arg = Argument::getNth(arguments, i); | 5560 Parameter *arg = Parameter::getNth(arguments, i); |
5561 arg->toDecoBuffer(buf, mangle); | 5561 arg->toDecoBuffer(buf, mangle); |
5562 } | 5562 } |
5563 } | 5563 } |
5564 } | 5564 } |
5565 | 5565 |
5567 * Determine if parameter is a lazy array of delegates. | 5567 * Determine if parameter is a lazy array of delegates. |
5568 * If so, return the return type of those delegates. | 5568 * If so, return the return type of those delegates. |
5569 * If not, return NULL. | 5569 * If not, return NULL. |
5570 */ | 5570 */ |
5571 | 5571 |
5572 Type *Argument::isLazyArray() | 5572 Type *Parameter::isLazyArray() |
5573 { | 5573 { |
5574 // if (inout == Lazy) | 5574 // if (inout == Lazy) |
5575 { | 5575 { |
5576 Type *tb = type->toBasetype(); | 5576 Type *tb = type->toBasetype(); |
5577 if (tb->ty == Tsarray || tb->ty == Tarray) | 5577 if (tb->ty == Tsarray || tb->ty == Tarray) |
5580 if (tel->ty == Tdelegate) | 5580 if (tel->ty == Tdelegate) |
5581 { | 5581 { |
5582 TypeDelegate *td = (TypeDelegate *)tel; | 5582 TypeDelegate *td = (TypeDelegate *)tel; |
5583 TypeFunction *tf = (TypeFunction *)td->next; | 5583 TypeFunction *tf = (TypeFunction *)td->next; |
5584 | 5584 |
5585 if (!tf->varargs && Argument::dim(tf->parameters) == 0) | 5585 if (!tf->varargs && Parameter::dim(tf->parameters) == 0) |
5586 { | 5586 { |
5587 return tf->next; // return type of delegate | 5587 return tf->next; // return type of delegate |
5588 } | 5588 } |
5589 } | 5589 } |
5590 } | 5590 } |
5591 } | 5591 } |
5592 return NULL; | 5592 return NULL; |
5593 } | 5593 } |
5594 | 5594 |
5595 void Argument::toDecoBuffer(OutBuffer *buf, bool mangle) | 5595 void Parameter::toDecoBuffer(OutBuffer *buf, bool mangle) |
5596 { | 5596 { |
5597 switch (storageClass & (STCin | STCout | STCref | STClazy)) | 5597 switch (storageClass & (STCin | STCout | STCref | STClazy)) |
5598 { case 0: | 5598 { case 0: |
5599 case STCin: | 5599 case STCin: |
5600 break; | 5600 break; |
5618 | 5618 |
5619 /*************************************** | 5619 /*************************************** |
5620 * Determine number of arguments, folding in tuples. | 5620 * Determine number of arguments, folding in tuples. |
5621 */ | 5621 */ |
5622 | 5622 |
5623 size_t Argument::dim(Arguments *args) | 5623 size_t Parameter::dim(Parameters *args) |
5624 { | 5624 { |
5625 size_t n = 0; | 5625 size_t n = 0; |
5626 if (args) | 5626 if (args) |
5627 { | 5627 { |
5628 for (size_t i = 0; i < args->dim; i++) | 5628 for (size_t i = 0; i < args->dim; i++) |
5629 { Argument *arg = (Argument *)args->data[i]; | 5629 { Parameter *arg = (Parameter *)args->data[i]; |
5630 Type *t = arg->type->toBasetype(); | 5630 Type *t = arg->type->toBasetype(); |
5631 | 5631 |
5632 if (t->ty == Ttuple) | 5632 if (t->ty == Ttuple) |
5633 { TypeTuple *tu = (TypeTuple *)t; | 5633 { TypeTuple *tu = (TypeTuple *)t; |
5634 n += dim(tu->arguments); | 5634 n += dim(tu->arguments); |
5639 } | 5639 } |
5640 return n; | 5640 return n; |
5641 } | 5641 } |
5642 | 5642 |
5643 /*************************************** | 5643 /*************************************** |
5644 * Get nth Argument, folding in tuples. | 5644 * Get nth Parameter, folding in tuples. |
5645 * Returns: | 5645 * Returns: |
5646 * Argument* nth Argument | 5646 * Parameter* nth Parameter |
5647 * NULL not found, *pn gets incremented by the number | 5647 * NULL not found, *pn gets incremented by the number |
5648 * of Arguments | 5648 * of Parameters |
5649 */ | 5649 */ |
5650 | 5650 |
5651 Argument *Argument::getNth(Arguments *args, size_t nth, size_t *pn) | 5651 Parameter *Parameter::getNth(Parameters *args, size_t nth, size_t *pn) |
5652 { | 5652 { |
5653 if (!args) | 5653 if (!args) |
5654 return NULL; | 5654 return NULL; |
5655 | 5655 |
5656 size_t n = 0; | 5656 size_t n = 0; |
5657 for (size_t i = 0; i < args->dim; i++) | 5657 for (size_t i = 0; i < args->dim; i++) |
5658 { Argument *arg = (Argument *)args->data[i]; | 5658 { Parameter *arg = (Parameter *)args->data[i]; |
5659 Type *t = arg->type->toBasetype(); | 5659 Type *t = arg->type->toBasetype(); |
5660 | 5660 |
5661 if (t->ty == Ttuple) | 5661 if (t->ty == Ttuple) |
5662 { TypeTuple *tu = (TypeTuple *)t; | 5662 { TypeTuple *tu = (TypeTuple *)t; |
5663 arg = getNth(tu->arguments, nth - n, &n); | 5663 arg = getNth(tu->arguments, nth - n, &n); |