Skip to content

Commit

Permalink
Made use of type-checked array accessors mandatory, adapted code at c…
Browse files Browse the repository at this point in the history
…ompiler errors.
  • Loading branch information
michelf committed Jul 5, 2011
1 parent 8b3bb0d commit 9859b1b
Show file tree
Hide file tree
Showing 64 changed files with 1,061 additions and 1,058 deletions.
6 changes: 3 additions & 3 deletions src/access.c
Original file line number Diff line number Diff line change
Expand Up @@ -85,7 +85,7 @@ enum PROT ClassDeclaration::getAccess(Dsymbol *smember)
}

for (i = 0; i < baseclasses->dim; i++)
{ BaseClass *b = (BaseClass *)baseclasses->data[i];
{ BaseClass *b = baseclasses->tdata()[i];

access = b->base->getAccess(smember);
switch (access)
Expand Down Expand Up @@ -154,7 +154,7 @@ static int accessCheckX(
if (cdthis)
{
for (int i = 0; i < cdthis->baseclasses->dim; i++)
{ BaseClass *b = (BaseClass *)cdthis->baseclasses->data[i];
{ BaseClass *b = cdthis->baseclasses->tdata()[i];
enum PROT access;

access = b->base->getAccess(smember);
Expand All @@ -175,7 +175,7 @@ static int accessCheckX(
if (cdthis)
{
for (int i = 0; i < cdthis->baseclasses->dim; i++)
{ BaseClass *b = (BaseClass *)cdthis->baseclasses->data[i];
{ BaseClass *b = cdthis->baseclasses->tdata()[i];

if (accessCheckX(smember, sfunc, b->base, cdscope))
return 1;
Expand Down
4 changes: 2 additions & 2 deletions src/aggregate.h
Original file line number Diff line number Diff line change
Expand Up @@ -210,8 +210,8 @@ struct ClassDeclaration : AggregateDeclaration
#endif
FuncDeclaration *staticCtor;
FuncDeclaration *staticDtor;
FuncDeclarations vtbl; // Array of FuncDeclaration's making up the vtbl[]
FuncDeclarations vtblFinal; // More FuncDeclaration's that aren't in vtbl[]
Dsymbols vtbl; // Array of FuncDeclaration's making up the vtbl[]
Dsymbols vtblFinal; // More FuncDeclaration's that aren't in vtbl[]

BaseClasses *baseclasses; // Array of BaseClass's; first is super,
// rest are Interface's
Expand Down
6 changes: 3 additions & 3 deletions src/arrayop.c
Original file line number Diff line number Diff line change
Expand Up @@ -319,7 +319,7 @@ Expression *BinExp::arrayOp(Scope *sc)

Parameters *fparams = new Parameters();
Expression *loopbody = buildArrayLoop(fparams);
Parameter *p = (Parameter *)fparams->data[0 /*fparams->dim - 1*/];
Parameter *p = fparams->tdata()[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));
Expand Down Expand Up @@ -522,7 +522,7 @@ Expression *AssignExp::buildArrayLoop(Parameters *fparams)
ex2 = new CastExp(0, ex2, e1->type->nextOf());
#endif
Expression *ex1 = e1->buildArrayLoop(fparams);
Parameter *param = (Parameter *)fparams->data[0];
Parameter *param = fparams->tdata()[0];
param->storageClass = 0;
Expression *e = new AssignExp(0, ex1, ex2);
return e;
Expand All @@ -535,7 +535,7 @@ Expression *Str##AssignExp::buildArrayLoop(Parameters *fparams) \
*/ \
Expression *ex2 = e2->buildArrayLoop(fparams); \
Expression *ex1 = e1->buildArrayLoop(fparams); \
Parameter *param = (Parameter *)fparams->data[0]; \
Parameter *param = fparams->tdata()[0]; \
param->storageClass = 0; \
Expression *e = new Str##AssignExp(0, ex1, ex2); \
return e; \
Expand Down
1 change: 1 addition & 0 deletions src/arraytypes.h
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,7 @@ struct Symbol;
void insert(unsigned index, TYPE *v) { ArrayBase::insert(index, (void *)v); } \
void insert(unsigned index, ArrayOf_##TYPE *a) { ArrayBase::insert(index, (ArrayBase *)a); } \
void append(ArrayOf_##TYPE *a) { ArrayBase::append((ArrayBase *)a); } \
void push(TYPE *a) { ArrayBase::push((void *)a); } \
ArrayOf_##TYPE *copy() { return (ArrayOf_##TYPE *)ArrayBase::copy(); } \
}

Expand Down
Loading

0 comments on commit 9859b1b

Please sign in to comment.