| 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 112 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 123 return errors.map((engine.AnalysisError error) { | 123 return errors.map((engine.AnalysisError error) { |
| 124 return new AnalysisError.fromEngine(lineInfo, error); | 124 return new AnalysisError.fromEngine(lineInfo, error); |
| 125 }).toList(); | 125 }).toList(); |
| 126 } | 126 } |
| 127 | 127 |
| 128 /** | 128 /** |
| 129 * Get the result of applying the edit to the given [code]. Access via | 129 * Get the result of applying the edit to the given [code]. Access via |
| 130 * SourceEdit.apply(). | 130 * SourceEdit.apply(). |
| 131 */ | 131 */ |
| 132 String _applyEdit(String code, SourceEdit edit) { | 132 String _applyEdit(String code, SourceEdit edit) { |
| 133 if (edit.length < 0) { |
| 134 throw new RangeError('length is negative'); |
| 135 } |
| 133 return code.substring(0, edit.offset) + | 136 return code.substring(0, edit.offset) + |
| 134 edit.replacement + | 137 edit.replacement + |
| 135 code.substring(edit.end); | 138 code.substring(edit.end); |
| 136 } | 139 } |
| 137 | 140 |
| 138 /** | 141 /** |
| 139 * Get the result of applying a set of [edits] to the given [code]. Edits | 142 * Get the result of applying a set of [edits] to the given [code]. Edits |
| 140 * are applied in the order they appear in [edits]. Access via | 143 * are applied in the order they appear in [edits]. Access via |
| 141 * SourceEdit.applySequence(). | 144 * SourceEdit.applySequence(). |
| 142 */ | 145 */ |
| (...skipping 855 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 998 hash = 0x1fffffff & (hash + ((0x03ffffff & hash) << 3)); | 1001 hash = 0x1fffffff & (hash + ((0x03ffffff & hash) << 3)); |
| 999 hash = hash ^ (hash >> 11); | 1002 hash = hash ^ (hash >> 11); |
| 1000 return 0x1fffffff & (hash + ((0x00003fff & hash) << 15)); | 1003 return 0x1fffffff & (hash + ((0x00003fff & hash) << 15)); |
| 1001 } | 1004 } |
| 1002 | 1005 |
| 1003 static int hash2(a, b) => finish(combine(combine(0, a), b)); | 1006 static int hash2(a, b) => finish(combine(combine(0, a), b)); |
| 1004 | 1007 |
| 1005 static int hash4(a, b, c, d) => | 1008 static int hash4(a, b, c, d) => |
| 1006 finish(combine(combine(combine(combine(0, a), b), c), d)); | 1009 finish(combine(combine(combine(combine(0, a), b), c), d)); |
| 1007 } | 1010 } |
| OLD | NEW |