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

Unified Diff: pkg/analyzer_experimental/lib/analyzer.dart

Issue 21162003: Fix for NPE when convert error without source. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Tweaks for path to Source convertion in parseDartFile() Created 7 years, 5 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: pkg/analyzer_experimental/lib/analyzer.dart
diff --git a/pkg/analyzer_experimental/lib/analyzer.dart b/pkg/analyzer_experimental/lib/analyzer.dart
index 2a9d9ac46ce19505aaf326d9d3dc0de9156d4a44..cbe76e3ae9da9f1f0ab1a992b0977b2638497ee7 100644
--- a/pkg/analyzer_experimental/lib/analyzer.dart
+++ b/pkg/analyzer_experimental/lib/analyzer.dart
@@ -26,7 +26,13 @@ CompilationUnit parseDartFile(String path) {
var contents = new File(path).readAsStringSync();
var errorCollector = new _ErrorCollector();
var sourceFactory = new SourceFactory.con2([new FileUriResolver()]);
- var source = sourceFactory.forUri(pathos.toUri(path).toString());
+
+ var absolutePath = pathos.absolute(path);
+ var source = sourceFactory.forUri(pathos.toUri(absolutePath).toString());
+ if (source == null) {
Brian Wilkerson 2013/07/30 14:03:01 We might also want to check whether the source exi
+ throw new ArgumentError("Can't get source for path $path");
+ }
+
var scanner = new StringScanner(source, contents, errorCollector);
var token = scanner.tokenize();
var parser = new Parser(source, errorCollector);
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698