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

Unified Diff: pkg/front_end/lib/src/dependency_walker.dart

Issue 2907023003: Change dependency walker's Node.dependencies to a static getter. (Closed)
Patch Set: Created 3 years, 7 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « pkg/analyzer/lib/src/summary/link.dart ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: pkg/front_end/lib/src/dependency_walker.dart
diff --git a/pkg/front_end/lib/src/dependency_walker.dart b/pkg/front_end/lib/src/dependency_walker.dart
index 7a27acb7b7f5d372c770f0443cada115e92d500e..e00066ffc690ae3dc64c71008db33e79e4cc9fc5 100644
--- a/pkg/front_end/lib/src/dependency_walker.dart
+++ b/pkg/front_end/lib/src/dependency_walker.dart
@@ -26,11 +26,6 @@ abstract class Node<NodeType> {
List<NodeType> _dependencies;
/**
- * Retrieve the dependencies of this node.
- */
- List<NodeType> get dependencies => _dependencies ??= computeDependencies();
-
- /**
* Indicates whether this node has been evaluated yet.
*/
bool get isEvaluated;
@@ -39,6 +34,13 @@ abstract class Node<NodeType> {
* Compute the dependencies of this node.
*/
List<NodeType> computeDependencies();
+
+ /**
+ * Gets the dependencies of the given node, computing them if necessary.
+ */
+ static List<NodeType> getDependencies<NodeType>(Node<NodeType> node) {
+ return node._dependencies ??= node.computeDependencies();
+ }
}
/**
@@ -97,7 +99,7 @@ abstract class DependencyWalker<NodeType extends Node<NodeType>> {
stack.add(node);
// Consider the node's dependencies one at a time.
- for (NodeType dependency in node.dependencies) {
+ for (NodeType dependency in Node.getDependencies(node)) {
// If the dependency has already been evaluated, it can't be
// part of this node's strongly connected component, so we can
// skip it.
« no previous file with comments | « pkg/analyzer/lib/src/summary/link.dart ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698