desc.configurable = deletable ? PropertyDescriptor::Set : PropertyDescriptor::Unset;
desc.writable = PropertyDescriptor::Set;
desc.enumberable = PropertyDescriptor::Set;
- activation->__defineOwnProperty__(ctx, name, &desc, true);
+ activation->__defineOwnProperty__(ctx, name, &desc);
}
void DeclarativeEnvironment::setMutableBinding(String *name, Value value, bool strict)
bool DeclarativeEnvironment::deleteBinding(ExecutionContext *ctx, String *name)
{
if (activation)
- activation->__delete__(ctx, name, false);
+ activation->__delete__(ctx, name);
- // ### throw in strict mode?
+ if (ctx->lexicalEnvironment->strictMode)
+ __qmljs_throw_type_error(ctx);
return false;
}
}
// Section 8.12.5
-void Object::__put__(ExecutionContext *ctx, String *name, const Value &value, bool throwException)
+void Object::__put__(ExecutionContext *ctx, String *name, const Value &value)
{
// clause 1
if (!__canPut__(ctx, name))
// ### to simplify and speed up we should expand the relevant parts here (clauses 6,7,9,10,12,13)
PropertyDescriptor desc = PropertyDescriptor::fromValue(value);
- __defineOwnProperty__(ctx, name, &desc, throwException);
+ __defineOwnProperty__(ctx, name, &desc);
return;
}
}
reject:
- if (throwException)
+ if (ctx->lexicalEnvironment->strictMode)
__qmljs_throw_type_error(ctx);
}
}
// Section 8.12.7
-bool Object::__delete__(ExecutionContext *ctx, String *name, bool throwException)
+bool Object::__delete__(ExecutionContext *ctx, String *name)
{
if (members) {
if (PropertyTableEntry *entry = members->findEntry(name)) {
members->remove(entry);
return true;
}
- if (throwException)
+ if (ctx->lexicalEnvironment->strictMode)
__qmljs_throw_type_error(ctx);
return false;
}
}
// Section 8.12.9
-bool Object::__defineOwnProperty__(ExecutionContext *ctx, String *name, PropertyDescriptor *desc, bool throwException)
+bool Object::__defineOwnProperty__(ExecutionContext *ctx, String *name, PropertyDescriptor *desc)
{
if (!members)
members = new PropertyTable();
return true;
reject:
qDebug() << "___put__ rejected" << name->toQString();
- if (throwException)
+ if (ctx->lexicalEnvironment->strictMode)
__qmljs_throw_type_error(ctx);
return false;
}
virtual Value __get__(ExecutionContext *ctx, String *name);
virtual PropertyDescriptor *__getOwnProperty__(ExecutionContext *ctx, String *name);
virtual PropertyDescriptor *__getPropertyDescriptor__(ExecutionContext *ctx, String *name, PropertyDescriptor *to_fill);
- virtual void __put__(ExecutionContext *ctx, String *name, const Value &value, bool throwException = false);
+ virtual void __put__(ExecutionContext *ctx, String *name, const Value &value);
virtual bool __canPut__(ExecutionContext *ctx, String *name);
virtual bool __hasProperty__(ExecutionContext *ctx, String *name) const;
- virtual bool __delete__(ExecutionContext *ctx, String *name, bool throwException = false);
- virtual bool __defineOwnProperty__(ExecutionContext *ctx, String *name, PropertyDescriptor *desc, bool throwException = false);
+ virtual bool __delete__(ExecutionContext *ctx, String *name);
+ virtual bool __defineOwnProperty__(ExecutionContext *ctx, String *name, PropertyDescriptor *desc);
//
// helpers
Value __qmljs_delete_member(ExecutionContext *ctx, Value base, String *name)
{
Value obj = base.toObject(ctx);
- return Value::fromBoolean(obj.objectValue()->__delete__(ctx, name, true));
+ return Value::fromBoolean(obj.objectValue()->__delete__(ctx, name));
}
Value __qmljs_delete_name(ExecutionContext *ctx, String *name)
void __qmljs_set_property(ExecutionContext *ctx, Value object, String *name, Value value)
{
- object.objectValue()->__put__(ctx, name, value, /*flags*/ 0);
+ object.objectValue()->__put__(ctx, name, value);
}
Value __qmljs_get_element(ExecutionContext *ctx, Value object, Value index)
if (! object.isObject())
object = __qmljs_to_object(object, ctx);
- object.objectValue()->__put__(ctx, name, value, /*flags*/ 0);
+ object.objectValue()->__put__(ctx, name, value);
}
Value __qmljs_foreach_iterator_object(Value in, ExecutionContext *ctx)
if (r2) {
String *r6 = Value::fromDouble(r2 - 1).toString(ctx);
Value r7 = self.property(ctx, r6);
- self.objectValue()->__delete__(ctx, r6, 0);
+ self.objectValue()->__delete__(ctx, r6);
self.objectValue()->__put__(ctx, ctx->engine->id_length, Value::fromDouble(2 - 1));
return r7;
}