Skip to content

Commit

Permalink
[style] fix indent
Browse files Browse the repository at this point in the history
  • Loading branch information
9rnsr committed Mar 10, 2014
1 parent 3e086a6 commit 9d7366d
Showing 1 changed file with 34 additions and 17 deletions.
51 changes: 34 additions & 17 deletions src/expression.c
Expand Up @@ -4756,7 +4756,8 @@ Expression *NewExp::semantic(Scope *sc)
nargs = arguments ? arguments->dim : 0;

if (thisexp && tb->ty != Tclass)
{ error("e.new is only for allocating nested classes, not %s", tb->toChars());
{
error("e.new is only for allocating nested classes, not %s", tb->toChars());
goto Lerr;
}

Expand All @@ -4767,26 +4768,31 @@ Expression *NewExp::semantic(Scope *sc)
if (cd->scope)
cd->semantic(NULL);
if (cd->isInterfaceDeclaration())
{ error("cannot create instance of interface %s", cd->toChars());
{
error("cannot create instance of interface %s", cd->toChars());
goto Lerr;
}
else if (cd->isAbstract())
{ error("cannot create instance of abstract class %s", cd->toChars());
{
error("cannot create instance of abstract class %s", cd->toChars());
for (size_t i = 0; i < cd->vtbl.dim; i++)
{ FuncDeclaration *fd = cd->vtbl[i]->isFuncDeclaration();
{
FuncDeclaration *fd = cd->vtbl[i]->isFuncDeclaration();
if (fd && fd->isAbstract())
errorSupplemental(loc, "function '%s' is not implemented", fd->toFullSignature());
}
goto Lerr;
}

if (cd->noDefaultCtor && !nargs && !cd->defaultCtor)
{ error("default construction is disabled for type %s", cd->type->toChars());
{
error("default construction is disabled for type %s", cd->type->toChars());
goto Lerr;
}
checkDeprecated(sc, cd);
if (cd->isNested())
{ /* We need a 'this' pointer for the nested class.
{
/* We need a 'this' pointer for the nested class.
* Ensure we have the right one.
*/
Dsymbol *s = cd->toParent2();
Expand All @@ -4801,7 +4807,8 @@ Expression *NewExp::semantic(Scope *sc)
// Supply an implicit 'this' and try again
thisexp = new ThisExp(loc);
for (Dsymbol *sp = sc->parent; 1; sp = sp->parent)
{ if (!sp)
{
if (!sp)
{
error("outer class %s 'this' needed to 'new' nested class %s", cdn->toChars(), cd->toChars());
goto Lerr;
Expand All @@ -4821,13 +4828,15 @@ Expression *NewExp::semantic(Scope *sc)
{
//printf("cdthis = %s\n", cdthis->toChars());
if (cdthis != cdn && !cdn->isBaseOf(cdthis, NULL))
{ error("'this' for nested class must be of type %s, not %s", cdn->toChars(), thisexp->type->toChars());
{
error("'this' for nested class must be of type %s, not %s", cdn->toChars(), thisexp->type->toChars());
goto Lerr;
}
}
}
else if (thisexp)
{ error("e.new is only for allocating nested classes");
{
error("e.new is only for allocating nested classes");
goto Lerr;
}
else if (fdn)
Expand All @@ -4849,7 +4858,8 @@ Expression *NewExp::semantic(Scope *sc)
assert(0);
}
else if (thisexp)
{ error("e.new is only for allocating nested classes");
{
error("e.new is only for allocating nested classes");
goto Lerr;
}

Expand Down Expand Up @@ -4880,7 +4890,8 @@ Expression *NewExp::semantic(Scope *sc)
else
{
if (nargs)
{ error("no constructor for %s", cd->toChars());
{
error("no constructor for %s", cd->toChars());
goto Lerr;
}
}
Expand Down Expand Up @@ -4908,7 +4919,8 @@ Expression *NewExp::semantic(Scope *sc)
else
{
if (newargs && newargs->dim)
{ error("no allocator for %s", cd->toChars());
{
error("no allocator for %s", cd->toChars());
goto Lerr;
}
}
Expand All @@ -4920,7 +4932,8 @@ Expression *NewExp::semantic(Scope *sc)
if (sd->scope)
sd->semantic(NULL);
if (sd->noDefaultCtor && !nargs)
{ error("default construction is disabled for type %s", sd->type->toChars());
{
error("default construction is disabled for type %s", sd->type->toChars());
goto Lerr;
}

Expand All @@ -4947,7 +4960,8 @@ Expression *NewExp::semantic(Scope *sc)
else
{
if (newargs && newargs->dim)
{ error("no allocator for %s", sd->toChars());
{
error("no allocator for %s", sd->toChars());
goto Lerr;
}
}
Expand Down Expand Up @@ -5011,13 +5025,15 @@ Expression *NewExp::semantic(Scope *sc)
Dsymbol *s = tn->toDsymbol(sc);
AggregateDeclaration *ad = s ? s->isAggregateDeclaration() : NULL;
if (ad && ad->noDefaultCtor)
{ error("default construction is disabled for type %s", tb->nextOf()->toChars());
{
error("default construction is disabled for type %s", tb->nextOf()->toChars());
goto Lerr;
}
for (size_t i = 0; i < nargs; i++)
{
if (tb->ty != Tarray)
{ error("too many arguments for array");
{
error("too many arguments for array");
goto Lerr;
}

Expand All @@ -5026,7 +5042,8 @@ Expression *NewExp::semantic(Scope *sc)
arg = arg->implicitCastTo(sc, Type::tsize_t);
arg = arg->optimize(WANTvalue);
if (arg->op == TOKint64 && (sinteger_t)arg->toInteger() < 0)
{ error("negative array index %s", arg->toChars());
{
error("negative array index %s", arg->toChars());
goto Lerr;
}
(*arguments)[i] = arg;
Expand Down

0 comments on commit 9d7366d

Please sign in to comment.