mirror of
https://github.com/dlang/dmd.git
synced 2025-04-26 13:10:12 +03:00
infer returnScope when adding return and scope (#12938)
This commit is contained in:
parent
fa9a7961b8
commit
cdd9063115
1 changed files with 6 additions and 1 deletions
|
@ -730,7 +730,7 @@ bool checkAssignEscape(Scope* sc, Expression e, bool gag)
|
|||
{ /* v is scope, and va is not scope, so va needs to
|
||||
* infer scope
|
||||
*/
|
||||
//printf("inferring scope for %s\n", va.toChars());
|
||||
if (log) printf("inferring scope for %s\n", va.toChars());
|
||||
va.storage_class |= STC.scope_ | STC.scopeinferred;
|
||||
/* v returns, and va does not return, so va needs
|
||||
* to infer return
|
||||
|
@ -738,7 +738,12 @@ bool checkAssignEscape(Scope* sc, Expression e, bool gag)
|
|||
if (v.storage_class & STC.return_ &&
|
||||
!(va.storage_class & STC.return_))
|
||||
{
|
||||
if (log) printf("infer return for %s\n", va.toChars());
|
||||
va.storage_class |= STC.return_ | STC.returninferred;
|
||||
|
||||
// Added "return scope" so don't confuse it with "return ref"
|
||||
if (isRefReturnScope(va.storage_class))
|
||||
va.storage_class |= STC.returnScope;
|
||||
}
|
||||
}
|
||||
continue;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue