OLD | NEW |
1 // Copyright (c) 2015, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2015, 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 analyzer.src.task.incremental_element_builder; | 5 library analyzer.src.task.incremental_element_builder; |
6 | 6 |
7 import 'dart:collection'; | 7 import 'dart:collection'; |
8 | 8 |
9 import 'package:analyzer/src/generated/ast.dart'; | 9 import 'package:analyzer/src/generated/ast.dart'; |
10 import 'package:analyzer/src/generated/element.dart'; | 10 import 'package:analyzer/src/generated/element.dart'; |
(...skipping 196 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
207 * nodes may declare more than one. | 207 * nodes may declare more than one. |
208 */ | 208 */ |
209 static List<Element> _getElements(AstNode node) { | 209 static List<Element> _getElements(AstNode node) { |
210 List<Element> elements = <Element>[]; | 210 List<Element> elements = <Element>[]; |
211 if (node is TopLevelVariableDeclaration) { | 211 if (node is TopLevelVariableDeclaration) { |
212 VariableDeclarationList variableList = node.variables; | 212 VariableDeclarationList variableList = node.variables; |
213 if (variableList != null) { | 213 if (variableList != null) { |
214 for (VariableDeclaration variable in variableList.variables) { | 214 for (VariableDeclaration variable in variableList.variables) { |
215 TopLevelVariableElement element = variable.element; | 215 TopLevelVariableElement element = variable.element; |
216 elements.add(element); | 216 elements.add(element); |
217 // TODO(scheglov) write tests for nulls | |
218 if (element.getter != null) { | 217 if (element.getter != null) { |
219 elements.add(element.getter); | 218 elements.add(element.getter); |
220 } | 219 } |
221 if (element.setter != null) { | 220 if (element.setter != null) { |
222 elements.add(element.setter); | 221 elements.add(element.setter); |
223 } | 222 } |
224 } | 223 } |
225 } | 224 } |
226 } else if (node is PartDirective || node is PartOfDirective) { | 225 } else if (node is PartDirective || node is PartOfDirective) { |
227 } else if (node is Directive && node.element != null) { | 226 } else if (node is Directive && node.element != null) { |
(...skipping 130 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
358 } | 357 } |
359 int oldOffset = element.nameOffset; | 358 int oldOffset = element.nameOffset; |
360 int newOffset = map[oldOffset]; | 359 int newOffset = map[oldOffset]; |
361 assert(newOffset != null); | 360 assert(newOffset != null); |
362 (element as ElementImpl).nameOffset = newOffset; | 361 (element as ElementImpl).nameOffset = newOffset; |
363 if (element is! LibraryElement) { | 362 if (element is! LibraryElement) { |
364 super.visitElement(element); | 363 super.visitElement(element); |
365 } | 364 } |
366 } | 365 } |
367 } | 366 } |
OLD | NEW |