Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(329)

Side by Side Diff: pkg/analysis_server/lib/src/services/refactoring/refactoring.dart

Issue 1397403002: Return 'null' rename refactoring in case of a null element. (Closed) Base URL: git@github.com:dart-lang/sdk.git@master
Patch Set: Created 5 years, 2 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « no previous file | pkg/analysis_server/test/services/refactoring/rename_constructor_test.dart » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2014, the Dart project authors. Please see the AUTHORS file 1 // Copyright (c) 2014, the Dart project authors. Please see the AUTHORS file
2 // for details. All rights reserved. Use of this source code is governed by a 2 // for details. All rights reserved. Use of this source code is governed by a
3 // BSD-style license that can be found in the LICENSE file. 3 // BSD-style license that can be found in the LICENSE file.
4 4
5 library services.refactoring; 5 library services.refactoring;
6 6
7 import 'dart:async'; 7 import 'dart:async';
8 8
9 import 'package:analysis_server/plugin/protocol/protocol.dart' 9 import 'package:analysis_server/plugin/protocol/protocol.dart'
10 show RefactoringMethodParameter, SourceChange; 10 show RefactoringMethodParameter, SourceChange;
(...skipping 338 matching lines...) Expand 10 before | Expand all | Expand 10 after
349 /** 349 /**
350 * Abstract [Refactoring] for renaming some [Element]. 350 * Abstract [Refactoring] for renaming some [Element].
351 */ 351 */
352 abstract class RenameRefactoring implements Refactoring { 352 abstract class RenameRefactoring implements Refactoring {
353 /** 353 /**
354 * Returns a new [RenameRefactoring] instance for renaming [element], 354 * Returns a new [RenameRefactoring] instance for renaming [element],
355 * maybe `null` if there is no support for renaming [Element]s of the given 355 * maybe `null` if there is no support for renaming [Element]s of the given
356 * type. 356 * type.
357 */ 357 */
358 factory RenameRefactoring(SearchEngine searchEngine, Element element) { 358 factory RenameRefactoring(SearchEngine searchEngine, Element element) {
359 if (element == null) {
360 return null;
361 }
359 if (element is PropertyAccessorElement) { 362 if (element is PropertyAccessorElement) {
360 element = (element as PropertyAccessorElement).variable; 363 element = (element as PropertyAccessorElement).variable;
361 } 364 }
362 if (element.enclosingElement is CompilationUnitElement) { 365 if (element.enclosingElement is CompilationUnitElement) {
363 return new RenameUnitMemberRefactoringImpl(searchEngine, element); 366 return new RenameUnitMemberRefactoringImpl(searchEngine, element);
364 } 367 }
365 if (element is ConstructorElement) { 368 if (element is ConstructorElement) {
366 return new RenameConstructorRefactoringImpl(searchEngine, element); 369 return new RenameConstructorRefactoringImpl(searchEngine, element);
367 } 370 }
368 if (element is ImportElement) { 371 if (element is ImportElement) {
(...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after
403 * Validates that the [newName] is a valid identifier and is appropriate for 406 * Validates that the [newName] is a valid identifier and is appropriate for
404 * the type of the [Element] being renamed. 407 * the type of the [Element] being renamed.
405 * 408 *
406 * It does not perform all the checks (such as checking for conflicts with any 409 * It does not perform all the checks (such as checking for conflicts with any
407 * existing names in any of the scopes containing the current name), as many 410 * existing names in any of the scopes containing the current name), as many
408 * of these checkes require search engine. Use [checkFinalConditions] for this 411 * of these checkes require search engine. Use [checkFinalConditions] for this
409 * level of checking. 412 * level of checking.
410 */ 413 */
411 RefactoringStatus checkNewName(); 414 RefactoringStatus checkNewName();
412 } 415 }
OLDNEW
« no previous file with comments | « no previous file | pkg/analysis_server/test/services/refactoring/rename_constructor_test.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698