Skip to content

Commit

Permalink
generalize isBorrowedPtr and isReadonlyPtr (#16402)
Browse files Browse the repository at this point in the history
  • Loading branch information
WalterBright authored Apr 21, 2024
1 parent 56a0ea8 commit c09adbb
Showing 1 changed file with 2 additions and 3 deletions.
5 changes: 2 additions & 3 deletions compiler/src/dmd/ob.d
Original file line number Diff line number Diff line change
Expand Up @@ -1242,8 +1242,7 @@ void allocStates(ref ObState obstate)
bool isBorrowedPtr(VarDeclaration v)
{
return v.isScope() && !v.isowner &&
(!v.type.nextOf() || // could be a struct type with a pointer field
v.type.nextOf().isMutable());
v.type.hasPointersToMutableFields();
}

/******************************
Expand All @@ -1253,7 +1252,7 @@ bool isBorrowedPtr(VarDeclaration v)
*/
bool isReadonlyPtr(VarDeclaration v)
{
return v.isScope() && !v.type.nextOf().isMutable();
return v.isScope() && !v.type.hasPointersToMutableFields();
}

/***************************************
Expand Down

0 comments on commit c09adbb

Please sign in to comment.