| 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 | 3 |
| 4 library engine.resolver_test; | 4 library engine.resolver_test; |
| 5 | 5 |
| 6 import 'package:analyzer/src/generated/java_core.dart'; | 6 import 'package:analyzer/src/generated/java_core.dart'; |
| 7 import 'package:analyzer/src/generated/java_junit.dart'; | 7 import 'package:analyzer/src/generated/java_junit.dart'; |
| 8 import 'package:analyzer/src/generated/source_io.dart'; | 8 import 'package:analyzer/src/generated/source_io.dart'; |
| 9 import 'package:analyzer/src/generated/error.dart'; | 9 import 'package:analyzer/src/generated/error.dart'; |
| 10 import 'package:analyzer/src/generated/scanner.dart'; | 10 import 'package:analyzer/src/generated/scanner.dart'; |
| (...skipping 1189 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1200 " switch(s) {", | 1200 " switch(s) {", |
| 1201 " case('1') : return 1;", | 1201 " case('1') : return 1;", |
| 1202 " default: return 0;", | 1202 " default: return 0;", |
| 1203 " }", | 1203 " }", |
| 1204 "}"])); | 1204 "}"])); |
| 1205 resolve(source); | 1205 resolve(source); |
| 1206 assertNoErrors(source); | 1206 assertNoErrors(source); |
| 1207 verify([source]); | 1207 verify([source]); |
| 1208 } | 1208 } |
| 1209 | 1209 |
| 1210 void test_commentReference_beforeConstructor() { |
| 1211 String code = EngineTestCase.createSource(["abstract class A {", " /// [p]"
, " A(int p) {}", "}"]); |
| 1212 Source source = addSource(code); |
| 1213 resolve(source); |
| 1214 assertNoErrors(source); |
| 1215 verify([source]); |
| 1216 CompilationUnit unit = analysisContext.parseCompilationUnit(source); |
| 1217 { |
| 1218 SimpleIdentifier ref = EngineTestCase.findNode(unit, code, "p]", SimpleIde
ntifier); |
| 1219 EngineTestCase.assertInstanceOf(ParameterElement, ref.staticElement); |
| 1220 } |
| 1221 } |
| 1222 |
| 1210 void test_commentReference_beforeFunction_blockBody() { | 1223 void test_commentReference_beforeFunction_blockBody() { |
| 1211 String code = EngineTestCase.createSource(["/// [p]", "foo(int p) {", "}"]); | 1224 String code = EngineTestCase.createSource(["/// [p]", "foo(int p) {", "}"]); |
| 1212 Source source = addSource(code); | 1225 Source source = addSource(code); |
| 1213 resolve(source); | 1226 resolve(source); |
| 1214 assertNoErrors(source); | 1227 assertNoErrors(source); |
| 1215 verify([source]); | 1228 verify([source]); |
| 1216 CompilationUnit unit = analysisContext.parseCompilationUnit(source); | 1229 CompilationUnit unit = analysisContext.parseCompilationUnit(source); |
| 1217 SimpleIdentifier ref = EngineTestCase.findNode(unit, code, "p]", SimpleIdent
ifier); | 1230 SimpleIdentifier ref = EngineTestCase.findNode(unit, code, "p]", SimpleIdent
ifier); |
| 1218 EngineTestCase.assertInstanceOf(ParameterElement, ref.staticElement); | 1231 EngineTestCase.assertInstanceOf(ParameterElement, ref.staticElement); |
| 1219 } | 1232 } |
| (...skipping 3234 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 4454 runJUnitTest(__test, __test.test_caseExpressionTypeImplementsEquals_Obje
ct); | 4467 runJUnitTest(__test, __test.test_caseExpressionTypeImplementsEquals_Obje
ct); |
| 4455 }); | 4468 }); |
| 4456 _ut.test('test_caseExpressionTypeImplementsEquals_String', () { | 4469 _ut.test('test_caseExpressionTypeImplementsEquals_String', () { |
| 4457 final __test = new NonErrorResolverTest(); | 4470 final __test = new NonErrorResolverTest(); |
| 4458 runJUnitTest(__test, __test.test_caseExpressionTypeImplementsEquals_Stri
ng); | 4471 runJUnitTest(__test, __test.test_caseExpressionTypeImplementsEquals_Stri
ng); |
| 4459 }); | 4472 }); |
| 4460 _ut.test('test_caseExpressionTypeImplementsEquals_int', () { | 4473 _ut.test('test_caseExpressionTypeImplementsEquals_int', () { |
| 4461 final __test = new NonErrorResolverTest(); | 4474 final __test = new NonErrorResolverTest(); |
| 4462 runJUnitTest(__test, __test.test_caseExpressionTypeImplementsEquals_int)
; | 4475 runJUnitTest(__test, __test.test_caseExpressionTypeImplementsEquals_int)
; |
| 4463 }); | 4476 }); |
| 4477 _ut.test('test_commentReference_beforeConstructor', () { |
| 4478 final __test = new NonErrorResolverTest(); |
| 4479 runJUnitTest(__test, __test.test_commentReference_beforeConstructor); |
| 4480 }); |
| 4464 _ut.test('test_commentReference_beforeFunction_blockBody', () { | 4481 _ut.test('test_commentReference_beforeFunction_blockBody', () { |
| 4465 final __test = new NonErrorResolverTest(); | 4482 final __test = new NonErrorResolverTest(); |
| 4466 runJUnitTest(__test, __test.test_commentReference_beforeFunction_blockBo
dy); | 4483 runJUnitTest(__test, __test.test_commentReference_beforeFunction_blockBo
dy); |
| 4467 }); | 4484 }); |
| 4468 _ut.test('test_commentReference_beforeFunction_expressionBody', () { | 4485 _ut.test('test_commentReference_beforeFunction_expressionBody', () { |
| 4469 final __test = new NonErrorResolverTest(); | 4486 final __test = new NonErrorResolverTest(); |
| 4470 runJUnitTest(__test, __test.test_commentReference_beforeFunction_express
ionBody); | 4487 runJUnitTest(__test, __test.test_commentReference_beforeFunction_express
ionBody); |
| 4471 }); | 4488 }); |
| 4472 _ut.test('test_commentReference_beforeMethod', () { | 4489 _ut.test('test_commentReference_beforeMethod', () { |
| 4473 final __test = new NonErrorResolverTest(); | 4490 final __test = new NonErrorResolverTest(); |
| (...skipping 17175 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 21649 final __test = new NonHintCodeTest(); | 21666 final __test = new NonHintCodeTest(); |
| 21650 runJUnitTest(__test, __test.test_unusedImport_prefix_topLevelFunction); | 21667 runJUnitTest(__test, __test.test_unusedImport_prefix_topLevelFunction); |
| 21651 }); | 21668 }); |
| 21652 }); | 21669 }); |
| 21653 } | 21670 } |
| 21654 } | 21671 } |
| 21655 | 21672 |
| 21656 class EnclosedScopeTest extends ResolverTestCase { | 21673 class EnclosedScopeTest extends ResolverTestCase { |
| 21657 void test_define_duplicate() { | 21674 void test_define_duplicate() { |
| 21658 GatheringErrorListener errorListener2 = new GatheringErrorListener(); | 21675 GatheringErrorListener errorListener2 = new GatheringErrorListener(); |
| 21659 Scope rootScope = new Scope_25(errorListener2); | 21676 Scope rootScope = new Scope_27(errorListener2); |
| 21660 EnclosedScope scope = new EnclosedScope(rootScope); | 21677 EnclosedScope scope = new EnclosedScope(rootScope); |
| 21661 VariableElement element1 = ElementFactory.localVariableElement(ASTFactory.id
entifier3("v1")); | 21678 VariableElement element1 = ElementFactory.localVariableElement(ASTFactory.id
entifier3("v1")); |
| 21662 VariableElement element2 = ElementFactory.localVariableElement(ASTFactory.id
entifier3("v1")); | 21679 VariableElement element2 = ElementFactory.localVariableElement(ASTFactory.id
entifier3("v1")); |
| 21663 scope.define(element1); | 21680 scope.define(element1); |
| 21664 scope.define(element2); | 21681 scope.define(element2); |
| 21665 errorListener2.assertErrors3([ErrorSeverity.ERROR]); | 21682 errorListener2.assertErrors3([ErrorSeverity.ERROR]); |
| 21666 } | 21683 } |
| 21667 | 21684 |
| 21668 void test_define_normal() { | 21685 void test_define_normal() { |
| 21669 GatheringErrorListener errorListener3 = new GatheringErrorListener(); | 21686 GatheringErrorListener errorListener3 = new GatheringErrorListener(); |
| 21670 Scope rootScope = new Scope_26(errorListener3); | 21687 Scope rootScope = new Scope_28(errorListener3); |
| 21671 EnclosedScope outerScope = new EnclosedScope(rootScope); | 21688 EnclosedScope outerScope = new EnclosedScope(rootScope); |
| 21672 EnclosedScope innerScope = new EnclosedScope(outerScope); | 21689 EnclosedScope innerScope = new EnclosedScope(outerScope); |
| 21673 VariableElement element1 = ElementFactory.localVariableElement(ASTFactory.id
entifier3("v1")); | 21690 VariableElement element1 = ElementFactory.localVariableElement(ASTFactory.id
entifier3("v1")); |
| 21674 VariableElement element2 = ElementFactory.localVariableElement(ASTFactory.id
entifier3("v2")); | 21691 VariableElement element2 = ElementFactory.localVariableElement(ASTFactory.id
entifier3("v2")); |
| 21675 outerScope.define(element1); | 21692 outerScope.define(element1); |
| 21676 innerScope.define(element2); | 21693 innerScope.define(element2); |
| 21677 errorListener3.assertNoErrors(); | 21694 errorListener3.assertNoErrors(); |
| 21678 } | 21695 } |
| 21679 | 21696 |
| 21680 static dartSuite() { | 21697 static dartSuite() { |
| 21681 _ut.group('EnclosedScopeTest', () { | 21698 _ut.group('EnclosedScopeTest', () { |
| 21682 _ut.test('test_define_duplicate', () { | 21699 _ut.test('test_define_duplicate', () { |
| 21683 final __test = new EnclosedScopeTest(); | 21700 final __test = new EnclosedScopeTest(); |
| 21684 runJUnitTest(__test, __test.test_define_duplicate); | 21701 runJUnitTest(__test, __test.test_define_duplicate); |
| 21685 }); | 21702 }); |
| 21686 _ut.test('test_define_normal', () { | 21703 _ut.test('test_define_normal', () { |
| 21687 final __test = new EnclosedScopeTest(); | 21704 final __test = new EnclosedScopeTest(); |
| 21688 runJUnitTest(__test, __test.test_define_normal); | 21705 runJUnitTest(__test, __test.test_define_normal); |
| 21689 }); | 21706 }); |
| 21690 }); | 21707 }); |
| 21691 } | 21708 } |
| 21692 } | 21709 } |
| 21693 | 21710 |
| 21694 class Scope_25 extends Scope { | 21711 class Scope_27 extends Scope { |
| 21695 GatheringErrorListener errorListener2; | 21712 GatheringErrorListener errorListener2; |
| 21696 | 21713 |
| 21697 Scope_25(this.errorListener2) : super(); | 21714 Scope_27(this.errorListener2) : super(); |
| 21698 | 21715 |
| 21699 AnalysisErrorListener get errorListener => errorListener2; | 21716 AnalysisErrorListener get errorListener => errorListener2; |
| 21700 | 21717 |
| 21701 Element lookup3(Identifier identifier, String name, LibraryElement referencing
Library) => null; | 21718 Element lookup3(Identifier identifier, String name, LibraryElement referencing
Library) => null; |
| 21702 } | 21719 } |
| 21703 | 21720 |
| 21704 class Scope_26 extends Scope { | 21721 class Scope_28 extends Scope { |
| 21705 GatheringErrorListener errorListener3; | 21722 GatheringErrorListener errorListener3; |
| 21706 | 21723 |
| 21707 Scope_26(this.errorListener3) : super(); | 21724 Scope_28(this.errorListener3) : super(); |
| 21708 | 21725 |
| 21709 AnalysisErrorListener get errorListener => errorListener3; | 21726 AnalysisErrorListener get errorListener => errorListener3; |
| 21710 | 21727 |
| 21711 Element lookup3(Identifier identifier, String name, LibraryElement referencing
Library) => null; | 21728 Element lookup3(Identifier identifier, String name, LibraryElement referencing
Library) => null; |
| 21712 } | 21729 } |
| 21713 | 21730 |
| 21714 class LibraryElementBuilderTest extends EngineTestCase { | 21731 class LibraryElementBuilderTest extends EngineTestCase { |
| 21715 /** | 21732 /** |
| 21716 * The source factory used to create [Source]. | 21733 * The source factory used to create [Source]. |
| 21717 */ | 21734 */ |
| (...skipping 711 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 22429 "main() {", | 22446 "main() {", |
| 22430 " var myVar = (int p) => 'foo';", | 22447 " var myVar = (int p) => 'foo';", |
| 22431 " myVar(42);", | 22448 " myVar(42);", |
| 22432 "}"])); | 22449 "}"])); |
| 22433 LibraryElement library = resolve(source); | 22450 LibraryElement library = resolve(source); |
| 22434 JUnitTestCase.assertNotNull(library); | 22451 JUnitTestCase.assertNotNull(library); |
| 22435 CompilationUnit unit = analysisContext.getResolvedCompilationUnit(source, li
brary); | 22452 CompilationUnit unit = analysisContext.getResolvedCompilationUnit(source, li
brary); |
| 22436 JUnitTestCase.assertNotNull(unit); | 22453 JUnitTestCase.assertNotNull(unit); |
| 22437 List<bool> found = [false]; | 22454 List<bool> found = [false]; |
| 22438 List<AnalysisException> thrownException = new List<AnalysisException>(1); | 22455 List<AnalysisException> thrownException = new List<AnalysisException>(1); |
| 22439 unit.accept(new RecursiveASTVisitor_29(this, found, thrownException)); | 22456 unit.accept(new RecursiveASTVisitor_31(this, found, thrownException)); |
| 22440 if (thrownException[0] != null) { | 22457 if (thrownException[0] != null) { |
| 22441 throw new AnalysisException.con3(thrownException[0]); | 22458 throw new AnalysisException.con3(thrownException[0]); |
| 22442 } | 22459 } |
| 22443 JUnitTestCase.assertTrue(found[0]); | 22460 JUnitTestCase.assertTrue(found[0]); |
| 22444 } | 22461 } |
| 22445 | 22462 |
| 22446 void test_metadata_class() { | 22463 void test_metadata_class() { |
| 22447 Source source = addSource(EngineTestCase.createSource(["const A = null;", "@
A class C {}"])); | 22464 Source source = addSource(EngineTestCase.createSource(["const A = null;", "@
A class C {}"])); |
| 22448 LibraryElement library = resolve(source); | 22465 LibraryElement library = resolve(source); |
| 22449 JUnitTestCase.assertNotNull(library); | 22466 JUnitTestCase.assertNotNull(library); |
| (...skipping 375 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 22825 runJUnitTest(__test, __test.test_setter_inherited); | 22842 runJUnitTest(__test, __test.test_setter_inherited); |
| 22826 }); | 22843 }); |
| 22827 _ut.test('test_setter_static', () { | 22844 _ut.test('test_setter_static', () { |
| 22828 final __test = new SimpleResolverTest(); | 22845 final __test = new SimpleResolverTest(); |
| 22829 runJUnitTest(__test, __test.test_setter_static); | 22846 runJUnitTest(__test, __test.test_setter_static); |
| 22830 }); | 22847 }); |
| 22831 }); | 22848 }); |
| 22832 } | 22849 } |
| 22833 } | 22850 } |
| 22834 | 22851 |
| 22835 class RecursiveASTVisitor_29 extends RecursiveASTVisitor<Object> { | 22852 class RecursiveASTVisitor_31 extends RecursiveASTVisitor<Object> { |
| 22836 final SimpleResolverTest SimpleResolverTest_this; | 22853 final SimpleResolverTest SimpleResolverTest_this; |
| 22837 | 22854 |
| 22838 List<bool> found; | 22855 List<bool> found; |
| 22839 | 22856 |
| 22840 List<AnalysisException> thrownException; | 22857 List<AnalysisException> thrownException; |
| 22841 | 22858 |
| 22842 RecursiveASTVisitor_29(this.SimpleResolverTest_this, this.found, this.thrownEx
ception) : super(); | 22859 RecursiveASTVisitor_31(this.SimpleResolverTest_this, this.found, this.thrownEx
ception) : super(); |
| 22843 | 22860 |
| 22844 Object visitSimpleIdentifier(SimpleIdentifier node) { | 22861 Object visitSimpleIdentifier(SimpleIdentifier node) { |
| 22845 if (node.name == "myVar" && node.parent is MethodInvocation) { | 22862 if (node.name == "myVar" && node.parent is MethodInvocation) { |
| 22846 try { | 22863 try { |
| 22847 found[0] = true; | 22864 found[0] = true; |
| 22848 Type2 staticType = node.staticType; | 22865 Type2 staticType = node.staticType; |
| 22849 JUnitTestCase.assertSame(SimpleResolverTest_this.typeProvider.dynamicTyp
e, staticType); | 22866 JUnitTestCase.assertSame(SimpleResolverTest_this.typeProvider.dynamicTyp
e, staticType); |
| 22850 FunctionType propagatedType = node.propagatedType as FunctionType; | 22867 FunctionType propagatedType = node.propagatedType as FunctionType; |
| 22851 JUnitTestCase.assertEquals(SimpleResolverTest_this.typeProvider.stringTy
pe, propagatedType.returnType); | 22868 JUnitTestCase.assertEquals(SimpleResolverTest_this.typeProvider.stringTy
pe, propagatedType.returnType); |
| 22852 } on AnalysisException catch (e) { | 22869 } on AnalysisException catch (e) { |
| (...skipping 344 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 23197 // HintCodeTest.dartSuite(); | 23214 // HintCodeTest.dartSuite(); |
| 23198 // MemberMapTest.dartSuite(); | 23215 // MemberMapTest.dartSuite(); |
| 23199 // NonHintCodeTest.dartSuite(); | 23216 // NonHintCodeTest.dartSuite(); |
| 23200 // NonErrorResolverTest.dartSuite(); | 23217 // NonErrorResolverTest.dartSuite(); |
| 23201 // SimpleResolverTest.dartSuite(); | 23218 // SimpleResolverTest.dartSuite(); |
| 23202 // StaticTypeWarningCodeTest.dartSuite(); | 23219 // StaticTypeWarningCodeTest.dartSuite(); |
| 23203 // StaticWarningCodeTest.dartSuite(); | 23220 // StaticWarningCodeTest.dartSuite(); |
| 23204 // StrictModeTest.dartSuite(); | 23221 // StrictModeTest.dartSuite(); |
| 23205 // TypePropagationTest.dartSuite(); | 23222 // TypePropagationTest.dartSuite(); |
| 23206 } | 23223 } |
| OLD | NEW |