Don't propose 'Assign to local variable' when in arguments list.

R=brianwilkerson@google.com
BUG=

Review URL: https://codereview.chromium.org//943053005

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@44036 260f80e4-7a28-3924-810f-c04153c831b5
This commit is contained in:
scheglov@google.com
2015-02-26 01:34:25 +00:00
parent 8b6a6a1e4f
commit 08cff379ca
2 changed files with 15 additions and 0 deletions
@@ -362,6 +362,11 @@ class AssistProcessor {
// prepare expression
Expression expression = expressionStatement.expression;
int offset = expression.offset;
// ignore if in arguments
if (node.getAncestor((node) => node is ArgumentList) != null) {
_coverageMarker();
return;
}
// ignore if already assignment
if (expression is AssignmentExpression) {
_coverageMarker();
@@ -613,6 +613,16 @@ main() {
assertNoAssistAt('vvv =', AssistKind.ASSIGN_TO_LOCAL_VARIABLE);
}
void test_assignToLocalVariable_invocationArgument() {
resolveTestUnit(r'''
main() {
f(12345);
}
int f(p) {}
''');
assertNoAssistAt('345', AssistKind.ASSIGN_TO_LOCAL_VARIABLE);
}
void test_assignToLocalVariable_throw() {
resolveTestUnit('''
main() {