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

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

Issue 1120623003: Add a flag to the element model to identify mixin applications. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 5 years, 7 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 | Annotate | Revision Log
« no previous file with comments | « pkg/analyzer/lib/src/generated/resolver.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 // This code was auto-generated, is not intended to be edited, and is subject to 5 // This code was auto-generated, is not intended to be edited, and is subject to
6 // significant change. Please see the README file for more information. 6 // significant change. Please see the README file for more information.
7 7
8 library engine.all_the_rest_test; 8 library engine.all_the_rest_test;
9 9
10 import 'dart:collection'; 10 import 'dart:collection';
(...skipping 4799 matching lines...) Expand 10 before | Expand all | Expand 10 after
4810 Keyword.ABSTRACT, className, null, null, null, null); 4810 Keyword.ABSTRACT, className, null, null, null, null);
4811 classDeclaration.accept(builder); 4811 classDeclaration.accept(builder);
4812 List<ClassElement> types = holder.types; 4812 List<ClassElement> types = holder.types;
4813 expect(types, hasLength(1)); 4813 expect(types, hasLength(1));
4814 ClassElement type = types[0]; 4814 ClassElement type = types[0];
4815 expect(type, isNotNull); 4815 expect(type, isNotNull);
4816 expect(type.name, className); 4816 expect(type.name, className);
4817 List<TypeParameterElement> typeParameters = type.typeParameters; 4817 List<TypeParameterElement> typeParameters = type.typeParameters;
4818 expect(typeParameters, hasLength(0)); 4818 expect(typeParameters, hasLength(0));
4819 expect(type.isAbstract, isTrue); 4819 expect(type.isAbstract, isTrue);
4820 expect(type.isMixinApplication, isFalse);
4820 expect(type.isSynthetic, isFalse); 4821 expect(type.isSynthetic, isFalse);
4821 } 4822 }
4822 4823
4823 void test_visitClassDeclaration_minimal() { 4824 void test_visitClassDeclaration_minimal() {
4824 ElementHolder holder = new ElementHolder(); 4825 ElementHolder holder = new ElementHolder();
4825 ElementBuilder builder = new ElementBuilder(holder); 4826 ElementBuilder builder = new ElementBuilder(holder);
4826 String className = "C"; 4827 String className = "C";
4827 ClassDeclaration classDeclaration = 4828 ClassDeclaration classDeclaration =
4828 AstFactory.classDeclaration(null, className, null, null, null, null); 4829 AstFactory.classDeclaration(null, className, null, null, null, null);
4829 classDeclaration.accept(builder); 4830 classDeclaration.accept(builder);
4830 List<ClassElement> types = holder.types; 4831 List<ClassElement> types = holder.types;
4831 expect(types, hasLength(1)); 4832 expect(types, hasLength(1));
4832 ClassElement type = types[0]; 4833 ClassElement type = types[0];
4833 expect(type, isNotNull); 4834 expect(type, isNotNull);
4834 expect(type.name, className); 4835 expect(type.name, className);
4835 List<TypeParameterElement> typeParameters = type.typeParameters; 4836 List<TypeParameterElement> typeParameters = type.typeParameters;
4836 expect(typeParameters, hasLength(0)); 4837 expect(typeParameters, hasLength(0));
4837 expect(type.isAbstract, isFalse); 4838 expect(type.isAbstract, isFalse);
4839 expect(type.isMixinApplication, isFalse);
4838 expect(type.isSynthetic, isFalse); 4840 expect(type.isSynthetic, isFalse);
4839 } 4841 }
4840 4842
4841 void test_visitClassDeclaration_parameterized() { 4843 void test_visitClassDeclaration_parameterized() {
4842 ElementHolder holder = new ElementHolder(); 4844 ElementHolder holder = new ElementHolder();
4843 ElementBuilder builder = new ElementBuilder(holder); 4845 ElementBuilder builder = new ElementBuilder(holder);
4844 String className = "C"; 4846 String className = "C";
4845 String firstVariableName = "E"; 4847 String firstVariableName = "E";
4846 String secondVariableName = "F"; 4848 String secondVariableName = "F";
4847 ClassDeclaration classDeclaration = AstFactory.classDeclaration(null, 4849 ClassDeclaration classDeclaration = AstFactory.classDeclaration(null,
4848 className, 4850 className,
4849 AstFactory.typeParameterList([firstVariableName, secondVariableName]), 4851 AstFactory.typeParameterList([firstVariableName, secondVariableName]),
4850 null, null, null); 4852 null, null, null);
4851 classDeclaration.accept(builder); 4853 classDeclaration.accept(builder);
4852 List<ClassElement> types = holder.types; 4854 List<ClassElement> types = holder.types;
4853 expect(types, hasLength(1)); 4855 expect(types, hasLength(1));
4854 ClassElement type = types[0]; 4856 ClassElement type = types[0];
4855 expect(type, isNotNull); 4857 expect(type, isNotNull);
4856 expect(type.name, className); 4858 expect(type.name, className);
4857 List<TypeParameterElement> typeParameters = type.typeParameters; 4859 List<TypeParameterElement> typeParameters = type.typeParameters;
4858 expect(typeParameters, hasLength(2)); 4860 expect(typeParameters, hasLength(2));
4859 expect(typeParameters[0].name, firstVariableName); 4861 expect(typeParameters[0].name, firstVariableName);
4860 expect(typeParameters[1].name, secondVariableName); 4862 expect(typeParameters[1].name, secondVariableName);
4861 expect(type.isAbstract, isFalse); 4863 expect(type.isAbstract, isFalse);
4864 expect(type.isMixinApplication, isFalse);
4862 expect(type.isSynthetic, isFalse); 4865 expect(type.isSynthetic, isFalse);
4863 } 4866 }
4864 4867
4865 void test_visitClassDeclaration_withMembers() { 4868 void test_visitClassDeclaration_withMembers() {
4866 ElementHolder holder = new ElementHolder(); 4869 ElementHolder holder = new ElementHolder();
4867 ElementBuilder builder = new ElementBuilder(holder); 4870 ElementBuilder builder = new ElementBuilder(holder);
4868 String className = "C"; 4871 String className = "C";
4869 String typeParameterName = "E"; 4872 String typeParameterName = "E";
4870 String fieldName = "f"; 4873 String fieldName = "f";
4871 String methodName = "m"; 4874 String methodName = "m";
4872 ClassDeclaration classDeclaration = AstFactory.classDeclaration(null, 4875 ClassDeclaration classDeclaration = AstFactory.classDeclaration(null,
4873 className, AstFactory.typeParameterList([typeParameterName]), null, 4876 className, AstFactory.typeParameterList([typeParameterName]), null,
4874 null, null, [ 4877 null, null, [
4875 AstFactory.fieldDeclaration2( 4878 AstFactory.fieldDeclaration2(
4876 false, null, [AstFactory.variableDeclaration(fieldName)]), 4879 false, null, [AstFactory.variableDeclaration(fieldName)]),
4877 AstFactory.methodDeclaration2(null, null, null, null, 4880 AstFactory.methodDeclaration2(null, null, null, null,
4878 AstFactory.identifier3(methodName), AstFactory.formalParameterList(), 4881 AstFactory.identifier3(methodName), AstFactory.formalParameterList(),
4879 AstFactory.blockFunctionBody2()) 4882 AstFactory.blockFunctionBody2())
4880 ]); 4883 ]);
4881 classDeclaration.accept(builder); 4884 classDeclaration.accept(builder);
4882 List<ClassElement> types = holder.types; 4885 List<ClassElement> types = holder.types;
4883 expect(types, hasLength(1)); 4886 expect(types, hasLength(1));
4884 ClassElement type = types[0]; 4887 ClassElement type = types[0];
4885 expect(type, isNotNull); 4888 expect(type, isNotNull);
4886 expect(type.name, className); 4889 expect(type.name, className);
4887 expect(type.isAbstract, isFalse); 4890 expect(type.isAbstract, isFalse);
4891 expect(type.isMixinApplication, isFalse);
4888 expect(type.isSynthetic, isFalse); 4892 expect(type.isSynthetic, isFalse);
4889 List<TypeParameterElement> typeParameters = type.typeParameters; 4893 List<TypeParameterElement> typeParameters = type.typeParameters;
4890 expect(typeParameters, hasLength(1)); 4894 expect(typeParameters, hasLength(1));
4891 TypeParameterElement typeParameter = typeParameters[0]; 4895 TypeParameterElement typeParameter = typeParameters[0];
4892 expect(typeParameter, isNotNull); 4896 expect(typeParameter, isNotNull);
4893 expect(typeParameter.name, typeParameterName); 4897 expect(typeParameter.name, typeParameterName);
4894 List<FieldElement> fields = type.fields; 4898 List<FieldElement> fields = type.fields;
4895 expect(fields, hasLength(1)); 4899 expect(fields, hasLength(1));
4896 FieldElement field = fields[0]; 4900 FieldElement field = fields[0];
4897 expect(field, isNotNull); 4901 expect(field, isNotNull);
(...skipping 21 matching lines...) Expand all
4919 AstFactory.withClause([AstFactory.typeName(classM, [])]); 4923 AstFactory.withClause([AstFactory.typeName(classM, [])]);
4920 ClassTypeAlias alias = AstFactory.classTypeAlias( 4924 ClassTypeAlias alias = AstFactory.classTypeAlias(
4921 'C', null, null, AstFactory.typeName(classB, []), withClause, null); 4925 'C', null, null, AstFactory.typeName(classB, []), withClause, null);
4922 alias.accept(builder); 4926 alias.accept(builder);
4923 List<ClassElement> types = holder.types; 4927 List<ClassElement> types = holder.types;
4924 expect(types, hasLength(1)); 4928 expect(types, hasLength(1));
4925 ClassElement type = types[0]; 4929 ClassElement type = types[0];
4926 expect(alias.element, same(type)); 4930 expect(alias.element, same(type));
4927 expect(type.name, equals('C')); 4931 expect(type.name, equals('C'));
4928 expect(type.isAbstract, isFalse); 4932 expect(type.isAbstract, isFalse);
4933 expect(type.isMixinApplication, isTrue);
4929 expect(type.isSynthetic, isFalse); 4934 expect(type.isSynthetic, isFalse);
4930 expect(type.typeParameters, isEmpty); 4935 expect(type.typeParameters, isEmpty);
4931 expect(type.fields, isEmpty); 4936 expect(type.fields, isEmpty);
4932 expect(type.methods, isEmpty); 4937 expect(type.methods, isEmpty);
4933 } 4938 }
4934 4939
4935 void test_visitClassTypeAlias_abstract() { 4940 void test_visitClassTypeAlias_abstract() {
4936 // class B {} 4941 // class B {}
4937 // class M {} 4942 // class M {}
4938 // abstract class C = B with M 4943 // abstract class C = B with M
4939 ElementHolder holder = new ElementHolder(); 4944 ElementHolder holder = new ElementHolder();
4940 ElementBuilder builder = new ElementBuilder(holder); 4945 ElementBuilder builder = new ElementBuilder(holder);
4941 ClassElementImpl classB = ElementFactory.classElement2('B', []); 4946 ClassElementImpl classB = ElementFactory.classElement2('B', []);
4942 ConstructorElementImpl constructorB = 4947 ConstructorElementImpl constructorB =
4943 ElementFactory.constructorElement2(classB, '', []); 4948 ElementFactory.constructorElement2(classB, '', []);
4944 constructorB.setModifier(Modifier.SYNTHETIC, true); 4949 constructorB.setModifier(Modifier.SYNTHETIC, true);
4945 classB.constructors = [constructorB]; 4950 classB.constructors = [constructorB];
4946 ClassElement classM = ElementFactory.classElement2('M', []); 4951 ClassElement classM = ElementFactory.classElement2('M', []);
4947 WithClause withClause = 4952 WithClause withClause =
4948 AstFactory.withClause([AstFactory.typeName(classM, [])]); 4953 AstFactory.withClause([AstFactory.typeName(classM, [])]);
4949 ClassTypeAlias classCAst = AstFactory.classTypeAlias('C', null, 4954 ClassTypeAlias classCAst = AstFactory.classTypeAlias('C', null,
4950 Keyword.ABSTRACT, AstFactory.typeName(classB, []), withClause, null); 4955 Keyword.ABSTRACT, AstFactory.typeName(classB, []), withClause, null);
4951 classCAst.accept(builder); 4956 classCAst.accept(builder);
4952 List<ClassElement> types = holder.types; 4957 List<ClassElement> types = holder.types;
4953 expect(types, hasLength(1)); 4958 expect(types, hasLength(1));
4954 ClassElement type = types[0]; 4959 ClassElement type = types[0];
4955 expect(type.isAbstract, isTrue); 4960 expect(type.isAbstract, isTrue);
4961 expect(type.isMixinApplication, isTrue);
4956 } 4962 }
4957 4963
4958 void test_visitClassTypeAlias_typeParams() { 4964 void test_visitClassTypeAlias_typeParams() {
4959 // class B {} 4965 // class B {}
4960 // class M {} 4966 // class M {}
4961 // class C<T> = B with M 4967 // class C<T> = B with M
4962 ElementHolder holder = new ElementHolder(); 4968 ElementHolder holder = new ElementHolder();
4963 ElementBuilder builder = new ElementBuilder(holder); 4969 ElementBuilder builder = new ElementBuilder(holder);
4964 ClassElementImpl classB = ElementFactory.classElement2('B', []); 4970 ClassElementImpl classB = ElementFactory.classElement2('B', []);
4965 ConstructorElementImpl constructorB = 4971 ConstructorElementImpl constructorB =
(...skipping 3655 matching lines...) Expand 10 before | Expand all | Expand 10 after
8621 if (_expectedExternalScriptName == null) { 8627 if (_expectedExternalScriptName == null) {
8622 expect(scriptSource, isNull, reason: "script $scriptIndex"); 8628 expect(scriptSource, isNull, reason: "script $scriptIndex");
8623 } else { 8629 } else {
8624 expect(scriptSource, isNotNull, reason: "script $scriptIndex"); 8630 expect(scriptSource, isNotNull, reason: "script $scriptIndex");
8625 String actualExternalScriptName = scriptSource.shortName; 8631 String actualExternalScriptName = scriptSource.shortName;
8626 expect(actualExternalScriptName, _expectedExternalScriptName, 8632 expect(actualExternalScriptName, _expectedExternalScriptName,
8627 reason: "script $scriptIndex"); 8633 reason: "script $scriptIndex");
8628 } 8634 }
8629 } 8635 }
8630 } 8636 }
OLDNEW
« no previous file with comments | « pkg/analyzer/lib/src/generated/resolver.dart ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698