aboutsummaryrefslogtreecommitdiffstats
path: root/src/qml/jsruntime/qv4runtime.cpp
diff options
context:
space:
mode:
authorLars Knoll <lars.knoll@qt.io>2018-05-30 14:55:34 +0200
committerLars Knoll <lars.knoll@qt.io>2018-06-04 13:02:28 +0000
commit502678a183e68a837a5b2ddee2978a3be5e9e008 (patch)
treeacfd88d08ce3c9f3dc1f6867d136e0dcd14fdee0 /src/qml/jsruntime/qv4runtime.cpp
parent9a0a074452c6534f25a878047398eea77a8c7e0e (diff)
Implement ToPropertyKey() from the ES7 spec
and use it where required. Change-Id: I309ca61e0360b26428fc2ea5a2eea47c8e0632a0 Reviewed-by: Simon Hausmann <simon.hausmann@qt.io>
Diffstat (limited to 'src/qml/jsruntime/qv4runtime.cpp')
-rw-r--r--src/qml/jsruntime/qv4runtime.cpp14
1 files changed, 9 insertions, 5 deletions
diff --git a/src/qml/jsruntime/qv4runtime.cpp b/src/qml/jsruntime/qv4runtime.cpp
index 477ecb37e9..b712b40897 100644
--- a/src/qml/jsruntime/qv4runtime.cpp
+++ b/src/qml/jsruntime/qv4runtime.cpp
@@ -331,7 +331,9 @@ bool Runtime::method_deleteElement(ExecutionEngine *engine, const Value &base, c
return o->deleteIndexedProperty(n);
}
- ScopedStringOrSymbol name(scope, index.toStringOrSymbol(engine));
+ ScopedStringOrSymbol name(scope, index.toPropertyKey(engine));
+ if (engine->hasException)
+ return false;
return method_deleteMemberString(engine, base, name);
}
@@ -383,7 +385,7 @@ QV4::ReturnedValue Runtime::method_in(ExecutionEngine *engine, const Value &left
if (!ro)
return engine->throwTypeError();
Scope scope(engine);
- ScopedStringOrSymbol s(scope, left.toStringOrSymbol(engine));
+ ScopedStringOrSymbol s(scope, left.toPropertyKey(engine));
if (scope.hasException())
return Encode::undefined();
bool r = ro->hasProperty(s);
@@ -647,7 +649,7 @@ static Q_NEVER_INLINE ReturnedValue getElementFallback(ExecutionEngine *engine,
Q_ASSERT(!!o); // can't fail as null/undefined is covered above
}
- ScopedStringOrSymbol name(scope, index.toStringOrSymbol(engine));
+ ScopedStringOrSymbol name(scope, index.toPropertyKey(engine));
if (scope.hasException())
return Encode::undefined();
return o->get(name);
@@ -701,7 +703,9 @@ static Q_NEVER_INLINE bool setElementFallback(ExecutionEngine *engine, const Val
return o->putIndexed(idx, value);
}
- ScopedStringOrSymbol name(scope, index.toStringOrSymbol(engine));
+ ScopedStringOrSymbol name(scope, index.toPropertyKey(engine));
+ if (engine->hasException)
+ return false;
return o->put(name, value);
}
@@ -1213,7 +1217,7 @@ ReturnedValue Runtime::method_callElement(ExecutionEngine *engine, Value *base,
ScopedValue thisObject(scope, base->toObject(engine));
base = thisObject;
- ScopedStringOrSymbol str(scope, index.toStringOrSymbol(engine));
+ ScopedStringOrSymbol str(scope, index.toPropertyKey(engine));
if (engine->hasException)
return Encode::undefined();