Skip to content

Commit

Permalink
Merge pull request #2813 from yebblies/danglingelses
Browse files Browse the repository at this point in the history
[DDMD] Get rid of dangling elses
  • Loading branch information
9rnsr committed Nov 18, 2013
2 parents b5c4e44 + 3630991 commit 7512d97
Show file tree
Hide file tree
Showing 8 changed files with 12 additions and 31 deletions.
8 changes: 0 additions & 8 deletions src/cast.c
Original file line number Diff line number Diff line change
Expand Up @@ -1077,14 +1077,6 @@ Expression *Expression::castTo(Scope *sc, Type *t)
else
e = new AddrExp(loc, e);
}
#if 0
else if (tb->ty == Tdelegate && type->ty != Tdelegate)
{
TypeDelegate *td = (TypeDelegate *)tb;
TypeFunction *tf = (TypeFunction *)td->nextOf();
return toDelegate(sc, tf->nextOf());
}
#endif
else
{
if (typeb->ty == Tstruct)
Expand Down
5 changes: 0 additions & 5 deletions src/constfold.c
Original file line number Diff line number Diff line change
Expand Up @@ -835,11 +835,6 @@ Expression *Equal(TOK op, Type *type, Expression *e1, Expression *e2)
cmp = 0;
}
}
#if 0 // Should handle this
else if (e1->op == TOKarrayliteral && e2->op == TOKstring)
{
}
#endif
else if (e1->isConst() != 1 || e2->isConst() != 1)
return EXP_CANT_INTERPRET;
else if (e1->type->isreal())
Expand Down
2 changes: 2 additions & 0 deletions src/ctfeexpr.c
Original file line number Diff line number Diff line change
Expand Up @@ -331,12 +331,14 @@ Expression *copyLiteral(Expression *e)
else if (e->op == TOKindex)
r = new IndexExp(e->loc, ((IndexExp *)e)->e1, ((IndexExp *)e)->e2);
else if (e->op == TOKdotvar)
{
#if DMDV2
r = new DotVarExp(e->loc, ((DotVarExp *)e)->e1,
((DotVarExp *)e)->var, ((DotVarExp *)e)->hasOverloads);
#else
r = new DotVarExp(e->loc, ((DotVarExp *)e)->e1, ((DotVarExp *)e)->var);
#endif
}
else
assert(0);
r->type = e->type;
Expand Down
2 changes: 0 additions & 2 deletions src/dsymbol.c
Original file line number Diff line number Diff line change
Expand Up @@ -797,12 +797,10 @@ void Dsymbol::addComment(const utf8_t *comment)

if (!this->comment)
this->comment = comment;
#if 1
else if (comment && strcmp((char *)comment, (char *)this->comment) != 0)
{ // Concatenate the two
this->comment = Lexer::combineComments(this->comment, comment);
}
#endif
}

/********************************* OverloadSet ****************************/
Expand Down
16 changes: 9 additions & 7 deletions src/interpret.c
Original file line number Diff line number Diff line change
Expand Up @@ -5592,16 +5592,17 @@ Expression *PtrExp::interpret(InterState *istate, CtfeGoal goal)
}
e = Ptr(type, e1);
}
else
{
#if DMDV2
#else // this is required for D1, where structs return *this instead of 'this'.
else if (e1->op == TOKthis)
{
if (ctfeStack.getThis())
return ctfeStack.getThis()->interpret(istate);
}
if (e1->op == TOKthis)
{
if (ctfeStack.getThis())
return ctfeStack.getThis()->interpret(istate);
goto Ldone;
}
#endif
else
{
// Check for .classinfo, which is lowered in the semantic pass into **(class).
if (e1->op == TOKstar && e1->type->ty == Tpointer && isTypeInfo_Class(e1->type->nextOf()))
{
Expand Down Expand Up @@ -5739,6 +5740,7 @@ Expression *PtrExp::interpret(InterState *istate, CtfeGoal goal)
e = paintTypeOntoLiteral(type, e);
}

Ldone:
#if LOG
if (e == EXP_CANT_INTERPRET)
printf("PtrExp::interpret() %s = EXP_CANT_INTERPRET\n", toChars());
Expand Down
6 changes: 0 additions & 6 deletions src/lexer.c
Original file line number Diff line number Diff line change
Expand Up @@ -931,12 +931,6 @@ void Lexer::scan(Token *t)
{ p++;
t->value = TOKminass;
}
#if 0
else if (*p == '>')
{ p++;
t->value = TOKarrow;
}
#endif
else if (*p == '-')
{ p++;
t->value = TOKminusminus;
Expand Down
2 changes: 1 addition & 1 deletion src/root/root.c
Original file line number Diff line number Diff line change
Expand Up @@ -959,7 +959,7 @@ File::~File()
if (ref == 0)
mem.free(buffer);
#if _WIN32
else if (ref == 2)
if (ref == 2)
UnmapViewOfFile(buffer);
#endif
}
Expand Down
2 changes: 0 additions & 2 deletions src/statement.c
Original file line number Diff line number Diff line change
Expand Up @@ -4294,7 +4294,6 @@ Statement *SynchronizedStatement::semantic(Scope *sc)
return s->semantic(sc);
#endif
}
#if 1
else
{ /* Generate our own critical section, then rewrite as:
* __gshared byte[CriticalSection.sizeof] critsec;
Expand Down Expand Up @@ -4331,7 +4330,6 @@ Statement *SynchronizedStatement::semantic(Scope *sc)
s = new CompoundStatement(loc, cs);
return s->semantic(sc);
}
#endif
Lbody:
if (body)
body = body->semantic(sc);
Expand Down

0 comments on commit 7512d97

Please sign in to comment.