Skip to content

Commit

Permalink
Refactor: remove getExpInitializer so it's used only once
Browse files Browse the repository at this point in the history
  • Loading branch information
9rnsr committed Sep 13, 2015
1 parent 0036506 commit ff18f79
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 22 deletions.
23 changes: 2 additions & 21 deletions src/declaration.d
Expand Up @@ -1574,9 +1574,9 @@ public:
{
error("%s does not have a default initializer", type.toChars());
}
else
else if (auto e = type.defaultInit(loc))
{
_init = getExpInitializer();
_init = new ExpInitializer(loc, e);
}
// Default initializer is always a blit
isBlit = true;
Expand Down Expand Up @@ -2141,25 +2141,6 @@ public:
return e;
}

/****************************
* Get ExpInitializer for a variable, if there is one.
*/
final ExpInitializer getExpInitializer()
{
ExpInitializer ei;
if (_init)
ei = _init.isExpInitializer();
else
{
Expression e = type.defaultInit(loc);
if (e)
ei = new ExpInitializer(loc, e);
else
ei = null;
}
return ei;
}

/*******************************************
* If variable has a constant expression initializer, get it.
* Otherwise, return NULL.
Expand Down
1 change: 0 additions & 1 deletion src/declaration.h
Expand Up @@ -283,7 +283,6 @@ class VarDeclaration : public Declaration
bool canTakeAddressOf();
bool needsAutoDtor();
Expression *callScopeDtor(Scope *sc);
ExpInitializer *getExpInitializer();
Expression *getConstInitializer(bool needFullType = true);
void checkCtorConstInit();
bool checkNestedReference(Scope *sc, Loc loc);
Expand Down

0 comments on commit ff18f79

Please sign in to comment.