| OLD | NEW |
| 1 // Copyright (c) 2016, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2016, 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 /** | 5 /** |
| 6 * This library is capable of producing linked summaries from unlinked | 6 * This library is capable of producing linked summaries from unlinked |
| 7 * ones (or prelinked ones). It functions by building a miniature | 7 * ones (or prelinked ones). It functions by building a miniature |
| 8 * element model to represent the contents of the summaries, and then | 8 * element model to represent the contents of the summaries, and then |
| 9 * scanning the element model to gather linked information and adding | 9 * scanning the element model to gather linked information and adding |
| 10 * it to the summary data structures. | 10 * it to the summary data structures. |
| (...skipping 1040 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1051 DartType getTypeArgument(int i) { | 1051 DartType getTypeArgument(int i) { |
| 1052 if (i < type.typeArguments.length) { | 1052 if (i < type.typeArguments.length) { |
| 1053 return resolveTypeRef(type.typeArguments[i], typeParameterContext); | 1053 return resolveTypeRef(type.typeArguments[i], typeParameterContext); |
| 1054 } else if (!instantiateToBoundsAllowed) { | 1054 } else if (!instantiateToBoundsAllowed) { |
| 1055 // Do not allow buildType to instantiate the bounds; force dynamic. | 1055 // Do not allow buildType to instantiate the bounds; force dynamic. |
| 1056 return DynamicTypeImpl.instance; | 1056 return DynamicTypeImpl.instance; |
| 1057 } else { | 1057 } else { |
| 1058 return null; | 1058 return null; |
| 1059 } | 1059 } |
| 1060 } | 1060 } |
| 1061 |
| 1061 ReferenceableElementForLink element = resolveRef(type.reference); | 1062 ReferenceableElementForLink element = resolveRef(type.reference); |
| 1062 return element.buildType( | 1063 return element.buildType( |
| 1063 getTypeArgument, type.implicitFunctionTypeIndices); | 1064 getTypeArgument, type.implicitFunctionTypeIndices); |
| 1064 } | 1065 } |
| 1065 } | 1066 } |
| 1066 | 1067 |
| 1067 @override | 1068 @override |
| 1068 String toString() => enclosingElement.toString(); | 1069 String toString() => enclosingElement.toString(); |
| 1069 } | 1070 } |
| 1070 | 1071 |
| (...skipping 286 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1357 ConstConstructorNode(this.constructorElement); | 1358 ConstConstructorNode(this.constructorElement); |
| 1358 | 1359 |
| 1359 @override | 1360 @override |
| 1360 List<ConstNode> computeDependencies() { | 1361 List<ConstNode> computeDependencies() { |
| 1361 List<ConstNode> dependencies = <ConstNode>[]; | 1362 List<ConstNode> dependencies = <ConstNode>[]; |
| 1362 void safeAddDependency(ConstNode target) { | 1363 void safeAddDependency(ConstNode target) { |
| 1363 if (target != null) { | 1364 if (target != null) { |
| 1364 dependencies.add(target); | 1365 dependencies.add(target); |
| 1365 } | 1366 } |
| 1366 } | 1367 } |
| 1368 |
| 1367 UnlinkedExecutable unlinkedExecutable = | 1369 UnlinkedExecutable unlinkedExecutable = |
| 1368 constructorElement._unlinkedExecutable; | 1370 constructorElement._unlinkedExecutable; |
| 1369 ClassElementForLink_Class enclosingClass = | 1371 ClassElementForLink_Class enclosingClass = |
| 1370 constructorElement.enclosingElement; | 1372 constructorElement.enclosingElement; |
| 1371 ConstructorElementForLink redirectedConstructor = | 1373 ConstructorElementForLink redirectedConstructor = |
| 1372 _getFactoryRedirectedConstructor(); | 1374 _getFactoryRedirectedConstructor(); |
| 1373 if (redirectedConstructor != null) { | 1375 if (redirectedConstructor != null) { |
| 1374 if (redirectedConstructor._constNode != null) { | 1376 if (redirectedConstructor._constNode != null) { |
| 1375 safeAddDependency(redirectedConstructor._constNode); | 1377 safeAddDependency(redirectedConstructor._constNode); |
| 1376 } | 1378 } |
| (...skipping 2791 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 4168 _unlinkedExecutable.kind == UnlinkedExecutableKind.getter; | 4170 _unlinkedExecutable.kind == UnlinkedExecutableKind.getter; |
| 4169 | 4171 |
| 4170 @override | 4172 @override |
| 4171 bool get isSetter => | 4173 bool get isSetter => |
| 4172 _unlinkedExecutable.kind == UnlinkedExecutableKind.setter; | 4174 _unlinkedExecutable.kind == UnlinkedExecutableKind.setter; |
| 4173 | 4175 |
| 4174 @override | 4176 @override |
| 4175 bool get isStatic => enclosingClass == null || super.isStatic; | 4177 bool get isStatic => enclosingClass == null || super.isStatic; |
| 4176 | 4178 |
| 4177 @override | 4179 @override |
| 4178 ElementKind get kind => _unlinkedExecutable.kind == | 4180 ElementKind get kind => |
| 4179 UnlinkedExecutableKind.getter ? ElementKind.GETTER : ElementKind.SETTER; | 4181 _unlinkedExecutable.kind == UnlinkedExecutableKind.getter |
| 4182 ? ElementKind.GETTER |
| 4183 : ElementKind.SETTER; |
| 4180 | 4184 |
| 4181 @override | 4185 @override |
| 4182 ReferenceableElementForLink getContainedName(String name) { | 4186 ReferenceableElementForLink getContainedName(String name) { |
| 4183 return new NonstaticMemberElementForLink( | 4187 return new NonstaticMemberElementForLink( |
| 4184 library as LibraryElementForLink, this, name); | 4188 library as LibraryElementForLink, this, name); |
| 4185 } | 4189 } |
| 4186 | 4190 |
| 4187 @override | 4191 @override |
| 4188 FunctionElementForLink_Local getLocalFunction(int index) { | 4192 FunctionElementForLink_Local getLocalFunction(int index) { |
| 4189 // TODO(paulberry): implement | 4193 // TODO(paulberry): implement |
| (...skipping 459 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 4649 } else { | 4653 } else { |
| 4650 functionElement | 4654 functionElement |
| 4651 ._setInferredType(new ExprTypeComputer(functionElement).compute()); | 4655 ._setInferredType(new ExprTypeComputer(functionElement).compute()); |
| 4652 } | 4656 } |
| 4653 } | 4657 } |
| 4654 | 4658 |
| 4655 @override | 4659 @override |
| 4656 String toString() => 'TypeInferenceNode($functionElement)'; | 4660 String toString() => 'TypeInferenceNode($functionElement)'; |
| 4657 } | 4661 } |
| 4658 | 4662 |
| 4659 class TypeProviderForLink implements TypeProvider { | 4663 class TypeProviderForLink extends Object |
| 4664 with TypeProviderBaseMixin |
| 4665 implements TypeProvider { |
| 4660 final Linker _linker; | 4666 final Linker _linker; |
| 4661 | 4667 |
| 4662 InterfaceType _boolType; | 4668 InterfaceType _boolType; |
| 4663 InterfaceType _deprecatedType; | 4669 InterfaceType _deprecatedType; |
| 4664 InterfaceType _doubleType; | 4670 InterfaceType _doubleType; |
| 4665 InterfaceType _functionType; | 4671 InterfaceType _functionType; |
| 4666 InterfaceType _futureDynamicType; | 4672 InterfaceType _futureDynamicType; |
| 4667 InterfaceType _futureNullType; | 4673 InterfaceType _futureNullType; |
| 4668 InterfaceType _futureType; | 4674 InterfaceType _futureType; |
| 4669 InterfaceType _intType; | 4675 InterfaceType _intType; |
| (...skipping 61 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 4731 | 4737 |
| 4732 @override | 4738 @override |
| 4733 InterfaceType get listType => | 4739 InterfaceType get listType => |
| 4734 _listType ??= _buildInterfaceType(_linker.coreLibrary, 'List'); | 4740 _listType ??= _buildInterfaceType(_linker.coreLibrary, 'List'); |
| 4735 | 4741 |
| 4736 @override | 4742 @override |
| 4737 InterfaceType get mapType => | 4743 InterfaceType get mapType => |
| 4738 _mapType ??= _buildInterfaceType(_linker.coreLibrary, 'Map'); | 4744 _mapType ??= _buildInterfaceType(_linker.coreLibrary, 'Map'); |
| 4739 | 4745 |
| 4740 @override | 4746 @override |
| 4741 List<InterfaceType> get nonSubtypableTypes => <InterfaceType>[ | |
| 4742 nullType, | |
| 4743 numType, | |
| 4744 intType, | |
| 4745 doubleType, | |
| 4746 boolType, | |
| 4747 stringType | |
| 4748 ]; | |
| 4749 | |
| 4750 @override | |
| 4751 DartObjectImpl get nullObject { | 4747 DartObjectImpl get nullObject { |
| 4752 // TODO(paulberry): implement if needed | 4748 // TODO(paulberry): implement if needed |
| 4753 throw new UnimplementedError(); | 4749 throw new UnimplementedError(); |
| 4754 } | 4750 } |
| 4755 | 4751 |
| 4756 @override | 4752 @override |
| 4757 InterfaceType get nullType => | 4753 InterfaceType get nullType => |
| 4758 _nullType ??= _buildInterfaceType(_linker.coreLibrary, 'Null'); | 4754 _nullType ??= _buildInterfaceType(_linker.coreLibrary, 'Null'); |
| 4759 | 4755 |
| 4760 @override | 4756 @override |
| (...skipping 201 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 4962 * there are no type parameters in scope. | 4958 * there are no type parameters in scope. |
| 4963 */ | 4959 */ |
| 4964 TypeParameterizedElementMixin get _typeParameterContext; | 4960 TypeParameterizedElementMixin get _typeParameterContext; |
| 4965 | 4961 |
| 4966 @override | 4962 @override |
| 4967 noSuchMethod(Invocation invocation) => super.noSuchMethod(invocation); | 4963 noSuchMethod(Invocation invocation) => super.noSuchMethod(invocation); |
| 4968 | 4964 |
| 4969 @override | 4965 @override |
| 4970 String toString() => '$enclosingElement.$name'; | 4966 String toString() => '$enclosingElement.$name'; |
| 4971 } | 4967 } |
| OLD | NEW |