| 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/src/protocol.dart'; | 7 import 'package:analysis_server/src/protocol.dart'; |
| 8 import 'package:analysis_server/src/services/search/search_engine.dart' as | 8 import 'package:analysis_server/src/services/search/search_engine.dart' as |
| 9 engine; | 9 engine; |
| 10 import 'package:analyzer/src/generated/ast.dart' as engine; | 10 import 'package:analyzer/src/generated/ast.dart' as engine; |
| (...skipping 212 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 223 engine.AnalysisContext context = unitElement.context; | 223 engine.AnalysisContext context = unitElement.context; |
| 224 engine.Source source = unitElement.source; | 224 engine.Source source = unitElement.source; |
| 225 return _locationForArgs(context, source, range); | 225 return _locationForArgs(context, source, range); |
| 226 } | 226 } |
| 227 | 227 |
| 228 | 228 |
| 229 NavigationTarget newNavigationTarget_fromElement(engine.Element element, | 229 NavigationTarget newNavigationTarget_fromElement(engine.Element element, |
| 230 int fileToIndex(String file)) { | 230 int fileToIndex(String file)) { |
| 231 ElementKind kind = newElementKind_fromEngine(element.kind); | 231 ElementKind kind = newElementKind_fromEngine(element.kind); |
| 232 Location location = newLocation_fromElement(element); | 232 Location location = newLocation_fromElement(element); |
| 233 // TODO(scheglov) Fix the enclosing element problem in the incremental | |
| 234 // resolver and remove this. | |
| 235 if (location == null) { | |
| 236 return null; | |
| 237 } | |
| 238 String file = location.file; | 233 String file = location.file; |
| 239 int fileIndex = fileToIndex(file); | 234 int fileIndex = fileToIndex(file); |
| 240 return new NavigationTarget( | 235 return new NavigationTarget( |
| 241 kind, | 236 kind, |
| 242 fileIndex, | 237 fileIndex, |
| 243 location.offset, | 238 location.offset, |
| 244 location.length, | 239 location.length, |
| 245 location.startLine, | 240 location.startLine, |
| 246 location.startColumn); | 241 location.startColumn); |
| 247 } | 242 } |
| (...skipping 173 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 421 startColumn = offsetLocation.columnNumber; | 416 startColumn = offsetLocation.columnNumber; |
| 422 } | 417 } |
| 423 } | 418 } |
| 424 return new Location( | 419 return new Location( |
| 425 source.fullName, | 420 source.fullName, |
| 426 range.offset, | 421 range.offset, |
| 427 range.length, | 422 range.length, |
| 428 startLine, | 423 startLine, |
| 429 startColumn); | 424 startColumn); |
| 430 } | 425 } |
| OLD | NEW |