| 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 3574 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3585 // cycle information for all nodes that are between the target and the | 3585 // cycle information for all nodes that are between the target and the |
| 3586 // node in the topological order. For simplicity, we simply invalidate | 3586 // node in the topological order. For simplicity, we simply invalidate |
| 3587 // all nodes which are reachable from the the source node. | 3587 // all nodes which are reachable from the the source node. |
| 3588 // Note that in the invalidation phase, we do not cut off when we encounter | 3588 // Note that in the invalidation phase, we do not cut off when we encounter |
| 3589 // a node with no library cycle information, since we do not know whether | 3589 // a node with no library cycle information, since we do not know whether |
| 3590 // we are in the case where invalidation has already been performed, or we | 3590 // we are in the case where invalidation has already been performed, or we |
| 3591 // are in the case where library cycles have simply never been computed from | 3591 // are in the case where library cycles have simply never been computed from |
| 3592 // a newly reachable node. | 3592 // a newly reachable node. |
| 3593 Set<LibraryElementImpl> active = new HashSet(); | 3593 Set<LibraryElementImpl> active = new HashSet(); |
| 3594 void invalidate(LibraryElement library) { | 3594 void invalidate(LibraryElement library) { |
| 3595 if (library is LibraryElementHandle) { |
| 3596 library = (library as LibraryElementHandle).actualElement; |
| 3597 } |
| 3595 LibraryElementImpl libraryImpl = library; | 3598 LibraryElementImpl libraryImpl = library; |
| 3596 if (active.add(libraryImpl)) { | 3599 if (active.add(libraryImpl)) { |
| 3597 if (libraryImpl._libraryCycle != null) { | 3600 if (libraryImpl._libraryCycle != null) { |
| 3598 libraryImpl._libraryCycle.forEach(invalidate); | 3601 libraryImpl._libraryCycle.forEach(invalidate); |
| 3599 libraryImpl._libraryCycle = null; | 3602 libraryImpl._libraryCycle = null; |
| 3600 } | 3603 } |
| 3601 library.exportedLibraries.forEach(invalidate); | 3604 library.exportedLibraries.forEach(invalidate); |
| 3602 library.importedLibraries.forEach(invalidate); | 3605 library.importedLibraries.forEach(invalidate); |
| 3603 } | 3606 } |
| 3604 } | 3607 } |
| (...skipping 1319 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 4924 | 4927 |
| 4925 @override | 4928 @override |
| 4926 void visitElement(Element element) { | 4929 void visitElement(Element element) { |
| 4927 int offset = element.nameOffset; | 4930 int offset = element.nameOffset; |
| 4928 if (offset != -1) { | 4931 if (offset != -1) { |
| 4929 map[offset] = element; | 4932 map[offset] = element; |
| 4930 } | 4933 } |
| 4931 super.visitElement(element); | 4934 super.visitElement(element); |
| 4932 } | 4935 } |
| 4933 } | 4936 } |
| OLD | NEW |