From 0eb9899df511bef56110aef7b17f07d7c67169e0 Mon Sep 17 00:00:00 2001 From: Lars Knoll Date: Thu, 7 Mar 2013 12:55:02 +0100 Subject: Cleanup put and properly implement it for strings Change-Id: I10dda09c8a087bc7ef34c0315c698e08c35ec28d Reviewed-by: Simon Hausmann --- src/v4/qmljs_environment.cpp | 6 ++-- src/v4/qmljs_runtime.cpp | 16 ++++----- src/v4/qv4argumentsobject.cpp | 2 +- src/v4/qv4arrayobject.cpp | 30 ++++++++-------- src/v4/qv4jsonobject.cpp | 2 +- src/v4/qv4managed.cpp | 10 ++++++ src/v4/qv4managed.h | 2 ++ src/v4/qv4object.cpp | 83 ++++++++++++++++++++++++++++++++++++++----- src/v4/qv4object.h | 44 +++++++++++------------ src/v4/qv4regexpobject.cpp | 4 +-- src/v4/qv4string.cpp | 9 +++-- src/v4/qv4stringobject.cpp | 4 +-- tools/v4/main.cpp | 4 +-- 13 files changed, 147 insertions(+), 69 deletions(-) diff --git a/src/v4/qmljs_environment.cpp b/src/v4/qmljs_environment.cpp index 92126937..244b9098 100644 --- a/src/v4/qmljs_environment.cpp +++ b/src/v4/qmljs_environment.cpp @@ -130,7 +130,7 @@ bool ExecutionContext::setMutableBinding(ExecutionContext *scope, String *name, } if (activation && activation->__hasProperty__(scope, name)) { - activation->__put__(scope, name, value); + activation->put(scope, name, value); return true; } @@ -338,7 +338,7 @@ void ExecutionContext::setProperty(String *name, const Value& value) // qDebug() << ctx << "hasWith"; if (w->__hasProperty__(ctx, name)) { // qDebug() << " withHasProp"; - w->__put__(ctx, name, value); + w->put(ctx, name, value); return; } } else if (ctx->exceptionVarName && ctx->exceptionVarName->isEqualTo(name)) { @@ -352,7 +352,7 @@ void ExecutionContext::setProperty(String *name, const Value& value) } if (strictMode || name->isEqualTo(engine->id_this)) throwReferenceError(Value::fromString(name)); - engine->globalObject.objectValue()->__put__(this, name, value); + engine->globalObject.objectValue()->put(this, name, value); } Value ExecutionContext::getProperty(String *name) diff --git a/src/v4/qmljs_runtime.cpp b/src/v4/qmljs_runtime.cpp index 5a272c8a..1e859eaa 100644 --- a/src/v4/qmljs_runtime.cpp +++ b/src/v4/qmljs_runtime.cpp @@ -585,7 +585,7 @@ String *__qmljs_convert_to_string(ExecutionContext *ctx, const Value &value) void __qmljs_set_property(ExecutionContext *ctx, const Value &object, String *name, const Value &value) { Object *o = object.toObject(ctx); - o->__put__(ctx, name, value); + o->put(ctx, name, value); } void __qmljs_get_element(ExecutionContext *ctx, Value *result, const Value &object, const Value &index) @@ -642,12 +642,12 @@ void __qmljs_set_element(ExecutionContext *ctx, const Value &object, const Value p->value = value; return; } - o->__put__(ctx, idx, value); + o->putIndexed(ctx, idx, value); return; } String *name = index.toString(ctx); - o->__put__(ctx, name, value); + o->put(ctx, name, value); } void __qmljs_foreach_iterator_object(ExecutionContext *ctx, Value *result, const Value &in) @@ -763,7 +763,7 @@ void __qmljs_set_property_lookup(ExecutionContext *ctx, const Value &object, int } } - o->__put__(ctx, l->name, value); + o->put(ctx, l->name, value); } @@ -1121,7 +1121,7 @@ void __qmljs_builtin_post_increment_member(ExecutionContext *context, Value *res v = Value::fromDouble(d + 1); } - o->__put__(context, name, v); + o->put(context, name, v); } void __qmljs_builtin_post_increment_element(ExecutionContext *context, Value *result, const Value &base, const Value *index) @@ -1148,7 +1148,7 @@ void __qmljs_builtin_post_increment_element(ExecutionContext *context, Value *re v = Value::fromDouble(d + 1); } - o->__put__(context, idx, v); + o->putIndexed(context, idx, v); } void __qmljs_builtin_post_decrement(ExecutionContext *ctx, Value *result, Value *val) @@ -1201,7 +1201,7 @@ void __qmljs_builtin_post_decrement_member(ExecutionContext *context, Value *res v = Value::fromDouble(d - 1); } - o->__put__(context, name, v); + o->put(context, name, v); } void __qmljs_builtin_post_decrement_element(ExecutionContext *context, Value *result, const Value &base, const Value &index) @@ -1228,7 +1228,7 @@ void __qmljs_builtin_post_decrement_element(ExecutionContext *context, Value *re v = Value::fromDouble(d - 1); } - o->__put__(context, idx, v); + o->putIndexed(context, idx, v); } void __qmljs_builtin_throw(ExecutionContext *context, const Value &val) diff --git a/src/v4/qv4argumentsobject.cpp b/src/v4/qv4argumentsobject.cpp index bca1738f..7667aaac 100644 --- a/src/v4/qv4argumentsobject.cpp +++ b/src/v4/qv4argumentsobject.cpp @@ -61,7 +61,7 @@ ArgumentsObject::ArgumentsObject(ExecutionContext *context, int formalParameterC defineDefaultProperty(context->engine->id_length, Value::fromInt32(actualParameterCount)); if (context->strictMode) { for (uint i = 0; i < context->argumentCount; ++i) - Object::__put__(context, QString::number(i), context->arguments[i]); + Object::put(context, QString::number(i), context->arguments[i]); FunctionObject *thrower = context->engine->newBuiltinFunction(context, 0, throwTypeError); PropertyDescriptor pd = PropertyDescriptor::fromAccessor(thrower, thrower); pd.configurable = PropertyDescriptor::Disabled; diff --git a/src/v4/qv4arrayobject.cpp b/src/v4/qv4arrayobject.cpp index 0b6906d2..2dba20eb 100644 --- a/src/v4/qv4arrayobject.cpp +++ b/src/v4/qv4arrayobject.cpp @@ -223,7 +223,7 @@ Value ArrayPrototype::method_pop(ExecutionContext *ctx) if (!len) { if (!instance->isArrayObject()) - instance->__put__(ctx, ctx->engine->id_length, Value::fromInt32(0)); + instance->put(ctx, ctx->engine->id_length, Value::fromInt32(0)); return Value::undefinedValue(); } @@ -233,7 +233,7 @@ Value ArrayPrototype::method_pop(ExecutionContext *ctx) if (instance->isArrayObject()) instance->setArrayLengthUnchecked(len - 1); else - instance->__put__(ctx, ctx->engine->id_length, Value::fromDouble(len - 1)); + instance->put(ctx, ctx->engine->id_length, Value::fromDouble(len - 1)); return result; } @@ -247,11 +247,11 @@ Value ArrayPrototype::method_push(ExecutionContext *ctx) double l = len; for (double i = 0; i < ctx->argumentCount; ++i) { Value idx = Value::fromDouble(l + i); - instance->__put__(ctx, idx.toString(ctx), ctx->argument(i)); + instance->put(ctx, idx.toString(ctx), ctx->argument(i)); } double newLen = l + ctx->argumentCount; if (!instance->isArrayObject()) - instance->__put__(ctx, ctx->engine->id_length, Value::fromDouble(newLen)); + instance->put(ctx, ctx->engine->id_length, Value::fromDouble(newLen)); else ctx->throwRangeError(Value::fromString(ctx, QStringLiteral("Array.prototype.push: Overflow"))); return Value::fromDouble(newLen); @@ -280,13 +280,13 @@ Value ArrayPrototype::method_push(ExecutionContext *ctx) } } else { for (uint i = 0; i < ctx->argumentCount; ++i) - instance->__put__(ctx, len + i, ctx->argument(i)); + instance->putIndexed(ctx, len + i, ctx->argument(i)); len += ctx->argumentCount; } if (instance->isArrayObject()) instance->setArrayLengthUnchecked(len); else - instance->__put__(ctx, ctx->engine->id_length, Value::fromDouble(len)); + instance->put(ctx, ctx->engine->id_length, Value::fromDouble(len)); if (len < INT_MAX) return Value::fromInt32(len); @@ -306,11 +306,11 @@ Value ArrayPrototype::method_reverse(ExecutionContext *ctx) Value lval = instance->getIndexed(ctx, lo, &loExists); Value hval = instance->getIndexed(ctx, hi, &hiExists); if (hiExists) - instance->__put__(ctx, lo, hval); + instance->putIndexed(ctx, lo, hval); else instance->__delete__(ctx, lo); if (loExists) - instance->__put__(ctx, hi, lval); + instance->putIndexed(ctx, hi, lval); else instance->__delete__(ctx, hi); } @@ -324,7 +324,7 @@ Value ArrayPrototype::method_shift(ExecutionContext *ctx) if (!len) { if (!instance->isArrayObject()) - instance->__put__(ctx, ctx->engine->id_length, Value::fromInt32(0)); + instance->put(ctx, ctx->engine->id_length, Value::fromInt32(0)); return Value::undefinedValue(); } @@ -366,7 +366,7 @@ Value ArrayPrototype::method_shift(ExecutionContext *ctx) bool exists; Value v = instance->getIndexed(ctx, k, &exists); if (exists) - instance->__put__(ctx, k - 1, v); + instance->putIndexed(ctx, k - 1, v); else instance->__delete__(ctx, k - 1); } @@ -376,7 +376,7 @@ Value ArrayPrototype::method_shift(ExecutionContext *ctx) if (instance->isArrayObject()) instance->setArrayLengthUnchecked(len - 1); else - instance->__put__(ctx, ctx->engine->id_length, Value::fromDouble(len - 1)); + instance->put(ctx, ctx->engine->id_length, Value::fromDouble(len - 1)); return result; } @@ -487,7 +487,7 @@ Value ArrayPrototype::method_splice(ExecutionContext *ctx) instance->arraySet(start + i, ctx->argument(i + 2)); ctx->strictMode = true; - instance->__put__(ctx, ctx->engine->id_length, Value::fromDouble(len - deleteCount + itemCount)); + instance->put(ctx, ctx->engine->id_length, Value::fromDouble(len - deleteCount + itemCount)); return Value::fromObject(newArray); } @@ -525,19 +525,19 @@ Value ArrayPrototype::method_unshift(ExecutionContext *ctx) bool exists; Value v = instance->getIndexed(ctx, k - 1, &exists); if (exists) - instance->__put__(ctx, k + ctx->argumentCount - 1, v); + instance->putIndexed(ctx, k + ctx->argumentCount - 1, v); else instance->__delete__(ctx, k + ctx->argumentCount - 1); } for (uint i = 0; i < ctx->argumentCount; ++i) - instance->__put__(ctx, i, ctx->argument(i)); + instance->putIndexed(ctx, i, ctx->argument(i)); } uint newLen = len + ctx->argumentCount; if (instance->isArrayObject()) instance->setArrayLengthUnchecked(newLen); else - instance->__put__(ctx, ctx->engine->id_length, Value::fromDouble(newLen)); + instance->put(ctx, ctx->engine->id_length, Value::fromDouble(newLen)); if (newLen < INT_MAX) return Value::fromInt32(newLen); diff --git a/src/v4/qv4jsonobject.cpp b/src/v4/qv4jsonobject.cpp index da39c674..4ecb735f 100644 --- a/src/v4/qv4jsonobject.cpp +++ b/src/v4/qv4jsonobject.cpp @@ -715,7 +715,7 @@ QString Stringify::Str(const QString &key, Value value) if (replacerFunction) { Object *holder = ctx->engine->newObject(); Value holderValue = Value::fromObject(holder); - holder->__put__(ctx, QString(), value); + holder->put(ctx, QString(), value); Value args[2]; args[0] = Value::fromString(ctx, key); args[1] = value; diff --git a/src/v4/qv4managed.cpp b/src/v4/qv4managed.cpp index 30219b9a..51017fe2 100644 --- a/src/v4/qv4managed.cpp +++ b/src/v4/qv4managed.cpp @@ -183,3 +183,13 @@ Value Managed::getIndexed(ExecutionContext *ctx, uint index, bool *hasProperty) { return vtbl->getIndexed(this, ctx, index, hasProperty); } + +void Managed::put(ExecutionContext *ctx, String *name, const Value &value) +{ + vtbl->put(this, ctx, name, value); +} + +void Managed::putIndexed(ExecutionContext *ctx, uint index, const Value &value) +{ + vtbl->putIndexed(this, ctx, index, value); +} diff --git a/src/v4/qv4managed.h b/src/v4/qv4managed.h index 6ddce626..2e69eecb 100644 --- a/src/v4/qv4managed.h +++ b/src/v4/qv4managed.h @@ -189,6 +189,8 @@ public: Value call(ExecutionContext *context, const Value &thisObject, Value *args, int argc); Value get(ExecutionContext *ctx, String *name, bool *hasProperty = 0); Value getIndexed(ExecutionContext *ctx, uint index, bool *hasProperty = 0); + void put(ExecutionContext *ctx, String *name, const Value &value); + void putIndexed(ExecutionContext *ctx, uint index, const Value &value); static void destroy(Managed *that) { that->_data = 0; } static bool hasInstance(Managed *that, ExecutionContext *ctx, const Value &value); diff --git a/src/v4/qv4object.cpp b/src/v4/qv4object.cpp index 588008a1..d4237811 100644 --- a/src/v4/qv4object.cpp +++ b/src/v4/qv4object.cpp @@ -92,9 +92,9 @@ void Object::destroy(Managed *that) static_cast(that)->~Object(); } -void Object::__put__(ExecutionContext *ctx, const QString &name, const Value &value) +void Object::put(ExecutionContext *ctx, const QString &name, const Value &value) { - __put__(ctx, ctx->engine->newString(name), value); + put(ctx, ctx->engine->newString(name), value); } Value Object::getValue(ExecutionContext *ctx, const PropertyDescriptor *p) const @@ -159,13 +159,37 @@ void Object::putValue(ExecutionContext *ctx, PropertyDescriptor *pd, const Value } +void Object::putValue(ExecutionContext *ctx, PropertyDescriptor *pd, const Value &thisObject, const Value &value) +{ + if (pd->isAccessor()) { + if (pd->set) { + Value args[1]; + args[0] = value; + pd->set->call(ctx, thisObject, args, 1); + return; + } + goto reject; + } + + if (!pd->isWritable()) + goto reject; + + pd->value = value; + return; + + reject: + if (ctx->strictMode) + ctx->throwTypeError(); + +} + void Object::inplaceBinOp(ExecutionContext *ctx, BinOp op, String *name, const Value &rhs) { bool hasProperty = false; Value v = get(ctx, name, &hasProperty); Value result; op(ctx, &result, v, rhs); - __put__(ctx, name, result); + put(ctx, name, result); } void Object::inplaceBinOp(ExecutionContext *ctx, BinOp op, const Value &index, const Value &rhs) @@ -176,7 +200,7 @@ void Object::inplaceBinOp(ExecutionContext *ctx, BinOp op, const Value &index, c Value v = getIndexed(ctx, idx, &hasProperty); Value result; op(ctx, &result, v, rhs); - __put__(ctx, idx, result); + putIndexed(ctx, idx, result); return; } String *name = index.toString(ctx); @@ -328,8 +352,49 @@ PropertyDescriptor *Object::__getPropertyDescriptor__(const ExecutionContext *ct return 0; } +Value Object::get(Managed *m, ExecutionContext *ctx, String *name, bool *hasProperty) +{ + return static_cast(m)->internalGet(ctx, name, hasProperty); +} + +Value Object::getIndexed(Managed *m, ExecutionContext *ctx, uint index, bool *hasProperty) +{ + return static_cast(m)->internalGetIndexed(ctx, index, hasProperty); +} + +void Object::put(Managed *m, ExecutionContext *ctx, String *name, const Value &value) +{ + static_cast(m)->internalPut(ctx, name, value); +} + +void Object::putIndexed(Managed *m, ExecutionContext *ctx, uint index, const Value &value) +{ + static_cast(m)->internalPutIndexed(ctx, index, value); +} + +PropertyFlags Object::query(Managed *m, ExecutionContext *ctx, String *name) +{ + return PropertyFlags(0); /* ### */ +} + +PropertyFlags Object::queryIndexed(Managed *m, ExecutionContext *ctx, uint index) +{ + return PropertyFlags(0); /* ### */ +} + +bool Object::deleteProperty(Managed *m, ExecutionContext *ctx, String *name) +{ + return static_cast(m)->__delete__(ctx, name); +} + +bool Object::deleteIndexedProperty(Managed *m, ExecutionContext *ctx, uint index) +{ + return static_cast(m)->__delete__(ctx, index); +} + + // Section 8.12.3 -Value Object::get(ExecutionContext *ctx, String *name, bool *hasProperty) +Value Object::internalGet(ExecutionContext *ctx, String *name, bool *hasProperty) { uint idx = name->asArrayIndex(); if (idx != UINT_MAX) @@ -360,7 +425,7 @@ Value Object::get(ExecutionContext *ctx, String *name, bool *hasProperty) return Value::undefinedValue(); } -Value Object::getIndexed(ExecutionContext *ctx, uint index, bool *hasProperty) +Value Object::internalGetIndexed(ExecutionContext *ctx, uint index, bool *hasProperty) { PropertyDescriptor *pd = 0; Object *o = this; @@ -393,11 +458,11 @@ Value Object::getIndexed(ExecutionContext *ctx, uint index, bool *hasProperty) // Section 8.12.5 -void Object::__put__(ExecutionContext *ctx, String *name, const Value &value) +void Object::internalPut(ExecutionContext *ctx, String *name, const Value &value) { uint idx = name->asArrayIndex(); if (idx != UINT_MAX) - return __put__(ctx, idx, value); + return putIndexed(ctx, idx, value); name->makeIdentifier(ctx); @@ -474,7 +539,7 @@ void Object::__put__(ExecutionContext *ctx, String *name, const Value &value) ctx->throwTypeError(); } -void Object::__put__(ExecutionContext *ctx, uint index, const Value &value) +void Object::internalPutIndexed(ExecutionContext *ctx, uint index, const Value &value) { PropertyDescriptor *pd = __getOwnProperty__(ctx, index); // clause 1 diff --git a/src/v4/qv4object.h b/src/v4/qv4object.h index a8bcffae..d0877543 100644 --- a/src/v4/qv4object.h +++ b/src/v4/qv4object.h @@ -132,13 +132,6 @@ struct Q_V4_EXPORT Object: Managed { PropertyDescriptor *__getPropertyDescriptor__(const ExecutionContext *ctx, String *name) const; PropertyDescriptor *__getPropertyDescriptor__(const ExecutionContext *ctx, uint index) const; - Value get(ExecutionContext *ctx, String *name, bool *hasProperty = 0); - Value getIndexed(ExecutionContext *ctx, uint index, bool *hasProperty = 0); - - // -> vtable - void __put__(ExecutionContext *ctx, String *name, const Value &value); - void __put__(ExecutionContext *ctx, uint index, const Value &value); - bool __hasProperty__(const ExecutionContext *ctx, String *name) const { PropertyDescriptor *pd = __getPropertyDescriptor__(ctx, name); return pd && pd->type != PropertyDescriptor::Generic; @@ -159,7 +152,7 @@ struct Q_V4_EXPORT Object: Managed { // // helpers // - void __put__(ExecutionContext *ctx, const QString &name, const Value &value); + void put(ExecutionContext *ctx, const QString &name, const Value &value); Value getValue(ExecutionContext *ctx, const PropertyDescriptor *p) const; Value getValueChecked(ExecutionContext *ctx, const PropertyDescriptor *p) const; @@ -167,6 +160,7 @@ struct Q_V4_EXPORT Object: Managed { Value getValueChecked(ExecutionContext *ctx, const PropertyDescriptor *p, bool *exists) const; void putValue(ExecutionContext *ctx, PropertyDescriptor *pd, const Value &value); + void putValue(ExecutionContext *ctx, PropertyDescriptor *pd, const Value &thisObject, 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); @@ -321,26 +315,28 @@ public: void arrayReserve(uint n); + using Managed::get; + using Managed::getIndexed; + using Managed::put; + using Managed::putIndexed; protected: static const ManagedVTable static_vtbl; static void destroy(Managed *that); static void markObjects(Managed *that); - static Value get(Managed *m, ExecutionContext *ctx, String *name, bool *hasProperty) - { return static_cast(m)->get(ctx, name, hasProperty); } - static Value getIndexed(Managed *m, ExecutionContext *ctx, uint index, bool *hasProperty) - { return static_cast(m)->getIndexed(ctx, index, hasProperty); } - static void put(Managed *m, ExecutionContext *ctx, String *name, const Value &value) - { static_cast(m)->__put__(ctx, name, value); } - static void putIndexed(Managed *m, ExecutionContext *ctx, uint index, const Value &value) - { static_cast(m)->__put__(ctx, index, value); } - static PropertyFlags query(Managed *m, ExecutionContext *ctx, String *name) - { return PropertyFlags(0); /* ### */ } - static PropertyFlags queryIndexed(Managed *m, ExecutionContext *ctx, uint index) - { return PropertyFlags(0); /* ### */ } - static bool deleteProperty(Managed *m, ExecutionContext *ctx, String *name) - { return static_cast(m)->__delete__(ctx, name); } - static bool deleteIndexedProperty(Managed *m, ExecutionContext *ctx, uint index) - { return static_cast(m)->__delete__(ctx, index); } + static Value get(Managed *m, ExecutionContext *ctx, String *name, bool *hasProperty); + static Value getIndexed(Managed *m, ExecutionContext *ctx, uint index, bool *hasProperty); + static void put(Managed *m, ExecutionContext *ctx, String *name, const Value &value); + static void putIndexed(Managed *m, ExecutionContext *ctx, uint index, const Value &value); + static PropertyFlags query(Managed *m, ExecutionContext *ctx, String *name); + static PropertyFlags queryIndexed(Managed *m, ExecutionContext *ctx, uint index); + static bool deleteProperty(Managed *m, ExecutionContext *ctx, String *name); + static bool deleteIndexedProperty(Managed *m, ExecutionContext *ctx, uint index); + +private: + Value internalGet(ExecutionContext *ctx, String *name, bool *hasProperty); + Value internalGetIndexed(ExecutionContext *ctx, uint index, bool *hasProperty); + void internalPut(ExecutionContext *ctx, String *name, const Value &value); + void internalPutIndexed(ExecutionContext *ctx, uint index, const Value &value); friend struct ObjectIterator; friend struct ObjectPrototype; diff --git a/src/v4/qv4regexpobject.cpp b/src/v4/qv4regexpobject.cpp index 556fd3b3..926aca66 100644 --- a/src/v4/qv4regexpobject.cpp +++ b/src/v4/qv4regexpobject.cpp @@ -204,8 +204,8 @@ Value RegExpPrototype::method_exec(ExecutionContext *ctx) array->push_back(entry); } - array->__put__(ctx, QLatin1String("index"), Value::fromInt32(result)); - array->__put__(ctx, QLatin1String("input"), arg); + array->put(ctx, QLatin1String("index"), Value::fromInt32(result)); + array->put(ctx, QLatin1String("input"), arg); if (r->global) r->lastIndexProperty(ctx)->value = Value::fromInt32(matchOffsets[1]); diff --git a/src/v4/qv4string.cpp b/src/v4/qv4string.cpp index 42f7ffdc..a7f288e4 100644 --- a/src/v4/qv4string.cpp +++ b/src/v4/qv4string.cpp @@ -43,6 +43,7 @@ #include "qv4identifier.h" #include "qmljs_runtime.h" #include "qv4objectproto.h" +#include "qv4stringobject.h" #include namespace QQmlJS { @@ -121,12 +122,16 @@ Value String::getIndexed(Managed *m, ExecutionContext *ctx, uint index, bool *ha void String::put(Managed *m, ExecutionContext *ctx, String *name, const Value &value) { - /* ### */ + String *that = static_cast(m); + Object *o = ctx->engine->newStringObject(ctx, Value::fromString(that)); + o->put(ctx, name, value); } void String::putIndexed(Managed *m, ExecutionContext *ctx, uint index, const Value &value) { - /* ### */ + String *that = static_cast(m); + Object *o = ctx->engine->newStringObject(ctx, Value::fromString(that)); + o->putIndexed(ctx, index, value); } PropertyFlags String::query(Managed *m, ExecutionContext *ctx, String *name) diff --git a/src/v4/qv4stringobject.cpp b/src/v4/qv4stringobject.cpp index bdc62658..fa00be8b 100644 --- a/src/v4/qv4stringobject.cpp +++ b/src/v4/qv4stringobject.cpp @@ -325,7 +325,7 @@ Value StringPrototype::method_match(ExecutionContext *parentCtx, Value thisObjec return exec->call(parentCtx, Value::fromObject(rx), &arg, 1); String *lastIndex = parentCtx->engine->newString(QStringLiteral("lastIndex")); - rx->__put__(parentCtx, lastIndex, Value::fromInt32(0)); + rx->put(parentCtx, lastIndex, Value::fromInt32(0)); ArrayObject *a = parentCtx->engine->newArrayObject(parentCtx); double previousLastIndex = 0; @@ -338,7 +338,7 @@ Value StringPrototype::method_match(ExecutionContext *parentCtx, Value thisObjec double thisIndex = rx->get(parentCtx, lastIndex, 0).toInteger(parentCtx); if (previousLastIndex == thisIndex) { previousLastIndex = thisIndex + 1; - rx->__put__(parentCtx, lastIndex, Value::fromDouble(previousLastIndex)); + rx->put(parentCtx, lastIndex, Value::fromDouble(previousLastIndex)); } else { previousLastIndex = thisIndex; } diff --git a/tools/v4/main.cpp b/tools/v4/main.cpp index eb46b719..d152f211 100644 --- a/tools/v4/main.cpp +++ b/tools/v4/main.cpp @@ -356,11 +356,11 @@ int main(int argc, char *argv[]) QQmlJS::VM::Object *globalObject = vm.globalObject.objectValue(); QQmlJS::VM::Object *print = new (ctx->engine->memoryManager) builtins::Print(ctx); print->prototype = ctx->engine->objectPrototype; - globalObject->__put__(ctx, vm.newIdentifier(QStringLiteral("print")), + globalObject->put(ctx, vm.newIdentifier(QStringLiteral("print")), QQmlJS::VM::Value::fromObject(print)); QQmlJS::VM::Object *gc = new (ctx->engine->memoryManager) builtins::GC(ctx); gc->prototype = ctx->engine->objectPrototype; - globalObject->__put__(ctx, vm.newIdentifier(QStringLiteral("gc")), + globalObject->put(ctx, vm.newIdentifier(QStringLiteral("gc")), QQmlJS::VM::Value::fromObject(gc)); foreach (const QString &fn, args) { -- cgit v1.2.3