@@ -432,7 +432,7 @@ static JSValueConst *convert_arguments_to_javascript(FunctionCallInfo fcinfo,
432432 if (isnull ) {
433433 argv [i ] = JS_NULL ;
434434 } else {
435- argv [i ] = pljs_datum_to_jsvalue (arg , argtypes [i ], context -> ctx , true);
435+ argv [i ] = pljs_datum_to_jsvalue (argtypes [i ], arg , context -> ctx , true);
436436 }
437437 }
438438 } else {
@@ -456,8 +456,8 @@ static JSValueConst *convert_arguments_to_javascript(FunctionCallInfo fcinfo,
456456 if (fcinfo -> args [inargs ].isnull == 1 ) {
457457 argv [inargs ] = JS_NULL ;
458458 } else {
459- argv [inargs ] = pljs_datum_to_jsvalue (fcinfo -> args [ inargs ]. value ,
460- argtype , context -> ctx , false);
459+ argv [inargs ] = pljs_datum_to_jsvalue (
460+ argtype , fcinfo -> args [ inargs ]. value , context -> ctx , false);
461461 }
462462
463463 inargs ++ ;
@@ -986,7 +986,7 @@ static Datum call_trigger(FunctionCallInfo fcinfo, pljs_context *context) {
986986
987987 pljs_type type ;
988988 pljs_type_fill (& type , context -> function -> rettype );
989- Datum d = pljs_jsvalue_to_record (ret , & type , context -> ctx , NULL , tupdesc );
989+ Datum d = pljs_jsvalue_to_record (& type , ret , context -> ctx , NULL , tupdesc );
990990
991991 HeapTupleHeader header = DatumGetHeapTupleHeader (d );
992992
@@ -1064,11 +1064,11 @@ static Datum call_function(FunctionCallInfo fcinfo, pljs_context *context,
10641064 pljs_type type ;
10651065 pljs_type_fill (& type , rettype );
10661066
1067- datum = pljs_jsvalue_to_record (ret , & type , context -> ctx , NULL , tupdesc );
1067+ datum = pljs_jsvalue_to_record (& type , ret , context -> ctx , NULL , tupdesc );
10681068 } else {
10691069 bool is_null ;
10701070 datum =
1071- pljs_jsvalue_to_datum (ret , rettype , context -> ctx , fcinfo , & is_null );
1071+ pljs_jsvalue_to_datum (rettype , ret , context -> ctx , fcinfo , & is_null );
10721072 }
10731073
10741074 JS_FreeValue (context -> ctx , ret );
@@ -1189,7 +1189,7 @@ static Datum call_srf_function(FunctionCallInfo fcinfo, pljs_context *context,
11891189 if (state -> is_composite ) {
11901190 bool * nulls = (bool * )palloc0 (sizeof (bool ) * state -> tuple_desc -> natts );
11911191
1192- Datum * values = pljs_jsvalue_to_datums (argv [0 ], NULL , context -> ctx ,
1192+ Datum * values = pljs_jsvalue_to_datums (NULL , argv [0 ], context -> ctx ,
11931193 & nulls , state -> tuple_desc );
11941194 tuplestore_putvalues (state -> tuple_store_state , state -> tuple_desc ,
11951195 values , nulls );
@@ -1203,15 +1203,15 @@ static Datum call_srf_function(FunctionCallInfo fcinfo, pljs_context *context,
12031203 JSValue val = JS_GetPropertyUint32 (context -> ctx , ret , i );
12041204
12051205 Datum result = pljs_jsvalue_to_datum (
1206- val , TupleDescAttr (state -> tuple_desc , 0 )-> atttypid ,
1206+ TupleDescAttr (state -> tuple_desc , 0 )-> atttypid , val ,
12071207 context -> ctx , NULL , & is_null );
12081208 tuplestore_putvalues (state -> tuple_store_state , state -> tuple_desc ,
12091209 & result , & is_null );
12101210 }
12111211 } else {
12121212 if (!JS_IsUndefined (ret )) {
12131213 Datum result = pljs_jsvalue_to_datum (
1214- ret , TupleDescAttr (state -> tuple_desc , 0 )-> atttypid ,
1214+ TupleDescAttr (state -> tuple_desc , 0 )-> atttypid , ret ,
12151215 context -> ctx , NULL , & is_null );
12161216
12171217 tuplestore_putvalues (state -> tuple_store_state , state -> tuple_desc ,
0 commit comments