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

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

Issue 335853003: Handle null content in ContentChange. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 6 years, 6 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
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 domain.analysis; 5 library domain.analysis;
6 6
7 import 'dart:collection'; 7 import 'dart:collection';
8 8
9 import 'package:analysis_server/src/analysis_server.dart'; 9 import 'package:analysis_server/src/analysis_server.dart';
10 import 'package:analysis_server/src/constants.dart'; 10 import 'package:analysis_server/src/constants.dart';
(...skipping 86 matching lines...) Expand 10 before | Expand all | Expand 10 after
97 } 97 }
98 server.setAnalysisSubscriptions(subMap); 98 server.setAnalysisSubscriptions(subMap);
99 return new Response(request.id); 99 return new Response(request.id);
100 } 100 }
101 101
102 Response updateContent(Request request) { 102 Response updateContent(Request request) {
103 var changes = new HashMap<String, ContentChange>(); 103 var changes = new HashMap<String, ContentChange>();
104 RequestDatum filesDatum = request.getRequiredParameter(FILES); 104 RequestDatum filesDatum = request.getRequiredParameter(FILES);
105 filesDatum.forEachMap((file, changeDatum) { 105 filesDatum.forEachMap((file, changeDatum) {
106 var change = new ContentChange(); 106 var change = new ContentChange();
107 change.content = changeDatum[CONTENT].asString(); 107 change.content = changeDatum[CONTENT].isNull ? null :
108 changeDatum[CONTENT].asString();
108 if (changeDatum.hasKey(OFFSET)) { 109 if (changeDatum.hasKey(OFFSET)) {
109 change.offset = changeDatum[OFFSET].asInt(); 110 change.offset = changeDatum[OFFSET].asInt();
110 change.oldLength = changeDatum[OLD_LENGTH].asInt(); 111 change.oldLength = changeDatum[OLD_LENGTH].asInt();
111 change.newLength = changeDatum[NEW_LENGTH].asInt(); 112 change.newLength = changeDatum[NEW_LENGTH].asInt();
112 } 113 }
113 changes[file] = change; 114 changes[file] = change;
114 }); 115 });
115 server.updateContent(changes); 116 server.updateContent(changes);
116 return new Response(request.id); 117 return new Response(request.id);
117 } 118 }
(...skipping 12 matching lines...) Expand all
130 131
131 /** 132 /**
132 * A description of the change to the content of a file. 133 * A description of the change to the content of a file.
133 */ 134 */
134 class ContentChange { 135 class ContentChange {
135 String content; 136 String content;
136 int offset; 137 int offset;
137 int oldLength; 138 int oldLength;
138 int newLength; 139 int newLength;
139 } 140 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698