Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(52)

Side by Side Diff: pkg/analyzer/test/generated/resolver_test.dart

Issue 2974513002: Remove ExecutableElement.labels usages in tests. (Closed)
Patch Set: Created 3 years, 5 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « pkg/analyzer/test/dart/element/builder_test.dart ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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:async'; 7 import 'dart:async';
8 import 'dart:collection'; 8 import 'dart:collection';
9 9
10 import 'package:analyzer/dart/ast/ast.dart'; 10 import 'package:analyzer/dart/ast/ast.dart';
(...skipping 3114 matching lines...) Expand 10 before | Expand all | Expand 10 after
3125 ClassTypeAlias alias = AstTestFactory.classTypeAlias( 3125 ClassTypeAlias alias = AstTestFactory.classTypeAlias(
3126 'C', null, null, AstTestFactory.typeName(classB, []), withClause, null); 3126 'C', null, null, AstTestFactory.typeName(classB, []), withClause, null);
3127 alias.name.staticElement = classC; 3127 alias.name.staticElement = classC;
3128 _resolveNode(alias, [classT, classB, classM, classC]); 3128 _resolveNode(alias, [classT, classB, classM, classC]);
3129 expect(classC.constructors, hasLength(1)); 3129 expect(classC.constructors, hasLength(1));
3130 ConstructorElement constructor = classC.constructors[0]; 3130 ConstructorElement constructor = classC.constructors[0];
3131 expect(constructor.isFactory, isFalse); 3131 expect(constructor.isFactory, isFalse);
3132 expect(constructor.isSynthetic, isTrue); 3132 expect(constructor.isSynthetic, isTrue);
3133 expect(constructor.name, 'c1'); 3133 expect(constructor.name, 'c1');
3134 expect(constructor.functions, hasLength(0)); 3134 expect(constructor.functions, hasLength(0));
3135 expect(constructor.labels, hasLength(0));
3136 expect(constructor.parameters, isEmpty); 3135 expect(constructor.parameters, isEmpty);
3137 } 3136 }
3138 3137
3139 test_visitClassTypeAlias_constructorWithParams() async { 3138 test_visitClassTypeAlias_constructorWithParams() async {
3140 // class T {} 3139 // class T {}
3141 // class B { 3140 // class B {
3142 // B(T a0); 3141 // B(T a0);
3143 // } 3142 // }
3144 // class M {} 3143 // class M {}
3145 // class C = B with M 3144 // class C = B with M
3146 ClassElement classT = ElementFactory.classElement2('T', []); 3145 ClassElement classT = ElementFactory.classElement2('T', []);
3147 ClassElementImpl classB = ElementFactory.classElement2('B', []); 3146 ClassElementImpl classB = ElementFactory.classElement2('B', []);
3148 ConstructorElementImpl constructorB = 3147 ConstructorElementImpl constructorB =
3149 ElementFactory.constructorElement2(classB, '', [classT.type]); 3148 ElementFactory.constructorElement2(classB, '', [classT.type]);
3150 classB.constructors = [constructorB]; 3149 classB.constructors = [constructorB];
3151 ClassElement classM = ElementFactory.classElement2('M', []); 3150 ClassElement classM = ElementFactory.classElement2('M', []);
3152 WithClause withClause = 3151 WithClause withClause =
3153 AstTestFactory.withClause([AstTestFactory.typeName(classM, [])]); 3152 AstTestFactory.withClause([AstTestFactory.typeName(classM, [])]);
3154 ClassElement classC = ElementFactory.classTypeAlias2('C', []); 3153 ClassElement classC = ElementFactory.classTypeAlias2('C', []);
3155 ClassTypeAlias alias = AstTestFactory.classTypeAlias( 3154 ClassTypeAlias alias = AstTestFactory.classTypeAlias(
3156 'C', null, null, AstTestFactory.typeName(classB, []), withClause, null); 3155 'C', null, null, AstTestFactory.typeName(classB, []), withClause, null);
3157 alias.name.staticElement = classC; 3156 alias.name.staticElement = classC;
3158 _resolveNode(alias, [classT, classB, classM, classC]); 3157 _resolveNode(alias, [classT, classB, classM, classC]);
3159 expect(classC.constructors, hasLength(1)); 3158 expect(classC.constructors, hasLength(1));
3160 ConstructorElement constructor = classC.constructors[0]; 3159 ConstructorElement constructor = classC.constructors[0];
3161 expect(constructor.isFactory, isFalse); 3160 expect(constructor.isFactory, isFalse);
3162 expect(constructor.isSynthetic, isTrue); 3161 expect(constructor.isSynthetic, isTrue);
3163 expect(constructor.name, ''); 3162 expect(constructor.name, '');
3164 expect(constructor.functions, hasLength(0)); 3163 expect(constructor.functions, hasLength(0));
3165 expect(constructor.labels, hasLength(0));
3166 expect(constructor.parameters, hasLength(1)); 3164 expect(constructor.parameters, hasLength(1));
3167 expect(constructor.parameters[0].type, equals(classT.type)); 3165 expect(constructor.parameters[0].type, equals(classT.type));
3168 expect(constructor.parameters[0].name, 3166 expect(constructor.parameters[0].name,
3169 equals(constructorB.parameters[0].name)); 3167 equals(constructorB.parameters[0].name));
3170 } 3168 }
3171 3169
3172 test_visitClassTypeAlias_defaultConstructor() async { 3170 test_visitClassTypeAlias_defaultConstructor() async {
3173 // class B {} 3171 // class B {}
3174 // class M {} 3172 // class M {}
3175 // class C = B with M 3173 // class C = B with M
3176 ClassElementImpl classB = ElementFactory.classElement2('B', []); 3174 ClassElementImpl classB = ElementFactory.classElement2('B', []);
3177 ConstructorElementImpl constructorB = 3175 ConstructorElementImpl constructorB =
3178 ElementFactory.constructorElement2(classB, '', []); 3176 ElementFactory.constructorElement2(classB, '', []);
3179 constructorB.setModifier(Modifier.SYNTHETIC, true); 3177 constructorB.setModifier(Modifier.SYNTHETIC, true);
3180 classB.constructors = [constructorB]; 3178 classB.constructors = [constructorB];
3181 ClassElement classM = ElementFactory.classElement2('M', []); 3179 ClassElement classM = ElementFactory.classElement2('M', []);
3182 WithClause withClause = 3180 WithClause withClause =
3183 AstTestFactory.withClause([AstTestFactory.typeName(classM, [])]); 3181 AstTestFactory.withClause([AstTestFactory.typeName(classM, [])]);
3184 ClassElement classC = ElementFactory.classTypeAlias2('C', []); 3182 ClassElement classC = ElementFactory.classTypeAlias2('C', []);
3185 ClassTypeAlias alias = AstTestFactory.classTypeAlias( 3183 ClassTypeAlias alias = AstTestFactory.classTypeAlias(
3186 'C', null, null, AstTestFactory.typeName(classB, []), withClause, null); 3184 'C', null, null, AstTestFactory.typeName(classB, []), withClause, null);
3187 alias.name.staticElement = classC; 3185 alias.name.staticElement = classC;
3188 _resolveNode(alias, [classB, classM, classC]); 3186 _resolveNode(alias, [classB, classM, classC]);
3189 expect(classC.constructors, hasLength(1)); 3187 expect(classC.constructors, hasLength(1));
3190 ConstructorElement constructor = classC.constructors[0]; 3188 ConstructorElement constructor = classC.constructors[0];
3191 expect(constructor.isFactory, isFalse); 3189 expect(constructor.isFactory, isFalse);
3192 expect(constructor.isSynthetic, isTrue); 3190 expect(constructor.isSynthetic, isTrue);
3193 expect(constructor.name, ''); 3191 expect(constructor.name, '');
3194 expect(constructor.functions, hasLength(0)); 3192 expect(constructor.functions, hasLength(0));
3195 expect(constructor.labels, hasLength(0));
3196 expect(constructor.parameters, isEmpty); 3193 expect(constructor.parameters, isEmpty);
3197 } 3194 }
3198 3195
3199 test_visitFieldFormalParameter_functionType() async { 3196 test_visitFieldFormalParameter_functionType() async {
3200 InterfaceType intType = _typeProvider.intType; 3197 InterfaceType intType = _typeProvider.intType;
3201 TypeName intTypeName = AstTestFactory.typeName4("int"); 3198 TypeName intTypeName = AstTestFactory.typeName4("int");
3202 String innerParameterName = "a"; 3199 String innerParameterName = "a";
3203 SimpleFormalParameterImpl parameter = 3200 SimpleFormalParameterImpl parameter =
3204 AstTestFactory.simpleFormalParameter3(innerParameterName); 3201 AstTestFactory.simpleFormalParameter3(innerParameterName);
3205 parameter.element = parameter.identifier.staticElement = 3202 parameter.element = parameter.identifier.staticElement =
(...skipping 410 matching lines...) Expand 10 before | Expand all | Expand 10 after
3616 */ 3613 */
3617 class _StaleElement extends ElementImpl { 3614 class _StaleElement extends ElementImpl {
3618 _StaleElement() : super("_StaleElement", -1); 3615 _StaleElement() : super("_StaleElement", -1);
3619 3616
3620 @override 3617 @override
3621 get kind => throw "_StaleElement's kind shouldn't be accessed"; 3618 get kind => throw "_StaleElement's kind shouldn't be accessed";
3622 3619
3623 @override 3620 @override
3624 T accept<T>(_) => throw "_StaleElement shouldn't be visited"; 3621 T accept<T>(_) => throw "_StaleElement shouldn't be visited";
3625 } 3622 }
OLDNEW
« no previous file with comments | « pkg/analyzer/test/dart/element/builder_test.dart ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698