aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorLars Knoll <lars.knoll@digia.com>2013-04-12 14:36:41 +0200
committerSimon Hausmann <simon.hausmann@digia.com>2013-04-12 15:26:46 +0200
commitb85758207a906f2b0dfc1cbb7f66878bf53f86e8 (patch)
tree684446c4340d0736979c699f39f44057e9796ec8 /src
parentd0af8986b32aa4cccdc2ff7d8dc5e66e9d53ed77 (diff)
Simplify logic for put and putIndexed
Change-Id: Ia67dc06f505fdb064a22920a9786708aa6d83e6e Reviewed-by: Simon Hausmann <simon.hausmann@digia.com>
Diffstat (limited to 'src')
-rw-r--r--src/v4/qv4object.cpp47
1 files changed, 14 insertions, 33 deletions
diff --git a/src/v4/qv4object.cpp b/src/v4/qv4object.cpp
index 45ce45e595..0937a98cf6 100644
--- a/src/v4/qv4object.cpp
+++ b/src/v4/qv4object.cpp
@@ -510,31 +510,21 @@ void Object::internalPut(ExecutionContext *ctx, String *name, const Value &value
if (!extensible)
goto reject;
} else {
- PropertyAttributes attrs;
- if (Property *p = prototype->__getPropertyDescriptor__(ctx, name, &attrs)) {
+ // clause 4
+ if ((pd = prototype->__getPropertyDescriptor__(ctx, name, &attrs))) {
if (attrs.isAccessor()) {
- if (p->setter())
- goto cont;
+ if (!pd->setter())
+ goto reject;
+ } else if (!extensible || !attrs.isWritable()) {
goto reject;
}
- if (!extensible)
- goto reject;
- if (!attrs.isWritable())
- goto reject;
- } else {
- if (!extensible)
- goto reject;
+ } else if (!extensible) {
+ goto reject;
}
}
cont:
-
- // clause 4
- // ### should be able to remove these two lines (see call 15 lines above)
- if (!pd && prototype)
- pd = prototype->__getPropertyDescriptor__(ctx, name, &attrs);
-
// Clause 5
if (pd && attrs.isAccessor()) {
assert(pd->setter() != 0);
@@ -593,30 +583,21 @@ void Object::internalPutIndexed(ExecutionContext *ctx, uint index, const Value &
if (!extensible)
goto reject;
} else {
- PropertyAttributes attrs;
- if (Property *p = prototype->__getPropertyDescriptor__(ctx, index, &attrs)) {
+ // clause 4
+ if ((pd = prototype->__getPropertyDescriptor__(ctx, index, &attrs))) {
if (attrs.isAccessor()) {
- if (p->setter())
- goto cont;
+ if (!pd->setter())
+ goto reject;
+ } else if (!extensible || !attrs.isWritable()) {
goto reject;
}
- if (!extensible)
- goto reject;
- if (!attrs.isWritable())
- goto reject;
- } else {
- if (!extensible)
- goto reject;
+ } else if (!extensible) {
+ goto reject;
}
}
cont:
- // clause 4
- // ### remove and replace with 15 lines above...
- if (!pd && prototype)
- pd = prototype->__getPropertyDescriptor__(ctx, index, &attrs);
-
// Clause 5
if (pd && attrs.isAccessor()) {
assert(pd->setter() != 0);