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

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

Issue 965753003: fix invocation completion with trailing stmt (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: merge Created 5 years, 9 months 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
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 29 matching lines...) Expand all
40 40
41 void declaredMethod(MethodDeclaration declaration); 41 void declaredMethod(MethodDeclaration declaration);
42 42
43 void declaredParam(SimpleIdentifier name, TypeName type); 43 void declaredParam(SimpleIdentifier name, TypeName type);
44 44
45 void declaredTopLevelVar(VariableDeclarationList varList, 45 void declaredTopLevelVar(VariableDeclarationList varList,
46 VariableDeclaration varDecl); 46 VariableDeclaration varDecl);
47 47
48 @override 48 @override
49 bool visitBlock(Block node) { 49 bool visitBlock(Block node) {
50 node.statements.forEach((Statement stmt) { 50 for (Statement stmt in node.statements) {
51 if (stmt.offset < offset) { 51 if (stmt.offset < offset) {
52 if (stmt is VariableDeclarationStatement) { 52 if (stmt is VariableDeclarationStatement) {
53 VariableDeclarationList varList = stmt.variables; 53 VariableDeclarationList varList = stmt.variables;
54 if (varList != null) { 54 if (varList != null) {
55 varList.variables.forEach((VariableDeclaration varDecl) { 55 for (VariableDeclaration varDecl in varList.variables) {
56 if (varDecl.end < offset) { 56 if (varDecl.end < offset) {
57 declaredLocalVar(varDecl.name, varList.type); 57 declaredLocalVar(varDecl.name, varList.type);
58 } 58 }
59 }); 59 };
60 } 60 }
61 } else if (stmt is FunctionDeclarationStatement) { 61 } else if (stmt is FunctionDeclarationStatement) {
62 FunctionDeclaration declaration = stmt.functionDeclaration; 62 FunctionDeclaration declaration = stmt.functionDeclaration;
63 if (declaration != null && declaration.offset < offset) { 63 if (declaration != null && declaration.offset < offset) {
64 SimpleIdentifier id = declaration.name; 64 SimpleIdentifier id = declaration.name;
65 if (id != null) { 65 if (id != null) {
66 String name = id.name; 66 String name = id.name;
67 if (name != null && name.length > 0) { 67 if (name != null && name.length > 0) {
68 declaredFunction(declaration); 68 declaredFunction(declaration);
69 } 69 }
70 } 70 }
71 } 71 }
72 } 72 }
73 } 73 }
74 }); 74 };
75 return visitNode(node); 75 return visitNode(node);
76 } 76 }
77 77
78 @override 78 @override
79 bool visitCatchClause(CatchClause node) { 79 bool visitCatchClause(CatchClause node) {
80 SimpleIdentifier param = node.exceptionParameter; 80 SimpleIdentifier param = node.exceptionParameter;
81 if (param != null) { 81 if (param != null) {
82 declaredParam(param, node.exceptionType); 82 declaredParam(param, node.exceptionType);
83 } 83 }
84 param = node.stackTraceParameter; 84 param = node.stackTraceParameter;
(...skipping 149 matching lines...) Expand 10 before | Expand all | Expand 10 after
234 type = normalParam.returnType; 234 type = normalParam.returnType;
235 } else if (normalParam is SimpleFormalParameter) { 235 } else if (normalParam is SimpleFormalParameter) {
236 type = normalParam.type; 236 type = normalParam.type;
237 } 237 }
238 SimpleIdentifier name = param.identifier; 238 SimpleIdentifier name = param.identifier;
239 declaredParam(name, type); 239 declaredParam(name, type);
240 }); 240 });
241 } 241 }
242 } 242 }
243 } 243 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698