OLD | NEW |
1 // Copyright (c) 2016, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2016, 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 import 'dart:collection' show HashSet; | 5 import 'dart:collection' show HashSet; |
6 import 'package:args/args.dart' show ArgParser, ArgResults; | 6 import 'package:args/args.dart' show ArgParser, ArgResults; |
7 import 'package:analyzer/analyzer.dart' | 7 import 'package:analyzer/analyzer.dart' |
8 show | 8 show |
9 AnalysisError, | 9 AnalysisError, |
10 CompilationUnit, | 10 CompilationUnit, |
(...skipping 49 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
60 | 60 |
61 // Validate that all parts were explicitly passed in. | 61 // Validate that all parts were explicitly passed in. |
62 // If not, it's an error. | 62 // If not, it's an error. |
63 var explicitParts = new HashSet<Source>(); | 63 var explicitParts = new HashSet<Source>(); |
64 var usedParts = new HashSet<Source>(); | 64 var usedParts = new HashSet<Source>(); |
65 for (var sourcePath in unit.sources) { | 65 for (var sourcePath in unit.sources) { |
66 var sourceUri = Uri.parse(sourcePath); | 66 var sourceUri = Uri.parse(sourcePath); |
67 if (sourceUri.scheme == '') { | 67 if (sourceUri.scheme == '') { |
68 sourceUri = path.toUri(path.absolute(sourcePath)); | 68 sourceUri = path.toUri(path.absolute(sourcePath)); |
69 } | 69 } |
70 Source source = context.sourceFactory.forUri(sourceUri.toString()); | 70 Source source = context.sourceFactory.forUri2(sourceUri); |
71 if (source == null) { | 71 if (source == null) { |
72 throw new AnalysisException('could not create a source for $sourcePath.' | 72 throw new AnalysisException('could not create a source for $sourcePath.' |
73 ' The file name is in the wrong format or was not found.'); | 73 ' The file name is in the wrong format or was not found.'); |
74 } | 74 } |
75 | 75 |
76 // Ignore parts. They need to be handled in the context of their library. | 76 // Ignore parts. They need to be handled in the context of their library. |
77 if (context.computeKindOf(source) == SourceKind.PART) { | 77 if (context.computeKindOf(source) == SourceKind.PART) { |
78 explicitParts.add(source); | 78 explicitParts.add(source); |
79 continue; | 79 continue; |
80 } | 80 } |
(...skipping 210 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
291 } | 291 } |
292 } | 292 } |
293 | 293 |
294 /// (Public for tests) the error code used when a part is missing. | 294 /// (Public for tests) the error code used when a part is missing. |
295 final missingPartErrorCode = const CompileTimeErrorCode( | 295 final missingPartErrorCode = const CompileTimeErrorCode( |
296 'MISSING_PART', 'The part was not supplied as an input to the compiler.'); | 296 'MISSING_PART', 'The part was not supplied as an input to the compiler.'); |
297 | 297 |
298 /// (Public for tests) the error code used when a part is unused. | 298 /// (Public for tests) the error code used when a part is unused. |
299 final unusedPartWarningCode = const StaticWarningCode( | 299 final unusedPartWarningCode = const StaticWarningCode( |
300 'UNUSED_PART', 'The part was not used by any libraries being compiled.'); | 300 'UNUSED_PART', 'The part was not used by any libraries being compiled.'); |
OLD | NEW |