aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorSimon Hausmann <simon.hausmann@digia.com>2012-12-13 13:12:10 +0100
committerLars Knoll <lars.knoll@digia.com>2012-12-13 13:34:13 +0100
commit0e8302d22966ed1e8b364a21fd7b2f3b06358f9c (patch)
tree356fd7a9f6582fcac98602c701af1fb2bf312db9
parent73824a7b6fbaa91c02a3b0e88b1c86f3267c5f49 (diff)
Rename Unset/Set to the more readable Enabled/Disabled for the property tristate
Change-Id: I67f5a509be64b20a5fa0205779f2a67dc1ba6536 Reviewed-by: Lars Knoll <lars.knoll@digia.com>
-rw-r--r--qmljs_environment.cpp6
-rw-r--r--qmljs_objects.cpp24
-rw-r--r--qmljs_objects.h16
-rw-r--r--qv4ecmaobjects.cpp42
4 files changed, 44 insertions, 44 deletions
diff --git a/qmljs_environment.cpp b/qmljs_environment.cpp
index c4177ad26e..e717851069 100644
--- a/qmljs_environment.cpp
+++ b/qmljs_environment.cpp
@@ -106,9 +106,9 @@ void ExecutionContext::createMutableBinding(String *name, bool deletable)
PropertyDescriptor desc;
desc.value = Value::undefinedValue();
desc.type = PropertyDescriptor::Data;
- desc.configurable = deletable ? PropertyDescriptor::Set : PropertyDescriptor::Unset;
- desc.writable = PropertyDescriptor::Set;
- desc.enumberable = PropertyDescriptor::Set;
+ desc.configurable = deletable ? PropertyDescriptor::Enabled : PropertyDescriptor::Disabled;
+ desc.writable = PropertyDescriptor::Enabled;
+ desc.enumberable = PropertyDescriptor::Enabled;
activation->__defineOwnProperty__(this, name, &desc);
}
diff --git a/qmljs_objects.cpp b/qmljs_objects.cpp
index 5116282f1c..616fe82df8 100644
--- a/qmljs_objects.cpp
+++ b/qmljs_objects.cpp
@@ -128,9 +128,9 @@ void Object::defineDefaultProperty(String *name, Value value)
members.reset(new PropertyTable());
PropertyDescriptor *pd = members->insert(name);
pd->type = PropertyDescriptor::Data;
- pd->writable = PropertyDescriptor::Set;
- pd->enumberable = PropertyDescriptor::Unset;
- pd->configurable = PropertyDescriptor::Set;
+ pd->writable = PropertyDescriptor::Enabled;
+ pd->enumberable = PropertyDescriptor::Disabled;
+ pd->configurable = PropertyDescriptor::Enabled;
pd->value = value;
}
@@ -153,9 +153,9 @@ void Object::defineReadonlyProperty(ExecutionEngine *engine, const QString &name
members.reset(new PropertyTable());
PropertyDescriptor *pd = members->insert(engine->identifier(name));
pd->type = PropertyDescriptor::Data;
- pd->writable = PropertyDescriptor::Unset;
- pd->enumberable = PropertyDescriptor::Unset;
- pd->configurable = PropertyDescriptor::Unset;
+ pd->writable = PropertyDescriptor::Disabled;
+ pd->enumberable = PropertyDescriptor::Disabled;
+ pd->configurable = PropertyDescriptor::Disabled;
pd->value = value;
}
@@ -270,9 +270,9 @@ void Object::__put__(ExecutionContext *ctx, String *name, Value value)
PropertyDescriptor *p = members->insert(name);
*p = PropertyDescriptor::fromValue(value);
- p->configurable = PropertyDescriptor::Set;
- p->enumberable = PropertyDescriptor::Set;
- p->writable = PropertyDescriptor::Set;
+ p->configurable = PropertyDescriptor::Enabled;
+ p->enumberable = PropertyDescriptor::Enabled;
+ p->writable = PropertyDescriptor::Enabled;
return;
}
@@ -360,7 +360,7 @@ bool Object::__defineOwnProperty__(ExecutionContext *ctx, String *name, Property
} else {
// 9c
current->type = PropertyDescriptor::Data;
- current->writable = PropertyDescriptor::Unset;
+ current->writable = PropertyDescriptor::Disabled;
current->value = Value::undefinedValue();
}
} else if (current->isData() && desc->isData()) { // clause 10
@@ -788,8 +788,8 @@ PropertyDescriptor *ArgumentsObject::__getPropertyDescriptor__(ExecutionContext
const quint32 i = Value::fromString(name).toUInt32(ctx);
if (i < context->argumentCount) {
*to_fill = PropertyDescriptor::fromValue(context->argument(i));
- to_fill->writable = PropertyDescriptor::Unset;
- to_fill->enumberable = PropertyDescriptor::Unset;
+ to_fill->writable = PropertyDescriptor::Disabled;
+ to_fill->enumberable = PropertyDescriptor::Disabled;
return to_fill;
}
}
diff --git a/qmljs_objects.h b/qmljs_objects.h
index 965b333230..419ada796d 100644
--- a/qmljs_objects.h
+++ b/qmljs_objects.h
@@ -153,8 +153,8 @@ struct PropertyDescriptor {
};
enum State {
Undefined,
- Unset,
- Set
+ Disabled,
+ Enabled
};
union {
Value value;
@@ -196,23 +196,23 @@ struct PropertyDescriptor {
}
if (type == Data) {
if (writable == Undefined)
- writable = Unset;
+ writable = Disabled;
} else {
writable = Undefined;
}
if (enumberable == Undefined)
- enumberable = Unset;
+ enumberable = Disabled;
if (configurable == Undefined)
- configurable = Unset;
+ configurable = Disabled;
}
inline bool isData() const { return type == Data; }
inline bool isAccessor() const { return type == Accessor; }
inline bool isGeneric() const { return type == Generic; }
- inline bool isWritable() const { return writable == Set; }
- inline bool isEnumerable() const { return enumberable == Set; }
- inline bool isConfigurable() const { return configurable == Set; }
+ inline bool isWritable() const { return writable == Enabled; }
+ inline bool isEnumerable() const { return enumberable == Enabled; }
+ inline bool isConfigurable() const { return configurable == Enabled; }
inline bool isEmpty() {
return type == Generic && writable == Undefined && enumberable == Undefined && configurable == Undefined;
diff --git a/qv4ecmaobjects.cpp b/qv4ecmaobjects.cpp
index 3090a3ee2c..bd8969d886 100644
--- a/qv4ecmaobjects.cpp
+++ b/qv4ecmaobjects.cpp
@@ -687,7 +687,7 @@ Value ObjectPrototype::method_seal(ExecutionContext *ctx)
if (o->members) {
PropertyTable::iterator it = o->members->begin();
while (it != o->members->end()) {
- (*it)->descriptor.configurable = PropertyDescriptor::Unset;
+ (*it)->descriptor.configurable = PropertyDescriptor::Disabled;
++it;
}
}
@@ -705,8 +705,8 @@ Value ObjectPrototype::method_freeze(ExecutionContext *ctx)
PropertyTable::iterator it = o->members->begin();
while (it != o->members->end()) {
if ((*it)->descriptor.isData())
- (*it)->descriptor.writable = PropertyDescriptor::Unset;
- (*it)->descriptor.configurable = PropertyDescriptor::Unset;
+ (*it)->descriptor.writable = PropertyDescriptor::Disabled;
+ (*it)->descriptor.configurable = PropertyDescriptor::Disabled;
++it;
}
}
@@ -734,7 +734,7 @@ Value ObjectPrototype::method_isSealed(ExecutionContext *ctx)
if (o->members) {
PropertyTable::iterator it = o->members->begin();
while (it != o->members->end()) {
- if ((*it)->descriptor.configurable != PropertyDescriptor::Unset)
+ if ((*it)->descriptor.configurable != PropertyDescriptor::Disabled)
return Value::fromBoolean(false);
++it;
}
@@ -754,9 +754,9 @@ Value ObjectPrototype::method_isFrozen(ExecutionContext *ctx)
PropertyTable::iterator it = o->members->begin();
while (it != o->members->end()) {
if ((*it)->descriptor.isData() &&
- ((*it)->descriptor.writable != PropertyDescriptor::Unset))
+ ((*it)->descriptor.writable != PropertyDescriptor::Disabled))
return Value::fromBoolean(false);
- if ((*it)->descriptor.configurable != PropertyDescriptor::Unset)
+ if ((*it)->descriptor.configurable != PropertyDescriptor::Disabled)
return Value::fromBoolean(false);
++it;
}
@@ -857,9 +857,9 @@ Value ObjectPrototype::method_defineGetter(ExecutionContext *ctx)
Object *o = ctx->thisObject.toObject(ctx).objectValue();
PropertyDescriptor pd = PropertyDescriptor::fromAccessor(f, 0);
- pd.writable = PropertyDescriptor::Set;
- pd.configurable = PropertyDescriptor::Set;
- pd.enumberable = PropertyDescriptor::Set;
+ pd.writable = PropertyDescriptor::Enabled;
+ pd.configurable = PropertyDescriptor::Enabled;
+ pd.enumberable = PropertyDescriptor::Enabled;
o->__defineOwnProperty__(ctx, prop, &pd);
return Value::undefinedValue();
}
@@ -877,9 +877,9 @@ Value ObjectPrototype::method_defineSetter(ExecutionContext *ctx)
Object *o = ctx->thisObject.toObject(ctx).objectValue();
PropertyDescriptor pd = PropertyDescriptor::fromAccessor(0, f);
- pd.writable = PropertyDescriptor::Set;
- pd.configurable = PropertyDescriptor::Set;
- pd.enumberable = PropertyDescriptor::Set;
+ pd.writable = PropertyDescriptor::Enabled;
+ pd.configurable = PropertyDescriptor::Enabled;
+ pd.enumberable = PropertyDescriptor::Enabled;
o->__defineOwnProperty__(ctx, prop, &pd);
return Value::undefinedValue();
}
@@ -895,11 +895,11 @@ void ObjectPrototype::toPropertyDescriptor(ExecutionContext *ctx, Value v, Prope
desc->enumberable = PropertyDescriptor::Undefined;
if (o->__hasProperty__(ctx, ctx->engine->id_enumerable))
- desc->enumberable = __qmljs_to_boolean(o->__get__(ctx, ctx->engine->id_enumerable), ctx) ? PropertyDescriptor::Set : PropertyDescriptor::Unset;
+ desc->enumberable = __qmljs_to_boolean(o->__get__(ctx, ctx->engine->id_enumerable), ctx) ? PropertyDescriptor::Enabled : PropertyDescriptor::Disabled;
desc->configurable = PropertyDescriptor::Undefined;
if (o->__hasProperty__(ctx, ctx->engine->id_configurable))
- desc->configurable = __qmljs_to_boolean(o->__get__(ctx, ctx->engine->id_configurable), ctx) ? PropertyDescriptor::Set : PropertyDescriptor::Unset;
+ desc->configurable = __qmljs_to_boolean(o->__get__(ctx, ctx->engine->id_configurable), ctx) ? PropertyDescriptor::Enabled : PropertyDescriptor::Disabled;
desc->get = 0;
if (o->__hasProperty__(ctx, ctx->engine->id_get)) {
@@ -933,7 +933,7 @@ void ObjectPrototype::toPropertyDescriptor(ExecutionContext *ctx, Value v, Prope
if (o->__hasProperty__(ctx, ctx->engine->id_writable)) {
if (desc->isAccessor())
__qmljs_throw_type_error(ctx);
- desc->writable = __qmljs_to_boolean(o->__get__(ctx, ctx->engine->id_writable), ctx) ? PropertyDescriptor::Set : PropertyDescriptor::Unset;
+ desc->writable = __qmljs_to_boolean(o->__get__(ctx, ctx->engine->id_writable), ctx) ? PropertyDescriptor::Enabled : PropertyDescriptor::Disabled;
// writable forces it to be a data descriptor
desc->type = PropertyDescriptor::Data;
desc->value = Value::undefinedValue();
@@ -960,14 +960,14 @@ Value ObjectPrototype::fromPropertyDescriptor(ExecutionContext *ctx, const Prope
PropertyDescriptor pd;
pd.type = PropertyDescriptor::Data;
- pd.writable = PropertyDescriptor::Set;
- pd.enumberable = PropertyDescriptor::Set;
- pd.configurable = PropertyDescriptor::Set;
+ pd.writable = PropertyDescriptor::Enabled;
+ pd.enumberable = PropertyDescriptor::Enabled;
+ pd.configurable = PropertyDescriptor::Enabled;
if (desc->isData()) {
pd.value = desc->value;
o->__defineOwnProperty__(ctx, engine->identifier(QStringLiteral("value")), &pd);
- pd.value = Value::fromBoolean(desc->writable == PropertyDescriptor::Set ? true : false);
+ pd.value = Value::fromBoolean(desc->writable == PropertyDescriptor::Enabled ? true : false);
o->__defineOwnProperty__(ctx, engine->identifier(QStringLiteral("writable")), &pd);
} else {
pd.value = desc->get ? Value::fromObject(desc->get) : Value::undefinedValue();
@@ -975,9 +975,9 @@ Value ObjectPrototype::fromPropertyDescriptor(ExecutionContext *ctx, const Prope
pd.value = desc->set ? Value::fromObject(desc->set) : Value::undefinedValue();
o->__defineOwnProperty__(ctx, engine->identifier(QStringLiteral("set")), &pd);
}
- pd.value = Value::fromBoolean(desc->enumberable == PropertyDescriptor::Set ? true : false);
+ pd.value = Value::fromBoolean(desc->enumberable == PropertyDescriptor::Enabled ? true : false);
o->__defineOwnProperty__(ctx, engine->identifier(QStringLiteral("enumerable")), &pd);
- pd.value = Value::fromBoolean(desc->configurable == PropertyDescriptor::Set ? true : false);
+ pd.value = Value::fromBoolean(desc->configurable == PropertyDescriptor::Enabled ? true : false);
o->__defineOwnProperty__(ctx, engine->identifier(QStringLiteral("configurable")), &pd);
return Value::fromObject(o);