Use const literals.

This commit is contained in:
Roberto Raggi
2009-12-01 11:33:13 +01:00
parent b792b934e4
commit fade61a8a9
38 changed files with 284 additions and 289 deletions

View File

@@ -219,7 +219,7 @@ protected:
if (! (ast && ast->name))
return false;
Identifier *id = ast->name->identifier();
const Identifier *id = ast->name->identifier();
if (scope) {
for (Symbol *member = scope->lookat(id); member; member = member->next()) {
@@ -1701,9 +1701,9 @@ void CPPEditor::performQuickFix(int index)
{
CPPQuickFixCollector *quickFixCollector = CppPlugin::instance()->quickFixCollector();
QuickFixOperationPtr op = m_quickFixes.at(index);
//quickFixCollector->perform(op);
op->createChangeSet();
setChangeSet(op->changeSet());
quickFixCollector->perform(op);
//op->createChangeSet();
//setChangeSet(op->changeSet());
}
void CPPEditor::contextMenuEvent(QContextMenuEvent *e)

View File

@@ -162,7 +162,7 @@ static QString buildHelpId(Symbol *symbol, Name *name)
if (owner && owner->name() && ! scope->isEnumScope()) {
Name *name = owner->name();
Identifier *id = 0;
const Identifier *id = 0;
if (NameId *nameId = name->asNameId())
id = nameId->identifier();
@@ -341,7 +341,7 @@ void CppHoverHandler::updateHelpIdAndTooltip(TextEditor::ITextEditor *editor, in
if (resolvedSymbol && resolvedSymbol->scope()
&& resolvedSymbol->scope()->isClassScope()) {
Class *enclosingClass = resolvedSymbol->scope()->owner()->asClass();
if (Identifier *id = enclosingClass->identifier()) {
if (const Identifier *id = enclosingClass->identifier()) {
if (id->isEqualTo(resolvedSymbol->identifier()))
resolvedSymbol = enclosingClass;
}

View File

@@ -79,8 +79,8 @@ QList<int> CppFindReferences::references(Symbol *symbol,
Document::Ptr doc,
const Snapshot& snapshot) const
{
Identifier *id = 0;
if (Identifier *symbolId = symbol->identifier())
const Identifier *id = 0;
if (const Identifier *symbolId = symbol->identifier())
id = doc->control()->findIdentifier(symbolId->chars(), symbolId->size());
QList<int> references;
@@ -106,7 +106,7 @@ static void find_helper(QFutureInterface<Usage> &future,
QTime tm;
tm.start();
Identifier *symbolId = symbol->identifier();
const Identifier *symbolId = symbol->identifier();
Q_ASSERT(symbolId != 0);
const QString sourceFile = QString::fromUtf8(symbol->fileName(), symbol->fileNameLength());
@@ -142,7 +142,7 @@ static void find_helper(QFutureInterface<Usage> &future,
if (Document::Ptr previousDoc = snapshot.value(fileName)) {
Control *control = previousDoc->control();
Identifier *id = control->findIdentifier(symbolId->chars(), symbolId->size());
const Identifier *id = control->findIdentifier(symbolId->chars(), symbolId->size());
if (! id)
continue; // skip this document, it's not using symbolId.
}
@@ -164,7 +164,7 @@ static void find_helper(QFutureInterface<Usage> &future,
doc->tokenize();
Control *control = doc->control();
if (Identifier *id = control->findIdentifier(symbolId->chars(), symbolId->size())) {
if (const Identifier *id = control->findIdentifier(symbolId->chars(), symbolId->size())) {
QTime tm;
tm.start();
doc->parse();
@@ -202,7 +202,7 @@ void CppFindReferences::findUsages(Symbol *symbol)
void CppFindReferences::renameUsages(Symbol *symbol)
{
if (Identifier *id = symbol->identifier()) {
if (const Identifier *id = symbol->identifier()) {
const QString textToReplace = QString::fromUtf8(id->chars(), id->size());
Find::SearchResult *search = _resultWindow->startNewSearch(Find::SearchResultWindow::SearchAndReplace);

View File

@@ -666,7 +666,7 @@ static int blockStartState(const QTextBlock &block)
return state & 0xff;
}
void ScriptEditor::indentBlock(QTextDocument *, QTextBlock block, QChar typedChar)
void ScriptEditor::indentBlock(QTextDocument *, QTextBlock block, QChar /*typedChar*/)
{
TextEditor::TabSettings ts = tabSettings();

View File

@@ -104,7 +104,7 @@ namespace QmlEditor {
}
protected:
virtual bool visit(Block *ast)
virtual bool visit(Block * /*ast*/)
{
// TODO
// if (_pos > ast->lbraceToken.end() && _pos < ast->rbraceToken.offset) {