4#ifndef QV4ERROROBJECT_H
5#define QV4ERROROBJECT_H
30#define ErrorObjectMembers(class, Member)
31 Member(class, Pointer, String *, stack)
34 DECLARE_MARKOBJECTS(ErrorObject)
48 void init(
const Value &message, ErrorType t = Error);
49 void init(
const Value &message,
const QString &fileName,
int line,
int column, ErrorType t = Error);
57 void init(
const Value &message);
61 void init(
const Value &message);
65 void init(
const Value &message);
66 void init(
const Value &msg,
const QString &fileName,
int lineNumber,
int columnNumber);
70 void init(
const Value &message);
71 void init(
const Value &msg,
const QString &fileName,
int lineNumber,
int columnNumber);
75 void init(
const Value &message);
79 void init(
const Value &message);
83 void init(ExecutionEngine *engine);
84 void init(ExecutionEngine *engine,
const QString &name);
88 void init(ExecutionEngine *engine);
92 void init(ExecutionEngine *engine);
96 void init(ExecutionEngine *engine);
100 void init(ExecutionEngine *engine);
104 void init(ExecutionEngine *engine);
108 void init(ExecutionEngine *engine);
129 V4_PROTOTYPE(errorPrototype)
132 template <
typename T>
134 template <
typename T>
135 static Heap::Object *
create(ExecutionEngine *e,
const QString &message);
136 template <
typename T>
137 static Heap::Object *
create(ExecutionEngine *e,
const QString &message,
const QString &filename,
int line,
int column);
141 static const char *
className(Heap::ErrorObject::ErrorType t);
153 V4_PROTOTYPE(evalErrorPrototype)
160 V4_PROTOTYPE(rangeErrorPrototype)
167 V4_PROTOTYPE(referenceErrorPrototype)
174 V4_PROTOTYPE(syntaxErrorPrototype)
181 V4_PROTOTYPE(typeErrorPrototype)
188 V4_PROTOTYPE(uRIErrorPrototype)
257 void init(ExecutionEngine *engine, Object *ctor) { init(engine, ctor,
this, Heap::ErrorObject::Error); }
259 static void init(ExecutionEngine *engine, Object *ctor, Object *obj, Heap::ErrorObject::ErrorType t);
265 void init(ExecutionEngine *engine, Object *ctor) { ErrorPrototype::init(engine, ctor,
this, Heap::ErrorObject::EvalError); }
270 void init(ExecutionEngine *engine, Object *ctor) { ErrorPrototype::init(engine, ctor,
this, Heap::ErrorObject::RangeError); }
275 void init(ExecutionEngine *engine, Object *ctor) { ErrorPrototype::init(engine, ctor,
this, Heap::ErrorObject::ReferenceError); }
280 void init(ExecutionEngine *engine, Object *ctor) { ErrorPrototype::init(engine, ctor,
this, Heap::ErrorObject::SyntaxError); }
285 void init(ExecutionEngine *engine, Object *ctor) { ErrorPrototype::init(engine, ctor,
this, Heap::ErrorObject::TypeError); }
290 void init(ExecutionEngine *engine, Object *ctor) { ErrorPrototype::init(engine, ctor,
this, Heap::ErrorObject::URIError); }
296 return d()->errorType == QV4::Heap::ErrorObject::SyntaxError ?
static_cast<SyntaxErrorObject *>(
this) :
nullptr;
302 EngineBase::InternalClassType klass = message.isUndefined() ? EngineBase::Class_ErrorObject : EngineBase::Class_ErrorObjectWithMessage;
304 ScopedObject proto(scope,
static_cast<
const Object *>(newTarget)->get(scope.engine->id_prototype()));
306 return e->memoryManager->allocObject<T>(ic->d(), message);
311 ScopedValue v(scope, message.isEmpty() ? Encode::undefined() : e->newString(message)->asReturnedValue());
312 EngineBase::InternalClassType klass = v->isUndefined() ? EngineBase::Class_ErrorObject : EngineBase::Class_ErrorObjectWithMessage;
313 Scoped<
InternalClass> ic(scope, e->internalClasses(klass)->changePrototype(T::defaultPrototype(e)->d()));
314 return e->memoryManager->allocObject<T>(ic->d(), v);
317Heap::Object *
ErrorObject::
create(ExecutionEngine *e,
const QString &message,
const QString &filename,
int line,
int column) {
319 ScopedValue v(scope, message.isEmpty() ? Encode::undefined() : e->newString(message)->asReturnedValue());
320 EngineBase::InternalClassType klass = v->isUndefined() ? EngineBase::Class_ErrorObject : EngineBase::Class_ErrorObjectWithMessage;
321 Scoped<
InternalClass> ic(scope, e->internalClasses(klass)->changePrototype(T::defaultPrototype(e)->d()));
322 return e->memoryManager->allocObject<T>(ic->d(), v, filename, line, column);
DECLARE_HEAP_OBJECT(ErrorObject, Object)
QVector< StackFrame > StackTrace
Scoped< Object > ScopedObject
Scoped< String > ScopedString
DEFINE_OBJECT_VTABLE(EvalErrorCtor)
DEFINE_OBJECT_VTABLE(URIErrorCtor)
DEFINE_OBJECT_VTABLE(ErrorCtor)
DEFINE_OBJECT_VTABLE(SyntaxErrorCtor)
DEFINE_OBJECT_VTABLE(RangeErrorCtor)
DEFINE_OBJECT_VTABLE(TypeErrorCtor)
DEFINE_OBJECT_VTABLE(ErrorObject)
DEFINE_OBJECT_VTABLE(ReferenceErrorCtor)
#define Q_MANAGED_TYPE(type)
#define V4_INTERNALCLASS(c)
static ReturnedValue virtualCall(const FunctionObject *f, const Value *thisObject, const Value *argv, int argc)
static ReturnedValue method_get_stack(const FunctionObject *, const Value *thisObject, const Value *argv, int argc)
SyntaxErrorObject * asSyntaxError()
static Heap::Object * create(ExecutionEngine *e, const QString &message)
static Heap::Object * create(ExecutionEngine *e, const QString &message, const QString &filename, int line, int column)
Heap::Object * create(ExecutionEngine *e, const Value &message, const Value *newTarget)
static const char * className(Heap::ErrorObject::ErrorType t)
static void init(ExecutionEngine *engine, Object *ctor, Object *obj, Heap::ErrorObject::ErrorType t)
void init(ExecutionEngine *engine, Object *ctor)
static ReturnedValue method_toString(const FunctionObject *, const Value *thisObject, const Value *argv, int argc)
Heap::EvalErrorObject Data
void init(ExecutionEngine *engine, Object *ctor)
void init(ExecutionEngine *engine)
void init(ExecutionEngine *engine, const QString &name)
void init(ExecutionEngine *engine)
void init(const Value &message)
void init(ExecutionEngine *engine)
void init(const Value &message)
void init(ExecutionEngine *engine)
void init(const Value &message)
void init(const Value &msg, const QString &fileName, int lineNumber, int columnNumber)
void init(ExecutionEngine *engine)
void init(const Value &message)
void init(const Value &msg, const QString &fileName, int lineNumber, int columnNumber)
void init(ExecutionEngine *engine)
void init(const Value &message)
void init(ExecutionEngine *engine)
void init(const Value &message)
Heap::RangeErrorObject Data
void init(ExecutionEngine *engine, Object *ctor)
Heap::ReferenceErrorObject Data
void init(ExecutionEngine *engine, Object *ctor)
Scope(ExecutionEngine *e)
Heap::SyntaxErrorObject Data
void init(ExecutionEngine *engine, Object *ctor)
Heap::TypeErrorObject Data
void init(ExecutionEngine *engine, Object *ctor)
Heap::URIErrorObject Data
void init(ExecutionEngine *engine, Object *ctor)