/****************************************************************************
**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
-** All rights reserved.
-** Contact: Nokia Corporation (qt-info@nokia.com)
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
+** Contact: http://www.qt-project.org/
**
** This file is part of the QtDeclarative module of the Qt Toolkit.
**
** $QT_BEGIN_LICENSE:LGPL$
-** No Commercial Usage
-** This file contains pre-release code and may not be distributed.
-** You may use this file in accordance with the terms and conditions
-** contained in the Technology Preview License Agreement accompanying
-** this package.
-**
** GNU Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 2.1 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPL included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 2.1 requirements
-** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
+** This file may be used under the terms of the GNU Lesser General Public
+** License version 2.1 as published by the Free Software Foundation and
+** appearing in the file LICENSE.LGPL included in the packaging of this
+** file. Please review the following information to ensure the GNU Lesser
+** General Public License version 2.1 requirements will be met:
+** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
**
** In addition, as a special exception, Nokia gives you certain additional
-** rights. These rights are described in the Nokia Qt LGPL Exception
+** rights. These rights are described in the Nokia Qt LGPL Exception
** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
**
-** If you have questions regarding the use of this file, please contact
-** Nokia at qt-info@nokia.com.
-**
+** GNU General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU General
+** Public License version 3.0 as published by the Free Software Foundation
+** and appearing in the file LICENSE.GPL included in the packaging of this
+** file. Please review the following information to ensure the GNU General
+** Public License version 3.0 requirements will be met:
+** http://www.gnu.org/copyleft/gpl.html.
**
+** Other Usage
+** Alternatively, this file may be used in accordance with the terms and
+** conditions contained in a signed written agreement between you and Nokia.
**
**
**
// Its possible we could delay the calculation of the "actual" context (in the case
// of sub contexts) until it is definately needed.
QDeclarativeContextData *context = resource->getContext();
+ QDeclarativeContextData *expressionContext = context;
if (!context)
return v8::Undefined();
if (context->imports && QV8Engine::startsWithUpper(property)) {
// Search for attached properties, enums and imported scripts
- QDeclarativeTypeNameCache::Data *data = context->imports->data(propertystring);
-
- if (data) {
- if (data->importedScriptIndex != -1) {
- int index = data->importedScriptIndex;
+ QDeclarativeTypeNameCache::Result r = context->imports->query(propertystring);
+
+ if (r.isValid()) {
+ if (r.scriptIndex != -1) {
+ int index = r.scriptIndex;
if (index < context->importedScripts.count())
return context->importedScripts.at(index);
else
return v8::Undefined();
- } else if (data->type) {
- return engine->typeWrapper()->newObject(scopeObject, data->type);
- } else if (data->typeNamespace) {
- return engine->typeWrapper()->newObject(scopeObject, data->typeNamespace);
+ } else if (r.type) {
+ return engine->typeWrapper()->newObject(scopeObject, r.type);
+ } else if (r.importNamespace) {
+ return engine->typeWrapper()->newObject(scopeObject, context->imports, r.importNamespace);
}
Q_ASSERT(!"Unreachable");
}
int propertyIdx = context->propertyNames->value(propertystring);
if (propertyIdx != -1) {
- typedef QDeclarativeEnginePrivate::CapturedProperty CapturedProperty;
if (propertyIdx < context->idValueCount) {
- if (ep->captureProperties)
- ep->capturedProperties << CapturedProperty(&context->idValues[propertyIdx].bindings);
-
+ ep->captureProperty(&context->idValues[propertyIdx].bindings);
return engine->newQObject(context->idValues[propertyIdx]);
} else {
QDeclarativeContextPrivate *cp = context->asQDeclarativeContextPrivate();
- if (ep->captureProperties)
- ep->capturedProperties << CapturedProperty(context->asQDeclarativeContext(), -1,
- propertyIdx + cp->notifyIndex);
+ ep->captureProperty(context->asQDeclarativeContext(), -1,
+ propertyIdx + cp->notifyIndex);
const QVariant &value = cp->propertyValues.at(propertyIdx);
if (value.userType() == qMetaTypeId<QList<QObject*> >()) {
context = context->parent;
}
+ expressionContext->unresolvedNames = true;
+
QString error = QLatin1String("Can't find variable: ") + engine->toString(property);
v8::ThrowException(v8::Exception::ReferenceError(engine->toString(error)));
return v8::Undefined();
// Its possible we could delay the calculation of the "actual" context (in the case
// of sub contexts) until it is definately needed.
QDeclarativeContextData *context = resource->getContext();
+ QDeclarativeContextData *expressionContext = context;
if (!context)
return v8::Undefined();
context = context->parent;
}
+ expressionContext->unresolvedNames = true;
+
if (!resource->readOnly) {
return v8::Handle<v8::Value>();
} else {