jscript: Throw 'Object expected' error in call_expression_eval.

This commit is contained in:
Piotr Caban 2009-09-02 12:33:08 +02:00 committed by Alexandre Julliard
parent c4bc5be262
commit 2e97b1f07f
4 changed files with 11 additions and 5 deletions

View File

@ -1570,16 +1570,19 @@ HRESULT call_expression_eval(exec_ctx_t *ctx, expression_t *_expr, DWORD flags,
if(SUCCEEDED(hres)) {
switch(exprval.type) {
case EXPRVAL_VARIANT:
if(V_VT(&exprval.u.var) != VT_DISPATCH)
return throw_type_error(ctx->var_disp->ctx, ei, IDS_NO_PROPERTY, NULL);
hres = disp_call(V_DISPATCH(&exprval.u.var), DISPID_VALUE, ctx->parser->script->lcid,
DISPATCH_METHOD, &dp, flags & EXPR_NOVAL ? NULL : &var, ei, NULL/*FIXME*/);
if(V_VT(&exprval.u.var) == VT_DISPATCH)
hres = disp_call(V_DISPATCH(&exprval.u.var), DISPID_VALUE, ctx->parser->script->lcid,
DISPATCH_METHOD, &dp, flags & EXPR_NOVAL ? NULL : &var, ei, NULL/*FIXME*/);
else
hres = throw_type_error(ctx->var_disp->ctx, ei, IDS_NO_PROPERTY, NULL);
break;
case EXPRVAL_IDREF:
hres = disp_call(exprval.u.idref.disp, exprval.u.idref.id, ctx->parser->script->lcid,
DISPATCH_METHOD, &dp, flags & EXPR_NOVAL ? NULL : &var, ei, NULL/*FIXME*/);
break;
case EXPRVAL_INVALID:
hres = throw_type_error(ctx->var_disp->ctx, ei, IDS_OBJECT_EXPECTED, NULL);
break;
default:
FIXME("unimplemented type %d\n", exprval.type);
hres = E_NOTIMPL;

View File

@ -34,6 +34,7 @@ STRINGTABLE DISCARDABLE
IDS_NOT_FUNC "Function expected"
IDS_NOT_DATE "'[object]' is not a date object"
IDS_NOT_NUM "Number expected"
IDS_OBJECT_EXPECTED "Object expected"
IDS_ILLEGAL_ASSIGN "Illegal assignment"
IDS_UNDEFINED "'|' is undefined"
IDS_NOT_BOOL "Boolean object expected"

View File

@ -30,6 +30,7 @@
#define IDS_NOT_FUNC 0x138A
#define IDS_NOT_DATE 0x138E
#define IDS_NOT_NUM 0x1389
#define IDS_OBJECT_EXPECTED 0x128F
#define IDS_ILLEGAL_ASSIGN 0x1390
#define IDS_UNDEFINED 0x1391
#define IDS_NOT_BOOL 0x1392

View File

@ -1481,6 +1481,7 @@ exception_test(function() {eval("for(i=0;i<10")}, "SyntaxError", -2146827284);
exception_test(function() {eval("while(")}, "SyntaxError", -2146827286);
exception_test(function() {eval("if(")}, "SyntaxError", -2146827286);
exception_test(function() {eval("'unterminated")}, "SyntaxError", -2146827273);
exception_test(function() {eval("nonexistingfunc()")}, "TypeError", -2146823537);
function testObjectInherit(obj, constr, ts, tls, vo) {
ok(obj instanceof Object, "obj is not instance of Object");