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

Side by Side Diff: lib/src/dependency_graph.dart

Issue 1160223006: Fix DDC errors on DDC (Closed) Base URL: https://github.com/dart-lang/dev_compiler.git@master
Patch Set: address comments Created 5 years, 6 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 unified diff | Download patch
« no previous file with comments | « lib/src/codegen/side_effect_analysis.dart ('k') | lib/src/info.dart » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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;
11 import 'package:analyzer/src/generated/ast.dart' 11 import 'package:analyzer/src/generated/ast.dart'
12 show 12 show
13 AstNode, 13 AstNode,
14 CompilationUnit, 14 CompilationUnit,
15 ExportDirective, 15 ExportDirective,
16 Identifier, 16 Identifier,
17 ImportDirective, 17 ImportDirective,
18 LibraryDirective, 18 LibraryDirective,
19 PartDirective, 19 PartDirective,
20 PartOfDirective; 20 PartOfDirective,
21 UriBasedDirective;
21 import 'package:analyzer/src/generated/engine.dart' 22 import 'package:analyzer/src/generated/engine.dart'
22 show ParseDartTask, AnalysisContext; 23 show ParseDartTask, AnalysisContext;
23 import 'package:analyzer/src/generated/source.dart' show Source, SourceKind; 24 import 'package:analyzer/src/generated/source.dart' show Source, SourceKind;
24 import 'package:html/dom.dart' show Document, Node; 25 import 'package:html/dom.dart' show Document, Node;
25 import 'package:html/parser.dart' as html; 26 import 'package:html/parser.dart' as html;
26 import 'package:logging/logging.dart' show Logger, Level; 27 import 'package:logging/logging.dart' show Logger, Level;
27 import 'package:path/path.dart' as path; 28 import 'package:path/path.dart' as path;
28 29
29 import 'info.dart'; 30 import 'info.dart';
30 import 'options.dart'; 31 import 'options.dart';
(...skipping 241 matching lines...) Expand 10 before | Expand all | Expand 10 after
272 // changed. 273 // changed.
273 var unit = parseDirectives(contents, name: _source.fullName); 274 var unit = parseDirectives(contents, name: _source.fullName);
274 var newImports = new Set<DartSourceNode>(); 275 var newImports = new Set<DartSourceNode>();
275 var newExports = new Set<DartSourceNode>(); 276 var newExports = new Set<DartSourceNode>();
276 var newParts = new Set<DartSourceNode>(); 277 var newParts = new Set<DartSourceNode>();
277 for (var d in unit.directives) { 278 for (var d in unit.directives) {
278 // Nothing to do for parts. 279 // Nothing to do for parts.
279 if (d is PartOfDirective) return; 280 if (d is PartOfDirective) return;
280 if (d is LibraryDirective) continue; 281 if (d is LibraryDirective) continue;
281 282
283 var directiveUri = (d as UriBasedDirective).uri;
284
282 // `dart:core` and other similar URLs only contain a name, but it is 285 // `dart:core` and other similar URLs only contain a name, but it is
283 // meant to be a folder when resolving relative paths from it. 286 // meant to be a folder when resolving relative paths from it.
284 var targetUri = uri.scheme == 'dart' && uri.pathSegments.length == 1 287 var targetUri = uri.scheme == 'dart' && uri.pathSegments.length == 1
285 ? Uri.parse('$uri/').resolve(d.uri.stringValue) 288 ? Uri.parse('$uri/').resolve(directiveUri.stringValue)
286 : uri.resolve(d.uri.stringValue); 289 : uri.resolve(directiveUri.stringValue);
287 var target = 290 var target =
288 ParseDartTask.resolveDirective(graph._context, _source, d, null); 291 ParseDartTask.resolveDirective(graph._context, _source, d, null);
289 if (target != null) { 292 if (target != null) {
290 if (targetUri != target.uri) print(">> ${target.uri} $targetUri"); 293 if (targetUri != target.uri) print(">> ${target.uri} $targetUri");
291 } 294 }
292 var node = graph.nodes.putIfAbsent( 295 var node = graph.nodes.putIfAbsent(
293 targetUri, () => new DartSourceNode(graph, targetUri, target)); 296 targetUri, () => new DartSourceNode(graph, targetUri, target));
294 //var node = graph.nodeFromUri(targetUri); 297 //var node = graph.nodeFromUri(targetUri);
295 if (node._source == null || !node._source.exists()) { 298 if (node._source == null || !node._source.exists()) {
296 _reportError(graph, 'File $targetUri not found', unit, d); 299 _reportError(graph, 'File $targetUri not found', unit, d);
(...skipping 219 matching lines...) Expand 10 before | Expand all | Expand 10 after
516 'dart._interceptors', 519 'dart._interceptors',
517 'dart._native_typed_data', 520 'dart._native_typed_data',
518 */ 521 */
519 ]; 522 ];
520 523
521 /// Runtime files added to applications when running in server mode. 524 /// Runtime files added to applications when running in server mode.
522 final runtimeFilesForServerMode = new List<String>.from(defaultRuntimeFiles) 525 final runtimeFilesForServerMode = new List<String>.from(defaultRuntimeFiles)
523 ..addAll(const ['messages_widget.js', 'messages.css']); 526 ..addAll(const ['messages_widget.js', 'messages.css']);
524 527
525 final _log = new Logger('dev_compiler.dependency_graph'); 528 final _log = new Logger('dev_compiler.dependency_graph');
OLDNEW
« no previous file with comments | « lib/src/codegen/side_effect_analysis.dart ('k') | lib/src/info.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698