Changeset 9795 in webkit for trunk/JavaScriptCore/kjs
- Timestamp:
- Jul 15, 2005, 9:58:57 AM (20 years ago)
- Location:
- trunk/JavaScriptCore/kjs
- Files:
-
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/JavaScriptCore/kjs/error_object.cpp
r9768 r9795 30 30 31 31 using namespace KJS; 32 33 // ------------------------------ ErrorInstanceImp ---------------------------- 34 35 const ClassInfo ErrorInstanceImp::info = {"Error", 0, 0, 0}; 36 37 ErrorInstanceImp::ErrorInstanceImp(ObjectImp *proto) 38 : ObjectImp(proto) 39 { 40 } 32 41 33 42 // ------------------------------ ErrorPrototypeImp ---------------------------- … … 65 74 { 66 75 // toString() 67 UString s ;76 UString s = "Error"; 68 77 69 78 Value v = thisObj.get(exec, namePropertyName); 70 79 if (v.type() != UndefinedType) { 71 s += v.toString(exec);80 s = v.toString(exec); 72 81 } 73 82 74 83 v = thisObj.get(exec, messagePropertyName); 75 84 if (v.type() != UndefinedType) { 76 s += " 85 s += ": " + v.toString(exec); // Mozilla compatible format 77 86 } 78 87 … … 101 110 { 102 111 Object proto = Object::dynamicCast(exec->lexicalInterpreter()->builtinErrorPrototype()); 103 ObjectImp *imp = new ObjectImp(proto);112 ObjectImp *imp = new ErrorInstanceImp(proto.imp()); 104 113 Object obj(imp); 105 114 … … 137 146 // ------------------------------ NativeErrorImp ------------------------------- 138 147 139 const ClassInfo NativeErrorImp::info = {" Error", &InternalFunctionImp::info, 0, 0};148 const ClassInfo NativeErrorImp::info = {"Function", &InternalFunctionImp::info, 0, 0}; 140 149 141 150 NativeErrorImp::NativeErrorImp(ExecState *exec, FunctionPrototypeImp *funcProto, … … 157 166 Object NativeErrorImp::construct(ExecState *exec, const List &args) 158 167 { 159 ObjectImp *imp = new ObjectImp(proto);168 ObjectImp *imp = new ErrorInstanceImp(proto); 160 169 Object obj(imp); 161 170 if (args[0].type() != UndefinedType) -
trunk/JavaScriptCore/kjs/error_object.h
r9768 r9795 28 28 namespace KJS { 29 29 30 class ErrorInstanceImp : public ObjectImp { 31 public: 32 ErrorInstanceImp(ObjectImp *proto); 33 34 virtual const ClassInfo *classInfo() const { return &info; } 35 static const ClassInfo info; 36 }; 37 30 38 class ErrorPrototypeImp : public ObjectImp { 31 39 public: … … 53 61 virtual Value call(ExecState *exec, Object &thisObj, const List &args); 54 62 }; 55 56 57 58 59 63 60 64 class NativeErrorPrototypeImp : public ObjectImp { -
trunk/JavaScriptCore/kjs/object.h
r9768 r9795 437 437 * 438 438 * \code 439 * const ClassInfo BarImp::info = { 0, 0, 0}; // no parent class440 * const ClassInfo FooImp::info = { &BarImp::info, 0, 0};439 * const ClassInfo BarImp::info = {"Bar", 0, 0, 0}; // no parent class 440 * const ClassInfo FooImp::info = {"Foo", &BarImp::info, 0, 0}; 441 441 * \endcode 442 442 *
Note:
See TracChangeset
for help on using the changeset viewer.