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

Side by Side Diff: pkg/analysis_server/lib/src/plugin/result_merger.dart

Issue 2685613002: Use toList to copy lists and clean up errors and warnings (Closed)
Patch Set: Created 3 years, 10 months 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) 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:collection'; 5 import 'dart:collection';
6 6
7 import 'package:analysis_server/plugin/protocol/protocol.dart'; 7 import 'package:analysis_server/plugin/protocol/protocol.dart';
8 import 'package:meta/meta.dart'; 8 import 'package:meta/meta.dart';
9 9
10 /** 10 /**
(...skipping 29 matching lines...) Expand all
40 buffer.write(error.correction); 40 buffer.write(error.correction);
41 return buffer.toString(); 41 return buffer.toString();
42 } 42 }
43 43
44 int count = partialResultList.length; 44 int count = partialResultList.length;
45 if (count == 0) { 45 if (count == 0) {
46 return <AnalysisErrorFixes>[]; 46 return <AnalysisErrorFixes>[];
47 } else if (count == 1) { 47 } else if (count == 1) {
48 return partialResultList[0]; 48 return partialResultList[0];
49 } 49 }
50 List<AnalysisErrorFixes> mergedFixes = 50 List<AnalysisErrorFixes> mergedFixes = partialResultList[0].toList();
51 new List<AnalysisErrorFixes>.from(partialResultList[0]);
52 Map<String, AnalysisErrorFixes> fixesMap = <String, AnalysisErrorFixes>{}; 51 Map<String, AnalysisErrorFixes> fixesMap = <String, AnalysisErrorFixes>{};
53 for (AnalysisErrorFixes fix in mergedFixes) { 52 for (AnalysisErrorFixes fix in mergedFixes) {
54 fixesMap[computeKey(fix.error)] = fix; 53 fixesMap[computeKey(fix.error)] = fix;
55 } 54 }
56 for (int i = 1; i < count; i++) { 55 for (int i = 1; i < count; i++) {
57 for (AnalysisErrorFixes fix in partialResultList[i]) { 56 for (AnalysisErrorFixes fix in partialResultList[i]) {
58 String key = computeKey(fix.error); 57 String key = computeKey(fix.error);
59 AnalysisErrorFixes mergedFix = fixesMap[key]; 58 AnalysisErrorFixes mergedFix = fixesMap[key];
60 if (mergedFix == null) { 59 if (mergedFix == null) {
61 mergedFixes.add(fix); 60 mergedFixes.add(fix);
62 fixesMap[key] = fix; 61 fixesMap[key] = fix;
63 } else { 62 } else {
64 // If more than two plugins contribute fixes for the same error, this 63 // If more than two plugins contribute fixes for the same error, this
65 // will result in extra copy operations. 64 // will result in extra copy operations.
66 List<SourceChange> mergedChanges = 65 List<SourceChange> mergedChanges = mergedFix.fixes.toList();
67 new List<SourceChange>.from(mergedFix.fixes);
68 mergedChanges.addAll(fix.fixes); 66 mergedChanges.addAll(fix.fixes);
69 AnalysisErrorFixes copiedFix = 67 AnalysisErrorFixes copiedFix =
70 new AnalysisErrorFixes(mergedFix.error, fixes: mergedChanges); 68 new AnalysisErrorFixes(mergedFix.error, fixes: mergedChanges);
71 mergedFixes[mergedFixes.indexOf(mergedFix)] = copiedFix; 69 mergedFixes[mergedFixes.indexOf(mergedFix)] = copiedFix;
72 fixesMap[key] = copiedFix; 70 fixesMap[key] = copiedFix;
73 } 71 }
74 } 72 }
75 } 73 }
76 return mergedFixes; 74 return mergedFixes;
77 } 75 }
(...skipping 58 matching lines...) Expand 10 before | Expand all | Expand 10 after
136 * considered to be overlapping.) 134 * considered to be overlapping.)
137 */ 135 */
138 List<FoldingRegion> mergeFoldingRegions( 136 List<FoldingRegion> mergeFoldingRegions(
139 List<List<FoldingRegion>> partialResultList) { 137 List<List<FoldingRegion>> partialResultList) {
140 int count = partialResultList.length; 138 int count = partialResultList.length;
141 if (count == 0) { 139 if (count == 0) {
142 return <FoldingRegion>[]; 140 return <FoldingRegion>[];
143 } else if (count == 1) { 141 } else if (count == 1) {
144 return partialResultList[0]; 142 return partialResultList[0];
145 } 143 }
146 List<FoldingRegion> mergedRegions = 144 List<FoldingRegion> mergedRegions = partialResultList[0].toList();
147 new List<FoldingRegion>.from(partialResultList[0]);
148 145
149 /** 146 /**
150 * Return `true` if the [newRegion] does not overlap any of the regions in 147 * Return `true` if the [newRegion] does not overlap any of the regions in
151 * the collection of [mergedRegions]. 148 * the collection of [mergedRegions].
152 */ 149 */
153 bool isNonOverlapping(FoldingRegion newRegion) { 150 bool isNonOverlapping(FoldingRegion newRegion) {
154 int newStart = newRegion.offset; 151 int newStart = newRegion.offset;
155 int newEnd = newStart + newRegion.length; 152 int newEnd = newStart + newRegion.length;
156 for (FoldingRegion existingRegion in mergedRegions) { 153 for (FoldingRegion existingRegion in mergedRegions) {
157 int existingStart = existingRegion.offset; 154 int existingStart = existingRegion.offset;
(...skipping 52 matching lines...) Expand 10 before | Expand all | Expand 10 after
210 AnalysisNavigationParams mergeNavigation( 207 AnalysisNavigationParams mergeNavigation(
211 List<AnalysisNavigationParams> partialResultList) { 208 List<AnalysisNavigationParams> partialResultList) {
212 int count = partialResultList.length; 209 int count = partialResultList.length;
213 if (count == 0) { 210 if (count == 0) {
214 return null; 211 return null;
215 } else if (count == 1) { 212 } else if (count == 1) {
216 return partialResultList[0]; 213 return partialResultList[0];
217 } 214 }
218 AnalysisNavigationParams base = partialResultList[0]; 215 AnalysisNavigationParams base = partialResultList[0];
219 String file = base.file; 216 String file = base.file;
220 List<NavigationRegion> mergedRegions = 217 List<NavigationRegion> mergedRegions = base.regions.toList();
221 new List<NavigationRegion>.from(base.regions); 218 List<NavigationTarget> mergedTargets = base.targets.toList();
222 List<NavigationTarget> mergedTargets = 219 List<String> mergedFiles = base.files.toList();
223 new List<NavigationTarget>.from(base.targets);
224 List<String> mergedFiles = new List<String>.from(base.files);
225 220
226 /** 221 /**
227 * Return `true` if the [newRegion] does not overlap any of the regions in 222 * Return `true` if the [newRegion] does not overlap any of the regions in
228 * the collection of [mergedRegions]. 223 * the collection of [mergedRegions].
229 */ 224 */
230 bool isNonOverlapping(NavigationRegion newRegion) { 225 bool isNonOverlapping(NavigationRegion newRegion) {
231 int newStart = newRegion.offset; 226 int newStart = newRegion.offset;
232 int newEnd = newStart + newRegion.length; 227 int newEnd = newStart + newRegion.length;
233 for (NavigationRegion mergedRegion in mergedRegions) { 228 for (NavigationRegion mergedRegion in mergedRegions) {
234 int mergedStart = mergedRegion.offset; 229 int mergedStart = mergedRegion.offset;
(...skipping 85 matching lines...) Expand 10 before | Expand all | Expand 10 after
320 if (!mergedTargets.contains(target)) { 315 if (!mergedTargets.contains(target)) {
321 if (added) { 316 if (added) {
322 mergedTargets.add(target); 317 mergedTargets.add(target);
323 } else { 318 } else {
324 // 319 //
325 // This is potentially inefficient. If a merged region matches 320 // This is potentially inefficient. If a merged region matches
326 // regions from multiple plugins it will be copied multiple 321 // regions from multiple plugins it will be copied multiple
327 // times. The likelihood seems small enough to not warrant 322 // times. The likelihood seems small enough to not warrant
328 // optimizing this further. 323 // optimizing this further.
329 // 324 //
330 mergedTargets = new List<int>.from(mergedTargets); 325 mergedTargets = mergedTargets.toList();
331 mergedTargets.add(target); 326 mergedTargets.add(target);
332 mergedRegion = new NavigationRegion( 327 mergedRegion = new NavigationRegion(
333 mergedRegion.offset, mergedRegion.length, mergedTargets); 328 mergedRegion.offset, mergedRegion.length, mergedTargets);
334 mergedRegions[index] = mergedRegion; 329 mergedRegions[index] = mergedRegion;
335 added = true; 330 added = true;
336 } 331 }
337 } 332 }
338 } 333 }
339 if (added) { 334 if (added) {
340 mergedTargets.sort(); 335 mergedTargets.sort();
(...skipping 73 matching lines...) Expand 10 before | Expand all | Expand 10 after
414 buffer.write(element.kind.name); 409 buffer.write(element.kind.name);
415 return buffer.toString(); 410 return buffer.toString();
416 } 411 }
417 412
418 int count = partialResultList.length; 413 int count = partialResultList.length;
419 if (count == 0) { 414 if (count == 0) {
420 return <Outline>[]; 415 return <Outline>[];
421 } else if (count == 1) { 416 } else if (count == 1) {
422 return partialResultList[0]; 417 return partialResultList[0];
423 } 418 }
424 List<Outline> mergedOutlines = new List<Outline>.from(partialResultList[0]); 419 List<Outline> mergedOutlines = partialResultList[0].toList();
425 Map<String, Outline> outlineMap = <String, Outline>{}; 420 Map<String, Outline> outlineMap = <String, Outline>{};
426 Map<Outline, Outline> copyMap = <Outline, Outline>{}; 421 Map<Outline, Outline> copyMap = <Outline, Outline>{};
427 422
428 /** 423 /**
429 * Add the given [outline] and all of its children to the [outlineMap]. 424 * Add the given [outline] and all of its children to the [outlineMap].
430 */ 425 */
431 void addToMap(Outline outline) { 426 void addToMap(Outline outline) {
432 String key = computeKey(outline.element); 427 String key = computeKey(outline.element);
433 if (outlineMap.containsKey(key)) { 428 if (outlineMap.containsKey(key)) {
434 // TODO(brianwilkerson) Decide how to handle this more gracefully. 429 // TODO(brianwilkerson) Decide how to handle this more gracefully.
435 throw new StateError('Inconsistent outlines'); 430 throw new StateError('Inconsistent outlines');
436 } 431 }
437 outlineMap[key] = outline; 432 outlineMap[key] = outline;
438 outline.children?.forEach(addToMap); 433 outline.children?.forEach(addToMap);
439 } 434 }
440 435
441 /** 436 /**
442 * Merge the children of the [newOutline] into the list of children of the 437 * Merge the children of the [newOutline] into the list of children of the
443 * [mergedOutline]. 438 * [mergedOutline].
444 */ 439 */
445 void mergeChildren(Outline mergedOutline, Outline newOutline) { 440 void mergeChildren(Outline mergedOutline, Outline newOutline) {
446 for (Outline newChild in newOutline.children) { 441 for (Outline newChild in newOutline.children) {
447 Outline mergedChild = outlineMap[computeKey(newChild.element)]; 442 Outline mergedChild = outlineMap[computeKey(newChild.element)];
448 if (mergedChild == null) { 443 if (mergedChild == null) {
449 // The [newChild] isn't in the existing list. 444 // The [newChild] isn't in the existing list.
450 Outline copiedOutline = copyMap.putIfAbsent( 445 Outline copiedOutline = copyMap.putIfAbsent(
451 mergedOutline, 446 mergedOutline,
452 () => new Outline(mergedOutline.element, mergedOutline.offset, 447 () => new Outline(mergedOutline.element, mergedOutline.offset,
453 mergedOutline.length, 448 mergedOutline.length,
454 children: new List<Outline>.from(mergedOutline.children))); 449 children: mergedOutline.children.toList()));
455 copiedOutline.children.add(newChild); 450 copiedOutline.children.add(newChild);
456 addToMap(newChild); 451 addToMap(newChild);
457 } else { 452 } else {
458 mergeChildren(mergedChild, newChild); 453 mergeChildren(mergedChild, newChild);
459 } 454 }
460 } 455 }
461 } 456 }
462 457
463 mergedOutlines.forEach(addToMap); 458 mergedOutlines.forEach(addToMap);
464 for (int i = 1; i < count; i++) { 459 for (int i = 1; i < count; i++) {
(...skipping 17 matching lines...) Expand all
482 * been updated by the merge process. 477 * been updated by the merge process.
483 */ 478 */
484 Outline traverse(Outline outline) { 479 Outline traverse(Outline outline) {
485 Outline copiedOutline = copyMap[outline]; 480 Outline copiedOutline = copyMap[outline];
486 bool isCopied = copiedOutline != null; 481 bool isCopied = copiedOutline != null;
487 copiedOutline ??= outline; 482 copiedOutline ??= outline;
488 List<Outline> currentChildren = copiedOutline.children; 483 List<Outline> currentChildren = copiedOutline.children;
489 if (currentChildren.isEmpty) { 484 if (currentChildren.isEmpty) {
490 return outline; 485 return outline;
491 } 486 }
492 Iterable<Outline> updatedChildren = 487 List<Outline> updatedChildren =
493 currentChildren.map((Outline child) => traverse(child)); 488 currentChildren.map((Outline child) => traverse(child)).toList();
494 if (currentChildren != updatedChildren) { 489 if (currentChildren != updatedChildren) {
495 if (!isCopied) { 490 if (!isCopied) {
496 return new Outline( 491 return new Outline(
497 copiedOutline.element, copiedOutline.offset, copiedOutline.length, 492 copiedOutline.element, copiedOutline.offset, copiedOutline.length,
498 children: updatedChildren.toList()); 493 children: updatedChildren);
499 } 494 }
500 copiedOutline.children = updatedChildren.toList(); 495 copiedOutline.children = updatedChildren;
501 return copiedOutline; 496 return copiedOutline;
502 } 497 }
503 return outline; 498 return outline;
504 } 499 }
505 500
506 for (int i = 0; i < mergedOutlines.length; i++) { 501 for (int i = 0; i < mergedOutlines.length; i++) {
507 mergedOutlines[i] = traverse(mergedOutlines[i]); 502 mergedOutlines[i] = traverse(mergedOutlines[i]);
508 } 503 }
509 return mergedOutlines; 504 return mergedOutlines;
510 } 505 }
(...skipping 22 matching lines...) Expand all
533 if (first is ConvertGetterToMethodFeedback) { 528 if (first is ConvertGetterToMethodFeedback) {
534 // The feedbacks are empty, so there's nothing to merge. 529 // The feedbacks are empty, so there's nothing to merge.
535 return first; 530 return first;
536 } else if (first is ConvertMethodToGetterFeedback) { 531 } else if (first is ConvertMethodToGetterFeedback) {
537 // The feedbacks are empty, so there's nothing to merge. 532 // The feedbacks are empty, so there's nothing to merge.
538 return first; 533 return first;
539 } else if (first is ExtractLocalVariableFeedback) { 534 } else if (first is ExtractLocalVariableFeedback) {
540 List<int> coveringExpressionOffsets = 535 List<int> coveringExpressionOffsets =
541 first.coveringExpressionOffsets == null 536 first.coveringExpressionOffsets == null
542 ? <int>[] 537 ? <int>[]
543 : new List<int>.from(first.coveringExpressionOffsets); 538 : first.coveringExpressionOffsets.toList();
544 List<int> coveringExpressionLengths = 539 List<int> coveringExpressionLengths =
545 first.coveringExpressionLengths == null 540 first.coveringExpressionLengths == null
546 ? <int>[] 541 ? <int>[]
547 : new List<int>.from(first.coveringExpressionLengths); 542 : first.coveringExpressionLengths.toList();
548 List<String> names = new List<String>.from(first.names); 543 List<String> names = first.names.toList();
549 List<int> offsets = new List<int>.from(first.offsets); 544 List<int> offsets = first.offsets.toList();
550 List<int> lengths = new List<int>.from(first.lengths); 545 List<int> lengths = first.lengths.toList();
551 for (int i = 1; i < count; i++) { 546 for (int i = 1; i < count; i++) {
552 ExtractLocalVariableFeedback feedback = feedbacks[i]; 547 ExtractLocalVariableFeedback feedback = feedbacks[i];
553 // TODO(brianwilkerson) This doesn't ensure that the covering data is in 548 // TODO(brianwilkerson) This doesn't ensure that the covering data is in
554 // the right order and consistent. 549 // the right order and consistent.
555 if (feedback.coveringExpressionOffsets != null) { 550 if (feedback.coveringExpressionOffsets != null) {
556 coveringExpressionOffsets.addAll(feedback.coveringExpressionOffsets); 551 coveringExpressionOffsets.addAll(feedback.coveringExpressionOffsets);
557 } 552 }
558 if (feedback.coveringExpressionLengths != null) { 553 if (feedback.coveringExpressionLengths != null) {
559 coveringExpressionLengths.addAll(feedback.coveringExpressionLengths); 554 coveringExpressionLengths.addAll(feedback.coveringExpressionLengths);
560 } 555 }
561 for (String name in feedback.names) { 556 for (String name in feedback.names) {
562 if (!names.contains(name)) { 557 if (!names.contains(name)) {
563 names.add(name); 558 names.add(name);
564 } 559 }
565 } 560 }
566 offsets.addAll(feedback.offsets); 561 offsets.addAll(feedback.offsets);
567 lengths.addAll(feedback.lengths); 562 lengths.addAll(feedback.lengths);
568 } 563 }
569 return new ExtractLocalVariableFeedback(names.toList(), offsets, lengths, 564 return new ExtractLocalVariableFeedback(names.toList(), offsets, lengths,
570 coveringExpressionOffsets: (coveringExpressionOffsets.isEmpty 565 coveringExpressionOffsets: (coveringExpressionOffsets.isEmpty
571 ? null 566 ? null
572 : coveringExpressionOffsets), 567 : coveringExpressionOffsets),
573 coveringExpressionLengths: (coveringExpressionLengths.isEmpty 568 coveringExpressionLengths: (coveringExpressionLengths.isEmpty
574 ? null 569 ? null
575 : coveringExpressionLengths)); 570 : coveringExpressionLengths));
576 } else if (first is ExtractMethodFeedback) { 571 } else if (first is ExtractMethodFeedback) {
577 int offset = first.offset; 572 int offset = first.offset;
578 int length = first.length; 573 int length = first.length;
579 String returnType = first.returnType; 574 String returnType = first.returnType;
580 List<String> names = new List<String>.from(first.names); 575 List<String> names = first.names.toList();
581 bool canCreateGetter = first.canCreateGetter; 576 bool canCreateGetter = first.canCreateGetter;
582 List<RefactoringMethodParameter> parameters = first.parameters; 577 List<RefactoringMethodParameter> parameters = first.parameters;
583 List<int> offsets = new List<int>.from(first.offsets); 578 List<int> offsets = first.offsets.toList();
584 List<int> lengths = new List<int>.from(first.lengths); 579 List<int> lengths = first.lengths.toList();
585 for (int i = 1; i < count; i++) { 580 for (int i = 1; i < count; i++) {
586 ExtractMethodFeedback feedback = feedbacks[i]; 581 ExtractMethodFeedback feedback = feedbacks[i];
587 if (returnType.isEmpty) { 582 if (returnType.isEmpty) {
588 returnType = feedback.returnType; 583 returnType = feedback.returnType;
589 } 584 }
590 for (String name in feedback.names) { 585 for (String name in feedback.names) {
591 if (!names.contains(name)) { 586 if (!names.contains(name)) {
592 names.add(name); 587 names.add(name);
593 } 588 }
594 } 589 }
(...skipping 86 matching lines...) Expand 10 before | Expand all | Expand 10 after
681 return null; 676 return null;
682 } else if (count == 1) { 677 } else if (count == 1) {
683 return changes[0]; 678 return changes[0];
684 } 679 }
685 SourceChange first = changes[0]; 680 SourceChange first = changes[0];
686 String message = first.message; 681 String message = first.message;
687 Map<String, SourceFileEdit> editMap = <String, SourceFileEdit>{}; 682 Map<String, SourceFileEdit> editMap = <String, SourceFileEdit>{};
688 for (SourceFileEdit edit in first.edits) { 683 for (SourceFileEdit edit in first.edits) {
689 editMap[edit.file] = edit; 684 editMap[edit.file] = edit;
690 } 685 }
691 List<LinkedEditGroup> linkedEditGroups = 686 List<LinkedEditGroup> linkedEditGroups = first.linkedEditGroups.toList();
692 new List<LinkedEditGroup>.from(first.linkedEditGroups);
693 Position selection = first.selection; 687 Position selection = first.selection;
694 for (int i = 1; i < count; i++) { 688 for (int i = 1; i < count; i++) {
695 SourceChange change = changes[i]; 689 SourceChange change = changes[i];
696 for (SourceFileEdit edit in change.edits) { 690 for (SourceFileEdit edit in change.edits) {
697 SourceFileEdit mergedEdit = editMap[edit.file]; 691 SourceFileEdit mergedEdit = editMap[edit.file];
698 if (mergedEdit == null) { 692 if (mergedEdit == null) {
699 editMap[edit.file] = edit; 693 editMap[edit.file] = edit;
700 } else { 694 } else {
701 // This doesn't detect if multiple plugins contribute the same (or 695 // This doesn't detect if multiple plugins contribute the same (or
702 // conflicting) edits. 696 // conflicting) edits.
703 List<SourceEdit> edits = 697 List<SourceEdit> edits = mergedEdit.edits.toList();
704 new List<SourceEdit>.from(mergedEdit.edits);
705 edits.addAll(edit.edits); 698 edits.addAll(edit.edits);
706 editMap[edit.file] = new SourceFileEdit( 699 editMap[edit.file] = new SourceFileEdit(
707 mergedEdit.file, mergedEdit.fileStamp, 700 mergedEdit.file, mergedEdit.fileStamp,
708 edits: edits); 701 edits: edits);
709 } 702 }
710 } 703 }
711 linkedEditGroups.addAll(change.linkedEditGroups); 704 linkedEditGroups.addAll(change.linkedEditGroups);
712 message ??= change.message; 705 message ??= change.message;
713 selection ??= change.selection; 706 selection ??= change.selection;
714 } 707 }
715 return new SourceChange(message, 708 return new SourceChange(message,
716 edits: editMap.values.toList(), 709 edits: editMap.values.toList(),
717 linkedEditGroups: linkedEditGroups, 710 linkedEditGroups: linkedEditGroups,
718 selection: selection); 711 selection: selection);
719 } 712 }
720 713
721 int count = partialResultList.length; 714 int count = partialResultList.length;
722 if (count == 0) { 715 if (count == 0) {
723 return null; 716 return null;
724 } else if (count == 1) { 717 } else if (count == 1) {
725 return partialResultList[0]; 718 return partialResultList[0];
726 } 719 }
727 EditGetRefactoringResult result = partialResultList[0]; 720 EditGetRefactoringResult result = partialResultList[0];
728 List<RefactoringProblem> initialProblems = 721 List<RefactoringProblem> initialProblems = result.initialProblems.toList();
729 new List<RefactoringProblem>.from(result.initialProblems); 722 List<RefactoringProblem> optionsProblems = result.optionsProblems.toList();
730 List<RefactoringProblem> optionsProblems = 723 List<RefactoringProblem> finalProblems = result.finalProblems.toList();
731 new List<RefactoringProblem>.from(result.optionsProblems);
732 List<RefactoringProblem> finalProblems =
733 new List<RefactoringProblem>.from(result.finalProblems);
734 List<RefactoringFeedback> feedbacks = <RefactoringFeedback>[]; 724 List<RefactoringFeedback> feedbacks = <RefactoringFeedback>[];
735 if (result.feedback != null) { 725 if (result.feedback != null) {
736 feedbacks.add(result.feedback); 726 feedbacks.add(result.feedback);
737 } 727 }
738 List<SourceChange> changes = <SourceChange>[]; 728 List<SourceChange> changes = <SourceChange>[];
739 if (result.change != null) { 729 if (result.change != null) {
740 changes.add(result.change); 730 changes.add(result.change);
741 } 731 }
742 List<String> potentialEdits = new List<String>.from(result.potentialEdits); 732 List<String> potentialEdits = result.potentialEdits.toList();
743 for (int i = 1; i < count; i++) { 733 for (int i = 1; i < count; i++) {
744 EditGetRefactoringResult result = partialResultList[1]; 734 EditGetRefactoringResult result = partialResultList[1];
745 initialProblems.addAll(result.initialProblems); 735 initialProblems.addAll(result.initialProblems);
746 optionsProblems.addAll(result.optionsProblems); 736 optionsProblems.addAll(result.optionsProblems);
747 finalProblems.addAll(result.finalProblems); 737 finalProblems.addAll(result.finalProblems);
748 if (result.feedback != null) { 738 if (result.feedback != null) {
749 feedbacks.add(result.feedback); 739 feedbacks.add(result.feedback);
750 } 740 }
751 if (result.change != null) { 741 if (result.change != null) {
752 changes.add(result.change); 742 changes.add(result.change);
(...skipping 43 matching lines...) Expand 10 before | Expand all | Expand 10 after
796 if (leftEnd < rightStart || leftStart > rightEnd) { 786 if (leftEnd < rightStart || leftStart > rightEnd) {
797 return false; 787 return false;
798 } 788 }
799 if (!allowNesting) { 789 if (!allowNesting) {
800 return true; 790 return true;
801 } 791 }
802 return !((leftStart <= rightStart && rightEnd <= leftEnd) || 792 return !((leftStart <= rightStart && rightEnd <= leftEnd) ||
803 (rightStart <= leftStart && leftEnd <= rightEnd)); 793 (rightStart <= leftStart && leftEnd <= rightEnd));
804 } 794 }
805 } 795 }
OLDNEW
« no previous file with comments | « pkg/analysis_server/lib/src/plugin/result_collector.dart ('k') | pkg/analyzer_plugin/lib/plugin/plugin.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698