jscript: Add Map.prototype.get implementation.
Signed-off-by: Jacek Caban <jacek@codeweavers.com> Signed-off-by: Alexandre Julliard <julliard@winehq.org>
This commit is contained in:
parent
9ced0b1fbc
commit
6cc5aa4286
|
@ -231,8 +231,20 @@ static HRESULT Map_forEach(script_ctx_t *ctx, vdisp_t *jsthis, WORD flags, unsig
|
||||||
static HRESULT Map_get(script_ctx_t *ctx, vdisp_t *jsthis, WORD flags, unsigned argc, jsval_t *argv,
|
static HRESULT Map_get(script_ctx_t *ctx, vdisp_t *jsthis, WORD flags, unsigned argc, jsval_t *argv,
|
||||||
jsval_t *r)
|
jsval_t *r)
|
||||||
{
|
{
|
||||||
FIXME("%p\n", jsthis);
|
jsval_t key = argc >= 1 ? argv[0] : jsval_undefined();
|
||||||
return E_NOTIMPL;
|
struct jsval_map_entry *entry;
|
||||||
|
MapInstance *map;
|
||||||
|
|
||||||
|
if(!(map = get_map_this(jsthis))) return JS_E_MAP_EXPECTED;
|
||||||
|
|
||||||
|
TRACE("%p (%s)\n", map, debugstr_jsval(key));
|
||||||
|
|
||||||
|
if(!(entry = get_map_entry(map, key))) {
|
||||||
|
if(r) *r = jsval_undefined();
|
||||||
|
return S_OK;
|
||||||
|
}
|
||||||
|
|
||||||
|
return r ? jsval_copy(entry->value, r) : S_OK;
|
||||||
}
|
}
|
||||||
|
|
||||||
static HRESULT Map_set(script_ctx_t *ctx, vdisp_t *jsthis, WORD flags, unsigned argc, jsval_t *argv,
|
static HRESULT Map_set(script_ctx_t *ctx, vdisp_t *jsthis, WORD flags, unsigned argc, jsval_t *argv,
|
||||||
|
|
Loading…
Reference in New Issue