Commit bc1b8b27 authored by Gabriel Ivăncescu's avatar Gabriel Ivăncescu Committed by Alexandre Julliard

jscript: Implement WeakMap.get().

parent b4373a9e
...@@ -683,8 +683,23 @@ static HRESULT WeakMap_delete(script_ctx_t *ctx, jsval_t vthis, WORD flags, unsi ...@@ -683,8 +683,23 @@ static HRESULT WeakMap_delete(script_ctx_t *ctx, jsval_t vthis, WORD flags, unsi
static HRESULT WeakMap_get(script_ctx_t *ctx, jsval_t vthis, WORD flags, unsigned argc, jsval_t *argv, static HRESULT WeakMap_get(script_ctx_t *ctx, jsval_t vthis, WORD flags, unsigned argc, jsval_t *argv,
jsval_t *r) jsval_t *r)
{ {
FIXME("\n"); jsdisp_t *key = (argc >= 1 && is_object_instance(argv[0])) ? to_jsdisp(get_object(argv[0])) : NULL;
return E_NOTIMPL; struct weakmap_entry *entry;
WeakMapInstance *weakmap;
HRESULT hres;
hres = get_weakmap_this(ctx, vthis, &weakmap);
if(FAILED(hres))
return hres;
TRACE("%p (%p)\n", weakmap, key);
if(!(entry = get_weakmap_entry(weakmap, key))) {
if(r) *r = jsval_undefined();
return S_OK;
}
return r ? jsval_copy(entry->value, r) : S_OK;
} }
static HRESULT WeakMap_set(script_ctx_t *ctx, jsval_t vthis, WORD flags, unsigned argc, jsval_t *argv, static HRESULT WeakMap_set(script_ctx_t *ctx, jsval_t vthis, WORD flags, unsigned argc, jsval_t *argv,
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment