Jacek Caban : jscript: Added plus expression implementation.

Alexandre Julliard julliard at winehq.org
Thu Sep 18 07:55:50 CDT 2008


Module: wine
Branch: master
Commit: 7c6b6c8ca840dc591d05bd3395163fb82eea7c3e
URL:    http://source.winehq.org/git/wine.git/?a=commit;h=7c6b6c8ca840dc591d05bd3395163fb82eea7c3e

Author: Jacek Caban <jacek at codeweavers.com>
Date:   Wed Sep 17 23:33:15 2008 +0200

jscript: Added plus expression implementation.

---

 dlls/jscript/engine.c      |   28 +++++++++++++++++++++++++---
 dlls/jscript/tests/lang.js |    2 ++
 2 files changed, 27 insertions(+), 3 deletions(-)

diff --git a/dlls/jscript/engine.c b/dlls/jscript/engine.c
index ff20151..09b1efe 100644
--- a/dlls/jscript/engine.c
+++ b/dlls/jscript/engine.c
@@ -1871,10 +1871,32 @@ HRESULT minus_expression_eval(exec_ctx_t *ctx, expression_t *_expr, DWORD flags,
     return S_OK;
 }
 
-HRESULT plus_expression_eval(exec_ctx_t *ctx, expression_t *expr, DWORD flags, jsexcept_t *ei, exprval_t *ret)
+/* ECMA-262 3rd Edition    11.4.6 */
+HRESULT plus_expression_eval(exec_ctx_t *ctx, expression_t *_expr, DWORD flags, jsexcept_t *ei, exprval_t *ret)
 {
-    FIXME("\n");
-    return E_NOTIMPL;
+    unary_expression_t *expr = (unary_expression_t*)_expr;
+    exprval_t exprval;
+    VARIANT val, num;
+    HRESULT hres;
+
+    TRACE("\n");
+
+    hres = expr_eval(ctx, expr->expression, EXPR_NEWREF, ei, &exprval);
+    if(FAILED(hres))
+        return hres;
+
+    hres = exprval_to_value(ctx->parser->script, &exprval, ei, &val);
+    exprval_release(&exprval);
+    if(FAILED(hres))
+        return hres;
+
+    hres = to_number(ctx->parser->script, &val, ei, &num);
+    if(FAILED(hres))
+        return hres;
+
+    ret->type = EXPRVAL_VARIANT;
+    ret->u.var = num;
+    return S_OK;
 }
 
 /* ECMA-262 3rd Edition    11.3.1 */
diff --git a/dlls/jscript/tests/lang.js b/dlls/jscript/tests/lang.js
index 03c208a..b4ab2b7 100644
--- a/dlls/jscript/tests/lang.js
+++ b/dlls/jscript/tests/lang.js
@@ -307,6 +307,8 @@ ok(getVT(tmp) === "VT_I4", "getVT(~1) = " + getVT(tmp));
 
 ok((3,4) === 4, "(3,4) !== 4");
 
+ok(+3 === 3, "+3 !== 3");
+
 ok(1 < 3.4, "1 < 3.4 failed");
 ok(!(3.4 < 1), "3.4 < 1");
 ok("abc" < "abcd", "abc < abcd failed");




More information about the wine-cvs mailing list