| 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 44 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 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 Loading... |
| 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 } |
| OLD | NEW |