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' |
(...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
48 String file = source.fullName; | 48 String file = source.fullName; |
49 int fileStamp = context.getModificationStamp(source); | 49 int fileStamp = context.getModificationStamp(source); |
50 change.addEdit(file, fileStamp, edit); | 50 change.addEdit(file, fileStamp, edit); |
51 } | 51 } |
52 | 52 |
53 String getReturnTypeString(engine.Element element) { | 53 String getReturnTypeString(engine.Element element) { |
54 if (element is engine.ExecutableElement) { | 54 if (element is engine.ExecutableElement) { |
55 if (element.kind == engine.ElementKind.SETTER) { | 55 if (element.kind == engine.ElementKind.SETTER) { |
56 return null; | 56 return null; |
57 } else { | 57 } else { |
58 return element.returnType.toString(); | 58 return element.returnType?.toString(); |
59 } | 59 } |
60 } else if (element is engine.VariableElement) { | 60 } else if (element is engine.VariableElement) { |
61 engine.DartType type = element.type; | 61 engine.DartType type = element.type; |
62 return type != null ? type.displayName : 'dynamic'; | 62 return type != null ? type.displayName : 'dynamic'; |
63 } else if (element is engine.FunctionTypeAliasElement) { | 63 } else if (element is engine.FunctionTypeAliasElement) { |
64 return element.returnType.toString(); | 64 return element.returnType.toString(); |
65 } else { | 65 } else { |
66 return null; | 66 return null; |
67 } | 67 } |
68 } | 68 } |
(...skipping 163 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
232 if (lineInfo != null) { | 232 if (lineInfo != null) { |
233 engine.LineInfo_Location offsetLocation = | 233 engine.LineInfo_Location offsetLocation = |
234 lineInfo.getLocation(range.offset); | 234 lineInfo.getLocation(range.offset); |
235 startLine = offsetLocation.lineNumber; | 235 startLine = offsetLocation.lineNumber; |
236 startColumn = offsetLocation.columnNumber; | 236 startColumn = offsetLocation.columnNumber; |
237 } | 237 } |
238 } | 238 } |
239 return new Location( | 239 return new Location( |
240 source.fullName, range.offset, range.length, startLine, startColumn); | 240 source.fullName, range.offset, range.length, startLine, startColumn); |
241 } | 241 } |
OLD | NEW |