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

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

Issue 1377623002: Report a fatal error on attempt to rename an element declared in SDK. (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
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.src.refactoring.rename_class_member; 5 library services.src.refactoring.rename_class_member;
6 6
7 import 'dart:async'; 7 import 'dart:async';
8 8
9 import 'package:analysis_server/src/protocol_server.dart' 9 import 'package:analysis_server/src/protocol_server.dart'
10 hide Element, ElementKind; 10 hide Element, ElementKind;
(...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after
51 } 51 }
52 52
53 @override 53 @override
54 Future<RefactoringStatus> checkFinalConditions() { 54 Future<RefactoringStatus> checkFinalConditions() {
55 _validator = 55 _validator =
56 new _ClassMemberValidator.forRename(searchEngine, element, newName); 56 new _ClassMemberValidator.forRename(searchEngine, element, newName);
57 return _validator.validate(); 57 return _validator.validate();
58 } 58 }
59 59
60 @override 60 @override
61 Future<RefactoringStatus> checkInitialConditions() { 61 Future<RefactoringStatus> checkInitialConditions() async {
62 RefactoringStatus result = new RefactoringStatus(); 62 RefactoringStatus result = await super.checkInitialConditions();
63 if (element is MethodElement && (element as MethodElement).isOperator) { 63 if (element is MethodElement && (element as MethodElement).isOperator) {
64 result.addFatalError('Cannot rename operator.'); 64 result.addFatalError('Cannot rename operator.');
65 } 65 }
66 return new Future.value(result); 66 return new Future.value(result);
67 } 67 }
68 68
69 @override 69 @override
70 RefactoringStatus checkNewName() { 70 RefactoringStatus checkNewName() {
71 RefactoringStatus result = super.checkNewName(); 71 RefactoringStatus result = super.checkNewName();
72 if (element is FieldElement) { 72 if (element is FieldElement) {
(...skipping 186 matching lines...) Expand 10 before | Expand all | Expand 10 after
259 Element refElement = reference.element; 259 Element refElement = reference.element;
260 LibraryElement refLibrary = refElement.library; 260 LibraryElement refLibrary = refElement.library;
261 if (refLibrary != library) { 261 if (refLibrary != library) {
262 String message = format("Renamed {0} will be invisible in '{1}'.", 262 String message = format("Renamed {0} will be invisible in '{1}'.",
263 getElementKindName(element), getElementQualifiedName(refLibrary)); 263 getElementKindName(element), getElementQualifiedName(refLibrary));
264 result.addError(message, newLocation_fromMatch(reference)); 264 result.addError(message, newLocation_fromMatch(reference));
265 } 265 }
266 } 266 }
267 } 267 }
268 } 268 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698