| OLD | NEW |
| 1 // Copyright (c) 2014, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2014, 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 analyzer.src.dart.element.element; | 5 library analyzer.src.dart.element.element; |
| 6 | 6 |
| 7 import 'dart:collection'; | 7 import 'dart:collection'; |
| 8 import 'dart:math' show min; | 8 import 'dart:math' show min; |
| 9 | 9 |
| 10 import 'package:analyzer/dart/ast/ast.dart'; | 10 import 'package:analyzer/dart/ast/ast.dart'; |
| (...skipping 5854 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 5865 } | 5865 } |
| 5866 } | 5866 } |
| 5867 return null; | 5867 return null; |
| 5868 } | 5868 } |
| 5869 | 5869 |
| 5870 /** Given an update to this library which may have added or deleted edges | 5870 /** Given an update to this library which may have added or deleted edges |
| 5871 * in the import/export graph originating from this node only, remove any | 5871 * in the import/export graph originating from this node only, remove any |
| 5872 * cached library cycles in the element model which may have been invalidated. | 5872 * cached library cycles in the element model which may have been invalidated. |
| 5873 */ | 5873 */ |
| 5874 void invalidateLibraryCycles() { | 5874 void invalidateLibraryCycles() { |
| 5875 if (_libraryCycle == null) { | |
| 5876 // We have already invalidated this node, or we have never computed | |
| 5877 // library cycle information for it. In the former case, we're done. In | |
| 5878 // the latter case, this node cannot be reachable from any node for which | |
| 5879 // we have computed library cycle information. Therefore, any edges added | |
| 5880 // or deleted in the update causing this invalidation can only be edges to | |
| 5881 // nodes which either have no library cycle information (and hence do not | |
| 5882 // need invalidation), or which do not reach this node by any path. | |
| 5883 // In either case, no further invalidation is needed. | |
| 5884 return; | |
| 5885 } | |
| 5886 // If we have pre-computed library cycle information, then we must | 5875 // If we have pre-computed library cycle information, then we must |
| 5887 // invalidate the information both on this element, and on certain | 5876 // invalidate the information both on this element, and on certain |
| 5888 // other elements. Edges originating at this node may have been | 5877 // other elements. Edges originating at this node may have been |
| 5889 // added or deleted. A deleted edge that points outside of this cycle | 5878 // added or deleted. A deleted edge that points outside of this cycle |
| 5890 // cannot change the cycle information for anything outside of this cycle, | 5879 // cannot change the cycle information for anything outside of this cycle, |
| 5891 // and so it is sufficient to delete the cached library information on this | 5880 // and so it is sufficient to delete the cached library information on this |
| 5892 // cycle. An added edge which points to another node within the cycle | 5881 // cycle. An added edge which points to another node within the cycle |
| 5893 // only invalidates the cycle. An added edge which points to a node earlier | 5882 // only invalidates the cycle. An added edge which points to a node earlier |
| 5894 // in the topological sort of cycles induces no invalidation (since there | 5883 // in the topological sort of cycles induces no invalidation (since there |
| 5895 // are by definition no back edges from earlier cycles in the topological | 5884 // are by definition no back edges from earlier cycles in the topological |
| (...skipping 2590 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 8486 | 8475 |
| 8487 @override | 8476 @override |
| 8488 void visitElement(Element element) { | 8477 void visitElement(Element element) { |
| 8489 int offset = element.nameOffset; | 8478 int offset = element.nameOffset; |
| 8490 if (offset != -1) { | 8479 if (offset != -1) { |
| 8491 map[offset] = element; | 8480 map[offset] = element; |
| 8492 } | 8481 } |
| 8493 super.visitElement(element); | 8482 super.visitElement(element); |
| 8494 } | 8483 } |
| 8495 } | 8484 } |
| OLD | NEW |