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

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

Issue 529313002: Fix for NPE in the 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 unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « no previous file | pkg/analysis_server/test/computer/element_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 protocol; 5 library protocol;
6 6
7 import 'dart:collection'; 7 import 'dart:collection';
8 import 'dart:convert'; 8 import 'dart:convert';
9 9
10 import 'package:analysis_server/src/computer/element.dart' show 10 import 'package:analysis_server/src/computer/element.dart' show
(...skipping 276 matching lines...) Expand 10 before | Expand all | Expand 10 after
287 startLine, 287 startLine,
288 startColumn); 288 startColumn);
289 } 289 }
290 290
291 /** 291 /**
292 * Creates a new [Location] for the given [engine.Element]. 292 * Creates a new [Location] for the given [engine.Element].
293 */ 293 */
294 Location _locationFromElement(engine.Element element) { 294 Location _locationFromElement(engine.Element element) {
295 engine.AnalysisContext context = element.context; 295 engine.AnalysisContext context = element.context;
296 engine.Source source = element.source; 296 engine.Source source = element.source;
297 if (context == null || source == null) {
298 return null;
299 }
297 String name = element.displayName; 300 String name = element.displayName;
298 int offset = element.nameOffset; 301 int offset = element.nameOffset;
299 int length = name != null ? name.length : 0; 302 int length = name != null ? name.length : 0;
300 if (element is engine.CompilationUnitElement) { 303 if (element is engine.CompilationUnitElement) {
301 offset = 0; 304 offset = 0;
302 length = 0; 305 length = 0;
303 } 306 }
304 engine.SourceRange range = new engine.SourceRange(offset, length); 307 engine.SourceRange range = new engine.SourceRange(offset, length);
305 return _locationForArgs(context, source, range); 308 return _locationForArgs(context, source, range);
306 } 309 }
(...skipping 637 matching lines...) Expand 10 before | Expand all | Expand 10 after
944 hash = 0x1fffffff & (hash + ((0x03ffffff & hash) << 3)); 947 hash = 0x1fffffff & (hash + ((0x03ffffff & hash) << 3));
945 hash = hash ^ (hash >> 11); 948 hash = hash ^ (hash >> 11);
946 return 0x1fffffff & (hash + ((0x00003fff & hash) << 15)); 949 return 0x1fffffff & (hash + ((0x00003fff & hash) << 15));
947 } 950 }
948 951
949 static int hash2(a, b) => finish(combine(combine(0, a), b)); 952 static int hash2(a, b) => finish(combine(combine(0, a), b));
950 953
951 static int hash4(a, b, c, d) => 954 static int hash4(a, b, c, d) =>
952 finish(combine(combine(combine(combine(0, a), b), c), d)); 955 finish(combine(combine(combine(combine(0, a), b), c), d));
953 } 956 }
OLDNEW
« no previous file with comments | « no previous file | pkg/analysis_server/test/computer/element_test.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698