/*
    This file is part of the WebKit open source project.
    This file has been generated by generate-bindings.pl. DO NOT MODIFY!

    This library is free software; you can redistribute it and/or
    modify it under the terms of the GNU Library General Public
    License as published by the Free Software Foundation; either
    version 2 of the License, or (at your option) any later version.

    This library is distributed in the hope that it will be useful,
    but WITHOUT ANY WARRANTY; without even the implied warranty of
    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
    Library General Public License for more details.

    You should have received a copy of the GNU Library General Public License
    along with this library; see the file COPYING.LIB.  If not, write to
    the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
    Boston, MA 02110-1301, USA.
*/

#include "config.h"
#include "JSXPathResult.h"

#include "ExceptionCode.h"
#include "JSDOMBinding.h"
#include "JSNode.h"
#include "Node.h"
#include "URL.h"
#include "XPathResult.h"
#include <runtime/Error.h>
#include <runtime/JSString.h>
#include <wtf/GetPtr.h>

using namespace JSC;

namespace WebCore {

/* Hash table */

static const HashTableValue JSXPathResultTableValues[] =
{
    { "resultType", DontDelete | ReadOnly, NoIntrinsic, (intptr_t)static_cast<PropertySlot::GetValueFunc>(jsXPathResultResultType), (intptr_t) static_cast<PutPropertySlot::PutValueFunc>(0) },
    { "numberValue", DontDelete | ReadOnly, NoIntrinsic, (intptr_t)static_cast<PropertySlot::GetValueFunc>(jsXPathResultNumberValue), (intptr_t) static_cast<PutPropertySlot::PutValueFunc>(0) },
    { "stringValue", DontDelete | ReadOnly, NoIntrinsic, (intptr_t)static_cast<PropertySlot::GetValueFunc>(jsXPathResultStringValue), (intptr_t) static_cast<PutPropertySlot::PutValueFunc>(0) },
    { "booleanValue", DontDelete | ReadOnly, NoIntrinsic, (intptr_t)static_cast<PropertySlot::GetValueFunc>(jsXPathResultBooleanValue), (intptr_t) static_cast<PutPropertySlot::PutValueFunc>(0) },
    { "singleNodeValue", DontDelete | ReadOnly, NoIntrinsic, (intptr_t)static_cast<PropertySlot::GetValueFunc>(jsXPathResultSingleNodeValue), (intptr_t) static_cast<PutPropertySlot::PutValueFunc>(0) },
    { "invalidIteratorState", DontDelete | ReadOnly, NoIntrinsic, (intptr_t)static_cast<PropertySlot::GetValueFunc>(jsXPathResultInvalidIteratorState), (intptr_t) static_cast<PutPropertySlot::PutValueFunc>(0) },
    { "snapshotLength", DontDelete | ReadOnly, NoIntrinsic, (intptr_t)static_cast<PropertySlot::GetValueFunc>(jsXPathResultSnapshotLength), (intptr_t) static_cast<PutPropertySlot::PutValueFunc>(0) },
    { "constructor", DontEnum | ReadOnly, NoIntrinsic, (intptr_t)static_cast<PropertySlot::GetValueFunc>(jsXPathResultConstructor), (intptr_t) static_cast<PutPropertySlot::PutValueFunc>(0) },
    { 0, 0, NoIntrinsic, 0, 0 }
};

static const HashTable JSXPathResultTable = { 18, 15, true, JSXPathResultTableValues, 0 };
/* Hash table for constructor */

static const HashTableValue JSXPathResultConstructorTableValues[] =
{
    { "ANY_TYPE", DontDelete | ReadOnly, NoIntrinsic, (intptr_t)static_cast<PropertySlot::GetValueFunc>(jsXPathResultANY_TYPE), (intptr_t) static_cast<PutPropertySlot::PutValueFunc>(0) },
    { "NUMBER_TYPE", DontDelete | ReadOnly, NoIntrinsic, (intptr_t)static_cast<PropertySlot::GetValueFunc>(jsXPathResultNUMBER_TYPE), (intptr_t) static_cast<PutPropertySlot::PutValueFunc>(0) },
    { "STRING_TYPE", DontDelete | ReadOnly, NoIntrinsic, (intptr_t)static_cast<PropertySlot::GetValueFunc>(jsXPathResultSTRING_TYPE), (intptr_t) static_cast<PutPropertySlot::PutValueFunc>(0) },
    { "BOOLEAN_TYPE", DontDelete | ReadOnly, NoIntrinsic, (intptr_t)static_cast<PropertySlot::GetValueFunc>(jsXPathResultBOOLEAN_TYPE), (intptr_t) static_cast<PutPropertySlot::PutValueFunc>(0) },
    { "UNORDERED_NODE_ITERATOR_TYPE", DontDelete | ReadOnly, NoIntrinsic, (intptr_t)static_cast<PropertySlot::GetValueFunc>(jsXPathResultUNORDERED_NODE_ITERATOR_TYPE), (intptr_t) static_cast<PutPropertySlot::PutValueFunc>(0) },
    { "ORDERED_NODE_ITERATOR_TYPE", DontDelete | ReadOnly, NoIntrinsic, (intptr_t)static_cast<PropertySlot::GetValueFunc>(jsXPathResultORDERED_NODE_ITERATOR_TYPE), (intptr_t) static_cast<PutPropertySlot::PutValueFunc>(0) },
    { "UNORDERED_NODE_SNAPSHOT_TYPE", DontDelete | ReadOnly, NoIntrinsic, (intptr_t)static_cast<PropertySlot::GetValueFunc>(jsXPathResultUNORDERED_NODE_SNAPSHOT_TYPE), (intptr_t) static_cast<PutPropertySlot::PutValueFunc>(0) },
    { "ORDERED_NODE_SNAPSHOT_TYPE", DontDelete | ReadOnly, NoIntrinsic, (intptr_t)static_cast<PropertySlot::GetValueFunc>(jsXPathResultORDERED_NODE_SNAPSHOT_TYPE), (intptr_t) static_cast<PutPropertySlot::PutValueFunc>(0) },
    { "ANY_UNORDERED_NODE_TYPE", DontDelete | ReadOnly, NoIntrinsic, (intptr_t)static_cast<PropertySlot::GetValueFunc>(jsXPathResultANY_UNORDERED_NODE_TYPE), (intptr_t) static_cast<PutPropertySlot::PutValueFunc>(0) },
    { "FIRST_ORDERED_NODE_TYPE", DontDelete | ReadOnly, NoIntrinsic, (intptr_t)static_cast<PropertySlot::GetValueFunc>(jsXPathResultFIRST_ORDERED_NODE_TYPE), (intptr_t) static_cast<PutPropertySlot::PutValueFunc>(0) },
    { 0, 0, NoIntrinsic, 0, 0 }
};

static const HashTable JSXPathResultConstructorTable = { 33, 31, true, JSXPathResultConstructorTableValues, 0 };

COMPILE_ASSERT(0 == XPathResult::ANY_TYPE, XPathResultEnumANY_TYPEIsWrongUseDoNotCheckConstants);
COMPILE_ASSERT(1 == XPathResult::NUMBER_TYPE, XPathResultEnumNUMBER_TYPEIsWrongUseDoNotCheckConstants);
COMPILE_ASSERT(2 == XPathResult::STRING_TYPE, XPathResultEnumSTRING_TYPEIsWrongUseDoNotCheckConstants);
COMPILE_ASSERT(3 == XPathResult::BOOLEAN_TYPE, XPathResultEnumBOOLEAN_TYPEIsWrongUseDoNotCheckConstants);
COMPILE_ASSERT(4 == XPathResult::UNORDERED_NODE_ITERATOR_TYPE, XPathResultEnumUNORDERED_NODE_ITERATOR_TYPEIsWrongUseDoNotCheckConstants);
COMPILE_ASSERT(5 == XPathResult::ORDERED_NODE_ITERATOR_TYPE, XPathResultEnumORDERED_NODE_ITERATOR_TYPEIsWrongUseDoNotCheckConstants);
COMPILE_ASSERT(6 == XPathResult::UNORDERED_NODE_SNAPSHOT_TYPE, XPathResultEnumUNORDERED_NODE_SNAPSHOT_TYPEIsWrongUseDoNotCheckConstants);
COMPILE_ASSERT(7 == XPathResult::ORDERED_NODE_SNAPSHOT_TYPE, XPathResultEnumORDERED_NODE_SNAPSHOT_TYPEIsWrongUseDoNotCheckConstants);
COMPILE_ASSERT(8 == XPathResult::ANY_UNORDERED_NODE_TYPE, XPathResultEnumANY_UNORDERED_NODE_TYPEIsWrongUseDoNotCheckConstants);
COMPILE_ASSERT(9 == XPathResult::FIRST_ORDERED_NODE_TYPE, XPathResultEnumFIRST_ORDERED_NODE_TYPEIsWrongUseDoNotCheckConstants);

const ClassInfo JSXPathResultConstructor::s_info = { "XPathResultConstructor", &Base::s_info, &JSXPathResultConstructorTable, 0, CREATE_METHOD_TABLE(JSXPathResultConstructor) };

JSXPathResultConstructor::JSXPathResultConstructor(Structure* structure, JSDOMGlobalObject* globalObject)
    : DOMConstructorObject(structure, globalObject)
{
}

void JSXPathResultConstructor::finishCreation(VM& vm, JSDOMGlobalObject* globalObject)
{
    Base::finishCreation(vm);
    ASSERT(inherits(info()));
    putDirect(vm, vm.propertyNames->prototype, JSXPathResultPrototype::self(vm, globalObject), DontDelete | ReadOnly);
    putDirect(vm, vm.propertyNames->length, jsNumber(0), ReadOnly | DontDelete | DontEnum);
}

bool JSXPathResultConstructor::getOwnPropertySlot(JSObject* object, ExecState* exec, PropertyName propertyName, PropertySlot& slot)
{
    return getStaticValueSlot<JSXPathResultConstructor, JSDOMWrapper>(exec, JSXPathResultConstructorTable, jsCast<JSXPathResultConstructor*>(object), propertyName, slot);
}

/* Hash table for prototype */

static const HashTableValue JSXPathResultPrototypeTableValues[] =
{
    { "ANY_TYPE", DontDelete | ReadOnly, NoIntrinsic, (intptr_t)static_cast<PropertySlot::GetValueFunc>(jsXPathResultANY_TYPE), (intptr_t) static_cast<PutPropertySlot::PutValueFunc>(0) },
    { "NUMBER_TYPE", DontDelete | ReadOnly, NoIntrinsic, (intptr_t)static_cast<PropertySlot::GetValueFunc>(jsXPathResultNUMBER_TYPE), (intptr_t) static_cast<PutPropertySlot::PutValueFunc>(0) },
    { "STRING_TYPE", DontDelete | ReadOnly, NoIntrinsic, (intptr_t)static_cast<PropertySlot::GetValueFunc>(jsXPathResultSTRING_TYPE), (intptr_t) static_cast<PutPropertySlot::PutValueFunc>(0) },
    { "BOOLEAN_TYPE", DontDelete | ReadOnly, NoIntrinsic, (intptr_t)static_cast<PropertySlot::GetValueFunc>(jsXPathResultBOOLEAN_TYPE), (intptr_t) static_cast<PutPropertySlot::PutValueFunc>(0) },
    { "UNORDERED_NODE_ITERATOR_TYPE", DontDelete | ReadOnly, NoIntrinsic, (intptr_t)static_cast<PropertySlot::GetValueFunc>(jsXPathResultUNORDERED_NODE_ITERATOR_TYPE), (intptr_t) static_cast<PutPropertySlot::PutValueFunc>(0) },
    { "ORDERED_NODE_ITERATOR_TYPE", DontDelete | ReadOnly, NoIntrinsic, (intptr_t)static_cast<PropertySlot::GetValueFunc>(jsXPathResultORDERED_NODE_ITERATOR_TYPE), (intptr_t) static_cast<PutPropertySlot::PutValueFunc>(0) },
    { "UNORDERED_NODE_SNAPSHOT_TYPE", DontDelete | ReadOnly, NoIntrinsic, (intptr_t)static_cast<PropertySlot::GetValueFunc>(jsXPathResultUNORDERED_NODE_SNAPSHOT_TYPE), (intptr_t) static_cast<PutPropertySlot::PutValueFunc>(0) },
    { "ORDERED_NODE_SNAPSHOT_TYPE", DontDelete | ReadOnly, NoIntrinsic, (intptr_t)static_cast<PropertySlot::GetValueFunc>(jsXPathResultORDERED_NODE_SNAPSHOT_TYPE), (intptr_t) static_cast<PutPropertySlot::PutValueFunc>(0) },
    { "ANY_UNORDERED_NODE_TYPE", DontDelete | ReadOnly, NoIntrinsic, (intptr_t)static_cast<PropertySlot::GetValueFunc>(jsXPathResultANY_UNORDERED_NODE_TYPE), (intptr_t) static_cast<PutPropertySlot::PutValueFunc>(0) },
    { "FIRST_ORDERED_NODE_TYPE", DontDelete | ReadOnly, NoIntrinsic, (intptr_t)static_cast<PropertySlot::GetValueFunc>(jsXPathResultFIRST_ORDERED_NODE_TYPE), (intptr_t) static_cast<PutPropertySlot::PutValueFunc>(0) },
    { "iterateNext", JSC::Function, NoIntrinsic, (intptr_t)static_cast<NativeFunction>(jsXPathResultPrototypeFunctionIterateNext), (intptr_t) (0) },
    { "snapshotItem", JSC::Function, NoIntrinsic, (intptr_t)static_cast<NativeFunction>(jsXPathResultPrototypeFunctionSnapshotItem), (intptr_t) (0) },
    { 0, 0, NoIntrinsic, 0, 0 }
};

static const HashTable JSXPathResultPrototypeTable = { 33, 31, true, JSXPathResultPrototypeTableValues, 0 };
const ClassInfo JSXPathResultPrototype::s_info = { "XPathResultPrototype", &Base::s_info, &JSXPathResultPrototypeTable, 0, CREATE_METHOD_TABLE(JSXPathResultPrototype) };

JSObject* JSXPathResultPrototype::self(VM& vm, JSGlobalObject* globalObject)
{
    return getDOMPrototype<JSXPathResult>(vm, globalObject);
}

bool JSXPathResultPrototype::getOwnPropertySlot(JSObject* object, ExecState* exec, PropertyName propertyName, PropertySlot& slot)
{
    JSXPathResultPrototype* thisObject = jsCast<JSXPathResultPrototype*>(object);
    return getStaticPropertySlot<JSXPathResultPrototype, JSObject>(exec, JSXPathResultPrototypeTable, thisObject, propertyName, slot);
}

const ClassInfo JSXPathResult::s_info = { "XPathResult", &Base::s_info, &JSXPathResultTable, 0 , CREATE_METHOD_TABLE(JSXPathResult) };

JSXPathResult::JSXPathResult(Structure* structure, JSDOMGlobalObject* globalObject, PassRefPtr<XPathResult> impl)
    : JSDOMWrapper(structure, globalObject)
    , m_impl(impl.leakRef())
{
}

void JSXPathResult::finishCreation(VM& vm)
{
    Base::finishCreation(vm);
    ASSERT(inherits(info()));
}

JSObject* JSXPathResult::createPrototype(VM& vm, JSGlobalObject* globalObject)
{
    return JSXPathResultPrototype::create(vm, globalObject, JSXPathResultPrototype::createStructure(vm, globalObject, globalObject->objectPrototype()));
}

void JSXPathResult::destroy(JSC::JSCell* cell)
{
    JSXPathResult* thisObject = static_cast<JSXPathResult*>(cell);
    thisObject->JSXPathResult::~JSXPathResult();
}

JSXPathResult::~JSXPathResult()
{
    releaseImplIfNotNull();
}

bool JSXPathResult::getOwnPropertySlot(JSObject* object, ExecState* exec, PropertyName propertyName, PropertySlot& slot)
{
    JSXPathResult* thisObject = jsCast<JSXPathResult*>(object);
    ASSERT_GC_OBJECT_INHERITS(thisObject, info());
    return getStaticValueSlot<JSXPathResult, Base>(exec, JSXPathResultTable, thisObject, propertyName, slot);
}

EncodedJSValue jsXPathResultResultType(ExecState* exec, EncodedJSValue slotBase, EncodedJSValue thisValue, PropertyName)
{
    JSXPathResult* castedThis = jsDynamicCast<JSXPathResult*>(JSValue::decode(thisValue));
    UNUSED_PARAM(slotBase);
    if (!castedThis)
        return throwVMTypeError(exec);
    UNUSED_PARAM(exec);
    XPathResult& impl = castedThis->impl();
    JSValue result = jsNumber(impl.resultType());
    return JSValue::encode(result);
}


EncodedJSValue jsXPathResultNumberValue(ExecState* exec, EncodedJSValue slotBase, EncodedJSValue thisValue, PropertyName)
{
    JSXPathResult* castedThis = jsDynamicCast<JSXPathResult*>(JSValue::decode(thisValue));
    UNUSED_PARAM(slotBase);
    if (!castedThis)
        return throwVMTypeError(exec);
    ExceptionCode ec = 0;
    XPathResult& impl = castedThis->impl();
    JSC::JSValue result = jsNumber(impl.numberValue(ec));
    setDOMException(exec, ec);
    return JSValue::encode(result);
}


EncodedJSValue jsXPathResultStringValue(ExecState* exec, EncodedJSValue slotBase, EncodedJSValue thisValue, PropertyName)
{
    JSXPathResult* castedThis = jsDynamicCast<JSXPathResult*>(JSValue::decode(thisValue));
    UNUSED_PARAM(slotBase);
    if (!castedThis)
        return throwVMTypeError(exec);
    ExceptionCode ec = 0;
    XPathResult& impl = castedThis->impl();
    JSC::JSValue result = jsStringWithCache(exec, impl.stringValue(ec));
    setDOMException(exec, ec);
    return JSValue::encode(result);
}


EncodedJSValue jsXPathResultBooleanValue(ExecState* exec, EncodedJSValue slotBase, EncodedJSValue thisValue, PropertyName)
{
    JSXPathResult* castedThis = jsDynamicCast<JSXPathResult*>(JSValue::decode(thisValue));
    UNUSED_PARAM(slotBase);
    if (!castedThis)
        return throwVMTypeError(exec);
    ExceptionCode ec = 0;
    XPathResult& impl = castedThis->impl();
    JSC::JSValue result = jsBoolean(impl.booleanValue(ec));
    setDOMException(exec, ec);
    return JSValue::encode(result);
}


EncodedJSValue jsXPathResultSingleNodeValue(ExecState* exec, EncodedJSValue slotBase, EncodedJSValue thisValue, PropertyName)
{
    JSXPathResult* castedThis = jsDynamicCast<JSXPathResult*>(JSValue::decode(thisValue));
    UNUSED_PARAM(slotBase);
    if (!castedThis)
        return throwVMTypeError(exec);
    ExceptionCode ec = 0;
    XPathResult& impl = castedThis->impl();
    JSC::JSValue result = toJS(exec, castedThis->globalObject(), WTF::getPtr(impl.singleNodeValue(ec)));
    setDOMException(exec, ec);
    return JSValue::encode(result);
}


EncodedJSValue jsXPathResultInvalidIteratorState(ExecState* exec, EncodedJSValue slotBase, EncodedJSValue thisValue, PropertyName)
{
    JSXPathResult* castedThis = jsDynamicCast<JSXPathResult*>(JSValue::decode(thisValue));
    UNUSED_PARAM(slotBase);
    if (!castedThis)
        return throwVMTypeError(exec);
    UNUSED_PARAM(exec);
    XPathResult& impl = castedThis->impl();
    JSValue result = jsBoolean(impl.invalidIteratorState());
    return JSValue::encode(result);
}


EncodedJSValue jsXPathResultSnapshotLength(ExecState* exec, EncodedJSValue slotBase, EncodedJSValue thisValue, PropertyName)
{
    JSXPathResult* castedThis = jsDynamicCast<JSXPathResult*>(JSValue::decode(thisValue));
    UNUSED_PARAM(slotBase);
    if (!castedThis)
        return throwVMTypeError(exec);
    ExceptionCode ec = 0;
    XPathResult& impl = castedThis->impl();
    JSC::JSValue result = jsNumber(impl.snapshotLength(ec));
    setDOMException(exec, ec);
    return JSValue::encode(result);
}


EncodedJSValue jsXPathResultConstructor(ExecState* exec, EncodedJSValue thisValue, EncodedJSValue, PropertyName)
{
    JSXPathResult* domObject = jsDynamicCast<JSXPathResult*>(JSValue::decode(thisValue));
    if (!domObject)
        return throwVMTypeError(exec);
    if (!domObject)
        return throwVMTypeError(exec);
    return JSValue::encode(JSXPathResult::getConstructor(exec->vm(), domObject->globalObject()));
}

JSValue JSXPathResult::getConstructor(VM& vm, JSGlobalObject* globalObject)
{
    return getDOMConstructor<JSXPathResultConstructor>(vm, jsCast<JSDOMGlobalObject*>(globalObject));
}

EncodedJSValue JSC_HOST_CALL jsXPathResultPrototypeFunctionIterateNext(ExecState* exec)
{
    JSValue thisValue = exec->hostThisValue();
    JSXPathResult* castedThis = jsDynamicCast<JSXPathResult*>(thisValue);
    if (!castedThis)
        return throwVMTypeError(exec);
    ASSERT_GC_OBJECT_INHERITS(castedThis, JSXPathResult::info());
    XPathResult& impl = castedThis->impl();
    ExceptionCode ec = 0;

    JSC::JSValue result = toJS(exec, castedThis->globalObject(), WTF::getPtr(impl.iterateNext(ec)));
    setDOMException(exec, ec);
    return JSValue::encode(result);
}

EncodedJSValue JSC_HOST_CALL jsXPathResultPrototypeFunctionSnapshotItem(ExecState* exec)
{
    JSValue thisValue = exec->hostThisValue();
    JSXPathResult* castedThis = jsDynamicCast<JSXPathResult*>(thisValue);
    if (!castedThis)
        return throwVMTypeError(exec);
    ASSERT_GC_OBJECT_INHERITS(castedThis, JSXPathResult::info());
    XPathResult& impl = castedThis->impl();
    ExceptionCode ec = 0;
    unsigned index(toUInt32(exec, exec->argument(0), NormalConversion));
    if (exec->hadException())
        return JSValue::encode(jsUndefined());

    JSC::JSValue result = toJS(exec, castedThis->globalObject(), WTF::getPtr(impl.snapshotItem(index, ec)));
    setDOMException(exec, ec);
    return JSValue::encode(result);
}

// Constant getters

EncodedJSValue jsXPathResultANY_TYPE(ExecState* exec, EncodedJSValue, EncodedJSValue, PropertyName)
{
    UNUSED_PARAM(exec);
    return JSValue::encode(jsNumber(static_cast<int>(0)));
}

EncodedJSValue jsXPathResultNUMBER_TYPE(ExecState* exec, EncodedJSValue, EncodedJSValue, PropertyName)
{
    UNUSED_PARAM(exec);
    return JSValue::encode(jsNumber(static_cast<int>(1)));
}

EncodedJSValue jsXPathResultSTRING_TYPE(ExecState* exec, EncodedJSValue, EncodedJSValue, PropertyName)
{
    UNUSED_PARAM(exec);
    return JSValue::encode(jsNumber(static_cast<int>(2)));
}

EncodedJSValue jsXPathResultBOOLEAN_TYPE(ExecState* exec, EncodedJSValue, EncodedJSValue, PropertyName)
{
    UNUSED_PARAM(exec);
    return JSValue::encode(jsNumber(static_cast<int>(3)));
}

EncodedJSValue jsXPathResultUNORDERED_NODE_ITERATOR_TYPE(ExecState* exec, EncodedJSValue, EncodedJSValue, PropertyName)
{
    UNUSED_PARAM(exec);
    return JSValue::encode(jsNumber(static_cast<int>(4)));
}

EncodedJSValue jsXPathResultORDERED_NODE_ITERATOR_TYPE(ExecState* exec, EncodedJSValue, EncodedJSValue, PropertyName)
{
    UNUSED_PARAM(exec);
    return JSValue::encode(jsNumber(static_cast<int>(5)));
}

EncodedJSValue jsXPathResultUNORDERED_NODE_SNAPSHOT_TYPE(ExecState* exec, EncodedJSValue, EncodedJSValue, PropertyName)
{
    UNUSED_PARAM(exec);
    return JSValue::encode(jsNumber(static_cast<int>(6)));
}

EncodedJSValue jsXPathResultORDERED_NODE_SNAPSHOT_TYPE(ExecState* exec, EncodedJSValue, EncodedJSValue, PropertyName)
{
    UNUSED_PARAM(exec);
    return JSValue::encode(jsNumber(static_cast<int>(7)));
}

EncodedJSValue jsXPathResultANY_UNORDERED_NODE_TYPE(ExecState* exec, EncodedJSValue, EncodedJSValue, PropertyName)
{
    UNUSED_PARAM(exec);
    return JSValue::encode(jsNumber(static_cast<int>(8)));
}

EncodedJSValue jsXPathResultFIRST_ORDERED_NODE_TYPE(ExecState* exec, EncodedJSValue, EncodedJSValue, PropertyName)
{
    UNUSED_PARAM(exec);
    return JSValue::encode(jsNumber(static_cast<int>(9)));
}

bool JSXPathResultOwner::isReachableFromOpaqueRoots(JSC::Handle<JSC::Unknown> handle, void*, SlotVisitor& visitor)
{
    UNUSED_PARAM(handle);
    UNUSED_PARAM(visitor);
    return false;
}

void JSXPathResultOwner::finalize(JSC::Handle<JSC::Unknown> handle, void* context)
{
    JSXPathResult* jsXPathResult = jsCast<JSXPathResult*>(handle.get().asCell());
    DOMWrapperWorld& world = *static_cast<DOMWrapperWorld*>(context);
    uncacheWrapper(world, &jsXPathResult->impl(), jsXPathResult);
    jsXPathResult->releaseImpl();
}

JSC::JSValue toJS(JSC::ExecState* exec, JSDOMGlobalObject* globalObject, XPathResult* impl)
{
    if (!impl)
        return jsNull();
    if (JSValue result = getExistingWrapper<JSXPathResult>(exec, impl))
        return result;
#if COMPILER(CLANG)
    // If you hit this failure the interface definition has the ImplementationLacksVTable
    // attribute. You should remove that attribute. If the class has subclasses
    // that may be passed through this toJS() function you should use the SkipVTableValidation
    // attribute to XPathResult.
    COMPILE_ASSERT(!__is_polymorphic(XPathResult), XPathResult_is_polymorphic_but_idl_claims_not_to_be);
#endif
    ReportMemoryCost<XPathResult>::reportMemoryCost(exec, impl);
    return createNewWrapper<JSXPathResult>(exec, globalObject, impl);
}

XPathResult* toXPathResult(JSC::JSValue value)
{
    return value.inherits(JSXPathResult::info()) ? &jsCast<JSXPathResult*>(value)->impl() : 0;
}

}
