| OLD | NEW | 
|---|
| 1 // Copyright (c) 2014, the Dart project authors.  Please see the AUTHORS file | 1 // Copyright (c) 2014, 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.dart.element.element; | 5 library analyzer.src.dart.element.element; | 
| 6 | 6 | 
| 7 import 'dart:collection'; | 7 import 'dart:collection'; | 
| 8 import 'dart:math' show min; | 8 import 'dart:math' show min; | 
| 9 | 9 | 
| 10 import 'package:analyzer/dart/ast/ast.dart'; | 10 import 'package:analyzer/dart/ast/ast.dart'; | 
| (...skipping 3864 matching lines...) Expand 10 before | Expand all | Expand 10 after  Loading... | 
| 3875   DartType get returnType { | 3875   DartType get returnType { | 
| 3876     if (serializedExecutable != null && | 3876     if (serializedExecutable != null && | 
| 3877         _declaredReturnType == null && | 3877         _declaredReturnType == null && | 
| 3878         _returnType == null) { | 3878         _returnType == null) { | 
| 3879       bool isSetter = | 3879       bool isSetter = | 
| 3880           serializedExecutable.kind == UnlinkedExecutableKind.setter; | 3880           serializedExecutable.kind == UnlinkedExecutableKind.setter; | 
| 3881       _returnType = enclosingUnit.resynthesizerContext.resolveLinkedType( | 3881       _returnType = enclosingUnit.resynthesizerContext.resolveLinkedType( | 
| 3882           serializedExecutable.inferredReturnTypeSlot, typeParameterContext); | 3882           serializedExecutable.inferredReturnTypeSlot, typeParameterContext); | 
| 3883       _declaredReturnType = enclosingUnit.resynthesizerContext.resolveTypeRef( | 3883       _declaredReturnType = enclosingUnit.resynthesizerContext.resolveTypeRef( | 
| 3884           serializedExecutable.returnType, typeParameterContext, | 3884           serializedExecutable.returnType, typeParameterContext, | 
| 3885           defaultVoid: isSetter && context.analysisOptions.strongMode); | 3885           defaultVoid: isSetter && context.analysisOptions.strongMode, | 
|  | 3886           declaredType: true); | 
| 3886     } | 3887     } | 
| 3887     return _returnType ?? _declaredReturnType; | 3888     return _returnType ?? _declaredReturnType; | 
| 3888   } | 3889   } | 
| 3889 | 3890 | 
| 3890   void set returnType(DartType returnType) { | 3891   void set returnType(DartType returnType) { | 
| 3891     _assertNotResynthesized(serializedExecutable); | 3892     _assertNotResynthesized(serializedExecutable); | 
| 3892     _returnType = returnType; | 3893     _returnType = returnType; | 
| 3893   } | 3894   } | 
| 3894 | 3895 | 
| 3895   @override | 3896   @override | 
| (...skipping 851 matching lines...) Expand 10 before | Expand all | Expand 10 after  Loading... | 
| 4747       for (ParameterElement parameter in parameters) { | 4748       for (ParameterElement parameter in parameters) { | 
| 4748         (parameter as ParameterElementImpl).enclosingElement = this; | 4749         (parameter as ParameterElementImpl).enclosingElement = this; | 
| 4749       } | 4750       } | 
| 4750     } | 4751     } | 
| 4751     this._parameters = parameters; | 4752     this._parameters = parameters; | 
| 4752   } | 4753   } | 
| 4753 | 4754 | 
| 4754   @override | 4755   @override | 
| 4755   DartType get returnType { | 4756   DartType get returnType { | 
| 4756     if (_unlinkedTypedef != null && _returnType == null) { | 4757     if (_unlinkedTypedef != null && _returnType == null) { | 
| 4757       _returnType = enclosingUnit.resynthesizerContext | 4758       _returnType = enclosingUnit.resynthesizerContext.resolveTypeRef( | 
| 4758           .resolveTypeRef(_unlinkedTypedef.returnType, this); | 4759           _unlinkedTypedef.returnType, this, | 
|  | 4760           declaredType: true); | 
| 4759     } | 4761     } | 
| 4760     return _returnType; | 4762     return _returnType; | 
| 4761   } | 4763   } | 
| 4762 | 4764 | 
| 4763   void set returnType(DartType returnType) { | 4765   void set returnType(DartType returnType) { | 
| 4764     _assertNotResynthesized(_unlinkedTypedef); | 4766     _assertNotResynthesized(_unlinkedTypedef); | 
| 4765     _returnType = returnType; | 4767     _returnType = returnType; | 
| 4766   } | 4768   } | 
| 4767 | 4769 | 
| 4768   @override | 4770   @override | 
| (...skipping 2125 matching lines...) Expand 10 before | Expand all | Expand 10 after  Loading... | 
| 6894       return _unlinkedVariable.nameOffset; | 6896       return _unlinkedVariable.nameOffset; | 
| 6895     } | 6897     } | 
| 6896     return offset; | 6898     return offset; | 
| 6897   } | 6899   } | 
| 6898 | 6900 | 
| 6899   @override | 6901   @override | 
| 6900   DartType get type { | 6902   DartType get type { | 
| 6901     if (_unlinkedVariable != null && _declaredType == null && _type == null) { | 6903     if (_unlinkedVariable != null && _declaredType == null && _type == null) { | 
| 6902       _type = enclosingUnit.resynthesizerContext.resolveLinkedType( | 6904       _type = enclosingUnit.resynthesizerContext.resolveLinkedType( | 
| 6903           _unlinkedVariable.inferredTypeSlot, typeParameterContext); | 6905           _unlinkedVariable.inferredTypeSlot, typeParameterContext); | 
| 6904       _declaredType = enclosingUnit.resynthesizerContext | 6906       _declaredType = enclosingUnit.resynthesizerContext.resolveTypeRef( | 
| 6905           .resolveTypeRef(_unlinkedVariable.type, typeParameterContext); | 6907           _unlinkedVariable.type, typeParameterContext, | 
|  | 6908           declaredType: true); | 
| 6906     } | 6909     } | 
| 6907     return super.type; | 6910     return super.type; | 
| 6908   } | 6911   } | 
| 6909 | 6912 | 
| 6910   void set type(DartType type) { | 6913   void set type(DartType type) { | 
| 6911     _assertNotResynthesized(_unlinkedVariable); | 6914     _assertNotResynthesized(_unlinkedVariable); | 
| 6912     _type = type; | 6915     _type = type; | 
| 6913   } | 6916   } | 
| 6914 | 6917 | 
| 6915   /** | 6918   /** | 
| (...skipping 466 matching lines...) Expand 10 before | Expand all | Expand 10 after  Loading... | 
| 7382         parameterTypeElement.returnType = enclosingUnit.resynthesizerContext | 7385         parameterTypeElement.returnType = enclosingUnit.resynthesizerContext | 
| 7383             .resolveTypeRef(_unlinkedParam.type, typeParameterContext); | 7386             .resolveTypeRef(_unlinkedParam.type, typeParameterContext); | 
| 7384         FunctionTypeImpl parameterType = | 7387         FunctionTypeImpl parameterType = | 
| 7385             new FunctionTypeImpl.elementWithNameAndArgs(parameterTypeElement, | 7388             new FunctionTypeImpl.elementWithNameAndArgs(parameterTypeElement, | 
| 7386                 null, typeParameterContext.allTypeParameterTypes, false); | 7389                 null, typeParameterContext.allTypeParameterTypes, false); | 
| 7387         parameterTypeElement.type = parameterType; | 7390         parameterTypeElement.type = parameterType; | 
| 7388         _type = parameterType; | 7391         _type = parameterType; | 
| 7389       } else { | 7392       } else { | 
| 7390         _type = enclosingUnit.resynthesizerContext.resolveLinkedType( | 7393         _type = enclosingUnit.resynthesizerContext.resolveLinkedType( | 
| 7391             _unlinkedParam.inferredTypeSlot, typeParameterContext); | 7394             _unlinkedParam.inferredTypeSlot, typeParameterContext); | 
| 7392         _declaredType = enclosingUnit.resynthesizerContext | 7395         _declaredType = enclosingUnit.resynthesizerContext.resolveTypeRef( | 
| 7393             .resolveTypeRef(_unlinkedParam.type, typeParameterContext); | 7396             _unlinkedParam.type, typeParameterContext, | 
|  | 7397             declaredType: true); | 
| 7394       } | 7398       } | 
| 7395     } | 7399     } | 
| 7396   } | 7400   } | 
| 7397 | 7401 | 
| 7398   /** | 7402   /** | 
| 7399    * Create and return [ParameterElement]s for the given [unlinkedParameters]. | 7403    * Create and return [ParameterElement]s for the given [unlinkedParameters]. | 
| 7400    */ | 7404    */ | 
| 7401   static List<ParameterElement> resynthesizeList( | 7405   static List<ParameterElement> resynthesizeList( | 
| 7402       List<UnlinkedParam> unlinkedParameters, ElementImpl enclosingElement, | 7406       List<UnlinkedParam> unlinkedParameters, ElementImpl enclosingElement, | 
| 7403       {bool synthetic: false}) { | 7407       {bool synthetic: false}) { | 
| (...skipping 537 matching lines...) Expand 10 before | Expand all | Expand 10 after  Loading... | 
| 7941 | 7945 | 
| 7942   /** | 7946   /** | 
| 7943    * Resolve an [EntityRef] into a type.  If the reference is | 7947    * Resolve an [EntityRef] into a type.  If the reference is | 
| 7944    * unresolved, return [DynamicTypeImpl.instance]. | 7948    * unresolved, return [DynamicTypeImpl.instance]. | 
| 7945    * | 7949    * | 
| 7946    * TODO(paulberry): or should we have a class representing an | 7950    * TODO(paulberry): or should we have a class representing an | 
| 7947    * unresolved type, for consistency with the full element model? | 7951    * unresolved type, for consistency with the full element model? | 
| 7948    */ | 7952    */ | 
| 7949   DartType resolveTypeRef( | 7953   DartType resolveTypeRef( | 
| 7950       EntityRef type, TypeParameterizedElementMixin typeParameterContext, | 7954       EntityRef type, TypeParameterizedElementMixin typeParameterContext, | 
| 7951       {bool defaultVoid: false, bool instantiateToBoundsAllowed: true}); | 7955       {bool defaultVoid: false, | 
|  | 7956       bool instantiateToBoundsAllowed: true, | 
|  | 7957       bool declaredType: false}); | 
| 7952 } | 7958 } | 
| 7953 | 7959 | 
| 7954 /** | 7960 /** | 
| 7955  * A concrete implementation of a [ShowElementCombinator]. | 7961  * A concrete implementation of a [ShowElementCombinator]. | 
| 7956  */ | 7962  */ | 
| 7957 class ShowElementCombinatorImpl implements ShowElementCombinator { | 7963 class ShowElementCombinatorImpl implements ShowElementCombinator { | 
| 7958   /** | 7964   /** | 
| 7959    * The unlinked representation of the combinator in the summary. | 7965    * The unlinked representation of the combinator in the summary. | 
| 7960    */ | 7966    */ | 
| 7961   final UnlinkedCombinator _unlinkedCombinator; | 7967   final UnlinkedCombinator _unlinkedCombinator; | 
| (...skipping 179 matching lines...) Expand 10 before | Expand all | Expand 10 after  Loading... | 
| 8141     isSynthetic = true; | 8147     isSynthetic = true; | 
| 8142   } | 8148   } | 
| 8143 | 8149 | 
| 8144   DartType get bound { | 8150   DartType get bound { | 
| 8145     if (_unlinkedTypeParam != null) { | 8151     if (_unlinkedTypeParam != null) { | 
| 8146       if (_unlinkedTypeParam.bound == null) { | 8152       if (_unlinkedTypeParam.bound == null) { | 
| 8147         return null; | 8153         return null; | 
| 8148       } | 8154       } | 
| 8149       return _bound ??= enclosingUnit.resynthesizerContext.resolveTypeRef( | 8155       return _bound ??= enclosingUnit.resynthesizerContext.resolveTypeRef( | 
| 8150           _unlinkedTypeParam.bound, enclosingElement, | 8156           _unlinkedTypeParam.bound, enclosingElement, | 
| 8151           instantiateToBoundsAllowed: false); | 8157           instantiateToBoundsAllowed: false, declaredType: true); | 
| 8152     } | 8158     } | 
| 8153     return _bound; | 8159     return _bound; | 
| 8154   } | 8160   } | 
| 8155 | 8161 | 
| 8156   void set bound(DartType bound) { | 8162   void set bound(DartType bound) { | 
| 8157     _assertNotResynthesized(_unlinkedTypeParam); | 8163     _assertNotResynthesized(_unlinkedTypeParam); | 
| 8158     _bound = bound; | 8164     _bound = bound; | 
| 8159   } | 8165   } | 
| 8160 | 8166 | 
| 8161   @override | 8167   @override | 
| (...skipping 463 matching lines...) Expand 10 before | Expand all | Expand 10 after  Loading... | 
| 8625 | 8631 | 
| 8626   @override | 8632   @override | 
| 8627   void visitElement(Element element) { | 8633   void visitElement(Element element) { | 
| 8628     int offset = element.nameOffset; | 8634     int offset = element.nameOffset; | 
| 8629     if (offset != -1) { | 8635     if (offset != -1) { | 
| 8630       map[offset] = element; | 8636       map[offset] = element; | 
| 8631     } | 8637     } | 
| 8632     super.visitElement(element); | 8638     super.visitElement(element); | 
| 8633   } | 8639   } | 
| 8634 } | 8640 } | 
| OLD | NEW | 
|---|