| OLD | NEW |
| 1 library angular.source_crawler_impl; | 1 library angular.source_crawler_impl; |
| 2 | 2 |
| 3 import 'dart:io'; | 3 import 'dart:io'; |
| 4 import 'package:analyzer/analyzer.dart'; | 4 import 'package:analyzer/analyzer.dart'; |
| 5 import 'package:angular/tools/source_crawler.dart'; | 5 import 'package:angular/tools/source_crawler.dart'; |
| 6 | 6 |
| 7 const String PACKAGE_PREFIX = 'package:'; | 7 const String PACKAGE_PREFIX = 'package:'; |
| 8 | 8 |
| 9 /** | 9 /** |
| 10 * Dart source file crawler. As it crawls Dart source, it calls | 10 * Dart source file crawler. As it crawls Dart source, it calls |
| (...skipping 27 matching lines...) Expand all Loading... |
| 38 CompilationUnit cu = parseDartFile(currentFile); | 38 CompilationUnit cu = parseDartFile(currentFile); |
| 39 processImports(cu, currentDir, currentFile, visited, toVisit); | 39 processImports(cu, currentDir, currentFile, visited, toVisit); |
| 40 visitor(cu); | 40 visitor(cu); |
| 41 } | 41 } |
| 42 } | 42 } |
| 43 | 43 |
| 44 void processImports(CompilationUnit cu, String currentDir, | 44 void processImports(CompilationUnit cu, String currentDir, |
| 45 String currentFile, List<String> visited, | 45 String currentFile, List<String> visited, |
| 46 List<String> toVisit) { | 46 List<String> toVisit) { |
| 47 cu.directives.forEach((Directive directive) { | 47 cu.directives.forEach((Directive directive) { |
| 48 if (directive is ImportDirective || directive is PartDirective) { | 48 if (directive is ImportDirective || |
| 49 directive is PartDirective || |
| 50 directive is ExportDirective) { |
| 49 UriBasedDirective import = directive; | 51 UriBasedDirective import = directive; |
| 50 String canonicalFile = canonicalizeImportPath( | 52 String canonicalFile = canonicalizeImportPath( |
| 51 currentDir, currentFile, import.uri.stringValue); | 53 currentDir, currentFile, import.uri.stringValue); |
| 52 if (canonicalFile == null) return; | 54 if (canonicalFile == null) return; |
| 53 if (!visited.contains(canonicalFile) && | 55 if (!visited.contains(canonicalFile) && |
| 54 !toVisit.contains(canonicalFile)) { | 56 !toVisit.contains(canonicalFile)) { |
| 55 toVisit.add(canonicalFile); | 57 toVisit.add(canonicalFile); |
| 56 } | 58 } |
| 57 } | 59 } |
| 58 }); | 60 }); |
| (...skipping 30 matching lines...) Expand all Loading... |
| 89 } | 91 } |
| 90 | 92 |
| 91 String _packageUriResolver(String uri, String packageRoot) { | 93 String _packageUriResolver(String uri, String packageRoot) { |
| 92 var packagePath = uri.substring(PACKAGE_PREFIX.length); | 94 var packagePath = uri.substring(PACKAGE_PREFIX.length); |
| 93 if (!packageRoot.endsWith('/')) { | 95 if (!packageRoot.endsWith('/')) { |
| 94 packageRoot = packageRoot + '/'; | 96 packageRoot = packageRoot + '/'; |
| 95 } | 97 } |
| 96 return packageRoot + packagePath; | 98 return packageRoot + packagePath; |
| 97 } | 99 } |
| 98 } | 100 } |
| OLD | NEW |