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

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

Issue 14050010: New analyzer_experimental snapshot. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 7 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
OLDNEW
1 // This code was auto-generated, is not intended to be edited, and is subject to 1 // This code was auto-generated, is not intended to be edited, and is subject to
2 // significant change. Please see the README file for more information. 2 // significant change. Please see the README file for more information.
3 3
4 library engine.element_test; 4 library engine.element_test;
5 5
6 import 'dart:collection'; 6 import 'dart:collection';
7 import 'dart:io'; 7 import 'dart:io';
8 import 'package:analyzer_experimental/src/generated/java_core.dart'; 8 import 'package:analyzer_experimental/src/generated/java_core.dart';
9 import 'package:analyzer_experimental/src/generated/java_engine.dart'; 9 import 'package:analyzer_experimental/src/generated/java_engine.dart';
10 import 'package:analyzer_experimental/src/generated/java_engine_io.dart'; 10 import 'package:analyzer_experimental/src/generated/java_engine_io.dart';
(...skipping 1457 matching lines...) Expand 10 before | Expand all | Expand 10 after
1468 setter.setter = true; 1468 setter.setter = true;
1469 setter.synthetic = true; 1469 setter.synthetic = true;
1470 field.setter = setter; 1470 field.setter = setter;
1471 FunctionTypeImpl setterType = new FunctionTypeImpl.con1(getter); 1471 FunctionTypeImpl setterType = new FunctionTypeImpl.con1(getter);
1472 setterType.normalParameterTypes = <Type2> [type2]; 1472 setterType.normalParameterTypes = <Type2> [type2];
1473 setterType.returnType = VoidTypeImpl.instance; 1473 setterType.returnType = VoidTypeImpl.instance;
1474 setter.type = setterType; 1474 setter.type = setterType;
1475 } 1475 }
1476 return field; 1476 return field;
1477 } 1477 }
1478 static FieldFormalParameterElementImpl fieldFormalParameter(Identifier name) = > new FieldFormalParameterElementImpl(name);
1478 static FunctionElementImpl functionElement(String functionName) => functionEle ment4(functionName, null, null, null, null); 1479 static FunctionElementImpl functionElement(String functionName) => functionEle ment4(functionName, null, null, null, null);
1479 static FunctionElementImpl functionElement2(String functionName, ClassElement returnElement) => functionElement3(functionName, returnElement, null, null); 1480 static FunctionElementImpl functionElement2(String functionName, ClassElement returnElement) => functionElement3(functionName, returnElement, null, null);
1480 static FunctionElementImpl functionElement3(String functionName, ClassElement returnElement, List<ClassElement> normalParameters, List<ClassElement> optionalP arameters) { 1481 static FunctionElementImpl functionElement3(String functionName, ClassElement returnElement, List<ClassElement> normalParameters, List<ClassElement> optionalP arameters) {
1481 FunctionElementImpl functionElement = new FunctionElementImpl.con1(ASTFactor y.identifier3(functionName)); 1482 FunctionElementImpl functionElement = new FunctionElementImpl.con1(ASTFactor y.identifier3(functionName));
1482 FunctionTypeImpl functionType = new FunctionTypeImpl.con1(functionElement); 1483 FunctionTypeImpl functionType = new FunctionTypeImpl.con1(functionElement);
1483 functionElement.type = functionType; 1484 functionElement.type = functionType;
1484 if (returnElement != null) { 1485 if (returnElement != null) {
1485 functionType.returnType = returnElement.type; 1486 functionType.returnType = returnElement.type;
1486 } 1487 }
1487 int count = normalParameters == null ? 0 : normalParameters.length; 1488 int count = normalParameters == null ? 0 : normalParameters.length;
(...skipping 135 matching lines...) Expand 10 before | Expand all | Expand 10 after
1623 return setter; 1624 return setter;
1624 } 1625 }
1625 static TopLevelVariableElementImpl topLevelVariableElement(Identifier name) => new TopLevelVariableElementImpl.con1(name); 1626 static TopLevelVariableElementImpl topLevelVariableElement(Identifier name) => new TopLevelVariableElementImpl.con1(name);
1626 static TopLevelVariableElementImpl topLevelVariableElement2(String name) => ne w TopLevelVariableElementImpl.con2(name); 1627 static TopLevelVariableElementImpl topLevelVariableElement2(String name) => ne w TopLevelVariableElementImpl.con2(name);
1627 /** 1628 /**
1628 * Prevent the creation of instances of this class. 1629 * Prevent the creation of instances of this class.
1629 */ 1630 */
1630 ElementFactory() { 1631 ElementFactory() {
1631 } 1632 }
1632 } 1633 }
1634 class ElementKindTest extends EngineTestCase {
1635 void test_of_nonNull() {
1636 JUnitTestCase.assertSame(ElementKind.CLASS, ElementKind.of(ElementFactory.cl assElement2("A", [])));
1637 }
1638 void test_of_null() {
1639 JUnitTestCase.assertSame(ElementKind.ERROR, ElementKind.of(null));
1640 }
1641 static dartSuite() {
1642 _ut.group('ElementKindTest', () {
1643 _ut.test('test_of_nonNull', () {
1644 final __test = new ElementKindTest();
1645 runJUnitTest(__test, __test.test_of_nonNull);
1646 });
1647 _ut.test('test_of_null', () {
1648 final __test = new ElementKindTest();
1649 runJUnitTest(__test, __test.test_of_null);
1650 });
1651 });
1652 }
1653 }
1633 class ClassElementImplTest extends EngineTestCase { 1654 class ClassElementImplTest extends EngineTestCase {
1634 void test_getAllSupertypes_interface() { 1655 void test_getAllSupertypes_interface() {
1635 ClassElement classA = ElementFactory.classElement2("A", []); 1656 ClassElement classA = ElementFactory.classElement2("A", []);
1636 ClassElement classB = ElementFactory.classElement("B", classA.type, []); 1657 ClassElement classB = ElementFactory.classElement("B", classA.type, []);
1637 ClassElementImpl elementC = ElementFactory.classElement2("C", []); 1658 ClassElementImpl elementC = ElementFactory.classElement2("C", []);
1638 InterfaceType typeObject = classA.supertype; 1659 InterfaceType typeObject = classA.supertype;
1639 InterfaceType typeA = classA.type; 1660 InterfaceType typeA = classA.type;
1640 InterfaceType typeB = classB.type; 1661 InterfaceType typeB = classB.type;
1641 InterfaceType typeC = elementC.type; 1662 InterfaceType typeC = elementC.type;
1642 elementC.interfaces = <InterfaceType> [typeB]; 1663 elementC.interfaces = <InterfaceType> [typeB];
(...skipping 21 matching lines...) Expand all
1664 JUnitTestCase.assertTrue(types.contains(typeB)); 1685 JUnitTestCase.assertTrue(types.contains(typeB));
1665 JUnitTestCase.assertTrue(types.contains(typeObject)); 1686 JUnitTestCase.assertTrue(types.contains(typeObject));
1666 JUnitTestCase.assertFalse(types.contains(typeC)); 1687 JUnitTestCase.assertFalse(types.contains(typeC));
1667 } 1688 }
1668 void test_getMethod_declared() { 1689 void test_getMethod_declared() {
1669 ClassElementImpl classA = ElementFactory.classElement2("A", []); 1690 ClassElementImpl classA = ElementFactory.classElement2("A", []);
1670 String methodName = "m"; 1691 String methodName = "m";
1671 MethodElement method = ElementFactory.methodElement(methodName, null, []); 1692 MethodElement method = ElementFactory.methodElement(methodName, null, []);
1672 classA.methods = <MethodElement> [method]; 1693 classA.methods = <MethodElement> [method];
1673 JUnitTestCase.assertSame(method, classA.getMethod(methodName)); 1694 JUnitTestCase.assertSame(method, classA.getMethod(methodName));
1695 JUnitTestCase.assertSame(method, classA.getExecutable(methodName));
1674 } 1696 }
1675 void test_getMethod_undeclared() { 1697 void test_getMethod_undeclared() {
1676 ClassElementImpl classA = ElementFactory.classElement2("A", []); 1698 ClassElementImpl classA = ElementFactory.classElement2("A", []);
1677 String methodName = "m"; 1699 String methodName = "m";
1678 MethodElement method = ElementFactory.methodElement(methodName, null, []); 1700 MethodElement method = ElementFactory.methodElement(methodName, null, []);
1679 classA.methods = <MethodElement> [method]; 1701 classA.methods = <MethodElement> [method];
1680 JUnitTestCase.assertNull(classA.getMethod("${methodName}x")); 1702 JUnitTestCase.assertNull(classA.getMethod("${methodName}x"));
1703 JUnitTestCase.assertNull(classA.getExecutable("${methodName}x"));
1681 } 1704 }
1682 void test_lookUpGetter_declared() { 1705 void test_lookUpGetter_declared() {
1683 LibraryElementImpl library2 = ElementFactory.library(createAnalysisContext() , "lib"); 1706 LibraryElementImpl library2 = ElementFactory.library(createAnalysisContext() , "lib");
1684 ClassElementImpl classA = ElementFactory.classElement2("A", []); 1707 ClassElementImpl classA = ElementFactory.classElement2("A", []);
1685 String getterName = "g"; 1708 String getterName = "g";
1686 PropertyAccessorElement getter = ElementFactory.getterElement(getterName, fa lse, null); 1709 PropertyAccessorElement getter = ElementFactory.getterElement(getterName, fa lse, null);
1687 classA.accessors = <PropertyAccessorElement> [getter]; 1710 classA.accessors = <PropertyAccessorElement> [getter];
1688 ((library2.definingCompilationUnit as CompilationUnitElementImpl)).types = < ClassElement> [classA]; 1711 ((library2.definingCompilationUnit as CompilationUnitElementImpl)).types = < ClassElement> [classA];
1689 JUnitTestCase.assertSame(getter, classA.lookUpGetter(getterName, library2)); 1712 JUnitTestCase.assertSame(getter, classA.lookUpGetter(getterName, library2));
1713 JUnitTestCase.assertSame(getter, classA.lookUpExecutable(getterName, library 2));
1690 } 1714 }
1691 void test_lookUpGetter_inherited() { 1715 void test_lookUpGetter_inherited() {
1692 LibraryElementImpl library2 = ElementFactory.library(createAnalysisContext() , "lib"); 1716 LibraryElementImpl library2 = ElementFactory.library(createAnalysisContext() , "lib");
1693 ClassElementImpl classA = ElementFactory.classElement2("A", []); 1717 ClassElementImpl classA = ElementFactory.classElement2("A", []);
1694 String getterName = "g"; 1718 String getterName = "g";
1695 PropertyAccessorElement getter = ElementFactory.getterElement(getterName, fa lse, null); 1719 PropertyAccessorElement getter = ElementFactory.getterElement(getterName, fa lse, null);
1696 classA.accessors = <PropertyAccessorElement> [getter]; 1720 classA.accessors = <PropertyAccessorElement> [getter];
1697 ClassElementImpl classB = ElementFactory.classElement("B", classA.type, []); 1721 ClassElementImpl classB = ElementFactory.classElement("B", classA.type, []);
1698 ((library2.definingCompilationUnit as CompilationUnitElementImpl)).types = < ClassElement> [classA, classB]; 1722 ((library2.definingCompilationUnit as CompilationUnitElementImpl)).types = < ClassElement> [classA, classB];
1699 JUnitTestCase.assertSame(getter, classB.lookUpGetter(getterName, library2)); 1723 JUnitTestCase.assertSame(getter, classB.lookUpGetter(getterName, library2));
1724 JUnitTestCase.assertSame(getter, classB.lookUpExecutable(getterName, library 2));
1700 } 1725 }
1701 void test_lookUpGetter_undeclared() { 1726 void test_lookUpGetter_undeclared() {
1702 LibraryElementImpl library2 = ElementFactory.library(createAnalysisContext() , "lib"); 1727 LibraryElementImpl library2 = ElementFactory.library(createAnalysisContext() , "lib");
1703 ClassElementImpl classA = ElementFactory.classElement2("A", []); 1728 ClassElementImpl classA = ElementFactory.classElement2("A", []);
1704 ((library2.definingCompilationUnit as CompilationUnitElementImpl)).types = < ClassElement> [classA]; 1729 ((library2.definingCompilationUnit as CompilationUnitElementImpl)).types = < ClassElement> [classA];
1705 JUnitTestCase.assertNull(classA.lookUpGetter("g", library2)); 1730 JUnitTestCase.assertNull(classA.lookUpGetter("g", library2));
1731 JUnitTestCase.assertNull(classA.lookUpExecutable("g", library2));
1706 } 1732 }
1707 void test_lookUpMethod_declared() { 1733 void test_lookUpMethod_declared() {
1708 LibraryElementImpl library2 = ElementFactory.library(createAnalysisContext() , "lib"); 1734 LibraryElementImpl library2 = ElementFactory.library(createAnalysisContext() , "lib");
1709 ClassElementImpl classA = ElementFactory.classElement2("A", []); 1735 ClassElementImpl classA = ElementFactory.classElement2("A", []);
1710 String methodName = "m"; 1736 String methodName = "m";
1711 MethodElement method = ElementFactory.methodElement(methodName, null, []); 1737 MethodElement method = ElementFactory.methodElement(methodName, null, []);
1712 classA.methods = <MethodElement> [method]; 1738 classA.methods = <MethodElement> [method];
1713 ((library2.definingCompilationUnit as CompilationUnitElementImpl)).types = < ClassElement> [classA]; 1739 ((library2.definingCompilationUnit as CompilationUnitElementImpl)).types = < ClassElement> [classA];
1714 JUnitTestCase.assertSame(method, classA.lookUpMethod(methodName, library2)); 1740 JUnitTestCase.assertSame(method, classA.lookUpMethod(methodName, library2));
1741 JUnitTestCase.assertSame(method, classA.lookUpExecutable(methodName, library 2));
1715 } 1742 }
1716 void test_lookUpMethod_inherited() { 1743 void test_lookUpMethod_inherited() {
1717 LibraryElementImpl library2 = ElementFactory.library(createAnalysisContext() , "lib"); 1744 LibraryElementImpl library2 = ElementFactory.library(createAnalysisContext() , "lib");
1718 ClassElementImpl classA = ElementFactory.classElement2("A", []); 1745 ClassElementImpl classA = ElementFactory.classElement2("A", []);
1719 String methodName = "m"; 1746 String methodName = "m";
1720 MethodElement method = ElementFactory.methodElement(methodName, null, []); 1747 MethodElement method = ElementFactory.methodElement(methodName, null, []);
1721 classA.methods = <MethodElement> [method]; 1748 classA.methods = <MethodElement> [method];
1722 ClassElementImpl classB = ElementFactory.classElement("B", classA.type, []); 1749 ClassElementImpl classB = ElementFactory.classElement("B", classA.type, []);
1723 ((library2.definingCompilationUnit as CompilationUnitElementImpl)).types = < ClassElement> [classA, classB]; 1750 ((library2.definingCompilationUnit as CompilationUnitElementImpl)).types = < ClassElement> [classA, classB];
1724 JUnitTestCase.assertSame(method, classB.lookUpMethod(methodName, library2)); 1751 JUnitTestCase.assertSame(method, classB.lookUpMethod(methodName, library2));
1752 JUnitTestCase.assertSame(method, classB.lookUpExecutable(methodName, library 2));
1725 } 1753 }
1726 void test_lookUpMethod_undeclared() { 1754 void test_lookUpMethod_undeclared() {
1727 LibraryElementImpl library2 = ElementFactory.library(createAnalysisContext() , "lib"); 1755 LibraryElementImpl library2 = ElementFactory.library(createAnalysisContext() , "lib");
1728 ClassElementImpl classA = ElementFactory.classElement2("A", []); 1756 ClassElementImpl classA = ElementFactory.classElement2("A", []);
1729 ((library2.definingCompilationUnit as CompilationUnitElementImpl)).types = < ClassElement> [classA]; 1757 ((library2.definingCompilationUnit as CompilationUnitElementImpl)).types = < ClassElement> [classA];
1730 JUnitTestCase.assertNull(classA.lookUpMethod("m", library2)); 1758 JUnitTestCase.assertNull(classA.lookUpMethod("m", library2));
1759 JUnitTestCase.assertNull(classA.lookUpExecutable("m", library2));
1731 } 1760 }
1732 void test_lookUpSetter_declared() { 1761 void test_lookUpSetter_declared() {
1733 LibraryElementImpl library2 = ElementFactory.library(createAnalysisContext() , "lib"); 1762 LibraryElementImpl library2 = ElementFactory.library(createAnalysisContext() , "lib");
1734 ClassElementImpl classA = ElementFactory.classElement2("A", []); 1763 ClassElementImpl classA = ElementFactory.classElement2("A", []);
1735 String setterName = "s"; 1764 String setterName = "s";
1736 PropertyAccessorElement setter = ElementFactory.setterElement(setterName, fa lse, null); 1765 PropertyAccessorElement setter = ElementFactory.setterElement(setterName, fa lse, null);
1737 classA.accessors = <PropertyAccessorElement> [setter]; 1766 classA.accessors = <PropertyAccessorElement> [setter];
1738 ((library2.definingCompilationUnit as CompilationUnitElementImpl)).types = < ClassElement> [classA]; 1767 ((library2.definingCompilationUnit as CompilationUnitElementImpl)).types = < ClassElement> [classA];
1739 JUnitTestCase.assertSame(setter, classA.lookUpSetter(setterName, library2)); 1768 JUnitTestCase.assertSame(setter, classA.lookUpSetter(setterName, library2));
1769 JUnitTestCase.assertSame(setter, classA.lookUpExecutable(setterName, library 2));
1740 } 1770 }
1741 void test_lookUpSetter_inherited() { 1771 void test_lookUpSetter_inherited() {
1742 LibraryElementImpl library2 = ElementFactory.library(createAnalysisContext() , "lib"); 1772 LibraryElementImpl library2 = ElementFactory.library(createAnalysisContext() , "lib");
1743 ClassElementImpl classA = ElementFactory.classElement2("A", []); 1773 ClassElementImpl classA = ElementFactory.classElement2("A", []);
1744 String setterName = "s"; 1774 String setterName = "s";
1745 PropertyAccessorElement setter = ElementFactory.setterElement(setterName, fa lse, null); 1775 PropertyAccessorElement setter = ElementFactory.setterElement(setterName, fa lse, null);
1746 classA.accessors = <PropertyAccessorElement> [setter]; 1776 classA.accessors = <PropertyAccessorElement> [setter];
1747 ClassElementImpl classB = ElementFactory.classElement("B", classA.type, []); 1777 ClassElementImpl classB = ElementFactory.classElement("B", classA.type, []);
1748 ((library2.definingCompilationUnit as CompilationUnitElementImpl)).types = < ClassElement> [classA, classB]; 1778 ((library2.definingCompilationUnit as CompilationUnitElementImpl)).types = < ClassElement> [classA, classB];
1749 JUnitTestCase.assertSame(setter, classB.lookUpSetter(setterName, library2)); 1779 JUnitTestCase.assertSame(setter, classB.lookUpSetter(setterName, library2));
1780 JUnitTestCase.assertSame(setter, classB.lookUpExecutable(setterName, library 2));
1750 } 1781 }
1751 void test_lookUpSetter_undeclared() { 1782 void test_lookUpSetter_undeclared() {
1752 LibraryElementImpl library2 = ElementFactory.library(createAnalysisContext() , "lib"); 1783 LibraryElementImpl library2 = ElementFactory.library(createAnalysisContext() , "lib");
1753 ClassElementImpl classA = ElementFactory.classElement2("A", []); 1784 ClassElementImpl classA = ElementFactory.classElement2("A", []);
1754 ((library2.definingCompilationUnit as CompilationUnitElementImpl)).types = < ClassElement> [classA]; 1785 ((library2.definingCompilationUnit as CompilationUnitElementImpl)).types = < ClassElement> [classA];
1755 JUnitTestCase.assertNull(classA.lookUpSetter("s", library2)); 1786 JUnitTestCase.assertNull(classA.lookUpSetter("s", library2));
1787 JUnitTestCase.assertNull(classA.lookUpExecutable("s", library2));
1756 } 1788 }
1757 static dartSuite() { 1789 static dartSuite() {
1758 _ut.group('ClassElementImplTest', () { 1790 _ut.group('ClassElementImplTest', () {
1759 _ut.test('test_getAllSupertypes_interface', () { 1791 _ut.test('test_getAllSupertypes_interface', () {
1760 final __test = new ClassElementImplTest(); 1792 final __test = new ClassElementImplTest();
1761 runJUnitTest(__test, __test.test_getAllSupertypes_interface); 1793 runJUnitTest(__test, __test.test_getAllSupertypes_interface);
1762 }); 1794 });
1763 _ut.test('test_getAllSupertypes_mixins', () { 1795 _ut.test('test_getAllSupertypes_mixins', () {
1764 final __test = new ClassElementImplTest(); 1796 final __test = new ClassElementImplTest();
1765 runJUnitTest(__test, __test.test_getAllSupertypes_mixins); 1797 runJUnitTest(__test, __test.test_getAllSupertypes_mixins);
(...skipping 559 matching lines...) Expand 10 before | Expand all | Expand 10 after
2325 runJUnitTest(__test, __test.test_substitute2_notEqual); 2357 runJUnitTest(__test, __test.test_substitute2_notEqual);
2326 }); 2358 });
2327 }); 2359 });
2328 } 2360 }
2329 } 2361 }
2330 class InterfaceTypeImpl_18 extends InterfaceTypeImpl { 2362 class InterfaceTypeImpl_18 extends InterfaceTypeImpl {
2331 InterfaceTypeImpl_18(ClassElement arg0) : super.con1(arg0); 2363 InterfaceTypeImpl_18(ClassElement arg0) : super.con1(arg0);
2332 bool isDartCoreFunction() => true; 2364 bool isDartCoreFunction() => true;
2333 } 2365 }
2334 main() { 2366 main() {
2367 ElementKindTest.dartSuite();
2335 FunctionTypeImplTest.dartSuite(); 2368 FunctionTypeImplTest.dartSuite();
2336 InterfaceTypeImplTest.dartSuite(); 2369 InterfaceTypeImplTest.dartSuite();
2337 TypeVariableTypeImplTest.dartSuite(); 2370 TypeVariableTypeImplTest.dartSuite();
2338 ClassElementImplTest.dartSuite(); 2371 ClassElementImplTest.dartSuite();
2339 ElementLocationImplTest.dartSuite(); 2372 ElementLocationImplTest.dartSuite();
2340 ElementImplTest.dartSuite(); 2373 ElementImplTest.dartSuite();
2341 LibraryElementImplTest.dartSuite(); 2374 LibraryElementImplTest.dartSuite();
2342 } 2375 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698