| OLD | NEW |
| 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 library engine.resolver_test; | 3 library engine.resolver_test; |
| 4 import 'dart:collection'; | 4 import 'dart:collection'; |
| 5 import 'package:analyzer_experimental/src/generated/java_core.dart'; | 5 import 'package:analyzer_experimental/src/generated/java_core.dart'; |
| 6 import 'package:analyzer_experimental/src/generated/java_engine.dart'; | 6 import 'package:analyzer_experimental/src/generated/java_engine.dart'; |
| 7 import 'package:analyzer_experimental/src/generated/java_junit.dart'; | 7 import 'package:analyzer_experimental/src/generated/java_junit.dart'; |
| 8 import 'package:analyzer_experimental/src/generated/source_io.dart'; | 8 import 'package:analyzer_experimental/src/generated/source_io.dart'; |
| 9 import 'package:analyzer_experimental/src/generated/error.dart'; | 9 import 'package:analyzer_experimental/src/generated/error.dart'; |
| 10 import 'package:analyzer_experimental/src/generated/scanner.dart'; | 10 import 'package:analyzer_experimental/src/generated/scanner.dart'; |
| (...skipping 7160 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 7171 ClassElementImpl classA = ElementFactory.classElement2("A", []); | 7171 ClassElementImpl classA = ElementFactory.classElement2("A", []); |
| 7172 String fieldName = "a"; | 7172 String fieldName = "a"; |
| 7173 FieldElement field = ElementFactory.fieldElement(fieldName, false, false, fa
lse, intType); | 7173 FieldElement field = ElementFactory.fieldElement(fieldName, false, false, fa
lse, intType); |
| 7174 classA.fields = <FieldElement> [field]; | 7174 classA.fields = <FieldElement> [field]; |
| 7175 classA.accessors = <PropertyAccessorElement> [field.getter, field.setter]; | 7175 classA.accessors = <PropertyAccessorElement> [field.getter, field.setter]; |
| 7176 SimpleIdentifier node = ASTFactory.identifier3(fieldName); | 7176 SimpleIdentifier node = ASTFactory.identifier3(fieldName); |
| 7177 ASTFactory.assignmentExpression(node, TokenType.EQ, ASTFactory.integer(0)); | 7177 ASTFactory.assignmentExpression(node, TokenType.EQ, ASTFactory.integer(0)); |
| 7178 resolveInClass(node, classA); | 7178 resolveInClass(node, classA); |
| 7179 Element element = node.element; | 7179 Element element = node.element; |
| 7180 EngineTestCase.assertInstanceOf(PropertyAccessorElement, element); | 7180 EngineTestCase.assertInstanceOf(PropertyAccessorElement, element); |
| 7181 JUnitTestCase.assertTrue(((element as PropertyAccessorElement)).isSetter()); | 7181 JUnitTestCase.assertTrue(((element as PropertyAccessorElement)).isSetter); |
| 7182 _listener.assertNoErrors(); | 7182 _listener.assertNoErrors(); |
| 7183 } | 7183 } |
| 7184 void test_visitSuperConstructorInvocation() { | 7184 void test_visitSuperConstructorInvocation() { |
| 7185 ClassElementImpl superclass = ElementFactory.classElement2("A", []); | 7185 ClassElementImpl superclass = ElementFactory.classElement2("A", []); |
| 7186 ConstructorElementImpl superConstructor = ElementFactory.constructorElement(
superclass, null); | 7186 ConstructorElementImpl superConstructor = ElementFactory.constructorElement(
superclass, null); |
| 7187 superclass.constructors = <ConstructorElement> [superConstructor]; | 7187 superclass.constructors = <ConstructorElement> [superConstructor]; |
| 7188 ClassElementImpl subclass = ElementFactory.classElement("B", superclass.type
, []); | 7188 ClassElementImpl subclass = ElementFactory.classElement("B", superclass.type
, []); |
| 7189 ConstructorElementImpl subConstructor = ElementFactory.constructorElement(su
bclass, null); | 7189 ConstructorElementImpl subConstructor = ElementFactory.constructorElement(su
bclass, null); |
| 7190 subclass.constructors = <ConstructorElement> [subConstructor]; | 7190 subclass.constructors = <ConstructorElement> [subConstructor]; |
| 7191 SuperConstructorInvocation invocation = ASTFactory.superConstructorInvocatio
n([]); | 7191 SuperConstructorInvocation invocation = ASTFactory.superConstructorInvocatio
n([]); |
| (...skipping 2378 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 9570 writer.print("Resolved "); | 9570 writer.print("Resolved "); |
| 9571 writer.print(_wrongTypedNodes.length); | 9571 writer.print(_wrongTypedNodes.length); |
| 9572 writer.println(" to the wrong type of element:"); | 9572 writer.println(" to the wrong type of element:"); |
| 9573 printNodes(writer, _wrongTypedNodes); | 9573 printNodes(writer, _wrongTypedNodes); |
| 9574 } | 9574 } |
| 9575 JUnitTestCase.fail(writer.toString()); | 9575 JUnitTestCase.fail(writer.toString()); |
| 9576 } | 9576 } |
| 9577 } | 9577 } |
| 9578 Object visitBinaryExpression(BinaryExpression node) { | 9578 Object visitBinaryExpression(BinaryExpression node) { |
| 9579 node.visitChildren(this); | 9579 node.visitChildren(this); |
| 9580 if (!node.operator.isUserDefinableOperator()) { | 9580 if (!node.operator.isUserDefinableOperator) { |
| 9581 return null; | 9581 return null; |
| 9582 } | 9582 } |
| 9583 return checkResolved2(node, node.element, MethodElement); | 9583 return checkResolved2(node, node.element, MethodElement); |
| 9584 } | 9584 } |
| 9585 Object visitCompilationUnit(CompilationUnit node) { | 9585 Object visitCompilationUnit(CompilationUnit node) { |
| 9586 node.visitChildren(this); | 9586 node.visitChildren(this); |
| 9587 return checkResolved2(node, node.element, CompilationUnitElement); | 9587 return checkResolved2(node, node.element, CompilationUnitElement); |
| 9588 } | 9588 } |
| 9589 Object visitExportDirective(ExportDirective node) => checkResolved2(node, node
.element, ExportElement); | 9589 Object visitExportDirective(ExportDirective node) => checkResolved2(node, node
.element, ExportElement); |
| 9590 Object visitFunctionDeclaration(FunctionDeclaration node) { | 9590 Object visitFunctionDeclaration(FunctionDeclaration node) { |
| (...skipping 17 matching lines...) Expand all Loading... |
| 9608 } | 9608 } |
| 9609 Object visitIndexExpression(IndexExpression node) { | 9609 Object visitIndexExpression(IndexExpression node) { |
| 9610 node.visitChildren(this); | 9610 node.visitChildren(this); |
| 9611 return checkResolved2(node, node.element, MethodElement); | 9611 return checkResolved2(node, node.element, MethodElement); |
| 9612 } | 9612 } |
| 9613 Object visitLibraryDirective(LibraryDirective node) => checkResolved2(node, no
de.element, LibraryElement); | 9613 Object visitLibraryDirective(LibraryDirective node) => checkResolved2(node, no
de.element, LibraryElement); |
| 9614 Object visitPartDirective(PartDirective node) => checkResolved2(node, node.ele
ment, CompilationUnitElement); | 9614 Object visitPartDirective(PartDirective node) => checkResolved2(node, node.ele
ment, CompilationUnitElement); |
| 9615 Object visitPartOfDirective(PartOfDirective node) => checkResolved2(node, node
.element, LibraryElement); | 9615 Object visitPartOfDirective(PartOfDirective node) => checkResolved2(node, node
.element, LibraryElement); |
| 9616 Object visitPostfixExpression(PostfixExpression node) { | 9616 Object visitPostfixExpression(PostfixExpression node) { |
| 9617 node.visitChildren(this); | 9617 node.visitChildren(this); |
| 9618 if (!node.operator.isUserDefinableOperator()) { | 9618 if (!node.operator.isUserDefinableOperator) { |
| 9619 return null; | 9619 return null; |
| 9620 } | 9620 } |
| 9621 return checkResolved2(node, node.element, MethodElement); | 9621 return checkResolved2(node, node.element, MethodElement); |
| 9622 } | 9622 } |
| 9623 Object visitPrefixExpression(PrefixExpression node) { | 9623 Object visitPrefixExpression(PrefixExpression node) { |
| 9624 node.visitChildren(this); | 9624 node.visitChildren(this); |
| 9625 if (!node.operator.isUserDefinableOperator()) { | 9625 if (!node.operator.isUserDefinableOperator) { |
| 9626 return null; | 9626 return null; |
| 9627 } | 9627 } |
| 9628 return checkResolved2(node, node.element, MethodElement); | 9628 return checkResolved2(node, node.element, MethodElement); |
| 9629 } | 9629 } |
| 9630 Object visitSimpleIdentifier(SimpleIdentifier node) { | 9630 Object visitSimpleIdentifier(SimpleIdentifier node) { |
| 9631 if (node.name == "void") { | 9631 if (node.name == "void") { |
| 9632 return null; | 9632 return null; |
| 9633 } | 9633 } |
| 9634 return checkResolved(node, node.element); | 9634 return checkResolved(node, node.element); |
| 9635 } | 9635 } |
| (...skipping 1618 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 11254 verify([source]); | 11254 verify([source]); |
| 11255 } | 11255 } |
| 11256 void test_isValidMixin_badSuperclass() { | 11256 void test_isValidMixin_badSuperclass() { |
| 11257 Source source = addSource(EngineTestCase.createSource(["class A extends B {}
", "class B {}"])); | 11257 Source source = addSource(EngineTestCase.createSource(["class A extends B {}
", "class B {}"])); |
| 11258 LibraryElement library = resolve(source); | 11258 LibraryElement library = resolve(source); |
| 11259 JUnitTestCase.assertNotNull(library); | 11259 JUnitTestCase.assertNotNull(library); |
| 11260 CompilationUnitElement unit = library.definingCompilationUnit; | 11260 CompilationUnitElement unit = library.definingCompilationUnit; |
| 11261 JUnitTestCase.assertNotNull(unit); | 11261 JUnitTestCase.assertNotNull(unit); |
| 11262 List<ClassElement> classes = unit.types; | 11262 List<ClassElement> classes = unit.types; |
| 11263 EngineTestCase.assertLength(2, classes); | 11263 EngineTestCase.assertLength(2, classes); |
| 11264 JUnitTestCase.assertFalse(classes[0].isValidMixin()); | 11264 JUnitTestCase.assertFalse(classes[0].isValidMixin); |
| 11265 assertNoErrors(); | 11265 assertNoErrors(); |
| 11266 verify([source]); | 11266 verify([source]); |
| 11267 } | 11267 } |
| 11268 void test_isValidMixin_constructor() { | 11268 void test_isValidMixin_constructor() { |
| 11269 Source source = addSource(EngineTestCase.createSource(["class A {", " A() {
}", "}"])); | 11269 Source source = addSource(EngineTestCase.createSource(["class A {", " A() {
}", "}"])); |
| 11270 LibraryElement library = resolve(source); | 11270 LibraryElement library = resolve(source); |
| 11271 JUnitTestCase.assertNotNull(library); | 11271 JUnitTestCase.assertNotNull(library); |
| 11272 CompilationUnitElement unit = library.definingCompilationUnit; | 11272 CompilationUnitElement unit = library.definingCompilationUnit; |
| 11273 JUnitTestCase.assertNotNull(unit); | 11273 JUnitTestCase.assertNotNull(unit); |
| 11274 List<ClassElement> classes = unit.types; | 11274 List<ClassElement> classes = unit.types; |
| 11275 EngineTestCase.assertLength(1, classes); | 11275 EngineTestCase.assertLength(1, classes); |
| 11276 JUnitTestCase.assertFalse(classes[0].isValidMixin()); | 11276 JUnitTestCase.assertFalse(classes[0].isValidMixin); |
| 11277 assertNoErrors(); | 11277 assertNoErrors(); |
| 11278 verify([source]); | 11278 verify([source]); |
| 11279 } | 11279 } |
| 11280 void test_isValidMixin_super() { | 11280 void test_isValidMixin_super() { |
| 11281 Source source = addSource(EngineTestCase.createSource(["class A {", " toStr
ing() {", " return super.toString();", " }", "}"])); | 11281 Source source = addSource(EngineTestCase.createSource(["class A {", " toStr
ing() {", " return super.toString();", " }", "}"])); |
| 11282 LibraryElement library = resolve(source); | 11282 LibraryElement library = resolve(source); |
| 11283 JUnitTestCase.assertNotNull(library); | 11283 JUnitTestCase.assertNotNull(library); |
| 11284 CompilationUnitElement unit = library.definingCompilationUnit; | 11284 CompilationUnitElement unit = library.definingCompilationUnit; |
| 11285 JUnitTestCase.assertNotNull(unit); | 11285 JUnitTestCase.assertNotNull(unit); |
| 11286 List<ClassElement> classes = unit.types; | 11286 List<ClassElement> classes = unit.types; |
| 11287 EngineTestCase.assertLength(1, classes); | 11287 EngineTestCase.assertLength(1, classes); |
| 11288 JUnitTestCase.assertFalse(classes[0].isValidMixin()); | 11288 JUnitTestCase.assertFalse(classes[0].isValidMixin); |
| 11289 assertNoErrors(); | 11289 assertNoErrors(); |
| 11290 verify([source]); | 11290 verify([source]); |
| 11291 } | 11291 } |
| 11292 void test_isValidMixin_valid() { | 11292 void test_isValidMixin_valid() { |
| 11293 Source source = addSource(EngineTestCase.createSource(["class A {}"])); | 11293 Source source = addSource(EngineTestCase.createSource(["class A {}"])); |
| 11294 LibraryElement library = resolve(source); | 11294 LibraryElement library = resolve(source); |
| 11295 JUnitTestCase.assertNotNull(library); | 11295 JUnitTestCase.assertNotNull(library); |
| 11296 CompilationUnitElement unit = library.definingCompilationUnit; | 11296 CompilationUnitElement unit = library.definingCompilationUnit; |
| 11297 JUnitTestCase.assertNotNull(unit); | 11297 JUnitTestCase.assertNotNull(unit); |
| 11298 List<ClassElement> classes = unit.types; | 11298 List<ClassElement> classes = unit.types; |
| 11299 EngineTestCase.assertLength(1, classes); | 11299 EngineTestCase.assertLength(1, classes); |
| 11300 JUnitTestCase.assertTrue(classes[0].isValidMixin()); | 11300 JUnitTestCase.assertTrue(classes[0].isValidMixin); |
| 11301 assertNoErrors(); | 11301 assertNoErrors(); |
| 11302 verify([source]); | 11302 verify([source]); |
| 11303 } | 11303 } |
| 11304 void test_labels_switch() { | 11304 void test_labels_switch() { |
| 11305 Source source = addSource(EngineTestCase.createSource(["void doSwitch(int ta
rget) {", " switch (target) {", " l0: case 0:", " continue l1;", " l
1: case 1:", " continue l0;", " default:", " continue l1;", " }",
"}"])); | 11305 Source source = addSource(EngineTestCase.createSource(["void doSwitch(int ta
rget) {", " switch (target) {", " l0: case 0:", " continue l1;", " l
1: case 1:", " continue l0;", " default:", " continue l1;", " }",
"}"])); |
| 11306 LibraryElement library = resolve(source); | 11306 LibraryElement library = resolve(source); |
| 11307 JUnitTestCase.assertNotNull(library); | 11307 JUnitTestCase.assertNotNull(library); |
| 11308 assertNoErrors(); | 11308 assertNoErrors(); |
| 11309 verify([source]); | 11309 verify([source]); |
| 11310 } | 11310 } |
| (...skipping 311 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 11622 runJUnitTest(__test, __test.test_setter_inherited); | 11622 runJUnitTest(__test, __test.test_setter_inherited); |
| 11623 }); | 11623 }); |
| 11624 _ut.test('test_setter_static', () { | 11624 _ut.test('test_setter_static', () { |
| 11625 final __test = new SimpleResolverTest(); | 11625 final __test = new SimpleResolverTest(); |
| 11626 runJUnitTest(__test, __test.test_setter_static); | 11626 runJUnitTest(__test, __test.test_setter_static); |
| 11627 }); | 11627 }); |
| 11628 }); | 11628 }); |
| 11629 } | 11629 } |
| 11630 } | 11630 } |
| 11631 main() { | 11631 main() { |
| 11632 // ElementResolverTest.dartSuite(); | 11632 ElementResolverTest.dartSuite(); |
| 11633 // InheritanceManagerTest.dartSuite(); | 11633 InheritanceManagerTest.dartSuite(); |
| 11634 // LibraryElementBuilderTest.dartSuite(); | 11634 LibraryElementBuilderTest.dartSuite(); |
| 11635 // LibraryTest.dartSuite(); | 11635 LibraryTest.dartSuite(); |
| 11636 // StaticTypeAnalyzerTest.dartSuite(); | 11636 StaticTypeAnalyzerTest.dartSuite(); |
| 11637 // TypeOverrideManagerTest.dartSuite(); | 11637 TypeOverrideManagerTest.dartSuite(); |
| 11638 // TypeProviderImplTest.dartSuite(); | 11638 TypeProviderImplTest.dartSuite(); |
| 11639 // TypeResolverVisitorTest.dartSuite(); | 11639 TypeResolverVisitorTest.dartSuite(); |
| 11640 // EnclosedScopeTest.dartSuite(); | 11640 EnclosedScopeTest.dartSuite(); |
| 11641 // LibraryImportScopeTest.dartSuite(); | 11641 LibraryImportScopeTest.dartSuite(); |
| 11642 // LibraryScopeTest.dartSuite(); | 11642 LibraryScopeTest.dartSuite(); |
| 11643 // ScopeTest.dartSuite(); | 11643 ScopeTest.dartSuite(); |
| 11644 // CompileTimeErrorCodeTest.dartSuite(); | 11644 CompileTimeErrorCodeTest.dartSuite(); |
| 11645 // ErrorResolverTest.dartSuite(); | 11645 ErrorResolverTest.dartSuite(); |
| 11646 // NonErrorResolverTest.dartSuite(); | 11646 NonErrorResolverTest.dartSuite(); |
| 11647 // SimpleResolverTest.dartSuite(); | 11647 SimpleResolverTest.dartSuite(); |
| 11648 // StaticTypeWarningCodeTest.dartSuite(); | 11648 StaticTypeWarningCodeTest.dartSuite(); |
| 11649 // StaticWarningCodeTest.dartSuite(); | 11649 StaticWarningCodeTest.dartSuite(); |
| 11650 // StrictModeTest.dartSuite(); | 11650 StrictModeTest.dartSuite(); |
| 11651 // TypePropagationTest.dartSuite(); | 11651 TypePropagationTest.dartSuite(); |
| 11652 } | 11652 } |
| OLD | NEW |