tests/JsCoreExecTest.vala.c
authorAlan Knowles <alan@roojs.com>
Thu, 19 Mar 2015 10:44:12 +0000 (18:44 +0800)
committerAlan Knowles <alan@roojs.com>
Thu, 19 Mar 2015 10:44:12 +0000 (18:44 +0800)
tests/Javascript.vala.c

src/Palete/Javascript.vala
src/c/jscore_object_call_as_function.o [new file with mode: 0644]
src/vapi/javascriptcore.vapi

index d1aa9e6..a4015e4 100644 (file)
@@ -141,7 +141,7 @@ namespace Palete {
                          JSCore.Value exb;
                        unowned JSCore.Value exc;
                           JSCore.Value exd;
-                          JSCore.Value exe;
+                          unowned JSCore.Value exe;
                        
                        var goc = new JSCore.Class(  class_definition ); 
                        var ctx = new JSCore.GlobalContext(goc);
@@ -166,7 +166,7 @@ namespace Palete {
                        if (!val.is_object(ctx)) {
                                throw new JavascriptError.MISSING_METHOD ("Plugin: not a property not found  %s", call_method);
                        }
-                       var oval = val.to_object(ctx, out exc);
+                       var oval = val.to_object(ctx,  out  exc);
                        
                        if (!oval.is_function(ctx)) {
                                throw new JavascriptError.MISSING_METHOD ("Plugin: not a method  %s", call_method);
@@ -183,12 +183,12 @@ namespace Palete {
                         
                         unowned JSCore.Value res = oval.call_as_function(ctx, othis, null, out exd);
                        // extract the text value from res...
-                        var sv = rs.to_string_copy ( ctx, out exe);
+                        JSCore.String  sv = res.to_string_copy ( ctx,  out  exe);
                         var length = sv.get_maximum_utf8_c_string_size();
                         var buf = new string[length];
                        
                         sv.get_utf8_c_string( buf, length);
-                       printf("ret:%s\n", buf);
+                       print("ret:%s\n",(string)  buf);
          
                        
                }
diff --git a/src/c/jscore_object_call_as_function.o b/src/c/jscore_object_call_as_function.o
new file mode 100644 (file)
index 0000000..3173458
Binary files /dev/null and b/src/c/jscore_object_call_as_function.o differ
index 62f74fa..425d226 100644 (file)
@@ -335,7 +335,7 @@ namespace JSCore {
     public double to_number (Context ctx, Value *exception);
 
     [CCode (cname = "JSValueToStringCopy", instance_pos=1.1)]
-    public JSCore.String to_string_copy (Context ctx, Value *exception);
+    public JSCore.String to_string_copy (Context ctx, out Value *exception);
 
     [CCode (cname = "JSValueToObject", instance_pos=1.1)]
     public Object to_object (Context ctx, out Value *exception);