Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(28)

Side by Side Diff: pkg/analysis_server/lib/src/utilities/change_builder_dart.dart

Issue 2532393008: Add libraries in corrections using SourceInfo instance of LibraryElement. (Closed)
Patch Set: Replace SourceInfo with Source. Created 4 years ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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
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 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698