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, HashMap; | 8 import 'dart:collection' show HashSet, HashMap; |
9 | 9 |
10 import 'package:analyzer/analyzer.dart' show parseDirectives; | 10 import 'package:analyzer/analyzer.dart' show parseDirectives; |
(...skipping 283 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
294 | 294 |
295 var directiveUri = (d as UriBasedDirective).uri; | 295 var directiveUri = (d as UriBasedDirective).uri; |
296 | 296 |
297 // `dart:core` and other similar URLs only contain a name, but it is | 297 // `dart:core` and other similar URLs only contain a name, but it is |
298 // meant to be a folder when resolving relative paths from it. | 298 // meant to be a folder when resolving relative paths from it. |
299 var targetUri = uri.scheme == 'dart' && uri.pathSegments.length == 1 | 299 var targetUri = uri.scheme == 'dart' && uri.pathSegments.length == 1 |
300 ? Uri.parse('$uri/').resolve(directiveUri.stringValue) | 300 ? Uri.parse('$uri/').resolve(directiveUri.stringValue) |
301 : uri.resolve(directiveUri.stringValue); | 301 : uri.resolve(directiveUri.stringValue); |
302 var target = | 302 var target = |
303 ParseDartTask.resolveDirective(graph._context, _source, d, null); | 303 ParseDartTask.resolveDirective(graph._context, _source, d, null); |
304 if (target != null) { | |
305 if (targetUri != target.uri) print(">> ${target.uri} $targetUri"); | |
306 } | |
307 var node = graph.nodes.putIfAbsent( | 304 var node = graph.nodes.putIfAbsent( |
308 targetUri, () => new DartSourceNode(graph, targetUri, target)); | 305 targetUri, () => new DartSourceNode(graph, targetUri, target)); |
309 //var node = graph.nodeFromUri(targetUri); | 306 //var node = graph.nodeFromUri(targetUri); |
310 if (node._source == null || !node._source.exists()) { | 307 if (node._source == null || !node._source.exists()) { |
311 _reportError(graph, 'File $targetUri not found', unit, d); | 308 _reportError(graph, 'File $targetUri not found', unit, d); |
312 } | 309 } |
313 | 310 |
314 if (d is ImportDirective) { | 311 if (d is ImportDirective) { |
315 newImports.add(node); | 312 newImports.add(node); |
316 } else if (d is ExportDirective) { | 313 } else if (d is ExportDirective) { |
(...skipping 214 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
531 'dart._interceptors', | 528 'dart._interceptors', |
532 'dart._native_typed_data', | 529 'dart._native_typed_data', |
533 */ | 530 */ |
534 ]; | 531 ]; |
535 | 532 |
536 /// Runtime files added to applications when running in server mode. | 533 /// Runtime files added to applications when running in server mode. |
537 final runtimeFilesForServerMode = new List<String>.from(defaultRuntimeFiles) | 534 final runtimeFilesForServerMode = new List<String>.from(defaultRuntimeFiles) |
538 ..addAll(const ['messages_widget.js', 'messages.css']); | 535 ..addAll(const ['messages_widget.js', 'messages.css']); |
539 | 536 |
540 final _log = new Logger('dev_compiler.dependency_graph'); | 537 final _log = new Logger('dev_compiler.dependency_graph'); |
OLD | NEW |