diff options
author | Lars Knoll <[email protected]> | 2018-06-23 23:07:23 +0200 |
---|---|---|
committer | Lars Knoll <[email protected]> | 2018-07-02 19:29:43 +0000 |
commit | 56bff8f7abc2f0eeadd4d197667132af6eed6f3a (patch) | |
tree | 13990d34f9239e1845dedaa452bc1093f38b027a /src/qml/jsruntime/qv4jsonobject.cpp | |
parent | 86f88521fbea59e8ec53e50cc1e3e68a61f53c40 (diff) |
Clean up the property key API in StringOrSymbol
Get rid of makeIdentifier(), as toPropertyKey() will take
care of it.
Rename identifier() to propertyKey() and check that the
key is valid.
Remove String/StringOrSymbol::asArrayIndex(), we don't need it
anymore.
Change-Id: I3c490fabc1475c9ea288b49b1638b6fa1bc237b7
Reviewed-by: Simon Hausmann <[email protected]>
Diffstat (limited to 'src/qml/jsruntime/qv4jsonobject.cpp')
-rw-r--r-- | src/qml/jsruntime/qv4jsonobject.cpp | 9 |
1 files changed, 5 insertions, 4 deletions
diff --git a/src/qml/jsruntime/qv4jsonobject.cpp b/src/qml/jsruntime/qv4jsonobject.cpp index 58c17b54cc..2e2314cafe 100644 --- a/src/qml/jsruntime/qv4jsonobject.cpp +++ b/src/qml/jsruntime/qv4jsonobject.cpp @@ -261,11 +261,12 @@ bool JsonParser::parseMember(Object *o) if (!parseValue(val)) return false; - ScopedString s(scope, engine->newIdentifier(key)); - uint idx = s->asArrayIndex(); - if (idx < UINT_MAX) { - o->put(idx, val); + ScopedString s(scope, engine->newString(key)); + PropertyKey skey = s->toPropertyKey(); + if (skey.isArrayIndex()) { + o->put(skey.asArrayIndex(), val); } else { + // avoid trouble with properties named __proto__ o->insertMember(s, val); } |