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 /// Implementation of the element model used for deserialiation. | 5 /// Implementation of the element model used for deserialiation. |
6 /// | 6 /// |
7 /// These classes are created by [ElementDeserializer] triggered by the | 7 /// These classes are created by [ElementDeserializer] triggered by the |
8 /// [Deserializer]. | 8 /// [Deserializer]. |
9 | 9 |
10 library dart2js.serialization.modelz; | 10 library dart2js.serialization.modelz; |
(...skipping 770 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
781 namedParameters = <String>[]; | 781 namedParameters = <String>[]; |
782 namedParameterTypes = <DartType>[]; | 782 namedParameterTypes = <DartType>[]; |
783 orderedOptionalParameters.sort((Element a, Element b) { | 783 orderedOptionalParameters.sort((Element a, Element b) { |
784 return a.name.compareTo(b.name); | 784 return a.name.compareTo(b.name); |
785 }); | 785 }); |
786 for (ParameterElement parameter in orderedOptionalParameters) { | 786 for (ParameterElement parameter in orderedOptionalParameters) { |
787 namedParameters.add(parameter.name); | 787 namedParameters.add(parameter.name); |
788 namedParameterTypes.add(parameter.type); | 788 namedParameterTypes.add(parameter.type); |
789 } | 789 } |
790 } | 790 } |
| 791 List<DartType> typeVariables = |
| 792 _decoder.getTypes(Key.TYPE_VARIABLES, isOptional: true); |
791 | 793 |
792 FunctionType type = new FunctionType( | 794 FunctionType type = new FunctionType( |
793 this, | 795 this, |
794 _decoder.getType(Key.RETURN_TYPE), | 796 _decoder.getType(Key.RETURN_TYPE), |
795 parameterTypes, | 797 parameterTypes, |
796 optionalParameterTypes, | 798 optionalParameterTypes, |
797 namedParameters, | 799 namedParameters, |
798 namedParameterTypes); | 800 namedParameterTypes); |
799 _functionSignature = new FunctionSignatureX( | 801 _functionSignature = new FunctionSignatureX( |
| 802 typeVariables: typeVariables, |
800 requiredParameters: requiredParameters, | 803 requiredParameters: requiredParameters, |
801 requiredParameterCount: requiredParameterCount, | 804 requiredParameterCount: requiredParameterCount, |
802 optionalParameters: optionalParameters, | 805 optionalParameters: optionalParameters, |
803 optionalParameterCount: optionalParameterCount, | 806 optionalParameterCount: optionalParameterCount, |
804 optionalParametersAreNamed: optionalParametersAreNamed, | 807 optionalParametersAreNamed: optionalParametersAreNamed, |
805 orderedOptionalParameters: orderedOptionalParameters, | 808 orderedOptionalParameters: orderedOptionalParameters, |
806 type: type); | 809 type: type); |
807 } | 810 } |
808 return _functionSignature; | 811 return _functionSignature; |
809 } | 812 } |
(...skipping 1056 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1866 @override | 1869 @override |
1867 void ensureResolved(Resolution resolution) {} | 1870 void ensureResolved(Resolution resolution) {} |
1868 | 1871 |
1869 @override | 1872 @override |
1870 void checkCyclicReference(Resolution resolution) {} | 1873 void checkCyclicReference(Resolution resolution) {} |
1871 } | 1874 } |
1872 | 1875 |
1873 class TypeVariableElementZ extends DeserializedElementZ | 1876 class TypeVariableElementZ extends DeserializedElementZ |
1874 with AnalyzableElementMixin, AstElementMixinZ, TypedElementMixin | 1877 with AnalyzableElementMixin, AstElementMixinZ, TypedElementMixin |
1875 implements TypeVariableElement { | 1878 implements TypeVariableElement { |
1876 TypeDeclarationElement _typeDeclaration; | 1879 GenericElement _typeDeclaration; |
1877 TypeVariableType _type; | 1880 TypeVariableType _type; |
1878 DartType _bound; | 1881 DartType _bound; |
1879 Name _memberName; | 1882 Name _memberName; |
1880 | 1883 |
1881 TypeVariableElementZ(ObjectDecoder decoder) : super(decoder); | 1884 TypeVariableElementZ(ObjectDecoder decoder) : super(decoder); |
1882 | 1885 |
1883 Name get memberName { | 1886 Name get memberName { |
1884 if (_memberName == null) { | 1887 if (_memberName == null) { |
1885 _memberName = new Name(name, library); | 1888 _memberName = new Name(name, library); |
1886 } | 1889 } |
(...skipping 16 matching lines...) Expand all Loading... |
1903 @override | 1906 @override |
1904 Element get enclosingElement => typeDeclaration; | 1907 Element get enclosingElement => typeDeclaration; |
1905 | 1908 |
1906 @override | 1909 @override |
1907 Element get enclosingClass => typeDeclaration; | 1910 Element get enclosingClass => typeDeclaration; |
1908 | 1911 |
1909 @override | 1912 @override |
1910 int get index => _decoder.getInt(Key.INDEX); | 1913 int get index => _decoder.getInt(Key.INDEX); |
1911 | 1914 |
1912 @override | 1915 @override |
1913 TypeDeclarationElement get typeDeclaration { | 1916 GenericElement get typeDeclaration { |
1914 if (_typeDeclaration == null) { | 1917 if (_typeDeclaration == null) { |
1915 _typeDeclaration = _decoder.getElement(Key.TYPE_DECLARATION); | 1918 _typeDeclaration = _decoder.getElement(Key.TYPE_DECLARATION); |
1916 } | 1919 } |
1917 return _typeDeclaration; | 1920 return _typeDeclaration; |
1918 } | 1921 } |
1919 | 1922 |
1920 DartType get bound { | 1923 DartType get bound { |
1921 if (_bound == null) { | 1924 if (_bound == null) { |
1922 _bound = _decoder.getType(Key.BOUND); | 1925 _bound = _decoder.getType(Key.BOUND); |
1923 } | 1926 } |
(...skipping 393 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2317 } | 2320 } |
2318 | 2321 |
2319 @override | 2322 @override |
2320 Node get node => throw new UnsupportedError('${this}.node'); | 2323 Node get node => throw new UnsupportedError('${this}.node'); |
2321 | 2324 |
2322 @override | 2325 @override |
2323 bool get hasNode => false; | 2326 bool get hasNode => false; |
2324 | 2327 |
2325 String toString() => 'MetadataAnnotationZ(${constant.toDartText()})'; | 2328 String toString() => 'MetadataAnnotationZ(${constant.toDartText()})'; |
2326 } | 2329 } |
OLD | NEW |