| 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.correction.util; | 5 library services.src.correction.util; |
| 6 | 6 |
| 7 import 'dart:math'; | 7 import 'dart:math'; |
| 8 | 8 |
| 9 import 'package:analysis_server/plugin/protocol/protocol.dart' | 9 import 'package:analysis_server/plugin/protocol/protocol.dart' |
| 10 show SourceChange, SourceEdit; | 10 show SourceChange, SourceEdit; |
| (...skipping 43 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 54 // if still at the beginning of the file, skip shebang and line comments | 54 // if still at the beginning of the file, skip shebang and line comments |
| 55 if (offset == 0) { | 55 if (offset == 0) { |
| 56 CorrectionUtils_InsertDesc desc = libraryUtils.getInsertDescTop(); | 56 CorrectionUtils_InsertDesc desc = libraryUtils.getInsertDescTop(); |
| 57 offset = desc.offset; | 57 offset = desc.offset; |
| 58 prefix = desc.prefix; | 58 prefix = desc.prefix; |
| 59 suffix = desc.suffix + eol; | 59 suffix = desc.suffix + eol; |
| 60 } | 60 } |
| 61 } | 61 } |
| 62 // insert imports | 62 // insert imports |
| 63 for (LibraryElement library in libraries) { | 63 for (LibraryElement library in libraries) { |
| 64 String importPath = getLibrarySourceUri(targetLibrary, library.source); | 64 String importUri = getLibrarySourceUri(targetLibrary, library.source); |
| 65 String importCode = "${prefix}import '$importPath';$suffix"; | 65 String importCode = "${prefix}import '$importUri';$suffix"; |
| 66 doSourceChange_addElementEdit( | 66 doSourceChange_addElementEdit( |
| 67 change, targetLibrary, new SourceEdit(offset, 0, importCode)); | 67 change, targetLibrary, new SourceEdit(offset, 0, importCode)); |
| 68 } | 68 } |
| 69 } | 69 } |
| 70 | 70 |
| 71 /** | 71 /** |
| 72 * @return <code>true</code> if given [List]s are identical at given position. | 72 * @return <code>true</code> if given [List]s are identical at given position. |
| 73 */ | 73 */ |
| 74 bool allListsIdentical(List<List> lists, int position) { | 74 bool allListsIdentical(List<List> lists, int position) { |
| 75 Object element = lists[0][position]; | 75 Object element = lists[0][position]; |
| (...skipping 1423 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1499 _InvertedCondition expr, int newOperatorPrecedence) { | 1499 _InvertedCondition expr, int newOperatorPrecedence) { |
| 1500 if (expr._precedence < newOperatorPrecedence) { | 1500 if (expr._precedence < newOperatorPrecedence) { |
| 1501 return "(${expr._source})"; | 1501 return "(${expr._source})"; |
| 1502 } | 1502 } |
| 1503 return expr._source; | 1503 return expr._source; |
| 1504 } | 1504 } |
| 1505 | 1505 |
| 1506 static _InvertedCondition _simple(String source) => | 1506 static _InvertedCondition _simple(String source) => |
| 1507 new _InvertedCondition(2147483647, source); | 1507 new _InvertedCondition(2147483647, source); |
| 1508 } | 1508 } |
| OLD | NEW |