Absolute File Name: | /home/opencoverage/opencoverage/guest-scripts/qtdeclarative/src/qtdeclarative/src/qml/qml/qqmlcustomparser.cpp |
Switch to Source code | Preprocessed file |
Line | Source | Count | ||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
1 | - | |||||||||||||
2 | - | |||||||||||||
3 | - | |||||||||||||
4 | - | |||||||||||||
5 | void QQmlCustomParser::clearErrors() | - | ||||||||||||
6 | { | - | ||||||||||||
7 | exceptions.clear(); | - | ||||||||||||
8 | } executed 926 times by 30 tests: end of block Executed by:
| 926 | ||||||||||||
9 | - | |||||||||||||
10 | - | |||||||||||||
11 | - | |||||||||||||
12 | - | |||||||||||||
13 | - | |||||||||||||
14 | - | |||||||||||||
15 | void QQmlCustomParser::error(const QV4::CompiledData::Location &location, const QString &description) | - | ||||||||||||
16 | { | - | ||||||||||||
17 | exceptions << QQmlCompileError(location, description); | - | ||||||||||||
18 | } executed 28 times by 3 tests: end of block Executed by:
| 28 | ||||||||||||
19 | - | |||||||||||||
20 | struct StaticQtMetaObject : public QObject | - | ||||||||||||
21 | { | - | ||||||||||||
22 | static const QMetaObject *get() | - | ||||||||||||
23 | { return executed 4 times by 1 test: &staticQtMetaObject;return &staticQtMetaObject; Executed by:
executed 4 times by 1 test: }return &staticQtMetaObject; Executed by:
| 4 | ||||||||||||
24 | }; | - | ||||||||||||
25 | int QQmlCustomParser::evaluateEnum(const QByteArray& script, bool *ok) const | - | ||||||||||||
26 | { | - | ||||||||||||
27 | ((ok) ? static_cast<void>(0) : qt_assert_x("QQmlCustomParser::evaluateEnum", "ok must not be a null pointer", __FILE__, 122)); | - | ||||||||||||
28 | *ok = false; | - | ||||||||||||
29 | - | |||||||||||||
30 | - | |||||||||||||
31 | - | |||||||||||||
32 | - | |||||||||||||
33 | - | |||||||||||||
34 | int dot = script.indexOf('.'); | - | ||||||||||||
35 | if (dot == -1
| 0-182 | ||||||||||||
36 | return executed 6 times by 1 test: -1;return -1; Executed by:
executed 6 times by 1 test: return -1; Executed by:
| 6 | ||||||||||||
37 | - | |||||||||||||
38 | QString scope = QString::fromUtf8(script.left(dot)); | - | ||||||||||||
39 | - | |||||||||||||
40 | if (scope != QLatin1String("Qt")
| 4-178 | ||||||||||||
41 | if (imports.isNull()
| 0-178 | ||||||||||||
42 | return never executed: -1;return -1; never executed: return -1; | 0 | ||||||||||||
43 | QQmlType type; | - | ||||||||||||
44 | - | |||||||||||||
45 | if (imports.isT1()
| 88-90 | ||||||||||||
46 | imports.asT1()->resolveType(scope, &type, nullptr, nullptr, nullptr); | - | ||||||||||||
47 | } executed 90 times by 2 tests: else {end of block Executed by:
| 90 | ||||||||||||
48 | QQmlTypeNameCache::Result result = imports.asT2()->query(scope); | - | ||||||||||||
49 | if (result.isValid()
| 0-88 | ||||||||||||
50 | type = result.type; executed 88 times by 2 tests: type = result.type; Executed by:
| 88 | ||||||||||||
51 | } executed 88 times by 2 tests: end of block Executed by:
| 88 | ||||||||||||
52 | - | |||||||||||||
53 | if (!type.isValid()
| 2-176 | ||||||||||||
54 | return executed 2 times by 1 test: -1;return -1; Executed by:
executed 2 times by 1 test: return -1; Executed by:
| 2 | ||||||||||||
55 | - | |||||||||||||
56 | int dot2 = script.indexOf('.', dot+1); | - | ||||||||||||
57 | const bool dot2Valid = dot2 != -1
| 0-176 | ||||||||||||
58 | QByteArray enumValue = script.mid(dot2Valid ? dot2 + 1 : dot + 1); | - | ||||||||||||
59 | QByteArray scopedEnumName = (dot2Valid
| 0-176 | ||||||||||||
60 | if (!scopedEnumName.isEmpty()
| 0-176 | ||||||||||||
61 | return never executed: type.scopedEnumValue(engine, scopedEnumName, enumValue, ok);return type.scopedEnumValue(engine, scopedEnumName, enumValue, ok); never executed: return type.scopedEnumValue(engine, scopedEnumName, enumValue, ok); | 0 | ||||||||||||
62 | else | - | ||||||||||||
63 | return executed 176 times by 2 tests: type.enumValue(engine, QHashedCStringRef(enumValue.constData(), enumValue.length()), ok);return type.enumValue(engine, QHashedCStringRef(enumValue.constData(), enumValue.length()), ok); Executed by:
executed 176 times by 2 tests: return type.enumValue(engine, QHashedCStringRef(enumValue.constData(), enumValue.length()), ok); Executed by:
| 176 | ||||||||||||
64 | } | - | ||||||||||||
65 | - | |||||||||||||
66 | QByteArray enumValue = script.mid(dot + 1); | - | ||||||||||||
67 | const QMetaObject *mo = StaticQtMetaObject::get(); | - | ||||||||||||
68 | int i = mo->enumeratorCount(); | - | ||||||||||||
69 | while (i--
| 0-296 | ||||||||||||
70 | int v = mo->enumerator(i).keyToValue(enumValue.constData(), ok); | - | ||||||||||||
71 | if (*
| 4-292 | ||||||||||||
72 | return executed 4 times by 1 test: v;return v; Executed by:
executed 4 times by 1 test: return v; Executed by:
| 4 | ||||||||||||
73 | } executed 292 times by 1 test: end of block Executed by:
| 292 | ||||||||||||
74 | return never executed: -1;return -1; never executed: return -1; | 0 | ||||||||||||
75 | } | - | ||||||||||||
76 | - | |||||||||||||
77 | - | |||||||||||||
78 | - | |||||||||||||
79 | - | |||||||||||||
80 | - | |||||||||||||
81 | const QMetaObject *QQmlCustomParser::resolveType(const QString& name) const | - | ||||||||||||
82 | { | - | ||||||||||||
83 | if (!imports.isT1()
| 0-388 | ||||||||||||
84 | return never executed: nullptr;return nullptr; never executed: return nullptr; | 0 | ||||||||||||
85 | QQmlType qmltype; | - | ||||||||||||
86 | if (!imports.asT1()->resolveType(name, &qmltype, nullptr, nullptr, nullptr)
| 0-388 | ||||||||||||
87 | return never executed: nullptr;return nullptr; never executed: return nullptr; | 0 | ||||||||||||
88 | return executed 388 times by 14 tests: qmltype.metaObject();return qmltype.metaObject(); Executed by:
executed 388 times by 14 tests: return qmltype.metaObject(); Executed by:
| 388 | ||||||||||||
89 | } | - | ||||||||||||
90 | - | |||||||||||||
91 | - | |||||||||||||
Switch to Source code | Preprocessed file |