Skip to content

Commit

Permalink
fix issue 3490 - DMD Never Inlines Functions that Could Throw
Browse files Browse the repository at this point in the history
  • Loading branch information
Abscissa committed Mar 12, 2014
1 parent a707998 commit 8f3557c
Showing 1 changed file with 12 additions and 0 deletions.
12 changes: 12 additions & 0 deletions src/inline.c
Expand Up @@ -200,6 +200,12 @@ class InlineCostVisitor : public Visitor
//printf("ForStatement: inlineCost = %d\n", cost);
}

void visit(ThrowStatement *s)
{
cost += STATEMENT_COST;
s->exp->accept(this);
}

/* -------------------------- */

void expressionInlineCost(Expression *e)
Expand Down Expand Up @@ -500,6 +506,12 @@ Statement *inlineAsStatement(Statement *s, InlineDoState *ids)
Statement *body = s->body ? inlineAsStatement(s->body, ids) : NULL;
result = new ForStatement(s->loc, init, condition, increment, body);
}

void visit(ThrowStatement *s)
{
//printf("ThrowStatement::inlineAsStatement() '%s'\n", s->exp->toChars());
result = new ThrowStatement(s->loc, doInline(s->exp, ids));
}
};

InlineAsStatement v(ids);
Expand Down

0 comments on commit 8f3557c

Please sign in to comment.