| 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 elements.add(element.getter); | 217 // TODO(scheglov) write tests for nulls |
| 218 elements.add(element.setter); | 218 if (element.getter != null) { |
| 219 elements.add(element.getter); |
| 220 } |
| 221 if (element.setter != null) { |
| 222 elements.add(element.setter); |
| 223 } |
| 219 } | 224 } |
| 220 } | 225 } |
| 221 } else if (node is PartDirective || node is PartOfDirective) { | 226 } else if (node is PartDirective || node is PartOfDirective) { |
| 222 } else if (node is Directive && node.element != null) { | 227 } else if (node is Directive && node.element != null) { |
| 223 elements.add(node.element); | 228 elements.add(node.element); |
| 224 } else if (node is Declaration && node.element != null) { | 229 } else if (node is Declaration && node.element != null) { |
| 225 Element element = node.element; | 230 Element element = node.element; |
| 226 elements.add(element); | 231 elements.add(element); |
| 227 if (element is PropertyAccessorElement) { | 232 if (element is PropertyAccessorElement) { |
| 228 elements.add(element.variable); | 233 elements.add(element.variable); |
| (...skipping 124 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 353 } | 358 } |
| 354 int oldOffset = element.nameOffset; | 359 int oldOffset = element.nameOffset; |
| 355 int newOffset = map[oldOffset]; | 360 int newOffset = map[oldOffset]; |
| 356 assert(newOffset != null); | 361 assert(newOffset != null); |
| 357 (element as ElementImpl).nameOffset = newOffset; | 362 (element as ElementImpl).nameOffset = newOffset; |
| 358 if (element is! LibraryElement) { | 363 if (element is! LibraryElement) { |
| 359 super.visitElement(element); | 364 super.visitElement(element); |
| 360 } | 365 } |
| 361 } | 366 } |
| 362 } | 367 } |
| OLD | NEW |