diff options
author | Lars Knoll <lars.knoll@theqtcompany.com> | 2015-08-27 22:47:23 +0200 |
---|---|---|
committer | Lars Knoll <lars.knoll@theqtcompany.com> | 2015-09-22 08:20:04 +0000 |
commit | 6190b10d1cb8b450c7429d35dc8efbe7c7f630b2 (patch) | |
tree | 498b892fbb3a0b66029bda3678334b96ecd0d891 /src/qml/jsruntime | |
parent | d7e535e99babae46d01311059f5ef6080dc90751 (diff) |
move error objects over to new construction scheme
Change-Id: I533c7bf90d49aee10b5661fd15a98e013b1169bd
Reviewed-by: Simon Hausmann <simon.hausmann@theqtcompany.com>
Diffstat (limited to 'src/qml/jsruntime')
-rw-r--r-- | src/qml/jsruntime/qv4engine.cpp | 45 | ||||
-rw-r--r-- | src/qml/jsruntime/qv4engine_p.h | 4 | ||||
-rw-r--r-- | src/qml/jsruntime/qv4errorobject.cpp | 126 | ||||
-rw-r--r-- | src/qml/jsruntime/qv4errorobject_p.h | 38 |
4 files changed, 119 insertions, 94 deletions
diff --git a/src/qml/jsruntime/qv4engine.cpp b/src/qml/jsruntime/qv4engine.cpp index 19a4467ca8..1a480f1aa4 100644 --- a/src/qml/jsruntime/qv4engine.cpp +++ b/src/qml/jsruntime/qv4engine.cpp @@ -351,13 +351,27 @@ ExecutionEngine::ExecutionEngine(EvalISelFactory *factory) regExpExecArrayClass = regExpExecArrayClass->addMember(id_input(), Attr_Data, &index); Q_ASSERT(index == RegExpObject::Index_ArrayInput); - jsObjects[ErrorProto] = memoryManager->alloc<ErrorPrototype>(emptyClass, objectPrototype()); - jsObjects[EvalErrorProto] = memoryManager->alloc<EvalErrorPrototype>(emptyClass, errorPrototype()); - jsObjects[RangeErrorProto] = memoryManager->alloc<RangeErrorPrototype>(emptyClass, errorPrototype()); - jsObjects[ReferenceErrorProto] = memoryManager->alloc<ReferenceErrorPrototype>(emptyClass, errorPrototype()); - jsObjects[SyntaxErrorProto] = memoryManager->alloc<SyntaxErrorPrototype>(emptyClass, errorPrototype()); - jsObjects[TypeErrorProto] = memoryManager->alloc<TypeErrorPrototype>(emptyClass, errorPrototype()); - jsObjects[URIErrorProto] = memoryManager->alloc<URIErrorPrototype>(emptyClass, errorPrototype()); + errorClass = emptyClass->addMember((str = newIdentifier(QStringLiteral("stack"))), Attr_Accessor|Attr_NotConfigurable|Attr_NotEnumerable, &index); + Q_ASSERT(index == ErrorObject::Index_Stack); + errorClass = errorClass->addMember((str = newIdentifier(QStringLiteral("message"))), Attr_Data|Attr_NotEnumerable, &index); + Q_ASSERT(index == ErrorObject::Index_Message); + errorClass = errorClass->addMember((str = newIdentifier(QStringLiteral("name"))), Attr_Data|Attr_NotEnumerable, &index); + Q_ASSERT(index == ErrorObject::Index_Name); + errorClass = errorClass->addMember((str = newIdentifier(QStringLiteral("fileName"))), Attr_Data|Attr_NotEnumerable, &index); + Q_ASSERT(index == ErrorObject::Index_FileName); + errorClass = errorClass->addMember((str = newIdentifier(QStringLiteral("lineNumber"))), Attr_Data|Attr_NotEnumerable, &index); + Q_ASSERT(index == ErrorObject::Index_LineNumber); + + jsObjects[GetStack_Function] = BuiltinFunction::create(rootContext(), str = newIdentifier(QStringLiteral("stack")), ErrorObject::method_get_stack); + getStackFunction()->defineReadonlyProperty(id_length(), Primitive::fromInt32(0)); + + jsObjects[ErrorProto] = memoryManager->allocObject<ErrorPrototype>(errorClass, objectPrototype()); + jsObjects[EvalErrorProto] = memoryManager->allocObject<EvalErrorPrototype>(errorClass, errorPrototype()); + jsObjects[RangeErrorProto] = memoryManager->allocObject<RangeErrorPrototype>(errorClass, errorPrototype()); + jsObjects[ReferenceErrorProto] = memoryManager->allocObject<ReferenceErrorPrototype>(errorClass, errorPrototype()); + jsObjects[SyntaxErrorProto] = memoryManager->allocObject<SyntaxErrorPrototype>(errorClass, errorPrototype()); + jsObjects[TypeErrorProto] = memoryManager->allocObject<TypeErrorPrototype>(errorClass, errorPrototype()); + jsObjects[URIErrorProto] = memoryManager->allocObject<URIErrorPrototype>(errorClass, errorPrototype()); jsObjects[VariantProto] = memoryManager->allocObject<VariantPrototype>(emptyClass, objectPrototype()); Q_ASSERT(variantPrototype()->prototype() == objectPrototype()->d()); @@ -665,7 +679,7 @@ Heap::RegExpObject *ExecutionEngine::newRegExpObject(const QRegExp &re) Heap::Object *ExecutionEngine::newErrorObject(const Value &value) { Scope scope(this); - ScopedObject object(scope, memoryManager->alloc<ErrorObject>(emptyClass, errorPrototype(), value)); + ScopedObject object(scope, memoryManager->allocObject<ErrorObject>(errorClass, errorPrototype(), value)); return object->d(); } @@ -673,14 +687,13 @@ Heap::Object *ExecutionEngine::newSyntaxErrorObject(const QString &message) { Scope scope(this); ScopedString s(scope, newString(message)); - ScopedObject error(scope, memoryManager->alloc<SyntaxErrorObject>(this, s)); - return error->d(); + return memoryManager->allocObject<SyntaxErrorObject>(errorClass, syntaxErrorPrototype(), s); } Heap::Object *ExecutionEngine::newSyntaxErrorObject(const QString &message, const QString &fileName, int line, int column) { Scope scope(this); - ScopedObject error(scope, memoryManager->alloc<SyntaxErrorObject>(this, message, fileName, line, column)); + ScopedObject error(scope, memoryManager->allocObject<SyntaxErrorObject>(errorClass, syntaxErrorPrototype(), message, fileName, line, column)); return error->d(); } @@ -688,14 +701,14 @@ Heap::Object *ExecutionEngine::newSyntaxErrorObject(const QString &message, cons Heap::Object *ExecutionEngine::newReferenceErrorObject(const QString &message) { Scope scope(this); - ScopedObject o(scope, memoryManager->alloc<ReferenceErrorObject>(this, message)); + ScopedObject o(scope, memoryManager->allocObject<ReferenceErrorObject>(errorClass, referenceErrorPrototype(), message)); return o->d(); } Heap::Object *ExecutionEngine::newReferenceErrorObject(const QString &message, const QString &fileName, int lineNumber, int columnNumber) { Scope scope(this); - ScopedObject o(scope, memoryManager->alloc<ReferenceErrorObject>(this, message, fileName, lineNumber, columnNumber)); + ScopedObject o(scope, memoryManager->allocObject<ReferenceErrorObject>(errorClass, referenceErrorPrototype(), message, fileName, lineNumber, columnNumber)); return o->d(); } @@ -703,21 +716,21 @@ Heap::Object *ExecutionEngine::newReferenceErrorObject(const QString &message, c Heap::Object *ExecutionEngine::newTypeErrorObject(const QString &message) { Scope scope(this); - ScopedObject o(scope, memoryManager->alloc<TypeErrorObject>(this, message)); + ScopedObject o(scope, memoryManager->allocObject<TypeErrorObject>(errorClass, typeErrorPrototype(), message)); return o->d(); } Heap::Object *ExecutionEngine::newRangeErrorObject(const QString &message) { Scope scope(this); - ScopedObject o(scope, memoryManager->alloc<RangeErrorObject>(this, message)); + ScopedObject o(scope, memoryManager->allocObject<RangeErrorObject>(errorClass, rangeErrorPrototype(), message)); return o->d(); } Heap::Object *ExecutionEngine::newURIErrorObject(const Value &message) { Scope scope(this); - ScopedObject o(scope, memoryManager->alloc<URIErrorObject>(this, message)); + ScopedObject o(scope, memoryManager->allocObject<URIErrorObject>(errorClass, uRIErrorPrototype(), message)); return o->d(); } diff --git a/src/qml/jsruntime/qv4engine_p.h b/src/qml/jsruntime/qv4engine_p.h index 64c3d1cb99..ea3ec6e6a4 100644 --- a/src/qml/jsruntime/qv4engine_p.h +++ b/src/qml/jsruntime/qv4engine_p.h @@ -169,6 +169,7 @@ public: DataView_Ctor, Eval_Function, + GetStack_Function, ThrowerObject, NJSObjects }; @@ -235,7 +236,10 @@ public: InternalClass *argumentsObjectClass; InternalClass *strictArgumentsObjectClass; + InternalClass *errorClass; + EvalFunction *evalFunction() const { return reinterpret_cast<EvalFunction *>(jsObjects + Eval_Function); } + FunctionObject *getStackFunction() const { return reinterpret_cast<FunctionObject *>(jsObjects + GetStack_Function); } FunctionObject *thrower() const { return reinterpret_cast<FunctionObject *>(jsObjects + ThrowerObject); } Property *argumentsAccessors; diff --git a/src/qml/jsruntime/qv4errorobject.cpp b/src/qml/jsruntime/qv4errorobject.cpp index f052efe03e..eb45ca6513 100644 --- a/src/qml/jsruntime/qv4errorobject.cpp +++ b/src/qml/jsruntime/qv4errorobject.cpp @@ -61,71 +61,74 @@ using namespace QV4; -Heap::ErrorObject::ErrorObject(InternalClass *ic, QV4::Object *prototype) - : Heap::Object(ic, prototype) +Heap::ErrorObject::ErrorObject() { - Scope scope(ic->engine); + Scope scope(internalClass->engine); Scoped<QV4::ErrorObject> e(scope, this); + *propertyData(QV4::ErrorObject::Index_Stack) = scope.engine->getStackFunction(); + *propertyData(QV4::ErrorObject::Index_Stack + QV4::Object::SetterOffset) = Encode::undefined(); + *propertyData(QV4::ErrorObject::Index_Message) = Encode::undefined(); + ScopedString s(scope, scope.engine->newString(QStringLiteral("Error"))); - e->defineDefaultProperty(QStringLiteral("name"), s); + *propertyData(QV4::ErrorObject::Index_Name) = s; + + *propertyData(QV4::ErrorObject::Index_FileName) = Encode::undefined(); + *propertyData(QV4::ErrorObject::Index_LineNumber) = Encode::undefined(); } -Heap::ErrorObject::ErrorObject(InternalClass *ic, QV4::Object *prototype, const Value &message, ErrorType t) - : Heap::Object(ic, prototype) +Heap::ErrorObject::ErrorObject(const Value &message, ErrorType t) { errorType = t; - Scope scope(ic->engine); + Scope scope(internalClass->engine); Scoped<QV4::ErrorObject> e(scope, this); - e->defineAccessorProperty(QStringLiteral("stack"), QV4::ErrorObject::method_get_stack, 0); + *propertyData(QV4::ErrorObject::Index_Stack) = scope.engine->getStackFunction(); + *propertyData(QV4::ErrorObject::Index_Stack + QV4::Object::SetterOffset) = Encode::undefined(); + *propertyData(QV4::ErrorObject::Index_Message) = message; - if (!message.isUndefined()) - e->defineDefaultProperty(QStringLiteral("message"), message); - ScopedString s(scope); - e->defineDefaultProperty(QStringLiteral("name"), (s = scope.engine->newString(e->className()))); + *propertyData(QV4::ErrorObject::Index_Name) = scope.engine->newString(e->className()); e->d()->stackTrace = scope.engine->stackTrace(); if (!e->d()->stackTrace.isEmpty()) { - e->defineDefaultProperty(QStringLiteral("fileName"), (s = scope.engine->newString(e->d()->stackTrace.at(0).source))); - e->defineDefaultProperty(QStringLiteral("lineNumber"), Primitive::fromInt32(e->d()->stackTrace.at(0).line)); + *propertyData(QV4::ErrorObject::Index_FileName) = scope.engine->newString(e->d()->stackTrace.at(0).source); + *propertyData(QV4::ErrorObject::Index_LineNumber) = Primitive::fromInt32(e->d()->stackTrace.at(0).line); } } -Heap::ErrorObject::ErrorObject(InternalClass *ic, QV4::Object *prototype, const QString &message, ErrorObject::ErrorType t) - : Heap::Object(ic, prototype) +Heap::ErrorObject::ErrorObject(const QString &message, ErrorObject::ErrorType t) { errorType = t; - Scope scope(ic->engine); + Scope scope(internalClass->engine); Scoped<QV4::ErrorObject> e(scope, this); - ScopedString s(scope); - e->defineAccessorProperty(QStringLiteral("stack"), QV4::ErrorObject::method_get_stack, 0); + *propertyData(QV4::ErrorObject::Index_Stack) = scope.engine->getStackFunction(); + *propertyData(QV4::ErrorObject::Index_Stack + QV4::Object::SetterOffset) = Encode::undefined(); + *propertyData(QV4::ErrorObject::Index_Message) = scope.engine->newString(message); - ScopedValue v(scope, scope.engine->newString(message)); - e->defineDefaultProperty(QStringLiteral("message"), v); - e->defineDefaultProperty(QStringLiteral("name"), (s = scope.engine->newString(e->className()))); + *propertyData(QV4::ErrorObject::Index_Name) = scope.engine->newString(e->className()); e->d()->stackTrace = scope.engine->stackTrace(); if (!e->d()->stackTrace.isEmpty()) { - e->defineDefaultProperty(QStringLiteral("fileName"), (s = scope.engine->newString(e->d()->stackTrace.at(0).source))); - e->defineDefaultProperty(QStringLiteral("lineNumber"), Primitive::fromInt32(e->d()->stackTrace.at(0).line)); + *propertyData(QV4::ErrorObject::Index_FileName) = scope.engine->newString(e->d()->stackTrace.at(0).source); + *propertyData(QV4::ErrorObject::Index_LineNumber) = Primitive::fromInt32(e->d()->stackTrace.at(0).line); } } -Heap::ErrorObject::ErrorObject(InternalClass *ic, QV4::Object *prototype, const QString &message, const QString &fileName, int line, int column, ErrorObject::ErrorType t) - : Heap::Object(ic, prototype) +Heap::ErrorObject::ErrorObject(const QString &message, const QString &fileName, int line, int column, ErrorObject::ErrorType t) { errorType = t; - Scope scope(ic->engine); + Scope scope(internalClass->engine); Scoped<QV4::ErrorObject> e(scope, this); - ScopedString s(scope); - e->defineAccessorProperty(QStringLiteral("stack"), QV4::ErrorObject::method_get_stack, 0); - e->defineDefaultProperty(QStringLiteral("name"), (s = scope.engine->newString(e->className()))); + *propertyData(QV4::ErrorObject::Index_Stack) = scope.engine->getStackFunction(); + *propertyData(QV4::ErrorObject::Index_Stack + QV4::Object::SetterOffset) = Encode::undefined(); + *propertyData(QV4::ErrorObject::Index_Message) = scope.engine->newString(message); + + *propertyData(QV4::ErrorObject::Index_Name) = scope.engine->newString(e->className()); e->d()->stackTrace = scope.engine->stackTrace(); StackFrame frame; @@ -135,12 +138,9 @@ Heap::ErrorObject::ErrorObject(InternalClass *ic, QV4::Object *prototype, const e->d()->stackTrace.prepend(frame); if (!e->d()->stackTrace.isEmpty()) { - e->defineDefaultProperty(QStringLiteral("fileName"), (s = scope.engine->newString(e->d()->stackTrace.at(0).source))); - e->defineDefaultProperty(QStringLiteral("lineNumber"), Primitive::fromInt32(e->d()->stackTrace.at(0).line)); + *propertyData(QV4::ErrorObject::Index_FileName) = scope.engine->newString(e->d()->stackTrace.at(0).source); + *propertyData(QV4::ErrorObject::Index_LineNumber) = Primitive::fromInt32(e->d()->stackTrace.at(0).line); } - - ScopedValue v(scope, scope.engine->newString(message)); - e->defineDefaultProperty(QStringLiteral("message"), v); } ReturnedValue ErrorObject::method_get_stack(CallContext *ctx) @@ -180,58 +180,58 @@ DEFINE_OBJECT_VTABLE(ErrorObject); DEFINE_OBJECT_VTABLE(SyntaxErrorObject); -Heap::SyntaxErrorObject::SyntaxErrorObject(ExecutionEngine *engine, const Value &msg) - : Heap::ErrorObject(engine->emptyClass, engine->syntaxErrorPrototype(), msg, SyntaxError) +Heap::SyntaxErrorObject::SyntaxErrorObject(const Value &msg) + : Heap::ErrorObject(msg, SyntaxError) { } -Heap::SyntaxErrorObject::SyntaxErrorObject(ExecutionEngine *engine, const QString &msg, const QString &fileName, int lineNumber, int columnNumber) - : Heap::ErrorObject(engine->emptyClass, engine->syntaxErrorPrototype(), msg, fileName, lineNumber, columnNumber, SyntaxError) +Heap::SyntaxErrorObject::SyntaxErrorObject(const QString &msg, const QString &fileName, int lineNumber, int columnNumber) + : Heap::ErrorObject(msg, fileName, lineNumber, columnNumber, SyntaxError) { } -Heap::EvalErrorObject::EvalErrorObject(ExecutionEngine *engine, const Value &message) - : Heap::ErrorObject(engine->emptyClass, engine->evalErrorPrototype(), message, EvalError) +Heap::EvalErrorObject::EvalErrorObject(const Value &message) + : Heap::ErrorObject(message, EvalError) { } -Heap::RangeErrorObject::RangeErrorObject(ExecutionEngine *engine, const Value &message) - : Heap::ErrorObject(engine->emptyClass, engine->rangeErrorPrototype(), message, RangeError) +Heap::RangeErrorObject::RangeErrorObject(const Value &message) + : Heap::ErrorObject(message, RangeError) { } -Heap::RangeErrorObject::RangeErrorObject(ExecutionEngine *engine, const QString &message) - : Heap::ErrorObject(engine->emptyClass, engine->rangeErrorPrototype(), message, RangeError) +Heap::RangeErrorObject::RangeErrorObject(const QString &message) + : Heap::ErrorObject(message, RangeError) { } -Heap::ReferenceErrorObject::ReferenceErrorObject(ExecutionEngine *engine, const Value &message) - : Heap::ErrorObject(engine->emptyClass, engine->referenceErrorPrototype(), message, ReferenceError) +Heap::ReferenceErrorObject::ReferenceErrorObject(const Value &message) + : Heap::ErrorObject(message, ReferenceError) { } -Heap::ReferenceErrorObject::ReferenceErrorObject(ExecutionEngine *engine, const QString &message) - : Heap::ErrorObject(engine->emptyClass, engine->referenceErrorPrototype(), message, ReferenceError) +Heap::ReferenceErrorObject::ReferenceErrorObject(const QString &message) + : Heap::ErrorObject(message, ReferenceError) { } -Heap::ReferenceErrorObject::ReferenceErrorObject(ExecutionEngine *engine, const QString &msg, const QString &fileName, int lineNumber, int columnNumber) - : Heap::ErrorObject(engine->emptyClass, engine->referenceErrorPrototype(), msg, fileName, lineNumber, columnNumber, ReferenceError) +Heap::ReferenceErrorObject::ReferenceErrorObject(const QString &msg, const QString &fileName, int lineNumber, int columnNumber) + : Heap::ErrorObject(msg, fileName, lineNumber, columnNumber, ReferenceError) { } -Heap::TypeErrorObject::TypeErrorObject(ExecutionEngine *engine, const Value &message) - : Heap::ErrorObject(engine->emptyClass, engine->typeErrorPrototype(), message, TypeError) +Heap::TypeErrorObject::TypeErrorObject(const Value &message) + : Heap::ErrorObject(message, TypeError) { } -Heap::TypeErrorObject::TypeErrorObject(ExecutionEngine *engine, const QString &message) - : Heap::ErrorObject(engine->emptyClass, engine->typeErrorPrototype(), message, TypeError) +Heap::TypeErrorObject::TypeErrorObject(const QString &message) + : Heap::ErrorObject(message, TypeError) { } -Heap::URIErrorObject::URIErrorObject(ExecutionEngine *engine, const Value &message) - : Heap::ErrorObject(engine->emptyClass, engine->uRIErrorPrototype(), message, URIError) +Heap::URIErrorObject::URIErrorObject(const Value &message) + : Heap::ErrorObject(message, URIError) { } @@ -274,7 +274,7 @@ ReturnedValue EvalErrorCtor::construct(const Managed *m, CallData *callData) { Scope scope(static_cast<const EvalErrorCtor *>(m)->engine()); ScopedValue v(scope, callData->argument(0)); - return (scope.engine->memoryManager->alloc<EvalErrorObject>(scope.engine, v))->asReturnedValue(); + return (scope.engine->memoryManager->allocObject<EvalErrorObject>(scope.engine->errorClass, scope.engine->evalErrorPrototype(), v))->asReturnedValue(); } Heap::RangeErrorCtor::RangeErrorCtor(QV4::ExecutionContext *scope) @@ -286,7 +286,7 @@ ReturnedValue RangeErrorCtor::construct(const Managed *m, CallData *callData) { Scope scope(static_cast<const RangeErrorCtor *>(m)->engine()); ScopedValue v(scope, callData->argument(0)); - return (scope.engine->memoryManager->alloc<RangeErrorObject>(scope.engine, v))->asReturnedValue(); + return (scope.engine->memoryManager->allocObject<RangeErrorObject>(scope.engine->errorClass, scope.engine->evalErrorPrototype(), v))->asReturnedValue(); } Heap::ReferenceErrorCtor::ReferenceErrorCtor(QV4::ExecutionContext *scope) @@ -298,7 +298,7 @@ ReturnedValue ReferenceErrorCtor::construct(const Managed *m, CallData *callData { Scope scope(static_cast<const ReferenceErrorCtor *>(m)->engine()); ScopedValue v(scope, callData->argument(0)); - return (scope.engine->memoryManager->alloc<ReferenceErrorObject>(scope.engine, v))->asReturnedValue(); + return (scope.engine->memoryManager->allocObject<ReferenceErrorObject>(scope.engine->errorClass, scope.engine->referenceErrorPrototype(), v))->asReturnedValue(); } Heap::SyntaxErrorCtor::SyntaxErrorCtor(QV4::ExecutionContext *scope) @@ -310,7 +310,7 @@ ReturnedValue SyntaxErrorCtor::construct(const Managed *m, CallData *callData) { Scope scope(static_cast<const SyntaxErrorCtor *>(m)->engine()); ScopedValue v(scope, callData->argument(0)); - return (scope.engine->memoryManager->alloc<SyntaxErrorObject>(scope.engine, v))->asReturnedValue(); + return (scope.engine->memoryManager->allocObject<SyntaxErrorObject>(scope.engine->errorClass, scope.engine->syntaxErrorPrototype(), v))->asReturnedValue(); } Heap::TypeErrorCtor::TypeErrorCtor(QV4::ExecutionContext *scope) @@ -322,7 +322,7 @@ ReturnedValue TypeErrorCtor::construct(const Managed *m, CallData *callData) { Scope scope(static_cast<const TypeErrorCtor *>(m)->engine()); ScopedValue v(scope, callData->argument(0)); - return (scope.engine->memoryManager->alloc<TypeErrorObject>(scope.engine, v))->asReturnedValue(); + return (scope.engine->memoryManager->allocObject<TypeErrorObject>(scope.engine->errorClass, scope.engine->typeErrorPrototype(), v))->asReturnedValue(); } Heap::URIErrorCtor::URIErrorCtor(QV4::ExecutionContext *scope) @@ -334,7 +334,7 @@ ReturnedValue URIErrorCtor::construct(const Managed *m, CallData *callData) { Scope scope(static_cast<const URIErrorCtor *>(m)->engine()); ScopedValue v(scope, callData->argument(0)); - return (scope.engine->memoryManager->alloc<URIErrorObject>(scope.engine, v))->asReturnedValue(); + return (scope.engine->memoryManager->allocObject<URIErrorObject>(scope.engine->errorClass, scope.engine->uRIErrorPrototype(), v))->asReturnedValue(); } void ErrorPrototype::init(ExecutionEngine *engine, Object *ctor, Object *obj) diff --git a/src/qml/jsruntime/qv4errorobject_p.h b/src/qml/jsruntime/qv4errorobject_p.h index e0fbcb4d8d..ec7de590bf 100644 --- a/src/qml/jsruntime/qv4errorobject_p.h +++ b/src/qml/jsruntime/qv4errorobject_p.h @@ -55,10 +55,10 @@ struct ErrorObject : Object { URIError }; - ErrorObject(InternalClass *ic, QV4::Object *prototype); - ErrorObject(InternalClass *ic, QV4::Object *prototype, const Value &message, ErrorType t = Error); - ErrorObject(InternalClass *ic, QV4::Object *prototype, const QString &message, ErrorType t = Error); - ErrorObject(InternalClass *ic, QV4::Object *prototype, const QString &message, const QString &fileName, int line, int column, ErrorType t = Error); + ErrorObject(); + ErrorObject(const Value &message, ErrorType t = Error); + ErrorObject(const QString &message, ErrorType t = Error); + ErrorObject(const QString &message, const QString &fileName, int line, int column, ErrorType t = Error); ErrorType errorType; StackTrace stackTrace; @@ -66,32 +66,32 @@ struct ErrorObject : Object { }; struct EvalErrorObject : ErrorObject { - EvalErrorObject(ExecutionEngine *engine, const Value &message); + EvalErrorObject(const Value &message); }; struct RangeErrorObject : ErrorObject { - RangeErrorObject(ExecutionEngine *engine, const Value &message); - RangeErrorObject(ExecutionEngine *engine, const QString &msg); + RangeErrorObject(const Value &message); + RangeErrorObject(const QString &msg); }; struct ReferenceErrorObject : ErrorObject { - ReferenceErrorObject(ExecutionEngine *engine, const Value &message); - ReferenceErrorObject(ExecutionEngine *engine, const QString &msg); - ReferenceErrorObject(ExecutionEngine *engine, const QString &msg, const QString &fileName, int lineNumber, int columnNumber); + ReferenceErrorObject(const Value &message); + ReferenceErrorObject(const QString &msg); + ReferenceErrorObject(const QString &msg, const QString &fileName, int lineNumber, int columnNumber); }; struct SyntaxErrorObject : ErrorObject { - SyntaxErrorObject(ExecutionEngine *engine, const Value &message); - SyntaxErrorObject(ExecutionEngine *engine, const QString &msg, const QString &fileName, int lineNumber, int columnNumber); + SyntaxErrorObject(const Value &message); + SyntaxErrorObject(const QString &msg, const QString &fileName, int lineNumber, int columnNumber); }; struct TypeErrorObject : ErrorObject { - TypeErrorObject(ExecutionEngine *engine, const Value &message); - TypeErrorObject(ExecutionEngine *engine, const QString &msg); + TypeErrorObject(const Value &message); + TypeErrorObject(const QString &msg); }; struct URIErrorObject : ErrorObject { - URIErrorObject(ExecutionEngine *engine, const Value &message); + URIErrorObject(const Value &message); }; struct ErrorCtor : Heap::FunctionObject { @@ -130,6 +130,14 @@ struct ErrorObject: Object { IsErrorObject = true }; + enum { + Index_Stack = 0, // Accessor Property + Index_Message = 2, + Index_Name = 3, + Index_FileName = 4, + Index_LineNumber = 5 + }; + V4_OBJECT2(ErrorObject, Object) Q_MANAGED_TYPE(ErrorObject) V4_NEEDS_DESTROY |