Update obsolete contact address.
[profile/ivi/qtdeclarative.git] / src / declarative / qml / v4 / qv4irbuilder.cpp
index 258627a..452cb43 100644 (file)
@@ -1,8 +1,8 @@
 /****************************************************************************
 **
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
 ** All rights reserved.
-** Contact: Nokia Corporation (qt-info@nokia.com)
+** Contact: http://www.qt-project.org/
 **
 ** This file is part of the QtDeclarative module of the Qt Toolkit.
 **
@@ -42,7 +42,7 @@
 #include "qv4irbuilder_p.h"
 #include "qv4compiler_p_p.h"
 
-#include <private/qquickanchors_p_p.h> // For AnchorLine
+#include <private/qdeclarativemetatype_p.h>
 #include <private/qdeclarativetypenamecache_p.h>
 
 DEFINE_BOOL_CONFIG_OPTION(qmlVerboseCompiler, QML_VERBOSE_COMPILER)
@@ -72,7 +72,7 @@ static IR::Type irTypeFromVariantType(int t, QDeclarativeEnginePrivate *engine,
     default:
         if (t == qMetaTypeId<QDeclarative1AnchorLine>())
             return IR::AnchorLineType;
-        else if (t == qMetaTypeId<QQuickAnchorLine>())
+        else if (t == QDeclarativeMetaType::QQuickAnchorLineMetaTypeId())
             return IR::SGAnchorLineType;
         else if (engine->metaObjectForType(t)) {
             return IR::ObjectType;
@@ -314,24 +314,6 @@ bool QV4IRBuilder::visit(AST::UiQualifiedId *)
     return false;
 }
 
-bool QV4IRBuilder::visit(AST::UiSignature *)
-{
-    Q_ASSERT(!"unreachable");
-    return false;
-}
-
-bool QV4IRBuilder::visit(AST::UiFormalList *)
-{
-    Q_ASSERT(!"unreachable");
-    return false;
-}
-
-bool QV4IRBuilder::visit(AST::UiFormal *)
-{
-    Q_ASSERT(!"unreachable");
-    return false;
-}
-
 
 // JS
 bool QV4IRBuilder::visit(AST::Program *)
@@ -466,7 +448,7 @@ bool QV4IRBuilder::visit(AST::IdentifierExpression *ast)
 
                 if (data && !data->isFunction()) {
                     IR::Type irType = irTypeFromVariantType(data->propType, m_engine, metaObject);
-                    _expr.code = _block->SYMBOL(irType, name, metaObject, data->coreIndex, IR::Name::ScopeStorage, line, column);
+                    _expr.code = _block->SYMBOL(irType, name, metaObject, data, IR::Name::ScopeStorage, line, column);
                     found = true;
                 } 
             }
@@ -487,7 +469,7 @@ bool QV4IRBuilder::visit(AST::IdentifierExpression *ast)
 
                 if (data && !data->isFunction()) {
                     IR::Type irType = irTypeFromVariantType(data->propType, m_engine, metaObject);
-                    _expr.code = _block->SYMBOL(irType, name, metaObject, data->coreIndex, IR::Name::RootStorage, line, column);
+                    _expr.code = _block->SYMBOL(irType, name, metaObject, data, IR::Name::RootStorage, line, column);
                     found = true;
                 } 
             }
@@ -615,7 +597,7 @@ bool QV4IRBuilder::visit(AST::FieldMemberExpression *ast)
                     }
 
                     IR::Type irType = irTypeFromVariantType(data->propType, m_engine, attachedMeta);
-                    _expr.code = _block->SYMBOL(baseName, irType, name, attachedMeta, data->coreIndex, line, column);
+                    _expr.code = _block->SYMBOL(baseName, irType, name, attachedMeta, data, line, column);
                 }
                 break;
 
@@ -638,31 +620,28 @@ bool QV4IRBuilder::visit(AST::FieldMemberExpression *ast)
 
                 IR::Type irType = irTypeFromVariantType(data->propType, m_engine, idObject->metaObject());
                 _expr.code = _block->SYMBOL(baseName, irType, name,
-                                            idObject->metaObject(), data->coreIndex, line, column);
+                                            idObject->metaObject(), data, line, column);
                 }
                 break;
 
             case IR::Name::Property: 
-                if (baseName->type == IR::ObjectType) {
-                    const QMetaObject *m = 
-                        m_engine->metaObjectForType(baseName->meta->property(baseName->index).userType());
-                    QDeclarativePropertyCache *cache = m_engine->cache(m);
-
-                    QDeclarativePropertyData *data = cache->property(name);
-
-                    if (!data || data->isFunction())
-                        return false; // Don't support methods (or non-existing properties ;)
+                if (baseName->type == IR::ObjectType && baseName->meta && baseName->property->isFinal()) {
+                    QDeclarativePropertyCache *cache = m_engine->cache(baseName->meta);
+                    if (!cache)
+                        return false;
+
+                    if (QDeclarativePropertyData *data = cache->property(name)) {
+                        if (!data->isFinal()) {
+                            if (qmlVerboseCompiler())
+                                qWarning() << "*** non-final property access:"
+                                           << (*baseName->id + QLatin1String(".") + ast->name.toString());
+                            return false; // We don't know enough about this property
+                        }
 
-                    if(!data->isFinal()) {
-                        if (qmlVerboseCompiler())
-                            qWarning() << "*** non-final property access:"
-                                << (*baseName->id + QLatin1String(".") + ast->name.toString());
-                        return false; // We don't know enough about this property
+                        IR::Type irType = irTypeFromVariantType(data->propType, m_engine, baseName->meta);
+                        _expr.code = _block->SYMBOL(baseName, irType, name,
+                                                    baseName->meta, data, line, column);
                     }
-
-                    IR::Type irType = irTypeFromVariantType(data->propType, m_engine, baseName->meta);
-                    _expr.code = _block->SYMBOL(baseName, irType, name,
-                                                baseName->meta, data->coreIndex, line, column);
                 }
                 break;