| 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 'package:analyzer_experimental/src/generated/java_core.dart'; | 4 import 'package:analyzer_experimental/src/generated/java_core.dart'; |
| 5 import 'package:analyzer_experimental/src/generated/java_junit.dart'; | 5 import 'package:analyzer_experimental/src/generated/java_junit.dart'; |
| 6 import 'package:analyzer_experimental/src/generated/source_io.dart'; | 6 import 'package:analyzer_experimental/src/generated/source_io.dart'; |
| 7 import 'package:analyzer_experimental/src/generated/error.dart'; | 7 import 'package:analyzer_experimental/src/generated/error.dart'; |
| 8 import 'package:analyzer_experimental/src/generated/scanner.dart'; | 8 import 'package:analyzer_experimental/src/generated/scanner.dart'; |
| 9 import 'package:analyzer_experimental/src/generated/ast.dart'; | 9 import 'package:analyzer_experimental/src/generated/ast.dart'; |
| 10 import 'package:analyzer_experimental/src/generated/parser.dart' show ParserErro
rCode; | 10 import 'package:analyzer_experimental/src/generated/parser.dart' show ParserErro
rCode; |
| (...skipping 2302 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2313 "}", | 2313 "}", |
| 2314 "abstract class B extends A {", | 2314 "abstract class B extends A {", |
| 2315 " m(p);", | 2315 " m(p);", |
| 2316 "}", | 2316 "}", |
| 2317 "class C extends B {", | 2317 "class C extends B {", |
| 2318 "}"])); | 2318 "}"])); |
| 2319 resolve(source); | 2319 resolve(source); |
| 2320 assertNoErrors(); | 2320 assertNoErrors(); |
| 2321 verify([source]); | 2321 verify([source]); |
| 2322 } | 2322 } |
| 2323 void test_nonAbstractClassInheritsAbstractMemberOne_noSuchMethod() { | |
| 2324 Source source = addSource(EngineTestCase.createSource([ | |
| 2325 "abstract class A {", | |
| 2326 " m(p);", | |
| 2327 "}", | |
| 2328 "class B extends A {", | |
| 2329 " noSuchMethod(invocation) {}", | |
| 2330 "}"])); | |
| 2331 resolve(source); | |
| 2332 assertNoErrors(); | |
| 2333 verify([source]); | |
| 2334 } | |
| 2335 void test_nonBoolExpression_functionType() { | 2323 void test_nonBoolExpression_functionType() { |
| 2336 Source source = addSource(EngineTestCase.createSource([ | 2324 Source source = addSource(EngineTestCase.createSource([ |
| 2337 "bool makeAssertion() => true;", | 2325 "bool makeAssertion() => true;", |
| 2338 "f() {", | 2326 "f() {", |
| 2339 " assert(makeAssertion);", | 2327 " assert(makeAssertion);", |
| 2340 "}"])); | 2328 "}"])); |
| 2341 resolve(source); | 2329 resolve(source); |
| 2342 assertNoErrors(); | 2330 assertNoErrors(); |
| 2343 verify([source]); | 2331 verify([source]); |
| 2344 } | 2332 } |
| (...skipping 321 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2666 "import 'lib.dart' as p;", | 2654 "import 'lib.dart' as p;", |
| 2667 "typedef P();", | 2655 "typedef P();", |
| 2668 "p2() {}", | 2656 "p2() {}", |
| 2669 "var p3;", | 2657 "var p3;", |
| 2670 "class p4 {}", | 2658 "class p4 {}", |
| 2671 "p.A a;"])); | 2659 "p.A a;"])); |
| 2672 resolve(source); | 2660 resolve(source); |
| 2673 assertNoErrors(); | 2661 assertNoErrors(); |
| 2674 verify([source]); | 2662 verify([source]); |
| 2675 } | 2663 } |
| 2664 void test_proxy_annotation_prefixed() { |
| 2665 Source source = addSource(EngineTestCase.createSource([ |
| 2666 "library L;", |
| 2667 "import 'meta.dart';", |
| 2668 "@proxy", |
| 2669 "class A {}", |
| 2670 "f(A a) {", |
| 2671 " a.m();", |
| 2672 " var x = a.g;", |
| 2673 " a.s = 1;", |
| 2674 " var y = a + a;", |
| 2675 " a++;", |
| 2676 " ++a;", |
| 2677 "}"])); |
| 2678 addSource2("/meta.dart", EngineTestCase.createSource([ |
| 2679 "library meta;", |
| 2680 "const proxy = const _Proxy();", |
| 2681 "class _Proxy { const _Proxy(); }"])); |
| 2682 resolve(source); |
| 2683 assertNoErrors(); |
| 2684 } |
| 2685 void test_proxy_annotation_prefixed2() { |
| 2686 Source source = addSource(EngineTestCase.createSource([ |
| 2687 "library L;", |
| 2688 "import 'meta.dart';", |
| 2689 "@proxy", |
| 2690 "class A {}", |
| 2691 "class B {", |
| 2692 " f(A a) {", |
| 2693 " a.m();", |
| 2694 " var x = a.g;", |
| 2695 " a.s = 1;", |
| 2696 " var y = a + a;", |
| 2697 " a++;", |
| 2698 " ++a;", |
| 2699 " }", |
| 2700 "}"])); |
| 2701 addSource2("/meta.dart", EngineTestCase.createSource([ |
| 2702 "library meta;", |
| 2703 "const proxy = const _Proxy();", |
| 2704 "class _Proxy { const _Proxy(); }"])); |
| 2705 resolve(source); |
| 2706 assertNoErrors(); |
| 2707 } |
| 2708 void test_proxy_annotation_prefixed3() { |
| 2709 Source source = addSource(EngineTestCase.createSource([ |
| 2710 "library L;", |
| 2711 "import 'meta.dart';", |
| 2712 "class B {", |
| 2713 " f(A a) {", |
| 2714 " a.m();", |
| 2715 " var x = a.g;", |
| 2716 " a.s = 1;", |
| 2717 " var y = a + a;", |
| 2718 " a++;", |
| 2719 " ++a;", |
| 2720 " }", |
| 2721 "}", |
| 2722 "@proxy", |
| 2723 "class A {}"])); |
| 2724 addSource2("/meta.dart", EngineTestCase.createSource([ |
| 2725 "library meta;", |
| 2726 "const proxy = const _Proxy();", |
| 2727 "class _Proxy { const _Proxy(); }"])); |
| 2728 resolve(source); |
| 2729 assertNoErrors(); |
| 2730 } |
| 2731 void test_proxy_annotation_simple() { |
| 2732 Source source = addSource(EngineTestCase.createSource([ |
| 2733 "library L;", |
| 2734 "import 'meta.dart';", |
| 2735 "@proxy", |
| 2736 "class B {", |
| 2737 " m() {", |
| 2738 " n();", |
| 2739 " var x = g;", |
| 2740 " s = 1;", |
| 2741 " var y = this + this;", |
| 2742 " }", |
| 2743 "}"])); |
| 2744 addSource2("/meta.dart", EngineTestCase.createSource([ |
| 2745 "library meta;", |
| 2746 "const proxy = const _Proxy();", |
| 2747 "class _Proxy { const _Proxy(); }"])); |
| 2748 resolve(source); |
| 2749 assertNoErrors(); |
| 2750 } |
| 2676 void test_recursiveConstructorRedirect() { | 2751 void test_recursiveConstructorRedirect() { |
| 2677 Source source = addSource(EngineTestCase.createSource([ | 2752 Source source = addSource(EngineTestCase.createSource([ |
| 2678 "class A {", | 2753 "class A {", |
| 2679 " A.a() : this.b();", | 2754 " A.a() : this.b();", |
| 2680 " A.b() : this.c();", | 2755 " A.b() : this.c();", |
| 2681 " A.c() {}", | 2756 " A.c() {}", |
| 2682 "}"])); | 2757 "}"])); |
| 2683 resolve(source); | 2758 resolve(source); |
| 2684 assertNoErrors(); | 2759 assertNoErrors(); |
| 2685 verify([source]); | 2760 verify([source]); |
| (...skipping 1057 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3743 runJUnitTest(__test, __test.test_newWithUndefinedConstructorDefault); | 3818 runJUnitTest(__test, __test.test_newWithUndefinedConstructorDefault); |
| 3744 }); | 3819 }); |
| 3745 _ut.test('test_nonAbstractClassInheritsAbstractMemberOne_abstractOverrides
Concrete_accessor', () { | 3820 _ut.test('test_nonAbstractClassInheritsAbstractMemberOne_abstractOverrides
Concrete_accessor', () { |
| 3746 final __test = new NonErrorResolverTest(); | 3821 final __test = new NonErrorResolverTest(); |
| 3747 runJUnitTest(__test, __test.test_nonAbstractClassInheritsAbstractMemberO
ne_abstractOverridesConcrete_accessor); | 3822 runJUnitTest(__test, __test.test_nonAbstractClassInheritsAbstractMemberO
ne_abstractOverridesConcrete_accessor); |
| 3748 }); | 3823 }); |
| 3749 _ut.test('test_nonAbstractClassInheritsAbstractMemberOne_abstractOverrides
Concrete_method', () { | 3824 _ut.test('test_nonAbstractClassInheritsAbstractMemberOne_abstractOverrides
Concrete_method', () { |
| 3750 final __test = new NonErrorResolverTest(); | 3825 final __test = new NonErrorResolverTest(); |
| 3751 runJUnitTest(__test, __test.test_nonAbstractClassInheritsAbstractMemberO
ne_abstractOverridesConcrete_method); | 3826 runJUnitTest(__test, __test.test_nonAbstractClassInheritsAbstractMemberO
ne_abstractOverridesConcrete_method); |
| 3752 }); | 3827 }); |
| 3753 _ut.test('test_nonAbstractClassInheritsAbstractMemberOne_noSuchMethod', ()
{ | |
| 3754 final __test = new NonErrorResolverTest(); | |
| 3755 runJUnitTest(__test, __test.test_nonAbstractClassInheritsAbstractMemberO
ne_noSuchMethod); | |
| 3756 }); | |
| 3757 _ut.test('test_nonBoolExpression_functionType', () { | 3828 _ut.test('test_nonBoolExpression_functionType', () { |
| 3758 final __test = new NonErrorResolverTest(); | 3829 final __test = new NonErrorResolverTest(); |
| 3759 runJUnitTest(__test, __test.test_nonBoolExpression_functionType); | 3830 runJUnitTest(__test, __test.test_nonBoolExpression_functionType); |
| 3760 }); | 3831 }); |
| 3761 _ut.test('test_nonBoolExpression_interfaceType', () { | 3832 _ut.test('test_nonBoolExpression_interfaceType', () { |
| 3762 final __test = new NonErrorResolverTest(); | 3833 final __test = new NonErrorResolverTest(); |
| 3763 runJUnitTest(__test, __test.test_nonBoolExpression_interfaceType); | 3834 runJUnitTest(__test, __test.test_nonBoolExpression_interfaceType); |
| 3764 }); | 3835 }); |
| 3765 _ut.test('test_nonConstCaseExpression', () { | 3836 _ut.test('test_nonConstCaseExpression', () { |
| 3766 final __test = new NonErrorResolverTest(); | 3837 final __test = new NonErrorResolverTest(); |
| (...skipping 116 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3883 runJUnitTest(__test, __test.test_nonVoidReturnForSetter_method_void); | 3954 runJUnitTest(__test, __test.test_nonVoidReturnForSetter_method_void); |
| 3884 }); | 3955 }); |
| 3885 _ut.test('test_optionalParameterInOperator_required', () { | 3956 _ut.test('test_optionalParameterInOperator_required', () { |
| 3886 final __test = new NonErrorResolverTest(); | 3957 final __test = new NonErrorResolverTest(); |
| 3887 runJUnitTest(__test, __test.test_optionalParameterInOperator_required); | 3958 runJUnitTest(__test, __test.test_optionalParameterInOperator_required); |
| 3888 }); | 3959 }); |
| 3889 _ut.test('test_prefixCollidesWithTopLevelMembers', () { | 3960 _ut.test('test_prefixCollidesWithTopLevelMembers', () { |
| 3890 final __test = new NonErrorResolverTest(); | 3961 final __test = new NonErrorResolverTest(); |
| 3891 runJUnitTest(__test, __test.test_prefixCollidesWithTopLevelMembers); | 3962 runJUnitTest(__test, __test.test_prefixCollidesWithTopLevelMembers); |
| 3892 }); | 3963 }); |
| 3964 _ut.test('test_proxy_annotation_prefixed', () { |
| 3965 final __test = new NonErrorResolverTest(); |
| 3966 runJUnitTest(__test, __test.test_proxy_annotation_prefixed); |
| 3967 }); |
| 3968 _ut.test('test_proxy_annotation_prefixed2', () { |
| 3969 final __test = new NonErrorResolverTest(); |
| 3970 runJUnitTest(__test, __test.test_proxy_annotation_prefixed2); |
| 3971 }); |
| 3972 _ut.test('test_proxy_annotation_prefixed3', () { |
| 3973 final __test = new NonErrorResolverTest(); |
| 3974 runJUnitTest(__test, __test.test_proxy_annotation_prefixed3); |
| 3975 }); |
| 3976 _ut.test('test_proxy_annotation_simple', () { |
| 3977 final __test = new NonErrorResolverTest(); |
| 3978 runJUnitTest(__test, __test.test_proxy_annotation_simple); |
| 3979 }); |
| 3893 _ut.test('test_recursiveConstructorRedirect', () { | 3980 _ut.test('test_recursiveConstructorRedirect', () { |
| 3894 final __test = new NonErrorResolverTest(); | 3981 final __test = new NonErrorResolverTest(); |
| 3895 runJUnitTest(__test, __test.test_recursiveConstructorRedirect); | 3982 runJUnitTest(__test, __test.test_recursiveConstructorRedirect); |
| 3896 }); | 3983 }); |
| 3897 _ut.test('test_recursiveFactoryRedirect', () { | 3984 _ut.test('test_recursiveFactoryRedirect', () { |
| 3898 final __test = new NonErrorResolverTest(); | 3985 final __test = new NonErrorResolverTest(); |
| 3899 runJUnitTest(__test, __test.test_recursiveFactoryRedirect); | 3986 runJUnitTest(__test, __test.test_recursiveFactoryRedirect); |
| 3900 }); | 3987 }); |
| 3901 _ut.test('test_redirectToInvalidFunctionType', () { | 3988 _ut.test('test_redirectToInvalidFunctionType', () { |
| 3902 final __test = new NonErrorResolverTest(); | 3989 final __test = new NonErrorResolverTest(); |
| (...skipping 872 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 4775 " A a = new B();", | 4862 " A a = new B();", |
| 4776 " a.m();", | 4863 " a.m();", |
| 4777 " }", | 4864 " }", |
| 4778 "}"])); | 4865 "}"])); |
| 4779 resolve(source); | 4866 resolve(source); |
| 4780 assertErrors([StaticTypeWarningCode.UNDEFINED_METHOD]); | 4867 assertErrors([StaticTypeWarningCode.UNDEFINED_METHOD]); |
| 4781 } | 4868 } |
| 4782 void test_undefinedOperator_indexBoth() { | 4869 void test_undefinedOperator_indexBoth() { |
| 4783 Source source = addSource(EngineTestCase.createSource(["class A {}", "f(A a)
{", " a[0]++;", "}"])); | 4870 Source source = addSource(EngineTestCase.createSource(["class A {}", "f(A a)
{", " a[0]++;", "}"])); |
| 4784 resolve(source); | 4871 resolve(source); |
| 4785 assertErrors([StaticTypeWarningCode.UNDEFINED_OPERATOR]); | 4872 assertErrors([ |
| 4873 StaticTypeWarningCode.UNDEFINED_OPERATOR, |
| 4874 StaticTypeWarningCode.UNDEFINED_OPERATOR]); |
| 4786 } | 4875 } |
| 4787 void test_undefinedOperator_indexGetter() { | 4876 void test_undefinedOperator_indexGetter() { |
| 4788 Source source = addSource(EngineTestCase.createSource(["class A {}", "f(A a)
{", " a[0];", "}"])); | 4877 Source source = addSource(EngineTestCase.createSource(["class A {}", "f(A a)
{", " a[0];", "}"])); |
| 4789 resolve(source); | 4878 resolve(source); |
| 4790 assertErrors([StaticTypeWarningCode.UNDEFINED_OPERATOR]); | 4879 assertErrors([StaticTypeWarningCode.UNDEFINED_OPERATOR]); |
| 4791 } | 4880 } |
| 4792 void test_undefinedOperator_indexSetter() { | 4881 void test_undefinedOperator_indexSetter() { |
| 4793 Source source = addSource(EngineTestCase.createSource(["class A {}", "f(A a)
{", " a[0] = 1;", "}"])); | 4882 Source source = addSource(EngineTestCase.createSource(["class A {}", "f(A a)
{", " a[0] = 1;", "}"])); |
| 4794 resolve(source); | 4883 resolve(source); |
| 4795 assertErrors([StaticTypeWarningCode.UNDEFINED_OPERATOR]); | 4884 assertErrors([StaticTypeWarningCode.UNDEFINED_OPERATOR]); |
| (...skipping 2143 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 6939 void test_ambiguousImport_function() { | 7028 void test_ambiguousImport_function() { |
| 6940 Source source = addSource(EngineTestCase.createSource([ | 7029 Source source = addSource(EngineTestCase.createSource([ |
| 6941 "import 'lib1.dart';", | 7030 "import 'lib1.dart';", |
| 6942 "import 'lib2.dart';", | 7031 "import 'lib2.dart';", |
| 6943 "g() { return f(); }"])); | 7032 "g() { return f(); }"])); |
| 6944 addSource2("/lib1.dart", EngineTestCase.createSource(["library lib1;", "f()
{}"])); | 7033 addSource2("/lib1.dart", EngineTestCase.createSource(["library lib1;", "f()
{}"])); |
| 6945 addSource2("/lib2.dart", EngineTestCase.createSource(["library lib2;", "f()
{}"])); | 7034 addSource2("/lib2.dart", EngineTestCase.createSource(["library lib2;", "f()
{}"])); |
| 6946 resolve(source); | 7035 resolve(source); |
| 6947 assertErrors([ | 7036 assertErrors([ |
| 6948 StaticWarningCode.AMBIGUOUS_IMPORT, | 7037 StaticWarningCode.AMBIGUOUS_IMPORT, |
| 6949 StaticTypeWarningCode.INVOCATION_OF_NON_FUNCTION]); | 7038 CompileTimeErrorCode.UNDEFINED_FUNCTION]); |
| 6950 } | 7039 } |
| 6951 void test_argumentDefinitionTestNonParameter() { | 7040 void test_argumentDefinitionTestNonParameter() { |
| 6952 Source source = addSource(EngineTestCase.createSource(["f() {", " var v = 0;
", " return ?v;", "}"])); | 7041 Source source = addSource(EngineTestCase.createSource(["f() {", " var v = 0;
", " return ?v;", "}"])); |
| 6953 resolve(source); | 7042 resolve(source); |
| 6954 assertErrors([ | 7043 assertErrors([ |
| 6955 ParserErrorCode.DEPRECATED_ARGUMENT_DEFINITION_TEST, | 7044 ParserErrorCode.DEPRECATED_ARGUMENT_DEFINITION_TEST, |
| 6956 CompileTimeErrorCode.ARGUMENT_DEFINITION_TEST_NON_PARAMETER]); | 7045 CompileTimeErrorCode.ARGUMENT_DEFINITION_TEST_NON_PARAMETER]); |
| 6957 verify([source]); | 7046 verify([source]); |
| 6958 } | 7047 } |
| 6959 void test_argumentTypeNotAssignable_const() { | 7048 void test_argumentTypeNotAssignable_const() { |
| (...skipping 3918 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 10878 _unresolvedTypes.add(node); | 10967 _unresolvedTypes.add(node); |
| 10879 } else { | 10968 } else { |
| 10880 _resolvedTypeCount++; | 10969 _resolvedTypeCount++; |
| 10881 } | 10970 } |
| 10882 return null; | 10971 return null; |
| 10883 } | 10972 } |
| 10884 String getFileName(ASTNode node) { | 10973 String getFileName(ASTNode node) { |
| 10885 if (node != null) { | 10974 if (node != null) { |
| 10886 ASTNode root = node.root; | 10975 ASTNode root = node.root; |
| 10887 if (root is CompilationUnit) { | 10976 if (root is CompilationUnit) { |
| 10888 CompilationUnit rootCU = (root as CompilationUnit); | 10977 CompilationUnit rootCU = root as CompilationUnit; |
| 10889 if (rootCU.element != null) { | 10978 if (rootCU.element != null) { |
| 10890 return rootCU.element.source.fullName; | 10979 return rootCU.element.source.fullName; |
| 10891 } else { | 10980 } else { |
| 10892 return "<unknown file- CompilationUnit.getElement() returned null>"; | 10981 return "<unknown file- CompilationUnit.getElement() returned null>"; |
| 10893 } | 10982 } |
| 10894 } else { | 10983 } else { |
| 10895 return "<unknown file- CompilationUnit.getRoot() is not a CompilationUni
t>"; | 10984 return "<unknown file- CompilationUnit.getRoot() is not a CompilationUni
t>"; |
| 10896 } | 10985 } |
| 10897 } | 10986 } |
| 10898 return "<unknown file- ASTNode is null>"; | 10987 return "<unknown file- ASTNode is null>"; |
| (...skipping 4251 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 15150 return null; | 15239 return null; |
| 15151 } | 15240 } |
| 15152 return node.propertyName.accept(this); | 15241 return node.propertyName.accept(this); |
| 15153 } | 15242 } |
| 15154 Object visitSimpleIdentifier(SimpleIdentifier node) { | 15243 Object visitSimpleIdentifier(SimpleIdentifier node) { |
| 15155 if (node.name == "void") { | 15244 if (node.name == "void") { |
| 15156 return null; | 15245 return null; |
| 15157 } | 15246 } |
| 15158 ASTNode parent = node.parent; | 15247 ASTNode parent = node.parent; |
| 15159 if (parent is MethodInvocation) { | 15248 if (parent is MethodInvocation) { |
| 15160 MethodInvocation invocation = (parent as MethodInvocation); | 15249 MethodInvocation invocation = parent as MethodInvocation; |
| 15161 if (identical(invocation.methodName, node)) { | 15250 if (identical(invocation.methodName, node)) { |
| 15162 Expression target = invocation.realTarget; | 15251 Expression target = invocation.realTarget; |
| 15163 Type2 targetType = target == null ? null : target.staticType; | 15252 Type2 targetType = target == null ? null : target.staticType; |
| 15164 if (targetType == null || targetType.isDynamic) { | 15253 if (targetType == null || targetType.isDynamic) { |
| 15165 return null; | 15254 return null; |
| 15166 } | 15255 } |
| 15167 } | 15256 } |
| 15168 } | 15257 } |
| 15169 return checkResolved(node, node.staticElement); | 15258 return checkResolved(node, node.staticElement); |
| 15170 } | 15259 } |
| 15171 Object checkResolved(ASTNode node, Element element) => checkResolved2(node, el
ement, null); | 15260 Object checkResolved(ASTNode node, Element element) => checkResolved2(node, el
ement, null); |
| 15172 Object checkResolved2(ASTNode node, Element element, Type expectedClass) { | 15261 Object checkResolved2(ASTNode node, Element element, Type expectedClass) { |
| 15173 if (element == null) { | 15262 if (element == null) { |
| 15174 if (_knownExceptions == null || !_knownExceptions.contains(node)) { | 15263 if (_knownExceptions == null || !_knownExceptions.contains(node)) { |
| 15175 _unresolvedNodes.add(node); | 15264 _unresolvedNodes.add(node); |
| 15176 } | 15265 } |
| 15177 } else if (expectedClass != null) { | 15266 } else if (expectedClass != null) { |
| 15178 if (!isInstanceOf(element, expectedClass)) { | 15267 if (!isInstanceOf(element, expectedClass)) { |
| 15179 _wrongTypedNodes.add(node); | 15268 _wrongTypedNodes.add(node); |
| 15180 } | 15269 } |
| 15181 } | 15270 } |
| 15182 return null; | 15271 return null; |
| 15183 } | 15272 } |
| 15184 String getFileName(ASTNode node) { | 15273 String getFileName(ASTNode node) { |
| 15185 if (node != null) { | 15274 if (node != null) { |
| 15186 ASTNode root = node.root; | 15275 ASTNode root = node.root; |
| 15187 if (root is CompilationUnit) { | 15276 if (root is CompilationUnit) { |
| 15188 CompilationUnit rootCU = (root as CompilationUnit); | 15277 CompilationUnit rootCU = root as CompilationUnit; |
| 15189 if (rootCU.element != null) { | 15278 if (rootCU.element != null) { |
| 15190 return rootCU.element.source.fullName; | 15279 return rootCU.element.source.fullName; |
| 15191 } else { | 15280 } else { |
| 15192 return "<unknown file- CompilationUnit.getElement() returned null>"; | 15281 return "<unknown file- CompilationUnit.getElement() returned null>"; |
| 15193 } | 15282 } |
| 15194 } else { | 15283 } else { |
| 15195 return "<unknown file- CompilationUnit.getRoot() is not a CompilationUni
t>"; | 15284 return "<unknown file- CompilationUnit.getRoot() is not a CompilationUni
t>"; |
| 15196 } | 15285 } |
| 15197 } | 15286 } |
| 15198 return "<unknown file- ASTNode is null>"; | 15287 return "<unknown file- ASTNode is null>"; |
| (...skipping 713 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 15912 int length = expectedArguments.length; | 16001 int length = expectedArguments.length; |
| 15913 List<Type2> actualArguments = actualType.typeArguments; | 16002 List<Type2> actualArguments = actualType.typeArguments; |
| 15914 EngineTestCase.assertLength(length, actualArguments); | 16003 EngineTestCase.assertLength(length, actualArguments); |
| 15915 for (int i = 0; i < length; i++) { | 16004 for (int i = 0; i < length; i++) { |
| 15916 assertType2(expectedArguments[i], actualArguments[i]); | 16005 assertType2(expectedArguments[i], actualArguments[i]); |
| 15917 } | 16006 } |
| 15918 } | 16007 } |
| 15919 void assertType2(Type2 expectedType, Type2 actualType) { | 16008 void assertType2(Type2 expectedType, Type2 actualType) { |
| 15920 if (expectedType is InterfaceTypeImpl) { | 16009 if (expectedType is InterfaceTypeImpl) { |
| 15921 EngineTestCase.assertInstanceOf(InterfaceTypeImpl, actualType); | 16010 EngineTestCase.assertInstanceOf(InterfaceTypeImpl, actualType); |
| 15922 assertType((expectedType as InterfaceTypeImpl), (actualType as InterfaceTy
peImpl)); | 16011 assertType(expectedType as InterfaceTypeImpl, actualType as InterfaceTypeI
mpl); |
| 15923 } | 16012 } |
| 15924 } | 16013 } |
| 15925 | 16014 |
| 15926 /** | 16015 /** |
| 15927 * Create the analyzer used by the tests. | 16016 * Create the analyzer used by the tests. |
| 15928 * | 16017 * |
| 15929 * @return the analyzer to be used by the tests | 16018 * @return the analyzer to be used by the tests |
| 15930 */ | 16019 */ |
| 15931 StaticTypeAnalyzer createAnalyzer() { | 16020 StaticTypeAnalyzer createAnalyzer() { |
| 15932 AnalysisContextImpl context = new AnalysisContextImpl(); | 16021 AnalysisContextImpl context = new AnalysisContextImpl(); |
| (...skipping 1364 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 17297 * valid | 17386 * valid |
| 17298 */ | 17387 */ |
| 17299 void validateArgumentResolution(Source source, List<int> indices) { | 17388 void validateArgumentResolution(Source source, List<int> indices) { |
| 17300 LibraryElement library = resolve(source); | 17389 LibraryElement library = resolve(source); |
| 17301 JUnitTestCase.assertNotNull(library); | 17390 JUnitTestCase.assertNotNull(library); |
| 17302 ClassElement classElement = library.definingCompilationUnit.types[0]; | 17391 ClassElement classElement = library.definingCompilationUnit.types[0]; |
| 17303 List<ParameterElement> parameters = classElement.methods[1].parameters; | 17392 List<ParameterElement> parameters = classElement.methods[1].parameters; |
| 17304 CompilationUnit unit = resolveCompilationUnit(source, library); | 17393 CompilationUnit unit = resolveCompilationUnit(source, library); |
| 17305 JUnitTestCase.assertNotNull(unit); | 17394 JUnitTestCase.assertNotNull(unit); |
| 17306 ClassDeclaration classDeclaration = unit.declarations[0] as ClassDeclaration
; | 17395 ClassDeclaration classDeclaration = unit.declarations[0] as ClassDeclaration
; |
| 17307 MethodDeclaration methodDeclaration = (classDeclaration.members[0] as Method
Declaration); | 17396 MethodDeclaration methodDeclaration = classDeclaration.members[0] as MethodD
eclaration; |
| 17308 Block block = ((methodDeclaration.body as BlockFunctionBody)).block; | 17397 Block block = ((methodDeclaration.body as BlockFunctionBody)).block; |
| 17309 ExpressionStatement statement = block.statements[0] as ExpressionStatement; | 17398 ExpressionStatement statement = block.statements[0] as ExpressionStatement; |
| 17310 MethodInvocation invocation = statement.expression as MethodInvocation; | 17399 MethodInvocation invocation = statement.expression as MethodInvocation; |
| 17311 NodeList<Expression> arguments = invocation.argumentList.arguments; | 17400 NodeList<Expression> arguments = invocation.argumentList.arguments; |
| 17312 int argumentCount = arguments.length; | 17401 int argumentCount = arguments.length; |
| 17313 JUnitTestCase.assertEquals(indices.length, argumentCount); | 17402 JUnitTestCase.assertEquals(indices.length, argumentCount); |
| 17314 for (int i = 0; i < argumentCount; i++) { | 17403 for (int i = 0; i < argumentCount; i++) { |
| 17315 Expression argument = arguments[i]; | 17404 Expression argument = arguments[i]; |
| 17316 ParameterElement element = argument.staticParameterElement; | 17405 ParameterElement element = argument.staticParameterElement; |
| 17317 int index = indices[i]; | 17406 int index = indices[i]; |
| (...skipping 183 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 17501 runJUnitTest(__test, __test.test_setter_inherited); | 17590 runJUnitTest(__test, __test.test_setter_inherited); |
| 17502 }); | 17591 }); |
| 17503 _ut.test('test_setter_static', () { | 17592 _ut.test('test_setter_static', () { |
| 17504 final __test = new SimpleResolverTest(); | 17593 final __test = new SimpleResolverTest(); |
| 17505 runJUnitTest(__test, __test.test_setter_static); | 17594 runJUnitTest(__test, __test.test_setter_static); |
| 17506 }); | 17595 }); |
| 17507 }); | 17596 }); |
| 17508 } | 17597 } |
| 17509 } | 17598 } |
| 17510 main() { | 17599 main() { |
| 17511 // ElementResolverTest.dartSuite(); | 17600 ElementResolverTest.dartSuite(); |
| 17512 // InheritanceManagerTest.dartSuite(); | 17601 InheritanceManagerTest.dartSuite(); |
| 17513 // LibraryElementBuilderTest.dartSuite(); | 17602 LibraryElementBuilderTest.dartSuite(); |
| 17514 // LibraryTest.dartSuite(); | 17603 LibraryTest.dartSuite(); |
| 17515 // StaticTypeAnalyzerTest.dartSuite(); | 17604 StaticTypeAnalyzerTest.dartSuite(); |
| 17516 // TypeOverrideManagerTest.dartSuite(); | 17605 TypeOverrideManagerTest.dartSuite(); |
| 17517 // TypeProviderImplTest.dartSuite(); | 17606 TypeProviderImplTest.dartSuite(); |
| 17518 // TypeResolverVisitorTest.dartSuite(); | 17607 TypeResolverVisitorTest.dartSuite(); |
| 17519 // EnclosedScopeTest.dartSuite(); | 17608 EnclosedScopeTest.dartSuite(); |
| 17520 // LibraryImportScopeTest.dartSuite(); | 17609 LibraryImportScopeTest.dartSuite(); |
| 17521 // LibraryScopeTest.dartSuite(); | 17610 LibraryScopeTest.dartSuite(); |
| 17522 // ScopeTest.dartSuite(); | 17611 ScopeTest.dartSuite(); |
| 17523 // CompileTimeErrorCodeTest.dartSuite(); | 17612 CompileTimeErrorCodeTest.dartSuite(); |
| 17524 // ErrorResolverTest.dartSuite(); | 17613 ErrorResolverTest.dartSuite(); |
| 17525 // HintCodeTest.dartSuite(); | 17614 HintCodeTest.dartSuite(); |
| 17526 // NonHintCodeTest.dartSuite(); | 17615 NonHintCodeTest.dartSuite(); |
| 17527 // NonErrorResolverTest.dartSuite(); | 17616 NonErrorResolverTest.dartSuite(); |
| 17528 // SimpleResolverTest.dartSuite(); | 17617 SimpleResolverTest.dartSuite(); |
| 17529 // StaticTypeWarningCodeTest.dartSuite(); | 17618 StaticTypeWarningCodeTest.dartSuite(); |
| 17530 // StaticWarningCodeTest.dartSuite(); | 17619 StaticWarningCodeTest.dartSuite(); |
| 17531 // StrictModeTest.dartSuite(); | 17620 StrictModeTest.dartSuite(); |
| 17532 // TypePropagationTest.dartSuite(); | 17621 TypePropagationTest.dartSuite(); |
| 17533 } | 17622 } |
| OLD | NEW |