

#ifndef InternalFunction_h
#define InternalFunction_h

#include "Identifier.h"
#include "JSDestructibleObject.h"

namespace JSC {

    class FunctionPrototype;

    class InternalFunction : public JSDestructibleObject {
    public:
        typedef JSDestructibleObject Base;

        static JS_EXPORTDATA const ClassInfo s_info;

        JS_EXPORT_PRIVATE const String& name(ExecState*);
        const String displayName(ExecState*);
        const String calculatedDisplayName(ExecState*);

        static Structure* createStructure(JSGlobalData& globalData, JSGlobalObject* globalObject, JSValue proto) 
        { 
            return Structure::create(globalData, globalObject, proto, TypeInfo(ObjectType, StructureFlags), &s_info); 
        }

    protected:
        static const unsigned StructureFlags = ImplementsHasInstance | JSObject::StructureFlags;

        JS_EXPORT_PRIVATE InternalFunction(JSGlobalObject*, Structure*);

        JS_EXPORT_PRIVATE void finishCreation(JSGlobalData&, const String& name);

        static CallType getCallData(JSCell*, CallData&);
    };

    InternalFunction* asInternalFunction(JSValue);

    inline InternalFunction* asInternalFunction(JSValue value)
    {
        ASSERT(asObject(value)->inherits(&InternalFunction::s_info));
        return static_cast<InternalFunction*>(asObject(value));
    }

} // namespace JSC

#endif // InternalFunction_h
