Skip to content

Commit

Permalink
Merge pull request #213 from yebblies/removedeadtypes
Browse files Browse the repository at this point in the history
Remove TypeNewArray from dmd
  • Loading branch information
WalterBright committed Jul 16, 2011
2 parents d3f5c9c + cb08516 commit b113fcf
Show file tree
Hide file tree
Showing 2 changed files with 0 additions and 111 deletions.
104 changes: 0 additions & 104 deletions src/mtype.c
Expand Up @@ -176,7 +176,6 @@ void Type::init()
sizeTy[i] = sizeof(TypeBasic);
sizeTy[Tsarray] = sizeof(TypeSArray);
sizeTy[Tarray] = sizeof(TypeDArray);
//sizeTy[Tnarray] = sizeof(TypeNArray);
sizeTy[Taarray] = sizeof(TypeAArray);
sizeTy[Tpointer] = sizeof(TypePointer);
sizeTy[Treference] = sizeof(TypeReference);
Expand All @@ -195,7 +194,6 @@ void Type::init()

mangleChar[Tarray] = 'A';
mangleChar[Tsarray] = 'G';
mangleChar[Tnarray] = '@';
mangleChar[Taarray] = 'H';
mangleChar[Tpointer] = 'P';
mangleChar[Treference] = 'R';
Expand Down Expand Up @@ -3838,87 +3836,6 @@ int TypeDArray::hasPointers()
}


/***************************** TypeNewArray *****************************/

#if 0

TypeNewArray::TypeNewArray(Type *telement)
: TypeArray(Tnewarray, telement)
{
sym = NULL;
}

Type *TypeNewArray::syntaxCopy()
{
Type *t = next->syntaxCopy();
if (t == next)
t = this;
else
{ t = new TypeNewArray(t);
t->mod = mod;
}
return t;
}

d_uns64 TypeNewArray::size(Loc loc)
{
//printf("TypeNewArray::size()\n");
return PTRSIZE;
}

unsigned TypeNewArray::alignsize()
{
return PTRSIZE;
}

Type *TypeNewArray::semantic(Loc loc, Scope *sc)
{ Type *tn = next;

tn = next->semantic(loc,sc);
Type *tbn = tn->toBasetype();
switch (tbn->ty)
{
case Tfunction:
case Tnone:
case Ttuple:
error(loc, "can't have array of %s", tbn->toChars());
tn = next = tint32;
break;
case Tstruct:
{ TypeStruct *ts = (TypeStruct *)tbn;
if (0 && ts->sym->isnested)
error(loc, "cannot have array of inner structs %s", ts->toChars());
break;
}
}
if (tn->isscope())
error(loc, "cannot have array of scope %s", tn->toChars());

next = tn;
transitive();
return merge();
}

void TypeNewArray::toDecoBuffer(OutBuffer *buf, int flag)
{
Type::toDecoBuffer(buf, flag);
buf->writeByte('e');
if (next)
next->toDecoBuffer(buf, (flag & 0x100) ? 0 : mod);
}

void TypeNewArray::toCBuffer2(OutBuffer *buf, HdrGenState *hgs, int mod)
{
if (mod != this->mod)
{ toCBuffer3(buf, hgs, mod);
return;
}
next->toCBuffer2(buf, hgs, this->mod);
buf->writestring("[new]");
}

#endif

/***************************** TypeAArray *****************************/

TypeAArray::TypeAArray(Type *t, Type *index)
Expand Down Expand Up @@ -8108,27 +8025,6 @@ void TypeSlice::toCBuffer2(OutBuffer *buf, HdrGenState *hgs, int mod)
buf->printf("%s]", upr->toChars());
}

/***************************** TypeNewArray *****************************/

/* T[new]
*/

TypeNewArray::TypeNewArray(Type *next)
: TypeNext(Tnarray, next)
{
//printf("TypeNewArray\n");
}

void TypeNewArray::toCBuffer2(OutBuffer *buf, HdrGenState *hgs, int mod)
{
if (mod != this->mod)
{ toCBuffer3(buf, hgs, mod);
return;
}
next->toCBuffer2(buf, hgs, this->mod);
buf->writestring("[new]");
}

/***************************** Parameter *****************************/

Parameter::Parameter(StorageClass storageClass, Type *type, Identifier *ident, Expression *defaultArg)
Expand Down
7 changes: 0 additions & 7 deletions src/mtype.h
Expand Up @@ -54,7 +54,6 @@ enum ENUMTY
{
Tarray, // slice array, aka T[]
Tsarray, // static array, aka T[dimension]
Tnarray, // resizable array, aka T[new]
Taarray, // associative array, aka T[type]
Tpointer,
Treference,
Expand Down Expand Up @@ -891,12 +890,6 @@ struct TypeSlice : TypeNext
void toCBuffer2(OutBuffer *buf, HdrGenState *hgs, int mod);
};

struct TypeNewArray : TypeNext
{
TypeNewArray(Type *next);
void toCBuffer2(OutBuffer *buf, HdrGenState *hgs, int mod);
};

/**************************************************************/

//enum InOut { None, In, Out, InOut, Lazy };
Expand Down

0 comments on commit b113fcf

Please sign in to comment.