QmlJSStaticAnalysis: make PrototypeMessageData public

We need this in the rewriter to avoid warning.

Change-Id: Ia99583e080eed936d98517ce553294d3040f8cee
Reviewed-by: Fawzi Mohamed <fawzi.mohamed@digia.com>
This commit is contained in:
Thomas Hartmann
2013-04-10 14:38:08 +02:00
parent 7b94ac13ed
commit 86ae825033
2 changed files with 19 additions and 9 deletions

View File

@@ -43,14 +43,6 @@ class StaticAnalysisMessages
Q_DECLARE_TR_FUNCTIONS(QmlJS::StaticAnalysisMessages) Q_DECLARE_TR_FUNCTIONS(QmlJS::StaticAnalysisMessages)
public: public:
class PrototypeMessageData {
public:
Type type;
Severity severity;
QString message;
int placeholders;
};
void newMsg(Type type, Severity severity, const QString &message, int placeholders = 0) void newMsg(Type type, Severity severity, const QString &message, int placeholders = 0)
{ {
PrototypeMessageData prototype; PrototypeMessageData prototype;
@@ -248,7 +240,7 @@ Message::Message(Type type,
: location(location), type(type) : location(location), type(type)
{ {
QTC_ASSERT(messages()->messages.contains(type), return); QTC_ASSERT(messages()->messages.contains(type), return);
const StaticAnalysisMessages::PrototypeMessageData &prototype = messages()->messages.value(type); const PrototypeMessageData &prototype = prototypeForMessageType(type);
severity = prototype.severity; severity = prototype.severity;
message = prototype.message; message = prototype.message;
if (prototype.placeholders == 0) { if (prototype.placeholders == 0) {
@@ -299,3 +291,11 @@ QRegExp Message::suppressionPattern()
{ {
return QRegExp(QLatin1String("@disable-check M(\\d+)")); return QRegExp(QLatin1String("@disable-check M(\\d+)"));
} }
const PrototypeMessageData Message::prototypeForMessageType(Type type)
{
QTC_CHECK(messages()->messages.contains(type));
const PrototypeMessageData &prototype = messages()->messages.value(type);
return prototype;
}

View File

@@ -131,6 +131,14 @@ enum Type
ErrInvalidArrayValueLength = 323 ErrInvalidArrayValueLength = 323
}; };
class QMLJS_EXPORT PrototypeMessageData {
public:
Type type;
Severity severity;
QString message;
int placeholders;
};
class QMLJS_EXPORT Message class QMLJS_EXPORT Message
{ {
public: public:
@@ -152,6 +160,8 @@ public:
QString message; QString message;
Type type; Type type;
Severity severity; Severity severity;
static const PrototypeMessageData prototypeForMessageType(Type type);
}; };
} // namespace StaticAnalysis } // namespace StaticAnalysis