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.test.generated.resolver_test; | 5 library analyzer.test.generated.resolver_test; |
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/ast/token.dart'; | 10 import 'package:analyzer/dart/ast/token.dart'; |
(...skipping 2904 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2915 InterfaceType mockStreamType = mockAsyncLib.getType('Stream').type; | 2915 InterfaceType mockStreamType = mockAsyncLib.getType('Stream').type; |
2916 expect(provider.streamType, same(mockStreamType)); | 2916 expect(provider.streamType, same(mockStreamType)); |
2917 expect(provider.typeType, same(typeType)); | 2917 expect(provider.typeType, same(typeType)); |
2918 } | 2918 } |
2919 | 2919 |
2920 ClassElement _classElement(String typeName, InterfaceType superclassType, | 2920 ClassElement _classElement(String typeName, InterfaceType superclassType, |
2921 [List<String> parameterNames]) { | 2921 [List<String> parameterNames]) { |
2922 ClassElementImpl element = | 2922 ClassElementImpl element = |
2923 new ClassElementImpl.forNode(AstFactory.identifier3(typeName)); | 2923 new ClassElementImpl.forNode(AstFactory.identifier3(typeName)); |
2924 element.supertype = superclassType; | 2924 element.supertype = superclassType; |
2925 InterfaceTypeImpl type = new InterfaceTypeImpl(element); | |
2926 element.type = type; | |
2927 if (parameterNames != null) { | 2925 if (parameterNames != null) { |
2928 int count = parameterNames.length; | 2926 int count = parameterNames.length; |
2929 if (count > 0) { | 2927 if (count > 0) { |
2930 List<TypeParameterElementImpl> typeParameters = | 2928 List<TypeParameterElementImpl> typeParameters = |
2931 new List<TypeParameterElementImpl>(count); | 2929 new List<TypeParameterElementImpl>(count); |
2932 List<TypeParameterTypeImpl> typeArguments = | 2930 List<TypeParameterTypeImpl> typeArguments = |
2933 new List<TypeParameterTypeImpl>(count); | 2931 new List<TypeParameterTypeImpl>(count); |
2934 for (int i = 0; i < count; i++) { | 2932 for (int i = 0; i < count; i++) { |
2935 TypeParameterElementImpl typeParameter = | 2933 TypeParameterElementImpl typeParameter = |
2936 new TypeParameterElementImpl.forNode( | 2934 new TypeParameterElementImpl.forNode( |
2937 AstFactory.identifier3(parameterNames[i])); | 2935 AstFactory.identifier3(parameterNames[i])); |
2938 typeParameters[i] = typeParameter; | 2936 typeParameters[i] = typeParameter; |
2939 typeArguments[i] = new TypeParameterTypeImpl(typeParameter); | 2937 typeArguments[i] = new TypeParameterTypeImpl(typeParameter); |
2940 typeParameter.type = typeArguments[i]; | 2938 typeParameter.type = typeArguments[i]; |
2941 } | 2939 } |
2942 element.typeParameters = typeParameters; | 2940 element.typeParameters = typeParameters; |
2943 type.typeArguments = typeArguments; | |
2944 } | 2941 } |
2945 } | 2942 } |
2946 return element; | 2943 return element; |
2947 } | 2944 } |
2948 } | 2945 } |
2949 | 2946 |
2950 @reflectiveTest | 2947 @reflectiveTest |
2951 class TypeResolverVisitorTest { | 2948 class TypeResolverVisitorTest { |
2952 /** | 2949 /** |
2953 * The error listener to which errors will be reported. | 2950 * The error listener to which errors will be reported. |
(...skipping 646 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3600 */ | 3597 */ |
3601 class _StaleElement extends ElementImpl { | 3598 class _StaleElement extends ElementImpl { |
3602 _StaleElement() : super("_StaleElement", -1); | 3599 _StaleElement() : super("_StaleElement", -1); |
3603 | 3600 |
3604 @override | 3601 @override |
3605 get kind => throw "_StaleElement's kind shouldn't be accessed"; | 3602 get kind => throw "_StaleElement's kind shouldn't be accessed"; |
3606 | 3603 |
3607 @override | 3604 @override |
3608 accept(_) => throw "_StaleElement shouldn't be visited"; | 3605 accept(_) => throw "_StaleElement shouldn't be visited"; |
3609 } | 3606 } |
OLD | NEW |