| OLD | NEW |
| 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 Loading... |
| 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 Loading... |
| 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 } |
| OLD | NEW |