aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorLars Knoll <lars.knoll@digia.com>2013-04-09 15:33:26 +0200
committerSimon Hausmann <simon.hausmann@digia.com>2013-04-12 14:32:36 +0200
commit9bd0895c277150aa51ee0ce55ce492c41346b18e (patch)
treebfeb84f0f750df4183937342ae7e9006e75a471c
parentf6d5079a44ca0dcb02cdc9c7adf9d3ab71df232d (diff)
Small fix to PropertyAttributes
Change-Id: I9fc8b291c434dc6552eba2a39623a4fe75291e0f Reviewed-by: Simon Hausmann <simon.hausmann@digia.com>
-rw-r--r--src/v4/qv4global.h6
-rw-r--r--src/v4/qv4object.cpp6
2 files changed, 7 insertions, 5 deletions
diff --git a/src/v4/qv4global.h b/src/v4/qv4global.h
index 0e0a4f0f26..928664de0a 100644
--- a/src/v4/qv4global.h
+++ b/src/v4/qv4global.h
@@ -102,13 +102,15 @@ struct PropertyAttributes
PropertyAttributes() : m_all(0) {}
PropertyAttributes(PropertyFlag f) : m_all(0) {
setType(f & Attr_Accessor ? Accessor : Data);
- setWritable(!(f & Attr_NotWritable));
+ if (!(f & Attr_Accessor))
+ setWritable(!(f & Attr_NotWritable));
setEnumerable(!(f & Attr_NotEnumerable));
setConfigurable(!(f & Attr_NotConfigurable));
}
PropertyAttributes(PropertyFlags f) : m_all(0) {
setType(f & Attr_Accessor ? Accessor : Data);
- setWritable(!(f & Attr_NotWritable));
+ if (!(f & Attr_Accessor))
+ setWritable(!(f & Attr_NotWritable));
setEnumerable(!(f & Attr_NotEnumerable));
setConfigurable(!(f & Attr_NotConfigurable));
}
diff --git a/src/v4/qv4object.cpp b/src/v4/qv4object.cpp
index 68f7c9ac0e..105af27517 100644
--- a/src/v4/qv4object.cpp
+++ b/src/v4/qv4object.cpp
@@ -192,7 +192,7 @@ void Object::inplaceBinOp(ExecutionContext *ctx, BinOp op, const Value &index, c
void Object::defineDefaultProperty(String *name, Value value)
{
- PropertyDescriptor *pd = insertMember(name, Attr_Data);
+ PropertyDescriptor *pd = insertMember(name, Attr_Data|Attr_NotEnumerable);
pd->attrs = Attr_Data|Attr_NotEnumerable;
pd->value = value;
}
@@ -658,8 +658,8 @@ bool Object::__defineOwnProperty__(ExecutionContext *ctx, String *name, const Pr
ctx->throwRangeError(desc->value);
succeeded = setArrayLength(l);
}
- if (desc->attrs.hasWritable())
- lp->attrs.setWritable(desc->attrs.isWritable());
+ if (desc->attrs.hasWritable() && !desc->attrs.isWritable())
+ lp->attrs.setWritable(false);
if (!succeeded)
goto reject;
return true;