| 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 378 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 389 * Create an OverriddenMember based on an element from the analyzer engine. | 389 * Create an OverriddenMember based on an element from the analyzer engine. |
| 390 */ | 390 */ |
| 391 OverriddenMember _overriddenMemberFromEngine(engine.Element member) { | 391 OverriddenMember _overriddenMemberFromEngine(engine.Element member) { |
| 392 Element element = elementFromEngine(member); | 392 Element element = elementFromEngine(member); |
| 393 String className = member.enclosingElement.displayName; | 393 String className = member.enclosingElement.displayName; |
| 394 return new OverriddenMember(element, className); | 394 return new OverriddenMember(element, className); |
| 395 } | 395 } |
| 396 | 396 |
| 397 | 397 |
| 398 /** | 398 /** |
| 399 * Create a [RefactoringOptions] corresponding the given [kind]. |
| 400 */ |
| 401 RefactoringOptions _refactoringOptionsFromJson(JsonDecoder jsonDecoder, |
| 402 String jsonPath, Object json, RefactoringKind kind) { |
| 403 if (kind == RefactoringKind.EXTRACT_LOCAL_VARIABLE) { |
| 404 return new ExtractLocalVariableOptions.fromJson(jsonDecoder, jsonPath, json)
; |
| 405 } |
| 406 if (kind == RefactoringKind.EXTRACT_METHOD) { |
| 407 return new ExtractMethodOptions.fromJson(jsonDecoder, jsonPath, json); |
| 408 } |
| 409 if (kind == RefactoringKind.INLINE_METHOD) { |
| 410 return new InlineMethodOptions.fromJson(jsonDecoder, jsonPath, json); |
| 411 } |
| 412 if (kind == RefactoringKind.RENAME) { |
| 413 return new RenameOptions.fromJson(jsonDecoder, jsonPath, json); |
| 414 } |
| 415 return null; |
| 416 } |
| 417 |
| 418 |
| 419 /** |
| 399 * Create a SearchResultKind based on a value from the search engine. | 420 * Create a SearchResultKind based on a value from the search engine. |
| 400 */ | 421 */ |
| 401 SearchResultKind _searchResultKindFromEngine(engine.MatchKind kind) { | 422 SearchResultKind _searchResultKindFromEngine(engine.MatchKind kind) { |
| 402 if (kind == engine.MatchKind.DECLARATION) { | 423 if (kind == engine.MatchKind.DECLARATION) { |
| 403 return SearchResultKind.DECLARATION; | 424 return SearchResultKind.DECLARATION; |
| 404 } | 425 } |
| 405 if (kind == engine.MatchKind.READ) { | 426 if (kind == engine.MatchKind.READ) { |
| 406 return SearchResultKind.READ; | 427 return SearchResultKind.READ; |
| 407 } | 428 } |
| 408 if (kind == engine.MatchKind.READ_WRITE) { | 429 if (kind == engine.MatchKind.READ_WRITE) { |
| (...skipping 538 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 947 hash = 0x1fffffff & (hash + ((0x03ffffff & hash) << 3)); | 968 hash = 0x1fffffff & (hash + ((0x03ffffff & hash) << 3)); |
| 948 hash = hash ^ (hash >> 11); | 969 hash = hash ^ (hash >> 11); |
| 949 return 0x1fffffff & (hash + ((0x00003fff & hash) << 15)); | 970 return 0x1fffffff & (hash + ((0x00003fff & hash) << 15)); |
| 950 } | 971 } |
| 951 | 972 |
| 952 static int hash2(a, b) => finish(combine(combine(0, a), b)); | 973 static int hash2(a, b) => finish(combine(combine(0, a), b)); |
| 953 | 974 |
| 954 static int hash4(a, b, c, d) => | 975 static int hash4(a, b, c, d) => |
| 955 finish(combine(combine(combine(combine(0, a), b), c), d)); | 976 finish(combine(combine(combine(combine(0, a), b), c), d)); |
| 956 } | 977 } |
| OLD | NEW |