Commit 0936f635 authored by twanvl's avatar twanvl

Fixed length function to work correctly for ScriptObjects, in particular for TextValues.

parent 010c6127
......@@ -266,11 +266,17 @@ class ScriptObject : public ScriptValue {
}
virtual ScriptValueP makeIterator(const ScriptValueP& thisP) const {
ScriptValueP it = make_iterator(*value);
return it ? it : ScriptValue::makeIterator(thisP);
if (it) return it;
ScriptValueP d = getDefault();
if (d) return d->makeIterator(d);
return ScriptValue::makeIterator(thisP);
}
virtual int itemCount() const {
int i = item_count(*value);
return i >= 0 ? i : ScriptValue::itemCount();
if (i >= 0) return i;
ScriptValueP d = getDefault();
if (d) return d->itemCount();
return ScriptValue::itemCount();
}
/// Objects can be compared by comparing pointers
virtual CompareWhat compareAs(String& compare_str, void const*& compare_ptr) const {
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment