| 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.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 31 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 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 node.statements.forEach((Statement stmt) { |
| 51 if (stmt.offset < offset) { | 51 if (stmt.offset < offset) { |
| 52 if (stmt is LabeledStatement) { | 52 if (stmt is VariableDeclarationStatement) { |
| 53 stmt.labels.forEach((Label label) { | |
| 54 declaredLabel(label); | |
| 55 }); | |
| 56 } else if (stmt is VariableDeclarationStatement) { | |
| 57 VariableDeclarationList varList = stmt.variables; | 53 VariableDeclarationList varList = stmt.variables; |
| 58 if (varList != null) { | 54 if (varList != null) { |
| 59 varList.variables.forEach((VariableDeclaration varDecl) { | 55 varList.variables.forEach((VariableDeclaration varDecl) { |
| 60 if (varDecl.end < offset) { | 56 if (varDecl.end < offset) { |
| 61 declaredLocalVar(varDecl.name, varList.type); | 57 declaredLocalVar(varDecl.name, varList.type); |
| 62 } | 58 } |
| 63 }); | 59 }); |
| 64 } | 60 } |
| 65 } else if (stmt is FunctionDeclarationStatement) { | 61 } else if (stmt is FunctionDeclarationStatement) { |
| 66 FunctionDeclaration declaration = stmt.functionDeclaration; | 62 FunctionDeclaration declaration = stmt.functionDeclaration; |
| (...skipping 111 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 178 _visitParamList(node.parameters); | 174 _visitParamList(node.parameters); |
| 179 return visitNode(node); | 175 return visitNode(node); |
| 180 } | 176 } |
| 181 | 177 |
| 182 @override | 178 @override |
| 183 bool visitInterpolationExpression(InterpolationExpression node) { | 179 bool visitInterpolationExpression(InterpolationExpression node) { |
| 184 return visitNode(node); | 180 return visitNode(node); |
| 185 } | 181 } |
| 186 | 182 |
| 187 @override | 183 @override |
| 184 bool visitLabeledStatement(LabeledStatement node) { |
| 185 node.labels.forEach(declaredLabel); |
| 186 return visitNode(node); |
| 187 } |
| 188 |
| 189 @override |
| 188 bool visitMethodDeclaration(MethodDeclaration node) { | 190 bool visitMethodDeclaration(MethodDeclaration node) { |
| 189 _visitParamList(node.parameters); | 191 _visitParamList(node.parameters); |
| 190 return visitNode(node); | 192 return visitNode(node); |
| 191 } | 193 } |
| 192 | 194 |
| 193 @override | 195 @override |
| 194 bool visitNode(AstNode node) { | 196 bool visitNode(AstNode node) { |
| 195 if (finished) { | 197 if (finished) { |
| 196 return true; | 198 return true; |
| 197 } | 199 } |
| (...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 231 type = normalParam.returnType; | 233 type = normalParam.returnType; |
| 232 } else if (normalParam is SimpleFormalParameter) { | 234 } else if (normalParam is SimpleFormalParameter) { |
| 233 type = normalParam.type; | 235 type = normalParam.type; |
| 234 } | 236 } |
| 235 SimpleIdentifier name = param.identifier; | 237 SimpleIdentifier name = param.identifier; |
| 236 declaredParam(name, type); | 238 declaredParam(name, type); |
| 237 }); | 239 }); |
| 238 } | 240 } |
| 239 } | 241 } |
| 240 } | 242 } |
| OLD | NEW |