aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorLars Knoll <lars.knoll@digia.com>2013-04-12 15:03:16 +0200
committerSimon Hausmann <simon.hausmann@digia.com>2013-04-12 15:28:39 +0200
commit9b6e522a52e92d992f3e363164ca94392e8461e7 (patch)
tree3039f54093884950aae7697578e6b6c3347523f4 /src
parente49724a4435a2a5ae5f33901a26201222465dde9 (diff)
Remove getValueChecked()
In the two places where we need to check, we can do it more easily on the calling side. Change-Id: I259d3cc798660121bba13208ef46e371e3173053 Reviewed-by: Simon Hausmann <simon.hausmann@digia.com>
Diffstat (limited to 'src')
-rw-r--r--src/v4/qv4jsonobject.cpp2
-rw-r--r--src/v4/qv4object.cpp14
-rw-r--r--src/v4/qv4object.h11
3 files changed, 8 insertions, 19 deletions
diff --git a/src/v4/qv4jsonobject.cpp b/src/v4/qv4jsonobject.cpp
index 22cd8ea8d5..5282b7ea5c 100644
--- a/src/v4/qv4jsonobject.cpp
+++ b/src/v4/qv4jsonobject.cpp
@@ -785,7 +785,7 @@ QString Stringify::JO(Object *o)
Property *pd = it.next(&name, &index, &attrs);
if (!pd)
break;
- Value v = o->getValueChecked(ctx, pd, attrs);
+ Value v = o->getValue(ctx, pd, attrs);
QString key;
if (name)
key = name->toQString();
diff --git a/src/v4/qv4object.cpp b/src/v4/qv4object.cpp
index b68c8de8be..04eb74b41c 100644
--- a/src/v4/qv4object.cpp
+++ b/src/v4/qv4object.cpp
@@ -881,9 +881,8 @@ Value Object::arrayIndexOf(Value v, uint fromIndex, uint endIndex, ExecutionCont
}
} else if (sparseArray) {
for (SparseArrayNode *n = sparseArray->lowerBound(fromIndex); n != sparseArray->end() && n->key() < endIndex; n = n->nextNode()) {
- bool exists;
- Value value = o->getValueChecked(ctx, arrayData + n->value, arrayAttributes ? arrayAttributes[n->value] : Attr_Data, &exists);
- if (exists && __qmljs_strict_equal(value, v, ctx))
+ Value value = o->getValue(ctx, arrayData + n->value, arrayAttributes ? arrayAttributes[n->value] : Attr_Data);
+ if (__qmljs_strict_equal(value, v, ctx))
return Value::fromDouble(n->key());
}
} else {
@@ -893,10 +892,11 @@ Value Object::arrayIndexOf(Value v, uint fromIndex, uint endIndex, ExecutionCont
Property *end = pd + endIndex;
pd += fromIndex;
while (pd < end) {
- bool exists;
- Value value = o->getValueChecked(ctx, pd, arrayAttributes ? arrayAttributes[pd - arrayData] : Attr_Data, &exists);
- if (exists && __qmljs_strict_equal(value, v, ctx))
- return Value::fromDouble(pd - arrayData);
+ if (!arrayAttributes || !arrayAttributes[pd - arrayData].isGeneric()) {
+ Value value = o->getValue(ctx, pd, arrayAttributes ? arrayAttributes[pd - arrayData] : Attr_Data);
+ if (__qmljs_strict_equal(value, v, ctx))
+ return Value::fromDouble(pd - arrayData);
+ }
++pd;
}
}
diff --git a/src/v4/qv4object.h b/src/v4/qv4object.h
index f82f953970..a5ef09690c 100644
--- a/src/v4/qv4object.h
+++ b/src/v4/qv4object.h
@@ -155,17 +155,6 @@ struct Q_V4_EXPORT Object: Managed {
Value getValue(ExecutionContext *ctx, const Property *p, PropertyAttributes attrs) const {
return getValue(Value::fromObject(const_cast<Object *>(this)), ctx, p, attrs);
}
- Value getValueChecked(ExecutionContext *ctx, const Property *p, PropertyAttributes attrs) const {
- if (!p || attrs.isGeneric())
- return Value::undefinedValue();
- return getValue(Value::fromObject(const_cast<Object *>(this)), ctx, p, attrs);
- }
- Value getValueChecked(ExecutionContext *ctx, const Property *p, PropertyAttributes attrs, bool *exists) const {
- *exists = p && !attrs.isGeneric();
- if (!*exists)
- return Value::undefinedValue();
- return getValue(Value::fromObject(const_cast<Object *>(this)), ctx, p, attrs);
- }
void putValue(ExecutionContext *ctx, Property *pd, PropertyAttributes attrs, const Value &value);