| 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 16 matching lines...) Expand all Loading... |
| 27 | 27 |
| 28 final Set<ClassElementDelta> superDeltas = new Set<ClassElementDelta>(); | 28 final Set<ClassElementDelta> superDeltas = new Set<ClassElementDelta>(); |
| 29 | 29 |
| 30 final List<PropertyAccessorElement> addedAccessors = | 30 final List<PropertyAccessorElement> addedAccessors = |
| 31 <PropertyAccessorElement>[]; | 31 <PropertyAccessorElement>[]; |
| 32 final List<PropertyAccessorElement> removedAccessors = | 32 final List<PropertyAccessorElement> removedAccessors = |
| 33 <PropertyAccessorElement>[]; | 33 <PropertyAccessorElement>[]; |
| 34 | 34 |
| 35 final List<ConstructorElement> addedConstructors = <ConstructorElement>[]; | 35 final List<ConstructorElement> addedConstructors = <ConstructorElement>[]; |
| 36 final List<ConstructorElement> removedConstructors = <ConstructorElement>[]; | 36 final List<ConstructorElement> removedConstructors = <ConstructorElement>[]; |
| 37 bool hasUnnamedConstructorChange = false; |
| 37 | 38 |
| 38 final List<MethodElement> addedMethods = <MethodElement>[]; | 39 final List<MethodElement> addedMethods = <MethodElement>[]; |
| 39 final List<MethodElement> removedMethods = <MethodElement>[]; | 40 final List<MethodElement> removedMethods = <MethodElement>[]; |
| 40 | 41 |
| 41 ClassElementDelta(this._element, this.librarySource, this.name); | 42 ClassElementDelta(this._element, this.librarySource, this.name); |
| 42 | 43 |
| 43 /** | 44 /** |
| 44 * Return `true` if this delta has changes to the [name] visible in the | 45 * Return `true` if this delta has changes to the [name] visible in the |
| 45 * given [librarySource]. | 46 * given [librarySource]. |
| 46 */ | 47 */ |
| (...skipping 290 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 337 classElement.fields = newFields.values.toList(); | 338 classElement.fields = newFields.values.toList(); |
| 338 classElement.methods = classElementHolder.methods; | 339 classElement.methods = classElementHolder.methods; |
| 339 classElement.version++; | 340 classElement.version++; |
| 340 classElementHolder.validate(); | 341 classElementHolder.validate(); |
| 341 // Ensure at least a default synthetic constructor. | 342 // Ensure at least a default synthetic constructor. |
| 342 if (classElement.constructors.isEmpty) { | 343 if (classElement.constructors.isEmpty) { |
| 343 ConstructorElementImpl constructor = | 344 ConstructorElementImpl constructor = |
| 344 new ConstructorElementImpl.forNode(null); | 345 new ConstructorElementImpl.forNode(null); |
| 345 constructor.synthetic = true; | 346 constructor.synthetic = true; |
| 346 classElement.constructors = <ConstructorElement>[constructor]; | 347 classElement.constructors = <ConstructorElement>[constructor]; |
| 348 classDelta.addedConstructors.add(constructor); |
| 347 } | 349 } |
| 350 classDelta.hasUnnamedConstructorChange = |
| 351 classDelta.addedConstructors.any((c) => c.name == '') || |
| 352 classDelta.removedConstructors.any((c) => c.name == ''); |
| 348 // OK | 353 // OK |
| 349 return classDelta; | 354 return classDelta; |
| 350 } | 355 } |
| 351 | 356 |
| 352 void _processDirectives() { | 357 void _processDirectives() { |
| 353 Map<String, Directive> oldDirectiveMap = new HashMap<String, Directive>(); | 358 Map<String, Directive> oldDirectiveMap = new HashMap<String, Directive>(); |
| 354 for (Directive oldDirective in oldUnit.directives) { | 359 for (Directive oldDirective in oldUnit.directives) { |
| 355 String code = TokenUtils.getFullCode(oldDirective); | 360 String code = TokenUtils.getFullCode(oldDirective); |
| 356 oldDirectiveMap[code] = oldDirective; | 361 oldDirectiveMap[code] = oldDirective; |
| 357 } | 362 } |
| (...skipping 339 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 697 } | 702 } |
| 698 } | 703 } |
| 699 super.visitElement(element); | 704 super.visitElement(element); |
| 700 } | 705 } |
| 701 | 706 |
| 702 static bool _isVariableInitializer(Element element) { | 707 static bool _isVariableInitializer(Element element) { |
| 703 return element is FunctionElement && | 708 return element is FunctionElement && |
| 704 element.enclosingElement is VariableElement; | 709 element.enclosingElement is VariableElement; |
| 705 } | 710 } |
| 706 } | 711 } |
| OLD | NEW |