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

jscript: Don't use iface_to_jsdisp where it's not necessary to grab it.

parent 0e9d2215
......@@ -1663,9 +1663,8 @@ static HRESULT ArrayConstr_isArray(script_ctx_t *ctx, jsval_t vthis, WORD flags,
return S_OK;
}
obj = iface_to_jsdisp(get_object(argv[0]));
obj = to_jsdisp(get_object(argv[0]));
if(r) *r = jsval_bool(obj && is_class(obj, JSCLASS_ARRAY));
if(obj) jsdisp_release(obj);
return S_OK;
}
......
......@@ -101,10 +101,9 @@ static inline BOOL is_function_prop(dispex_prop_t *prop)
if (is_object_instance(prop->u.val))
{
jsdisp_t *jsdisp = iface_to_jsdisp(get_object(prop->u.val));
jsdisp_t *jsdisp = to_jsdisp(get_object(prop->u.val));
if (jsdisp) ret = is_class(jsdisp, JSCLASS_FUNCTION);
jsdisp_release(jsdisp);
}
return ret;
}
......
......@@ -514,12 +514,9 @@ static HRESULT disp_get_id(script_ctx_t *ctx, IDispatch *disp, const WCHAR *name
BSTR bstr;
HRESULT hres;
jsdisp = iface_to_jsdisp(disp);
if(jsdisp) {
hres = jsdisp_get_id(jsdisp, name, flags, id);
jsdisp_release(jsdisp);
return hres;
}
jsdisp = to_jsdisp(disp);
if(jsdisp)
return jsdisp_get_id(jsdisp, name, flags, id);
if(name_bstr) {
bstr = name_bstr;
......@@ -1771,7 +1768,7 @@ static HRESULT interp_obj_prop(script_ctx_t *ctx)
jsdisp_t *func;
assert(is_object_instance(val));
func = iface_to_jsdisp(get_object(val));
func = to_jsdisp(get_object(val));
desc.mask = desc.flags;
if(type == PROPERTY_DEFINITION_GETTER) {
......@@ -1783,7 +1780,6 @@ static HRESULT interp_obj_prop(script_ctx_t *ctx)
}
hres = jsdisp_define_property(obj, name, &desc);
jsdisp_release(func);
}
jsval_release(val);
......@@ -1927,15 +1923,12 @@ static HRESULT interp_instanceof(script_ctx_t *ctx)
hres = JS_E_OBJECT_EXPECTED;
else if(is_object_instance(prot)) {
if(is_object_instance(v))
tmp = iface_to_jsdisp(get_object(v));
tmp = to_jsdisp(get_object(v));
for(iter = tmp; !ret && iter; iter = iter->prototype) {
hres = disp_cmp(get_object(prot), to_disp(iter), &ret);
if(FAILED(hres))
break;
}
if(tmp)
jsdisp_release(tmp);
}else {
FIXME("prototype is not an object\n");
hres = E_FAIL;
......@@ -2221,9 +2214,8 @@ static HRESULT typeof_string(jsval_t v, const WCHAR **ret)
case JSV_OBJECT: {
jsdisp_t *dispex;
if((dispex = iface_to_jsdisp(get_object(v)))) {
if((dispex = to_jsdisp(get_object(v)))) {
*ret = is_class(dispex, JSCLASS_FUNCTION) ? L"function" : L"object";
jsdisp_release(dispex);
}else {
*ret = L"object";
}
......
......@@ -754,14 +754,13 @@ static HRESULT stringify(stringify_ctx_t *ctx, jsdisp_t *object, const WCHAR *na
jsdisp_t *obj;
DISPID id;
obj = iface_to_jsdisp(get_object(value));
obj = to_jsdisp(get_object(value));
if(!obj) {
jsval_release(value);
return S_FALSE;
}
hres = jsdisp_get_id(obj, L"toJSON", 0, &id);
jsdisp_release(obj);
if(hres == S_OK)
FIXME("Use toJSON.\n");
}
......
......@@ -666,17 +666,14 @@ HRESULT create_regexp_var(script_ctx_t *ctx, jsval_t src_arg, jsval_t *flags_arg
if(is_object_instance(src_arg)) {
jsdisp_t *obj;
obj = iface_to_jsdisp(get_object(src_arg));
obj = to_jsdisp(get_object(src_arg));
if(obj) {
if(is_class(obj, JSCLASS_REGEXP)) {
RegExpInstance *regexp = regexp_from_jsdisp(obj);
hres = create_regexp(ctx, regexp->str, regexp->jsregexp->flags, ret);
jsdisp_release(obj);
return hres;
}
jsdisp_release(obj);
}
}
......@@ -913,21 +910,16 @@ static HRESULT RegExpConstr_value(script_ctx_t *ctx, jsval_t vthis, WORD flags,
case DISPATCH_METHOD:
if(argc) {
if(is_object_instance(argv[0])) {
jsdisp_t *jsdisp = iface_to_jsdisp(get_object(argv[0]));
jsdisp_t *jsdisp = to_jsdisp(get_object(argv[0]));
if(jsdisp) {
if(is_class(jsdisp, JSCLASS_REGEXP)) {
if(argc > 1 && !is_undefined(argv[1])) {
jsdisp_release(jsdisp);
if(argc > 1 && !is_undefined(argv[1]))
return JS_E_REGEXP_SYNTAX;
}
if(r)
*r = jsval_obj(jsdisp);
else
jsdisp_release(jsdisp);
*r = jsval_obj(jsdisp_addref(jsdisp));
return S_OK;
}
jsdisp_release(jsdisp);
}
}
}
......
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