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

Side by Side 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: Added test Created 5 years, 7 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 | Annotate | Revision Log
« no previous file with comments | « no previous file | pkg/analysis_server/test/analysis_server_test.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) 2014, the Dart project authors. Please see the AUTHORS file 1 // Copyright (c) 2014, 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 library analysis.server; 5 library analysis.server;
6 6
7 import 'dart:async'; 7 import 'dart:async';
8 import 'dart:collection'; 8 import 'dart:collection';
9 import 'dart:math' show max; 9 import 'dart:math' show max;
10 10
(...skipping 425 matching lines...) Expand 10 before | Expand all | Expand 10 after
436 { 436 {
437 Uri uri = resourceProvider.pathContext.toUri(path); 437 Uri uri = resourceProvider.pathContext.toUri(path);
438 Source sdkSource = defaultSdk.fromFileUri(uri); 438 Source sdkSource = defaultSdk.fromFileUri(uri);
439 if (sdkSource != null) { 439 if (sdkSource != null) {
440 AnalysisContext anyContext = folderMap.values.first; 440 AnalysisContext anyContext = folderMap.values.first;
441 return new ContextSourcePair(anyContext, sdkSource); 441 return new ContextSourcePair(anyContext, sdkSource);
442 } 442 }
443 } 443 }
444 // try to find the deep-most containing context 444 // try to find the deep-most containing context
445 Resource resource = resourceProvider.getResource(path); 445 Resource resource = resourceProvider.getResource(path);
446 File file = resource is File ? resource : null; 446 if (resource is! File) {
447 return null;
scheglov 2015/05/04 15:38:54 This breaks this method's contract. 1. It promise
Brian Wilkerson 2015/05/04 15:55:58 I misread the comment. Done.
448 }
449 File file = resource;
447 { 450 {
448 AnalysisContext containingContext = getContainingContext(path); 451 AnalysisContext containingContext = getContainingContext(path);
449 if (containingContext != null) { 452 if (containingContext != null) {
450 Source source = file != null 453 Source source = file != null
451 ? ContextManager.createSourceInContext(containingContext, file) 454 ? ContextManager.createSourceInContext(containingContext, file)
452 : null; 455 : null;
453 return new ContextSourcePair(containingContext, source); 456 return new ContextSourcePair(containingContext, source);
454 } 457 }
455 } 458 }
456 // try to find a context that analysed the file 459 // try to find a context that analysed the file
457 for (AnalysisContext context in folderMap.values) { 460 for (AnalysisContext context in folderMap.values) {
458 Source source = file != null 461 Source source = file != null
scheglov 2015/05/04 15:38:54 Now we can remove all checks of "file" for null.
Brian Wilkerson 2015/05/04 15:55:58 Done
459 ? ContextManager.createSourceInContext(context, file) 462 ? ContextManager.createSourceInContext(context, file)
460 : null; 463 : null;
461 SourceKind kind = context.getKindOf(source); 464 SourceKind kind = context.getKindOf(source);
462 if (kind != SourceKind.UNKNOWN) { 465 if (kind != SourceKind.UNKNOWN) {
463 return new ContextSourcePair(context, source); 466 return new ContextSourcePair(context, source);
464 } 467 }
465 } 468 }
466 // try to find a context for which the file is a priority source 469 // try to find a context for which the file is a priority source
467 for (InternalAnalysisContext context in folderMap.values) { 470 for (InternalAnalysisContext context in folderMap.values) {
468 List<Source> sources = context.getSourcesWithFullName(path); 471 List<Source> sources = context.getSourcesWithFullName(path);
(...skipping 1030 matching lines...) Expand 10 before | Expand all | Expand 10 after
1499 /** 1502 /**
1500 * The [PerformanceTag] for time spent in server request handlers. 1503 * The [PerformanceTag] for time spent in server request handlers.
1501 */ 1504 */
1502 static PerformanceTag serverRequests = new PerformanceTag('serverRequests'); 1505 static PerformanceTag serverRequests = new PerformanceTag('serverRequests');
1503 1506
1504 /** 1507 /**
1505 * The [PerformanceTag] for time spent in split store microtasks. 1508 * The [PerformanceTag] for time spent in split store microtasks.
1506 */ 1509 */
1507 static PerformanceTag splitStore = new PerformanceTag('splitStore'); 1510 static PerformanceTag splitStore = new PerformanceTag('splitStore');
1508 } 1511 }
OLDNEW
« 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