bool jsc::Value::isArray() const {return JSValueIsArray(context, value);}
bool JSValue::IsArray() const { return JSValueIsArray(ctx_, instance()); }
static void gumjs_proxy_get_property_names (JSContextRef ctx, JSObjectRef object, JSPropertyNameAccumulatorRef property_names) { GumJscProxy * self; GumJscCore * core; self = GUMJS_PROXY (object); if (self->enumerate == NULL) return; core = JSObjectGetPrivate (JSContextGetGlobalObject (ctx)); { GumJscScope scope = GUM_JSC_SCOPE_INIT (core); JSValueRef * ex = &scope.exception; JSValueRef value; JSObjectRef names; guint length, i; value = JSObjectCallAsFunction (ctx, self->enumerate, self->receiver, 0, NULL, ex); if (value == NULL) goto beach; if (!JSValueIsArray (ctx, value)) goto invalid_result_type; names = (JSObjectRef) value; if (!_gumjs_object_try_get_uint (ctx, names, "length", &length, ex)) goto beach; for (i = 0; i != length; i++) { JSValueRef element; JSStringRef s; element = JSObjectGetPropertyAtIndex (ctx, names, i, ex); if (element == NULL) goto beach; if (!JSValueIsString (ctx, element)) goto invalid_element_type; s = JSValueToStringCopy (ctx, element, ex); if (s == NULL) goto beach; JSPropertyNameAccumulatorAddName (property_names, s); JSStringRelease (s); } goto beach; invalid_result_type: { _gumjs_throw (ctx, ex, "expected enumerate() to return an array"); goto beach; } invalid_element_type: { _gumjs_throw (ctx, ex, "expected a string"); goto beach; } beach: { _gum_jsc_scope_flush (&scope); } } }