Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(764)

Side by Side Diff: pkg/analyzer_experimental/test/generated/resolver_test.dart

Issue 25373002: Issue 13584. Fix for Java/Dart local variable scoping mismatch. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 7 years, 2 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
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 1272 matching lines...) Expand 10 before | Expand all | Expand 10 after
1283 resolve(source); 1283 resolve(source);
1284 assertNoErrors(source); 1284 assertNoErrors(source);
1285 verify([source]); 1285 verify([source]);
1286 } 1286 }
1287 void test_constNotInitialized_local() { 1287 void test_constNotInitialized_local() {
1288 Source source = addSource(EngineTestCase.createSource(["main() {", " const int x = 0;", "}"])); 1288 Source source = addSource(EngineTestCase.createSource(["main() {", " const int x = 0;", "}"]));
1289 resolve(source); 1289 resolve(source);
1290 assertNoErrors(source); 1290 assertNoErrors(source);
1291 verify([source]); 1291 verify([source]);
1292 } 1292 }
1293 void test_constructorDeclaration_scope_signature() {
1294 Source source = addSource(EngineTestCase.createSource([
1295 "const app = 0;",
1296 "class A {",
1297 " A(@app int app) {}",
1298 "}"]));
1299 resolve(source);
1300 assertNoErrors(source);
1301 verify([source]);
1302 }
1293 void test_constWithNonConstantArgument_literals() { 1303 void test_constWithNonConstantArgument_literals() {
1294 Source source = addSource(EngineTestCase.createSource([ 1304 Source source = addSource(EngineTestCase.createSource([
1295 "class A {", 1305 "class A {",
1296 " const A(a, b, c, d);", 1306 " const A(a, b, c, d);",
1297 "}", 1307 "}",
1298 "f() { return const A(true, 0, 1.0, '2'); }"])); 1308 "f() { return const A(true, 0, 1.0, '2'); }"]));
1299 resolve(source); 1309 resolve(source);
1300 assertNoErrors(source); 1310 assertNoErrors(source);
1301 verify([source]); 1311 verify([source]);
1302 } 1312 }
(...skipping 223 matching lines...) Expand 10 before | Expand all | Expand 10 after
1526 Source source = addSource(EngineTestCase.createSource([ 1536 Source source = addSource(EngineTestCase.createSource([
1527 "class A {", 1537 "class A {",
1528 " final int x;", 1538 " final int x;",
1529 " A(this.x);", 1539 " A(this.x);",
1530 " A.named() : this (42);", 1540 " A.named() : this (42);",
1531 "}"])); 1541 "}"]));
1532 resolve(source); 1542 resolve(source);
1533 assertNoErrors(source); 1543 assertNoErrors(source);
1534 verify([source]); 1544 verify([source]);
1535 } 1545 }
1546 void test_functionDeclaration_scope_returnType() {
1547 Source source = addSource(EngineTestCase.createSource(["int f(int) {}"]));
1548 resolve(source);
1549 assertNoErrors(source);
1550 verify([source]);
1551 }
1552 void test_functionDeclaration_scope_signature() {
1553 Source source = addSource(EngineTestCase.createSource(["const app = 0;", "f( @app int app) {}"]));
1554 resolve(source);
1555 assertNoErrors(source);
1556 verify([source]);
1557 }
1558 void test_functionTypeAlias_scope_returnType() {
1559 Source source = addSource(EngineTestCase.createSource(["typedef int f(int);" ]));
1560 resolve(source);
1561 assertNoErrors(source);
1562 verify([source]);
1563 }
1564 void test_functionTypeAlias_scope_signature() {
1565 Source source = addSource(EngineTestCase.createSource(["const app = 0;", "ty pedef int f(@app int app);"]));
1566 resolve(source);
1567 assertNoErrors(source);
1568 verify([source]);
1569 }
1536 void test_implicitThisReferenceInInitializer_constructorName() { 1570 void test_implicitThisReferenceInInitializer_constructorName() {
1537 Source source = addSource(EngineTestCase.createSource([ 1571 Source source = addSource(EngineTestCase.createSource([
1538 "class A {", 1572 "class A {",
1539 " A.named() {}", 1573 " A.named() {}",
1540 "}", 1574 "}",
1541 "class B {", 1575 "class B {",
1542 " var v;", 1576 " var v;",
1543 " B() : v = new A.named();", 1577 " B() : v = new A.named();",
1544 "}"])); 1578 "}"]));
1545 resolve(source); 1579 resolve(source);
(...skipping 131 matching lines...) Expand 10 before | Expand all | Expand 10 after
1677 assertNoErrors(source); 1711 assertNoErrors(source);
1678 verify([source]); 1712 verify([source]);
1679 } 1713 }
1680 void test_importOfNonLibrary_libraryNotDeclared() { 1714 void test_importOfNonLibrary_libraryNotDeclared() {
1681 Source source = addSource(EngineTestCase.createSource(["library lib;", "impo rt 'part.dart';", "A a;"])); 1715 Source source = addSource(EngineTestCase.createSource(["library lib;", "impo rt 'part.dart';", "A a;"]));
1682 addSource2("/part.dart", EngineTestCase.createSource(["class A {}"])); 1716 addSource2("/part.dart", EngineTestCase.createSource(["class A {}"]));
1683 resolve(source); 1717 resolve(source);
1684 assertNoErrors(source); 1718 assertNoErrors(source);
1685 verify([source]); 1719 verify([source]);
1686 } 1720 }
1721 void test_importPrefixes_withFirstLetterDifference() {
1722 Source source = addSource(EngineTestCase.createSource([
1723 "library L;",
1724 "import 'lib1.dart' as math;",
1725 "import 'lib2.dart' as path;",
1726 "main() {",
1727 " math.test1();",
1728 " path.test2();",
1729 "}"]));
1730 addSource2("/lib1.dart", EngineTestCase.createSource(["library lib1;", "test 1() {}"]));
1731 addSource2("/lib2.dart", EngineTestCase.createSource(["library lib2;", "test 2() {}"]));
1732 resolve(source);
1733 assertNoErrors(source);
1734 verify([source]);
1735 }
1687 void test_inconsistentCaseExpressionTypes() { 1736 void test_inconsistentCaseExpressionTypes() {
1688 Source source = addSource(EngineTestCase.createSource([ 1737 Source source = addSource(EngineTestCase.createSource([
1689 "f(var p) {", 1738 "f(var p) {",
1690 " switch (p) {", 1739 " switch (p) {",
1691 " case 1:", 1740 " case 1:",
1692 " break;", 1741 " break;",
1693 " case 2:", 1742 " case 2:",
1694 " break;", 1743 " break;",
1695 " }", 1744 " }",
1696 "}"])); 1745 "}"]));
(...skipping 500 matching lines...) Expand 10 before | Expand all | Expand 10 after
2197 resolve(source); 2246 resolve(source);
2198 assertNoErrors(source); 2247 assertNoErrors(source);
2199 verify([source]); 2248 verify([source]);
2200 } 2249 }
2201 void test_memberWithClassName_setter() { 2250 void test_memberWithClassName_setter() {
2202 Source source = addSource(EngineTestCase.createSource(["class A {", " set A (v) {}", "}"])); 2251 Source source = addSource(EngineTestCase.createSource(["class A {", " set A (v) {}", "}"]));
2203 resolve(source); 2252 resolve(source);
2204 assertNoErrors(source); 2253 assertNoErrors(source);
2205 verify([source]); 2254 verify([source]);
2206 } 2255 }
2256 void test_methodDeclaration_scope_signature() {
2257 Source source = addSource(EngineTestCase.createSource([
2258 "const app = 0;",
2259 "class A {",
2260 " foo(@app int app) {}",
2261 "}"]));
2262 resolve(source);
2263 assertNoErrors(source);
2264 verify([source]);
2265 }
2207 void test_misMatchedGetterAndSetterTypes_instance_sameTypes() { 2266 void test_misMatchedGetterAndSetterTypes_instance_sameTypes() {
2208 Source source = addSource(EngineTestCase.createSource([ 2267 Source source = addSource(EngineTestCase.createSource([
2209 "class C {", 2268 "class C {",
2210 " int get x => 0;", 2269 " int get x => 0;",
2211 " set x(int v) {}", 2270 " set x(int v) {}",
2212 "}"])); 2271 "}"]));
2213 resolve(source); 2272 resolve(source);
2214 assertNoErrors(source); 2273 assertNoErrors(source);
2215 verify([source]); 2274 verify([source]);
2216 } 2275 }
(...skipping 1228 matching lines...) Expand 10 before | Expand all | Expand 10 after
3445 runJUnitTest(__test, __test.test_constWithTypeParameters_direct); 3504 runJUnitTest(__test, __test.test_constWithTypeParameters_direct);
3446 }); 3505 });
3447 _ut.test('test_constWithUndefinedConstructor', () { 3506 _ut.test('test_constWithUndefinedConstructor', () {
3448 final __test = new NonErrorResolverTest(); 3507 final __test = new NonErrorResolverTest();
3449 runJUnitTest(__test, __test.test_constWithUndefinedConstructor); 3508 runJUnitTest(__test, __test.test_constWithUndefinedConstructor);
3450 }); 3509 });
3451 _ut.test('test_constWithUndefinedConstructorDefault', () { 3510 _ut.test('test_constWithUndefinedConstructorDefault', () {
3452 final __test = new NonErrorResolverTest(); 3511 final __test = new NonErrorResolverTest();
3453 runJUnitTest(__test, __test.test_constWithUndefinedConstructorDefault); 3512 runJUnitTest(__test, __test.test_constWithUndefinedConstructorDefault);
3454 }); 3513 });
3514 _ut.test('test_constructorDeclaration_scope_signature', () {
3515 final __test = new NonErrorResolverTest();
3516 runJUnitTest(__test, __test.test_constructorDeclaration_scope_signature) ;
3517 });
3455 _ut.test('test_defaultValueInFunctionTypeAlias', () { 3518 _ut.test('test_defaultValueInFunctionTypeAlias', () {
3456 final __test = new NonErrorResolverTest(); 3519 final __test = new NonErrorResolverTest();
3457 runJUnitTest(__test, __test.test_defaultValueInFunctionTypeAlias); 3520 runJUnitTest(__test, __test.test_defaultValueInFunctionTypeAlias);
3458 }); 3521 });
3459 _ut.test('test_defaultValueInFunctionTypedParameter_named', () { 3522 _ut.test('test_defaultValueInFunctionTypedParameter_named', () {
3460 final __test = new NonErrorResolverTest(); 3523 final __test = new NonErrorResolverTest();
3461 runJUnitTest(__test, __test.test_defaultValueInFunctionTypedParameter_na med); 3524 runJUnitTest(__test, __test.test_defaultValueInFunctionTypedParameter_na med);
3462 }); 3525 });
3463 _ut.test('test_defaultValueInFunctionTypedParameter_optional', () { 3526 _ut.test('test_defaultValueInFunctionTypedParameter_optional', () {
3464 final __test = new NonErrorResolverTest(); 3527 final __test = new NonErrorResolverTest();
(...skipping 88 matching lines...) Expand 10 before | Expand all | Expand 10 after
3553 runJUnitTest(__test, __test.test_finalNotInitialized_hasNativeClause_noC onstructor); 3616 runJUnitTest(__test, __test.test_finalNotInitialized_hasNativeClause_noC onstructor);
3554 }); 3617 });
3555 _ut.test('test_finalNotInitialized_initializer', () { 3618 _ut.test('test_finalNotInitialized_initializer', () {
3556 final __test = new NonErrorResolverTest(); 3619 final __test = new NonErrorResolverTest();
3557 runJUnitTest(__test, __test.test_finalNotInitialized_initializer); 3620 runJUnitTest(__test, __test.test_finalNotInitialized_initializer);
3558 }); 3621 });
3559 _ut.test('test_finalNotInitialized_redirectingConstructor', () { 3622 _ut.test('test_finalNotInitialized_redirectingConstructor', () {
3560 final __test = new NonErrorResolverTest(); 3623 final __test = new NonErrorResolverTest();
3561 runJUnitTest(__test, __test.test_finalNotInitialized_redirectingConstruc tor); 3624 runJUnitTest(__test, __test.test_finalNotInitialized_redirectingConstruc tor);
3562 }); 3625 });
3626 _ut.test('test_functionDeclaration_scope_returnType', () {
3627 final __test = new NonErrorResolverTest();
3628 runJUnitTest(__test, __test.test_functionDeclaration_scope_returnType);
3629 });
3630 _ut.test('test_functionDeclaration_scope_signature', () {
3631 final __test = new NonErrorResolverTest();
3632 runJUnitTest(__test, __test.test_functionDeclaration_scope_signature);
3633 });
3634 _ut.test('test_functionTypeAlias_scope_returnType', () {
3635 final __test = new NonErrorResolverTest();
3636 runJUnitTest(__test, __test.test_functionTypeAlias_scope_returnType);
3637 });
3638 _ut.test('test_functionTypeAlias_scope_signature', () {
3639 final __test = new NonErrorResolverTest();
3640 runJUnitTest(__test, __test.test_functionTypeAlias_scope_signature);
3641 });
3563 _ut.test('test_implicitThisReferenceInInitializer_constructorName', () { 3642 _ut.test('test_implicitThisReferenceInInitializer_constructorName', () {
3564 final __test = new NonErrorResolverTest(); 3643 final __test = new NonErrorResolverTest();
3565 runJUnitTest(__test, __test.test_implicitThisReferenceInInitializer_cons tructorName); 3644 runJUnitTest(__test, __test.test_implicitThisReferenceInInitializer_cons tructorName);
3566 }); 3645 });
3567 _ut.test('test_implicitThisReferenceInInitializer_prefixedIdentifier', () { 3646 _ut.test('test_implicitThisReferenceInInitializer_prefixedIdentifier', () {
3568 final __test = new NonErrorResolverTest(); 3647 final __test = new NonErrorResolverTest();
3569 runJUnitTest(__test, __test.test_implicitThisReferenceInInitializer_pref ixedIdentifier); 3648 runJUnitTest(__test, __test.test_implicitThisReferenceInInitializer_pref ixedIdentifier);
3570 }); 3649 });
3571 _ut.test('test_implicitThisReferenceInInitializer_qualifiedMethodInvocatio n', () { 3650 _ut.test('test_implicitThisReferenceInInitializer_qualifiedMethodInvocatio n', () {
3572 final __test = new NonErrorResolverTest(); 3651 final __test = new NonErrorResolverTest();
(...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after
3609 runJUnitTest(__test, __test.test_importDuplicatedLibraryName); 3688 runJUnitTest(__test, __test.test_importDuplicatedLibraryName);
3610 }); 3689 });
3611 _ut.test('test_importOfNonLibrary_libraryDeclared', () { 3690 _ut.test('test_importOfNonLibrary_libraryDeclared', () {
3612 final __test = new NonErrorResolverTest(); 3691 final __test = new NonErrorResolverTest();
3613 runJUnitTest(__test, __test.test_importOfNonLibrary_libraryDeclared); 3692 runJUnitTest(__test, __test.test_importOfNonLibrary_libraryDeclared);
3614 }); 3693 });
3615 _ut.test('test_importOfNonLibrary_libraryNotDeclared', () { 3694 _ut.test('test_importOfNonLibrary_libraryNotDeclared', () {
3616 final __test = new NonErrorResolverTest(); 3695 final __test = new NonErrorResolverTest();
3617 runJUnitTest(__test, __test.test_importOfNonLibrary_libraryNotDeclared); 3696 runJUnitTest(__test, __test.test_importOfNonLibrary_libraryNotDeclared);
3618 }); 3697 });
3698 _ut.test('test_importPrefixes_withFirstLetterDifference', () {
3699 final __test = new NonErrorResolverTest();
3700 runJUnitTest(__test, __test.test_importPrefixes_withFirstLetterDifferenc e);
3701 });
3619 _ut.test('test_inconsistentCaseExpressionTypes', () { 3702 _ut.test('test_inconsistentCaseExpressionTypes', () {
3620 final __test = new NonErrorResolverTest(); 3703 final __test = new NonErrorResolverTest();
3621 runJUnitTest(__test, __test.test_inconsistentCaseExpressionTypes); 3704 runJUnitTest(__test, __test.test_inconsistentCaseExpressionTypes);
3622 }); 3705 });
3623 _ut.test('test_inconsistentMethodInheritance_accessors_typeParameter2', () { 3706 _ut.test('test_inconsistentMethodInheritance_accessors_typeParameter2', () {
3624 final __test = new NonErrorResolverTest(); 3707 final __test = new NonErrorResolverTest();
3625 runJUnitTest(__test, __test.test_inconsistentMethodInheritance_accessors _typeParameter2); 3708 runJUnitTest(__test, __test.test_inconsistentMethodInheritance_accessors _typeParameter2);
3626 }); 3709 });
3627 _ut.test('test_inconsistentMethodInheritance_accessors_typeParameters1', ( ) { 3710 _ut.test('test_inconsistentMethodInheritance_accessors_typeParameters1', ( ) {
3628 final __test = new NonErrorResolverTest(); 3711 final __test = new NonErrorResolverTest();
(...skipping 176 matching lines...) Expand 10 before | Expand all | Expand 10 after
3805 runJUnitTest(__test, __test.test_listElementTypeNotAssignable); 3888 runJUnitTest(__test, __test.test_listElementTypeNotAssignable);
3806 }); 3889 });
3807 _ut.test('test_mapKeyTypeNotAssignable', () { 3890 _ut.test('test_mapKeyTypeNotAssignable', () {
3808 final __test = new NonErrorResolverTest(); 3891 final __test = new NonErrorResolverTest();
3809 runJUnitTest(__test, __test.test_mapKeyTypeNotAssignable); 3892 runJUnitTest(__test, __test.test_mapKeyTypeNotAssignable);
3810 }); 3893 });
3811 _ut.test('test_memberWithClassName_setter', () { 3894 _ut.test('test_memberWithClassName_setter', () {
3812 final __test = new NonErrorResolverTest(); 3895 final __test = new NonErrorResolverTest();
3813 runJUnitTest(__test, __test.test_memberWithClassName_setter); 3896 runJUnitTest(__test, __test.test_memberWithClassName_setter);
3814 }); 3897 });
3898 _ut.test('test_methodDeclaration_scope_signature', () {
3899 final __test = new NonErrorResolverTest();
3900 runJUnitTest(__test, __test.test_methodDeclaration_scope_signature);
3901 });
3815 _ut.test('test_misMatchedGetterAndSetterTypes_instance_sameTypes', () { 3902 _ut.test('test_misMatchedGetterAndSetterTypes_instance_sameTypes', () {
3816 final __test = new NonErrorResolverTest(); 3903 final __test = new NonErrorResolverTest();
3817 runJUnitTest(__test, __test.test_misMatchedGetterAndSetterTypes_instance _sameTypes); 3904 runJUnitTest(__test, __test.test_misMatchedGetterAndSetterTypes_instance _sameTypes);
3818 }); 3905 });
3819 _ut.test('test_misMatchedGetterAndSetterTypes_instance_unspecifiedGetter', () { 3906 _ut.test('test_misMatchedGetterAndSetterTypes_instance_unspecifiedGetter', () {
3820 final __test = new NonErrorResolverTest(); 3907 final __test = new NonErrorResolverTest();
3821 runJUnitTest(__test, __test.test_misMatchedGetterAndSetterTypes_instance _unspecifiedGetter); 3908 runJUnitTest(__test, __test.test_misMatchedGetterAndSetterTypes_instance _unspecifiedGetter);
3822 }); 3909 });
3823 _ut.test('test_misMatchedGetterAndSetterTypes_instance_unspecifiedSetter', () { 3910 _ut.test('test_misMatchedGetterAndSetterTypes_instance_unspecifiedSetter', () {
3824 final __test = new NonErrorResolverTest(); 3911 final __test = new NonErrorResolverTest();
(...skipping 2786 matching lines...) Expand 10 before | Expand all | Expand 10 after
6611 } 6698 }
6612 6699
6613 /** 6700 /**
6614 * Assert that no errors have been reported against the given source. 6701 * Assert that no errors have been reported against the given source.
6615 * 6702 *
6616 * @param source the source against which no errors should have been reported 6703 * @param source the source against which no errors should have been reported
6617 * @throws AnalysisException if the reported errors could not be computed 6704 * @throws AnalysisException if the reported errors could not be computed
6618 * @throws AssertionFailedError if any errors have been reported 6705 * @throws AssertionFailedError if any errors have been reported
6619 */ 6706 */
6620 void assertNoErrors(Source source) { 6707 void assertNoErrors(Source source) {
6621 EngineTestCase.assertLength(0, analysisContext.computeErrors(source)); 6708 assertErrors(source, []);
6622 } 6709 }
6623 6710
6624 /** 6711 /**
6625 * Cache the source file content in the source factory but don't add the sourc e to the analysis 6712 * Cache the source file content in the source factory but don't add the sourc e to the analysis
6626 * context. The file path should be absolute. 6713 * context. The file path should be absolute.
6627 * 6714 *
6628 * @param filePath the path of the file being cached 6715 * @param filePath the path of the file being cached
6629 * @param contents the contents to be returned by the content provider for the specified file 6716 * @param contents the contents to be returned by the content provider for the specified file
6630 * @return the source object representing the cached file 6717 * @return the source object representing the cached file
6631 */ 6718 */
(...skipping 10025 matching lines...) Expand 10 before | Expand all | Expand 10 after
16657 /** 16744 /**
16658 * Create a function expression that has an element associated with it, where the element has an 16745 * Create a function expression that has an element associated with it, where the element has an
16659 * incomplete type associated with it (just like the one 16746 * incomplete type associated with it (just like the one
16660 * [ElementBuilder#visitFunctionExpression] would have built if we had 16747 * [ElementBuilder#visitFunctionExpression] would have built if we had
16661 * run it). 16748 * run it).
16662 * 16749 *
16663 * @param parameters the parameters to the function 16750 * @param parameters the parameters to the function
16664 * @param body the body of the function 16751 * @param body the body of the function
16665 * @return a resolved function expression 16752 * @return a resolved function expression
16666 */ 16753 */
16667 FunctionExpression resolvedFunctionExpression(FormalParameterList parameters2, FunctionBody body) { 16754 FunctionExpression resolvedFunctionExpression(FormalParameterList parameters, FunctionBody body) {
16668 List<ParameterElement> parameterElements = new List<ParameterElement>(); 16755 List<ParameterElement> parameterElements = new List<ParameterElement>();
16669 for (FormalParameter parameter in parameters2.parameters) { 16756 for (FormalParameter parameter in parameters.parameters) {
16670 ParameterElementImpl element = new ParameterElementImpl.con1(parameter.ide ntifier); 16757 ParameterElementImpl element = new ParameterElementImpl.con1(parameter.ide ntifier);
16671 element.parameterKind = parameter.kind; 16758 element.parameterKind = parameter.kind;
16672 element.type = _typeProvider.dynamicType; 16759 element.type = _typeProvider.dynamicType;
16673 parameter.identifier.staticElement = element; 16760 parameter.identifier.staticElement = element;
16674 parameterElements.add(element); 16761 parameterElements.add(element);
16675 } 16762 }
16676 FunctionExpression node = ASTFactory.functionExpression2(parameters2, body); 16763 FunctionExpression node = ASTFactory.functionExpression2(parameters, body);
16677 FunctionElementImpl element = new FunctionElementImpl.con1(null); 16764 FunctionElementImpl element = new FunctionElementImpl.con1(null);
16678 element.parameters = new List.from(parameterElements); 16765 element.parameters = new List.from(parameterElements);
16679 element.type = new FunctionTypeImpl.con1(element); 16766 element.type = new FunctionTypeImpl.con1(element);
16680 node.element = element; 16767 node.element = element;
16681 return node; 16768 return node;
16682 } 16769 }
16683 16770
16684 /** 16771 /**
16685 * Return an integer literal that has been resolved to the correct type. 16772 * Return an integer literal that has been resolved to the correct type.
16686 * 16773 *
(...skipping 18 matching lines...) Expand all
16705 return string; 16792 return string;
16706 } 16793 }
16707 16794
16708 /** 16795 /**
16709 * Return a simple identifier that has been resolved to a variable element wit h the given type. 16796 * Return a simple identifier that has been resolved to a variable element wit h the given type.
16710 * 16797 *
16711 * @param type the type of the variable being represented 16798 * @param type the type of the variable being represented
16712 * @param variableName the name of the variable 16799 * @param variableName the name of the variable
16713 * @return a simple identifier that has been resolved to a variable element wi th the given type 16800 * @return a simple identifier that has been resolved to a variable element wi th the given type
16714 */ 16801 */
16715 SimpleIdentifier resolvedVariable(InterfaceType type2, String variableName) { 16802 SimpleIdentifier resolvedVariable(InterfaceType type, String variableName) {
16716 SimpleIdentifier identifier = ASTFactory.identifier3(variableName); 16803 SimpleIdentifier identifier = ASTFactory.identifier3(variableName);
16717 VariableElementImpl element = ElementFactory.localVariableElement(identifier ); 16804 VariableElementImpl element = ElementFactory.localVariableElement(identifier );
16718 element.type = type2; 16805 element.type = type;
16719 identifier.staticElement = element; 16806 identifier.staticElement = element;
16720 identifier.staticType = type2; 16807 identifier.staticType = type;
16721 return identifier; 16808 return identifier;
16722 } 16809 }
16723 16810
16724 /** 16811 /**
16725 * Set the type of the given parameter to the given type. 16812 * Set the type of the given parameter to the given type.
16726 * 16813 *
16727 * @param parameter the parameter whose type is to be set 16814 * @param parameter the parameter whose type is to be set
16728 * @param type the new type of the given parameter 16815 * @param type the new type of the given parameter
16729 */ 16816 */
16730 void setType(FormalParameter parameter, Type2 type2) { 16817 void setType(FormalParameter parameter, Type2 type) {
16731 SimpleIdentifier identifier = parameter.identifier; 16818 SimpleIdentifier identifier = parameter.identifier;
16732 Element element = identifier.staticElement; 16819 Element element = identifier.staticElement;
16733 if (element is! ParameterElement) { 16820 if (element is! ParameterElement) {
16734 element = new ParameterElementImpl.con1(identifier); 16821 element = new ParameterElementImpl.con1(identifier);
16735 identifier.staticElement = element; 16822 identifier.staticElement = element;
16736 } 16823 }
16737 ((element as ParameterElementImpl)).type = type2; 16824 ((element as ParameterElementImpl)).type = type;
16738 } 16825 }
16739 static dartSuite() { 16826 static dartSuite() {
16740 _ut.group('StaticTypeAnalyzerTest', () { 16827 _ut.group('StaticTypeAnalyzerTest', () {
16741 _ut.test('test_visitAdjacentStrings', () { 16828 _ut.test('test_visitAdjacentStrings', () {
16742 final __test = new StaticTypeAnalyzerTest(); 16829 final __test = new StaticTypeAnalyzerTest();
16743 runJUnitTest(__test, __test.test_visitAdjacentStrings); 16830 runJUnitTest(__test, __test.test_visitAdjacentStrings);
16744 }); 16831 });
16745 _ut.test('test_visitArgumentDefinitionTest', () { 16832 _ut.test('test_visitArgumentDefinitionTest', () {
16746 final __test = new StaticTypeAnalyzerTest(); 16833 final __test = new StaticTypeAnalyzerTest();
16747 runJUnitTest(__test, __test.test_visitArgumentDefinitionTest); 16834 runJUnitTest(__test, __test.test_visitArgumentDefinitionTest);
(...skipping 1779 matching lines...) Expand 10 before | Expand all | Expand 10 after
18527 // ErrorResolverTest.dartSuite(); 18614 // ErrorResolverTest.dartSuite();
18528 // HintCodeTest.dartSuite(); 18615 // HintCodeTest.dartSuite();
18529 // NonHintCodeTest.dartSuite(); 18616 // NonHintCodeTest.dartSuite();
18530 // NonErrorResolverTest.dartSuite(); 18617 // NonErrorResolverTest.dartSuite();
18531 // SimpleResolverTest.dartSuite(); 18618 // SimpleResolverTest.dartSuite();
18532 // StaticTypeWarningCodeTest.dartSuite(); 18619 // StaticTypeWarningCodeTest.dartSuite();
18533 // StaticWarningCodeTest.dartSuite(); 18620 // StaticWarningCodeTest.dartSuite();
18534 // StrictModeTest.dartSuite(); 18621 // StrictModeTest.dartSuite();
18535 // TypePropagationTest.dartSuite(); 18622 // TypePropagationTest.dartSuite();
18536 } 18623 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698