| 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 6671 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 6682 } | 6682 } |
| 6683 void fail_visitRedirectingConstructorInvocation() { | 6683 void fail_visitRedirectingConstructorInvocation() { |
| 6684 JUnitTestCase.fail("Not yet tested"); | 6684 JUnitTestCase.fail("Not yet tested"); |
| 6685 _listener.assertNoErrors(); | 6685 _listener.assertNoErrors(); |
| 6686 } | 6686 } |
| 6687 void setUp() { | 6687 void setUp() { |
| 6688 _listener = new GatheringErrorListener(); | 6688 _listener = new GatheringErrorListener(); |
| 6689 _typeProvider = new TestTypeProvider(); | 6689 _typeProvider = new TestTypeProvider(); |
| 6690 _resolver = createResolver(); | 6690 _resolver = createResolver(); |
| 6691 } | 6691 } |
| 6692 void test_lookUpMethodInInterfaces() { |
| 6693 InterfaceType intType2 = _typeProvider.intType; |
| 6694 ClassElementImpl classA = ElementFactory.classElement2("A", []); |
| 6695 MethodElement operator = ElementFactory.methodElement("[]", intType2, [intTy
pe2]); |
| 6696 classA.methods = <MethodElement> [operator]; |
| 6697 ClassElementImpl classB = ElementFactory.classElement2("B", []); |
| 6698 classB.interfaces = <InterfaceType> [classA.type]; |
| 6699 ClassElementImpl classC = ElementFactory.classElement2("C", []); |
| 6700 classC.mixins = <InterfaceType> [classB.type]; |
| 6701 ClassElementImpl classD = ElementFactory.classElement("D", classC.type, []); |
| 6702 SimpleIdentifier array = ASTFactory.identifier3("a"); |
| 6703 array.staticType = classD.type; |
| 6704 IndexExpression expression = ASTFactory.indexExpression(array, ASTFactory.id
entifier3("i")); |
| 6705 JUnitTestCase.assertSame(operator, resolve5(expression, [])); |
| 6706 _listener.assertNoErrors(); |
| 6707 } |
| 6692 void test_visitAssignmentExpression_compound() { | 6708 void test_visitAssignmentExpression_compound() { |
| 6693 InterfaceType intType2 = _typeProvider.intType; | 6709 InterfaceType intType2 = _typeProvider.intType; |
| 6694 SimpleIdentifier leftHandSide = ASTFactory.identifier3("a"); | 6710 SimpleIdentifier leftHandSide = ASTFactory.identifier3("a"); |
| 6695 leftHandSide.staticType = intType2; | 6711 leftHandSide.staticType = intType2; |
| 6696 AssignmentExpression assignment = ASTFactory.assignmentExpression(leftHandSi
de, TokenType.PLUS_EQ, ASTFactory.integer(1)); | 6712 AssignmentExpression assignment = ASTFactory.assignmentExpression(leftHandSi
de, TokenType.PLUS_EQ, ASTFactory.integer(1)); |
| 6697 resolveNode(assignment, []); | 6713 resolveNode(assignment, []); |
| 6698 JUnitTestCase.assertSame(getMethod(_typeProvider.numType, "+"), assignment.e
lement); | 6714 JUnitTestCase.assertSame(getMethod(_typeProvider.numType, "+"), assignment.e
lement); |
| 6699 _listener.assertNoErrors(); | 6715 _listener.assertNoErrors(); |
| 6700 } | 6716 } |
| 6701 void test_visitAssignmentExpression_simple() { | 6717 void test_visitAssignmentExpression_simple() { |
| (...skipping 463 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 7165 statement.accept(_resolver); | 7181 statement.accept(_resolver); |
| 7166 } finally { | 7182 } finally { |
| 7167 _visitor.labelScope_J2DAccessor = outerScope; | 7183 _visitor.labelScope_J2DAccessor = outerScope; |
| 7168 } | 7184 } |
| 7169 } catch (exception) { | 7185 } catch (exception) { |
| 7170 throw new IllegalArgumentException("Could not resolve node", exception); | 7186 throw new IllegalArgumentException("Could not resolve node", exception); |
| 7171 } | 7187 } |
| 7172 } | 7188 } |
| 7173 static dartSuite() { | 7189 static dartSuite() { |
| 7174 _ut.group('ElementResolverTest', () { | 7190 _ut.group('ElementResolverTest', () { |
| 7191 _ut.test('test_lookUpMethodInInterfaces', () { |
| 7192 final __test = new ElementResolverTest(); |
| 7193 runJUnitTest(__test, __test.test_lookUpMethodInInterfaces); |
| 7194 }); |
| 7175 _ut.test('test_visitAssignmentExpression_compound', () { | 7195 _ut.test('test_visitAssignmentExpression_compound', () { |
| 7176 final __test = new ElementResolverTest(); | 7196 final __test = new ElementResolverTest(); |
| 7177 runJUnitTest(__test, __test.test_visitAssignmentExpression_compound); | 7197 runJUnitTest(__test, __test.test_visitAssignmentExpression_compound); |
| 7178 }); | 7198 }); |
| 7179 _ut.test('test_visitAssignmentExpression_simple', () { | 7199 _ut.test('test_visitAssignmentExpression_simple', () { |
| 7180 final __test = new ElementResolverTest(); | 7200 final __test = new ElementResolverTest(); |
| 7181 runJUnitTest(__test, __test.test_visitAssignmentExpression_simple); | 7201 runJUnitTest(__test, __test.test_visitAssignmentExpression_simple); |
| 7182 }); | 7202 }); |
| 7183 _ut.test('test_visitBinaryExpression', () { | 7203 _ut.test('test_visitBinaryExpression', () { |
| 7184 final __test = new ElementResolverTest(); | 7204 final __test = new ElementResolverTest(); |
| (...skipping 3549 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 10734 JUnitTestCase.assertNotNull(library); | 10754 JUnitTestCase.assertNotNull(library); |
| 10735 CompilationUnitElement unit = library.definingCompilationUnit; | 10755 CompilationUnitElement unit = library.definingCompilationUnit; |
| 10736 JUnitTestCase.assertNotNull(unit); | 10756 JUnitTestCase.assertNotNull(unit); |
| 10737 List<ClassElement> classes = unit.types; | 10757 List<ClassElement> classes = unit.types; |
| 10738 EngineTestCase.assertLength(2, classes); | 10758 EngineTestCase.assertLength(2, classes); |
| 10739 JUnitTestCase.assertFalse(classes[0].hasReferenceToSuper()); | 10759 JUnitTestCase.assertFalse(classes[0].hasReferenceToSuper()); |
| 10740 JUnitTestCase.assertTrue(classes[1].hasReferenceToSuper()); | 10760 JUnitTestCase.assertTrue(classes[1].hasReferenceToSuper()); |
| 10741 assertNoErrors(); | 10761 assertNoErrors(); |
| 10742 verify([source]); | 10762 verify([source]); |
| 10743 } | 10763 } |
| 10744 void test_importWithPrefix() { | 10764 void test_import_hide() { |
| 10765 addSource2("lib1.dart", EngineTestCase.createSource(["library lib1;", "set f
oo(value) {}"])); |
| 10766 addSource2("lib2.dart", EngineTestCase.createSource(["library lib2;", "set f
oo(value) {}"])); |
| 10767 Source source = addSource2("lib3.dart", EngineTestCase.createSource(["import
'lib1.dart' hide foo;", "import 'lib2.dart';", "", "main() {", " foo = 0;", "}
"])); |
| 10768 resolve(source); |
| 10769 assertNoErrors(); |
| 10770 verify([source]); |
| 10771 } |
| 10772 void test_import_prefix() { |
| 10745 addSource2("/two.dart", EngineTestCase.createSource(["library two;", "f(int
x) {", " return x * x;", "}"])); | 10773 addSource2("/two.dart", EngineTestCase.createSource(["library two;", "f(int
x) {", " return x * x;", "}"])); |
| 10746 Source source = addSource2("/one.dart", EngineTestCase.createSource(["librar
y one;", "import 'two.dart' as _two;", "main() {", " _two.f(0);", "}"])); | 10774 Source source = addSource2("/one.dart", EngineTestCase.createSource(["librar
y one;", "import 'two.dart' as _two;", "main() {", " _two.f(0);", "}"])); |
| 10747 resolve(source); | 10775 resolve(source); |
| 10748 assertNoErrors(); | 10776 assertNoErrors(); |
| 10749 verify([source]); | 10777 verify([source]); |
| 10750 } | 10778 } |
| 10751 void test_indexExpression_typeParameters() { | 10779 void test_indexExpression_typeParameters() { |
| 10752 Source source = addSource(EngineTestCase.createSource(["f() {", " List<int>
a;", " a[0];", " List<List<int>> b;", " b[0][0];", " List<List<List<int>>>
c;", " c[0][0][0];", "}"])); | 10780 Source source = addSource(EngineTestCase.createSource(["f() {", " List<int>
a;", " a[0];", " List<List<int>> b;", " b[0][0];", " List<List<List<int>>>
c;", " c[0][0][0];", "}"])); |
| 10753 resolve(source); | 10781 resolve(source); |
| 10754 assertNoErrors(); | 10782 assertNoErrors(); |
| (...skipping 195 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 10950 ClassDeclaration classDeclaration = unit.declarations[0] as ClassDeclaration
; | 10978 ClassDeclaration classDeclaration = unit.declarations[0] as ClassDeclaration
; |
| 10951 MethodDeclaration methodDeclaration = (classDeclaration.members[0] as Method
Declaration); | 10979 MethodDeclaration methodDeclaration = (classDeclaration.members[0] as Method
Declaration); |
| 10952 Block block2 = ((methodDeclaration.body as BlockFunctionBody)).block; | 10980 Block block2 = ((methodDeclaration.body as BlockFunctionBody)).block; |
| 10953 ExpressionStatement statement = block2.statements[0] as ExpressionStatement; | 10981 ExpressionStatement statement = block2.statements[0] as ExpressionStatement; |
| 10954 MethodInvocation invocation = statement.expression as MethodInvocation; | 10982 MethodInvocation invocation = statement.expression as MethodInvocation; |
| 10955 NodeList<Expression> arguments2 = invocation.argumentList.arguments; | 10983 NodeList<Expression> arguments2 = invocation.argumentList.arguments; |
| 10956 int argumentCount = arguments2.length; | 10984 int argumentCount = arguments2.length; |
| 10957 JUnitTestCase.assertEquals(indices.length, argumentCount); | 10985 JUnitTestCase.assertEquals(indices.length, argumentCount); |
| 10958 for (int i = 0; i < argumentCount; i++) { | 10986 for (int i = 0; i < argumentCount; i++) { |
| 10959 Expression argument = arguments2[i]; | 10987 Expression argument = arguments2[i]; |
| 10960 ParameterElement element = argument.parameterElement; | 10988 ParameterElement element = argument.staticParameterElement; |
| 10961 int index = indices[i]; | 10989 int index = indices[i]; |
| 10962 if (index < 0) { | 10990 if (index < 0) { |
| 10963 JUnitTestCase.assertNull(element); | 10991 JUnitTestCase.assertNull(element); |
| 10964 } else { | 10992 } else { |
| 10965 JUnitTestCase.assertSame(parameters2[index], element); | 10993 JUnitTestCase.assertSame(parameters2[index], element); |
| 10966 } | 10994 } |
| 10967 } | 10995 } |
| 10968 } | 10996 } |
| 10969 static dartSuite() { | 10997 static dartSuite() { |
| 10970 _ut.group('SimpleResolverTest', () { | 10998 _ut.group('SimpleResolverTest', () { |
| (...skipping 78 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 11049 runJUnitTest(__test, __test.test_functionTypeAlias); | 11077 runJUnitTest(__test, __test.test_functionTypeAlias); |
| 11050 }); | 11078 }); |
| 11051 _ut.test('test_getterAndSetterWithDifferentTypes', () { | 11079 _ut.test('test_getterAndSetterWithDifferentTypes', () { |
| 11052 final __test = new SimpleResolverTest(); | 11080 final __test = new SimpleResolverTest(); |
| 11053 runJUnitTest(__test, __test.test_getterAndSetterWithDifferentTypes); | 11081 runJUnitTest(__test, __test.test_getterAndSetterWithDifferentTypes); |
| 11054 }); | 11082 }); |
| 11055 _ut.test('test_hasReferenceToSuper', () { | 11083 _ut.test('test_hasReferenceToSuper', () { |
| 11056 final __test = new SimpleResolverTest(); | 11084 final __test = new SimpleResolverTest(); |
| 11057 runJUnitTest(__test, __test.test_hasReferenceToSuper); | 11085 runJUnitTest(__test, __test.test_hasReferenceToSuper); |
| 11058 }); | 11086 }); |
| 11059 _ut.test('test_importWithPrefix', () { | 11087 _ut.test('test_import_hide', () { |
| 11060 final __test = new SimpleResolverTest(); | 11088 final __test = new SimpleResolverTest(); |
| 11061 runJUnitTest(__test, __test.test_importWithPrefix); | 11089 runJUnitTest(__test, __test.test_import_hide); |
| 11090 }); |
| 11091 _ut.test('test_import_prefix', () { |
| 11092 final __test = new SimpleResolverTest(); |
| 11093 runJUnitTest(__test, __test.test_import_prefix); |
| 11062 }); | 11094 }); |
| 11063 _ut.test('test_indexExpression_typeParameters', () { | 11095 _ut.test('test_indexExpression_typeParameters', () { |
| 11064 final __test = new SimpleResolverTest(); | 11096 final __test = new SimpleResolverTest(); |
| 11065 runJUnitTest(__test, __test.test_indexExpression_typeParameters); | 11097 runJUnitTest(__test, __test.test_indexExpression_typeParameters); |
| 11066 }); | 11098 }); |
| 11067 _ut.test('test_indexExpression_typeParameters_invalidAssignmentWarning', (
) { | 11099 _ut.test('test_indexExpression_typeParameters_invalidAssignmentWarning', (
) { |
| 11068 final __test = new SimpleResolverTest(); | 11100 final __test = new SimpleResolverTest(); |
| 11069 runJUnitTest(__test, __test.test_indexExpression_typeParameters_invalidA
ssignmentWarning); | 11101 runJUnitTest(__test, __test.test_indexExpression_typeParameters_invalidA
ssignmentWarning); |
| 11070 }); | 11102 }); |
| 11071 _ut.test('test_indirectOperatorThroughCall', () { | 11103 _ut.test('test_indirectOperatorThroughCall', () { |
| (...skipping 87 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 11159 // CompileTimeErrorCodeTest.dartSuite(); | 11191 // CompileTimeErrorCodeTest.dartSuite(); |
| 11160 // ErrorResolverTest.dartSuite(); | 11192 // ErrorResolverTest.dartSuite(); |
| 11161 // NonErrorResolverTest.dartSuite(); | 11193 // NonErrorResolverTest.dartSuite(); |
| 11162 // PubSuggestionCodeTest.dartSuite(); | 11194 // PubSuggestionCodeTest.dartSuite(); |
| 11163 // SimpleResolverTest.dartSuite(); | 11195 // SimpleResolverTest.dartSuite(); |
| 11164 // StaticTypeWarningCodeTest.dartSuite(); | 11196 // StaticTypeWarningCodeTest.dartSuite(); |
| 11165 // StaticWarningCodeTest.dartSuite(); | 11197 // StaticWarningCodeTest.dartSuite(); |
| 11166 // StrictModeTest.dartSuite(); | 11198 // StrictModeTest.dartSuite(); |
| 11167 // TypePropagationTest.dartSuite(); | 11199 // TypePropagationTest.dartSuite(); |
| 11168 } | 11200 } |
| OLD | NEW |