Changeset 11731 in webkit for trunk/JavaScriptCore


Ignore:
Timestamp:
Dec 22, 2005, 1:07:37 PM (19 years ago)
Author:
andersca
Message:

2005-12-22 Anders Carlsson <[email protected]>

Reviewed by Eric and Darin.

  • kjs/lookup.h: Move ClassName from KJS_DECLARE_PROTOTYPE to KJS_IMPLEMENT_PROTOTYPE. Also, namespace all macros by prefixing them with KJS_.
Location:
trunk/JavaScriptCore
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/JavaScriptCore/ChangeLog

    r11727 r11731  
     12005-12-22  Anders Carlsson  <[email protected]>
     2
     3        Reviewed by Eric and Darin.
     4
     5        - fix http://bugzilla.opendarwin.org/show_bug.cgi?id=6196
     6        Would like to be able to define prototypes in headers
     7       
     8        * kjs/lookup.h:
     9        Move ClassName from KJS_DECLARE_PROTOTYPE to KJS_IMPLEMENT_PROTOTYPE.
     10        Also, namespace all macros by prefixing them with KJS_.
     11
    1122005-12-22  Darin Adler  <[email protected]>
    213
     
    2839        (KXMLCore::operator!=): Ditto.
    2940
     41>>>>>>> 1.920
    30422005-12-21  Timothy Hatcher  <[email protected]>
    3143
  • trunk/JavaScriptCore/kjs/lookup.h

    r11566 r11731  
    285285   *
    286286   * Using those macros is very simple: define the hashtable (e.g. "DOMNodeProtoTable"), then
    287    * DEFINE_PROTOTYPE("DOMNode",DOMNodeProto)
    288    * IMPLEMENT_PROTOFUNC(DOMNodeProtoFunc)
    289    * IMPLEMENT_PROTOTYPE(DOMNodeProto,DOMNodeProtoFunc)
     287   * KJS_DEFINE_PROTOTYPE(DOMNodeProto)
     288   * KJS_IMPLEMENT_PROTOFUNC(DOMNodeProtoFunc)
     289   * KJS_IMPLEMENT_PROTOTYPE("DOMNode", DOMNodeProto,DOMNodeProtoFunc)
    290290   * and use DOMNodeProto::self(exec) as prototype in the DOMNode constructor.
    291291   * If the prototype has a "parent prototype", e.g. DOMElementProto falls back on DOMNodeProto,
    292292   * then the last line will use IMPLEMENT_PROTOTYPE_WITH_PARENT, with DOMNodeProto as last argument.
    293293   */
    294 #define DEFINE_PROTOTYPE(ClassName,ClassProto) \
     294#define KJS_DEFINE_PROTOTYPE(ClassProto) \
    295295  class ClassProto : public JSObject { \
    296296    friend JSObject *cacheGlobalObject<ClassProto>(ExecState *exec, const Identifier &propertyName); \
    297297  public: \
    298     static JSObject *self(ExecState *exec) \
    299     { \
    300       return cacheGlobalObject<ClassProto>(exec, "[[" ClassName ".prototype]]"); \
    301     } \
     298    static JSObject *ClassProto::self(ExecState *exec); \
     299    virtual const ClassInfo *classInfo() const { return &info; } \
     300    static const ClassInfo info; \
     301    bool getOwnPropertySlot(ExecState *, const Identifier&, PropertySlot&); \
    302302  protected: \
    303303    ClassProto( ExecState *exec ) \
    304304      : JSObject( exec->lexicalInterpreter()->builtinObjectPrototype() ) {} \
    305305    \
    306   public: \
    307     virtual const ClassInfo *classInfo() const { return &info; } \
    308     static const ClassInfo info; \
    309     bool getOwnPropertySlot(ExecState *, const Identifier&, PropertySlot&); \
    310   }; \
    311   const ClassInfo ClassProto::info = { ClassName, 0, &ClassProto##Table, 0 };
    312 
    313 #define IMPLEMENT_PROTOTYPE(ClassProto,ClassFunc) \
     306  };
     307
     308#define KJS_IMPLEMENT_PROTOTYPE(ClassName, ClassProto,ClassFunc) \
     309    const ClassInfo ClassProto::info = { ClassName, 0, &ClassProto##Table, 0 }; \
     310    JSObject *ClassProto::self(ExecState *exec) \
     311    { \
     312      return cacheGlobalObject<ClassProto>(exec, "[[" ClassName ".prototype]]"); \
     313    } \
    314314    bool ClassProto::getOwnPropertySlot(ExecState *exec, const Identifier& propertyName, PropertySlot& slot) \
    315315    { \
     
    317317    }
    318318
    319 #define IMPLEMENT_PROTOTYPE_WITH_PARENT(ClassProto,ClassFunc,ParentProto)  \
     319#define KJS_IMPLEMENT_PROTOTYPE_WITH_PARENT(ClassName, ClassProto,ClassFunc,ParentProto)  \
     320    const ClassInfo ClassProto::info = { ClassName, 0, &ClassProto##Table, 0 }; \
     321    JSObject *ClassProto::self(ExecState *exec) \
     322    { \
     323      return cacheGlobalObject<ClassProto>(exec, "[[" ClassName ".prototype]]"); \
     324    } \
    320325    bool ClassProto::getOwnPropertySlot(ExecState *exec, const Identifier& propertyName, PropertySlot& slot) \
    321326    { \
     
    325330    }
    326331
    327 #define IMPLEMENT_PROTOFUNC(ClassFunc) \
     332#define KJS_IMPLEMENT_PROTOFUNC(ClassFunc) \
    328333  class ClassFunc : public DOMFunction { \
    329334  public: \
Note: See TracChangeset for help on using the changeset viewer.