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.server; | 5 library protocol.server; |
6 | 6 |
7 import 'package:analysis_server/plugin/protocol/protocol.dart'; | 7 import 'package:analysis_server/plugin/protocol/protocol.dart'; |
8 import 'package:analysis_server/plugin/protocol/protocol_dart.dart'; | 8 import 'package:analysis_server/plugin/protocol/protocol_dart.dart'; |
9 import 'package:analysis_server/src/services/correction/fix.dart'; | 9 import 'package:analysis_server/src/services/correction/fix.dart'; |
10 import 'package:analysis_server/src/services/search/search_engine.dart' | 10 import 'package:analysis_server/src/services/search/search_engine.dart' |
11 as engine; | 11 as engine; |
12 import 'package:analyzer/dart/ast/ast.dart' as engine; | 12 import 'package:analyzer/dart/ast/ast.dart' as engine; |
13 import 'package:analyzer/dart/ast/visitor.dart' as engine; | 13 import 'package:analyzer/dart/ast/visitor.dart' as engine; |
14 import 'package:analyzer/dart/element/element.dart' as engine; | 14 import 'package:analyzer/dart/element/element.dart' as engine; |
15 import 'package:analyzer/dart/element/type.dart' as engine; | 15 import 'package:analyzer/dart/element/type.dart' as engine; |
16 import 'package:analyzer/source/error_processor.dart'; | 16 import 'package:analyzer/source/error_processor.dart'; |
17 import 'package:analyzer/src/dart/ast/utilities.dart' as engine; | 17 import 'package:analyzer/src/dart/ast/utilities.dart' as engine; |
18 import 'package:analyzer/src/generated/engine.dart' as engine; | 18 import 'package:analyzer/src/generated/engine.dart' as engine; |
19 import 'package:analyzer/src/generated/error.dart' as engine; | 19 import 'package:analyzer/src/generated/error.dart' as engine; |
| 20 import 'package:analyzer/src/generated/java_engine.dart'; |
20 import 'package:analyzer/src/generated/source.dart' as engine; | 21 import 'package:analyzer/src/generated/source.dart' as engine; |
21 import 'package:analyzer/src/generated/utilities_dart.dart' as engine; | 22 import 'package:analyzer/src/generated/utilities_dart.dart' as engine; |
22 | 23 |
23 export 'package:analysis_server/plugin/protocol/protocol.dart'; | 24 export 'package:analysis_server/plugin/protocol/protocol.dart'; |
24 export 'package:analysis_server/plugin/protocol/protocol_dart.dart'; | 25 export 'package:analysis_server/plugin/protocol/protocol_dart.dart'; |
25 | 26 |
26 /** | 27 /** |
27 * Returns a list of AnalysisErrors corresponding to the given list of Engine | 28 * Returns a list of AnalysisErrors corresponding to the given list of Engine |
28 * errors. | 29 * errors. |
29 */ | 30 */ |
(...skipping 217 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
247 return path; | 248 return path; |
248 } | 249 } |
249 | 250 |
250 /** | 251 /** |
251 * Creates a new [Location]. | 252 * Creates a new [Location]. |
252 */ | 253 */ |
253 Location _locationForArgs(engine.AnalysisContext context, engine.Source source, | 254 Location _locationForArgs(engine.AnalysisContext context, engine.Source source, |
254 engine.SourceRange range) { | 255 engine.SourceRange range) { |
255 int startLine = 0; | 256 int startLine = 0; |
256 int startColumn = 0; | 257 int startColumn = 0; |
257 { | 258 try { |
258 engine.LineInfo lineInfo = context.getLineInfo(source); | 259 engine.LineInfo lineInfo = context.computeLineInfo(source); |
259 if (lineInfo != null) { | 260 if (lineInfo != null) { |
260 engine.LineInfo_Location offsetLocation = | 261 engine.LineInfo_Location offsetLocation = |
261 lineInfo.getLocation(range.offset); | 262 lineInfo.getLocation(range.offset); |
262 startLine = offsetLocation.lineNumber; | 263 startLine = offsetLocation.lineNumber; |
263 startColumn = offsetLocation.columnNumber; | 264 startColumn = offsetLocation.columnNumber; |
264 } | 265 } |
265 } | 266 } on AnalysisException {} |
266 return new Location( | 267 return new Location( |
267 source.fullName, range.offset, range.length, startLine, startColumn); | 268 source.fullName, range.offset, range.length, startLine, startColumn); |
268 } | 269 } |
OLD | NEW |