Skip to content

Commit

Permalink
CallExp::f should be initialized in its constructor
Browse files Browse the repository at this point in the history
  • Loading branch information
9rnsr committed May 26, 2014
1 parent e9bb4a2 commit 9874632
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 7 deletions.
6 changes: 5 additions & 1 deletion src/expression.c
Expand Up @@ -7953,17 +7953,20 @@ CallExp::CallExp(Loc loc, Expression *e)
: UnaExp(loc, TOKcall, sizeof(CallExp), e)
{
this->arguments = NULL;
this->f = NULL;
}

CallExp::CallExp(Loc loc, Expression *e, Expression *earg1)
: UnaExp(loc, TOKcall, sizeof(CallExp), e)
{
Expressions *arguments = new Expressions();
if (earg1)
{ arguments->setDim(1);
{
arguments->setDim(1);
(*arguments)[0] = earg1;
}
this->arguments = arguments;
this->f = NULL;
}

CallExp::CallExp(Loc loc, Expression *e, Expression *earg1, Expression *earg2)
Expand All @@ -7975,6 +7978,7 @@ CallExp::CallExp(Loc loc, Expression *e, Expression *earg1, Expression *earg2)
(*arguments)[1] = earg2;

this->arguments = arguments;
this->f = NULL;
}

CallExp *CallExp::create(Loc loc, Expression *e, Expressions *exps)
Expand Down
10 changes: 4 additions & 6 deletions src/sideeffect.c
Expand Up @@ -154,9 +154,8 @@ bool lambdaHasSideEffect(Expression *e)
if (t->ty == Tdelegate)
t = ((TypeDelegate *)t)->next;
if (t->ty == Tfunction &&
(ce->f && ce->f->type->ty == Tfunction
? callSideEffectLevel(ce->f)
: callSideEffectLevel(ce->e1->type)) > 0)
(ce->f ? callSideEffectLevel(ce->f)
: callSideEffectLevel(ce->e1->type)) > 0)
{
}
else
Expand Down Expand Up @@ -230,9 +229,8 @@ void discardValue(Expression *e)
if (t->ty == Tdelegate)
t = ((TypeDelegate *)t)->next;
if (t->ty == Tfunction &&
(ce->f && ce->f->type->ty == Tfunction
? callSideEffectLevel(ce->f)
: callSideEffectLevel(ce->e1->type)) > 0)
(ce->f ? callSideEffectLevel(ce->f)
: callSideEffectLevel(ce->e1->type)) > 0)
{
const char *s;
if (ce->f)
Expand Down

0 comments on commit 9874632

Please sign in to comment.