| OLD | NEW |
| 1 // Copyright (c) 2015, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2015, 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 /// Tracks the shape of the import/export graph and dependencies between files. | 5 /// Tracks the shape of the import/export graph and dependencies between files. |
| 6 library dev_compiler.src.dependency_graph; | 6 library dev_compiler.src.dependency_graph; |
| 7 | 7 |
| 8 import 'dart:collection' show HashSet; | 8 import 'dart:collection' show HashSet; |
| 9 | 9 |
| 10 import 'package:analyzer/analyzer.dart' show parseDirectives; | 10 import 'package:analyzer/analyzer.dart' show parseDirectives; |
| (...skipping 79 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 90 | 90 |
| 91 /// Direct dependencies in the [SourceGraph]. These include script tags for | 91 /// Direct dependencies in the [SourceGraph]. These include script tags for |
| 92 /// [HtmlSourceNode]s; and imports, exports and parts for [DartSourceNode]s. | 92 /// [HtmlSourceNode]s; and imports, exports and parts for [DartSourceNode]s. |
| 93 Iterable<SourceNode> get allDeps => const []; | 93 Iterable<SourceNode> get allDeps => const []; |
| 94 | 94 |
| 95 /// Like [allDeps] but excludes parts for [DartSourceNode]s. For many | 95 /// Like [allDeps] but excludes parts for [DartSourceNode]s. For many |
| 96 /// operations we mainly care about dependencies at the library level, so | 96 /// operations we mainly care about dependencies at the library level, so |
| 97 /// parts are excluded from this list. | 97 /// parts are excluded from this list. |
| 98 Iterable<SourceNode> get depsWithoutParts => const []; | 98 Iterable<SourceNode> get depsWithoutParts => const []; |
| 99 | 99 |
| 100 SourceNode(this.uri, this.source); | 100 SourceNode(this.uri, this.source) { |
| 101 assert(source != null); |
| 102 } |
| 101 | 103 |
| 102 /// Check for whether the file has changed and, if so, mark [needsRebuild] and | 104 /// Check for whether the file has changed and, if so, mark [needsRebuild] and |
| 103 /// [structureChanged] as necessary. | 105 /// [structureChanged] as necessary. |
| 104 void update(SourceGraph graph) { | 106 void update(SourceGraph graph) { |
| 105 int newStamp = source.modificationStamp; | 107 int newStamp = source.modificationStamp; |
| 106 if (newStamp > _lastStamp) { | 108 if (newStamp > _lastStamp) { |
| 107 _lastStamp = newStamp; | 109 _lastStamp = newStamp; |
| 108 needsRebuild = true; | 110 needsRebuild = true; |
| 109 } | 111 } |
| 110 } | 112 } |
| (...skipping 297 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 408 helper(start); | 410 helper(start); |
| 409 } | 411 } |
| 410 | 412 |
| 411 bool _same(Set a, Set b) => a.length == b.length && a.containsAll(b); | 413 bool _same(Set a, Set b) => a.length == b.length && a.containsAll(b); |
| 412 | 414 |
| 413 /// An error message discovered while parsing the dependencies between files. | 415 /// An error message discovered while parsing the dependencies between files. |
| 414 class DependencyGraphError extends MessageWithSpan { | 416 class DependencyGraphError extends MessageWithSpan { |
| 415 const DependencyGraphError(String message, SourceSpan span) | 417 const DependencyGraphError(String message, SourceSpan span) |
| 416 : super(message, Level.SEVERE, span); | 418 : super(message, Level.SEVERE, span); |
| 417 } | 419 } |
| OLD | NEW |