Skip to content
This repository was archived by the owner on Oct 12, 2022. It is now read-only.

Commit 651389b

Browse files
ntreldlang-bot
authored andcommitted
Change _aaNew to return Impl*, not AA
_aaNew was added recently in #3863. This is consistent with `_d_assocarrayliteralTX` returning `Impl*`. Also flesh out docs for _d_assocarrayliteralTX.
1 parent 8f22b91 commit 651389b

File tree

1 file changed

+11
-5
lines changed

1 file changed

+11
-5
lines changed

Diff for: src/rt/aaA.d

+11-5
Original file line numberDiff line numberDiff line change
@@ -493,11 +493,9 @@ pure nothrow @nogc unittest
493493
* Returns:
494494
* A new associative array.
495495
*/
496-
extern (C) AA _aaNew(const TypeInfo_AssociativeArray ti)
496+
extern (C) Impl* _aaNew(const TypeInfo_AssociativeArray ti)
497497
{
498-
AA aa;
499-
aa.impl = new Impl(ti);
500-
return aa;
498+
return new Impl(ti);
501499
}
502500

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

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

0 commit comments

Comments
 (0)