| 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' | 8 import 'package:analysis_server/src/services/search/search_engine.dart' |
| 9 as engine; | 9 as engine; |
| 10 import 'package:analyzer/src/generated/ast.dart' as engine; | 10 import 'package:analyzer/src/generated/ast.dart' as engine; |
| (...skipping 239 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 250 * Create a Location based on an [engine.CompilationUnit]. | 250 * Create a Location based on an [engine.CompilationUnit]. |
| 251 */ | 251 */ |
| 252 Location newLocation_fromUnit( | 252 Location newLocation_fromUnit( |
| 253 engine.CompilationUnit unit, engine.SourceRange range) { | 253 engine.CompilationUnit unit, engine.SourceRange range) { |
| 254 engine.CompilationUnitElement unitElement = unit.element; | 254 engine.CompilationUnitElement unitElement = unit.element; |
| 255 engine.AnalysisContext context = unitElement.context; | 255 engine.AnalysisContext context = unitElement.context; |
| 256 engine.Source source = unitElement.source; | 256 engine.Source source = unitElement.source; |
| 257 return _locationForArgs(context, source, range); | 257 return _locationForArgs(context, source, range); |
| 258 } | 258 } |
| 259 | 259 |
| 260 NavigationTarget newNavigationTarget_fromElement( | |
| 261 engine.Element element, int fileToIndex(String file)) { | |
| 262 ElementKind kind = newElementKind_fromEngine(element.kind); | |
| 263 Location location = newLocation_fromElement(element); | |
| 264 String file = location.file; | |
| 265 int fileIndex = fileToIndex(file); | |
| 266 return new NavigationTarget(kind, fileIndex, location.offset, location.length, | |
| 267 location.startLine, location.startColumn); | |
| 268 } | |
| 269 | |
| 270 /** | 260 /** |
| 271 * Construct based on an element from the analyzer engine. | 261 * Construct based on an element from the analyzer engine. |
| 272 */ | 262 */ |
| 273 OverriddenMember newOverriddenMember_fromEngine(engine.Element member) { | 263 OverriddenMember newOverriddenMember_fromEngine(engine.Element member) { |
| 274 Element element = newElement_fromEngine(member); | 264 Element element = newElement_fromEngine(member); |
| 275 String className = member.enclosingElement.displayName; | 265 String className = member.enclosingElement.displayName; |
| 276 return new OverriddenMember(element, className); | 266 return new OverriddenMember(element, className); |
| 277 } | 267 } |
| 278 | 268 |
| 279 /** | 269 /** |
| (...skipping 162 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 442 if (lineInfo != null) { | 432 if (lineInfo != null) { |
| 443 engine.LineInfo_Location offsetLocation = | 433 engine.LineInfo_Location offsetLocation = |
| 444 lineInfo.getLocation(range.offset); | 434 lineInfo.getLocation(range.offset); |
| 445 startLine = offsetLocation.lineNumber; | 435 startLine = offsetLocation.lineNumber; |
| 446 startColumn = offsetLocation.columnNumber; | 436 startColumn = offsetLocation.columnNumber; |
| 447 } | 437 } |
| 448 } | 438 } |
| 449 return new Location( | 439 return new Location( |
| 450 source.fullName, range.offset, range.length, startLine, startColumn); | 440 source.fullName, range.offset, range.length, startLine, startColumn); |
| 451 } | 441 } |
| OLD | NEW |