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

Unified Diff: pkg/analysis_server/lib/src/analysis_server.dart

Issue 1113063007: Fix exception in stack trace from issue 23348 (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Address comments Created 5 years, 8 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 | pkg/analysis_server/test/analysis_server_test.dart » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: pkg/analysis_server/lib/src/analysis_server.dart
diff --git a/pkg/analysis_server/lib/src/analysis_server.dart b/pkg/analysis_server/lib/src/analysis_server.dart
index d468ce5bc5a394dbda24fda0db1486f516a63065..121227ac33424e7b8bc7e3bcd702273d9082d530 100644
--- a/pkg/analysis_server/lib/src/analysis_server.dart
+++ b/pkg/analysis_server/lib/src/analysis_server.dart
@@ -425,9 +425,10 @@ class AnalysisServer {
* first context that implicitly analyzes it.
*
* If the [path] is not analyzed by any context, a [ContextSourcePair] with
- * `null` context and `file` [Source] is returned.
+ * a `null` context and `file` [Source] is returned.
*
- * If the [path] dosn't represent a file, `null` is returned as a [Source].
+ * If the [path] dosn't represent a file, a [ContextSourcePair] with a `null`
+ * context and `null` [Source] is returned.
*
* Does not return `null`.
*/
@@ -443,21 +444,21 @@ class AnalysisServer {
}
// try to find the deep-most containing context
Resource resource = resourceProvider.getResource(path);
- File file = resource is File ? resource : null;
+ if (resource is! File) {
+ return new ContextSourcePair(null, null);
+ }
+ File file = resource;
{
AnalysisContext containingContext = getContainingContext(path);
if (containingContext != null) {
- Source source = file != null
- ? ContextManager.createSourceInContext(containingContext, file)
- : null;
+ Source source =
+ ContextManager.createSourceInContext(containingContext, file);
return new ContextSourcePair(containingContext, source);
}
}
// try to find a context that analysed the file
for (AnalysisContext context in folderMap.values) {
- Source source = file != null
- ? ContextManager.createSourceInContext(context, file)
- : null;
+ Source source = ContextManager.createSourceInContext(context, file);
SourceKind kind = context.getKindOf(source);
if (kind != SourceKind.UNKNOWN) {
return new ContextSourcePair(context, source);
@@ -472,7 +473,7 @@ class AnalysisServer {
}
}
// file-based source
- Source fileSource = file != null ? file.createSource() : null;
+ Source fileSource = file.createSource();
return new ContextSourcePair(null, fileSource);
}
« no previous file with comments | « no previous file | pkg/analysis_server/test/analysis_server_test.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698