Skip to content
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.

Commit 0af0cfc

Browse files
committedJul 5, 2022
Change _aaNew to return Impl*, not AA
_aaNew was added recently in dlang#3863. This is consistent with `_d_assocarrayliteralTX` returning `Impl*`. Also flesh out docs for _d_assocarrayliteralTX.
1 parent 0ae1c82 commit 0af0cfc

File tree

1 file changed

+11
-5
lines changed

1 file changed

+11
-5
lines changed
 

‎src/rt/aaA.d

+11-5
Original file line numberDiff line numberDiff line change
@@ -492,11 +492,9 @@ pure nothrow @nogc unittest
492492
* Returns:
493493
* A new associative array.
494494
*/
495-
extern (C) AA _aaNew(const TypeInfo_AssociativeArray ti)
495+
extern (C) Impl* _aaNew(const TypeInfo_AssociativeArray ti)
496496
{
497-
AA aa;
498-
aa.impl = new Impl(ti);
499-
return aa;
497+
return new Impl(ti);
500498
}
501499

502500
/// Determine number of entries in associative array.
@@ -750,7 +748,15 @@ extern (C) int _aaApply2(AA aa, const size_t keysz, dg2_t dg)
750748
return 0;
751749
}
752750

753-
/// Construct an associative array of type ti from keys and value
751+
/** Construct an associative array of type ti from corresponding keys and values.
752+
* Called for an AA literal `[k1:v1, k2:v2]`.
753+
* Params:
754+
* ti = TypeInfo for the associative array
755+
* keys = array of keys
756+
* vals = array of values
757+
* Returns:
758+
* A new associative array opaque pointer, or null if `keys` is empty.
759+
*/
754760
extern (C) Impl* _d_assocarrayliteralTX(const TypeInfo_AssociativeArray ti, void[] keys,
755761
void[] vals)
756762
{

0 commit comments

Comments
 (0)
Please sign in to comment.