| 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 summary_resynthesizer; | 5 library summary_resynthesizer; |
| 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/element/element.dart'; | 10 import 'package:analyzer/dart/element/element.dart'; |
| (...skipping 1584 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1595 String identifier = _getElementIdentifier(name, linkedReference.kind); | 1595 String identifier = _getElementIdentifier(name, linkedReference.kind); |
| 1596 locationComponents = getReferencedLocationComponents( | 1596 locationComponents = getReferencedLocationComponents( |
| 1597 linkedReference.dependency, linkedReference.unit, identifier); | 1597 linkedReference.dependency, linkedReference.unit, identifier); |
| 1598 } | 1598 } |
| 1599 ElementLocation location = | 1599 ElementLocation location = |
| 1600 new ElementLocationImpl.con3(locationComponents); | 1600 new ElementLocationImpl.con3(locationComponents); |
| 1601 switch (linkedReference.kind) { | 1601 switch (linkedReference.kind) { |
| 1602 case ReferenceKind.classOrEnum: | 1602 case ReferenceKind.classOrEnum: |
| 1603 element = new ClassElementHandle(summaryResynthesizer, location); | 1603 element = new ClassElementHandle(summaryResynthesizer, location); |
| 1604 break; | 1604 break; |
| 1605 case ReferenceKind.typedef: | |
| 1606 element = new FunctionTypeAliasElementHandle( | |
| 1607 summaryResynthesizer, location); | |
| 1608 break; | |
| 1609 case ReferenceKind.topLevelPropertyAccessor: | |
| 1610 element = new PropertyAccessorElementHandle( | |
| 1611 summaryResynthesizer, location); | |
| 1612 break; | |
| 1613 case ReferenceKind.constructor: | 1605 case ReferenceKind.constructor: |
| 1614 assert(location.components.length == 4); | 1606 assert(location.components.length == 4); |
| 1615 element = | 1607 element = |
| 1616 new ConstructorElementHandle(summaryResynthesizer, location); | 1608 new ConstructorElementHandle(summaryResynthesizer, location); |
| 1617 numTypeParameters = enclosingInfo.numTypeParameters; | 1609 numTypeParameters = enclosingInfo.numTypeParameters; |
| 1618 break; | 1610 break; |
| 1611 case ReferenceKind.length: |
| 1612 element = _buildStringLengthPropertyAccessorElement(); |
| 1613 break; |
| 1614 case ReferenceKind.method: |
| 1615 assert(location.components.length == 4); |
| 1616 element = new MethodElementHandle(summaryResynthesizer, location); |
| 1617 break; |
| 1619 case ReferenceKind.propertyAccessor: | 1618 case ReferenceKind.propertyAccessor: |
| 1620 assert(location.components.length == 4); | 1619 assert(location.components.length == 4); |
| 1621 element = new PropertyAccessorElementHandle( | 1620 element = new PropertyAccessorElementHandle( |
| 1622 summaryResynthesizer, location); | 1621 summaryResynthesizer, location); |
| 1623 break; | 1622 break; |
| 1624 case ReferenceKind.method: | 1623 case ReferenceKind.topLevelFunction: |
| 1625 assert(location.components.length == 4); | 1624 assert(location.components.length == 3); |
| 1626 element = new MethodElementHandle(summaryResynthesizer, location); | 1625 element = new FunctionElementHandle(summaryResynthesizer, location); |
| 1627 break; | 1626 break; |
| 1628 case ReferenceKind.length: | 1627 case ReferenceKind.topLevelPropertyAccessor: |
| 1629 element = _buildStringLengthPropertyAccessorElement(); | 1628 element = new PropertyAccessorElementHandle( |
| 1629 summaryResynthesizer, location); |
| 1630 break; | 1630 break; |
| 1631 default: | 1631 case ReferenceKind.typedef: |
| 1632 // This is an element that doesn't (yet) need to be referred to | 1632 element = new FunctionTypeAliasElementHandle( |
| 1633 // directly, so don't bother populating an element for it. | 1633 summaryResynthesizer, location); |
| 1634 // TODO(paulberry): add support for more kinds, as needed. | 1634 break; |
| 1635 case ReferenceKind.prefix: |
| 1636 case ReferenceKind.unresolved: |
| 1635 break; | 1637 break; |
| 1636 } | 1638 } |
| 1637 } | 1639 } |
| 1638 referenceInfos[i] = new _ReferenceInfo( | 1640 referenceInfos[i] = new _ReferenceInfo( |
| 1639 enclosingInfo, name, element, type, numTypeParameters); | 1641 enclosingInfo, name, element, type, numTypeParameters); |
| 1640 } | 1642 } |
| 1641 } | 1643 } |
| 1642 | 1644 |
| 1643 /** | 1645 /** |
| 1644 * Populate a [CompilationUnitElement] by deserializing all the elements | 1646 * Populate a [CompilationUnitElement] by deserializing all the elements |
| (...skipping 193 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1838 } | 1840 } |
| 1839 : () => this.element; | 1841 : () => this.element; |
| 1840 // TODO(paulberry): Is it a bug that we have to pass `false` for | 1842 // TODO(paulberry): Is it a bug that we have to pass `false` for |
| 1841 // isInstantiated? | 1843 // isInstantiated? |
| 1842 return new DeferredFunctionTypeImpl(computer, null, typeArguments, false); | 1844 return new DeferredFunctionTypeImpl(computer, null, typeArguments, false); |
| 1843 } else { | 1845 } else { |
| 1844 return null; | 1846 return null; |
| 1845 } | 1847 } |
| 1846 } | 1848 } |
| 1847 } | 1849 } |
| OLD | NEW |