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

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

Issue 545323002: Add error condition INVALID_OVERLAY_CHANGE to analysis server. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 6 years, 3 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 | « pkg/analysis_server/doc/api.html ('k') | pkg/analysis_server/lib/src/domain_analysis.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 d687353370b85ee3a58d6f520fdef3bd32e82df2..2f40fb0e766223e5f014275ed714804fc09d2166 100644
--- a/pkg/analysis_server/lib/src/analysis_server.dart
+++ b/pkg/analysis_server/lib/src/analysis_server.dart
@@ -497,7 +497,7 @@ class AnalysisServer {
/**
* Implementation for `analysis.updateContent`.
*/
- void updateContent(Map<String, dynamic> changes) {
+ void updateContent(String id, Map<String, dynamic> changes) {
changes.forEach((file, change) {
AnalysisContext analysisContext = getAnalysisContext(file);
// TODO(paulberry): handle the case where a file is referred to by more
@@ -513,7 +513,15 @@ class AnalysisServer {
// currently in the content cache.
TimestampedData<String> oldContents = analysisContext.getContents(
source);
- String newContents = SourceEdit.applySequence(oldContents.data, change.edits);
+ String newContents;
+ try {
+ newContents = SourceEdit.applySequence(oldContents.data,
+ change.edits);
+ } on RangeError {
+ throw new RequestFailure(new Response(id, error: new RequestError(
+ RequestErrorCode.INVALID_OVERLAY_CHANGE,
+ 'Invalid overlay change')));
+ }
// TODO(paulberry): to aid in incremental processing it would be
// better to use setChangedContents.
analysisContext.setContents(source, newContents);
« no previous file with comments | « pkg/analysis_server/doc/api.html ('k') | pkg/analysis_server/lib/src/domain_analysis.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698