| OLD | NEW |
| 1 // Copyright (c) 2015, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2015, 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 analysis_server.src.utilities.change_builder_dart; | 5 library analysis_server.src.utilities.change_builder_dart; |
| 6 | 6 |
| 7 import 'package:analysis_server/plugin/protocol/protocol.dart' hide ElementKind; | 7 import 'package:analysis_server/plugin/protocol/protocol.dart' hide ElementKind; |
| 8 import 'package:analysis_server/src/provisional/edit/utilities/change_builder_co
re.dart'; | 8 import 'package:analysis_server/src/provisional/edit/utilities/change_builder_co
re.dart'; |
| 9 import 'package:analysis_server/src/provisional/edit/utilities/change_builder_da
rt.dart'; | 9 import 'package:analysis_server/src/provisional/edit/utilities/change_builder_da
rt.dart'; |
| 10 import 'package:analysis_server/src/services/correction/name_suggestion.dart'; | 10 import 'package:analysis_server/src/services/correction/name_suggestion.dart'; |
| (...skipping 440 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 451 * The compilation unit to which the code will be added. | 451 * The compilation unit to which the code will be added. |
| 452 */ | 452 */ |
| 453 CompilationUnit unit; | 453 CompilationUnit unit; |
| 454 | 454 |
| 455 /** | 455 /** |
| 456 * A utility class used to help build the source code. | 456 * A utility class used to help build the source code. |
| 457 */ | 457 */ |
| 458 CorrectionUtils utils; | 458 CorrectionUtils utils; |
| 459 | 459 |
| 460 /** | 460 /** |
| 461 * A set containing the elements of the libraries that need to be imported in | 461 * A set containing the sources of the libraries that need to be imported in |
| 462 * order to make visible the names used in generated code. | 462 * order to make visible the names used in generated code. |
| 463 */ | 463 */ |
| 464 Set<LibraryElement> librariesToImport = new Set<LibraryElement>(); | 464 Set<Source> librariesToImport = new Set<Source>(); |
| 465 | 465 |
| 466 /** | 466 /** |
| 467 * Initialize a newly created builder to build a source file edit within the | 467 * Initialize a newly created builder to build a source file edit within the |
| 468 * change being built by the given [changeBuilder]. The file being edited has | 468 * change being built by the given [changeBuilder]. The file being edited has |
| 469 * the given [source] and [timeStamp]. | 469 * the given [source] and [timeStamp]. |
| 470 */ | 470 */ |
| 471 DartFileEditBuilderImpl( | 471 DartFileEditBuilderImpl( |
| 472 DartChangeBuilderImpl changeBuilder, Source source, int timeStamp) | 472 DartChangeBuilderImpl changeBuilder, Source source, int timeStamp) |
| 473 : super(changeBuilder, source, timeStamp) { | 473 : super(changeBuilder, source, timeStamp) { |
| 474 AnalysisContext context = changeBuilder.context; | 474 AnalysisContext context = changeBuilder.context; |
| 475 List<Source> librariesContaining = context.getLibrariesContaining(source); | 475 List<Source> librariesContaining = context.getLibrariesContaining(source); |
| 476 if (librariesContaining.length < 1) { | 476 if (librariesContaining.length < 1) { |
| 477 throw new StateError('Cannot build edits for ${source.fullName}'); | 477 throw new StateError('Cannot build edits for ${source.fullName}'); |
| 478 } | 478 } |
| 479 unit = context.resolveCompilationUnit2(source, librariesContaining[0]); | 479 unit = context.resolveCompilationUnit2(source, librariesContaining[0]); |
| 480 utils = new CorrectionUtils(unit); | 480 utils = new CorrectionUtils(unit); |
| 481 } | 481 } |
| 482 | 482 |
| 483 @override | 483 @override |
| 484 DartEditBuilderImpl createEditBuilder(int offset, int length) { | 484 DartEditBuilderImpl createEditBuilder(int offset, int length) { |
| 485 return new DartEditBuilderImpl(this, offset, length); | 485 return new DartEditBuilderImpl(this, offset, length); |
| 486 } | 486 } |
| 487 } | 487 } |
| OLD | NEW |