Changeset 13150 in webkit for trunk/JavaScriptCore/kjs
- Timestamp:
- Mar 5, 2006, 7:58:15 PM (19 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/JavaScriptCore/kjs/lookup.h
r13089 r13150 296 296 * and use DOMNodeProto::self(exec) as prototype in the DOMNode constructor. 297 297 * If the prototype has a "parent prototype", e.g. DOMElementProto falls back on DOMNodeProto, 298 * then the last line will use IMPLEMENT_PROTOTYPE_WITH_PARENT, with DOMNodeProto as lastargument.298 * then the first line will use KJS_DEFINE_PROTOTYPE_WITH_PROTOTYPE, with DOMNodeProto as the second argument. 299 299 */ 300 300 … … 306 306 #endif 307 307 308 // These macros assume that a prototype's only properties are functions 308 309 #define KJS_DEFINE_PROTOTYPE(ClassProto) \ 309 310 class ClassProto : public KJS::JSObject { \ … … 316 317 protected: \ 317 318 ClassProto(KJS::ExecState *exec) \ 318 : JSObject(exec->lexicalInterpreter()->builtinObjectPrototype()) { } \319 : KJS::JSObject(exec->lexicalInterpreter()->builtinObjectPrototype()) { } \ 319 320 \ 320 321 }; 321 322 322 #define KJS_IMPLEMENT_PROTOTYPE(ClassName, ClassProto,ClassFunc) \ 323 #define KJS_DEFINE_PROTOTYPE_WITH_PROTOTYPE(ClassProto, ClassProtoProto) \ 324 class ClassProto : public KJS::JSObject { \ 325 friend KJS::JSObject* KJS_GCC_ROOT_NS_HACK cacheGlobalObject<ClassProto>(KJS::ExecState* exec, const KJS::Identifier& propertyName); \ 326 public: \ 327 static KJS::JSObject* self(KJS::ExecState* exec); \ 328 virtual const KJS::ClassInfo* classInfo() const { return &info; } \ 329 static const KJS::ClassInfo info; \ 330 bool getOwnPropertySlot(KJS::ExecState*, const KJS::Identifier&, KJS::PropertySlot&); \ 331 protected: \ 332 ClassProto(KJS::ExecState* exec) \ 333 : KJS::JSObject(ClassProtoProto::self(exec)) { } \ 334 \ 335 }; 336 337 #define KJS_IMPLEMENT_PROTOTYPE(ClassName, ClassProto, ClassFunc) \ 323 338 const ClassInfo ClassProto::info = { ClassName, 0, &ClassProto##Table, 0 }; \ 324 339 JSObject *ClassProto::self(ExecState *exec) \ … … 328 343 bool ClassProto::getOwnPropertySlot(ExecState *exec, const Identifier& propertyName, PropertySlot& slot) \ 329 344 { \ 330 return getStaticFunctionSlot<ClassFunc,JSObject>(exec, &ClassProto##Table, this, propertyName, slot); \ 331 } 332 333 #define KJS_IMPLEMENT_PROTOTYPE_WITH_PARENT(ClassName, ClassProto,ClassFunc,ParentProto) \ 334 const ClassInfo ClassProto::info = { ClassName, 0, &ClassProto##Table, 0 }; \ 335 JSObject *ClassProto::self(ExecState *exec) \ 336 { \ 337 return ::cacheGlobalObject<ClassProto>(exec, "[[" ClassName ".prototype]]"); \ 338 } \ 339 bool ClassProto::getOwnPropertySlot(ExecState *exec, const Identifier& propertyName, PropertySlot& slot) \ 340 { \ 341 if (getStaticFunctionSlot<ClassFunc,JSObject>(exec, &ClassProto##Table, this, propertyName, slot)) \ 342 return true; \ 343 return ParentProto::self(exec)->getOwnPropertySlot(exec, propertyName, slot); \ 345 return getStaticFunctionSlot<ClassFunc, JSObject>(exec, &ClassProto##Table, this, propertyName, slot); \ 344 346 } 345 347
Note:
See TracChangeset
for help on using the changeset viewer.