PropertyAttributes attrs;
Property *pd = wrapper->__getOwnProperty__(name, &attrs);
if (pd) {
- wrapper->putValue(v4->current, pd, attrs, value);
+ wrapper->putValue(pd, attrs, value);
return;
}
if (pidx < UINT_MAX && (!instance->arrayAttributes || !instance->arrayAttributes[0].isGeneric()))
front = instance->arrayData + pidx;
- Value result = front ? instance->getValue(ctx, front, instance->arrayAttributes ? instance->arrayAttributes[pidx] : Attr_Data) : Value::undefinedValue();
+ Value result = front ? instance->getValue(front, instance->arrayAttributes ? instance->arrayAttributes[pidx] : Attr_Data) : Value::undefinedValue();
bool protoHasArray = false;
Object *p = instance;
cout << prefix << "\t\"" << qPrintable(name.stringValue()->toQString()) << "\"" << endl;
PropertyAttributes attrs;
Property *d = o->__getOwnProperty__(name.stringValue(), &attrs);
- Value pval = o->getValue(ctx, d, attrs);
+ Value pval = o->getValue(d, attrs);
cout << prefix << "\tvalue:" << endl;
realDumpValue(pval, ctx, prefix + "\t");
}
l->globalGetter = globalGetterAccessor1;
else if (l->level == 2)
l->globalGetter = globalGetterAccessor2;
- Value res = o->getValue(ctx, p, attrs);
+ Value res = o->getValue(p, attrs);
if (result)
*result = res;
return;
put(ctx->engine->newString(name), value);
}
-Value Object::getValue(const Value &thisObject, ExecutionContext *ctx, const Property *p, PropertyAttributes attrs)
+Value Object::getValue(const Value &thisObject, const Property *p, PropertyAttributes attrs)
{
if (!attrs.isAccessor())
return p->value;
if (!getter)
return Value::undefinedValue();
- return getter->call(ctx, thisObject, 0, 0);
+ return getter->call(getter->engine()->current, thisObject, 0, 0);
}
-void Object::putValue(ExecutionContext *ctx, Property *pd, PropertyAttributes attrs, const Value &value)
+void Object::putValue(Property *pd, PropertyAttributes attrs, const Value &value)
{
if (attrs.isAccessor()) {
if (pd->set) {
Value args[1];
args[0] = value;
- pd->set->call(ctx, Value::fromObject(this), args, 1);
+ pd->set->call(engine()->current, Value::fromObject(this), args, 1);
return;
}
goto reject;
return;
reject:
- if (ctx->strictMode)
- ctx->throwTypeError();
+ if (engine()->current->strictMode)
+ engine()->current->throwTypeError();
}
l->getter = Lookup::getterAccessor2;
if (result)
*result = p->value;
- Value res = o->getValue(o->engine()->current, p, attrs);
+ Value res = o->getValue(p, attrs);
if (result)
*result = res;
return;
}
if (idx != UINT_MAX) {
- o->putValue(o->engine()->current, o->memberData + idx, o->internalClass->propertyData[idx], value);
+ o->putValue(o->memberData + idx, o->internalClass->propertyData[idx], value);
return;
}
}
if (idx < UINT_MAX) {
if (hasProperty)
*hasProperty = true;
- return getValue(engine()->current, o->memberData + idx, o->internalClass->propertyData.at(idx));
+ return getValue(o->memberData + idx, o->internalClass->propertyData.at(idx));
}
o = o->prototype;
if (pd) {
if (hasProperty)
*hasProperty = true;
- return getValue(engine()->current, pd, attrs);
+ return getValue(pd, attrs);
}
if (hasProperty)
}
} else if (sparseArray) {
for (SparseArrayNode *n = sparseArray->lowerBound(fromIndex); n != sparseArray->end() && n->key() < endIndex; n = n->nextNode()) {
- Value value = o->getValue(ctx, arrayData + n->value, arrayAttributes ? arrayAttributes[n->value] : Attr_Data);
+ Value value = o->getValue(arrayData + n->value, arrayAttributes ? arrayAttributes[n->value] : Attr_Data);
if (__qmljs_strict_equal(value, v))
return Value::fromDouble(n->key());
}
pd += fromIndex;
while (pd < end) {
if (!arrayAttributes || !arrayAttributes[pd - arrayData].isGeneric()) {
- Value value = o->getValue(ctx, pd, arrayAttributes ? arrayAttributes[pd - arrayData] : Attr_Data);
+ Value value = o->getValue(pd, arrayAttributes ? arrayAttributes[pd - arrayData] : Attr_Data);
if (__qmljs_strict_equal(value, v))
return Value::fromDouble(pd - arrayData);
}
while (--len > i)
if (!arrayAttributes[len].isGeneric())
break;
- arrayData[i].value = getValue(context, arrayData + len, arrayAttributes[len]);
+ arrayData[i].value = getValue(arrayData + len, arrayAttributes[len]);
arrayAttributes[i] = Attr_Data;
arrayAttributes[len].clear();
} else if (arrayAttributes[i].isAccessor()) {
- arrayData[i].value = getValue(context, arrayData + i, arrayAttributes[i]);
+ arrayData[i].value = getValue(arrayData + i, arrayAttributes[i]);
arrayAttributes[i] = Attr_Data;
}
}
//
void put(ExecutionContext *ctx, const QString &name, const Value &value);
- static Value getValue(const Value &thisObject, ExecutionContext *ctx, const Property *p, PropertyAttributes attrs);
- Value getValue(ExecutionContext *ctx, const Property *p, PropertyAttributes attrs) const {
- return getValue(Value::fromObject(const_cast<Object *>(this)), ctx, p, attrs);
+ static Value getValue(const Value &thisObject, const Property *p, PropertyAttributes attrs);
+ Value getValue(const Property *p, PropertyAttributes attrs) const {
+ return getValue(Value::fromObject(const_cast<Object *>(this)), p, attrs);
}
- void putValue(ExecutionContext *ctx, Property *pd, PropertyAttributes attrs, const Value &value);
+ void putValue(Property *pd, PropertyAttributes attrs, const Value &value);
void inplaceBinOp(ExecutionContext *ctx, BinOp op, String *name, const Value &rhs);
void inplaceBinOp(ExecutionContext *ctx, BinOp op, const Value &index, const Value &rhs);
return Value::nullValue();
if (value)
- *value = object->getValue(object->engine()->current, p, attrs);
+ *value = object->getValue(p, attrs);
if (name)
return Value::fromString(name);
return Value::nullValue();
if (value)
- *value = object->getValue(object->engine()->current, p, attrs);
+ *value = object->getValue(p, attrs);
if (name)
return Value::fromString(name);
break;
Property n;
PropertyAttributes nattrs;
- toPropertyDescriptor(ctx, o->getValue(ctx, pd, attrs), &n, &nattrs);
+ toPropertyDescriptor(ctx, o->getValue(pd, attrs), &n, &nattrs);
bool ok;
if (name)
ok = O.objectValue()->__defineOwnProperty__(ctx, name, n, nattrs);
Property *p = l->lookup(baseObject, &attrs);
if (!p)
context->throwTypeError();
- Value func = attrs.isData() ? p->value : baseObject->getValue(context, p, attrs);
+ Value func = attrs.isData() ? p->value : baseObject->getValue(p, attrs);
FunctionObject *o = func.asFunctionObject();
if (!o)
context->throwTypeError();
}
if (hasProperty)
*hasProperty = true;
- return v4->stringPrototype->getValue(Value::fromString(that), v4->current, pd, attrs);
+ return v4->stringPrototype->getValue(Value::fromString(that), pd, attrs);
}
Value String::getIndexed(Managed *m, uint index, bool *hasProperty)
}
if (hasProperty)
*hasProperty = true;
- return engine->stringPrototype->getValue(Value::fromString(that), engine->current, pd, attrs);
+ return engine->stringPrototype->getValue(Value::fromString(that), pd, attrs);
}
void String::put(Managed *m, String *name, const Value &value)
QV4::ExecutionEngine *engine = o->internalClass->engine;
QV4::ExecutionContext *ctx = engine->current;
try {
- QV4::Value v = o->getValue(ctx, d_ptr->currentValue, d_ptr->currentAttributes);
+ QV4::Value v = o->getValue(d_ptr->currentValue, d_ptr->currentAttributes);
return new QJSValuePrivate(engine, v);
} catch (QV4::Exception &e) {
e.accept(ctx);