Jacek Caban : jscript: Added Function default value implementation.

Alexandre Julliard julliard at winehq.org
Mon Sep 22 07:04:35 CDT 2008


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

Author: Jacek Caban <jacek at codeweavers.com>
Date:   Sun Sep 21 15:48:11 2008 +0200

jscript: Added Function default value implementation.

---

 dlls/jscript/function.c   |   13 +++++++++++++
 dlls/jscript/tests/api.js |    4 ++++
 2 files changed, 17 insertions(+), 0 deletions(-)

diff --git a/dlls/jscript/function.c b/dlls/jscript/function.c
index c0ba1e2..96c41a9 100644
--- a/dlls/jscript/function.c
+++ b/dlls/jscript/function.c
@@ -364,6 +364,19 @@ static HRESULT Function_value(DispatchEx *dispex, LCID lcid, WORD flags, DISPPAR
 
         return invoke_function(function, lcid, dp, retv, ei, caller);
 
+    case DISPATCH_PROPERTYGET: {
+        HRESULT hres;
+        BSTR str;
+
+        hres = function_to_string(function, &str);
+        if(FAILED(hres))
+            return hres;
+
+        V_VT(retv) = VT_BSTR;
+        V_BSTR(retv) = str;
+        break;
+    }
+
     case DISPATCH_CONSTRUCT:
         if(function->value_proc)
             return invoke_value_proc(function, lcid, flags, dp, retv, ei, caller);
diff --git a/dlls/jscript/tests/api.js b/dlls/jscript/tests/api.js
index 4084241..93f06b9 100644
--- a/dlls/jscript/tests/api.js
+++ b/dlls/jscript/tests/api.js
@@ -321,6 +321,8 @@ var func = function  (a) {
     }.toString();
 ok(func.toString() === "function  (a) {\n        var a = 1;\n        if(a) return;\n    }",
    "func.toString() = " + func.toString());
+ok("" + func === "function  (a) {\n        var a = 1;\n        if(a) return;\n    }",
+   "'' + func.toString() = " + func);
 
 function testFuncToString(x,y) {
     return x+y;
@@ -328,5 +330,7 @@ function testFuncToString(x,y) {
 
 ok(testFuncToString.toString() === "function testFuncToString(x,y) {\n    return x+y;\n}",
    "testFuncToString.toString() = " + testFuncToString.toString());
+ok("" + testFuncToString === "function testFuncToString(x,y) {\n    return x+y;\n}",
+   "'' + testFuncToString = " + testFuncToString);
 
 reportSuccess();




More information about the wine-cvs mailing list