aboutsummaryrefslogtreecommitdiffstats
path: root/src/qml/jsruntime/qv4runtime.cpp
diff options
context:
space:
mode:
authorLars Knoll <lars.knoll@qt.io>2018-04-08 16:43:10 +0200
committerLars Knoll <lars.knoll@qt.io>2018-05-02 14:18:45 +0000
commit37b85ca10eef7236dbea0decd265c40fa8d0caf1 (patch)
treeed3343cd350dff8aa3be1d471c745775ae523855 /src/qml/jsruntime/qv4runtime.cpp
parent360a48aa3f5346aa7aaff741e4ef8f5dc8701f51 (diff)
Add SymbolObject, well known symbols and fix most remaining issues
Added SymbolObject, the equivalent to StringObject which was still missing so far. Added the predefined standard symbols, and fixed most test failures related to symbols. Change-Id: I1e28b439e7c4f5141b4a09bd8fb666c60691f192 Reviewed-by: Simon Hausmann <simon.hausmann@qt.io>
Diffstat (limited to 'src/qml/jsruntime/qv4runtime.cpp')
-rw-r--r--src/qml/jsruntime/qv4runtime.cpp9
1 files changed, 4 insertions, 5 deletions
diff --git a/src/qml/jsruntime/qv4runtime.cpp b/src/qml/jsruntime/qv4runtime.cpp
index 18e5f29c09..1237edcdc6 100644
--- a/src/qml/jsruntime/qv4runtime.cpp
+++ b/src/qml/jsruntime/qv4runtime.cpp
@@ -327,7 +327,7 @@ bool Runtime::method_deleteElement(ExecutionEngine *engine, const Value &base, c
return o->deleteIndexedProperty(n);
}
- ScopedString name(scope, index.toString(engine));
+ ScopedStringOrSymbol name(scope, index.toStringOrSymbol(engine));
return method_deleteMemberString(engine, base, name);
}
@@ -338,7 +338,7 @@ bool Runtime::method_deleteMember(ExecutionEngine *engine, const Value &base, in
return method_deleteMemberString(engine, base, name);
}
-bool Runtime::method_deleteMemberString(ExecutionEngine *engine, const Value &base, String *name)
+bool Runtime::method_deleteMemberString(ExecutionEngine *engine, const Value &base, StringOrSymbol *name)
{
Scope scope(engine);
ScopedObject obj(scope, base.toObject(engine));
@@ -371,7 +371,7 @@ QV4::ReturnedValue Runtime::method_in(ExecutionEngine *engine, const Value &left
if (!ro)
return engine->throwTypeError();
Scope scope(engine);
- ScopedString s(scope, left.toString(engine));
+ ScopedStringOrSymbol s(scope, left.toStringOrSymbol(engine));
if (scope.hasException())
return Encode::undefined();
bool r = ro->hasProperty(s);
@@ -463,8 +463,7 @@ Heap::Object *RuntimeHelpers::convertToObject(ExecutionEngine *engine, const Val
case Value::Managed_Type:
Q_ASSERT(value.isStringOrSymbol());
if (!value.isString())
- // ### this is a symbol, which is an immutable object according to spec
- return nullptr;
+ return engine->newSymbolObject(value.symbolValue());
return engine->newStringObject(value.stringValue());
case Value::Integer_Type:
default: // double