Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(396)

Side by Side Diff: pkg/analysis_server/lib/src/services/completion/suggestion_builder.dart

Issue 1412423006: add logging code to track unexpected situation - fixes #24630 (Closed) Base URL: git@github.com:dart-lang/sdk.git@master
Patch Set: Created 5 years, 1 month ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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.suggestion.builder; 5 library services.completion.suggestion.builder;
6 6
7 import 'dart:async'; 7 import 'dart:async';
8 import 'dart:collection'; 8 import 'dart:collection';
9 9
10 import 'package:analysis_server/src/protocol_server.dart' as protocol; 10 import 'package:analysis_server/src/protocol_server.dart' as protocol;
11 import 'package:analysis_server/src/protocol_server.dart' 11 import 'package:analysis_server/src/protocol_server.dart'
12 hide Element, ElementKind; 12 hide Element, ElementKind;
13 import 'package:analysis_server/src/services/completion/dart_completion_manager. dart'; 13 import 'package:analysis_server/src/services/completion/dart_completion_manager. dart';
14 import 'package:analyzer/src/generated/ast.dart'; 14 import 'package:analyzer/src/generated/ast.dart';
15 import 'package:analyzer/src/generated/element.dart'; 15 import 'package:analyzer/src/generated/element.dart';
16 import 'package:analyzer/src/generated/utilities_dart.dart'; 16 import 'package:analyzer/src/generated/utilities_dart.dart';
17 import 'package:analyzer/src/generated/source.dart'; 17 import 'package:analyzer/src/generated/source.dart';
18 import 'package:path/path.dart' as path; 18 import 'package:path/path.dart' as path;
19 import 'package:analyzer/src/generated/engine.dart' as engine;
scheglov 2015/10/22 16:26:33 sort?
danrubel 2015/10/22 16:50:51 Good point. Done.
19 20
20 const String DYNAMIC = 'dynamic'; 21 const String DYNAMIC = 'dynamic';
21 22
22 /** 23 /**
23 * Return a suggestion based upon the given element 24 * Return a suggestion based upon the given element
24 * or `null` if a suggestion is not appropriate for the given element. 25 * or `null` if a suggestion is not appropriate for the given element.
25 * If the suggestion is not currently in scope, then specify 26 * If the suggestion is not currently in scope, then specify
26 * importForSource as the source to which an import should be added. 27 * importForSource as the source to which an import should be added.
27 */ 28 */
28 CompletionSuggestion createSuggestion(Element element, 29 CompletionSuggestion createSuggestion(Element element,
(...skipping 402 matching lines...) Expand 10 before | Expand all | Expand 10 after
431 432
432 /** 433 /**
433 * Add suggestions for the visible members in the given interface 434 * Add suggestions for the visible members in the given interface
434 */ 435 */
435 static void suggestionsFor(DartCompletionRequest request, DartType type, 436 static void suggestionsFor(DartCompletionRequest request, DartType type,
436 {bool isSuper: false, String containingMethodName: null}) { 437 {bool isSuper: false, String containingMethodName: null}) {
437 CompilationUnit compilationUnit = 438 CompilationUnit compilationUnit =
438 request.target.containingNode.getAncestor((n) => n is CompilationUnit); 439 request.target.containingNode.getAncestor((n) => n is CompilationUnit);
439 CompilationUnitElement unitElem = compilationUnit.element; 440 CompilationUnitElement unitElem = compilationUnit.element;
440 if (unitElem == null) { 441 if (unitElem == null) {
442 engine.AnalysisEngine.instance.logger
443 .logInformation('Completion expected resolved AST');
scheglov 2015/10/22 16:26:33 Maybe we should include name of the source, if it'
danrubel 2015/10/22 16:50:51 There is a lot of additional information that woul
441 return; 444 return;
442 } 445 }
443 LibraryElement library = unitElem.library; 446 LibraryElement library = unitElem.library;
444 if (type is DynamicTypeImpl) { 447 if (type is DynamicTypeImpl) {
445 type = request.cache.objectClassElement.type; 448 type = request.cache.objectClassElement.type;
446 } 449 }
447 if (type is InterfaceType) { 450 if (type is InterfaceType) {
448 new InterfaceTypeSuggestionBuilder(request) 451 new InterfaceTypeSuggestionBuilder(request)
449 ._buildSuggestions(type, library, isSuper, containingMethodName); 452 ._buildSuggestions(type, library, isSuper, containingMethodName);
450 } 453 }
(...skipping 221 matching lines...) Expand 10 before | Expand all | Expand 10 after
672 * or `false` if [computeFull] should be called. 675 * or `false` if [computeFull] should be called.
673 */ 676 */
674 bool computeFast(AstNode node); 677 bool computeFast(AstNode node);
675 678
676 /** 679 /**
677 * Return a future that computes the suggestions given a fully resolved AST. 680 * Return a future that computes the suggestions given a fully resolved AST.
678 * The future returns `true` if suggestions were added, else `false`. 681 * The future returns `true` if suggestions were added, else `false`.
679 */ 682 */
680 Future<bool> computeFull(AstNode node); 683 Future<bool> computeFull(AstNode node);
681 } 684 }
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698