namespace JSC {
- class ErrorInstance : public JSObject {
+ class ErrorInstance : public JSNonFinalObject {
public:
- explicit ErrorInstance(PassRefPtr<Structure>);
+ typedef JSNonFinalObject Base;
- virtual const ClassInfo* classInfo() const { return &info; }
- static const ClassInfo info;
+ static const ClassInfo s_info;
+
+ static Structure* createStructure(JSGlobalData& globalData, JSGlobalObject* globalObject, JSValue prototype)
+ {
+ return Structure::create(globalData, globalObject, prototype, TypeInfo(ErrorInstanceType, StructureFlags), &s_info);
+ }
+
+ static ErrorInstance* create(JSGlobalData& globalData, Structure* structure, const UString& message)
+ {
+ ErrorInstance* instance = new (NotNull, allocateCell<ErrorInstance>(globalData.heap)) ErrorInstance(globalData, structure);
+ instance->finishCreation(globalData, message);
+ return instance;
+ }
+
+ static ErrorInstance* create(ExecState* exec, Structure* structure, JSValue message)
+ {
+ return create(exec->globalData(), structure, message.isUndefined() ? UString() : message.toString(exec)->value(exec));
+ }
+
+ bool appendSourceToMessage() { return m_appendSourceToMessage; }
+ void setAppendSourceToMessage() { m_appendSourceToMessage = true; }
+ void clearAppendSourceToMessage() { m_appendSourceToMessage = false; }
+
+ protected:
+ explicit ErrorInstance(JSGlobalData&, Structure*);
+
+ void finishCreation(JSGlobalData& globalData, const UString& message)
+ {
+ Base::finishCreation(globalData);
+ ASSERT(inherits(&s_info));
+ if (!message.isNull())
+ putDirect(globalData, globalData.propertyNames->message, jsString(&globalData, message), DontEnum);
+ }
+
+ bool m_appendSourceToMessage;
};
} // namespace JSC