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

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

Issue 802163002: include local functions in completion suggestions (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: merge Created 6 years 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 | Annotate | Revision Log
« no previous file with comments | « no previous file | pkg/analysis_server/test/completion_test.dart » ('j') | 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.computer.dart.local.Declaration.visitor; 5 library services.completion.computer.dart.local.Declaration.visitor;
6 6
7 import 'package:analysis_server/src/services/completion/suggestion_builder.dart' ; 7 import 'package:analysis_server/src/services/completion/suggestion_builder.dart' ;
8 import 'package:analyzer/src/generated/ast.dart'; 8 import 'package:analyzer/src/generated/ast.dart';
9 import 'package:analyzer/src/generated/scanner.dart'; 9 import 'package:analyzer/src/generated/scanner.dart';
10 10
(...skipping 44 matching lines...) Expand 10 before | Expand all | Expand 10 after
55 }); 55 });
56 } else if (stmt is VariableDeclarationStatement) { 56 } else if (stmt is VariableDeclarationStatement) {
57 VariableDeclarationList varList = stmt.variables; 57 VariableDeclarationList varList = stmt.variables;
58 if (varList != null) { 58 if (varList != null) {
59 varList.variables.forEach((VariableDeclaration varDecl) { 59 varList.variables.forEach((VariableDeclaration varDecl) {
60 if (varDecl.end < offset) { 60 if (varDecl.end < offset) {
61 declaredLocalVar(varDecl.name, varList.type); 61 declaredLocalVar(varDecl.name, varList.type);
62 } 62 }
63 }); 63 });
64 } 64 }
65 } else if (stmt is FunctionDeclarationStatement) {
66 FunctionDeclaration declaration = stmt.functionDeclaration;
67 if (declaration != null && declaration.offset < offset) {
68 SimpleIdentifier id = declaration.name;
69 if (id != null) {
70 String name = id.name;
71 if (name != null && name.length > 0) {
72 declaredFunction(declaration);
73 }
74 }
75 }
65 } 76 }
66 } 77 }
67 }); 78 });
68 return visitNode(node); 79 return visitNode(node);
69 } 80 }
70 81
71 @override 82 @override
72 bool visitCatchClause(CatchClause node) { 83 bool visitCatchClause(CatchClause node) {
73 SimpleIdentifier param = node.exceptionParameter; 84 SimpleIdentifier param = node.exceptionParameter;
74 if (param != null) { 85 if (param != null) {
(...skipping 145 matching lines...) Expand 10 before | Expand all | Expand 10 after
220 type = normalParam.returnType; 231 type = normalParam.returnType;
221 } else if (normalParam is SimpleFormalParameter) { 232 } else if (normalParam is SimpleFormalParameter) {
222 type = normalParam.type; 233 type = normalParam.type;
223 } 234 }
224 SimpleIdentifier name = param.identifier; 235 SimpleIdentifier name = param.identifier;
225 declaredParam(name, type); 236 declaredParam(name, type);
226 }); 237 });
227 } 238 }
228 } 239 }
229 } 240 }
OLDNEW
« no previous file with comments | « no previous file | pkg/analysis_server/test/completion_test.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698