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 116 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
127 Iterable<SourceNode> get allDeps => [scripts, runtimeDeps].expand((e) => e); | 127 Iterable<SourceNode> get allDeps => [scripts, runtimeDeps].expand((e) => e); |
128 | 128 |
129 @override | 129 @override |
130 Iterable<SourceNode> get depsWithoutParts => allDeps; | 130 Iterable<SourceNode> get depsWithoutParts => allDeps; |
131 | 131 |
132 /// Parsed document, updated whenever [update] is invoked. | 132 /// Parsed document, updated whenever [update] is invoked. |
133 Document document; | 133 Document document; |
134 | 134 |
135 HtmlSourceNode(uri, source, graph) : super(uri, source) { | 135 HtmlSourceNode(uri, source, graph) : super(uri, source) { |
136 var prefix = 'package:dev_compiler/runtime'; | 136 var prefix = 'package:dev_compiler/runtime'; |
137 var files = ['harmony_feature_check.js', 'dart_runtime.js']; | 137 var files = ['harmony_feature_check.js', 'dart_runtime.js', 'dart_core.js']; |
138 if (graph._options.serverMode) { | 138 if (graph._options.serverMode) { |
139 files.addAll(const ['messages_widget.js', 'messages.css']); | 139 files.addAll(const ['messages_widget.js', 'messages.css']); |
140 } | 140 } |
141 files.forEach((file) { | 141 files.forEach((file) { |
142 runtimeDeps.add(graph.nodeFromUri(Uri.parse('$prefix/$file'))); | 142 runtimeDeps.add(graph.nodeFromUri(Uri.parse('$prefix/$file'))); |
143 }); | 143 }); |
144 } | 144 } |
145 | 145 |
146 void update(SourceGraph graph) { | 146 void update(SourceGraph graph) { |
147 super.update(graph); | 147 super.update(graph); |
(...skipping 260 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
408 helper(start); | 408 helper(start); |
409 } | 409 } |
410 | 410 |
411 bool _same(Set a, Set b) => a.length == b.length && a.containsAll(b); | 411 bool _same(Set a, Set b) => a.length == b.length && a.containsAll(b); |
412 | 412 |
413 /// An error message discovered while parsing the dependencies between files. | 413 /// An error message discovered while parsing the dependencies between files. |
414 class DependencyGraphError extends MessageWithSpan { | 414 class DependencyGraphError extends MessageWithSpan { |
415 const DependencyGraphError(String message, SourceSpan span) | 415 const DependencyGraphError(String message, SourceSpan span) |
416 : super(message, Level.SEVERE, span); | 416 : super(message, Level.SEVERE, span); |
417 } | 417 } |
OLD | NEW |