Remove subtype usage in ErrorObject
authorLars Knoll <lars.knoll@theqtcompany.com>
Fri, 9 Jan 2015 13:32:57 +0000 (14:32 +0100)
committerSimon Hausmann <simon.hausmann@digia.com>
Mon, 12 Jan 2015 10:04:26 +0000 (11:04 +0100)
Change-Id: I77e23516270a2330ec22215aef6782a38d7fca09
Reviewed-by: Simon Hausmann <simon.hausmann@digia.com>
src/qml/jsruntime/qv4errorobject.cpp
src/qml/jsruntime/qv4errorobject_p.h
src/qml/jsruntime/qv4managed.cpp

index 849c560..eda3714 100644 (file)
@@ -76,7 +76,7 @@ Heap::ErrorObject::ErrorObject(InternalClass *ic, QV4::Object *prototype)
 Heap::ErrorObject::ErrorObject(InternalClass *ic, QV4::Object *prototype, const ValueRef message, ErrorType t)
     : Heap::Object(ic, prototype)
 {
-    subtype = t;
+    errorType = t;
 
     Scope scope(ic->engine);
     Scoped<QV4::ErrorObject> e(scope, this);
@@ -98,7 +98,7 @@ Heap::ErrorObject::ErrorObject(InternalClass *ic, QV4::Object *prototype, const
 Heap::ErrorObject::ErrorObject(InternalClass *ic, QV4::Object *prototype, const QString &message, ErrorObject::ErrorType t)
     : Heap::Object(ic, prototype)
 {
-    subtype = t;
+    errorType = t;
 
     Scope scope(ic->engine);
     Scoped<QV4::ErrorObject> e(scope, this);
@@ -120,7 +120,7 @@ Heap::ErrorObject::ErrorObject(InternalClass *ic, QV4::Object *prototype, const
 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)
 {
-    subtype = t;
+    errorType = t;
 
     Scope scope(ic->engine);
     Scoped<QV4::ErrorObject> e(scope, this);
index 71a811c..54762d8 100644 (file)
@@ -59,6 +59,8 @@ struct ErrorObject : Object {
     ErrorObject(InternalClass *ic, QV4::Object *prototype, const ValueRef 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);
+
+    ErrorType errorType;
     StackTrace stackTrace;
     String *stack;
 };
@@ -269,7 +271,7 @@ struct URIErrorPrototype : ErrorObject
 
 inline SyntaxErrorObject *ErrorObject::asSyntaxError()
 {
-    return subtype() == QV4::Heap::ErrorObject::SyntaxError ? static_cast<SyntaxErrorObject *>(this) : 0;
+    return d()->errorType == QV4::Heap::ErrorObject::SyntaxError ? static_cast<SyntaxErrorObject *>(this) : 0;
 }
 
 }
index 9dc583b..668e7d2 100644 (file)
@@ -100,7 +100,7 @@ QString Managed::className() const
         s = "RegExp";
         break;
     case Type_ErrorObject:
-        switch (Heap::ErrorObject::ErrorType(subtype())) {
+        switch (static_cast<Heap::ErrorObject *>(d())->errorType) {
         case Heap::ErrorObject::Error:
             s = "Error";
             break;