Changeset 11731 in webkit for trunk/JavaScriptCore
- Timestamp:
- Dec 22, 2005, 1:07:37 PM (19 years ago)
- Location:
- trunk/JavaScriptCore
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/JavaScriptCore/ChangeLog
r11727 r11731 1 2005-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 1 12 2005-12-22 Darin Adler <[email protected]> 2 13 … … 28 39 (KXMLCore::operator!=): Ditto. 29 40 41 >>>>>>> 1.920 30 42 2005-12-21 Timothy Hatcher <[email protected]> 31 43 -
trunk/JavaScriptCore/kjs/lookup.h
r11566 r11731 285 285 * 286 286 * 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) 290 290 * and use DOMNodeProto::self(exec) as prototype in the DOMNode constructor. 291 291 * If the prototype has a "parent prototype", e.g. DOMElementProto falls back on DOMNodeProto, 292 292 * then the last line will use IMPLEMENT_PROTOTYPE_WITH_PARENT, with DOMNodeProto as last argument. 293 293 */ 294 #define DEFINE_PROTOTYPE(ClassName,ClassProto) \294 #define KJS_DEFINE_PROTOTYPE(ClassProto) \ 295 295 class ClassProto : public JSObject { \ 296 296 friend JSObject *cacheGlobalObject<ClassProto>(ExecState *exec, const Identifier &propertyName); \ 297 297 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&); \ 302 302 protected: \ 303 303 ClassProto( ExecState *exec ) \ 304 304 : JSObject( exec->lexicalInterpreter()->builtinObjectPrototype() ) {} \ 305 305 \ 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 } \ 314 314 bool ClassProto::getOwnPropertySlot(ExecState *exec, const Identifier& propertyName, PropertySlot& slot) \ 315 315 { \ … … 317 317 } 318 318 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 } \ 320 325 bool ClassProto::getOwnPropertySlot(ExecState *exec, const Identifier& propertyName, PropertySlot& slot) \ 321 326 { \ … … 325 330 } 326 331 327 #define IMPLEMENT_PROTOFUNC(ClassFunc) \332 #define KJS_IMPLEMENT_PROTOFUNC(ClassFunc) \ 328 333 class ClassFunc : public DOMFunction { \ 329 334 public: \
Note:
See TracChangeset
for help on using the changeset viewer.