Jacek Caban : jscript: Add Map.size property implementation.

Alexandre Julliard julliard at winehq.org
Tue Apr 27 16:09:00 CDT 2021


Module: wine
Branch: master
Commit: b8f17fa48add830e4119f4cd738d2512cb82eec7
URL:    https://source.winehq.org/git/wine.git/?a=commit;h=b8f17fa48add830e4119f4cd738d2512cb82eec7

Author: Jacek Caban <jacek at codeweavers.com>
Date:   Tue Apr 27 18:12:29 2021 +0200

jscript: Add Map.size property implementation.

Signed-off-by: Jacek Caban <jacek at codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard at winehq.org>

---

 dlls/jscript/set.c | 17 ++++++++++++++++-
 1 file changed, 16 insertions(+), 1 deletion(-)

diff --git a/dlls/jscript/set.c b/dlls/jscript/set.c
index bb1cd40b540..1fdf4f786fe 100644
--- a/dlls/jscript/set.c
+++ b/dlls/jscript/set.c
@@ -335,6 +335,16 @@ static HRESULT Map_has(script_ctx_t *ctx, vdisp_t *jsthis, WORD flags, unsigned
     return S_OK;
 }
 
+static HRESULT Map_get_size(script_ctx_t *ctx, jsdisp_t *jsthis, jsval_t *r)
+{
+    MapInstance *map = (MapInstance*)jsthis;
+
+    TRACE("%p\n", map);
+
+    *r = jsval_number(map->size);
+    return S_OK;
+}
+
 static HRESULT Map_value(script_ctx_t *ctx, vdisp_t *jsthis, WORD flags, unsigned argc, jsval_t *argv,
         jsval_t *r)
 {
@@ -364,6 +374,10 @@ static const builtin_prop_t Map_prototype_props[] = {
     {L"set",        Map_set,       PROPF_METHOD|2},
 };
 
+static const builtin_prop_t Map_props[] = {
+    {L"size",       NULL,0,        Map_get_size, builtin_set_const},
+};
+
 static const builtin_info_t Map_prototype_info = {
     JSCLASS_OBJECT,
     {NULL, Map_value, 0},
@@ -376,7 +390,8 @@ static const builtin_info_t Map_prototype_info = {
 static const builtin_info_t Map_info = {
     JSCLASS_MAP,
     {NULL, Map_value, 0},
-    0, NULL,
+    ARRAY_SIZE(Map_props),
+    Map_props,
     Map_destructor,
     NULL
 };




More information about the wine-cvs mailing list