| OLD | NEW |
| 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.inline_local; | 5 library services.src.refactoring.inline_local; |
| 6 | 6 |
| 7 import 'dart:async'; | 7 import 'dart:async'; |
| 8 | 8 |
| 9 import 'package:analysis_server/src/protocol.dart' hide Element; | 9 import 'package:analysis_server/src/protocol.dart' hide Element; |
| 10 import 'package:analysis_server/src/services/correction/status.dart'; | 10 import 'package:analysis_server/src/services/correction/status.dart'; |
| (...skipping 29 matching lines...) Expand all Loading... |
| 40 InlineLocalRefactoringImpl(this.searchEngine, this.unit, this.offset) { | 40 InlineLocalRefactoringImpl(this.searchEngine, this.unit, this.offset) { |
| 41 file = unit.element.source.fullName; | 41 file = unit.element.source.fullName; |
| 42 utils = new CorrectionUtils(unit); | 42 utils = new CorrectionUtils(unit); |
| 43 } | 43 } |
| 44 | 44 |
| 45 @override | 45 @override |
| 46 String get refactoringName => 'Inline Local Variable'; | 46 String get refactoringName => 'Inline Local Variable'; |
| 47 | 47 |
| 48 @override | 48 @override |
| 49 int get referenceCount { | 49 int get referenceCount { |
| 50 if (_references == null) { |
| 51 return 0; |
| 52 } |
| 50 return _references.length; | 53 return _references.length; |
| 51 } | 54 } |
| 52 | 55 |
| 53 @override | 56 @override |
| 57 String get variableName { |
| 58 if (_variableElement == null) { |
| 59 return null; |
| 60 } |
| 61 return _variableElement.name; |
| 62 } |
| 63 |
| 64 @override |
| 54 Future<RefactoringStatus> checkFinalConditions() { | 65 Future<RefactoringStatus> checkFinalConditions() { |
| 55 RefactoringStatus result = new RefactoringStatus(); | 66 RefactoringStatus result = new RefactoringStatus(); |
| 56 return new Future.value(result); | 67 return new Future.value(result); |
| 57 } | 68 } |
| 58 | 69 |
| 59 @override | 70 @override |
| 60 Future<RefactoringStatus> checkInitialConditions() { | 71 Future<RefactoringStatus> checkInitialConditions() { |
| 61 RefactoringStatus result = new RefactoringStatus(); | 72 RefactoringStatus result = new RefactoringStatus(); |
| 62 // prepare variable | 73 // prepare variable |
| 63 { | 74 { |
| (...skipping 103 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 167 */ | 178 */ |
| 168 bool _isIdentifierStringInterpolation(AstNode parent) { | 179 bool _isIdentifierStringInterpolation(AstNode parent) { |
| 169 if (parent is InterpolationExpression) { | 180 if (parent is InterpolationExpression) { |
| 170 InterpolationExpression element = parent; | 181 InterpolationExpression element = parent; |
| 171 return element.beginToken.type == | 182 return element.beginToken.type == |
| 172 TokenType.STRING_INTERPOLATION_IDENTIFIER; | 183 TokenType.STRING_INTERPOLATION_IDENTIFIER; |
| 173 } | 184 } |
| 174 return false; | 185 return false; |
| 175 } | 186 } |
| 176 } | 187 } |
| OLD | NEW |