OLD | NEW |
1 // Copyright (c) 2017, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2017, 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 import 'dart:async'; | 5 import 'dart:async'; |
6 | 6 |
7 import 'package:analysis_server/protocol/protocol_generated.dart'; | 7 import 'package:analysis_server/protocol/protocol_generated.dart'; |
8 import 'package:analyzer/dart/analysis/results.dart'; | 8 import 'package:analyzer/dart/analysis/results.dart'; |
9 import 'package:analyzer/dart/ast/ast.dart'; | 9 import 'package:analyzer/dart/ast/ast.dart'; |
10 import 'package:analyzer/dart/ast/ast_factory.dart'; | 10 import 'package:analyzer/dart/ast/ast_factory.dart'; |
(...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
46 | 46 |
47 /** | 47 /** |
48 * Create the edits that will cause the list of [importedElements] to be | 48 * Create the edits that will cause the list of [importedElements] to be |
49 * imported into the library at the given [path]. | 49 * imported into the library at the given [path]. |
50 */ | 50 */ |
51 Future<SourceChange> createEdits( | 51 Future<SourceChange> createEdits( |
52 List<ImportedElements> importedElementsList) async { | 52 List<ImportedElements> importedElementsList) async { |
53 List<ImportedElements> filteredImportedElements = | 53 List<ImportedElements> filteredImportedElements = |
54 _filterImportedElements(importedElementsList); | 54 _filterImportedElements(importedElementsList); |
55 LibraryElement libraryElement = libraryResult.libraryElement; | 55 LibraryElement libraryElement = libraryResult.libraryElement; |
56 SourceFactory sourceFactory = libraryElement.context.sourceFactory; | 56 SourceFactory sourceFactory = libraryResult.session.sourceFactory; |
57 List<ImportDirective> existingImports = <ImportDirective>[]; | 57 List<ImportDirective> existingImports = <ImportDirective>[]; |
58 for (var directive in libraryResult.unit.directives) { | 58 for (var directive in libraryResult.unit.directives) { |
59 if (directive is ImportDirective) { | 59 if (directive is ImportDirective) { |
60 existingImports.add(directive); | 60 existingImports.add(directive); |
61 } | 61 } |
62 } | 62 } |
63 | 63 |
64 DartChangeBuilder builder = new DartChangeBuilder(libraryResult.session); | 64 DartChangeBuilder builder = new DartChangeBuilder(libraryResult.session); |
65 await builder.addFileEdit(libraryResult.path, | 65 await builder.addFileEdit(libraryResult.path, |
66 (DartFileEditBuilder builder) { | 66 (DartFileEditBuilder builder) { |
(...skipping 334 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
401 namesToShow.add(name); | 401 namesToShow.add(name); |
402 } | 402 } |
403 | 403 |
404 /** | 404 /** |
405 * Record that the given [name] needs to be removed from hide combinators. | 405 * Record that the given [name] needs to be removed from hide combinators. |
406 */ | 406 */ |
407 void unhide(String name) { | 407 void unhide(String name) { |
408 namesToUnhide.add(name); | 408 namesToUnhide.add(name); |
409 } | 409 } |
410 } | 410 } |
OLD | NEW |