jscript: Added block statement implementation.

This commit is contained in:
Jacek Caban 2008-09-10 21:10:41 +02:00 committed by Alexandre Julliard
parent e7786d1d45
commit 026bbea672
2 changed files with 34 additions and 3 deletions

View File

@ -478,10 +478,35 @@ static HRESULT identifier_eval(exec_ctx_t *ctx, BSTR identifier, DWORD flags, ex
return E_FAIL;
}
HRESULT block_statement_eval(exec_ctx_t *ctx, statement_t *stat, return_type_t *rt, VARIANT *ret)
/* ECMA-262 3rd Edition 12.1 */
HRESULT block_statement_eval(exec_ctx_t *ctx, statement_t *_stat, return_type_t *rt, VARIANT *ret)
{
FIXME("\n");
return E_NOTIMPL;
block_statement_t *stat = (block_statement_t*)_stat;
VARIANT val, tmp;
statement_t *iter;
HRESULT hres = S_OK;
TRACE("\n");
V_VT(&val) = VT_EMPTY;
for(iter = stat->stat_list; iter; iter = iter->next) {
hres = stat_eval(ctx, iter, rt, &tmp);
if(FAILED(hres))
break;
VariantClear(&val);
val = tmp;
if(rt->type != RT_NORMAL)
break;
}
if(FAILED(hres)) {
VariantClear(&val);
return hres;
}
*ret = val;
return S_OK;
}
/* ECMA-262 3rd Edition 12.2 */

View File

@ -144,4 +144,10 @@ var obj3 = { prop1: 1, prop2: typeof(false) };
ok(obj3.prop1 === 1, "obj3.prop1 is not 1");
ok(obj3.prop2 === "boolean", "obj3.prop2 is not \"boolean\"");
{
var blockVar = 1;
blockVar = 2;
}
ok(blockVar === 2, "blockVar !== 2");
reportSuccess();