| 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: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 hide AnalysisErrorFixes; | 8 hide AnalysisErrorFixes; |
| 9 import 'package:analyzer_plugin/protocol/protocol_generated.dart' as plugin; | 9 import 'package:analyzer_plugin/protocol/protocol_generated.dart' as plugin; |
| 10 import 'package:meta/meta.dart'; | 10 import 'package:meta/meta.dart'; |
| (...skipping 469 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 480 /** | 480 /** |
| 481 * Perform a depth first traversal of the outline structure rooted at the | 481 * Perform a depth first traversal of the outline structure rooted at the |
| 482 * given [outline] item, re-building each item if any of its children have | 482 * given [outline] item, re-building each item if any of its children have |
| 483 * been updated by the merge process. | 483 * been updated by the merge process. |
| 484 */ | 484 */ |
| 485 Outline traverse(Outline outline) { | 485 Outline traverse(Outline outline) { |
| 486 Outline copiedOutline = copyMap[outline]; | 486 Outline copiedOutline = copyMap[outline]; |
| 487 bool isCopied = copiedOutline != null; | 487 bool isCopied = copiedOutline != null; |
| 488 copiedOutline ??= outline; | 488 copiedOutline ??= outline; |
| 489 List<Outline> currentChildren = copiedOutline.children; | 489 List<Outline> currentChildren = copiedOutline.children; |
| 490 if (currentChildren.isEmpty) { | 490 if (currentChildren == null || currentChildren.isEmpty) { |
| 491 return outline; | 491 return outline; |
| 492 } | 492 } |
| 493 List<Outline> updatedChildren = | 493 List<Outline> updatedChildren = |
| 494 currentChildren.map((Outline child) => traverse(child)).toList(); | 494 currentChildren.map((Outline child) => traverse(child)).toList(); |
| 495 if (currentChildren != updatedChildren) { | 495 if (currentChildren != updatedChildren) { |
| 496 if (!isCopied) { | 496 if (!isCopied) { |
| 497 return new Outline( | 497 return new Outline( |
| 498 copiedOutline.element, copiedOutline.offset, copiedOutline.length, | 498 copiedOutline.element, copiedOutline.offset, copiedOutline.length, |
| 499 children: updatedChildren); | 499 children: updatedChildren); |
| 500 } | 500 } |
| (...skipping 317 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 818 if (leftEnd < rightStart || leftStart > rightEnd) { | 818 if (leftEnd < rightStart || leftStart > rightEnd) { |
| 819 return false; | 819 return false; |
| 820 } | 820 } |
| 821 if (!allowNesting) { | 821 if (!allowNesting) { |
| 822 return true; | 822 return true; |
| 823 } | 823 } |
| 824 return !((leftStart <= rightStart && rightEnd <= leftEnd) || | 824 return !((leftStart <= rightStart && rightEnd <= leftEnd) || |
| 825 (rightStart <= leftStart && leftEnd <= rightEnd)); | 825 (rightStart <= leftStart && leftEnd <= rightEnd)); |
| 826 } | 826 } |
| 827 } | 827 } |
| OLD | NEW |