From 50fe23390e069d2bdee68a6e82224b7236182101 Mon Sep 17 00:00:00 2001 From: Nick Treleaven Date: Wed, 29 Jun 2022 16:39:16 +0100 Subject: [PATCH 1/2] [rt/aaA] Add _aaNew function to initialize AA Part of https://issues.dlang.org/show_bug.cgi?id=10535. --- src/rt/aaA.d | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/src/rt/aaA.d b/src/rt/aaA.d index ab93f19163..b5897f93d4 100644 --- a/src/rt/aaA.d +++ b/src/rt/aaA.d @@ -485,6 +485,14 @@ pure nothrow @nogc unittest // API Implementation //------------------------------------------------------------------------------ +/// Allocate new AA implementation. +extern (C) AA _aaNew(const TypeInfo_AssociativeArray ti) +{ + AA aa; + aa.impl = new Impl(ti); + return aa; +} + /// Determine number of entries in associative array. extern (C) size_t _aaLen(scope const AA aa) pure nothrow @nogc { From 3052ed287b58c0e80b2df048f3595084d7a67ec5 Mon Sep 17 00:00:00 2001 From: Nick Treleaven Date: Sat, 2 Jul 2022 16:19:22 +0100 Subject: [PATCH 2/2] Improve ddoc --- src/rt/aaA.d | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/src/rt/aaA.d b/src/rt/aaA.d index b5897f93d4..307c1765b8 100644 --- a/src/rt/aaA.d +++ b/src/rt/aaA.d @@ -485,7 +485,13 @@ pure nothrow @nogc unittest // API Implementation //------------------------------------------------------------------------------ -/// Allocate new AA implementation. +/** Allocate associative array data. + * Called for `new SomeAA` expression. + * Params: + * ti = TypeInfo for the associative array + * Returns: + * A new associative array. + */ extern (C) AA _aaNew(const TypeInfo_AssociativeArray ti) { AA aa;