| 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 60 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 71 void _addEditToSourceChange(SourceChange change, String file, int fileStamp, | 71 void _addEditToSourceChange(SourceChange change, String file, int fileStamp, |
| 72 SourceEdit edit) { | 72 SourceEdit edit) { |
| 73 SourceFileEdit fileEdit = change.getFileEdit(file); | 73 SourceFileEdit fileEdit = change.getFileEdit(file); |
| 74 if (fileEdit == null) { | 74 if (fileEdit == null) { |
| 75 fileEdit = new SourceFileEdit(file, fileStamp); | 75 fileEdit = new SourceFileEdit(file, fileStamp); |
| 76 change.addFileEdit(fileEdit); | 76 change.addFileEdit(fileEdit); |
| 77 } | 77 } |
| 78 fileEdit.add(edit); | 78 fileEdit.add(edit); |
| 79 } | 79 } |
| 80 | 80 |
| 81 |
| 82 void _addElementEditToSourceChange(SourceChange change, engine.Element element, |
| 83 SourceEdit edit) { |
| 84 engine.AnalysisContext context = element.context; |
| 85 engine.Source source = element.source; |
| 86 _addSourceEditToSourceChange(change, context, source, edit); |
| 87 } |
| 88 |
| 89 |
| 90 void _addSourceEditToSourceChange(SourceChange change, |
| 91 engine.AnalysisContext context, engine.Source source, SourceEdit edit) { |
| 92 String file = source.fullName; |
| 93 int fileStamp = context.getModificationStamp(source); |
| 94 change.addEdit(file, fileStamp, edit); |
| 95 } |
| 96 |
| 81 /** | 97 /** |
| 82 * Create an AnalysisError based on error information from the analyzer | 98 * Create an AnalysisError based on error information from the analyzer |
| 83 * engine. Access via AnalysisError.fromEngine(). | 99 * engine. Access via AnalysisError.fromEngine(). |
| 84 */ | 100 */ |
| 85 AnalysisError _analysisErrorFromEngine(engine.LineInfo lineInfo, | 101 AnalysisError _analysisErrorFromEngine(engine.LineInfo lineInfo, |
| 86 engine.AnalysisError error) { | 102 engine.AnalysisError error) { |
| 87 engine.ErrorCode errorCode = error.errorCode; | 103 engine.ErrorCode errorCode = error.errorCode; |
| 88 // prepare location | 104 // prepare location |
| 89 Location location; | 105 Location location; |
| 90 { | 106 { |
| (...skipping 923 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1014 hash = 0x1fffffff & (hash + ((0x03ffffff & hash) << 3)); | 1030 hash = 0x1fffffff & (hash + ((0x03ffffff & hash) << 3)); |
| 1015 hash = hash ^ (hash >> 11); | 1031 hash = hash ^ (hash >> 11); |
| 1016 return 0x1fffffff & (hash + ((0x00003fff & hash) << 15)); | 1032 return 0x1fffffff & (hash + ((0x00003fff & hash) << 15)); |
| 1017 } | 1033 } |
| 1018 | 1034 |
| 1019 static int hash2(a, b) => finish(combine(combine(0, a), b)); | 1035 static int hash2(a, b) => finish(combine(combine(0, a), b)); |
| 1020 | 1036 |
| 1021 static int hash4(a, b, c, d) => | 1037 static int hash4(a, b, c, d) => |
| 1022 finish(combine(combine(combine(combine(0, a), b), c), d)); | 1038 finish(combine(combine(combine(combine(0, a), b), c), d)); |
| 1023 } | 1039 } |
| OLD | NEW |