Jacek Caban : jscript: Added block statement implementation.
Alexandre Julliard
julliard at winehq.org
Thu Sep 11 08:00:56 CDT 2008
Module: wine
Branch: master
Commit: 026bbea6726ad396500bc45f380e3cb18ed506e5
URL: http://source.winehq.org/git/wine.git/?a=commit;h=026bbea6726ad396500bc45f380e3cb18ed506e5
Author: Jacek Caban <jacek at codeweavers.com>
Date: Wed Sep 10 21:10:41 2008 +0200
jscript: Added block statement implementation.
---
dlls/jscript/engine.c | 31 ++++++++++++++++++++++++++++---
dlls/jscript/tests/lang.js | 6 ++++++
2 files changed, 34 insertions(+), 3 deletions(-)
diff --git a/dlls/jscript/engine.c b/dlls/jscript/engine.c
index 6f77eb4..e19a0bb 100644
--- a/dlls/jscript/engine.c
+++ b/dlls/jscript/engine.c
@@ -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 */
diff --git a/dlls/jscript/tests/lang.js b/dlls/jscript/tests/lang.js
index f709015..76cacee 100644
--- a/dlls/jscript/tests/lang.js
+++ b/dlls/jscript/tests/lang.js
@@ -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();
More information about the wine-cvs
mailing list