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

Unified Diff: pkg/analyzer/test/generated/resolver_test.dart

Issue 1022843002: Rewrite ImplicitConstructorBuilder to use only element model. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 5 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 side-by-side diff with in-line comments
Download patch
Index: pkg/analyzer/test/generated/resolver_test.dart
diff --git a/pkg/analyzer/test/generated/resolver_test.dart b/pkg/analyzer/test/generated/resolver_test.dart
index b512ceb206dd68a9f4f6b381e8f19574688899e1..52d5be828aa6ad0bbc3cc8cb30142c4d0cd70e46 100644
--- a/pkg/analyzer/test/generated/resolver_test.dart
+++ b/pkg/analyzer/test/generated/resolver_test.dart
@@ -272,9 +272,9 @@ class AnalysisContextFactory {
ElementFactory.classElement("SelectElement", elementType)
];
htmlUnit.functions = <FunctionElement>[
- ElementFactory.functionElement3("query", elementElement, <ClassElement>[
- provider.stringType.element
- ], ClassElementImpl.EMPTY_ARRAY)
+ ElementFactory.functionElement3("query", elementElement,
+ <ClassElement>[provider.stringType.element],
+ ClassElementImpl.EMPTY_ARRAY)
];
TopLevelVariableElementImpl document = ElementFactory
.topLevelVariableElement3(
@@ -293,9 +293,8 @@ class AnalysisContextFactory {
coreContext.setContents(mathSource, "");
mathUnit.source = mathSource;
FunctionElement cosElement = ElementFactory.functionElement3("cos",
- provider.doubleType.element, <ClassElement>[
- provider.numType.element
- ], ClassElementImpl.EMPTY_ARRAY);
+ provider.doubleType.element, <ClassElement>[provider.numType.element],
+ ClassElementImpl.EMPTY_ARRAY);
TopLevelVariableElement ln10Element = ElementFactory
.topLevelVariableElement3("LN10", true, false, provider.doubleType);
TopLevelVariableElement piElement = ElementFactory.topLevelVariableElement3(
@@ -311,13 +310,11 @@ class AnalysisContextFactory {
randomConstructor.parameters = <ParameterElement>[seedParam];
randomElement.constructors = <ConstructorElement>[randomConstructor];
FunctionElement sinElement = ElementFactory.functionElement3("sin",
- provider.doubleType.element, <ClassElement>[
- provider.numType.element
- ], ClassElementImpl.EMPTY_ARRAY);
+ provider.doubleType.element, <ClassElement>[provider.numType.element],
+ ClassElementImpl.EMPTY_ARRAY);
FunctionElement sqrtElement = ElementFactory.functionElement3("sqrt",
- provider.doubleType.element, <ClassElement>[
- provider.numType.element
- ], ClassElementImpl.EMPTY_ARRAY);
+ provider.doubleType.element, <ClassElement>[provider.numType.element],
+ ClassElementImpl.EMPTY_ARRAY);
mathUnit.accessors = <PropertyAccessorElement>[
ln10Element.getter,
piElement.getter
@@ -1537,9 +1534,8 @@ class ElementResolverTest extends EngineTestCase {
AstFactory.typeName(classA), constructorName);
name.staticElement = constructor;
InstanceCreationExpression creation = AstFactory.instanceCreationExpression(
- Keyword.NEW, name, [
- AstFactory.namedExpression2(parameterName, AstFactory.integer(0))
- ]);
+ Keyword.NEW, name,
+ [AstFactory.namedExpression2(parameterName, AstFactory.integer(0))]);
_resolveNode(creation);
expect(creation.staticElement, same(constructor));
expect((creation.argumentList.arguments[
@@ -4659,9 +4655,8 @@ class InheritanceManagerTest extends EngineTestCase {
_inheritanceManager.getMapOfMembersInheritedFromInterfaces(classA);
expect(mapA.size, _numOfMembersInObject);
expect(mapA.get(methodName), isNull);
- _assertErrors(classA, [
- StaticWarningCode.INCONSISTENT_METHOD_INHERITANCE_GETTER_AND_METHOD
- ]);
+ _assertErrors(classA,
+ [StaticWarningCode.INCONSISTENT_METHOD_INHERITANCE_GETTER_AND_METHOD]);
}
void test_getMapOfMembersInheritedFromInterfaces_inconsistentMethodInheritance_int_str() {
@@ -4706,9 +4701,8 @@ class InheritanceManagerTest extends EngineTestCase {
_inheritanceManager.getMapOfMembersInheritedFromInterfaces(classA);
expect(mapA.size, _numOfMembersInObject);
expect(mapA.get(methodName), isNull);
- _assertErrors(classA, [
- StaticWarningCode.INCONSISTENT_METHOD_INHERITANCE_GETTER_AND_METHOD
- ]);
+ _assertErrors(classA,
+ [StaticWarningCode.INCONSISTENT_METHOD_INHERITANCE_GETTER_AND_METHOD]);
}
void test_getMapOfMembersInheritedFromInterfaces_inconsistentMethodInheritance_numOfRequiredParams() {
@@ -9995,8 +9989,10 @@ class StaticTypeAnalyzerTest extends EngineTestCase {
_analyze5(p1);
_analyze5(p2);
DartType resultType = _analyze(node);
- _assertFunctionType(dynamicType,
- <DartType>[dynamicType, dynamicType], null, null, resultType);
+ _assertFunctionType(dynamicType, <DartType>[
+ dynamicType,
+ dynamicType
+ ], null, null, resultType);
_listener.assertNoErrors();
}
@@ -10030,8 +10026,8 @@ class StaticTypeAnalyzerTest extends EngineTestCase {
DartType resultType = _analyze(node);
Map<String, DartType> expectedNamedTypes = new HashMap<String, DartType>();
expectedNamedTypes["p2"] = dynamicType;
- _assertFunctionType(dynamicType,
- <DartType>[dynamicType], null, expectedNamedTypes, resultType);
+ _assertFunctionType(dynamicType, <DartType>[dynamicType], null,
+ expectedNamedTypes, resultType);
_listener.assertNoErrors();
}
@@ -10050,8 +10046,8 @@ class StaticTypeAnalyzerTest extends EngineTestCase {
DartType resultType = _analyze(node);
Map<String, DartType> expectedNamedTypes = new HashMap<String, DartType>();
expectedNamedTypes["p2"] = dynamicType;
- _assertFunctionType(_typeProvider.intType,
- <DartType>[dynamicType], null, expectedNamedTypes, resultType);
+ _assertFunctionType(_typeProvider.intType, <DartType>[dynamicType], null,
+ expectedNamedTypes, resultType);
_listener.assertNoErrors();
}
@@ -10069,8 +10065,8 @@ class StaticTypeAnalyzerTest extends EngineTestCase {
_analyze5(p1);
_analyze5(p2);
DartType resultType = _analyze(node);
- _assertFunctionType(dynamicType,
- <DartType>[dynamicType], <DartType>[dynamicType], null, resultType);
+ _assertFunctionType(dynamicType, <DartType>[dynamicType],
+ <DartType>[dynamicType], null, resultType);
_listener.assertNoErrors();
}
@@ -10088,8 +10084,8 @@ class StaticTypeAnalyzerTest extends EngineTestCase {
_analyze5(p1);
_analyze5(p2);
DartType resultType = _analyze(node);
- _assertFunctionType(_typeProvider.intType,
- <DartType>[dynamicType], <DartType>[dynamicType], null, resultType);
+ _assertFunctionType(_typeProvider.intType, <DartType>[dynamicType],
+ <DartType>[dynamicType], null, resultType);
_listener.assertNoErrors();
}
@@ -10108,8 +10104,10 @@ class StaticTypeAnalyzerTest extends EngineTestCase {
_analyze5(p1);
_analyze5(p2);
DartType resultType = _analyze(node);
- _assertFunctionType(dynamicType,
- null, <DartType>[dynamicType, dynamicType], null, resultType);
+ _assertFunctionType(dynamicType, null, <DartType>[
+ dynamicType,
+ dynamicType
+ ], null, resultType);
_listener.assertNoErrors();
}
@@ -10212,9 +10210,8 @@ class StaticTypeAnalyzerTest extends EngineTestCase {
constructor.type = constructorType;
classElement.constructors = <ConstructorElement>[constructor];
InstanceCreationExpression node = AstFactory.instanceCreationExpression2(
- null, AstFactory.typeName(classElement), [
- AstFactory.identifier3(constructorName)
- ]);
+ null, AstFactory.typeName(classElement),
+ [AstFactory.identifier3(constructorName)]);
node.staticElement = constructor;
expect(_analyze(node), same(classElement.type));
_listener.assertNoErrors();
@@ -10304,10 +10301,9 @@ class StaticTypeAnalyzerTest extends EngineTestCase {
// {}
Expression node = AstFactory.mapLiteral2();
DartType resultType = _analyze(node);
- _assertType2(_typeProvider.mapType.substitute4(<DartType>[
- _typeProvider.dynamicType,
- _typeProvider.dynamicType
- ]), resultType);
+ _assertType2(_typeProvider.mapType.substitute4(
+ <DartType>[_typeProvider.dynamicType, _typeProvider.dynamicType]),
+ resultType);
_listener.assertNoErrors();
}
@@ -10316,10 +10312,9 @@ class StaticTypeAnalyzerTest extends EngineTestCase {
Expression node = AstFactory
.mapLiteral2([AstFactory.mapLiteralEntry("k", _resolvedInteger(0))]);
DartType resultType = _analyze(node);
- _assertType2(_typeProvider.mapType.substitute4(<DartType>[
- _typeProvider.dynamicType,
- _typeProvider.dynamicType
- ]), resultType);
+ _assertType2(_typeProvider.mapType.substitute4(
+ <DartType>[_typeProvider.dynamicType, _typeProvider.dynamicType]),
+ resultType);
_listener.assertNoErrors();
}
@@ -13033,8 +13028,7 @@ class TypeResolverVisitorTest extends EngineTestCase {
_typeProvider = new TestTypeProvider();
_visitor =
new TypeResolverVisitor.con1(_library, librarySource, _typeProvider);
- _implicitConstructorBuilder = new ImplicitConstructorBuilder(librarySource,
- _library.libraryElement, _library.libraryScope, _typeProvider,
+ _implicitConstructorBuilder = new ImplicitConstructorBuilder(_listener,
(ClassElement classElement, ClassElement superclassElement,
void computation()) {
// For these tests, we assume the classes for which implicit
@@ -13196,7 +13190,7 @@ class TypeResolverVisitorTest extends EngineTestCase {
ClassElement classM = ElementFactory.classElement2('M', []);
WithClause withClause =
AstFactory.withClause([AstFactory.typeName(classM, [])]);
- ClassElement classC = ElementFactory.classElement2('C', []);
+ ClassElement classC = ElementFactory.classTypeAlias2('C', []);
ClassTypeAlias alias = AstFactory.classTypeAlias(
'C', null, null, AstFactory.typeName(classB, []), withClause, null);
alias.name.staticElement = classC;
@@ -13227,7 +13221,7 @@ class TypeResolverVisitorTest extends EngineTestCase {
ClassElement classM = ElementFactory.classElement2('M', []);
WithClause withClause =
AstFactory.withClause([AstFactory.typeName(classM, [])]);
- ClassElement classC = ElementFactory.classElement2('C', []);
+ ClassElement classC = ElementFactory.classTypeAlias2('C', []);
ClassTypeAlias alias = AstFactory.classTypeAlias(
'C', null, null, AstFactory.typeName(classB, []), withClause, null);
alias.name.staticElement = classC;
@@ -13258,7 +13252,7 @@ class TypeResolverVisitorTest extends EngineTestCase {
ClassElement classM = ElementFactory.classElement2('M', []);
WithClause withClause =
AstFactory.withClause([AstFactory.typeName(classM, [])]);
- ClassElement classC = ElementFactory.classElement2('C', []);
+ ClassElement classC = ElementFactory.classTypeAlias2('C', []);
ClassTypeAlias alias = AstFactory.classTypeAlias(
'C', null, null, AstFactory.typeName(classB, []), withClause, null);
alias.name.staticElement = classC;
@@ -13441,7 +13435,9 @@ class TypeResolverVisitorTest extends EngineTestCase {
}
}
node.accept(_visitor);
- node.accept(_implicitConstructorBuilder);
+ if (node is Declaration) {
+ node.element.accept(_implicitConstructorBuilder);
+ }
}
}

Powered by Google App Engine
This is Rietveld 408576698