| 77 | } |
| 78 | |
| 79 | QString JSRepl::stringify(const QJSValue &value) |
| 80 | { |
| 81 | if (value.isArray()) { |
| 82 | QStringList items; |
| 83 | const int length = value.property("length").toInt(); |
| 84 | for (int i = 0; i < length; ++i) { |
| 85 | QJSValue v = value.property(i); |
| 86 | if (v.isArray()) { |
| 87 | items << QString("Array(%1)").arg(v.property("length").toInt()); |
| 88 | } else { |
| 89 | items << stringify(v); |
| 90 | } |
| 91 | } |
| 92 | return QString("(%1) [%2]").arg( |
| 93 | QString::number(length), items.join(", ")); |
| 94 | } else if (value.isString()) { |
| 95 | return "'" + value.toString() + "'"; |
| 96 | } else { |
| 97 | return value.toString(); |
| 98 | } |
| 99 | } |
| 100 | |
| 101 | void JSRepl::printResult(const QJSValue &value) |
| 102 | { |
no test coverage detected