| OLD | NEW |
| 1 // Copyright (c) 2014, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2014, the Dart project authors. Please see the AUTHORS file |
| 2 // for details. All rights reserved. Use of this source code is governed by a | 2 // for details. All rights reserved. Use of this source code is governed by a |
| 3 // BSD-style license that can be found in the LICENSE file. | 3 // BSD-style license that can be found in the LICENSE file. |
| 4 | 4 |
| 5 // This code was auto-generated, is not intended to be edited, and is subject to | 5 // This code was auto-generated, is not intended to be edited, and is subject to |
| 6 // significant change. Please see the README file for more information. | 6 // significant change. Please see the README file for more information. |
| 7 | 7 |
| 8 library engine.all_the_rest_test; | 8 library engine.all_the_rest_test; |
| 9 | 9 |
| 10 import 'dart:collection'; | 10 import 'dart:collection'; |
| (...skipping 459 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 470 ClassElement classElement = mainUnitElement.getType("MyDirective"); | 470 ClassElement classElement = mainUnitElement.getType("MyDirective"); |
| 471 AngularDecoratorElement directive = | 471 AngularDecoratorElement directive = |
| 472 getAngularElement(classElement, (e) => e is AngularDecoratorElement); | 472 getAngularElement(classElement, (e) => e is AngularDecoratorElement); |
| 473 expect(directive, isNotNull); | 473 expect(directive, isNotNull); |
| 474 // verify | 474 // verify |
| 475 expect(directive.name, null); | 475 expect(directive.name, null); |
| 476 expect(directive.nameOffset, -1); | 476 expect(directive.nameOffset, -1); |
| 477 _assertHasAttributeSelector(directive.selector, "my-dir"); | 477 _assertHasAttributeSelector(directive.selector, "my-dir"); |
| 478 // verify properties | 478 // verify properties |
| 479 List<AngularPropertyElement> properties = directive.properties; | 479 List<AngularPropertyElement> properties = directive.properties; |
| 480 EngineTestCase.assertLength(3, properties); | 480 expect(properties, hasLength(3)); |
| 481 _assertProperty( | 481 _assertProperty( |
| 482 properties[0], | 482 properties[0], |
| 483 "my-dir", | 483 "my-dir", |
| 484 findMainOffset("my-dir' :"), | 484 findMainOffset("my-dir' :"), |
| 485 AngularPropertyKind.ONE_WAY, | 485 AngularPropertyKind.ONE_WAY, |
| 486 "myPropA", | 486 "myPropA", |
| 487 findMainOffset("myPropA'")); | 487 findMainOffset("myPropA'")); |
| 488 _assertProperty( | 488 _assertProperty( |
| 489 properties[1], | 489 properties[1], |
| 490 ".", | 490 ".", |
| (...skipping 281 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 772 }) | 772 }) |
| 773 class MyComponent extends MySuper { | 773 class MyComponent extends MySuper { |
| 774 }''')); | 774 }''')); |
| 775 // prepare AngularComponentElement | 775 // prepare AngularComponentElement |
| 776 ClassElement classElement = mainUnitElement.getType("MyComponent"); | 776 ClassElement classElement = mainUnitElement.getType("MyComponent"); |
| 777 AngularComponentElement component = | 777 AngularComponentElement component = |
| 778 getAngularElement(classElement, (e) => e is AngularComponentElement); | 778 getAngularElement(classElement, (e) => e is AngularComponentElement); |
| 779 expect(component, isNotNull); | 779 expect(component, isNotNull); |
| 780 // verify | 780 // verify |
| 781 List<AngularPropertyElement> properties = component.properties; | 781 List<AngularPropertyElement> properties = component.properties; |
| 782 EngineTestCase.assertLength(1, properties); | 782 expect(properties, hasLength(1)); |
| 783 _assertProperty( | 783 _assertProperty( |
| 784 properties[0], | 784 properties[0], |
| 785 "prop-a", | 785 "prop-a", |
| 786 findMainOffset("prop-a' :"), | 786 findMainOffset("prop-a' :"), |
| 787 AngularPropertyKind.ATTR, | 787 AngularPropertyKind.ATTR, |
| 788 "myPropA", | 788 "myPropA", |
| 789 findMainOffset("myPropA'")); | 789 findMainOffset("myPropA'")); |
| 790 } | 790 } |
| 791 | 791 |
| 792 void test_NgComponent_properties_fromFields() { | 792 void test_NgComponent_properties_fromFields() { |
| (...skipping 15 matching lines...) Expand all Loading... |
| 808 @NgTwoWay('prop-e') | 808 @NgTwoWay('prop-e') |
| 809 var myPropE; | 809 var myPropE; |
| 810 }''')); | 810 }''')); |
| 811 // prepare AngularComponentElement | 811 // prepare AngularComponentElement |
| 812 ClassElement classElement = mainUnitElement.getType("MyComponent"); | 812 ClassElement classElement = mainUnitElement.getType("MyComponent"); |
| 813 AngularComponentElement component = | 813 AngularComponentElement component = |
| 814 getAngularElement(classElement, (e) => e is AngularComponentElement); | 814 getAngularElement(classElement, (e) => e is AngularComponentElement); |
| 815 expect(component, isNotNull); | 815 expect(component, isNotNull); |
| 816 // verify | 816 // verify |
| 817 List<AngularPropertyElement> properties = component.properties; | 817 List<AngularPropertyElement> properties = component.properties; |
| 818 EngineTestCase.assertLength(5, properties); | 818 expect(properties, hasLength(5)); |
| 819 _assertProperty( | 819 _assertProperty( |
| 820 properties[0], | 820 properties[0], |
| 821 "prop-a", | 821 "prop-a", |
| 822 findMainOffset("prop-a')"), | 822 findMainOffset("prop-a')"), |
| 823 AngularPropertyKind.ATTR, | 823 AngularPropertyKind.ATTR, |
| 824 "myPropA", | 824 "myPropA", |
| 825 -1); | 825 -1); |
| 826 _assertProperty( | 826 _assertProperty( |
| 827 properties[1], | 827 properties[1], |
| 828 "prop-b", | 828 "prop-b", |
| (...skipping 45 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 874 var myPropD; | 874 var myPropD; |
| 875 var myPropE; | 875 var myPropE; |
| 876 }''')); | 876 }''')); |
| 877 // prepare AngularComponentElement | 877 // prepare AngularComponentElement |
| 878 ClassElement classElement = mainUnitElement.getType("MyComponent"); | 878 ClassElement classElement = mainUnitElement.getType("MyComponent"); |
| 879 AngularComponentElement component = | 879 AngularComponentElement component = |
| 880 getAngularElement(classElement, (e) => e is AngularComponentElement); | 880 getAngularElement(classElement, (e) => e is AngularComponentElement); |
| 881 expect(component, isNotNull); | 881 expect(component, isNotNull); |
| 882 // verify | 882 // verify |
| 883 List<AngularPropertyElement> properties = component.properties; | 883 List<AngularPropertyElement> properties = component.properties; |
| 884 EngineTestCase.assertLength(5, properties); | 884 expect(properties, hasLength(5)); |
| 885 _assertProperty( | 885 _assertProperty( |
| 886 properties[0], | 886 properties[0], |
| 887 "prop-a", | 887 "prop-a", |
| 888 findMainOffset("prop-a' :"), | 888 findMainOffset("prop-a' :"), |
| 889 AngularPropertyKind.ATTR, | 889 AngularPropertyKind.ATTR, |
| 890 "myPropA", | 890 "myPropA", |
| 891 findMainOffset("myPropA'")); | 891 findMainOffset("myPropA'")); |
| 892 _assertProperty( | 892 _assertProperty( |
| 893 properties[1], | 893 properties[1], |
| 894 "prop-b", | 894 "prop-b", |
| (...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 934 getAngularElement(classElement, (e) => e is AngularComponentElement); | 934 getAngularElement(classElement, (e) => e is AngularComponentElement); |
| 935 expect(component, isNotNull); | 935 expect(component, isNotNull); |
| 936 // verify | 936 // verify |
| 937 expect(component.name, "ctrl"); | 937 expect(component.name, "ctrl"); |
| 938 expect(component.nameOffset, AngularTest.findOffset(mainContent, "ctrl'")); | 938 expect(component.nameOffset, AngularTest.findOffset(mainContent, "ctrl'")); |
| 939 _assertIsTagSelector(component.selector, "myComp"); | 939 _assertIsTagSelector(component.selector, "myComp"); |
| 940 expect(component.templateUri, "my_template.html"); | 940 expect(component.templateUri, "my_template.html"); |
| 941 expect(component.templateUriOffset, AngularTest.findOffset(mainContent, "my_
template.html'")); | 941 expect(component.templateUriOffset, AngularTest.findOffset(mainContent, "my_
template.html'")); |
| 942 expect(component.styleUri, "my_styles.css"); | 942 expect(component.styleUri, "my_styles.css"); |
| 943 expect(component.styleUriOffset, AngularTest.findOffset(mainContent, "my_sty
les.css'")); | 943 expect(component.styleUriOffset, AngularTest.findOffset(mainContent, "my_sty
les.css'")); |
| 944 EngineTestCase.assertLength(0, component.properties); | 944 expect(component.properties, hasLength(0)); |
| 945 } | 945 } |
| 946 | 946 |
| 947 void test_NgComponent_scopeProperties() { | 947 void test_NgComponent_scopeProperties() { |
| 948 contextHelper.addSource("/my_template.html", ""); | 948 contextHelper.addSource("/my_template.html", ""); |
| 949 contextHelper.addSource("/my_styles.css", ""); | 949 contextHelper.addSource("/my_styles.css", ""); |
| 950 String mainContent = _createAngularSource(r''' | 950 String mainContent = _createAngularSource(r''' |
| 951 @Component(publishAs: 'ctrl', selector: 'myComp', | 951 @Component(publishAs: 'ctrl', selector: 'myComp', |
| 952 templateUrl: 'my_template.html', cssUrl: 'my_styles.css') | 952 templateUrl: 'my_template.html', cssUrl: 'my_styles.css') |
| 953 class MyComponent { | 953 class MyComponent { |
| 954 MyComponent(Scope scope) { | 954 MyComponent(Scope scope) { |
| (...skipping 12 matching lines...) Expand all Loading... |
| 967 }'''); | 967 }'''); |
| 968 resolveMainSourceNoErrors(mainContent); | 968 resolveMainSourceNoErrors(mainContent); |
| 969 // prepare AngularComponentElement | 969 // prepare AngularComponentElement |
| 970 ClassElement classElement = mainUnitElement.getType("MyComponent"); | 970 ClassElement classElement = mainUnitElement.getType("MyComponent"); |
| 971 AngularComponentElement component = | 971 AngularComponentElement component = |
| 972 getAngularElement(classElement, (e) => e is AngularComponentElement); | 972 getAngularElement(classElement, (e) => e is AngularComponentElement); |
| 973 expect(component, isNotNull); | 973 expect(component, isNotNull); |
| 974 // verify | 974 // verify |
| 975 List<AngularScopePropertyElement> scopeProperties = | 975 List<AngularScopePropertyElement> scopeProperties = |
| 976 component.scopeProperties; | 976 component.scopeProperties; |
| 977 EngineTestCase.assertLength(3, scopeProperties); | 977 expect(scopeProperties, hasLength(3)); |
| 978 { | 978 { |
| 979 AngularScopePropertyElement property = scopeProperties[0]; | 979 AngularScopePropertyElement property = scopeProperties[0]; |
| 980 expect(findMainElement2("boolProp"), same(property)); | 980 expect(findMainElement2("boolProp"), same(property)); |
| 981 expect(property.name, "boolProp"); | 981 expect(property.name, "boolProp"); |
| 982 expect(property.nameOffset, AngularTest.findOffset(mainContent, "boolProp'
")); | 982 expect(property.nameOffset, AngularTest.findOffset(mainContent, "boolProp'
")); |
| 983 expect(property.type.name, "bool"); | 983 expect(property.type.name, "bool"); |
| 984 } | 984 } |
| 985 { | 985 { |
| 986 AngularScopePropertyElement property = scopeProperties[1]; | 986 AngularScopePropertyElement property = scopeProperties[1]; |
| 987 expect(findMainElement2("intProp"), same(property)); | 987 expect(findMainElement2("intProp"), same(property)); |
| (...skipping 365 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1353 foo('wrong.html', 'bar'); // more than one argument | 1353 foo('wrong.html', 'bar'); // more than one argument |
| 1354 foo('wrong' + '.html'); // not literal | 1354 foo('wrong' + '.html'); // not literal |
| 1355 foo('wrong.html'); // not ViewFactory | 1355 foo('wrong.html'); // not ViewFactory |
| 1356 view('my_templateA.html'); | 1356 view('my_templateA.html'); |
| 1357 view('my_templateB.html'); | 1357 view('my_templateB.html'); |
| 1358 } | 1358 } |
| 1359 }'''); | 1359 }'''); |
| 1360 resolveMainSourceNoErrors(mainContent); | 1360 resolveMainSourceNoErrors(mainContent); |
| 1361 // prepare AngularViewElement(s) | 1361 // prepare AngularViewElement(s) |
| 1362 List<AngularViewElement> views = mainUnitElement.angularViews; | 1362 List<AngularViewElement> views = mainUnitElement.angularViews; |
| 1363 EngineTestCase.assertLength(2, views); | 1363 expect(views, hasLength(2)); |
| 1364 { | 1364 { |
| 1365 AngularViewElement view = views[0]; | 1365 AngularViewElement view = views[0]; |
| 1366 expect(view.templateUri, "my_templateA.html"); | 1366 expect(view.templateUri, "my_templateA.html"); |
| 1367 expect(view.name, null); | 1367 expect(view.name, null); |
| 1368 expect(view.nameOffset, -1); | 1368 expect(view.nameOffset, -1); |
| 1369 expect(view.templateUriOffset, AngularTest.findOffset(mainContent, "my_tem
plateA.html'")); | 1369 expect(view.templateUriOffset, AngularTest.findOffset(mainContent, "my_tem
plateA.html'")); |
| 1370 } | 1370 } |
| 1371 { | 1371 { |
| 1372 AngularViewElement view = views[1]; | 1372 AngularViewElement view = views[1]; |
| 1373 expect(view.templateUri, "my_templateB.html"); | 1373 expect(view.templateUri, "my_templateB.html"); |
| (...skipping 2000 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3374 expect(value.stringValue, expectedValue); | 3374 expect(value.stringValue, expectedValue); |
| 3375 } | 3375 } |
| 3376 | 3376 |
| 3377 EvaluationResult _getExpressionValue(String contents) { | 3377 EvaluationResult _getExpressionValue(String contents) { |
| 3378 Source source = addSource("var x = $contents;"); | 3378 Source source = addSource("var x = $contents;"); |
| 3379 LibraryElement library = resolve(source); | 3379 LibraryElement library = resolve(source); |
| 3380 CompilationUnit unit = | 3380 CompilationUnit unit = |
| 3381 analysisContext.resolveCompilationUnit(source, library); | 3381 analysisContext.resolveCompilationUnit(source, library); |
| 3382 expect(unit, isNotNull); | 3382 expect(unit, isNotNull); |
| 3383 NodeList<CompilationUnitMember> declarations = unit.declarations; | 3383 NodeList<CompilationUnitMember> declarations = unit.declarations; |
| 3384 EngineTestCase.assertSizeOfList(1, declarations); | 3384 expect(declarations, hasLength(1)); |
| 3385 CompilationUnitMember declaration = declarations[0]; | 3385 CompilationUnitMember declaration = declarations[0]; |
| 3386 EngineTestCase.assertInstanceOf( | 3386 EngineTestCase.assertInstanceOf( |
| 3387 (obj) => obj is TopLevelVariableDeclaration, | 3387 (obj) => obj is TopLevelVariableDeclaration, |
| 3388 TopLevelVariableDeclaration, | 3388 TopLevelVariableDeclaration, |
| 3389 declaration); | 3389 declaration); |
| 3390 NodeList<VariableDeclaration> variables = | 3390 NodeList<VariableDeclaration> variables = |
| 3391 (declaration as TopLevelVariableDeclaration).variables.variables; | 3391 (declaration as TopLevelVariableDeclaration).variables.variables; |
| 3392 EngineTestCase.assertSizeOfList(1, variables); | 3392 expect(variables, hasLength(1)); |
| 3393 ConstantEvaluator evaluator = new ConstantEvaluator( | 3393 ConstantEvaluator evaluator = new ConstantEvaluator( |
| 3394 source, | 3394 source, |
| 3395 (analysisContext as AnalysisContextImpl).typeProvider); | 3395 (analysisContext as AnalysisContextImpl).typeProvider); |
| 3396 return evaluator.evaluate(variables[0].initializer); | 3396 return evaluator.evaluate(variables[0].initializer); |
| 3397 } | 3397 } |
| 3398 } | 3398 } |
| 3399 | 3399 |
| 3400 | 3400 |
| 3401 class ConstantFinderTest extends EngineTestCase { | 3401 class ConstantFinderTest extends EngineTestCase { |
| 3402 AstNode _node; | 3402 AstNode _node; |
| (...skipping 112 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3515 const int c = b;'''); | 3515 const int c = b;'''); |
| 3516 LibraryElement libraryElement = resolve(librarySource); | 3516 LibraryElement libraryElement = resolve(librarySource); |
| 3517 CompilationUnit unit = | 3517 CompilationUnit unit = |
| 3518 analysisContext.resolveCompilationUnit(librarySource, libraryElement); | 3518 analysisContext.resolveCompilationUnit(librarySource, libraryElement); |
| 3519 analysisContext.computeErrors(librarySource); | 3519 analysisContext.computeErrors(librarySource); |
| 3520 expect(unit, isNotNull); | 3520 expect(unit, isNotNull); |
| 3521 ConstantValueComputer computer = _makeConstantValueComputer(); | 3521 ConstantValueComputer computer = _makeConstantValueComputer(); |
| 3522 computer.add(unit); | 3522 computer.add(unit); |
| 3523 computer.computeValues(); | 3523 computer.computeValues(); |
| 3524 NodeList<CompilationUnitMember> members = unit.declarations; | 3524 NodeList<CompilationUnitMember> members = unit.declarations; |
| 3525 EngineTestCase.assertSizeOfList(3, members); | 3525 expect(members, hasLength(3)); |
| 3526 _validate(false, (members[0] as TopLevelVariableDeclaration).variables); | 3526 _validate(false, (members[0] as TopLevelVariableDeclaration).variables); |
| 3527 _validate(false, (members[1] as TopLevelVariableDeclaration).variables); | 3527 _validate(false, (members[1] as TopLevelVariableDeclaration).variables); |
| 3528 _validate(false, (members[2] as TopLevelVariableDeclaration).variables); | 3528 _validate(false, (members[2] as TopLevelVariableDeclaration).variables); |
| 3529 } | 3529 } |
| 3530 | 3530 |
| 3531 void test_computeValues_dependentVariables() { | 3531 void test_computeValues_dependentVariables() { |
| 3532 Source librarySource = addSource(r''' | 3532 Source librarySource = addSource(r''' |
| 3533 const int b = a; | 3533 const int b = a; |
| 3534 const int a = 0;'''); | 3534 const int a = 0;'''); |
| 3535 LibraryElement libraryElement = resolve(librarySource); | 3535 LibraryElement libraryElement = resolve(librarySource); |
| 3536 CompilationUnit unit = | 3536 CompilationUnit unit = |
| 3537 analysisContext.resolveCompilationUnit(librarySource, libraryElement); | 3537 analysisContext.resolveCompilationUnit(librarySource, libraryElement); |
| 3538 expect(unit, isNotNull); | 3538 expect(unit, isNotNull); |
| 3539 ConstantValueComputer computer = _makeConstantValueComputer(); | 3539 ConstantValueComputer computer = _makeConstantValueComputer(); |
| 3540 computer.add(unit); | 3540 computer.add(unit); |
| 3541 computer.computeValues(); | 3541 computer.computeValues(); |
| 3542 NodeList<CompilationUnitMember> members = unit.declarations; | 3542 NodeList<CompilationUnitMember> members = unit.declarations; |
| 3543 EngineTestCase.assertSizeOfList(2, members); | 3543 expect(members, hasLength(2)); |
| 3544 _validate(true, (members[0] as TopLevelVariableDeclaration).variables); | 3544 _validate(true, (members[0] as TopLevelVariableDeclaration).variables); |
| 3545 _validate(true, (members[1] as TopLevelVariableDeclaration).variables); | 3545 _validate(true, (members[1] as TopLevelVariableDeclaration).variables); |
| 3546 } | 3546 } |
| 3547 | 3547 |
| 3548 void test_computeValues_empty() { | 3548 void test_computeValues_empty() { |
| 3549 ConstantValueComputer computer = _makeConstantValueComputer(); | 3549 ConstantValueComputer computer = _makeConstantValueComputer(); |
| 3550 computer.computeValues(); | 3550 computer.computeValues(); |
| 3551 } | 3551 } |
| 3552 | 3552 |
| 3553 void test_computeValues_multipleSources() { | 3553 void test_computeValues_multipleSources() { |
| (...skipping 15 matching lines...) Expand all Loading... |
| 3569 analysisContext.resolveCompilationUnit(librarySource, libraryElement); | 3569 analysisContext.resolveCompilationUnit(librarySource, libraryElement); |
| 3570 expect(libraryUnit, isNotNull); | 3570 expect(libraryUnit, isNotNull); |
| 3571 CompilationUnit partUnit = | 3571 CompilationUnit partUnit = |
| 3572 analysisContext.resolveCompilationUnit(partSource, libraryElement); | 3572 analysisContext.resolveCompilationUnit(partSource, libraryElement); |
| 3573 expect(partUnit, isNotNull); | 3573 expect(partUnit, isNotNull); |
| 3574 ConstantValueComputer computer = _makeConstantValueComputer(); | 3574 ConstantValueComputer computer = _makeConstantValueComputer(); |
| 3575 computer.add(libraryUnit); | 3575 computer.add(libraryUnit); |
| 3576 computer.add(partUnit); | 3576 computer.add(partUnit); |
| 3577 computer.computeValues(); | 3577 computer.computeValues(); |
| 3578 NodeList<CompilationUnitMember> libraryMembers = libraryUnit.declarations; | 3578 NodeList<CompilationUnitMember> libraryMembers = libraryUnit.declarations; |
| 3579 EngineTestCase.assertSizeOfList(2, libraryMembers); | 3579 expect(libraryMembers, hasLength(2)); |
| 3580 _validate( | 3580 _validate( |
| 3581 true, | 3581 true, |
| 3582 (libraryMembers[0] as TopLevelVariableDeclaration).variables); | 3582 (libraryMembers[0] as TopLevelVariableDeclaration).variables); |
| 3583 _validate( | 3583 _validate( |
| 3584 true, | 3584 true, |
| 3585 (libraryMembers[1] as TopLevelVariableDeclaration).variables); | 3585 (libraryMembers[1] as TopLevelVariableDeclaration).variables); |
| 3586 NodeList<CompilationUnitMember> partMembers = libraryUnit.declarations; | 3586 NodeList<CompilationUnitMember> partMembers = libraryUnit.declarations; |
| 3587 EngineTestCase.assertSizeOfList(2, partMembers); | 3587 expect(partMembers, hasLength(2)); |
| 3588 _validate(true, (partMembers[0] as TopLevelVariableDeclaration).variables); | 3588 _validate(true, (partMembers[0] as TopLevelVariableDeclaration).variables); |
| 3589 _validate(true, (partMembers[1] as TopLevelVariableDeclaration).variables); | 3589 _validate(true, (partMembers[1] as TopLevelVariableDeclaration).variables); |
| 3590 } | 3590 } |
| 3591 | 3591 |
| 3592 void test_computeValues_singleVariable() { | 3592 void test_computeValues_singleVariable() { |
| 3593 Source librarySource = addSource("const int a = 0;"); | 3593 Source librarySource = addSource("const int a = 0;"); |
| 3594 LibraryElement libraryElement = resolve(librarySource); | 3594 LibraryElement libraryElement = resolve(librarySource); |
| 3595 CompilationUnit unit = | 3595 CompilationUnit unit = |
| 3596 analysisContext.resolveCompilationUnit(librarySource, libraryElement); | 3596 analysisContext.resolveCompilationUnit(librarySource, libraryElement); |
| 3597 expect(unit, isNotNull); | 3597 expect(unit, isNotNull); |
| 3598 ConstantValueComputer computer = _makeConstantValueComputer(); | 3598 ConstantValueComputer computer = _makeConstantValueComputer(); |
| 3599 computer.add(unit); | 3599 computer.add(unit); |
| 3600 computer.computeValues(); | 3600 computer.computeValues(); |
| 3601 NodeList<CompilationUnitMember> members = unit.declarations; | 3601 NodeList<CompilationUnitMember> members = unit.declarations; |
| 3602 EngineTestCase.assertSizeOfList(1, members); | 3602 expect(members, hasLength(1)); |
| 3603 _validate(true, (members[0] as TopLevelVariableDeclaration).variables); | 3603 _validate(true, (members[0] as TopLevelVariableDeclaration).variables); |
| 3604 } | 3604 } |
| 3605 | 3605 |
| 3606 void test_dependencyOnConstructor() { | 3606 void test_dependencyOnConstructor() { |
| 3607 // x depends on "const A()" | 3607 // x depends on "const A()" |
| 3608 _assertProperDependencies(r''' | 3608 _assertProperDependencies(r''' |
| 3609 class A { | 3609 class A { |
| 3610 const A(); | 3610 const A(); |
| 3611 } | 3611 } |
| 3612 const x = const A();''', | 3612 const x = const A();''', |
| (...skipping 286 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3899 void test_instanceCreationExpression_computedField() { | 3899 void test_instanceCreationExpression_computedField() { |
| 3900 CompilationUnit compilationUnit = resolveSource(r''' | 3900 CompilationUnit compilationUnit = resolveSource(r''' |
| 3901 const foo = const A(4, 5); | 3901 const foo = const A(4, 5); |
| 3902 class A { | 3902 class A { |
| 3903 const A(int i, int j) : k = 2 * i + j; | 3903 const A(int i, int j) : k = 2 * i + j; |
| 3904 final int k; | 3904 final int k; |
| 3905 }'''); | 3905 }'''); |
| 3906 EvaluationResultImpl result = | 3906 EvaluationResultImpl result = |
| 3907 _evaluateInstanceCreationExpression(compilationUnit, "foo"); | 3907 _evaluateInstanceCreationExpression(compilationUnit, "foo"); |
| 3908 Map<String, DartObjectImpl> fields = _assertType(result, "A"); | 3908 Map<String, DartObjectImpl> fields = _assertType(result, "A"); |
| 3909 EngineTestCase.assertSizeOfMap(1, fields); | 3909 expect(fields, hasLength(1)); |
| 3910 _assertIntField(fields, "k", 13); | 3910 _assertIntField(fields, "k", 13); |
| 3911 } | 3911 } |
| 3912 | 3912 |
| 3913 void | 3913 void |
| 3914 test_instanceCreationExpression_computedField_namedOptionalWithDefault() { | 3914 test_instanceCreationExpression_computedField_namedOptionalWithDefault() { |
| 3915 _checkInstanceCreationOptionalParams(false, true, true); | 3915 _checkInstanceCreationOptionalParams(false, true, true); |
| 3916 } | 3916 } |
| 3917 | 3917 |
| 3918 void | 3918 void |
| 3919 test_instanceCreationExpression_computedField_namedOptionalWithoutDefault(
) { | 3919 test_instanceCreationExpression_computedField_namedOptionalWithoutDefault(
) { |
| (...skipping 17 matching lines...) Expand all Loading... |
| 3937 const A(int i) : b = const B(4); | 3937 const A(int i) : b = const B(4); |
| 3938 final int b; | 3938 final int b; |
| 3939 } | 3939 } |
| 3940 class B { | 3940 class B { |
| 3941 const B(this.k); | 3941 const B(this.k); |
| 3942 final int k; | 3942 final int k; |
| 3943 }'''); | 3943 }'''); |
| 3944 EvaluationResultImpl result = | 3944 EvaluationResultImpl result = |
| 3945 _evaluateInstanceCreationExpression(compilationUnit, "foo"); | 3945 _evaluateInstanceCreationExpression(compilationUnit, "foo"); |
| 3946 Map<String, DartObjectImpl> fieldsOfA = _assertType(result, "A"); | 3946 Map<String, DartObjectImpl> fieldsOfA = _assertType(result, "A"); |
| 3947 EngineTestCase.assertSizeOfMap(1, fieldsOfA); | 3947 expect(fieldsOfA, hasLength(1)); |
| 3948 Map<String, DartObjectImpl> fieldsOfB = | 3948 Map<String, DartObjectImpl> fieldsOfB = |
| 3949 _assertFieldType(fieldsOfA, "b", "B"); | 3949 _assertFieldType(fieldsOfA, "b", "B"); |
| 3950 EngineTestCase.assertSizeOfMap(1, fieldsOfB); | 3950 expect(fieldsOfB, hasLength(1)); |
| 3951 _assertIntField(fieldsOfB, "k", 4); | 3951 _assertIntField(fieldsOfB, "k", 4); |
| 3952 } | 3952 } |
| 3953 | 3953 |
| 3954 void test_instanceCreationExpression_computedField_usesStaticConst() { | 3954 void test_instanceCreationExpression_computedField_usesStaticConst() { |
| 3955 CompilationUnit compilationUnit = resolveSource(r''' | 3955 CompilationUnit compilationUnit = resolveSource(r''' |
| 3956 const foo = const A(3); | 3956 const foo = const A(3); |
| 3957 class A { | 3957 class A { |
| 3958 const A(int i) : k = i + B.bar; | 3958 const A(int i) : k = i + B.bar; |
| 3959 final int k; | 3959 final int k; |
| 3960 } | 3960 } |
| 3961 class B { | 3961 class B { |
| 3962 static const bar = 4; | 3962 static const bar = 4; |
| 3963 }'''); | 3963 }'''); |
| 3964 EvaluationResultImpl result = | 3964 EvaluationResultImpl result = |
| 3965 _evaluateInstanceCreationExpression(compilationUnit, "foo"); | 3965 _evaluateInstanceCreationExpression(compilationUnit, "foo"); |
| 3966 Map<String, DartObjectImpl> fields = _assertType(result, "A"); | 3966 Map<String, DartObjectImpl> fields = _assertType(result, "A"); |
| 3967 EngineTestCase.assertSizeOfMap(1, fields); | 3967 expect(fields, hasLength(1)); |
| 3968 _assertIntField(fields, "k", 7); | 3968 _assertIntField(fields, "k", 7); |
| 3969 } | 3969 } |
| 3970 | 3970 |
| 3971 void test_instanceCreationExpression_computedField_usesToplevelConst() { | 3971 void test_instanceCreationExpression_computedField_usesToplevelConst() { |
| 3972 CompilationUnit compilationUnit = resolveSource(r''' | 3972 CompilationUnit compilationUnit = resolveSource(r''' |
| 3973 const foo = const A(3); | 3973 const foo = const A(3); |
| 3974 const bar = 4; | 3974 const bar = 4; |
| 3975 class A { | 3975 class A { |
| 3976 const A(int i) : k = i + bar; | 3976 const A(int i) : k = i + bar; |
| 3977 final int k; | 3977 final int k; |
| 3978 }'''); | 3978 }'''); |
| 3979 EvaluationResultImpl result = | 3979 EvaluationResultImpl result = |
| 3980 _evaluateInstanceCreationExpression(compilationUnit, "foo"); | 3980 _evaluateInstanceCreationExpression(compilationUnit, "foo"); |
| 3981 Map<String, DartObjectImpl> fields = _assertType(result, "A"); | 3981 Map<String, DartObjectImpl> fields = _assertType(result, "A"); |
| 3982 EngineTestCase.assertSizeOfMap(1, fields); | 3982 expect(fields, hasLength(1)); |
| 3983 _assertIntField(fields, "k", 7); | 3983 _assertIntField(fields, "k", 7); |
| 3984 } | 3984 } |
| 3985 | 3985 |
| 3986 void test_instanceCreationExpression_explicitSuper() { | 3986 void test_instanceCreationExpression_explicitSuper() { |
| 3987 CompilationUnit compilationUnit = resolveSource(r''' | 3987 CompilationUnit compilationUnit = resolveSource(r''' |
| 3988 const foo = const B(4, 5); | 3988 const foo = const B(4, 5); |
| 3989 class A { | 3989 class A { |
| 3990 const A(this.x); | 3990 const A(this.x); |
| 3991 final int x; | 3991 final int x; |
| 3992 } | 3992 } |
| 3993 class B extends A { | 3993 class B extends A { |
| 3994 const B(int x, this.y) : super(x * 2); | 3994 const B(int x, this.y) : super(x * 2); |
| 3995 final int y; | 3995 final int y; |
| 3996 }'''); | 3996 }'''); |
| 3997 EvaluationResultImpl result = | 3997 EvaluationResultImpl result = |
| 3998 _evaluateInstanceCreationExpression(compilationUnit, "foo"); | 3998 _evaluateInstanceCreationExpression(compilationUnit, "foo"); |
| 3999 Map<String, DartObjectImpl> fields = _assertType(result, "B"); | 3999 Map<String, DartObjectImpl> fields = _assertType(result, "B"); |
| 4000 EngineTestCase.assertSizeOfMap(2, fields); | 4000 expect(fields, hasLength(2)); |
| 4001 _assertIntField(fields, "y", 5); | 4001 _assertIntField(fields, "y", 5); |
| 4002 Map<String, DartObjectImpl> superclassFields = | 4002 Map<String, DartObjectImpl> superclassFields = |
| 4003 _assertFieldType(fields, GenericState.SUPERCLASS_FIELD, "A"); | 4003 _assertFieldType(fields, GenericState.SUPERCLASS_FIELD, "A"); |
| 4004 EngineTestCase.assertSizeOfMap(1, superclassFields); | 4004 expect(superclassFields, hasLength(1)); |
| 4005 _assertIntField(superclassFields, "x", 8); | 4005 _assertIntField(superclassFields, "x", 8); |
| 4006 } | 4006 } |
| 4007 | 4007 |
| 4008 void test_instanceCreationExpression_fieldFormalParameter() { | 4008 void test_instanceCreationExpression_fieldFormalParameter() { |
| 4009 CompilationUnit compilationUnit = resolveSource(r''' | 4009 CompilationUnit compilationUnit = resolveSource(r''' |
| 4010 const foo = const A(42); | 4010 const foo = const A(42); |
| 4011 class A { | 4011 class A { |
| 4012 int x; | 4012 int x; |
| 4013 const A(this.x) | 4013 const A(this.x) |
| 4014 }'''); | 4014 }'''); |
| 4015 EvaluationResultImpl result = | 4015 EvaluationResultImpl result = |
| 4016 _evaluateInstanceCreationExpression(compilationUnit, "foo"); | 4016 _evaluateInstanceCreationExpression(compilationUnit, "foo"); |
| 4017 Map<String, DartObjectImpl> fields = _assertType(result, "A"); | 4017 Map<String, DartObjectImpl> fields = _assertType(result, "A"); |
| 4018 EngineTestCase.assertSizeOfMap(1, fields); | 4018 expect(fields, hasLength(1)); |
| 4019 _assertIntField(fields, "x", 42); | 4019 _assertIntField(fields, "x", 42); |
| 4020 } | 4020 } |
| 4021 | 4021 |
| 4022 void | 4022 void |
| 4023 test_instanceCreationExpression_fieldFormalParameter_namedOptionalWithDefa
ult() { | 4023 test_instanceCreationExpression_fieldFormalParameter_namedOptionalWithDefa
ult() { |
| 4024 _checkInstanceCreationOptionalParams(true, true, true); | 4024 _checkInstanceCreationOptionalParams(true, true, true); |
| 4025 } | 4025 } |
| 4026 | 4026 |
| 4027 void | 4027 void |
| 4028 test_instanceCreationExpression_fieldFormalParameter_namedOptionalWithoutD
efault() { | 4028 test_instanceCreationExpression_fieldFormalParameter_namedOptionalWithoutD
efault() { |
| (...skipping 17 matching lines...) Expand all Loading... |
| 4046 const A() : x(3); | 4046 const A() : x(3); |
| 4047 final int x; | 4047 final int x; |
| 4048 } | 4048 } |
| 4049 class B extends A { | 4049 class B extends A { |
| 4050 const B(this.y); | 4050 const B(this.y); |
| 4051 final int y; | 4051 final int y; |
| 4052 }'''); | 4052 }'''); |
| 4053 EvaluationResultImpl result = | 4053 EvaluationResultImpl result = |
| 4054 _evaluateInstanceCreationExpression(compilationUnit, "foo"); | 4054 _evaluateInstanceCreationExpression(compilationUnit, "foo"); |
| 4055 Map<String, DartObjectImpl> fields = _assertType(result, "B"); | 4055 Map<String, DartObjectImpl> fields = _assertType(result, "B"); |
| 4056 EngineTestCase.assertSizeOfMap(2, fields); | 4056 expect(fields, hasLength(2)); |
| 4057 _assertIntField(fields, "y", 4); | 4057 _assertIntField(fields, "y", 4); |
| 4058 Map<String, DartObjectImpl> superclassFields = | 4058 Map<String, DartObjectImpl> superclassFields = |
| 4059 _assertFieldType(fields, GenericState.SUPERCLASS_FIELD, "A"); | 4059 _assertFieldType(fields, GenericState.SUPERCLASS_FIELD, "A"); |
| 4060 EngineTestCase.assertSizeOfMap(1, superclassFields); | 4060 expect(superclassFields, hasLength(1)); |
| 4061 _assertIntField(superclassFields, "x", 3); | 4061 _assertIntField(superclassFields, "x", 3); |
| 4062 } | 4062 } |
| 4063 | 4063 |
| 4064 void test_instanceCreationExpression_nonFactoryRedirect() { | 4064 void test_instanceCreationExpression_nonFactoryRedirect() { |
| 4065 CompilationUnit compilationUnit = resolveSource(r''' | 4065 CompilationUnit compilationUnit = resolveSource(r''' |
| 4066 const foo = const A.a1(); | 4066 const foo = const A.a1(); |
| 4067 class A { | 4067 class A { |
| 4068 const A.a1() : this.a2(); | 4068 const A.a1() : this.a2(); |
| 4069 const A.a2() : x = 5; | 4069 const A.a2() : x = 5; |
| 4070 final int x; | 4070 final int x; |
| (...skipping 111 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 4182 | 4182 |
| 4183 class B<T> implements A { | 4183 class B<T> implements A { |
| 4184 final T x; | 4184 final T x; |
| 4185 const B(this.x); | 4185 const B(this.x); |
| 4186 } | 4186 } |
| 4187 | 4187 |
| 4188 const A a = const A(10);'''); | 4188 const A a = const A(10);'''); |
| 4189 EvaluationResultImpl result = | 4189 EvaluationResultImpl result = |
| 4190 _evaluateInstanceCreationExpression(compilationUnit, "a"); | 4190 _evaluateInstanceCreationExpression(compilationUnit, "a"); |
| 4191 Map<String, DartObjectImpl> fields = _assertType(result, "B<int>"); | 4191 Map<String, DartObjectImpl> fields = _assertType(result, "B<int>"); |
| 4192 EngineTestCase.assertSizeOfMap(1, fields); | 4192 expect(fields, hasLength(1)); |
| 4193 _assertIntField(fields, "x", 10); | 4193 _assertIntField(fields, "x", 10); |
| 4194 } | 4194 } |
| 4195 | 4195 |
| 4196 void test_instanceCreationExpression_redirectWithTypeSubstitution() { | 4196 void test_instanceCreationExpression_redirectWithTypeSubstitution() { |
| 4197 // To evaluate the redirection of A<int>, | 4197 // To evaluate the redirection of A<int>, |
| 4198 // A's template argument (T=int) must be substituted | 4198 // A's template argument (T=int) must be substituted |
| 4199 // into B's template argument (B<U> where U=T) to get B<int>. | 4199 // into B's template argument (B<U> where U=T) to get B<int>. |
| 4200 CompilationUnit compilationUnit = resolveSource(r''' | 4200 CompilationUnit compilationUnit = resolveSource(r''' |
| 4201 class A<T> { | 4201 class A<T> { |
| 4202 const factory A(var a) = B<T>; | 4202 const factory A(var a) = B<T>; |
| 4203 } | 4203 } |
| 4204 | 4204 |
| 4205 class B<U> implements A { | 4205 class B<U> implements A { |
| 4206 final U x; | 4206 final U x; |
| 4207 const B(this.x); | 4207 const B(this.x); |
| 4208 } | 4208 } |
| 4209 | 4209 |
| 4210 const A<int> a = const A<int>(10);'''); | 4210 const A<int> a = const A<int>(10);'''); |
| 4211 EvaluationResultImpl result = | 4211 EvaluationResultImpl result = |
| 4212 _evaluateInstanceCreationExpression(compilationUnit, "a"); | 4212 _evaluateInstanceCreationExpression(compilationUnit, "a"); |
| 4213 Map<String, DartObjectImpl> fields = _assertType(result, "B<int>"); | 4213 Map<String, DartObjectImpl> fields = _assertType(result, "B<int>"); |
| 4214 EngineTestCase.assertSizeOfMap(1, fields); | 4214 expect(fields, hasLength(1)); |
| 4215 _assertIntField(fields, "x", 10); | 4215 _assertIntField(fields, "x", 10); |
| 4216 } | 4216 } |
| 4217 | 4217 |
| 4218 void test_instanceCreationExpression_redirect_cycle() { | 4218 void test_instanceCreationExpression_redirect_cycle() { |
| 4219 // It is an error to have a cycle in factory redirects; however, we need | 4219 // It is an error to have a cycle in factory redirects; however, we need |
| 4220 // to make sure that even if the error occurs, attempting to evaluate the | 4220 // to make sure that even if the error occurs, attempting to evaluate the |
| 4221 // constant will terminate. | 4221 // constant will terminate. |
| 4222 CompilationUnit compilationUnit = resolveSource(r''' | 4222 CompilationUnit compilationUnit = resolveSource(r''' |
| 4223 const foo = const A(); | 4223 const foo = const A(); |
| 4224 class A { | 4224 class A { |
| (...skipping 188 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 4413 CompilationUnit compilationUnit = resolveSource(""" | 4413 CompilationUnit compilationUnit = resolveSource(""" |
| 4414 const x = const A(); | 4414 const x = const A(); |
| 4415 const y = const A(${isNamed ? '$paramName: ' : ''}10); | 4415 const y = const A(${isNamed ? '$paramName: ' : ''}10); |
| 4416 class A { | 4416 class A { |
| 4417 const A(${isNamed ? "{$formalParam}" : "[$formalParam]"})${isFieldFormal ? ""
: " : $fieldName = $paramName"}; | 4417 const A(${isNamed ? "{$formalParam}" : "[$formalParam]"})${isFieldFormal ? ""
: " : $fieldName = $paramName"}; |
| 4418 final int $fieldName; | 4418 final int $fieldName; |
| 4419 }"""); | 4419 }"""); |
| 4420 EvaluationResultImpl x = | 4420 EvaluationResultImpl x = |
| 4421 _evaluateInstanceCreationExpression(compilationUnit, "x"); | 4421 _evaluateInstanceCreationExpression(compilationUnit, "x"); |
| 4422 Map<String, DartObjectImpl> fieldsOfX = _assertType(x, "A"); | 4422 Map<String, DartObjectImpl> fieldsOfX = _assertType(x, "A"); |
| 4423 EngineTestCase.assertSizeOfMap(1, fieldsOfX); | 4423 expect(fieldsOfX, hasLength(1)); |
| 4424 if (hasDefault) { | 4424 if (hasDefault) { |
| 4425 _assertIntField(fieldsOfX, fieldName, 3); | 4425 _assertIntField(fieldsOfX, fieldName, 3); |
| 4426 } else { | 4426 } else { |
| 4427 _assertNullField(fieldsOfX, fieldName); | 4427 _assertNullField(fieldsOfX, fieldName); |
| 4428 } | 4428 } |
| 4429 EvaluationResultImpl y = | 4429 EvaluationResultImpl y = |
| 4430 _evaluateInstanceCreationExpression(compilationUnit, "y"); | 4430 _evaluateInstanceCreationExpression(compilationUnit, "y"); |
| 4431 Map<String, DartObjectImpl> fieldsOfY = _assertType(y, "A"); | 4431 Map<String, DartObjectImpl> fieldsOfY = _assertType(y, "A"); |
| 4432 EngineTestCase.assertSizeOfMap(1, fieldsOfY); | 4432 expect(fieldsOfY, hasLength(1)); |
| 4433 _assertIntField(fieldsOfY, fieldName, 10); | 4433 _assertIntField(fieldsOfY, fieldName, 10); |
| 4434 } | 4434 } |
| 4435 | 4435 |
| 4436 void _checkInstanceCreation_withSupertypeParams(bool isExplicit) { | 4436 void _checkInstanceCreation_withSupertypeParams(bool isExplicit) { |
| 4437 String superCall = isExplicit ? " : super()" : ""; | 4437 String superCall = isExplicit ? " : super()" : ""; |
| 4438 CompilationUnit compilationUnit = resolveSource(""" | 4438 CompilationUnit compilationUnit = resolveSource(""" |
| 4439 class A<T> { | 4439 class A<T> { |
| 4440 const A(); | 4440 const A(); |
| 4441 } | 4441 } |
| 4442 class B<T, U> extends A<T> { | 4442 class B<T, U> extends A<T> { |
| (...skipping 672 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 5115 } | 5115 } |
| 5116 | 5116 |
| 5117 void test_getValue_int_unknown() { | 5117 void test_getValue_int_unknown() { |
| 5118 expect(_intValue(null).value, isNull); | 5118 expect(_intValue(null).value, isNull); |
| 5119 } | 5119 } |
| 5120 | 5120 |
| 5121 void test_getValue_list_empty() { | 5121 void test_getValue_list_empty() { |
| 5122 Object result = _listValue([]).value; | 5122 Object result = _listValue([]).value; |
| 5123 _assertInstanceOfObjectArray(result); | 5123 _assertInstanceOfObjectArray(result); |
| 5124 List<Object> array = result as List<Object>; | 5124 List<Object> array = result as List<Object>; |
| 5125 EngineTestCase.assertLength(0, array); | 5125 expect(array, hasLength(0)); |
| 5126 } | 5126 } |
| 5127 | 5127 |
| 5128 void test_getValue_list_valid() { | 5128 void test_getValue_list_valid() { |
| 5129 Object result = _listValue([_intValue(23)]).value; | 5129 Object result = _listValue([_intValue(23)]).value; |
| 5130 _assertInstanceOfObjectArray(result); | 5130 _assertInstanceOfObjectArray(result); |
| 5131 List<Object> array = result as List<Object>; | 5131 List<Object> array = result as List<Object>; |
| 5132 EngineTestCase.assertLength(1, array); | 5132 expect(array, hasLength(1)); |
| 5133 } | 5133 } |
| 5134 | 5134 |
| 5135 void test_getValue_map_empty() { | 5135 void test_getValue_map_empty() { |
| 5136 Object result = _mapValue([]).value; | 5136 Object result = _mapValue([]).value; |
| 5137 EngineTestCase.assertInstanceOf((obj) => obj is Map, Map, result); | 5137 EngineTestCase.assertInstanceOf((obj) => obj is Map, Map, result); |
| 5138 Map map = result as Map; | 5138 Map map = result as Map; |
| 5139 EngineTestCase.assertSizeOfMap(0, map); | 5139 expect(map, hasLength(0)); |
| 5140 } | 5140 } |
| 5141 | 5141 |
| 5142 void test_getValue_map_valid() { | 5142 void test_getValue_map_valid() { |
| 5143 Object result = | 5143 Object result = |
| 5144 _mapValue([_stringValue("key"), _stringValue("value")]).value; | 5144 _mapValue([_stringValue("key"), _stringValue("value")]).value; |
| 5145 EngineTestCase.assertInstanceOf((obj) => obj is Map, Map, result); | 5145 EngineTestCase.assertInstanceOf((obj) => obj is Map, Map, result); |
| 5146 Map map = result as Map; | 5146 Map map = result as Map; |
| 5147 EngineTestCase.assertSizeOfMap(1, map); | 5147 expect(map, hasLength(1)); |
| 5148 } | 5148 } |
| 5149 | 5149 |
| 5150 void test_getValue_null() { | 5150 void test_getValue_null() { |
| 5151 expect(_nullValue().value, isNull); | 5151 expect(_nullValue().value, isNull); |
| 5152 } | 5152 } |
| 5153 | 5153 |
| 5154 void test_getValue_string_known() { | 5154 void test_getValue_string_known() { |
| 5155 String value = "twenty-three"; | 5155 String value = "twenty-three"; |
| 5156 expect(_stringValue(value).value, value); | 5156 expect(_stringValue(value).value, value); |
| 5157 } | 5157 } |
| (...skipping 1997 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 7155 class ElementBuilderTest extends EngineTestCase { | 7155 class ElementBuilderTest extends EngineTestCase { |
| 7156 void test_visitCatchClause() { | 7156 void test_visitCatchClause() { |
| 7157 ElementHolder holder = new ElementHolder(); | 7157 ElementHolder holder = new ElementHolder(); |
| 7158 ElementBuilder builder = new ElementBuilder(holder); | 7158 ElementBuilder builder = new ElementBuilder(holder); |
| 7159 String exceptionParameterName = "e"; | 7159 String exceptionParameterName = "e"; |
| 7160 String stackParameterName = "s"; | 7160 String stackParameterName = "s"; |
| 7161 CatchClause clause = | 7161 CatchClause clause = |
| 7162 AstFactory.catchClause2(exceptionParameterName, stackParameterName, []); | 7162 AstFactory.catchClause2(exceptionParameterName, stackParameterName, []); |
| 7163 clause.accept(builder); | 7163 clause.accept(builder); |
| 7164 List<LocalVariableElement> variables = holder.localVariables; | 7164 List<LocalVariableElement> variables = holder.localVariables; |
| 7165 EngineTestCase.assertLength(2, variables); | 7165 expect(variables, hasLength(2)); |
| 7166 VariableElement exceptionVariable = variables[0]; | 7166 VariableElement exceptionVariable = variables[0]; |
| 7167 expect(exceptionVariable, isNotNull); | 7167 expect(exceptionVariable, isNotNull); |
| 7168 expect(exceptionVariable.name, exceptionParameterName); | 7168 expect(exceptionVariable.name, exceptionParameterName); |
| 7169 expect(exceptionVariable.isSynthetic, isFalse); | 7169 expect(exceptionVariable.isSynthetic, isFalse); |
| 7170 expect(exceptionVariable.isConst, isFalse); | 7170 expect(exceptionVariable.isConst, isFalse); |
| 7171 expect(exceptionVariable.isFinal, isFalse); | 7171 expect(exceptionVariable.isFinal, isFalse); |
| 7172 expect(exceptionVariable.initializer, isNull); | 7172 expect(exceptionVariable.initializer, isNull); |
| 7173 VariableElement stackVariable = variables[1]; | 7173 VariableElement stackVariable = variables[1]; |
| 7174 expect(stackVariable, isNotNull); | 7174 expect(stackVariable, isNotNull); |
| 7175 expect(stackVariable.name, stackParameterName); | 7175 expect(stackVariable.name, stackParameterName); |
| (...skipping 10 matching lines...) Expand all Loading... |
| 7186 ClassDeclaration classDeclaration = AstFactory.classDeclaration( | 7186 ClassDeclaration classDeclaration = AstFactory.classDeclaration( |
| 7187 Keyword.ABSTRACT, | 7187 Keyword.ABSTRACT, |
| 7188 className, | 7188 className, |
| 7189 null, | 7189 null, |
| 7190 null, | 7190 null, |
| 7191 null, | 7191 null, |
| 7192 null, | 7192 null, |
| 7193 []); | 7193 []); |
| 7194 classDeclaration.accept(builder); | 7194 classDeclaration.accept(builder); |
| 7195 List<ClassElement> types = holder.types; | 7195 List<ClassElement> types = holder.types; |
| 7196 EngineTestCase.assertLength(1, types); | 7196 expect(types, hasLength(1)); |
| 7197 ClassElement type = types[0]; | 7197 ClassElement type = types[0]; |
| 7198 expect(type, isNotNull); | 7198 expect(type, isNotNull); |
| 7199 expect(type.name, className); | 7199 expect(type.name, className); |
| 7200 List<TypeParameterElement> typeParameters = type.typeParameters; | 7200 List<TypeParameterElement> typeParameters = type.typeParameters; |
| 7201 EngineTestCase.assertLength(0, typeParameters); | 7201 expect(typeParameters, hasLength(0)); |
| 7202 expect(type.isAbstract, isTrue); | 7202 expect(type.isAbstract, isTrue); |
| 7203 expect(type.isSynthetic, isFalse); | 7203 expect(type.isSynthetic, isFalse); |
| 7204 } | 7204 } |
| 7205 | 7205 |
| 7206 void test_visitClassDeclaration_minimal() { | 7206 void test_visitClassDeclaration_minimal() { |
| 7207 ElementHolder holder = new ElementHolder(); | 7207 ElementHolder holder = new ElementHolder(); |
| 7208 ElementBuilder builder = new ElementBuilder(holder); | 7208 ElementBuilder builder = new ElementBuilder(holder); |
| 7209 String className = "C"; | 7209 String className = "C"; |
| 7210 ClassDeclaration classDeclaration = | 7210 ClassDeclaration classDeclaration = |
| 7211 AstFactory.classDeclaration(null, className, null, null, null, null, [])
; | 7211 AstFactory.classDeclaration(null, className, null, null, null, null, [])
; |
| 7212 classDeclaration.accept(builder); | 7212 classDeclaration.accept(builder); |
| 7213 List<ClassElement> types = holder.types; | 7213 List<ClassElement> types = holder.types; |
| 7214 EngineTestCase.assertLength(1, types); | 7214 expect(types, hasLength(1)); |
| 7215 ClassElement type = types[0]; | 7215 ClassElement type = types[0]; |
| 7216 expect(type, isNotNull); | 7216 expect(type, isNotNull); |
| 7217 expect(type.name, className); | 7217 expect(type.name, className); |
| 7218 List<TypeParameterElement> typeParameters = type.typeParameters; | 7218 List<TypeParameterElement> typeParameters = type.typeParameters; |
| 7219 EngineTestCase.assertLength(0, typeParameters); | 7219 expect(typeParameters, hasLength(0)); |
| 7220 expect(type.isAbstract, isFalse); | 7220 expect(type.isAbstract, isFalse); |
| 7221 expect(type.isSynthetic, isFalse); | 7221 expect(type.isSynthetic, isFalse); |
| 7222 } | 7222 } |
| 7223 | 7223 |
| 7224 void test_visitClassDeclaration_parameterized() { | 7224 void test_visitClassDeclaration_parameterized() { |
| 7225 ElementHolder holder = new ElementHolder(); | 7225 ElementHolder holder = new ElementHolder(); |
| 7226 ElementBuilder builder = new ElementBuilder(holder); | 7226 ElementBuilder builder = new ElementBuilder(holder); |
| 7227 String className = "C"; | 7227 String className = "C"; |
| 7228 String firstVariableName = "E"; | 7228 String firstVariableName = "E"; |
| 7229 String secondVariableName = "F"; | 7229 String secondVariableName = "F"; |
| 7230 ClassDeclaration classDeclaration = AstFactory.classDeclaration( | 7230 ClassDeclaration classDeclaration = AstFactory.classDeclaration( |
| 7231 null, | 7231 null, |
| 7232 className, | 7232 className, |
| 7233 AstFactory.typeParameterList([firstVariableName, secondVariableName]), | 7233 AstFactory.typeParameterList([firstVariableName, secondVariableName]), |
| 7234 null, | 7234 null, |
| 7235 null, | 7235 null, |
| 7236 null, | 7236 null, |
| 7237 []); | 7237 []); |
| 7238 classDeclaration.accept(builder); | 7238 classDeclaration.accept(builder); |
| 7239 List<ClassElement> types = holder.types; | 7239 List<ClassElement> types = holder.types; |
| 7240 EngineTestCase.assertLength(1, types); | 7240 expect(types, hasLength(1)); |
| 7241 ClassElement type = types[0]; | 7241 ClassElement type = types[0]; |
| 7242 expect(type, isNotNull); | 7242 expect(type, isNotNull); |
| 7243 expect(type.name, className); | 7243 expect(type.name, className); |
| 7244 List<TypeParameterElement> typeParameters = type.typeParameters; | 7244 List<TypeParameterElement> typeParameters = type.typeParameters; |
| 7245 EngineTestCase.assertLength(2, typeParameters); | 7245 expect(typeParameters, hasLength(2)); |
| 7246 expect(typeParameters[0].name, firstVariableName); | 7246 expect(typeParameters[0].name, firstVariableName); |
| 7247 expect(typeParameters[1].name, secondVariableName); | 7247 expect(typeParameters[1].name, secondVariableName); |
| 7248 expect(type.isAbstract, isFalse); | 7248 expect(type.isAbstract, isFalse); |
| 7249 expect(type.isSynthetic, isFalse); | 7249 expect(type.isSynthetic, isFalse); |
| 7250 } | 7250 } |
| 7251 | 7251 |
| 7252 void test_visitClassDeclaration_withMembers() { | 7252 void test_visitClassDeclaration_withMembers() { |
| 7253 ElementHolder holder = new ElementHolder(); | 7253 ElementHolder holder = new ElementHolder(); |
| 7254 ElementBuilder builder = new ElementBuilder(holder); | 7254 ElementBuilder builder = new ElementBuilder(holder); |
| 7255 String className = "C"; | 7255 String className = "C"; |
| (...skipping 15 matching lines...) Expand all Loading... |
| 7271 AstFactory.methodDeclaration2( | 7271 AstFactory.methodDeclaration2( |
| 7272 null, | 7272 null, |
| 7273 null, | 7273 null, |
| 7274 null, | 7274 null, |
| 7275 null, | 7275 null, |
| 7276 AstFactory.identifier3(methodName), | 7276 AstFactory.identifier3(methodName), |
| 7277 AstFactory.formalParameterList([]), | 7277 AstFactory.formalParameterList([]), |
| 7278 AstFactory.blockFunctionBody2([]))]); | 7278 AstFactory.blockFunctionBody2([]))]); |
| 7279 classDeclaration.accept(builder); | 7279 classDeclaration.accept(builder); |
| 7280 List<ClassElement> types = holder.types; | 7280 List<ClassElement> types = holder.types; |
| 7281 EngineTestCase.assertLength(1, types); | 7281 expect(types, hasLength(1)); |
| 7282 ClassElement type = types[0]; | 7282 ClassElement type = types[0]; |
| 7283 expect(type, isNotNull); | 7283 expect(type, isNotNull); |
| 7284 expect(type.name, className); | 7284 expect(type.name, className); |
| 7285 expect(type.isAbstract, isFalse); | 7285 expect(type.isAbstract, isFalse); |
| 7286 expect(type.isSynthetic, isFalse); | 7286 expect(type.isSynthetic, isFalse); |
| 7287 List<TypeParameterElement> typeParameters = type.typeParameters; | 7287 List<TypeParameterElement> typeParameters = type.typeParameters; |
| 7288 EngineTestCase.assertLength(1, typeParameters); | 7288 expect(typeParameters, hasLength(1)); |
| 7289 TypeParameterElement typeParameter = typeParameters[0]; | 7289 TypeParameterElement typeParameter = typeParameters[0]; |
| 7290 expect(typeParameter, isNotNull); | 7290 expect(typeParameter, isNotNull); |
| 7291 expect(typeParameter.name, typeParameterName); | 7291 expect(typeParameter.name, typeParameterName); |
| 7292 List<FieldElement> fields = type.fields; | 7292 List<FieldElement> fields = type.fields; |
| 7293 EngineTestCase.assertLength(1, fields); | 7293 expect(fields, hasLength(1)); |
| 7294 FieldElement field = fields[0]; | 7294 FieldElement field = fields[0]; |
| 7295 expect(field, isNotNull); | 7295 expect(field, isNotNull); |
| 7296 expect(field.name, fieldName); | 7296 expect(field.name, fieldName); |
| 7297 List<MethodElement> methods = type.methods; | 7297 List<MethodElement> methods = type.methods; |
| 7298 EngineTestCase.assertLength(1, methods); | 7298 expect(methods, hasLength(1)); |
| 7299 MethodElement method = methods[0]; | 7299 MethodElement method = methods[0]; |
| 7300 expect(method, isNotNull); | 7300 expect(method, isNotNull); |
| 7301 expect(method.name, methodName); | 7301 expect(method.name, methodName); |
| 7302 } | 7302 } |
| 7303 | 7303 |
| 7304 void test_visitConstructorDeclaration_factory() { | 7304 void test_visitConstructorDeclaration_factory() { |
| 7305 ElementHolder holder = new ElementHolder(); | 7305 ElementHolder holder = new ElementHolder(); |
| 7306 ElementBuilder builder = new ElementBuilder(holder); | 7306 ElementBuilder builder = new ElementBuilder(holder); |
| 7307 String className = "A"; | 7307 String className = "A"; |
| 7308 ConstructorDeclaration constructorDeclaration = | 7308 ConstructorDeclaration constructorDeclaration = |
| 7309 AstFactory.constructorDeclaration2( | 7309 AstFactory.constructorDeclaration2( |
| 7310 null, | 7310 null, |
| 7311 Keyword.FACTORY, | 7311 Keyword.FACTORY, |
| 7312 AstFactory.identifier3(className), | 7312 AstFactory.identifier3(className), |
| 7313 null, | 7313 null, |
| 7314 AstFactory.formalParameterList([]), | 7314 AstFactory.formalParameterList([]), |
| 7315 null, | 7315 null, |
| 7316 AstFactory.blockFunctionBody2([])); | 7316 AstFactory.blockFunctionBody2([])); |
| 7317 constructorDeclaration.accept(builder); | 7317 constructorDeclaration.accept(builder); |
| 7318 List<ConstructorElement> constructors = holder.constructors; | 7318 List<ConstructorElement> constructors = holder.constructors; |
| 7319 EngineTestCase.assertLength(1, constructors); | 7319 expect(constructors, hasLength(1)); |
| 7320 ConstructorElement constructor = constructors[0]; | 7320 ConstructorElement constructor = constructors[0]; |
| 7321 expect(constructor, isNotNull); | 7321 expect(constructor, isNotNull); |
| 7322 expect(constructor.isFactory, isTrue); | 7322 expect(constructor.isFactory, isTrue); |
| 7323 expect(constructor.name, ""); | 7323 expect(constructor.name, ""); |
| 7324 EngineTestCase.assertLength(0, constructor.functions); | 7324 expect(constructor.functions, hasLength(0)); |
| 7325 EngineTestCase.assertLength(0, constructor.labels); | 7325 expect(constructor.labels, hasLength(0)); |
| 7326 EngineTestCase.assertLength(0, constructor.localVariables); | 7326 expect(constructor.localVariables, hasLength(0)); |
| 7327 EngineTestCase.assertLength(0, constructor.parameters); | 7327 expect(constructor.parameters, hasLength(0)); |
| 7328 } | 7328 } |
| 7329 | 7329 |
| 7330 void test_visitConstructorDeclaration_minimal() { | 7330 void test_visitConstructorDeclaration_minimal() { |
| 7331 ElementHolder holder = new ElementHolder(); | 7331 ElementHolder holder = new ElementHolder(); |
| 7332 ElementBuilder builder = new ElementBuilder(holder); | 7332 ElementBuilder builder = new ElementBuilder(holder); |
| 7333 String className = "A"; | 7333 String className = "A"; |
| 7334 ConstructorDeclaration constructorDeclaration = | 7334 ConstructorDeclaration constructorDeclaration = |
| 7335 AstFactory.constructorDeclaration2( | 7335 AstFactory.constructorDeclaration2( |
| 7336 null, | 7336 null, |
| 7337 null, | 7337 null, |
| 7338 AstFactory.identifier3(className), | 7338 AstFactory.identifier3(className), |
| 7339 null, | 7339 null, |
| 7340 AstFactory.formalParameterList([]), | 7340 AstFactory.formalParameterList([]), |
| 7341 null, | 7341 null, |
| 7342 AstFactory.blockFunctionBody2([])); | 7342 AstFactory.blockFunctionBody2([])); |
| 7343 constructorDeclaration.accept(builder); | 7343 constructorDeclaration.accept(builder); |
| 7344 List<ConstructorElement> constructors = holder.constructors; | 7344 List<ConstructorElement> constructors = holder.constructors; |
| 7345 EngineTestCase.assertLength(1, constructors); | 7345 expect(constructors, hasLength(1)); |
| 7346 ConstructorElement constructor = constructors[0]; | 7346 ConstructorElement constructor = constructors[0]; |
| 7347 expect(constructor, isNotNull); | 7347 expect(constructor, isNotNull); |
| 7348 expect(constructor.isFactory, isFalse); | 7348 expect(constructor.isFactory, isFalse); |
| 7349 expect(constructor.name, ""); | 7349 expect(constructor.name, ""); |
| 7350 EngineTestCase.assertLength(0, constructor.functions); | 7350 expect(constructor.functions, hasLength(0)); |
| 7351 EngineTestCase.assertLength(0, constructor.labels); | 7351 expect(constructor.labels, hasLength(0)); |
| 7352 EngineTestCase.assertLength(0, constructor.localVariables); | 7352 expect(constructor.localVariables, hasLength(0)); |
| 7353 EngineTestCase.assertLength(0, constructor.parameters); | 7353 expect(constructor.parameters, hasLength(0)); |
| 7354 } | 7354 } |
| 7355 | 7355 |
| 7356 void test_visitConstructorDeclaration_named() { | 7356 void test_visitConstructorDeclaration_named() { |
| 7357 ElementHolder holder = new ElementHolder(); | 7357 ElementHolder holder = new ElementHolder(); |
| 7358 ElementBuilder builder = new ElementBuilder(holder); | 7358 ElementBuilder builder = new ElementBuilder(holder); |
| 7359 String className = "A"; | 7359 String className = "A"; |
| 7360 String constructorName = "c"; | 7360 String constructorName = "c"; |
| 7361 ConstructorDeclaration constructorDeclaration = | 7361 ConstructorDeclaration constructorDeclaration = |
| 7362 AstFactory.constructorDeclaration2( | 7362 AstFactory.constructorDeclaration2( |
| 7363 null, | 7363 null, |
| 7364 null, | 7364 null, |
| 7365 AstFactory.identifier3(className), | 7365 AstFactory.identifier3(className), |
| 7366 constructorName, | 7366 constructorName, |
| 7367 AstFactory.formalParameterList([]), | 7367 AstFactory.formalParameterList([]), |
| 7368 null, | 7368 null, |
| 7369 AstFactory.blockFunctionBody2([])); | 7369 AstFactory.blockFunctionBody2([])); |
| 7370 constructorDeclaration.accept(builder); | 7370 constructorDeclaration.accept(builder); |
| 7371 List<ConstructorElement> constructors = holder.constructors; | 7371 List<ConstructorElement> constructors = holder.constructors; |
| 7372 EngineTestCase.assertLength(1, constructors); | 7372 expect(constructors, hasLength(1)); |
| 7373 ConstructorElement constructor = constructors[0]; | 7373 ConstructorElement constructor = constructors[0]; |
| 7374 expect(constructor, isNotNull); | 7374 expect(constructor, isNotNull); |
| 7375 expect(constructor.isFactory, isFalse); | 7375 expect(constructor.isFactory, isFalse); |
| 7376 expect(constructor.name, constructorName); | 7376 expect(constructor.name, constructorName); |
| 7377 EngineTestCase.assertLength(0, constructor.functions); | 7377 expect(constructor.functions, hasLength(0)); |
| 7378 EngineTestCase.assertLength(0, constructor.labels); | 7378 expect(constructor.labels, hasLength(0)); |
| 7379 EngineTestCase.assertLength(0, constructor.localVariables); | 7379 expect(constructor.localVariables, hasLength(0)); |
| 7380 EngineTestCase.assertLength(0, constructor.parameters); | 7380 expect(constructor.parameters, hasLength(0)); |
| 7381 expect(constructorDeclaration.name.staticElement, same(constructor)); | 7381 expect(constructorDeclaration.name.staticElement, same(constructor)); |
| 7382 expect(constructorDeclaration.element, same(constructor)); | 7382 expect(constructorDeclaration.element, same(constructor)); |
| 7383 } | 7383 } |
| 7384 | 7384 |
| 7385 void test_visitConstructorDeclaration_unnamed() { | 7385 void test_visitConstructorDeclaration_unnamed() { |
| 7386 ElementHolder holder = new ElementHolder(); | 7386 ElementHolder holder = new ElementHolder(); |
| 7387 ElementBuilder builder = new ElementBuilder(holder); | 7387 ElementBuilder builder = new ElementBuilder(holder); |
| 7388 String className = "A"; | 7388 String className = "A"; |
| 7389 ConstructorDeclaration constructorDeclaration = | 7389 ConstructorDeclaration constructorDeclaration = |
| 7390 AstFactory.constructorDeclaration2( | 7390 AstFactory.constructorDeclaration2( |
| 7391 null, | 7391 null, |
| 7392 null, | 7392 null, |
| 7393 AstFactory.identifier3(className), | 7393 AstFactory.identifier3(className), |
| 7394 null, | 7394 null, |
| 7395 AstFactory.formalParameterList([]), | 7395 AstFactory.formalParameterList([]), |
| 7396 null, | 7396 null, |
| 7397 AstFactory.blockFunctionBody2([])); | 7397 AstFactory.blockFunctionBody2([])); |
| 7398 constructorDeclaration.accept(builder); | 7398 constructorDeclaration.accept(builder); |
| 7399 List<ConstructorElement> constructors = holder.constructors; | 7399 List<ConstructorElement> constructors = holder.constructors; |
| 7400 EngineTestCase.assertLength(1, constructors); | 7400 expect(constructors, hasLength(1)); |
| 7401 ConstructorElement constructor = constructors[0]; | 7401 ConstructorElement constructor = constructors[0]; |
| 7402 expect(constructor, isNotNull); | 7402 expect(constructor, isNotNull); |
| 7403 expect(constructor.isFactory, isFalse); | 7403 expect(constructor.isFactory, isFalse); |
| 7404 expect(constructor.name, ""); | 7404 expect(constructor.name, ""); |
| 7405 EngineTestCase.assertLength(0, constructor.functions); | 7405 expect(constructor.functions, hasLength(0)); |
| 7406 EngineTestCase.assertLength(0, constructor.labels); | 7406 expect(constructor.labels, hasLength(0)); |
| 7407 EngineTestCase.assertLength(0, constructor.localVariables); | 7407 expect(constructor.localVariables, hasLength(0)); |
| 7408 EngineTestCase.assertLength(0, constructor.parameters); | 7408 expect(constructor.parameters, hasLength(0)); |
| 7409 expect(constructorDeclaration.element, same(constructor)); | 7409 expect(constructorDeclaration.element, same(constructor)); |
| 7410 } | 7410 } |
| 7411 | 7411 |
| 7412 void test_visitEnumDeclaration() { | 7412 void test_visitEnumDeclaration() { |
| 7413 ElementHolder holder = new ElementHolder(); | 7413 ElementHolder holder = new ElementHolder(); |
| 7414 ElementBuilder builder = new ElementBuilder(holder); | 7414 ElementBuilder builder = new ElementBuilder(holder); |
| 7415 String enumName = "E"; | 7415 String enumName = "E"; |
| 7416 EnumDeclaration enumDeclaration = | 7416 EnumDeclaration enumDeclaration = |
| 7417 AstFactory.enumDeclaration2(enumName, ["ONE"]); | 7417 AstFactory.enumDeclaration2(enumName, ["ONE"]); |
| 7418 enumDeclaration.accept(builder); | 7418 enumDeclaration.accept(builder); |
| 7419 List<ClassElement> enums = holder.enums; | 7419 List<ClassElement> enums = holder.enums; |
| 7420 EngineTestCase.assertLength(1, enums); | 7420 expect(enums, hasLength(1)); |
| 7421 ClassElement enumElement = enums[0]; | 7421 ClassElement enumElement = enums[0]; |
| 7422 expect(enumElement, isNotNull); | 7422 expect(enumElement, isNotNull); |
| 7423 expect(enumElement.name, enumName); | 7423 expect(enumElement.name, enumName); |
| 7424 } | 7424 } |
| 7425 | 7425 |
| 7426 void test_visitFieldDeclaration() { | 7426 void test_visitFieldDeclaration() { |
| 7427 ElementHolder holder = new ElementHolder(); | 7427 ElementHolder holder = new ElementHolder(); |
| 7428 ElementBuilder builder = new ElementBuilder(holder); | 7428 ElementBuilder builder = new ElementBuilder(holder); |
| 7429 String firstFieldName = "x"; | 7429 String firstFieldName = "x"; |
| 7430 String secondFieldName = "y"; | 7430 String secondFieldName = "y"; |
| 7431 FieldDeclaration fieldDeclaration = AstFactory.fieldDeclaration2( | 7431 FieldDeclaration fieldDeclaration = AstFactory.fieldDeclaration2( |
| 7432 false, | 7432 false, |
| 7433 null, | 7433 null, |
| 7434 [ | 7434 [ |
| 7435 AstFactory.variableDeclaration(firstFieldName), | 7435 AstFactory.variableDeclaration(firstFieldName), |
| 7436 AstFactory.variableDeclaration(secondFieldName)]); | 7436 AstFactory.variableDeclaration(secondFieldName)]); |
| 7437 fieldDeclaration.accept(builder); | 7437 fieldDeclaration.accept(builder); |
| 7438 List<FieldElement> fields = holder.fields; | 7438 List<FieldElement> fields = holder.fields; |
| 7439 EngineTestCase.assertLength(2, fields); | 7439 expect(fields, hasLength(2)); |
| 7440 FieldElement firstField = fields[0]; | 7440 FieldElement firstField = fields[0]; |
| 7441 expect(firstField, isNotNull); | 7441 expect(firstField, isNotNull); |
| 7442 expect(firstField.name, firstFieldName); | 7442 expect(firstField.name, firstFieldName); |
| 7443 expect(firstField.initializer, isNull); | 7443 expect(firstField.initializer, isNull); |
| 7444 expect(firstField.isConst, isFalse); | 7444 expect(firstField.isConst, isFalse); |
| 7445 expect(firstField.isFinal, isFalse); | 7445 expect(firstField.isFinal, isFalse); |
| 7446 expect(firstField.isSynthetic, isFalse); | 7446 expect(firstField.isSynthetic, isFalse); |
| 7447 FieldElement secondField = fields[1]; | 7447 FieldElement secondField = fields[1]; |
| 7448 expect(secondField, isNotNull); | 7448 expect(secondField, isNotNull); |
| 7449 expect(secondField.name, secondFieldName); | 7449 expect(secondField.name, secondFieldName); |
| 7450 expect(secondField.initializer, isNull); | 7450 expect(secondField.initializer, isNull); |
| 7451 expect(secondField.isConst, isFalse); | 7451 expect(secondField.isConst, isFalse); |
| 7452 expect(secondField.isFinal, isFalse); | 7452 expect(secondField.isFinal, isFalse); |
| 7453 expect(secondField.isSynthetic, isFalse); | 7453 expect(secondField.isSynthetic, isFalse); |
| 7454 } | 7454 } |
| 7455 | 7455 |
| 7456 void test_visitFieldFormalParameter() { | 7456 void test_visitFieldFormalParameter() { |
| 7457 ElementHolder holder = new ElementHolder(); | 7457 ElementHolder holder = new ElementHolder(); |
| 7458 ElementBuilder builder = new ElementBuilder(holder); | 7458 ElementBuilder builder = new ElementBuilder(holder); |
| 7459 String parameterName = "p"; | 7459 String parameterName = "p"; |
| 7460 FieldFormalParameter formalParameter = | 7460 FieldFormalParameter formalParameter = |
| 7461 AstFactory.fieldFormalParameter(null, null, parameterName); | 7461 AstFactory.fieldFormalParameter(null, null, parameterName); |
| 7462 formalParameter.accept(builder); | 7462 formalParameter.accept(builder); |
| 7463 List<ParameterElement> parameters = holder.parameters; | 7463 List<ParameterElement> parameters = holder.parameters; |
| 7464 EngineTestCase.assertLength(1, parameters); | 7464 expect(parameters, hasLength(1)); |
| 7465 ParameterElement parameter = parameters[0]; | 7465 ParameterElement parameter = parameters[0]; |
| 7466 expect(parameter, isNotNull); | 7466 expect(parameter, isNotNull); |
| 7467 expect(parameter.name, parameterName); | 7467 expect(parameter.name, parameterName); |
| 7468 expect(parameter.initializer, isNull); | 7468 expect(parameter.initializer, isNull); |
| 7469 expect(parameter.isConst, isFalse); | 7469 expect(parameter.isConst, isFalse); |
| 7470 expect(parameter.isFinal, isFalse); | 7470 expect(parameter.isFinal, isFalse); |
| 7471 expect(parameter.isSynthetic, isFalse); | 7471 expect(parameter.isSynthetic, isFalse); |
| 7472 expect(parameter.parameterKind, ParameterKind.REQUIRED); | 7472 expect(parameter.parameterKind, ParameterKind.REQUIRED); |
| 7473 EngineTestCase.assertLength(0, parameter.parameters); | 7473 expect(parameter.parameters, hasLength(0)); |
| 7474 } | 7474 } |
| 7475 | 7475 |
| 7476 void test_visitFieldFormalParameter_funtionTyped() { | 7476 void test_visitFieldFormalParameter_funtionTyped() { |
| 7477 ElementHolder holder = new ElementHolder(); | 7477 ElementHolder holder = new ElementHolder(); |
| 7478 ElementBuilder builder = new ElementBuilder(holder); | 7478 ElementBuilder builder = new ElementBuilder(holder); |
| 7479 String parameterName = "p"; | 7479 String parameterName = "p"; |
| 7480 FieldFormalParameter formalParameter = AstFactory.fieldFormalParameter( | 7480 FieldFormalParameter formalParameter = AstFactory.fieldFormalParameter( |
| 7481 null, | 7481 null, |
| 7482 null, | 7482 null, |
| 7483 parameterName, | 7483 parameterName, |
| 7484 AstFactory.formalParameterList([AstFactory.simpleFormalParameter3("a")])
); | 7484 AstFactory.formalParameterList([AstFactory.simpleFormalParameter3("a")])
); |
| 7485 formalParameter.accept(builder); | 7485 formalParameter.accept(builder); |
| 7486 List<ParameterElement> parameters = holder.parameters; | 7486 List<ParameterElement> parameters = holder.parameters; |
| 7487 EngineTestCase.assertLength(1, parameters); | 7487 expect(parameters, hasLength(1)); |
| 7488 ParameterElement parameter = parameters[0]; | 7488 ParameterElement parameter = parameters[0]; |
| 7489 expect(parameter, isNotNull); | 7489 expect(parameter, isNotNull); |
| 7490 expect(parameter.name, parameterName); | 7490 expect(parameter.name, parameterName); |
| 7491 expect(parameter.initializer, isNull); | 7491 expect(parameter.initializer, isNull); |
| 7492 expect(parameter.isConst, isFalse); | 7492 expect(parameter.isConst, isFalse); |
| 7493 expect(parameter.isFinal, isFalse); | 7493 expect(parameter.isFinal, isFalse); |
| 7494 expect(parameter.isSynthetic, isFalse); | 7494 expect(parameter.isSynthetic, isFalse); |
| 7495 expect(parameter.parameterKind, ParameterKind.REQUIRED); | 7495 expect(parameter.parameterKind, ParameterKind.REQUIRED); |
| 7496 EngineTestCase.assertLength(1, parameter.parameters); | 7496 expect(parameter.parameters, hasLength(1)); |
| 7497 } | 7497 } |
| 7498 | 7498 |
| 7499 void test_visitFormalParameterList() { | 7499 void test_visitFormalParameterList() { |
| 7500 ElementHolder holder = new ElementHolder(); | 7500 ElementHolder holder = new ElementHolder(); |
| 7501 ElementBuilder builder = new ElementBuilder(holder); | 7501 ElementBuilder builder = new ElementBuilder(holder); |
| 7502 String firstParameterName = "a"; | 7502 String firstParameterName = "a"; |
| 7503 String secondParameterName = "b"; | 7503 String secondParameterName = "b"; |
| 7504 FormalParameterList parameterList = AstFactory.formalParameterList( | 7504 FormalParameterList parameterList = AstFactory.formalParameterList( |
| 7505 [ | 7505 [ |
| 7506 AstFactory.simpleFormalParameter3(firstParameterName), | 7506 AstFactory.simpleFormalParameter3(firstParameterName), |
| 7507 AstFactory.simpleFormalParameter3(secondParameterName)]); | 7507 AstFactory.simpleFormalParameter3(secondParameterName)]); |
| 7508 parameterList.accept(builder); | 7508 parameterList.accept(builder); |
| 7509 List<ParameterElement> parameters = holder.parameters; | 7509 List<ParameterElement> parameters = holder.parameters; |
| 7510 EngineTestCase.assertLength(2, parameters); | 7510 expect(parameters, hasLength(2)); |
| 7511 expect(parameters[0].name, firstParameterName); | 7511 expect(parameters[0].name, firstParameterName); |
| 7512 expect(parameters[1].name, secondParameterName); | 7512 expect(parameters[1].name, secondParameterName); |
| 7513 } | 7513 } |
| 7514 | 7514 |
| 7515 void test_visitFunctionDeclaration_getter() { | 7515 void test_visitFunctionDeclaration_getter() { |
| 7516 ElementHolder holder = new ElementHolder(); | 7516 ElementHolder holder = new ElementHolder(); |
| 7517 ElementBuilder builder = new ElementBuilder(holder); | 7517 ElementBuilder builder = new ElementBuilder(holder); |
| 7518 String functionName = "f"; | 7518 String functionName = "f"; |
| 7519 FunctionDeclaration declaration = AstFactory.functionDeclaration( | 7519 FunctionDeclaration declaration = AstFactory.functionDeclaration( |
| 7520 null, | 7520 null, |
| 7521 Keyword.GET, | 7521 Keyword.GET, |
| 7522 functionName, | 7522 functionName, |
| 7523 AstFactory.functionExpression2( | 7523 AstFactory.functionExpression2( |
| 7524 AstFactory.formalParameterList([]), | 7524 AstFactory.formalParameterList([]), |
| 7525 AstFactory.blockFunctionBody2([]))); | 7525 AstFactory.blockFunctionBody2([]))); |
| 7526 declaration.accept(builder); | 7526 declaration.accept(builder); |
| 7527 List<PropertyAccessorElement> accessors = holder.accessors; | 7527 List<PropertyAccessorElement> accessors = holder.accessors; |
| 7528 EngineTestCase.assertLength(1, accessors); | 7528 expect(accessors, hasLength(1)); |
| 7529 PropertyAccessorElement accessor = accessors[0]; | 7529 PropertyAccessorElement accessor = accessors[0]; |
| 7530 expect(accessor, isNotNull); | 7530 expect(accessor, isNotNull); |
| 7531 expect(accessor.name, functionName); | 7531 expect(accessor.name, functionName); |
| 7532 expect(declaration.element, same(accessor)); | 7532 expect(declaration.element, same(accessor)); |
| 7533 expect(declaration.functionExpression.element, same(accessor)); | 7533 expect(declaration.functionExpression.element, same(accessor)); |
| 7534 expect(accessor.isGetter, isTrue); | 7534 expect(accessor.isGetter, isTrue); |
| 7535 expect(accessor.isSetter, isFalse); | 7535 expect(accessor.isSetter, isFalse); |
| 7536 expect(accessor.isSynthetic, isFalse); | 7536 expect(accessor.isSynthetic, isFalse); |
| 7537 PropertyInducingElement variable = accessor.variable; | 7537 PropertyInducingElement variable = accessor.variable; |
| 7538 EngineTestCase.assertInstanceOf( | 7538 EngineTestCase.assertInstanceOf( |
| 7539 (obj) => obj is TopLevelVariableElement, | 7539 (obj) => obj is TopLevelVariableElement, |
| 7540 TopLevelVariableElement, | 7540 TopLevelVariableElement, |
| 7541 variable); | 7541 variable); |
| 7542 expect(variable.isSynthetic, isTrue); | 7542 expect(variable.isSynthetic, isTrue); |
| 7543 } | 7543 } |
| 7544 | 7544 |
| 7545 void test_visitFunctionDeclaration_plain() { | 7545 void test_visitFunctionDeclaration_plain() { |
| 7546 ElementHolder holder = new ElementHolder(); | 7546 ElementHolder holder = new ElementHolder(); |
| 7547 ElementBuilder builder = new ElementBuilder(holder); | 7547 ElementBuilder builder = new ElementBuilder(holder); |
| 7548 String functionName = "f"; | 7548 String functionName = "f"; |
| 7549 FunctionDeclaration declaration = AstFactory.functionDeclaration( | 7549 FunctionDeclaration declaration = AstFactory.functionDeclaration( |
| 7550 null, | 7550 null, |
| 7551 null, | 7551 null, |
| 7552 functionName, | 7552 functionName, |
| 7553 AstFactory.functionExpression2( | 7553 AstFactory.functionExpression2( |
| 7554 AstFactory.formalParameterList([]), | 7554 AstFactory.formalParameterList([]), |
| 7555 AstFactory.blockFunctionBody2([]))); | 7555 AstFactory.blockFunctionBody2([]))); |
| 7556 declaration.accept(builder); | 7556 declaration.accept(builder); |
| 7557 List<FunctionElement> functions = holder.functions; | 7557 List<FunctionElement> functions = holder.functions; |
| 7558 EngineTestCase.assertLength(1, functions); | 7558 expect(functions, hasLength(1)); |
| 7559 FunctionElement function = functions[0]; | 7559 FunctionElement function = functions[0]; |
| 7560 expect(function, isNotNull); | 7560 expect(function, isNotNull); |
| 7561 expect(function.name, functionName); | 7561 expect(function.name, functionName); |
| 7562 expect(declaration.element, same(function)); | 7562 expect(declaration.element, same(function)); |
| 7563 expect(declaration.functionExpression.element, same(function)); | 7563 expect(declaration.functionExpression.element, same(function)); |
| 7564 expect(function.isSynthetic, isFalse); | 7564 expect(function.isSynthetic, isFalse); |
| 7565 } | 7565 } |
| 7566 | 7566 |
| 7567 void test_visitFunctionDeclaration_setter() { | 7567 void test_visitFunctionDeclaration_setter() { |
| 7568 ElementHolder holder = new ElementHolder(); | 7568 ElementHolder holder = new ElementHolder(); |
| 7569 ElementBuilder builder = new ElementBuilder(holder); | 7569 ElementBuilder builder = new ElementBuilder(holder); |
| 7570 String functionName = "f"; | 7570 String functionName = "f"; |
| 7571 FunctionDeclaration declaration = AstFactory.functionDeclaration( | 7571 FunctionDeclaration declaration = AstFactory.functionDeclaration( |
| 7572 null, | 7572 null, |
| 7573 Keyword.SET, | 7573 Keyword.SET, |
| 7574 functionName, | 7574 functionName, |
| 7575 AstFactory.functionExpression2( | 7575 AstFactory.functionExpression2( |
| 7576 AstFactory.formalParameterList([]), | 7576 AstFactory.formalParameterList([]), |
| 7577 AstFactory.blockFunctionBody2([]))); | 7577 AstFactory.blockFunctionBody2([]))); |
| 7578 declaration.accept(builder); | 7578 declaration.accept(builder); |
| 7579 List<PropertyAccessorElement> accessors = holder.accessors; | 7579 List<PropertyAccessorElement> accessors = holder.accessors; |
| 7580 EngineTestCase.assertLength(1, accessors); | 7580 expect(accessors, hasLength(1)); |
| 7581 PropertyAccessorElement accessor = accessors[0]; | 7581 PropertyAccessorElement accessor = accessors[0]; |
| 7582 expect(accessor, isNotNull); | 7582 expect(accessor, isNotNull); |
| 7583 expect(accessor.name, "$functionName="); | 7583 expect(accessor.name, "$functionName="); |
| 7584 expect(declaration.element, same(accessor)); | 7584 expect(declaration.element, same(accessor)); |
| 7585 expect(declaration.functionExpression.element, same(accessor)); | 7585 expect(declaration.functionExpression.element, same(accessor)); |
| 7586 expect(accessor.isGetter, isFalse); | 7586 expect(accessor.isGetter, isFalse); |
| 7587 expect(accessor.isSetter, isTrue); | 7587 expect(accessor.isSetter, isTrue); |
| 7588 expect(accessor.isSynthetic, isFalse); | 7588 expect(accessor.isSynthetic, isFalse); |
| 7589 PropertyInducingElement variable = accessor.variable; | 7589 PropertyInducingElement variable = accessor.variable; |
| 7590 EngineTestCase.assertInstanceOf( | 7590 EngineTestCase.assertInstanceOf( |
| 7591 (obj) => obj is TopLevelVariableElement, | 7591 (obj) => obj is TopLevelVariableElement, |
| 7592 TopLevelVariableElement, | 7592 TopLevelVariableElement, |
| 7593 variable); | 7593 variable); |
| 7594 expect(variable.isSynthetic, isTrue); | 7594 expect(variable.isSynthetic, isTrue); |
| 7595 } | 7595 } |
| 7596 | 7596 |
| 7597 void test_visitFunctionExpression() { | 7597 void test_visitFunctionExpression() { |
| 7598 ElementHolder holder = new ElementHolder(); | 7598 ElementHolder holder = new ElementHolder(); |
| 7599 ElementBuilder builder = new ElementBuilder(holder); | 7599 ElementBuilder builder = new ElementBuilder(holder); |
| 7600 FunctionExpression expression = AstFactory.functionExpression2( | 7600 FunctionExpression expression = AstFactory.functionExpression2( |
| 7601 AstFactory.formalParameterList([]), | 7601 AstFactory.formalParameterList([]), |
| 7602 AstFactory.blockFunctionBody2([])); | 7602 AstFactory.blockFunctionBody2([])); |
| 7603 expression.accept(builder); | 7603 expression.accept(builder); |
| 7604 List<FunctionElement> functions = holder.functions; | 7604 List<FunctionElement> functions = holder.functions; |
| 7605 EngineTestCase.assertLength(1, functions); | 7605 expect(functions, hasLength(1)); |
| 7606 FunctionElement function = functions[0]; | 7606 FunctionElement function = functions[0]; |
| 7607 expect(function, isNotNull); | 7607 expect(function, isNotNull); |
| 7608 expect(expression.element, same(function)); | 7608 expect(expression.element, same(function)); |
| 7609 expect(function.isSynthetic, isFalse); | 7609 expect(function.isSynthetic, isFalse); |
| 7610 } | 7610 } |
| 7611 | 7611 |
| 7612 void test_visitFunctionTypeAlias() { | 7612 void test_visitFunctionTypeAlias() { |
| 7613 ElementHolder holder = new ElementHolder(); | 7613 ElementHolder holder = new ElementHolder(); |
| 7614 ElementBuilder builder = new ElementBuilder(holder); | 7614 ElementBuilder builder = new ElementBuilder(holder); |
| 7615 String aliasName = "F"; | 7615 String aliasName = "F"; |
| 7616 String parameterName = "E"; | 7616 String parameterName = "E"; |
| 7617 FunctionTypeAlias aliasNode = AstFactory.typeAlias( | 7617 FunctionTypeAlias aliasNode = AstFactory.typeAlias( |
| 7618 null, | 7618 null, |
| 7619 aliasName, | 7619 aliasName, |
| 7620 AstFactory.typeParameterList([parameterName]), | 7620 AstFactory.typeParameterList([parameterName]), |
| 7621 null); | 7621 null); |
| 7622 aliasNode.accept(builder); | 7622 aliasNode.accept(builder); |
| 7623 List<FunctionTypeAliasElement> aliases = holder.typeAliases; | 7623 List<FunctionTypeAliasElement> aliases = holder.typeAliases; |
| 7624 EngineTestCase.assertLength(1, aliases); | 7624 expect(aliases, hasLength(1)); |
| 7625 FunctionTypeAliasElement alias = aliases[0]; | 7625 FunctionTypeAliasElement alias = aliases[0]; |
| 7626 expect(alias, isNotNull); | 7626 expect(alias, isNotNull); |
| 7627 expect(alias.name, aliasName); | 7627 expect(alias.name, aliasName); |
| 7628 EngineTestCase.assertLength(0, alias.parameters); | 7628 expect(alias.parameters, hasLength(0)); |
| 7629 List<TypeParameterElement> typeParameters = alias.typeParameters; | 7629 List<TypeParameterElement> typeParameters = alias.typeParameters; |
| 7630 EngineTestCase.assertLength(1, typeParameters); | 7630 expect(typeParameters, hasLength(1)); |
| 7631 TypeParameterElement typeParameter = typeParameters[0]; | 7631 TypeParameterElement typeParameter = typeParameters[0]; |
| 7632 expect(typeParameter, isNotNull); | 7632 expect(typeParameter, isNotNull); |
| 7633 expect(typeParameter.name, parameterName); | 7633 expect(typeParameter.name, parameterName); |
| 7634 } | 7634 } |
| 7635 | 7635 |
| 7636 void test_visitFunctionTypedFormalParameter() { | 7636 void test_visitFunctionTypedFormalParameter() { |
| 7637 ElementHolder holder = new ElementHolder(); | 7637 ElementHolder holder = new ElementHolder(); |
| 7638 ElementBuilder builder = new ElementBuilder(holder); | 7638 ElementBuilder builder = new ElementBuilder(holder); |
| 7639 String parameterName = "p"; | 7639 String parameterName = "p"; |
| 7640 FunctionTypedFormalParameter formalParameter = | 7640 FunctionTypedFormalParameter formalParameter = |
| 7641 AstFactory.functionTypedFormalParameter(null, parameterName, []); | 7641 AstFactory.functionTypedFormalParameter(null, parameterName, []); |
| 7642 _useParameterInMethod(formalParameter, 100, 110); | 7642 _useParameterInMethod(formalParameter, 100, 110); |
| 7643 formalParameter.accept(builder); | 7643 formalParameter.accept(builder); |
| 7644 List<ParameterElement> parameters = holder.parameters; | 7644 List<ParameterElement> parameters = holder.parameters; |
| 7645 EngineTestCase.assertLength(1, parameters); | 7645 expect(parameters, hasLength(1)); |
| 7646 ParameterElement parameter = parameters[0]; | 7646 ParameterElement parameter = parameters[0]; |
| 7647 expect(parameter, isNotNull); | 7647 expect(parameter, isNotNull); |
| 7648 expect(parameter.name, parameterName); | 7648 expect(parameter.name, parameterName); |
| 7649 expect(parameter.initializer, isNull); | 7649 expect(parameter.initializer, isNull); |
| 7650 expect(parameter.isConst, isFalse); | 7650 expect(parameter.isConst, isFalse); |
| 7651 expect(parameter.isFinal, isFalse); | 7651 expect(parameter.isFinal, isFalse); |
| 7652 expect(parameter.isSynthetic, isFalse); | 7652 expect(parameter.isSynthetic, isFalse); |
| 7653 expect(parameter.parameterKind, ParameterKind.REQUIRED); | 7653 expect(parameter.parameterKind, ParameterKind.REQUIRED); |
| 7654 { | 7654 { |
| 7655 SourceRange visibleRange = parameter.visibleRange; | 7655 SourceRange visibleRange = parameter.visibleRange; |
| 7656 expect(100, visibleRange.offset); | 7656 expect(100, visibleRange.offset); |
| 7657 expect(110, visibleRange.end); | 7657 expect(110, visibleRange.end); |
| 7658 } | 7658 } |
| 7659 } | 7659 } |
| 7660 | 7660 |
| 7661 void test_visitLabeledStatement() { | 7661 void test_visitLabeledStatement() { |
| 7662 ElementHolder holder = new ElementHolder(); | 7662 ElementHolder holder = new ElementHolder(); |
| 7663 ElementBuilder builder = new ElementBuilder(holder); | 7663 ElementBuilder builder = new ElementBuilder(holder); |
| 7664 String labelName = "l"; | 7664 String labelName = "l"; |
| 7665 LabeledStatement statement = AstFactory.labeledStatement( | 7665 LabeledStatement statement = AstFactory.labeledStatement( |
| 7666 AstFactory.list([AstFactory.label2(labelName)]), | 7666 AstFactory.list([AstFactory.label2(labelName)]), |
| 7667 AstFactory.breakStatement()); | 7667 AstFactory.breakStatement()); |
| 7668 statement.accept(builder); | 7668 statement.accept(builder); |
| 7669 List<LabelElement> labels = holder.labels; | 7669 List<LabelElement> labels = holder.labels; |
| 7670 EngineTestCase.assertLength(1, labels); | 7670 expect(labels, hasLength(1)); |
| 7671 LabelElement label = labels[0]; | 7671 LabelElement label = labels[0]; |
| 7672 expect(label, isNotNull); | 7672 expect(label, isNotNull); |
| 7673 expect(label.name, labelName); | 7673 expect(label.name, labelName); |
| 7674 expect(label.isSynthetic, isFalse); | 7674 expect(label.isSynthetic, isFalse); |
| 7675 } | 7675 } |
| 7676 | 7676 |
| 7677 void test_visitMethodDeclaration_abstract() { | 7677 void test_visitMethodDeclaration_abstract() { |
| 7678 ElementHolder holder = new ElementHolder(); | 7678 ElementHolder holder = new ElementHolder(); |
| 7679 ElementBuilder builder = new ElementBuilder(holder); | 7679 ElementBuilder builder = new ElementBuilder(holder); |
| 7680 String methodName = "m"; | 7680 String methodName = "m"; |
| 7681 MethodDeclaration methodDeclaration = AstFactory.methodDeclaration2( | 7681 MethodDeclaration methodDeclaration = AstFactory.methodDeclaration2( |
| 7682 null, | 7682 null, |
| 7683 null, | 7683 null, |
| 7684 null, | 7684 null, |
| 7685 null, | 7685 null, |
| 7686 AstFactory.identifier3(methodName), | 7686 AstFactory.identifier3(methodName), |
| 7687 AstFactory.formalParameterList([]), | 7687 AstFactory.formalParameterList([]), |
| 7688 AstFactory.emptyFunctionBody()); | 7688 AstFactory.emptyFunctionBody()); |
| 7689 methodDeclaration.accept(builder); | 7689 methodDeclaration.accept(builder); |
| 7690 List<MethodElement> methods = holder.methods; | 7690 List<MethodElement> methods = holder.methods; |
| 7691 EngineTestCase.assertLength(1, methods); | 7691 expect(methods, hasLength(1)); |
| 7692 MethodElement method = methods[0]; | 7692 MethodElement method = methods[0]; |
| 7693 expect(method, isNotNull); | 7693 expect(method, isNotNull); |
| 7694 expect(method.name, methodName); | 7694 expect(method.name, methodName); |
| 7695 EngineTestCase.assertLength(0, method.functions); | 7695 expect(method.functions, hasLength(0)); |
| 7696 EngineTestCase.assertLength(0, method.labels); | 7696 expect(method.labels, hasLength(0)); |
| 7697 EngineTestCase.assertLength(0, method.localVariables); | 7697 expect(method.localVariables, hasLength(0)); |
| 7698 EngineTestCase.assertLength(0, method.parameters); | 7698 expect(method.parameters, hasLength(0)); |
| 7699 expect(method.isAbstract, isTrue); | 7699 expect(method.isAbstract, isTrue); |
| 7700 expect(method.isStatic, isFalse); | 7700 expect(method.isStatic, isFalse); |
| 7701 expect(method.isSynthetic, isFalse); | 7701 expect(method.isSynthetic, isFalse); |
| 7702 } | 7702 } |
| 7703 | 7703 |
| 7704 void test_visitMethodDeclaration_getter() { | 7704 void test_visitMethodDeclaration_getter() { |
| 7705 ElementHolder holder = new ElementHolder(); | 7705 ElementHolder holder = new ElementHolder(); |
| 7706 ElementBuilder builder = new ElementBuilder(holder); | 7706 ElementBuilder builder = new ElementBuilder(holder); |
| 7707 String methodName = "m"; | 7707 String methodName = "m"; |
| 7708 MethodDeclaration methodDeclaration = AstFactory.methodDeclaration2( | 7708 MethodDeclaration methodDeclaration = AstFactory.methodDeclaration2( |
| 7709 null, | 7709 null, |
| 7710 null, | 7710 null, |
| 7711 Keyword.GET, | 7711 Keyword.GET, |
| 7712 null, | 7712 null, |
| 7713 AstFactory.identifier3(methodName), | 7713 AstFactory.identifier3(methodName), |
| 7714 AstFactory.formalParameterList([]), | 7714 AstFactory.formalParameterList([]), |
| 7715 AstFactory.blockFunctionBody2([])); | 7715 AstFactory.blockFunctionBody2([])); |
| 7716 methodDeclaration.accept(builder); | 7716 methodDeclaration.accept(builder); |
| 7717 List<FieldElement> fields = holder.fields; | 7717 List<FieldElement> fields = holder.fields; |
| 7718 EngineTestCase.assertLength(1, fields); | 7718 expect(fields, hasLength(1)); |
| 7719 FieldElement field = fields[0]; | 7719 FieldElement field = fields[0]; |
| 7720 expect(field, isNotNull); | 7720 expect(field, isNotNull); |
| 7721 expect(field.name, methodName); | 7721 expect(field.name, methodName); |
| 7722 expect(field.isSynthetic, isTrue); | 7722 expect(field.isSynthetic, isTrue); |
| 7723 expect(field.setter, isNull); | 7723 expect(field.setter, isNull); |
| 7724 PropertyAccessorElement getter = field.getter; | 7724 PropertyAccessorElement getter = field.getter; |
| 7725 expect(getter, isNotNull); | 7725 expect(getter, isNotNull); |
| 7726 expect(getter.isAbstract, isFalse); | 7726 expect(getter.isAbstract, isFalse); |
| 7727 expect(getter.isGetter, isTrue); | 7727 expect(getter.isGetter, isTrue); |
| 7728 expect(getter.isSynthetic, isFalse); | 7728 expect(getter.isSynthetic, isFalse); |
| 7729 expect(getter.name, methodName); | 7729 expect(getter.name, methodName); |
| 7730 expect(getter.variable, field); | 7730 expect(getter.variable, field); |
| 7731 EngineTestCase.assertLength(0, getter.functions); | 7731 expect(getter.functions, hasLength(0)); |
| 7732 EngineTestCase.assertLength(0, getter.labels); | 7732 expect(getter.labels, hasLength(0)); |
| 7733 EngineTestCase.assertLength(0, getter.localVariables); | 7733 expect(getter.localVariables, hasLength(0)); |
| 7734 EngineTestCase.assertLength(0, getter.parameters); | 7734 expect(getter.parameters, hasLength(0)); |
| 7735 } | 7735 } |
| 7736 | 7736 |
| 7737 void test_visitMethodDeclaration_getter_abstract() { | 7737 void test_visitMethodDeclaration_getter_abstract() { |
| 7738 ElementHolder holder = new ElementHolder(); | 7738 ElementHolder holder = new ElementHolder(); |
| 7739 ElementBuilder builder = new ElementBuilder(holder); | 7739 ElementBuilder builder = new ElementBuilder(holder); |
| 7740 String methodName = "m"; | 7740 String methodName = "m"; |
| 7741 MethodDeclaration methodDeclaration = AstFactory.methodDeclaration2( | 7741 MethodDeclaration methodDeclaration = AstFactory.methodDeclaration2( |
| 7742 null, | 7742 null, |
| 7743 null, | 7743 null, |
| 7744 Keyword.GET, | 7744 Keyword.GET, |
| 7745 null, | 7745 null, |
| 7746 AstFactory.identifier3(methodName), | 7746 AstFactory.identifier3(methodName), |
| 7747 AstFactory.formalParameterList([]), | 7747 AstFactory.formalParameterList([]), |
| 7748 AstFactory.emptyFunctionBody()); | 7748 AstFactory.emptyFunctionBody()); |
| 7749 methodDeclaration.accept(builder); | 7749 methodDeclaration.accept(builder); |
| 7750 List<FieldElement> fields = holder.fields; | 7750 List<FieldElement> fields = holder.fields; |
| 7751 EngineTestCase.assertLength(1, fields); | 7751 expect(fields, hasLength(1)); |
| 7752 FieldElement field = fields[0]; | 7752 FieldElement field = fields[0]; |
| 7753 expect(field, isNotNull); | 7753 expect(field, isNotNull); |
| 7754 expect(field.name, methodName); | 7754 expect(field.name, methodName); |
| 7755 expect(field.isSynthetic, isTrue); | 7755 expect(field.isSynthetic, isTrue); |
| 7756 expect(field.setter, isNull); | 7756 expect(field.setter, isNull); |
| 7757 PropertyAccessorElement getter = field.getter; | 7757 PropertyAccessorElement getter = field.getter; |
| 7758 expect(getter, isNotNull); | 7758 expect(getter, isNotNull); |
| 7759 expect(getter.isAbstract, isTrue); | 7759 expect(getter.isAbstract, isTrue); |
| 7760 expect(getter.isGetter, isTrue); | 7760 expect(getter.isGetter, isTrue); |
| 7761 expect(getter.isSynthetic, isFalse); | 7761 expect(getter.isSynthetic, isFalse); |
| 7762 expect(getter.name, methodName); | 7762 expect(getter.name, methodName); |
| 7763 expect(getter.variable, field); | 7763 expect(getter.variable, field); |
| 7764 EngineTestCase.assertLength(0, getter.functions); | 7764 expect(getter.functions, hasLength(0)); |
| 7765 EngineTestCase.assertLength(0, getter.labels); | 7765 expect(getter.labels, hasLength(0)); |
| 7766 EngineTestCase.assertLength(0, getter.localVariables); | 7766 expect(getter.localVariables, hasLength(0)); |
| 7767 EngineTestCase.assertLength(0, getter.parameters); | 7767 expect(getter.parameters, hasLength(0)); |
| 7768 } | 7768 } |
| 7769 | 7769 |
| 7770 void test_visitMethodDeclaration_getter_external() { | 7770 void test_visitMethodDeclaration_getter_external() { |
| 7771 ElementHolder holder = new ElementHolder(); | 7771 ElementHolder holder = new ElementHolder(); |
| 7772 ElementBuilder builder = new ElementBuilder(holder); | 7772 ElementBuilder builder = new ElementBuilder(holder); |
| 7773 String methodName = "m"; | 7773 String methodName = "m"; |
| 7774 MethodDeclaration methodDeclaration = AstFactory.methodDeclaration( | 7774 MethodDeclaration methodDeclaration = AstFactory.methodDeclaration( |
| 7775 null, | 7775 null, |
| 7776 null, | 7776 null, |
| 7777 Keyword.GET, | 7777 Keyword.GET, |
| 7778 null, | 7778 null, |
| 7779 AstFactory.identifier3(methodName), | 7779 AstFactory.identifier3(methodName), |
| 7780 AstFactory.formalParameterList([])); | 7780 AstFactory.formalParameterList([])); |
| 7781 methodDeclaration.accept(builder); | 7781 methodDeclaration.accept(builder); |
| 7782 List<FieldElement> fields = holder.fields; | 7782 List<FieldElement> fields = holder.fields; |
| 7783 EngineTestCase.assertLength(1, fields); | 7783 expect(fields, hasLength(1)); |
| 7784 FieldElement field = fields[0]; | 7784 FieldElement field = fields[0]; |
| 7785 expect(field, isNotNull); | 7785 expect(field, isNotNull); |
| 7786 expect(field.name, methodName); | 7786 expect(field.name, methodName); |
| 7787 expect(field.isSynthetic, isTrue); | 7787 expect(field.isSynthetic, isTrue); |
| 7788 expect(field.setter, isNull); | 7788 expect(field.setter, isNull); |
| 7789 PropertyAccessorElement getter = field.getter; | 7789 PropertyAccessorElement getter = field.getter; |
| 7790 expect(getter, isNotNull); | 7790 expect(getter, isNotNull); |
| 7791 expect(getter.isAbstract, isFalse); | 7791 expect(getter.isAbstract, isFalse); |
| 7792 expect(getter.isGetter, isTrue); | 7792 expect(getter.isGetter, isTrue); |
| 7793 expect(getter.isSynthetic, isFalse); | 7793 expect(getter.isSynthetic, isFalse); |
| 7794 expect(getter.name, methodName); | 7794 expect(getter.name, methodName); |
| 7795 expect(getter.variable, field); | 7795 expect(getter.variable, field); |
| 7796 EngineTestCase.assertLength(0, getter.functions); | 7796 expect(getter.functions, hasLength(0)); |
| 7797 EngineTestCase.assertLength(0, getter.labels); | 7797 expect(getter.labels, hasLength(0)); |
| 7798 EngineTestCase.assertLength(0, getter.localVariables); | 7798 expect(getter.localVariables, hasLength(0)); |
| 7799 EngineTestCase.assertLength(0, getter.parameters); | 7799 expect(getter.parameters, hasLength(0)); |
| 7800 } | 7800 } |
| 7801 | 7801 |
| 7802 void test_visitMethodDeclaration_minimal() { | 7802 void test_visitMethodDeclaration_minimal() { |
| 7803 ElementHolder holder = new ElementHolder(); | 7803 ElementHolder holder = new ElementHolder(); |
| 7804 ElementBuilder builder = new ElementBuilder(holder); | 7804 ElementBuilder builder = new ElementBuilder(holder); |
| 7805 String methodName = "m"; | 7805 String methodName = "m"; |
| 7806 MethodDeclaration methodDeclaration = AstFactory.methodDeclaration2( | 7806 MethodDeclaration methodDeclaration = AstFactory.methodDeclaration2( |
| 7807 null, | 7807 null, |
| 7808 null, | 7808 null, |
| 7809 null, | 7809 null, |
| 7810 null, | 7810 null, |
| 7811 AstFactory.identifier3(methodName), | 7811 AstFactory.identifier3(methodName), |
| 7812 AstFactory.formalParameterList([]), | 7812 AstFactory.formalParameterList([]), |
| 7813 AstFactory.blockFunctionBody2([])); | 7813 AstFactory.blockFunctionBody2([])); |
| 7814 methodDeclaration.accept(builder); | 7814 methodDeclaration.accept(builder); |
| 7815 List<MethodElement> methods = holder.methods; | 7815 List<MethodElement> methods = holder.methods; |
| 7816 EngineTestCase.assertLength(1, methods); | 7816 expect(methods, hasLength(1)); |
| 7817 MethodElement method = methods[0]; | 7817 MethodElement method = methods[0]; |
| 7818 expect(method, isNotNull); | 7818 expect(method, isNotNull); |
| 7819 expect(method.name, methodName); | 7819 expect(method.name, methodName); |
| 7820 EngineTestCase.assertLength(0, method.functions); | 7820 expect(method.functions, hasLength(0)); |
| 7821 EngineTestCase.assertLength(0, method.labels); | 7821 expect(method.labels, hasLength(0)); |
| 7822 EngineTestCase.assertLength(0, method.localVariables); | 7822 expect(method.localVariables, hasLength(0)); |
| 7823 EngineTestCase.assertLength(0, method.parameters); | 7823 expect(method.parameters, hasLength(0)); |
| 7824 expect(method.isAbstract, isFalse); | 7824 expect(method.isAbstract, isFalse); |
| 7825 expect(method.isStatic, isFalse); | 7825 expect(method.isStatic, isFalse); |
| 7826 expect(method.isSynthetic, isFalse); | 7826 expect(method.isSynthetic, isFalse); |
| 7827 } | 7827 } |
| 7828 | 7828 |
| 7829 void test_visitMethodDeclaration_operator() { | 7829 void test_visitMethodDeclaration_operator() { |
| 7830 ElementHolder holder = new ElementHolder(); | 7830 ElementHolder holder = new ElementHolder(); |
| 7831 ElementBuilder builder = new ElementBuilder(holder); | 7831 ElementBuilder builder = new ElementBuilder(holder); |
| 7832 String methodName = "+"; | 7832 String methodName = "+"; |
| 7833 MethodDeclaration methodDeclaration = AstFactory.methodDeclaration2( | 7833 MethodDeclaration methodDeclaration = AstFactory.methodDeclaration2( |
| 7834 null, | 7834 null, |
| 7835 null, | 7835 null, |
| 7836 null, | 7836 null, |
| 7837 Keyword.OPERATOR, | 7837 Keyword.OPERATOR, |
| 7838 AstFactory.identifier3(methodName), | 7838 AstFactory.identifier3(methodName), |
| 7839 AstFactory.formalParameterList([AstFactory.simpleFormalParameter3("adden
d")]), | 7839 AstFactory.formalParameterList([AstFactory.simpleFormalParameter3("adden
d")]), |
| 7840 AstFactory.blockFunctionBody2([])); | 7840 AstFactory.blockFunctionBody2([])); |
| 7841 methodDeclaration.accept(builder); | 7841 methodDeclaration.accept(builder); |
| 7842 List<MethodElement> methods = holder.methods; | 7842 List<MethodElement> methods = holder.methods; |
| 7843 EngineTestCase.assertLength(1, methods); | 7843 expect(methods, hasLength(1)); |
| 7844 MethodElement method = methods[0]; | 7844 MethodElement method = methods[0]; |
| 7845 expect(method, isNotNull); | 7845 expect(method, isNotNull); |
| 7846 expect(method.name, methodName); | 7846 expect(method.name, methodName); |
| 7847 EngineTestCase.assertLength(0, method.functions); | 7847 expect(method.functions, hasLength(0)); |
| 7848 EngineTestCase.assertLength(0, method.labels); | 7848 expect(method.labels, hasLength(0)); |
| 7849 EngineTestCase.assertLength(0, method.localVariables); | 7849 expect(method.localVariables, hasLength(0)); |
| 7850 EngineTestCase.assertLength(1, method.parameters); | 7850 expect(method.parameters, hasLength(1)); |
| 7851 expect(method.isAbstract, isFalse); | 7851 expect(method.isAbstract, isFalse); |
| 7852 expect(method.isStatic, isFalse); | 7852 expect(method.isStatic, isFalse); |
| 7853 expect(method.isSynthetic, isFalse); | 7853 expect(method.isSynthetic, isFalse); |
| 7854 } | 7854 } |
| 7855 | 7855 |
| 7856 void test_visitMethodDeclaration_setter() { | 7856 void test_visitMethodDeclaration_setter() { |
| 7857 ElementHolder holder = new ElementHolder(); | 7857 ElementHolder holder = new ElementHolder(); |
| 7858 ElementBuilder builder = new ElementBuilder(holder); | 7858 ElementBuilder builder = new ElementBuilder(holder); |
| 7859 String methodName = "m"; | 7859 String methodName = "m"; |
| 7860 MethodDeclaration methodDeclaration = AstFactory.methodDeclaration2( | 7860 MethodDeclaration methodDeclaration = AstFactory.methodDeclaration2( |
| 7861 null, | 7861 null, |
| 7862 null, | 7862 null, |
| 7863 Keyword.SET, | 7863 Keyword.SET, |
| 7864 null, | 7864 null, |
| 7865 AstFactory.identifier3(methodName), | 7865 AstFactory.identifier3(methodName), |
| 7866 AstFactory.formalParameterList([]), | 7866 AstFactory.formalParameterList([]), |
| 7867 AstFactory.blockFunctionBody2([])); | 7867 AstFactory.blockFunctionBody2([])); |
| 7868 methodDeclaration.accept(builder); | 7868 methodDeclaration.accept(builder); |
| 7869 List<FieldElement> fields = holder.fields; | 7869 List<FieldElement> fields = holder.fields; |
| 7870 EngineTestCase.assertLength(1, fields); | 7870 expect(fields, hasLength(1)); |
| 7871 FieldElement field = fields[0]; | 7871 FieldElement field = fields[0]; |
| 7872 expect(field, isNotNull); | 7872 expect(field, isNotNull); |
| 7873 expect(field.name, methodName); | 7873 expect(field.name, methodName); |
| 7874 expect(field.isSynthetic, isTrue); | 7874 expect(field.isSynthetic, isTrue); |
| 7875 expect(field.getter, isNull); | 7875 expect(field.getter, isNull); |
| 7876 PropertyAccessorElement setter = field.setter; | 7876 PropertyAccessorElement setter = field.setter; |
| 7877 expect(setter, isNotNull); | 7877 expect(setter, isNotNull); |
| 7878 expect(setter.isAbstract, isFalse); | 7878 expect(setter.isAbstract, isFalse); |
| 7879 expect(setter.isSetter, isTrue); | 7879 expect(setter.isSetter, isTrue); |
| 7880 expect(setter.isSynthetic, isFalse); | 7880 expect(setter.isSynthetic, isFalse); |
| 7881 expect(setter.name, "$methodName="); | 7881 expect(setter.name, "$methodName="); |
| 7882 expect(setter.displayName, methodName); | 7882 expect(setter.displayName, methodName); |
| 7883 expect(setter.variable, field); | 7883 expect(setter.variable, field); |
| 7884 EngineTestCase.assertLength(0, setter.functions); | 7884 expect(setter.functions, hasLength(0)); |
| 7885 EngineTestCase.assertLength(0, setter.labels); | 7885 expect(setter.labels, hasLength(0)); |
| 7886 EngineTestCase.assertLength(0, setter.localVariables); | 7886 expect(setter.localVariables, hasLength(0)); |
| 7887 EngineTestCase.assertLength(0, setter.parameters); | 7887 expect(setter.parameters, hasLength(0)); |
| 7888 } | 7888 } |
| 7889 | 7889 |
| 7890 void test_visitMethodDeclaration_setter_abstract() { | 7890 void test_visitMethodDeclaration_setter_abstract() { |
| 7891 ElementHolder holder = new ElementHolder(); | 7891 ElementHolder holder = new ElementHolder(); |
| 7892 ElementBuilder builder = new ElementBuilder(holder); | 7892 ElementBuilder builder = new ElementBuilder(holder); |
| 7893 String methodName = "m"; | 7893 String methodName = "m"; |
| 7894 MethodDeclaration methodDeclaration = AstFactory.methodDeclaration2( | 7894 MethodDeclaration methodDeclaration = AstFactory.methodDeclaration2( |
| 7895 null, | 7895 null, |
| 7896 null, | 7896 null, |
| 7897 Keyword.SET, | 7897 Keyword.SET, |
| 7898 null, | 7898 null, |
| 7899 AstFactory.identifier3(methodName), | 7899 AstFactory.identifier3(methodName), |
| 7900 AstFactory.formalParameterList([]), | 7900 AstFactory.formalParameterList([]), |
| 7901 AstFactory.emptyFunctionBody()); | 7901 AstFactory.emptyFunctionBody()); |
| 7902 methodDeclaration.accept(builder); | 7902 methodDeclaration.accept(builder); |
| 7903 List<FieldElement> fields = holder.fields; | 7903 List<FieldElement> fields = holder.fields; |
| 7904 EngineTestCase.assertLength(1, fields); | 7904 expect(fields, hasLength(1)); |
| 7905 FieldElement field = fields[0]; | 7905 FieldElement field = fields[0]; |
| 7906 expect(field, isNotNull); | 7906 expect(field, isNotNull); |
| 7907 expect(field.name, methodName); | 7907 expect(field.name, methodName); |
| 7908 expect(field.isSynthetic, isTrue); | 7908 expect(field.isSynthetic, isTrue); |
| 7909 expect(field.getter, isNull); | 7909 expect(field.getter, isNull); |
| 7910 PropertyAccessorElement setter = field.setter; | 7910 PropertyAccessorElement setter = field.setter; |
| 7911 expect(setter, isNotNull); | 7911 expect(setter, isNotNull); |
| 7912 expect(setter.isAbstract, isTrue); | 7912 expect(setter.isAbstract, isTrue); |
| 7913 expect(setter.isSetter, isTrue); | 7913 expect(setter.isSetter, isTrue); |
| 7914 expect(setter.isSynthetic, isFalse); | 7914 expect(setter.isSynthetic, isFalse); |
| 7915 expect(setter.name, "$methodName="); | 7915 expect(setter.name, "$methodName="); |
| 7916 expect(setter.displayName, methodName); | 7916 expect(setter.displayName, methodName); |
| 7917 expect(setter.variable, field); | 7917 expect(setter.variable, field); |
| 7918 EngineTestCase.assertLength(0, setter.functions); | 7918 expect(setter.functions, hasLength(0)); |
| 7919 EngineTestCase.assertLength(0, setter.labels); | 7919 expect(setter.labels, hasLength(0)); |
| 7920 EngineTestCase.assertLength(0, setter.localVariables); | 7920 expect(setter.localVariables, hasLength(0)); |
| 7921 EngineTestCase.assertLength(0, setter.parameters); | 7921 expect(setter.parameters, hasLength(0)); |
| 7922 } | 7922 } |
| 7923 | 7923 |
| 7924 void test_visitMethodDeclaration_setter_external() { | 7924 void test_visitMethodDeclaration_setter_external() { |
| 7925 ElementHolder holder = new ElementHolder(); | 7925 ElementHolder holder = new ElementHolder(); |
| 7926 ElementBuilder builder = new ElementBuilder(holder); | 7926 ElementBuilder builder = new ElementBuilder(holder); |
| 7927 String methodName = "m"; | 7927 String methodName = "m"; |
| 7928 MethodDeclaration methodDeclaration = AstFactory.methodDeclaration( | 7928 MethodDeclaration methodDeclaration = AstFactory.methodDeclaration( |
| 7929 null, | 7929 null, |
| 7930 null, | 7930 null, |
| 7931 Keyword.SET, | 7931 Keyword.SET, |
| 7932 null, | 7932 null, |
| 7933 AstFactory.identifier3(methodName), | 7933 AstFactory.identifier3(methodName), |
| 7934 AstFactory.formalParameterList([])); | 7934 AstFactory.formalParameterList([])); |
| 7935 methodDeclaration.accept(builder); | 7935 methodDeclaration.accept(builder); |
| 7936 List<FieldElement> fields = holder.fields; | 7936 List<FieldElement> fields = holder.fields; |
| 7937 EngineTestCase.assertLength(1, fields); | 7937 expect(fields, hasLength(1)); |
| 7938 FieldElement field = fields[0]; | 7938 FieldElement field = fields[0]; |
| 7939 expect(field, isNotNull); | 7939 expect(field, isNotNull); |
| 7940 expect(field.name, methodName); | 7940 expect(field.name, methodName); |
| 7941 expect(field.isSynthetic, isTrue); | 7941 expect(field.isSynthetic, isTrue); |
| 7942 expect(field.getter, isNull); | 7942 expect(field.getter, isNull); |
| 7943 PropertyAccessorElement setter = field.setter; | 7943 PropertyAccessorElement setter = field.setter; |
| 7944 expect(setter, isNotNull); | 7944 expect(setter, isNotNull); |
| 7945 expect(setter.isAbstract, isFalse); | 7945 expect(setter.isAbstract, isFalse); |
| 7946 expect(setter.isSetter, isTrue); | 7946 expect(setter.isSetter, isTrue); |
| 7947 expect(setter.isSynthetic, isFalse); | 7947 expect(setter.isSynthetic, isFalse); |
| 7948 expect(setter.name, "$methodName="); | 7948 expect(setter.name, "$methodName="); |
| 7949 expect(setter.displayName, methodName); | 7949 expect(setter.displayName, methodName); |
| 7950 expect(setter.variable, field); | 7950 expect(setter.variable, field); |
| 7951 EngineTestCase.assertLength(0, setter.functions); | 7951 expect(setter.functions, hasLength(0)); |
| 7952 EngineTestCase.assertLength(0, setter.labels); | 7952 expect(setter.labels, hasLength(0)); |
| 7953 EngineTestCase.assertLength(0, setter.localVariables); | 7953 expect(setter.localVariables, hasLength(0)); |
| 7954 EngineTestCase.assertLength(0, setter.parameters); | 7954 expect(setter.parameters, hasLength(0)); |
| 7955 } | 7955 } |
| 7956 | 7956 |
| 7957 void test_visitMethodDeclaration_static() { | 7957 void test_visitMethodDeclaration_static() { |
| 7958 ElementHolder holder = new ElementHolder(); | 7958 ElementHolder holder = new ElementHolder(); |
| 7959 ElementBuilder builder = new ElementBuilder(holder); | 7959 ElementBuilder builder = new ElementBuilder(holder); |
| 7960 String methodName = "m"; | 7960 String methodName = "m"; |
| 7961 MethodDeclaration methodDeclaration = AstFactory.methodDeclaration2( | 7961 MethodDeclaration methodDeclaration = AstFactory.methodDeclaration2( |
| 7962 Keyword.STATIC, | 7962 Keyword.STATIC, |
| 7963 null, | 7963 null, |
| 7964 null, | 7964 null, |
| 7965 null, | 7965 null, |
| 7966 AstFactory.identifier3(methodName), | 7966 AstFactory.identifier3(methodName), |
| 7967 AstFactory.formalParameterList([]), | 7967 AstFactory.formalParameterList([]), |
| 7968 AstFactory.blockFunctionBody2([])); | 7968 AstFactory.blockFunctionBody2([])); |
| 7969 methodDeclaration.accept(builder); | 7969 methodDeclaration.accept(builder); |
| 7970 List<MethodElement> methods = holder.methods; | 7970 List<MethodElement> methods = holder.methods; |
| 7971 EngineTestCase.assertLength(1, methods); | 7971 expect(methods, hasLength(1)); |
| 7972 MethodElement method = methods[0]; | 7972 MethodElement method = methods[0]; |
| 7973 expect(method, isNotNull); | 7973 expect(method, isNotNull); |
| 7974 expect(method.name, methodName); | 7974 expect(method.name, methodName); |
| 7975 EngineTestCase.assertLength(0, method.functions); | 7975 expect(method.functions, hasLength(0)); |
| 7976 EngineTestCase.assertLength(0, method.labels); | 7976 expect(method.labels, hasLength(0)); |
| 7977 EngineTestCase.assertLength(0, method.localVariables); | 7977 expect(method.localVariables, hasLength(0)); |
| 7978 EngineTestCase.assertLength(0, method.parameters); | 7978 expect(method.parameters, hasLength(0)); |
| 7979 expect(method.isAbstract, isFalse); | 7979 expect(method.isAbstract, isFalse); |
| 7980 expect(method.isStatic, isTrue); | 7980 expect(method.isStatic, isTrue); |
| 7981 expect(method.isSynthetic, isFalse); | 7981 expect(method.isSynthetic, isFalse); |
| 7982 } | 7982 } |
| 7983 | 7983 |
| 7984 void test_visitMethodDeclaration_withMembers() { | 7984 void test_visitMethodDeclaration_withMembers() { |
| 7985 ElementHolder holder = new ElementHolder(); | 7985 ElementHolder holder = new ElementHolder(); |
| 7986 ElementBuilder builder = new ElementBuilder(holder); | 7986 ElementBuilder builder = new ElementBuilder(holder); |
| 7987 String methodName = "m"; | 7987 String methodName = "m"; |
| 7988 String parameterName = "p"; | 7988 String parameterName = "p"; |
| (...skipping 15 matching lines...) Expand all Loading... |
| 8004 [AstFactory.variableDeclaration(localVariableName)]), | 8004 [AstFactory.variableDeclaration(localVariableName)]), |
| 8005 AstFactory.tryStatement2( | 8005 AstFactory.tryStatement2( |
| 8006 AstFactory.block( | 8006 AstFactory.block( |
| 8007 [ | 8007 [ |
| 8008 AstFactory.labeledStatement( | 8008 AstFactory.labeledStatement( |
| 8009 AstFactory.list([AstFactory.label2(labelName)]), | 8009 AstFactory.list([AstFactory.label2(labelName)]), |
| 8010 AstFactory.returnStatement())]), | 8010 AstFactory.returnStatement())]), |
| 8011 [AstFactory.catchClause(exceptionParameterName, [])])])); | 8011 [AstFactory.catchClause(exceptionParameterName, [])])])); |
| 8012 methodDeclaration.accept(builder); | 8012 methodDeclaration.accept(builder); |
| 8013 List<MethodElement> methods = holder.methods; | 8013 List<MethodElement> methods = holder.methods; |
| 8014 EngineTestCase.assertLength(1, methods); | 8014 expect(methods, hasLength(1)); |
| 8015 MethodElement method = methods[0]; | 8015 MethodElement method = methods[0]; |
| 8016 expect(method, isNotNull); | 8016 expect(method, isNotNull); |
| 8017 expect(method.name, methodName); | 8017 expect(method.name, methodName); |
| 8018 expect(method.isAbstract, isFalse); | 8018 expect(method.isAbstract, isFalse); |
| 8019 expect(method.isStatic, isFalse); | 8019 expect(method.isStatic, isFalse); |
| 8020 expect(method.isSynthetic, isFalse); | 8020 expect(method.isSynthetic, isFalse); |
| 8021 List<VariableElement> parameters = method.parameters; | 8021 List<VariableElement> parameters = method.parameters; |
| 8022 EngineTestCase.assertLength(1, parameters); | 8022 expect(parameters, hasLength(1)); |
| 8023 VariableElement parameter = parameters[0]; | 8023 VariableElement parameter = parameters[0]; |
| 8024 expect(parameter, isNotNull); | 8024 expect(parameter, isNotNull); |
| 8025 expect(parameter.name, parameterName); | 8025 expect(parameter.name, parameterName); |
| 8026 List<VariableElement> localVariables = method.localVariables; | 8026 List<VariableElement> localVariables = method.localVariables; |
| 8027 EngineTestCase.assertLength(2, localVariables); | 8027 expect(localVariables, hasLength(2)); |
| 8028 VariableElement firstVariable = localVariables[0]; | 8028 VariableElement firstVariable = localVariables[0]; |
| 8029 VariableElement secondVariable = localVariables[1]; | 8029 VariableElement secondVariable = localVariables[1]; |
| 8030 expect(firstVariable, isNotNull); | 8030 expect(firstVariable, isNotNull); |
| 8031 expect(secondVariable, isNotNull); | 8031 expect(secondVariable, isNotNull); |
| 8032 expect((firstVariable.name == localVariableName && | 8032 expect((firstVariable.name == localVariableName && |
| 8033 secondVariable.name == exceptionParameterName) || | 8033 secondVariable.name == exceptionParameterName) || |
| 8034 (firstVariable.name == exceptionParameterName && | 8034 (firstVariable.name == exceptionParameterName && |
| 8035 secondVariable.name == localVariableName), isTrue); | 8035 secondVariable.name == localVariableName), isTrue); |
| 8036 List<LabelElement> labels = method.labels; | 8036 List<LabelElement> labels = method.labels; |
| 8037 EngineTestCase.assertLength(1, labels); | 8037 expect(labels, hasLength(1)); |
| 8038 LabelElement label = labels[0]; | 8038 LabelElement label = labels[0]; |
| 8039 expect(label, isNotNull); | 8039 expect(label, isNotNull); |
| 8040 expect(label.name, labelName); | 8040 expect(label.name, labelName); |
| 8041 } | 8041 } |
| 8042 | 8042 |
| 8043 void test_visitNamedFormalParameter() { | 8043 void test_visitNamedFormalParameter() { |
| 8044 ElementHolder holder = new ElementHolder(); | 8044 ElementHolder holder = new ElementHolder(); |
| 8045 ElementBuilder builder = new ElementBuilder(holder); | 8045 ElementBuilder builder = new ElementBuilder(holder); |
| 8046 String parameterName = "p"; | 8046 String parameterName = "p"; |
| 8047 DefaultFormalParameter formalParameter = AstFactory.namedFormalParameter( | 8047 DefaultFormalParameter formalParameter = AstFactory.namedFormalParameter( |
| 8048 AstFactory.simpleFormalParameter3(parameterName), | 8048 AstFactory.simpleFormalParameter3(parameterName), |
| 8049 AstFactory.identifier3("42")); | 8049 AstFactory.identifier3("42")); |
| 8050 _useParameterInMethod(formalParameter, 100, 110); | 8050 _useParameterInMethod(formalParameter, 100, 110); |
| 8051 formalParameter.accept(builder); | 8051 formalParameter.accept(builder); |
| 8052 List<ParameterElement> parameters = holder.parameters; | 8052 List<ParameterElement> parameters = holder.parameters; |
| 8053 EngineTestCase.assertLength(1, parameters); | 8053 expect(parameters, hasLength(1)); |
| 8054 ParameterElement parameter = parameters[0]; | 8054 ParameterElement parameter = parameters[0]; |
| 8055 expect(parameter, isNotNull); | 8055 expect(parameter, isNotNull); |
| 8056 expect(parameter.name, parameterName); | 8056 expect(parameter.name, parameterName); |
| 8057 expect(parameter.isConst, isFalse); | 8057 expect(parameter.isConst, isFalse); |
| 8058 expect(parameter.isFinal, isFalse); | 8058 expect(parameter.isFinal, isFalse); |
| 8059 expect(parameter.isSynthetic, isFalse); | 8059 expect(parameter.isSynthetic, isFalse); |
| 8060 expect(parameter.parameterKind, ParameterKind.NAMED); | 8060 expect(parameter.parameterKind, ParameterKind.NAMED); |
| 8061 { | 8061 { |
| 8062 SourceRange visibleRange = parameter.visibleRange; | 8062 SourceRange visibleRange = parameter.visibleRange; |
| 8063 expect(100, visibleRange.offset); | 8063 expect(100, visibleRange.offset); |
| 8064 expect(110, visibleRange.end); | 8064 expect(110, visibleRange.end); |
| 8065 } | 8065 } |
| 8066 expect(parameter.defaultValueCode, "42"); | 8066 expect(parameter.defaultValueCode, "42"); |
| 8067 FunctionElement initializer = parameter.initializer; | 8067 FunctionElement initializer = parameter.initializer; |
| 8068 expect(initializer, isNotNull); | 8068 expect(initializer, isNotNull); |
| 8069 expect(initializer.isSynthetic, isTrue); | 8069 expect(initializer.isSynthetic, isTrue); |
| 8070 } | 8070 } |
| 8071 | 8071 |
| 8072 void test_visitSimpleFormalParameter() { | 8072 void test_visitSimpleFormalParameter() { |
| 8073 ElementHolder holder = new ElementHolder(); | 8073 ElementHolder holder = new ElementHolder(); |
| 8074 ElementBuilder builder = new ElementBuilder(holder); | 8074 ElementBuilder builder = new ElementBuilder(holder); |
| 8075 String parameterName = "p"; | 8075 String parameterName = "p"; |
| 8076 SimpleFormalParameter formalParameter = | 8076 SimpleFormalParameter formalParameter = |
| 8077 AstFactory.simpleFormalParameter3(parameterName); | 8077 AstFactory.simpleFormalParameter3(parameterName); |
| 8078 _useParameterInMethod(formalParameter, 100, 110); | 8078 _useParameterInMethod(formalParameter, 100, 110); |
| 8079 formalParameter.accept(builder); | 8079 formalParameter.accept(builder); |
| 8080 List<ParameterElement> parameters = holder.parameters; | 8080 List<ParameterElement> parameters = holder.parameters; |
| 8081 EngineTestCase.assertLength(1, parameters); | 8081 expect(parameters, hasLength(1)); |
| 8082 ParameterElement parameter = parameters[0]; | 8082 ParameterElement parameter = parameters[0]; |
| 8083 expect(parameter, isNotNull); | 8083 expect(parameter, isNotNull); |
| 8084 expect(parameter.name, parameterName); | 8084 expect(parameter.name, parameterName); |
| 8085 expect(parameter.initializer, isNull); | 8085 expect(parameter.initializer, isNull); |
| 8086 expect(parameter.isConst, isFalse); | 8086 expect(parameter.isConst, isFalse); |
| 8087 expect(parameter.isFinal, isFalse); | 8087 expect(parameter.isFinal, isFalse); |
| 8088 expect(parameter.isSynthetic, isFalse); | 8088 expect(parameter.isSynthetic, isFalse); |
| 8089 expect(parameter.parameterKind, ParameterKind.REQUIRED); | 8089 expect(parameter.parameterKind, ParameterKind.REQUIRED); |
| 8090 { | 8090 { |
| 8091 SourceRange visibleRange = parameter.visibleRange; | 8091 SourceRange visibleRange = parameter.visibleRange; |
| 8092 expect(100, visibleRange.offset); | 8092 expect(100, visibleRange.offset); |
| 8093 expect(110, visibleRange.end); | 8093 expect(110, visibleRange.end); |
| 8094 } | 8094 } |
| 8095 } | 8095 } |
| 8096 | 8096 |
| 8097 void test_visitTypeAlias_minimal() { | 8097 void test_visitTypeAlias_minimal() { |
| 8098 ElementHolder holder = new ElementHolder(); | 8098 ElementHolder holder = new ElementHolder(); |
| 8099 ElementBuilder builder = new ElementBuilder(holder); | 8099 ElementBuilder builder = new ElementBuilder(holder); |
| 8100 String aliasName = "F"; | 8100 String aliasName = "F"; |
| 8101 TypeAlias typeAlias = AstFactory.typeAlias(null, aliasName, null, null); | 8101 TypeAlias typeAlias = AstFactory.typeAlias(null, aliasName, null, null); |
| 8102 typeAlias.accept(builder); | 8102 typeAlias.accept(builder); |
| 8103 List<FunctionTypeAliasElement> aliases = holder.typeAliases; | 8103 List<FunctionTypeAliasElement> aliases = holder.typeAliases; |
| 8104 EngineTestCase.assertLength(1, aliases); | 8104 expect(aliases, hasLength(1)); |
| 8105 FunctionTypeAliasElement alias = aliases[0]; | 8105 FunctionTypeAliasElement alias = aliases[0]; |
| 8106 expect(alias, isNotNull); | 8106 expect(alias, isNotNull); |
| 8107 expect(alias.name, aliasName); | 8107 expect(alias.name, aliasName); |
| 8108 expect(alias.type, isNotNull); | 8108 expect(alias.type, isNotNull); |
| 8109 expect(alias.isSynthetic, isFalse); | 8109 expect(alias.isSynthetic, isFalse); |
| 8110 } | 8110 } |
| 8111 | 8111 |
| 8112 void test_visitTypeAlias_withFormalParameters() { | 8112 void test_visitTypeAlias_withFormalParameters() { |
| 8113 ElementHolder holder = new ElementHolder(); | 8113 ElementHolder holder = new ElementHolder(); |
| 8114 ElementBuilder builder = new ElementBuilder(holder); | 8114 ElementBuilder builder = new ElementBuilder(holder); |
| 8115 String aliasName = "F"; | 8115 String aliasName = "F"; |
| 8116 String firstParameterName = "x"; | 8116 String firstParameterName = "x"; |
| 8117 String secondParameterName = "y"; | 8117 String secondParameterName = "y"; |
| 8118 TypeAlias typeAlias = AstFactory.typeAlias( | 8118 TypeAlias typeAlias = AstFactory.typeAlias( |
| 8119 null, | 8119 null, |
| 8120 aliasName, | 8120 aliasName, |
| 8121 AstFactory.typeParameterList([]), | 8121 AstFactory.typeParameterList([]), |
| 8122 AstFactory.formalParameterList( | 8122 AstFactory.formalParameterList( |
| 8123 [ | 8123 [ |
| 8124 AstFactory.simpleFormalParameter3(firstParameterName), | 8124 AstFactory.simpleFormalParameter3(firstParameterName), |
| 8125 AstFactory.simpleFormalParameter3(secondParameterName)])); | 8125 AstFactory.simpleFormalParameter3(secondParameterName)])); |
| 8126 typeAlias.accept(builder); | 8126 typeAlias.accept(builder); |
| 8127 List<FunctionTypeAliasElement> aliases = holder.typeAliases; | 8127 List<FunctionTypeAliasElement> aliases = holder.typeAliases; |
| 8128 EngineTestCase.assertLength(1, aliases); | 8128 expect(aliases, hasLength(1)); |
| 8129 FunctionTypeAliasElement alias = aliases[0]; | 8129 FunctionTypeAliasElement alias = aliases[0]; |
| 8130 expect(alias, isNotNull); | 8130 expect(alias, isNotNull); |
| 8131 expect(alias.name, aliasName); | 8131 expect(alias.name, aliasName); |
| 8132 expect(alias.type, isNotNull); | 8132 expect(alias.type, isNotNull); |
| 8133 expect(alias.isSynthetic, isFalse); | 8133 expect(alias.isSynthetic, isFalse); |
| 8134 List<VariableElement> parameters = alias.parameters; | 8134 List<VariableElement> parameters = alias.parameters; |
| 8135 EngineTestCase.assertLength(2, parameters); | 8135 expect(parameters, hasLength(2)); |
| 8136 expect(parameters[0].name, firstParameterName); | 8136 expect(parameters[0].name, firstParameterName); |
| 8137 expect(parameters[1].name, secondParameterName); | 8137 expect(parameters[1].name, secondParameterName); |
| 8138 List<TypeParameterElement> typeParameters = alias.typeParameters; | 8138 List<TypeParameterElement> typeParameters = alias.typeParameters; |
| 8139 expect(typeParameters, isNotNull); | 8139 expect(typeParameters, isNotNull); |
| 8140 EngineTestCase.assertLength(0, typeParameters); | 8140 expect(typeParameters, hasLength(0)); |
| 8141 } | 8141 } |
| 8142 | 8142 |
| 8143 void test_visitTypeAlias_withTypeParameters() { | 8143 void test_visitTypeAlias_withTypeParameters() { |
| 8144 ElementHolder holder = new ElementHolder(); | 8144 ElementHolder holder = new ElementHolder(); |
| 8145 ElementBuilder builder = new ElementBuilder(holder); | 8145 ElementBuilder builder = new ElementBuilder(holder); |
| 8146 String aliasName = "F"; | 8146 String aliasName = "F"; |
| 8147 String firstTypeParameterName = "A"; | 8147 String firstTypeParameterName = "A"; |
| 8148 String secondTypeParameterName = "B"; | 8148 String secondTypeParameterName = "B"; |
| 8149 TypeAlias typeAlias = AstFactory.typeAlias( | 8149 TypeAlias typeAlias = AstFactory.typeAlias( |
| 8150 null, | 8150 null, |
| 8151 aliasName, | 8151 aliasName, |
| 8152 AstFactory.typeParameterList([firstTypeParameterName, secondTypeParamete
rName]), | 8152 AstFactory.typeParameterList([firstTypeParameterName, secondTypeParamete
rName]), |
| 8153 AstFactory.formalParameterList([])); | 8153 AstFactory.formalParameterList([])); |
| 8154 typeAlias.accept(builder); | 8154 typeAlias.accept(builder); |
| 8155 List<FunctionTypeAliasElement> aliases = holder.typeAliases; | 8155 List<FunctionTypeAliasElement> aliases = holder.typeAliases; |
| 8156 EngineTestCase.assertLength(1, aliases); | 8156 expect(aliases, hasLength(1)); |
| 8157 FunctionTypeAliasElement alias = aliases[0]; | 8157 FunctionTypeAliasElement alias = aliases[0]; |
| 8158 expect(alias, isNotNull); | 8158 expect(alias, isNotNull); |
| 8159 expect(alias.name, aliasName); | 8159 expect(alias.name, aliasName); |
| 8160 expect(alias.type, isNotNull); | 8160 expect(alias.type, isNotNull); |
| 8161 expect(alias.isSynthetic, isFalse); | 8161 expect(alias.isSynthetic, isFalse); |
| 8162 List<VariableElement> parameters = alias.parameters; | 8162 List<VariableElement> parameters = alias.parameters; |
| 8163 expect(parameters, isNotNull); | 8163 expect(parameters, isNotNull); |
| 8164 EngineTestCase.assertLength(0, parameters); | 8164 expect(parameters, hasLength(0)); |
| 8165 List<TypeParameterElement> typeParameters = alias.typeParameters; | 8165 List<TypeParameterElement> typeParameters = alias.typeParameters; |
| 8166 EngineTestCase.assertLength(2, typeParameters); | 8166 expect(typeParameters, hasLength(2)); |
| 8167 expect(typeParameters[0].name, firstTypeParameterName); | 8167 expect(typeParameters[0].name, firstTypeParameterName); |
| 8168 expect(typeParameters[1].name, secondTypeParameterName); | 8168 expect(typeParameters[1].name, secondTypeParameterName); |
| 8169 } | 8169 } |
| 8170 | 8170 |
| 8171 void test_visitTypeParameter() { | 8171 void test_visitTypeParameter() { |
| 8172 ElementHolder holder = new ElementHolder(); | 8172 ElementHolder holder = new ElementHolder(); |
| 8173 ElementBuilder builder = new ElementBuilder(holder); | 8173 ElementBuilder builder = new ElementBuilder(holder); |
| 8174 String parameterName = "E"; | 8174 String parameterName = "E"; |
| 8175 TypeParameter typeParameter = AstFactory.typeParameter(parameterName); | 8175 TypeParameter typeParameter = AstFactory.typeParameter(parameterName); |
| 8176 typeParameter.accept(builder); | 8176 typeParameter.accept(builder); |
| 8177 List<TypeParameterElement> typeParameters = holder.typeParameters; | 8177 List<TypeParameterElement> typeParameters = holder.typeParameters; |
| 8178 EngineTestCase.assertLength(1, typeParameters); | 8178 expect(typeParameters, hasLength(1)); |
| 8179 TypeParameterElement typeParameterElement = typeParameters[0]; | 8179 TypeParameterElement typeParameterElement = typeParameters[0]; |
| 8180 expect(typeParameterElement, isNotNull); | 8180 expect(typeParameterElement, isNotNull); |
| 8181 expect(typeParameterElement.name, parameterName); | 8181 expect(typeParameterElement.name, parameterName); |
| 8182 expect(typeParameterElement.bound, isNull); | 8182 expect(typeParameterElement.bound, isNull); |
| 8183 expect(typeParameterElement.isSynthetic, isFalse); | 8183 expect(typeParameterElement.isSynthetic, isFalse); |
| 8184 } | 8184 } |
| 8185 | 8185 |
| 8186 void test_visitVariableDeclaration_inConstructor() { | 8186 void test_visitVariableDeclaration_inConstructor() { |
| 8187 ElementHolder holder = new ElementHolder(); | 8187 ElementHolder holder = new ElementHolder(); |
| 8188 ElementBuilder builder = new ElementBuilder(holder); | 8188 ElementBuilder builder = new ElementBuilder(holder); |
| 8189 // | 8189 // |
| 8190 // C() {var v;} | 8190 // C() {var v;} |
| 8191 // | 8191 // |
| 8192 String variableName = "v"; | 8192 String variableName = "v"; |
| 8193 VariableDeclaration variable = | 8193 VariableDeclaration variable = |
| 8194 AstFactory.variableDeclaration2(variableName, null); | 8194 AstFactory.variableDeclaration2(variableName, null); |
| 8195 Statement statement = | 8195 Statement statement = |
| 8196 AstFactory.variableDeclarationStatement2(null, [variable]); | 8196 AstFactory.variableDeclarationStatement2(null, [variable]); |
| 8197 ConstructorDeclaration constructor = AstFactory.constructorDeclaration2( | 8197 ConstructorDeclaration constructor = AstFactory.constructorDeclaration2( |
| 8198 null, | 8198 null, |
| 8199 null, | 8199 null, |
| 8200 AstFactory.identifier3("C"), | 8200 AstFactory.identifier3("C"), |
| 8201 "C", | 8201 "C", |
| 8202 AstFactory.formalParameterList([]), | 8202 AstFactory.formalParameterList([]), |
| 8203 null, | 8203 null, |
| 8204 AstFactory.blockFunctionBody2([statement])); | 8204 AstFactory.blockFunctionBody2([statement])); |
| 8205 constructor.accept(builder); | 8205 constructor.accept(builder); |
| 8206 List<ConstructorElement> constructors = holder.constructors; | 8206 List<ConstructorElement> constructors = holder.constructors; |
| 8207 EngineTestCase.assertLength(1, constructors); | 8207 expect(constructors, hasLength(1)); |
| 8208 List<LocalVariableElement> variableElements = | 8208 List<LocalVariableElement> variableElements = |
| 8209 constructors[0].localVariables; | 8209 constructors[0].localVariables; |
| 8210 EngineTestCase.assertLength(1, variableElements); | 8210 expect(variableElements, hasLength(1)); |
| 8211 LocalVariableElement variableElement = variableElements[0]; | 8211 LocalVariableElement variableElement = variableElements[0]; |
| 8212 expect(variableElement.name, variableName); | 8212 expect(variableElement.name, variableName); |
| 8213 } | 8213 } |
| 8214 | 8214 |
| 8215 void test_visitVariableDeclaration_inMethod() { | 8215 void test_visitVariableDeclaration_inMethod() { |
| 8216 ElementHolder holder = new ElementHolder(); | 8216 ElementHolder holder = new ElementHolder(); |
| 8217 ElementBuilder builder = new ElementBuilder(holder); | 8217 ElementBuilder builder = new ElementBuilder(holder); |
| 8218 // | 8218 // |
| 8219 // m() {var v;} | 8219 // m() {var v;} |
| 8220 // | 8220 // |
| 8221 String variableName = "v"; | 8221 String variableName = "v"; |
| 8222 VariableDeclaration variable = | 8222 VariableDeclaration variable = |
| 8223 AstFactory.variableDeclaration2(variableName, null); | 8223 AstFactory.variableDeclaration2(variableName, null); |
| 8224 Statement statement = | 8224 Statement statement = |
| 8225 AstFactory.variableDeclarationStatement2(null, [variable]); | 8225 AstFactory.variableDeclarationStatement2(null, [variable]); |
| 8226 MethodDeclaration constructor = AstFactory.methodDeclaration2( | 8226 MethodDeclaration constructor = AstFactory.methodDeclaration2( |
| 8227 null, | 8227 null, |
| 8228 null, | 8228 null, |
| 8229 null, | 8229 null, |
| 8230 null, | 8230 null, |
| 8231 AstFactory.identifier3("m"), | 8231 AstFactory.identifier3("m"), |
| 8232 AstFactory.formalParameterList([]), | 8232 AstFactory.formalParameterList([]), |
| 8233 AstFactory.blockFunctionBody2([statement])); | 8233 AstFactory.blockFunctionBody2([statement])); |
| 8234 constructor.accept(builder); | 8234 constructor.accept(builder); |
| 8235 List<MethodElement> methods = holder.methods; | 8235 List<MethodElement> methods = holder.methods; |
| 8236 EngineTestCase.assertLength(1, methods); | 8236 expect(methods, hasLength(1)); |
| 8237 List<LocalVariableElement> variableElements = methods[0].localVariables; | 8237 List<LocalVariableElement> variableElements = methods[0].localVariables; |
| 8238 EngineTestCase.assertLength(1, variableElements); | 8238 expect(variableElements, hasLength(1)); |
| 8239 LocalVariableElement variableElement = variableElements[0]; | 8239 LocalVariableElement variableElement = variableElements[0]; |
| 8240 expect(variableElement.name, variableName); | 8240 expect(variableElement.name, variableName); |
| 8241 } | 8241 } |
| 8242 | 8242 |
| 8243 void test_visitVariableDeclaration_localNestedInField() { | 8243 void test_visitVariableDeclaration_localNestedInField() { |
| 8244 ElementHolder holder = new ElementHolder(); | 8244 ElementHolder holder = new ElementHolder(); |
| 8245 ElementBuilder builder = new ElementBuilder(holder); | 8245 ElementBuilder builder = new ElementBuilder(holder); |
| 8246 // | 8246 // |
| 8247 // var f = () {var v;} | 8247 // var f = () {var v;} |
| 8248 // | 8248 // |
| 8249 String variableName = "v"; | 8249 String variableName = "v"; |
| 8250 VariableDeclaration variable = | 8250 VariableDeclaration variable = |
| 8251 AstFactory.variableDeclaration2(variableName, null); | 8251 AstFactory.variableDeclaration2(variableName, null); |
| 8252 Statement statement = | 8252 Statement statement = |
| 8253 AstFactory.variableDeclarationStatement2(null, [variable]); | 8253 AstFactory.variableDeclarationStatement2(null, [variable]); |
| 8254 Expression initializer = AstFactory.functionExpression2( | 8254 Expression initializer = AstFactory.functionExpression2( |
| 8255 AstFactory.formalParameterList([]), | 8255 AstFactory.formalParameterList([]), |
| 8256 AstFactory.blockFunctionBody2([statement])); | 8256 AstFactory.blockFunctionBody2([statement])); |
| 8257 String fieldName = "f"; | 8257 String fieldName = "f"; |
| 8258 VariableDeclaration field = | 8258 VariableDeclaration field = |
| 8259 AstFactory.variableDeclaration2(fieldName, initializer); | 8259 AstFactory.variableDeclaration2(fieldName, initializer); |
| 8260 FieldDeclaration fieldDeclaration = | 8260 FieldDeclaration fieldDeclaration = |
| 8261 AstFactory.fieldDeclaration2(false, null, [field]); | 8261 AstFactory.fieldDeclaration2(false, null, [field]); |
| 8262 fieldDeclaration.accept(builder); | 8262 fieldDeclaration.accept(builder); |
| 8263 List<FieldElement> variables = holder.fields; | 8263 List<FieldElement> variables = holder.fields; |
| 8264 EngineTestCase.assertLength(1, variables); | 8264 expect(variables, hasLength(1)); |
| 8265 FieldElement fieldElement = variables[0]; | 8265 FieldElement fieldElement = variables[0]; |
| 8266 expect(fieldElement, isNotNull); | 8266 expect(fieldElement, isNotNull); |
| 8267 FunctionElement initializerElement = fieldElement.initializer; | 8267 FunctionElement initializerElement = fieldElement.initializer; |
| 8268 expect(initializerElement, isNotNull); | 8268 expect(initializerElement, isNotNull); |
| 8269 List<FunctionElement> functionElements = initializerElement.functions; | 8269 List<FunctionElement> functionElements = initializerElement.functions; |
| 8270 EngineTestCase.assertLength(1, functionElements); | 8270 expect(functionElements, hasLength(1)); |
| 8271 List<LocalVariableElement> variableElements = | 8271 List<LocalVariableElement> variableElements = |
| 8272 functionElements[0].localVariables; | 8272 functionElements[0].localVariables; |
| 8273 EngineTestCase.assertLength(1, variableElements); | 8273 expect(variableElements, hasLength(1)); |
| 8274 LocalVariableElement variableElement = variableElements[0]; | 8274 LocalVariableElement variableElement = variableElements[0]; |
| 8275 expect(variableElement.name, variableName); | 8275 expect(variableElement.name, variableName); |
| 8276 expect(variableElement.isConst, isFalse); | 8276 expect(variableElement.isConst, isFalse); |
| 8277 expect(variableElement.isFinal, isFalse); | 8277 expect(variableElement.isFinal, isFalse); |
| 8278 expect(variableElement.isSynthetic, isFalse); | 8278 expect(variableElement.isSynthetic, isFalse); |
| 8279 } | 8279 } |
| 8280 | 8280 |
| 8281 void test_visitVariableDeclaration_noInitializer() { | 8281 void test_visitVariableDeclaration_noInitializer() { |
| 8282 ElementHolder holder = new ElementHolder(); | 8282 ElementHolder holder = new ElementHolder(); |
| 8283 ElementBuilder builder = new ElementBuilder(holder); | 8283 ElementBuilder builder = new ElementBuilder(holder); |
| 8284 String variableName = "v"; | 8284 String variableName = "v"; |
| 8285 VariableDeclaration variableDeclaration = | 8285 VariableDeclaration variableDeclaration = |
| 8286 AstFactory.variableDeclaration2(variableName, null); | 8286 AstFactory.variableDeclaration2(variableName, null); |
| 8287 AstFactory.variableDeclarationList2(null, [variableDeclaration]); | 8287 AstFactory.variableDeclarationList2(null, [variableDeclaration]); |
| 8288 variableDeclaration.accept(builder); | 8288 variableDeclaration.accept(builder); |
| 8289 List<TopLevelVariableElement> variables = holder.topLevelVariables; | 8289 List<TopLevelVariableElement> variables = holder.topLevelVariables; |
| 8290 EngineTestCase.assertLength(1, variables); | 8290 expect(variables, hasLength(1)); |
| 8291 TopLevelVariableElement variable = variables[0]; | 8291 TopLevelVariableElement variable = variables[0]; |
| 8292 expect(variable, isNotNull); | 8292 expect(variable, isNotNull); |
| 8293 expect(variable.initializer, isNull); | 8293 expect(variable.initializer, isNull); |
| 8294 expect(variable.name, variableName); | 8294 expect(variable.name, variableName); |
| 8295 expect(variable.isConst, isFalse); | 8295 expect(variable.isConst, isFalse); |
| 8296 expect(variable.isFinal, isFalse); | 8296 expect(variable.isFinal, isFalse); |
| 8297 expect(variable.isSynthetic, isFalse); | 8297 expect(variable.isSynthetic, isFalse); |
| 8298 expect(variable.getter, isNotNull); | 8298 expect(variable.getter, isNotNull); |
| 8299 expect(variable.setter, isNotNull); | 8299 expect(variable.setter, isNotNull); |
| 8300 } | 8300 } |
| (...skipping 511 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 8812 class EnumMemberBuilderTest extends EngineTestCase { | 8812 class EnumMemberBuilderTest extends EngineTestCase { |
| 8813 void test_visitEnumDeclaration_multiple() { | 8813 void test_visitEnumDeclaration_multiple() { |
| 8814 String firstName = "ONE"; | 8814 String firstName = "ONE"; |
| 8815 String secondName = "TWO"; | 8815 String secondName = "TWO"; |
| 8816 String thirdName = "THREE"; | 8816 String thirdName = "THREE"; |
| 8817 EnumDeclaration enumDeclaration = | 8817 EnumDeclaration enumDeclaration = |
| 8818 AstFactory.enumDeclaration2("E", [firstName, secondName, thirdName]); | 8818 AstFactory.enumDeclaration2("E", [firstName, secondName, thirdName]); |
| 8819 | 8819 |
| 8820 ClassElement enumElement = _buildElement(enumDeclaration); | 8820 ClassElement enumElement = _buildElement(enumDeclaration); |
| 8821 List<FieldElement> fields = enumElement.fields; | 8821 List<FieldElement> fields = enumElement.fields; |
| 8822 EngineTestCase.assertLength(5, fields); | 8822 expect(fields, hasLength(5)); |
| 8823 | 8823 |
| 8824 FieldElement constant = fields[2]; | 8824 FieldElement constant = fields[2]; |
| 8825 expect(constant, isNotNull); | 8825 expect(constant, isNotNull); |
| 8826 expect(constant.name, firstName); | 8826 expect(constant.name, firstName); |
| 8827 expect(constant.isStatic, isTrue); | 8827 expect(constant.isStatic, isTrue); |
| 8828 _assertGetter(constant); | 8828 _assertGetter(constant); |
| 8829 | 8829 |
| 8830 constant = fields[3]; | 8830 constant = fields[3]; |
| 8831 expect(constant, isNotNull); | 8831 expect(constant, isNotNull); |
| 8832 expect(constant.name, secondName); | 8832 expect(constant.name, secondName); |
| 8833 expect(constant.isStatic, isTrue); | 8833 expect(constant.isStatic, isTrue); |
| 8834 _assertGetter(constant); | 8834 _assertGetter(constant); |
| 8835 | 8835 |
| 8836 constant = fields[4]; | 8836 constant = fields[4]; |
| 8837 expect(constant, isNotNull); | 8837 expect(constant, isNotNull); |
| 8838 expect(constant.name, thirdName); | 8838 expect(constant.name, thirdName); |
| 8839 expect(constant.isStatic, isTrue); | 8839 expect(constant.isStatic, isTrue); |
| 8840 _assertGetter(constant); | 8840 _assertGetter(constant); |
| 8841 } | 8841 } |
| 8842 | 8842 |
| 8843 void test_visitEnumDeclaration_single() { | 8843 void test_visitEnumDeclaration_single() { |
| 8844 String firstName = "ONE"; | 8844 String firstName = "ONE"; |
| 8845 EnumDeclaration enumDeclaration = | 8845 EnumDeclaration enumDeclaration = |
| 8846 AstFactory.enumDeclaration2("E", [firstName]); | 8846 AstFactory.enumDeclaration2("E", [firstName]); |
| 8847 | 8847 |
| 8848 ClassElement enumElement = _buildElement(enumDeclaration); | 8848 ClassElement enumElement = _buildElement(enumDeclaration); |
| 8849 List<FieldElement> fields = enumElement.fields; | 8849 List<FieldElement> fields = enumElement.fields; |
| 8850 EngineTestCase.assertLength(3, fields); | 8850 expect(fields, hasLength(3)); |
| 8851 | 8851 |
| 8852 FieldElement field = fields[0]; | 8852 FieldElement field = fields[0]; |
| 8853 expect(field, isNotNull); | 8853 expect(field, isNotNull); |
| 8854 expect(field.name, "index"); | 8854 expect(field.name, "index"); |
| 8855 expect(field.isStatic, isFalse); | 8855 expect(field.isStatic, isFalse); |
| 8856 expect(field.isSynthetic, isTrue); | 8856 expect(field.isSynthetic, isTrue); |
| 8857 _assertGetter(field); | 8857 _assertGetter(field); |
| 8858 | 8858 |
| 8859 field = fields[1]; | 8859 field = fields[1]; |
| 8860 expect(field, isNotNull); | 8860 expect(field, isNotNull); |
| (...skipping 17 matching lines...) Expand all Loading... |
| 8878 } | 8878 } |
| 8879 | 8879 |
| 8880 ClassElement _buildElement(EnumDeclaration enumDeclaration) { | 8880 ClassElement _buildElement(EnumDeclaration enumDeclaration) { |
| 8881 ElementHolder holder = new ElementHolder(); | 8881 ElementHolder holder = new ElementHolder(); |
| 8882 ElementBuilder elementBuilder = new ElementBuilder(holder); | 8882 ElementBuilder elementBuilder = new ElementBuilder(holder); |
| 8883 enumDeclaration.accept(elementBuilder); | 8883 enumDeclaration.accept(elementBuilder); |
| 8884 EnumMemberBuilder memberBuilder = | 8884 EnumMemberBuilder memberBuilder = |
| 8885 new EnumMemberBuilder(new TestTypeProvider()); | 8885 new EnumMemberBuilder(new TestTypeProvider()); |
| 8886 enumDeclaration.accept(memberBuilder); | 8886 enumDeclaration.accept(memberBuilder); |
| 8887 List<ClassElement> enums = holder.enums; | 8887 List<ClassElement> enums = holder.enums; |
| 8888 EngineTestCase.assertLength(1, enums); | 8888 expect(enums, hasLength(1)); |
| 8889 return enums[0]; | 8889 return enums[0]; |
| 8890 } | 8890 } |
| 8891 } | 8891 } |
| 8892 | 8892 |
| 8893 | 8893 |
| 8894 class ErrorReporterTest extends EngineTestCase { | 8894 class ErrorReporterTest extends EngineTestCase { |
| 8895 /** | 8895 /** |
| 8896 * Create a type with the given name in a compilation unit with the given name
. | 8896 * Create a type with the given name in a compilation unit with the given name
. |
| 8897 * | 8897 * |
| 8898 * @param fileName the name of the compilation unit containing the class | 8898 * @param fileName the name of the compilation unit containing the class |
| (...skipping 1016 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 9915 <body> | 9915 <body> |
| 9916 <div id="x"></div> | 9916 <div id="x"></div> |
| 9917 <p class='c'></p> | 9917 <p class='c'></p> |
| 9918 <div class='c'></div> | 9918 <div class='c'></div> |
| 9919 </body> | 9919 </body> |
| 9920 </html>'''); | 9920 </html>'''); |
| 9921 unit.accept(builder); | 9921 unit.accept(builder); |
| 9922 HtmlTagInfo info = builder.getTagInfo(); | 9922 HtmlTagInfo info = builder.getTagInfo(); |
| 9923 expect(info, isNotNull); | 9923 expect(info, isNotNull); |
| 9924 List<String> allTags = info.allTags; | 9924 List<String> allTags = info.allTags; |
| 9925 EngineTestCase.assertLength(4, allTags); | 9925 expect(allTags, hasLength(4)); |
| 9926 expect(info.getTagWithId("x"), "div"); | 9926 expect(info.getTagWithId("x"), "div"); |
| 9927 List<String> tagsWithClass = info.getTagsWithClass("c"); | 9927 List<String> tagsWithClass = info.getTagsWithClass("c"); |
| 9928 EngineTestCase.assertLength(2, tagsWithClass); | 9928 expect(tagsWithClass, hasLength(2)); |
| 9929 } | 9929 } |
| 9930 } | 9930 } |
| 9931 | 9931 |
| 9932 | 9932 |
| 9933 class HtmlUnitBuilderTest extends EngineTestCase { | 9933 class HtmlUnitBuilderTest extends EngineTestCase { |
| 9934 AnalysisContextImpl _context; | 9934 AnalysisContextImpl _context; |
| 9935 @override | 9935 @override |
| 9936 void setUp() { | 9936 void setUp() { |
| 9937 _context = AnalysisContextFactory.contextWithCore(); | 9937 _context = AnalysisContextFactory.contextWithCore(); |
| 9938 } | 9938 } |
| (...skipping 72 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 10011 new _ExpectedScript.con1(expectedLibrary); | 10011 new _ExpectedScript.con1(expectedLibrary); |
| 10012 _ExpectedScript _s2(String scriptSourcePath) => | 10012 _ExpectedScript _s2(String scriptSourcePath) => |
| 10013 new _ExpectedScript.con2(scriptSourcePath); | 10013 new _ExpectedScript.con2(scriptSourcePath); |
| 10014 HtmlUnitBuilderTest_ExpectedVariable _v(String varName) => | 10014 HtmlUnitBuilderTest_ExpectedVariable _v(String varName) => |
| 10015 new HtmlUnitBuilderTest_ExpectedVariable(varName); | 10015 new HtmlUnitBuilderTest_ExpectedVariable(varName); |
| 10016 void _validate(HtmlElementImpl element, | 10016 void _validate(HtmlElementImpl element, |
| 10017 List<_ExpectedScript> expectedScripts) { | 10017 List<_ExpectedScript> expectedScripts) { |
| 10018 expect(element.context, same(_context)); | 10018 expect(element.context, same(_context)); |
| 10019 List<HtmlScriptElement> scripts = element.scripts; | 10019 List<HtmlScriptElement> scripts = element.scripts; |
| 10020 expect(scripts, isNotNull); | 10020 expect(scripts, isNotNull); |
| 10021 EngineTestCase.assertLength(expectedScripts.length, scripts); | 10021 expect(scripts, hasLength(expectedScripts.length)); |
| 10022 for (int scriptIndex = 0; scriptIndex < scripts.length; scriptIndex++) { | 10022 for (int scriptIndex = 0; scriptIndex < scripts.length; scriptIndex++) { |
| 10023 expectedScripts[scriptIndex]._validate(scriptIndex, scripts[scriptIndex]); | 10023 expectedScripts[scriptIndex]._validate(scriptIndex, scripts[scriptIndex]); |
| 10024 } | 10024 } |
| 10025 } | 10025 } |
| 10026 } | 10026 } |
| 10027 | 10027 |
| 10028 | 10028 |
| 10029 class HtmlUnitBuilderTest_ExpectedLibrary { | 10029 class HtmlUnitBuilderTest_ExpectedLibrary { |
| 10030 final HtmlUnitBuilderTest HtmlUnitBuilderTest_this; | 10030 final HtmlUnitBuilderTest HtmlUnitBuilderTest_this; |
| 10031 final List<HtmlUnitBuilderTest_ExpectedVariable> _expectedVariables; | 10031 final List<HtmlUnitBuilderTest_ExpectedVariable> _expectedVariables; |
| 10032 HtmlUnitBuilderTest_ExpectedLibrary(this.HtmlUnitBuilderTest_this, | 10032 HtmlUnitBuilderTest_ExpectedLibrary(this.HtmlUnitBuilderTest_this, |
| 10033 this._expectedVariables); | 10033 this._expectedVariables); |
| 10034 void _validate(int scriptIndex, EmbeddedHtmlScriptElementImpl script) { | 10034 void _validate(int scriptIndex, EmbeddedHtmlScriptElementImpl script) { |
| 10035 LibraryElement library = script.scriptLibrary; | 10035 LibraryElement library = script.scriptLibrary; |
| 10036 expect(library, isNotNull, reason: "script $scriptIndex"); | 10036 expect(library, isNotNull, reason: "script $scriptIndex"); |
| 10037 expect(script.context, same(HtmlUnitBuilderTest_this._context), reason: "scr
ipt $scriptIndex"); | 10037 expect(script.context, same(HtmlUnitBuilderTest_this._context), reason: "scr
ipt $scriptIndex"); |
| 10038 CompilationUnitElement unit = library.definingCompilationUnit; | 10038 CompilationUnitElement unit = library.definingCompilationUnit; |
| 10039 expect(unit, isNotNull, reason: "script $scriptIndex"); | 10039 expect(unit, isNotNull, reason: "script $scriptIndex"); |
| 10040 List<TopLevelVariableElement> variables = unit.topLevelVariables; | 10040 List<TopLevelVariableElement> variables = unit.topLevelVariables; |
| 10041 EngineTestCase.assertLength(_expectedVariables.length, variables); | 10041 expect(variables, hasLength(_expectedVariables.length)); |
| 10042 for (int index = 0; index < variables.length; index++) { | 10042 for (int index = 0; index < variables.length; index++) { |
| 10043 _expectedVariables[index].validate(scriptIndex, variables[index]); | 10043 _expectedVariables[index].validate(scriptIndex, variables[index]); |
| 10044 } | 10044 } |
| 10045 expect(library.enclosingElement, same(script), reason: "script $scriptIndex"
); | 10045 expect(library.enclosingElement, same(script), reason: "script $scriptIndex"
); |
| 10046 } | 10046 } |
| 10047 } | 10047 } |
| 10048 | 10048 |
| 10049 | 10049 |
| 10050 class HtmlUnitBuilderTest_ExpectedVariable { | 10050 class HtmlUnitBuilderTest_ExpectedVariable { |
| 10051 final String _expectedName; | 10051 final String _expectedName; |
| (...skipping 188 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 10240 } | 10240 } |
| 10241 void test_visitSuperConstructorInvocation_unresolved() { | 10241 void test_visitSuperConstructorInvocation_unresolved() { |
| 10242 SuperConstructorInvocation superConstructorInvocation = | 10242 SuperConstructorInvocation superConstructorInvocation = |
| 10243 AstFactory.superConstructorInvocation([]); | 10243 AstFactory.superConstructorInvocation([]); |
| 10244 _tail = superConstructorInvocation; | 10244 _tail = superConstructorInvocation; |
| 10245 _visitNode(superConstructorInvocation); | 10245 _visitNode(superConstructorInvocation); |
| 10246 _assertNoArcs(); | 10246 _assertNoArcs(); |
| 10247 } | 10247 } |
| 10248 void _assertNoArcs() { | 10248 void _assertNoArcs() { |
| 10249 Set<AstNode> tails = _referenceGraph.getTails(_head); | 10249 Set<AstNode> tails = _referenceGraph.getTails(_head); |
| 10250 EngineTestCase.assertSizeOfSet(0, tails); | 10250 expect(tails, hasLength(0)); |
| 10251 } | 10251 } |
| 10252 void _assertOneArc(AstNode tail) { | 10252 void _assertOneArc(AstNode tail) { |
| 10253 Set<AstNode> tails = _referenceGraph.getTails(_head); | 10253 Set<AstNode> tails = _referenceGraph.getTails(_head); |
| 10254 EngineTestCase.assertSizeOfSet(1, tails); | 10254 expect(tails, hasLength(1)); |
| 10255 expect(tails.first, same(tail)); | 10255 expect(tails.first, same(tail)); |
| 10256 } | 10256 } |
| 10257 ReferenceFinder _createReferenceFinder(AstNode source) => | 10257 ReferenceFinder _createReferenceFinder(AstNode source) => |
| 10258 new ReferenceFinder( | 10258 new ReferenceFinder( |
| 10259 source, | 10259 source, |
| 10260 _referenceGraph, | 10260 _referenceGraph, |
| 10261 _variableDeclarationMap, | 10261 _variableDeclarationMap, |
| 10262 _constructorDeclarationMap); | 10262 _constructorDeclarationMap); |
| 10263 InstanceCreationExpression _makeTailConstructor(String name, | 10263 InstanceCreationExpression _makeTailConstructor(String name, |
| 10264 bool isConstDeclaration, bool isConstUsage, bool inMap) { | 10264 bool isConstDeclaration, bool isConstUsage, bool inMap) { |
| (...skipping 703 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 10968 Source scriptSource = externalScript.scriptSource; | 10968 Source scriptSource = externalScript.scriptSource; |
| 10969 if (_expectedExternalScriptName == null) { | 10969 if (_expectedExternalScriptName == null) { |
| 10970 expect(scriptSource, isNull, reason: "script $scriptIndex"); | 10970 expect(scriptSource, isNull, reason: "script $scriptIndex"); |
| 10971 } else { | 10971 } else { |
| 10972 expect(scriptSource, isNotNull, reason: "script $scriptIndex"); | 10972 expect(scriptSource, isNotNull, reason: "script $scriptIndex"); |
| 10973 String actualExternalScriptName = scriptSource.shortName; | 10973 String actualExternalScriptName = scriptSource.shortName; |
| 10974 expect(actualExternalScriptName, _expectedExternalScriptName, reason: "scr
ipt $scriptIndex"); | 10974 expect(actualExternalScriptName, _expectedExternalScriptName, reason: "scr
ipt $scriptIndex"); |
| 10975 } | 10975 } |
| 10976 } | 10976 } |
| 10977 } | 10977 } |
| OLD | NEW |