Chromium Code Reviews| Index: pkg/analysis_server/lib/src/computer/import_elements_computer.dart |
| diff --git a/pkg/analysis_server/lib/src/computer/import_elements_computer.dart b/pkg/analysis_server/lib/src/computer/import_elements_computer.dart |
| new file mode 100644 |
| index 0000000000000000000000000000000000000000..a6c1e3b06107098fc249aba75c9bc6672660e7bb |
| --- /dev/null |
| +++ b/pkg/analysis_server/lib/src/computer/import_elements_computer.dart |
| @@ -0,0 +1,54 @@ |
| +// Copyright (c) 2017, the Dart project authors. Please see the AUTHORS file |
| +// for details. All rights reserved. Use of this source code is governed by a |
| +// BSD-style license that can be found in the LICENSE file. |
| + |
| +import 'package:analysis_server/protocol/protocol_generated.dart'; |
| +import 'package:analyzer/dart/analysis/results.dart'; |
| +import 'package:analyzer/dart/analysis/session.dart'; |
| +import 'package:analyzer/dart/element/element.dart'; |
| +import 'package:analyzer_plugin/protocol/protocol_common.dart'; |
| +import 'package:analyzer_plugin/utilities/change_builder/change_builder_dart.dart'; |
| + |
| +/** |
| + * An object used to compute the edits required to ensure that a list of |
| + * elements is imported into a given library. |
| + */ |
| +class ImportElementsComputer { |
| + /** |
| + * The analysis session used to compute the unit. |
| + */ |
| + final AnalysisSession session; |
| + |
| + /** |
| + * The library element representing the library to which the imports are to be |
| + * added. |
| + */ |
| + final LibraryElement libraryElement; |
| + |
| + /** |
| + * The path of the defining compilation unit of the library. |
| + */ |
| + final String path; |
| + |
| + /** |
| + * The elements that are to be imported into the library. |
| + */ |
| + final List<ImportedElements> elements; |
| + |
| + /** |
| + * Initialize a newly created computer to compute the edits required to ensure |
| + * that the given list of [elements] is imported into a given [library]. |
| + */ |
| + ImportElementsComputer(ResolveResult result, this.path, this.elements) |
| + : session = result.session, |
| + libraryElement = result.libraryElement; |
| + |
| + /** |
| + * Compute and return the list of edits. |
| + */ |
| + List<SourceEdit> compute() { |
| + DartChangeBuilder builder = new DartChangeBuilder(session); |
| + builder.addFileEdit(path, (DartFileEditBuilder builder) {}); |
|
devoncarew
2017/07/05 20:54:59
This is the stub implementation? Perhaps provide a
Brian Wilkerson
2017/07/05 21:01:50
Done
|
| + return <SourceEdit>[]; // builder.sourceChange |
| + } |
| +} |