diff options
author | Lars Knoll <lars.knoll@qt.io> | 2018-04-03 15:23:07 +0200 |
---|---|---|
committer | Lars Knoll <lars.knoll@qt.io> | 2018-05-02 14:18:36 +0000 |
commit | bab5e5adf578fb37402ff03f4bd5e9ed3ce4c2d2 (patch) | |
tree | 1bbc320c5594faf5d2156385088c12222b9542b8 /src/qml/jsruntime/qv4objectproto.cpp | |
parent | a6da23bb5f6004e13d22838c7db1246169874930 (diff) |
Partial Symbol support
Added basic infrastructure to create symbols and convert them
back to strings. In addition, storing and retrieving of symbol
based properties in Objects works.
Change-Id: I185f7aa46e7afa19db5a801102142892e03b7bf1
Reviewed-by: Simon Hausmann <simon.hausmann@qt.io>
Diffstat (limited to 'src/qml/jsruntime/qv4objectproto.cpp')
-rw-r--r-- | src/qml/jsruntime/qv4objectproto.cpp | 10 |
1 files changed, 7 insertions, 3 deletions
diff --git a/src/qml/jsruntime/qv4objectproto.cpp b/src/qml/jsruntime/qv4objectproto.cpp index 451566137c..94917a45f6 100644 --- a/src/qml/jsruntime/qv4objectproto.cpp +++ b/src/qml/jsruntime/qv4objectproto.cpp @@ -484,10 +484,14 @@ ReturnedValue ObjectPrototype::method_toString(const FunctionObject *b, const Va return Encode(v4->newString(QStringLiteral("[object Undefined]"))); } else if (thisObject->isNull()) { return Encode(v4->newString(QStringLiteral("[object Null]"))); + } else if (thisObject->isBoolean()) { + return Encode(v4->newString(QStringLiteral("[object Boolean]"))); + } else if (thisObject->isNumber()) { + return Encode(v4->newString(QStringLiteral("[object Number]"))); } else { - Scope scope(v4); - ScopedObject obj(scope, thisObject->toObject(scope.engine)); - QString className = obj->className(); + Q_ASSERT(thisObject->isManaged()); + const Managed *m = static_cast<const Managed *>(thisObject); + QString className = m->className(); return Encode(v4->newString(QStringLiteral("[object %1]").arg(className))); } } |