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 services.completion.contributor.dart.local; | 5 library services.completion.contributor.dart.local; |
6 | 6 |
7 import 'dart:async'; | 7 import 'dart:async'; |
8 | 8 |
9 import 'package:analysis_server/src/protocol.dart' as protocol | 9 import 'package:analysis_server/src/protocol.dart' as protocol |
10 show Element, ElementKind; | 10 show Element, ElementKind; |
(...skipping 338 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
349 * that contains the completion offset to the [CompilationUnit]. | 349 * that contains the completion offset to the [CompilationUnit]. |
350 */ | 350 */ |
351 class _LocalVisitor extends LocalDeclarationVisitor { | 351 class _LocalVisitor extends LocalDeclarationVisitor { |
352 final DartCompletionRequest request; | 352 final DartCompletionRequest request; |
353 final OpType optype; | 353 final OpType optype; |
354 int privateMemberRelevance = DART_RELEVANCE_DEFAULT; | 354 int privateMemberRelevance = DART_RELEVANCE_DEFAULT; |
355 | 355 |
356 _LocalVisitor(this.request, int offset, this.optype) : super(offset) { | 356 _LocalVisitor(this.request, int offset, this.optype) : super(offset) { |
357 includeLocalInheritedTypes = !optype.inStaticMethodBody; | 357 includeLocalInheritedTypes = !optype.inStaticMethodBody; |
358 if (request.replacementLength > 0) { | 358 if (request.replacementLength > 0) { |
359 var contents = request.source.contents; | 359 var contents = request.context.getContents(request.source); |
360 if (contents != null && | 360 if (contents != null && |
361 contents.data != null && | 361 contents.data != null && |
362 contents.data.startsWith('_', request.replacementOffset)) { | 362 contents.data.startsWith('_', request.replacementOffset)) { |
363 // If user typed identifier starting with '_' | 363 // If user typed identifier starting with '_' |
364 // then do not suppress the relevance of private members | 364 // then do not suppress the relevance of private members |
365 privateMemberRelevance = null; | 365 privateMemberRelevance = null; |
366 } | 366 } |
367 } | 367 } |
368 } | 368 } |
369 | 369 |
(...skipping 216 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
586 bool _isVoid(TypeName returnType) { | 586 bool _isVoid(TypeName returnType) { |
587 if (returnType != null) { | 587 if (returnType != null) { |
588 Identifier id = returnType.name; | 588 Identifier id = returnType.name; |
589 if (id != null && id.name == 'void') { | 589 if (id != null && id.name == 'void') { |
590 return true; | 590 return true; |
591 } | 591 } |
592 } | 592 } |
593 return false; | 593 return false; |
594 } | 594 } |
595 } | 595 } |
OLD | NEW |