| 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/dart/ast/ast.dart'; | 9 import 'package:analyzer/dart/ast/ast.dart'; |
| 10 import 'package:analyzer/dart/ast/token.dart'; | 10 import 'package:analyzer/dart/ast/token.dart'; |
| (...skipping 145 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 156 } else if (element is TopLevelVariableElement) { | 156 } else if (element is TopLevelVariableElement) { |
| 157 unitElementHolder.addTopLevelVariable(element); | 157 unitElementHolder.addTopLevelVariable(element); |
| 158 } | 158 } |
| 159 } | 159 } |
| 160 | 160 |
| 161 void _findConstants() { | 161 void _findConstants() { |
| 162 ConstantFinder finder = | 162 ConstantFinder finder = |
| 163 new ConstantFinder(unitElement.context, unitSource, librarySource); | 163 new ConstantFinder(unitElement.context, unitSource, librarySource); |
| 164 oldUnit.accept(finder); | 164 oldUnit.accept(finder); |
| 165 unitConstants.addAll(finder.constantsToCompute); | 165 unitConstants.addAll(finder.constantsToCompute); |
| 166 // Update annotation constants to using the old unit element. |
| 167 for (ConstantEvaluationTarget constant in unitConstants) { |
| 168 if (constant is ElementAnnotationImpl) { |
| 169 constant.compilationUnit = unitElement; |
| 170 } |
| 171 } |
| 166 } | 172 } |
| 167 | 173 |
| 168 ClassElementDelta _processClassMembers( | 174 ClassElementDelta _processClassMembers( |
| 169 ClassDeclaration oldClass, ClassDeclaration newClass) { | 175 ClassDeclaration oldClass, ClassDeclaration newClass) { |
| 170 // If the class hierarchy or type parameters are changed, | 176 // If the class hierarchy or type parameters are changed, |
| 171 // then the class changed too much - don't compute the delta. | 177 // then the class changed too much - don't compute the delta. |
| 172 if (newClass.abstractKeyword != null && oldClass.abstractKeyword == null || | 178 if (newClass.abstractKeyword != null && oldClass.abstractKeyword == null || |
| 173 newClass.abstractKeyword == null && oldClass.abstractKeyword != null || | 179 newClass.abstractKeyword == null && oldClass.abstractKeyword != null || |
| 174 TokenUtils.getFullCode(newClass.typeParameters) != | 180 TokenUtils.getFullCode(newClass.typeParameters) != |
| 175 TokenUtils.getFullCode(oldClass.typeParameters) || | 181 TokenUtils.getFullCode(oldClass.typeParameters) || |
| (...skipping 539 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 715 } | 721 } |
| 716 } | 722 } |
| 717 super.visitElement(element); | 723 super.visitElement(element); |
| 718 } | 724 } |
| 719 | 725 |
| 720 static bool _isVariableInitializer(Element element) { | 726 static bool _isVariableInitializer(Element element) { |
| 721 return element is FunctionElement && | 727 return element is FunctionElement && |
| 722 element.enclosingElement is VariableElement; | 728 element.enclosingElement is VariableElement; |
| 723 } | 729 } |
| 724 } | 730 } |
| OLD | NEW |