+ static const ClassInfo s_info;
+
+ static Structure* createStructure(VM& vm, JSGlobalObject* globalObject, JSValue prototype)
+ {
+ return Structure::create(vm, globalObject, prototype, TypeInfo(ErrorInstanceType, StructureFlags), &s_info);
+ }
+
+ static ErrorInstance* create(VM& vm, Structure* structure, const String& message)
+ {
+ ErrorInstance* instance = new (NotNull, allocateCell<ErrorInstance>(vm.heap)) ErrorInstance(vm, structure);
+ instance->finishCreation(vm, message);
+ return instance;
+ }
+
+ static ErrorInstance* create(ExecState* exec, Structure* structure, JSValue message)
+ {
+ return create(exec->vm(), structure, message.isUndefined() ? String() : message.toString(exec)->value(exec));
+ }
+
+ bool appendSourceToMessage() { return m_appendSourceToMessage; }
+ void setAppendSourceToMessage() { m_appendSourceToMessage = true; }
+ void clearAppendSourceToMessage() { m_appendSourceToMessage = false; }
+
+ protected:
+ explicit ErrorInstance(VM&, Structure*);
+
+ void finishCreation(VM& vm, const String& message)
+ {
+ Base::finishCreation(vm);
+ ASSERT(inherits(&s_info));
+ if (!message.isNull())
+ putDirect(vm, vm.propertyNames->message, jsString(&vm, message), DontEnum);
+ }
+
+ bool m_appendSourceToMessage;