aboutsummaryrefslogtreecommitdiffstats
path: root/src/qml/jsruntime/qv4value.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/qml/jsruntime/qv4value.cpp')
-rw-r--r--src/qml/jsruntime/qv4value.cpp11
1 files changed, 11 insertions, 0 deletions
diff --git a/src/qml/jsruntime/qv4value.cpp b/src/qml/jsruntime/qv4value.cpp
index be406db325..9febd41a00 100644
--- a/src/qml/jsruntime/qv4value.cpp
+++ b/src/qml/jsruntime/qv4value.cpp
@@ -228,6 +228,17 @@ QString Value::toQString() const
}
} // switch
}
+
+Heap::StringOrSymbol *Value::toPropertyKey(ExecutionEngine *e) const
+{
+ Scope scope(e);
+ ScopedValue v(scope, RuntimeHelpers::toPrimitive(*this, STRING_HINT));
+ if (!v->isStringOrSymbol())
+ v = v->toString(e);
+ if (e->hasException)
+ return nullptr;
+ return static_cast<Heap::StringOrSymbol *>(v->m());
+}
#endif // V4_BOOTSTRAP
bool Value::sameValue(Value other) const {