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

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

Issue 1138963005: Fix exception in code completion (issue 23439) (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 5 years, 7 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
« no previous file with comments | « no previous file | pkg/analysis_server/test/services/completion/local_declaration_visitor_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.dart.local.declaration.visitor; 5 library services.completion.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 142 matching lines...) Expand 10 before | Expand all | Expand 10 after
153 SimpleIdentifier id; 153 SimpleIdentifier id;
154 TypeName type; 154 TypeName type;
155 DeclaredIdentifier loopVar = node.loopVariable; 155 DeclaredIdentifier loopVar = node.loopVariable;
156 if (loopVar != null) { 156 if (loopVar != null) {
157 id = loopVar.identifier; 157 id = loopVar.identifier;
158 type = loopVar.type; 158 type = loopVar.type;
159 } else { 159 } else {
160 id = node.identifier; 160 id = node.identifier;
161 type = null; 161 type = null;
162 } 162 }
163 declaredLocalVar(id, type); 163 if (id != null) {
164 // If there is no loop variable, don't declare it.
165 declaredLocalVar(id, type);
166 }
164 visitNode(node); 167 visitNode(node);
165 } 168 }
166 169
167 @override 170 @override
168 void visitForStatement(ForStatement node) { 171 void visitForStatement(ForStatement node) {
169 VariableDeclarationList varList = node.variables; 172 VariableDeclarationList varList = node.variables;
170 if (varList != null) { 173 if (varList != null) {
171 varList.variables.forEach((VariableDeclaration varDecl) { 174 varList.variables.forEach((VariableDeclaration varDecl) {
172 declaredLocalVar(varDecl.name, varList.type); 175 declaredLocalVar(varDecl.name, varList.type);
173 }); 176 });
(...skipping 86 matching lines...) Expand 10 before | Expand all | Expand 10 after
260 }); 263 });
261 } 264 }
262 } 265 }
263 } 266 }
264 267
265 /** 268 /**
266 * Internal exception used to indicate that [LocalDeclarationVisitor] 269 * Internal exception used to indicate that [LocalDeclarationVisitor]
267 * should stop visiting. 270 * should stop visiting.
268 */ 271 */
269 class _LocalDeclarationVisitorFinished {} 272 class _LocalDeclarationVisitorFinished {}
OLDNEW
« no previous file with comments | « no previous file | pkg/analysis_server/test/services/completion/local_declaration_visitor_test.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698