//
Object::~Object()
{
- delete members;
}
void Object::__put__(ExecutionContext *ctx, const QString &name, const Value &value)
void Object::defineDefaultProperty(String *name, Value value)
{
if (!members)
- members = new PropertyTable();
+ members.reset(new PropertyTable());
PropertyDescriptor *pd = members->insert(name);
pd->type = PropertyDescriptor::Data;
pd->writable = PropertyDescriptor::Set;
void Object::defineReadonlyProperty(ExecutionEngine *engine, const QString &name, Value value)
{
if (!members)
- members = new PropertyTable();
+ members.reset(new PropertyTable());
PropertyDescriptor *pd = members->insert(engine->identifier(name));
pd->type = PropertyDescriptor::Data;
pd->writable = PropertyDescriptor::Unset;
goto reject;
if (!members)
- members = new PropertyTable();
+ members.reset(new PropertyTable());
{
// Clause 2
bool Object::__defineOwnProperty__(ExecutionContext *ctx, String *name, PropertyDescriptor *desc)
{
if (!members)
- members = new PropertyTable();
+ members.reset(new PropertyTable());
// Clause 1
PropertyDescriptor *current = __getOwnProperty__(ctx, name);
#include <QtCore/QString>
#include <QtCore/QHash>
#include <QtCore/QRegularExpression>
+#include <QtCore/QScopedPointer>
#include <cstdio>
#include <cassert>
struct Object: Managed {
Object *prototype;
- PropertyTable *members;
+ QScopedPointer<PropertyTable> members;
bool extensible;
Object()
: prototype(0)
- , members(0)
, extensible(true) {}
virtual ~Object();
ArrayObject *array = ctx->engine->newArrayObject()->asArrayObject();
Array &a = array->value;
- if (PropertyTable *members = O.objectValue()->members) {
+ if (PropertyTable *members = O.objectValue()->members.data()) {
for (PropertyTableEntry **it = members->begin(), **end = members->end(); it != end; ++it) {
if (PropertyTableEntry *prop = *it) {
a.push(Value::fromString(prop->name));