| 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.ast_test; | 8 library engine.ast_test; |
| 9 | 9 |
| 10 import 'package:analyzer/src/generated/java_core.dart'; | 10 import 'package:analyzer/src/generated/java_core.dart'; |
| 11 import 'package:analyzer/src/generated/java_engine.dart'; | 11 import 'package:analyzer/src/generated/java_engine.dart'; |
| 12 import 'package:analyzer/src/generated/java_junit.dart'; | 12 import 'package:analyzer/src/generated/java_junit.dart'; |
| 13 import 'package:analyzer/src/generated/java_engine.dart' show Predicate; | 13 import 'package:analyzer/src/generated/java_engine.dart' show Predicate; |
| 14 import 'package:analyzer/src/generated/scanner.dart'; | 14 import 'package:analyzer/src/generated/scanner.dart'; |
| 15 import 'package:analyzer/src/generated/ast.dart'; | 15 import 'package:analyzer/src/generated/ast.dart'; |
| 16 import 'package:analyzer/src/generated/utilities_dart.dart'; | 16 import 'package:analyzer/src/generated/utilities_dart.dart'; |
| 17 import 'package:analyzer/src/generated/element.dart' show ClassElement; | 17 import 'package:analyzer/src/generated/element.dart' show ClassElement; |
| 18 import 'package:unittest/unittest.dart' as _ut; | 18 import 'package:unittest/unittest.dart' as _ut; |
| 19 import 'parser_test.dart' show ParserTestCase; | 19 import 'parser_test.dart' show ParserTestCase; |
| 20 import 'test_support.dart'; | 20 import 'test_support.dart'; |
| 21 import 'scanner_test.dart' show TokenFactory; | 21 import 'scanner_test.dart' show TokenFactory; |
| 22 | 22 |
| 23 class NodeLocatorTest extends ParserTestCase { | 23 class NodeLocatorTest extends ParserTestCase { |
| 24 void test_range() { | 24 void test_range() { |
| 25 CompilationUnit unit = ParserTestCase.parseCompilationUnit("library myLib;",
[]); | 25 CompilationUnit unit = ParserTestCase.parseCompilationUnit("library myLib;",
[]); |
| 26 assertLocate(unit, 4, 10, (node) => node is LibraryDirective, LibraryDirecti
ve); | 26 _assertLocate(unit, 4, 10, (node) => node is LibraryDirective, LibraryDirect
ive); |
| 27 } | 27 } |
| 28 | 28 |
| 29 void test_searchWithin_null() { | 29 void test_searchWithin_null() { |
| 30 NodeLocator locator = new NodeLocator.con2(0, 0); | 30 NodeLocator locator = new NodeLocator.con2(0, 0); |
| 31 JUnitTestCase.assertNull(locator.searchWithin(null)); | 31 JUnitTestCase.assertNull(locator.searchWithin(null)); |
| 32 } | 32 } |
| 33 | 33 |
| 34 void test_searchWithin_offset() { | 34 void test_searchWithin_offset() { |
| 35 CompilationUnit unit = ParserTestCase.parseCompilationUnit("library myLib;",
[]); | 35 CompilationUnit unit = ParserTestCase.parseCompilationUnit("library myLib;",
[]); |
| 36 assertLocate(unit, 10, 10, (node) => node is SimpleIdentifier, SimpleIdentif
ier); | 36 _assertLocate(unit, 10, 10, (node) => node is SimpleIdentifier, SimpleIdenti
fier); |
| 37 } | 37 } |
| 38 | 38 |
| 39 void test_searchWithin_offsetAfterNode() { | 39 void test_searchWithin_offsetAfterNode() { |
| 40 CompilationUnit unit = ParserTestCase.parseCompilationUnit(EngineTestCase.cr
eateSource(["class A {}", "class B {}"]), []); | 40 CompilationUnit unit = ParserTestCase.parseCompilationUnit(EngineTestCase.cr
eateSource(["class A {}", "class B {}"]), []); |
| 41 NodeLocator locator = new NodeLocator.con2(1024, 1024); | 41 NodeLocator locator = new NodeLocator.con2(1024, 1024); |
| 42 AstNode node = locator.searchWithin(unit.declarations[0]); | 42 AstNode node = locator.searchWithin(unit.declarations[0]); |
| 43 JUnitTestCase.assertNull(node); | 43 JUnitTestCase.assertNull(node); |
| 44 } | 44 } |
| 45 | 45 |
| 46 void test_searchWithin_offsetBeforeNode() { | 46 void test_searchWithin_offsetBeforeNode() { |
| 47 CompilationUnit unit = ParserTestCase.parseCompilationUnit(EngineTestCase.cr
eateSource(["class A {}", "class B {}"]), []); | 47 CompilationUnit unit = ParserTestCase.parseCompilationUnit(EngineTestCase.cr
eateSource(["class A {}", "class B {}"]), []); |
| 48 NodeLocator locator = new NodeLocator.con2(0, 0); | 48 NodeLocator locator = new NodeLocator.con2(0, 0); |
| 49 AstNode node = locator.searchWithin(unit.declarations[1]); | 49 AstNode node = locator.searchWithin(unit.declarations[1]); |
| 50 JUnitTestCase.assertNull(node); | 50 JUnitTestCase.assertNull(node); |
| 51 } | 51 } |
| 52 | 52 |
| 53 void assertLocate(CompilationUnit unit, int start, int end, Predicate<AstNode>
predicate, Type expectedClass) { | 53 void _assertLocate(CompilationUnit unit, int start, int end, Predicate<AstNode
> predicate, Type expectedClass) { |
| 54 NodeLocator locator = new NodeLocator.con2(start, end); | 54 NodeLocator locator = new NodeLocator.con2(start, end); |
| 55 AstNode node = locator.searchWithin(unit); | 55 AstNode node = locator.searchWithin(unit); |
| 56 JUnitTestCase.assertNotNull(node); | 56 JUnitTestCase.assertNotNull(node); |
| 57 JUnitTestCase.assertSame(node, locator.foundNode); | 57 JUnitTestCase.assertSame(node, locator.foundNode); |
| 58 JUnitTestCase.assertTrueMsg("Node starts after range", node.offset <= start)
; | 58 JUnitTestCase.assertTrueMsg("Node starts after range", node.offset <= start)
; |
| 59 JUnitTestCase.assertTrueMsg("Node ends before range", node.offset + node.len
gth > end); | 59 JUnitTestCase.assertTrueMsg("Node ends before range", node.offset + node.len
gth > end); |
| 60 EngineTestCase.assertInstanceOf(predicate, expectedClass, node); | 60 EngineTestCase.assertInstanceOf(predicate, expectedClass, node); |
| 61 } | 61 } |
| 62 | 62 |
| 63 static dartSuite() { | 63 static dartSuite() { |
| (...skipping 747 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 811 } | 811 } |
| 812 | 812 |
| 813 void test_inDeclarationContext_variableDeclaration() { | 813 void test_inDeclarationContext_variableDeclaration() { |
| 814 SimpleIdentifier identifier = AstFactory.variableDeclaration("v").name; | 814 SimpleIdentifier identifier = AstFactory.variableDeclaration("v").name; |
| 815 JUnitTestCase.assertTrue(identifier.inDeclarationContext()); | 815 JUnitTestCase.assertTrue(identifier.inDeclarationContext()); |
| 816 } | 816 } |
| 817 | 817 |
| 818 void test_inGetterContext() { | 818 void test_inGetterContext() { |
| 819 for (WrapperKind wrapper in WrapperKind.values) { | 819 for (WrapperKind wrapper in WrapperKind.values) { |
| 820 for (AssignmentKind assignment in AssignmentKind.values) { | 820 for (AssignmentKind assignment in AssignmentKind.values) { |
| 821 SimpleIdentifier identifier = createIdentifier(wrapper, assignment); | 821 SimpleIdentifier identifier = _createIdentifier(wrapper, assignment); |
| 822 if (identical(assignment, AssignmentKind.SIMPLE_LEFT) && wrapper != Wrap
perKind.PREFIXED_LEFT && wrapper != WrapperKind.PROPERTY_LEFT) { | 822 if (identical(assignment, AssignmentKind.SIMPLE_LEFT) && wrapper != Wrap
perKind.PREFIXED_LEFT && wrapper != WrapperKind.PROPERTY_LEFT) { |
| 823 if (identifier.inGetterContext()) { | 823 if (identifier.inGetterContext()) { |
| 824 JUnitTestCase.fail("Expected ${topMostNode(identifier).toSource()} t
o be false"); | 824 JUnitTestCase.fail("Expected ${_topMostNode(identifier).toSource()}
to be false"); |
| 825 } | 825 } |
| 826 } else { | 826 } else { |
| 827 if (!identifier.inGetterContext()) { | 827 if (!identifier.inGetterContext()) { |
| 828 JUnitTestCase.fail("Expected ${topMostNode(identifier).toSource()} t
o be true"); | 828 JUnitTestCase.fail("Expected ${_topMostNode(identifier).toSource()}
to be true"); |
| 829 } | 829 } |
| 830 } | 830 } |
| 831 } | 831 } |
| 832 } | 832 } |
| 833 } | 833 } |
| 834 | 834 |
| 835 void test_inReferenceContext() { | 835 void test_inReferenceContext() { |
| 836 SimpleIdentifier identifier = AstFactory.identifier3("id"); | 836 SimpleIdentifier identifier = AstFactory.identifier3("id"); |
| 837 AstFactory.namedExpression(AstFactory.label(identifier), AstFactory.identifi
er3("_")); | 837 AstFactory.namedExpression(AstFactory.label(identifier), AstFactory.identifi
er3("_")); |
| 838 JUnitTestCase.assertFalse(identifier.inGetterContext()); | 838 JUnitTestCase.assertFalse(identifier.inGetterContext()); |
| 839 JUnitTestCase.assertFalse(identifier.inSetterContext()); | 839 JUnitTestCase.assertFalse(identifier.inSetterContext()); |
| 840 } | 840 } |
| 841 | 841 |
| 842 void test_inSetterContext() { | 842 void test_inSetterContext() { |
| 843 for (WrapperKind wrapper in WrapperKind.values) { | 843 for (WrapperKind wrapper in WrapperKind.values) { |
| 844 for (AssignmentKind assignment in AssignmentKind.values) { | 844 for (AssignmentKind assignment in AssignmentKind.values) { |
| 845 SimpleIdentifier identifier = createIdentifier(wrapper, assignment); | 845 SimpleIdentifier identifier = _createIdentifier(wrapper, assignment); |
| 846 if (identical(wrapper, WrapperKind.PREFIXED_LEFT) || identical(wrapper,
WrapperKind.PROPERTY_LEFT) || identical(assignment, AssignmentKind.BINARY) || id
entical(assignment, AssignmentKind.COMPOUND_RIGHT) || identical(assignment, Assi
gnmentKind.PREFIX_NOT) || identical(assignment, AssignmentKind.SIMPLE_RIGHT) ||
identical(assignment, AssignmentKind.NONE)) { | 846 if (identical(wrapper, WrapperKind.PREFIXED_LEFT) || identical(wrapper,
WrapperKind.PROPERTY_LEFT) || identical(assignment, AssignmentKind.BINARY) || id
entical(assignment, AssignmentKind.COMPOUND_RIGHT) || identical(assignment, Assi
gnmentKind.PREFIX_NOT) || identical(assignment, AssignmentKind.SIMPLE_RIGHT) ||
identical(assignment, AssignmentKind.NONE)) { |
| 847 if (identifier.inSetterContext()) { | 847 if (identifier.inSetterContext()) { |
| 848 JUnitTestCase.fail("Expected ${topMostNode(identifier).toSource()} t
o be false"); | 848 JUnitTestCase.fail("Expected ${_topMostNode(identifier).toSource()}
to be false"); |
| 849 } | 849 } |
| 850 } else { | 850 } else { |
| 851 if (!identifier.inSetterContext()) { | 851 if (!identifier.inSetterContext()) { |
| 852 JUnitTestCase.fail("Expected ${topMostNode(identifier).toSource()} t
o be true"); | 852 JUnitTestCase.fail("Expected ${_topMostNode(identifier).toSource()}
to be true"); |
| 853 } | 853 } |
| 854 } | 854 } |
| 855 } | 855 } |
| 856 } | 856 } |
| 857 } | 857 } |
| 858 | 858 |
| 859 SimpleIdentifier createIdentifier(WrapperKind wrapper, AssignmentKind assignme
nt) { | 859 SimpleIdentifier _createIdentifier(WrapperKind wrapper, AssignmentKind assignm
ent) { |
| 860 SimpleIdentifier identifier = AstFactory.identifier3("a"); | 860 SimpleIdentifier identifier = AstFactory.identifier3("a"); |
| 861 Expression expression = identifier; | 861 Expression expression = identifier; |
| 862 while (true) { | 862 while (true) { |
| 863 if (wrapper == WrapperKind.PREFIXED_LEFT) { | 863 if (wrapper == WrapperKind.PREFIXED_LEFT) { |
| 864 expression = AstFactory.identifier(identifier, AstFactory.identifier3("_
")); | 864 expression = AstFactory.identifier(identifier, AstFactory.identifier3("_
")); |
| 865 } else if (wrapper == WrapperKind.PREFIXED_RIGHT) { | 865 } else if (wrapper == WrapperKind.PREFIXED_RIGHT) { |
| 866 expression = AstFactory.identifier(AstFactory.identifier3("_"), identifi
er); | 866 expression = AstFactory.identifier(AstFactory.identifier3("_"), identifi
er); |
| 867 } else if (wrapper == WrapperKind.PROPERTY_LEFT) { | 867 } else if (wrapper == WrapperKind.PROPERTY_LEFT) { |
| 868 expression = AstFactory.propertyAccess2(expression, "_"); | 868 expression = AstFactory.propertyAccess2(expression, "_"); |
| 869 } else if (wrapper == WrapperKind.PROPERTY_RIGHT) { | 869 } else if (wrapper == WrapperKind.PROPERTY_RIGHT) { |
| (...skipping 27 matching lines...) Expand all Loading... |
| 897 } | 897 } |
| 898 return identifier; | 898 return identifier; |
| 899 } | 899 } |
| 900 | 900 |
| 901 /** | 901 /** |
| 902 * Return the top-most node in the AST structure containing the given identifi
er. | 902 * Return the top-most node in the AST structure containing the given identifi
er. |
| 903 * | 903 * |
| 904 * @param identifier the identifier in the AST structure being traversed | 904 * @param identifier the identifier in the AST structure being traversed |
| 905 * @return the root of the AST structure containing the identifier | 905 * @return the root of the AST structure containing the identifier |
| 906 */ | 906 */ |
| 907 AstNode topMostNode(SimpleIdentifier identifier) { | 907 AstNode _topMostNode(SimpleIdentifier identifier) { |
| 908 AstNode child = identifier; | 908 AstNode child = identifier; |
| 909 AstNode parent = identifier.parent; | 909 AstNode parent = identifier.parent; |
| 910 while (parent != null) { | 910 while (parent != null) { |
| 911 child = parent; | 911 child = parent; |
| 912 parent = parent.parent; | 912 parent = parent.parent; |
| 913 } | 913 } |
| 914 return child; | 914 return child; |
| 915 } | 915 } |
| 916 | 916 |
| 917 static dartSuite() { | 917 static dartSuite() { |
| (...skipping 494 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1412 _ut.test('test_set_tooBig', () { | 1412 _ut.test('test_set_tooBig', () { |
| 1413 final __test = new NodeListTest(); | 1413 final __test = new NodeListTest(); |
| 1414 runJUnitTest(__test, __test.test_set_tooBig); | 1414 runJUnitTest(__test, __test.test_set_tooBig); |
| 1415 }); | 1415 }); |
| 1416 }); | 1416 }); |
| 1417 } | 1417 } |
| 1418 } | 1418 } |
| 1419 | 1419 |
| 1420 class ConstantEvaluatorTest extends ParserTestCase { | 1420 class ConstantEvaluatorTest extends ParserTestCase { |
| 1421 void fail_constructor() { | 1421 void fail_constructor() { |
| 1422 Object value = getConstantValue("?"); | 1422 Object value = _getConstantValue("?"); |
| 1423 JUnitTestCase.assertEquals(null, value); | 1423 JUnitTestCase.assertEquals(null, value); |
| 1424 } | 1424 } |
| 1425 | 1425 |
| 1426 void fail_identifier_class() { | 1426 void fail_identifier_class() { |
| 1427 Object value = getConstantValue("?"); | 1427 Object value = _getConstantValue("?"); |
| 1428 JUnitTestCase.assertEquals(null, value); | 1428 JUnitTestCase.assertEquals(null, value); |
| 1429 } | 1429 } |
| 1430 | 1430 |
| 1431 void fail_identifier_function() { | 1431 void fail_identifier_function() { |
| 1432 Object value = getConstantValue("?"); | 1432 Object value = _getConstantValue("?"); |
| 1433 JUnitTestCase.assertEquals(null, value); | 1433 JUnitTestCase.assertEquals(null, value); |
| 1434 } | 1434 } |
| 1435 | 1435 |
| 1436 void fail_identifier_static() { | 1436 void fail_identifier_static() { |
| 1437 Object value = getConstantValue("?"); | 1437 Object value = _getConstantValue("?"); |
| 1438 JUnitTestCase.assertEquals(null, value); | 1438 JUnitTestCase.assertEquals(null, value); |
| 1439 } | 1439 } |
| 1440 | 1440 |
| 1441 void fail_identifier_staticMethod() { | 1441 void fail_identifier_staticMethod() { |
| 1442 Object value = getConstantValue("?"); | 1442 Object value = _getConstantValue("?"); |
| 1443 JUnitTestCase.assertEquals(null, value); | 1443 JUnitTestCase.assertEquals(null, value); |
| 1444 } | 1444 } |
| 1445 | 1445 |
| 1446 void fail_identifier_topLevel() { | 1446 void fail_identifier_topLevel() { |
| 1447 Object value = getConstantValue("?"); | 1447 Object value = _getConstantValue("?"); |
| 1448 JUnitTestCase.assertEquals(null, value); | 1448 JUnitTestCase.assertEquals(null, value); |
| 1449 } | 1449 } |
| 1450 | 1450 |
| 1451 void fail_identifier_typeParameter() { | 1451 void fail_identifier_typeParameter() { |
| 1452 Object value = getConstantValue("?"); | 1452 Object value = _getConstantValue("?"); |
| 1453 JUnitTestCase.assertEquals(null, value); | 1453 JUnitTestCase.assertEquals(null, value); |
| 1454 } | 1454 } |
| 1455 | 1455 |
| 1456 void test_binary_bitAnd() { | 1456 void test_binary_bitAnd() { |
| 1457 Object value = getConstantValue("74 & 42"); | 1457 Object value = _getConstantValue("74 & 42"); |
| 1458 EngineTestCase.assertInstanceOf((obj) => obj is int, int, value); | 1458 EngineTestCase.assertInstanceOf((obj) => obj is int, int, value); |
| 1459 JUnitTestCase.assertEquals(74 & 42, value as int); | 1459 JUnitTestCase.assertEquals(74 & 42, value as int); |
| 1460 } | 1460 } |
| 1461 | 1461 |
| 1462 void test_binary_bitOr() { | 1462 void test_binary_bitOr() { |
| 1463 Object value = getConstantValue("74 | 42"); | 1463 Object value = _getConstantValue("74 | 42"); |
| 1464 EngineTestCase.assertInstanceOf((obj) => obj is int, int, value); | 1464 EngineTestCase.assertInstanceOf((obj) => obj is int, int, value); |
| 1465 JUnitTestCase.assertEquals(74 | 42, value as int); | 1465 JUnitTestCase.assertEquals(74 | 42, value as int); |
| 1466 } | 1466 } |
| 1467 | 1467 |
| 1468 void test_binary_bitXor() { | 1468 void test_binary_bitXor() { |
| 1469 Object value = getConstantValue("74 ^ 42"); | 1469 Object value = _getConstantValue("74 ^ 42"); |
| 1470 EngineTestCase.assertInstanceOf((obj) => obj is int, int, value); | 1470 EngineTestCase.assertInstanceOf((obj) => obj is int, int, value); |
| 1471 JUnitTestCase.assertEquals(74 ^ 42, value as int); | 1471 JUnitTestCase.assertEquals(74 ^ 42, value as int); |
| 1472 } | 1472 } |
| 1473 | 1473 |
| 1474 void test_binary_divide_double() { | 1474 void test_binary_divide_double() { |
| 1475 Object value = getConstantValue("3.2 / 2.3"); | 1475 Object value = _getConstantValue("3.2 / 2.3"); |
| 1476 EngineTestCase.assertInstanceOf((obj) => obj is double, double, value); | 1476 EngineTestCase.assertInstanceOf((obj) => obj is double, double, value); |
| 1477 JUnitTestCase.assertEquals(3.2 / 2.3, value as double); | 1477 JUnitTestCase.assertEquals(3.2 / 2.3, value as double); |
| 1478 } | 1478 } |
| 1479 | 1479 |
| 1480 void test_binary_divide_integer() { | 1480 void test_binary_divide_integer() { |
| 1481 Object value = getConstantValue("3 / 2"); | 1481 Object value = _getConstantValue("3 / 2"); |
| 1482 EngineTestCase.assertInstanceOf((obj) => obj is int, int, value); | 1482 EngineTestCase.assertInstanceOf((obj) => obj is int, int, value); |
| 1483 JUnitTestCase.assertEquals(1, value as int); | 1483 JUnitTestCase.assertEquals(1, value as int); |
| 1484 } | 1484 } |
| 1485 | 1485 |
| 1486 void test_binary_equal_boolean() { | 1486 void test_binary_equal_boolean() { |
| 1487 Object value = getConstantValue("true == false"); | 1487 Object value = _getConstantValue("true == false"); |
| 1488 JUnitTestCase.assertEquals(false, value); | 1488 JUnitTestCase.assertEquals(false, value); |
| 1489 } | 1489 } |
| 1490 | 1490 |
| 1491 void test_binary_equal_integer() { | 1491 void test_binary_equal_integer() { |
| 1492 Object value = getConstantValue("2 == 3"); | 1492 Object value = _getConstantValue("2 == 3"); |
| 1493 JUnitTestCase.assertEquals(false, value); | 1493 JUnitTestCase.assertEquals(false, value); |
| 1494 } | 1494 } |
| 1495 | 1495 |
| 1496 void test_binary_equal_invalidLeft() { | 1496 void test_binary_equal_invalidLeft() { |
| 1497 Object value = getConstantValue("a == 3"); | 1497 Object value = _getConstantValue("a == 3"); |
| 1498 JUnitTestCase.assertEquals(ConstantEvaluator.NOT_A_CONSTANT, value); | 1498 JUnitTestCase.assertEquals(ConstantEvaluator.NOT_A_CONSTANT, value); |
| 1499 } | 1499 } |
| 1500 | 1500 |
| 1501 void test_binary_equal_invalidRight() { | 1501 void test_binary_equal_invalidRight() { |
| 1502 Object value = getConstantValue("2 == a"); | 1502 Object value = _getConstantValue("2 == a"); |
| 1503 JUnitTestCase.assertEquals(ConstantEvaluator.NOT_A_CONSTANT, value); | 1503 JUnitTestCase.assertEquals(ConstantEvaluator.NOT_A_CONSTANT, value); |
| 1504 } | 1504 } |
| 1505 | 1505 |
| 1506 void test_binary_equal_string() { | 1506 void test_binary_equal_string() { |
| 1507 Object value = getConstantValue("'a' == 'b'"); | 1507 Object value = _getConstantValue("'a' == 'b'"); |
| 1508 JUnitTestCase.assertEquals(false, value); | 1508 JUnitTestCase.assertEquals(false, value); |
| 1509 } | 1509 } |
| 1510 | 1510 |
| 1511 void test_binary_greaterThan() { | 1511 void test_binary_greaterThan() { |
| 1512 Object value = getConstantValue("2 > 3"); | 1512 Object value = _getConstantValue("2 > 3"); |
| 1513 JUnitTestCase.assertEquals(false, value); | 1513 JUnitTestCase.assertEquals(false, value); |
| 1514 } | 1514 } |
| 1515 | 1515 |
| 1516 void test_binary_greaterThanOrEqual() { | 1516 void test_binary_greaterThanOrEqual() { |
| 1517 Object value = getConstantValue("2 >= 3"); | 1517 Object value = _getConstantValue("2 >= 3"); |
| 1518 JUnitTestCase.assertEquals(false, value); | 1518 JUnitTestCase.assertEquals(false, value); |
| 1519 } | 1519 } |
| 1520 | 1520 |
| 1521 void test_binary_leftShift() { | 1521 void test_binary_leftShift() { |
| 1522 Object value = getConstantValue("16 << 2"); | 1522 Object value = _getConstantValue("16 << 2"); |
| 1523 EngineTestCase.assertInstanceOf((obj) => obj is int, int, value); | 1523 EngineTestCase.assertInstanceOf((obj) => obj is int, int, value); |
| 1524 JUnitTestCase.assertEquals(64, value as int); | 1524 JUnitTestCase.assertEquals(64, value as int); |
| 1525 } | 1525 } |
| 1526 | 1526 |
| 1527 void test_binary_lessThan() { | 1527 void test_binary_lessThan() { |
| 1528 Object value = getConstantValue("2 < 3"); | 1528 Object value = _getConstantValue("2 < 3"); |
| 1529 JUnitTestCase.assertEquals(true, value); | 1529 JUnitTestCase.assertEquals(true, value); |
| 1530 } | 1530 } |
| 1531 | 1531 |
| 1532 void test_binary_lessThanOrEqual() { | 1532 void test_binary_lessThanOrEqual() { |
| 1533 Object value = getConstantValue("2 <= 3"); | 1533 Object value = _getConstantValue("2 <= 3"); |
| 1534 JUnitTestCase.assertEquals(true, value); | 1534 JUnitTestCase.assertEquals(true, value); |
| 1535 } | 1535 } |
| 1536 | 1536 |
| 1537 void test_binary_logicalAnd() { | 1537 void test_binary_logicalAnd() { |
| 1538 Object value = getConstantValue("true && false"); | 1538 Object value = _getConstantValue("true && false"); |
| 1539 JUnitTestCase.assertEquals(false, value); | 1539 JUnitTestCase.assertEquals(false, value); |
| 1540 } | 1540 } |
| 1541 | 1541 |
| 1542 void test_binary_logicalOr() { | 1542 void test_binary_logicalOr() { |
| 1543 Object value = getConstantValue("true || false"); | 1543 Object value = _getConstantValue("true || false"); |
| 1544 JUnitTestCase.assertEquals(true, value); | 1544 JUnitTestCase.assertEquals(true, value); |
| 1545 } | 1545 } |
| 1546 | 1546 |
| 1547 void test_binary_minus_double() { | 1547 void test_binary_minus_double() { |
| 1548 Object value = getConstantValue("3.2 - 2.3"); | 1548 Object value = _getConstantValue("3.2 - 2.3"); |
| 1549 EngineTestCase.assertInstanceOf((obj) => obj is double, double, value); | 1549 EngineTestCase.assertInstanceOf((obj) => obj is double, double, value); |
| 1550 JUnitTestCase.assertEquals(3.2 - 2.3, value as double); | 1550 JUnitTestCase.assertEquals(3.2 - 2.3, value as double); |
| 1551 } | 1551 } |
| 1552 | 1552 |
| 1553 void test_binary_minus_integer() { | 1553 void test_binary_minus_integer() { |
| 1554 Object value = getConstantValue("3 - 2"); | 1554 Object value = _getConstantValue("3 - 2"); |
| 1555 EngineTestCase.assertInstanceOf((obj) => obj is int, int, value); | 1555 EngineTestCase.assertInstanceOf((obj) => obj is int, int, value); |
| 1556 JUnitTestCase.assertEquals(1, value as int); | 1556 JUnitTestCase.assertEquals(1, value as int); |
| 1557 } | 1557 } |
| 1558 | 1558 |
| 1559 void test_binary_notEqual_boolean() { | 1559 void test_binary_notEqual_boolean() { |
| 1560 Object value = getConstantValue("true != false"); | 1560 Object value = _getConstantValue("true != false"); |
| 1561 JUnitTestCase.assertEquals(true, value); | 1561 JUnitTestCase.assertEquals(true, value); |
| 1562 } | 1562 } |
| 1563 | 1563 |
| 1564 void test_binary_notEqual_integer() { | 1564 void test_binary_notEqual_integer() { |
| 1565 Object value = getConstantValue("2 != 3"); | 1565 Object value = _getConstantValue("2 != 3"); |
| 1566 JUnitTestCase.assertEquals(true, value); | 1566 JUnitTestCase.assertEquals(true, value); |
| 1567 } | 1567 } |
| 1568 | 1568 |
| 1569 void test_binary_notEqual_invalidLeft() { | 1569 void test_binary_notEqual_invalidLeft() { |
| 1570 Object value = getConstantValue("a != 3"); | 1570 Object value = _getConstantValue("a != 3"); |
| 1571 JUnitTestCase.assertEquals(ConstantEvaluator.NOT_A_CONSTANT, value); | 1571 JUnitTestCase.assertEquals(ConstantEvaluator.NOT_A_CONSTANT, value); |
| 1572 } | 1572 } |
| 1573 | 1573 |
| 1574 void test_binary_notEqual_invalidRight() { | 1574 void test_binary_notEqual_invalidRight() { |
| 1575 Object value = getConstantValue("2 != a"); | 1575 Object value = _getConstantValue("2 != a"); |
| 1576 JUnitTestCase.assertEquals(ConstantEvaluator.NOT_A_CONSTANT, value); | 1576 JUnitTestCase.assertEquals(ConstantEvaluator.NOT_A_CONSTANT, value); |
| 1577 } | 1577 } |
| 1578 | 1578 |
| 1579 void test_binary_notEqual_string() { | 1579 void test_binary_notEqual_string() { |
| 1580 Object value = getConstantValue("'a' != 'b'"); | 1580 Object value = _getConstantValue("'a' != 'b'"); |
| 1581 JUnitTestCase.assertEquals(true, value); | 1581 JUnitTestCase.assertEquals(true, value); |
| 1582 } | 1582 } |
| 1583 | 1583 |
| 1584 void test_binary_plus_double() { | 1584 void test_binary_plus_double() { |
| 1585 Object value = getConstantValue("2.3 + 3.2"); | 1585 Object value = _getConstantValue("2.3 + 3.2"); |
| 1586 EngineTestCase.assertInstanceOf((obj) => obj is double, double, value); | 1586 EngineTestCase.assertInstanceOf((obj) => obj is double, double, value); |
| 1587 JUnitTestCase.assertEquals(2.3 + 3.2, value as double); | 1587 JUnitTestCase.assertEquals(2.3 + 3.2, value as double); |
| 1588 } | 1588 } |
| 1589 | 1589 |
| 1590 void test_binary_plus_integer() { | 1590 void test_binary_plus_integer() { |
| 1591 Object value = getConstantValue("2 + 3"); | 1591 Object value = _getConstantValue("2 + 3"); |
| 1592 EngineTestCase.assertInstanceOf((obj) => obj is int, int, value); | 1592 EngineTestCase.assertInstanceOf((obj) => obj is int, int, value); |
| 1593 JUnitTestCase.assertEquals(5, value as int); | 1593 JUnitTestCase.assertEquals(5, value as int); |
| 1594 } | 1594 } |
| 1595 | 1595 |
| 1596 void test_binary_remainder_double() { | 1596 void test_binary_remainder_double() { |
| 1597 Object value = getConstantValue("3.2 % 2.3"); | 1597 Object value = _getConstantValue("3.2 % 2.3"); |
| 1598 EngineTestCase.assertInstanceOf((obj) => obj is double, double, value); | 1598 EngineTestCase.assertInstanceOf((obj) => obj is double, double, value); |
| 1599 JUnitTestCase.assertEquals(3.2 % 2.3, value as double); | 1599 JUnitTestCase.assertEquals(3.2 % 2.3, value as double); |
| 1600 } | 1600 } |
| 1601 | 1601 |
| 1602 void test_binary_remainder_integer() { | 1602 void test_binary_remainder_integer() { |
| 1603 Object value = getConstantValue("8 % 3"); | 1603 Object value = _getConstantValue("8 % 3"); |
| 1604 EngineTestCase.assertInstanceOf((obj) => obj is int, int, value); | 1604 EngineTestCase.assertInstanceOf((obj) => obj is int, int, value); |
| 1605 JUnitTestCase.assertEquals(2, value as int); | 1605 JUnitTestCase.assertEquals(2, value as int); |
| 1606 } | 1606 } |
| 1607 | 1607 |
| 1608 void test_binary_rightShift() { | 1608 void test_binary_rightShift() { |
| 1609 Object value = getConstantValue("64 >> 2"); | 1609 Object value = _getConstantValue("64 >> 2"); |
| 1610 EngineTestCase.assertInstanceOf((obj) => obj is int, int, value); | 1610 EngineTestCase.assertInstanceOf((obj) => obj is int, int, value); |
| 1611 JUnitTestCase.assertEquals(16, value as int); | 1611 JUnitTestCase.assertEquals(16, value as int); |
| 1612 } | 1612 } |
| 1613 | 1613 |
| 1614 void test_binary_times_double() { | 1614 void test_binary_times_double() { |
| 1615 Object value = getConstantValue("2.3 * 3.2"); | 1615 Object value = _getConstantValue("2.3 * 3.2"); |
| 1616 EngineTestCase.assertInstanceOf((obj) => obj is double, double, value); | 1616 EngineTestCase.assertInstanceOf((obj) => obj is double, double, value); |
| 1617 JUnitTestCase.assertEquals(2.3 * 3.2, value as double); | 1617 JUnitTestCase.assertEquals(2.3 * 3.2, value as double); |
| 1618 } | 1618 } |
| 1619 | 1619 |
| 1620 void test_binary_times_integer() { | 1620 void test_binary_times_integer() { |
| 1621 Object value = getConstantValue("2 * 3"); | 1621 Object value = _getConstantValue("2 * 3"); |
| 1622 EngineTestCase.assertInstanceOf((obj) => obj is int, int, value); | 1622 EngineTestCase.assertInstanceOf((obj) => obj is int, int, value); |
| 1623 JUnitTestCase.assertEquals(6, value as int); | 1623 JUnitTestCase.assertEquals(6, value as int); |
| 1624 } | 1624 } |
| 1625 | 1625 |
| 1626 void test_binary_truncatingDivide_double() { | 1626 void test_binary_truncatingDivide_double() { |
| 1627 Object value = getConstantValue("3.2 ~/ 2.3"); | 1627 Object value = _getConstantValue("3.2 ~/ 2.3"); |
| 1628 EngineTestCase.assertInstanceOf((obj) => obj is int, int, value); | 1628 EngineTestCase.assertInstanceOf((obj) => obj is int, int, value); |
| 1629 JUnitTestCase.assertEquals(1, value as int); | 1629 JUnitTestCase.assertEquals(1, value as int); |
| 1630 } | 1630 } |
| 1631 | 1631 |
| 1632 void test_binary_truncatingDivide_integer() { | 1632 void test_binary_truncatingDivide_integer() { |
| 1633 Object value = getConstantValue("10 ~/ 3"); | 1633 Object value = _getConstantValue("10 ~/ 3"); |
| 1634 EngineTestCase.assertInstanceOf((obj) => obj is int, int, value); | 1634 EngineTestCase.assertInstanceOf((obj) => obj is int, int, value); |
| 1635 JUnitTestCase.assertEquals(3, value as int); | 1635 JUnitTestCase.assertEquals(3, value as int); |
| 1636 } | 1636 } |
| 1637 | 1637 |
| 1638 void test_literal_boolean_false() { | 1638 void test_literal_boolean_false() { |
| 1639 Object value = getConstantValue("false"); | 1639 Object value = _getConstantValue("false"); |
| 1640 JUnitTestCase.assertEquals(false, value); | 1640 JUnitTestCase.assertEquals(false, value); |
| 1641 } | 1641 } |
| 1642 | 1642 |
| 1643 void test_literal_boolean_true() { | 1643 void test_literal_boolean_true() { |
| 1644 Object value = getConstantValue("true"); | 1644 Object value = _getConstantValue("true"); |
| 1645 JUnitTestCase.assertEquals(true, value); | 1645 JUnitTestCase.assertEquals(true, value); |
| 1646 } | 1646 } |
| 1647 | 1647 |
| 1648 void test_literal_list() { | 1648 void test_literal_list() { |
| 1649 Object value = getConstantValue("['a', 'b', 'c']"); | 1649 Object value = _getConstantValue("['a', 'b', 'c']"); |
| 1650 EngineTestCase.assertInstanceOf((obj) => obj is List, List, value); | 1650 EngineTestCase.assertInstanceOf((obj) => obj is List, List, value); |
| 1651 List list = value as List; | 1651 List list = value as List; |
| 1652 JUnitTestCase.assertEquals(3, list.length); | 1652 JUnitTestCase.assertEquals(3, list.length); |
| 1653 JUnitTestCase.assertEquals("a", list[0]); | 1653 JUnitTestCase.assertEquals("a", list[0]); |
| 1654 JUnitTestCase.assertEquals("b", list[1]); | 1654 JUnitTestCase.assertEquals("b", list[1]); |
| 1655 JUnitTestCase.assertEquals("c", list[2]); | 1655 JUnitTestCase.assertEquals("c", list[2]); |
| 1656 } | 1656 } |
| 1657 | 1657 |
| 1658 void test_literal_map() { | 1658 void test_literal_map() { |
| 1659 Object value = getConstantValue("{'a' : 'm', 'b' : 'n', 'c' : 'o'}"); | 1659 Object value = _getConstantValue("{'a' : 'm', 'b' : 'n', 'c' : 'o'}"); |
| 1660 EngineTestCase.assertInstanceOf((obj) => obj is Map, Map, value); | 1660 EngineTestCase.assertInstanceOf((obj) => obj is Map, Map, value); |
| 1661 Map map = value as Map; | 1661 Map map = value as Map; |
| 1662 JUnitTestCase.assertEquals(3, map.length); | 1662 JUnitTestCase.assertEquals(3, map.length); |
| 1663 JUnitTestCase.assertEquals("m", map["a"]); | 1663 JUnitTestCase.assertEquals("m", map["a"]); |
| 1664 JUnitTestCase.assertEquals("n", map["b"]); | 1664 JUnitTestCase.assertEquals("n", map["b"]); |
| 1665 JUnitTestCase.assertEquals("o", map["c"]); | 1665 JUnitTestCase.assertEquals("o", map["c"]); |
| 1666 } | 1666 } |
| 1667 | 1667 |
| 1668 void test_literal_null() { | 1668 void test_literal_null() { |
| 1669 Object value = getConstantValue("null"); | 1669 Object value = _getConstantValue("null"); |
| 1670 JUnitTestCase.assertEquals(null, value); | 1670 JUnitTestCase.assertEquals(null, value); |
| 1671 } | 1671 } |
| 1672 | 1672 |
| 1673 void test_literal_number_double() { | 1673 void test_literal_number_double() { |
| 1674 Object value = getConstantValue("3.45"); | 1674 Object value = _getConstantValue("3.45"); |
| 1675 EngineTestCase.assertInstanceOf((obj) => obj is double, double, value); | 1675 EngineTestCase.assertInstanceOf((obj) => obj is double, double, value); |
| 1676 JUnitTestCase.assertEquals(3.45, value as double); | 1676 JUnitTestCase.assertEquals(3.45, value as double); |
| 1677 } | 1677 } |
| 1678 | 1678 |
| 1679 void test_literal_number_integer() { | 1679 void test_literal_number_integer() { |
| 1680 Object value = getConstantValue("42"); | 1680 Object value = _getConstantValue("42"); |
| 1681 EngineTestCase.assertInstanceOf((obj) => obj is int, int, value); | 1681 EngineTestCase.assertInstanceOf((obj) => obj is int, int, value); |
| 1682 JUnitTestCase.assertEquals(42, value as int); | 1682 JUnitTestCase.assertEquals(42, value as int); |
| 1683 } | 1683 } |
| 1684 | 1684 |
| 1685 void test_literal_string_adjacent() { | 1685 void test_literal_string_adjacent() { |
| 1686 Object value = getConstantValue("'abc' 'def'"); | 1686 Object value = _getConstantValue("'abc' 'def'"); |
| 1687 JUnitTestCase.assertEquals("abcdef", value); | 1687 JUnitTestCase.assertEquals("abcdef", value); |
| 1688 } | 1688 } |
| 1689 | 1689 |
| 1690 void test_literal_string_interpolation_invalid() { | 1690 void test_literal_string_interpolation_invalid() { |
| 1691 Object value = getConstantValue("'a\${f()}c'"); | 1691 Object value = _getConstantValue("'a\${f()}c'"); |
| 1692 JUnitTestCase.assertEquals(ConstantEvaluator.NOT_A_CONSTANT, value); | 1692 JUnitTestCase.assertEquals(ConstantEvaluator.NOT_A_CONSTANT, value); |
| 1693 } | 1693 } |
| 1694 | 1694 |
| 1695 void test_literal_string_interpolation_valid() { | 1695 void test_literal_string_interpolation_valid() { |
| 1696 Object value = getConstantValue("'a\${3}c'"); | 1696 Object value = _getConstantValue("'a\${3}c'"); |
| 1697 JUnitTestCase.assertEquals("a3c", value); | 1697 JUnitTestCase.assertEquals("a3c", value); |
| 1698 } | 1698 } |
| 1699 | 1699 |
| 1700 void test_literal_string_simple() { | 1700 void test_literal_string_simple() { |
| 1701 Object value = getConstantValue("'abc'"); | 1701 Object value = _getConstantValue("'abc'"); |
| 1702 JUnitTestCase.assertEquals("abc", value); | 1702 JUnitTestCase.assertEquals("abc", value); |
| 1703 } | 1703 } |
| 1704 | 1704 |
| 1705 void test_parenthesizedExpression() { | 1705 void test_parenthesizedExpression() { |
| 1706 Object value = getConstantValue("('a')"); | 1706 Object value = _getConstantValue("('a')"); |
| 1707 JUnitTestCase.assertEquals("a", value); | 1707 JUnitTestCase.assertEquals("a", value); |
| 1708 } | 1708 } |
| 1709 | 1709 |
| 1710 void test_unary_bitNot() { | 1710 void test_unary_bitNot() { |
| 1711 Object value = getConstantValue("~42"); | 1711 Object value = _getConstantValue("~42"); |
| 1712 EngineTestCase.assertInstanceOf((obj) => obj is int, int, value); | 1712 EngineTestCase.assertInstanceOf((obj) => obj is int, int, value); |
| 1713 JUnitTestCase.assertEquals(~42, value as int); | 1713 JUnitTestCase.assertEquals(~42, value as int); |
| 1714 } | 1714 } |
| 1715 | 1715 |
| 1716 void test_unary_logicalNot() { | 1716 void test_unary_logicalNot() { |
| 1717 Object value = getConstantValue("!true"); | 1717 Object value = _getConstantValue("!true"); |
| 1718 JUnitTestCase.assertEquals(false, value); | 1718 JUnitTestCase.assertEquals(false, value); |
| 1719 } | 1719 } |
| 1720 | 1720 |
| 1721 void test_unary_negated_double() { | 1721 void test_unary_negated_double() { |
| 1722 Object value = getConstantValue("-42.3"); | 1722 Object value = _getConstantValue("-42.3"); |
| 1723 EngineTestCase.assertInstanceOf((obj) => obj is double, double, value); | 1723 EngineTestCase.assertInstanceOf((obj) => obj is double, double, value); |
| 1724 JUnitTestCase.assertEquals(-42.3, value as double); | 1724 JUnitTestCase.assertEquals(-42.3, value as double); |
| 1725 } | 1725 } |
| 1726 | 1726 |
| 1727 void test_unary_negated_integer() { | 1727 void test_unary_negated_integer() { |
| 1728 Object value = getConstantValue("-42"); | 1728 Object value = _getConstantValue("-42"); |
| 1729 EngineTestCase.assertInstanceOf((obj) => obj is int, int, value); | 1729 EngineTestCase.assertInstanceOf((obj) => obj is int, int, value); |
| 1730 JUnitTestCase.assertEquals(-42, value as int); | 1730 JUnitTestCase.assertEquals(-42, value as int); |
| 1731 } | 1731 } |
| 1732 | 1732 |
| 1733 Object getConstantValue(String source) => ParserTestCase.parseExpression(sourc
e, []).accept(new ConstantEvaluator()); | 1733 Object _getConstantValue(String source) => ParserTestCase.parseExpression(sour
ce, []).accept(new ConstantEvaluator()); |
| 1734 | 1734 |
| 1735 static dartSuite() { | 1735 static dartSuite() { |
| 1736 _ut.group('ConstantEvaluatorTest', () { | 1736 _ut.group('ConstantEvaluatorTest', () { |
| 1737 _ut.test('test_binary_bitAnd', () { | 1737 _ut.test('test_binary_bitAnd', () { |
| 1738 final __test = new ConstantEvaluatorTest(); | 1738 final __test = new ConstantEvaluatorTest(); |
| 1739 runJUnitTest(__test, __test.test_binary_bitAnd); | 1739 runJUnitTest(__test, __test.test_binary_bitAnd); |
| 1740 }); | 1740 }); |
| 1741 _ut.test('test_binary_bitOr', () { | 1741 _ut.test('test_binary_bitOr', () { |
| 1742 final __test = new ConstantEvaluatorTest(); | 1742 final __test = new ConstantEvaluatorTest(); |
| 1743 runJUnitTest(__test, __test.test_binary_bitOr); | 1743 runJUnitTest(__test, __test.test_binary_bitOr); |
| (...skipping 250 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1994 _ut.test('test_simple', () { | 1994 _ut.test('test_simple', () { |
| 1995 final __test = new SimpleStringLiteralTest(); | 1995 final __test = new SimpleStringLiteralTest(); |
| 1996 runJUnitTest(__test, __test.test_simple); | 1996 runJUnitTest(__test, __test.test_simple); |
| 1997 }); | 1997 }); |
| 1998 }); | 1998 }); |
| 1999 } | 1999 } |
| 2000 } | 2000 } |
| 2001 | 2001 |
| 2002 class ToSourceVisitorTest extends EngineTestCase { | 2002 class ToSourceVisitorTest extends EngineTestCase { |
| 2003 void test_visitAdjacentStrings() { | 2003 void test_visitAdjacentStrings() { |
| 2004 assertSource("'a' 'b'", AstFactory.adjacentStrings([AstFactory.string2("a"),
AstFactory.string2("b")])); | 2004 _assertSource("'a' 'b'", AstFactory.adjacentStrings([AstFactory.string2("a")
, AstFactory.string2("b")])); |
| 2005 } | 2005 } |
| 2006 | 2006 |
| 2007 void test_visitAnnotation_constant() { | 2007 void test_visitAnnotation_constant() { |
| 2008 assertSource("@A", AstFactory.annotation(AstFactory.identifier3("A"))); | 2008 _assertSource("@A", AstFactory.annotation(AstFactory.identifier3("A"))); |
| 2009 } | 2009 } |
| 2010 | 2010 |
| 2011 void test_visitAnnotation_constructor() { | 2011 void test_visitAnnotation_constructor() { |
| 2012 assertSource("@A.c()", AstFactory.annotation2(AstFactory.identifier3("A"), A
stFactory.identifier3("c"), AstFactory.argumentList([]))); | 2012 _assertSource("@A.c()", AstFactory.annotation2(AstFactory.identifier3("A"),
AstFactory.identifier3("c"), AstFactory.argumentList([]))); |
| 2013 } | 2013 } |
| 2014 | 2014 |
| 2015 void test_visitArgumentDefinitionTest() { | 2015 void test_visitArgumentDefinitionTest() { |
| 2016 assertSource("?a", AstFactory.argumentDefinitionTest("a")); | 2016 _assertSource("?a", AstFactory.argumentDefinitionTest("a")); |
| 2017 } | 2017 } |
| 2018 | 2018 |
| 2019 void test_visitArgumentList() { | 2019 void test_visitArgumentList() { |
| 2020 assertSource("(a, b)", AstFactory.argumentList([AstFactory.identifier3("a"),
AstFactory.identifier3("b")])); | 2020 _assertSource("(a, b)", AstFactory.argumentList([AstFactory.identifier3("a")
, AstFactory.identifier3("b")])); |
| 2021 } | 2021 } |
| 2022 | 2022 |
| 2023 void test_visitAsExpression() { | 2023 void test_visitAsExpression() { |
| 2024 assertSource("e as T", AstFactory.asExpression(AstFactory.identifier3("e"),
AstFactory.typeName4("T", []))); | 2024 _assertSource("e as T", AstFactory.asExpression(AstFactory.identifier3("e"),
AstFactory.typeName4("T", []))); |
| 2025 } | 2025 } |
| 2026 | 2026 |
| 2027 void test_visitAssertStatement() { | 2027 void test_visitAssertStatement() { |
| 2028 assertSource("assert (a);", AstFactory.assertStatement(AstFactory.identifier
3("a"))); | 2028 _assertSource("assert (a);", AstFactory.assertStatement(AstFactory.identifie
r3("a"))); |
| 2029 } | 2029 } |
| 2030 | 2030 |
| 2031 void test_visitAssignmentExpression() { | 2031 void test_visitAssignmentExpression() { |
| 2032 assertSource("a = b", AstFactory.assignmentExpression(AstFactory.identifier3
("a"), TokenType.EQ, AstFactory.identifier3("b"))); | 2032 _assertSource("a = b", AstFactory.assignmentExpression(AstFactory.identifier
3("a"), TokenType.EQ, AstFactory.identifier3("b"))); |
| 2033 } | 2033 } |
| 2034 | 2034 |
| 2035 void test_visitBinaryExpression() { | 2035 void test_visitBinaryExpression() { |
| 2036 assertSource("a + b", AstFactory.binaryExpression(AstFactory.identifier3("a"
), TokenType.PLUS, AstFactory.identifier3("b"))); | 2036 _assertSource("a + b", AstFactory.binaryExpression(AstFactory.identifier3("a
"), TokenType.PLUS, AstFactory.identifier3("b"))); |
| 2037 } | 2037 } |
| 2038 | 2038 |
| 2039 void test_visitBlock_empty() { | 2039 void test_visitBlock_empty() { |
| 2040 assertSource("{}", AstFactory.block([])); | 2040 _assertSource("{}", AstFactory.block([])); |
| 2041 } | 2041 } |
| 2042 | 2042 |
| 2043 void test_visitBlock_nonEmpty() { | 2043 void test_visitBlock_nonEmpty() { |
| 2044 assertSource("{break; break;}", AstFactory.block([AstFactory.breakStatement(
), AstFactory.breakStatement()])); | 2044 _assertSource("{break; break;}", AstFactory.block([AstFactory.breakStatement
(), AstFactory.breakStatement()])); |
| 2045 } | 2045 } |
| 2046 | 2046 |
| 2047 void test_visitBlockFunctionBody() { | 2047 void test_visitBlockFunctionBody() { |
| 2048 assertSource("{}", AstFactory.blockFunctionBody2([])); | 2048 _assertSource("{}", AstFactory.blockFunctionBody2([])); |
| 2049 } | 2049 } |
| 2050 | 2050 |
| 2051 void test_visitBooleanLiteral_false() { | 2051 void test_visitBooleanLiteral_false() { |
| 2052 assertSource("false", AstFactory.booleanLiteral(false)); | 2052 _assertSource("false", AstFactory.booleanLiteral(false)); |
| 2053 } | 2053 } |
| 2054 | 2054 |
| 2055 void test_visitBooleanLiteral_true() { | 2055 void test_visitBooleanLiteral_true() { |
| 2056 assertSource("true", AstFactory.booleanLiteral(true)); | 2056 _assertSource("true", AstFactory.booleanLiteral(true)); |
| 2057 } | 2057 } |
| 2058 | 2058 |
| 2059 void test_visitBreakStatement_label() { | 2059 void test_visitBreakStatement_label() { |
| 2060 assertSource("break l;", AstFactory.breakStatement2("l")); | 2060 _assertSource("break l;", AstFactory.breakStatement2("l")); |
| 2061 } | 2061 } |
| 2062 | 2062 |
| 2063 void test_visitBreakStatement_noLabel() { | 2063 void test_visitBreakStatement_noLabel() { |
| 2064 assertSource("break;", AstFactory.breakStatement()); | 2064 _assertSource("break;", AstFactory.breakStatement()); |
| 2065 } | 2065 } |
| 2066 | 2066 |
| 2067 void test_visitCascadeExpression_field() { | 2067 void test_visitCascadeExpression_field() { |
| 2068 assertSource("a..b..c", AstFactory.cascadeExpression(AstFactory.identifier3(
"a"), [ | 2068 _assertSource("a..b..c", AstFactory.cascadeExpression(AstFactory.identifier3
("a"), [ |
| 2069 AstFactory.cascadedPropertyAccess("b"), | 2069 AstFactory.cascadedPropertyAccess("b"), |
| 2070 AstFactory.cascadedPropertyAccess("c")])); | 2070 AstFactory.cascadedPropertyAccess("c")])); |
| 2071 } | 2071 } |
| 2072 | 2072 |
| 2073 void test_visitCascadeExpression_index() { | 2073 void test_visitCascadeExpression_index() { |
| 2074 assertSource("a..[0]..[1]", AstFactory.cascadeExpression(AstFactory.identifi
er3("a"), [ | 2074 _assertSource("a..[0]..[1]", AstFactory.cascadeExpression(AstFactory.identif
ier3("a"), [ |
| 2075 AstFactory.cascadedIndexExpression(AstFactory.integer(0)), | 2075 AstFactory.cascadedIndexExpression(AstFactory.integer(0)), |
| 2076 AstFactory.cascadedIndexExpression(AstFactory.integer(1))])); | 2076 AstFactory.cascadedIndexExpression(AstFactory.integer(1))])); |
| 2077 } | 2077 } |
| 2078 | 2078 |
| 2079 void test_visitCascadeExpression_method() { | 2079 void test_visitCascadeExpression_method() { |
| 2080 assertSource("a..b()..c()", AstFactory.cascadeExpression(AstFactory.identifi
er3("a"), [ | 2080 _assertSource("a..b()..c()", AstFactory.cascadeExpression(AstFactory.identif
ier3("a"), [ |
| 2081 AstFactory.cascadedMethodInvocation("b", []), | 2081 AstFactory.cascadedMethodInvocation("b", []), |
| 2082 AstFactory.cascadedMethodInvocation("c", [])])); | 2082 AstFactory.cascadedMethodInvocation("c", [])])); |
| 2083 } | 2083 } |
| 2084 | 2084 |
| 2085 void test_visitCatchClause_catch_noStack() { | 2085 void test_visitCatchClause_catch_noStack() { |
| 2086 assertSource("catch (e) {}", AstFactory.catchClause("e", [])); | 2086 _assertSource("catch (e) {}", AstFactory.catchClause("e", [])); |
| 2087 } | 2087 } |
| 2088 | 2088 |
| 2089 void test_visitCatchClause_catch_stack() { | 2089 void test_visitCatchClause_catch_stack() { |
| 2090 assertSource("catch (e, s) {}", AstFactory.catchClause2("e", "s", [])); | 2090 _assertSource("catch (e, s) {}", AstFactory.catchClause2("e", "s", [])); |
| 2091 } | 2091 } |
| 2092 | 2092 |
| 2093 void test_visitCatchClause_on() { | 2093 void test_visitCatchClause_on() { |
| 2094 assertSource("on E {}", AstFactory.catchClause3(AstFactory.typeName4("E", []
), [])); | 2094 _assertSource("on E {}", AstFactory.catchClause3(AstFactory.typeName4("E", [
]), [])); |
| 2095 } | 2095 } |
| 2096 | 2096 |
| 2097 void test_visitCatchClause_on_catch() { | 2097 void test_visitCatchClause_on_catch() { |
| 2098 assertSource("on E catch (e) {}", AstFactory.catchClause4(AstFactory.typeNam
e4("E", []), "e", [])); | 2098 _assertSource("on E catch (e) {}", AstFactory.catchClause4(AstFactory.typeNa
me4("E", []), "e", [])); |
| 2099 } | 2099 } |
| 2100 | 2100 |
| 2101 void test_visitClassDeclaration_abstract() { | 2101 void test_visitClassDeclaration_abstract() { |
| 2102 assertSource("abstract class C {}", AstFactory.classDeclaration(Keyword.ABST
RACT, "C", null, null, null, null, [])); | 2102 _assertSource("abstract class C {}", AstFactory.classDeclaration(Keyword.ABS
TRACT, "C", null, null, null, null, [])); |
| 2103 } | 2103 } |
| 2104 | 2104 |
| 2105 void test_visitClassDeclaration_empty() { | 2105 void test_visitClassDeclaration_empty() { |
| 2106 assertSource("class C {}", AstFactory.classDeclaration(null, "C", null, null
, null, null, [])); | 2106 _assertSource("class C {}", AstFactory.classDeclaration(null, "C", null, nul
l, null, null, [])); |
| 2107 } | 2107 } |
| 2108 | 2108 |
| 2109 void test_visitClassDeclaration_extends() { | 2109 void test_visitClassDeclaration_extends() { |
| 2110 assertSource("class C extends A {}", AstFactory.classDeclaration(null, "C",
null, AstFactory.extendsClause(AstFactory.typeName4("A", [])), null, null, [])); | 2110 _assertSource("class C extends A {}", AstFactory.classDeclaration(null, "C",
null, AstFactory.extendsClause(AstFactory.typeName4("A", [])), null, null, []))
; |
| 2111 } | 2111 } |
| 2112 | 2112 |
| 2113 void test_visitClassDeclaration_extends_implements() { | 2113 void test_visitClassDeclaration_extends_implements() { |
| 2114 assertSource("class C extends A implements B {}", AstFactory.classDeclaratio
n(null, "C", null, AstFactory.extendsClause(AstFactory.typeName4("A", [])), null
, AstFactory.implementsClause([AstFactory.typeName4("B", [])]), [])); | 2114 _assertSource("class C extends A implements B {}", AstFactory.classDeclarati
on(null, "C", null, AstFactory.extendsClause(AstFactory.typeName4("A", [])), nul
l, AstFactory.implementsClause([AstFactory.typeName4("B", [])]), [])); |
| 2115 } | 2115 } |
| 2116 | 2116 |
| 2117 void test_visitClassDeclaration_extends_with() { | 2117 void test_visitClassDeclaration_extends_with() { |
| 2118 assertSource("class C extends A with M {}", AstFactory.classDeclaration(null
, "C", null, AstFactory.extendsClause(AstFactory.typeName4("A", [])), AstFactory
.withClause([AstFactory.typeName4("M", [])]), null, [])); | 2118 _assertSource("class C extends A with M {}", AstFactory.classDeclaration(nul
l, "C", null, AstFactory.extendsClause(AstFactory.typeName4("A", [])), AstFactor
y.withClause([AstFactory.typeName4("M", [])]), null, [])); |
| 2119 } | 2119 } |
| 2120 | 2120 |
| 2121 void test_visitClassDeclaration_extends_with_implements() { | 2121 void test_visitClassDeclaration_extends_with_implements() { |
| 2122 assertSource("class C extends A with M implements B {}", AstFactory.classDec
laration(null, "C", null, AstFactory.extendsClause(AstFactory.typeName4("A", [])
), AstFactory.withClause([AstFactory.typeName4("M", [])]), AstFactory.implements
Clause([AstFactory.typeName4("B", [])]), [])); | 2122 _assertSource("class C extends A with M implements B {}", AstFactory.classDe
claration(null, "C", null, AstFactory.extendsClause(AstFactory.typeName4("A", []
)), AstFactory.withClause([AstFactory.typeName4("M", [])]), AstFactory.implement
sClause([AstFactory.typeName4("B", [])]), [])); |
| 2123 } | 2123 } |
| 2124 | 2124 |
| 2125 void test_visitClassDeclaration_implements() { | 2125 void test_visitClassDeclaration_implements() { |
| 2126 assertSource("class C implements B {}", AstFactory.classDeclaration(null, "C
", null, null, null, AstFactory.implementsClause([AstFactory.typeName4("B", [])]
), [])); | 2126 _assertSource("class C implements B {}", AstFactory.classDeclaration(null, "
C", null, null, null, AstFactory.implementsClause([AstFactory.typeName4("B", [])
]), [])); |
| 2127 } | 2127 } |
| 2128 | 2128 |
| 2129 void test_visitClassDeclaration_multipleMember() { | 2129 void test_visitClassDeclaration_multipleMember() { |
| 2130 assertSource("class C {var a; var b;}", AstFactory.classDeclaration(null, "C
", null, null, null, null, [ | 2130 _assertSource("class C {var a; var b;}", AstFactory.classDeclaration(null, "
C", null, null, null, null, [ |
| 2131 AstFactory.fieldDeclaration2(false, Keyword.VAR, [AstFactory.variableDec
laration("a")]), | 2131 AstFactory.fieldDeclaration2(false, Keyword.VAR, [AstFactory.variableDec
laration("a")]), |
| 2132 AstFactory.fieldDeclaration2(false, Keyword.VAR, [AstFactory.variableDec
laration("b")])])); | 2132 AstFactory.fieldDeclaration2(false, Keyword.VAR, [AstFactory.variableDec
laration("b")])])); |
| 2133 } | 2133 } |
| 2134 | 2134 |
| 2135 void test_visitClassDeclaration_parameters() { | 2135 void test_visitClassDeclaration_parameters() { |
| 2136 assertSource("class C<E> {}", AstFactory.classDeclaration(null, "C", AstFact
ory.typeParameterList(["E"]), null, null, null, [])); | 2136 _assertSource("class C<E> {}", AstFactory.classDeclaration(null, "C", AstFac
tory.typeParameterList(["E"]), null, null, null, [])); |
| 2137 } | 2137 } |
| 2138 | 2138 |
| 2139 void test_visitClassDeclaration_parameters_extends() { | 2139 void test_visitClassDeclaration_parameters_extends() { |
| 2140 assertSource("class C<E> extends A {}", AstFactory.classDeclaration(null, "C
", AstFactory.typeParameterList(["E"]), AstFactory.extendsClause(AstFactory.type
Name4("A", [])), null, null, [])); | 2140 _assertSource("class C<E> extends A {}", AstFactory.classDeclaration(null, "
C", AstFactory.typeParameterList(["E"]), AstFactory.extendsClause(AstFactory.typ
eName4("A", [])), null, null, [])); |
| 2141 } | 2141 } |
| 2142 | 2142 |
| 2143 void test_visitClassDeclaration_parameters_extends_implements() { | 2143 void test_visitClassDeclaration_parameters_extends_implements() { |
| 2144 assertSource("class C<E> extends A implements B {}", AstFactory.classDeclara
tion(null, "C", AstFactory.typeParameterList(["E"]), AstFactory.extendsClause(As
tFactory.typeName4("A", [])), null, AstFactory.implementsClause([AstFactory.type
Name4("B", [])]), [])); | 2144 _assertSource("class C<E> extends A implements B {}", AstFactory.classDeclar
ation(null, "C", AstFactory.typeParameterList(["E"]), AstFactory.extendsClause(A
stFactory.typeName4("A", [])), null, AstFactory.implementsClause([AstFactory.typ
eName4("B", [])]), [])); |
| 2145 } | 2145 } |
| 2146 | 2146 |
| 2147 void test_visitClassDeclaration_parameters_extends_with() { | 2147 void test_visitClassDeclaration_parameters_extends_with() { |
| 2148 assertSource("class C<E> extends A with M {}", AstFactory.classDeclaration(n
ull, "C", AstFactory.typeParameterList(["E"]), AstFactory.extendsClause(AstFacto
ry.typeName4("A", [])), AstFactory.withClause([AstFactory.typeName4("M", [])]),
null, [])); | 2148 _assertSource("class C<E> extends A with M {}", AstFactory.classDeclaration(
null, "C", AstFactory.typeParameterList(["E"]), AstFactory.extendsClause(AstFact
ory.typeName4("A", [])), AstFactory.withClause([AstFactory.typeName4("M", [])]),
null, [])); |
| 2149 } | 2149 } |
| 2150 | 2150 |
| 2151 void test_visitClassDeclaration_parameters_extends_with_implements() { | 2151 void test_visitClassDeclaration_parameters_extends_with_implements() { |
| 2152 assertSource("class C<E> extends A with M implements B {}", AstFactory.class
Declaration(null, "C", AstFactory.typeParameterList(["E"]), AstFactory.extendsCl
ause(AstFactory.typeName4("A", [])), AstFactory.withClause([AstFactory.typeName4
("M", [])]), AstFactory.implementsClause([AstFactory.typeName4("B", [])]), [])); | 2152 _assertSource("class C<E> extends A with M implements B {}", AstFactory.clas
sDeclaration(null, "C", AstFactory.typeParameterList(["E"]), AstFactory.extendsC
lause(AstFactory.typeName4("A", [])), AstFactory.withClause([AstFactory.typeName
4("M", [])]), AstFactory.implementsClause([AstFactory.typeName4("B", [])]), []))
; |
| 2153 } | 2153 } |
| 2154 | 2154 |
| 2155 void test_visitClassDeclaration_parameters_implements() { | 2155 void test_visitClassDeclaration_parameters_implements() { |
| 2156 assertSource("class C<E> implements B {}", AstFactory.classDeclaration(null,
"C", AstFactory.typeParameterList(["E"]), null, null, AstFactory.implementsClau
se([AstFactory.typeName4("B", [])]), [])); | 2156 _assertSource("class C<E> implements B {}", AstFactory.classDeclaration(null
, "C", AstFactory.typeParameterList(["E"]), null, null, AstFactory.implementsCla
use([AstFactory.typeName4("B", [])]), [])); |
| 2157 } | 2157 } |
| 2158 | 2158 |
| 2159 void test_visitClassDeclaration_singleMember() { | 2159 void test_visitClassDeclaration_singleMember() { |
| 2160 assertSource("class C {var a;}", AstFactory.classDeclaration(null, "C", null
, null, null, null, [AstFactory.fieldDeclaration2(false, Keyword.VAR, [AstFactor
y.variableDeclaration("a")])])); | 2160 _assertSource("class C {var a;}", AstFactory.classDeclaration(null, "C", nul
l, null, null, null, [AstFactory.fieldDeclaration2(false, Keyword.VAR, [AstFacto
ry.variableDeclaration("a")])])); |
| 2161 } | 2161 } |
| 2162 | 2162 |
| 2163 void test_visitClassTypeAlias_abstract() { | 2163 void test_visitClassTypeAlias_abstract() { |
| 2164 assertSource("abstract class C = S with M1;", AstFactory.classTypeAlias("C",
null, Keyword.ABSTRACT, AstFactory.typeName4("S", []), AstFactory.withClause([A
stFactory.typeName4("M1", [])]), null)); | 2164 _assertSource("abstract class C = S with M1;", AstFactory.classTypeAlias("C"
, null, Keyword.ABSTRACT, AstFactory.typeName4("S", []), AstFactory.withClause([
AstFactory.typeName4("M1", [])]), null)); |
| 2165 } | 2165 } |
| 2166 | 2166 |
| 2167 void test_visitClassTypeAlias_abstract_implements() { | 2167 void test_visitClassTypeAlias_abstract_implements() { |
| 2168 assertSource("abstract class C = S with M1 implements I;", AstFactory.classT
ypeAlias("C", null, Keyword.ABSTRACT, AstFactory.typeName4("S", []), AstFactory.
withClause([AstFactory.typeName4("M1", [])]), AstFactory.implementsClause([AstFa
ctory.typeName4("I", [])]))); | 2168 _assertSource("abstract class C = S with M1 implements I;", AstFactory.class
TypeAlias("C", null, Keyword.ABSTRACT, AstFactory.typeName4("S", []), AstFactory
.withClause([AstFactory.typeName4("M1", [])]), AstFactory.implementsClause([AstF
actory.typeName4("I", [])]))); |
| 2169 } | 2169 } |
| 2170 | 2170 |
| 2171 void test_visitClassTypeAlias_generic() { | 2171 void test_visitClassTypeAlias_generic() { |
| 2172 assertSource("class C<E> = S<E> with M1<E>;", AstFactory.classTypeAlias("C",
AstFactory.typeParameterList(["E"]), null, AstFactory.typeName4("S", [AstFactor
y.typeName4("E", [])]), AstFactory.withClause([AstFactory.typeName4("M1", [AstFa
ctory.typeName4("E", [])])]), null)); | 2172 _assertSource("class C<E> = S<E> with M1<E>;", AstFactory.classTypeAlias("C"
, AstFactory.typeParameterList(["E"]), null, AstFactory.typeName4("S", [AstFacto
ry.typeName4("E", [])]), AstFactory.withClause([AstFactory.typeName4("M1", [AstF
actory.typeName4("E", [])])]), null)); |
| 2173 } | 2173 } |
| 2174 | 2174 |
| 2175 void test_visitClassTypeAlias_implements() { | 2175 void test_visitClassTypeAlias_implements() { |
| 2176 assertSource("class C = S with M1 implements I;", AstFactory.classTypeAlias(
"C", null, null, AstFactory.typeName4("S", []), AstFactory.withClause([AstFactor
y.typeName4("M1", [])]), AstFactory.implementsClause([AstFactory.typeName4("I",
[])]))); | 2176 _assertSource("class C = S with M1 implements I;", AstFactory.classTypeAlias
("C", null, null, AstFactory.typeName4("S", []), AstFactory.withClause([AstFacto
ry.typeName4("M1", [])]), AstFactory.implementsClause([AstFactory.typeName4("I",
[])]))); |
| 2177 } | 2177 } |
| 2178 | 2178 |
| 2179 void test_visitClassTypeAlias_minimal() { | 2179 void test_visitClassTypeAlias_minimal() { |
| 2180 assertSource("class C = S with M1;", AstFactory.classTypeAlias("C", null, nu
ll, AstFactory.typeName4("S", []), AstFactory.withClause([AstFactory.typeName4("
M1", [])]), null)); | 2180 _assertSource("class C = S with M1;", AstFactory.classTypeAlias("C", null, n
ull, AstFactory.typeName4("S", []), AstFactory.withClause([AstFactory.typeName4(
"M1", [])]), null)); |
| 2181 } | 2181 } |
| 2182 | 2182 |
| 2183 void test_visitClassTypeAlias_parameters_abstract() { | 2183 void test_visitClassTypeAlias_parameters_abstract() { |
| 2184 assertSource("abstract class C<E> = S with M1;", AstFactory.classTypeAlias("
C", AstFactory.typeParameterList(["E"]), Keyword.ABSTRACT, AstFactory.typeName4(
"S", []), AstFactory.withClause([AstFactory.typeName4("M1", [])]), null)); | 2184 _assertSource("abstract class C<E> = S with M1;", AstFactory.classTypeAlias(
"C", AstFactory.typeParameterList(["E"]), Keyword.ABSTRACT, AstFactory.typeName4
("S", []), AstFactory.withClause([AstFactory.typeName4("M1", [])]), null)); |
| 2185 } | 2185 } |
| 2186 | 2186 |
| 2187 void test_visitClassTypeAlias_parameters_abstract_implements() { | 2187 void test_visitClassTypeAlias_parameters_abstract_implements() { |
| 2188 assertSource("abstract class C<E> = S with M1 implements I;", AstFactory.cla
ssTypeAlias("C", AstFactory.typeParameterList(["E"]), Keyword.ABSTRACT, AstFacto
ry.typeName4("S", []), AstFactory.withClause([AstFactory.typeName4("M1", [])]),
AstFactory.implementsClause([AstFactory.typeName4("I", [])]))); | 2188 _assertSource("abstract class C<E> = S with M1 implements I;", AstFactory.cl
assTypeAlias("C", AstFactory.typeParameterList(["E"]), Keyword.ABSTRACT, AstFact
ory.typeName4("S", []), AstFactory.withClause([AstFactory.typeName4("M1", [])]),
AstFactory.implementsClause([AstFactory.typeName4("I", [])]))); |
| 2189 } | 2189 } |
| 2190 | 2190 |
| 2191 void test_visitClassTypeAlias_parameters_implements() { | 2191 void test_visitClassTypeAlias_parameters_implements() { |
| 2192 assertSource("class C<E> = S with M1 implements I;", AstFactory.classTypeAli
as("C", AstFactory.typeParameterList(["E"]), null, AstFactory.typeName4("S", [])
, AstFactory.withClause([AstFactory.typeName4("M1", [])]), AstFactory.implements
Clause([AstFactory.typeName4("I", [])]))); | 2192 _assertSource("class C<E> = S with M1 implements I;", AstFactory.classTypeAl
ias("C", AstFactory.typeParameterList(["E"]), null, AstFactory.typeName4("S", []
), AstFactory.withClause([AstFactory.typeName4("M1", [])]), AstFactory.implement
sClause([AstFactory.typeName4("I", [])]))); |
| 2193 } | 2193 } |
| 2194 | 2194 |
| 2195 void test_visitComment() { | 2195 void test_visitComment() { |
| 2196 assertSource("", Comment.createBlockComment(<Token> [TokenFactory.tokenFromS
tring("/* comment */")])); | 2196 _assertSource("", Comment.createBlockComment(<Token> [TokenFactory.tokenFrom
String("/* comment */")])); |
| 2197 } | 2197 } |
| 2198 | 2198 |
| 2199 void test_visitCommentReference() { | 2199 void test_visitCommentReference() { |
| 2200 assertSource("", new CommentReference(null, AstFactory.identifier3("a"))); | 2200 _assertSource("", new CommentReference(null, AstFactory.identifier3("a"))); |
| 2201 } | 2201 } |
| 2202 | 2202 |
| 2203 void test_visitCompilationUnit_declaration() { | 2203 void test_visitCompilationUnit_declaration() { |
| 2204 assertSource("var a;", AstFactory.compilationUnit2([AstFactory.topLevelVaria
bleDeclaration2(Keyword.VAR, [AstFactory.variableDeclaration("a")])])); | 2204 _assertSource("var a;", AstFactory.compilationUnit2([AstFactory.topLevelVari
ableDeclaration2(Keyword.VAR, [AstFactory.variableDeclaration("a")])])); |
| 2205 } | 2205 } |
| 2206 | 2206 |
| 2207 void test_visitCompilationUnit_directive() { | 2207 void test_visitCompilationUnit_directive() { |
| 2208 assertSource("library l;", AstFactory.compilationUnit3([AstFactory.libraryDi
rective2("l")])); | 2208 _assertSource("library l;", AstFactory.compilationUnit3([AstFactory.libraryD
irective2("l")])); |
| 2209 } | 2209 } |
| 2210 | 2210 |
| 2211 void test_visitCompilationUnit_directive_declaration() { | 2211 void test_visitCompilationUnit_directive_declaration() { |
| 2212 assertSource("library l; var a;", AstFactory.compilationUnit4(AstFactory.lis
t([AstFactory.libraryDirective2("l")]), AstFactory.list([AstFactory.topLevelVari
ableDeclaration2(Keyword.VAR, [AstFactory.variableDeclaration("a")])]))); | 2212 _assertSource("library l; var a;", AstFactory.compilationUnit4(AstFactory.li
st([AstFactory.libraryDirective2("l")]), AstFactory.list([AstFactory.topLevelVar
iableDeclaration2(Keyword.VAR, [AstFactory.variableDeclaration("a")])]))); |
| 2213 } | 2213 } |
| 2214 | 2214 |
| 2215 void test_visitCompilationUnit_empty() { | 2215 void test_visitCompilationUnit_empty() { |
| 2216 assertSource("", AstFactory.compilationUnit()); | 2216 _assertSource("", AstFactory.compilationUnit()); |
| 2217 } | 2217 } |
| 2218 | 2218 |
| 2219 void test_visitCompilationUnit_script() { | 2219 void test_visitCompilationUnit_script() { |
| 2220 assertSource("!#/bin/dartvm", AstFactory.compilationUnit5("!#/bin/dartvm")); | 2220 _assertSource("!#/bin/dartvm", AstFactory.compilationUnit5("!#/bin/dartvm"))
; |
| 2221 } | 2221 } |
| 2222 | 2222 |
| 2223 void test_visitCompilationUnit_script_declaration() { | 2223 void test_visitCompilationUnit_script_declaration() { |
| 2224 assertSource("!#/bin/dartvm var a;", AstFactory.compilationUnit6("!#/bin/dar
tvm", [AstFactory.topLevelVariableDeclaration2(Keyword.VAR, [AstFactory.variable
Declaration("a")])])); | 2224 _assertSource("!#/bin/dartvm var a;", AstFactory.compilationUnit6("!#/bin/da
rtvm", [AstFactory.topLevelVariableDeclaration2(Keyword.VAR, [AstFactory.variabl
eDeclaration("a")])])); |
| 2225 } | 2225 } |
| 2226 | 2226 |
| 2227 void test_visitCompilationUnit_script_directive() { | 2227 void test_visitCompilationUnit_script_directive() { |
| 2228 assertSource("!#/bin/dartvm library l;", AstFactory.compilationUnit7("!#/bin
/dartvm", [AstFactory.libraryDirective2("l")])); | 2228 _assertSource("!#/bin/dartvm library l;", AstFactory.compilationUnit7("!#/bi
n/dartvm", [AstFactory.libraryDirective2("l")])); |
| 2229 } | 2229 } |
| 2230 | 2230 |
| 2231 void test_visitCompilationUnit_script_directives_declarations() { | 2231 void test_visitCompilationUnit_script_directives_declarations() { |
| 2232 assertSource("!#/bin/dartvm library l; var a;", AstFactory.compilationUnit8(
"!#/bin/dartvm", AstFactory.list([AstFactory.libraryDirective2("l")]), AstFactor
y.list([AstFactory.topLevelVariableDeclaration2(Keyword.VAR, [AstFactory.variabl
eDeclaration("a")])]))); | 2232 _assertSource("!#/bin/dartvm library l; var a;", AstFactory.compilationUnit8
("!#/bin/dartvm", AstFactory.list([AstFactory.libraryDirective2("l")]), AstFacto
ry.list([AstFactory.topLevelVariableDeclaration2(Keyword.VAR, [AstFactory.variab
leDeclaration("a")])]))); |
| 2233 } | 2233 } |
| 2234 | 2234 |
| 2235 void test_visitConditionalExpression() { | 2235 void test_visitConditionalExpression() { |
| 2236 assertSource("a ? b : c", AstFactory.conditionalExpression(AstFactory.identi
fier3("a"), AstFactory.identifier3("b"), AstFactory.identifier3("c"))); | 2236 _assertSource("a ? b : c", AstFactory.conditionalExpression(AstFactory.ident
ifier3("a"), AstFactory.identifier3("b"), AstFactory.identifier3("c"))); |
| 2237 } | 2237 } |
| 2238 | 2238 |
| 2239 void test_visitConstructorDeclaration_const() { | 2239 void test_visitConstructorDeclaration_const() { |
| 2240 assertSource("const C() {}", AstFactory.constructorDeclaration2(Keyword.CONS
T, null, AstFactory.identifier3("C"), null, AstFactory.formalParameterList([]),
null, AstFactory.blockFunctionBody2([]))); | 2240 _assertSource("const C() {}", AstFactory.constructorDeclaration2(Keyword.CON
ST, null, AstFactory.identifier3("C"), null, AstFactory.formalParameterList([]),
null, AstFactory.blockFunctionBody2([]))); |
| 2241 } | 2241 } |
| 2242 | 2242 |
| 2243 void test_visitConstructorDeclaration_external() { | 2243 void test_visitConstructorDeclaration_external() { |
| 2244 assertSource("external C();", AstFactory.constructorDeclaration(AstFactory.i
dentifier3("C"), null, AstFactory.formalParameterList([]), null)); | 2244 _assertSource("external C();", AstFactory.constructorDeclaration(AstFactory.
identifier3("C"), null, AstFactory.formalParameterList([]), null)); |
| 2245 } | 2245 } |
| 2246 | 2246 |
| 2247 void test_visitConstructorDeclaration_minimal() { | 2247 void test_visitConstructorDeclaration_minimal() { |
| 2248 assertSource("C() {}", AstFactory.constructorDeclaration2(null, null, AstFac
tory.identifier3("C"), null, AstFactory.formalParameterList([]), null, AstFactor
y.blockFunctionBody2([]))); | 2248 _assertSource("C() {}", AstFactory.constructorDeclaration2(null, null, AstFa
ctory.identifier3("C"), null, AstFactory.formalParameterList([]), null, AstFacto
ry.blockFunctionBody2([]))); |
| 2249 } | 2249 } |
| 2250 | 2250 |
| 2251 void test_visitConstructorDeclaration_multipleInitializers() { | 2251 void test_visitConstructorDeclaration_multipleInitializers() { |
| 2252 assertSource("C() : a = b, c = d {}", AstFactory.constructorDeclaration2(nul
l, null, AstFactory.identifier3("C"), null, AstFactory.formalParameterList([]),
AstFactory.list([ | 2252 _assertSource("C() : a = b, c = d {}", AstFactory.constructorDeclaration2(nu
ll, null, AstFactory.identifier3("C"), null, AstFactory.formalParameterList([]),
AstFactory.list([ |
| 2253 AstFactory.constructorFieldInitializer(false, "a", AstFactory.identifier
3("b")), | 2253 AstFactory.constructorFieldInitializer(false, "a", AstFactory.identifier
3("b")), |
| 2254 AstFactory.constructorFieldInitializer(false, "c", AstFactory.identifier
3("d"))]), AstFactory.blockFunctionBody2([]))); | 2254 AstFactory.constructorFieldInitializer(false, "c", AstFactory.identifier
3("d"))]), AstFactory.blockFunctionBody2([]))); |
| 2255 } | 2255 } |
| 2256 | 2256 |
| 2257 void test_visitConstructorDeclaration_multipleParameters() { | 2257 void test_visitConstructorDeclaration_multipleParameters() { |
| 2258 assertSource("C(var a, var b) {}", AstFactory.constructorDeclaration2(null,
null, AstFactory.identifier3("C"), null, AstFactory.formalParameterList([ | 2258 _assertSource("C(var a, var b) {}", AstFactory.constructorDeclaration2(null,
null, AstFactory.identifier3("C"), null, AstFactory.formalParameterList([ |
| 2259 AstFactory.simpleFormalParameter(Keyword.VAR, "a"), | 2259 AstFactory.simpleFormalParameter(Keyword.VAR, "a"), |
| 2260 AstFactory.simpleFormalParameter(Keyword.VAR, "b")]), null, AstFactory.b
lockFunctionBody2([]))); | 2260 AstFactory.simpleFormalParameter(Keyword.VAR, "b")]), null, AstFactory.b
lockFunctionBody2([]))); |
| 2261 } | 2261 } |
| 2262 | 2262 |
| 2263 void test_visitConstructorDeclaration_named() { | 2263 void test_visitConstructorDeclaration_named() { |
| 2264 assertSource("C.m() {}", AstFactory.constructorDeclaration2(null, null, AstF
actory.identifier3("C"), "m", AstFactory.formalParameterList([]), null, AstFacto
ry.blockFunctionBody2([]))); | 2264 _assertSource("C.m() {}", AstFactory.constructorDeclaration2(null, null, Ast
Factory.identifier3("C"), "m", AstFactory.formalParameterList([]), null, AstFact
ory.blockFunctionBody2([]))); |
| 2265 } | 2265 } |
| 2266 | 2266 |
| 2267 void test_visitConstructorDeclaration_singleInitializer() { | 2267 void test_visitConstructorDeclaration_singleInitializer() { |
| 2268 assertSource("C() : a = b {}", AstFactory.constructorDeclaration2(null, null
, AstFactory.identifier3("C"), null, AstFactory.formalParameterList([]), AstFact
ory.list([AstFactory.constructorFieldInitializer(false, "a", AstFactory.identifi
er3("b"))]), AstFactory.blockFunctionBody2([]))); | 2268 _assertSource("C() : a = b {}", AstFactory.constructorDeclaration2(null, nul
l, AstFactory.identifier3("C"), null, AstFactory.formalParameterList([]), AstFac
tory.list([AstFactory.constructorFieldInitializer(false, "a", AstFactory.identif
ier3("b"))]), AstFactory.blockFunctionBody2([]))); |
| 2269 } | 2269 } |
| 2270 | 2270 |
| 2271 void test_visitConstructorFieldInitializer_withoutThis() { | 2271 void test_visitConstructorFieldInitializer_withoutThis() { |
| 2272 assertSource("a = b", AstFactory.constructorFieldInitializer(false, "a", Ast
Factory.identifier3("b"))); | 2272 _assertSource("a = b", AstFactory.constructorFieldInitializer(false, "a", As
tFactory.identifier3("b"))); |
| 2273 } | 2273 } |
| 2274 | 2274 |
| 2275 void test_visitConstructorFieldInitializer_withThis() { | 2275 void test_visitConstructorFieldInitializer_withThis() { |
| 2276 assertSource("this.a = b", AstFactory.constructorFieldInitializer(true, "a",
AstFactory.identifier3("b"))); | 2276 _assertSource("this.a = b", AstFactory.constructorFieldInitializer(true, "a"
, AstFactory.identifier3("b"))); |
| 2277 } | 2277 } |
| 2278 | 2278 |
| 2279 void test_visitConstructorName_named_prefix() { | 2279 void test_visitConstructorName_named_prefix() { |
| 2280 assertSource("p.C.n", AstFactory.constructorName(AstFactory.typeName4("p.C.n
", []), null)); | 2280 _assertSource("p.C.n", AstFactory.constructorName(AstFactory.typeName4("p.C.
n", []), null)); |
| 2281 } | 2281 } |
| 2282 | 2282 |
| 2283 void test_visitConstructorName_unnamed_noPrefix() { | 2283 void test_visitConstructorName_unnamed_noPrefix() { |
| 2284 assertSource("C", AstFactory.constructorName(AstFactory.typeName4("C", []),
null)); | 2284 _assertSource("C", AstFactory.constructorName(AstFactory.typeName4("C", []),
null)); |
| 2285 } | 2285 } |
| 2286 | 2286 |
| 2287 void test_visitConstructorName_unnamed_prefix() { | 2287 void test_visitConstructorName_unnamed_prefix() { |
| 2288 assertSource("p.C", AstFactory.constructorName(AstFactory.typeName3(AstFacto
ry.identifier5("p", "C"), []), null)); | 2288 _assertSource("p.C", AstFactory.constructorName(AstFactory.typeName3(AstFact
ory.identifier5("p", "C"), []), null)); |
| 2289 } | 2289 } |
| 2290 | 2290 |
| 2291 void test_visitContinueStatement_label() { | 2291 void test_visitContinueStatement_label() { |
| 2292 assertSource("continue l;", AstFactory.continueStatement2("l")); | 2292 _assertSource("continue l;", AstFactory.continueStatement2("l")); |
| 2293 } | 2293 } |
| 2294 | 2294 |
| 2295 void test_visitContinueStatement_noLabel() { | 2295 void test_visitContinueStatement_noLabel() { |
| 2296 assertSource("continue;", AstFactory.continueStatement()); | 2296 _assertSource("continue;", AstFactory.continueStatement()); |
| 2297 } | 2297 } |
| 2298 | 2298 |
| 2299 void test_visitDefaultFormalParameter_named_noValue() { | 2299 void test_visitDefaultFormalParameter_named_noValue() { |
| 2300 assertSource("p", AstFactory.namedFormalParameter(AstFactory.simpleFormalPar
ameter3("p"), null)); | 2300 _assertSource("p", AstFactory.namedFormalParameter(AstFactory.simpleFormalPa
rameter3("p"), null)); |
| 2301 } | 2301 } |
| 2302 | 2302 |
| 2303 void test_visitDefaultFormalParameter_named_value() { | 2303 void test_visitDefaultFormalParameter_named_value() { |
| 2304 assertSource("p : 0", AstFactory.namedFormalParameter(AstFactory.simpleForma
lParameter3("p"), AstFactory.integer(0))); | 2304 _assertSource("p : 0", AstFactory.namedFormalParameter(AstFactory.simpleForm
alParameter3("p"), AstFactory.integer(0))); |
| 2305 } | 2305 } |
| 2306 | 2306 |
| 2307 void test_visitDefaultFormalParameter_positional_noValue() { | 2307 void test_visitDefaultFormalParameter_positional_noValue() { |
| 2308 assertSource("p", AstFactory.positionalFormalParameter(AstFactory.simpleForm
alParameter3("p"), null)); | 2308 _assertSource("p", AstFactory.positionalFormalParameter(AstFactory.simpleFor
malParameter3("p"), null)); |
| 2309 } | 2309 } |
| 2310 | 2310 |
| 2311 void test_visitDefaultFormalParameter_positional_value() { | 2311 void test_visitDefaultFormalParameter_positional_value() { |
| 2312 assertSource("p = 0", AstFactory.positionalFormalParameter(AstFactory.simple
FormalParameter3("p"), AstFactory.integer(0))); | 2312 _assertSource("p = 0", AstFactory.positionalFormalParameter(AstFactory.simpl
eFormalParameter3("p"), AstFactory.integer(0))); |
| 2313 } | 2313 } |
| 2314 | 2314 |
| 2315 void test_visitDoStatement() { | 2315 void test_visitDoStatement() { |
| 2316 assertSource("do {} while (c);", AstFactory.doStatement(AstFactory.block([])
, AstFactory.identifier3("c"))); | 2316 _assertSource("do {} while (c);", AstFactory.doStatement(AstFactory.block([]
), AstFactory.identifier3("c"))); |
| 2317 } | 2317 } |
| 2318 | 2318 |
| 2319 void test_visitDoubleLiteral() { | 2319 void test_visitDoubleLiteral() { |
| 2320 assertSource("4.2", AstFactory.doubleLiteral(4.2)); | 2320 _assertSource("4.2", AstFactory.doubleLiteral(4.2)); |
| 2321 } | 2321 } |
| 2322 | 2322 |
| 2323 void test_visitEmptyFunctionBody() { | 2323 void test_visitEmptyFunctionBody() { |
| 2324 assertSource(";", AstFactory.emptyFunctionBody()); | 2324 _assertSource(";", AstFactory.emptyFunctionBody()); |
| 2325 } | 2325 } |
| 2326 | 2326 |
| 2327 void test_visitEmptyStatement() { | 2327 void test_visitEmptyStatement() { |
| 2328 assertSource(";", AstFactory.emptyStatement()); | 2328 _assertSource(";", AstFactory.emptyStatement()); |
| 2329 } | 2329 } |
| 2330 | 2330 |
| 2331 void test_visitExportDirective_combinator() { | 2331 void test_visitExportDirective_combinator() { |
| 2332 assertSource("export 'a.dart' show A;", AstFactory.exportDirective2("a.dart"
, [AstFactory.showCombinator([AstFactory.identifier3("A")])])); | 2332 _assertSource("export 'a.dart' show A;", AstFactory.exportDirective2("a.dart
", [AstFactory.showCombinator([AstFactory.identifier3("A")])])); |
| 2333 } | 2333 } |
| 2334 | 2334 |
| 2335 void test_visitExportDirective_combinators() { | 2335 void test_visitExportDirective_combinators() { |
| 2336 assertSource("export 'a.dart' show A hide B;", AstFactory.exportDirective2("
a.dart", [ | 2336 _assertSource("export 'a.dart' show A hide B;", AstFactory.exportDirective2(
"a.dart", [ |
| 2337 AstFactory.showCombinator([AstFactory.identifier3("A")]), | 2337 AstFactory.showCombinator([AstFactory.identifier3("A")]), |
| 2338 AstFactory.hideCombinator([AstFactory.identifier3("B")])])); | 2338 AstFactory.hideCombinator([AstFactory.identifier3("B")])])); |
| 2339 } | 2339 } |
| 2340 | 2340 |
| 2341 void test_visitExportDirective_minimal() { | 2341 void test_visitExportDirective_minimal() { |
| 2342 assertSource("export 'a.dart';", AstFactory.exportDirective2("a.dart", [])); | 2342 _assertSource("export 'a.dart';", AstFactory.exportDirective2("a.dart", []))
; |
| 2343 } | 2343 } |
| 2344 | 2344 |
| 2345 void test_visitExpressionFunctionBody() { | 2345 void test_visitExpressionFunctionBody() { |
| 2346 assertSource("=> a;", AstFactory.expressionFunctionBody(AstFactory.identifie
r3("a"))); | 2346 _assertSource("=> a;", AstFactory.expressionFunctionBody(AstFactory.identifi
er3("a"))); |
| 2347 } | 2347 } |
| 2348 | 2348 |
| 2349 void test_visitExpressionStatement() { | 2349 void test_visitExpressionStatement() { |
| 2350 assertSource("a;", AstFactory.expressionStatement(AstFactory.identifier3("a"
))); | 2350 _assertSource("a;", AstFactory.expressionStatement(AstFactory.identifier3("a
"))); |
| 2351 } | 2351 } |
| 2352 | 2352 |
| 2353 void test_visitExtendsClause() { | 2353 void test_visitExtendsClause() { |
| 2354 assertSource("extends C", AstFactory.extendsClause(AstFactory.typeName4("C",
[]))); | 2354 _assertSource("extends C", AstFactory.extendsClause(AstFactory.typeName4("C"
, []))); |
| 2355 } | 2355 } |
| 2356 | 2356 |
| 2357 void test_visitFieldDeclaration_instance() { | 2357 void test_visitFieldDeclaration_instance() { |
| 2358 assertSource("var a;", AstFactory.fieldDeclaration2(false, Keyword.VAR, [Ast
Factory.variableDeclaration("a")])); | 2358 _assertSource("var a;", AstFactory.fieldDeclaration2(false, Keyword.VAR, [As
tFactory.variableDeclaration("a")])); |
| 2359 } | 2359 } |
| 2360 | 2360 |
| 2361 void test_visitFieldDeclaration_static() { | 2361 void test_visitFieldDeclaration_static() { |
| 2362 assertSource("static var a;", AstFactory.fieldDeclaration2(true, Keyword.VAR
, [AstFactory.variableDeclaration("a")])); | 2362 _assertSource("static var a;", AstFactory.fieldDeclaration2(true, Keyword.VA
R, [AstFactory.variableDeclaration("a")])); |
| 2363 } | 2363 } |
| 2364 | 2364 |
| 2365 void test_visitFieldFormalParameter_functionTyped() { | 2365 void test_visitFieldFormalParameter_functionTyped() { |
| 2366 assertSource("A this.a(b)", AstFactory.fieldFormalParameter2(null, AstFactor
y.typeName4("A", []), "a", AstFactory.formalParameterList([AstFactory.simpleForm
alParameter3("b")]))); | 2366 _assertSource("A this.a(b)", AstFactory.fieldFormalParameter2(null, AstFacto
ry.typeName4("A", []), "a", AstFactory.formalParameterList([AstFactory.simpleFor
malParameter3("b")]))); |
| 2367 } | 2367 } |
| 2368 | 2368 |
| 2369 void test_visitFieldFormalParameter_keyword() { | 2369 void test_visitFieldFormalParameter_keyword() { |
| 2370 assertSource("var this.a", AstFactory.fieldFormalParameter(Keyword.VAR, null
, "a")); | 2370 _assertSource("var this.a", AstFactory.fieldFormalParameter(Keyword.VAR, nul
l, "a")); |
| 2371 } | 2371 } |
| 2372 | 2372 |
| 2373 void test_visitFieldFormalParameter_keywordAndType() { | 2373 void test_visitFieldFormalParameter_keywordAndType() { |
| 2374 assertSource("final A this.a", AstFactory.fieldFormalParameter(Keyword.FINAL
, AstFactory.typeName4("A", []), "a")); | 2374 _assertSource("final A this.a", AstFactory.fieldFormalParameter(Keyword.FINA
L, AstFactory.typeName4("A", []), "a")); |
| 2375 } | 2375 } |
| 2376 | 2376 |
| 2377 void test_visitFieldFormalParameter_type() { | 2377 void test_visitFieldFormalParameter_type() { |
| 2378 assertSource("A this.a", AstFactory.fieldFormalParameter(null, AstFactory.ty
peName4("A", []), "a")); | 2378 _assertSource("A this.a", AstFactory.fieldFormalParameter(null, AstFactory.t
ypeName4("A", []), "a")); |
| 2379 } | 2379 } |
| 2380 | 2380 |
| 2381 void test_visitForEachStatement() { | 2381 void test_visitForEachStatement() { |
| 2382 assertSource("for (a in b) {}", AstFactory.forEachStatement(AstFactory.decla
redIdentifier3("a"), AstFactory.identifier3("b"), AstFactory.block([]))); | 2382 _assertSource("for (a in b) {}", AstFactory.forEachStatement(AstFactory.decl
aredIdentifier3("a"), AstFactory.identifier3("b"), AstFactory.block([]))); |
| 2383 } | 2383 } |
| 2384 | 2384 |
| 2385 void test_visitFormalParameterList_empty() { | 2385 void test_visitFormalParameterList_empty() { |
| 2386 assertSource("()", AstFactory.formalParameterList([])); | 2386 _assertSource("()", AstFactory.formalParameterList([])); |
| 2387 } | 2387 } |
| 2388 | 2388 |
| 2389 void test_visitFormalParameterList_n() { | 2389 void test_visitFormalParameterList_n() { |
| 2390 assertSource("({a : 0})", AstFactory.formalParameterList([AstFactory.namedFo
rmalParameter(AstFactory.simpleFormalParameter3("a"), AstFactory.integer(0))])); | 2390 _assertSource("({a : 0})", AstFactory.formalParameterList([AstFactory.namedF
ormalParameter(AstFactory.simpleFormalParameter3("a"), AstFactory.integer(0))]))
; |
| 2391 } | 2391 } |
| 2392 | 2392 |
| 2393 void test_visitFormalParameterList_nn() { | 2393 void test_visitFormalParameterList_nn() { |
| 2394 assertSource("({a : 0, b : 1})", AstFactory.formalParameterList([ | 2394 _assertSource("({a : 0, b : 1})", AstFactory.formalParameterList([ |
| 2395 AstFactory.namedFormalParameter(AstFactory.simpleFormalParameter3("a"),
AstFactory.integer(0)), | 2395 AstFactory.namedFormalParameter(AstFactory.simpleFormalParameter3("a"),
AstFactory.integer(0)), |
| 2396 AstFactory.namedFormalParameter(AstFactory.simpleFormalParameter3("b"),
AstFactory.integer(1))])); | 2396 AstFactory.namedFormalParameter(AstFactory.simpleFormalParameter3("b"),
AstFactory.integer(1))])); |
| 2397 } | 2397 } |
| 2398 | 2398 |
| 2399 void test_visitFormalParameterList_p() { | 2399 void test_visitFormalParameterList_p() { |
| 2400 assertSource("([a = 0])", AstFactory.formalParameterList([AstFactory.positio
nalFormalParameter(AstFactory.simpleFormalParameter3("a"), AstFactory.integer(0)
)])); | 2400 _assertSource("([a = 0])", AstFactory.formalParameterList([AstFactory.positi
onalFormalParameter(AstFactory.simpleFormalParameter3("a"), AstFactory.integer(0
))])); |
| 2401 } | 2401 } |
| 2402 | 2402 |
| 2403 void test_visitFormalParameterList_pp() { | 2403 void test_visitFormalParameterList_pp() { |
| 2404 assertSource("([a = 0, b = 1])", AstFactory.formalParameterList([ | 2404 _assertSource("([a = 0, b = 1])", AstFactory.formalParameterList([ |
| 2405 AstFactory.positionalFormalParameter(AstFactory.simpleFormalParameter3("
a"), AstFactory.integer(0)), | 2405 AstFactory.positionalFormalParameter(AstFactory.simpleFormalParameter3("
a"), AstFactory.integer(0)), |
| 2406 AstFactory.positionalFormalParameter(AstFactory.simpleFormalParameter3("
b"), AstFactory.integer(1))])); | 2406 AstFactory.positionalFormalParameter(AstFactory.simpleFormalParameter3("
b"), AstFactory.integer(1))])); |
| 2407 } | 2407 } |
| 2408 | 2408 |
| 2409 void test_visitFormalParameterList_r() { | 2409 void test_visitFormalParameterList_r() { |
| 2410 assertSource("(a)", AstFactory.formalParameterList([AstFactory.simpleFormalP
arameter3("a")])); | 2410 _assertSource("(a)", AstFactory.formalParameterList([AstFactory.simpleFormal
Parameter3("a")])); |
| 2411 } | 2411 } |
| 2412 | 2412 |
| 2413 void test_visitFormalParameterList_rn() { | 2413 void test_visitFormalParameterList_rn() { |
| 2414 assertSource("(a, {b : 1})", AstFactory.formalParameterList([ | 2414 _assertSource("(a, {b : 1})", AstFactory.formalParameterList([ |
| 2415 AstFactory.simpleFormalParameter3("a"), | 2415 AstFactory.simpleFormalParameter3("a"), |
| 2416 AstFactory.namedFormalParameter(AstFactory.simpleFormalParameter3("b"),
AstFactory.integer(1))])); | 2416 AstFactory.namedFormalParameter(AstFactory.simpleFormalParameter3("b"),
AstFactory.integer(1))])); |
| 2417 } | 2417 } |
| 2418 | 2418 |
| 2419 void test_visitFormalParameterList_rnn() { | 2419 void test_visitFormalParameterList_rnn() { |
| 2420 assertSource("(a, {b : 1, c : 2})", AstFactory.formalParameterList([ | 2420 _assertSource("(a, {b : 1, c : 2})", AstFactory.formalParameterList([ |
| 2421 AstFactory.simpleFormalParameter3("a"), | 2421 AstFactory.simpleFormalParameter3("a"), |
| 2422 AstFactory.namedFormalParameter(AstFactory.simpleFormalParameter3("b"),
AstFactory.integer(1)), | 2422 AstFactory.namedFormalParameter(AstFactory.simpleFormalParameter3("b"),
AstFactory.integer(1)), |
| 2423 AstFactory.namedFormalParameter(AstFactory.simpleFormalParameter3("c"),
AstFactory.integer(2))])); | 2423 AstFactory.namedFormalParameter(AstFactory.simpleFormalParameter3("c"),
AstFactory.integer(2))])); |
| 2424 } | 2424 } |
| 2425 | 2425 |
| 2426 void test_visitFormalParameterList_rp() { | 2426 void test_visitFormalParameterList_rp() { |
| 2427 assertSource("(a, [b = 1])", AstFactory.formalParameterList([ | 2427 _assertSource("(a, [b = 1])", AstFactory.formalParameterList([ |
| 2428 AstFactory.simpleFormalParameter3("a"), | 2428 AstFactory.simpleFormalParameter3("a"), |
| 2429 AstFactory.positionalFormalParameter(AstFactory.simpleFormalParameter3("
b"), AstFactory.integer(1))])); | 2429 AstFactory.positionalFormalParameter(AstFactory.simpleFormalParameter3("
b"), AstFactory.integer(1))])); |
| 2430 } | 2430 } |
| 2431 | 2431 |
| 2432 void test_visitFormalParameterList_rpp() { | 2432 void test_visitFormalParameterList_rpp() { |
| 2433 assertSource("(a, [b = 1, c = 2])", AstFactory.formalParameterList([ | 2433 _assertSource("(a, [b = 1, c = 2])", AstFactory.formalParameterList([ |
| 2434 AstFactory.simpleFormalParameter3("a"), | 2434 AstFactory.simpleFormalParameter3("a"), |
| 2435 AstFactory.positionalFormalParameter(AstFactory.simpleFormalParameter3("
b"), AstFactory.integer(1)), | 2435 AstFactory.positionalFormalParameter(AstFactory.simpleFormalParameter3("
b"), AstFactory.integer(1)), |
| 2436 AstFactory.positionalFormalParameter(AstFactory.simpleFormalParameter3("
c"), AstFactory.integer(2))])); | 2436 AstFactory.positionalFormalParameter(AstFactory.simpleFormalParameter3("
c"), AstFactory.integer(2))])); |
| 2437 } | 2437 } |
| 2438 | 2438 |
| 2439 void test_visitFormalParameterList_rr() { | 2439 void test_visitFormalParameterList_rr() { |
| 2440 assertSource("(a, b)", AstFactory.formalParameterList([ | 2440 _assertSource("(a, b)", AstFactory.formalParameterList([ |
| 2441 AstFactory.simpleFormalParameter3("a"), | 2441 AstFactory.simpleFormalParameter3("a"), |
| 2442 AstFactory.simpleFormalParameter3("b")])); | 2442 AstFactory.simpleFormalParameter3("b")])); |
| 2443 } | 2443 } |
| 2444 | 2444 |
| 2445 void test_visitFormalParameterList_rrn() { | 2445 void test_visitFormalParameterList_rrn() { |
| 2446 assertSource("(a, b, {c : 3})", AstFactory.formalParameterList([ | 2446 _assertSource("(a, b, {c : 3})", AstFactory.formalParameterList([ |
| 2447 AstFactory.simpleFormalParameter3("a"), | 2447 AstFactory.simpleFormalParameter3("a"), |
| 2448 AstFactory.simpleFormalParameter3("b"), | 2448 AstFactory.simpleFormalParameter3("b"), |
| 2449 AstFactory.namedFormalParameter(AstFactory.simpleFormalParameter3("c"),
AstFactory.integer(3))])); | 2449 AstFactory.namedFormalParameter(AstFactory.simpleFormalParameter3("c"),
AstFactory.integer(3))])); |
| 2450 } | 2450 } |
| 2451 | 2451 |
| 2452 void test_visitFormalParameterList_rrnn() { | 2452 void test_visitFormalParameterList_rrnn() { |
| 2453 assertSource("(a, b, {c : 3, d : 4})", AstFactory.formalParameterList([ | 2453 _assertSource("(a, b, {c : 3, d : 4})", AstFactory.formalParameterList([ |
| 2454 AstFactory.simpleFormalParameter3("a"), | 2454 AstFactory.simpleFormalParameter3("a"), |
| 2455 AstFactory.simpleFormalParameter3("b"), | 2455 AstFactory.simpleFormalParameter3("b"), |
| 2456 AstFactory.namedFormalParameter(AstFactory.simpleFormalParameter3("c"),
AstFactory.integer(3)), | 2456 AstFactory.namedFormalParameter(AstFactory.simpleFormalParameter3("c"),
AstFactory.integer(3)), |
| 2457 AstFactory.namedFormalParameter(AstFactory.simpleFormalParameter3("d"),
AstFactory.integer(4))])); | 2457 AstFactory.namedFormalParameter(AstFactory.simpleFormalParameter3("d"),
AstFactory.integer(4))])); |
| 2458 } | 2458 } |
| 2459 | 2459 |
| 2460 void test_visitFormalParameterList_rrp() { | 2460 void test_visitFormalParameterList_rrp() { |
| 2461 assertSource("(a, b, [c = 3])", AstFactory.formalParameterList([ | 2461 _assertSource("(a, b, [c = 3])", AstFactory.formalParameterList([ |
| 2462 AstFactory.simpleFormalParameter3("a"), | 2462 AstFactory.simpleFormalParameter3("a"), |
| 2463 AstFactory.simpleFormalParameter3("b"), | 2463 AstFactory.simpleFormalParameter3("b"), |
| 2464 AstFactory.positionalFormalParameter(AstFactory.simpleFormalParameter3("
c"), AstFactory.integer(3))])); | 2464 AstFactory.positionalFormalParameter(AstFactory.simpleFormalParameter3("
c"), AstFactory.integer(3))])); |
| 2465 } | 2465 } |
| 2466 | 2466 |
| 2467 void test_visitFormalParameterList_rrpp() { | 2467 void test_visitFormalParameterList_rrpp() { |
| 2468 assertSource("(a, b, [c = 3, d = 4])", AstFactory.formalParameterList([ | 2468 _assertSource("(a, b, [c = 3, d = 4])", AstFactory.formalParameterList([ |
| 2469 AstFactory.simpleFormalParameter3("a"), | 2469 AstFactory.simpleFormalParameter3("a"), |
| 2470 AstFactory.simpleFormalParameter3("b"), | 2470 AstFactory.simpleFormalParameter3("b"), |
| 2471 AstFactory.positionalFormalParameter(AstFactory.simpleFormalParameter3("
c"), AstFactory.integer(3)), | 2471 AstFactory.positionalFormalParameter(AstFactory.simpleFormalParameter3("
c"), AstFactory.integer(3)), |
| 2472 AstFactory.positionalFormalParameter(AstFactory.simpleFormalParameter3("
d"), AstFactory.integer(4))])); | 2472 AstFactory.positionalFormalParameter(AstFactory.simpleFormalParameter3("
d"), AstFactory.integer(4))])); |
| 2473 } | 2473 } |
| 2474 | 2474 |
| 2475 void test_visitForStatement_c() { | 2475 void test_visitForStatement_c() { |
| 2476 assertSource("for (; c;) {}", AstFactory.forStatement(null, AstFactory.ident
ifier3("c"), null, AstFactory.block([]))); | 2476 _assertSource("for (; c;) {}", AstFactory.forStatement(null, AstFactory.iden
tifier3("c"), null, AstFactory.block([]))); |
| 2477 } | 2477 } |
| 2478 | 2478 |
| 2479 void test_visitForStatement_cu() { | 2479 void test_visitForStatement_cu() { |
| 2480 assertSource("for (; c; u) {}", AstFactory.forStatement(null, AstFactory.ide
ntifier3("c"), AstFactory.list([AstFactory.identifier3("u")]), AstFactory.block(
[]))); | 2480 _assertSource("for (; c; u) {}", AstFactory.forStatement(null, AstFactory.id
entifier3("c"), AstFactory.list([AstFactory.identifier3("u")]), AstFactory.block
([]))); |
| 2481 } | 2481 } |
| 2482 | 2482 |
| 2483 void test_visitForStatement_e() { | 2483 void test_visitForStatement_e() { |
| 2484 assertSource("for (e;;) {}", AstFactory.forStatement(AstFactory.identifier3(
"e"), null, null, AstFactory.block([]))); | 2484 _assertSource("for (e;;) {}", AstFactory.forStatement(AstFactory.identifier3
("e"), null, null, AstFactory.block([]))); |
| 2485 } | 2485 } |
| 2486 | 2486 |
| 2487 void test_visitForStatement_ec() { | 2487 void test_visitForStatement_ec() { |
| 2488 assertSource("for (e; c;) {}", AstFactory.forStatement(AstFactory.identifier
3("e"), AstFactory.identifier3("c"), null, AstFactory.block([]))); | 2488 _assertSource("for (e; c;) {}", AstFactory.forStatement(AstFactory.identifie
r3("e"), AstFactory.identifier3("c"), null, AstFactory.block([]))); |
| 2489 } | 2489 } |
| 2490 | 2490 |
| 2491 void test_visitForStatement_ecu() { | 2491 void test_visitForStatement_ecu() { |
| 2492 assertSource("for (e; c; u) {}", AstFactory.forStatement(AstFactory.identifi
er3("e"), AstFactory.identifier3("c"), AstFactory.list([AstFactory.identifier3("
u")]), AstFactory.block([]))); | 2492 _assertSource("for (e; c; u) {}", AstFactory.forStatement(AstFactory.identif
ier3("e"), AstFactory.identifier3("c"), AstFactory.list([AstFactory.identifier3(
"u")]), AstFactory.block([]))); |
| 2493 } | 2493 } |
| 2494 | 2494 |
| 2495 void test_visitForStatement_eu() { | 2495 void test_visitForStatement_eu() { |
| 2496 assertSource("for (e;; u) {}", AstFactory.forStatement(AstFactory.identifier
3("e"), null, AstFactory.list([AstFactory.identifier3("u")]), AstFactory.block([
]))); | 2496 _assertSource("for (e;; u) {}", AstFactory.forStatement(AstFactory.identifie
r3("e"), null, AstFactory.list([AstFactory.identifier3("u")]), AstFactory.block(
[]))); |
| 2497 } | 2497 } |
| 2498 | 2498 |
| 2499 void test_visitForStatement_i() { | 2499 void test_visitForStatement_i() { |
| 2500 assertSource("for (var i;;) {}", AstFactory.forStatement2(AstFactory.variabl
eDeclarationList2(Keyword.VAR, [AstFactory.variableDeclaration("i")]), null, nul
l, AstFactory.block([]))); | 2500 _assertSource("for (var i;;) {}", AstFactory.forStatement2(AstFactory.variab
leDeclarationList2(Keyword.VAR, [AstFactory.variableDeclaration("i")]), null, nu
ll, AstFactory.block([]))); |
| 2501 } | 2501 } |
| 2502 | 2502 |
| 2503 void test_visitForStatement_ic() { | 2503 void test_visitForStatement_ic() { |
| 2504 assertSource("for (var i; c;) {}", AstFactory.forStatement2(AstFactory.varia
bleDeclarationList2(Keyword.VAR, [AstFactory.variableDeclaration("i")]), AstFact
ory.identifier3("c"), null, AstFactory.block([]))); | 2504 _assertSource("for (var i; c;) {}", AstFactory.forStatement2(AstFactory.vari
ableDeclarationList2(Keyword.VAR, [AstFactory.variableDeclaration("i")]), AstFac
tory.identifier3("c"), null, AstFactory.block([]))); |
| 2505 } | 2505 } |
| 2506 | 2506 |
| 2507 void test_visitForStatement_icu() { | 2507 void test_visitForStatement_icu() { |
| 2508 assertSource("for (var i; c; u) {}", AstFactory.forStatement2(AstFactory.var
iableDeclarationList2(Keyword.VAR, [AstFactory.variableDeclaration("i")]), AstFa
ctory.identifier3("c"), AstFactory.list([AstFactory.identifier3("u")]), AstFacto
ry.block([]))); | 2508 _assertSource("for (var i; c; u) {}", AstFactory.forStatement2(AstFactory.va
riableDeclarationList2(Keyword.VAR, [AstFactory.variableDeclaration("i")]), AstF
actory.identifier3("c"), AstFactory.list([AstFactory.identifier3("u")]), AstFact
ory.block([]))); |
| 2509 } | 2509 } |
| 2510 | 2510 |
| 2511 void test_visitForStatement_iu() { | 2511 void test_visitForStatement_iu() { |
| 2512 assertSource("for (var i;; u) {}", AstFactory.forStatement2(AstFactory.varia
bleDeclarationList2(Keyword.VAR, [AstFactory.variableDeclaration("i")]), null, A
stFactory.list([AstFactory.identifier3("u")]), AstFactory.block([]))); | 2512 _assertSource("for (var i;; u) {}", AstFactory.forStatement2(AstFactory.vari
ableDeclarationList2(Keyword.VAR, [AstFactory.variableDeclaration("i")]), null,
AstFactory.list([AstFactory.identifier3("u")]), AstFactory.block([]))); |
| 2513 } | 2513 } |
| 2514 | 2514 |
| 2515 void test_visitForStatement_u() { | 2515 void test_visitForStatement_u() { |
| 2516 assertSource("for (;; u) {}", AstFactory.forStatement(null, null, AstFactory
.list([AstFactory.identifier3("u")]), AstFactory.block([]))); | 2516 _assertSource("for (;; u) {}", AstFactory.forStatement(null, null, AstFactor
y.list([AstFactory.identifier3("u")]), AstFactory.block([]))); |
| 2517 } | 2517 } |
| 2518 | 2518 |
| 2519 void test_visitFunctionDeclaration_getter() { | 2519 void test_visitFunctionDeclaration_getter() { |
| 2520 assertSource("get f() {}", AstFactory.functionDeclaration(null, Keyword.GET,
"f", AstFactory.functionExpression())); | 2520 _assertSource("get f() {}", AstFactory.functionDeclaration(null, Keyword.GET
, "f", AstFactory.functionExpression())); |
| 2521 } | 2521 } |
| 2522 | 2522 |
| 2523 void test_visitFunctionDeclaration_normal() { | 2523 void test_visitFunctionDeclaration_normal() { |
| 2524 assertSource("f() {}", AstFactory.functionDeclaration(null, null, "f", AstFa
ctory.functionExpression())); | 2524 _assertSource("f() {}", AstFactory.functionDeclaration(null, null, "f", AstF
actory.functionExpression())); |
| 2525 } | 2525 } |
| 2526 | 2526 |
| 2527 void test_visitFunctionDeclaration_setter() { | 2527 void test_visitFunctionDeclaration_setter() { |
| 2528 assertSource("set f() {}", AstFactory.functionDeclaration(null, Keyword.SET,
"f", AstFactory.functionExpression())); | 2528 _assertSource("set f() {}", AstFactory.functionDeclaration(null, Keyword.SET
, "f", AstFactory.functionExpression())); |
| 2529 } | 2529 } |
| 2530 | 2530 |
| 2531 void test_visitFunctionDeclarationStatement() { | 2531 void test_visitFunctionDeclarationStatement() { |
| 2532 assertSource("f() {};", AstFactory.functionDeclarationStatement(null, null,
"f", AstFactory.functionExpression())); | 2532 _assertSource("f() {};", AstFactory.functionDeclarationStatement(null, null,
"f", AstFactory.functionExpression())); |
| 2533 } | 2533 } |
| 2534 | 2534 |
| 2535 void test_visitFunctionExpression() { | 2535 void test_visitFunctionExpression() { |
| 2536 assertSource("() {}", AstFactory.functionExpression()); | 2536 _assertSource("() {}", AstFactory.functionExpression()); |
| 2537 } | 2537 } |
| 2538 | 2538 |
| 2539 void test_visitFunctionExpressionInvocation() { | 2539 void test_visitFunctionExpressionInvocation() { |
| 2540 assertSource("f()", AstFactory.functionExpressionInvocation(AstFactory.ident
ifier3("f"), [])); | 2540 _assertSource("f()", AstFactory.functionExpressionInvocation(AstFactory.iden
tifier3("f"), [])); |
| 2541 } | 2541 } |
| 2542 | 2542 |
| 2543 void test_visitFunctionTypedFormalParameter_noType() { | 2543 void test_visitFunctionTypedFormalParameter_noType() { |
| 2544 assertSource("f()", AstFactory.functionTypedFormalParameter(null, "f", [])); | 2544 _assertSource("f()", AstFactory.functionTypedFormalParameter(null, "f", []))
; |
| 2545 } | 2545 } |
| 2546 | 2546 |
| 2547 void test_visitFunctionTypedFormalParameter_type() { | 2547 void test_visitFunctionTypedFormalParameter_type() { |
| 2548 assertSource("T f()", AstFactory.functionTypedFormalParameter(AstFactory.typ
eName4("T", []), "f", [])); | 2548 _assertSource("T f()", AstFactory.functionTypedFormalParameter(AstFactory.ty
peName4("T", []), "f", [])); |
| 2549 } | 2549 } |
| 2550 | 2550 |
| 2551 void test_visitIfStatement_withElse() { | 2551 void test_visitIfStatement_withElse() { |
| 2552 assertSource("if (c) {} else {}", AstFactory.ifStatement2(AstFactory.identif
ier3("c"), AstFactory.block([]), AstFactory.block([]))); | 2552 _assertSource("if (c) {} else {}", AstFactory.ifStatement2(AstFactory.identi
fier3("c"), AstFactory.block([]), AstFactory.block([]))); |
| 2553 } | 2553 } |
| 2554 | 2554 |
| 2555 void test_visitIfStatement_withoutElse() { | 2555 void test_visitIfStatement_withoutElse() { |
| 2556 assertSource("if (c) {}", AstFactory.ifStatement(AstFactory.identifier3("c")
, AstFactory.block([]))); | 2556 _assertSource("if (c) {}", AstFactory.ifStatement(AstFactory.identifier3("c"
), AstFactory.block([]))); |
| 2557 } | 2557 } |
| 2558 | 2558 |
| 2559 void test_visitImplementsClause_multiple() { | 2559 void test_visitImplementsClause_multiple() { |
| 2560 assertSource("implements A, B", AstFactory.implementsClause([ | 2560 _assertSource("implements A, B", AstFactory.implementsClause([ |
| 2561 AstFactory.typeName4("A", []), | 2561 AstFactory.typeName4("A", []), |
| 2562 AstFactory.typeName4("B", [])])); | 2562 AstFactory.typeName4("B", [])])); |
| 2563 } | 2563 } |
| 2564 | 2564 |
| 2565 void test_visitImplementsClause_single() { | 2565 void test_visitImplementsClause_single() { |
| 2566 assertSource("implements A", AstFactory.implementsClause([AstFactory.typeNam
e4("A", [])])); | 2566 _assertSource("implements A", AstFactory.implementsClause([AstFactory.typeNa
me4("A", [])])); |
| 2567 } | 2567 } |
| 2568 | 2568 |
| 2569 void test_visitImportDirective_combinator() { | 2569 void test_visitImportDirective_combinator() { |
| 2570 assertSource("import 'a.dart' show A;", AstFactory.importDirective2("a.dart"
, null, [AstFactory.showCombinator([AstFactory.identifier3("A")])])); | 2570 _assertSource("import 'a.dart' show A;", AstFactory.importDirective2("a.dart
", null, [AstFactory.showCombinator([AstFactory.identifier3("A")])])); |
| 2571 } | 2571 } |
| 2572 | 2572 |
| 2573 void test_visitImportDirective_combinators() { | 2573 void test_visitImportDirective_combinators() { |
| 2574 assertSource("import 'a.dart' show A hide B;", AstFactory.importDirective2("
a.dart", null, [ | 2574 _assertSource("import 'a.dart' show A hide B;", AstFactory.importDirective2(
"a.dart", null, [ |
| 2575 AstFactory.showCombinator([AstFactory.identifier3("A")]), | 2575 AstFactory.showCombinator([AstFactory.identifier3("A")]), |
| 2576 AstFactory.hideCombinator([AstFactory.identifier3("B")])])); | 2576 AstFactory.hideCombinator([AstFactory.identifier3("B")])])); |
| 2577 } | 2577 } |
| 2578 | 2578 |
| 2579 void test_visitImportDirective_minimal() { | 2579 void test_visitImportDirective_minimal() { |
| 2580 assertSource("import 'a.dart';", AstFactory.importDirective2("a.dart", null,
[])); | 2580 _assertSource("import 'a.dart';", AstFactory.importDirective2("a.dart", null
, [])); |
| 2581 } | 2581 } |
| 2582 | 2582 |
| 2583 void test_visitImportDirective_prefix() { | 2583 void test_visitImportDirective_prefix() { |
| 2584 assertSource("import 'a.dart' as p;", AstFactory.importDirective2("a.dart",
"p", [])); | 2584 _assertSource("import 'a.dart' as p;", AstFactory.importDirective2("a.dart",
"p", [])); |
| 2585 } | 2585 } |
| 2586 | 2586 |
| 2587 void test_visitImportDirective_prefix_combinator() { | 2587 void test_visitImportDirective_prefix_combinator() { |
| 2588 assertSource("import 'a.dart' as p show A;", AstFactory.importDirective2("a.
dart", "p", [AstFactory.showCombinator([AstFactory.identifier3("A")])])); | 2588 _assertSource("import 'a.dart' as p show A;", AstFactory.importDirective2("a
.dart", "p", [AstFactory.showCombinator([AstFactory.identifier3("A")])])); |
| 2589 } | 2589 } |
| 2590 | 2590 |
| 2591 void test_visitImportDirective_prefix_combinators() { | 2591 void test_visitImportDirective_prefix_combinators() { |
| 2592 assertSource("import 'a.dart' as p show A hide B;", AstFactory.importDirecti
ve2("a.dart", "p", [ | 2592 _assertSource("import 'a.dart' as p show A hide B;", AstFactory.importDirect
ive2("a.dart", "p", [ |
| 2593 AstFactory.showCombinator([AstFactory.identifier3("A")]), | 2593 AstFactory.showCombinator([AstFactory.identifier3("A")]), |
| 2594 AstFactory.hideCombinator([AstFactory.identifier3("B")])])); | 2594 AstFactory.hideCombinator([AstFactory.identifier3("B")])])); |
| 2595 } | 2595 } |
| 2596 | 2596 |
| 2597 void test_visitImportHideCombinator_multiple() { | 2597 void test_visitImportHideCombinator_multiple() { |
| 2598 assertSource("hide a, b", AstFactory.hideCombinator([AstFactory.identifier3(
"a"), AstFactory.identifier3("b")])); | 2598 _assertSource("hide a, b", AstFactory.hideCombinator([AstFactory.identifier3
("a"), AstFactory.identifier3("b")])); |
| 2599 } | 2599 } |
| 2600 | 2600 |
| 2601 void test_visitImportHideCombinator_single() { | 2601 void test_visitImportHideCombinator_single() { |
| 2602 assertSource("hide a", AstFactory.hideCombinator([AstFactory.identifier3("a"
)])); | 2602 _assertSource("hide a", AstFactory.hideCombinator([AstFactory.identifier3("a
")])); |
| 2603 } | 2603 } |
| 2604 | 2604 |
| 2605 void test_visitImportShowCombinator_multiple() { | 2605 void test_visitImportShowCombinator_multiple() { |
| 2606 assertSource("show a, b", AstFactory.showCombinator([AstFactory.identifier3(
"a"), AstFactory.identifier3("b")])); | 2606 _assertSource("show a, b", AstFactory.showCombinator([AstFactory.identifier3
("a"), AstFactory.identifier3("b")])); |
| 2607 } | 2607 } |
| 2608 | 2608 |
| 2609 void test_visitImportShowCombinator_single() { | 2609 void test_visitImportShowCombinator_single() { |
| 2610 assertSource("show a", AstFactory.showCombinator([AstFactory.identifier3("a"
)])); | 2610 _assertSource("show a", AstFactory.showCombinator([AstFactory.identifier3("a
")])); |
| 2611 } | 2611 } |
| 2612 | 2612 |
| 2613 void test_visitIndexExpression() { | 2613 void test_visitIndexExpression() { |
| 2614 assertSource("a[i]", AstFactory.indexExpression(AstFactory.identifier3("a"),
AstFactory.identifier3("i"))); | 2614 _assertSource("a[i]", AstFactory.indexExpression(AstFactory.identifier3("a")
, AstFactory.identifier3("i"))); |
| 2615 } | 2615 } |
| 2616 | 2616 |
| 2617 void test_visitInstanceCreationExpression_const() { | 2617 void test_visitInstanceCreationExpression_const() { |
| 2618 assertSource("const C()", AstFactory.instanceCreationExpression2(Keyword.CON
ST, AstFactory.typeName4("C", []), [])); | 2618 _assertSource("const C()", AstFactory.instanceCreationExpression2(Keyword.CO
NST, AstFactory.typeName4("C", []), [])); |
| 2619 } | 2619 } |
| 2620 | 2620 |
| 2621 void test_visitInstanceCreationExpression_named() { | 2621 void test_visitInstanceCreationExpression_named() { |
| 2622 assertSource("new C.c()", AstFactory.instanceCreationExpression3(Keyword.NEW
, AstFactory.typeName4("C", []), "c", [])); | 2622 _assertSource("new C.c()", AstFactory.instanceCreationExpression3(Keyword.NE
W, AstFactory.typeName4("C", []), "c", [])); |
| 2623 } | 2623 } |
| 2624 | 2624 |
| 2625 void test_visitInstanceCreationExpression_unnamed() { | 2625 void test_visitInstanceCreationExpression_unnamed() { |
| 2626 assertSource("new C()", AstFactory.instanceCreationExpression2(Keyword.NEW,
AstFactory.typeName4("C", []), [])); | 2626 _assertSource("new C()", AstFactory.instanceCreationExpression2(Keyword.NEW,
AstFactory.typeName4("C", []), [])); |
| 2627 } | 2627 } |
| 2628 | 2628 |
| 2629 void test_visitIntegerLiteral() { | 2629 void test_visitIntegerLiteral() { |
| 2630 assertSource("42", AstFactory.integer(42)); | 2630 _assertSource("42", AstFactory.integer(42)); |
| 2631 } | 2631 } |
| 2632 | 2632 |
| 2633 void test_visitInterpolationExpression_expression() { | 2633 void test_visitInterpolationExpression_expression() { |
| 2634 assertSource("\${a}", AstFactory.interpolationExpression(AstFactory.identifi
er3("a"))); | 2634 _assertSource("\${a}", AstFactory.interpolationExpression(AstFactory.identif
ier3("a"))); |
| 2635 } | 2635 } |
| 2636 | 2636 |
| 2637 void test_visitInterpolationExpression_identifier() { | 2637 void test_visitInterpolationExpression_identifier() { |
| 2638 assertSource("\$a", AstFactory.interpolationExpression2("a")); | 2638 _assertSource("\$a", AstFactory.interpolationExpression2("a")); |
| 2639 } | 2639 } |
| 2640 | 2640 |
| 2641 void test_visitInterpolationString() { | 2641 void test_visitInterpolationString() { |
| 2642 assertSource("'x", AstFactory.interpolationString("'x", "x")); | 2642 _assertSource("'x", AstFactory.interpolationString("'x", "x")); |
| 2643 } | 2643 } |
| 2644 | 2644 |
| 2645 void test_visitIsExpression_negated() { | 2645 void test_visitIsExpression_negated() { |
| 2646 assertSource("a is! C", AstFactory.isExpression(AstFactory.identifier3("a"),
true, AstFactory.typeName4("C", []))); | 2646 _assertSource("a is! C", AstFactory.isExpression(AstFactory.identifier3("a")
, true, AstFactory.typeName4("C", []))); |
| 2647 } | 2647 } |
| 2648 | 2648 |
| 2649 void test_visitIsExpression_normal() { | 2649 void test_visitIsExpression_normal() { |
| 2650 assertSource("a is C", AstFactory.isExpression(AstFactory.identifier3("a"),
false, AstFactory.typeName4("C", []))); | 2650 _assertSource("a is C", AstFactory.isExpression(AstFactory.identifier3("a"),
false, AstFactory.typeName4("C", []))); |
| 2651 } | 2651 } |
| 2652 | 2652 |
| 2653 void test_visitLabel() { | 2653 void test_visitLabel() { |
| 2654 assertSource("a:", AstFactory.label2("a")); | 2654 _assertSource("a:", AstFactory.label2("a")); |
| 2655 } | 2655 } |
| 2656 | 2656 |
| 2657 void test_visitLabeledStatement_multiple() { | 2657 void test_visitLabeledStatement_multiple() { |
| 2658 assertSource("a: b: return;", AstFactory.labeledStatement(AstFactory.list([A
stFactory.label2("a"), AstFactory.label2("b")]), AstFactory.returnStatement())); | 2658 _assertSource("a: b: return;", AstFactory.labeledStatement(AstFactory.list([
AstFactory.label2("a"), AstFactory.label2("b")]), AstFactory.returnStatement()))
; |
| 2659 } | 2659 } |
| 2660 | 2660 |
| 2661 void test_visitLabeledStatement_single() { | 2661 void test_visitLabeledStatement_single() { |
| 2662 assertSource("a: return;", AstFactory.labeledStatement(AstFactory.list([AstF
actory.label2("a")]), AstFactory.returnStatement())); | 2662 _assertSource("a: return;", AstFactory.labeledStatement(AstFactory.list([Ast
Factory.label2("a")]), AstFactory.returnStatement())); |
| 2663 } | 2663 } |
| 2664 | 2664 |
| 2665 void test_visitLibraryDirective() { | 2665 void test_visitLibraryDirective() { |
| 2666 assertSource("library l;", AstFactory.libraryDirective2("l")); | 2666 _assertSource("library l;", AstFactory.libraryDirective2("l")); |
| 2667 } | 2667 } |
| 2668 | 2668 |
| 2669 void test_visitLibraryIdentifier_multiple() { | 2669 void test_visitLibraryIdentifier_multiple() { |
| 2670 assertSource("a.b.c", AstFactory.libraryIdentifier([ | 2670 _assertSource("a.b.c", AstFactory.libraryIdentifier([ |
| 2671 AstFactory.identifier3("a"), | 2671 AstFactory.identifier3("a"), |
| 2672 AstFactory.identifier3("b"), | 2672 AstFactory.identifier3("b"), |
| 2673 AstFactory.identifier3("c")])); | 2673 AstFactory.identifier3("c")])); |
| 2674 } | 2674 } |
| 2675 | 2675 |
| 2676 void test_visitLibraryIdentifier_single() { | 2676 void test_visitLibraryIdentifier_single() { |
| 2677 assertSource("a", AstFactory.libraryIdentifier([AstFactory.identifier3("a")]
)); | 2677 _assertSource("a", AstFactory.libraryIdentifier([AstFactory.identifier3("a")
])); |
| 2678 } | 2678 } |
| 2679 | 2679 |
| 2680 void test_visitListLiteral_const() { | 2680 void test_visitListLiteral_const() { |
| 2681 assertSource("const []", AstFactory.listLiteral2(Keyword.CONST, null, [])); | 2681 _assertSource("const []", AstFactory.listLiteral2(Keyword.CONST, null, [])); |
| 2682 } | 2682 } |
| 2683 | 2683 |
| 2684 void test_visitListLiteral_empty() { | 2684 void test_visitListLiteral_empty() { |
| 2685 assertSource("[]", AstFactory.listLiteral([])); | 2685 _assertSource("[]", AstFactory.listLiteral([])); |
| 2686 } | 2686 } |
| 2687 | 2687 |
| 2688 void test_visitListLiteral_nonEmpty() { | 2688 void test_visitListLiteral_nonEmpty() { |
| 2689 assertSource("[a, b, c]", AstFactory.listLiteral([ | 2689 _assertSource("[a, b, c]", AstFactory.listLiteral([ |
| 2690 AstFactory.identifier3("a"), | 2690 AstFactory.identifier3("a"), |
| 2691 AstFactory.identifier3("b"), | 2691 AstFactory.identifier3("b"), |
| 2692 AstFactory.identifier3("c")])); | 2692 AstFactory.identifier3("c")])); |
| 2693 } | 2693 } |
| 2694 | 2694 |
| 2695 void test_visitMapLiteral_const() { | 2695 void test_visitMapLiteral_const() { |
| 2696 assertSource("const {}", AstFactory.mapLiteral(Keyword.CONST, null, [])); | 2696 _assertSource("const {}", AstFactory.mapLiteral(Keyword.CONST, null, [])); |
| 2697 } | 2697 } |
| 2698 | 2698 |
| 2699 void test_visitMapLiteral_empty() { | 2699 void test_visitMapLiteral_empty() { |
| 2700 assertSource("{}", AstFactory.mapLiteral2([])); | 2700 _assertSource("{}", AstFactory.mapLiteral2([])); |
| 2701 } | 2701 } |
| 2702 | 2702 |
| 2703 void test_visitMapLiteral_nonEmpty() { | 2703 void test_visitMapLiteral_nonEmpty() { |
| 2704 assertSource("{'a' : a, 'b' : b, 'c' : c}", AstFactory.mapLiteral2([ | 2704 _assertSource("{'a' : a, 'b' : b, 'c' : c}", AstFactory.mapLiteral2([ |
| 2705 AstFactory.mapLiteralEntry("a", AstFactory.identifier3("a")), | 2705 AstFactory.mapLiteralEntry("a", AstFactory.identifier3("a")), |
| 2706 AstFactory.mapLiteralEntry("b", AstFactory.identifier3("b")), | 2706 AstFactory.mapLiteralEntry("b", AstFactory.identifier3("b")), |
| 2707 AstFactory.mapLiteralEntry("c", AstFactory.identifier3("c"))])); | 2707 AstFactory.mapLiteralEntry("c", AstFactory.identifier3("c"))])); |
| 2708 } | 2708 } |
| 2709 | 2709 |
| 2710 void test_visitMapLiteralEntry() { | 2710 void test_visitMapLiteralEntry() { |
| 2711 assertSource("'a' : b", AstFactory.mapLiteralEntry("a", AstFactory.identifie
r3("b"))); | 2711 _assertSource("'a' : b", AstFactory.mapLiteralEntry("a", AstFactory.identifi
er3("b"))); |
| 2712 } | 2712 } |
| 2713 | 2713 |
| 2714 void test_visitMethodDeclaration_external() { | 2714 void test_visitMethodDeclaration_external() { |
| 2715 assertSource("external m();", AstFactory.methodDeclaration(null, null, null,
null, AstFactory.identifier3("m"), AstFactory.formalParameterList([]))); | 2715 _assertSource("external m();", AstFactory.methodDeclaration(null, null, null
, null, AstFactory.identifier3("m"), AstFactory.formalParameterList([]))); |
| 2716 } | 2716 } |
| 2717 | 2717 |
| 2718 void test_visitMethodDeclaration_external_returnType() { | 2718 void test_visitMethodDeclaration_external_returnType() { |
| 2719 assertSource("external T m();", AstFactory.methodDeclaration(null, AstFactor
y.typeName4("T", []), null, null, AstFactory.identifier3("m"), AstFactory.formal
ParameterList([]))); | 2719 _assertSource("external T m();", AstFactory.methodDeclaration(null, AstFacto
ry.typeName4("T", []), null, null, AstFactory.identifier3("m"), AstFactory.forma
lParameterList([]))); |
| 2720 } | 2720 } |
| 2721 | 2721 |
| 2722 void test_visitMethodDeclaration_getter() { | 2722 void test_visitMethodDeclaration_getter() { |
| 2723 assertSource("get m {}", AstFactory.methodDeclaration2(null, null, Keyword.G
ET, null, AstFactory.identifier3("m"), null, AstFactory.blockFunctionBody2([])))
; | 2723 _assertSource("get m {}", AstFactory.methodDeclaration2(null, null, Keyword.
GET, null, AstFactory.identifier3("m"), null, AstFactory.blockFunctionBody2([]))
); |
| 2724 } | 2724 } |
| 2725 | 2725 |
| 2726 void test_visitMethodDeclaration_getter_returnType() { | 2726 void test_visitMethodDeclaration_getter_returnType() { |
| 2727 assertSource("T get m {}", AstFactory.methodDeclaration2(null, AstFactory.ty
peName4("T", []), Keyword.GET, null, AstFactory.identifier3("m"), null, AstFacto
ry.blockFunctionBody2([]))); | 2727 _assertSource("T get m {}", AstFactory.methodDeclaration2(null, AstFactory.t
ypeName4("T", []), Keyword.GET, null, AstFactory.identifier3("m"), null, AstFact
ory.blockFunctionBody2([]))); |
| 2728 } | 2728 } |
| 2729 | 2729 |
| 2730 void test_visitMethodDeclaration_getter_seturnType() { | 2730 void test_visitMethodDeclaration_getter_seturnType() { |
| 2731 assertSource("T set m(var v) {}", AstFactory.methodDeclaration2(null, AstFac
tory.typeName4("T", []), Keyword.SET, null, AstFactory.identifier3("m"), AstFact
ory.formalParameterList([AstFactory.simpleFormalParameter(Keyword.VAR, "v")]), A
stFactory.blockFunctionBody2([]))); | 2731 _assertSource("T set m(var v) {}", AstFactory.methodDeclaration2(null, AstFa
ctory.typeName4("T", []), Keyword.SET, null, AstFactory.identifier3("m"), AstFac
tory.formalParameterList([AstFactory.simpleFormalParameter(Keyword.VAR, "v")]),
AstFactory.blockFunctionBody2([]))); |
| 2732 } | 2732 } |
| 2733 | 2733 |
| 2734 void test_visitMethodDeclaration_minimal() { | 2734 void test_visitMethodDeclaration_minimal() { |
| 2735 assertSource("m() {}", AstFactory.methodDeclaration2(null, null, null, null,
AstFactory.identifier3("m"), AstFactory.formalParameterList([]), AstFactory.blo
ckFunctionBody2([]))); | 2735 _assertSource("m() {}", AstFactory.methodDeclaration2(null, null, null, null
, AstFactory.identifier3("m"), AstFactory.formalParameterList([]), AstFactory.bl
ockFunctionBody2([]))); |
| 2736 } | 2736 } |
| 2737 | 2737 |
| 2738 void test_visitMethodDeclaration_multipleParameters() { | 2738 void test_visitMethodDeclaration_multipleParameters() { |
| 2739 assertSource("m(var a, var b) {}", AstFactory.methodDeclaration2(null, null,
null, null, AstFactory.identifier3("m"), AstFactory.formalParameterList([ | 2739 _assertSource("m(var a, var b) {}", AstFactory.methodDeclaration2(null, null
, null, null, AstFactory.identifier3("m"), AstFactory.formalParameterList([ |
| 2740 AstFactory.simpleFormalParameter(Keyword.VAR, "a"), | 2740 AstFactory.simpleFormalParameter(Keyword.VAR, "a"), |
| 2741 AstFactory.simpleFormalParameter(Keyword.VAR, "b")]), AstFactory.blockFu
nctionBody2([]))); | 2741 AstFactory.simpleFormalParameter(Keyword.VAR, "b")]), AstFactory.blockFu
nctionBody2([]))); |
| 2742 } | 2742 } |
| 2743 | 2743 |
| 2744 void test_visitMethodDeclaration_operator() { | 2744 void test_visitMethodDeclaration_operator() { |
| 2745 assertSource("operator +() {}", AstFactory.methodDeclaration2(null, null, nu
ll, Keyword.OPERATOR, AstFactory.identifier3("+"), AstFactory.formalParameterLis
t([]), AstFactory.blockFunctionBody2([]))); | 2745 _assertSource("operator +() {}", AstFactory.methodDeclaration2(null, null, n
ull, Keyword.OPERATOR, AstFactory.identifier3("+"), AstFactory.formalParameterLi
st([]), AstFactory.blockFunctionBody2([]))); |
| 2746 } | 2746 } |
| 2747 | 2747 |
| 2748 void test_visitMethodDeclaration_operator_returnType() { | 2748 void test_visitMethodDeclaration_operator_returnType() { |
| 2749 assertSource("T operator +() {}", AstFactory.methodDeclaration2(null, AstFac
tory.typeName4("T", []), null, Keyword.OPERATOR, AstFactory.identifier3("+"), As
tFactory.formalParameterList([]), AstFactory.blockFunctionBody2([]))); | 2749 _assertSource("T operator +() {}", AstFactory.methodDeclaration2(null, AstFa
ctory.typeName4("T", []), null, Keyword.OPERATOR, AstFactory.identifier3("+"), A
stFactory.formalParameterList([]), AstFactory.blockFunctionBody2([]))); |
| 2750 } | 2750 } |
| 2751 | 2751 |
| 2752 void test_visitMethodDeclaration_returnType() { | 2752 void test_visitMethodDeclaration_returnType() { |
| 2753 assertSource("T m() {}", AstFactory.methodDeclaration2(null, AstFactory.type
Name4("T", []), null, null, AstFactory.identifier3("m"), AstFactory.formalParame
terList([]), AstFactory.blockFunctionBody2([]))); | 2753 _assertSource("T m() {}", AstFactory.methodDeclaration2(null, AstFactory.typ
eName4("T", []), null, null, AstFactory.identifier3("m"), AstFactory.formalParam
eterList([]), AstFactory.blockFunctionBody2([]))); |
| 2754 } | 2754 } |
| 2755 | 2755 |
| 2756 void test_visitMethodDeclaration_setter() { | 2756 void test_visitMethodDeclaration_setter() { |
| 2757 assertSource("set m(var v) {}", AstFactory.methodDeclaration2(null, null, Ke
yword.SET, null, AstFactory.identifier3("m"), AstFactory.formalParameterList([As
tFactory.simpleFormalParameter(Keyword.VAR, "v")]), AstFactory.blockFunctionBody
2([]))); | 2757 _assertSource("set m(var v) {}", AstFactory.methodDeclaration2(null, null, K
eyword.SET, null, AstFactory.identifier3("m"), AstFactory.formalParameterList([A
stFactory.simpleFormalParameter(Keyword.VAR, "v")]), AstFactory.blockFunctionBod
y2([]))); |
| 2758 } | 2758 } |
| 2759 | 2759 |
| 2760 void test_visitMethodDeclaration_static() { | 2760 void test_visitMethodDeclaration_static() { |
| 2761 assertSource("static m() {}", AstFactory.methodDeclaration2(Keyword.STATIC,
null, null, null, AstFactory.identifier3("m"), AstFactory.formalParameterList([]
), AstFactory.blockFunctionBody2([]))); | 2761 _assertSource("static m() {}", AstFactory.methodDeclaration2(Keyword.STATIC,
null, null, null, AstFactory.identifier3("m"), AstFactory.formalParameterList([
]), AstFactory.blockFunctionBody2([]))); |
| 2762 } | 2762 } |
| 2763 | 2763 |
| 2764 void test_visitMethodDeclaration_static_returnType() { | 2764 void test_visitMethodDeclaration_static_returnType() { |
| 2765 assertSource("static T m() {}", AstFactory.methodDeclaration2(Keyword.STATIC
, AstFactory.typeName4("T", []), null, null, AstFactory.identifier3("m"), AstFac
tory.formalParameterList([]), AstFactory.blockFunctionBody2([]))); | 2765 _assertSource("static T m() {}", AstFactory.methodDeclaration2(Keyword.STATI
C, AstFactory.typeName4("T", []), null, null, AstFactory.identifier3("m"), AstFa
ctory.formalParameterList([]), AstFactory.blockFunctionBody2([]))); |
| 2766 } | 2766 } |
| 2767 | 2767 |
| 2768 void test_visitMethodInvocation_noTarget() { | 2768 void test_visitMethodInvocation_noTarget() { |
| 2769 assertSource("m()", AstFactory.methodInvocation2("m", [])); | 2769 _assertSource("m()", AstFactory.methodInvocation2("m", [])); |
| 2770 } | 2770 } |
| 2771 | 2771 |
| 2772 void test_visitMethodInvocation_target() { | 2772 void test_visitMethodInvocation_target() { |
| 2773 assertSource("t.m()", AstFactory.methodInvocation(AstFactory.identifier3("t"
), "m", [])); | 2773 _assertSource("t.m()", AstFactory.methodInvocation(AstFactory.identifier3("t
"), "m", [])); |
| 2774 } | 2774 } |
| 2775 | 2775 |
| 2776 void test_visitNamedExpression() { | 2776 void test_visitNamedExpression() { |
| 2777 assertSource("a: b", AstFactory.namedExpression2("a", AstFactory.identifier3
("b"))); | 2777 _assertSource("a: b", AstFactory.namedExpression2("a", AstFactory.identifier
3("b"))); |
| 2778 } | 2778 } |
| 2779 | 2779 |
| 2780 void test_visitNamedFormalParameter() { | 2780 void test_visitNamedFormalParameter() { |
| 2781 assertSource("var a : 0", AstFactory.namedFormalParameter(AstFactory.simpleF
ormalParameter(Keyword.VAR, "a"), AstFactory.integer(0))); | 2781 _assertSource("var a : 0", AstFactory.namedFormalParameter(AstFactory.simple
FormalParameter(Keyword.VAR, "a"), AstFactory.integer(0))); |
| 2782 } | 2782 } |
| 2783 | 2783 |
| 2784 void test_visitNativeClause() { | 2784 void test_visitNativeClause() { |
| 2785 assertSource("native 'code'", AstFactory.nativeClause("code")); | 2785 _assertSource("native 'code'", AstFactory.nativeClause("code")); |
| 2786 } | 2786 } |
| 2787 | 2787 |
| 2788 void test_visitNativeFunctionBody() { | 2788 void test_visitNativeFunctionBody() { |
| 2789 assertSource("native 'str';", AstFactory.nativeFunctionBody("str")); | 2789 _assertSource("native 'str';", AstFactory.nativeFunctionBody("str")); |
| 2790 } | 2790 } |
| 2791 | 2791 |
| 2792 void test_visitNullLiteral() { | 2792 void test_visitNullLiteral() { |
| 2793 assertSource("null", AstFactory.nullLiteral()); | 2793 _assertSource("null", AstFactory.nullLiteral()); |
| 2794 } | 2794 } |
| 2795 | 2795 |
| 2796 void test_visitParenthesizedExpression() { | 2796 void test_visitParenthesizedExpression() { |
| 2797 assertSource("(a)", AstFactory.parenthesizedExpression(AstFactory.identifier
3("a"))); | 2797 _assertSource("(a)", AstFactory.parenthesizedExpression(AstFactory.identifie
r3("a"))); |
| 2798 } | 2798 } |
| 2799 | 2799 |
| 2800 void test_visitPartDirective() { | 2800 void test_visitPartDirective() { |
| 2801 assertSource("part 'a.dart';", AstFactory.partDirective2("a.dart")); | 2801 _assertSource("part 'a.dart';", AstFactory.partDirective2("a.dart")); |
| 2802 } | 2802 } |
| 2803 | 2803 |
| 2804 void test_visitPartOfDirective() { | 2804 void test_visitPartOfDirective() { |
| 2805 assertSource("part of l;", AstFactory.partOfDirective(AstFactory.libraryIden
tifier2(["l"]))); | 2805 _assertSource("part of l;", AstFactory.partOfDirective(AstFactory.libraryIde
ntifier2(["l"]))); |
| 2806 } | 2806 } |
| 2807 | 2807 |
| 2808 void test_visitPositionalFormalParameter() { | 2808 void test_visitPositionalFormalParameter() { |
| 2809 assertSource("var a = 0", AstFactory.positionalFormalParameter(AstFactory.si
mpleFormalParameter(Keyword.VAR, "a"), AstFactory.integer(0))); | 2809 _assertSource("var a = 0", AstFactory.positionalFormalParameter(AstFactory.s
impleFormalParameter(Keyword.VAR, "a"), AstFactory.integer(0))); |
| 2810 } | 2810 } |
| 2811 | 2811 |
| 2812 void test_visitPostfixExpression() { | 2812 void test_visitPostfixExpression() { |
| 2813 assertSource("a++", AstFactory.postfixExpression(AstFactory.identifier3("a")
, TokenType.PLUS_PLUS)); | 2813 _assertSource("a++", AstFactory.postfixExpression(AstFactory.identifier3("a"
), TokenType.PLUS_PLUS)); |
| 2814 } | 2814 } |
| 2815 | 2815 |
| 2816 void test_visitPrefixedIdentifier() { | 2816 void test_visitPrefixedIdentifier() { |
| 2817 assertSource("a.b", AstFactory.identifier5("a", "b")); | 2817 _assertSource("a.b", AstFactory.identifier5("a", "b")); |
| 2818 } | 2818 } |
| 2819 | 2819 |
| 2820 void test_visitPrefixExpression() { | 2820 void test_visitPrefixExpression() { |
| 2821 assertSource("-a", AstFactory.prefixExpression(TokenType.MINUS, AstFactory.i
dentifier3("a"))); | 2821 _assertSource("-a", AstFactory.prefixExpression(TokenType.MINUS, AstFactory.
identifier3("a"))); |
| 2822 } | 2822 } |
| 2823 | 2823 |
| 2824 void test_visitPropertyAccess() { | 2824 void test_visitPropertyAccess() { |
| 2825 assertSource("a.b", AstFactory.propertyAccess2(AstFactory.identifier3("a"),
"b")); | 2825 _assertSource("a.b", AstFactory.propertyAccess2(AstFactory.identifier3("a"),
"b")); |
| 2826 } | 2826 } |
| 2827 | 2827 |
| 2828 void test_visitRedirectingConstructorInvocation_named() { | 2828 void test_visitRedirectingConstructorInvocation_named() { |
| 2829 assertSource("this.c()", AstFactory.redirectingConstructorInvocation2("c", [
])); | 2829 _assertSource("this.c()", AstFactory.redirectingConstructorInvocation2("c",
[])); |
| 2830 } | 2830 } |
| 2831 | 2831 |
| 2832 void test_visitRedirectingConstructorInvocation_unnamed() { | 2832 void test_visitRedirectingConstructorInvocation_unnamed() { |
| 2833 assertSource("this()", AstFactory.redirectingConstructorInvocation([])); | 2833 _assertSource("this()", AstFactory.redirectingConstructorInvocation([])); |
| 2834 } | 2834 } |
| 2835 | 2835 |
| 2836 void test_visitRethrowExpression() { | 2836 void test_visitRethrowExpression() { |
| 2837 assertSource("rethrow", AstFactory.rethrowExpression()); | 2837 _assertSource("rethrow", AstFactory.rethrowExpression()); |
| 2838 } | 2838 } |
| 2839 | 2839 |
| 2840 void test_visitReturnStatement_expression() { | 2840 void test_visitReturnStatement_expression() { |
| 2841 assertSource("return a;", AstFactory.returnStatement2(AstFactory.identifier3
("a"))); | 2841 _assertSource("return a;", AstFactory.returnStatement2(AstFactory.identifier
3("a"))); |
| 2842 } | 2842 } |
| 2843 | 2843 |
| 2844 void test_visitReturnStatement_noExpression() { | 2844 void test_visitReturnStatement_noExpression() { |
| 2845 assertSource("return;", AstFactory.returnStatement()); | 2845 _assertSource("return;", AstFactory.returnStatement()); |
| 2846 } | 2846 } |
| 2847 | 2847 |
| 2848 void test_visitScriptTag() { | 2848 void test_visitScriptTag() { |
| 2849 String scriptTag = "!#/bin/dart.exe"; | 2849 String scriptTag = "!#/bin/dart.exe"; |
| 2850 assertSource(scriptTag, AstFactory.scriptTag(scriptTag)); | 2850 _assertSource(scriptTag, AstFactory.scriptTag(scriptTag)); |
| 2851 } | 2851 } |
| 2852 | 2852 |
| 2853 void test_visitSimpleFormalParameter_keyword() { | 2853 void test_visitSimpleFormalParameter_keyword() { |
| 2854 assertSource("var a", AstFactory.simpleFormalParameter(Keyword.VAR, "a")); | 2854 _assertSource("var a", AstFactory.simpleFormalParameter(Keyword.VAR, "a")); |
| 2855 } | 2855 } |
| 2856 | 2856 |
| 2857 void test_visitSimpleFormalParameter_keyword_type() { | 2857 void test_visitSimpleFormalParameter_keyword_type() { |
| 2858 assertSource("final A a", AstFactory.simpleFormalParameter2(Keyword.FINAL, A
stFactory.typeName4("A", []), "a")); | 2858 _assertSource("final A a", AstFactory.simpleFormalParameter2(Keyword.FINAL,
AstFactory.typeName4("A", []), "a")); |
| 2859 } | 2859 } |
| 2860 | 2860 |
| 2861 void test_visitSimpleFormalParameter_type() { | 2861 void test_visitSimpleFormalParameter_type() { |
| 2862 assertSource("A a", AstFactory.simpleFormalParameter4(AstFactory.typeName4("
A", []), "a")); | 2862 _assertSource("A a", AstFactory.simpleFormalParameter4(AstFactory.typeName4(
"A", []), "a")); |
| 2863 } | 2863 } |
| 2864 | 2864 |
| 2865 void test_visitSimpleIdentifier() { | 2865 void test_visitSimpleIdentifier() { |
| 2866 assertSource("a", AstFactory.identifier3("a")); | 2866 _assertSource("a", AstFactory.identifier3("a")); |
| 2867 } | 2867 } |
| 2868 | 2868 |
| 2869 void test_visitSimpleStringLiteral() { | 2869 void test_visitSimpleStringLiteral() { |
| 2870 assertSource("'a'", AstFactory.string2("a")); | 2870 _assertSource("'a'", AstFactory.string2("a")); |
| 2871 } | 2871 } |
| 2872 | 2872 |
| 2873 void test_visitStringInterpolation() { | 2873 void test_visitStringInterpolation() { |
| 2874 assertSource("'a\${e}b'", AstFactory.string([ | 2874 _assertSource("'a\${e}b'", AstFactory.string([ |
| 2875 AstFactory.interpolationString("'a", "a"), | 2875 AstFactory.interpolationString("'a", "a"), |
| 2876 AstFactory.interpolationExpression(AstFactory.identifier3("e")), | 2876 AstFactory.interpolationExpression(AstFactory.identifier3("e")), |
| 2877 AstFactory.interpolationString("b'", "b")])); | 2877 AstFactory.interpolationString("b'", "b")])); |
| 2878 } | 2878 } |
| 2879 | 2879 |
| 2880 void test_visitSuperConstructorInvocation() { | 2880 void test_visitSuperConstructorInvocation() { |
| 2881 assertSource("super()", AstFactory.superConstructorInvocation([])); | 2881 _assertSource("super()", AstFactory.superConstructorInvocation([])); |
| 2882 } | 2882 } |
| 2883 | 2883 |
| 2884 void test_visitSuperConstructorInvocation_named() { | 2884 void test_visitSuperConstructorInvocation_named() { |
| 2885 assertSource("super.c()", AstFactory.superConstructorInvocation2("c", [])); | 2885 _assertSource("super.c()", AstFactory.superConstructorInvocation2("c", [])); |
| 2886 } | 2886 } |
| 2887 | 2887 |
| 2888 void test_visitSuperExpression() { | 2888 void test_visitSuperExpression() { |
| 2889 assertSource("super", AstFactory.superExpression()); | 2889 _assertSource("super", AstFactory.superExpression()); |
| 2890 } | 2890 } |
| 2891 | 2891 |
| 2892 void test_visitSwitchCase_multipleLabels() { | 2892 void test_visitSwitchCase_multipleLabels() { |
| 2893 assertSource("l1: l2: case a: {}", AstFactory.switchCase2(AstFactory.list([A
stFactory.label2("l1"), AstFactory.label2("l2")]), AstFactory.identifier3("a"),
[AstFactory.block([])])); | 2893 _assertSource("l1: l2: case a: {}", AstFactory.switchCase2(AstFactory.list([
AstFactory.label2("l1"), AstFactory.label2("l2")]), AstFactory.identifier3("a"),
[AstFactory.block([])])); |
| 2894 } | 2894 } |
| 2895 | 2895 |
| 2896 void test_visitSwitchCase_multipleStatements() { | 2896 void test_visitSwitchCase_multipleStatements() { |
| 2897 assertSource("case a: {} {}", AstFactory.switchCase(AstFactory.identifier3("
a"), [AstFactory.block([]), AstFactory.block([])])); | 2897 _assertSource("case a: {} {}", AstFactory.switchCase(AstFactory.identifier3(
"a"), [AstFactory.block([]), AstFactory.block([])])); |
| 2898 } | 2898 } |
| 2899 | 2899 |
| 2900 void test_visitSwitchCase_noLabels() { | 2900 void test_visitSwitchCase_noLabels() { |
| 2901 assertSource("case a: {}", AstFactory.switchCase(AstFactory.identifier3("a")
, [AstFactory.block([])])); | 2901 _assertSource("case a: {}", AstFactory.switchCase(AstFactory.identifier3("a"
), [AstFactory.block([])])); |
| 2902 } | 2902 } |
| 2903 | 2903 |
| 2904 void test_visitSwitchCase_singleLabel() { | 2904 void test_visitSwitchCase_singleLabel() { |
| 2905 assertSource("l1: case a: {}", AstFactory.switchCase2(AstFactory.list([AstFa
ctory.label2("l1")]), AstFactory.identifier3("a"), [AstFactory.block([])])); | 2905 _assertSource("l1: case a: {}", AstFactory.switchCase2(AstFactory.list([AstF
actory.label2("l1")]), AstFactory.identifier3("a"), [AstFactory.block([])])); |
| 2906 } | 2906 } |
| 2907 | 2907 |
| 2908 void test_visitSwitchDefault_multipleLabels() { | 2908 void test_visitSwitchDefault_multipleLabels() { |
| 2909 assertSource("l1: l2: default: {}", AstFactory.switchDefault(AstFactory.list
([AstFactory.label2("l1"), AstFactory.label2("l2")]), [AstFactory.block([])])); | 2909 _assertSource("l1: l2: default: {}", AstFactory.switchDefault(AstFactory.lis
t([AstFactory.label2("l1"), AstFactory.label2("l2")]), [AstFactory.block([])])); |
| 2910 } | 2910 } |
| 2911 | 2911 |
| 2912 void test_visitSwitchDefault_multipleStatements() { | 2912 void test_visitSwitchDefault_multipleStatements() { |
| 2913 assertSource("default: {} {}", AstFactory.switchDefault2([AstFactory.block([
]), AstFactory.block([])])); | 2913 _assertSource("default: {} {}", AstFactory.switchDefault2([AstFactory.block(
[]), AstFactory.block([])])); |
| 2914 } | 2914 } |
| 2915 | 2915 |
| 2916 void test_visitSwitchDefault_noLabels() { | 2916 void test_visitSwitchDefault_noLabels() { |
| 2917 assertSource("default: {}", AstFactory.switchDefault2([AstFactory.block([])]
)); | 2917 _assertSource("default: {}", AstFactory.switchDefault2([AstFactory.block([])
])); |
| 2918 } | 2918 } |
| 2919 | 2919 |
| 2920 void test_visitSwitchDefault_singleLabel() { | 2920 void test_visitSwitchDefault_singleLabel() { |
| 2921 assertSource("l1: default: {}", AstFactory.switchDefault(AstFactory.list([As
tFactory.label2("l1")]), [AstFactory.block([])])); | 2921 _assertSource("l1: default: {}", AstFactory.switchDefault(AstFactory.list([A
stFactory.label2("l1")]), [AstFactory.block([])])); |
| 2922 } | 2922 } |
| 2923 | 2923 |
| 2924 void test_visitSwitchStatement() { | 2924 void test_visitSwitchStatement() { |
| 2925 assertSource("switch (a) {case 'b': {} default: {}}", AstFactory.switchState
ment(AstFactory.identifier3("a"), [ | 2925 _assertSource("switch (a) {case 'b': {} default: {}}", AstFactory.switchStat
ement(AstFactory.identifier3("a"), [ |
| 2926 AstFactory.switchCase(AstFactory.string2("b"), [AstFactory.block([])]), | 2926 AstFactory.switchCase(AstFactory.string2("b"), [AstFactory.block([])]), |
| 2927 AstFactory.switchDefault2([AstFactory.block([])])])); | 2927 AstFactory.switchDefault2([AstFactory.block([])])])); |
| 2928 } | 2928 } |
| 2929 | 2929 |
| 2930 void test_visitSymbolLiteral_multiple() { | 2930 void test_visitSymbolLiteral_multiple() { |
| 2931 assertSource("#a.b.c", AstFactory.symbolLiteral(["a", "b", "c"])); | 2931 _assertSource("#a.b.c", AstFactory.symbolLiteral(["a", "b", "c"])); |
| 2932 } | 2932 } |
| 2933 | 2933 |
| 2934 void test_visitSymbolLiteral_single() { | 2934 void test_visitSymbolLiteral_single() { |
| 2935 assertSource("#a", AstFactory.symbolLiteral(["a"])); | 2935 _assertSource("#a", AstFactory.symbolLiteral(["a"])); |
| 2936 } | 2936 } |
| 2937 | 2937 |
| 2938 void test_visitThisExpression() { | 2938 void test_visitThisExpression() { |
| 2939 assertSource("this", AstFactory.thisExpression()); | 2939 _assertSource("this", AstFactory.thisExpression()); |
| 2940 } | 2940 } |
| 2941 | 2941 |
| 2942 void test_visitThrowStatement() { | 2942 void test_visitThrowStatement() { |
| 2943 assertSource("throw e", AstFactory.throwExpression2(AstFactory.identifier3("
e"))); | 2943 _assertSource("throw e", AstFactory.throwExpression2(AstFactory.identifier3(
"e"))); |
| 2944 } | 2944 } |
| 2945 | 2945 |
| 2946 void test_visitTopLevelVariableDeclaration_multiple() { | 2946 void test_visitTopLevelVariableDeclaration_multiple() { |
| 2947 assertSource("var a;", AstFactory.topLevelVariableDeclaration2(Keyword.VAR,
[AstFactory.variableDeclaration("a")])); | 2947 _assertSource("var a;", AstFactory.topLevelVariableDeclaration2(Keyword.VAR,
[AstFactory.variableDeclaration("a")])); |
| 2948 } | 2948 } |
| 2949 | 2949 |
| 2950 void test_visitTopLevelVariableDeclaration_single() { | 2950 void test_visitTopLevelVariableDeclaration_single() { |
| 2951 assertSource("var a, b;", AstFactory.topLevelVariableDeclaration2(Keyword.VA
R, [ | 2951 _assertSource("var a, b;", AstFactory.topLevelVariableDeclaration2(Keyword.V
AR, [ |
| 2952 AstFactory.variableDeclaration("a"), | 2952 AstFactory.variableDeclaration("a"), |
| 2953 AstFactory.variableDeclaration("b")])); | 2953 AstFactory.variableDeclaration("b")])); |
| 2954 } | 2954 } |
| 2955 | 2955 |
| 2956 void test_visitTryStatement_catch() { | 2956 void test_visitTryStatement_catch() { |
| 2957 assertSource("try {} on E {}", AstFactory.tryStatement2(AstFactory.block([])
, [AstFactory.catchClause3(AstFactory.typeName4("E", []), [])])); | 2957 _assertSource("try {} on E {}", AstFactory.tryStatement2(AstFactory.block([]
), [AstFactory.catchClause3(AstFactory.typeName4("E", []), [])])); |
| 2958 } | 2958 } |
| 2959 | 2959 |
| 2960 void test_visitTryStatement_catches() { | 2960 void test_visitTryStatement_catches() { |
| 2961 assertSource("try {} on E {} on F {}", AstFactory.tryStatement2(AstFactory.b
lock([]), [ | 2961 _assertSource("try {} on E {} on F {}", AstFactory.tryStatement2(AstFactory.
block([]), [ |
| 2962 AstFactory.catchClause3(AstFactory.typeName4("E", []), []), | 2962 AstFactory.catchClause3(AstFactory.typeName4("E", []), []), |
| 2963 AstFactory.catchClause3(AstFactory.typeName4("F", []), [])])); | 2963 AstFactory.catchClause3(AstFactory.typeName4("F", []), [])])); |
| 2964 } | 2964 } |
| 2965 | 2965 |
| 2966 void test_visitTryStatement_catchFinally() { | 2966 void test_visitTryStatement_catchFinally() { |
| 2967 assertSource("try {} on E {} finally {}", AstFactory.tryStatement3(AstFactor
y.block([]), AstFactory.list([AstFactory.catchClause3(AstFactory.typeName4("E",
[]), [])]), AstFactory.block([]))); | 2967 _assertSource("try {} on E {} finally {}", AstFactory.tryStatement3(AstFacto
ry.block([]), AstFactory.list([AstFactory.catchClause3(AstFactory.typeName4("E",
[]), [])]), AstFactory.block([]))); |
| 2968 } | 2968 } |
| 2969 | 2969 |
| 2970 void test_visitTryStatement_finally() { | 2970 void test_visitTryStatement_finally() { |
| 2971 assertSource("try {} finally {}", AstFactory.tryStatement(AstFactory.block([
]), AstFactory.block([]))); | 2971 _assertSource("try {} finally {}", AstFactory.tryStatement(AstFactory.block(
[]), AstFactory.block([]))); |
| 2972 } | 2972 } |
| 2973 | 2973 |
| 2974 void test_visitTypeAlias_generic() { | 2974 void test_visitTypeAlias_generic() { |
| 2975 assertSource("typedef A F<B>();", AstFactory.typeAlias(AstFactory.typeName4(
"A", []), "F", AstFactory.typeParameterList(["B"]), AstFactory.formalParameterLi
st([]))); | 2975 _assertSource("typedef A F<B>();", AstFactory.typeAlias(AstFactory.typeName4
("A", []), "F", AstFactory.typeParameterList(["B"]), AstFactory.formalParameterL
ist([]))); |
| 2976 } | 2976 } |
| 2977 | 2977 |
| 2978 void test_visitTypeAlias_nonGeneric() { | 2978 void test_visitTypeAlias_nonGeneric() { |
| 2979 assertSource("typedef A F();", AstFactory.typeAlias(AstFactory.typeName4("A"
, []), "F", null, AstFactory.formalParameterList([]))); | 2979 _assertSource("typedef A F();", AstFactory.typeAlias(AstFactory.typeName4("A
", []), "F", null, AstFactory.formalParameterList([]))); |
| 2980 } | 2980 } |
| 2981 | 2981 |
| 2982 void test_visitTypeArgumentList_multiple() { | 2982 void test_visitTypeArgumentList_multiple() { |
| 2983 assertSource("<E, F>", AstFactory.typeArgumentList([ | 2983 _assertSource("<E, F>", AstFactory.typeArgumentList([ |
| 2984 AstFactory.typeName4("E", []), | 2984 AstFactory.typeName4("E", []), |
| 2985 AstFactory.typeName4("F", [])])); | 2985 AstFactory.typeName4("F", [])])); |
| 2986 } | 2986 } |
| 2987 | 2987 |
| 2988 void test_visitTypeArgumentList_single() { | 2988 void test_visitTypeArgumentList_single() { |
| 2989 assertSource("<E>", AstFactory.typeArgumentList([AstFactory.typeName4("E", [
])])); | 2989 _assertSource("<E>", AstFactory.typeArgumentList([AstFactory.typeName4("E",
[])])); |
| 2990 } | 2990 } |
| 2991 | 2991 |
| 2992 void test_visitTypeName_multipleArgs() { | 2992 void test_visitTypeName_multipleArgs() { |
| 2993 assertSource("C<D, E>", AstFactory.typeName4("C", [ | 2993 _assertSource("C<D, E>", AstFactory.typeName4("C", [ |
| 2994 AstFactory.typeName4("D", []), | 2994 AstFactory.typeName4("D", []), |
| 2995 AstFactory.typeName4("E", [])])); | 2995 AstFactory.typeName4("E", [])])); |
| 2996 } | 2996 } |
| 2997 | 2997 |
| 2998 void test_visitTypeName_nestedArg() { | 2998 void test_visitTypeName_nestedArg() { |
| 2999 assertSource("C<D<E>>", AstFactory.typeName4("C", [AstFactory.typeName4("D",
[AstFactory.typeName4("E", [])])])); | 2999 _assertSource("C<D<E>>", AstFactory.typeName4("C", [AstFactory.typeName4("D"
, [AstFactory.typeName4("E", [])])])); |
| 3000 } | 3000 } |
| 3001 | 3001 |
| 3002 void test_visitTypeName_noArgs() { | 3002 void test_visitTypeName_noArgs() { |
| 3003 assertSource("C", AstFactory.typeName4("C", [])); | 3003 _assertSource("C", AstFactory.typeName4("C", [])); |
| 3004 } | 3004 } |
| 3005 | 3005 |
| 3006 void test_visitTypeName_singleArg() { | 3006 void test_visitTypeName_singleArg() { |
| 3007 assertSource("C<D>", AstFactory.typeName4("C", [AstFactory.typeName4("D", []
)])); | 3007 _assertSource("C<D>", AstFactory.typeName4("C", [AstFactory.typeName4("D", [
])])); |
| 3008 } | 3008 } |
| 3009 | 3009 |
| 3010 void test_visitTypeParameter_withExtends() { | 3010 void test_visitTypeParameter_withExtends() { |
| 3011 assertSource("E extends C", AstFactory.typeParameter2("E", AstFactory.typeNa
me4("C", []))); | 3011 _assertSource("E extends C", AstFactory.typeParameter2("E", AstFactory.typeN
ame4("C", []))); |
| 3012 } | 3012 } |
| 3013 | 3013 |
| 3014 void test_visitTypeParameter_withoutExtends() { | 3014 void test_visitTypeParameter_withoutExtends() { |
| 3015 assertSource("E", AstFactory.typeParameter("E")); | 3015 _assertSource("E", AstFactory.typeParameter("E")); |
| 3016 } | 3016 } |
| 3017 | 3017 |
| 3018 void test_visitTypeParameterList_multiple() { | 3018 void test_visitTypeParameterList_multiple() { |
| 3019 assertSource("<E, F>", AstFactory.typeParameterList(["E", "F"])); | 3019 _assertSource("<E, F>", AstFactory.typeParameterList(["E", "F"])); |
| 3020 } | 3020 } |
| 3021 | 3021 |
| 3022 void test_visitTypeParameterList_single() { | 3022 void test_visitTypeParameterList_single() { |
| 3023 assertSource("<E>", AstFactory.typeParameterList(["E"])); | 3023 _assertSource("<E>", AstFactory.typeParameterList(["E"])); |
| 3024 } | 3024 } |
| 3025 | 3025 |
| 3026 void test_visitVariableDeclaration_initialized() { | 3026 void test_visitVariableDeclaration_initialized() { |
| 3027 assertSource("a = b", AstFactory.variableDeclaration2("a", AstFactory.identi
fier3("b"))); | 3027 _assertSource("a = b", AstFactory.variableDeclaration2("a", AstFactory.ident
ifier3("b"))); |
| 3028 } | 3028 } |
| 3029 | 3029 |
| 3030 void test_visitVariableDeclaration_uninitialized() { | 3030 void test_visitVariableDeclaration_uninitialized() { |
| 3031 assertSource("a", AstFactory.variableDeclaration("a")); | 3031 _assertSource("a", AstFactory.variableDeclaration("a")); |
| 3032 } | 3032 } |
| 3033 | 3033 |
| 3034 void test_visitVariableDeclarationList_const_type() { | 3034 void test_visitVariableDeclarationList_const_type() { |
| 3035 assertSource("const C a, b", AstFactory.variableDeclarationList(Keyword.CONS
T, AstFactory.typeName4("C", []), [ | 3035 _assertSource("const C a, b", AstFactory.variableDeclarationList(Keyword.CON
ST, AstFactory.typeName4("C", []), [ |
| 3036 AstFactory.variableDeclaration("a"), | 3036 AstFactory.variableDeclaration("a"), |
| 3037 AstFactory.variableDeclaration("b")])); | 3037 AstFactory.variableDeclaration("b")])); |
| 3038 } | 3038 } |
| 3039 | 3039 |
| 3040 void test_visitVariableDeclarationList_final_noType() { | 3040 void test_visitVariableDeclarationList_final_noType() { |
| 3041 assertSource("final a, b", AstFactory.variableDeclarationList2(Keyword.FINAL
, [ | 3041 _assertSource("final a, b", AstFactory.variableDeclarationList2(Keyword.FINA
L, [ |
| 3042 AstFactory.variableDeclaration("a"), | 3042 AstFactory.variableDeclaration("a"), |
| 3043 AstFactory.variableDeclaration("b")])); | 3043 AstFactory.variableDeclaration("b")])); |
| 3044 } | 3044 } |
| 3045 | 3045 |
| 3046 void test_visitVariableDeclarationList_type() { | 3046 void test_visitVariableDeclarationList_type() { |
| 3047 assertSource("C a, b", AstFactory.variableDeclarationList(null, AstFactory.t
ypeName4("C", []), [ | 3047 _assertSource("C a, b", AstFactory.variableDeclarationList(null, AstFactory.
typeName4("C", []), [ |
| 3048 AstFactory.variableDeclaration("a"), | 3048 AstFactory.variableDeclaration("a"), |
| 3049 AstFactory.variableDeclaration("b")])); | 3049 AstFactory.variableDeclaration("b")])); |
| 3050 } | 3050 } |
| 3051 | 3051 |
| 3052 void test_visitVariableDeclarationList_var() { | 3052 void test_visitVariableDeclarationList_var() { |
| 3053 assertSource("var a, b", AstFactory.variableDeclarationList2(Keyword.VAR, [ | 3053 _assertSource("var a, b", AstFactory.variableDeclarationList2(Keyword.VAR, [ |
| 3054 AstFactory.variableDeclaration("a"), | 3054 AstFactory.variableDeclaration("a"), |
| 3055 AstFactory.variableDeclaration("b")])); | 3055 AstFactory.variableDeclaration("b")])); |
| 3056 } | 3056 } |
| 3057 | 3057 |
| 3058 void test_visitVariableDeclarationStatement() { | 3058 void test_visitVariableDeclarationStatement() { |
| 3059 assertSource("C c;", AstFactory.variableDeclarationStatement(null, AstFactor
y.typeName4("C", []), [AstFactory.variableDeclaration("c")])); | 3059 _assertSource("C c;", AstFactory.variableDeclarationStatement(null, AstFacto
ry.typeName4("C", []), [AstFactory.variableDeclaration("c")])); |
| 3060 } | 3060 } |
| 3061 | 3061 |
| 3062 void test_visitWhileStatement() { | 3062 void test_visitWhileStatement() { |
| 3063 assertSource("while (c) {}", AstFactory.whileStatement(AstFactory.identifier
3("c"), AstFactory.block([]))); | 3063 _assertSource("while (c) {}", AstFactory.whileStatement(AstFactory.identifie
r3("c"), AstFactory.block([]))); |
| 3064 } | 3064 } |
| 3065 | 3065 |
| 3066 void test_visitWithClause_multiple() { | 3066 void test_visitWithClause_multiple() { |
| 3067 assertSource("with A, B, C", AstFactory.withClause([ | 3067 _assertSource("with A, B, C", AstFactory.withClause([ |
| 3068 AstFactory.typeName4("A", []), | 3068 AstFactory.typeName4("A", []), |
| 3069 AstFactory.typeName4("B", []), | 3069 AstFactory.typeName4("B", []), |
| 3070 AstFactory.typeName4("C", [])])); | 3070 AstFactory.typeName4("C", [])])); |
| 3071 } | 3071 } |
| 3072 | 3072 |
| 3073 void test_visitWithClause_single() { | 3073 void test_visitWithClause_single() { |
| 3074 assertSource("with A", AstFactory.withClause([AstFactory.typeName4("A", [])]
)); | 3074 _assertSource("with A", AstFactory.withClause([AstFactory.typeName4("A", [])
])); |
| 3075 } | 3075 } |
| 3076 | 3076 |
| 3077 /** | 3077 /** |
| 3078 * Assert that a `ToSourceVisitor` will produce the expected source when visit
ing the given | 3078 * Assert that a `ToSourceVisitor` will produce the expected source when visit
ing the given |
| 3079 * node. | 3079 * node. |
| 3080 * | 3080 * |
| 3081 * @param expectedSource the source string that the visitor is expected to pro
duce | 3081 * @param expectedSource the source string that the visitor is expected to pro
duce |
| 3082 * @param node the AST node being visited to produce the actual source | 3082 * @param node the AST node being visited to produce the actual source |
| 3083 * @throws AFE if the visitor does not produce the expected source for the giv
en node | 3083 * @throws AFE if the visitor does not produce the expected source for the giv
en node |
| 3084 */ | 3084 */ |
| 3085 void assertSource(String expectedSource, AstNode node) { | 3085 void _assertSource(String expectedSource, AstNode node) { |
| 3086 PrintStringWriter writer = new PrintStringWriter(); | 3086 PrintStringWriter writer = new PrintStringWriter(); |
| 3087 node.accept(new ToSourceVisitor(writer)); | 3087 node.accept(new ToSourceVisitor(writer)); |
| 3088 JUnitTestCase.assertEquals(expectedSource, writer.toString()); | 3088 JUnitTestCase.assertEquals(expectedSource, writer.toString()); |
| 3089 } | 3089 } |
| 3090 | 3090 |
| 3091 static dartSuite() { | 3091 static dartSuite() { |
| 3092 _ut.group('ToSourceVisitorTest', () { | 3092 _ut.group('ToSourceVisitorTest', () { |
| 3093 _ut.test('test_visitAdjacentStrings', () { | 3093 _ut.test('test_visitAdjacentStrings', () { |
| 3094 final __test = new ToSourceVisitorTest(); | 3094 final __test = new ToSourceVisitorTest(); |
| 3095 runJUnitTest(__test, __test.test_visitAdjacentStrings); | 3095 runJUnitTest(__test, __test.test_visitAdjacentStrings); |
| (...skipping 991 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 4087 NodeLocatorTest.dartSuite(); | 4087 NodeLocatorTest.dartSuite(); |
| 4088 ToSourceVisitorTest.dartSuite(); | 4088 ToSourceVisitorTest.dartSuite(); |
| 4089 BreadthFirstVisitorTest.dartSuite(); | 4089 BreadthFirstVisitorTest.dartSuite(); |
| 4090 ClassDeclarationTest.dartSuite(); | 4090 ClassDeclarationTest.dartSuite(); |
| 4091 IndexExpressionTest.dartSuite(); | 4091 IndexExpressionTest.dartSuite(); |
| 4092 NodeListTest.dartSuite(); | 4092 NodeListTest.dartSuite(); |
| 4093 SimpleIdentifierTest.dartSuite(); | 4093 SimpleIdentifierTest.dartSuite(); |
| 4094 SimpleStringLiteralTest.dartSuite(); | 4094 SimpleStringLiteralTest.dartSuite(); |
| 4095 VariableDeclarationTest.dartSuite(); | 4095 VariableDeclarationTest.dartSuite(); |
| 4096 } | 4096 } |
| OLD | NEW |