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

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

Issue 1524893002: Fix imports within the analyzer package (Closed) Base URL: https://github.com/dart-lang/sdk.git@master
Patch Set: Created 5 years 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
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.element_test; 5 library analyzer.test.generated.element_test;
6 6
7 import 'package:analyzer/dart/element/element.dart';
8 import 'package:analyzer/dart/element/type.dart';
9 import 'package:analyzer/src/dart/element/element.dart';
10 import 'package:analyzer/src/dart/element/type.dart';
7 import 'package:analyzer/src/generated/ast.dart'; 11 import 'package:analyzer/src/generated/ast.dart';
8 import 'package:analyzer/src/generated/element.dart';
9 import 'package:analyzer/src/generated/engine.dart' 12 import 'package:analyzer/src/generated/engine.dart'
10 show AnalysisContext, AnalysisOptionsImpl; 13 show AnalysisContext, AnalysisOptionsImpl;
11 import 'package:analyzer/src/generated/java_core.dart'; 14 import 'package:analyzer/src/generated/java_core.dart';
12 import 'package:analyzer/src/generated/source_io.dart'; 15 import 'package:analyzer/src/generated/source_io.dart';
13 import 'package:analyzer/src/generated/testing/ast_factory.dart'; 16 import 'package:analyzer/src/generated/testing/ast_factory.dart';
14 import 'package:analyzer/src/generated/testing/element_factory.dart'; 17 import 'package:analyzer/src/generated/testing/element_factory.dart';
15 import 'package:analyzer/src/generated/testing/test_type_provider.dart'; 18 import 'package:analyzer/src/generated/testing/test_type_provider.dart';
16 import 'package:unittest/unittest.dart'; 19 import 'package:unittest/unittest.dart';
17 20
18 import '../reflective_tests.dart'; 21 import '../reflective_tests.dart';
(...skipping 255 matching lines...) Expand 10 before | Expand all | Expand 10 after
274 ElementFactory.setterElement("foo", false, null); 277 ElementFactory.setterElement("foo", false, null);
275 classA.accessors = <PropertyAccessorElement>[setter]; 278 classA.accessors = <PropertyAccessorElement>[setter];
276 // "foo" is static 279 // "foo" is static
277 setter.static = true; 280 setter.static = true;
278 expect(classA.hasStaticMember, isTrue); 281 expect(classA.hasStaticMember, isTrue);
279 } 282 }
280 283
281 void test_isEnum() { 284 void test_isEnum() {
282 String firstConst = "A"; 285 String firstConst = "A";
283 String secondConst = "B"; 286 String secondConst = "B";
284 ClassElementImpl enumE = ElementFactory.enumElement( 287 ClassElementImpl enumE = ElementFactory
285 new TestTypeProvider(), "E", [firstConst, secondConst]); 288 .enumElement(new TestTypeProvider(), "E", [firstConst, secondConst]);
286 289
287 // E is an enum 290 // E is an enum
288 expect(enumE.isEnum, true); 291 expect(enumE.isEnum, true);
289 292
290 // A and B are static members 293 // A and B are static members
291 expect(enumE.getField(firstConst).isEnumConstant, true); 294 expect(enumE.getField(firstConst).isEnumConstant, true);
292 expect(enumE.getField(secondConst).isEnumConstant, true); 295 expect(enumE.getField(secondConst).isEnumConstant, true);
293 } 296 }
294 297
295 void test_lookUpConcreteMethod_declared() { 298 void test_lookUpConcreteMethod_declared() {
(...skipping 330 matching lines...) Expand 10 before | Expand all | Expand 10 after
626 inheritedMethod.abstract = true; 629 inheritedMethod.abstract = true;
627 classA.methods = <MethodElement>[inheritedMethod]; 630 classA.methods = <MethodElement>[inheritedMethod];
628 ClassElementImpl classB = ElementFactory.classElement("B", classA.type); 631 ClassElementImpl classB = ElementFactory.classElement("B", classA.type);
629 MethodElement method = ElementFactory.methodElement(methodName, null); 632 MethodElement method = ElementFactory.methodElement(methodName, null);
630 classB.methods = <MethodElement>[method]; 633 classB.methods = <MethodElement>[method];
631 (library.definingCompilationUnit as CompilationUnitElementImpl).types = 634 (library.definingCompilationUnit as CompilationUnitElementImpl).types =
632 <ClassElement>[classA, classB]; 635 <ClassElement>[classA, classB];
633 expect(classB.lookUpInheritedConcreteMethod(methodName, library), isNull); 636 expect(classB.lookUpInheritedConcreteMethod(methodName, library), isNull);
634 } 637 }
635 638
636 void test_lookUpInheritedConcreteMethod_declaredAndInheritedWithAbstractBetwee n() { 639 void
640 test_lookUpInheritedConcreteMethod_declaredAndInheritedWithAbstractBetween () {
637 // class A { 641 // class A {
638 // m() {} 642 // m() {}
639 // } 643 // }
640 // class B extends A { 644 // class B extends A {
641 // m(); 645 // m();
642 // } 646 // }
643 // class C extends B { 647 // class C extends B {
644 // m() {} 648 // m() {}
645 // } 649 // }
646 LibraryElementImpl library = 650 LibraryElementImpl library =
(...skipping 1250 matching lines...) Expand 10 before | Expand all | Expand 10 after
1897 functionElement.parameters = <ParameterElement>[ 1901 functionElement.parameters = <ParameterElement>[
1898 ElementFactory.requiredParameter2("a", parameterType), 1902 ElementFactory.requiredParameter2("a", parameterType),
1899 ElementFactory.positionalParameter2("b", parameterType), 1903 ElementFactory.positionalParameter2("b", parameterType),
1900 ElementFactory.namedParameter2(namedParameterName, parameterType) 1904 ElementFactory.namedParameter2(namedParameterName, parameterType)
1901 ]; 1905 ];
1902 functionElement.returnType = parameterType; 1906 functionElement.returnType = parameterType;
1903 definingClass.methods = <MethodElement>[functionElement]; 1907 definingClass.methods = <MethodElement>[functionElement];
1904 FunctionTypeImpl functionType = new FunctionTypeImpl(functionElement); 1908 FunctionTypeImpl functionType = new FunctionTypeImpl(functionElement);
1905 InterfaceTypeImpl argumentType = new InterfaceTypeImpl( 1909 InterfaceTypeImpl argumentType = new InterfaceTypeImpl(
1906 new ClassElementImpl.forNode(AstFactory.identifier3("D"))); 1910 new ClassElementImpl.forNode(AstFactory.identifier3("D")));
1907 FunctionType result = functionType.substitute2( 1911 FunctionType result = functionType
1908 <DartType>[argumentType], <DartType>[parameterType]); 1912 .substitute2(<DartType>[argumentType], <DartType>[parameterType]);
1909 expect(result.returnType, argumentType); 1913 expect(result.returnType, argumentType);
1910 List<DartType> normalParameters = result.normalParameterTypes; 1914 List<DartType> normalParameters = result.normalParameterTypes;
1911 expect(normalParameters, hasLength(1)); 1915 expect(normalParameters, hasLength(1));
1912 expect(normalParameters[0], argumentType); 1916 expect(normalParameters[0], argumentType);
1913 List<DartType> optionalParameters = result.optionalParameterTypes; 1917 List<DartType> optionalParameters = result.optionalParameterTypes;
1914 expect(optionalParameters, hasLength(1)); 1918 expect(optionalParameters, hasLength(1));
1915 expect(optionalParameters[0], argumentType); 1919 expect(optionalParameters[0], argumentType);
1916 Map<String, DartType> namedParameters = result.namedParameterTypes; 1920 Map<String, DartType> namedParameters = result.namedParameterTypes;
1917 expect(namedParameters, hasLength(1)); 1921 expect(namedParameters, hasLength(1));
1918 expect(namedParameters[namedParameterName], argumentType); 1922 expect(namedParameters[namedParameterName], argumentType);
(...skipping 15 matching lines...) Expand all
1934 ElementFactory.requiredParameter2("a", normalParameterType), 1938 ElementFactory.requiredParameter2("a", normalParameterType),
1935 ElementFactory.positionalParameter2("b", optionalParameterType), 1939 ElementFactory.positionalParameter2("b", optionalParameterType),
1936 ElementFactory.namedParameter2(namedParameterName, namedParameterType) 1940 ElementFactory.namedParameter2(namedParameterName, namedParameterType)
1937 ]; 1941 ];
1938 functionElement.returnType = returnType; 1942 functionElement.returnType = returnType;
1939 FunctionTypeImpl functionType = new FunctionTypeImpl(functionElement); 1943 FunctionTypeImpl functionType = new FunctionTypeImpl(functionElement);
1940 InterfaceTypeImpl argumentType = new InterfaceTypeImpl( 1944 InterfaceTypeImpl argumentType = new InterfaceTypeImpl(
1941 new ClassElementImpl.forNode(AstFactory.identifier3("D"))); 1945 new ClassElementImpl.forNode(AstFactory.identifier3("D")));
1942 TypeParameterTypeImpl parameterType = new TypeParameterTypeImpl( 1946 TypeParameterTypeImpl parameterType = new TypeParameterTypeImpl(
1943 new TypeParameterElementImpl.forNode(AstFactory.identifier3("E"))); 1947 new TypeParameterElementImpl.forNode(AstFactory.identifier3("E")));
1944 FunctionType result = functionType.substitute2( 1948 FunctionType result = functionType
1945 <DartType>[argumentType], <DartType>[parameterType]); 1949 .substitute2(<DartType>[argumentType], <DartType>[parameterType]);
1946 expect(result.returnType, returnType); 1950 expect(result.returnType, returnType);
1947 List<DartType> normalParameters = result.normalParameterTypes; 1951 List<DartType> normalParameters = result.normalParameterTypes;
1948 expect(normalParameters, hasLength(1)); 1952 expect(normalParameters, hasLength(1));
1949 expect(normalParameters[0], normalParameterType); 1953 expect(normalParameters[0], normalParameterType);
1950 List<DartType> optionalParameters = result.optionalParameterTypes; 1954 List<DartType> optionalParameters = result.optionalParameterTypes;
1951 expect(optionalParameters, hasLength(1)); 1955 expect(optionalParameters, hasLength(1));
1952 expect(optionalParameters[0], optionalParameterType); 1956 expect(optionalParameters[0], optionalParameterType);
1953 Map<String, DartType> namedParameters = result.namedParameterTypes; 1957 Map<String, DartType> namedParameters = result.namedParameterTypes;
1954 expect(namedParameters, hasLength(1)); 1958 expect(namedParameters, hasLength(1));
1955 expect(namedParameters[namedParameterName], namedParameterType); 1959 expect(namedParameters[namedParameterName], namedParameterType);
(...skipping 2050 matching lines...) Expand 10 before | Expand all | Expand 10 after
4006 } 4010 }
4007 4011
4008 class _FunctionTypeImplTest_isSubtypeOf_baseCase_classFunction 4012 class _FunctionTypeImplTest_isSubtypeOf_baseCase_classFunction
4009 extends InterfaceTypeImpl { 4013 extends InterfaceTypeImpl {
4010 _FunctionTypeImplTest_isSubtypeOf_baseCase_classFunction(ClassElement arg0) 4014 _FunctionTypeImplTest_isSubtypeOf_baseCase_classFunction(ClassElement arg0)
4011 : super(arg0); 4015 : super(arg0);
4012 4016
4013 @override 4017 @override
4014 bool get isDartCoreFunction => true; 4018 bool get isDartCoreFunction => true;
4015 } 4019 }
OLDNEW
« no previous file with comments | « pkg/analyzer/test/generated/declaration_resolver_test.dart ('k') | pkg/analyzer/test/generated/engine_test.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698