| 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.arglist; | 5 library services.completion.computer.dart.arglist; |
| 6 | 6 |
| 7 import 'dart:async'; | 7 import 'dart:async'; |
| 8 | 8 |
| 9 import 'package:analysis_server/src/protocol_server.dart' hide Element, | 9 import 'package:analysis_server/src/protocol_server.dart' hide Element, |
| 10 ElementKind; | 10 ElementKind; |
| (...skipping 43 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 54 SimpleIdentifier selector = parent.methodName; | 54 SimpleIdentifier selector = parent.methodName; |
| 55 if (selector != null) { | 55 if (selector != null) { |
| 56 String name = selector.name; | 56 String name = selector.name; |
| 57 if (name != null && name.length > 0) { | 57 if (name != null && name.length > 0) { |
| 58 if (parent.period == null) { | 58 if (parent.period == null) { |
| 59 /* | 59 /* |
| 60 * If a local declaration is found, then return null | 60 * If a local declaration is found, then return null |
| 61 * indicating that suggestions were added | 61 * indicating that suggestions were added |
| 62 * and no further action is necessary | 62 * and no further action is necessary |
| 63 */ | 63 */ |
| 64 if (node.accept( | 64 if (new _LocalDeclarationFinder( |
| 65 new _LocalDeclarationFinder(request, request.offset, name))) { | 65 request, |
| 66 request.offset, |
| 67 name).visit(node)) { |
| 66 return null; | 68 return null; |
| 67 } | 69 } |
| 68 } else { | 70 } else { |
| 69 // determine target | 71 // determine target |
| 70 } | 72 } |
| 71 } | 73 } |
| 72 } | 74 } |
| 73 } | 75 } |
| 74 return new _ArgListSuggestionBuilder(request); | 76 return new _ArgListSuggestionBuilder(request); |
| 75 } | 77 } |
| (...skipping 43 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 119 } | 121 } |
| 120 | 122 |
| 121 @override | 123 @override |
| 122 void declaredField(FieldDeclaration fieldDecl, VariableDeclaration varDecl) { | 124 void declaredField(FieldDeclaration fieldDecl, VariableDeclaration varDecl) { |
| 123 } | 125 } |
| 124 | 126 |
| 125 @override | 127 @override |
| 126 void declaredFunction(FunctionDeclaration declaration) { | 128 void declaredFunction(FunctionDeclaration declaration) { |
| 127 SimpleIdentifier selector = declaration.name; | 129 SimpleIdentifier selector = declaration.name; |
| 128 if (selector != null && name == selector.name) { | 130 if (selector != null && name == selector.name) { |
| 129 finished = true; | |
| 130 _addArgListSuggestion(declaration.functionExpression.parameters); | 131 _addArgListSuggestion(declaration.functionExpression.parameters); |
| 132 finished(); |
| 131 } | 133 } |
| 132 } | 134 } |
| 133 | 135 |
| 134 @override | 136 @override |
| 135 void declaredFunctionTypeAlias(FunctionTypeAlias declaration) { | 137 void declaredFunctionTypeAlias(FunctionTypeAlias declaration) { |
| 136 } | 138 } |
| 137 | 139 |
| 138 @override | 140 @override |
| 139 void declaredLabel(Label label, bool isCaseLabel) { | 141 void declaredLabel(Label label, bool isCaseLabel) { |
| 140 } | 142 } |
| 141 | 143 |
| 142 @override | 144 @override |
| 143 void declaredLocalVar(SimpleIdentifier name, TypeName type) { | 145 void declaredLocalVar(SimpleIdentifier name, TypeName type) { |
| 144 } | 146 } |
| 145 | 147 |
| 146 @override | 148 @override |
| 147 void declaredMethod(MethodDeclaration declaration) { | 149 void declaredMethod(MethodDeclaration declaration) { |
| 148 SimpleIdentifier selector = declaration.name; | 150 SimpleIdentifier selector = declaration.name; |
| 149 if (selector != null && name == selector.name) { | 151 if (selector != null && name == selector.name) { |
| 150 finished = true; | |
| 151 _addArgListSuggestion(declaration.parameters); | 152 _addArgListSuggestion(declaration.parameters); |
| 153 finished(); |
| 152 } | 154 } |
| 153 } | 155 } |
| 154 | 156 |
| 155 @override | 157 @override |
| 156 void declaredParam(SimpleIdentifier name, TypeName type) { | 158 void declaredParam(SimpleIdentifier name, TypeName type) { |
| 157 } | 159 } |
| 158 | 160 |
| 159 @override | 161 @override |
| 160 void declaredTopLevelVar(VariableDeclarationList varList, | 162 void declaredTopLevelVar(VariableDeclarationList varList, |
| 161 VariableDeclaration varDecl) { | 163 VariableDeclaration varDecl) { |
| (...skipping 44 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 206 if (id != null) { | 208 if (id != null) { |
| 207 String name = id.name; | 209 String name = id.name; |
| 208 if (name != null && name.length > 0) { | 210 if (name != null && name.length > 0) { |
| 209 return name; | 211 return name; |
| 210 } | 212 } |
| 211 } | 213 } |
| 212 } | 214 } |
| 213 return 'dynamic'; | 215 return 'dynamic'; |
| 214 } | 216 } |
| 215 } | 217 } |
| OLD | NEW |