forked from qt-creator/qt-creator
qmljs: switch to the new category logging
Change-Id: Id4e43779590939e9d6dd2d0dab536f70e721f097 Reviewed-by: Kai Koehne <kai.koehne@digia.com>
This commit is contained in:
committed by
Kai Koehne
parent
b204c4dba2
commit
4dc438db5e
@@ -33,8 +33,6 @@
|
|||||||
#include "qmljsdocument.h"
|
#include "qmljsdocument.h"
|
||||||
#include "qmljsmodelmanagerinterface.h"
|
#include "qmljsmodelmanagerinterface.h"
|
||||||
|
|
||||||
#include <QDebug>
|
|
||||||
|
|
||||||
using namespace LanguageUtils;
|
using namespace LanguageUtils;
|
||||||
using namespace QmlJS;
|
using namespace QmlJS;
|
||||||
using namespace QmlJS::AST;
|
using namespace QmlJS::AST;
|
||||||
|
@@ -35,7 +35,6 @@
|
|||||||
|
|
||||||
#include <utils/qtcassert.h>
|
#include <utils/qtcassert.h>
|
||||||
|
|
||||||
#include <QDebug>
|
|
||||||
#include <QDir>
|
#include <QDir>
|
||||||
|
|
||||||
using namespace QmlJS;
|
using namespace QmlJS;
|
||||||
|
@@ -29,12 +29,15 @@
|
|||||||
|
|
||||||
#include "qmljscodeformatter.h"
|
#include "qmljscodeformatter.h"
|
||||||
|
|
||||||
#include <QDebug>
|
#include <utils/logging.h>
|
||||||
|
|
||||||
#include <QMetaEnum>
|
#include <QMetaEnum>
|
||||||
#include <QTextDocument>
|
#include <QTextDocument>
|
||||||
#include <QTextBlock>
|
#include <QTextBlock>
|
||||||
|
|
||||||
using namespace QmlJS;
|
namespace QmlJS {
|
||||||
|
|
||||||
|
Q_LOGGING_CATEGORY(formatterLog, "qtc.qmljs.formatter")
|
||||||
|
|
||||||
CodeFormatter::BlockData::BlockData()
|
CodeFormatter::BlockData::BlockData()
|
||||||
: m_indentDepth(0)
|
: m_indentDepth(0)
|
||||||
@@ -65,13 +68,13 @@ void CodeFormatter::recalculateStateAfter(const QTextBlock &block)
|
|||||||
m_tokenIndex = 0;
|
m_tokenIndex = 0;
|
||||||
m_newStates.clear();
|
m_newStates.clear();
|
||||||
|
|
||||||
//qDebug() << "Starting to look at " << block.text() << block.blockNumber() + 1;
|
//qCDebug(formatterLog) << "Starting to look at " << block.text() << block.blockNumber() + 1;
|
||||||
|
|
||||||
for (; m_tokenIndex < m_tokens.size(); ) {
|
for (; m_tokenIndex < m_tokens.size(); ) {
|
||||||
m_currentToken = tokenAt(m_tokenIndex);
|
m_currentToken = tokenAt(m_tokenIndex);
|
||||||
const int kind = extendedTokenKind(m_currentToken);
|
const int kind = extendedTokenKind(m_currentToken);
|
||||||
|
|
||||||
//qDebug() << "Token" << m_currentLine.mid(m_currentToken.begin(), m_currentToken.length) << m_tokenIndex << "in line" << block.blockNumber() + 1;
|
//qCDebug(formatterLog) << "Token" << m_currentLine.mid(m_currentToken.begin(), m_currentToken.length) << m_tokenIndex << "in line" << block.blockNumber() + 1;
|
||||||
//dump();
|
//dump();
|
||||||
|
|
||||||
if (kind == Comment
|
if (kind == Comment
|
||||||
@@ -520,7 +523,7 @@ void CodeFormatter::recalculateStateAfter(const QTextBlock &block)
|
|||||||
|
|
||||||
int CodeFormatter::indentFor(const QTextBlock &block)
|
int CodeFormatter::indentFor(const QTextBlock &block)
|
||||||
{
|
{
|
||||||
// qDebug() << "indenting for" << block.blockNumber() + 1;
|
// qCDebug(formatterLog) << "indenting for" << block.blockNumber() + 1;
|
||||||
|
|
||||||
restoreCurrentState(block.previous());
|
restoreCurrentState(block.previous());
|
||||||
correctIndentation(block);
|
correctIndentation(block);
|
||||||
@@ -641,7 +644,7 @@ void CodeFormatter::enter(int newState)
|
|||||||
m_currentState.push(s);
|
m_currentState.push(s);
|
||||||
m_newStates.push(s);
|
m_newStates.push(s);
|
||||||
|
|
||||||
//qDebug() << "enter state" << stateToString(newState);
|
//qCDebug(formatterLog) << "enter state" << stateToString(newState);
|
||||||
|
|
||||||
if (newState == bracket_open)
|
if (newState == bracket_open)
|
||||||
enter(bracket_element_start);
|
enter(bracket_element_start);
|
||||||
@@ -662,7 +665,7 @@ void CodeFormatter::leave(bool statementDone)
|
|||||||
|
|
||||||
int topState = m_currentState.top().type;
|
int topState = m_currentState.top().type;
|
||||||
|
|
||||||
//qDebug() << "left state" << stateToString(poppedState.type) << ", now in state" << stateToString(topState);
|
//qCDebug(formatterLog) << "left state" << stateToString(poppedState.type) << ", now in state" << stateToString(topState);
|
||||||
|
|
||||||
// if statement is done, may need to leave recursively
|
// if statement is done, may need to leave recursively
|
||||||
if (statementDone) {
|
if (statementDone) {
|
||||||
@@ -1003,12 +1006,12 @@ CodeFormatter::TokenKind CodeFormatter::extendedTokenKind(const QmlJS::Token &to
|
|||||||
|
|
||||||
void CodeFormatter::dump() const
|
void CodeFormatter::dump() const
|
||||||
{
|
{
|
||||||
qDebug() << "Current token index" << m_tokenIndex;
|
qCDebug(formatterLog) << "Current token index" << m_tokenIndex;
|
||||||
qDebug() << "Current state:";
|
qCDebug(formatterLog) << "Current state:";
|
||||||
foreach (const State &s, m_currentState) {
|
foreach (const State &s, m_currentState) {
|
||||||
qDebug() << stateToString(s.type) << s.savedIndentDepth;
|
qCDebug(formatterLog) << stateToString(s.type) << s.savedIndentDepth;
|
||||||
}
|
}
|
||||||
qDebug() << "Current indent depth:" << m_indentDepth;
|
qCDebug(formatterLog) << "Current indent depth:" << m_indentDepth;
|
||||||
}
|
}
|
||||||
|
|
||||||
QString CodeFormatter::stateToString(int type) const
|
QString CodeFormatter::stateToString(int type) const
|
||||||
@@ -1339,3 +1342,5 @@ void QtStyleCodeFormatter::adjustIndent(const QList<Token> &tokens, int startLex
|
|||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
} // namespace QmlJS
|
||||||
|
@@ -29,7 +29,6 @@
|
|||||||
|
|
||||||
#include "qmljscompletioncontextfinder.h"
|
#include "qmljscompletioncontextfinder.h"
|
||||||
|
|
||||||
#include <QDebug>
|
|
||||||
#include <QTextDocument>
|
#include <QTextDocument>
|
||||||
#include <QStringList>
|
#include <QStringList>
|
||||||
|
|
||||||
@@ -130,7 +129,7 @@ void CompletionContextFinder::checkBinding()
|
|||||||
{
|
{
|
||||||
YY_SAVE();
|
YY_SAVE();
|
||||||
|
|
||||||
//qDebug() << "Start line:" << *yyLine << m_startTokenIndex;
|
//qCDebug(qmljsLog) << "Start line:" << *yyLine << m_startTokenIndex;
|
||||||
|
|
||||||
int i = m_startTokenIndex;
|
int i = m_startTokenIndex;
|
||||||
int colonCount = 0;
|
int colonCount = 0;
|
||||||
|
@@ -29,6 +29,9 @@
|
|||||||
|
|
||||||
#ifndef QMLJSCONSTANTS_H
|
#ifndef QMLJSCONSTANTS_H
|
||||||
#define QMLJSCONSTANTS_H
|
#define QMLJSCONSTANTS_H
|
||||||
|
#include "qmljs_global.h"
|
||||||
|
|
||||||
|
#include <utils/logging.h>
|
||||||
|
|
||||||
namespace QmlJS {
|
namespace QmlJS {
|
||||||
|
|
||||||
@@ -87,5 +90,8 @@ const char TASK_INDEX[] = "QmlJSEditor.TaskIndex";
|
|||||||
const char TASK_IMPORT_SCAN[] = "QmlJSEditor.TaskImportScan";
|
const char TASK_IMPORT_SCAN[] = "QmlJSEditor.TaskImportScan";
|
||||||
|
|
||||||
} // namespace Constants
|
} // namespace Constants
|
||||||
|
|
||||||
|
QMLJS_EXPORT Q_DECLARE_LOGGING_CATEGORY(qmljsLog)
|
||||||
|
|
||||||
} // namespace QmlJS
|
} // namespace QmlJS
|
||||||
#endif // QMLJSCONSTANTS_H
|
#endif // QMLJSCONSTANTS_H
|
||||||
|
@@ -31,7 +31,6 @@
|
|||||||
#include "qmljscontext.h"
|
#include "qmljscontext.h"
|
||||||
#include "qmljsscopechain.h"
|
#include "qmljsscopechain.h"
|
||||||
#include "parser/qmljsast_p.h"
|
#include "parser/qmljsast_p.h"
|
||||||
#include <QDebug>
|
|
||||||
|
|
||||||
using namespace QmlJS;
|
using namespace QmlJS;
|
||||||
|
|
||||||
|
@@ -36,7 +36,6 @@
|
|||||||
#include <cplusplus/cppmodelmanagerbase.h>
|
#include <cplusplus/cppmodelmanagerbase.h>
|
||||||
#include <cplusplus/CppDocument.h>
|
#include <cplusplus/CppDocument.h>
|
||||||
|
|
||||||
#include <QDebug>
|
|
||||||
#include <QList>
|
#include <QList>
|
||||||
|
|
||||||
//using namespace QmlJS;
|
//using namespace QmlJS;
|
||||||
|
@@ -28,8 +28,10 @@
|
|||||||
****************************************************************************/
|
****************************************************************************/
|
||||||
|
|
||||||
#include "qmljsicons.h"
|
#include "qmljsicons.h"
|
||||||
|
|
||||||
|
#include <utils/logging.h>
|
||||||
|
|
||||||
#include <QIcon>
|
#include <QIcon>
|
||||||
#include <QDebug>
|
|
||||||
#include <QDir>
|
#include <QDir>
|
||||||
#include <QHash>
|
#include <QHash>
|
||||||
#include <QPair>
|
#include <QPair>
|
||||||
@@ -43,6 +45,8 @@ enum {
|
|||||||
|
|
||||||
namespace QmlJS {
|
namespace QmlJS {
|
||||||
|
|
||||||
|
Q_LOGGING_CATEGORY(iconsLog, "qtc.qmljs.icons")
|
||||||
|
|
||||||
Icons *Icons::m_instance = 0;
|
Icons *Icons::m_instance = 0;
|
||||||
|
|
||||||
class IconsPrivate
|
class IconsPrivate
|
||||||
@@ -88,22 +92,22 @@ void Icons::setIconFilesPath(const QString &iconPath)
|
|||||||
d->resourcePath = iconPath;
|
d->resourcePath = iconPath;
|
||||||
|
|
||||||
if (debug)
|
if (debug)
|
||||||
qDebug() << "QmlJSIcons -" << "parsing" << iconPath;
|
qCDebug(iconsLog) << "parsing" << iconPath;
|
||||||
QDir topDir(iconPath);
|
QDir topDir(iconPath);
|
||||||
foreach (const QFileInfo &subDirInfo, topDir.entryInfoList(QDir::Dirs | QDir::NoDotAndDotDot)) {
|
foreach (const QFileInfo &subDirInfo, topDir.entryInfoList(QDir::Dirs | QDir::NoDotAndDotDot)) {
|
||||||
if (debug)
|
if (debug)
|
||||||
qDebug() << "QmlJSIcons - parsing" << subDirInfo.absoluteFilePath();
|
qCDebug(iconsLog) << "parsing" << subDirInfo.absoluteFilePath();
|
||||||
const QString packageName = subDirInfo.fileName();
|
const QString packageName = subDirInfo.fileName();
|
||||||
QDir subDir(subDirInfo.absoluteFilePath() + QLatin1String("/16x16"));
|
QDir subDir(subDirInfo.absoluteFilePath() + QLatin1String("/16x16"));
|
||||||
foreach (const QFileInfo &iconFile, subDir.entryInfoList(QDir::Files)) {
|
foreach (const QFileInfo &iconFile, subDir.entryInfoList(QDir::Files)) {
|
||||||
QIcon icon(iconFile.absoluteFilePath());
|
QIcon icon(iconFile.absoluteFilePath());
|
||||||
if (icon.isNull()) {
|
if (icon.isNull()) {
|
||||||
if (debug)
|
if (debug)
|
||||||
qDebug() << "QmlJSIcons - skipping" << iconFile.absoluteFilePath();
|
qCDebug(iconsLog) << "skipping" << iconFile.absoluteFilePath();
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
if (debug)
|
if (debug)
|
||||||
qDebug() << "QmlJSIcons - adding" << packageName << iconFile.baseName() << "icon to database";
|
qCDebug(iconsLog) << "adding" << packageName << iconFile.baseName() << "icon to database";
|
||||||
QPair<QString,QString> element(packageName, iconFile.baseName());
|
QPair<QString,QString> element(packageName, iconFile.baseName());
|
||||||
d->iconHash.insert(element, icon);
|
d->iconHash.insert(element, icon);
|
||||||
}
|
}
|
||||||
@@ -114,7 +118,7 @@ QIcon Icons::icon(const QString &packageName, const QString typeName) const
|
|||||||
{
|
{
|
||||||
QPair<QString,QString> element(packageName, typeName);
|
QPair<QString,QString> element(packageName, typeName);
|
||||||
if (debug)
|
if (debug)
|
||||||
qDebug() << "QmlJSIcons - icon for" << packageName << typeName << "requested" << d->iconHash.contains(element);
|
qCDebug(iconsLog) << "icon for" << packageName << typeName << "requested" << d->iconHash.contains(element);
|
||||||
return d->iconHash.value(element);
|
return d->iconHash.value(element);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@@ -32,6 +32,7 @@
|
|||||||
#include "qmljsqrcparser.h"
|
#include "qmljsqrcparser.h"
|
||||||
|
|
||||||
#include <utils/qtcassert.h>
|
#include <utils/qtcassert.h>
|
||||||
|
#include <utils/logging.h>
|
||||||
|
|
||||||
#include <QCryptographicHash>
|
#include <QCryptographicHash>
|
||||||
|
|
||||||
@@ -39,7 +40,7 @@
|
|||||||
|
|
||||||
namespace QmlJS {
|
namespace QmlJS {
|
||||||
|
|
||||||
static bool debugImportDependencies = false;
|
Q_LOGGING_CATEGORY(importsLog, "qtc.qmljs.imports")
|
||||||
|
|
||||||
ImportKind::Enum toImportKind(ImportType::Enum type)
|
ImportKind::Enum toImportKind(ImportType::Enum type)
|
||||||
{
|
{
|
||||||
@@ -728,18 +729,18 @@ void ImportDependencies::addCoreImport(const CoreImport &import)
|
|||||||
foreach (const Export &e, import.possibleExports)
|
foreach (const Export &e, import.possibleExports)
|
||||||
m_importCache[e.exportName].append(import.importId);
|
m_importCache[e.exportName].append(import.importId);
|
||||||
m_coreImports.insert(newImport.importId, newImport);
|
m_coreImports.insert(newImport.importId, newImport);
|
||||||
if (debugImportDependencies) {
|
if (importsLog().isDebugEnabled()) {
|
||||||
QDebug dbg(qDebug());
|
QString msg = QString::fromLatin1("added import %1 for").arg(newImport.importId);
|
||||||
dbg << "added import "<< newImport.importId << " for";
|
|
||||||
foreach (const Export &e, newImport.possibleExports)
|
foreach (const Export &e, newImport.possibleExports)
|
||||||
dbg << " " << e.exportName.toString() << "(" << e.pathRequired << ")";
|
msg += QString::fromLatin1("\n %1(%2)").arg(e.exportName.toString(), e.pathRequired);
|
||||||
|
qCDebug(importsLog) << msg;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void ImportDependencies::removeCoreImport(const QString &importId)
|
void ImportDependencies::removeCoreImport(const QString &importId)
|
||||||
{
|
{
|
||||||
if (!m_coreImports.contains(importId)) {
|
if (!m_coreImports.contains(importId)) {
|
||||||
qDebug() << "missing importId in removeCoreImport(" << importId << ")";
|
qCWarning(importsLog) << "missing importId in removeCoreImport(" << importId << ")";
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
CoreImport &cImport = m_coreImports[importId];
|
CoreImport &cImport = m_coreImports[importId];
|
||||||
@@ -754,15 +755,14 @@ void ImportDependencies::removeCoreImport(const QString &importId)
|
|||||||
else
|
else
|
||||||
m_coreImports.remove(importId);
|
m_coreImports.remove(importId);
|
||||||
|
|
||||||
if (debugImportDependencies)
|
qCDebug(importsLog) << "removed import with id:"<< importId;
|
||||||
qDebug() << "removed import with id:"<< importId;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void ImportDependencies::removeImportCacheEntry(const ImportKey &importKey, const QString &importId)
|
void ImportDependencies::removeImportCacheEntry(const ImportKey &importKey, const QString &importId)
|
||||||
{
|
{
|
||||||
QStringList &cImp = m_importCache[importKey];
|
QStringList &cImp = m_importCache[importKey];
|
||||||
if (!cImp.removeOne(importId)) {
|
if (!cImp.removeOne(importId)) {
|
||||||
qDebug() << "missing possibleExport backpointer for " << importKey.toString() << " to "
|
qCWarning(importsLog) << "missing possibleExport backpointer for " << importKey.toString() << " to "
|
||||||
<< importId;
|
<< importId;
|
||||||
}
|
}
|
||||||
if (cImp.isEmpty())
|
if (cImp.isEmpty())
|
||||||
@@ -783,8 +783,7 @@ void ImportDependencies::addExport(const QString &importId, const ImportKey &imp
|
|||||||
CoreImport &importValue = m_coreImports[importId];
|
CoreImport &importValue = m_coreImports[importId];
|
||||||
importValue.possibleExports.append(Export(importKey, requiredPath, false));
|
importValue.possibleExports.append(Export(importKey, requiredPath, false));
|
||||||
m_importCache[importKey].append(importId);
|
m_importCache[importKey].append(importId);
|
||||||
if (debugImportDependencies)
|
qCDebug(importsLog) << "added export "<< importKey.toString() << " for id " <<importId
|
||||||
qDebug() << "added export "<< importKey.toString() << " for id " <<importId
|
|
||||||
<< " (" << requiredPath << ")";
|
<< " (" << requiredPath << ")";
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -792,25 +791,24 @@ void ImportDependencies::removeExport(const QString &importId, const ImportKey &
|
|||||||
const QString &requiredPath)
|
const QString &requiredPath)
|
||||||
{
|
{
|
||||||
if (!m_coreImports.contains(importId)) {
|
if (!m_coreImports.contains(importId)) {
|
||||||
qDebug() << "non existing core import for removeExport(" << importId << ", "
|
qCWarning(importsLog) << "non existing core import for removeExport(" << importId << ", "
|
||||||
<< importKey.toString() << ")";
|
<< importKey.toString() << ")";
|
||||||
} else {
|
} else {
|
||||||
CoreImport &importValue = m_coreImports[importId];
|
CoreImport &importValue = m_coreImports[importId];
|
||||||
if (!importValue.possibleExports.removeOne(Export(importKey, requiredPath, false))) {
|
if (!importValue.possibleExports.removeOne(Export(importKey, requiredPath, false))) {
|
||||||
qDebug() << "non existing export for removeExport(" << importId << ", "
|
qCWarning(importsLog) << "non existing export for removeExport(" << importId << ", "
|
||||||
<< importKey.toString() << ")";
|
<< importKey.toString() << ")";
|
||||||
}
|
}
|
||||||
if (importValue.possibleExports.isEmpty() && importValue.fingerprint.isEmpty())
|
if (importValue.possibleExports.isEmpty() && importValue.fingerprint.isEmpty())
|
||||||
m_coreImports.remove(importId);
|
m_coreImports.remove(importId);
|
||||||
}
|
}
|
||||||
if (!m_importCache.contains(importKey)) {
|
if (!m_importCache.contains(importKey)) {
|
||||||
qDebug() << "missing possibleExport for " << importKey.toString() << " when removing export of "
|
qCWarning(importsLog) << "missing possibleExport for " << importKey.toString()
|
||||||
<< importId;
|
<< " when removing export of " << importId;
|
||||||
} else {
|
} else {
|
||||||
removeImportCacheEntry(importKey, importId);
|
removeImportCacheEntry(importKey, importId);
|
||||||
}
|
}
|
||||||
if (debugImportDependencies)
|
qCDebug(importsLog) << "removed export "<< importKey.toString() << " for id " << importId
|
||||||
qDebug() << "removed export "<< importKey.toString() << " for id " << importId
|
|
||||||
<< " (" << requiredPath << ")";
|
<< " (" << requiredPath << ")";
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -838,8 +836,7 @@ void ImportDependencies::iterateOnLibraryImports(
|
|||||||
iter_t i = m_importCache.lowerBound(firstLib);
|
iter_t i = m_importCache.lowerBound(firstLib);
|
||||||
iter_t end = m_importCache.constEnd();
|
iter_t end = m_importCache.constEnd();
|
||||||
while (i != end && i.key().type == ImportType::Library) {
|
while (i != end && i.key().type == ImportType::Library) {
|
||||||
if (debugImportDependencies)
|
qCDebug(importsLog) << "libloop:" << i.key().toString() << i.value();
|
||||||
qDebug() << "libloop:" << i.key().toString() << i.value();
|
|
||||||
foreach (const QString &cImportName, i.value()) {
|
foreach (const QString &cImportName, i.value()) {
|
||||||
CoreImport cImport = coreImport(cImportName);
|
CoreImport cImport = coreImport(cImportName);
|
||||||
if (vContext.languageIsCompatible(cImport.language)) {
|
if (vContext.languageIsCompatible(cImport.language)) {
|
||||||
@@ -847,8 +844,7 @@ void ImportDependencies::iterateOnLibraryImports(
|
|||||||
if (e.visibleInVContext(vContext) && e.exportName.type == ImportType::Library) {
|
if (e.visibleInVContext(vContext) && e.exportName.type == ImportType::Library) {
|
||||||
ImportMatchStrength m = e.exportName.matchImport(i.key(), vContext);
|
ImportMatchStrength m = e.exportName.matchImport(i.key(), vContext);
|
||||||
if (m.hasMatch()) {
|
if (m.hasMatch()) {
|
||||||
if (debugImportDependencies)
|
qCDebug(importsLog) << "import iterate:" << e.exportName.toString()
|
||||||
qDebug() << "import iterate:" << e.exportName.toString()
|
|
||||||
<< " (" << e.pathRequired << "), id:" << cImport.importId;
|
<< " (" << e.pathRequired << "), id:" << cImport.importId;
|
||||||
if (!iterF(m, e, cImport))
|
if (!iterF(m, e, cImport))
|
||||||
return;
|
return;
|
||||||
@@ -945,16 +941,16 @@ void ImportDependencies::checkConsistency() const
|
|||||||
i.next();
|
i.next();
|
||||||
foreach (const Export &e, i.value().possibleExports) {
|
foreach (const Export &e, i.value().possibleExports) {
|
||||||
if (!m_importCache.value(e.exportName).contains(i.key())) {
|
if (!m_importCache.value(e.exportName).contains(i.key())) {
|
||||||
qDebug() << e.exportName.toString();
|
qCWarning(importsLog) << e.exportName.toString();
|
||||||
qDebug() << i.key();
|
qCWarning(importsLog) << i.key();
|
||||||
|
|
||||||
QMapIterator<ImportKey, QStringList> j(m_importCache);
|
QMapIterator<ImportKey, QStringList> j(m_importCache);
|
||||||
while (j.hasNext()) {
|
while (j.hasNext()) {
|
||||||
j.next();
|
j.next();
|
||||||
qDebug() << j.key().toString() << j.value();
|
qCWarning(importsLog) << j.key().toString() << j.value();
|
||||||
}
|
}
|
||||||
qDebug() << m_importCache.contains(e.exportName);
|
qCWarning(importsLog) << m_importCache.contains(e.exportName);
|
||||||
qDebug() << m_importCache.value(e.exportName);
|
qCWarning(importsLog) << m_importCache.value(e.exportName);
|
||||||
}
|
}
|
||||||
Q_ASSERT(m_importCache.value(e.exportName).contains(i.key()));
|
Q_ASSERT(m_importCache.value(e.exportName).contains(i.key()));
|
||||||
}
|
}
|
||||||
|
@@ -67,7 +67,6 @@
|
|||||||
|
|
||||||
#include <qmljs/qmljsindenter.h>
|
#include <qmljs/qmljsindenter.h>
|
||||||
|
|
||||||
#include <QDebug>
|
|
||||||
#include <QTextBlock>
|
#include <QTextBlock>
|
||||||
|
|
||||||
using namespace QmlJS;
|
using namespace QmlJS;
|
||||||
|
@@ -28,6 +28,7 @@
|
|||||||
****************************************************************************/
|
****************************************************************************/
|
||||||
|
|
||||||
#include "parser/qmljsast_p.h"
|
#include "parser/qmljsast_p.h"
|
||||||
|
#include "qmljsconstants.h"
|
||||||
#include "qmljscontext.h"
|
#include "qmljscontext.h"
|
||||||
#include "qmljsevaluate.h"
|
#include "qmljsevaluate.h"
|
||||||
#include "qmljsinterpreter.h"
|
#include "qmljsinterpreter.h"
|
||||||
@@ -41,7 +42,6 @@
|
|||||||
#include <utils/qtcassert.h>
|
#include <utils/qtcassert.h>
|
||||||
|
|
||||||
#include <QApplication>
|
#include <QApplication>
|
||||||
#include <QDebug>
|
|
||||||
#include <QDir>
|
#include <QDir>
|
||||||
#include <QFile>
|
#include <QFile>
|
||||||
#include <QString>
|
#include <QString>
|
||||||
@@ -2492,38 +2492,38 @@ public:
|
|||||||
|
|
||||||
virtual bool processProperty(const QString &name, const Value *)
|
virtual bool processProperty(const QString &name, const Value *)
|
||||||
{
|
{
|
||||||
qDebug() << "property: " << name;
|
qCDebug(qmljsLog) << "property: " << name;
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
virtual bool processEnumerator(const QString &name, const Value *)
|
virtual bool processEnumerator(const QString &name, const Value *)
|
||||||
{
|
{
|
||||||
qDebug() << "enumerator: " << name;
|
qCDebug(qmljsLog) << "enumerator: " << name;
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
virtual bool processSignal(const QString &name, const Value *)
|
virtual bool processSignal(const QString &name, const Value *)
|
||||||
{
|
{
|
||||||
qDebug() << "signal: " << name;
|
qCDebug(qmljsLog) << "signal: " << name;
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
virtual bool processSlot(const QString &name, const Value *)
|
virtual bool processSlot(const QString &name, const Value *)
|
||||||
{
|
{
|
||||||
qDebug() << "slot: " << name;
|
qCDebug(qmljsLog) << "slot: " << name;
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
virtual bool processGeneratedSlot(const QString &name, const Value *)
|
virtual bool processGeneratedSlot(const QString &name, const Value *)
|
||||||
{
|
{
|
||||||
qDebug() << "generated slot: " << name;
|
qCDebug(qmljsLog) << "generated slot: " << name;
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
void Imports::dump() const
|
void Imports::dump() const
|
||||||
{
|
{
|
||||||
qDebug() << "Imports contents, in search order:";
|
qCDebug(qmljsLog) << "Imports contents, in search order:";
|
||||||
QListIterator<Import> it(m_imports);
|
QListIterator<Import> it(m_imports);
|
||||||
it.toBack();
|
it.toBack();
|
||||||
while (it.hasPrevious()) {
|
while (it.hasPrevious()) {
|
||||||
@@ -2531,7 +2531,7 @@ void Imports::dump() const
|
|||||||
const ObjectValue *import = i.object;
|
const ObjectValue *import = i.object;
|
||||||
const ImportInfo &info = i.info;
|
const ImportInfo &info = i.info;
|
||||||
|
|
||||||
qDebug() << " " << info.path() << " " << info.version().toString() << " as " << info.as() << " : " << import;
|
qCDebug(qmljsLog) << " " << info.path() << " " << info.version().toString() << " as " << info.as() << " : " << import;
|
||||||
MemberDumper dumper;
|
MemberDumper dumper;
|
||||||
import->processMembers(&dumper);
|
import->processMembers(&dumper);
|
||||||
}
|
}
|
||||||
|
@@ -67,8 +67,6 @@
|
|||||||
|
|
||||||
#include <qmljs/qmljslineinfo.h>
|
#include <qmljs/qmljslineinfo.h>
|
||||||
|
|
||||||
#include <QDebug>
|
|
||||||
|
|
||||||
using namespace QmlJS;
|
using namespace QmlJS;
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
@@ -38,7 +38,6 @@
|
|||||||
#include "qmljsconstants.h"
|
#include "qmljsconstants.h"
|
||||||
|
|
||||||
#include <QDir>
|
#include <QDir>
|
||||||
#include <QDebug>
|
|
||||||
|
|
||||||
using namespace LanguageUtils;
|
using namespace LanguageUtils;
|
||||||
using namespace QmlJS;
|
using namespace QmlJS;
|
||||||
|
@@ -39,7 +39,6 @@
|
|||||||
#include <utils/hostosinfo.h>
|
#include <utils/hostosinfo.h>
|
||||||
#include <utils/runextensions.h>
|
#include <utils/runextensions.h>
|
||||||
|
|
||||||
#include <QDebug>
|
|
||||||
#include <QDir>
|
#include <QDir>
|
||||||
#include <QFile>
|
#include <QFile>
|
||||||
#include <QFileInfo>
|
#include <QFileInfo>
|
||||||
@@ -55,6 +54,8 @@
|
|||||||
|
|
||||||
namespace QmlJS {
|
namespace QmlJS {
|
||||||
|
|
||||||
|
QMLJS_EXPORT Q_LOGGING_CATEGORY(qmljsLog, "qtc.qmljs.common")
|
||||||
|
|
||||||
/*!
|
/*!
|
||||||
\class QmlJS::ModelManagerInterface
|
\class QmlJS::ModelManagerInterface
|
||||||
\brief The ModelManagerInterface class acts as an interface to the
|
\brief The ModelManagerInterface class acts as an interface to the
|
||||||
@@ -184,7 +185,7 @@ void ModelManagerInterface::writeWarning(const QString &msg)
|
|||||||
if (ModelManagerInterface *i = instance())
|
if (ModelManagerInterface *i = instance())
|
||||||
i->writeMessageInternal(msg);
|
i->writeMessageInternal(msg);
|
||||||
else
|
else
|
||||||
qDebug() << msg;
|
qCWarning(qmljsLog) << msg;
|
||||||
}
|
}
|
||||||
|
|
||||||
ModelManagerInterface::WorkingCopy ModelManagerInterface::workingCopy()
|
ModelManagerInterface::WorkingCopy ModelManagerInterface::workingCopy()
|
||||||
@@ -209,7 +210,7 @@ QHash<QString, Language::Enum> ModelManagerInterface::languageForSuffix() const
|
|||||||
|
|
||||||
void ModelManagerInterface::writeMessageInternal(const QString &msg) const
|
void ModelManagerInterface::writeMessageInternal(const QString &msg) const
|
||||||
{
|
{
|
||||||
qDebug() << msg;
|
qCWarning(qmljsLog) << msg;
|
||||||
}
|
}
|
||||||
|
|
||||||
ModelManagerInterface::WorkingCopy ModelManagerInterface::workingCopyInternal() const
|
ModelManagerInterface::WorkingCopy ModelManagerInterface::workingCopyInternal() const
|
||||||
@@ -222,7 +223,7 @@ void ModelManagerInterface::addTaskInternal(QFuture<void> result, const QString
|
|||||||
const char *taskId) const
|
const char *taskId) const
|
||||||
{
|
{
|
||||||
Q_UNUSED(result);
|
Q_UNUSED(result);
|
||||||
qDebug() << "started " << taskId << " " << msg;
|
qCDebug(qmljsLog) << "started " << taskId << " " << msg;
|
||||||
}
|
}
|
||||||
|
|
||||||
void ModelManagerInterface::loadQmlTypeDescriptionsInternal(const QString &resourcePath)
|
void ModelManagerInterface::loadQmlTypeDescriptionsInternal(const QString &resourcePath)
|
||||||
@@ -630,7 +631,7 @@ void ModelManagerInterface::updateDocument(Document::Ptr doc)
|
|||||||
void ModelManagerInterface::updateLibraryInfo(const QString &path, const LibraryInfo &info)
|
void ModelManagerInterface::updateLibraryInfo(const QString &path, const LibraryInfo &info)
|
||||||
{
|
{
|
||||||
if (!info.pluginTypeInfoError().isEmpty())
|
if (!info.pluginTypeInfoError().isEmpty())
|
||||||
qDebug() << "Dumping errors for " << path << ":" << info.pluginTypeInfoError();
|
qCWarning(qmljsLog) << "Dumping errors for " << path << ":" << info.pluginTypeInfoError();
|
||||||
|
|
||||||
{
|
{
|
||||||
QMutexLocker locker(&m_mutex);
|
QMutexLocker locker(&m_mutex);
|
||||||
|
@@ -28,6 +28,7 @@
|
|||||||
****************************************************************************/
|
****************************************************************************/
|
||||||
|
|
||||||
#include "qmljsqrcparser.h"
|
#include "qmljsqrcparser.h"
|
||||||
|
#include "qmljsconstants.h"
|
||||||
#include <QFile>
|
#include <QFile>
|
||||||
#include <QDir>
|
#include <QDir>
|
||||||
#include <QFileInfo>
|
#include <QFileInfo>
|
||||||
@@ -40,7 +41,6 @@
|
|||||||
#include <QMultiHash>
|
#include <QMultiHash>
|
||||||
#include <QCoreApplication>
|
#include <QCoreApplication>
|
||||||
#include <utils/qtcassert.h>
|
#include <utils/qtcassert.h>
|
||||||
#include <QDebug>
|
|
||||||
|
|
||||||
namespace QmlJS {
|
namespace QmlJS {
|
||||||
|
|
||||||
@@ -456,7 +456,7 @@ QrcParser::Ptr QrcCachePrivate::addPath(const QString &path)
|
|||||||
}
|
}
|
||||||
QrcParser::Ptr newParser = QrcParser::parseQrcFile(path);
|
QrcParser::Ptr newParser = QrcParser::parseQrcFile(path);
|
||||||
if (!newParser->isValid())
|
if (!newParser->isValid())
|
||||||
qDebug() << "adding invalid qrc " << path << " to the cache:" << newParser->errorMessages();
|
qCWarning(qmljsLog) << "adding invalid qrc " << path << " to the cache:" << newParser->errorMessages();
|
||||||
{
|
{
|
||||||
QMutexLocker l(&m_mutex);
|
QMutexLocker l(&m_mutex);
|
||||||
QPair<QrcParser::Ptr,int> currentValue = m_cache.value(path, qMakePair(QrcParser::Ptr(0), 0));
|
QPair<QrcParser::Ptr,int> currentValue = m_cache.value(path, qMakePair(QrcParser::Ptr(0), 0));
|
||||||
|
@@ -288,7 +288,7 @@ protected:
|
|||||||
result.badnessFromSplits = 0;
|
result.badnessFromSplits = 0;
|
||||||
result.lines = QStringList(line);
|
result.lines = QStringList(line);
|
||||||
|
|
||||||
//qDebug() << "trying to split" << line << possibleSplits << context;
|
//qCDebug(qmljsLog) << "trying to split" << line << possibleSplits << context;
|
||||||
|
|
||||||
// try to split at every possible position
|
// try to split at every possible position
|
||||||
for (int i = possibleSplits.size() - 1; i >= 0; --i) {
|
for (int i = possibleSplits.size() - 1; i >= 0; --i) {
|
||||||
|
@@ -33,16 +33,14 @@
|
|||||||
#include "parser/qmljslexer_p.h"
|
#include "parser/qmljslexer_p.h"
|
||||||
#include "parser/qmljsengine_p.h"
|
#include "parser/qmljsengine_p.h"
|
||||||
|
|
||||||
|
#include <utils/logging.h>
|
||||||
|
|
||||||
#include "qmljsutils.h"
|
#include "qmljsutils.h"
|
||||||
|
|
||||||
#include <QFile>
|
#include <QFile>
|
||||||
|
|
||||||
enum {
|
namespace QmlJS{
|
||||||
debug = false
|
Q_LOGGING_CATEGORY(simpleReaderLog, "qtc.qmljs.simpleReader")
|
||||||
};
|
|
||||||
|
|
||||||
|
|
||||||
using namespace QmlJS;
|
|
||||||
|
|
||||||
QVariant SimpleReaderNode::property(const QString &name) const
|
QVariant SimpleReaderNode::property(const QString &name) const
|
||||||
{
|
{
|
||||||
@@ -304,8 +302,7 @@ SimpleReaderNode::Ptr SimpleReader::readFromSource(const QString &source)
|
|||||||
|
|
||||||
void SimpleReader::elementStart(const QString &name)
|
void SimpleReader::elementStart(const QString &name)
|
||||||
{
|
{
|
||||||
if (debug)
|
qCDebug(simpleReaderLog) << "elementStart()" << name;
|
||||||
qDebug() << "SimpleReader::elementStart()" << name;
|
|
||||||
|
|
||||||
SimpleReaderNode::Ptr newNode = SimpleReaderNode::create(name, m_currentNode);
|
SimpleReaderNode::Ptr newNode = SimpleReaderNode::create(name, m_currentNode);
|
||||||
|
|
||||||
@@ -321,8 +318,7 @@ void SimpleReader::elementEnd()
|
|||||||
{
|
{
|
||||||
Q_ASSERT(m_currentNode);
|
Q_ASSERT(m_currentNode);
|
||||||
|
|
||||||
if (debug)
|
qCDebug(simpleReaderLog) << "elementEnd()" << m_currentNode.data()->name();
|
||||||
qDebug() << "SimpleReader::elementEnd()" << m_currentNode.data()->name();
|
|
||||||
|
|
||||||
m_currentNode = m_currentNode.data()->parent();
|
m_currentNode = m_currentNode.data()->parent();
|
||||||
}
|
}
|
||||||
@@ -331,11 +327,12 @@ void SimpleReader::propertyDefinition(const QString &name, const QVariant &value
|
|||||||
{
|
{
|
||||||
Q_ASSERT(m_currentNode);
|
Q_ASSERT(m_currentNode);
|
||||||
|
|
||||||
if (debug)
|
qCDebug(simpleReaderLog) << "propertyDefinition()" << m_currentNode.data()->name() << name << value;
|
||||||
qDebug() << "SimpleReader::propertyDefinition()" << m_currentNode.data()->name() << name << value;
|
|
||||||
|
|
||||||
if (m_currentNode.data()->propertyNames().contains(name))
|
if (m_currentNode.data()->propertyNames().contains(name))
|
||||||
addError(tr("Property is defined twice."), currentSourceLocation());
|
addError(tr("Property is defined twice."), currentSourceLocation());
|
||||||
|
|
||||||
m_currentNode.data()->setProperty(name, value);
|
m_currentNode.data()->setProperty(name, value);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
} // namespace QmlJS
|
||||||
|
Reference in New Issue
Block a user