Skip to content

Commit

Permalink
Add and use a method for querying whether a property is revisioned.
Browse files Browse the repository at this point in the history
Accessor data and the revision are now unioned, so querying
the value directly can give incorrect results.

Change-Id: I0ba6c53d8bd6b012507bfb32d33dc414348379b0
Reviewed-by: Chris Adams <christopher.adams@nokia.com>
  • Loading branch information
Michael Brasser authored and Qt by Nokia committed Feb 29, 2012
1 parent ba3ac32 commit ab727e6
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 5 deletions.
1 change: 1 addition & 0 deletions src/declarative/qml/qdeclarativepropertycache_p.h
Expand Up @@ -149,6 +149,7 @@ class QDeclarativePropertyRawData
bool hasOverride() const { return !(flags & IsValueTypeVirtual) &&
!(flags & HasAccessors) &&
overrideIndex >= 0; }
bool hasRevision() const { return !(flags & HasAccessors) && revision != 0; }

// Returns -1 if not a value type virtual property
inline int getValueTypeCoreIndex() const;
Expand Down
6 changes: 3 additions & 3 deletions src/declarative/qml/v4/qv4irbuilder.cpp
Expand Up @@ -437,7 +437,7 @@ bool QV4IRBuilder::visit(AST::IdentifierExpression *ast)

QDeclarativePropertyData *data = cache->property(name);

if (data && data->revision != 0) {
if (data && data->hasRevision()) {
if (qmlVerboseCompiler())
qWarning() << "*** versioned symbol:" << name;
discard();
Expand All @@ -458,7 +458,7 @@ bool QV4IRBuilder::visit(AST::IdentifierExpression *ast)

QDeclarativePropertyData *data = cache->property(name);

if (data && data->revision != 0) {
if (data && data->hasRevision()) {
if (qmlVerboseCompiler())
qWarning() << "*** versioned symbol:" << name;
discard();
Expand Down Expand Up @@ -609,7 +609,7 @@ bool QV4IRBuilder::visit(AST::FieldMemberExpression *ast)
if (!data || data->isFunction())
return false; // Don't support methods (or non-existing properties ;)

if (data->revision != 0) {
if (data->hasRevision()) {
if (qmlVerboseCompiler())
qWarning() << "*** versioned symbol:" << name;
discard();
Expand Down
4 changes: 2 additions & 2 deletions src/declarative/qml/v8/qv8qobjectwrapper.cpp
Expand Up @@ -513,7 +513,7 @@ v8::Handle<v8::Value> QV8QObjectWrapper::GetProperty(QV8Engine *engine, QObject
if (!result)
return v8::Handle<v8::Value>();

if (revisionMode == QV8QObjectWrapper::CheckRevision && result->revision != 0) {
if (revisionMode == QV8QObjectWrapper::CheckRevision && result->hasRevision()) {
QDeclarativeData *ddata = QDeclarativeData::get(object);
if (ddata && ddata->propertyCache && !ddata->propertyCache->isAllowedInRevision(result))
return v8::Handle<v8::Value>();
Expand Down Expand Up @@ -673,7 +673,7 @@ bool QV8QObjectWrapper::SetProperty(QV8Engine *engine, QObject *object, const QH
if (!result)
return false;

if (revisionMode == QV8QObjectWrapper::CheckRevision && result->revision != 0) {
if (revisionMode == QV8QObjectWrapper::CheckRevision && result->hasRevision()) {
QDeclarativeData *ddata = QDeclarativeData::get(object);
if (ddata && ddata->propertyCache && !ddata->propertyCache->isAllowedInRevision(result))
return false;
Expand Down

0 comments on commit ab727e6

Please sign in to comment.