Commit 9a496ce1 authored by Jacek Caban's avatar Jacek Caban Committed by Alexandre Julliard

jscript: Added get_op_bstr helper.

parent 942f2ce7
...@@ -554,10 +554,14 @@ static HRESULT identifier_eval(script_ctx_t *ctx, BSTR identifier, exprval_t *re ...@@ -554,10 +554,14 @@ static HRESULT identifier_eval(script_ctx_t *ctx, BSTR identifier, exprval_t *re
return S_OK; return S_OK;
} }
static inline BSTR get_op_bstr(exec_ctx_t *ctx, int i){
return i ? ctx->code->instrs[ctx->ip].arg2.bstr : ctx->code->instrs[ctx->ip].arg1.bstr;
}
/* ECMA-262 3rd Edition 12.2 */ /* ECMA-262 3rd Edition 12.2 */
static HRESULT interp_var_set(exec_ctx_t *ctx) static HRESULT interp_var_set(exec_ctx_t *ctx)
{ {
const BSTR name = ctx->code->instrs[ctx->ip].arg1.bstr; const BSTR name = get_op_bstr(ctx, 0);
VARIANT *v; VARIANT *v;
HRESULT hres; HRESULT hres;
...@@ -730,7 +734,7 @@ static HRESULT interp_throw_type(exec_ctx_t *ctx) ...@@ -730,7 +734,7 @@ static HRESULT interp_throw_type(exec_ctx_t *ctx)
static HRESULT interp_push_except(exec_ctx_t *ctx) static HRESULT interp_push_except(exec_ctx_t *ctx)
{ {
const unsigned arg1 = ctx->code->instrs[ctx->ip].arg1.uint; const unsigned arg1 = ctx->code->instrs[ctx->ip].arg1.uint;
const BSTR arg2 = ctx->code->instrs[ctx->ip].arg2.bstr; const BSTR arg2 = get_op_bstr(ctx, 1);
except_frame_t *except; except_frame_t *except;
unsigned stack_top; unsigned stack_top;
...@@ -863,7 +867,7 @@ static HRESULT interp_array(exec_ctx_t *ctx) ...@@ -863,7 +867,7 @@ static HRESULT interp_array(exec_ctx_t *ctx)
/* ECMA-262 3rd Edition 11.2.1 */ /* ECMA-262 3rd Edition 11.2.1 */
static HRESULT interp_member(exec_ctx_t *ctx) static HRESULT interp_member(exec_ctx_t *ctx)
{ {
const BSTR arg = ctx->code->instrs[ctx->ip].arg1.bstr; const BSTR arg = get_op_bstr(ctx, 0);
IDispatch *obj; IDispatch *obj;
VARIANT v; VARIANT v;
DISPID id; DISPID id;
...@@ -1072,7 +1076,7 @@ static HRESULT interp_this(exec_ctx_t *ctx) ...@@ -1072,7 +1076,7 @@ static HRESULT interp_this(exec_ctx_t *ctx)
/* ECMA-262 3rd Edition 10.1.4 */ /* ECMA-262 3rd Edition 10.1.4 */
static HRESULT interp_ident(exec_ctx_t *ctx) static HRESULT interp_ident(exec_ctx_t *ctx)
{ {
const BSTR arg = ctx->code->instrs[ctx->ip].arg1.bstr; const BSTR arg = get_op_bstr(ctx, 0);
exprval_t exprval; exprval_t exprval;
VARIANT v; VARIANT v;
HRESULT hres; HRESULT hres;
...@@ -1097,7 +1101,7 @@ static HRESULT interp_ident(exec_ctx_t *ctx) ...@@ -1097,7 +1101,7 @@ static HRESULT interp_ident(exec_ctx_t *ctx)
/* ECMA-262 3rd Edition 10.1.4 */ /* ECMA-262 3rd Edition 10.1.4 */
static HRESULT interp_identid(exec_ctx_t *ctx) static HRESULT interp_identid(exec_ctx_t *ctx)
{ {
const BSTR arg = ctx->code->instrs[ctx->ip].arg1.bstr; const BSTR arg = get_op_bstr(ctx, 0);
const unsigned flags = ctx->code->instrs[ctx->ip].arg2.uint; const unsigned flags = ctx->code->instrs[ctx->ip].arg2.uint;
exprval_t exprval; exprval_t exprval;
HRESULT hres; HRESULT hres;
...@@ -1259,7 +1263,7 @@ static HRESULT interp_new_obj(exec_ctx_t *ctx) ...@@ -1259,7 +1263,7 @@ static HRESULT interp_new_obj(exec_ctx_t *ctx)
/* ECMA-262 3rd Edition 11.1.5 */ /* ECMA-262 3rd Edition 11.1.5 */
static HRESULT interp_obj_prop(exec_ctx_t *ctx) static HRESULT interp_obj_prop(exec_ctx_t *ctx)
{ {
const BSTR name = ctx->code->instrs[ctx->ip].arg1.bstr; const BSTR name = get_op_bstr(ctx, 0);
jsdisp_t *obj; jsdisp_t *obj;
VARIANT *v; VARIANT *v;
HRESULT hres; HRESULT hres;
...@@ -1687,7 +1691,7 @@ static HRESULT interp_delete(exec_ctx_t *ctx) ...@@ -1687,7 +1691,7 @@ static HRESULT interp_delete(exec_ctx_t *ctx)
/* ECMA-262 3rd Edition 11.4.2 */ /* ECMA-262 3rd Edition 11.4.2 */
static HRESULT interp_delete_ident(exec_ctx_t *ctx) static HRESULT interp_delete_ident(exec_ctx_t *ctx)
{ {
const BSTR arg = ctx->code->instrs[ctx->ip].arg1.bstr; const BSTR arg = get_op_bstr(ctx, 0);
IDispatchEx *dispex; IDispatchEx *dispex;
exprval_t exprval; exprval_t exprval;
BOOL ret = FALSE; BOOL ret = FALSE;
...@@ -1805,7 +1809,7 @@ static HRESULT interp_typeofid(exec_ctx_t *ctx) ...@@ -1805,7 +1809,7 @@ static HRESULT interp_typeofid(exec_ctx_t *ctx)
/* ECMA-262 3rd Edition 11.4.3 */ /* ECMA-262 3rd Edition 11.4.3 */
static HRESULT interp_typeofident(exec_ctx_t *ctx) static HRESULT interp_typeofident(exec_ctx_t *ctx)
{ {
const BSTR arg = ctx->code->instrs[ctx->ip].arg1.bstr; const BSTR arg = get_op_bstr(ctx, 0);
exprval_t exprval; exprval_t exprval;
const WCHAR *ret; const WCHAR *ret;
VARIANT v; VARIANT v;
......
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