| 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/analyzer.dart'; | 9 import 'package:analyzer/dart/element/element.dart'; |
| 10 import 'package:analyzer/src/generated/element.dart'; | 10 import 'package:analyzer/dart/element/type.dart'; |
| 11 import 'package:analyzer/src/dart/element/element.dart'; |
| 12 import 'package:analyzer/src/dart/element/type.dart'; |
| 11 import 'package:analyzer/src/generated/element_handle.dart'; | 13 import 'package:analyzer/src/generated/element_handle.dart'; |
| 12 import 'package:analyzer/src/generated/engine.dart'; | 14 import 'package:analyzer/src/generated/engine.dart'; |
| 13 import 'package:analyzer/src/generated/resolver.dart'; | 15 import 'package:analyzer/src/generated/resolver.dart'; |
| 14 import 'package:analyzer/src/generated/source_io.dart'; | 16 import 'package:analyzer/src/generated/source_io.dart'; |
| 17 import 'package:analyzer/src/generated/utilities_dart.dart'; |
| 15 import 'package:analyzer/src/summary/format.dart'; | 18 import 'package:analyzer/src/summary/format.dart'; |
| 16 | 19 |
| 17 /** | 20 /** |
| 18 * Implementation of [ElementResynthesizer] used when resynthesizing an element | 21 * Implementation of [ElementResynthesizer] used when resynthesizing an element |
| 19 * model from summaries. | 22 * model from summaries. |
| 20 */ | 23 */ |
| 21 abstract class SummaryResynthesizer extends ElementResynthesizer { | 24 abstract class SummaryResynthesizer extends ElementResynthesizer { |
| 22 /** | 25 /** |
| 23 * The parent [SummaryResynthesizer] which is asked to resynthesize elements | 26 * The parent [SummaryResynthesizer] which is asked to resynthesize elements |
| 24 * and get summaries before this resynthesizer attempts to do this. | 27 * and get summaries before this resynthesizer attempts to do this. |
| (...skipping 898 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 923 /** | 926 /** |
| 924 * Build a [DartType] object based on an [UnlinkedTypeRef]. This [DartType] | 927 * Build a [DartType] object based on an [UnlinkedTypeRef]. This [DartType] |
| 925 * may refer to elements in other libraries than the library being | 928 * may refer to elements in other libraries than the library being |
| 926 * deserialized, so handles are used to avoid having to deserialize other | 929 * deserialized, so handles are used to avoid having to deserialize other |
| 927 * libraries in the process. | 930 * libraries in the process. |
| 928 */ | 931 */ |
| 929 DartType buildType(UnlinkedTypeRef type) { | 932 DartType buildType(UnlinkedTypeRef type) { |
| 930 if (type.paramReference != 0) { | 933 if (type.paramReference != 0) { |
| 931 // TODO(paulberry): make this work for generic methods. | 934 // TODO(paulberry): make this work for generic methods. |
| 932 return currentTypeParameters[ | 935 return currentTypeParameters[ |
| 933 currentTypeParameters.length - type.paramReference].type; | 936 currentTypeParameters.length - type.paramReference] |
| 937 .type; |
| 934 } else { | 938 } else { |
| 935 // TODO(paulberry): handle references to things other than classes (note: | 939 // TODO(paulberry): handle references to things other than classes (note: |
| 936 // this should only occur in the case of erroneous code). | 940 // this should only occur in the case of erroneous code). |
| 937 // TODO(paulberry): test reference to something inside a part. | 941 // TODO(paulberry): test reference to something inside a part. |
| 938 // TODO(paulberry): test reference to something inside a part of the | 942 // TODO(paulberry): test reference to something inside a part of the |
| 939 // current lib. | 943 // current lib. |
| 940 UnlinkedReference reference = unlinkedUnit.references[type.reference]; | 944 UnlinkedReference reference = unlinkedUnit.references[type.reference]; |
| 941 LinkedReference referenceResolution = | 945 LinkedReference referenceResolution = |
| 942 linkedUnit.references[type.reference]; | 946 linkedUnit.references[type.reference]; |
| 943 ElementLocationImpl location; | 947 ElementLocationImpl location; |
| (...skipping 217 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1161 } | 1165 } |
| 1162 for (PropertyAccessorElementImpl accessor in unit.accessors) { | 1166 for (PropertyAccessorElementImpl accessor in unit.accessors) { |
| 1163 elementMap[accessor.identifier] = accessor; | 1167 elementMap[accessor.identifier] = accessor; |
| 1164 } | 1168 } |
| 1165 resummarizedElements[absoluteUri] = elementMap; | 1169 resummarizedElements[absoluteUri] = elementMap; |
| 1166 unitHolder = null; | 1170 unitHolder = null; |
| 1167 linkedUnit = null; | 1171 linkedUnit = null; |
| 1168 unlinkedUnit = null; | 1172 unlinkedUnit = null; |
| 1169 } | 1173 } |
| 1170 } | 1174 } |
| OLD | NEW |