forked from qt-creator/qt-creator
Removed the TokenCache.
This commit is contained in:
@@ -55,7 +55,6 @@
|
||||
#include <cplusplus/BackwardsScanner.h>
|
||||
#include <cplusplus/FastPreprocessor.h>
|
||||
#include <cplusplus/CheckUndefinedSymbols.h>
|
||||
#include <cplusplus/TokenCache.h>
|
||||
|
||||
#include <cpptools/cppmodelmanagerinterface.h>
|
||||
#include <cpptools/cpptoolsconstants.h>
|
||||
@@ -530,7 +529,7 @@ struct FindCanonicalSymbol
|
||||
SemanticInfo info;
|
||||
|
||||
FindCanonicalSymbol(CPPEditor *editor, const SemanticInfo &info)
|
||||
: editor(editor), expressionUnderCursor(editor->tokenCache()), info(info)
|
||||
: editor(editor), info(info)
|
||||
{
|
||||
typeOfExpression.init(info.doc, info.snapshot);
|
||||
}
|
||||
@@ -724,11 +723,6 @@ void CPPEditor::cut()
|
||||
finishRename();
|
||||
}
|
||||
|
||||
TokenCache *CPPEditor::tokenCache() const
|
||||
{
|
||||
return m_modelManager->tokenCache(editableInterface());
|
||||
}
|
||||
|
||||
CppTools::CppModelManagerInterface *CPPEditor::modelManager() const
|
||||
{
|
||||
return m_modelManager;
|
||||
@@ -1227,7 +1221,7 @@ CPPEditor::Link CPPEditor::findLinkAt(const QTextCursor &cursor,
|
||||
SimpleLexer tokenize;
|
||||
tokenize.setQtMocRunEnabled(true);
|
||||
const QString blockText = cursor.block().text();
|
||||
const QList<SimpleToken> tokens = tokenize(blockText, TokenCache::previousBlockState(cursor.block()));
|
||||
const QList<SimpleToken> tokens = tokenize(blockText, BackwardsScanner::previousBlockState(cursor.block()));
|
||||
|
||||
bool recognizedQtMethod = false;
|
||||
|
||||
@@ -1275,7 +1269,7 @@ CPPEditor::Link CPPEditor::findLinkAt(const QTextCursor &cursor,
|
||||
|
||||
if (! recognizedQtMethod) {
|
||||
const QTextBlock block = tc.block();
|
||||
const SimpleToken tk = tokenCache()->tokenUnderCursor(tc);
|
||||
const SimpleToken tk = SimpleLexer::tokenAt(block.text(), cursor.positionInBlock(), BackwardsScanner::previousBlockState(block), true);
|
||||
|
||||
beginOfToken = block.position() + tk.begin();
|
||||
endOfToken = block.position() + tk.end();
|
||||
@@ -1305,7 +1299,7 @@ CPPEditor::Link CPPEditor::findLinkAt(const QTextCursor &cursor,
|
||||
return link;
|
||||
|
||||
// Evaluate the type of the expression under the cursor
|
||||
ExpressionUnderCursor expressionUnderCursor(tokenCache());
|
||||
ExpressionUnderCursor expressionUnderCursor;
|
||||
const QString expression = expressionUnderCursor(tc);
|
||||
|
||||
TypeOfExpression typeOfExpression;
|
||||
@@ -1408,13 +1402,13 @@ bool CPPEditor::isElectricCharacter(QChar ch) const
|
||||
QString CPPEditor::insertMatchingBrace(const QTextCursor &tc, const QString &text,
|
||||
QChar la, int *skippedChars) const
|
||||
{
|
||||
MatchingText m(tokenCache());
|
||||
MatchingText m;
|
||||
return m.insertMatchingBrace(tc, text, la, skippedChars);
|
||||
}
|
||||
|
||||
QString CPPEditor::insertParagraphSeparator(const QTextCursor &tc) const
|
||||
{
|
||||
MatchingText m(tokenCache());
|
||||
MatchingText m;
|
||||
return m.insertParagraphSeparator(tc);
|
||||
}
|
||||
|
||||
@@ -1437,7 +1431,7 @@ bool CPPEditor::contextAllowsAutoParentheses(const QTextCursor &cursor,
|
||||
|
||||
bool CPPEditor::contextAllowsElectricCharacters(const QTextCursor &cursor) const
|
||||
{
|
||||
const SimpleToken tk = tokenCache()->tokenUnderCursor(cursor);
|
||||
const SimpleToken tk = SimpleLexer::tokenAt(cursor.block().text(), cursor.positionInBlock(), BackwardsScanner::previousBlockState(cursor.block()));
|
||||
|
||||
// XXX Duplicated from CPPEditor::isInComment to avoid tokenizing twice
|
||||
if (tk.isComment()) {
|
||||
@@ -1468,7 +1462,7 @@ bool CPPEditor::contextAllowsElectricCharacters(const QTextCursor &cursor) const
|
||||
|
||||
bool CPPEditor::isInComment(const QTextCursor &cursor) const
|
||||
{
|
||||
const SimpleToken tk = tokenCache()->tokenUnderCursor(cursor);
|
||||
const SimpleToken tk = SimpleLexer::tokenAt(cursor.block().text(), cursor.positionInBlock(), BackwardsScanner::previousBlockState(cursor.block()));
|
||||
|
||||
if (tk.isComment()) {
|
||||
const int pos = cursor.selectionEnd() - cursor.block().position();
|
||||
@@ -1522,7 +1516,7 @@ void CPPEditor::indentBlock(QTextDocument *doc, QTextBlock block, QChar typedCha
|
||||
|
||||
const TabSettings &ts = tabSettings();
|
||||
|
||||
BackwardsScanner tk(tokenCache(), tc, 400);
|
||||
BackwardsScanner tk(tc, 400);
|
||||
const int tokenCount = tk.startToken();
|
||||
|
||||
if (tokenCount != 0) {
|
||||
|
||||
Reference in New Issue
Block a user