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

Side by Side Diff: pkg/analysis_server/lib/src/analysis_server.dart

Issue 668513002: Fix for getAnalysisContext() (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 6 years, 2 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 | no next file » | 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 9
10 import 'package:analyzer/file_system/file_system.dart'; 10 import 'package:analyzer/file_system/file_system.dart';
(...skipping 666 matching lines...) Expand 10 before | Expand all | Expand 10 after
677 return folderMap.values; 677 return folderMap.values;
678 } 678 }
679 679
680 /** 680 /**
681 * Return the [AnalysisContext] that is used to analyze the given [path]. 681 * Return the [AnalysisContext] that is used to analyze the given [path].
682 * Return `null` if there is no such context. 682 * Return `null` if there is no such context.
683 */ 683 */
684 AnalysisContext getAnalysisContext(String path) { 684 AnalysisContext getAnalysisContext(String path) {
685 // try to find a containing context 685 // try to find a containing context
686 for (Folder folder in folderMap.keys) { 686 for (Folder folder in folderMap.keys) {
687 if (path.startsWith(folder.path)) { 687 if (folder.contains(path)) {
688 return folderMap[folder]; 688 return folderMap[folder];
689 } 689 }
690 } 690 }
691 // check if there is a context that analyzed this source 691 // check if there is a context that analyzed this source
692 Source source = getSource(path); 692 Source source = getSource(path);
693 for (AnalysisContext context in folderMap.values) { 693 for (AnalysisContext context in folderMap.values) {
694 SourceKind kind = context.getKindOf(source); 694 SourceKind kind = context.getKindOf(source);
695 if (kind != null) { 695 if (kind != null) {
696 return context; 696 return context;
697 } 697 }
(...skipping 235 matching lines...) Expand 10 before | Expand all | Expand 10 after
933 // send the notification 933 // send the notification
934 channel.sendNotification( 934 channel.sendNotification(
935 new ServerErrorParams( 935 new ServerErrorParams(
936 true, 936 true,
937 exceptionString, 937 exceptionString,
938 stackTraceString).toNotification()); 938 stackTraceString).toNotification());
939 } 939 }
940 } 940 }
941 941
942 typedef void OptionUpdater(AnalysisOptionsImpl options); 942 typedef void OptionUpdater(AnalysisOptionsImpl options);
OLDNEW
« 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