| 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 21655 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 21666 final __test = new NonHintCodeTest(); | 21666 final __test = new NonHintCodeTest(); |
| 21667 runJUnitTest(__test, __test.test_unusedImport_prefix_topLevelFunction); | 21667 runJUnitTest(__test, __test.test_unusedImport_prefix_topLevelFunction); |
| 21668 }); | 21668 }); |
| 21669 }); | 21669 }); |
| 21670 } | 21670 } |
| 21671 } | 21671 } |
| 21672 | 21672 |
| 21673 class EnclosedScopeTest extends ResolverTestCase { | 21673 class EnclosedScopeTest extends ResolverTestCase { |
| 21674 void test_define_duplicate() { | 21674 void test_define_duplicate() { |
| 21675 GatheringErrorListener errorListener2 = new GatheringErrorListener(); | 21675 GatheringErrorListener errorListener2 = new GatheringErrorListener(); |
| 21676 Scope rootScope = new Scope_32(errorListener2); | 21676 Scope rootScope = new Scope_EnclosedScopeTest_test_define_duplicate(errorLis
tener2); |
| 21677 EnclosedScope scope = new EnclosedScope(rootScope); | 21677 EnclosedScope scope = new EnclosedScope(rootScope); |
| 21678 VariableElement element1 = ElementFactory.localVariableElement(ASTFactory.id
entifier3("v1")); | 21678 VariableElement element1 = ElementFactory.localVariableElement(ASTFactory.id
entifier3("v1")); |
| 21679 VariableElement element2 = ElementFactory.localVariableElement(ASTFactory.id
entifier3("v1")); | 21679 VariableElement element2 = ElementFactory.localVariableElement(ASTFactory.id
entifier3("v1")); |
| 21680 scope.define(element1); | 21680 scope.define(element1); |
| 21681 scope.define(element2); | 21681 scope.define(element2); |
| 21682 errorListener2.assertErrors3([ErrorSeverity.ERROR]); | 21682 errorListener2.assertErrors3([ErrorSeverity.ERROR]); |
| 21683 } | 21683 } |
| 21684 | 21684 |
| 21685 void test_define_normal() { | 21685 void test_define_normal() { |
| 21686 GatheringErrorListener errorListener3 = new GatheringErrorListener(); | 21686 GatheringErrorListener errorListener3 = new GatheringErrorListener(); |
| 21687 Scope rootScope = new Scope_33(errorListener3); | 21687 Scope rootScope = new Scope_EnclosedScopeTest_test_define_normal(errorListen
er3); |
| 21688 EnclosedScope outerScope = new EnclosedScope(rootScope); | 21688 EnclosedScope outerScope = new EnclosedScope(rootScope); |
| 21689 EnclosedScope innerScope = new EnclosedScope(outerScope); | 21689 EnclosedScope innerScope = new EnclosedScope(outerScope); |
| 21690 VariableElement element1 = ElementFactory.localVariableElement(ASTFactory.id
entifier3("v1")); | 21690 VariableElement element1 = ElementFactory.localVariableElement(ASTFactory.id
entifier3("v1")); |
| 21691 VariableElement element2 = ElementFactory.localVariableElement(ASTFactory.id
entifier3("v2")); | 21691 VariableElement element2 = ElementFactory.localVariableElement(ASTFactory.id
entifier3("v2")); |
| 21692 outerScope.define(element1); | 21692 outerScope.define(element1); |
| 21693 innerScope.define(element2); | 21693 innerScope.define(element2); |
| 21694 errorListener3.assertNoErrors(); | 21694 errorListener3.assertNoErrors(); |
| 21695 } | 21695 } |
| 21696 | 21696 |
| 21697 static dartSuite() { | 21697 static dartSuite() { |
| 21698 _ut.group('EnclosedScopeTest', () { | 21698 _ut.group('EnclosedScopeTest', () { |
| 21699 _ut.test('test_define_duplicate', () { | 21699 _ut.test('test_define_duplicate', () { |
| 21700 final __test = new EnclosedScopeTest(); | 21700 final __test = new EnclosedScopeTest(); |
| 21701 runJUnitTest(__test, __test.test_define_duplicate); | 21701 runJUnitTest(__test, __test.test_define_duplicate); |
| 21702 }); | 21702 }); |
| 21703 _ut.test('test_define_normal', () { | 21703 _ut.test('test_define_normal', () { |
| 21704 final __test = new EnclosedScopeTest(); | 21704 final __test = new EnclosedScopeTest(); |
| 21705 runJUnitTest(__test, __test.test_define_normal); | 21705 runJUnitTest(__test, __test.test_define_normal); |
| 21706 }); | 21706 }); |
| 21707 }); | 21707 }); |
| 21708 } | 21708 } |
| 21709 } | 21709 } |
| 21710 | 21710 |
| 21711 class Scope_32 extends Scope { | 21711 class Scope_EnclosedScopeTest_test_define_duplicate extends Scope { |
| 21712 GatheringErrorListener errorListener2; | 21712 GatheringErrorListener errorListener2; |
| 21713 | 21713 |
| 21714 Scope_32(this.errorListener2) : super(); | 21714 Scope_EnclosedScopeTest_test_define_duplicate(this.errorListener2) : super(); |
| 21715 | 21715 |
| 21716 AnalysisErrorListener get errorListener => errorListener2; | 21716 AnalysisErrorListener get errorListener => errorListener2; |
| 21717 | 21717 |
| 21718 Element lookup3(Identifier identifier, String name, LibraryElement referencing
Library) => null; | 21718 Element lookup3(Identifier identifier, String name, LibraryElement referencing
Library) => null; |
| 21719 } | 21719 } |
| 21720 | 21720 |
| 21721 class Scope_33 extends Scope { | 21721 class Scope_EnclosedScopeTest_test_define_normal extends Scope { |
| 21722 GatheringErrorListener errorListener3; | 21722 GatheringErrorListener errorListener3; |
| 21723 | 21723 |
| 21724 Scope_33(this.errorListener3) : super(); | 21724 Scope_EnclosedScopeTest_test_define_normal(this.errorListener3) : super(); |
| 21725 | 21725 |
| 21726 AnalysisErrorListener get errorListener => errorListener3; | 21726 AnalysisErrorListener get errorListener => errorListener3; |
| 21727 | 21727 |
| 21728 Element lookup3(Identifier identifier, String name, LibraryElement referencing
Library) => null; | 21728 Element lookup3(Identifier identifier, String name, LibraryElement referencing
Library) => null; |
| 21729 } | 21729 } |
| 21730 | 21730 |
| 21731 class LibraryElementBuilderTest extends EngineTestCase { | 21731 class LibraryElementBuilderTest extends EngineTestCase { |
| 21732 /** | 21732 /** |
| 21733 * The source factory used to create [Source]. | 21733 * The source factory used to create [Source]. |
| 21734 */ | 21734 */ |
| (...skipping 711 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 22446 "main() {", | 22446 "main() {", |
| 22447 " var myVar = (int p) => 'foo';", | 22447 " var myVar = (int p) => 'foo';", |
| 22448 " myVar(42);", | 22448 " myVar(42);", |
| 22449 "}"])); | 22449 "}"])); |
| 22450 LibraryElement library = resolve(source); | 22450 LibraryElement library = resolve(source); |
| 22451 JUnitTestCase.assertNotNull(library); | 22451 JUnitTestCase.assertNotNull(library); |
| 22452 CompilationUnit unit = analysisContext.getResolvedCompilationUnit(source, li
brary); | 22452 CompilationUnit unit = analysisContext.getResolvedCompilationUnit(source, li
brary); |
| 22453 JUnitTestCase.assertNotNull(unit); | 22453 JUnitTestCase.assertNotNull(unit); |
| 22454 List<bool> found = [false]; | 22454 List<bool> found = [false]; |
| 22455 List<AnalysisException> thrownException = new List<AnalysisException>(1); | 22455 List<AnalysisException> thrownException = new List<AnalysisException>(1); |
| 22456 unit.accept(new RecursiveASTVisitor_36(this, found, thrownException)); | 22456 unit.accept(new RecursiveASTVisitor_SimpleResolverTest_test_localVariable_ty
pes_invoked(this, found, thrownException)); |
| 22457 if (thrownException[0] != null) { | 22457 if (thrownException[0] != null) { |
| 22458 throw new AnalysisException.con3(thrownException[0]); | 22458 throw new AnalysisException.con3(thrownException[0]); |
| 22459 } | 22459 } |
| 22460 JUnitTestCase.assertTrue(found[0]); | 22460 JUnitTestCase.assertTrue(found[0]); |
| 22461 } | 22461 } |
| 22462 | 22462 |
| 22463 void test_metadata_class() { | 22463 void test_metadata_class() { |
| 22464 Source source = addSource(EngineTestCase.createSource(["const A = null;", "@
A class C {}"])); | 22464 Source source = addSource(EngineTestCase.createSource(["const A = null;", "@
A class C {}"])); |
| 22465 LibraryElement library = resolve(source); | 22465 LibraryElement library = resolve(source); |
| 22466 JUnitTestCase.assertNotNull(library); | 22466 JUnitTestCase.assertNotNull(library); |
| (...skipping 375 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 22842 runJUnitTest(__test, __test.test_setter_inherited); | 22842 runJUnitTest(__test, __test.test_setter_inherited); |
| 22843 }); | 22843 }); |
| 22844 _ut.test('test_setter_static', () { | 22844 _ut.test('test_setter_static', () { |
| 22845 final __test = new SimpleResolverTest(); | 22845 final __test = new SimpleResolverTest(); |
| 22846 runJUnitTest(__test, __test.test_setter_static); | 22846 runJUnitTest(__test, __test.test_setter_static); |
| 22847 }); | 22847 }); |
| 22848 }); | 22848 }); |
| 22849 } | 22849 } |
| 22850 } | 22850 } |
| 22851 | 22851 |
| 22852 class RecursiveASTVisitor_36 extends RecursiveASTVisitor<Object> { | 22852 class RecursiveASTVisitor_SimpleResolverTest_test_localVariable_types_invoked ex
tends RecursiveASTVisitor<Object> { |
| 22853 final SimpleResolverTest SimpleResolverTest_this; | 22853 final SimpleResolverTest SimpleResolverTest_this; |
| 22854 | 22854 |
| 22855 List<bool> found; | 22855 List<bool> found; |
| 22856 | 22856 |
| 22857 List<AnalysisException> thrownException; | 22857 List<AnalysisException> thrownException; |
| 22858 | 22858 |
| 22859 RecursiveASTVisitor_36(this.SimpleResolverTest_this, this.found, this.thrownEx
ception) : super(); | 22859 RecursiveASTVisitor_SimpleResolverTest_test_localVariable_types_invoked(this.S
impleResolverTest_this, this.found, this.thrownException) : super(); |
| 22860 | 22860 |
| 22861 Object visitSimpleIdentifier(SimpleIdentifier node) { | 22861 Object visitSimpleIdentifier(SimpleIdentifier node) { |
| 22862 if (node.name == "myVar" && node.parent is MethodInvocation) { | 22862 if (node.name == "myVar" && node.parent is MethodInvocation) { |
| 22863 try { | 22863 try { |
| 22864 found[0] = true; | 22864 found[0] = true; |
| 22865 Type2 staticType = node.staticType; | 22865 Type2 staticType = node.staticType; |
| 22866 JUnitTestCase.assertSame(SimpleResolverTest_this.typeProvider.dynamicTyp
e, staticType); | 22866 JUnitTestCase.assertSame(SimpleResolverTest_this.typeProvider.dynamicTyp
e, staticType); |
| 22867 FunctionType propagatedType = node.propagatedType as FunctionType; | 22867 FunctionType propagatedType = node.propagatedType as FunctionType; |
| 22868 JUnitTestCase.assertEquals(SimpleResolverTest_this.typeProvider.stringTy
pe, propagatedType.returnType); | 22868 JUnitTestCase.assertEquals(SimpleResolverTest_this.typeProvider.stringTy
pe, propagatedType.returnType); |
| 22869 } on AnalysisException catch (e) { | 22869 } on AnalysisException catch (e) { |
| (...skipping 344 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 23214 // HintCodeTest.dartSuite(); | 23214 // HintCodeTest.dartSuite(); |
| 23215 // MemberMapTest.dartSuite(); | 23215 // MemberMapTest.dartSuite(); |
| 23216 // NonHintCodeTest.dartSuite(); | 23216 // NonHintCodeTest.dartSuite(); |
| 23217 // NonErrorResolverTest.dartSuite(); | 23217 // NonErrorResolverTest.dartSuite(); |
| 23218 // SimpleResolverTest.dartSuite(); | 23218 // SimpleResolverTest.dartSuite(); |
| 23219 // StaticTypeWarningCodeTest.dartSuite(); | 23219 // StaticTypeWarningCodeTest.dartSuite(); |
| 23220 // StaticWarningCodeTest.dartSuite(); | 23220 // StaticWarningCodeTest.dartSuite(); |
| 23221 // StrictModeTest.dartSuite(); | 23221 // StrictModeTest.dartSuite(); |
| 23222 // TypePropagationTest.dartSuite(); | 23222 // TypePropagationTest.dartSuite(); |
| 23223 } | 23223 } |
| OLD | NEW |