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; | |
6 | |
7 import 'dart:math'; | 5 import 'dart:math'; |
8 | 6 |
9 import 'package:analysis_server/protocol/protocol_generated.dart' | 7 import 'package:analysis_server/protocol/protocol_generated.dart' |
10 show SourceChange, SourceEdit; | 8 show SourceChange, SourceEdit; |
11 import 'package:analysis_server/src/protocol_server.dart' | 9 import 'package:analysis_server/src/protocol_server.dart' |
12 show doSourceChange_addElementEdit; | 10 show doSourceChange_addElementEdit; |
13 import 'package:analysis_server/src/services/correction/strings.dart'; | 11 import 'package:analysis_server/src/services/correction/strings.dart'; |
14 import 'package:analyzer/dart/ast/ast.dart'; | 12 import 'package:analyzer/dart/ast/ast.dart'; |
15 import 'package:analyzer/dart/ast/token.dart'; | 13 import 'package:analyzer/dart/ast/token.dart'; |
16 import 'package:analyzer/dart/ast/visitor.dart'; | 14 import 'package:analyzer/dart/ast/visitor.dart'; |
17 import 'package:analyzer/dart/element/element.dart'; | 15 import 'package:analyzer/dart/element/element.dart'; |
18 import 'package:analyzer/dart/element/type.dart'; | 16 import 'package:analyzer/dart/element/type.dart'; |
19 import 'package:analyzer/src/dart/ast/utilities.dart'; | 17 import 'package:analyzer/src/dart/ast/utilities.dart'; |
20 import 'package:analyzer/src/dart/scanner/reader.dart'; | 18 import 'package:analyzer/src/dart/scanner/reader.dart'; |
21 import 'package:analyzer/src/dart/scanner/scanner.dart'; | 19 import 'package:analyzer/src/dart/scanner/scanner.dart'; |
22 import 'package:analyzer/src/generated/engine.dart'; | 20 import 'package:analyzer/src/generated/engine.dart'; |
23 import 'package:analyzer/src/generated/resolver.dart'; | 21 import 'package:analyzer/src/generated/resolver.dart'; |
24 import 'package:analyzer/src/generated/source.dart'; | 22 import 'package:analyzer/src/generated/source.dart'; |
| 23 import 'package:analyzer_plugin/src/utilities/string_utilities.dart'; |
25 import 'package:analyzer_plugin/utilities/range_factory.dart'; | 24 import 'package:analyzer_plugin/utilities/range_factory.dart'; |
26 import 'package:path/path.dart'; | 25 import 'package:path/path.dart'; |
27 | 26 |
28 /** | 27 /** |
29 * Adds edits to the given [change] that ensure that all the [libraries] are | 28 * Adds edits to the given [change] that ensure that all the [libraries] are |
30 * imported into the given [targetLibrary]. | 29 * imported into the given [targetLibrary]. |
31 */ | 30 */ |
32 void addLibraryImports( | 31 void addLibraryImports( |
33 SourceChange change, LibraryElement targetLibrary, Set<Source> libraries) { | 32 SourceChange change, LibraryElement targetLibrary, Set<Source> libraries) { |
34 CorrectionUtils libUtils; | 33 CorrectionUtils libUtils; |
(...skipping 1612 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1647 _InvertedCondition expr, int newOperatorPrecedence) { | 1646 _InvertedCondition expr, int newOperatorPrecedence) { |
1648 if (expr._precedence < newOperatorPrecedence) { | 1647 if (expr._precedence < newOperatorPrecedence) { |
1649 return "(${expr._source})"; | 1648 return "(${expr._source})"; |
1650 } | 1649 } |
1651 return expr._source; | 1650 return expr._source; |
1652 } | 1651 } |
1653 | 1652 |
1654 static _InvertedCondition _simple(String source) => | 1653 static _InvertedCondition _simple(String source) => |
1655 new _InvertedCondition(2147483647, source); | 1654 new _InvertedCondition(2147483647, source); |
1656 } | 1655 } |
OLD | NEW |