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

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

Issue 12604020: analyzer_experimental checkpoint and AnalysisContext example. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Don't mark Source as 'changed'. Created 7 years, 9 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 1141 matching lines...) Expand 10 before | Expand all | Expand 10 after
1152 String fileName = "${libraryName}.dart"; 1152 String fileName = "${libraryName}.dart";
1153 FileBasedSource source = new FileBasedSource.con1(context.sourceFactory, Fil eUtilities2.createFile(fileName)); 1153 FileBasedSource source = new FileBasedSource.con1(context.sourceFactory, Fil eUtilities2.createFile(fileName));
1154 CompilationUnitElementImpl unit = new CompilationUnitElementImpl(fileName); 1154 CompilationUnitElementImpl unit = new CompilationUnitElementImpl(fileName);
1155 unit.source = source; 1155 unit.source = source;
1156 LibraryElementImpl library = new LibraryElementImpl(context, ASTFactory.libr aryIdentifier2([libraryName])); 1156 LibraryElementImpl library = new LibraryElementImpl(context, ASTFactory.libr aryIdentifier2([libraryName]));
1157 library.definingCompilationUnit = unit; 1157 library.definingCompilationUnit = unit;
1158 return library; 1158 return library;
1159 } 1159 }
1160 static LocalVariableElementImpl localVariableElement(Identifier name) => new L ocalVariableElementImpl(name); 1160 static LocalVariableElementImpl localVariableElement(Identifier name) => new L ocalVariableElementImpl(name);
1161 static LocalVariableElementImpl localVariableElement2(String name) => new Loca lVariableElementImpl(ASTFactory.identifier2(name)); 1161 static LocalVariableElementImpl localVariableElement2(String name) => new Loca lVariableElementImpl(ASTFactory.identifier2(name));
1162 static MethodElementImpl methodElement(String methodName, Type2 returnType13, List<Type2> argumentTypes) { 1162 static MethodElementImpl methodElement(String methodName, Type2 returnType14, List<Type2> argumentTypes) {
1163 MethodElementImpl method = new MethodElementImpl.con1(ASTFactory.identifier2 (methodName)); 1163 MethodElementImpl method = new MethodElementImpl.con1(ASTFactory.identifier2 (methodName));
1164 int count = argumentTypes.length; 1164 int count = argumentTypes.length;
1165 List<ParameterElement> parameters = new List<ParameterElement>(count); 1165 List<ParameterElement> parameters = new List<ParameterElement>(count);
1166 for (int i = 0; i < count; i++) { 1166 for (int i = 0; i < count; i++) {
1167 ParameterElementImpl parameter = new ParameterElementImpl(ASTFactory.ident ifier2("a${i}")); 1167 ParameterElementImpl parameter = new ParameterElementImpl(ASTFactory.ident ifier2("a${i}"));
1168 parameter.type = argumentTypes[i]; 1168 parameter.type = argumentTypes[i];
1169 parameter.parameterKind = ParameterKind.REQUIRED; 1169 parameter.parameterKind = ParameterKind.REQUIRED;
1170 parameters[i] = parameter; 1170 parameters[i] = parameter;
1171 } 1171 }
1172 method.parameters = parameters; 1172 method.parameters = parameters;
1173 FunctionTypeImpl methodType = new FunctionTypeImpl.con1(method); 1173 FunctionTypeImpl methodType = new FunctionTypeImpl.con1(method);
1174 methodType.normalParameterTypes = argumentTypes; 1174 methodType.normalParameterTypes = argumentTypes;
1175 methodType.returnType = returnType13; 1175 methodType.returnType = returnType14;
1176 method.type = methodType; 1176 method.type = methodType;
1177 return method; 1177 return method;
1178 } 1178 }
1179 static ParameterElementImpl namedParameter(String name) { 1179 static ParameterElementImpl namedParameter(String name) {
1180 ParameterElementImpl parameter = new ParameterElementImpl(ASTFactory.identif ier2(name)); 1180 ParameterElementImpl parameter = new ParameterElementImpl(ASTFactory.identif ier2(name));
1181 parameter.parameterKind = ParameterKind.NAMED; 1181 parameter.parameterKind = ParameterKind.NAMED;
1182 return parameter; 1182 return parameter;
1183 } 1183 }
1184 static ParameterElementImpl positionalParameter(String name) { 1184 static ParameterElementImpl positionalParameter(String name) {
1185 ParameterElementImpl parameter = new ParameterElementImpl(ASTFactory.identif ier2(name)); 1185 ParameterElementImpl parameter = new ParameterElementImpl(ASTFactory.identif ier2(name));
(...skipping 273 matching lines...) Expand 10 before | Expand all | Expand 10 after
1459 Map<String, Type2> types = type.namedParameterTypes; 1459 Map<String, Type2> types = type.namedParameterTypes;
1460 EngineTestCase.assertSize2(0, types); 1460 EngineTestCase.assertSize2(0, types);
1461 } 1461 }
1462 void test_getNormalParameterTypes() { 1462 void test_getNormalParameterTypes() {
1463 FunctionTypeImpl type = new FunctionTypeImpl.con1(new FunctionElementImpl.co n1(ASTFactory.identifier2("f"))); 1463 FunctionTypeImpl type = new FunctionTypeImpl.con1(new FunctionElementImpl.co n1(ASTFactory.identifier2("f")));
1464 List<Type2> types = type.normalParameterTypes; 1464 List<Type2> types = type.normalParameterTypes;
1465 EngineTestCase.assertLength(0, types); 1465 EngineTestCase.assertLength(0, types);
1466 } 1466 }
1467 void test_getReturnType() { 1467 void test_getReturnType() {
1468 FunctionTypeImpl type = new FunctionTypeImpl.con1(new FunctionElementImpl.co n1(ASTFactory.identifier2("f"))); 1468 FunctionTypeImpl type = new FunctionTypeImpl.con1(new FunctionElementImpl.co n1(ASTFactory.identifier2("f")));
1469 Type2 returnType9 = type.returnType; 1469 Type2 returnType10 = type.returnType;
1470 JUnitTestCase.assertEquals(VoidTypeImpl.instance, returnType9); 1470 JUnitTestCase.assertEquals(VoidTypeImpl.instance, returnType10);
1471 } 1471 }
1472 void test_getTypeArguments() { 1472 void test_getTypeArguments() {
1473 FunctionTypeImpl type = new FunctionTypeImpl.con1(new FunctionElementImpl.co n1(ASTFactory.identifier2("f"))); 1473 FunctionTypeImpl type = new FunctionTypeImpl.con1(new FunctionElementImpl.co n1(ASTFactory.identifier2("f")));
1474 List<Type2> types = type.typeArguments; 1474 List<Type2> types = type.typeArguments;
1475 EngineTestCase.assertLength(0, types); 1475 EngineTestCase.assertLength(0, types);
1476 } 1476 }
1477 void test_hashCode_element() { 1477 void test_hashCode_element() {
1478 FunctionTypeImpl type = new FunctionTypeImpl.con1(new FunctionElementImpl.co n1(ASTFactory.identifier2("f"))); 1478 FunctionTypeImpl type = new FunctionTypeImpl.con1(new FunctionElementImpl.co n1(ASTFactory.identifier2("f")));
1479 type.hashCode; 1479 type.hashCode;
1480 } 1480 }
(...skipping 182 matching lines...) Expand 10 before | Expand all | Expand 10 after
1663 FunctionTypeImpl type = new FunctionTypeImpl.con1(new FunctionElementImpl.co n1(ASTFactory.identifier2("f"))); 1663 FunctionTypeImpl type = new FunctionTypeImpl.con1(new FunctionElementImpl.co n1(ASTFactory.identifier2("f")));
1664 List<Type2> expectedTypes = <Type2> [new InterfaceTypeImpl.con1(new ClassEle mentImpl(ASTFactory.identifier2("C")))]; 1664 List<Type2> expectedTypes = <Type2> [new InterfaceTypeImpl.con1(new ClassEle mentImpl(ASTFactory.identifier2("C")))];
1665 type.normalParameterTypes = expectedTypes; 1665 type.normalParameterTypes = expectedTypes;
1666 List<Type2> types = type.normalParameterTypes; 1666 List<Type2> types = type.normalParameterTypes;
1667 JUnitTestCase.assertEquals(expectedTypes, types); 1667 JUnitTestCase.assertEquals(expectedTypes, types);
1668 } 1668 }
1669 void test_setReturnType() { 1669 void test_setReturnType() {
1670 FunctionTypeImpl type = new FunctionTypeImpl.con1(new FunctionElementImpl.co n1(ASTFactory.identifier2("f"))); 1670 FunctionTypeImpl type = new FunctionTypeImpl.con1(new FunctionElementImpl.co n1(ASTFactory.identifier2("f")));
1671 Type2 expectedType = new InterfaceTypeImpl.con1(new ClassElementImpl(ASTFact ory.identifier2("C"))); 1671 Type2 expectedType = new InterfaceTypeImpl.con1(new ClassElementImpl(ASTFact ory.identifier2("C")));
1672 type.returnType = expectedType; 1672 type.returnType = expectedType;
1673 Type2 returnType10 = type.returnType; 1673 Type2 returnType11 = type.returnType;
1674 JUnitTestCase.assertEquals(expectedType, returnType10); 1674 JUnitTestCase.assertEquals(expectedType, returnType11);
1675 } 1675 }
1676 void test_setTypeArguments() { 1676 void test_setTypeArguments() {
1677 FunctionTypeImpl type = new FunctionTypeImpl.con1(new FunctionElementImpl.co n1(ASTFactory.identifier2("f"))); 1677 FunctionTypeImpl type = new FunctionTypeImpl.con1(new FunctionElementImpl.co n1(ASTFactory.identifier2("f")));
1678 Type2 expectedType = new TypeVariableTypeImpl(new TypeVariableElementImpl(AS TFactory.identifier2("C"))); 1678 Type2 expectedType = new TypeVariableTypeImpl(new TypeVariableElementImpl(AS TFactory.identifier2("C")));
1679 type.typeArguments = <Type2> [expectedType]; 1679 type.typeArguments = <Type2> [expectedType];
1680 List<Type2> arguments = type.typeArguments; 1680 List<Type2> arguments = type.typeArguments;
1681 EngineTestCase.assertLength(1, arguments); 1681 EngineTestCase.assertLength(1, arguments);
1682 JUnitTestCase.assertEquals(expectedType, arguments[0]); 1682 JUnitTestCase.assertEquals(expectedType, arguments[0]);
1683 } 1683 }
1684 void test_substitute2_equal() { 1684 void test_substitute2_equal() {
(...skipping 217 matching lines...) Expand 10 before | Expand all | Expand 10 after
1902 } 1902 }
1903 main() { 1903 main() {
1904 FunctionTypeImplTest.dartSuite(); 1904 FunctionTypeImplTest.dartSuite();
1905 InterfaceTypeImplTest.dartSuite(); 1905 InterfaceTypeImplTest.dartSuite();
1906 TypeVariableTypeImplTest.dartSuite(); 1906 TypeVariableTypeImplTest.dartSuite();
1907 ClassElementImplTest.dartSuite(); 1907 ClassElementImplTest.dartSuite();
1908 ElementLocationImplTest.dartSuite(); 1908 ElementLocationImplTest.dartSuite();
1909 ElementImplTest.dartSuite(); 1909 ElementImplTest.dartSuite();
1910 LibraryElementImplTest.dartSuite(); 1910 LibraryElementImplTest.dartSuite();
1911 } 1911 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698