mirror of
https://github.com/xomboverlord/ldc.git
synced 2026-02-13 18:33:13 +01:00
Merge dmd-1.074 into ldc.
This commit is contained in:
22
dmd/inline.c
22
dmd/inline.c
@@ -1,5 +1,5 @@
|
||||
|
||||
// Copyright (c) 1999-2011 by Digital Mars
|
||||
// Copyright (c) 1999-2012 by Digital Mars
|
||||
// All Rights Reserved
|
||||
// written by Walter Bright
|
||||
// http://www.digitalmars.com
|
||||
@@ -196,6 +196,8 @@ int lambdaInlineCost(Expression *e, void *param)
|
||||
|
||||
int expressionInlineCost(Expression *e, InlineCostState *ics)
|
||||
{
|
||||
//printf("expressionInlineCost()\n");
|
||||
//e->dump(0);
|
||||
ICS2 ics2;
|
||||
ics2.cost = 0;
|
||||
ics2.ics = ics;
|
||||
@@ -340,6 +342,7 @@ struct InlineDoState
|
||||
Dsymbols from; // old Dsymbols
|
||||
Dsymbols to; // parallel array of new Dsymbols
|
||||
Dsymbol *parent; // new parent
|
||||
FuncDeclaration *fd; // function being inlined (old parent)
|
||||
};
|
||||
|
||||
/* -------------------------------------------------------------------- */
|
||||
@@ -1486,6 +1489,9 @@ int FuncDeclaration::canInline(int hasthis, int hdrscan, int statementsToo)
|
||||
if (
|
||||
!fbody ||
|
||||
ident == Id::ensure || // ensure() has magic properties the inliner loses
|
||||
(ident == Id::require && // require() has magic properties too
|
||||
toParent()->isFuncDeclaration() && // see bug 7699
|
||||
toParent()->isFuncDeclaration()->needThis()) ||
|
||||
!hdrscan &&
|
||||
(
|
||||
#if 0
|
||||
@@ -1600,6 +1606,7 @@ Expression *FuncDeclaration::expandInline(InlineScanState *iss, Expression *ethi
|
||||
|
||||
memset(&ids, 0, sizeof(ids));
|
||||
ids.parent = iss->fd;
|
||||
ids.fd = this;
|
||||
|
||||
if (ps)
|
||||
as = new Statements();
|
||||
@@ -1786,6 +1793,18 @@ Expression *Expression::inlineCopy(Scope *sc)
|
||||
*/
|
||||
return copy();
|
||||
#else
|
||||
if (op == TOKdelegate)
|
||||
{ DelegateExp *de = (DelegateExp *)this;
|
||||
|
||||
if (de->func->isNested())
|
||||
{ /* See Bugzilla 4820
|
||||
* Defer checking until later if we actually need the 'this' pointer
|
||||
*/
|
||||
Expression *e = de->copy();
|
||||
return e;
|
||||
}
|
||||
}
|
||||
|
||||
InlineCostState ics;
|
||||
|
||||
memset(&ics, 0, sizeof(ics));
|
||||
@@ -1802,3 +1821,4 @@ Expression *Expression::inlineCopy(Scope *sc)
|
||||
return e;
|
||||
#endif
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user