Simplified the algorithm used to compute the expression under cursor.

This commit is contained in:
Roberto Raggi
2010-02-15 14:43:43 +01:00
parent a943350bd7
commit 83e40337d9
2 changed files with 83 additions and 80 deletions

View File

@@ -627,6 +627,16 @@ bool CodeCompletion::isDelimiter(const QChar &ch) const
}
}
static bool isLiteral(AST::Node *ast)
{
if (AST::cast<AST::StringLiteral *>(ast))
return true;
else if (AST::cast<AST::NumericLiteral *>(ast))
return true;
else
return false;
}
int CodeCompletion::startCompletion(TextEditor::ITextEditable *editor)
{
m_editor = editor;
@@ -691,9 +701,8 @@ int CodeCompletion::startCompletion(TextEditor::ITextEditable *editor)
QmlExpressionUnderCursor expressionUnderCursor;
QmlJS::AST::ExpressionNode *expression = expressionUnderCursor(tc);
//qDebug() << "expression:" << expression;
if (expression != 0) {
if (expression != 0 && ! isLiteral(expression)) {
Evaluate evaluate(&context);
// Evaluate the expression under cursor.