forked from qt-creator/qt-creator
CppEditor: Hide "Assign to Local Variable" if signatures don't match
Task-number: QTCREATORBUG-9321 Change-Id: I31ac75a480b30ef26f343557088c4bbe5e95c4c6 Reviewed-by: Nikolai Kosjar <nikolai.kosjar@digia.com>
This commit is contained in:
committed by
Nikolai Kosjar
parent
8ffb0c7c1f
commit
276e2bccaa
@@ -4279,13 +4279,21 @@ void AssignToLocalVariable::match(const CppQuickFixInterface &interface, QuickFi
|
||||
TypeOfExpression typeOfExpression;
|
||||
typeOfExpression.init(interface->semanticInfo().doc, interface->snapshot(),
|
||||
interface->context().bindings());
|
||||
|
||||
// If items are empty, AssignToLocalVariableOperation will fail.
|
||||
items = typeOfExpression(file->textOf(outerAST).toUtf8(),
|
||||
file->scopeAt(outerAST->firstToken()),
|
||||
TypeOfExpression::Preprocess);
|
||||
if (items.isEmpty())
|
||||
return;
|
||||
|
||||
if (CallAST *callAST = outerAST->asCall()) {
|
||||
Scope *scope = file->scopeAt(callAST->base_expression->firstToken());
|
||||
items = typeOfExpression(file->textOf(callAST->base_expression).toUtf8(), scope,
|
||||
items = typeOfExpression(file->textOf(callAST->base_expression).toUtf8(),
|
||||
file->scopeAt(callAST->base_expression->firstToken()),
|
||||
TypeOfExpression::Preprocess);
|
||||
} else {
|
||||
Scope *scope = file->scopeAt(nameAST->firstToken());
|
||||
items = typeOfExpression(file->textOf(nameAST).toUtf8(), scope,
|
||||
items = typeOfExpression(file->textOf(nameAST).toUtf8(),
|
||||
file->scopeAt(nameAST->firstToken()),
|
||||
TypeOfExpression::Preprocess);
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user