Commit 95bdd084 authored by Jacek Caban's avatar Jacek Caban Committed by Alexandre Julliard

jscript: Added JSON.stringify implementation.

parent f0be56e1
......@@ -20,6 +20,7 @@
#include "wine/port.h"
#include <math.h>
#include <assert.h>
#include "jscript.h"
......@@ -64,6 +65,12 @@ static inline ArrayInstance *array_this(vdisp_t *jsthis)
return is_vclass(jsthis, JSCLASS_ARRAY) ? array_from_vdisp(jsthis) : NULL;
}
unsigned array_get_length(jsdisp_t *array)
{
assert(is_class(array, JSCLASS_ARRAY));
return array_from_jsdisp(array)->length;
}
static HRESULT get_length(script_ctx_t *ctx, vdisp_t *vdisp, jsdisp_t **jsthis, DWORD *ret)
{
ArrayInstance *array;
......
......@@ -17,6 +17,8 @@
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
*/
#include <assert.h>
#include "jscript.h"
#include "wine/debug.h"
......@@ -37,6 +39,12 @@ static inline BoolInstance *bool_this(vdisp_t *jsthis)
return is_vclass(jsthis, JSCLASS_BOOLEAN) ? (BoolInstance*)jsthis->u.jsdisp : NULL;
}
BOOL bool_obj_value(jsdisp_t *obj)
{
assert(is_class(obj, JSCLASS_BOOLEAN));
return ((BoolInstance*)obj)->val;
}
/* ECMA-262 3rd Edition 15.6.4.2 */
static HRESULT Bool_toString(script_ctx_t *ctx, vdisp_t *jsthis, WORD flags, unsigned argc, jsval_t *argv, jsval_t *r)
{
......
......@@ -461,6 +461,9 @@ HRESULT regexp_match_next(script_ctx_t*,jsdisp_t*,DWORD,jsstr_t*,struct match_st
HRESULT parse_regexp_flags(const WCHAR*,DWORD,DWORD*) DECLSPEC_HIDDEN;
HRESULT regexp_string_match(script_ctx_t*,jsdisp_t*,jsstr_t*,jsval_t*) DECLSPEC_HIDDEN;
BOOL bool_obj_value(jsdisp_t*) DECLSPEC_HIDDEN;
unsigned array_get_length(jsdisp_t*) DECLSPEC_HIDDEN;
static inline BOOL is_class(jsdisp_t *jsdisp, jsclass_t class)
{
return jsdisp->builtin_info->class == class;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment