| 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 490 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 501 "class A {}", | 501 "class A {}", |
| 502 "A f(var p) {", | 502 "A f(var p) {", |
| 503 " if (p is! A || null == p) {", | 503 " if (p is! A || null == p) {", |
| 504 " return null;", | 504 " return null;", |
| 505 " } else {", | 505 " } else {", |
| 506 " return p;", | 506 " return p;", |
| 507 " }", | 507 " }", |
| 508 "}"])); | 508 "}"])); |
| 509 LibraryElement library = resolve(source); | 509 LibraryElement library = resolve(source); |
| 510 assertNoErrors(source); | 510 assertNoErrors(source); |
| 511 verify([source]); | |
| 512 CompilationUnit unit = resolveCompilationUnit(source, library); | 511 CompilationUnit unit = resolveCompilationUnit(source, library); |
| 513 ClassDeclaration classA = unit.declarations[0] as ClassDeclaration; | 512 ClassDeclaration classA = unit.declarations[0] as ClassDeclaration; |
| 514 InterfaceType typeA = classA.element.type; | 513 InterfaceType typeA = classA.element.type; |
| 515 FunctionDeclaration function = unit.declarations[1] as FunctionDeclaration; | 514 FunctionDeclaration function = unit.declarations[1] as FunctionDeclaration; |
| 516 BlockFunctionBody body = function.functionExpression.body as BlockFunctionBo
dy; | 515 BlockFunctionBody body = function.functionExpression.body as BlockFunctionBo
dy; |
| 517 IfStatement ifStatement = body.block.statements[0] as IfStatement; | 516 IfStatement ifStatement = body.block.statements[0] as IfStatement; |
| 518 ReturnStatement statement = ((ifStatement.elseStatement as Block)).statement
s[0] as ReturnStatement; | 517 ReturnStatement statement = ((ifStatement.elseStatement as Block)).statement
s[0] as ReturnStatement; |
| 519 SimpleIdentifier variableName = statement.expression as SimpleIdentifier; | 518 SimpleIdentifier variableName = statement.expression as SimpleIdentifier; |
| 520 JUnitTestCase.assertSame(typeA, variableName.propagatedType); | 519 JUnitTestCase.assertSame(typeA, variableName.propagatedType); |
| 521 } | 520 } |
| (...skipping 691 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1213 Source source = addSource(EngineTestCase.createSource([ | 1212 Source source = addSource(EngineTestCase.createSource([ |
| 1214 "class A {", | 1213 "class A {", |
| 1215 " const A();", | 1214 " const A();", |
| 1216 " static m() {}", | 1215 " static m() {}", |
| 1217 "}", | 1216 "}", |
| 1218 "const C = A.m;"])); | 1217 "const C = A.m;"])); |
| 1219 resolve(source); | 1218 resolve(source); |
| 1220 assertNoErrors(source); | 1219 assertNoErrors(source); |
| 1221 verify([source]); | 1220 verify([source]); |
| 1222 } | 1221 } |
| 1222 void test_constEval_symbol() { |
| 1223 addSource2("/math.dart", EngineTestCase.createSource(["library math;", "cons
t PI = 3.14;"])); |
| 1224 Source source = addSource(EngineTestCase.createSource(["const C = #foo;", "f
oo() {}"])); |
| 1225 resolve(source); |
| 1226 assertNoErrors(source); |
| 1227 verify([source]); |
| 1228 } |
| 1223 void test_constEvalTypeBoolNumString_equal() { | 1229 void test_constEvalTypeBoolNumString_equal() { |
| 1224 Source source = addSource(EngineTestCase.createSource([ | 1230 Source source = addSource(EngineTestCase.createSource([ |
| 1225 "class A {", | 1231 "class A {", |
| 1226 " const A();", | 1232 " const A();", |
| 1227 "}", | 1233 "}", |
| 1228 "class B {", | 1234 "class B {", |
| 1229 " final v;", | 1235 " final v;", |
| 1230 " const B.a1(bool p) : v = p == true;", | 1236 " const B.a1(bool p) : v = p == true;", |
| 1231 " const B.a2(bool p) : v = p == false;", | 1237 " const B.a2(bool p) : v = p == false;", |
| 1232 " const B.a3(bool p) : v = p == 0;", | 1238 " const B.a3(bool p) : v = p == 0;", |
| 1233 " const B.a4(bool p) : v = p == 0.0;", | 1239 " const B.a4(bool p) : v = p == 0.0;", |
| 1234 " const B.a5(bool p) : v = p == '';", | 1240 " const B.a5(bool p) : v = p == '';", |
| 1235 " const B.b1(int p) : v = p == true;", | 1241 " const B.b1(int p) : v = p == true;", |
| 1236 " const B.b2(int p) : v = p == false;", | 1242 " const B.b2(int p) : v = p == false;", |
| 1237 " const B.b3(int p) : v = p == 0;", | 1243 " const B.b3(int p) : v = p == 0;", |
| 1238 " const B.b4(int p) : v = p == 0.0;", | 1244 " const B.b4(int p) : v = p == 0.0;", |
| 1239 " const B.b5(int p) : v = p == '';", | 1245 " const B.b5(int p) : v = p == '';", |
| 1240 " const B.c1(String p) : v = p == true;", | 1246 " const B.c1(String p) : v = p == true;", |
| 1241 " const B.c2(String p) : v = p == false;", | 1247 " const B.c2(String p) : v = p == false;", |
| 1242 " const B.c3(String p) : v = p == 0;", | 1248 " const B.c3(String p) : v = p == 0;", |
| 1243 " const B.c4(String p) : v = p == 0.0;", | 1249 " const B.c4(String p) : v = p == 0.0;", |
| 1244 " const B.c5(String p) : v = p == '';", | 1250 " const B.c5(String p) : v = p == '';", |
| 1245 " const B.n1(num p) : v = p == null;", | 1251 " const B.n1(num p) : v = p == null;", |
| 1246 " const B.n2(num p) : v = null == p;", | 1252 " const B.n2(num p) : v = null == p;", |
| 1247 "}"])); | 1253 "}"])); |
| 1248 resolve(source); | 1254 resolve(source); |
| 1249 assertNoErrors(source); | 1255 assertNoErrors(source); |
| 1250 verify([source]); | |
| 1251 } | 1256 } |
| 1252 void test_constEvalTypeBoolNumString_notEqual() { | 1257 void test_constEvalTypeBoolNumString_notEqual() { |
| 1253 Source source = addSource(EngineTestCase.createSource([ | 1258 Source source = addSource(EngineTestCase.createSource([ |
| 1254 "class A {", | 1259 "class A {", |
| 1255 " const A();", | 1260 " const A();", |
| 1256 "}", | 1261 "}", |
| 1257 "class B {", | 1262 "class B {", |
| 1258 " final v;", | 1263 " final v;", |
| 1259 " const B.a1(bool p) : v = p != true;", | 1264 " const B.a1(bool p) : v = p != true;", |
| 1260 " const B.a2(bool p) : v = p != false;", | 1265 " const B.a2(bool p) : v = p != false;", |
| (...skipping 607 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1868 "class A {", | 1873 "class A {", |
| 1869 " m() {}", | 1874 " m() {}", |
| 1870 " /// [m]", | 1875 " /// [m]", |
| 1871 " static foo() {", | 1876 " static foo() {", |
| 1872 " }", | 1877 " }", |
| 1873 "}"])); | 1878 "}"])); |
| 1874 resolve(source); | 1879 resolve(source); |
| 1875 assertNoErrors(source); | 1880 assertNoErrors(source); |
| 1876 verify([source]); | 1881 verify([source]); |
| 1877 } | 1882 } |
| 1883 void test_instanceMethodNameCollidesWithSuperclassStatic_field() { |
| 1884 Source source = addSource(EngineTestCase.createSource([ |
| 1885 "import 'lib.dart';", |
| 1886 "class B extends A {", |
| 1887 " _m() {}", |
| 1888 "}"])); |
| 1889 addSource2("/lib.dart", EngineTestCase.createSource(["library L;", "class A
{", " static var _m;", "}"])); |
| 1890 resolve(source); |
| 1891 assertNoErrors(source); |
| 1892 verify([source]); |
| 1893 } |
| 1894 void test_instanceMethodNameCollidesWithSuperclassStatic_method() { |
| 1895 Source source = addSource(EngineTestCase.createSource([ |
| 1896 "import 'lib.dart';", |
| 1897 "class B extends A {", |
| 1898 " _m() {}", |
| 1899 "}"])); |
| 1900 addSource2("/lib.dart", EngineTestCase.createSource(["library L;", "class A
{", " static _m() {}", "}"])); |
| 1901 resolve(source); |
| 1902 assertErrors(source, [HintCode.OVERRIDDING_PRIVATE_MEMBER]); |
| 1903 verify([source]); |
| 1904 } |
| 1878 void test_invalidAnnotation_constantVariable() { | 1905 void test_invalidAnnotation_constantVariable() { |
| 1879 Source source = addSource(EngineTestCase.createSource(["const C = 0;", "@C",
"main() {", "}"])); | 1906 Source source = addSource(EngineTestCase.createSource(["const C = 0;", "@C",
"main() {", "}"])); |
| 1880 resolve(source); | 1907 resolve(source); |
| 1881 assertNoErrors(source); | 1908 assertNoErrors(source); |
| 1882 verify([source]); | 1909 verify([source]); |
| 1883 } | 1910 } |
| 1884 void test_invalidAnnotation_importWithPrefix_constantVariable() { | 1911 void test_invalidAnnotation_importWithPrefix_constantVariable() { |
| 1885 addSource2("/lib.dart", EngineTestCase.createSource(["library lib;", "const
C = 0;"])); | 1912 addSource2("/lib.dart", EngineTestCase.createSource(["library lib;", "const
C = 0;"])); |
| 1886 Source source = addSource(EngineTestCase.createSource(["import 'lib.dart' as
p;", "@p.C", "main() {", "}"])); | 1913 Source source = addSource(EngineTestCase.createSource(["import 'lib.dart' as
p;", "@p.C", "main() {", "}"])); |
| 1887 resolve(source); | 1914 resolve(source); |
| (...skipping 845 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2733 resolve(source); | 2760 resolve(source); |
| 2734 assertNoErrors(source); | 2761 assertNoErrors(source); |
| 2735 verify([source]); | 2762 verify([source]); |
| 2736 } | 2763 } |
| 2737 void test_nonVoidReturnForSetter_method_void() { | 2764 void test_nonVoidReturnForSetter_method_void() { |
| 2738 Source source = addSource(EngineTestCase.createSource(["class A {", " void
set x(v) {}", "}"])); | 2765 Source source = addSource(EngineTestCase.createSource(["class A {", " void
set x(v) {}", "}"])); |
| 2739 resolve(source); | 2766 resolve(source); |
| 2740 assertNoErrors(source); | 2767 assertNoErrors(source); |
| 2741 verify([source]); | 2768 verify([source]); |
| 2742 } | 2769 } |
| 2770 void test_null_callMethod() { |
| 2771 Source source = addSource(EngineTestCase.createSource(["main() {", " null.m
();", "}"])); |
| 2772 resolve(source); |
| 2773 assertNoErrors(source); |
| 2774 } |
| 2775 void test_null_callOperator() { |
| 2776 Source source = addSource(EngineTestCase.createSource([ |
| 2777 "main() {", |
| 2778 " null + 5;", |
| 2779 " null == 5;", |
| 2780 " null[0];", |
| 2781 "}"])); |
| 2782 resolve(source); |
| 2783 assertNoErrors(source); |
| 2784 } |
| 2743 void test_optionalParameterInOperator_required() { | 2785 void test_optionalParameterInOperator_required() { |
| 2744 Source source = addSource(EngineTestCase.createSource(["class A {", " opera
tor +(p) {}", "}"])); | 2786 Source source = addSource(EngineTestCase.createSource(["class A {", " opera
tor +(p) {}", "}"])); |
| 2745 resolve(source); | 2787 resolve(source); |
| 2746 assertNoErrors(source); | 2788 assertNoErrors(source); |
| 2747 verify([source]); | 2789 verify([source]); |
| 2748 } | 2790 } |
| 2749 void test_prefixCollidesWithTopLevelMembers() { | 2791 void test_prefixCollidesWithTopLevelMembers() { |
| 2750 addSource2("/lib.dart", EngineTestCase.createSource(["library lib;", "class
A {}"])); | 2792 addSource2("/lib.dart", EngineTestCase.createSource(["library lib;", "class
A {}"])); |
| 2751 Source source = addSource(EngineTestCase.createSource([ | 2793 Source source = addSource(EngineTestCase.createSource([ |
| 2752 "import 'lib.dart' as p;", | 2794 "import 'lib.dart' as p;", |
| (...skipping 727 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3480 runJUnitTest(__test, __test.test_constEvalTypeBoolNumString_notEqual); | 3522 runJUnitTest(__test, __test.test_constEvalTypeBoolNumString_notEqual); |
| 3481 }); | 3523 }); |
| 3482 _ut.test('test_constEval_propertyExtraction_fieldStatic_targetType', () { | 3524 _ut.test('test_constEval_propertyExtraction_fieldStatic_targetType', () { |
| 3483 final __test = new NonErrorResolverTest(); | 3525 final __test = new NonErrorResolverTest(); |
| 3484 runJUnitTest(__test, __test.test_constEval_propertyExtraction_fieldStati
c_targetType); | 3526 runJUnitTest(__test, __test.test_constEval_propertyExtraction_fieldStati
c_targetType); |
| 3485 }); | 3527 }); |
| 3486 _ut.test('test_constEval_propertyExtraction_methodStatic_targetType', () { | 3528 _ut.test('test_constEval_propertyExtraction_methodStatic_targetType', () { |
| 3487 final __test = new NonErrorResolverTest(); | 3529 final __test = new NonErrorResolverTest(); |
| 3488 runJUnitTest(__test, __test.test_constEval_propertyExtraction_methodStat
ic_targetType); | 3530 runJUnitTest(__test, __test.test_constEval_propertyExtraction_methodStat
ic_targetType); |
| 3489 }); | 3531 }); |
| 3532 _ut.test('test_constEval_symbol', () { |
| 3533 final __test = new NonErrorResolverTest(); |
| 3534 runJUnitTest(__test, __test.test_constEval_symbol); |
| 3535 }); |
| 3490 _ut.test('test_constNotInitialized_field', () { | 3536 _ut.test('test_constNotInitialized_field', () { |
| 3491 final __test = new NonErrorResolverTest(); | 3537 final __test = new NonErrorResolverTest(); |
| 3492 runJUnitTest(__test, __test.test_constNotInitialized_field); | 3538 runJUnitTest(__test, __test.test_constNotInitialized_field); |
| 3493 }); | 3539 }); |
| 3494 _ut.test('test_constNotInitialized_local', () { | 3540 _ut.test('test_constNotInitialized_local', () { |
| 3495 final __test = new NonErrorResolverTest(); | 3541 final __test = new NonErrorResolverTest(); |
| 3496 runJUnitTest(__test, __test.test_constNotInitialized_local); | 3542 runJUnitTest(__test, __test.test_constNotInitialized_local); |
| 3497 }); | 3543 }); |
| 3498 _ut.test('test_constWithNonConstantArgument_literals', () { | 3544 _ut.test('test_constWithNonConstantArgument_literals', () { |
| 3499 final __test = new NonErrorResolverTest(); | 3545 final __test = new NonErrorResolverTest(); |
| (...skipping 236 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3736 runJUnitTest(__test, __test.test_instanceAccessToStaticMember_fromCommen
t); | 3782 runJUnitTest(__test, __test.test_instanceAccessToStaticMember_fromCommen
t); |
| 3737 }); | 3783 }); |
| 3738 _ut.test('test_instanceAccessToStaticMember_topLevel', () { | 3784 _ut.test('test_instanceAccessToStaticMember_topLevel', () { |
| 3739 final __test = new NonErrorResolverTest(); | 3785 final __test = new NonErrorResolverTest(); |
| 3740 runJUnitTest(__test, __test.test_instanceAccessToStaticMember_topLevel); | 3786 runJUnitTest(__test, __test.test_instanceAccessToStaticMember_topLevel); |
| 3741 }); | 3787 }); |
| 3742 _ut.test('test_instanceMemberAccessFromStatic_fromComment', () { | 3788 _ut.test('test_instanceMemberAccessFromStatic_fromComment', () { |
| 3743 final __test = new NonErrorResolverTest(); | 3789 final __test = new NonErrorResolverTest(); |
| 3744 runJUnitTest(__test, __test.test_instanceMemberAccessFromStatic_fromComm
ent); | 3790 runJUnitTest(__test, __test.test_instanceMemberAccessFromStatic_fromComm
ent); |
| 3745 }); | 3791 }); |
| 3792 _ut.test('test_instanceMethodNameCollidesWithSuperclassStatic_field', () { |
| 3793 final __test = new NonErrorResolverTest(); |
| 3794 runJUnitTest(__test, __test.test_instanceMethodNameCollidesWithSuperclas
sStatic_field); |
| 3795 }); |
| 3796 _ut.test('test_instanceMethodNameCollidesWithSuperclassStatic_method', ()
{ |
| 3797 final __test = new NonErrorResolverTest(); |
| 3798 runJUnitTest(__test, __test.test_instanceMethodNameCollidesWithSuperclas
sStatic_method); |
| 3799 }); |
| 3746 _ut.test('test_invalidAnnotation_constantVariable', () { | 3800 _ut.test('test_invalidAnnotation_constantVariable', () { |
| 3747 final __test = new NonErrorResolverTest(); | 3801 final __test = new NonErrorResolverTest(); |
| 3748 runJUnitTest(__test, __test.test_invalidAnnotation_constantVariable); | 3802 runJUnitTest(__test, __test.test_invalidAnnotation_constantVariable); |
| 3749 }); | 3803 }); |
| 3750 _ut.test('test_invalidAnnotation_importWithPrefix_constConstructor', () { | 3804 _ut.test('test_invalidAnnotation_importWithPrefix_constConstructor', () { |
| 3751 final __test = new NonErrorResolverTest(); | 3805 final __test = new NonErrorResolverTest(); |
| 3752 runJUnitTest(__test, __test.test_invalidAnnotation_importWithPrefix_cons
tConstructor); | 3806 runJUnitTest(__test, __test.test_invalidAnnotation_importWithPrefix_cons
tConstructor); |
| 3753 }); | 3807 }); |
| 3754 _ut.test('test_invalidAnnotation_importWithPrefix_constantVariable', () { | 3808 _ut.test('test_invalidAnnotation_importWithPrefix_constantVariable', () { |
| 3755 final __test = new NonErrorResolverTest(); | 3809 final __test = new NonErrorResolverTest(); |
| (...skipping 332 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 4088 runJUnitTest(__test, __test.test_nonVoidReturnForSetter_function_void); | 4142 runJUnitTest(__test, __test.test_nonVoidReturnForSetter_function_void); |
| 4089 }); | 4143 }); |
| 4090 _ut.test('test_nonVoidReturnForSetter_method_no', () { | 4144 _ut.test('test_nonVoidReturnForSetter_method_no', () { |
| 4091 final __test = new NonErrorResolverTest(); | 4145 final __test = new NonErrorResolverTest(); |
| 4092 runJUnitTest(__test, __test.test_nonVoidReturnForSetter_method_no); | 4146 runJUnitTest(__test, __test.test_nonVoidReturnForSetter_method_no); |
| 4093 }); | 4147 }); |
| 4094 _ut.test('test_nonVoidReturnForSetter_method_void', () { | 4148 _ut.test('test_nonVoidReturnForSetter_method_void', () { |
| 4095 final __test = new NonErrorResolverTest(); | 4149 final __test = new NonErrorResolverTest(); |
| 4096 runJUnitTest(__test, __test.test_nonVoidReturnForSetter_method_void); | 4150 runJUnitTest(__test, __test.test_nonVoidReturnForSetter_method_void); |
| 4097 }); | 4151 }); |
| 4152 _ut.test('test_null_callMethod', () { |
| 4153 final __test = new NonErrorResolverTest(); |
| 4154 runJUnitTest(__test, __test.test_null_callMethod); |
| 4155 }); |
| 4156 _ut.test('test_null_callOperator', () { |
| 4157 final __test = new NonErrorResolverTest(); |
| 4158 runJUnitTest(__test, __test.test_null_callOperator); |
| 4159 }); |
| 4098 _ut.test('test_optionalParameterInOperator_required', () { | 4160 _ut.test('test_optionalParameterInOperator_required', () { |
| 4099 final __test = new NonErrorResolverTest(); | 4161 final __test = new NonErrorResolverTest(); |
| 4100 runJUnitTest(__test, __test.test_optionalParameterInOperator_required); | 4162 runJUnitTest(__test, __test.test_optionalParameterInOperator_required); |
| 4101 }); | 4163 }); |
| 4102 _ut.test('test_prefixCollidesWithTopLevelMembers', () { | 4164 _ut.test('test_prefixCollidesWithTopLevelMembers', () { |
| 4103 final __test = new NonErrorResolverTest(); | 4165 final __test = new NonErrorResolverTest(); |
| 4104 runJUnitTest(__test, __test.test_prefixCollidesWithTopLevelMembers); | 4166 runJUnitTest(__test, __test.test_prefixCollidesWithTopLevelMembers); |
| 4105 }); | 4167 }); |
| 4106 _ut.test('test_proxy_annotation_prefixed', () { | 4168 _ut.test('test_proxy_annotation_prefixed', () { |
| 4107 final __test = new NonErrorResolverTest(); | 4169 final __test = new NonErrorResolverTest(); |
| (...skipping 2823 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 6931 _inheritanceManager = createInheritanceManager(); | 6993 _inheritanceManager = createInheritanceManager(); |
| 6932 InterfaceType objectType = _typeProvider.objectType; | 6994 InterfaceType objectType = _typeProvider.objectType; |
| 6933 _numOfMembersInObject = objectType.methods.length + objectType.accessors.len
gth; | 6995 _numOfMembersInObject = objectType.methods.length + objectType.accessors.len
gth; |
| 6934 } | 6996 } |
| 6935 void test_getMapOfMembersInheritedFromClasses_accessor_extends() { | 6997 void test_getMapOfMembersInheritedFromClasses_accessor_extends() { |
| 6936 ClassElementImpl classA = ElementFactory.classElement2("A", []); | 6998 ClassElementImpl classA = ElementFactory.classElement2("A", []); |
| 6937 String getterName = "g"; | 6999 String getterName = "g"; |
| 6938 PropertyAccessorElement getterG = ElementFactory.getterElement(getterName, f
alse, _typeProvider.intType); | 7000 PropertyAccessorElement getterG = ElementFactory.getterElement(getterName, f
alse, _typeProvider.intType); |
| 6939 classA.accessors = <PropertyAccessorElement> [getterG]; | 7001 classA.accessors = <PropertyAccessorElement> [getterG]; |
| 6940 ClassElementImpl classB = ElementFactory.classElement("B", classA.type, []); | 7002 ClassElementImpl classB = ElementFactory.classElement("B", classA.type, []); |
| 6941 Map<String, ExecutableElement> mapB = _inheritanceManager.getMapOfMembersInh
eritedFromClasses(classB); | 7003 MemberMap mapB = _inheritanceManager.getMapOfMembersInheritedFromClasses(cla
ssB); |
| 6942 Map<String, ExecutableElement> mapA = _inheritanceManager.getMapOfMembersInh
eritedFromClasses(classA); | 7004 MemberMap mapA = _inheritanceManager.getMapOfMembersInheritedFromClasses(cla
ssA); |
| 6943 EngineTestCase.assertSize2(_numOfMembersInObject, mapA); | 7005 JUnitTestCase.assertEquals(_numOfMembersInObject, mapA.size); |
| 6944 EngineTestCase.assertSize2(_numOfMembersInObject + 1, mapB); | 7006 JUnitTestCase.assertEquals(_numOfMembersInObject + 1, mapB.size); |
| 6945 JUnitTestCase.assertSame(getterG, mapB[getterName]); | 7007 JUnitTestCase.assertSame(getterG, mapB.get(getterName)); |
| 6946 assertNoErrors(classA); | 7008 assertNoErrors(classA); |
| 6947 assertNoErrors(classB); | 7009 assertNoErrors(classB); |
| 6948 } | 7010 } |
| 6949 void test_getMapOfMembersInheritedFromClasses_accessor_implements() { | 7011 void test_getMapOfMembersInheritedFromClasses_accessor_implements() { |
| 6950 ClassElementImpl classA = ElementFactory.classElement2("A", []); | 7012 ClassElementImpl classA = ElementFactory.classElement2("A", []); |
| 6951 String getterName = "g"; | 7013 String getterName = "g"; |
| 6952 PropertyAccessorElement getterG = ElementFactory.getterElement(getterName, f
alse, _typeProvider.intType); | 7014 PropertyAccessorElement getterG = ElementFactory.getterElement(getterName, f
alse, _typeProvider.intType); |
| 6953 classA.accessors = <PropertyAccessorElement> [getterG]; | 7015 classA.accessors = <PropertyAccessorElement> [getterG]; |
| 6954 ClassElementImpl classB = ElementFactory.classElement2("B", []); | 7016 ClassElementImpl classB = ElementFactory.classElement2("B", []); |
| 6955 classB.interfaces = <InterfaceType> [classA.type]; | 7017 classB.interfaces = <InterfaceType> [classA.type]; |
| 6956 Map<String, ExecutableElement> mapB = _inheritanceManager.getMapOfMembersInh
eritedFromClasses(classB); | 7018 MemberMap mapB = _inheritanceManager.getMapOfMembersInheritedFromClasses(cla
ssB); |
| 6957 Map<String, ExecutableElement> mapA = _inheritanceManager.getMapOfMembersInh
eritedFromClasses(classA); | 7019 MemberMap mapA = _inheritanceManager.getMapOfMembersInheritedFromClasses(cla
ssA); |
| 6958 EngineTestCase.assertSize2(_numOfMembersInObject, mapA); | 7020 JUnitTestCase.assertEquals(_numOfMembersInObject, mapA.size); |
| 6959 EngineTestCase.assertSize2(_numOfMembersInObject, mapB); | 7021 JUnitTestCase.assertEquals(_numOfMembersInObject, mapB.size); |
| 6960 JUnitTestCase.assertNull(mapB[getterName]); | 7022 JUnitTestCase.assertNull(mapB.get(getterName)); |
| 6961 assertNoErrors(classA); | 7023 assertNoErrors(classA); |
| 6962 assertNoErrors(classB); | 7024 assertNoErrors(classB); |
| 6963 } | 7025 } |
| 6964 void test_getMapOfMembersInheritedFromClasses_accessor_with() { | 7026 void test_getMapOfMembersInheritedFromClasses_accessor_with() { |
| 6965 ClassElementImpl classA = ElementFactory.classElement2("A", []); | 7027 ClassElementImpl classA = ElementFactory.classElement2("A", []); |
| 6966 String getterName = "g"; | 7028 String getterName = "g"; |
| 6967 PropertyAccessorElement getterG = ElementFactory.getterElement(getterName, f
alse, _typeProvider.intType); | 7029 PropertyAccessorElement getterG = ElementFactory.getterElement(getterName, f
alse, _typeProvider.intType); |
| 6968 classA.accessors = <PropertyAccessorElement> [getterG]; | 7030 classA.accessors = <PropertyAccessorElement> [getterG]; |
| 6969 ClassElementImpl classB = ElementFactory.classElement2("B", []); | 7031 ClassElementImpl classB = ElementFactory.classElement2("B", []); |
| 6970 classB.mixins = <InterfaceType> [classA.type]; | 7032 classB.mixins = <InterfaceType> [classA.type]; |
| 6971 Map<String, ExecutableElement> mapB = _inheritanceManager.getMapOfMembersInh
eritedFromClasses(classB); | 7033 MemberMap mapB = _inheritanceManager.getMapOfMembersInheritedFromClasses(cla
ssB); |
| 6972 Map<String, ExecutableElement> mapA = _inheritanceManager.getMapOfMembersInh
eritedFromClasses(classA); | 7034 MemberMap mapA = _inheritanceManager.getMapOfMembersInheritedFromClasses(cla
ssA); |
| 6973 EngineTestCase.assertSize2(_numOfMembersInObject, mapA); | 7035 JUnitTestCase.assertEquals(_numOfMembersInObject, mapA.size); |
| 6974 EngineTestCase.assertSize2(_numOfMembersInObject + 1, mapB); | 7036 JUnitTestCase.assertEquals(_numOfMembersInObject + 1, mapB.size); |
| 6975 JUnitTestCase.assertSame(getterG, mapB[getterName]); | 7037 JUnitTestCase.assertSame(getterG, mapB.get(getterName)); |
| 6976 assertNoErrors(classA); | 7038 assertNoErrors(classA); |
| 6977 assertNoErrors(classB); | 7039 assertNoErrors(classB); |
| 6978 } | 7040 } |
| 6979 void test_getMapOfMembersInheritedFromClasses_method_extends() { | 7041 void test_getMapOfMembersInheritedFromClasses_method_extends() { |
| 6980 ClassElementImpl classA = ElementFactory.classElement2("A", []); | 7042 ClassElementImpl classA = ElementFactory.classElement2("A", []); |
| 6981 String methodName = "m"; | 7043 String methodName = "m"; |
| 6982 MethodElement methodM = ElementFactory.methodElement(methodName, _typeProvid
er.intType, []); | 7044 MethodElement methodM = ElementFactory.methodElement(methodName, _typeProvid
er.intType, []); |
| 6983 classA.methods = <MethodElement> [methodM]; | 7045 classA.methods = <MethodElement> [methodM]; |
| 6984 ClassElementImpl classB = ElementFactory.classElement2("B", []); | 7046 ClassElementImpl classB = ElementFactory.classElement2("B", []); |
| 6985 classB.supertype = classA.type; | 7047 classB.supertype = classA.type; |
| 6986 Map<String, ExecutableElement> mapB = _inheritanceManager.getMapOfMembersInh
eritedFromClasses(classB); | 7048 MemberMap mapB = _inheritanceManager.getMapOfMembersInheritedFromClasses(cla
ssB); |
| 6987 Map<String, ExecutableElement> mapA = _inheritanceManager.getMapOfMembersInh
eritedFromClasses(classA); | 7049 MemberMap mapA = _inheritanceManager.getMapOfMembersInheritedFromClasses(cla
ssA); |
| 6988 EngineTestCase.assertSize2(_numOfMembersInObject, mapA); | 7050 JUnitTestCase.assertEquals(_numOfMembersInObject, mapA.size); |
| 6989 EngineTestCase.assertSize2(_numOfMembersInObject + 1, mapB); | 7051 JUnitTestCase.assertEquals(_numOfMembersInObject + 1, mapB.size); |
| 6990 JUnitTestCase.assertSame(methodM, mapB[methodName]); | 7052 JUnitTestCase.assertSame(methodM, mapB.get(methodName)); |
| 6991 assertNoErrors(classA); | 7053 assertNoErrors(classA); |
| 6992 assertNoErrors(classB); | 7054 assertNoErrors(classB); |
| 6993 } | 7055 } |
| 6994 void test_getMapOfMembersInheritedFromClasses_method_implements() { | 7056 void test_getMapOfMembersInheritedFromClasses_method_implements() { |
| 6995 ClassElementImpl classA = ElementFactory.classElement2("A", []); | 7057 ClassElementImpl classA = ElementFactory.classElement2("A", []); |
| 6996 String methodName = "m"; | 7058 String methodName = "m"; |
| 6997 MethodElement methodM = ElementFactory.methodElement(methodName, _typeProvid
er.intType, []); | 7059 MethodElement methodM = ElementFactory.methodElement(methodName, _typeProvid
er.intType, []); |
| 6998 classA.methods = <MethodElement> [methodM]; | 7060 classA.methods = <MethodElement> [methodM]; |
| 6999 ClassElementImpl classB = ElementFactory.classElement2("B", []); | 7061 ClassElementImpl classB = ElementFactory.classElement2("B", []); |
| 7000 classB.interfaces = <InterfaceType> [classA.type]; | 7062 classB.interfaces = <InterfaceType> [classA.type]; |
| 7001 Map<String, ExecutableElement> mapB = _inheritanceManager.getMapOfMembersInh
eritedFromClasses(classB); | 7063 MemberMap mapB = _inheritanceManager.getMapOfMembersInheritedFromClasses(cla
ssB); |
| 7002 Map<String, ExecutableElement> mapA = _inheritanceManager.getMapOfMembersInh
eritedFromClasses(classA); | 7064 MemberMap mapA = _inheritanceManager.getMapOfMembersInheritedFromClasses(cla
ssA); |
| 7003 EngineTestCase.assertSize2(_numOfMembersInObject, mapA); | 7065 JUnitTestCase.assertEquals(_numOfMembersInObject, mapA.size); |
| 7004 EngineTestCase.assertSize2(_numOfMembersInObject, mapB); | 7066 JUnitTestCase.assertEquals(_numOfMembersInObject, mapB.size); |
| 7005 JUnitTestCase.assertNull(mapB[methodName]); | 7067 JUnitTestCase.assertNull(mapB.get(methodName)); |
| 7006 assertNoErrors(classA); | 7068 assertNoErrors(classA); |
| 7007 assertNoErrors(classB); | 7069 assertNoErrors(classB); |
| 7008 } | 7070 } |
| 7009 void test_getMapOfMembersInheritedFromClasses_method_with() { | 7071 void test_getMapOfMembersInheritedFromClasses_method_with() { |
| 7010 ClassElementImpl classA = ElementFactory.classElement2("A", []); | 7072 ClassElementImpl classA = ElementFactory.classElement2("A", []); |
| 7011 String methodName = "m"; | 7073 String methodName = "m"; |
| 7012 MethodElement methodM = ElementFactory.methodElement(methodName, _typeProvid
er.intType, []); | 7074 MethodElement methodM = ElementFactory.methodElement(methodName, _typeProvid
er.intType, []); |
| 7013 classA.methods = <MethodElement> [methodM]; | 7075 classA.methods = <MethodElement> [methodM]; |
| 7014 ClassElementImpl classB = ElementFactory.classElement2("B", []); | 7076 ClassElementImpl classB = ElementFactory.classElement2("B", []); |
| 7015 classB.mixins = <InterfaceType> [classA.type]; | 7077 classB.mixins = <InterfaceType> [classA.type]; |
| 7016 Map<String, ExecutableElement> mapB = _inheritanceManager.getMapOfMembersInh
eritedFromClasses(classB); | 7078 MemberMap mapB = _inheritanceManager.getMapOfMembersInheritedFromClasses(cla
ssB); |
| 7017 Map<String, ExecutableElement> mapA = _inheritanceManager.getMapOfMembersInh
eritedFromClasses(classA); | 7079 MemberMap mapA = _inheritanceManager.getMapOfMembersInheritedFromClasses(cla
ssA); |
| 7018 EngineTestCase.assertSize2(_numOfMembersInObject, mapA); | 7080 JUnitTestCase.assertEquals(_numOfMembersInObject, mapA.size); |
| 7019 EngineTestCase.assertSize2(_numOfMembersInObject + 1, mapB); | 7081 JUnitTestCase.assertEquals(_numOfMembersInObject + 1, mapB.size); |
| 7020 JUnitTestCase.assertSame(methodM, mapB[methodName]); | 7082 JUnitTestCase.assertSame(methodM, mapB.get(methodName)); |
| 7021 assertNoErrors(classA); | 7083 assertNoErrors(classA); |
| 7022 assertNoErrors(classB); | 7084 assertNoErrors(classB); |
| 7023 } | 7085 } |
| 7024 void test_getMapOfMembersInheritedFromInterfaces_accessor_extends() { | 7086 void test_getMapOfMembersInheritedFromInterfaces_accessor_extends() { |
| 7025 ClassElementImpl classA = ElementFactory.classElement2("A", []); | 7087 ClassElementImpl classA = ElementFactory.classElement2("A", []); |
| 7026 String getterName = "g"; | 7088 String getterName = "g"; |
| 7027 PropertyAccessorElement getterG = ElementFactory.getterElement(getterName, f
alse, _typeProvider.intType); | 7089 PropertyAccessorElement getterG = ElementFactory.getterElement(getterName, f
alse, _typeProvider.intType); |
| 7028 classA.accessors = <PropertyAccessorElement> [getterG]; | 7090 classA.accessors = <PropertyAccessorElement> [getterG]; |
| 7029 ClassElementImpl classB = ElementFactory.classElement("B", classA.type, []); | 7091 ClassElementImpl classB = ElementFactory.classElement("B", classA.type, []); |
| 7030 Map<String, ExecutableElement> mapB = _inheritanceManager.getMapOfMembersInh
eritedFromInterfaces(classB); | 7092 MemberMap mapB = _inheritanceManager.getMapOfMembersInheritedFromInterfaces(
classB); |
| 7031 Map<String, ExecutableElement> mapA = _inheritanceManager.getMapOfMembersInh
eritedFromInterfaces(classA); | 7093 MemberMap mapA = _inheritanceManager.getMapOfMembersInheritedFromInterfaces(
classA); |
| 7032 EngineTestCase.assertSize2(_numOfMembersInObject, mapA); | 7094 JUnitTestCase.assertEquals(_numOfMembersInObject, mapA.size); |
| 7033 EngineTestCase.assertSize2(_numOfMembersInObject + 1, mapB); | 7095 JUnitTestCase.assertEquals(_numOfMembersInObject + 1, mapB.size); |
| 7034 JUnitTestCase.assertSame(getterG, mapB[getterName]); | 7096 JUnitTestCase.assertSame(getterG, mapB.get(getterName)); |
| 7035 assertNoErrors(classA); | 7097 assertNoErrors(classA); |
| 7036 assertNoErrors(classB); | 7098 assertNoErrors(classB); |
| 7037 } | 7099 } |
| 7038 void test_getMapOfMembersInheritedFromInterfaces_accessor_implements() { | 7100 void test_getMapOfMembersInheritedFromInterfaces_accessor_implements() { |
| 7039 ClassElementImpl classA = ElementFactory.classElement2("A", []); | 7101 ClassElementImpl classA = ElementFactory.classElement2("A", []); |
| 7040 String getterName = "g"; | 7102 String getterName = "g"; |
| 7041 PropertyAccessorElement getterG = ElementFactory.getterElement(getterName, f
alse, _typeProvider.intType); | 7103 PropertyAccessorElement getterG = ElementFactory.getterElement(getterName, f
alse, _typeProvider.intType); |
| 7042 classA.accessors = <PropertyAccessorElement> [getterG]; | 7104 classA.accessors = <PropertyAccessorElement> [getterG]; |
| 7043 ClassElementImpl classB = ElementFactory.classElement2("B", []); | 7105 ClassElementImpl classB = ElementFactory.classElement2("B", []); |
| 7044 classB.interfaces = <InterfaceType> [classA.type]; | 7106 classB.interfaces = <InterfaceType> [classA.type]; |
| 7045 Map<String, ExecutableElement> mapB = _inheritanceManager.getMapOfMembersInh
eritedFromInterfaces(classB); | 7107 MemberMap mapB = _inheritanceManager.getMapOfMembersInheritedFromInterfaces(
classB); |
| 7046 Map<String, ExecutableElement> mapA = _inheritanceManager.getMapOfMembersInh
eritedFromInterfaces(classA); | 7108 MemberMap mapA = _inheritanceManager.getMapOfMembersInheritedFromInterfaces(
classA); |
| 7047 EngineTestCase.assertSize2(_numOfMembersInObject, mapA); | 7109 JUnitTestCase.assertEquals(_numOfMembersInObject, mapA.size); |
| 7048 EngineTestCase.assertSize2(_numOfMembersInObject + 1, mapB); | 7110 JUnitTestCase.assertEquals(_numOfMembersInObject + 1, mapB.size); |
| 7049 JUnitTestCase.assertSame(getterG, mapB[getterName]); | 7111 JUnitTestCase.assertSame(getterG, mapB.get(getterName)); |
| 7050 assertNoErrors(classA); | 7112 assertNoErrors(classA); |
| 7051 assertNoErrors(classB); | 7113 assertNoErrors(classB); |
| 7052 } | 7114 } |
| 7053 void test_getMapOfMembersInheritedFromInterfaces_accessor_with() { | 7115 void test_getMapOfMembersInheritedFromInterfaces_accessor_with() { |
| 7054 ClassElementImpl classA = ElementFactory.classElement2("A", []); | 7116 ClassElementImpl classA = ElementFactory.classElement2("A", []); |
| 7055 String getterName = "g"; | 7117 String getterName = "g"; |
| 7056 PropertyAccessorElement getterG = ElementFactory.getterElement(getterName, f
alse, _typeProvider.intType); | 7118 PropertyAccessorElement getterG = ElementFactory.getterElement(getterName, f
alse, _typeProvider.intType); |
| 7057 classA.accessors = <PropertyAccessorElement> [getterG]; | 7119 classA.accessors = <PropertyAccessorElement> [getterG]; |
| 7058 ClassElementImpl classB = ElementFactory.classElement2("B", []); | 7120 ClassElementImpl classB = ElementFactory.classElement2("B", []); |
| 7059 classB.mixins = <InterfaceType> [classA.type]; | 7121 classB.mixins = <InterfaceType> [classA.type]; |
| 7060 Map<String, ExecutableElement> mapB = _inheritanceManager.getMapOfMembersInh
eritedFromInterfaces(classB); | 7122 MemberMap mapB = _inheritanceManager.getMapOfMembersInheritedFromInterfaces(
classB); |
| 7061 Map<String, ExecutableElement> mapA = _inheritanceManager.getMapOfMembersInh
eritedFromInterfaces(classA); | 7123 MemberMap mapA = _inheritanceManager.getMapOfMembersInheritedFromInterfaces(
classA); |
| 7062 EngineTestCase.assertSize2(_numOfMembersInObject, mapA); | 7124 JUnitTestCase.assertEquals(_numOfMembersInObject, mapA.size); |
| 7063 EngineTestCase.assertSize2(_numOfMembersInObject + 1, mapB); | 7125 JUnitTestCase.assertEquals(_numOfMembersInObject + 1, mapB.size); |
| 7064 JUnitTestCase.assertSame(getterG, mapB[getterName]); | 7126 JUnitTestCase.assertSame(getterG, mapB.get(getterName)); |
| 7065 assertNoErrors(classA); | 7127 assertNoErrors(classA); |
| 7066 assertNoErrors(classB); | 7128 assertNoErrors(classB); |
| 7067 } | 7129 } |
| 7068 void test_getMapOfMembersInheritedFromInterfaces_method_extends() { | 7130 void test_getMapOfMembersInheritedFromInterfaces_method_extends() { |
| 7069 ClassElementImpl classA = ElementFactory.classElement2("A", []); | 7131 ClassElementImpl classA = ElementFactory.classElement2("A", []); |
| 7070 String methodName = "m"; | 7132 String methodName = "m"; |
| 7071 MethodElement methodM = ElementFactory.methodElement(methodName, _typeProvid
er.intType, []); | 7133 MethodElement methodM = ElementFactory.methodElement(methodName, _typeProvid
er.intType, []); |
| 7072 classA.methods = <MethodElement> [methodM]; | 7134 classA.methods = <MethodElement> [methodM]; |
| 7073 ClassElementImpl classB = ElementFactory.classElement("B", classA.type, []); | 7135 ClassElementImpl classB = ElementFactory.classElement("B", classA.type, []); |
| 7074 Map<String, ExecutableElement> mapB = _inheritanceManager.getMapOfMembersInh
eritedFromInterfaces(classB); | 7136 MemberMap mapB = _inheritanceManager.getMapOfMembersInheritedFromInterfaces(
classB); |
| 7075 Map<String, ExecutableElement> mapA = _inheritanceManager.getMapOfMembersInh
eritedFromInterfaces(classA); | 7137 MemberMap mapA = _inheritanceManager.getMapOfMembersInheritedFromInterfaces(
classA); |
| 7076 EngineTestCase.assertSize2(_numOfMembersInObject, mapA); | 7138 JUnitTestCase.assertEquals(_numOfMembersInObject, mapA.size); |
| 7077 EngineTestCase.assertSize2(_numOfMembersInObject + 1, mapB); | 7139 JUnitTestCase.assertEquals(_numOfMembersInObject + 1, mapB.size); |
| 7078 JUnitTestCase.assertSame(methodM, mapB[methodName]); | 7140 JUnitTestCase.assertSame(methodM, mapB.get(methodName)); |
| 7079 assertNoErrors(classA); | 7141 assertNoErrors(classA); |
| 7080 assertNoErrors(classB); | 7142 assertNoErrors(classB); |
| 7081 } | 7143 } |
| 7082 void test_getMapOfMembersInheritedFromInterfaces_method_implements() { | 7144 void test_getMapOfMembersInheritedFromInterfaces_method_implements() { |
| 7083 ClassElementImpl classA = ElementFactory.classElement2("A", []); | 7145 ClassElementImpl classA = ElementFactory.classElement2("A", []); |
| 7084 String methodName = "m"; | 7146 String methodName = "m"; |
| 7085 MethodElement methodM = ElementFactory.methodElement(methodName, _typeProvid
er.intType, []); | 7147 MethodElement methodM = ElementFactory.methodElement(methodName, _typeProvid
er.intType, []); |
| 7086 classA.methods = <MethodElement> [methodM]; | 7148 classA.methods = <MethodElement> [methodM]; |
| 7087 ClassElementImpl classB = ElementFactory.classElement2("B", []); | 7149 ClassElementImpl classB = ElementFactory.classElement2("B", []); |
| 7088 classB.interfaces = <InterfaceType> [classA.type]; | 7150 classB.interfaces = <InterfaceType> [classA.type]; |
| 7089 Map<String, ExecutableElement> mapB = _inheritanceManager.getMapOfMembersInh
eritedFromInterfaces(classB); | 7151 MemberMap mapB = _inheritanceManager.getMapOfMembersInheritedFromInterfaces(
classB); |
| 7090 Map<String, ExecutableElement> mapA = _inheritanceManager.getMapOfMembersInh
eritedFromInterfaces(classA); | 7152 MemberMap mapA = _inheritanceManager.getMapOfMembersInheritedFromInterfaces(
classA); |
| 7091 EngineTestCase.assertSize2(_numOfMembersInObject, mapA); | 7153 JUnitTestCase.assertEquals(_numOfMembersInObject, mapA.size); |
| 7092 EngineTestCase.assertSize2(_numOfMembersInObject + 1, mapB); | 7154 JUnitTestCase.assertEquals(_numOfMembersInObject + 1, mapB.size); |
| 7093 JUnitTestCase.assertSame(methodM, mapB[methodName]); | 7155 JUnitTestCase.assertSame(methodM, mapB.get(methodName)); |
| 7094 assertNoErrors(classA); | 7156 assertNoErrors(classA); |
| 7095 assertNoErrors(classB); | 7157 assertNoErrors(classB); |
| 7096 } | 7158 } |
| 7097 void test_getMapOfMembersInheritedFromInterfaces_method_with() { | 7159 void test_getMapOfMembersInheritedFromInterfaces_method_with() { |
| 7098 ClassElementImpl classA = ElementFactory.classElement2("A", []); | 7160 ClassElementImpl classA = ElementFactory.classElement2("A", []); |
| 7099 String methodName = "m"; | 7161 String methodName = "m"; |
| 7100 MethodElement methodM = ElementFactory.methodElement(methodName, _typeProvid
er.intType, []); | 7162 MethodElement methodM = ElementFactory.methodElement(methodName, _typeProvid
er.intType, []); |
| 7101 classA.methods = <MethodElement> [methodM]; | 7163 classA.methods = <MethodElement> [methodM]; |
| 7102 ClassElementImpl classB = ElementFactory.classElement2("B", []); | 7164 ClassElementImpl classB = ElementFactory.classElement2("B", []); |
| 7103 classB.mixins = <InterfaceType> [classA.type]; | 7165 classB.mixins = <InterfaceType> [classA.type]; |
| 7104 Map<String, ExecutableElement> mapB = _inheritanceManager.getMapOfMembersInh
eritedFromInterfaces(classB); | 7166 MemberMap mapB = _inheritanceManager.getMapOfMembersInheritedFromInterfaces(
classB); |
| 7105 Map<String, ExecutableElement> mapA = _inheritanceManager.getMapOfMembersInh
eritedFromInterfaces(classA); | 7167 MemberMap mapA = _inheritanceManager.getMapOfMembersInheritedFromInterfaces(
classA); |
| 7106 EngineTestCase.assertSize2(_numOfMembersInObject, mapA); | 7168 JUnitTestCase.assertEquals(_numOfMembersInObject, mapA.size); |
| 7107 EngineTestCase.assertSize2(_numOfMembersInObject + 1, mapB); | 7169 JUnitTestCase.assertEquals(_numOfMembersInObject + 1, mapB.size); |
| 7108 JUnitTestCase.assertSame(methodM, mapB[methodName]); | 7170 JUnitTestCase.assertSame(methodM, mapB.get(methodName)); |
| 7109 assertNoErrors(classA); | 7171 assertNoErrors(classA); |
| 7110 assertNoErrors(classB); | 7172 assertNoErrors(classB); |
| 7111 } | 7173 } |
| 7112 void test_lookupInheritance_interface_getter() { | 7174 void test_lookupInheritance_interface_getter() { |
| 7113 ClassElementImpl classA = ElementFactory.classElement2("A", []); | 7175 ClassElementImpl classA = ElementFactory.classElement2("A", []); |
| 7114 String getterName = "g"; | 7176 String getterName = "g"; |
| 7115 PropertyAccessorElement getterG = ElementFactory.getterElement(getterName, f
alse, _typeProvider.intType); | 7177 PropertyAccessorElement getterG = ElementFactory.getterElement(getterName, f
alse, _typeProvider.intType); |
| 7116 classA.accessors = <PropertyAccessorElement> [getterG]; | 7178 classA.accessors = <PropertyAccessorElement> [getterG]; |
| 7117 ClassElementImpl classB = ElementFactory.classElement2("B", []); | 7179 ClassElementImpl classB = ElementFactory.classElement2("B", []); |
| 7118 classB.interfaces = <InterfaceType> [classA.type]; | 7180 classB.interfaces = <InterfaceType> [classA.type]; |
| (...skipping 553 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 7672 CompileTimeErrorCode.UNDEFINED_FUNCTION]); | 7734 CompileTimeErrorCode.UNDEFINED_FUNCTION]); |
| 7673 } | 7735 } |
| 7674 void test_argumentDefinitionTestNonParameter() { | 7736 void test_argumentDefinitionTestNonParameter() { |
| 7675 Source source = addSource(EngineTestCase.createSource(["f() {", " var v = 0;
", " return ?v;", "}"])); | 7737 Source source = addSource(EngineTestCase.createSource(["f() {", " var v = 0;
", " return ?v;", "}"])); |
| 7676 resolve(source); | 7738 resolve(source); |
| 7677 assertErrors(source, [ | 7739 assertErrors(source, [ |
| 7678 ParserErrorCode.DEPRECATED_ARGUMENT_DEFINITION_TEST, | 7740 ParserErrorCode.DEPRECATED_ARGUMENT_DEFINITION_TEST, |
| 7679 CompileTimeErrorCode.ARGUMENT_DEFINITION_TEST_NON_PARAMETER]); | 7741 CompileTimeErrorCode.ARGUMENT_DEFINITION_TEST_NON_PARAMETER]); |
| 7680 verify([source]); | 7742 verify([source]); |
| 7681 } | 7743 } |
| 7682 void test_argumentTypeNotAssignable_const() { | 7744 void test_builtInIdentifierAsType_formalParameter_field() { |
| 7683 Source source = addSource(EngineTestCase.createSource([ | 7745 Source source = addSource(EngineTestCase.createSource(["class A {", " var x
;", " A(static this.x);", "}"])); |
| 7684 "class A {", | |
| 7685 " const A(String p);", | |
| 7686 "}", | |
| 7687 "main() {", | |
| 7688 " const A(42);", | |
| 7689 "}"])); | |
| 7690 resolve(source); | 7746 resolve(source); |
| 7691 assertErrors(source, [CompileTimeErrorCode.ARGUMENT_TYPE_NOT_ASSIGNABLE]); | 7747 assertErrors(source, [CompileTimeErrorCode.BUILT_IN_IDENTIFIER_AS_TYPE]); |
| 7692 verify([source]); | 7748 verify([source]); |
| 7693 } | 7749 } |
| 7694 void test_argumentTypeNotAssignable_const_super() { | 7750 void test_builtInIdentifierAsType_formalParameter_simple() { |
| 7695 Source source = addSource(EngineTestCase.createSource([ | 7751 Source source = addSource(EngineTestCase.createSource(["f(static x) {", "}"]
)); |
| 7696 "class A {", | |
| 7697 " const A(String p);", | |
| 7698 "}", | |
| 7699 "class B extends A {", | |
| 7700 " const B() : super(42);", | |
| 7701 "}"])); | |
| 7702 resolve(source); | 7752 resolve(source); |
| 7703 assertErrors(source, [CompileTimeErrorCode.ARGUMENT_TYPE_NOT_ASSIGNABLE]); | 7753 assertErrors(source, [CompileTimeErrorCode.BUILT_IN_IDENTIFIER_AS_TYPE]); |
| 7704 verify([source]); | 7754 verify([source]); |
| 7705 } | 7755 } |
| 7706 void test_builtInIdentifierAsType() { | 7756 void test_builtInIdentifierAsType_variableDeclaration() { |
| 7707 Source source = addSource(EngineTestCase.createSource(["f() {", " typedef x
;", "}"])); | 7757 Source source = addSource(EngineTestCase.createSource(["f() {", " typedef x
;", "}"])); |
| 7708 resolve(source); | 7758 resolve(source); |
| 7709 assertErrors(source, [ | 7759 assertErrors(source, [CompileTimeErrorCode.BUILT_IN_IDENTIFIER_AS_TYPE]); |
| 7710 CompileTimeErrorCode.BUILT_IN_IDENTIFIER_AS_TYPE, | |
| 7711 StaticWarningCode.UNDEFINED_CLASS]); | |
| 7712 verify([source]); | 7760 verify([source]); |
| 7713 } | 7761 } |
| 7714 void test_builtInIdentifierAsTypedefName_classTypeAlias() { | 7762 void test_builtInIdentifierAsTypedefName_classTypeAlias() { |
| 7715 Source source = addSource(EngineTestCase.createSource(["class A {}", "class
B {}", "typedef as = A with B;"])); | 7763 Source source = addSource(EngineTestCase.createSource(["class A {}", "class
B {}", "typedef as = A with B;"])); |
| 7716 resolve(source); | 7764 resolve(source); |
| 7717 assertErrors(source, [CompileTimeErrorCode.BUILT_IN_IDENTIFIER_AS_TYPEDEF_NA
ME]); | 7765 assertErrors(source, [CompileTimeErrorCode.BUILT_IN_IDENTIFIER_AS_TYPEDEF_NA
ME]); |
| 7718 verify([source]); | 7766 verify([source]); |
| 7719 } | 7767 } |
| 7720 void test_builtInIdentifierAsTypedefName_functionTypeAlias() { | 7768 void test_builtInIdentifierAsTypedefName_functionTypeAlias() { |
| 7721 Source source = addSource(EngineTestCase.createSource(["typedef bool as();"]
)); | 7769 Source source = addSource(EngineTestCase.createSource(["typedef bool as();"]
)); |
| (...skipping 178 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 7900 } | 7948 } |
| 7901 void test_constEvalThrowsException_divisionByZero() { | 7949 void test_constEvalThrowsException_divisionByZero() { |
| 7902 Source source = addSource("const C = 1 ~/ 0;"); | 7950 Source source = addSource("const C = 1 ~/ 0;"); |
| 7903 resolve(source); | 7951 resolve(source); |
| 7904 assertErrors(source, [CompileTimeErrorCode.CONST_EVAL_THROWS_IDBZE]); | 7952 assertErrors(source, [CompileTimeErrorCode.CONST_EVAL_THROWS_IDBZE]); |
| 7905 verify([source]); | 7953 verify([source]); |
| 7906 } | 7954 } |
| 7907 void test_constEvalThrowsException_unaryBitNot_null() { | 7955 void test_constEvalThrowsException_unaryBitNot_null() { |
| 7908 Source source = addSource("const C = ~null;"); | 7956 Source source = addSource("const C = ~null;"); |
| 7909 resolve(source); | 7957 resolve(source); |
| 7910 assertErrors(source, [ | 7958 assertErrors(source, [CompileTimeErrorCode.CONST_EVAL_THROWS_EXCEPTION]); |
| 7911 CompileTimeErrorCode.CONST_EVAL_THROWS_EXCEPTION, | |
| 7912 StaticTypeWarningCode.UNDEFINED_OPERATOR]); | |
| 7913 } | 7959 } |
| 7914 void test_constEvalThrowsException_unaryNegated_null() { | 7960 void test_constEvalThrowsException_unaryNegated_null() { |
| 7915 Source source = addSource("const C = -null;"); | 7961 Source source = addSource("const C = -null;"); |
| 7916 resolve(source); | 7962 resolve(source); |
| 7917 assertErrors(source, [ | 7963 assertErrors(source, [CompileTimeErrorCode.CONST_EVAL_THROWS_EXCEPTION]); |
| 7918 CompileTimeErrorCode.CONST_EVAL_THROWS_EXCEPTION, | |
| 7919 StaticTypeWarningCode.UNDEFINED_OPERATOR]); | |
| 7920 } | 7964 } |
| 7921 void test_constEvalThrowsException_unaryNot_null() { | 7965 void test_constEvalThrowsException_unaryNot_null() { |
| 7922 Source source = addSource("const C = !null;"); | 7966 Source source = addSource("const C = !null;"); |
| 7923 resolve(source); | 7967 resolve(source); |
| 7924 assertErrors(source, [CompileTimeErrorCode.CONST_EVAL_THROWS_EXCEPTION]); | 7968 assertErrors(source, [CompileTimeErrorCode.CONST_EVAL_THROWS_EXCEPTION]); |
| 7925 verify([source]); | 7969 verify([source]); |
| 7926 } | 7970 } |
| 7927 void test_constEvalTypeBool_binary() { | 7971 void test_constEvalTypeBool_binary() { |
| 7928 check_constEvalTypeBool_withParameter_binary("p && ''"); | 7972 check_constEvalTypeBool_withParameter_binary("p && ''"); |
| 7929 check_constEvalTypeBool_withParameter_binary("p || ''"); | 7973 check_constEvalTypeBool_withParameter_binary("p || ''"); |
| (...skipping 1498 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 9428 } | 9472 } |
| 9429 void test_nonConstValueInInitializer_binary_notInt() { | 9473 void test_nonConstValueInInitializer_binary_notInt() { |
| 9430 Source source = addSource(EngineTestCase.createSource([ | 9474 Source source = addSource(EngineTestCase.createSource([ |
| 9431 "class A {", | 9475 "class A {", |
| 9432 " final int a;", | 9476 " final int a;", |
| 9433 " const A(String p) : a = 5 & p;", | 9477 " const A(String p) : a = 5 & p;", |
| 9434 "}"])); | 9478 "}"])); |
| 9435 resolve(source); | 9479 resolve(source); |
| 9436 assertErrors(source, [ | 9480 assertErrors(source, [ |
| 9437 CompileTimeErrorCode.CONST_EVAL_TYPE_INT, | 9481 CompileTimeErrorCode.CONST_EVAL_TYPE_INT, |
| 9438 CompileTimeErrorCode.ARGUMENT_TYPE_NOT_ASSIGNABLE]); | 9482 StaticWarningCode.ARGUMENT_TYPE_NOT_ASSIGNABLE]); |
| 9439 verify([source]); | 9483 verify([source]); |
| 9440 } | 9484 } |
| 9441 void test_nonConstValueInInitializer_binary_notNum() { | 9485 void test_nonConstValueInInitializer_binary_notNum() { |
| 9442 Source source = addSource(EngineTestCase.createSource([ | 9486 Source source = addSource(EngineTestCase.createSource([ |
| 9443 "class A {", | 9487 "class A {", |
| 9444 " final int a;", | 9488 " final int a;", |
| 9445 " const A(String p) : a = 5 + p;", | 9489 " const A(String p) : a = 5 + p;", |
| 9446 "}"])); | 9490 "}"])); |
| 9447 resolve(source); | 9491 resolve(source); |
| 9448 assertErrors(source, [ | 9492 assertErrors(source, [ |
| 9449 CompileTimeErrorCode.CONST_EVAL_TYPE_NUM, | 9493 CompileTimeErrorCode.CONST_EVAL_TYPE_NUM, |
| 9450 CompileTimeErrorCode.ARGUMENT_TYPE_NOT_ASSIGNABLE]); | 9494 StaticWarningCode.ARGUMENT_TYPE_NOT_ASSIGNABLE]); |
| 9451 verify([source]); | 9495 verify([source]); |
| 9452 } | 9496 } |
| 9453 void test_nonConstValueInInitializer_field() { | 9497 void test_nonConstValueInInitializer_field() { |
| 9454 Source source = addSource(EngineTestCase.createSource([ | 9498 Source source = addSource(EngineTestCase.createSource([ |
| 9455 "class A {", | 9499 "class A {", |
| 9456 " static int C;", | 9500 " static int C;", |
| 9457 " final int a;", | 9501 " final int a;", |
| 9458 " const A() : a = C;", | 9502 " const A() : a = C;", |
| 9459 "}"])); | 9503 "}"])); |
| 9460 resolve(source); | 9504 resolve(source); |
| (...skipping 735 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 10196 assertErrors(source, [CompileTimeErrorCode.WRONG_NUMBER_OF_PARAMETERS_FOR_SE
TTER]); | 10240 assertErrors(source, [CompileTimeErrorCode.WRONG_NUMBER_OF_PARAMETERS_FOR_SE
TTER]); |
| 10197 verify([source]); | 10241 verify([source]); |
| 10198 } | 10242 } |
| 10199 void check_constEvalThrowsException_binary_null(String expr, bool resolved) { | 10243 void check_constEvalThrowsException_binary_null(String expr, bool resolved) { |
| 10200 Source source = addSource("const C = ${expr};"); | 10244 Source source = addSource("const C = ${expr};"); |
| 10201 resolve(source); | 10245 resolve(source); |
| 10202 if (resolved) { | 10246 if (resolved) { |
| 10203 assertErrors(source, [CompileTimeErrorCode.CONST_EVAL_THROWS_EXCEPTION]); | 10247 assertErrors(source, [CompileTimeErrorCode.CONST_EVAL_THROWS_EXCEPTION]); |
| 10204 verify([source]); | 10248 verify([source]); |
| 10205 } else { | 10249 } else { |
| 10206 assertErrors(source, [ | 10250 assertErrors(source, [CompileTimeErrorCode.CONST_EVAL_THROWS_EXCEPTION]); |
| 10207 CompileTimeErrorCode.CONST_EVAL_THROWS_EXCEPTION, | |
| 10208 StaticTypeWarningCode.UNDEFINED_OPERATOR]); | |
| 10209 } | 10251 } |
| 10210 reset(); | 10252 reset(); |
| 10211 } | 10253 } |
| 10212 void check_constEvalTypeBool_withParameter_binary(String expr) { | 10254 void check_constEvalTypeBool_withParameter_binary(String expr) { |
| 10213 Source source = addSource(EngineTestCase.createSource([ | 10255 Source source = addSource(EngineTestCase.createSource([ |
| 10214 "class A {", | 10256 "class A {", |
| 10215 " final a;", | 10257 " final a;", |
| 10216 " const A(bool p) : a = ${expr};", | 10258 " const A(bool p) : a = ${expr};", |
| 10217 "}"])); | 10259 "}"])); |
| 10218 resolve(source); | 10260 resolve(source); |
| 10219 assertErrors(source, [CompileTimeErrorCode.CONST_EVAL_TYPE_BOOL]); | 10261 assertErrors(source, [CompileTimeErrorCode.CONST_EVAL_TYPE_BOOL]); |
| 10220 verify([source]); | 10262 verify([source]); |
| 10221 reset(); | 10263 reset(); |
| 10222 } | 10264 } |
| 10223 void check_constEvalTypeInt_withParameter_binary(String expr) { | 10265 void check_constEvalTypeInt_withParameter_binary(String expr) { |
| 10224 Source source = addSource(EngineTestCase.createSource([ | 10266 Source source = addSource(EngineTestCase.createSource([ |
| 10225 "class A {", | 10267 "class A {", |
| 10226 " final a;", | 10268 " final a;", |
| 10227 " const A(int p) : a = ${expr};", | 10269 " const A(int p) : a = ${expr};", |
| 10228 "}"])); | 10270 "}"])); |
| 10229 resolve(source); | 10271 resolve(source); |
| 10230 assertErrors(source, [ | 10272 assertErrors(source, [ |
| 10231 CompileTimeErrorCode.CONST_EVAL_TYPE_INT, | 10273 CompileTimeErrorCode.CONST_EVAL_TYPE_INT, |
| 10232 CompileTimeErrorCode.ARGUMENT_TYPE_NOT_ASSIGNABLE]); | 10274 StaticWarningCode.ARGUMENT_TYPE_NOT_ASSIGNABLE]); |
| 10233 verify([source]); | 10275 verify([source]); |
| 10234 reset(); | 10276 reset(); |
| 10235 } | 10277 } |
| 10236 void check_constEvalTypeNum_withParameter_binary(String expr) { | 10278 void check_constEvalTypeNum_withParameter_binary(String expr) { |
| 10237 Source source = addSource(EngineTestCase.createSource([ | 10279 Source source = addSource(EngineTestCase.createSource([ |
| 10238 "class A {", | 10280 "class A {", |
| 10239 " final a;", | 10281 " final a;", |
| 10240 " const A(num p) : a = ${expr};", | 10282 " const A(num p) : a = ${expr};", |
| 10241 "}"])); | 10283 "}"])); |
| 10242 resolve(source); | 10284 resolve(source); |
| 10243 assertErrors(source, [ | 10285 assertErrors(source, [ |
| 10244 CompileTimeErrorCode.CONST_EVAL_TYPE_NUM, | 10286 CompileTimeErrorCode.CONST_EVAL_TYPE_NUM, |
| 10245 CompileTimeErrorCode.ARGUMENT_TYPE_NOT_ASSIGNABLE]); | 10287 StaticWarningCode.ARGUMENT_TYPE_NOT_ASSIGNABLE]); |
| 10246 verify([source]); | 10288 verify([source]); |
| 10247 reset(); | 10289 reset(); |
| 10248 } | 10290 } |
| 10249 void check_wrongNumberOfParametersForOperator(String name, String parameters)
{ | 10291 void check_wrongNumberOfParametersForOperator(String name, String parameters)
{ |
| 10250 Source source = addSource(EngineTestCase.createSource(["class A {", " opera
tor ${name}(${parameters}) {}", "}"])); | 10292 Source source = addSource(EngineTestCase.createSource(["class A {", " opera
tor ${name}(${parameters}) {}", "}"])); |
| 10251 resolve(source); | 10293 resolve(source); |
| 10252 assertErrors(source, [CompileTimeErrorCode.WRONG_NUMBER_OF_PARAMETERS_FOR_OP
ERATOR]); | 10294 assertErrors(source, [CompileTimeErrorCode.WRONG_NUMBER_OF_PARAMETERS_FOR_OP
ERATOR]); |
| 10253 verify([source]); | 10295 verify([source]); |
| 10254 reset(); | 10296 reset(); |
| 10255 } | 10297 } |
| 10256 void check_wrongNumberOfParametersForOperator1(String name) { | 10298 void check_wrongNumberOfParametersForOperator1(String name) { |
| 10257 check_wrongNumberOfParametersForOperator(name, ""); | 10299 check_wrongNumberOfParametersForOperator(name, ""); |
| 10258 check_wrongNumberOfParametersForOperator(name, "a, b"); | 10300 check_wrongNumberOfParametersForOperator(name, "a, b"); |
| 10259 } | 10301 } |
| 10260 static dartSuite() { | 10302 static dartSuite() { |
| 10261 _ut.group('CompileTimeErrorCodeTest', () { | 10303 _ut.group('CompileTimeErrorCodeTest', () { |
| 10262 _ut.test('test_ambiguousExport', () { | 10304 _ut.test('test_ambiguousExport', () { |
| 10263 final __test = new CompileTimeErrorCodeTest(); | 10305 final __test = new CompileTimeErrorCodeTest(); |
| 10264 runJUnitTest(__test, __test.test_ambiguousExport); | 10306 runJUnitTest(__test, __test.test_ambiguousExport); |
| 10265 }); | 10307 }); |
| 10266 _ut.test('test_ambiguousImport_function', () { | 10308 _ut.test('test_ambiguousImport_function', () { |
| 10267 final __test = new CompileTimeErrorCodeTest(); | 10309 final __test = new CompileTimeErrorCodeTest(); |
| 10268 runJUnitTest(__test, __test.test_ambiguousImport_function); | 10310 runJUnitTest(__test, __test.test_ambiguousImport_function); |
| 10269 }); | 10311 }); |
| 10270 _ut.test('test_argumentDefinitionTestNonParameter', () { | 10312 _ut.test('test_argumentDefinitionTestNonParameter', () { |
| 10271 final __test = new CompileTimeErrorCodeTest(); | 10313 final __test = new CompileTimeErrorCodeTest(); |
| 10272 runJUnitTest(__test, __test.test_argumentDefinitionTestNonParameter); | 10314 runJUnitTest(__test, __test.test_argumentDefinitionTestNonParameter); |
| 10273 }); | 10315 }); |
| 10274 _ut.test('test_argumentTypeNotAssignable_const', () { | |
| 10275 final __test = new CompileTimeErrorCodeTest(); | |
| 10276 runJUnitTest(__test, __test.test_argumentTypeNotAssignable_const); | |
| 10277 }); | |
| 10278 _ut.test('test_argumentTypeNotAssignable_const_super', () { | |
| 10279 final __test = new CompileTimeErrorCodeTest(); | |
| 10280 runJUnitTest(__test, __test.test_argumentTypeNotAssignable_const_super); | |
| 10281 }); | |
| 10282 _ut.test('test_builtInIdentifierAsType', () { | |
| 10283 final __test = new CompileTimeErrorCodeTest(); | |
| 10284 runJUnitTest(__test, __test.test_builtInIdentifierAsType); | |
| 10285 }); | |
| 10286 _ut.test('test_builtInIdentifierAsTypeName', () { | 10316 _ut.test('test_builtInIdentifierAsTypeName', () { |
| 10287 final __test = new CompileTimeErrorCodeTest(); | 10317 final __test = new CompileTimeErrorCodeTest(); |
| 10288 runJUnitTest(__test, __test.test_builtInIdentifierAsTypeName); | 10318 runJUnitTest(__test, __test.test_builtInIdentifierAsTypeName); |
| 10289 }); | 10319 }); |
| 10290 _ut.test('test_builtInIdentifierAsTypeParameterName', () { | 10320 _ut.test('test_builtInIdentifierAsTypeParameterName', () { |
| 10291 final __test = new CompileTimeErrorCodeTest(); | 10321 final __test = new CompileTimeErrorCodeTest(); |
| 10292 runJUnitTest(__test, __test.test_builtInIdentifierAsTypeParameterName); | 10322 runJUnitTest(__test, __test.test_builtInIdentifierAsTypeParameterName); |
| 10293 }); | 10323 }); |
| 10324 _ut.test('test_builtInIdentifierAsType_formalParameter_field', () { |
| 10325 final __test = new CompileTimeErrorCodeTest(); |
| 10326 runJUnitTest(__test, __test.test_builtInIdentifierAsType_formalParameter
_field); |
| 10327 }); |
| 10328 _ut.test('test_builtInIdentifierAsType_formalParameter_simple', () { |
| 10329 final __test = new CompileTimeErrorCodeTest(); |
| 10330 runJUnitTest(__test, __test.test_builtInIdentifierAsType_formalParameter
_simple); |
| 10331 }); |
| 10332 _ut.test('test_builtInIdentifierAsType_variableDeclaration', () { |
| 10333 final __test = new CompileTimeErrorCodeTest(); |
| 10334 runJUnitTest(__test, __test.test_builtInIdentifierAsType_variableDeclara
tion); |
| 10335 }); |
| 10294 _ut.test('test_builtInIdentifierAsTypedefName_classTypeAlias', () { | 10336 _ut.test('test_builtInIdentifierAsTypedefName_classTypeAlias', () { |
| 10295 final __test = new CompileTimeErrorCodeTest(); | 10337 final __test = new CompileTimeErrorCodeTest(); |
| 10296 runJUnitTest(__test, __test.test_builtInIdentifierAsTypedefName_classTyp
eAlias); | 10338 runJUnitTest(__test, __test.test_builtInIdentifierAsTypedefName_classTyp
eAlias); |
| 10297 }); | 10339 }); |
| 10298 _ut.test('test_builtInIdentifierAsTypedefName_functionTypeAlias', () { | 10340 _ut.test('test_builtInIdentifierAsTypedefName_functionTypeAlias', () { |
| 10299 final __test = new CompileTimeErrorCodeTest(); | 10341 final __test = new CompileTimeErrorCodeTest(); |
| 10300 runJUnitTest(__test, __test.test_builtInIdentifierAsTypedefName_function
TypeAlias); | 10342 runJUnitTest(__test, __test.test_builtInIdentifierAsTypedefName_function
TypeAlias); |
| 10301 }); | 10343 }); |
| 10302 _ut.test('test_caseExpressionTypeImplementsEquals', () { | 10344 _ut.test('test_caseExpressionTypeImplementsEquals', () { |
| 10303 final __test = new CompileTimeErrorCodeTest(); | 10345 final __test = new CompileTimeErrorCodeTest(); |
| (...skipping 1966 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 12270 FileBasedSource source = new FileBasedSource.con1(contentCache, FileUtilitie
s2.createFile("/test.dart")); | 12312 FileBasedSource source = new FileBasedSource.con1(contentCache, FileUtilitie
s2.createFile("/test.dart")); |
| 12271 CompilationUnitElementImpl definingCompilationUnit = new CompilationUnitElem
entImpl("test.dart"); | 12313 CompilationUnitElementImpl definingCompilationUnit = new CompilationUnitElem
entImpl("test.dart"); |
| 12272 definingCompilationUnit.source = source; | 12314 definingCompilationUnit.source = source; |
| 12273 _definingLibrary = ElementFactory.library(context, "test"); | 12315 _definingLibrary = ElementFactory.library(context, "test"); |
| 12274 _definingLibrary.definingCompilationUnit = definingCompilationUnit; | 12316 _definingLibrary.definingCompilationUnit = definingCompilationUnit; |
| 12275 Library library = new Library(context, _listener, source); | 12317 Library library = new Library(context, _listener, source); |
| 12276 library.libraryElement = _definingLibrary; | 12318 library.libraryElement = _definingLibrary; |
| 12277 _visitor = new ResolverVisitor.con1(library, source, _typeProvider); | 12319 _visitor = new ResolverVisitor.con1(library, source, _typeProvider); |
| 12278 try { | 12320 try { |
| 12279 return _visitor.elementResolver_J2DAccessor as ElementResolver; | 12321 return _visitor.elementResolver_J2DAccessor as ElementResolver; |
| 12280 } catch (exception) { | 12322 } on JavaException catch (exception) { |
| 12281 throw new IllegalArgumentException("Could not create resolver", exception)
; | 12323 throw new IllegalArgumentException("Could not create resolver", exception)
; |
| 12282 } | 12324 } |
| 12283 } | 12325 } |
| 12284 | 12326 |
| 12285 /** | 12327 /** |
| 12286 * Return the element associated with the label of the given statement after t
he resolver has | 12328 * Return the element associated with the label of the given statement after t
he resolver has |
| 12287 * resolved the statement. | 12329 * resolved the statement. |
| 12288 * | 12330 * |
| 12289 * @param statement the statement to be resolved | 12331 * @param statement the statement to be resolved |
| 12290 * @param labelElement the label element to be defined in the statement's labe
l scope | 12332 * @param labelElement the label element to be defined in the statement's labe
l scope |
| (...skipping 58 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 12349 Scope outerScope = _visitor.nameScope_J2DAccessor as Scope; | 12391 Scope outerScope = _visitor.nameScope_J2DAccessor as Scope; |
| 12350 try { | 12392 try { |
| 12351 _visitor.enclosingClass_J2DAccessor = enclosingClass; | 12393 _visitor.enclosingClass_J2DAccessor = enclosingClass; |
| 12352 EnclosedScope innerScope = new ClassScope(outerScope, enclosingClass); | 12394 EnclosedScope innerScope = new ClassScope(outerScope, enclosingClass); |
| 12353 _visitor.nameScope_J2DAccessor = innerScope; | 12395 _visitor.nameScope_J2DAccessor = innerScope; |
| 12354 node.accept(_resolver); | 12396 node.accept(_resolver); |
| 12355 } finally { | 12397 } finally { |
| 12356 _visitor.enclosingClass_J2DAccessor = null; | 12398 _visitor.enclosingClass_J2DAccessor = null; |
| 12357 _visitor.nameScope_J2DAccessor = outerScope; | 12399 _visitor.nameScope_J2DAccessor = outerScope; |
| 12358 } | 12400 } |
| 12359 } catch (exception) { | 12401 } on JavaException catch (exception) { |
| 12360 throw new IllegalArgumentException("Could not resolve node", exception); | 12402 throw new IllegalArgumentException("Could not resolve node", exception); |
| 12361 } | 12403 } |
| 12362 } | 12404 } |
| 12363 | 12405 |
| 12364 /** | 12406 /** |
| 12365 * Return the element associated with the given identifier after the resolver
has resolved the | 12407 * Return the element associated with the given identifier after the resolver
has resolved the |
| 12366 * identifier. | 12408 * identifier. |
| 12367 * | 12409 * |
| 12368 * @param node the expression to be resolved | 12410 * @param node the expression to be resolved |
| 12369 * @param definedElements the elements that are to be defined in the scope in
which the element is | 12411 * @param definedElements the elements that are to be defined in the scope in
which the element is |
| 12370 * being resolved | 12412 * being resolved |
| 12371 * @return the element to which the expression was resolved | 12413 * @return the element to which the expression was resolved |
| 12372 */ | 12414 */ |
| 12373 void resolveNode(ASTNode node, List<Element> definedElements) { | 12415 void resolveNode(ASTNode node, List<Element> definedElements) { |
| 12374 try { | 12416 try { |
| 12375 Scope outerScope = _visitor.nameScope_J2DAccessor as Scope; | 12417 Scope outerScope = _visitor.nameScope_J2DAccessor as Scope; |
| 12376 try { | 12418 try { |
| 12377 EnclosedScope innerScope = new EnclosedScope(outerScope); | 12419 EnclosedScope innerScope = new EnclosedScope(outerScope); |
| 12378 for (Element element in definedElements) { | 12420 for (Element element in definedElements) { |
| 12379 innerScope.define(element); | 12421 innerScope.define(element); |
| 12380 } | 12422 } |
| 12381 _visitor.nameScope_J2DAccessor = innerScope; | 12423 _visitor.nameScope_J2DAccessor = innerScope; |
| 12382 node.accept(_resolver); | 12424 node.accept(_resolver); |
| 12383 } finally { | 12425 } finally { |
| 12384 _visitor.nameScope_J2DAccessor = outerScope; | 12426 _visitor.nameScope_J2DAccessor = outerScope; |
| 12385 } | 12427 } |
| 12386 } catch (exception) { | 12428 } on JavaException catch (exception) { |
| 12387 throw new IllegalArgumentException("Could not resolve node", exception); | 12429 throw new IllegalArgumentException("Could not resolve node", exception); |
| 12388 } | 12430 } |
| 12389 } | 12431 } |
| 12390 | 12432 |
| 12391 /** | 12433 /** |
| 12392 * Return the element associated with the label of the given statement after t
he resolver has | 12434 * Return the element associated with the label of the given statement after t
he resolver has |
| 12393 * resolved the statement. | 12435 * resolved the statement. |
| 12394 * | 12436 * |
| 12395 * @param statement the statement to be resolved | 12437 * @param statement the statement to be resolved |
| 12396 * @param labelElement the label element to be defined in the statement's labe
l scope | 12438 * @param labelElement the label element to be defined in the statement's labe
l scope |
| 12397 * @return the element to which the statement's label was resolved | 12439 * @return the element to which the statement's label was resolved |
| 12398 */ | 12440 */ |
| 12399 void resolveStatement(Statement statement, LabelElementImpl labelElement) { | 12441 void resolveStatement(Statement statement, LabelElementImpl labelElement) { |
| 12400 try { | 12442 try { |
| 12401 LabelScope outerScope = _visitor.labelScope_J2DAccessor as LabelScope; | 12443 LabelScope outerScope = _visitor.labelScope_J2DAccessor as LabelScope; |
| 12402 try { | 12444 try { |
| 12403 LabelScope innerScope; | 12445 LabelScope innerScope; |
| 12404 if (labelElement == null) { | 12446 if (labelElement == null) { |
| 12405 innerScope = new LabelScope.con1(outerScope, false, false); | 12447 innerScope = new LabelScope.con1(outerScope, false, false); |
| 12406 } else { | 12448 } else { |
| 12407 innerScope = new LabelScope.con2(outerScope, labelElement.name, labelE
lement); | 12449 innerScope = new LabelScope.con2(outerScope, labelElement.name, labelE
lement); |
| 12408 } | 12450 } |
| 12409 _visitor.labelScope_J2DAccessor = innerScope; | 12451 _visitor.labelScope_J2DAccessor = innerScope; |
| 12410 statement.accept(_resolver); | 12452 statement.accept(_resolver); |
| 12411 } finally { | 12453 } finally { |
| 12412 _visitor.labelScope_J2DAccessor = outerScope; | 12454 _visitor.labelScope_J2DAccessor = outerScope; |
| 12413 } | 12455 } |
| 12414 } catch (exception) { | 12456 } on JavaException catch (exception) { |
| 12415 throw new IllegalArgumentException("Could not resolve node", exception); | 12457 throw new IllegalArgumentException("Could not resolve node", exception); |
| 12416 } | 12458 } |
| 12417 } | 12459 } |
| 12418 static dartSuite() { | 12460 static dartSuite() { |
| 12419 _ut.group('ElementResolverTest', () { | 12461 _ut.group('ElementResolverTest', () { |
| 12420 _ut.test('test_lookUpMethodInInterfaces', () { | 12462 _ut.test('test_lookUpMethodInInterfaces', () { |
| 12421 final __test = new ElementResolverTest(); | 12463 final __test = new ElementResolverTest(); |
| 12422 runJUnitTest(__test, __test.test_lookUpMethodInInterfaces); | 12464 runJUnitTest(__test, __test.test_lookUpMethodInInterfaces); |
| 12423 }); | 12465 }); |
| 12424 _ut.test('test_visitAssignmentExpression_compound', () { | 12466 _ut.test('test_visitAssignmentExpression_compound', () { |
| (...skipping 459 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 12884 "import 'lib1.dart';", | 12926 "import 'lib1.dart';", |
| 12885 "import 'lib2.dart';", | 12927 "import 'lib2.dart';", |
| 12886 "class A implements N {}"])); | 12928 "class A implements N {}"])); |
| 12887 addSource2("/lib1.dart", EngineTestCase.createSource(["library lib1;", "clas
s N {}"])); | 12929 addSource2("/lib1.dart", EngineTestCase.createSource(["library lib1;", "clas
s N {}"])); |
| 12888 addSource2("/lib2.dart", EngineTestCase.createSource(["library lib2;", "clas
s N {}"])); | 12930 addSource2("/lib2.dart", EngineTestCase.createSource(["library lib2;", "clas
s N {}"])); |
| 12889 resolve(source); | 12931 resolve(source); |
| 12890 assertErrors(source, [ | 12932 assertErrors(source, [ |
| 12891 StaticWarningCode.AMBIGUOUS_IMPORT, | 12933 StaticWarningCode.AMBIGUOUS_IMPORT, |
| 12892 CompileTimeErrorCode.IMPLEMENTS_NON_CLASS]); | 12934 CompileTimeErrorCode.IMPLEMENTS_NON_CLASS]); |
| 12893 } | 12935 } |
| 12936 void test_ambiguousImport_inPart() { |
| 12937 Source source = addSource(EngineTestCase.createSource([ |
| 12938 "library lib;", |
| 12939 "import 'lib1.dart';", |
| 12940 "import 'lib2.dart';", |
| 12941 "part 'part.dart';"])); |
| 12942 addSource2("/lib1.dart", EngineTestCase.createSource(["library lib1;", "clas
s N {}"])); |
| 12943 addSource2("/lib2.dart", EngineTestCase.createSource(["library lib2;", "clas
s N {}"])); |
| 12944 Source partSource = addSource2("/part.dart", EngineTestCase.createSource(["p
art of lib;", "class A extends N {}"])); |
| 12945 resolve(source); |
| 12946 assertErrors(partSource, [ |
| 12947 StaticWarningCode.AMBIGUOUS_IMPORT, |
| 12948 CompileTimeErrorCode.EXTENDS_NON_CLASS]); |
| 12949 } |
| 12894 void test_ambiguousImport_instanceCreation() { | 12950 void test_ambiguousImport_instanceCreation() { |
| 12895 Source source = addSource(EngineTestCase.createSource([ | 12951 Source source = addSource(EngineTestCase.createSource([ |
| 12896 "library L;", | 12952 "library L;", |
| 12897 "import 'lib1.dart';", | 12953 "import 'lib1.dart';", |
| 12898 "import 'lib2.dart';", | 12954 "import 'lib2.dart';", |
| 12899 "f() {new N();}"])); | 12955 "f() {new N();}"])); |
| 12900 addSource2("/lib1.dart", EngineTestCase.createSource(["library lib1;", "clas
s N {}"])); | 12956 addSource2("/lib1.dart", EngineTestCase.createSource(["library lib1;", "clas
s N {}"])); |
| 12901 addSource2("/lib2.dart", EngineTestCase.createSource(["library lib2;", "clas
s N {}"])); | 12957 addSource2("/lib2.dart", EngineTestCase.createSource(["library lib2;", "clas
s N {}"])); |
| 12902 resolve(source); | 12958 resolve(source); |
| 12903 assertErrors(source, [StaticWarningCode.AMBIGUOUS_IMPORT]); | 12959 assertErrors(source, [StaticWarningCode.AMBIGUOUS_IMPORT]); |
| (...skipping 114 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 13018 "class A {", | 13074 "class A {", |
| 13019 " operator +(int p) {}", | 13075 " operator +(int p) {}", |
| 13020 "}", | 13076 "}", |
| 13021 "f(A a) {", | 13077 "f(A a) {", |
| 13022 " a + '0';", | 13078 " a + '0';", |
| 13023 "}"])); | 13079 "}"])); |
| 13024 resolve(source); | 13080 resolve(source); |
| 13025 assertErrors(source, [StaticWarningCode.ARGUMENT_TYPE_NOT_ASSIGNABLE]); | 13081 assertErrors(source, [StaticWarningCode.ARGUMENT_TYPE_NOT_ASSIGNABLE]); |
| 13026 verify([source]); | 13082 verify([source]); |
| 13027 } | 13083 } |
| 13084 void test_argumentTypeNotAssignable_const() { |
| 13085 Source source = addSource(EngineTestCase.createSource([ |
| 13086 "class A {", |
| 13087 " const A(String p);", |
| 13088 "}", |
| 13089 "main() {", |
| 13090 " const A(42);", |
| 13091 "}"])); |
| 13092 resolve(source); |
| 13093 assertErrors(source, [StaticWarningCode.ARGUMENT_TYPE_NOT_ASSIGNABLE]); |
| 13094 verify([source]); |
| 13095 } |
| 13096 void test_argumentTypeNotAssignable_const_super() { |
| 13097 Source source = addSource(EngineTestCase.createSource([ |
| 13098 "class A {", |
| 13099 " const A(String p);", |
| 13100 "}", |
| 13101 "class B extends A {", |
| 13102 " const B() : super(42);", |
| 13103 "}"])); |
| 13104 resolve(source); |
| 13105 assertErrors(source, [StaticWarningCode.ARGUMENT_TYPE_NOT_ASSIGNABLE]); |
| 13106 verify([source]); |
| 13107 } |
| 13028 void test_argumentTypeNotAssignable_index() { | 13108 void test_argumentTypeNotAssignable_index() { |
| 13029 Source source = addSource(EngineTestCase.createSource([ | 13109 Source source = addSource(EngineTestCase.createSource([ |
| 13030 "class A {", | 13110 "class A {", |
| 13031 " operator [](int index) {}", | 13111 " operator [](int index) {}", |
| 13032 "}", | 13112 "}", |
| 13033 "f(A a) {", | 13113 "f(A a) {", |
| 13034 " a['0'];", | 13114 " a['0'];", |
| 13035 "}"])); | 13115 "}"])); |
| 13036 resolve(source); | 13116 resolve(source); |
| 13037 assertErrors(source, [StaticWarningCode.ARGUMENT_TYPE_NOT_ASSIGNABLE]); | 13117 assertErrors(source, [StaticWarningCode.ARGUMENT_TYPE_NOT_ASSIGNABLE]); |
| (...skipping 1453 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 14491 runJUnitTest(__test, __test.test_ambiguousImport_as); | 14571 runJUnitTest(__test, __test.test_ambiguousImport_as); |
| 14492 }); | 14572 }); |
| 14493 _ut.test('test_ambiguousImport_extends', () { | 14573 _ut.test('test_ambiguousImport_extends', () { |
| 14494 final __test = new StaticWarningCodeTest(); | 14574 final __test = new StaticWarningCodeTest(); |
| 14495 runJUnitTest(__test, __test.test_ambiguousImport_extends); | 14575 runJUnitTest(__test, __test.test_ambiguousImport_extends); |
| 14496 }); | 14576 }); |
| 14497 _ut.test('test_ambiguousImport_implements', () { | 14577 _ut.test('test_ambiguousImport_implements', () { |
| 14498 final __test = new StaticWarningCodeTest(); | 14578 final __test = new StaticWarningCodeTest(); |
| 14499 runJUnitTest(__test, __test.test_ambiguousImport_implements); | 14579 runJUnitTest(__test, __test.test_ambiguousImport_implements); |
| 14500 }); | 14580 }); |
| 14581 _ut.test('test_ambiguousImport_inPart', () { |
| 14582 final __test = new StaticWarningCodeTest(); |
| 14583 runJUnitTest(__test, __test.test_ambiguousImport_inPart); |
| 14584 }); |
| 14501 _ut.test('test_ambiguousImport_instanceCreation', () { | 14585 _ut.test('test_ambiguousImport_instanceCreation', () { |
| 14502 final __test = new StaticWarningCodeTest(); | 14586 final __test = new StaticWarningCodeTest(); |
| 14503 runJUnitTest(__test, __test.test_ambiguousImport_instanceCreation); | 14587 runJUnitTest(__test, __test.test_ambiguousImport_instanceCreation); |
| 14504 }); | 14588 }); |
| 14505 _ut.test('test_ambiguousImport_is', () { | 14589 _ut.test('test_ambiguousImport_is', () { |
| 14506 final __test = new StaticWarningCodeTest(); | 14590 final __test = new StaticWarningCodeTest(); |
| 14507 runJUnitTest(__test, __test.test_ambiguousImport_is); | 14591 runJUnitTest(__test, __test.test_ambiguousImport_is); |
| 14508 }); | 14592 }); |
| 14509 _ut.test('test_ambiguousImport_qualifier', () { | 14593 _ut.test('test_ambiguousImport_qualifier', () { |
| 14510 final __test = new StaticWarningCodeTest(); | 14594 final __test = new StaticWarningCodeTest(); |
| (...skipping 24 matching lines...) Expand all Loading... |
| 14535 runJUnitTest(__test, __test.test_argumentTypeNotAssignable_annotation_na
medConstructor); | 14619 runJUnitTest(__test, __test.test_argumentTypeNotAssignable_annotation_na
medConstructor); |
| 14536 }); | 14620 }); |
| 14537 _ut.test('test_argumentTypeNotAssignable_annotation_unnamedConstructor', (
) { | 14621 _ut.test('test_argumentTypeNotAssignable_annotation_unnamedConstructor', (
) { |
| 14538 final __test = new StaticWarningCodeTest(); | 14622 final __test = new StaticWarningCodeTest(); |
| 14539 runJUnitTest(__test, __test.test_argumentTypeNotAssignable_annotation_un
namedConstructor); | 14623 runJUnitTest(__test, __test.test_argumentTypeNotAssignable_annotation_un
namedConstructor); |
| 14540 }); | 14624 }); |
| 14541 _ut.test('test_argumentTypeNotAssignable_binary', () { | 14625 _ut.test('test_argumentTypeNotAssignable_binary', () { |
| 14542 final __test = new StaticWarningCodeTest(); | 14626 final __test = new StaticWarningCodeTest(); |
| 14543 runJUnitTest(__test, __test.test_argumentTypeNotAssignable_binary); | 14627 runJUnitTest(__test, __test.test_argumentTypeNotAssignable_binary); |
| 14544 }); | 14628 }); |
| 14629 _ut.test('test_argumentTypeNotAssignable_const', () { |
| 14630 final __test = new StaticWarningCodeTest(); |
| 14631 runJUnitTest(__test, __test.test_argumentTypeNotAssignable_const); |
| 14632 }); |
| 14633 _ut.test('test_argumentTypeNotAssignable_const_super', () { |
| 14634 final __test = new StaticWarningCodeTest(); |
| 14635 runJUnitTest(__test, __test.test_argumentTypeNotAssignable_const_super); |
| 14636 }); |
| 14545 _ut.test('test_argumentTypeNotAssignable_index', () { | 14637 _ut.test('test_argumentTypeNotAssignable_index', () { |
| 14546 final __test = new StaticWarningCodeTest(); | 14638 final __test = new StaticWarningCodeTest(); |
| 14547 runJUnitTest(__test, __test.test_argumentTypeNotAssignable_index); | 14639 runJUnitTest(__test, __test.test_argumentTypeNotAssignable_index); |
| 14548 }); | 14640 }); |
| 14549 _ut.test('test_argumentTypeNotAssignable_invocation_callParameter', () { | 14641 _ut.test('test_argumentTypeNotAssignable_invocation_callParameter', () { |
| 14550 final __test = new StaticWarningCodeTest(); | 14642 final __test = new StaticWarningCodeTest(); |
| 14551 runJUnitTest(__test, __test.test_argumentTypeNotAssignable_invocation_ca
llParameter); | 14643 runJUnitTest(__test, __test.test_argumentTypeNotAssignable_invocation_ca
llParameter); |
| 14552 }); | 14644 }); |
| 14553 _ut.test('test_argumentTypeNotAssignable_invocation_callVariable', () { | 14645 _ut.test('test_argumentTypeNotAssignable_invocation_callVariable', () { |
| 14554 final __test = new StaticWarningCodeTest(); | 14646 final __test = new StaticWarningCodeTest(); |
| (...skipping 1008 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 15563 provider.functionType.element, | 15655 provider.functionType.element, |
| 15564 provider.intType.element, | 15656 provider.intType.element, |
| 15565 provider.listType.element, | 15657 provider.listType.element, |
| 15566 provider.mapType.element, | 15658 provider.mapType.element, |
| 15567 provider.nullType.element, | 15659 provider.nullType.element, |
| 15568 provider.numType.element, | 15660 provider.numType.element, |
| 15569 provider.objectType.element, | 15661 provider.objectType.element, |
| 15570 provider.stackTraceType.element, | 15662 provider.stackTraceType.element, |
| 15571 provider.stringType.element, | 15663 provider.stringType.element, |
| 15572 provider.typeType.element]; | 15664 provider.typeType.element]; |
| 15665 coreUnit.functions = <FunctionElement> [ElementFactory.functionElement3("ide
ntical", provider.boolType.element, <ClassElement> [provider.objectType.element,
provider.objectType.element], null)]; |
| 15573 LibraryElementImpl coreLibrary = new LibraryElementImpl(sdkContext, ASTFacto
ry.libraryIdentifier2(["dart", "core"])); | 15666 LibraryElementImpl coreLibrary = new LibraryElementImpl(sdkContext, ASTFacto
ry.libraryIdentifier2(["dart", "core"])); |
| 15574 coreLibrary.definingCompilationUnit = coreUnit; | 15667 coreLibrary.definingCompilationUnit = coreUnit; |
| 15575 CompilationUnitElementImpl htmlUnit = new CompilationUnitElementImpl("html_d
artium.dart"); | 15668 CompilationUnitElementImpl htmlUnit = new CompilationUnitElementImpl("html_d
artium.dart"); |
| 15576 Source htmlSource = sourceFactory.forUri(DartSdk.DART_HTML); | 15669 Source htmlSource = sourceFactory.forUri(DartSdk.DART_HTML); |
| 15577 sdkContext.setContents(htmlSource, ""); | 15670 sdkContext.setContents(htmlSource, ""); |
| 15578 htmlUnit.source = htmlSource; | 15671 htmlUnit.source = htmlSource; |
| 15579 ClassElementImpl elementElement = ElementFactory.classElement2("Element", []
); | 15672 ClassElementImpl elementElement = ElementFactory.classElement2("Element", []
); |
| 15580 InterfaceType elementType = elementElement.type; | 15673 InterfaceType elementType = elementElement.type; |
| 15581 ClassElementImpl documentElement = ElementFactory.classElement("Document", e
lementType, []); | 15674 ClassElementImpl documentElement = ElementFactory.classElement("Document", e
lementType, []); |
| 15582 ClassElementImpl htmlDocumentElement = ElementFactory.classElement("HtmlDocu
ment", documentElement.type, []); | 15675 ClassElementImpl htmlDocumentElement = ElementFactory.classElement("HtmlDocu
ment", documentElement.type, []); |
| (...skipping 400 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 15983 writer.print(" "); | 16076 writer.print(" "); |
| 15984 writer.print(identifier.toString()); | 16077 writer.print(identifier.toString()); |
| 15985 writer.print(" ("); | 16078 writer.print(" ("); |
| 15986 writer.print(getFileName(identifier)); | 16079 writer.print(getFileName(identifier)); |
| 15987 writer.print(" : "); | 16080 writer.print(" : "); |
| 15988 writer.print(identifier.offset); | 16081 writer.print(identifier.offset); |
| 15989 writer.println(")"); | 16082 writer.println(")"); |
| 15990 } | 16083 } |
| 15991 } | 16084 } |
| 15992 } | 16085 } |
| 16086 class MemberMapTest extends JUnitTestCase { |
| 16087 |
| 16088 /** |
| 16089 * The null type. |
| 16090 */ |
| 16091 InterfaceType _nullType; |
| 16092 void setUp() { |
| 16093 _nullType = new TestTypeProvider().nullType; |
| 16094 } |
| 16095 void test_MemberMap_copyConstructor() { |
| 16096 MethodElement m1 = ElementFactory.methodElement("m1", _nullType, []); |
| 16097 MethodElement m2 = ElementFactory.methodElement("m2", _nullType, []); |
| 16098 MethodElement m3 = ElementFactory.methodElement("m3", _nullType, []); |
| 16099 MemberMap map = new MemberMap(); |
| 16100 map.put(m1.name, m1); |
| 16101 map.put(m2.name, m2); |
| 16102 map.put(m3.name, m3); |
| 16103 MemberMap copy = new MemberMap.con2(map); |
| 16104 JUnitTestCase.assertEquals(map.size, copy.size); |
| 16105 JUnitTestCase.assertEquals(m1, copy.get(m1.name)); |
| 16106 JUnitTestCase.assertEquals(m2, copy.get(m2.name)); |
| 16107 JUnitTestCase.assertEquals(m3, copy.get(m3.name)); |
| 16108 } |
| 16109 void test_MemberMap_override() { |
| 16110 MethodElement m1 = ElementFactory.methodElement("m", _nullType, []); |
| 16111 MethodElement m2 = ElementFactory.methodElement("m", _nullType, []); |
| 16112 MemberMap map = new MemberMap(); |
| 16113 map.put(m1.name, m1); |
| 16114 map.put(m2.name, m2); |
| 16115 JUnitTestCase.assertEquals(1, map.size); |
| 16116 JUnitTestCase.assertEquals(m2, map.get("m")); |
| 16117 } |
| 16118 void test_MemberMap_put() { |
| 16119 MethodElement m1 = ElementFactory.methodElement("m1", _nullType, []); |
| 16120 MemberMap map = new MemberMap(); |
| 16121 JUnitTestCase.assertEquals(0, map.size); |
| 16122 map.put(m1.name, m1); |
| 16123 JUnitTestCase.assertEquals(1, map.size); |
| 16124 JUnitTestCase.assertEquals(m1, map.get("m1")); |
| 16125 } |
| 16126 static dartSuite() { |
| 16127 _ut.group('MemberMapTest', () { |
| 16128 _ut.test('test_MemberMap_copyConstructor', () { |
| 16129 final __test = new MemberMapTest(); |
| 16130 runJUnitTest(__test, __test.test_MemberMap_copyConstructor); |
| 16131 }); |
| 16132 _ut.test('test_MemberMap_override', () { |
| 16133 final __test = new MemberMapTest(); |
| 16134 runJUnitTest(__test, __test.test_MemberMap_override); |
| 16135 }); |
| 16136 _ut.test('test_MemberMap_put', () { |
| 16137 final __test = new MemberMapTest(); |
| 16138 runJUnitTest(__test, __test.test_MemberMap_put); |
| 16139 }); |
| 16140 }); |
| 16141 } |
| 16142 } |
| 15993 class LibraryScopeTest extends ResolverTestCase { | 16143 class LibraryScopeTest extends ResolverTestCase { |
| 15994 void test_creation_empty() { | 16144 void test_creation_empty() { |
| 15995 LibraryElement definingLibrary = createTestLibrary(); | 16145 LibraryElement definingLibrary = createTestLibrary(); |
| 15996 GatheringErrorListener errorListener = new GatheringErrorListener(); | 16146 GatheringErrorListener errorListener = new GatheringErrorListener(); |
| 15997 new LibraryScope(definingLibrary, errorListener); | 16147 new LibraryScope(definingLibrary, errorListener); |
| 15998 } | 16148 } |
| 15999 void test_creation_nonEmpty() { | 16149 void test_creation_nonEmpty() { |
| 16000 AnalysisContext context = new AnalysisContextImpl(); | 16150 AnalysisContext context = new AnalysisContextImpl(); |
| 16001 String importedTypeName = "A"; | 16151 String importedTypeName = "A"; |
| 16002 ClassElement importedType = new ClassElementImpl(ASTFactory.identifier3(impo
rtedTypeName)); | 16152 ClassElement importedType = new ClassElementImpl(ASTFactory.identifier3(impo
rtedTypeName)); |
| (...skipping 614 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 16617 * Return the type associated with the given expression after the static type
analyzer has | 16767 * Return the type associated with the given expression after the static type
analyzer has |
| 16618 * computed a type for it. | 16768 * computed a type for it. |
| 16619 * | 16769 * |
| 16620 * @param node the expression with which the type is associated | 16770 * @param node the expression with which the type is associated |
| 16621 * @param thisType the type of 'this' | 16771 * @param thisType the type of 'this' |
| 16622 * @return the type associated with the expression | 16772 * @return the type associated with the expression |
| 16623 */ | 16773 */ |
| 16624 Type2 analyze2(Expression node, InterfaceType thisType) { | 16774 Type2 analyze2(Expression node, InterfaceType thisType) { |
| 16625 try { | 16775 try { |
| 16626 _analyzer.thisType_J2DAccessor = thisType; | 16776 _analyzer.thisType_J2DAccessor = thisType; |
| 16627 } catch (exception) { | 16777 } on JavaException catch (exception) { |
| 16628 throw new IllegalArgumentException("Could not set type of 'this'", excepti
on); | 16778 throw new IllegalArgumentException("Could not set type of 'this'", excepti
on); |
| 16629 } | 16779 } |
| 16630 node.accept(_analyzer); | 16780 node.accept(_analyzer); |
| 16631 return node.staticType; | 16781 return node.staticType; |
| 16632 } | 16782 } |
| 16633 | 16783 |
| 16634 /** | 16784 /** |
| 16635 * Return the type associated with the given parameter after the static type a
nalyzer has computed | 16785 * Return the type associated with the given parameter after the static type a
nalyzer has computed |
| 16636 * a type for it. | 16786 * a type for it. |
| 16637 * | 16787 * |
| (...skipping 79 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 16717 CompilationUnitElementImpl definingCompilationUnit = new CompilationUnitElem
entImpl("lib.dart"); | 16867 CompilationUnitElementImpl definingCompilationUnit = new CompilationUnitElem
entImpl("lib.dart"); |
| 16718 definingCompilationUnit.source = source; | 16868 definingCompilationUnit.source = source; |
| 16719 LibraryElementImpl definingLibrary = new LibraryElementImpl(context, null); | 16869 LibraryElementImpl definingLibrary = new LibraryElementImpl(context, null); |
| 16720 definingLibrary.definingCompilationUnit = definingCompilationUnit; | 16870 definingLibrary.definingCompilationUnit = definingCompilationUnit; |
| 16721 Library library = new Library(context, _listener, source); | 16871 Library library = new Library(context, _listener, source); |
| 16722 library.libraryElement = definingLibrary; | 16872 library.libraryElement = definingLibrary; |
| 16723 _visitor = new ResolverVisitor.con1(library, source, _typeProvider); | 16873 _visitor = new ResolverVisitor.con1(library, source, _typeProvider); |
| 16724 _visitor.overrideManager.enterScope(); | 16874 _visitor.overrideManager.enterScope(); |
| 16725 try { | 16875 try { |
| 16726 return _visitor.typeAnalyzer_J2DAccessor as StaticTypeAnalyzer; | 16876 return _visitor.typeAnalyzer_J2DAccessor as StaticTypeAnalyzer; |
| 16727 } catch (exception) { | 16877 } on JavaException catch (exception) { |
| 16728 throw new IllegalArgumentException("Could not create analyzer", exception)
; | 16878 throw new IllegalArgumentException("Could not create analyzer", exception)
; |
| 16729 } | 16879 } |
| 16730 } | 16880 } |
| 16731 | 16881 |
| 16732 /** | 16882 /** |
| 16733 * Return an integer literal that has been resolved to the correct type. | 16883 * Return an integer literal that has been resolved to the correct type. |
| 16734 * | 16884 * |
| 16735 * @param value the value of the literal | 16885 * @param value the value of the literal |
| 16736 * @return an integer literal that has been resolved to the correct type | 16886 * @return an integer literal that has been resolved to the correct type |
| 16737 */ | 16887 */ |
| (...skipping 1597 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 18335 " }", | 18485 " }", |
| 18336 "}"])); | 18486 "}"])); |
| 18337 resolve(source); | 18487 resolve(source); |
| 18338 assertNoErrors(source); | 18488 assertNoErrors(source); |
| 18339 verify([source]); | 18489 verify([source]); |
| 18340 } | 18490 } |
| 18341 void test_resolveAgainstNull() { | 18491 void test_resolveAgainstNull() { |
| 18342 Source source = addSource(EngineTestCase.createSource(["f(var p) {", " retu
rn null == p;", "}"])); | 18492 Source source = addSource(EngineTestCase.createSource(["f(var p) {", " retu
rn null == p;", "}"])); |
| 18343 resolve(source); | 18493 resolve(source); |
| 18344 assertNoErrors(source); | 18494 assertNoErrors(source); |
| 18345 verify([source]); | |
| 18346 } | 18495 } |
| 18347 void test_setter_inherited() { | 18496 void test_setter_inherited() { |
| 18348 Source source = addSource(EngineTestCase.createSource([ | 18497 Source source = addSource(EngineTestCase.createSource([ |
| 18349 "class A {", | 18498 "class A {", |
| 18350 " int get x => 0;", | 18499 " int get x => 0;", |
| 18351 " set x(int p) {}", | 18500 " set x(int p) {}", |
| 18352 "}", | 18501 "}", |
| 18353 "class B extends A {", | 18502 "class B extends A {", |
| 18354 " int get x => super.x == null ? 0 : super.x;", | 18503 " int get x => super.x == null ? 0 : super.x;", |
| 18355 " int f() => x = 1;", | 18504 " int f() => x = 1;", |
| (...skipping 250 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 18606 // TypeOverrideManagerTest.dartSuite(); | 18755 // TypeOverrideManagerTest.dartSuite(); |
| 18607 // TypeProviderImplTest.dartSuite(); | 18756 // TypeProviderImplTest.dartSuite(); |
| 18608 // TypeResolverVisitorTest.dartSuite(); | 18757 // TypeResolverVisitorTest.dartSuite(); |
| 18609 // EnclosedScopeTest.dartSuite(); | 18758 // EnclosedScopeTest.dartSuite(); |
| 18610 // LibraryImportScopeTest.dartSuite(); | 18759 // LibraryImportScopeTest.dartSuite(); |
| 18611 // LibraryScopeTest.dartSuite(); | 18760 // LibraryScopeTest.dartSuite(); |
| 18612 // ScopeTest.dartSuite(); | 18761 // ScopeTest.dartSuite(); |
| 18613 // CompileTimeErrorCodeTest.dartSuite(); | 18762 // CompileTimeErrorCodeTest.dartSuite(); |
| 18614 // ErrorResolverTest.dartSuite(); | 18763 // ErrorResolverTest.dartSuite(); |
| 18615 // HintCodeTest.dartSuite(); | 18764 // HintCodeTest.dartSuite(); |
| 18765 // MemberMapTest.dartSuite(); |
| 18616 // NonHintCodeTest.dartSuite(); | 18766 // NonHintCodeTest.dartSuite(); |
| 18617 // NonErrorResolverTest.dartSuite(); | 18767 // NonErrorResolverTest.dartSuite(); |
| 18618 // SimpleResolverTest.dartSuite(); | 18768 // SimpleResolverTest.dartSuite(); |
| 18619 // StaticTypeWarningCodeTest.dartSuite(); | 18769 // StaticTypeWarningCodeTest.dartSuite(); |
| 18620 // StaticWarningCodeTest.dartSuite(); | 18770 // StaticWarningCodeTest.dartSuite(); |
| 18621 // StrictModeTest.dartSuite(); | 18771 // StrictModeTest.dartSuite(); |
| 18622 // TypePropagationTest.dartSuite(); | 18772 // TypePropagationTest.dartSuite(); |
| 18623 } | 18773 } |
| OLD | NEW |