| OLD | NEW |
| 1 // This code was auto-generated, is not intended to be edited, and is subject to | 1 // This code was auto-generated, is not intended to be edited, and is subject to |
| 2 // significant change. Please see the README file for more information. | 2 // significant change. Please see the README file for more information. |
| 3 |
| 3 library engine.ast_test; | 4 library engine.ast_test; |
| 5 |
| 4 import 'package:analyzer/src/generated/java_core.dart'; | 6 import 'package:analyzer/src/generated/java_core.dart'; |
| 5 import 'package:analyzer/src/generated/java_junit.dart'; | 7 import 'package:analyzer/src/generated/java_junit.dart'; |
| 6 import 'package:analyzer/src/generated/scanner.dart'; | 8 import 'package:analyzer/src/generated/scanner.dart'; |
| 7 import 'package:analyzer/src/generated/ast.dart'; | 9 import 'package:analyzer/src/generated/ast.dart'; |
| 8 import 'package:analyzer/src/generated/utilities_dart.dart'; | 10 import 'package:analyzer/src/generated/utilities_dart.dart'; |
| 9 import 'package:analyzer/src/generated/element.dart' show ClassElement; | 11 import 'package:analyzer/src/generated/element.dart' show ClassElement; |
| 10 import 'package:unittest/unittest.dart' as _ut; | 12 import 'package:unittest/unittest.dart' as _ut; |
| 11 import 'parser_test.dart' show ParserTestCase; | 13 import 'parser_test.dart' show ParserTestCase; |
| 12 import 'test_support.dart'; | 14 import 'test_support.dart'; |
| 13 import 'scanner_test.dart' show TokenFactory; | 15 import 'scanner_test.dart' show TokenFactory; |
| 16 |
| 14 class NodeLocatorTest extends ParserTestCase { | 17 class NodeLocatorTest extends ParserTestCase { |
| 15 void test_range() { | 18 void test_range() { |
| 16 CompilationUnit unit = ParserTestCase.parseCompilationUnit("library myLib;",
[]); | 19 CompilationUnit unit = ParserTestCase.parseCompilationUnit("library myLib;",
[]); |
| 17 assertLocate2(unit, 4, 10, LibraryDirective); | 20 assertLocate2(unit, 4, 10, LibraryDirective); |
| 18 } | 21 } |
| 22 |
| 19 void test_searchWithin_null() { | 23 void test_searchWithin_null() { |
| 20 NodeLocator locator = new NodeLocator.con2(0, 0); | 24 NodeLocator locator = new NodeLocator.con2(0, 0); |
| 21 JUnitTestCase.assertNull(locator.searchWithin(null)); | 25 JUnitTestCase.assertNull(locator.searchWithin(null)); |
| 22 } | 26 } |
| 27 |
| 23 void test_searchWithin_offset() { | 28 void test_searchWithin_offset() { |
| 24 CompilationUnit unit = ParserTestCase.parseCompilationUnit("library myLib;",
[]); | 29 CompilationUnit unit = ParserTestCase.parseCompilationUnit("library myLib;",
[]); |
| 25 assertLocate(unit, 10, SimpleIdentifier); | 30 assertLocate(unit, 10, SimpleIdentifier); |
| 26 } | 31 } |
| 32 |
| 27 void test_searchWithin_offsetAfterNode() { | 33 void test_searchWithin_offsetAfterNode() { |
| 28 CompilationUnit unit = ParserTestCase.parseCompilationUnit(EngineTestCase.cr
eateSource(["class A {}", "class B {}"]), []); | 34 CompilationUnit unit = ParserTestCase.parseCompilationUnit(EngineTestCase.cr
eateSource(["class A {}", "class B {}"]), []); |
| 29 NodeLocator locator = new NodeLocator.con2(1024, 1024); | 35 NodeLocator locator = new NodeLocator.con2(1024, 1024); |
| 30 ASTNode node = locator.searchWithin(unit.declarations[0]); | 36 ASTNode node = locator.searchWithin(unit.declarations[0]); |
| 31 JUnitTestCase.assertNull(node); | 37 JUnitTestCase.assertNull(node); |
| 32 } | 38 } |
| 39 |
| 33 void test_searchWithin_offsetBeforeNode() { | 40 void test_searchWithin_offsetBeforeNode() { |
| 34 CompilationUnit unit = ParserTestCase.parseCompilationUnit(EngineTestCase.cr
eateSource(["class A {}", "class B {}"]), []); | 41 CompilationUnit unit = ParserTestCase.parseCompilationUnit(EngineTestCase.cr
eateSource(["class A {}", "class B {}"]), []); |
| 35 NodeLocator locator = new NodeLocator.con2(0, 0); | 42 NodeLocator locator = new NodeLocator.con2(0, 0); |
| 36 ASTNode node = locator.searchWithin(unit.declarations[1]); | 43 ASTNode node = locator.searchWithin(unit.declarations[1]); |
| 37 JUnitTestCase.assertNull(node); | 44 JUnitTestCase.assertNull(node); |
| 38 } | 45 } |
| 46 |
| 39 void assertLocate(CompilationUnit unit, int offset, Type expectedClass) { | 47 void assertLocate(CompilationUnit unit, int offset, Type expectedClass) { |
| 40 assertLocate2(unit, offset, offset, expectedClass); | 48 assertLocate2(unit, offset, offset, expectedClass); |
| 41 } | 49 } |
| 50 |
| 42 void assertLocate2(CompilationUnit unit, int start, int end, Type expectedClas
s) { | 51 void assertLocate2(CompilationUnit unit, int start, int end, Type expectedClas
s) { |
| 43 NodeLocator locator = new NodeLocator.con2(start, end); | 52 NodeLocator locator = new NodeLocator.con2(start, end); |
| 44 ASTNode node = locator.searchWithin(unit); | 53 ASTNode node = locator.searchWithin(unit); |
| 45 JUnitTestCase.assertNotNull(node); | 54 JUnitTestCase.assertNotNull(node); |
| 46 JUnitTestCase.assertSame(node, locator.foundNode); | 55 JUnitTestCase.assertSame(node, locator.foundNode); |
| 47 JUnitTestCase.assertTrueMsg("Node starts after range", node.offset <= start)
; | 56 JUnitTestCase.assertTrueMsg("Node starts after range", node.offset <= start)
; |
| 48 JUnitTestCase.assertTrueMsg("Node ends before range", node.offset + node.len
gth > end); | 57 JUnitTestCase.assertTrueMsg("Node ends before range", node.offset + node.len
gth > end); |
| 49 EngineTestCase.assertInstanceOf(expectedClass, node); | 58 EngineTestCase.assertInstanceOf(expectedClass, node); |
| 50 } | 59 } |
| 60 |
| 51 static dartSuite() { | 61 static dartSuite() { |
| 52 _ut.group('NodeLocatorTest', () { | 62 _ut.group('NodeLocatorTest', () { |
| 53 _ut.test('test_range', () { | 63 _ut.test('test_range', () { |
| 54 final __test = new NodeLocatorTest(); | 64 final __test = new NodeLocatorTest(); |
| 55 runJUnitTest(__test, __test.test_range); | 65 runJUnitTest(__test, __test.test_range); |
| 56 }); | 66 }); |
| 57 _ut.test('test_searchWithin_null', () { | 67 _ut.test('test_searchWithin_null', () { |
| 58 final __test = new NodeLocatorTest(); | 68 final __test = new NodeLocatorTest(); |
| 59 runJUnitTest(__test, __test.test_searchWithin_null); | 69 runJUnitTest(__test, __test.test_searchWithin_null); |
| 60 }); | 70 }); |
| 61 _ut.test('test_searchWithin_offset', () { | 71 _ut.test('test_searchWithin_offset', () { |
| 62 final __test = new NodeLocatorTest(); | 72 final __test = new NodeLocatorTest(); |
| 63 runJUnitTest(__test, __test.test_searchWithin_offset); | 73 runJUnitTest(__test, __test.test_searchWithin_offset); |
| 64 }); | 74 }); |
| 65 _ut.test('test_searchWithin_offsetAfterNode', () { | 75 _ut.test('test_searchWithin_offsetAfterNode', () { |
| 66 final __test = new NodeLocatorTest(); | 76 final __test = new NodeLocatorTest(); |
| 67 runJUnitTest(__test, __test.test_searchWithin_offsetAfterNode); | 77 runJUnitTest(__test, __test.test_searchWithin_offsetAfterNode); |
| 68 }); | 78 }); |
| 69 _ut.test('test_searchWithin_offsetBeforeNode', () { | 79 _ut.test('test_searchWithin_offsetBeforeNode', () { |
| 70 final __test = new NodeLocatorTest(); | 80 final __test = new NodeLocatorTest(); |
| 71 runJUnitTest(__test, __test.test_searchWithin_offsetBeforeNode); | 81 runJUnitTest(__test, __test.test_searchWithin_offsetBeforeNode); |
| 72 }); | 82 }); |
| 73 }); | 83 }); |
| 74 } | 84 } |
| 75 } | 85 } |
| 86 |
| 76 class IndexExpressionTest extends EngineTestCase { | 87 class IndexExpressionTest extends EngineTestCase { |
| 77 void test_inGetterContext_assignment_compound_left() { | 88 void test_inGetterContext_assignment_compound_left() { |
| 78 IndexExpression expression = ASTFactory.indexExpression(ASTFactory.identifie
r3("a"), ASTFactory.identifier3("b")); | 89 IndexExpression expression = ASTFactory.indexExpression(ASTFactory.identifie
r3("a"), ASTFactory.identifier3("b")); |
| 79 ASTFactory.assignmentExpression(expression, TokenType.PLUS_EQ, null); | 90 ASTFactory.assignmentExpression(expression, TokenType.PLUS_EQ, null); |
| 80 JUnitTestCase.assertTrue(expression.inGetterContext()); | 91 JUnitTestCase.assertTrue(expression.inGetterContext()); |
| 81 } | 92 } |
| 93 |
| 82 void test_inGetterContext_assignment_simple_left() { | 94 void test_inGetterContext_assignment_simple_left() { |
| 83 IndexExpression expression = ASTFactory.indexExpression(ASTFactory.identifie
r3("a"), ASTFactory.identifier3("b")); | 95 IndexExpression expression = ASTFactory.indexExpression(ASTFactory.identifie
r3("a"), ASTFactory.identifier3("b")); |
| 84 ASTFactory.assignmentExpression(expression, TokenType.EQ, null); | 96 ASTFactory.assignmentExpression(expression, TokenType.EQ, null); |
| 85 JUnitTestCase.assertFalse(expression.inGetterContext()); | 97 JUnitTestCase.assertFalse(expression.inGetterContext()); |
| 86 } | 98 } |
| 99 |
| 87 void test_inGetterContext_nonAssignment() { | 100 void test_inGetterContext_nonAssignment() { |
| 88 IndexExpression expression = ASTFactory.indexExpression(ASTFactory.identifie
r3("a"), ASTFactory.identifier3("b")); | 101 IndexExpression expression = ASTFactory.indexExpression(ASTFactory.identifie
r3("a"), ASTFactory.identifier3("b")); |
| 89 ASTFactory.binaryExpression(expression, TokenType.PLUS, null); | 102 ASTFactory.binaryExpression(expression, TokenType.PLUS, null); |
| 90 JUnitTestCase.assertTrue(expression.inGetterContext()); | 103 JUnitTestCase.assertTrue(expression.inGetterContext()); |
| 91 } | 104 } |
| 105 |
| 92 void test_inSetterContext_assignment_compound_left() { | 106 void test_inSetterContext_assignment_compound_left() { |
| 93 IndexExpression expression = ASTFactory.indexExpression(ASTFactory.identifie
r3("a"), ASTFactory.identifier3("b")); | 107 IndexExpression expression = ASTFactory.indexExpression(ASTFactory.identifie
r3("a"), ASTFactory.identifier3("b")); |
| 94 ASTFactory.assignmentExpression(expression, TokenType.PLUS_EQ, null); | 108 ASTFactory.assignmentExpression(expression, TokenType.PLUS_EQ, null); |
| 95 JUnitTestCase.assertTrue(expression.inSetterContext()); | 109 JUnitTestCase.assertTrue(expression.inSetterContext()); |
| 96 } | 110 } |
| 111 |
| 97 void test_inSetterContext_assignment_compound_right() { | 112 void test_inSetterContext_assignment_compound_right() { |
| 98 IndexExpression expression = ASTFactory.indexExpression(ASTFactory.identifie
r3("a"), ASTFactory.identifier3("b")); | 113 IndexExpression expression = ASTFactory.indexExpression(ASTFactory.identifie
r3("a"), ASTFactory.identifier3("b")); |
| 99 ASTFactory.assignmentExpression(null, TokenType.PLUS_EQ, expression); | 114 ASTFactory.assignmentExpression(null, TokenType.PLUS_EQ, expression); |
| 100 JUnitTestCase.assertFalse(expression.inSetterContext()); | 115 JUnitTestCase.assertFalse(expression.inSetterContext()); |
| 101 } | 116 } |
| 117 |
| 102 void test_inSetterContext_assignment_simple_left() { | 118 void test_inSetterContext_assignment_simple_left() { |
| 103 IndexExpression expression = ASTFactory.indexExpression(ASTFactory.identifie
r3("a"), ASTFactory.identifier3("b")); | 119 IndexExpression expression = ASTFactory.indexExpression(ASTFactory.identifie
r3("a"), ASTFactory.identifier3("b")); |
| 104 ASTFactory.assignmentExpression(expression, TokenType.EQ, null); | 120 ASTFactory.assignmentExpression(expression, TokenType.EQ, null); |
| 105 JUnitTestCase.assertTrue(expression.inSetterContext()); | 121 JUnitTestCase.assertTrue(expression.inSetterContext()); |
| 106 } | 122 } |
| 123 |
| 107 void test_inSetterContext_assignment_simple_right() { | 124 void test_inSetterContext_assignment_simple_right() { |
| 108 IndexExpression expression = ASTFactory.indexExpression(ASTFactory.identifie
r3("a"), ASTFactory.identifier3("b")); | 125 IndexExpression expression = ASTFactory.indexExpression(ASTFactory.identifie
r3("a"), ASTFactory.identifier3("b")); |
| 109 ASTFactory.assignmentExpression(null, TokenType.EQ, expression); | 126 ASTFactory.assignmentExpression(null, TokenType.EQ, expression); |
| 110 JUnitTestCase.assertFalse(expression.inSetterContext()); | 127 JUnitTestCase.assertFalse(expression.inSetterContext()); |
| 111 } | 128 } |
| 129 |
| 112 void test_inSetterContext_nonAssignment() { | 130 void test_inSetterContext_nonAssignment() { |
| 113 IndexExpression expression = ASTFactory.indexExpression(ASTFactory.identifie
r3("a"), ASTFactory.identifier3("b")); | 131 IndexExpression expression = ASTFactory.indexExpression(ASTFactory.identifie
r3("a"), ASTFactory.identifier3("b")); |
| 114 ASTFactory.binaryExpression(expression, TokenType.PLUS, null); | 132 ASTFactory.binaryExpression(expression, TokenType.PLUS, null); |
| 115 JUnitTestCase.assertFalse(expression.inSetterContext()); | 133 JUnitTestCase.assertFalse(expression.inSetterContext()); |
| 116 } | 134 } |
| 135 |
| 117 void test_inSetterContext_postfix() { | 136 void test_inSetterContext_postfix() { |
| 118 IndexExpression expression = ASTFactory.indexExpression(ASTFactory.identifie
r3("a"), ASTFactory.identifier3("b")); | 137 IndexExpression expression = ASTFactory.indexExpression(ASTFactory.identifie
r3("a"), ASTFactory.identifier3("b")); |
| 119 ASTFactory.postfixExpression(expression, TokenType.PLUS_PLUS); | 138 ASTFactory.postfixExpression(expression, TokenType.PLUS_PLUS); |
| 120 JUnitTestCase.assertTrue(expression.inSetterContext()); | 139 JUnitTestCase.assertTrue(expression.inSetterContext()); |
| 121 } | 140 } |
| 141 |
| 122 void test_inSetterContext_prefix_bang() { | 142 void test_inSetterContext_prefix_bang() { |
| 123 IndexExpression expression = ASTFactory.indexExpression(ASTFactory.identifie
r3("a"), ASTFactory.identifier3("b")); | 143 IndexExpression expression = ASTFactory.indexExpression(ASTFactory.identifie
r3("a"), ASTFactory.identifier3("b")); |
| 124 ASTFactory.prefixExpression(TokenType.BANG, expression); | 144 ASTFactory.prefixExpression(TokenType.BANG, expression); |
| 125 JUnitTestCase.assertFalse(expression.inSetterContext()); | 145 JUnitTestCase.assertFalse(expression.inSetterContext()); |
| 126 } | 146 } |
| 147 |
| 127 void test_inSetterContext_prefix_minusMinus() { | 148 void test_inSetterContext_prefix_minusMinus() { |
| 128 IndexExpression expression = ASTFactory.indexExpression(ASTFactory.identifie
r3("a"), ASTFactory.identifier3("b")); | 149 IndexExpression expression = ASTFactory.indexExpression(ASTFactory.identifie
r3("a"), ASTFactory.identifier3("b")); |
| 129 ASTFactory.prefixExpression(TokenType.MINUS_MINUS, expression); | 150 ASTFactory.prefixExpression(TokenType.MINUS_MINUS, expression); |
| 130 JUnitTestCase.assertTrue(expression.inSetterContext()); | 151 JUnitTestCase.assertTrue(expression.inSetterContext()); |
| 131 } | 152 } |
| 153 |
| 132 void test_inSetterContext_prefix_plusPlus() { | 154 void test_inSetterContext_prefix_plusPlus() { |
| 133 IndexExpression expression = ASTFactory.indexExpression(ASTFactory.identifie
r3("a"), ASTFactory.identifier3("b")); | 155 IndexExpression expression = ASTFactory.indexExpression(ASTFactory.identifie
r3("a"), ASTFactory.identifier3("b")); |
| 134 ASTFactory.prefixExpression(TokenType.PLUS_PLUS, expression); | 156 ASTFactory.prefixExpression(TokenType.PLUS_PLUS, expression); |
| 135 JUnitTestCase.assertTrue(expression.inSetterContext()); | 157 JUnitTestCase.assertTrue(expression.inSetterContext()); |
| 136 } | 158 } |
| 159 |
| 137 static dartSuite() { | 160 static dartSuite() { |
| 138 _ut.group('IndexExpressionTest', () { | 161 _ut.group('IndexExpressionTest', () { |
| 139 _ut.test('test_inGetterContext_assignment_compound_left', () { | 162 _ut.test('test_inGetterContext_assignment_compound_left', () { |
| 140 final __test = new IndexExpressionTest(); | 163 final __test = new IndexExpressionTest(); |
| 141 runJUnitTest(__test, __test.test_inGetterContext_assignment_compound_lef
t); | 164 runJUnitTest(__test, __test.test_inGetterContext_assignment_compound_lef
t); |
| 142 }); | 165 }); |
| 143 _ut.test('test_inGetterContext_assignment_simple_left', () { | 166 _ut.test('test_inGetterContext_assignment_simple_left', () { |
| 144 final __test = new IndexExpressionTest(); | 167 final __test = new IndexExpressionTest(); |
| 145 runJUnitTest(__test, __test.test_inGetterContext_assignment_simple_left)
; | 168 runJUnitTest(__test, __test.test_inGetterContext_assignment_simple_left)
; |
| 146 }); | 169 }); |
| (...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 180 final __test = new IndexExpressionTest(); | 203 final __test = new IndexExpressionTest(); |
| 181 runJUnitTest(__test, __test.test_inSetterContext_prefix_minusMinus); | 204 runJUnitTest(__test, __test.test_inSetterContext_prefix_minusMinus); |
| 182 }); | 205 }); |
| 183 _ut.test('test_inSetterContext_prefix_plusPlus', () { | 206 _ut.test('test_inSetterContext_prefix_plusPlus', () { |
| 184 final __test = new IndexExpressionTest(); | 207 final __test = new IndexExpressionTest(); |
| 185 runJUnitTest(__test, __test.test_inSetterContext_prefix_plusPlus); | 208 runJUnitTest(__test, __test.test_inSetterContext_prefix_plusPlus); |
| 186 }); | 209 }); |
| 187 }); | 210 }); |
| 188 } | 211 } |
| 189 } | 212 } |
| 213 |
| 190 class VariableDeclarationTest extends ParserTestCase { | 214 class VariableDeclarationTest extends ParserTestCase { |
| 191 void test_getDocumentationComment_onGrandParent() { | 215 void test_getDocumentationComment_onGrandParent() { |
| 192 VariableDeclaration varDecl = ASTFactory.variableDeclaration("a"); | 216 VariableDeclaration varDecl = ASTFactory.variableDeclaration("a"); |
| 193 TopLevelVariableDeclaration decl = ASTFactory.topLevelVariableDeclaration2(K
eyword.VAR, [varDecl]); | 217 TopLevelVariableDeclaration decl = ASTFactory.topLevelVariableDeclaration2(K
eyword.VAR, [varDecl]); |
| 194 Comment comment = Comment.createDocumentationComment(new List<Token>(0)); | 218 Comment comment = Comment.createDocumentationComment(new List<Token>(0)); |
| 195 JUnitTestCase.assertNull(varDecl.documentationComment); | 219 JUnitTestCase.assertNull(varDecl.documentationComment); |
| 196 decl.documentationComment = comment; | 220 decl.documentationComment = comment; |
| 197 JUnitTestCase.assertNotNull(varDecl.documentationComment); | 221 JUnitTestCase.assertNotNull(varDecl.documentationComment); |
| 198 JUnitTestCase.assertNotNull(decl.documentationComment); | 222 JUnitTestCase.assertNotNull(decl.documentationComment); |
| 199 } | 223 } |
| 224 |
| 200 void test_getDocumentationComment_onNode() { | 225 void test_getDocumentationComment_onNode() { |
| 201 VariableDeclaration decl = ASTFactory.variableDeclaration("a"); | 226 VariableDeclaration decl = ASTFactory.variableDeclaration("a"); |
| 202 Comment comment = Comment.createDocumentationComment(new List<Token>(0)); | 227 Comment comment = Comment.createDocumentationComment(new List<Token>(0)); |
| 203 decl.documentationComment = comment; | 228 decl.documentationComment = comment; |
| 204 JUnitTestCase.assertNotNull(decl.documentationComment); | 229 JUnitTestCase.assertNotNull(decl.documentationComment); |
| 205 } | 230 } |
| 231 |
| 206 static dartSuite() { | 232 static dartSuite() { |
| 207 _ut.group('VariableDeclarationTest', () { | 233 _ut.group('VariableDeclarationTest', () { |
| 208 _ut.test('test_getDocumentationComment_onGrandParent', () { | 234 _ut.test('test_getDocumentationComment_onGrandParent', () { |
| 209 final __test = new VariableDeclarationTest(); | 235 final __test = new VariableDeclarationTest(); |
| 210 runJUnitTest(__test, __test.test_getDocumentationComment_onGrandParent); | 236 runJUnitTest(__test, __test.test_getDocumentationComment_onGrandParent); |
| 211 }); | 237 }); |
| 212 _ut.test('test_getDocumentationComment_onNode', () { | 238 _ut.test('test_getDocumentationComment_onNode', () { |
| 213 final __test = new VariableDeclarationTest(); | 239 final __test = new VariableDeclarationTest(); |
| 214 runJUnitTest(__test, __test.test_getDocumentationComment_onNode); | 240 runJUnitTest(__test, __test.test_getDocumentationComment_onNode); |
| 215 }); | 241 }); |
| 216 }); | 242 }); |
| 217 } | 243 } |
| 218 } | 244 } |
| 245 |
| 219 /** | 246 /** |
| 220 * The class `ASTFactory` defines utility methods that can be used to create AST
nodes. The | 247 * The class `ASTFactory` defines utility methods that can be used to create AST
nodes. The |
| 221 * nodes that are created are complete in the sense that all of the tokens that
would have been | 248 * nodes that are created are complete in the sense that all of the tokens that
would have been |
| 222 * associated with the nodes by a parser are also created, but the token stream
is not constructed. | 249 * associated with the nodes by a parser are also created, but the token stream
is not constructed. |
| 223 * None of the nodes are resolved. | 250 * None of the nodes are resolved. |
| 224 * | 251 * |
| 225 * The general pattern is for the name of the factory method to be the same as t
he name of the class | 252 * The general pattern is for the name of the factory method to be the same as t
he name of the class |
| 226 * of AST node being created. There are two notable exceptions. The first is for
methods creating | 253 * of AST node being created. There are two notable exceptions. The first is for
methods creating |
| 227 * nodes that are part of a cascade expression. These methods are all prefixed w
ith 'cascaded'. The | 254 * nodes that are part of a cascade expression. These methods are all prefixed w
ith 'cascaded'. The |
| 228 * second is places where a shorter name seemed unambiguous and easier to read,
such as using | 255 * second is places where a shorter name seemed unambiguous and easier to read,
such as using |
| 229 * 'identifier' rather than 'prefixedIdentifier', or 'integer' rather than 'inte
gerLiteral'. | 256 * 'identifier' rather than 'prefixedIdentifier', or 'integer' rather than 'inte
gerLiteral'. |
| 230 */ | 257 */ |
| 231 class ASTFactory { | 258 class ASTFactory { |
| 232 static AdjacentStrings adjacentStrings(List<StringLiteral> strings) => new Adj
acentStrings.full(list(strings)); | 259 static AdjacentStrings adjacentStrings(List<StringLiteral> strings) => new Adj
acentStrings.full(list(strings)); |
| 260 |
| 233 static Annotation annotation(Identifier name) => new Annotation.full(TokenFact
ory.token3(TokenType.AT), name, null, null, null); | 261 static Annotation annotation(Identifier name) => new Annotation.full(TokenFact
ory.token3(TokenType.AT), name, null, null, null); |
| 262 |
| 234 static Annotation annotation2(Identifier name, SimpleIdentifier constructorNam
e, ArgumentList arguments) => new Annotation.full(TokenFactory.token3(TokenType.
AT), name, TokenFactory.token3(TokenType.PERIOD), constructorName, arguments); | 263 static Annotation annotation2(Identifier name, SimpleIdentifier constructorNam
e, ArgumentList arguments) => new Annotation.full(TokenFactory.token3(TokenType.
AT), name, TokenFactory.token3(TokenType.PERIOD), constructorName, arguments); |
| 264 |
| 235 static ArgumentDefinitionTest argumentDefinitionTest(String identifier) => new
ArgumentDefinitionTest.full(TokenFactory.token3(TokenType.QUESTION), identifier
3(identifier)); | 265 static ArgumentDefinitionTest argumentDefinitionTest(String identifier) => new
ArgumentDefinitionTest.full(TokenFactory.token3(TokenType.QUESTION), identifier
3(identifier)); |
| 266 |
| 236 static ArgumentList argumentList(List<Expression> arguments) => new ArgumentLi
st.full(TokenFactory.token3(TokenType.OPEN_PAREN), list(arguments), TokenFactory
.token3(TokenType.CLOSE_PAREN)); | 267 static ArgumentList argumentList(List<Expression> arguments) => new ArgumentLi
st.full(TokenFactory.token3(TokenType.OPEN_PAREN), list(arguments), TokenFactory
.token3(TokenType.CLOSE_PAREN)); |
| 268 |
| 237 static AsExpression asExpression(Expression expression, TypeName type) => new
AsExpression.full(expression, TokenFactory.token(Keyword.AS), type); | 269 static AsExpression asExpression(Expression expression, TypeName type) => new
AsExpression.full(expression, TokenFactory.token(Keyword.AS), type); |
| 270 |
| 238 static AssertStatement assertStatement(Expression condition) => new AssertStat
ement.full(TokenFactory.token(Keyword.ASSERT), TokenFactory.token3(TokenType.OPE
N_PAREN), condition, TokenFactory.token3(TokenType.CLOSE_PAREN), TokenFactory.to
ken3(TokenType.SEMICOLON)); | 271 static AssertStatement assertStatement(Expression condition) => new AssertStat
ement.full(TokenFactory.token(Keyword.ASSERT), TokenFactory.token3(TokenType.OPE
N_PAREN), condition, TokenFactory.token3(TokenType.CLOSE_PAREN), TokenFactory.to
ken3(TokenType.SEMICOLON)); |
| 272 |
| 239 static AssignmentExpression assignmentExpression(Expression leftHandSide, Toke
nType operator, Expression rightHandSide) => new AssignmentExpression.full(leftH
andSide, TokenFactory.token3(operator), rightHandSide); | 273 static AssignmentExpression assignmentExpression(Expression leftHandSide, Toke
nType operator, Expression rightHandSide) => new AssignmentExpression.full(leftH
andSide, TokenFactory.token3(operator), rightHandSide); |
| 274 |
| 240 static BinaryExpression binaryExpression(Expression leftOperand, TokenType ope
rator, Expression rightOperand) => new BinaryExpression.full(leftOperand, TokenF
actory.token3(operator), rightOperand); | 275 static BinaryExpression binaryExpression(Expression leftOperand, TokenType ope
rator, Expression rightOperand) => new BinaryExpression.full(leftOperand, TokenF
actory.token3(operator), rightOperand); |
| 276 |
| 241 static Block block(List<Statement> statements) => new Block.full(TokenFactory.
token3(TokenType.OPEN_CURLY_BRACKET), list(statements), TokenFactory.token3(Toke
nType.CLOSE_CURLY_BRACKET)); | 277 static Block block(List<Statement> statements) => new Block.full(TokenFactory.
token3(TokenType.OPEN_CURLY_BRACKET), list(statements), TokenFactory.token3(Toke
nType.CLOSE_CURLY_BRACKET)); |
| 278 |
| 242 static BlockFunctionBody blockFunctionBody(Block block) => new BlockFunctionBo
dy.full(block); | 279 static BlockFunctionBody blockFunctionBody(Block block) => new BlockFunctionBo
dy.full(block); |
| 280 |
| 243 static BlockFunctionBody blockFunctionBody2(List<Statement> statements) => new
BlockFunctionBody.full(block(statements)); | 281 static BlockFunctionBody blockFunctionBody2(List<Statement> statements) => new
BlockFunctionBody.full(block(statements)); |
| 282 |
| 244 static BooleanLiteral booleanLiteral(bool value) => new BooleanLiteral.full(va
lue ? TokenFactory.token(Keyword.TRUE) : TokenFactory.token(Keyword.FALSE), valu
e); | 283 static BooleanLiteral booleanLiteral(bool value) => new BooleanLiteral.full(va
lue ? TokenFactory.token(Keyword.TRUE) : TokenFactory.token(Keyword.FALSE), valu
e); |
| 284 |
| 245 static BreakStatement breakStatement() => new BreakStatement.full(TokenFactory
.token(Keyword.BREAK), null, TokenFactory.token3(TokenType.SEMICOLON)); | 285 static BreakStatement breakStatement() => new BreakStatement.full(TokenFactory
.token(Keyword.BREAK), null, TokenFactory.token3(TokenType.SEMICOLON)); |
| 286 |
| 246 static BreakStatement breakStatement2(String label) => new BreakStatement.full
(TokenFactory.token(Keyword.BREAK), identifier3(label), TokenFactory.token3(Toke
nType.SEMICOLON)); | 287 static BreakStatement breakStatement2(String label) => new BreakStatement.full
(TokenFactory.token(Keyword.BREAK), identifier3(label), TokenFactory.token3(Toke
nType.SEMICOLON)); |
| 288 |
| 247 static IndexExpression cascadedIndexExpression(Expression index) => new IndexE
xpression.forCascade_full(TokenFactory.token3(TokenType.PERIOD_PERIOD), TokenFac
tory.token3(TokenType.OPEN_SQUARE_BRACKET), index, TokenFactory.token3(TokenType
.CLOSE_SQUARE_BRACKET)); | 289 static IndexExpression cascadedIndexExpression(Expression index) => new IndexE
xpression.forCascade_full(TokenFactory.token3(TokenType.PERIOD_PERIOD), TokenFac
tory.token3(TokenType.OPEN_SQUARE_BRACKET), index, TokenFactory.token3(TokenType
.CLOSE_SQUARE_BRACKET)); |
| 290 |
| 248 static MethodInvocation cascadedMethodInvocation(String methodName, List<Expre
ssion> arguments) => new MethodInvocation.full(null, TokenFactory.token3(TokenTy
pe.PERIOD_PERIOD), identifier3(methodName), argumentList(arguments)); | 291 static MethodInvocation cascadedMethodInvocation(String methodName, List<Expre
ssion> arguments) => new MethodInvocation.full(null, TokenFactory.token3(TokenTy
pe.PERIOD_PERIOD), identifier3(methodName), argumentList(arguments)); |
| 292 |
| 249 static PropertyAccess cascadedPropertyAccess(String propertyName) => new Prope
rtyAccess.full(null, TokenFactory.token3(TokenType.PERIOD_PERIOD), identifier3(p
ropertyName)); | 293 static PropertyAccess cascadedPropertyAccess(String propertyName) => new Prope
rtyAccess.full(null, TokenFactory.token3(TokenType.PERIOD_PERIOD), identifier3(p
ropertyName)); |
| 294 |
| 250 static CascadeExpression cascadeExpression(Expression target, List<Expression>
cascadeSections) => new CascadeExpression.full(target, list(cascadeSections)); | 295 static CascadeExpression cascadeExpression(Expression target, List<Expression>
cascadeSections) => new CascadeExpression.full(target, list(cascadeSections)); |
| 296 |
| 251 static CatchClause catchClause(String exceptionParameter, List<Statement> stat
ements) => catchClause5(null, exceptionParameter, null, statements); | 297 static CatchClause catchClause(String exceptionParameter, List<Statement> stat
ements) => catchClause5(null, exceptionParameter, null, statements); |
| 298 |
| 252 static CatchClause catchClause2(String exceptionParameter, String stackTracePa
rameter, List<Statement> statements) => catchClause5(null, exceptionParameter, s
tackTraceParameter, statements); | 299 static CatchClause catchClause2(String exceptionParameter, String stackTracePa
rameter, List<Statement> statements) => catchClause5(null, exceptionParameter, s
tackTraceParameter, statements); |
| 300 |
| 253 static CatchClause catchClause3(TypeName exceptionType, List<Statement> statem
ents) => catchClause5(exceptionType, null, null, statements); | 301 static CatchClause catchClause3(TypeName exceptionType, List<Statement> statem
ents) => catchClause5(exceptionType, null, null, statements); |
| 302 |
| 254 static CatchClause catchClause4(TypeName exceptionType, String exceptionParame
ter, List<Statement> statements) => catchClause5(exceptionType, exceptionParamet
er, null, statements); | 303 static CatchClause catchClause4(TypeName exceptionType, String exceptionParame
ter, List<Statement> statements) => catchClause5(exceptionType, exceptionParamet
er, null, statements); |
| 304 |
| 255 static CatchClause catchClause5(TypeName exceptionType, String exceptionParame
ter, String stackTraceParameter, List<Statement> statements) => new CatchClause.
full(exceptionType == null ? null : TokenFactory.token4(TokenType.IDENTIFIER, "o
n"), exceptionType, exceptionParameter == null ? null : TokenFactory.token(Keywo
rd.CATCH), exceptionParameter == null ? null : TokenFactory.token3(TokenType.OPE
N_PAREN), identifier3(exceptionParameter), stackTraceParameter == null ? null :
TokenFactory.token3(TokenType.COMMA), stackTraceParameter == null ? null : ident
ifier3(stackTraceParameter), exceptionParameter == null ? null : TokenFactory.to
ken3(TokenType.CLOSE_PAREN), block(statements)); | 305 static CatchClause catchClause5(TypeName exceptionType, String exceptionParame
ter, String stackTraceParameter, List<Statement> statements) => new CatchClause.
full(exceptionType == null ? null : TokenFactory.token4(TokenType.IDENTIFIER, "o
n"), exceptionType, exceptionParameter == null ? null : TokenFactory.token(Keywo
rd.CATCH), exceptionParameter == null ? null : TokenFactory.token3(TokenType.OPE
N_PAREN), identifier3(exceptionParameter), stackTraceParameter == null ? null :
TokenFactory.token3(TokenType.COMMA), stackTraceParameter == null ? null : ident
ifier3(stackTraceParameter), exceptionParameter == null ? null : TokenFactory.to
ken3(TokenType.CLOSE_PAREN), block(statements)); |
| 306 |
| 256 static ClassDeclaration classDeclaration(Keyword abstractKeyword, String name,
TypeParameterList typeParameters, ExtendsClause extendsClause, WithClause withC
lause, ImplementsClause implementsClause, List<ClassMember> members) => new Clas
sDeclaration.full(null, null, abstractKeyword == null ? null : TokenFactory.toke
n(abstractKeyword), TokenFactory.token(Keyword.CLASS), identifier3(name), typePa
rameters, extendsClause, withClause, implementsClause, TokenFactory.token3(Token
Type.OPEN_CURLY_BRACKET), list(members), TokenFactory.token3(TokenType.CLOSE_CUR
LY_BRACKET)); | 307 static ClassDeclaration classDeclaration(Keyword abstractKeyword, String name,
TypeParameterList typeParameters, ExtendsClause extendsClause, WithClause withC
lause, ImplementsClause implementsClause, List<ClassMember> members) => new Clas
sDeclaration.full(null, null, abstractKeyword == null ? null : TokenFactory.toke
n(abstractKeyword), TokenFactory.token(Keyword.CLASS), identifier3(name), typePa
rameters, extendsClause, withClause, implementsClause, TokenFactory.token3(Token
Type.OPEN_CURLY_BRACKET), list(members), TokenFactory.token3(TokenType.CLOSE_CUR
LY_BRACKET)); |
| 308 |
| 257 static ClassTypeAlias classTypeAlias(String name, TypeParameterList typeParame
ters, Keyword abstractKeyword, TypeName superclass, WithClause withClause, Imple
mentsClause implementsClause) => new ClassTypeAlias.full(null, null, TokenFactor
y.token(Keyword.CLASS), identifier3(name), typeParameters, TokenFactory.token3(T
okenType.EQ), abstractKeyword == null ? null : TokenFactory.token(abstractKeywor
d), superclass, withClause, implementsClause, TokenFactory.token3(TokenType.SEMI
COLON)); | 309 static ClassTypeAlias classTypeAlias(String name, TypeParameterList typeParame
ters, Keyword abstractKeyword, TypeName superclass, WithClause withClause, Imple
mentsClause implementsClause) => new ClassTypeAlias.full(null, null, TokenFactor
y.token(Keyword.CLASS), identifier3(name), typeParameters, TokenFactory.token3(T
okenType.EQ), abstractKeyword == null ? null : TokenFactory.token(abstractKeywor
d), superclass, withClause, implementsClause, TokenFactory.token3(TokenType.SEMI
COLON)); |
| 310 |
| 258 static CompilationUnit compilationUnit() => compilationUnit8(null, null, null)
; | 311 static CompilationUnit compilationUnit() => compilationUnit8(null, null, null)
; |
| 312 |
| 259 static CompilationUnit compilationUnit2(List<CompilationUnitMember> declaratio
ns) => compilationUnit8(null, null, list(declarations)); | 313 static CompilationUnit compilationUnit2(List<CompilationUnitMember> declaratio
ns) => compilationUnit8(null, null, list(declarations)); |
| 314 |
| 260 static CompilationUnit compilationUnit3(List<Directive> directives) => compila
tionUnit8(null, list(directives), null); | 315 static CompilationUnit compilationUnit3(List<Directive> directives) => compila
tionUnit8(null, list(directives), null); |
| 316 |
| 261 static CompilationUnit compilationUnit4(List<Directive> directives, List<Compi
lationUnitMember> declarations) => compilationUnit8(null, directives, declaratio
ns); | 317 static CompilationUnit compilationUnit4(List<Directive> directives, List<Compi
lationUnitMember> declarations) => compilationUnit8(null, directives, declaratio
ns); |
| 318 |
| 262 static CompilationUnit compilationUnit5(String scriptTag) => compilationUnit8(
scriptTag, null, null); | 319 static CompilationUnit compilationUnit5(String scriptTag) => compilationUnit8(
scriptTag, null, null); |
| 320 |
| 263 static CompilationUnit compilationUnit6(String scriptTag, List<CompilationUnit
Member> declarations) => compilationUnit8(scriptTag, null, list(declarations)); | 321 static CompilationUnit compilationUnit6(String scriptTag, List<CompilationUnit
Member> declarations) => compilationUnit8(scriptTag, null, list(declarations)); |
| 322 |
| 264 static CompilationUnit compilationUnit7(String scriptTag, List<Directive> dire
ctives) => compilationUnit8(scriptTag, list(directives), null); | 323 static CompilationUnit compilationUnit7(String scriptTag, List<Directive> dire
ctives) => compilationUnit8(scriptTag, list(directives), null); |
| 324 |
| 265 static CompilationUnit compilationUnit8(String scriptTag, List<Directive> dire
ctives, List<CompilationUnitMember> declarations) => new CompilationUnit.full(To
kenFactory.token3(TokenType.EOF), scriptTag == null ? null : ASTFactory.scriptTa
g(scriptTag), directives == null ? new List<Directive>() : directives, declarati
ons == null ? new List<CompilationUnitMember>() : declarations, TokenFactory.tok
en3(TokenType.EOF)); | 325 static CompilationUnit compilationUnit8(String scriptTag, List<Directive> dire
ctives, List<CompilationUnitMember> declarations) => new CompilationUnit.full(To
kenFactory.token3(TokenType.EOF), scriptTag == null ? null : ASTFactory.scriptTa
g(scriptTag), directives == null ? new List<Directive>() : directives, declarati
ons == null ? new List<CompilationUnitMember>() : declarations, TokenFactory.tok
en3(TokenType.EOF)); |
| 326 |
| 266 static ConditionalExpression conditionalExpression(Expression condition, Expre
ssion thenExpression, Expression elseExpression) => new ConditionalExpression.fu
ll(condition, TokenFactory.token3(TokenType.QUESTION), thenExpression, TokenFact
ory.token3(TokenType.COLON), elseExpression); | 327 static ConditionalExpression conditionalExpression(Expression condition, Expre
ssion thenExpression, Expression elseExpression) => new ConditionalExpression.fu
ll(condition, TokenFactory.token3(TokenType.QUESTION), thenExpression, TokenFact
ory.token3(TokenType.COLON), elseExpression); |
| 328 |
| 267 static ConstructorDeclaration constructorDeclaration(Identifier returnType, St
ring name, FormalParameterList parameters, List<ConstructorInitializer> initiali
zers) => new ConstructorDeclaration.full(null, null, TokenFactory.token(Keyword.
EXTERNAL), null, null, returnType, name == null ? null : TokenFactory.token3(Tok
enType.PERIOD), name == null ? null : identifier3(name), parameters, initializer
s == null || initializers.isEmpty ? null : TokenFactory.token3(TokenType.PERIOD)
, initializers == null ? new List<ConstructorInitializer>() : initializers, null
, emptyFunctionBody()); | 329 static ConstructorDeclaration constructorDeclaration(Identifier returnType, St
ring name, FormalParameterList parameters, List<ConstructorInitializer> initiali
zers) => new ConstructorDeclaration.full(null, null, TokenFactory.token(Keyword.
EXTERNAL), null, null, returnType, name == null ? null : TokenFactory.token3(Tok
enType.PERIOD), name == null ? null : identifier3(name), parameters, initializer
s == null || initializers.isEmpty ? null : TokenFactory.token3(TokenType.PERIOD)
, initializers == null ? new List<ConstructorInitializer>() : initializers, null
, emptyFunctionBody()); |
| 330 |
| 268 static ConstructorDeclaration constructorDeclaration2(Keyword constKeyword, Ke
yword factoryKeyword, Identifier returnType, String name, FormalParameterList pa
rameters, List<ConstructorInitializer> initializers, FunctionBody body) => new C
onstructorDeclaration.full(null, null, null, constKeyword == null ? null : Token
Factory.token(constKeyword), factoryKeyword == null ? null : TokenFactory.token(
factoryKeyword), returnType, name == null ? null : TokenFactory.token3(TokenType
.PERIOD), name == null ? null : identifier3(name), parameters, initializers == n
ull || initializers.isEmpty ? null : TokenFactory.token3(TokenType.PERIOD), init
ializers == null ? new List<ConstructorInitializer>() : initializers, null, body
); | 331 static ConstructorDeclaration constructorDeclaration2(Keyword constKeyword, Ke
yword factoryKeyword, Identifier returnType, String name, FormalParameterList pa
rameters, List<ConstructorInitializer> initializers, FunctionBody body) => new C
onstructorDeclaration.full(null, null, null, constKeyword == null ? null : Token
Factory.token(constKeyword), factoryKeyword == null ? null : TokenFactory.token(
factoryKeyword), returnType, name == null ? null : TokenFactory.token3(TokenType
.PERIOD), name == null ? null : identifier3(name), parameters, initializers == n
ull || initializers.isEmpty ? null : TokenFactory.token3(TokenType.PERIOD), init
ializers == null ? new List<ConstructorInitializer>() : initializers, null, body
); |
| 332 |
| 269 static ConstructorFieldInitializer constructorFieldInitializer(bool prefixedWi
thThis, String fieldName, Expression expression) => new ConstructorFieldInitiali
zer.full(prefixedWithThis ? TokenFactory.token(Keyword.THIS) : null, prefixedWit
hThis ? TokenFactory.token3(TokenType.PERIOD) : null, identifier3(fieldName), To
kenFactory.token3(TokenType.EQ), expression); | 333 static ConstructorFieldInitializer constructorFieldInitializer(bool prefixedWi
thThis, String fieldName, Expression expression) => new ConstructorFieldInitiali
zer.full(prefixedWithThis ? TokenFactory.token(Keyword.THIS) : null, prefixedWit
hThis ? TokenFactory.token3(TokenType.PERIOD) : null, identifier3(fieldName), To
kenFactory.token3(TokenType.EQ), expression); |
| 334 |
| 270 static ConstructorName constructorName(TypeName type, String name) => new Cons
tructorName.full(type, name == null ? null : TokenFactory.token3(TokenType.PERIO
D), name == null ? null : identifier3(name)); | 335 static ConstructorName constructorName(TypeName type, String name) => new Cons
tructorName.full(type, name == null ? null : TokenFactory.token3(TokenType.PERIO
D), name == null ? null : identifier3(name)); |
| 336 |
| 271 static ContinueStatement continueStatement() => new ContinueStatement.full(Tok
enFactory.token(Keyword.CONTINUE), null, TokenFactory.token3(TokenType.SEMICOLON
)); | 337 static ContinueStatement continueStatement() => new ContinueStatement.full(Tok
enFactory.token(Keyword.CONTINUE), null, TokenFactory.token3(TokenType.SEMICOLON
)); |
| 338 |
| 272 static ContinueStatement continueStatement2(String label) => new ContinueState
ment.full(TokenFactory.token(Keyword.CONTINUE), identifier3(label), TokenFactory
.token3(TokenType.SEMICOLON)); | 339 static ContinueStatement continueStatement2(String label) => new ContinueState
ment.full(TokenFactory.token(Keyword.CONTINUE), identifier3(label), TokenFactory
.token3(TokenType.SEMICOLON)); |
| 340 |
| 273 static DeclaredIdentifier declaredIdentifier(Keyword keyword, String identifie
r) => declaredIdentifier2(keyword, null, identifier); | 341 static DeclaredIdentifier declaredIdentifier(Keyword keyword, String identifie
r) => declaredIdentifier2(keyword, null, identifier); |
| 342 |
| 274 static DeclaredIdentifier declaredIdentifier2(Keyword keyword, TypeName type,
String identifier) => new DeclaredIdentifier.full(null, null, keyword == null ?
null : TokenFactory.token(keyword), type, identifier3(identifier)); | 343 static DeclaredIdentifier declaredIdentifier2(Keyword keyword, TypeName type,
String identifier) => new DeclaredIdentifier.full(null, null, keyword == null ?
null : TokenFactory.token(keyword), type, identifier3(identifier)); |
| 344 |
| 275 static DeclaredIdentifier declaredIdentifier3(String identifier) => declaredId
entifier2(null, null, identifier); | 345 static DeclaredIdentifier declaredIdentifier3(String identifier) => declaredId
entifier2(null, null, identifier); |
| 346 |
| 276 static DeclaredIdentifier declaredIdentifier4(TypeName type, String identifier
) => declaredIdentifier2(null, type, identifier); | 347 static DeclaredIdentifier declaredIdentifier4(TypeName type, String identifier
) => declaredIdentifier2(null, type, identifier); |
| 348 |
| 277 static DoStatement doStatement(Statement body, Expression condition) => new Do
Statement.full(TokenFactory.token(Keyword.DO), body, TokenFactory.token(Keyword.
WHILE), TokenFactory.token3(TokenType.OPEN_PAREN), condition, TokenFactory.token
3(TokenType.CLOSE_PAREN), TokenFactory.token3(TokenType.SEMICOLON)); | 349 static DoStatement doStatement(Statement body, Expression condition) => new Do
Statement.full(TokenFactory.token(Keyword.DO), body, TokenFactory.token(Keyword.
WHILE), TokenFactory.token3(TokenType.OPEN_PAREN), condition, TokenFactory.token
3(TokenType.CLOSE_PAREN), TokenFactory.token3(TokenType.SEMICOLON)); |
| 350 |
| 278 static DoubleLiteral doubleLiteral(double value) => new DoubleLiteral.full(Tok
enFactory.token2(value.toString()), value); | 351 static DoubleLiteral doubleLiteral(double value) => new DoubleLiteral.full(Tok
enFactory.token2(value.toString()), value); |
| 352 |
| 279 static EmptyFunctionBody emptyFunctionBody() => new EmptyFunctionBody.full(Tok
enFactory.token3(TokenType.SEMICOLON)); | 353 static EmptyFunctionBody emptyFunctionBody() => new EmptyFunctionBody.full(Tok
enFactory.token3(TokenType.SEMICOLON)); |
| 354 |
| 280 static EmptyStatement emptyStatement() => new EmptyStatement.full(TokenFactory
.token3(TokenType.SEMICOLON)); | 355 static EmptyStatement emptyStatement() => new EmptyStatement.full(TokenFactory
.token3(TokenType.SEMICOLON)); |
| 356 |
| 281 static ExportDirective exportDirective(List<Annotation> metadata, String uri,
List<Combinator> combinators) => new ExportDirective.full(null, metadata, TokenF
actory.token(Keyword.EXPORT), string2(uri), list(combinators), TokenFactory.toke
n3(TokenType.SEMICOLON)); | 357 static ExportDirective exportDirective(List<Annotation> metadata, String uri,
List<Combinator> combinators) => new ExportDirective.full(null, metadata, TokenF
actory.token(Keyword.EXPORT), string2(uri), list(combinators), TokenFactory.toke
n3(TokenType.SEMICOLON)); |
| 358 |
| 282 static ExportDirective exportDirective2(String uri, List<Combinator> combinato
rs) => exportDirective(new List<Annotation>(), uri, combinators); | 359 static ExportDirective exportDirective2(String uri, List<Combinator> combinato
rs) => exportDirective(new List<Annotation>(), uri, combinators); |
| 360 |
| 283 static ExpressionFunctionBody expressionFunctionBody(Expression expression) =>
new ExpressionFunctionBody.full(TokenFactory.token3(TokenType.FUNCTION), expres
sion, TokenFactory.token3(TokenType.SEMICOLON)); | 361 static ExpressionFunctionBody expressionFunctionBody(Expression expression) =>
new ExpressionFunctionBody.full(TokenFactory.token3(TokenType.FUNCTION), expres
sion, TokenFactory.token3(TokenType.SEMICOLON)); |
| 362 |
| 284 static ExpressionStatement expressionStatement(Expression expression) => new E
xpressionStatement.full(expression, TokenFactory.token3(TokenType.SEMICOLON)); | 363 static ExpressionStatement expressionStatement(Expression expression) => new E
xpressionStatement.full(expression, TokenFactory.token3(TokenType.SEMICOLON)); |
| 364 |
| 285 static ExtendsClause extendsClause(TypeName type) => new ExtendsClause.full(To
kenFactory.token(Keyword.EXTENDS), type); | 365 static ExtendsClause extendsClause(TypeName type) => new ExtendsClause.full(To
kenFactory.token(Keyword.EXTENDS), type); |
| 366 |
| 286 static FieldDeclaration fieldDeclaration(bool isStatic, Keyword keyword, TypeN
ame type, List<VariableDeclaration> variables) => new FieldDeclaration.full(null
, null, isStatic ? TokenFactory.token(Keyword.STATIC) : null, variableDeclaratio
nList(keyword, type, variables), TokenFactory.token3(TokenType.SEMICOLON)); | 367 static FieldDeclaration fieldDeclaration(bool isStatic, Keyword keyword, TypeN
ame type, List<VariableDeclaration> variables) => new FieldDeclaration.full(null
, null, isStatic ? TokenFactory.token(Keyword.STATIC) : null, variableDeclaratio
nList(keyword, type, variables), TokenFactory.token3(TokenType.SEMICOLON)); |
| 368 |
| 287 static FieldDeclaration fieldDeclaration2(bool isStatic, Keyword keyword, List
<VariableDeclaration> variables) => fieldDeclaration(isStatic, keyword, null, va
riables); | 369 static FieldDeclaration fieldDeclaration2(bool isStatic, Keyword keyword, List
<VariableDeclaration> variables) => fieldDeclaration(isStatic, keyword, null, va
riables); |
| 370 |
| 288 static FieldFormalParameter fieldFormalParameter(Keyword keyword, TypeName typ
e, String identifier) => new FieldFormalParameter.full(null, null, keyword == nu
ll ? null : TokenFactory.token(keyword), type, TokenFactory.token(Keyword.THIS),
TokenFactory.token3(TokenType.PERIOD), identifier3(identifier), null); | 371 static FieldFormalParameter fieldFormalParameter(Keyword keyword, TypeName typ
e, String identifier) => new FieldFormalParameter.full(null, null, keyword == nu
ll ? null : TokenFactory.token(keyword), type, TokenFactory.token(Keyword.THIS),
TokenFactory.token3(TokenType.PERIOD), identifier3(identifier), null); |
| 372 |
| 289 static FieldFormalParameter fieldFormalParameter2(Keyword keyword, TypeName ty
pe, String identifier, FormalParameterList parameterList) => new FieldFormalPara
meter.full(null, null, keyword == null ? null : TokenFactory.token(keyword), typ
e, TokenFactory.token(Keyword.THIS), TokenFactory.token3(TokenType.PERIOD), iden
tifier3(identifier), parameterList); | 373 static FieldFormalParameter fieldFormalParameter2(Keyword keyword, TypeName ty
pe, String identifier, FormalParameterList parameterList) => new FieldFormalPara
meter.full(null, null, keyword == null ? null : TokenFactory.token(keyword), typ
e, TokenFactory.token(Keyword.THIS), TokenFactory.token3(TokenType.PERIOD), iden
tifier3(identifier), parameterList); |
| 374 |
| 290 static FieldFormalParameter fieldFormalParameter3(String identifier) => fieldF
ormalParameter(null, null, identifier); | 375 static FieldFormalParameter fieldFormalParameter3(String identifier) => fieldF
ormalParameter(null, null, identifier); |
| 376 |
| 291 static ForEachStatement forEachStatement(DeclaredIdentifier loopVariable, Expr
ession iterator, Statement body) => new ForEachStatement.con1_full(TokenFactory.
token(Keyword.FOR), TokenFactory.token3(TokenType.OPEN_PAREN), loopVariable, Tok
enFactory.token(Keyword.IN), iterator, TokenFactory.token3(TokenType.CLOSE_PAREN
), body); | 377 static ForEachStatement forEachStatement(DeclaredIdentifier loopVariable, Expr
ession iterator, Statement body) => new ForEachStatement.con1_full(TokenFactory.
token(Keyword.FOR), TokenFactory.token3(TokenType.OPEN_PAREN), loopVariable, Tok
enFactory.token(Keyword.IN), iterator, TokenFactory.token3(TokenType.CLOSE_PAREN
), body); |
| 378 |
| 292 static FormalParameterList formalParameterList(List<FormalParameter> parameter
s) => new FormalParameterList.full(TokenFactory.token3(TokenType.OPEN_PAREN), li
st(parameters), null, null, TokenFactory.token3(TokenType.CLOSE_PAREN)); | 379 static FormalParameterList formalParameterList(List<FormalParameter> parameter
s) => new FormalParameterList.full(TokenFactory.token3(TokenType.OPEN_PAREN), li
st(parameters), null, null, TokenFactory.token3(TokenType.CLOSE_PAREN)); |
| 380 |
| 293 static ForStatement forStatement(Expression initialization, Expression conditi
on, List<Expression> updaters, Statement body) => new ForStatement.full(TokenFac
tory.token(Keyword.FOR), TokenFactory.token3(TokenType.OPEN_PAREN), null, initia
lization, TokenFactory.token3(TokenType.SEMICOLON), condition, TokenFactory.toke
n3(TokenType.SEMICOLON), updaters, TokenFactory.token3(TokenType.CLOSE_PAREN), b
ody); | 381 static ForStatement forStatement(Expression initialization, Expression conditi
on, List<Expression> updaters, Statement body) => new ForStatement.full(TokenFac
tory.token(Keyword.FOR), TokenFactory.token3(TokenType.OPEN_PAREN), null, initia
lization, TokenFactory.token3(TokenType.SEMICOLON), condition, TokenFactory.toke
n3(TokenType.SEMICOLON), updaters, TokenFactory.token3(TokenType.CLOSE_PAREN), b
ody); |
| 382 |
| 294 static ForStatement forStatement2(VariableDeclarationList variableList, Expres
sion condition, List<Expression> updaters, Statement body) => new ForStatement.f
ull(TokenFactory.token(Keyword.FOR), TokenFactory.token3(TokenType.OPEN_PAREN),
variableList, null, TokenFactory.token3(TokenType.SEMICOLON), condition, TokenFa
ctory.token3(TokenType.SEMICOLON), updaters, TokenFactory.token3(TokenType.CLOSE
_PAREN), body); | 383 static ForStatement forStatement2(VariableDeclarationList variableList, Expres
sion condition, List<Expression> updaters, Statement body) => new ForStatement.f
ull(TokenFactory.token(Keyword.FOR), TokenFactory.token3(TokenType.OPEN_PAREN),
variableList, null, TokenFactory.token3(TokenType.SEMICOLON), condition, TokenFa
ctory.token3(TokenType.SEMICOLON), updaters, TokenFactory.token3(TokenType.CLOSE
_PAREN), body); |
| 384 |
| 295 static FunctionDeclaration functionDeclaration(TypeName type, Keyword keyword,
String name, FunctionExpression functionExpression) => new FunctionDeclaration.
full(null, null, null, type, keyword == null ? null : TokenFactory.token(keyword
), identifier3(name), functionExpression); | 385 static FunctionDeclaration functionDeclaration(TypeName type, Keyword keyword,
String name, FunctionExpression functionExpression) => new FunctionDeclaration.
full(null, null, null, type, keyword == null ? null : TokenFactory.token(keyword
), identifier3(name), functionExpression); |
| 386 |
| 296 static FunctionDeclarationStatement functionDeclarationStatement(TypeName type
, Keyword keyword, String name, FunctionExpression functionExpression) => new Fu
nctionDeclarationStatement.full(functionDeclaration(type, keyword, name, functio
nExpression)); | 387 static FunctionDeclarationStatement functionDeclarationStatement(TypeName type
, Keyword keyword, String name, FunctionExpression functionExpression) => new Fu
nctionDeclarationStatement.full(functionDeclaration(type, keyword, name, functio
nExpression)); |
| 388 |
| 297 static FunctionExpression functionExpression() => new FunctionExpression.full(
formalParameterList([]), blockFunctionBody2([])); | 389 static FunctionExpression functionExpression() => new FunctionExpression.full(
formalParameterList([]), blockFunctionBody2([])); |
| 390 |
| 298 static FunctionExpression functionExpression2(FormalParameterList parameters,
FunctionBody body) => new FunctionExpression.full(parameters, body); | 391 static FunctionExpression functionExpression2(FormalParameterList parameters,
FunctionBody body) => new FunctionExpression.full(parameters, body); |
| 392 |
| 299 static FunctionExpressionInvocation functionExpressionInvocation(Expression fu
nction, List<Expression> arguments) => new FunctionExpressionInvocation.full(fun
ction, argumentList(arguments)); | 393 static FunctionExpressionInvocation functionExpressionInvocation(Expression fu
nction, List<Expression> arguments) => new FunctionExpressionInvocation.full(fun
ction, argumentList(arguments)); |
| 394 |
| 300 static FunctionTypedFormalParameter functionTypedFormalParameter(TypeName retu
rnType, String identifier, List<FormalParameter> parameters) => new FunctionType
dFormalParameter.full(null, null, returnType, identifier3(identifier), formalPar
ameterList(parameters)); | 395 static FunctionTypedFormalParameter functionTypedFormalParameter(TypeName retu
rnType, String identifier, List<FormalParameter> parameters) => new FunctionType
dFormalParameter.full(null, null, returnType, identifier3(identifier), formalPar
ameterList(parameters)); |
| 396 |
| 301 static HideCombinator hideCombinator(List<SimpleIdentifier> identifiers) => ne
w HideCombinator.full(TokenFactory.token2("hide"), list(identifiers)); | 397 static HideCombinator hideCombinator(List<SimpleIdentifier> identifiers) => ne
w HideCombinator.full(TokenFactory.token2("hide"), list(identifiers)); |
| 398 |
| 302 static HideCombinator hideCombinator2(List<String> identifiers) { | 399 static HideCombinator hideCombinator2(List<String> identifiers) { |
| 303 List<SimpleIdentifier> identifierList = new List<SimpleIdentifier>(); | 400 List<SimpleIdentifier> identifierList = new List<SimpleIdentifier>(); |
| 304 for (String identifier in identifiers) { | 401 for (String identifier in identifiers) { |
| 305 identifierList.add(identifier3(identifier)); | 402 identifierList.add(identifier3(identifier)); |
| 306 } | 403 } |
| 307 return new HideCombinator.full(TokenFactory.token2("hide"), identifierList); | 404 return new HideCombinator.full(TokenFactory.token2("hide"), identifierList); |
| 308 } | 405 } |
| 406 |
| 309 static PrefixedIdentifier identifier(SimpleIdentifier prefix, SimpleIdentifier
identifier) => new PrefixedIdentifier.full(prefix, TokenFactory.token3(TokenTyp
e.PERIOD), identifier); | 407 static PrefixedIdentifier identifier(SimpleIdentifier prefix, SimpleIdentifier
identifier) => new PrefixedIdentifier.full(prefix, TokenFactory.token3(TokenTyp
e.PERIOD), identifier); |
| 408 |
| 310 static SimpleIdentifier identifier3(String lexeme) => new SimpleIdentifier.ful
l(TokenFactory.token4(TokenType.IDENTIFIER, lexeme)); | 409 static SimpleIdentifier identifier3(String lexeme) => new SimpleIdentifier.ful
l(TokenFactory.token4(TokenType.IDENTIFIER, lexeme)); |
| 410 |
| 311 static PrefixedIdentifier identifier4(String prefix, SimpleIdentifier identifi
er) => new PrefixedIdentifier.full(identifier3(prefix), TokenFactory.token3(Toke
nType.PERIOD), identifier); | 411 static PrefixedIdentifier identifier4(String prefix, SimpleIdentifier identifi
er) => new PrefixedIdentifier.full(identifier3(prefix), TokenFactory.token3(Toke
nType.PERIOD), identifier); |
| 412 |
| 312 static PrefixedIdentifier identifier5(String prefix, String identifier) => new
PrefixedIdentifier.full(identifier3(prefix), TokenFactory.token3(TokenType.PERI
OD), identifier3(identifier)); | 413 static PrefixedIdentifier identifier5(String prefix, String identifier) => new
PrefixedIdentifier.full(identifier3(prefix), TokenFactory.token3(TokenType.PERI
OD), identifier3(identifier)); |
| 414 |
| 313 static IfStatement ifStatement(Expression condition, Statement thenStatement)
=> ifStatement2(condition, thenStatement, null); | 415 static IfStatement ifStatement(Expression condition, Statement thenStatement)
=> ifStatement2(condition, thenStatement, null); |
| 416 |
| 314 static IfStatement ifStatement2(Expression condition, Statement thenStatement,
Statement elseStatement) => new IfStatement.full(TokenFactory.token(Keyword.IF)
, TokenFactory.token3(TokenType.OPEN_PAREN), condition, TokenFactory.token3(Toke
nType.CLOSE_PAREN), thenStatement, elseStatement == null ? null : TokenFactory.t
oken(Keyword.ELSE), elseStatement); | 417 static IfStatement ifStatement2(Expression condition, Statement thenStatement,
Statement elseStatement) => new IfStatement.full(TokenFactory.token(Keyword.IF)
, TokenFactory.token3(TokenType.OPEN_PAREN), condition, TokenFactory.token3(Toke
nType.CLOSE_PAREN), thenStatement, elseStatement == null ? null : TokenFactory.t
oken(Keyword.ELSE), elseStatement); |
| 418 |
| 315 static ImplementsClause implementsClause(List<TypeName> types) => new Implemen
tsClause.full(TokenFactory.token(Keyword.IMPLEMENTS), list(types)); | 419 static ImplementsClause implementsClause(List<TypeName> types) => new Implemen
tsClause.full(TokenFactory.token(Keyword.IMPLEMENTS), list(types)); |
| 420 |
| 316 static ImportDirective importDirective(List<Annotation> metadata, String uri,
String prefix, List<Combinator> combinators) => new ImportDirective.full(null, m
etadata, TokenFactory.token(Keyword.IMPORT), string2(uri), prefix == null ? null
: TokenFactory.token(Keyword.AS), prefix == null ? null : identifier3(prefix),
list(combinators), TokenFactory.token3(TokenType.SEMICOLON)); | 421 static ImportDirective importDirective(List<Annotation> metadata, String uri,
String prefix, List<Combinator> combinators) => new ImportDirective.full(null, m
etadata, TokenFactory.token(Keyword.IMPORT), string2(uri), prefix == null ? null
: TokenFactory.token(Keyword.AS), prefix == null ? null : identifier3(prefix),
list(combinators), TokenFactory.token3(TokenType.SEMICOLON)); |
| 422 |
| 317 static ImportDirective importDirective2(String uri, String prefix, List<Combin
ator> combinators) => importDirective(new List<Annotation>(), uri, prefix, combi
nators); | 423 static ImportDirective importDirective2(String uri, String prefix, List<Combin
ator> combinators) => importDirective(new List<Annotation>(), uri, prefix, combi
nators); |
| 424 |
| 318 static IndexExpression indexExpression(Expression array, Expression index) =>
new IndexExpression.forTarget_full(array, TokenFactory.token3(TokenType.OPEN_SQU
ARE_BRACKET), index, TokenFactory.token3(TokenType.CLOSE_SQUARE_BRACKET)); | 425 static IndexExpression indexExpression(Expression array, Expression index) =>
new IndexExpression.forTarget_full(array, TokenFactory.token3(TokenType.OPEN_SQU
ARE_BRACKET), index, TokenFactory.token3(TokenType.CLOSE_SQUARE_BRACKET)); |
| 426 |
| 319 static InstanceCreationExpression instanceCreationExpression(Keyword keyword,
ConstructorName name, List<Expression> arguments) => new InstanceCreationExpress
ion.full(keyword == null ? null : TokenFactory.token(keyword), name, argumentLis
t(arguments)); | 427 static InstanceCreationExpression instanceCreationExpression(Keyword keyword,
ConstructorName name, List<Expression> arguments) => new InstanceCreationExpress
ion.full(keyword == null ? null : TokenFactory.token(keyword), name, argumentLis
t(arguments)); |
| 428 |
| 320 static InstanceCreationExpression instanceCreationExpression2(Keyword keyword,
TypeName type, List<Expression> arguments) => instanceCreationExpression3(keywo
rd, type, null, arguments); | 429 static InstanceCreationExpression instanceCreationExpression2(Keyword keyword,
TypeName type, List<Expression> arguments) => instanceCreationExpression3(keywo
rd, type, null, arguments); |
| 430 |
| 321 static InstanceCreationExpression instanceCreationExpression3(Keyword keyword,
TypeName type, String identifier, List<Expression> arguments) => instanceCreati
onExpression(keyword, new ConstructorName.full(type, identifier == null ? null :
TokenFactory.token3(TokenType.PERIOD), identifier == null ? null : identifier3(
identifier)), arguments); | 431 static InstanceCreationExpression instanceCreationExpression3(Keyword keyword,
TypeName type, String identifier, List<Expression> arguments) => instanceCreati
onExpression(keyword, new ConstructorName.full(type, identifier == null ? null :
TokenFactory.token3(TokenType.PERIOD), identifier == null ? null : identifier3(
identifier)), arguments); |
| 432 |
| 322 static IntegerLiteral integer(int value) => new IntegerLiteral.full(TokenFacto
ry.token4(TokenType.INT, value.toString()), value); | 433 static IntegerLiteral integer(int value) => new IntegerLiteral.full(TokenFacto
ry.token4(TokenType.INT, value.toString()), value); |
| 434 |
| 323 static InterpolationExpression interpolationExpression(Expression expression)
=> new InterpolationExpression.full(TokenFactory.token3(TokenType.STRING_INTERPO
LATION_EXPRESSION), expression, TokenFactory.token3(TokenType.CLOSE_CURLY_BRACKE
T)); | 435 static InterpolationExpression interpolationExpression(Expression expression)
=> new InterpolationExpression.full(TokenFactory.token3(TokenType.STRING_INTERPO
LATION_EXPRESSION), expression, TokenFactory.token3(TokenType.CLOSE_CURLY_BRACKE
T)); |
| 436 |
| 324 static InterpolationExpression interpolationExpression2(String identifier) =>
new InterpolationExpression.full(TokenFactory.token3(TokenType.STRING_INTERPOLAT
ION_IDENTIFIER), identifier3(identifier), null); | 437 static InterpolationExpression interpolationExpression2(String identifier) =>
new InterpolationExpression.full(TokenFactory.token3(TokenType.STRING_INTERPOLAT
ION_IDENTIFIER), identifier3(identifier), null); |
| 438 |
| 325 static InterpolationString interpolationString(String contents, String value)
=> new InterpolationString.full(TokenFactory.token2(contents), value); | 439 static InterpolationString interpolationString(String contents, String value)
=> new InterpolationString.full(TokenFactory.token2(contents), value); |
| 440 |
| 326 static IsExpression isExpression(Expression expression, bool negated, TypeName
type) => new IsExpression.full(expression, TokenFactory.token(Keyword.IS), nega
ted ? TokenFactory.token3(TokenType.BANG) : null, type); | 441 static IsExpression isExpression(Expression expression, bool negated, TypeName
type) => new IsExpression.full(expression, TokenFactory.token(Keyword.IS), nega
ted ? TokenFactory.token3(TokenType.BANG) : null, type); |
| 442 |
| 327 static Label label(SimpleIdentifier label) => new Label.full(label, TokenFacto
ry.token3(TokenType.COLON)); | 443 static Label label(SimpleIdentifier label) => new Label.full(label, TokenFacto
ry.token3(TokenType.COLON)); |
| 444 |
| 328 static Label label2(String label) => ASTFactory.label(identifier3(label)); | 445 static Label label2(String label) => ASTFactory.label(identifier3(label)); |
| 446 |
| 329 static LabeledStatement labeledStatement(List<Label> labels, Statement stateme
nt) => new LabeledStatement.full(labels, statement); | 447 static LabeledStatement labeledStatement(List<Label> labels, Statement stateme
nt) => new LabeledStatement.full(labels, statement); |
| 448 |
| 330 static LibraryDirective libraryDirective(List<Annotation> metadata, LibraryIde
ntifier libraryName) => new LibraryDirective.full(null, metadata, TokenFactory.t
oken(Keyword.LIBRARY), libraryName, TokenFactory.token3(TokenType.SEMICOLON)); | 449 static LibraryDirective libraryDirective(List<Annotation> metadata, LibraryIde
ntifier libraryName) => new LibraryDirective.full(null, metadata, TokenFactory.t
oken(Keyword.LIBRARY), libraryName, TokenFactory.token3(TokenType.SEMICOLON)); |
| 450 |
| 331 static LibraryDirective libraryDirective2(String libraryName) => libraryDirect
ive(new List<Annotation>(), libraryIdentifier2([libraryName])); | 451 static LibraryDirective libraryDirective2(String libraryName) => libraryDirect
ive(new List<Annotation>(), libraryIdentifier2([libraryName])); |
| 452 |
| 332 static LibraryIdentifier libraryIdentifier(List<SimpleIdentifier> components)
=> new LibraryIdentifier.full(list(components)); | 453 static LibraryIdentifier libraryIdentifier(List<SimpleIdentifier> components)
=> new LibraryIdentifier.full(list(components)); |
| 454 |
| 333 static LibraryIdentifier libraryIdentifier2(List<String> components) { | 455 static LibraryIdentifier libraryIdentifier2(List<String> components) { |
| 334 List<SimpleIdentifier> componentList = new List<SimpleIdentifier>(); | 456 List<SimpleIdentifier> componentList = new List<SimpleIdentifier>(); |
| 335 for (String component in components) { | 457 for (String component in components) { |
| 336 componentList.add(identifier3(component)); | 458 componentList.add(identifier3(component)); |
| 337 } | 459 } |
| 338 return new LibraryIdentifier.full(componentList); | 460 return new LibraryIdentifier.full(componentList); |
| 339 } | 461 } |
| 462 |
| 340 static List list(List<Object> elements) { | 463 static List list(List<Object> elements) { |
| 341 List elementList = new List(); | 464 List elementList = new List(); |
| 342 for (Object element in elements) { | 465 for (Object element in elements) { |
| 343 elementList.add(element); | 466 elementList.add(element); |
| 344 } | 467 } |
| 345 return elementList; | 468 return elementList; |
| 346 } | 469 } |
| 470 |
| 347 static ListLiteral listLiteral(List<Expression> elements) => listLiteral2(null
, null, elements); | 471 static ListLiteral listLiteral(List<Expression> elements) => listLiteral2(null
, null, elements); |
| 472 |
| 348 static ListLiteral listLiteral2(Keyword keyword, TypeArgumentList typeArgument
s, List<Expression> elements) => new ListLiteral.full(keyword == null ? null : T
okenFactory.token(keyword), null, TokenFactory.token3(TokenType.OPEN_SQUARE_BRAC
KET), list(elements), TokenFactory.token3(TokenType.CLOSE_SQUARE_BRACKET)); | 473 static ListLiteral listLiteral2(Keyword keyword, TypeArgumentList typeArgument
s, List<Expression> elements) => new ListLiteral.full(keyword == null ? null : T
okenFactory.token(keyword), null, TokenFactory.token3(TokenType.OPEN_SQUARE_BRAC
KET), list(elements), TokenFactory.token3(TokenType.CLOSE_SQUARE_BRACKET)); |
| 474 |
| 349 static MapLiteral mapLiteral(Keyword keyword, TypeArgumentList typeArguments,
List<MapLiteralEntry> entries) => new MapLiteral.full(keyword == null ? null : T
okenFactory.token(keyword), typeArguments, TokenFactory.token3(TokenType.OPEN_CU
RLY_BRACKET), list(entries), TokenFactory.token3(TokenType.CLOSE_CURLY_BRACKET))
; | 475 static MapLiteral mapLiteral(Keyword keyword, TypeArgumentList typeArguments,
List<MapLiteralEntry> entries) => new MapLiteral.full(keyword == null ? null : T
okenFactory.token(keyword), typeArguments, TokenFactory.token3(TokenType.OPEN_CU
RLY_BRACKET), list(entries), TokenFactory.token3(TokenType.CLOSE_CURLY_BRACKET))
; |
| 476 |
| 350 static MapLiteral mapLiteral2(List<MapLiteralEntry> entries) => mapLiteral(nul
l, null, entries); | 477 static MapLiteral mapLiteral2(List<MapLiteralEntry> entries) => mapLiteral(nul
l, null, entries); |
| 478 |
| 351 static MapLiteralEntry mapLiteralEntry(String key, Expression value) => new Ma
pLiteralEntry.full(string2(key), TokenFactory.token3(TokenType.COLON), value); | 479 static MapLiteralEntry mapLiteralEntry(String key, Expression value) => new Ma
pLiteralEntry.full(string2(key), TokenFactory.token3(TokenType.COLON), value); |
| 480 |
| 352 static MethodDeclaration methodDeclaration(Keyword modifier, TypeName returnTy
pe, Keyword property, Keyword operator, SimpleIdentifier name, FormalParameterLi
st parameters) => new MethodDeclaration.full(null, null, TokenFactory.token(Keyw
ord.EXTERNAL), modifier == null ? null : TokenFactory.token(modifier), returnTyp
e, property == null ? null : TokenFactory.token(property), operator == null ? nu
ll : TokenFactory.token(operator), name, parameters, emptyFunctionBody()); | 481 static MethodDeclaration methodDeclaration(Keyword modifier, TypeName returnTy
pe, Keyword property, Keyword operator, SimpleIdentifier name, FormalParameterLi
st parameters) => new MethodDeclaration.full(null, null, TokenFactory.token(Keyw
ord.EXTERNAL), modifier == null ? null : TokenFactory.token(modifier), returnTyp
e, property == null ? null : TokenFactory.token(property), operator == null ? nu
ll : TokenFactory.token(operator), name, parameters, emptyFunctionBody()); |
| 482 |
| 353 static MethodDeclaration methodDeclaration2(Keyword modifier, TypeName returnT
ype, Keyword property, Keyword operator, SimpleIdentifier name, FormalParameterL
ist parameters, FunctionBody body) => new MethodDeclaration.full(null, null, nul
l, modifier == null ? null : TokenFactory.token(modifier), returnType, property
== null ? null : TokenFactory.token(property), operator == null ? null : TokenFa
ctory.token(operator), name, parameters, body); | 483 static MethodDeclaration methodDeclaration2(Keyword modifier, TypeName returnT
ype, Keyword property, Keyword operator, SimpleIdentifier name, FormalParameterL
ist parameters, FunctionBody body) => new MethodDeclaration.full(null, null, nul
l, modifier == null ? null : TokenFactory.token(modifier), returnType, property
== null ? null : TokenFactory.token(property), operator == null ? null : TokenFa
ctory.token(operator), name, parameters, body); |
| 484 |
| 354 static MethodInvocation methodInvocation(Expression target, String methodName,
List<Expression> arguments) => new MethodInvocation.full(target, target == null
? null : TokenFactory.token3(TokenType.PERIOD), identifier3(methodName), argume
ntList(arguments)); | 485 static MethodInvocation methodInvocation(Expression target, String methodName,
List<Expression> arguments) => new MethodInvocation.full(target, target == null
? null : TokenFactory.token3(TokenType.PERIOD), identifier3(methodName), argume
ntList(arguments)); |
| 486 |
| 355 static MethodInvocation methodInvocation2(String methodName, List<Expression>
arguments) => methodInvocation(null, methodName, arguments); | 487 static MethodInvocation methodInvocation2(String methodName, List<Expression>
arguments) => methodInvocation(null, methodName, arguments); |
| 488 |
| 356 static NamedExpression namedExpression(Label label, Expression expression) =>
new NamedExpression.full(label, expression); | 489 static NamedExpression namedExpression(Label label, Expression expression) =>
new NamedExpression.full(label, expression); |
| 490 |
| 357 static NamedExpression namedExpression2(String label, Expression expression) =
> namedExpression(label2(label), expression); | 491 static NamedExpression namedExpression2(String label, Expression expression) =
> namedExpression(label2(label), expression); |
| 492 |
| 358 static DefaultFormalParameter namedFormalParameter(NormalFormalParameter param
eter, Expression expression) => new DefaultFormalParameter.full(parameter, Param
eterKind.NAMED, expression == null ? null : TokenFactory.token3(TokenType.COLON)
, expression); | 493 static DefaultFormalParameter namedFormalParameter(NormalFormalParameter param
eter, Expression expression) => new DefaultFormalParameter.full(parameter, Param
eterKind.NAMED, expression == null ? null : TokenFactory.token3(TokenType.COLON)
, expression); |
| 494 |
| 359 static NativeClause nativeClause(String nativeCode) => new NativeClause.full(T
okenFactory.token2("native"), string2(nativeCode)); | 495 static NativeClause nativeClause(String nativeCode) => new NativeClause.full(T
okenFactory.token2("native"), string2(nativeCode)); |
| 496 |
| 360 static NativeFunctionBody nativeFunctionBody(String nativeMethodName) => new N
ativeFunctionBody.full(TokenFactory.token2("native"), string2(nativeMethodName),
TokenFactory.token3(TokenType.SEMICOLON)); | 497 static NativeFunctionBody nativeFunctionBody(String nativeMethodName) => new N
ativeFunctionBody.full(TokenFactory.token2("native"), string2(nativeMethodName),
TokenFactory.token3(TokenType.SEMICOLON)); |
| 498 |
| 361 static NullLiteral nullLiteral() => new NullLiteral.full(TokenFactory.token(Ke
yword.NULL)); | 499 static NullLiteral nullLiteral() => new NullLiteral.full(TokenFactory.token(Ke
yword.NULL)); |
| 500 |
| 362 static ParenthesizedExpression parenthesizedExpression(Expression expression)
=> new ParenthesizedExpression.full(TokenFactory.token3(TokenType.OPEN_PAREN), e
xpression, TokenFactory.token3(TokenType.CLOSE_PAREN)); | 501 static ParenthesizedExpression parenthesizedExpression(Expression expression)
=> new ParenthesizedExpression.full(TokenFactory.token3(TokenType.OPEN_PAREN), e
xpression, TokenFactory.token3(TokenType.CLOSE_PAREN)); |
| 502 |
| 363 static PartDirective partDirective(List<Annotation> metadata, String url) => n
ew PartDirective.full(null, metadata, TokenFactory.token(Keyword.PART), string2(
url), TokenFactory.token3(TokenType.SEMICOLON)); | 503 static PartDirective partDirective(List<Annotation> metadata, String url) => n
ew PartDirective.full(null, metadata, TokenFactory.token(Keyword.PART), string2(
url), TokenFactory.token3(TokenType.SEMICOLON)); |
| 504 |
| 364 static PartDirective partDirective2(String url) => partDirective(new List<Anno
tation>(), url); | 505 static PartDirective partDirective2(String url) => partDirective(new List<Anno
tation>(), url); |
| 506 |
| 365 static PartOfDirective partOfDirective(LibraryIdentifier libraryName) => partO
fDirective2(new List<Annotation>(), libraryName); | 507 static PartOfDirective partOfDirective(LibraryIdentifier libraryName) => partO
fDirective2(new List<Annotation>(), libraryName); |
| 508 |
| 366 static PartOfDirective partOfDirective2(List<Annotation> metadata, LibraryIden
tifier libraryName) => new PartOfDirective.full(null, metadata, TokenFactory.tok
en(Keyword.PART), TokenFactory.token2("of"), libraryName, TokenFactory.token3(To
kenType.SEMICOLON)); | 509 static PartOfDirective partOfDirective2(List<Annotation> metadata, LibraryIden
tifier libraryName) => new PartOfDirective.full(null, metadata, TokenFactory.tok
en(Keyword.PART), TokenFactory.token2("of"), libraryName, TokenFactory.token3(To
kenType.SEMICOLON)); |
| 510 |
| 367 static DefaultFormalParameter positionalFormalParameter(NormalFormalParameter
parameter, Expression expression) => new DefaultFormalParameter.full(parameter,
ParameterKind.POSITIONAL, expression == null ? null : TokenFactory.token3(TokenT
ype.EQ), expression); | 511 static DefaultFormalParameter positionalFormalParameter(NormalFormalParameter
parameter, Expression expression) => new DefaultFormalParameter.full(parameter,
ParameterKind.POSITIONAL, expression == null ? null : TokenFactory.token3(TokenT
ype.EQ), expression); |
| 512 |
| 368 static PostfixExpression postfixExpression(Expression expression, TokenType op
erator) => new PostfixExpression.full(expression, TokenFactory.token3(operator))
; | 513 static PostfixExpression postfixExpression(Expression expression, TokenType op
erator) => new PostfixExpression.full(expression, TokenFactory.token3(operator))
; |
| 514 |
| 369 static PrefixExpression prefixExpression(TokenType operator, Expression expres
sion) => new PrefixExpression.full(TokenFactory.token3(operator), expression); | 515 static PrefixExpression prefixExpression(TokenType operator, Expression expres
sion) => new PrefixExpression.full(TokenFactory.token3(operator), expression); |
| 516 |
| 370 static PropertyAccess propertyAccess(Expression target, SimpleIdentifier prope
rtyName) => new PropertyAccess.full(target, TokenFactory.token3(TokenType.PERIOD
), propertyName); | 517 static PropertyAccess propertyAccess(Expression target, SimpleIdentifier prope
rtyName) => new PropertyAccess.full(target, TokenFactory.token3(TokenType.PERIOD
), propertyName); |
| 518 |
| 371 static PropertyAccess propertyAccess2(Expression target, String propertyName)
=> new PropertyAccess.full(target, TokenFactory.token3(TokenType.PERIOD), identi
fier3(propertyName)); | 519 static PropertyAccess propertyAccess2(Expression target, String propertyName)
=> new PropertyAccess.full(target, TokenFactory.token3(TokenType.PERIOD), identi
fier3(propertyName)); |
| 520 |
| 372 static RedirectingConstructorInvocation redirectingConstructorInvocation(List<
Expression> arguments) => redirectingConstructorInvocation2(null, arguments); | 521 static RedirectingConstructorInvocation redirectingConstructorInvocation(List<
Expression> arguments) => redirectingConstructorInvocation2(null, arguments); |
| 522 |
| 373 static RedirectingConstructorInvocation redirectingConstructorInvocation2(Stri
ng constructorName, List<Expression> arguments) => new RedirectingConstructorInv
ocation.full(TokenFactory.token(Keyword.THIS), constructorName == null ? null :
TokenFactory.token3(TokenType.PERIOD), constructorName == null ? null : identifi
er3(constructorName), argumentList(arguments)); | 523 static RedirectingConstructorInvocation redirectingConstructorInvocation2(Stri
ng constructorName, List<Expression> arguments) => new RedirectingConstructorInv
ocation.full(TokenFactory.token(Keyword.THIS), constructorName == null ? null :
TokenFactory.token3(TokenType.PERIOD), constructorName == null ? null : identifi
er3(constructorName), argumentList(arguments)); |
| 524 |
| 374 static RethrowExpression rethrowExpression() => new RethrowExpression.full(Tok
enFactory.token(Keyword.RETHROW)); | 525 static RethrowExpression rethrowExpression() => new RethrowExpression.full(Tok
enFactory.token(Keyword.RETHROW)); |
| 526 |
| 375 static ReturnStatement returnStatement() => returnStatement2(null); | 527 static ReturnStatement returnStatement() => returnStatement2(null); |
| 528 |
| 376 static ReturnStatement returnStatement2(Expression expression) => new ReturnSt
atement.full(TokenFactory.token(Keyword.RETURN), expression, TokenFactory.token3
(TokenType.SEMICOLON)); | 529 static ReturnStatement returnStatement2(Expression expression) => new ReturnSt
atement.full(TokenFactory.token(Keyword.RETURN), expression, TokenFactory.token3
(TokenType.SEMICOLON)); |
| 530 |
| 377 static ScriptTag scriptTag(String scriptTag) => new ScriptTag.full(TokenFactor
y.token2(scriptTag)); | 531 static ScriptTag scriptTag(String scriptTag) => new ScriptTag.full(TokenFactor
y.token2(scriptTag)); |
| 532 |
| 378 static ShowCombinator showCombinator(List<SimpleIdentifier> identifiers) => ne
w ShowCombinator.full(TokenFactory.token2("show"), list(identifiers)); | 533 static ShowCombinator showCombinator(List<SimpleIdentifier> identifiers) => ne
w ShowCombinator.full(TokenFactory.token2("show"), list(identifiers)); |
| 534 |
| 379 static ShowCombinator showCombinator2(List<String> identifiers) { | 535 static ShowCombinator showCombinator2(List<String> identifiers) { |
| 380 List<SimpleIdentifier> identifierList = new List<SimpleIdentifier>(); | 536 List<SimpleIdentifier> identifierList = new List<SimpleIdentifier>(); |
| 381 for (String identifier in identifiers) { | 537 for (String identifier in identifiers) { |
| 382 identifierList.add(identifier3(identifier)); | 538 identifierList.add(identifier3(identifier)); |
| 383 } | 539 } |
| 384 return new ShowCombinator.full(TokenFactory.token2("show"), identifierList); | 540 return new ShowCombinator.full(TokenFactory.token2("show"), identifierList); |
| 385 } | 541 } |
| 542 |
| 386 static SimpleFormalParameter simpleFormalParameter(Keyword keyword, String par
ameterName) => simpleFormalParameter2(keyword, null, parameterName); | 543 static SimpleFormalParameter simpleFormalParameter(Keyword keyword, String par
ameterName) => simpleFormalParameter2(keyword, null, parameterName); |
| 544 |
| 387 static SimpleFormalParameter simpleFormalParameter2(Keyword keyword, TypeName
type, String parameterName) => new SimpleFormalParameter.full(null, null, keywor
d == null ? null : TokenFactory.token(keyword), type, identifier3(parameterName)
); | 545 static SimpleFormalParameter simpleFormalParameter2(Keyword keyword, TypeName
type, String parameterName) => new SimpleFormalParameter.full(null, null, keywor
d == null ? null : TokenFactory.token(keyword), type, identifier3(parameterName)
); |
| 546 |
| 388 static SimpleFormalParameter simpleFormalParameter3(String parameterName) => s
impleFormalParameter2(null, null, parameterName); | 547 static SimpleFormalParameter simpleFormalParameter3(String parameterName) => s
impleFormalParameter2(null, null, parameterName); |
| 548 |
| 389 static SimpleFormalParameter simpleFormalParameter4(TypeName type, String para
meterName) => simpleFormalParameter2(null, type, parameterName); | 549 static SimpleFormalParameter simpleFormalParameter4(TypeName type, String para
meterName) => simpleFormalParameter2(null, type, parameterName); |
| 550 |
| 390 static StringInterpolation string(List<InterpolationElement> elements) => new
StringInterpolation.full(list(elements)); | 551 static StringInterpolation string(List<InterpolationElement> elements) => new
StringInterpolation.full(list(elements)); |
| 552 |
| 391 static SimpleStringLiteral string2(String content) => new SimpleStringLiteral.
full(TokenFactory.token2("'${content}'"), content); | 553 static SimpleStringLiteral string2(String content) => new SimpleStringLiteral.
full(TokenFactory.token2("'${content}'"), content); |
| 554 |
| 392 static SuperConstructorInvocation superConstructorInvocation(List<Expression>
arguments) => superConstructorInvocation2(null, arguments); | 555 static SuperConstructorInvocation superConstructorInvocation(List<Expression>
arguments) => superConstructorInvocation2(null, arguments); |
| 556 |
| 393 static SuperConstructorInvocation superConstructorInvocation2(String name, Lis
t<Expression> arguments) => new SuperConstructorInvocation.full(TokenFactory.tok
en(Keyword.SUPER), name == null ? null : TokenFactory.token3(TokenType.PERIOD),
name == null ? null : identifier3(name), argumentList(arguments)); | 557 static SuperConstructorInvocation superConstructorInvocation2(String name, Lis
t<Expression> arguments) => new SuperConstructorInvocation.full(TokenFactory.tok
en(Keyword.SUPER), name == null ? null : TokenFactory.token3(TokenType.PERIOD),
name == null ? null : identifier3(name), argumentList(arguments)); |
| 558 |
| 394 static SuperExpression superExpression() => new SuperExpression.full(TokenFact
ory.token(Keyword.SUPER)); | 559 static SuperExpression superExpression() => new SuperExpression.full(TokenFact
ory.token(Keyword.SUPER)); |
| 560 |
| 395 static SwitchCase switchCase(Expression expression, List<Statement> statements
) => switchCase2(new List<Label>(), expression, statements); | 561 static SwitchCase switchCase(Expression expression, List<Statement> statements
) => switchCase2(new List<Label>(), expression, statements); |
| 562 |
| 396 static SwitchCase switchCase2(List<Label> labels, Expression expression, List<
Statement> statements) => new SwitchCase.full(labels, TokenFactory.token(Keyword
.CASE), expression, TokenFactory.token3(TokenType.COLON), list(statements)); | 563 static SwitchCase switchCase2(List<Label> labels, Expression expression, List<
Statement> statements) => new SwitchCase.full(labels, TokenFactory.token(Keyword
.CASE), expression, TokenFactory.token3(TokenType.COLON), list(statements)); |
| 564 |
| 397 static SwitchDefault switchDefault(List<Label> labels, List<Statement> stateme
nts) => new SwitchDefault.full(labels, TokenFactory.token(Keyword.DEFAULT), Toke
nFactory.token3(TokenType.COLON), list(statements)); | 565 static SwitchDefault switchDefault(List<Label> labels, List<Statement> stateme
nts) => new SwitchDefault.full(labels, TokenFactory.token(Keyword.DEFAULT), Toke
nFactory.token3(TokenType.COLON), list(statements)); |
| 566 |
| 398 static SwitchDefault switchDefault2(List<Statement> statements) => switchDefau
lt(new List<Label>(), statements); | 567 static SwitchDefault switchDefault2(List<Statement> statements) => switchDefau
lt(new List<Label>(), statements); |
| 568 |
| 399 static SwitchStatement switchStatement(Expression expression, List<SwitchMembe
r> members) => new SwitchStatement.full(TokenFactory.token(Keyword.SWITCH), Toke
nFactory.token3(TokenType.OPEN_PAREN), expression, TokenFactory.token3(TokenType
.CLOSE_PAREN), TokenFactory.token3(TokenType.OPEN_CURLY_BRACKET), list(members),
TokenFactory.token3(TokenType.CLOSE_CURLY_BRACKET)); | 569 static SwitchStatement switchStatement(Expression expression, List<SwitchMembe
r> members) => new SwitchStatement.full(TokenFactory.token(Keyword.SWITCH), Toke
nFactory.token3(TokenType.OPEN_PAREN), expression, TokenFactory.token3(TokenType
.CLOSE_PAREN), TokenFactory.token3(TokenType.OPEN_CURLY_BRACKET), list(members),
TokenFactory.token3(TokenType.CLOSE_CURLY_BRACKET)); |
| 570 |
| 400 static SymbolLiteral symbolLiteral(List<String> components) { | 571 static SymbolLiteral symbolLiteral(List<String> components) { |
| 401 List<Token> identifierList = new List<Token>(); | 572 List<Token> identifierList = new List<Token>(); |
| 402 for (String component in components) { | 573 for (String component in components) { |
| 403 identifierList.add(TokenFactory.token4(TokenType.IDENTIFIER, component)); | 574 identifierList.add(TokenFactory.token4(TokenType.IDENTIFIER, component)); |
| 404 } | 575 } |
| 405 return new SymbolLiteral.full(TokenFactory.token3(TokenType.HASH), new List.
from(identifierList)); | 576 return new SymbolLiteral.full(TokenFactory.token3(TokenType.HASH), new List.
from(identifierList)); |
| 406 } | 577 } |
| 578 |
| 407 static ThisExpression thisExpression() => new ThisExpression.full(TokenFactory
.token(Keyword.THIS)); | 579 static ThisExpression thisExpression() => new ThisExpression.full(TokenFactory
.token(Keyword.THIS)); |
| 580 |
| 408 static ThrowExpression throwExpression() => throwExpression2(null); | 581 static ThrowExpression throwExpression() => throwExpression2(null); |
| 582 |
| 409 static ThrowExpression throwExpression2(Expression expression) => new ThrowExp
ression.full(TokenFactory.token(Keyword.THROW), expression); | 583 static ThrowExpression throwExpression2(Expression expression) => new ThrowExp
ression.full(TokenFactory.token(Keyword.THROW), expression); |
| 584 |
| 410 static TopLevelVariableDeclaration topLevelVariableDeclaration(Keyword keyword
, TypeName type, List<VariableDeclaration> variables) => new TopLevelVariableDec
laration.full(null, null, variableDeclarationList(keyword, type, variables), Tok
enFactory.token3(TokenType.SEMICOLON)); | 585 static TopLevelVariableDeclaration topLevelVariableDeclaration(Keyword keyword
, TypeName type, List<VariableDeclaration> variables) => new TopLevelVariableDec
laration.full(null, null, variableDeclarationList(keyword, type, variables), Tok
enFactory.token3(TokenType.SEMICOLON)); |
| 586 |
| 411 static TopLevelVariableDeclaration topLevelVariableDeclaration2(Keyword keywor
d, List<VariableDeclaration> variables) => new TopLevelVariableDeclaration.full(
null, null, variableDeclarationList(keyword, null, variables), TokenFactory.toke
n3(TokenType.SEMICOLON)); | 587 static TopLevelVariableDeclaration topLevelVariableDeclaration2(Keyword keywor
d, List<VariableDeclaration> variables) => new TopLevelVariableDeclaration.full(
null, null, variableDeclarationList(keyword, null, variables), TokenFactory.toke
n3(TokenType.SEMICOLON)); |
| 588 |
| 412 static TryStatement tryStatement(Block body, Block finallyClause) => tryStatem
ent3(body, new List<CatchClause>(), finallyClause); | 589 static TryStatement tryStatement(Block body, Block finallyClause) => tryStatem
ent3(body, new List<CatchClause>(), finallyClause); |
| 590 |
| 413 static TryStatement tryStatement2(Block body, List<CatchClause> catchClauses)
=> tryStatement3(body, list(catchClauses), null); | 591 static TryStatement tryStatement2(Block body, List<CatchClause> catchClauses)
=> tryStatement3(body, list(catchClauses), null); |
| 592 |
| 414 static TryStatement tryStatement3(Block body, List<CatchClause> catchClauses,
Block finallyClause) => new TryStatement.full(TokenFactory.token(Keyword.TRY), b
ody, catchClauses, finallyClause == null ? null : TokenFactory.token(Keyword.FIN
ALLY), finallyClause); | 593 static TryStatement tryStatement3(Block body, List<CatchClause> catchClauses,
Block finallyClause) => new TryStatement.full(TokenFactory.token(Keyword.TRY), b
ody, catchClauses, finallyClause == null ? null : TokenFactory.token(Keyword.FIN
ALLY), finallyClause); |
| 594 |
| 415 static FunctionTypeAlias typeAlias(TypeName returnType, String name, TypeParam
eterList typeParameters, FormalParameterList parameters) => new FunctionTypeAlia
s.full(null, null, TokenFactory.token(Keyword.TYPEDEF), returnType, identifier3(
name), typeParameters, parameters, TokenFactory.token3(TokenType.SEMICOLON)); | 595 static FunctionTypeAlias typeAlias(TypeName returnType, String name, TypeParam
eterList typeParameters, FormalParameterList parameters) => new FunctionTypeAlia
s.full(null, null, TokenFactory.token(Keyword.TYPEDEF), returnType, identifier3(
name), typeParameters, parameters, TokenFactory.token3(TokenType.SEMICOLON)); |
| 596 |
| 416 static TypeArgumentList typeArgumentList(List<TypeName> typeNames) => new Type
ArgumentList.full(TokenFactory.token3(TokenType.LT), list(typeNames), TokenFacto
ry.token3(TokenType.GT)); | 597 static TypeArgumentList typeArgumentList(List<TypeName> typeNames) => new Type
ArgumentList.full(TokenFactory.token3(TokenType.LT), list(typeNames), TokenFacto
ry.token3(TokenType.GT)); |
| 417 | 598 |
| 418 /** | 599 /** |
| 419 * Create a type name whose name has been resolved to the given element and wh
ose type has been | 600 * Create a type name whose name has been resolved to the given element and wh
ose type has been |
| 420 * resolved to the type of the given element. | 601 * resolved to the type of the given element. |
| 421 * | 602 * |
| 422 * <b>Note:</b> This method does not correctly handle class elements that have
type parameters. | 603 * <b>Note:</b> This method does not correctly handle class elements that have
type parameters. |
| 423 * | 604 * |
| 424 * @param element the element defining the type represented by the type name | 605 * @param element the element defining the type represented by the type name |
| 425 * @return the type name that was created | 606 * @return the type name that was created |
| 426 */ | 607 */ |
| 427 static TypeName typeName(ClassElement element, List<TypeName> arguments) { | 608 static TypeName typeName(ClassElement element, List<TypeName> arguments) { |
| 428 SimpleIdentifier name = identifier3(element.name); | 609 SimpleIdentifier name = identifier3(element.name); |
| 429 name.staticElement = element; | 610 name.staticElement = element; |
| 430 TypeName typeName = typeName3(name, arguments); | 611 TypeName typeName = typeName3(name, arguments); |
| 431 typeName.type = element.type; | 612 typeName.type = element.type; |
| 432 return typeName; | 613 return typeName; |
| 433 } | 614 } |
| 615 |
| 434 static TypeName typeName3(Identifier name, List<TypeName> arguments) { | 616 static TypeName typeName3(Identifier name, List<TypeName> arguments) { |
| 435 if (arguments.length == 0) { | 617 if (arguments.length == 0) { |
| 436 return new TypeName.full(name, null); | 618 return new TypeName.full(name, null); |
| 437 } | 619 } |
| 438 return new TypeName.full(name, typeArgumentList(arguments)); | 620 return new TypeName.full(name, typeArgumentList(arguments)); |
| 439 } | 621 } |
| 622 |
| 440 static TypeName typeName4(String name, List<TypeName> arguments) { | 623 static TypeName typeName4(String name, List<TypeName> arguments) { |
| 441 if (arguments.length == 0) { | 624 if (arguments.length == 0) { |
| 442 return new TypeName.full(identifier3(name), null); | 625 return new TypeName.full(identifier3(name), null); |
| 443 } | 626 } |
| 444 return new TypeName.full(identifier3(name), typeArgumentList(arguments)); | 627 return new TypeName.full(identifier3(name), typeArgumentList(arguments)); |
| 445 } | 628 } |
| 629 |
| 446 static TypeParameter typeParameter(String name) => new TypeParameter.full(null
, null, identifier3(name), null, null); | 630 static TypeParameter typeParameter(String name) => new TypeParameter.full(null
, null, identifier3(name), null, null); |
| 631 |
| 447 static TypeParameter typeParameter2(String name, TypeName bound) => new TypePa
rameter.full(null, null, identifier3(name), TokenFactory.token(Keyword.EXTENDS),
bound); | 632 static TypeParameter typeParameter2(String name, TypeName bound) => new TypePa
rameter.full(null, null, identifier3(name), TokenFactory.token(Keyword.EXTENDS),
bound); |
| 633 |
| 448 static TypeParameterList typeParameterList(List<String> typeNames) { | 634 static TypeParameterList typeParameterList(List<String> typeNames) { |
| 449 List<TypeParameter> typeParameters = new List<TypeParameter>(); | 635 List<TypeParameter> typeParameters = new List<TypeParameter>(); |
| 450 for (String typeName in typeNames) { | 636 for (String typeName in typeNames) { |
| 451 typeParameters.add(typeParameter(typeName)); | 637 typeParameters.add(typeParameter(typeName)); |
| 452 } | 638 } |
| 453 return new TypeParameterList.full(TokenFactory.token3(TokenType.LT), typePar
ameters, TokenFactory.token3(TokenType.GT)); | 639 return new TypeParameterList.full(TokenFactory.token3(TokenType.LT), typePar
ameters, TokenFactory.token3(TokenType.GT)); |
| 454 } | 640 } |
| 641 |
| 455 static VariableDeclaration variableDeclaration(String name) => new VariableDec
laration.full(null, null, identifier3(name), null, null); | 642 static VariableDeclaration variableDeclaration(String name) => new VariableDec
laration.full(null, null, identifier3(name), null, null); |
| 643 |
| 456 static VariableDeclaration variableDeclaration2(String name, Expression initia
lizer) => new VariableDeclaration.full(null, null, identifier3(name), TokenFacto
ry.token3(TokenType.EQ), initializer); | 644 static VariableDeclaration variableDeclaration2(String name, Expression initia
lizer) => new VariableDeclaration.full(null, null, identifier3(name), TokenFacto
ry.token3(TokenType.EQ), initializer); |
| 645 |
| 457 static VariableDeclarationList variableDeclarationList(Keyword keyword, TypeNa
me type, List<VariableDeclaration> variables) => new VariableDeclarationList.ful
l(null, null, keyword == null ? null : TokenFactory.token(keyword), type, list(v
ariables)); | 646 static VariableDeclarationList variableDeclarationList(Keyword keyword, TypeNa
me type, List<VariableDeclaration> variables) => new VariableDeclarationList.ful
l(null, null, keyword == null ? null : TokenFactory.token(keyword), type, list(v
ariables)); |
| 647 |
| 458 static VariableDeclarationList variableDeclarationList2(Keyword keyword, List<
VariableDeclaration> variables) => variableDeclarationList(keyword, null, variab
les); | 648 static VariableDeclarationList variableDeclarationList2(Keyword keyword, List<
VariableDeclaration> variables) => variableDeclarationList(keyword, null, variab
les); |
| 649 |
| 459 static VariableDeclarationStatement variableDeclarationStatement(Keyword keywo
rd, TypeName type, List<VariableDeclaration> variables) => new VariableDeclarati
onStatement.full(variableDeclarationList(keyword, type, variables), TokenFactory
.token3(TokenType.SEMICOLON)); | 650 static VariableDeclarationStatement variableDeclarationStatement(Keyword keywo
rd, TypeName type, List<VariableDeclaration> variables) => new VariableDeclarati
onStatement.full(variableDeclarationList(keyword, type, variables), TokenFactory
.token3(TokenType.SEMICOLON)); |
| 651 |
| 460 static VariableDeclarationStatement variableDeclarationStatement2(Keyword keyw
ord, List<VariableDeclaration> variables) => variableDeclarationStatement(keywor
d, null, variables); | 652 static VariableDeclarationStatement variableDeclarationStatement2(Keyword keyw
ord, List<VariableDeclaration> variables) => variableDeclarationStatement(keywor
d, null, variables); |
| 653 |
| 461 static WhileStatement whileStatement(Expression condition, Statement body) =>
new WhileStatement.full(TokenFactory.token(Keyword.WHILE), TokenFactory.token3(T
okenType.OPEN_PAREN), condition, TokenFactory.token3(TokenType.CLOSE_PAREN), bod
y); | 654 static WhileStatement whileStatement(Expression condition, Statement body) =>
new WhileStatement.full(TokenFactory.token(Keyword.WHILE), TokenFactory.token3(T
okenType.OPEN_PAREN), condition, TokenFactory.token3(TokenType.CLOSE_PAREN), bod
y); |
| 655 |
| 462 static WithClause withClause(List<TypeName> types) => new WithClause.full(Toke
nFactory.token(Keyword.WITH), list(types)); | 656 static WithClause withClause(List<TypeName> types) => new WithClause.full(Toke
nFactory.token(Keyword.WITH), list(types)); |
| 463 } | 657 } |
| 658 |
| 464 class SimpleIdentifierTest extends ParserTestCase { | 659 class SimpleIdentifierTest extends ParserTestCase { |
| 465 void test_inDeclarationContext_argumentDefinition() { | 660 void test_inDeclarationContext_argumentDefinition() { |
| 466 SimpleIdentifier identifier = ASTFactory.argumentDefinitionTest("p").identif
ier; | 661 SimpleIdentifier identifier = ASTFactory.argumentDefinitionTest("p").identif
ier; |
| 467 JUnitTestCase.assertFalse(identifier.inDeclarationContext()); | 662 JUnitTestCase.assertFalse(identifier.inDeclarationContext()); |
| 468 } | 663 } |
| 664 |
| 469 void test_inDeclarationContext_catch_exception() { | 665 void test_inDeclarationContext_catch_exception() { |
| 470 SimpleIdentifier identifier = ASTFactory.catchClause("e", []).exceptionParam
eter; | 666 SimpleIdentifier identifier = ASTFactory.catchClause("e", []).exceptionParam
eter; |
| 471 JUnitTestCase.assertTrue(identifier.inDeclarationContext()); | 667 JUnitTestCase.assertTrue(identifier.inDeclarationContext()); |
| 472 } | 668 } |
| 669 |
| 473 void test_inDeclarationContext_catch_stack() { | 670 void test_inDeclarationContext_catch_stack() { |
| 474 SimpleIdentifier identifier = ASTFactory.catchClause2("e", "s", []).stackTra
ceParameter; | 671 SimpleIdentifier identifier = ASTFactory.catchClause2("e", "s", []).stackTra
ceParameter; |
| 475 JUnitTestCase.assertTrue(identifier.inDeclarationContext()); | 672 JUnitTestCase.assertTrue(identifier.inDeclarationContext()); |
| 476 } | 673 } |
| 674 |
| 477 void test_inDeclarationContext_classDeclaration() { | 675 void test_inDeclarationContext_classDeclaration() { |
| 478 SimpleIdentifier identifier = ASTFactory.classDeclaration(null, "C", null, n
ull, null, null, []).name; | 676 SimpleIdentifier identifier = ASTFactory.classDeclaration(null, "C", null, n
ull, null, null, []).name; |
| 479 JUnitTestCase.assertTrue(identifier.inDeclarationContext()); | 677 JUnitTestCase.assertTrue(identifier.inDeclarationContext()); |
| 480 } | 678 } |
| 679 |
| 481 void test_inDeclarationContext_classTypeAlias() { | 680 void test_inDeclarationContext_classTypeAlias() { |
| 482 SimpleIdentifier identifier = ASTFactory.classTypeAlias("C", null, null, nul
l, null, null).name; | 681 SimpleIdentifier identifier = ASTFactory.classTypeAlias("C", null, null, nul
l, null, null).name; |
| 483 JUnitTestCase.assertTrue(identifier.inDeclarationContext()); | 682 JUnitTestCase.assertTrue(identifier.inDeclarationContext()); |
| 484 } | 683 } |
| 684 |
| 485 void test_inDeclarationContext_constructorDeclaration() { | 685 void test_inDeclarationContext_constructorDeclaration() { |
| 486 SimpleIdentifier identifier = ASTFactory.constructorDeclaration(ASTFactory.i
dentifier3("C"), "c", null, null).name; | 686 SimpleIdentifier identifier = ASTFactory.constructorDeclaration(ASTFactory.i
dentifier3("C"), "c", null, null).name; |
| 487 JUnitTestCase.assertTrue(identifier.inDeclarationContext()); | 687 JUnitTestCase.assertTrue(identifier.inDeclarationContext()); |
| 488 } | 688 } |
| 689 |
| 489 void test_inDeclarationContext_declaredIdentifier() { | 690 void test_inDeclarationContext_declaredIdentifier() { |
| 490 DeclaredIdentifier declaredIdentifier = ASTFactory.declaredIdentifier3("v"); | 691 DeclaredIdentifier declaredIdentifier = ASTFactory.declaredIdentifier3("v"); |
| 491 SimpleIdentifier identifier = declaredIdentifier.identifier; | 692 SimpleIdentifier identifier = declaredIdentifier.identifier; |
| 492 JUnitTestCase.assertTrue(identifier.inDeclarationContext()); | 693 JUnitTestCase.assertTrue(identifier.inDeclarationContext()); |
| 493 } | 694 } |
| 695 |
| 494 void test_inDeclarationContext_fieldFormalParameter() { | 696 void test_inDeclarationContext_fieldFormalParameter() { |
| 495 SimpleIdentifier identifier = ASTFactory.fieldFormalParameter3("p").identifi
er; | 697 SimpleIdentifier identifier = ASTFactory.fieldFormalParameter3("p").identifi
er; |
| 496 JUnitTestCase.assertFalse(identifier.inDeclarationContext()); | 698 JUnitTestCase.assertFalse(identifier.inDeclarationContext()); |
| 497 } | 699 } |
| 700 |
| 498 void test_inDeclarationContext_functionDeclaration() { | 701 void test_inDeclarationContext_functionDeclaration() { |
| 499 SimpleIdentifier identifier = ASTFactory.functionDeclaration(null, null, "f"
, null).name; | 702 SimpleIdentifier identifier = ASTFactory.functionDeclaration(null, null, "f"
, null).name; |
| 500 JUnitTestCase.assertTrue(identifier.inDeclarationContext()); | 703 JUnitTestCase.assertTrue(identifier.inDeclarationContext()); |
| 501 } | 704 } |
| 705 |
| 502 void test_inDeclarationContext_functionTypeAlias() { | 706 void test_inDeclarationContext_functionTypeAlias() { |
| 503 SimpleIdentifier identifier = ASTFactory.typeAlias(null, "F", null, null).na
me; | 707 SimpleIdentifier identifier = ASTFactory.typeAlias(null, "F", null, null).na
me; |
| 504 JUnitTestCase.assertTrue(identifier.inDeclarationContext()); | 708 JUnitTestCase.assertTrue(identifier.inDeclarationContext()); |
| 505 } | 709 } |
| 710 |
| 506 void test_inDeclarationContext_label_false() { | 711 void test_inDeclarationContext_label_false() { |
| 507 SimpleIdentifier identifier = ASTFactory.namedExpression2("l", ASTFactory.in
teger(0)).name.label; | 712 SimpleIdentifier identifier = ASTFactory.namedExpression2("l", ASTFactory.in
teger(0)).name.label; |
| 508 JUnitTestCase.assertFalse(identifier.inDeclarationContext()); | 713 JUnitTestCase.assertFalse(identifier.inDeclarationContext()); |
| 509 } | 714 } |
| 715 |
| 510 void test_inDeclarationContext_label_true() { | 716 void test_inDeclarationContext_label_true() { |
| 511 Label label = ASTFactory.label2("l"); | 717 Label label = ASTFactory.label2("l"); |
| 512 SimpleIdentifier identifier = label.label; | 718 SimpleIdentifier identifier = label.label; |
| 513 ASTFactory.labeledStatement(ASTFactory.list([label]), ASTFactory.emptyStatem
ent()); | 719 ASTFactory.labeledStatement(ASTFactory.list([label]), ASTFactory.emptyStatem
ent()); |
| 514 JUnitTestCase.assertTrue(identifier.inDeclarationContext()); | 720 JUnitTestCase.assertTrue(identifier.inDeclarationContext()); |
| 515 } | 721 } |
| 722 |
| 516 void test_inDeclarationContext_methodDeclaration() { | 723 void test_inDeclarationContext_methodDeclaration() { |
| 517 SimpleIdentifier identifier = ASTFactory.identifier3("m"); | 724 SimpleIdentifier identifier = ASTFactory.identifier3("m"); |
| 518 ASTFactory.methodDeclaration2(null, null, null, null, identifier, null, null
); | 725 ASTFactory.methodDeclaration2(null, null, null, null, identifier, null, null
); |
| 519 JUnitTestCase.assertTrue(identifier.inDeclarationContext()); | 726 JUnitTestCase.assertTrue(identifier.inDeclarationContext()); |
| 520 } | 727 } |
| 728 |
| 521 void test_inDeclarationContext_simpleFormalParameter() { | 729 void test_inDeclarationContext_simpleFormalParameter() { |
| 522 SimpleIdentifier identifier = ASTFactory.simpleFormalParameter3("p").identif
ier; | 730 SimpleIdentifier identifier = ASTFactory.simpleFormalParameter3("p").identif
ier; |
| 523 JUnitTestCase.assertTrue(identifier.inDeclarationContext()); | 731 JUnitTestCase.assertTrue(identifier.inDeclarationContext()); |
| 524 } | 732 } |
| 733 |
| 525 void test_inDeclarationContext_typeParameter_bound() { | 734 void test_inDeclarationContext_typeParameter_bound() { |
| 526 TypeName bound = ASTFactory.typeName4("A", []); | 735 TypeName bound = ASTFactory.typeName4("A", []); |
| 527 SimpleIdentifier identifier = bound.name as SimpleIdentifier; | 736 SimpleIdentifier identifier = bound.name as SimpleIdentifier; |
| 528 ASTFactory.typeParameter2("E", bound); | 737 ASTFactory.typeParameter2("E", bound); |
| 529 JUnitTestCase.assertFalse(identifier.inDeclarationContext()); | 738 JUnitTestCase.assertFalse(identifier.inDeclarationContext()); |
| 530 } | 739 } |
| 740 |
| 531 void test_inDeclarationContext_typeParameter_name() { | 741 void test_inDeclarationContext_typeParameter_name() { |
| 532 SimpleIdentifier identifier = ASTFactory.typeParameter("E").name; | 742 SimpleIdentifier identifier = ASTFactory.typeParameter("E").name; |
| 533 JUnitTestCase.assertTrue(identifier.inDeclarationContext()); | 743 JUnitTestCase.assertTrue(identifier.inDeclarationContext()); |
| 534 } | 744 } |
| 745 |
| 535 void test_inDeclarationContext_variableDeclaration() { | 746 void test_inDeclarationContext_variableDeclaration() { |
| 536 SimpleIdentifier identifier = ASTFactory.variableDeclaration("v").name; | 747 SimpleIdentifier identifier = ASTFactory.variableDeclaration("v").name; |
| 537 JUnitTestCase.assertTrue(identifier.inDeclarationContext()); | 748 JUnitTestCase.assertTrue(identifier.inDeclarationContext()); |
| 538 } | 749 } |
| 750 |
| 539 void test_inGetterContext() { | 751 void test_inGetterContext() { |
| 540 for (WrapperKind wrapper in WrapperKind.values) { | 752 for (WrapperKind wrapper in WrapperKind.values) { |
| 541 for (AssignmentKind assignment in AssignmentKind.values) { | 753 for (AssignmentKind assignment in AssignmentKind.values) { |
| 542 SimpleIdentifier identifier = createIdentifier(wrapper, assignment); | 754 SimpleIdentifier identifier = createIdentifier(wrapper, assignment); |
| 543 if (identical(assignment, AssignmentKind.SIMPLE_LEFT) && wrapper != Wrap
perKind.PREFIXED_LEFT && wrapper != WrapperKind.PROPERTY_LEFT) { | 755 if (identical(assignment, AssignmentKind.SIMPLE_LEFT) && wrapper != Wrap
perKind.PREFIXED_LEFT && wrapper != WrapperKind.PROPERTY_LEFT) { |
| 544 if (identifier.inGetterContext()) { | 756 if (identifier.inGetterContext()) { |
| 545 JUnitTestCase.fail("Expected ${topMostNode(identifier).toSource()} t
o be false"); | 757 JUnitTestCase.fail("Expected ${topMostNode(identifier).toSource()} t
o be false"); |
| 546 } | 758 } |
| 547 } else { | 759 } else { |
| 548 if (!identifier.inGetterContext()) { | 760 if (!identifier.inGetterContext()) { |
| 549 JUnitTestCase.fail("Expected ${topMostNode(identifier).toSource()} t
o be true"); | 761 JUnitTestCase.fail("Expected ${topMostNode(identifier).toSource()} t
o be true"); |
| 550 } | 762 } |
| 551 } | 763 } |
| 552 } | 764 } |
| 553 } | 765 } |
| 554 } | 766 } |
| 767 |
| 555 void test_inReferenceContext() { | 768 void test_inReferenceContext() { |
| 556 SimpleIdentifier identifier = ASTFactory.identifier3("id"); | 769 SimpleIdentifier identifier = ASTFactory.identifier3("id"); |
| 557 ASTFactory.namedExpression(ASTFactory.label(identifier), ASTFactory.identifi
er3("_")); | 770 ASTFactory.namedExpression(ASTFactory.label(identifier), ASTFactory.identifi
er3("_")); |
| 558 JUnitTestCase.assertFalse(identifier.inGetterContext()); | 771 JUnitTestCase.assertFalse(identifier.inGetterContext()); |
| 559 JUnitTestCase.assertFalse(identifier.inSetterContext()); | 772 JUnitTestCase.assertFalse(identifier.inSetterContext()); |
| 560 } | 773 } |
| 774 |
| 561 void test_inSetterContext() { | 775 void test_inSetterContext() { |
| 562 for (WrapperKind wrapper in WrapperKind.values) { | 776 for (WrapperKind wrapper in WrapperKind.values) { |
| 563 for (AssignmentKind assignment in AssignmentKind.values) { | 777 for (AssignmentKind assignment in AssignmentKind.values) { |
| 564 SimpleIdentifier identifier = createIdentifier(wrapper, assignment); | 778 SimpleIdentifier identifier = createIdentifier(wrapper, assignment); |
| 565 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)) { | 779 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)) { |
| 566 if (identifier.inSetterContext()) { | 780 if (identifier.inSetterContext()) { |
| 567 JUnitTestCase.fail("Expected ${topMostNode(identifier).toSource()} t
o be false"); | 781 JUnitTestCase.fail("Expected ${topMostNode(identifier).toSource()} t
o be false"); |
| 568 } | 782 } |
| 569 } else { | 783 } else { |
| 570 if (!identifier.inSetterContext()) { | 784 if (!identifier.inSetterContext()) { |
| 571 JUnitTestCase.fail("Expected ${topMostNode(identifier).toSource()} t
o be true"); | 785 JUnitTestCase.fail("Expected ${topMostNode(identifier).toSource()} t
o be true"); |
| 572 } | 786 } |
| 573 } | 787 } |
| 574 } | 788 } |
| 575 } | 789 } |
| 576 } | 790 } |
| 791 |
| 577 SimpleIdentifier createIdentifier(WrapperKind wrapper, AssignmentKind assignme
nt) { | 792 SimpleIdentifier createIdentifier(WrapperKind wrapper, AssignmentKind assignme
nt) { |
| 578 SimpleIdentifier identifier = ASTFactory.identifier3("a"); | 793 SimpleIdentifier identifier = ASTFactory.identifier3("a"); |
| 579 Expression expression = identifier; | 794 Expression expression = identifier; |
| 580 while (true) { | 795 while (true) { |
| 581 if (wrapper == WrapperKind.PREFIXED_LEFT) { | 796 if (wrapper == WrapperKind.PREFIXED_LEFT) { |
| 582 expression = ASTFactory.identifier(identifier, ASTFactory.identifier3("_
")); | 797 expression = ASTFactory.identifier(identifier, ASTFactory.identifier3("_
")); |
| 583 } else if (wrapper == WrapperKind.PREFIXED_RIGHT) { | 798 } else if (wrapper == WrapperKind.PREFIXED_RIGHT) { |
| 584 expression = ASTFactory.identifier(ASTFactory.identifier3("_"), identifi
er); | 799 expression = ASTFactory.identifier(ASTFactory.identifier3("_"), identifi
er); |
| 585 } else if (wrapper == WrapperKind.PROPERTY_LEFT) { | 800 } else if (wrapper == WrapperKind.PROPERTY_LEFT) { |
| 586 expression = ASTFactory.propertyAccess2(expression, "_"); | 801 expression = ASTFactory.propertyAccess2(expression, "_"); |
| (...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 622 */ | 837 */ |
| 623 ASTNode topMostNode(SimpleIdentifier identifier) { | 838 ASTNode topMostNode(SimpleIdentifier identifier) { |
| 624 ASTNode child = identifier; | 839 ASTNode child = identifier; |
| 625 ASTNode parent = identifier.parent; | 840 ASTNode parent = identifier.parent; |
| 626 while (parent != null) { | 841 while (parent != null) { |
| 627 child = parent; | 842 child = parent; |
| 628 parent = parent.parent; | 843 parent = parent.parent; |
| 629 } | 844 } |
| 630 return child; | 845 return child; |
| 631 } | 846 } |
| 847 |
| 632 static dartSuite() { | 848 static dartSuite() { |
| 633 _ut.group('SimpleIdentifierTest', () { | 849 _ut.group('SimpleIdentifierTest', () { |
| 634 _ut.test('test_inDeclarationContext_argumentDefinition', () { | 850 _ut.test('test_inDeclarationContext_argumentDefinition', () { |
| 635 final __test = new SimpleIdentifierTest(); | 851 final __test = new SimpleIdentifierTest(); |
| 636 runJUnitTest(__test, __test.test_inDeclarationContext_argumentDefinition
); | 852 runJUnitTest(__test, __test.test_inDeclarationContext_argumentDefinition
); |
| 637 }); | 853 }); |
| 638 _ut.test('test_inDeclarationContext_catch_exception', () { | 854 _ut.test('test_inDeclarationContext_catch_exception', () { |
| 639 final __test = new SimpleIdentifierTest(); | 855 final __test = new SimpleIdentifierTest(); |
| 640 runJUnitTest(__test, __test.test_inDeclarationContext_catch_exception); | 856 runJUnitTest(__test, __test.test_inDeclarationContext_catch_exception); |
| 641 }); | 857 }); |
| (...skipping 65 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 707 final __test = new SimpleIdentifierTest(); | 923 final __test = new SimpleIdentifierTest(); |
| 708 runJUnitTest(__test, __test.test_inReferenceContext); | 924 runJUnitTest(__test, __test.test_inReferenceContext); |
| 709 }); | 925 }); |
| 710 _ut.test('test_inSetterContext', () { | 926 _ut.test('test_inSetterContext', () { |
| 711 final __test = new SimpleIdentifierTest(); | 927 final __test = new SimpleIdentifierTest(); |
| 712 runJUnitTest(__test, __test.test_inSetterContext); | 928 runJUnitTest(__test, __test.test_inSetterContext); |
| 713 }); | 929 }); |
| 714 }); | 930 }); |
| 715 } | 931 } |
| 716 } | 932 } |
| 933 |
| 717 class AssignmentKind extends Enum<AssignmentKind> { | 934 class AssignmentKind extends Enum<AssignmentKind> { |
| 718 static final AssignmentKind BINARY = new AssignmentKind('BINARY', 0); | 935 static final AssignmentKind BINARY = new AssignmentKind('BINARY', 0); |
| 936 |
| 719 static final AssignmentKind COMPOUND_LEFT = new AssignmentKind('COMPOUND_LEFT'
, 1); | 937 static final AssignmentKind COMPOUND_LEFT = new AssignmentKind('COMPOUND_LEFT'
, 1); |
| 938 |
| 720 static final AssignmentKind COMPOUND_RIGHT = new AssignmentKind('COMPOUND_RIGH
T', 2); | 939 static final AssignmentKind COMPOUND_RIGHT = new AssignmentKind('COMPOUND_RIGH
T', 2); |
| 940 |
| 721 static final AssignmentKind POSTFIX_INC = new AssignmentKind('POSTFIX_INC', 3)
; | 941 static final AssignmentKind POSTFIX_INC = new AssignmentKind('POSTFIX_INC', 3)
; |
| 942 |
| 722 static final AssignmentKind PREFIX_DEC = new AssignmentKind('PREFIX_DEC', 4); | 943 static final AssignmentKind PREFIX_DEC = new AssignmentKind('PREFIX_DEC', 4); |
| 944 |
| 723 static final AssignmentKind PREFIX_INC = new AssignmentKind('PREFIX_INC', 5); | 945 static final AssignmentKind PREFIX_INC = new AssignmentKind('PREFIX_INC', 5); |
| 946 |
| 724 static final AssignmentKind PREFIX_NOT = new AssignmentKind('PREFIX_NOT', 6); | 947 static final AssignmentKind PREFIX_NOT = new AssignmentKind('PREFIX_NOT', 6); |
| 948 |
| 725 static final AssignmentKind SIMPLE_LEFT = new AssignmentKind('SIMPLE_LEFT', 7)
; | 949 static final AssignmentKind SIMPLE_LEFT = new AssignmentKind('SIMPLE_LEFT', 7)
; |
| 950 |
| 726 static final AssignmentKind SIMPLE_RIGHT = new AssignmentKind('SIMPLE_RIGHT',
8); | 951 static final AssignmentKind SIMPLE_RIGHT = new AssignmentKind('SIMPLE_RIGHT',
8); |
| 952 |
| 727 static final AssignmentKind NONE = new AssignmentKind('NONE', 9); | 953 static final AssignmentKind NONE = new AssignmentKind('NONE', 9); |
| 954 |
| 728 static final List<AssignmentKind> values = [ | 955 static final List<AssignmentKind> values = [ |
| 729 BINARY, | 956 BINARY, |
| 730 COMPOUND_LEFT, | 957 COMPOUND_LEFT, |
| 731 COMPOUND_RIGHT, | 958 COMPOUND_RIGHT, |
| 732 POSTFIX_INC, | 959 POSTFIX_INC, |
| 733 PREFIX_DEC, | 960 PREFIX_DEC, |
| 734 PREFIX_INC, | 961 PREFIX_INC, |
| 735 PREFIX_NOT, | 962 PREFIX_NOT, |
| 736 SIMPLE_LEFT, | 963 SIMPLE_LEFT, |
| 737 SIMPLE_RIGHT, | 964 SIMPLE_RIGHT, |
| 738 NONE]; | 965 NONE]; |
| 966 |
| 739 AssignmentKind(String name, int ordinal) : super(name, ordinal); | 967 AssignmentKind(String name, int ordinal) : super(name, ordinal); |
| 740 } | 968 } |
| 969 |
| 741 class WrapperKind extends Enum<WrapperKind> { | 970 class WrapperKind extends Enum<WrapperKind> { |
| 742 static final WrapperKind PREFIXED_LEFT = new WrapperKind('PREFIXED_LEFT', 0); | 971 static final WrapperKind PREFIXED_LEFT = new WrapperKind('PREFIXED_LEFT', 0); |
| 972 |
| 743 static final WrapperKind PREFIXED_RIGHT = new WrapperKind('PREFIXED_RIGHT', 1)
; | 973 static final WrapperKind PREFIXED_RIGHT = new WrapperKind('PREFIXED_RIGHT', 1)
; |
| 974 |
| 744 static final WrapperKind PROPERTY_LEFT = new WrapperKind('PROPERTY_LEFT', 2); | 975 static final WrapperKind PROPERTY_LEFT = new WrapperKind('PROPERTY_LEFT', 2); |
| 976 |
| 745 static final WrapperKind PROPERTY_RIGHT = new WrapperKind('PROPERTY_RIGHT', 3)
; | 977 static final WrapperKind PROPERTY_RIGHT = new WrapperKind('PROPERTY_RIGHT', 3)
; |
| 978 |
| 746 static final WrapperKind NONE = new WrapperKind('NONE', 4); | 979 static final WrapperKind NONE = new WrapperKind('NONE', 4); |
| 980 |
| 747 static final List<WrapperKind> values = [ | 981 static final List<WrapperKind> values = [ |
| 748 PREFIXED_LEFT, | 982 PREFIXED_LEFT, |
| 749 PREFIXED_RIGHT, | 983 PREFIXED_RIGHT, |
| 750 PROPERTY_LEFT, | 984 PROPERTY_LEFT, |
| 751 PROPERTY_RIGHT, | 985 PROPERTY_RIGHT, |
| 752 NONE]; | 986 NONE]; |
| 987 |
| 753 WrapperKind(String name, int ordinal) : super(name, ordinal); | 988 WrapperKind(String name, int ordinal) : super(name, ordinal); |
| 754 } | 989 } |
| 990 |
| 755 class BreadthFirstVisitorTest extends ParserTestCase { | 991 class BreadthFirstVisitorTest extends ParserTestCase { |
| 756 void testIt() { | 992 void testIt() { |
| 757 String source = EngineTestCase.createSource([ | 993 String source = EngineTestCase.createSource([ |
| 758 "class A {", | 994 "class A {", |
| 759 " bool get g => true;", | 995 " bool get g => true;", |
| 760 "}", | 996 "}", |
| 761 "class B {", | 997 "class B {", |
| 762 " int f() {", | 998 " int f() {", |
| 763 " num q() {", | 999 " num q() {", |
| 764 " return 3;", | 1000 " return 3;", |
| 765 " }", | 1001 " }", |
| 766 " return q() + 4;", | 1002 " return q() + 4;", |
| 767 " }", | 1003 " }", |
| 768 "}", | 1004 "}", |
| 769 "A f(var p) {", | 1005 "A f(var p) {", |
| 770 " if ((p as A).g) {", | 1006 " if ((p as A).g) {", |
| 771 " return p;", | 1007 " return p;", |
| 772 " } else {", | 1008 " } else {", |
| 773 " return null;", | 1009 " return null;", |
| 774 " }", | 1010 " }", |
| 775 "}"]); | 1011 "}"]); |
| 776 CompilationUnit unit = ParserTestCase.parseCompilationUnit(source, []); | 1012 CompilationUnit unit = ParserTestCase.parseCompilationUnit(source, []); |
| 777 List<ASTNode> nodes = new List<ASTNode>(); | 1013 List<ASTNode> nodes = new List<ASTNode>(); |
| 778 BreadthFirstVisitor<Object> visitor = new BreadthFirstVisitor_18(nodes); | 1014 BreadthFirstVisitor<Object> visitor = new BreadthFirstVisitor_19(nodes); |
| 779 visitor.visitAllNodes(unit); | 1015 visitor.visitAllNodes(unit); |
| 780 EngineTestCase.assertSize(59, nodes); | 1016 EngineTestCase.assertSize(59, nodes); |
| 781 EngineTestCase.assertInstanceOf(CompilationUnit, nodes[0]); | 1017 EngineTestCase.assertInstanceOf(CompilationUnit, nodes[0]); |
| 782 EngineTestCase.assertInstanceOf(ClassDeclaration, nodes[2]); | 1018 EngineTestCase.assertInstanceOf(ClassDeclaration, nodes[2]); |
| 783 EngineTestCase.assertInstanceOf(FunctionDeclaration, nodes[3]); | 1019 EngineTestCase.assertInstanceOf(FunctionDeclaration, nodes[3]); |
| 784 EngineTestCase.assertInstanceOf(FunctionDeclarationStatement, nodes[27]); | 1020 EngineTestCase.assertInstanceOf(FunctionDeclarationStatement, nodes[27]); |
| 785 EngineTestCase.assertInstanceOf(IntegerLiteral, nodes[58]); | 1021 EngineTestCase.assertInstanceOf(IntegerLiteral, nodes[58]); |
| 786 } | 1022 } |
| 1023 |
| 787 static dartSuite() { | 1024 static dartSuite() { |
| 788 _ut.group('BreadthFirstVisitorTest', () { | 1025 _ut.group('BreadthFirstVisitorTest', () { |
| 789 _ut.test('testIt', () { | 1026 _ut.test('testIt', () { |
| 790 final __test = new BreadthFirstVisitorTest(); | 1027 final __test = new BreadthFirstVisitorTest(); |
| 791 runJUnitTest(__test, __test.testIt); | 1028 runJUnitTest(__test, __test.testIt); |
| 792 }); | 1029 }); |
| 793 }); | 1030 }); |
| 794 } | 1031 } |
| 795 } | 1032 } |
| 796 class BreadthFirstVisitor_18 extends BreadthFirstVisitor<Object> { | 1033 |
| 1034 class BreadthFirstVisitor_19 extends BreadthFirstVisitor<Object> { |
| 797 List<ASTNode> nodes; | 1035 List<ASTNode> nodes; |
| 798 BreadthFirstVisitor_18(this.nodes) : super(); | 1036 |
| 1037 BreadthFirstVisitor_19(this.nodes) : super(); |
| 1038 |
| 799 Object visitNode(ASTNode node) { | 1039 Object visitNode(ASTNode node) { |
| 800 nodes.add(node); | 1040 nodes.add(node); |
| 801 return super.visitNode(node); | 1041 return super.visitNode(node); |
| 802 } | 1042 } |
| 803 } | 1043 } |
| 1044 |
| 804 class NodeListTest extends EngineTestCase { | 1045 class NodeListTest extends EngineTestCase { |
| 805 void test_add() { | 1046 void test_add() { |
| 806 ASTNode parent = ASTFactory.argumentList([]); | 1047 ASTNode parent = ASTFactory.argumentList([]); |
| 807 ASTNode firstNode = ASTFactory.booleanLiteral(true); | 1048 ASTNode firstNode = ASTFactory.booleanLiteral(true); |
| 808 ASTNode secondNode = ASTFactory.booleanLiteral(false); | 1049 ASTNode secondNode = ASTFactory.booleanLiteral(false); |
| 809 NodeList<ASTNode> list = new NodeList<ASTNode>(parent); | 1050 NodeList<ASTNode> list = new NodeList<ASTNode>(parent); |
| 810 list.insert(0, secondNode); | 1051 list.insert(0, secondNode); |
| 811 list.insert(0, firstNode); | 1052 list.insert(0, firstNode); |
| 812 EngineTestCase.assertSize(2, list); | 1053 EngineTestCase.assertSize(2, list); |
| 813 JUnitTestCase.assertSame(firstNode, list[0]); | 1054 JUnitTestCase.assertSame(firstNode, list[0]); |
| 814 JUnitTestCase.assertSame(secondNode, list[1]); | 1055 JUnitTestCase.assertSame(secondNode, list[1]); |
| 815 JUnitTestCase.assertSame(parent, firstNode.parent); | 1056 JUnitTestCase.assertSame(parent, firstNode.parent); |
| 816 JUnitTestCase.assertSame(parent, secondNode.parent); | 1057 JUnitTestCase.assertSame(parent, secondNode.parent); |
| 817 ASTNode thirdNode = ASTFactory.booleanLiteral(false); | 1058 ASTNode thirdNode = ASTFactory.booleanLiteral(false); |
| 818 list.insert(1, thirdNode); | 1059 list.insert(1, thirdNode); |
| 819 EngineTestCase.assertSize(3, list); | 1060 EngineTestCase.assertSize(3, list); |
| 820 JUnitTestCase.assertSame(firstNode, list[0]); | 1061 JUnitTestCase.assertSame(firstNode, list[0]); |
| 821 JUnitTestCase.assertSame(thirdNode, list[1]); | 1062 JUnitTestCase.assertSame(thirdNode, list[1]); |
| 822 JUnitTestCase.assertSame(secondNode, list[2]); | 1063 JUnitTestCase.assertSame(secondNode, list[2]); |
| 823 JUnitTestCase.assertSame(parent, firstNode.parent); | 1064 JUnitTestCase.assertSame(parent, firstNode.parent); |
| 824 JUnitTestCase.assertSame(parent, secondNode.parent); | 1065 JUnitTestCase.assertSame(parent, secondNode.parent); |
| 825 JUnitTestCase.assertSame(parent, thirdNode.parent); | 1066 JUnitTestCase.assertSame(parent, thirdNode.parent); |
| 826 } | 1067 } |
| 1068 |
| 827 void test_add_negative() { | 1069 void test_add_negative() { |
| 828 NodeList<ASTNode> list = new NodeList<ASTNode>(ASTFactory.argumentList([])); | 1070 NodeList<ASTNode> list = new NodeList<ASTNode>(ASTFactory.argumentList([])); |
| 829 try { | 1071 try { |
| 830 list.insert(-1, ASTFactory.booleanLiteral(true)); | 1072 list.insert(-1, ASTFactory.booleanLiteral(true)); |
| 831 JUnitTestCase.fail("Expected IndexOutOfBoundsException"); | 1073 JUnitTestCase.fail("Expected IndexOutOfBoundsException"); |
| 832 } on RangeError catch (exception) { | 1074 } on RangeError catch (exception) { |
| 833 } | 1075 } |
| 834 } | 1076 } |
| 1077 |
| 835 void test_add_tooBig() { | 1078 void test_add_tooBig() { |
| 836 NodeList<ASTNode> list = new NodeList<ASTNode>(ASTFactory.argumentList([])); | 1079 NodeList<ASTNode> list = new NodeList<ASTNode>(ASTFactory.argumentList([])); |
| 837 try { | 1080 try { |
| 838 list.insert(1, ASTFactory.booleanLiteral(true)); | 1081 list.insert(1, ASTFactory.booleanLiteral(true)); |
| 839 JUnitTestCase.fail("Expected IndexOutOfBoundsException"); | 1082 JUnitTestCase.fail("Expected IndexOutOfBoundsException"); |
| 840 } on RangeError catch (exception) { | 1083 } on RangeError catch (exception) { |
| 841 } | 1084 } |
| 842 } | 1085 } |
| 1086 |
| 843 void test_addAll() { | 1087 void test_addAll() { |
| 844 ASTNode parent = ASTFactory.argumentList([]); | 1088 ASTNode parent = ASTFactory.argumentList([]); |
| 845 List<ASTNode> firstNodes = new List<ASTNode>(); | 1089 List<ASTNode> firstNodes = new List<ASTNode>(); |
| 846 ASTNode firstNode = ASTFactory.booleanLiteral(true); | 1090 ASTNode firstNode = ASTFactory.booleanLiteral(true); |
| 847 ASTNode secondNode = ASTFactory.booleanLiteral(false); | 1091 ASTNode secondNode = ASTFactory.booleanLiteral(false); |
| 848 firstNodes.add(firstNode); | 1092 firstNodes.add(firstNode); |
| 849 firstNodes.add(secondNode); | 1093 firstNodes.add(secondNode); |
| 850 NodeList<ASTNode> list = new NodeList<ASTNode>(parent); | 1094 NodeList<ASTNode> list = new NodeList<ASTNode>(parent); |
| 851 list.addAll(firstNodes); | 1095 list.addAll(firstNodes); |
| 852 EngineTestCase.assertSize(2, list); | 1096 EngineTestCase.assertSize(2, list); |
| (...skipping 10 matching lines...) Expand all Loading... |
| 863 EngineTestCase.assertSize(4, list); | 1107 EngineTestCase.assertSize(4, list); |
| 864 JUnitTestCase.assertSame(firstNode, list[0]); | 1108 JUnitTestCase.assertSame(firstNode, list[0]); |
| 865 JUnitTestCase.assertSame(secondNode, list[1]); | 1109 JUnitTestCase.assertSame(secondNode, list[1]); |
| 866 JUnitTestCase.assertSame(thirdNode, list[2]); | 1110 JUnitTestCase.assertSame(thirdNode, list[2]); |
| 867 JUnitTestCase.assertSame(fourthNode, list[3]); | 1111 JUnitTestCase.assertSame(fourthNode, list[3]); |
| 868 JUnitTestCase.assertSame(parent, firstNode.parent); | 1112 JUnitTestCase.assertSame(parent, firstNode.parent); |
| 869 JUnitTestCase.assertSame(parent, secondNode.parent); | 1113 JUnitTestCase.assertSame(parent, secondNode.parent); |
| 870 JUnitTestCase.assertSame(parent, thirdNode.parent); | 1114 JUnitTestCase.assertSame(parent, thirdNode.parent); |
| 871 JUnitTestCase.assertSame(parent, fourthNode.parent); | 1115 JUnitTestCase.assertSame(parent, fourthNode.parent); |
| 872 } | 1116 } |
| 1117 |
| 873 void test_create() { | 1118 void test_create() { |
| 874 ASTNode owner = ASTFactory.argumentList([]); | 1119 ASTNode owner = ASTFactory.argumentList([]); |
| 875 NodeList<ASTNode> list = NodeList.create(owner); | 1120 NodeList<ASTNode> list = NodeList.create(owner); |
| 876 JUnitTestCase.assertNotNull(list); | 1121 JUnitTestCase.assertNotNull(list); |
| 877 EngineTestCase.assertSize(0, list); | 1122 EngineTestCase.assertSize(0, list); |
| 878 JUnitTestCase.assertSame(owner, list.owner); | 1123 JUnitTestCase.assertSame(owner, list.owner); |
| 879 } | 1124 } |
| 1125 |
| 880 void test_creation() { | 1126 void test_creation() { |
| 881 ASTNode owner = ASTFactory.argumentList([]); | 1127 ASTNode owner = ASTFactory.argumentList([]); |
| 882 NodeList<ASTNode> list = new NodeList<ASTNode>(owner); | 1128 NodeList<ASTNode> list = new NodeList<ASTNode>(owner); |
| 883 JUnitTestCase.assertNotNull(list); | 1129 JUnitTestCase.assertNotNull(list); |
| 884 EngineTestCase.assertSize(0, list); | 1130 EngineTestCase.assertSize(0, list); |
| 885 JUnitTestCase.assertSame(owner, list.owner); | 1131 JUnitTestCase.assertSame(owner, list.owner); |
| 886 } | 1132 } |
| 1133 |
| 887 void test_get_negative() { | 1134 void test_get_negative() { |
| 888 NodeList<ASTNode> list = new NodeList<ASTNode>(ASTFactory.argumentList([])); | 1135 NodeList<ASTNode> list = new NodeList<ASTNode>(ASTFactory.argumentList([])); |
| 889 try { | 1136 try { |
| 890 list[-1]; | 1137 list[-1]; |
| 891 JUnitTestCase.fail("Expected IndexOutOfBoundsException"); | 1138 JUnitTestCase.fail("Expected IndexOutOfBoundsException"); |
| 892 } on RangeError catch (exception) { | 1139 } on RangeError catch (exception) { |
| 893 } | 1140 } |
| 894 } | 1141 } |
| 1142 |
| 895 void test_get_tooBig() { | 1143 void test_get_tooBig() { |
| 896 NodeList<ASTNode> list = new NodeList<ASTNode>(ASTFactory.argumentList([])); | 1144 NodeList<ASTNode> list = new NodeList<ASTNode>(ASTFactory.argumentList([])); |
| 897 try { | 1145 try { |
| 898 list[1]; | 1146 list[1]; |
| 899 JUnitTestCase.fail("Expected IndexOutOfBoundsException"); | 1147 JUnitTestCase.fail("Expected IndexOutOfBoundsException"); |
| 900 } on RangeError catch (exception) { | 1148 } on RangeError catch (exception) { |
| 901 } | 1149 } |
| 902 } | 1150 } |
| 1151 |
| 903 void test_getBeginToken_empty() { | 1152 void test_getBeginToken_empty() { |
| 904 NodeList<ASTNode> list = new NodeList<ASTNode>(ASTFactory.argumentList([])); | 1153 NodeList<ASTNode> list = new NodeList<ASTNode>(ASTFactory.argumentList([])); |
| 905 JUnitTestCase.assertNull(list.beginToken); | 1154 JUnitTestCase.assertNull(list.beginToken); |
| 906 } | 1155 } |
| 1156 |
| 907 void test_getBeginToken_nonEmpty() { | 1157 void test_getBeginToken_nonEmpty() { |
| 908 NodeList<ASTNode> list = new NodeList<ASTNode>(ASTFactory.argumentList([])); | 1158 NodeList<ASTNode> list = new NodeList<ASTNode>(ASTFactory.argumentList([])); |
| 909 ASTNode node = ASTFactory.parenthesizedExpression(ASTFactory.booleanLiteral(
true)); | 1159 ASTNode node = ASTFactory.parenthesizedExpression(ASTFactory.booleanLiteral(
true)); |
| 910 list.add(node); | 1160 list.add(node); |
| 911 JUnitTestCase.assertSame(node.beginToken, list.beginToken); | 1161 JUnitTestCase.assertSame(node.beginToken, list.beginToken); |
| 912 } | 1162 } |
| 1163 |
| 913 void test_getEndToken_empty() { | 1164 void test_getEndToken_empty() { |
| 914 NodeList<ASTNode> list = new NodeList<ASTNode>(ASTFactory.argumentList([])); | 1165 NodeList<ASTNode> list = new NodeList<ASTNode>(ASTFactory.argumentList([])); |
| 915 JUnitTestCase.assertNull(list.endToken); | 1166 JUnitTestCase.assertNull(list.endToken); |
| 916 } | 1167 } |
| 1168 |
| 917 void test_getEndToken_nonEmpty() { | 1169 void test_getEndToken_nonEmpty() { |
| 918 NodeList<ASTNode> list = new NodeList<ASTNode>(ASTFactory.argumentList([])); | 1170 NodeList<ASTNode> list = new NodeList<ASTNode>(ASTFactory.argumentList([])); |
| 919 ASTNode node = ASTFactory.parenthesizedExpression(ASTFactory.booleanLiteral(
true)); | 1171 ASTNode node = ASTFactory.parenthesizedExpression(ASTFactory.booleanLiteral(
true)); |
| 920 list.add(node); | 1172 list.add(node); |
| 921 JUnitTestCase.assertSame(node.endToken, list.endToken); | 1173 JUnitTestCase.assertSame(node.endToken, list.endToken); |
| 922 } | 1174 } |
| 1175 |
| 923 void test_indexOf() { | 1176 void test_indexOf() { |
| 924 List<ASTNode> nodes = new List<ASTNode>(); | 1177 List<ASTNode> nodes = new List<ASTNode>(); |
| 925 ASTNode firstNode = ASTFactory.booleanLiteral(true); | 1178 ASTNode firstNode = ASTFactory.booleanLiteral(true); |
| 926 ASTNode secondNode = ASTFactory.booleanLiteral(false); | 1179 ASTNode secondNode = ASTFactory.booleanLiteral(false); |
| 927 ASTNode thirdNode = ASTFactory.booleanLiteral(true); | 1180 ASTNode thirdNode = ASTFactory.booleanLiteral(true); |
| 928 ASTNode fourthNode = ASTFactory.booleanLiteral(false); | 1181 ASTNode fourthNode = ASTFactory.booleanLiteral(false); |
| 929 nodes.add(firstNode); | 1182 nodes.add(firstNode); |
| 930 nodes.add(secondNode); | 1183 nodes.add(secondNode); |
| 931 nodes.add(thirdNode); | 1184 nodes.add(thirdNode); |
| 932 NodeList<ASTNode> list = new NodeList<ASTNode>(ASTFactory.argumentList([])); | 1185 NodeList<ASTNode> list = new NodeList<ASTNode>(ASTFactory.argumentList([])); |
| 933 list.addAll(nodes); | 1186 list.addAll(nodes); |
| 934 EngineTestCase.assertSize(3, list); | 1187 EngineTestCase.assertSize(3, list); |
| 935 JUnitTestCase.assertEquals(0, list.indexOf(firstNode)); | 1188 JUnitTestCase.assertEquals(0, list.indexOf(firstNode)); |
| 936 JUnitTestCase.assertEquals(1, list.indexOf(secondNode)); | 1189 JUnitTestCase.assertEquals(1, list.indexOf(secondNode)); |
| 937 JUnitTestCase.assertEquals(2, list.indexOf(thirdNode)); | 1190 JUnitTestCase.assertEquals(2, list.indexOf(thirdNode)); |
| 938 JUnitTestCase.assertEquals(-1, list.indexOf(fourthNode)); | 1191 JUnitTestCase.assertEquals(-1, list.indexOf(fourthNode)); |
| 939 JUnitTestCase.assertEquals(-1, list.indexOf(null)); | 1192 JUnitTestCase.assertEquals(-1, list.indexOf(null)); |
| 940 } | 1193 } |
| 1194 |
| 941 void test_remove() { | 1195 void test_remove() { |
| 942 List<ASTNode> nodes = new List<ASTNode>(); | 1196 List<ASTNode> nodes = new List<ASTNode>(); |
| 943 ASTNode firstNode = ASTFactory.booleanLiteral(true); | 1197 ASTNode firstNode = ASTFactory.booleanLiteral(true); |
| 944 ASTNode secondNode = ASTFactory.booleanLiteral(false); | 1198 ASTNode secondNode = ASTFactory.booleanLiteral(false); |
| 945 ASTNode thirdNode = ASTFactory.booleanLiteral(true); | 1199 ASTNode thirdNode = ASTFactory.booleanLiteral(true); |
| 946 nodes.add(firstNode); | 1200 nodes.add(firstNode); |
| 947 nodes.add(secondNode); | 1201 nodes.add(secondNode); |
| 948 nodes.add(thirdNode); | 1202 nodes.add(thirdNode); |
| 949 NodeList<ASTNode> list = new NodeList<ASTNode>(ASTFactory.argumentList([])); | 1203 NodeList<ASTNode> list = new NodeList<ASTNode>(ASTFactory.argumentList([])); |
| 950 list.addAll(nodes); | 1204 list.addAll(nodes); |
| 951 EngineTestCase.assertSize(3, list); | 1205 EngineTestCase.assertSize(3, list); |
| 952 JUnitTestCase.assertSame(secondNode, list.removeAt(1)); | 1206 JUnitTestCase.assertSame(secondNode, list.removeAt(1)); |
| 953 EngineTestCase.assertSize(2, list); | 1207 EngineTestCase.assertSize(2, list); |
| 954 JUnitTestCase.assertSame(firstNode, list[0]); | 1208 JUnitTestCase.assertSame(firstNode, list[0]); |
| 955 JUnitTestCase.assertSame(thirdNode, list[1]); | 1209 JUnitTestCase.assertSame(thirdNode, list[1]); |
| 956 } | 1210 } |
| 1211 |
| 957 void test_remove_negative() { | 1212 void test_remove_negative() { |
| 958 NodeList<ASTNode> list = new NodeList<ASTNode>(ASTFactory.argumentList([])); | 1213 NodeList<ASTNode> list = new NodeList<ASTNode>(ASTFactory.argumentList([])); |
| 959 try { | 1214 try { |
| 960 list.removeAt(-1); | 1215 list.removeAt(-1); |
| 961 JUnitTestCase.fail("Expected IndexOutOfBoundsException"); | 1216 JUnitTestCase.fail("Expected IndexOutOfBoundsException"); |
| 962 } on RangeError catch (exception) { | 1217 } on RangeError catch (exception) { |
| 963 } | 1218 } |
| 964 } | 1219 } |
| 1220 |
| 965 void test_remove_tooBig() { | 1221 void test_remove_tooBig() { |
| 966 NodeList<ASTNode> list = new NodeList<ASTNode>(ASTFactory.argumentList([])); | 1222 NodeList<ASTNode> list = new NodeList<ASTNode>(ASTFactory.argumentList([])); |
| 967 try { | 1223 try { |
| 968 list.removeAt(1); | 1224 list.removeAt(1); |
| 969 JUnitTestCase.fail("Expected IndexOutOfBoundsException"); | 1225 JUnitTestCase.fail("Expected IndexOutOfBoundsException"); |
| 970 } on RangeError catch (exception) { | 1226 } on RangeError catch (exception) { |
| 971 } | 1227 } |
| 972 } | 1228 } |
| 1229 |
| 973 void test_set() { | 1230 void test_set() { |
| 974 List<ASTNode> nodes = new List<ASTNode>(); | 1231 List<ASTNode> nodes = new List<ASTNode>(); |
| 975 ASTNode firstNode = ASTFactory.booleanLiteral(true); | 1232 ASTNode firstNode = ASTFactory.booleanLiteral(true); |
| 976 ASTNode secondNode = ASTFactory.booleanLiteral(false); | 1233 ASTNode secondNode = ASTFactory.booleanLiteral(false); |
| 977 ASTNode thirdNode = ASTFactory.booleanLiteral(true); | 1234 ASTNode thirdNode = ASTFactory.booleanLiteral(true); |
| 978 nodes.add(firstNode); | 1235 nodes.add(firstNode); |
| 979 nodes.add(secondNode); | 1236 nodes.add(secondNode); |
| 980 nodes.add(thirdNode); | 1237 nodes.add(thirdNode); |
| 981 NodeList<ASTNode> list = new NodeList<ASTNode>(ASTFactory.argumentList([])); | 1238 NodeList<ASTNode> list = new NodeList<ASTNode>(ASTFactory.argumentList([])); |
| 982 list.addAll(nodes); | 1239 list.addAll(nodes); |
| 983 EngineTestCase.assertSize(3, list); | 1240 EngineTestCase.assertSize(3, list); |
| 984 ASTNode fourthNode = ASTFactory.integer(0); | 1241 ASTNode fourthNode = ASTFactory.integer(0); |
| 985 JUnitTestCase.assertSame(secondNode, javaListSet(list, 1, fourthNode)); | 1242 JUnitTestCase.assertSame(secondNode, javaListSet(list, 1, fourthNode)); |
| 986 EngineTestCase.assertSize(3, list); | 1243 EngineTestCase.assertSize(3, list); |
| 987 JUnitTestCase.assertSame(firstNode, list[0]); | 1244 JUnitTestCase.assertSame(firstNode, list[0]); |
| 988 JUnitTestCase.assertSame(fourthNode, list[1]); | 1245 JUnitTestCase.assertSame(fourthNode, list[1]); |
| 989 JUnitTestCase.assertSame(thirdNode, list[2]); | 1246 JUnitTestCase.assertSame(thirdNode, list[2]); |
| 990 } | 1247 } |
| 1248 |
| 991 void test_set_negative() { | 1249 void test_set_negative() { |
| 992 ASTNode node = ASTFactory.booleanLiteral(true); | 1250 ASTNode node = ASTFactory.booleanLiteral(true); |
| 993 NodeList<ASTNode> list = new NodeList<ASTNode>(ASTFactory.argumentList([])); | 1251 NodeList<ASTNode> list = new NodeList<ASTNode>(ASTFactory.argumentList([])); |
| 994 try { | 1252 try { |
| 995 javaListSet(list, -1, node); | 1253 javaListSet(list, -1, node); |
| 996 JUnitTestCase.fail("Expected IndexOutOfBoundsException"); | 1254 JUnitTestCase.fail("Expected IndexOutOfBoundsException"); |
| 997 } on RangeError catch (exception) { | 1255 } on RangeError catch (exception) { |
| 998 } | 1256 } |
| 999 } | 1257 } |
| 1258 |
| 1000 void test_set_tooBig() { | 1259 void test_set_tooBig() { |
| 1001 ASTNode node = ASTFactory.booleanLiteral(true); | 1260 ASTNode node = ASTFactory.booleanLiteral(true); |
| 1002 NodeList<ASTNode> list = new NodeList<ASTNode>(ASTFactory.argumentList([])); | 1261 NodeList<ASTNode> list = new NodeList<ASTNode>(ASTFactory.argumentList([])); |
| 1003 try { | 1262 try { |
| 1004 javaListSet(list, 1, node); | 1263 javaListSet(list, 1, node); |
| 1005 JUnitTestCase.fail("Expected IndexOutOfBoundsException"); | 1264 JUnitTestCase.fail("Expected IndexOutOfBoundsException"); |
| 1006 } on RangeError catch (exception) { | 1265 } on RangeError catch (exception) { |
| 1007 } | 1266 } |
| 1008 } | 1267 } |
| 1268 |
| 1009 static dartSuite() { | 1269 static dartSuite() { |
| 1010 _ut.group('NodeListTest', () { | 1270 _ut.group('NodeListTest', () { |
| 1011 _ut.test('test_add', () { | 1271 _ut.test('test_add', () { |
| 1012 final __test = new NodeListTest(); | 1272 final __test = new NodeListTest(); |
| 1013 runJUnitTest(__test, __test.test_add); | 1273 runJUnitTest(__test, __test.test_add); |
| 1014 }); | 1274 }); |
| 1015 _ut.test('test_addAll', () { | 1275 _ut.test('test_addAll', () { |
| 1016 final __test = new NodeListTest(); | 1276 final __test = new NodeListTest(); |
| 1017 runJUnitTest(__test, __test.test_addAll); | 1277 runJUnitTest(__test, __test.test_addAll); |
| 1018 }); | 1278 }); |
| (...skipping 61 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1080 final __test = new NodeListTest(); | 1340 final __test = new NodeListTest(); |
| 1081 runJUnitTest(__test, __test.test_set_negative); | 1341 runJUnitTest(__test, __test.test_set_negative); |
| 1082 }); | 1342 }); |
| 1083 _ut.test('test_set_tooBig', () { | 1343 _ut.test('test_set_tooBig', () { |
| 1084 final __test = new NodeListTest(); | 1344 final __test = new NodeListTest(); |
| 1085 runJUnitTest(__test, __test.test_set_tooBig); | 1345 runJUnitTest(__test, __test.test_set_tooBig); |
| 1086 }); | 1346 }); |
| 1087 }); | 1347 }); |
| 1088 } | 1348 } |
| 1089 } | 1349 } |
| 1350 |
| 1090 class ConstantEvaluatorTest extends ParserTestCase { | 1351 class ConstantEvaluatorTest extends ParserTestCase { |
| 1091 void fail_constructor() { | 1352 void fail_constructor() { |
| 1092 Object value = getConstantValue("?"); | 1353 Object value = getConstantValue("?"); |
| 1093 JUnitTestCase.assertEquals(null, value); | 1354 JUnitTestCase.assertEquals(null, value); |
| 1094 } | 1355 } |
| 1356 |
| 1095 void fail_identifier_class() { | 1357 void fail_identifier_class() { |
| 1096 Object value = getConstantValue("?"); | 1358 Object value = getConstantValue("?"); |
| 1097 JUnitTestCase.assertEquals(null, value); | 1359 JUnitTestCase.assertEquals(null, value); |
| 1098 } | 1360 } |
| 1361 |
| 1099 void fail_identifier_function() { | 1362 void fail_identifier_function() { |
| 1100 Object value = getConstantValue("?"); | 1363 Object value = getConstantValue("?"); |
| 1101 JUnitTestCase.assertEquals(null, value); | 1364 JUnitTestCase.assertEquals(null, value); |
| 1102 } | 1365 } |
| 1366 |
| 1103 void fail_identifier_static() { | 1367 void fail_identifier_static() { |
| 1104 Object value = getConstantValue("?"); | 1368 Object value = getConstantValue("?"); |
| 1105 JUnitTestCase.assertEquals(null, value); | 1369 JUnitTestCase.assertEquals(null, value); |
| 1106 } | 1370 } |
| 1371 |
| 1107 void fail_identifier_staticMethod() { | 1372 void fail_identifier_staticMethod() { |
| 1108 Object value = getConstantValue("?"); | 1373 Object value = getConstantValue("?"); |
| 1109 JUnitTestCase.assertEquals(null, value); | 1374 JUnitTestCase.assertEquals(null, value); |
| 1110 } | 1375 } |
| 1376 |
| 1111 void fail_identifier_topLevel() { | 1377 void fail_identifier_topLevel() { |
| 1112 Object value = getConstantValue("?"); | 1378 Object value = getConstantValue("?"); |
| 1113 JUnitTestCase.assertEquals(null, value); | 1379 JUnitTestCase.assertEquals(null, value); |
| 1114 } | 1380 } |
| 1381 |
| 1115 void fail_identifier_typeParameter() { | 1382 void fail_identifier_typeParameter() { |
| 1116 Object value = getConstantValue("?"); | 1383 Object value = getConstantValue("?"); |
| 1117 JUnitTestCase.assertEquals(null, value); | 1384 JUnitTestCase.assertEquals(null, value); |
| 1118 } | 1385 } |
| 1386 |
| 1119 void test_binary_bitAnd() { | 1387 void test_binary_bitAnd() { |
| 1120 Object value = getConstantValue("74 & 42"); | 1388 Object value = getConstantValue("74 & 42"); |
| 1121 EngineTestCase.assertInstanceOf(int, value); | 1389 EngineTestCase.assertInstanceOf(int, value); |
| 1122 JUnitTestCase.assertEquals(74 & 42, value as int); | 1390 JUnitTestCase.assertEquals(74 & 42, value as int); |
| 1123 } | 1391 } |
| 1392 |
| 1124 void test_binary_bitOr() { | 1393 void test_binary_bitOr() { |
| 1125 Object value = getConstantValue("74 | 42"); | 1394 Object value = getConstantValue("74 | 42"); |
| 1126 EngineTestCase.assertInstanceOf(int, value); | 1395 EngineTestCase.assertInstanceOf(int, value); |
| 1127 JUnitTestCase.assertEquals(74 | 42, value as int); | 1396 JUnitTestCase.assertEquals(74 | 42, value as int); |
| 1128 } | 1397 } |
| 1398 |
| 1129 void test_binary_bitXor() { | 1399 void test_binary_bitXor() { |
| 1130 Object value = getConstantValue("74 ^ 42"); | 1400 Object value = getConstantValue("74 ^ 42"); |
| 1131 EngineTestCase.assertInstanceOf(int, value); | 1401 EngineTestCase.assertInstanceOf(int, value); |
| 1132 JUnitTestCase.assertEquals(74 ^ 42, value as int); | 1402 JUnitTestCase.assertEquals(74 ^ 42, value as int); |
| 1133 } | 1403 } |
| 1404 |
| 1134 void test_binary_divide_double() { | 1405 void test_binary_divide_double() { |
| 1135 Object value = getConstantValue("3.2 / 2.3"); | 1406 Object value = getConstantValue("3.2 / 2.3"); |
| 1136 EngineTestCase.assertInstanceOf(double, value); | 1407 EngineTestCase.assertInstanceOf(double, value); |
| 1137 JUnitTestCase.assertEquals(3.2 / 2.3, value as double); | 1408 JUnitTestCase.assertEquals(3.2 / 2.3, value as double); |
| 1138 } | 1409 } |
| 1410 |
| 1139 void test_binary_divide_integer() { | 1411 void test_binary_divide_integer() { |
| 1140 Object value = getConstantValue("3 / 2"); | 1412 Object value = getConstantValue("3 / 2"); |
| 1141 EngineTestCase.assertInstanceOf(int, value); | 1413 EngineTestCase.assertInstanceOf(int, value); |
| 1142 JUnitTestCase.assertEquals(1, value as int); | 1414 JUnitTestCase.assertEquals(1, value as int); |
| 1143 } | 1415 } |
| 1416 |
| 1144 void test_binary_equal_boolean() { | 1417 void test_binary_equal_boolean() { |
| 1145 Object value = getConstantValue("true == false"); | 1418 Object value = getConstantValue("true == false"); |
| 1146 JUnitTestCase.assertEquals(false, value); | 1419 JUnitTestCase.assertEquals(false, value); |
| 1147 } | 1420 } |
| 1421 |
| 1148 void test_binary_equal_integer() { | 1422 void test_binary_equal_integer() { |
| 1149 Object value = getConstantValue("2 == 3"); | 1423 Object value = getConstantValue("2 == 3"); |
| 1150 JUnitTestCase.assertEquals(false, value); | 1424 JUnitTestCase.assertEquals(false, value); |
| 1151 } | 1425 } |
| 1426 |
| 1152 void test_binary_equal_invalidLeft() { | 1427 void test_binary_equal_invalidLeft() { |
| 1153 Object value = getConstantValue("a == 3"); | 1428 Object value = getConstantValue("a == 3"); |
| 1154 JUnitTestCase.assertEquals(ConstantEvaluator.NOT_A_CONSTANT, value); | 1429 JUnitTestCase.assertEquals(ConstantEvaluator.NOT_A_CONSTANT, value); |
| 1155 } | 1430 } |
| 1431 |
| 1156 void test_binary_equal_invalidRight() { | 1432 void test_binary_equal_invalidRight() { |
| 1157 Object value = getConstantValue("2 == a"); | 1433 Object value = getConstantValue("2 == a"); |
| 1158 JUnitTestCase.assertEquals(ConstantEvaluator.NOT_A_CONSTANT, value); | 1434 JUnitTestCase.assertEquals(ConstantEvaluator.NOT_A_CONSTANT, value); |
| 1159 } | 1435 } |
| 1436 |
| 1160 void test_binary_equal_string() { | 1437 void test_binary_equal_string() { |
| 1161 Object value = getConstantValue("'a' == 'b'"); | 1438 Object value = getConstantValue("'a' == 'b'"); |
| 1162 JUnitTestCase.assertEquals(false, value); | 1439 JUnitTestCase.assertEquals(false, value); |
| 1163 } | 1440 } |
| 1441 |
| 1164 void test_binary_greaterThan() { | 1442 void test_binary_greaterThan() { |
| 1165 Object value = getConstantValue("2 > 3"); | 1443 Object value = getConstantValue("2 > 3"); |
| 1166 JUnitTestCase.assertEquals(false, value); | 1444 JUnitTestCase.assertEquals(false, value); |
| 1167 } | 1445 } |
| 1446 |
| 1168 void test_binary_greaterThanOrEqual() { | 1447 void test_binary_greaterThanOrEqual() { |
| 1169 Object value = getConstantValue("2 >= 3"); | 1448 Object value = getConstantValue("2 >= 3"); |
| 1170 JUnitTestCase.assertEquals(false, value); | 1449 JUnitTestCase.assertEquals(false, value); |
| 1171 } | 1450 } |
| 1451 |
| 1172 void test_binary_leftShift() { | 1452 void test_binary_leftShift() { |
| 1173 Object value = getConstantValue("16 << 2"); | 1453 Object value = getConstantValue("16 << 2"); |
| 1174 EngineTestCase.assertInstanceOf(int, value); | 1454 EngineTestCase.assertInstanceOf(int, value); |
| 1175 JUnitTestCase.assertEquals(64, value as int); | 1455 JUnitTestCase.assertEquals(64, value as int); |
| 1176 } | 1456 } |
| 1457 |
| 1177 void test_binary_lessThan() { | 1458 void test_binary_lessThan() { |
| 1178 Object value = getConstantValue("2 < 3"); | 1459 Object value = getConstantValue("2 < 3"); |
| 1179 JUnitTestCase.assertEquals(true, value); | 1460 JUnitTestCase.assertEquals(true, value); |
| 1180 } | 1461 } |
| 1462 |
| 1181 void test_binary_lessThanOrEqual() { | 1463 void test_binary_lessThanOrEqual() { |
| 1182 Object value = getConstantValue("2 <= 3"); | 1464 Object value = getConstantValue("2 <= 3"); |
| 1183 JUnitTestCase.assertEquals(true, value); | 1465 JUnitTestCase.assertEquals(true, value); |
| 1184 } | 1466 } |
| 1467 |
| 1185 void test_binary_logicalAnd() { | 1468 void test_binary_logicalAnd() { |
| 1186 Object value = getConstantValue("true && false"); | 1469 Object value = getConstantValue("true && false"); |
| 1187 JUnitTestCase.assertEquals(false, value); | 1470 JUnitTestCase.assertEquals(false, value); |
| 1188 } | 1471 } |
| 1472 |
| 1189 void test_binary_logicalOr() { | 1473 void test_binary_logicalOr() { |
| 1190 Object value = getConstantValue("true || false"); | 1474 Object value = getConstantValue("true || false"); |
| 1191 JUnitTestCase.assertEquals(true, value); | 1475 JUnitTestCase.assertEquals(true, value); |
| 1192 } | 1476 } |
| 1477 |
| 1193 void test_binary_minus_double() { | 1478 void test_binary_minus_double() { |
| 1194 Object value = getConstantValue("3.2 - 2.3"); | 1479 Object value = getConstantValue("3.2 - 2.3"); |
| 1195 EngineTestCase.assertInstanceOf(double, value); | 1480 EngineTestCase.assertInstanceOf(double, value); |
| 1196 JUnitTestCase.assertEquals(3.2 - 2.3, value as double); | 1481 JUnitTestCase.assertEquals(3.2 - 2.3, value as double); |
| 1197 } | 1482 } |
| 1483 |
| 1198 void test_binary_minus_integer() { | 1484 void test_binary_minus_integer() { |
| 1199 Object value = getConstantValue("3 - 2"); | 1485 Object value = getConstantValue("3 - 2"); |
| 1200 EngineTestCase.assertInstanceOf(int, value); | 1486 EngineTestCase.assertInstanceOf(int, value); |
| 1201 JUnitTestCase.assertEquals(1, value as int); | 1487 JUnitTestCase.assertEquals(1, value as int); |
| 1202 } | 1488 } |
| 1489 |
| 1203 void test_binary_notEqual_boolean() { | 1490 void test_binary_notEqual_boolean() { |
| 1204 Object value = getConstantValue("true != false"); | 1491 Object value = getConstantValue("true != false"); |
| 1205 JUnitTestCase.assertEquals(true, value); | 1492 JUnitTestCase.assertEquals(true, value); |
| 1206 } | 1493 } |
| 1494 |
| 1207 void test_binary_notEqual_integer() { | 1495 void test_binary_notEqual_integer() { |
| 1208 Object value = getConstantValue("2 != 3"); | 1496 Object value = getConstantValue("2 != 3"); |
| 1209 JUnitTestCase.assertEquals(true, value); | 1497 JUnitTestCase.assertEquals(true, value); |
| 1210 } | 1498 } |
| 1499 |
| 1211 void test_binary_notEqual_invalidLeft() { | 1500 void test_binary_notEqual_invalidLeft() { |
| 1212 Object value = getConstantValue("a != 3"); | 1501 Object value = getConstantValue("a != 3"); |
| 1213 JUnitTestCase.assertEquals(ConstantEvaluator.NOT_A_CONSTANT, value); | 1502 JUnitTestCase.assertEquals(ConstantEvaluator.NOT_A_CONSTANT, value); |
| 1214 } | 1503 } |
| 1504 |
| 1215 void test_binary_notEqual_invalidRight() { | 1505 void test_binary_notEqual_invalidRight() { |
| 1216 Object value = getConstantValue("2 != a"); | 1506 Object value = getConstantValue("2 != a"); |
| 1217 JUnitTestCase.assertEquals(ConstantEvaluator.NOT_A_CONSTANT, value); | 1507 JUnitTestCase.assertEquals(ConstantEvaluator.NOT_A_CONSTANT, value); |
| 1218 } | 1508 } |
| 1509 |
| 1219 void test_binary_notEqual_string() { | 1510 void test_binary_notEqual_string() { |
| 1220 Object value = getConstantValue("'a' != 'b'"); | 1511 Object value = getConstantValue("'a' != 'b'"); |
| 1221 JUnitTestCase.assertEquals(true, value); | 1512 JUnitTestCase.assertEquals(true, value); |
| 1222 } | 1513 } |
| 1514 |
| 1223 void test_binary_plus_double() { | 1515 void test_binary_plus_double() { |
| 1224 Object value = getConstantValue("2.3 + 3.2"); | 1516 Object value = getConstantValue("2.3 + 3.2"); |
| 1225 EngineTestCase.assertInstanceOf(double, value); | 1517 EngineTestCase.assertInstanceOf(double, value); |
| 1226 JUnitTestCase.assertEquals(2.3 + 3.2, value as double); | 1518 JUnitTestCase.assertEquals(2.3 + 3.2, value as double); |
| 1227 } | 1519 } |
| 1520 |
| 1228 void test_binary_plus_integer() { | 1521 void test_binary_plus_integer() { |
| 1229 Object value = getConstantValue("2 + 3"); | 1522 Object value = getConstantValue("2 + 3"); |
| 1230 EngineTestCase.assertInstanceOf(int, value); | 1523 EngineTestCase.assertInstanceOf(int, value); |
| 1231 JUnitTestCase.assertEquals(5, value as int); | 1524 JUnitTestCase.assertEquals(5, value as int); |
| 1232 } | 1525 } |
| 1526 |
| 1233 void test_binary_remainder_double() { | 1527 void test_binary_remainder_double() { |
| 1234 Object value = getConstantValue("3.2 % 2.3"); | 1528 Object value = getConstantValue("3.2 % 2.3"); |
| 1235 EngineTestCase.assertInstanceOf(double, value); | 1529 EngineTestCase.assertInstanceOf(double, value); |
| 1236 JUnitTestCase.assertEquals(3.2 % 2.3, value as double); | 1530 JUnitTestCase.assertEquals(3.2 % 2.3, value as double); |
| 1237 } | 1531 } |
| 1532 |
| 1238 void test_binary_remainder_integer() { | 1533 void test_binary_remainder_integer() { |
| 1239 Object value = getConstantValue("8 % 3"); | 1534 Object value = getConstantValue("8 % 3"); |
| 1240 EngineTestCase.assertInstanceOf(int, value); | 1535 EngineTestCase.assertInstanceOf(int, value); |
| 1241 JUnitTestCase.assertEquals(2, value as int); | 1536 JUnitTestCase.assertEquals(2, value as int); |
| 1242 } | 1537 } |
| 1538 |
| 1243 void test_binary_rightShift() { | 1539 void test_binary_rightShift() { |
| 1244 Object value = getConstantValue("64 >> 2"); | 1540 Object value = getConstantValue("64 >> 2"); |
| 1245 EngineTestCase.assertInstanceOf(int, value); | 1541 EngineTestCase.assertInstanceOf(int, value); |
| 1246 JUnitTestCase.assertEquals(16, value as int); | 1542 JUnitTestCase.assertEquals(16, value as int); |
| 1247 } | 1543 } |
| 1544 |
| 1248 void test_binary_times_double() { | 1545 void test_binary_times_double() { |
| 1249 Object value = getConstantValue("2.3 * 3.2"); | 1546 Object value = getConstantValue("2.3 * 3.2"); |
| 1250 EngineTestCase.assertInstanceOf(double, value); | 1547 EngineTestCase.assertInstanceOf(double, value); |
| 1251 JUnitTestCase.assertEquals(2.3 * 3.2, value as double); | 1548 JUnitTestCase.assertEquals(2.3 * 3.2, value as double); |
| 1252 } | 1549 } |
| 1550 |
| 1253 void test_binary_times_integer() { | 1551 void test_binary_times_integer() { |
| 1254 Object value = getConstantValue("2 * 3"); | 1552 Object value = getConstantValue("2 * 3"); |
| 1255 EngineTestCase.assertInstanceOf(int, value); | 1553 EngineTestCase.assertInstanceOf(int, value); |
| 1256 JUnitTestCase.assertEquals(6, value as int); | 1554 JUnitTestCase.assertEquals(6, value as int); |
| 1257 } | 1555 } |
| 1556 |
| 1258 void test_binary_truncatingDivide_double() { | 1557 void test_binary_truncatingDivide_double() { |
| 1259 Object value = getConstantValue("3.2 ~/ 2.3"); | 1558 Object value = getConstantValue("3.2 ~/ 2.3"); |
| 1260 EngineTestCase.assertInstanceOf(int, value); | 1559 EngineTestCase.assertInstanceOf(int, value); |
| 1261 JUnitTestCase.assertEquals(1, value as int); | 1560 JUnitTestCase.assertEquals(1, value as int); |
| 1262 } | 1561 } |
| 1562 |
| 1263 void test_binary_truncatingDivide_integer() { | 1563 void test_binary_truncatingDivide_integer() { |
| 1264 Object value = getConstantValue("10 ~/ 3"); | 1564 Object value = getConstantValue("10 ~/ 3"); |
| 1265 EngineTestCase.assertInstanceOf(int, value); | 1565 EngineTestCase.assertInstanceOf(int, value); |
| 1266 JUnitTestCase.assertEquals(3, value as int); | 1566 JUnitTestCase.assertEquals(3, value as int); |
| 1267 } | 1567 } |
| 1568 |
| 1268 void test_literal_boolean_false() { | 1569 void test_literal_boolean_false() { |
| 1269 Object value = getConstantValue("false"); | 1570 Object value = getConstantValue("false"); |
| 1270 JUnitTestCase.assertEquals(false, value); | 1571 JUnitTestCase.assertEquals(false, value); |
| 1271 } | 1572 } |
| 1573 |
| 1272 void test_literal_boolean_true() { | 1574 void test_literal_boolean_true() { |
| 1273 Object value = getConstantValue("true"); | 1575 Object value = getConstantValue("true"); |
| 1274 JUnitTestCase.assertEquals(true, value); | 1576 JUnitTestCase.assertEquals(true, value); |
| 1275 } | 1577 } |
| 1578 |
| 1276 void test_literal_list() { | 1579 void test_literal_list() { |
| 1277 Object value = getConstantValue("['a', 'b', 'c']"); | 1580 Object value = getConstantValue("['a', 'b', 'c']"); |
| 1278 EngineTestCase.assertInstanceOf(List, value); | 1581 EngineTestCase.assertInstanceOf(List, value); |
| 1279 List list = value as List; | 1582 List list = value as List; |
| 1280 JUnitTestCase.assertEquals(3, list.length); | 1583 JUnitTestCase.assertEquals(3, list.length); |
| 1281 JUnitTestCase.assertEquals("a", list[0]); | 1584 JUnitTestCase.assertEquals("a", list[0]); |
| 1282 JUnitTestCase.assertEquals("b", list[1]); | 1585 JUnitTestCase.assertEquals("b", list[1]); |
| 1283 JUnitTestCase.assertEquals("c", list[2]); | 1586 JUnitTestCase.assertEquals("c", list[2]); |
| 1284 } | 1587 } |
| 1588 |
| 1285 void test_literal_map() { | 1589 void test_literal_map() { |
| 1286 Object value = getConstantValue("{'a' : 'm', 'b' : 'n', 'c' : 'o'}"); | 1590 Object value = getConstantValue("{'a' : 'm', 'b' : 'n', 'c' : 'o'}"); |
| 1287 EngineTestCase.assertInstanceOf(Map, value); | 1591 EngineTestCase.assertInstanceOf(Map, value); |
| 1288 Map map = value as Map; | 1592 Map map = value as Map; |
| 1289 JUnitTestCase.assertEquals(3, map.length); | 1593 JUnitTestCase.assertEquals(3, map.length); |
| 1290 JUnitTestCase.assertEquals("m", map["a"]); | 1594 JUnitTestCase.assertEquals("m", map["a"]); |
| 1291 JUnitTestCase.assertEquals("n", map["b"]); | 1595 JUnitTestCase.assertEquals("n", map["b"]); |
| 1292 JUnitTestCase.assertEquals("o", map["c"]); | 1596 JUnitTestCase.assertEquals("o", map["c"]); |
| 1293 } | 1597 } |
| 1598 |
| 1294 void test_literal_null() { | 1599 void test_literal_null() { |
| 1295 Object value = getConstantValue("null"); | 1600 Object value = getConstantValue("null"); |
| 1296 JUnitTestCase.assertEquals(null, value); | 1601 JUnitTestCase.assertEquals(null, value); |
| 1297 } | 1602 } |
| 1603 |
| 1298 void test_literal_number_double() { | 1604 void test_literal_number_double() { |
| 1299 Object value = getConstantValue("3.45"); | 1605 Object value = getConstantValue("3.45"); |
| 1300 EngineTestCase.assertInstanceOf(double, value); | 1606 EngineTestCase.assertInstanceOf(double, value); |
| 1301 JUnitTestCase.assertEquals(3.45, value as double); | 1607 JUnitTestCase.assertEquals(3.45, value as double); |
| 1302 } | 1608 } |
| 1609 |
| 1303 void test_literal_number_integer() { | 1610 void test_literal_number_integer() { |
| 1304 Object value = getConstantValue("42"); | 1611 Object value = getConstantValue("42"); |
| 1305 EngineTestCase.assertInstanceOf(int, value); | 1612 EngineTestCase.assertInstanceOf(int, value); |
| 1306 JUnitTestCase.assertEquals(42, value as int); | 1613 JUnitTestCase.assertEquals(42, value as int); |
| 1307 } | 1614 } |
| 1615 |
| 1308 void test_literal_string_adjacent() { | 1616 void test_literal_string_adjacent() { |
| 1309 Object value = getConstantValue("'abc' 'def'"); | 1617 Object value = getConstantValue("'abc' 'def'"); |
| 1310 JUnitTestCase.assertEquals("abcdef", value); | 1618 JUnitTestCase.assertEquals("abcdef", value); |
| 1311 } | 1619 } |
| 1620 |
| 1312 void test_literal_string_interpolation_invalid() { | 1621 void test_literal_string_interpolation_invalid() { |
| 1313 Object value = getConstantValue("'a\${f()}c'"); | 1622 Object value = getConstantValue("'a\${f()}c'"); |
| 1314 JUnitTestCase.assertEquals(ConstantEvaluator.NOT_A_CONSTANT, value); | 1623 JUnitTestCase.assertEquals(ConstantEvaluator.NOT_A_CONSTANT, value); |
| 1315 } | 1624 } |
| 1625 |
| 1316 void test_literal_string_interpolation_valid() { | 1626 void test_literal_string_interpolation_valid() { |
| 1317 Object value = getConstantValue("'a\${3}c'"); | 1627 Object value = getConstantValue("'a\${3}c'"); |
| 1318 JUnitTestCase.assertEquals("a3c", value); | 1628 JUnitTestCase.assertEquals("a3c", value); |
| 1319 } | 1629 } |
| 1630 |
| 1320 void test_literal_string_simple() { | 1631 void test_literal_string_simple() { |
| 1321 Object value = getConstantValue("'abc'"); | 1632 Object value = getConstantValue("'abc'"); |
| 1322 JUnitTestCase.assertEquals("abc", value); | 1633 JUnitTestCase.assertEquals("abc", value); |
| 1323 } | 1634 } |
| 1635 |
| 1324 void test_parenthesizedExpression() { | 1636 void test_parenthesizedExpression() { |
| 1325 Object value = getConstantValue("('a')"); | 1637 Object value = getConstantValue("('a')"); |
| 1326 JUnitTestCase.assertEquals("a", value); | 1638 JUnitTestCase.assertEquals("a", value); |
| 1327 } | 1639 } |
| 1640 |
| 1328 void test_unary_bitNot() { | 1641 void test_unary_bitNot() { |
| 1329 Object value = getConstantValue("~42"); | 1642 Object value = getConstantValue("~42"); |
| 1330 EngineTestCase.assertInstanceOf(int, value); | 1643 EngineTestCase.assertInstanceOf(int, value); |
| 1331 JUnitTestCase.assertEquals(~42, value as int); | 1644 JUnitTestCase.assertEquals(~42, value as int); |
| 1332 } | 1645 } |
| 1646 |
| 1333 void test_unary_logicalNot() { | 1647 void test_unary_logicalNot() { |
| 1334 Object value = getConstantValue("!true"); | 1648 Object value = getConstantValue("!true"); |
| 1335 JUnitTestCase.assertEquals(false, value); | 1649 JUnitTestCase.assertEquals(false, value); |
| 1336 } | 1650 } |
| 1651 |
| 1337 void test_unary_negated_double() { | 1652 void test_unary_negated_double() { |
| 1338 Object value = getConstantValue("-42.3"); | 1653 Object value = getConstantValue("-42.3"); |
| 1339 EngineTestCase.assertInstanceOf(double, value); | 1654 EngineTestCase.assertInstanceOf(double, value); |
| 1340 JUnitTestCase.assertEquals(-42.3, value as double); | 1655 JUnitTestCase.assertEquals(-42.3, value as double); |
| 1341 } | 1656 } |
| 1657 |
| 1342 void test_unary_negated_integer() { | 1658 void test_unary_negated_integer() { |
| 1343 Object value = getConstantValue("-42"); | 1659 Object value = getConstantValue("-42"); |
| 1344 EngineTestCase.assertInstanceOf(int, value); | 1660 EngineTestCase.assertInstanceOf(int, value); |
| 1345 JUnitTestCase.assertEquals(-42, value as int); | 1661 JUnitTestCase.assertEquals(-42, value as int); |
| 1346 } | 1662 } |
| 1663 |
| 1347 Object getConstantValue(String source) => ParserTestCase.parseExpression(sourc
e, []).accept(new ConstantEvaluator()); | 1664 Object getConstantValue(String source) => ParserTestCase.parseExpression(sourc
e, []).accept(new ConstantEvaluator()); |
| 1665 |
| 1348 static dartSuite() { | 1666 static dartSuite() { |
| 1349 _ut.group('ConstantEvaluatorTest', () { | 1667 _ut.group('ConstantEvaluatorTest', () { |
| 1350 _ut.test('test_binary_bitAnd', () { | 1668 _ut.test('test_binary_bitAnd', () { |
| 1351 final __test = new ConstantEvaluatorTest(); | 1669 final __test = new ConstantEvaluatorTest(); |
| 1352 runJUnitTest(__test, __test.test_binary_bitAnd); | 1670 runJUnitTest(__test, __test.test_binary_bitAnd); |
| 1353 }); | 1671 }); |
| 1354 _ut.test('test_binary_bitOr', () { | 1672 _ut.test('test_binary_bitOr', () { |
| 1355 final __test = new ConstantEvaluatorTest(); | 1673 final __test = new ConstantEvaluatorTest(); |
| 1356 runJUnitTest(__test, __test.test_binary_bitOr); | 1674 runJUnitTest(__test, __test.test_binary_bitOr); |
| 1357 }); | 1675 }); |
| (...skipping 181 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1539 final __test = new ConstantEvaluatorTest(); | 1857 final __test = new ConstantEvaluatorTest(); |
| 1540 runJUnitTest(__test, __test.test_unary_negated_double); | 1858 runJUnitTest(__test, __test.test_unary_negated_double); |
| 1541 }); | 1859 }); |
| 1542 _ut.test('test_unary_negated_integer', () { | 1860 _ut.test('test_unary_negated_integer', () { |
| 1543 final __test = new ConstantEvaluatorTest(); | 1861 final __test = new ConstantEvaluatorTest(); |
| 1544 runJUnitTest(__test, __test.test_unary_negated_integer); | 1862 runJUnitTest(__test, __test.test_unary_negated_integer); |
| 1545 }); | 1863 }); |
| 1546 }); | 1864 }); |
| 1547 } | 1865 } |
| 1548 } | 1866 } |
| 1867 |
| 1549 class ToSourceVisitorTest extends EngineTestCase { | 1868 class ToSourceVisitorTest extends EngineTestCase { |
| 1550 void test_visitAdjacentStrings() { | 1869 void test_visitAdjacentStrings() { |
| 1551 assertSource("'a' 'b'", ASTFactory.adjacentStrings([ASTFactory.string2("a"),
ASTFactory.string2("b")])); | 1870 assertSource("'a' 'b'", ASTFactory.adjacentStrings([ASTFactory.string2("a"),
ASTFactory.string2("b")])); |
| 1552 } | 1871 } |
| 1872 |
| 1553 void test_visitAnnotation_constant() { | 1873 void test_visitAnnotation_constant() { |
| 1554 assertSource("@A", ASTFactory.annotation(ASTFactory.identifier3("A"))); | 1874 assertSource("@A", ASTFactory.annotation(ASTFactory.identifier3("A"))); |
| 1555 } | 1875 } |
| 1876 |
| 1556 void test_visitAnnotation_constructor() { | 1877 void test_visitAnnotation_constructor() { |
| 1557 assertSource("@A.c()", ASTFactory.annotation2(ASTFactory.identifier3("A"), A
STFactory.identifier3("c"), ASTFactory.argumentList([]))); | 1878 assertSource("@A.c()", ASTFactory.annotation2(ASTFactory.identifier3("A"), A
STFactory.identifier3("c"), ASTFactory.argumentList([]))); |
| 1558 } | 1879 } |
| 1880 |
| 1559 void test_visitArgumentDefinitionTest() { | 1881 void test_visitArgumentDefinitionTest() { |
| 1560 assertSource("?a", ASTFactory.argumentDefinitionTest("a")); | 1882 assertSource("?a", ASTFactory.argumentDefinitionTest("a")); |
| 1561 } | 1883 } |
| 1884 |
| 1562 void test_visitArgumentList() { | 1885 void test_visitArgumentList() { |
| 1563 assertSource("(a, b)", ASTFactory.argumentList([ASTFactory.identifier3("a"),
ASTFactory.identifier3("b")])); | 1886 assertSource("(a, b)", ASTFactory.argumentList([ASTFactory.identifier3("a"),
ASTFactory.identifier3("b")])); |
| 1564 } | 1887 } |
| 1888 |
| 1565 void test_visitAsExpression() { | 1889 void test_visitAsExpression() { |
| 1566 assertSource("e as T", ASTFactory.asExpression(ASTFactory.identifier3("e"),
ASTFactory.typeName4("T", []))); | 1890 assertSource("e as T", ASTFactory.asExpression(ASTFactory.identifier3("e"),
ASTFactory.typeName4("T", []))); |
| 1567 } | 1891 } |
| 1892 |
| 1568 void test_visitAssertStatement() { | 1893 void test_visitAssertStatement() { |
| 1569 assertSource("assert (a);", ASTFactory.assertStatement(ASTFactory.identifier
3("a"))); | 1894 assertSource("assert (a);", ASTFactory.assertStatement(ASTFactory.identifier
3("a"))); |
| 1570 } | 1895 } |
| 1896 |
| 1571 void test_visitAssignmentExpression() { | 1897 void test_visitAssignmentExpression() { |
| 1572 assertSource("a = b", ASTFactory.assignmentExpression(ASTFactory.identifier3
("a"), TokenType.EQ, ASTFactory.identifier3("b"))); | 1898 assertSource("a = b", ASTFactory.assignmentExpression(ASTFactory.identifier3
("a"), TokenType.EQ, ASTFactory.identifier3("b"))); |
| 1573 } | 1899 } |
| 1900 |
| 1574 void test_visitBinaryExpression() { | 1901 void test_visitBinaryExpression() { |
| 1575 assertSource("a + b", ASTFactory.binaryExpression(ASTFactory.identifier3("a"
), TokenType.PLUS, ASTFactory.identifier3("b"))); | 1902 assertSource("a + b", ASTFactory.binaryExpression(ASTFactory.identifier3("a"
), TokenType.PLUS, ASTFactory.identifier3("b"))); |
| 1576 } | 1903 } |
| 1904 |
| 1577 void test_visitBlock_empty() { | 1905 void test_visitBlock_empty() { |
| 1578 assertSource("{}", ASTFactory.block([])); | 1906 assertSource("{}", ASTFactory.block([])); |
| 1579 } | 1907 } |
| 1908 |
| 1580 void test_visitBlock_nonEmpty() { | 1909 void test_visitBlock_nonEmpty() { |
| 1581 assertSource("{break; break;}", ASTFactory.block([ASTFactory.breakStatement(
), ASTFactory.breakStatement()])); | 1910 assertSource("{break; break;}", ASTFactory.block([ASTFactory.breakStatement(
), ASTFactory.breakStatement()])); |
| 1582 } | 1911 } |
| 1912 |
| 1583 void test_visitBlockFunctionBody() { | 1913 void test_visitBlockFunctionBody() { |
| 1584 assertSource("{}", ASTFactory.blockFunctionBody2([])); | 1914 assertSource("{}", ASTFactory.blockFunctionBody2([])); |
| 1585 } | 1915 } |
| 1916 |
| 1586 void test_visitBooleanLiteral_false() { | 1917 void test_visitBooleanLiteral_false() { |
| 1587 assertSource("false", ASTFactory.booleanLiteral(false)); | 1918 assertSource("false", ASTFactory.booleanLiteral(false)); |
| 1588 } | 1919 } |
| 1920 |
| 1589 void test_visitBooleanLiteral_true() { | 1921 void test_visitBooleanLiteral_true() { |
| 1590 assertSource("true", ASTFactory.booleanLiteral(true)); | 1922 assertSource("true", ASTFactory.booleanLiteral(true)); |
| 1591 } | 1923 } |
| 1924 |
| 1592 void test_visitBreakStatement_label() { | 1925 void test_visitBreakStatement_label() { |
| 1593 assertSource("break l;", ASTFactory.breakStatement2("l")); | 1926 assertSource("break l;", ASTFactory.breakStatement2("l")); |
| 1594 } | 1927 } |
| 1928 |
| 1595 void test_visitBreakStatement_noLabel() { | 1929 void test_visitBreakStatement_noLabel() { |
| 1596 assertSource("break;", ASTFactory.breakStatement()); | 1930 assertSource("break;", ASTFactory.breakStatement()); |
| 1597 } | 1931 } |
| 1932 |
| 1598 void test_visitCascadeExpression_field() { | 1933 void test_visitCascadeExpression_field() { |
| 1599 assertSource("a..b..c", ASTFactory.cascadeExpression(ASTFactory.identifier3(
"a"), [ | 1934 assertSource("a..b..c", ASTFactory.cascadeExpression(ASTFactory.identifier3(
"a"), [ |
| 1600 ASTFactory.cascadedPropertyAccess("b"), | 1935 ASTFactory.cascadedPropertyAccess("b"), |
| 1601 ASTFactory.cascadedPropertyAccess("c")])); | 1936 ASTFactory.cascadedPropertyAccess("c")])); |
| 1602 } | 1937 } |
| 1938 |
| 1603 void test_visitCascadeExpression_index() { | 1939 void test_visitCascadeExpression_index() { |
| 1604 assertSource("a..[0]..[1]", ASTFactory.cascadeExpression(ASTFactory.identifi
er3("a"), [ | 1940 assertSource("a..[0]..[1]", ASTFactory.cascadeExpression(ASTFactory.identifi
er3("a"), [ |
| 1605 ASTFactory.cascadedIndexExpression(ASTFactory.integer(0)), | 1941 ASTFactory.cascadedIndexExpression(ASTFactory.integer(0)), |
| 1606 ASTFactory.cascadedIndexExpression(ASTFactory.integer(1))])); | 1942 ASTFactory.cascadedIndexExpression(ASTFactory.integer(1))])); |
| 1607 } | 1943 } |
| 1944 |
| 1608 void test_visitCascadeExpression_method() { | 1945 void test_visitCascadeExpression_method() { |
| 1609 assertSource("a..b()..c()", ASTFactory.cascadeExpression(ASTFactory.identifi
er3("a"), [ | 1946 assertSource("a..b()..c()", ASTFactory.cascadeExpression(ASTFactory.identifi
er3("a"), [ |
| 1610 ASTFactory.cascadedMethodInvocation("b", []), | 1947 ASTFactory.cascadedMethodInvocation("b", []), |
| 1611 ASTFactory.cascadedMethodInvocation("c", [])])); | 1948 ASTFactory.cascadedMethodInvocation("c", [])])); |
| 1612 } | 1949 } |
| 1950 |
| 1613 void test_visitCatchClause_catch_noStack() { | 1951 void test_visitCatchClause_catch_noStack() { |
| 1614 assertSource("catch (e) {}", ASTFactory.catchClause("e", [])); | 1952 assertSource("catch (e) {}", ASTFactory.catchClause("e", [])); |
| 1615 } | 1953 } |
| 1954 |
| 1616 void test_visitCatchClause_catch_stack() { | 1955 void test_visitCatchClause_catch_stack() { |
| 1617 assertSource("catch (e, s) {}", ASTFactory.catchClause2("e", "s", [])); | 1956 assertSource("catch (e, s) {}", ASTFactory.catchClause2("e", "s", [])); |
| 1618 } | 1957 } |
| 1958 |
| 1619 void test_visitCatchClause_on() { | 1959 void test_visitCatchClause_on() { |
| 1620 assertSource("on E {}", ASTFactory.catchClause3(ASTFactory.typeName4("E", []
), [])); | 1960 assertSource("on E {}", ASTFactory.catchClause3(ASTFactory.typeName4("E", []
), [])); |
| 1621 } | 1961 } |
| 1962 |
| 1622 void test_visitCatchClause_on_catch() { | 1963 void test_visitCatchClause_on_catch() { |
| 1623 assertSource("on E catch (e) {}", ASTFactory.catchClause4(ASTFactory.typeNam
e4("E", []), "e", [])); | 1964 assertSource("on E catch (e) {}", ASTFactory.catchClause4(ASTFactory.typeNam
e4("E", []), "e", [])); |
| 1624 } | 1965 } |
| 1966 |
| 1625 void test_visitClassDeclaration_abstract() { | 1967 void test_visitClassDeclaration_abstract() { |
| 1626 assertSource("abstract class C {}", ASTFactory.classDeclaration(Keyword.ABST
RACT, "C", null, null, null, null, [])); | 1968 assertSource("abstract class C {}", ASTFactory.classDeclaration(Keyword.ABST
RACT, "C", null, null, null, null, [])); |
| 1627 } | 1969 } |
| 1970 |
| 1628 void test_visitClassDeclaration_empty() { | 1971 void test_visitClassDeclaration_empty() { |
| 1629 assertSource("class C {}", ASTFactory.classDeclaration(null, "C", null, null
, null, null, [])); | 1972 assertSource("class C {}", ASTFactory.classDeclaration(null, "C", null, null
, null, null, [])); |
| 1630 } | 1973 } |
| 1974 |
| 1631 void test_visitClassDeclaration_extends() { | 1975 void test_visitClassDeclaration_extends() { |
| 1632 assertSource("class C extends A {}", ASTFactory.classDeclaration(null, "C",
null, ASTFactory.extendsClause(ASTFactory.typeName4("A", [])), null, null, [])); | 1976 assertSource("class C extends A {}", ASTFactory.classDeclaration(null, "C",
null, ASTFactory.extendsClause(ASTFactory.typeName4("A", [])), null, null, [])); |
| 1633 } | 1977 } |
| 1978 |
| 1634 void test_visitClassDeclaration_extends_implements() { | 1979 void test_visitClassDeclaration_extends_implements() { |
| 1635 assertSource("class C extends A implements B {}", ASTFactory.classDeclaratio
n(null, "C", null, ASTFactory.extendsClause(ASTFactory.typeName4("A", [])), null
, ASTFactory.implementsClause([ASTFactory.typeName4("B", [])]), [])); | 1980 assertSource("class C extends A implements B {}", ASTFactory.classDeclaratio
n(null, "C", null, ASTFactory.extendsClause(ASTFactory.typeName4("A", [])), null
, ASTFactory.implementsClause([ASTFactory.typeName4("B", [])]), [])); |
| 1636 } | 1981 } |
| 1982 |
| 1637 void test_visitClassDeclaration_extends_with() { | 1983 void test_visitClassDeclaration_extends_with() { |
| 1638 assertSource("class C extends A with M {}", ASTFactory.classDeclaration(null
, "C", null, ASTFactory.extendsClause(ASTFactory.typeName4("A", [])), ASTFactory
.withClause([ASTFactory.typeName4("M", [])]), null, [])); | 1984 assertSource("class C extends A with M {}", ASTFactory.classDeclaration(null
, "C", null, ASTFactory.extendsClause(ASTFactory.typeName4("A", [])), ASTFactory
.withClause([ASTFactory.typeName4("M", [])]), null, [])); |
| 1639 } | 1985 } |
| 1986 |
| 1640 void test_visitClassDeclaration_extends_with_implements() { | 1987 void test_visitClassDeclaration_extends_with_implements() { |
| 1641 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", [])]), [])); | 1988 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", [])]), [])); |
| 1642 } | 1989 } |
| 1990 |
| 1643 void test_visitClassDeclaration_implements() { | 1991 void test_visitClassDeclaration_implements() { |
| 1644 assertSource("class C implements B {}", ASTFactory.classDeclaration(null, "C
", null, null, null, ASTFactory.implementsClause([ASTFactory.typeName4("B", [])]
), [])); | 1992 assertSource("class C implements B {}", ASTFactory.classDeclaration(null, "C
", null, null, null, ASTFactory.implementsClause([ASTFactory.typeName4("B", [])]
), [])); |
| 1645 } | 1993 } |
| 1994 |
| 1646 void test_visitClassDeclaration_multipleMember() { | 1995 void test_visitClassDeclaration_multipleMember() { |
| 1647 assertSource("class C {var a; var b;}", ASTFactory.classDeclaration(null, "C
", null, null, null, null, [ | 1996 assertSource("class C {var a; var b;}", ASTFactory.classDeclaration(null, "C
", null, null, null, null, [ |
| 1648 ASTFactory.fieldDeclaration2(false, Keyword.VAR, [ASTFactory.variableDec
laration("a")]), | 1997 ASTFactory.fieldDeclaration2(false, Keyword.VAR, [ASTFactory.variableDec
laration("a")]), |
| 1649 ASTFactory.fieldDeclaration2(false, Keyword.VAR, [ASTFactory.variableDec
laration("b")])])); | 1998 ASTFactory.fieldDeclaration2(false, Keyword.VAR, [ASTFactory.variableDec
laration("b")])])); |
| 1650 } | 1999 } |
| 2000 |
| 1651 void test_visitClassDeclaration_parameters() { | 2001 void test_visitClassDeclaration_parameters() { |
| 1652 assertSource("class C<E> {}", ASTFactory.classDeclaration(null, "C", ASTFact
ory.typeParameterList(["E"]), null, null, null, [])); | 2002 assertSource("class C<E> {}", ASTFactory.classDeclaration(null, "C", ASTFact
ory.typeParameterList(["E"]), null, null, null, [])); |
| 1653 } | 2003 } |
| 2004 |
| 1654 void test_visitClassDeclaration_parameters_extends() { | 2005 void test_visitClassDeclaration_parameters_extends() { |
| 1655 assertSource("class C<E> extends A {}", ASTFactory.classDeclaration(null, "C
", ASTFactory.typeParameterList(["E"]), ASTFactory.extendsClause(ASTFactory.type
Name4("A", [])), null, null, [])); | 2006 assertSource("class C<E> extends A {}", ASTFactory.classDeclaration(null, "C
", ASTFactory.typeParameterList(["E"]), ASTFactory.extendsClause(ASTFactory.type
Name4("A", [])), null, null, [])); |
| 1656 } | 2007 } |
| 2008 |
| 1657 void test_visitClassDeclaration_parameters_extends_implements() { | 2009 void test_visitClassDeclaration_parameters_extends_implements() { |
| 1658 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", [])]), [])); | 2010 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", [])]), [])); |
| 1659 } | 2011 } |
| 2012 |
| 1660 void test_visitClassDeclaration_parameters_extends_with() { | 2013 void test_visitClassDeclaration_parameters_extends_with() { |
| 1661 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, [])); | 2014 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, [])); |
| 1662 } | 2015 } |
| 2016 |
| 1663 void test_visitClassDeclaration_parameters_extends_with_implements() { | 2017 void test_visitClassDeclaration_parameters_extends_with_implements() { |
| 1664 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", [])]), [])); | 2018 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", [])]), [])); |
| 1665 } | 2019 } |
| 2020 |
| 1666 void test_visitClassDeclaration_parameters_implements() { | 2021 void test_visitClassDeclaration_parameters_implements() { |
| 1667 assertSource("class C<E> implements B {}", ASTFactory.classDeclaration(null,
"C", ASTFactory.typeParameterList(["E"]), null, null, ASTFactory.implementsClau
se([ASTFactory.typeName4("B", [])]), [])); | 2022 assertSource("class C<E> implements B {}", ASTFactory.classDeclaration(null,
"C", ASTFactory.typeParameterList(["E"]), null, null, ASTFactory.implementsClau
se([ASTFactory.typeName4("B", [])]), [])); |
| 1668 } | 2023 } |
| 2024 |
| 1669 void test_visitClassDeclaration_singleMember() { | 2025 void test_visitClassDeclaration_singleMember() { |
| 1670 assertSource("class C {var a;}", ASTFactory.classDeclaration(null, "C", null
, null, null, null, [ASTFactory.fieldDeclaration2(false, Keyword.VAR, [ASTFactor
y.variableDeclaration("a")])])); | 2026 assertSource("class C {var a;}", ASTFactory.classDeclaration(null, "C", null
, null, null, null, [ASTFactory.fieldDeclaration2(false, Keyword.VAR, [ASTFactor
y.variableDeclaration("a")])])); |
| 1671 } | 2027 } |
| 2028 |
| 1672 void test_visitClassTypeAlias_abstract() { | 2029 void test_visitClassTypeAlias_abstract() { |
| 1673 assertSource("class C = abstract S with M1;", ASTFactory.classTypeAlias("C",
null, Keyword.ABSTRACT, ASTFactory.typeName4("S", []), ASTFactory.withClause([A
STFactory.typeName4("M1", [])]), null)); | 2030 assertSource("class C = abstract S with M1;", ASTFactory.classTypeAlias("C",
null, Keyword.ABSTRACT, ASTFactory.typeName4("S", []), ASTFactory.withClause([A
STFactory.typeName4("M1", [])]), null)); |
| 1674 } | 2031 } |
| 2032 |
| 1675 void test_visitClassTypeAlias_abstract_implements() { | 2033 void test_visitClassTypeAlias_abstract_implements() { |
| 1676 assertSource("class C = abstract 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", [])]))); | 2034 assertSource("class C = abstract 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", [])]))); |
| 1677 } | 2035 } |
| 2036 |
| 1678 void test_visitClassTypeAlias_generic() { | 2037 void test_visitClassTypeAlias_generic() { |
| 1679 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)); | 2038 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)); |
| 1680 } | 2039 } |
| 2040 |
| 1681 void test_visitClassTypeAlias_implements() { | 2041 void test_visitClassTypeAlias_implements() { |
| 1682 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",
[])]))); | 2042 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",
[])]))); |
| 1683 } | 2043 } |
| 2044 |
| 1684 void test_visitClassTypeAlias_minimal() { | 2045 void test_visitClassTypeAlias_minimal() { |
| 1685 assertSource("class C = S with M1;", ASTFactory.classTypeAlias("C", null, nu
ll, ASTFactory.typeName4("S", []), ASTFactory.withClause([ASTFactory.typeName4("
M1", [])]), null)); | 2046 assertSource("class C = S with M1;", ASTFactory.classTypeAlias("C", null, nu
ll, ASTFactory.typeName4("S", []), ASTFactory.withClause([ASTFactory.typeName4("
M1", [])]), null)); |
| 1686 } | 2047 } |
| 2048 |
| 1687 void test_visitClassTypeAlias_parameters_abstract() { | 2049 void test_visitClassTypeAlias_parameters_abstract() { |
| 1688 assertSource("class C<E> = abstract S with M1;", ASTFactory.classTypeAlias("
C", ASTFactory.typeParameterList(["E"]), Keyword.ABSTRACT, ASTFactory.typeName4(
"S", []), ASTFactory.withClause([ASTFactory.typeName4("M1", [])]), null)); | 2050 assertSource("class C<E> = abstract S with M1;", ASTFactory.classTypeAlias("
C", ASTFactory.typeParameterList(["E"]), Keyword.ABSTRACT, ASTFactory.typeName4(
"S", []), ASTFactory.withClause([ASTFactory.typeName4("M1", [])]), null)); |
| 1689 } | 2051 } |
| 2052 |
| 1690 void test_visitClassTypeAlias_parameters_abstract_implements() { | 2053 void test_visitClassTypeAlias_parameters_abstract_implements() { |
| 1691 assertSource("class C<E> = abstract 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", [])]))); | 2054 assertSource("class C<E> = abstract 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", [])]))); |
| 1692 } | 2055 } |
| 2056 |
| 1693 void test_visitClassTypeAlias_parameters_implements() { | 2057 void test_visitClassTypeAlias_parameters_implements() { |
| 1694 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", [])]))); | 2058 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", [])]))); |
| 1695 } | 2059 } |
| 2060 |
| 1696 void test_visitComment() { | 2061 void test_visitComment() { |
| 1697 assertSource("", Comment.createBlockComment(<Token> [TokenFactory.token2("/*
comment */")])); | 2062 assertSource("", Comment.createBlockComment(<Token> [TokenFactory.token2("/*
comment */")])); |
| 1698 } | 2063 } |
| 2064 |
| 1699 void test_visitCommentReference() { | 2065 void test_visitCommentReference() { |
| 1700 assertSource("", new CommentReference.full(null, ASTFactory.identifier3("a")
)); | 2066 assertSource("", new CommentReference.full(null, ASTFactory.identifier3("a")
)); |
| 1701 } | 2067 } |
| 2068 |
| 1702 void test_visitCompilationUnit_declaration() { | 2069 void test_visitCompilationUnit_declaration() { |
| 1703 assertSource("var a;", ASTFactory.compilationUnit2([ASTFactory.topLevelVaria
bleDeclaration2(Keyword.VAR, [ASTFactory.variableDeclaration("a")])])); | 2070 assertSource("var a;", ASTFactory.compilationUnit2([ASTFactory.topLevelVaria
bleDeclaration2(Keyword.VAR, [ASTFactory.variableDeclaration("a")])])); |
| 1704 } | 2071 } |
| 2072 |
| 1705 void test_visitCompilationUnit_directive() { | 2073 void test_visitCompilationUnit_directive() { |
| 1706 assertSource("library l;", ASTFactory.compilationUnit3([ASTFactory.libraryDi
rective2("l")])); | 2074 assertSource("library l;", ASTFactory.compilationUnit3([ASTFactory.libraryDi
rective2("l")])); |
| 1707 } | 2075 } |
| 2076 |
| 1708 void test_visitCompilationUnit_directive_declaration() { | 2077 void test_visitCompilationUnit_directive_declaration() { |
| 1709 assertSource("library l; var a;", ASTFactory.compilationUnit4(ASTFactory.lis
t([ASTFactory.libraryDirective2("l") as Directive]), ASTFactory.list([ASTFactory
.topLevelVariableDeclaration2(Keyword.VAR, [ASTFactory.variableDeclaration("a")]
) as CompilationUnitMember]))); | 2078 assertSource("library l; var a;", ASTFactory.compilationUnit4(ASTFactory.lis
t([ASTFactory.libraryDirective2("l") as Directive]), ASTFactory.list([ASTFactory
.topLevelVariableDeclaration2(Keyword.VAR, [ASTFactory.variableDeclaration("a")]
) as CompilationUnitMember]))); |
| 1710 } | 2079 } |
| 2080 |
| 1711 void test_visitCompilationUnit_empty() { | 2081 void test_visitCompilationUnit_empty() { |
| 1712 assertSource("", ASTFactory.compilationUnit()); | 2082 assertSource("", ASTFactory.compilationUnit()); |
| 1713 } | 2083 } |
| 2084 |
| 1714 void test_visitCompilationUnit_script() { | 2085 void test_visitCompilationUnit_script() { |
| 1715 assertSource("!#/bin/dartvm", ASTFactory.compilationUnit5("!#/bin/dartvm")); | 2086 assertSource("!#/bin/dartvm", ASTFactory.compilationUnit5("!#/bin/dartvm")); |
| 1716 } | 2087 } |
| 2088 |
| 1717 void test_visitCompilationUnit_script_declaration() { | 2089 void test_visitCompilationUnit_script_declaration() { |
| 1718 assertSource("!#/bin/dartvm var a;", ASTFactory.compilationUnit6("!#/bin/dar
tvm", [ASTFactory.topLevelVariableDeclaration2(Keyword.VAR, [ASTFactory.variable
Declaration("a")])])); | 2090 assertSource("!#/bin/dartvm var a;", ASTFactory.compilationUnit6("!#/bin/dar
tvm", [ASTFactory.topLevelVariableDeclaration2(Keyword.VAR, [ASTFactory.variable
Declaration("a")])])); |
| 1719 } | 2091 } |
| 2092 |
| 1720 void test_visitCompilationUnit_script_directive() { | 2093 void test_visitCompilationUnit_script_directive() { |
| 1721 assertSource("!#/bin/dartvm library l;", ASTFactory.compilationUnit7("!#/bin
/dartvm", [ASTFactory.libraryDirective2("l")])); | 2094 assertSource("!#/bin/dartvm library l;", ASTFactory.compilationUnit7("!#/bin
/dartvm", [ASTFactory.libraryDirective2("l")])); |
| 1722 } | 2095 } |
| 2096 |
| 1723 void test_visitCompilationUnit_script_directives_declarations() { | 2097 void test_visitCompilationUnit_script_directives_declarations() { |
| 1724 assertSource("!#/bin/dartvm library l; var a;", ASTFactory.compilationUnit8(
"!#/bin/dartvm", ASTFactory.list([ASTFactory.libraryDirective2("l") as Directive
]), ASTFactory.list([ASTFactory.topLevelVariableDeclaration2(Keyword.VAR, [ASTFa
ctory.variableDeclaration("a")]) as CompilationUnitMember]))); | 2098 assertSource("!#/bin/dartvm library l; var a;", ASTFactory.compilationUnit8(
"!#/bin/dartvm", ASTFactory.list([ASTFactory.libraryDirective2("l") as Directive
]), ASTFactory.list([ASTFactory.topLevelVariableDeclaration2(Keyword.VAR, [ASTFa
ctory.variableDeclaration("a")]) as CompilationUnitMember]))); |
| 1725 } | 2099 } |
| 2100 |
| 1726 void test_visitConditionalExpression() { | 2101 void test_visitConditionalExpression() { |
| 1727 assertSource("a ? b : c", ASTFactory.conditionalExpression(ASTFactory.identi
fier3("a"), ASTFactory.identifier3("b"), ASTFactory.identifier3("c"))); | 2102 assertSource("a ? b : c", ASTFactory.conditionalExpression(ASTFactory.identi
fier3("a"), ASTFactory.identifier3("b"), ASTFactory.identifier3("c"))); |
| 1728 } | 2103 } |
| 2104 |
| 1729 void test_visitConstructorDeclaration_const() { | 2105 void test_visitConstructorDeclaration_const() { |
| 1730 assertSource("const C() {}", ASTFactory.constructorDeclaration2(Keyword.CONS
T, null, ASTFactory.identifier3("C"), null, ASTFactory.formalParameterList([]),
null, ASTFactory.blockFunctionBody2([]))); | 2106 assertSource("const C() {}", ASTFactory.constructorDeclaration2(Keyword.CONS
T, null, ASTFactory.identifier3("C"), null, ASTFactory.formalParameterList([]),
null, ASTFactory.blockFunctionBody2([]))); |
| 1731 } | 2107 } |
| 2108 |
| 1732 void test_visitConstructorDeclaration_external() { | 2109 void test_visitConstructorDeclaration_external() { |
| 1733 assertSource("external C();", ASTFactory.constructorDeclaration(ASTFactory.i
dentifier3("C"), null, ASTFactory.formalParameterList([]), null)); | 2110 assertSource("external C();", ASTFactory.constructorDeclaration(ASTFactory.i
dentifier3("C"), null, ASTFactory.formalParameterList([]), null)); |
| 1734 } | 2111 } |
| 2112 |
| 1735 void test_visitConstructorDeclaration_minimal() { | 2113 void test_visitConstructorDeclaration_minimal() { |
| 1736 assertSource("C() {}", ASTFactory.constructorDeclaration2(null, null, ASTFac
tory.identifier3("C"), null, ASTFactory.formalParameterList([]), null, ASTFactor
y.blockFunctionBody2([]))); | 2114 assertSource("C() {}", ASTFactory.constructorDeclaration2(null, null, ASTFac
tory.identifier3("C"), null, ASTFactory.formalParameterList([]), null, ASTFactor
y.blockFunctionBody2([]))); |
| 1737 } | 2115 } |
| 2116 |
| 1738 void test_visitConstructorDeclaration_multipleInitializers() { | 2117 void test_visitConstructorDeclaration_multipleInitializers() { |
| 1739 assertSource("C() : a = b, c = d {}", ASTFactory.constructorDeclaration2(nul
l, null, ASTFactory.identifier3("C"), null, ASTFactory.formalParameterList([]),
ASTFactory.list([ | 2118 assertSource("C() : a = b, c = d {}", ASTFactory.constructorDeclaration2(nul
l, null, ASTFactory.identifier3("C"), null, ASTFactory.formalParameterList([]),
ASTFactory.list([ |
| 1740 ASTFactory.constructorFieldInitializer(false, "a", ASTFactory.identifier
3("b")) as ConstructorInitializer, | 2119 ASTFactory.constructorFieldInitializer(false, "a", ASTFactory.identifier
3("b")) as ConstructorInitializer, |
| 1741 ASTFactory.constructorFieldInitializer(false, "c", ASTFactory.identifier
3("d"))]), ASTFactory.blockFunctionBody2([]))); | 2120 ASTFactory.constructorFieldInitializer(false, "c", ASTFactory.identifier
3("d"))]), ASTFactory.blockFunctionBody2([]))); |
| 1742 } | 2121 } |
| 2122 |
| 1743 void test_visitConstructorDeclaration_multipleParameters() { | 2123 void test_visitConstructorDeclaration_multipleParameters() { |
| 1744 assertSource("C(var a, var b) {}", ASTFactory.constructorDeclaration2(null,
null, ASTFactory.identifier3("C"), null, ASTFactory.formalParameterList([ | 2124 assertSource("C(var a, var b) {}", ASTFactory.constructorDeclaration2(null,
null, ASTFactory.identifier3("C"), null, ASTFactory.formalParameterList([ |
| 1745 ASTFactory.simpleFormalParameter(Keyword.VAR, "a"), | 2125 ASTFactory.simpleFormalParameter(Keyword.VAR, "a"), |
| 1746 ASTFactory.simpleFormalParameter(Keyword.VAR, "b")]), null, ASTFactory.b
lockFunctionBody2([]))); | 2126 ASTFactory.simpleFormalParameter(Keyword.VAR, "b")]), null, ASTFactory.b
lockFunctionBody2([]))); |
| 1747 } | 2127 } |
| 2128 |
| 1748 void test_visitConstructorDeclaration_named() { | 2129 void test_visitConstructorDeclaration_named() { |
| 1749 assertSource("C.m() {}", ASTFactory.constructorDeclaration2(null, null, ASTF
actory.identifier3("C"), "m", ASTFactory.formalParameterList([]), null, ASTFacto
ry.blockFunctionBody2([]))); | 2130 assertSource("C.m() {}", ASTFactory.constructorDeclaration2(null, null, ASTF
actory.identifier3("C"), "m", ASTFactory.formalParameterList([]), null, ASTFacto
ry.blockFunctionBody2([]))); |
| 1750 } | 2131 } |
| 2132 |
| 1751 void test_visitConstructorDeclaration_singleInitializer() { | 2133 void test_visitConstructorDeclaration_singleInitializer() { |
| 1752 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")) as ConstructorInitializer]), ASTFactory.blockFunctionBody2([]))); | 2134 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")) as ConstructorInitializer]), ASTFactory.blockFunctionBody2([]))); |
| 1753 } | 2135 } |
| 2136 |
| 1754 void test_visitConstructorFieldInitializer_withoutThis() { | 2137 void test_visitConstructorFieldInitializer_withoutThis() { |
| 1755 assertSource("a = b", ASTFactory.constructorFieldInitializer(false, "a", AST
Factory.identifier3("b"))); | 2138 assertSource("a = b", ASTFactory.constructorFieldInitializer(false, "a", AST
Factory.identifier3("b"))); |
| 1756 } | 2139 } |
| 2140 |
| 1757 void test_visitConstructorFieldInitializer_withThis() { | 2141 void test_visitConstructorFieldInitializer_withThis() { |
| 1758 assertSource("this.a = b", ASTFactory.constructorFieldInitializer(true, "a",
ASTFactory.identifier3("b"))); | 2142 assertSource("this.a = b", ASTFactory.constructorFieldInitializer(true, "a",
ASTFactory.identifier3("b"))); |
| 1759 } | 2143 } |
| 2144 |
| 1760 void test_visitConstructorName_named_prefix() { | 2145 void test_visitConstructorName_named_prefix() { |
| 1761 assertSource("p.C.n", ASTFactory.constructorName(ASTFactory.typeName4("p.C.n
", []), null)); | 2146 assertSource("p.C.n", ASTFactory.constructorName(ASTFactory.typeName4("p.C.n
", []), null)); |
| 1762 } | 2147 } |
| 2148 |
| 1763 void test_visitConstructorName_unnamed_noPrefix() { | 2149 void test_visitConstructorName_unnamed_noPrefix() { |
| 1764 assertSource("C", ASTFactory.constructorName(ASTFactory.typeName4("C", []),
null)); | 2150 assertSource("C", ASTFactory.constructorName(ASTFactory.typeName4("C", []),
null)); |
| 1765 } | 2151 } |
| 2152 |
| 1766 void test_visitConstructorName_unnamed_prefix() { | 2153 void test_visitConstructorName_unnamed_prefix() { |
| 1767 assertSource("p.C", ASTFactory.constructorName(ASTFactory.typeName3(ASTFacto
ry.identifier5("p", "C"), []), null)); | 2154 assertSource("p.C", ASTFactory.constructorName(ASTFactory.typeName3(ASTFacto
ry.identifier5("p", "C"), []), null)); |
| 1768 } | 2155 } |
| 2156 |
| 1769 void test_visitContinueStatement_label() { | 2157 void test_visitContinueStatement_label() { |
| 1770 assertSource("continue l;", ASTFactory.continueStatement2("l")); | 2158 assertSource("continue l;", ASTFactory.continueStatement2("l")); |
| 1771 } | 2159 } |
| 2160 |
| 1772 void test_visitContinueStatement_noLabel() { | 2161 void test_visitContinueStatement_noLabel() { |
| 1773 assertSource("continue;", ASTFactory.continueStatement()); | 2162 assertSource("continue;", ASTFactory.continueStatement()); |
| 1774 } | 2163 } |
| 2164 |
| 1775 void test_visitDefaultFormalParameter_named_noValue() { | 2165 void test_visitDefaultFormalParameter_named_noValue() { |
| 1776 assertSource("p", ASTFactory.namedFormalParameter(ASTFactory.simpleFormalPar
ameter3("p"), null)); | 2166 assertSource("p", ASTFactory.namedFormalParameter(ASTFactory.simpleFormalPar
ameter3("p"), null)); |
| 1777 } | 2167 } |
| 2168 |
| 1778 void test_visitDefaultFormalParameter_named_value() { | 2169 void test_visitDefaultFormalParameter_named_value() { |
| 1779 assertSource("p : 0", ASTFactory.namedFormalParameter(ASTFactory.simpleForma
lParameter3("p"), ASTFactory.integer(0))); | 2170 assertSource("p : 0", ASTFactory.namedFormalParameter(ASTFactory.simpleForma
lParameter3("p"), ASTFactory.integer(0))); |
| 1780 } | 2171 } |
| 2172 |
| 1781 void test_visitDefaultFormalParameter_positional_noValue() { | 2173 void test_visitDefaultFormalParameter_positional_noValue() { |
| 1782 assertSource("p", ASTFactory.positionalFormalParameter(ASTFactory.simpleForm
alParameter3("p"), null)); | 2174 assertSource("p", ASTFactory.positionalFormalParameter(ASTFactory.simpleForm
alParameter3("p"), null)); |
| 1783 } | 2175 } |
| 2176 |
| 1784 void test_visitDefaultFormalParameter_positional_value() { | 2177 void test_visitDefaultFormalParameter_positional_value() { |
| 1785 assertSource("p = 0", ASTFactory.positionalFormalParameter(ASTFactory.simple
FormalParameter3("p"), ASTFactory.integer(0))); | 2178 assertSource("p = 0", ASTFactory.positionalFormalParameter(ASTFactory.simple
FormalParameter3("p"), ASTFactory.integer(0))); |
| 1786 } | 2179 } |
| 2180 |
| 1787 void test_visitDoStatement() { | 2181 void test_visitDoStatement() { |
| 1788 assertSource("do {} while (c);", ASTFactory.doStatement(ASTFactory.block([])
, ASTFactory.identifier3("c"))); | 2182 assertSource("do {} while (c);", ASTFactory.doStatement(ASTFactory.block([])
, ASTFactory.identifier3("c"))); |
| 1789 } | 2183 } |
| 2184 |
| 1790 void test_visitDoubleLiteral() { | 2185 void test_visitDoubleLiteral() { |
| 1791 assertSource("4.2", ASTFactory.doubleLiteral(4.2)); | 2186 assertSource("4.2", ASTFactory.doubleLiteral(4.2)); |
| 1792 } | 2187 } |
| 2188 |
| 1793 void test_visitEmptyFunctionBody() { | 2189 void test_visitEmptyFunctionBody() { |
| 1794 assertSource(";", ASTFactory.emptyFunctionBody()); | 2190 assertSource(";", ASTFactory.emptyFunctionBody()); |
| 1795 } | 2191 } |
| 2192 |
| 1796 void test_visitEmptyStatement() { | 2193 void test_visitEmptyStatement() { |
| 1797 assertSource(";", ASTFactory.emptyStatement()); | 2194 assertSource(";", ASTFactory.emptyStatement()); |
| 1798 } | 2195 } |
| 2196 |
| 1799 void test_visitExportDirective_combinator() { | 2197 void test_visitExportDirective_combinator() { |
| 1800 assertSource("export 'a.dart' show A;", ASTFactory.exportDirective2("a.dart"
, [ASTFactory.showCombinator([ASTFactory.identifier3("A")]) as Combinator])); | 2198 assertSource("export 'a.dart' show A;", ASTFactory.exportDirective2("a.dart"
, [ASTFactory.showCombinator([ASTFactory.identifier3("A")]) as Combinator])); |
| 1801 } | 2199 } |
| 2200 |
| 1802 void test_visitExportDirective_combinators() { | 2201 void test_visitExportDirective_combinators() { |
| 1803 assertSource("export 'a.dart' show A hide B;", ASTFactory.exportDirective2("
a.dart", [ | 2202 assertSource("export 'a.dart' show A hide B;", ASTFactory.exportDirective2("
a.dart", [ |
| 1804 ASTFactory.showCombinator([ASTFactory.identifier3("A")]), | 2203 ASTFactory.showCombinator([ASTFactory.identifier3("A")]), |
| 1805 ASTFactory.hideCombinator([ASTFactory.identifier3("B")])])); | 2204 ASTFactory.hideCombinator([ASTFactory.identifier3("B")])])); |
| 1806 } | 2205 } |
| 2206 |
| 1807 void test_visitExportDirective_minimal() { | 2207 void test_visitExportDirective_minimal() { |
| 1808 assertSource("export 'a.dart';", ASTFactory.exportDirective2("a.dart", [])); | 2208 assertSource("export 'a.dart';", ASTFactory.exportDirective2("a.dart", [])); |
| 1809 } | 2209 } |
| 2210 |
| 1810 void test_visitExpressionFunctionBody() { | 2211 void test_visitExpressionFunctionBody() { |
| 1811 assertSource("=> a;", ASTFactory.expressionFunctionBody(ASTFactory.identifie
r3("a"))); | 2212 assertSource("=> a;", ASTFactory.expressionFunctionBody(ASTFactory.identifie
r3("a"))); |
| 1812 } | 2213 } |
| 2214 |
| 1813 void test_visitExpressionStatement() { | 2215 void test_visitExpressionStatement() { |
| 1814 assertSource("a;", ASTFactory.expressionStatement(ASTFactory.identifier3("a"
))); | 2216 assertSource("a;", ASTFactory.expressionStatement(ASTFactory.identifier3("a"
))); |
| 1815 } | 2217 } |
| 2218 |
| 1816 void test_visitExtendsClause() { | 2219 void test_visitExtendsClause() { |
| 1817 assertSource("extends C", ASTFactory.extendsClause(ASTFactory.typeName4("C",
[]))); | 2220 assertSource("extends C", ASTFactory.extendsClause(ASTFactory.typeName4("C",
[]))); |
| 1818 } | 2221 } |
| 2222 |
| 1819 void test_visitFieldDeclaration_instance() { | 2223 void test_visitFieldDeclaration_instance() { |
| 1820 assertSource("var a;", ASTFactory.fieldDeclaration2(false, Keyword.VAR, [AST
Factory.variableDeclaration("a")])); | 2224 assertSource("var a;", ASTFactory.fieldDeclaration2(false, Keyword.VAR, [AST
Factory.variableDeclaration("a")])); |
| 1821 } | 2225 } |
| 2226 |
| 1822 void test_visitFieldDeclaration_static() { | 2227 void test_visitFieldDeclaration_static() { |
| 1823 assertSource("static var a;", ASTFactory.fieldDeclaration2(true, Keyword.VAR
, [ASTFactory.variableDeclaration("a")])); | 2228 assertSource("static var a;", ASTFactory.fieldDeclaration2(true, Keyword.VAR
, [ASTFactory.variableDeclaration("a")])); |
| 1824 } | 2229 } |
| 2230 |
| 1825 void test_visitFieldFormalParameter_functionTyped() { | 2231 void test_visitFieldFormalParameter_functionTyped() { |
| 1826 assertSource("A this.a(b)", ASTFactory.fieldFormalParameter2(null, ASTFactor
y.typeName4("A", []), "a", ASTFactory.formalParameterList([ASTFactory.simpleForm
alParameter3("b")]))); | 2232 assertSource("A this.a(b)", ASTFactory.fieldFormalParameter2(null, ASTFactor
y.typeName4("A", []), "a", ASTFactory.formalParameterList([ASTFactory.simpleForm
alParameter3("b")]))); |
| 1827 } | 2233 } |
| 2234 |
| 1828 void test_visitFieldFormalParameter_keyword() { | 2235 void test_visitFieldFormalParameter_keyword() { |
| 1829 assertSource("var this.a", ASTFactory.fieldFormalParameter(Keyword.VAR, null
, "a")); | 2236 assertSource("var this.a", ASTFactory.fieldFormalParameter(Keyword.VAR, null
, "a")); |
| 1830 } | 2237 } |
| 2238 |
| 1831 void test_visitFieldFormalParameter_keywordAndType() { | 2239 void test_visitFieldFormalParameter_keywordAndType() { |
| 1832 assertSource("final A this.a", ASTFactory.fieldFormalParameter(Keyword.FINAL
, ASTFactory.typeName4("A", []), "a")); | 2240 assertSource("final A this.a", ASTFactory.fieldFormalParameter(Keyword.FINAL
, ASTFactory.typeName4("A", []), "a")); |
| 1833 } | 2241 } |
| 2242 |
| 1834 void test_visitFieldFormalParameter_type() { | 2243 void test_visitFieldFormalParameter_type() { |
| 1835 assertSource("A this.a", ASTFactory.fieldFormalParameter(null, ASTFactory.ty
peName4("A", []), "a")); | 2244 assertSource("A this.a", ASTFactory.fieldFormalParameter(null, ASTFactory.ty
peName4("A", []), "a")); |
| 1836 } | 2245 } |
| 2246 |
| 1837 void test_visitForEachStatement() { | 2247 void test_visitForEachStatement() { |
| 1838 assertSource("for (a in b) {}", ASTFactory.forEachStatement(ASTFactory.decla
redIdentifier3("a"), ASTFactory.identifier3("b"), ASTFactory.block([]))); | 2248 assertSource("for (a in b) {}", ASTFactory.forEachStatement(ASTFactory.decla
redIdentifier3("a"), ASTFactory.identifier3("b"), ASTFactory.block([]))); |
| 1839 } | 2249 } |
| 2250 |
| 1840 void test_visitFormalParameterList_empty() { | 2251 void test_visitFormalParameterList_empty() { |
| 1841 assertSource("()", ASTFactory.formalParameterList([])); | 2252 assertSource("()", ASTFactory.formalParameterList([])); |
| 1842 } | 2253 } |
| 2254 |
| 1843 void test_visitFormalParameterList_n() { | 2255 void test_visitFormalParameterList_n() { |
| 1844 assertSource("({a : 0})", ASTFactory.formalParameterList([ASTFactory.namedFo
rmalParameter(ASTFactory.simpleFormalParameter3("a"), ASTFactory.integer(0))])); | 2256 assertSource("({a : 0})", ASTFactory.formalParameterList([ASTFactory.namedFo
rmalParameter(ASTFactory.simpleFormalParameter3("a"), ASTFactory.integer(0))])); |
| 1845 } | 2257 } |
| 2258 |
| 1846 void test_visitFormalParameterList_nn() { | 2259 void test_visitFormalParameterList_nn() { |
| 1847 assertSource("({a : 0, b : 1})", ASTFactory.formalParameterList([ | 2260 assertSource("({a : 0, b : 1})", ASTFactory.formalParameterList([ |
| 1848 ASTFactory.namedFormalParameter(ASTFactory.simpleFormalParameter3("a"),
ASTFactory.integer(0)), | 2261 ASTFactory.namedFormalParameter(ASTFactory.simpleFormalParameter3("a"),
ASTFactory.integer(0)), |
| 1849 ASTFactory.namedFormalParameter(ASTFactory.simpleFormalParameter3("b"),
ASTFactory.integer(1))])); | 2262 ASTFactory.namedFormalParameter(ASTFactory.simpleFormalParameter3("b"),
ASTFactory.integer(1))])); |
| 1850 } | 2263 } |
| 2264 |
| 1851 void test_visitFormalParameterList_p() { | 2265 void test_visitFormalParameterList_p() { |
| 1852 assertSource("([a = 0])", ASTFactory.formalParameterList([ASTFactory.positio
nalFormalParameter(ASTFactory.simpleFormalParameter3("a"), ASTFactory.integer(0)
)])); | 2266 assertSource("([a = 0])", ASTFactory.formalParameterList([ASTFactory.positio
nalFormalParameter(ASTFactory.simpleFormalParameter3("a"), ASTFactory.integer(0)
)])); |
| 1853 } | 2267 } |
| 2268 |
| 1854 void test_visitFormalParameterList_pp() { | 2269 void test_visitFormalParameterList_pp() { |
| 1855 assertSource("([a = 0, b = 1])", ASTFactory.formalParameterList([ | 2270 assertSource("([a = 0, b = 1])", ASTFactory.formalParameterList([ |
| 1856 ASTFactory.positionalFormalParameter(ASTFactory.simpleFormalParameter3("
a"), ASTFactory.integer(0)), | 2271 ASTFactory.positionalFormalParameter(ASTFactory.simpleFormalParameter3("
a"), ASTFactory.integer(0)), |
| 1857 ASTFactory.positionalFormalParameter(ASTFactory.simpleFormalParameter3("
b"), ASTFactory.integer(1))])); | 2272 ASTFactory.positionalFormalParameter(ASTFactory.simpleFormalParameter3("
b"), ASTFactory.integer(1))])); |
| 1858 } | 2273 } |
| 2274 |
| 1859 void test_visitFormalParameterList_r() { | 2275 void test_visitFormalParameterList_r() { |
| 1860 assertSource("(a)", ASTFactory.formalParameterList([ASTFactory.simpleFormalP
arameter3("a")])); | 2276 assertSource("(a)", ASTFactory.formalParameterList([ASTFactory.simpleFormalP
arameter3("a")])); |
| 1861 } | 2277 } |
| 2278 |
| 1862 void test_visitFormalParameterList_rn() { | 2279 void test_visitFormalParameterList_rn() { |
| 1863 assertSource("(a, {b : 1})", ASTFactory.formalParameterList([ | 2280 assertSource("(a, {b : 1})", ASTFactory.formalParameterList([ |
| 1864 ASTFactory.simpleFormalParameter3("a"), | 2281 ASTFactory.simpleFormalParameter3("a"), |
| 1865 ASTFactory.namedFormalParameter(ASTFactory.simpleFormalParameter3("b"),
ASTFactory.integer(1))])); | 2282 ASTFactory.namedFormalParameter(ASTFactory.simpleFormalParameter3("b"),
ASTFactory.integer(1))])); |
| 1866 } | 2283 } |
| 2284 |
| 1867 void test_visitFormalParameterList_rnn() { | 2285 void test_visitFormalParameterList_rnn() { |
| 1868 assertSource("(a, {b : 1, c : 2})", ASTFactory.formalParameterList([ | 2286 assertSource("(a, {b : 1, c : 2})", ASTFactory.formalParameterList([ |
| 1869 ASTFactory.simpleFormalParameter3("a"), | 2287 ASTFactory.simpleFormalParameter3("a"), |
| 1870 ASTFactory.namedFormalParameter(ASTFactory.simpleFormalParameter3("b"),
ASTFactory.integer(1)), | 2288 ASTFactory.namedFormalParameter(ASTFactory.simpleFormalParameter3("b"),
ASTFactory.integer(1)), |
| 1871 ASTFactory.namedFormalParameter(ASTFactory.simpleFormalParameter3("c"),
ASTFactory.integer(2))])); | 2289 ASTFactory.namedFormalParameter(ASTFactory.simpleFormalParameter3("c"),
ASTFactory.integer(2))])); |
| 1872 } | 2290 } |
| 2291 |
| 1873 void test_visitFormalParameterList_rp() { | 2292 void test_visitFormalParameterList_rp() { |
| 1874 assertSource("(a, [b = 1])", ASTFactory.formalParameterList([ | 2293 assertSource("(a, [b = 1])", ASTFactory.formalParameterList([ |
| 1875 ASTFactory.simpleFormalParameter3("a"), | 2294 ASTFactory.simpleFormalParameter3("a"), |
| 1876 ASTFactory.positionalFormalParameter(ASTFactory.simpleFormalParameter3("
b"), ASTFactory.integer(1))])); | 2295 ASTFactory.positionalFormalParameter(ASTFactory.simpleFormalParameter3("
b"), ASTFactory.integer(1))])); |
| 1877 } | 2296 } |
| 2297 |
| 1878 void test_visitFormalParameterList_rpp() { | 2298 void test_visitFormalParameterList_rpp() { |
| 1879 assertSource("(a, [b = 1, c = 2])", ASTFactory.formalParameterList([ | 2299 assertSource("(a, [b = 1, c = 2])", ASTFactory.formalParameterList([ |
| 1880 ASTFactory.simpleFormalParameter3("a"), | 2300 ASTFactory.simpleFormalParameter3("a"), |
| 1881 ASTFactory.positionalFormalParameter(ASTFactory.simpleFormalParameter3("
b"), ASTFactory.integer(1)), | 2301 ASTFactory.positionalFormalParameter(ASTFactory.simpleFormalParameter3("
b"), ASTFactory.integer(1)), |
| 1882 ASTFactory.positionalFormalParameter(ASTFactory.simpleFormalParameter3("
c"), ASTFactory.integer(2))])); | 2302 ASTFactory.positionalFormalParameter(ASTFactory.simpleFormalParameter3("
c"), ASTFactory.integer(2))])); |
| 1883 } | 2303 } |
| 2304 |
| 1884 void test_visitFormalParameterList_rr() { | 2305 void test_visitFormalParameterList_rr() { |
| 1885 assertSource("(a, b)", ASTFactory.formalParameterList([ | 2306 assertSource("(a, b)", ASTFactory.formalParameterList([ |
| 1886 ASTFactory.simpleFormalParameter3("a"), | 2307 ASTFactory.simpleFormalParameter3("a"), |
| 1887 ASTFactory.simpleFormalParameter3("b")])); | 2308 ASTFactory.simpleFormalParameter3("b")])); |
| 1888 } | 2309 } |
| 2310 |
| 1889 void test_visitFormalParameterList_rrn() { | 2311 void test_visitFormalParameterList_rrn() { |
| 1890 assertSource("(a, b, {c : 3})", ASTFactory.formalParameterList([ | 2312 assertSource("(a, b, {c : 3})", ASTFactory.formalParameterList([ |
| 1891 ASTFactory.simpleFormalParameter3("a"), | 2313 ASTFactory.simpleFormalParameter3("a"), |
| 1892 ASTFactory.simpleFormalParameter3("b"), | 2314 ASTFactory.simpleFormalParameter3("b"), |
| 1893 ASTFactory.namedFormalParameter(ASTFactory.simpleFormalParameter3("c"),
ASTFactory.integer(3))])); | 2315 ASTFactory.namedFormalParameter(ASTFactory.simpleFormalParameter3("c"),
ASTFactory.integer(3))])); |
| 1894 } | 2316 } |
| 2317 |
| 1895 void test_visitFormalParameterList_rrnn() { | 2318 void test_visitFormalParameterList_rrnn() { |
| 1896 assertSource("(a, b, {c : 3, d : 4})", ASTFactory.formalParameterList([ | 2319 assertSource("(a, b, {c : 3, d : 4})", ASTFactory.formalParameterList([ |
| 1897 ASTFactory.simpleFormalParameter3("a"), | 2320 ASTFactory.simpleFormalParameter3("a"), |
| 1898 ASTFactory.simpleFormalParameter3("b"), | 2321 ASTFactory.simpleFormalParameter3("b"), |
| 1899 ASTFactory.namedFormalParameter(ASTFactory.simpleFormalParameter3("c"),
ASTFactory.integer(3)), | 2322 ASTFactory.namedFormalParameter(ASTFactory.simpleFormalParameter3("c"),
ASTFactory.integer(3)), |
| 1900 ASTFactory.namedFormalParameter(ASTFactory.simpleFormalParameter3("d"),
ASTFactory.integer(4))])); | 2323 ASTFactory.namedFormalParameter(ASTFactory.simpleFormalParameter3("d"),
ASTFactory.integer(4))])); |
| 1901 } | 2324 } |
| 2325 |
| 1902 void test_visitFormalParameterList_rrp() { | 2326 void test_visitFormalParameterList_rrp() { |
| 1903 assertSource("(a, b, [c = 3])", ASTFactory.formalParameterList([ | 2327 assertSource("(a, b, [c = 3])", ASTFactory.formalParameterList([ |
| 1904 ASTFactory.simpleFormalParameter3("a"), | 2328 ASTFactory.simpleFormalParameter3("a"), |
| 1905 ASTFactory.simpleFormalParameter3("b"), | 2329 ASTFactory.simpleFormalParameter3("b"), |
| 1906 ASTFactory.positionalFormalParameter(ASTFactory.simpleFormalParameter3("
c"), ASTFactory.integer(3))])); | 2330 ASTFactory.positionalFormalParameter(ASTFactory.simpleFormalParameter3("
c"), ASTFactory.integer(3))])); |
| 1907 } | 2331 } |
| 2332 |
| 1908 void test_visitFormalParameterList_rrpp() { | 2333 void test_visitFormalParameterList_rrpp() { |
| 1909 assertSource("(a, b, [c = 3, d = 4])", ASTFactory.formalParameterList([ | 2334 assertSource("(a, b, [c = 3, d = 4])", ASTFactory.formalParameterList([ |
| 1910 ASTFactory.simpleFormalParameter3("a"), | 2335 ASTFactory.simpleFormalParameter3("a"), |
| 1911 ASTFactory.simpleFormalParameter3("b"), | 2336 ASTFactory.simpleFormalParameter3("b"), |
| 1912 ASTFactory.positionalFormalParameter(ASTFactory.simpleFormalParameter3("
c"), ASTFactory.integer(3)), | 2337 ASTFactory.positionalFormalParameter(ASTFactory.simpleFormalParameter3("
c"), ASTFactory.integer(3)), |
| 1913 ASTFactory.positionalFormalParameter(ASTFactory.simpleFormalParameter3("
d"), ASTFactory.integer(4))])); | 2338 ASTFactory.positionalFormalParameter(ASTFactory.simpleFormalParameter3("
d"), ASTFactory.integer(4))])); |
| 1914 } | 2339 } |
| 2340 |
| 1915 void test_visitForStatement_c() { | 2341 void test_visitForStatement_c() { |
| 1916 assertSource("for (; c;) {}", ASTFactory.forStatement(null as Expression, AS
TFactory.identifier3("c"), null, ASTFactory.block([]))); | 2342 assertSource("for (; c;) {}", ASTFactory.forStatement(null as Expression, AS
TFactory.identifier3("c"), null, ASTFactory.block([]))); |
| 1917 } | 2343 } |
| 2344 |
| 1918 void test_visitForStatement_cu() { | 2345 void test_visitForStatement_cu() { |
| 1919 assertSource("for (; c; u) {}", ASTFactory.forStatement(null as Expression,
ASTFactory.identifier3("c"), ASTFactory.list([ASTFactory.identifier3("u") as Exp
ression]), ASTFactory.block([]))); | 2346 assertSource("for (; c; u) {}", ASTFactory.forStatement(null as Expression,
ASTFactory.identifier3("c"), ASTFactory.list([ASTFactory.identifier3("u") as Exp
ression]), ASTFactory.block([]))); |
| 1920 } | 2347 } |
| 2348 |
| 1921 void test_visitForStatement_e() { | 2349 void test_visitForStatement_e() { |
| 1922 assertSource("for (e;;) {}", ASTFactory.forStatement(ASTFactory.identifier3(
"e"), null, null, ASTFactory.block([]))); | 2350 assertSource("for (e;;) {}", ASTFactory.forStatement(ASTFactory.identifier3(
"e"), null, null, ASTFactory.block([]))); |
| 1923 } | 2351 } |
| 2352 |
| 1924 void test_visitForStatement_ec() { | 2353 void test_visitForStatement_ec() { |
| 1925 assertSource("for (e; c;) {}", ASTFactory.forStatement(ASTFactory.identifier
3("e"), ASTFactory.identifier3("c"), null, ASTFactory.block([]))); | 2354 assertSource("for (e; c;) {}", ASTFactory.forStatement(ASTFactory.identifier
3("e"), ASTFactory.identifier3("c"), null, ASTFactory.block([]))); |
| 1926 } | 2355 } |
| 2356 |
| 1927 void test_visitForStatement_ecu() { | 2357 void test_visitForStatement_ecu() { |
| 1928 assertSource("for (e; c; u) {}", ASTFactory.forStatement(ASTFactory.identifi
er3("e"), ASTFactory.identifier3("c"), ASTFactory.list([ASTFactory.identifier3("
u") as Expression]), ASTFactory.block([]))); | 2358 assertSource("for (e; c; u) {}", ASTFactory.forStatement(ASTFactory.identifi
er3("e"), ASTFactory.identifier3("c"), ASTFactory.list([ASTFactory.identifier3("
u") as Expression]), ASTFactory.block([]))); |
| 1929 } | 2359 } |
| 2360 |
| 1930 void test_visitForStatement_eu() { | 2361 void test_visitForStatement_eu() { |
| 1931 assertSource("for (e;; u) {}", ASTFactory.forStatement(ASTFactory.identifier
3("e"), null, ASTFactory.list([ASTFactory.identifier3("u") as Expression]), ASTF
actory.block([]))); | 2362 assertSource("for (e;; u) {}", ASTFactory.forStatement(ASTFactory.identifier
3("e"), null, ASTFactory.list([ASTFactory.identifier3("u") as Expression]), ASTF
actory.block([]))); |
| 1932 } | 2363 } |
| 2364 |
| 1933 void test_visitForStatement_i() { | 2365 void test_visitForStatement_i() { |
| 1934 assertSource("for (var i;;) {}", ASTFactory.forStatement2(ASTFactory.variabl
eDeclarationList2(Keyword.VAR, [ASTFactory.variableDeclaration("i")]), null, nul
l, ASTFactory.block([]))); | 2366 assertSource("for (var i;;) {}", ASTFactory.forStatement2(ASTFactory.variabl
eDeclarationList2(Keyword.VAR, [ASTFactory.variableDeclaration("i")]), null, nul
l, ASTFactory.block([]))); |
| 1935 } | 2367 } |
| 2368 |
| 1936 void test_visitForStatement_ic() { | 2369 void test_visitForStatement_ic() { |
| 1937 assertSource("for (var i; c;) {}", ASTFactory.forStatement2(ASTFactory.varia
bleDeclarationList2(Keyword.VAR, [ASTFactory.variableDeclaration("i")]), ASTFact
ory.identifier3("c"), null, ASTFactory.block([]))); | 2370 assertSource("for (var i; c;) {}", ASTFactory.forStatement2(ASTFactory.varia
bleDeclarationList2(Keyword.VAR, [ASTFactory.variableDeclaration("i")]), ASTFact
ory.identifier3("c"), null, ASTFactory.block([]))); |
| 1938 } | 2371 } |
| 2372 |
| 1939 void test_visitForStatement_icu() { | 2373 void test_visitForStatement_icu() { |
| 1940 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") as Expressi
on]), ASTFactory.block([]))); | 2374 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") as Expressi
on]), ASTFactory.block([]))); |
| 1941 } | 2375 } |
| 2376 |
| 1942 void test_visitForStatement_iu() { | 2377 void test_visitForStatement_iu() { |
| 1943 assertSource("for (var i;; u) {}", ASTFactory.forStatement2(ASTFactory.varia
bleDeclarationList2(Keyword.VAR, [ASTFactory.variableDeclaration("i")]), null, A
STFactory.list([ASTFactory.identifier3("u") as Expression]), ASTFactory.block([]
))); | 2378 assertSource("for (var i;; u) {}", ASTFactory.forStatement2(ASTFactory.varia
bleDeclarationList2(Keyword.VAR, [ASTFactory.variableDeclaration("i")]), null, A
STFactory.list([ASTFactory.identifier3("u") as Expression]), ASTFactory.block([]
))); |
| 1944 } | 2379 } |
| 2380 |
| 1945 void test_visitForStatement_u() { | 2381 void test_visitForStatement_u() { |
| 1946 assertSource("for (;; u) {}", ASTFactory.forStatement(null as Expression, nu
ll, ASTFactory.list([ASTFactory.identifier3("u") as Expression]), ASTFactory.blo
ck([]))); | 2382 assertSource("for (;; u) {}", ASTFactory.forStatement(null as Expression, nu
ll, ASTFactory.list([ASTFactory.identifier3("u") as Expression]), ASTFactory.blo
ck([]))); |
| 1947 } | 2383 } |
| 2384 |
| 1948 void test_visitFunctionDeclaration_getter() { | 2385 void test_visitFunctionDeclaration_getter() { |
| 1949 assertSource("get f() {}", ASTFactory.functionDeclaration(null, Keyword.GET,
"f", ASTFactory.functionExpression())); | 2386 assertSource("get f() {}", ASTFactory.functionDeclaration(null, Keyword.GET,
"f", ASTFactory.functionExpression())); |
| 1950 } | 2387 } |
| 2388 |
| 1951 void test_visitFunctionDeclaration_normal() { | 2389 void test_visitFunctionDeclaration_normal() { |
| 1952 assertSource("f() {}", ASTFactory.functionDeclaration(null, null, "f", ASTFa
ctory.functionExpression())); | 2390 assertSource("f() {}", ASTFactory.functionDeclaration(null, null, "f", ASTFa
ctory.functionExpression())); |
| 1953 } | 2391 } |
| 2392 |
| 1954 void test_visitFunctionDeclaration_setter() { | 2393 void test_visitFunctionDeclaration_setter() { |
| 1955 assertSource("set f() {}", ASTFactory.functionDeclaration(null, Keyword.SET,
"f", ASTFactory.functionExpression())); | 2394 assertSource("set f() {}", ASTFactory.functionDeclaration(null, Keyword.SET,
"f", ASTFactory.functionExpression())); |
| 1956 } | 2395 } |
| 2396 |
| 1957 void test_visitFunctionDeclarationStatement() { | 2397 void test_visitFunctionDeclarationStatement() { |
| 1958 assertSource("f() {};", ASTFactory.functionDeclarationStatement(null, null,
"f", ASTFactory.functionExpression())); | 2398 assertSource("f() {};", ASTFactory.functionDeclarationStatement(null, null,
"f", ASTFactory.functionExpression())); |
| 1959 } | 2399 } |
| 2400 |
| 1960 void test_visitFunctionExpression() { | 2401 void test_visitFunctionExpression() { |
| 1961 assertSource("() {}", ASTFactory.functionExpression()); | 2402 assertSource("() {}", ASTFactory.functionExpression()); |
| 1962 } | 2403 } |
| 2404 |
| 1963 void test_visitFunctionExpressionInvocation() { | 2405 void test_visitFunctionExpressionInvocation() { |
| 1964 assertSource("f()", ASTFactory.functionExpressionInvocation(ASTFactory.ident
ifier3("f"), [])); | 2406 assertSource("f()", ASTFactory.functionExpressionInvocation(ASTFactory.ident
ifier3("f"), [])); |
| 1965 } | 2407 } |
| 2408 |
| 1966 void test_visitFunctionTypedFormalParameter_noType() { | 2409 void test_visitFunctionTypedFormalParameter_noType() { |
| 1967 assertSource("f()", ASTFactory.functionTypedFormalParameter(null, "f", [])); | 2410 assertSource("f()", ASTFactory.functionTypedFormalParameter(null, "f", [])); |
| 1968 } | 2411 } |
| 2412 |
| 1969 void test_visitFunctionTypedFormalParameter_type() { | 2413 void test_visitFunctionTypedFormalParameter_type() { |
| 1970 assertSource("T f()", ASTFactory.functionTypedFormalParameter(ASTFactory.typ
eName4("T", []), "f", [])); | 2414 assertSource("T f()", ASTFactory.functionTypedFormalParameter(ASTFactory.typ
eName4("T", []), "f", [])); |
| 1971 } | 2415 } |
| 2416 |
| 1972 void test_visitIfStatement_withElse() { | 2417 void test_visitIfStatement_withElse() { |
| 1973 assertSource("if (c) {} else {}", ASTFactory.ifStatement2(ASTFactory.identif
ier3("c"), ASTFactory.block([]), ASTFactory.block([]))); | 2418 assertSource("if (c) {} else {}", ASTFactory.ifStatement2(ASTFactory.identif
ier3("c"), ASTFactory.block([]), ASTFactory.block([]))); |
| 1974 } | 2419 } |
| 2420 |
| 1975 void test_visitIfStatement_withoutElse() { | 2421 void test_visitIfStatement_withoutElse() { |
| 1976 assertSource("if (c) {}", ASTFactory.ifStatement(ASTFactory.identifier3("c")
, ASTFactory.block([]))); | 2422 assertSource("if (c) {}", ASTFactory.ifStatement(ASTFactory.identifier3("c")
, ASTFactory.block([]))); |
| 1977 } | 2423 } |
| 2424 |
| 1978 void test_visitImplementsClause_multiple() { | 2425 void test_visitImplementsClause_multiple() { |
| 1979 assertSource("implements A, B", ASTFactory.implementsClause([ | 2426 assertSource("implements A, B", ASTFactory.implementsClause([ |
| 1980 ASTFactory.typeName4("A", []), | 2427 ASTFactory.typeName4("A", []), |
| 1981 ASTFactory.typeName4("B", [])])); | 2428 ASTFactory.typeName4("B", [])])); |
| 1982 } | 2429 } |
| 2430 |
| 1983 void test_visitImplementsClause_single() { | 2431 void test_visitImplementsClause_single() { |
| 1984 assertSource("implements A", ASTFactory.implementsClause([ASTFactory.typeNam
e4("A", [])])); | 2432 assertSource("implements A", ASTFactory.implementsClause([ASTFactory.typeNam
e4("A", [])])); |
| 1985 } | 2433 } |
| 2434 |
| 1986 void test_visitImportDirective_combinator() { | 2435 void test_visitImportDirective_combinator() { |
| 1987 assertSource("import 'a.dart' show A;", ASTFactory.importDirective2("a.dart"
, null, [ASTFactory.showCombinator([ASTFactory.identifier3("A")])])); | 2436 assertSource("import 'a.dart' show A;", ASTFactory.importDirective2("a.dart"
, null, [ASTFactory.showCombinator([ASTFactory.identifier3("A")])])); |
| 1988 } | 2437 } |
| 2438 |
| 1989 void test_visitImportDirective_combinators() { | 2439 void test_visitImportDirective_combinators() { |
| 1990 assertSource("import 'a.dart' show A hide B;", ASTFactory.importDirective2("
a.dart", null, [ | 2440 assertSource("import 'a.dart' show A hide B;", ASTFactory.importDirective2("
a.dart", null, [ |
| 1991 ASTFactory.showCombinator([ASTFactory.identifier3("A")]), | 2441 ASTFactory.showCombinator([ASTFactory.identifier3("A")]), |
| 1992 ASTFactory.hideCombinator([ASTFactory.identifier3("B")])])); | 2442 ASTFactory.hideCombinator([ASTFactory.identifier3("B")])])); |
| 1993 } | 2443 } |
| 2444 |
| 1994 void test_visitImportDirective_minimal() { | 2445 void test_visitImportDirective_minimal() { |
| 1995 assertSource("import 'a.dart';", ASTFactory.importDirective2("a.dart", null,
[])); | 2446 assertSource("import 'a.dart';", ASTFactory.importDirective2("a.dart", null,
[])); |
| 1996 } | 2447 } |
| 2448 |
| 1997 void test_visitImportDirective_prefix() { | 2449 void test_visitImportDirective_prefix() { |
| 1998 assertSource("import 'a.dart' as p;", ASTFactory.importDirective2("a.dart",
"p", [])); | 2450 assertSource("import 'a.dart' as p;", ASTFactory.importDirective2("a.dart",
"p", [])); |
| 1999 } | 2451 } |
| 2452 |
| 2000 void test_visitImportDirective_prefix_combinator() { | 2453 void test_visitImportDirective_prefix_combinator() { |
| 2001 assertSource("import 'a.dart' as p show A;", ASTFactory.importDirective2("a.
dart", "p", [ASTFactory.showCombinator([ASTFactory.identifier3("A")])])); | 2454 assertSource("import 'a.dart' as p show A;", ASTFactory.importDirective2("a.
dart", "p", [ASTFactory.showCombinator([ASTFactory.identifier3("A")])])); |
| 2002 } | 2455 } |
| 2456 |
| 2003 void test_visitImportDirective_prefix_combinators() { | 2457 void test_visitImportDirective_prefix_combinators() { |
| 2004 assertSource("import 'a.dart' as p show A hide B;", ASTFactory.importDirecti
ve2("a.dart", "p", [ | 2458 assertSource("import 'a.dart' as p show A hide B;", ASTFactory.importDirecti
ve2("a.dart", "p", [ |
| 2005 ASTFactory.showCombinator([ASTFactory.identifier3("A")]), | 2459 ASTFactory.showCombinator([ASTFactory.identifier3("A")]), |
| 2006 ASTFactory.hideCombinator([ASTFactory.identifier3("B")])])); | 2460 ASTFactory.hideCombinator([ASTFactory.identifier3("B")])])); |
| 2007 } | 2461 } |
| 2462 |
| 2008 void test_visitImportHideCombinator_multiple() { | 2463 void test_visitImportHideCombinator_multiple() { |
| 2009 assertSource("hide a, b", ASTFactory.hideCombinator([ASTFactory.identifier3(
"a"), ASTFactory.identifier3("b")])); | 2464 assertSource("hide a, b", ASTFactory.hideCombinator([ASTFactory.identifier3(
"a"), ASTFactory.identifier3("b")])); |
| 2010 } | 2465 } |
| 2466 |
| 2011 void test_visitImportHideCombinator_single() { | 2467 void test_visitImportHideCombinator_single() { |
| 2012 assertSource("hide a", ASTFactory.hideCombinator([ASTFactory.identifier3("a"
)])); | 2468 assertSource("hide a", ASTFactory.hideCombinator([ASTFactory.identifier3("a"
)])); |
| 2013 } | 2469 } |
| 2470 |
| 2014 void test_visitImportShowCombinator_multiple() { | 2471 void test_visitImportShowCombinator_multiple() { |
| 2015 assertSource("show a, b", ASTFactory.showCombinator([ASTFactory.identifier3(
"a"), ASTFactory.identifier3("b")])); | 2472 assertSource("show a, b", ASTFactory.showCombinator([ASTFactory.identifier3(
"a"), ASTFactory.identifier3("b")])); |
| 2016 } | 2473 } |
| 2474 |
| 2017 void test_visitImportShowCombinator_single() { | 2475 void test_visitImportShowCombinator_single() { |
| 2018 assertSource("show a", ASTFactory.showCombinator([ASTFactory.identifier3("a"
)])); | 2476 assertSource("show a", ASTFactory.showCombinator([ASTFactory.identifier3("a"
)])); |
| 2019 } | 2477 } |
| 2478 |
| 2020 void test_visitIndexExpression() { | 2479 void test_visitIndexExpression() { |
| 2021 assertSource("a[i]", ASTFactory.indexExpression(ASTFactory.identifier3("a"),
ASTFactory.identifier3("i"))); | 2480 assertSource("a[i]", ASTFactory.indexExpression(ASTFactory.identifier3("a"),
ASTFactory.identifier3("i"))); |
| 2022 } | 2481 } |
| 2482 |
| 2023 void test_visitInstanceCreationExpression_const() { | 2483 void test_visitInstanceCreationExpression_const() { |
| 2024 assertSource("const C()", ASTFactory.instanceCreationExpression2(Keyword.CON
ST, ASTFactory.typeName4("C", []), [])); | 2484 assertSource("const C()", ASTFactory.instanceCreationExpression2(Keyword.CON
ST, ASTFactory.typeName4("C", []), [])); |
| 2025 } | 2485 } |
| 2486 |
| 2026 void test_visitInstanceCreationExpression_named() { | 2487 void test_visitInstanceCreationExpression_named() { |
| 2027 assertSource("new C.c()", ASTFactory.instanceCreationExpression3(Keyword.NEW
, ASTFactory.typeName4("C", []), "c", [])); | 2488 assertSource("new C.c()", ASTFactory.instanceCreationExpression3(Keyword.NEW
, ASTFactory.typeName4("C", []), "c", [])); |
| 2028 } | 2489 } |
| 2490 |
| 2029 void test_visitInstanceCreationExpression_unnamed() { | 2491 void test_visitInstanceCreationExpression_unnamed() { |
| 2030 assertSource("new C()", ASTFactory.instanceCreationExpression2(Keyword.NEW,
ASTFactory.typeName4("C", []), [])); | 2492 assertSource("new C()", ASTFactory.instanceCreationExpression2(Keyword.NEW,
ASTFactory.typeName4("C", []), [])); |
| 2031 } | 2493 } |
| 2494 |
| 2032 void test_visitIntegerLiteral() { | 2495 void test_visitIntegerLiteral() { |
| 2033 assertSource("42", ASTFactory.integer(42)); | 2496 assertSource("42", ASTFactory.integer(42)); |
| 2034 } | 2497 } |
| 2498 |
| 2035 void test_visitInterpolationExpression_expression() { | 2499 void test_visitInterpolationExpression_expression() { |
| 2036 assertSource("\${a}", ASTFactory.interpolationExpression(ASTFactory.identifi
er3("a"))); | 2500 assertSource("\${a}", ASTFactory.interpolationExpression(ASTFactory.identifi
er3("a"))); |
| 2037 } | 2501 } |
| 2502 |
| 2038 void test_visitInterpolationExpression_identifier() { | 2503 void test_visitInterpolationExpression_identifier() { |
| 2039 assertSource("\$a", ASTFactory.interpolationExpression2("a")); | 2504 assertSource("\$a", ASTFactory.interpolationExpression2("a")); |
| 2040 } | 2505 } |
| 2506 |
| 2041 void test_visitInterpolationString() { | 2507 void test_visitInterpolationString() { |
| 2042 assertSource("'x", ASTFactory.interpolationString("'x", "x")); | 2508 assertSource("'x", ASTFactory.interpolationString("'x", "x")); |
| 2043 } | 2509 } |
| 2510 |
| 2044 void test_visitIsExpression_negated() { | 2511 void test_visitIsExpression_negated() { |
| 2045 assertSource("a is! C", ASTFactory.isExpression(ASTFactory.identifier3("a"),
true, ASTFactory.typeName4("C", []))); | 2512 assertSource("a is! C", ASTFactory.isExpression(ASTFactory.identifier3("a"),
true, ASTFactory.typeName4("C", []))); |
| 2046 } | 2513 } |
| 2514 |
| 2047 void test_visitIsExpression_normal() { | 2515 void test_visitIsExpression_normal() { |
| 2048 assertSource("a is C", ASTFactory.isExpression(ASTFactory.identifier3("a"),
false, ASTFactory.typeName4("C", []))); | 2516 assertSource("a is C", ASTFactory.isExpression(ASTFactory.identifier3("a"),
false, ASTFactory.typeName4("C", []))); |
| 2049 } | 2517 } |
| 2518 |
| 2050 void test_visitLabel() { | 2519 void test_visitLabel() { |
| 2051 assertSource("a:", ASTFactory.label2("a")); | 2520 assertSource("a:", ASTFactory.label2("a")); |
| 2052 } | 2521 } |
| 2522 |
| 2053 void test_visitLabeledStatement_multiple() { | 2523 void test_visitLabeledStatement_multiple() { |
| 2054 assertSource("a: b: return;", ASTFactory.labeledStatement(ASTFactory.list([A
STFactory.label2("a"), ASTFactory.label2("b")]), ASTFactory.returnStatement())); | 2524 assertSource("a: b: return;", ASTFactory.labeledStatement(ASTFactory.list([A
STFactory.label2("a"), ASTFactory.label2("b")]), ASTFactory.returnStatement())); |
| 2055 } | 2525 } |
| 2526 |
| 2056 void test_visitLabeledStatement_single() { | 2527 void test_visitLabeledStatement_single() { |
| 2057 assertSource("a: return;", ASTFactory.labeledStatement(ASTFactory.list([ASTF
actory.label2("a")]), ASTFactory.returnStatement())); | 2528 assertSource("a: return;", ASTFactory.labeledStatement(ASTFactory.list([ASTF
actory.label2("a")]), ASTFactory.returnStatement())); |
| 2058 } | 2529 } |
| 2530 |
| 2059 void test_visitLibraryDirective() { | 2531 void test_visitLibraryDirective() { |
| 2060 assertSource("library l;", ASTFactory.libraryDirective2("l")); | 2532 assertSource("library l;", ASTFactory.libraryDirective2("l")); |
| 2061 } | 2533 } |
| 2534 |
| 2062 void test_visitLibraryIdentifier_multiple() { | 2535 void test_visitLibraryIdentifier_multiple() { |
| 2063 assertSource("a.b.c", ASTFactory.libraryIdentifier([ | 2536 assertSource("a.b.c", ASTFactory.libraryIdentifier([ |
| 2064 ASTFactory.identifier3("a"), | 2537 ASTFactory.identifier3("a"), |
| 2065 ASTFactory.identifier3("b"), | 2538 ASTFactory.identifier3("b"), |
| 2066 ASTFactory.identifier3("c")])); | 2539 ASTFactory.identifier3("c")])); |
| 2067 } | 2540 } |
| 2541 |
| 2068 void test_visitLibraryIdentifier_single() { | 2542 void test_visitLibraryIdentifier_single() { |
| 2069 assertSource("a", ASTFactory.libraryIdentifier([ASTFactory.identifier3("a")]
)); | 2543 assertSource("a", ASTFactory.libraryIdentifier([ASTFactory.identifier3("a")]
)); |
| 2070 } | 2544 } |
| 2545 |
| 2071 void test_visitListLiteral_const() { | 2546 void test_visitListLiteral_const() { |
| 2072 assertSource("const []", ASTFactory.listLiteral2(Keyword.CONST, null, [])); | 2547 assertSource("const []", ASTFactory.listLiteral2(Keyword.CONST, null, [])); |
| 2073 } | 2548 } |
| 2549 |
| 2074 void test_visitListLiteral_empty() { | 2550 void test_visitListLiteral_empty() { |
| 2075 assertSource("[]", ASTFactory.listLiteral([])); | 2551 assertSource("[]", ASTFactory.listLiteral([])); |
| 2076 } | 2552 } |
| 2553 |
| 2077 void test_visitListLiteral_nonEmpty() { | 2554 void test_visitListLiteral_nonEmpty() { |
| 2078 assertSource("[a, b, c]", ASTFactory.listLiteral([ | 2555 assertSource("[a, b, c]", ASTFactory.listLiteral([ |
| 2079 ASTFactory.identifier3("a"), | 2556 ASTFactory.identifier3("a"), |
| 2080 ASTFactory.identifier3("b"), | 2557 ASTFactory.identifier3("b"), |
| 2081 ASTFactory.identifier3("c")])); | 2558 ASTFactory.identifier3("c")])); |
| 2082 } | 2559 } |
| 2560 |
| 2083 void test_visitMapLiteral_const() { | 2561 void test_visitMapLiteral_const() { |
| 2084 assertSource("const {}", ASTFactory.mapLiteral(Keyword.CONST, null, [])); | 2562 assertSource("const {}", ASTFactory.mapLiteral(Keyword.CONST, null, [])); |
| 2085 } | 2563 } |
| 2564 |
| 2086 void test_visitMapLiteral_empty() { | 2565 void test_visitMapLiteral_empty() { |
| 2087 assertSource("{}", ASTFactory.mapLiteral2([])); | 2566 assertSource("{}", ASTFactory.mapLiteral2([])); |
| 2088 } | 2567 } |
| 2568 |
| 2089 void test_visitMapLiteral_nonEmpty() { | 2569 void test_visitMapLiteral_nonEmpty() { |
| 2090 assertSource("{'a' : a, 'b' : b, 'c' : c}", ASTFactory.mapLiteral2([ | 2570 assertSource("{'a' : a, 'b' : b, 'c' : c}", ASTFactory.mapLiteral2([ |
| 2091 ASTFactory.mapLiteralEntry("a", ASTFactory.identifier3("a")), | 2571 ASTFactory.mapLiteralEntry("a", ASTFactory.identifier3("a")), |
| 2092 ASTFactory.mapLiteralEntry("b", ASTFactory.identifier3("b")), | 2572 ASTFactory.mapLiteralEntry("b", ASTFactory.identifier3("b")), |
| 2093 ASTFactory.mapLiteralEntry("c", ASTFactory.identifier3("c"))])); | 2573 ASTFactory.mapLiteralEntry("c", ASTFactory.identifier3("c"))])); |
| 2094 } | 2574 } |
| 2575 |
| 2095 void test_visitMapLiteralEntry() { | 2576 void test_visitMapLiteralEntry() { |
| 2096 assertSource("'a' : b", ASTFactory.mapLiteralEntry("a", ASTFactory.identifie
r3("b"))); | 2577 assertSource("'a' : b", ASTFactory.mapLiteralEntry("a", ASTFactory.identifie
r3("b"))); |
| 2097 } | 2578 } |
| 2579 |
| 2098 void test_visitMethodDeclaration_external() { | 2580 void test_visitMethodDeclaration_external() { |
| 2099 assertSource("external m();", ASTFactory.methodDeclaration(null, null, null,
null, ASTFactory.identifier3("m"), ASTFactory.formalParameterList([]))); | 2581 assertSource("external m();", ASTFactory.methodDeclaration(null, null, null,
null, ASTFactory.identifier3("m"), ASTFactory.formalParameterList([]))); |
| 2100 } | 2582 } |
| 2583 |
| 2101 void test_visitMethodDeclaration_external_returnType() { | 2584 void test_visitMethodDeclaration_external_returnType() { |
| 2102 assertSource("external T m();", ASTFactory.methodDeclaration(null, ASTFactor
y.typeName4("T", []), null, null, ASTFactory.identifier3("m"), ASTFactory.formal
ParameterList([]))); | 2585 assertSource("external T m();", ASTFactory.methodDeclaration(null, ASTFactor
y.typeName4("T", []), null, null, ASTFactory.identifier3("m"), ASTFactory.formal
ParameterList([]))); |
| 2103 } | 2586 } |
| 2587 |
| 2104 void test_visitMethodDeclaration_getter() { | 2588 void test_visitMethodDeclaration_getter() { |
| 2105 assertSource("get m {}", ASTFactory.methodDeclaration2(null, null, Keyword.G
ET, null, ASTFactory.identifier3("m"), null, ASTFactory.blockFunctionBody2([])))
; | 2589 assertSource("get m {}", ASTFactory.methodDeclaration2(null, null, Keyword.G
ET, null, ASTFactory.identifier3("m"), null, ASTFactory.blockFunctionBody2([])))
; |
| 2106 } | 2590 } |
| 2591 |
| 2107 void test_visitMethodDeclaration_getter_returnType() { | 2592 void test_visitMethodDeclaration_getter_returnType() { |
| 2108 assertSource("T get m {}", ASTFactory.methodDeclaration2(null, ASTFactory.ty
peName4("T", []), Keyword.GET, null, ASTFactory.identifier3("m"), null, ASTFacto
ry.blockFunctionBody2([]))); | 2593 assertSource("T get m {}", ASTFactory.methodDeclaration2(null, ASTFactory.ty
peName4("T", []), Keyword.GET, null, ASTFactory.identifier3("m"), null, ASTFacto
ry.blockFunctionBody2([]))); |
| 2109 } | 2594 } |
| 2595 |
| 2110 void test_visitMethodDeclaration_getter_seturnType() { | 2596 void test_visitMethodDeclaration_getter_seturnType() { |
| 2111 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([]))); | 2597 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([]))); |
| 2112 } | 2598 } |
| 2599 |
| 2113 void test_visitMethodDeclaration_minimal() { | 2600 void test_visitMethodDeclaration_minimal() { |
| 2114 assertSource("m() {}", ASTFactory.methodDeclaration2(null, null, null, null,
ASTFactory.identifier3("m"), ASTFactory.formalParameterList([]), ASTFactory.blo
ckFunctionBody2([]))); | 2601 assertSource("m() {}", ASTFactory.methodDeclaration2(null, null, null, null,
ASTFactory.identifier3("m"), ASTFactory.formalParameterList([]), ASTFactory.blo
ckFunctionBody2([]))); |
| 2115 } | 2602 } |
| 2603 |
| 2116 void test_visitMethodDeclaration_multipleParameters() { | 2604 void test_visitMethodDeclaration_multipleParameters() { |
| 2117 assertSource("m(var a, var b) {}", ASTFactory.methodDeclaration2(null, null,
null, null, ASTFactory.identifier3("m"), ASTFactory.formalParameterList([ | 2605 assertSource("m(var a, var b) {}", ASTFactory.methodDeclaration2(null, null,
null, null, ASTFactory.identifier3("m"), ASTFactory.formalParameterList([ |
| 2118 ASTFactory.simpleFormalParameter(Keyword.VAR, "a"), | 2606 ASTFactory.simpleFormalParameter(Keyword.VAR, "a"), |
| 2119 ASTFactory.simpleFormalParameter(Keyword.VAR, "b")]), ASTFactory.blockFu
nctionBody2([]))); | 2607 ASTFactory.simpleFormalParameter(Keyword.VAR, "b")]), ASTFactory.blockFu
nctionBody2([]))); |
| 2120 } | 2608 } |
| 2609 |
| 2121 void test_visitMethodDeclaration_operator() { | 2610 void test_visitMethodDeclaration_operator() { |
| 2122 assertSource("operator +() {}", ASTFactory.methodDeclaration2(null, null, nu
ll, Keyword.OPERATOR, ASTFactory.identifier3("+"), ASTFactory.formalParameterLis
t([]), ASTFactory.blockFunctionBody2([]))); | 2611 assertSource("operator +() {}", ASTFactory.methodDeclaration2(null, null, nu
ll, Keyword.OPERATOR, ASTFactory.identifier3("+"), ASTFactory.formalParameterLis
t([]), ASTFactory.blockFunctionBody2([]))); |
| 2123 } | 2612 } |
| 2613 |
| 2124 void test_visitMethodDeclaration_operator_returnType() { | 2614 void test_visitMethodDeclaration_operator_returnType() { |
| 2125 assertSource("T operator +() {}", ASTFactory.methodDeclaration2(null, ASTFac
tory.typeName4("T", []), null, Keyword.OPERATOR, ASTFactory.identifier3("+"), AS
TFactory.formalParameterList([]), ASTFactory.blockFunctionBody2([]))); | 2615 assertSource("T operator +() {}", ASTFactory.methodDeclaration2(null, ASTFac
tory.typeName4("T", []), null, Keyword.OPERATOR, ASTFactory.identifier3("+"), AS
TFactory.formalParameterList([]), ASTFactory.blockFunctionBody2([]))); |
| 2126 } | 2616 } |
| 2617 |
| 2127 void test_visitMethodDeclaration_returnType() { | 2618 void test_visitMethodDeclaration_returnType() { |
| 2128 assertSource("T m() {}", ASTFactory.methodDeclaration2(null, ASTFactory.type
Name4("T", []), null, null, ASTFactory.identifier3("m"), ASTFactory.formalParame
terList([]), ASTFactory.blockFunctionBody2([]))); | 2619 assertSource("T m() {}", ASTFactory.methodDeclaration2(null, ASTFactory.type
Name4("T", []), null, null, ASTFactory.identifier3("m"), ASTFactory.formalParame
terList([]), ASTFactory.blockFunctionBody2([]))); |
| 2129 } | 2620 } |
| 2621 |
| 2130 void test_visitMethodDeclaration_setter() { | 2622 void test_visitMethodDeclaration_setter() { |
| 2131 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([]))); | 2623 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([]))); |
| 2132 } | 2624 } |
| 2625 |
| 2133 void test_visitMethodDeclaration_static() { | 2626 void test_visitMethodDeclaration_static() { |
| 2134 assertSource("static m() {}", ASTFactory.methodDeclaration2(Keyword.STATIC,
null, null, null, ASTFactory.identifier3("m"), ASTFactory.formalParameterList([]
), ASTFactory.blockFunctionBody2([]))); | 2627 assertSource("static m() {}", ASTFactory.methodDeclaration2(Keyword.STATIC,
null, null, null, ASTFactory.identifier3("m"), ASTFactory.formalParameterList([]
), ASTFactory.blockFunctionBody2([]))); |
| 2135 } | 2628 } |
| 2629 |
| 2136 void test_visitMethodDeclaration_static_returnType() { | 2630 void test_visitMethodDeclaration_static_returnType() { |
| 2137 assertSource("static T m() {}", ASTFactory.methodDeclaration2(Keyword.STATIC
, ASTFactory.typeName4("T", []), null, null, ASTFactory.identifier3("m"), ASTFac
tory.formalParameterList([]), ASTFactory.blockFunctionBody2([]))); | 2631 assertSource("static T m() {}", ASTFactory.methodDeclaration2(Keyword.STATIC
, ASTFactory.typeName4("T", []), null, null, ASTFactory.identifier3("m"), ASTFac
tory.formalParameterList([]), ASTFactory.blockFunctionBody2([]))); |
| 2138 } | 2632 } |
| 2633 |
| 2139 void test_visitMethodInvocation_noTarget() { | 2634 void test_visitMethodInvocation_noTarget() { |
| 2140 assertSource("m()", ASTFactory.methodInvocation2("m", [])); | 2635 assertSource("m()", ASTFactory.methodInvocation2("m", [])); |
| 2141 } | 2636 } |
| 2637 |
| 2142 void test_visitMethodInvocation_target() { | 2638 void test_visitMethodInvocation_target() { |
| 2143 assertSource("t.m()", ASTFactory.methodInvocation(ASTFactory.identifier3("t"
), "m", [])); | 2639 assertSource("t.m()", ASTFactory.methodInvocation(ASTFactory.identifier3("t"
), "m", [])); |
| 2144 } | 2640 } |
| 2641 |
| 2145 void test_visitNamedExpression() { | 2642 void test_visitNamedExpression() { |
| 2146 assertSource("a: b", ASTFactory.namedExpression2("a", ASTFactory.identifier3
("b"))); | 2643 assertSource("a: b", ASTFactory.namedExpression2("a", ASTFactory.identifier3
("b"))); |
| 2147 } | 2644 } |
| 2645 |
| 2148 void test_visitNamedFormalParameter() { | 2646 void test_visitNamedFormalParameter() { |
| 2149 assertSource("var a : 0", ASTFactory.namedFormalParameter(ASTFactory.simpleF
ormalParameter(Keyword.VAR, "a"), ASTFactory.integer(0))); | 2647 assertSource("var a : 0", ASTFactory.namedFormalParameter(ASTFactory.simpleF
ormalParameter(Keyword.VAR, "a"), ASTFactory.integer(0))); |
| 2150 } | 2648 } |
| 2649 |
| 2151 void test_visitNativeClause() { | 2650 void test_visitNativeClause() { |
| 2152 assertSource("native 'code'", ASTFactory.nativeClause("code")); | 2651 assertSource("native 'code'", ASTFactory.nativeClause("code")); |
| 2153 } | 2652 } |
| 2653 |
| 2154 void test_visitNativeFunctionBody() { | 2654 void test_visitNativeFunctionBody() { |
| 2155 assertSource("native 'str';", ASTFactory.nativeFunctionBody("str")); | 2655 assertSource("native 'str';", ASTFactory.nativeFunctionBody("str")); |
| 2156 } | 2656 } |
| 2657 |
| 2157 void test_visitNullLiteral() { | 2658 void test_visitNullLiteral() { |
| 2158 assertSource("null", ASTFactory.nullLiteral()); | 2659 assertSource("null", ASTFactory.nullLiteral()); |
| 2159 } | 2660 } |
| 2661 |
| 2160 void test_visitParenthesizedExpression() { | 2662 void test_visitParenthesizedExpression() { |
| 2161 assertSource("(a)", ASTFactory.parenthesizedExpression(ASTFactory.identifier
3("a"))); | 2663 assertSource("(a)", ASTFactory.parenthesizedExpression(ASTFactory.identifier
3("a"))); |
| 2162 } | 2664 } |
| 2665 |
| 2163 void test_visitPartDirective() { | 2666 void test_visitPartDirective() { |
| 2164 assertSource("part 'a.dart';", ASTFactory.partDirective2("a.dart")); | 2667 assertSource("part 'a.dart';", ASTFactory.partDirective2("a.dart")); |
| 2165 } | 2668 } |
| 2669 |
| 2166 void test_visitPartOfDirective() { | 2670 void test_visitPartOfDirective() { |
| 2167 assertSource("part of l;", ASTFactory.partOfDirective(ASTFactory.libraryIden
tifier2(["l"]))); | 2671 assertSource("part of l;", ASTFactory.partOfDirective(ASTFactory.libraryIden
tifier2(["l"]))); |
| 2168 } | 2672 } |
| 2673 |
| 2169 void test_visitPositionalFormalParameter() { | 2674 void test_visitPositionalFormalParameter() { |
| 2170 assertSource("var a = 0", ASTFactory.positionalFormalParameter(ASTFactory.si
mpleFormalParameter(Keyword.VAR, "a"), ASTFactory.integer(0))); | 2675 assertSource("var a = 0", ASTFactory.positionalFormalParameter(ASTFactory.si
mpleFormalParameter(Keyword.VAR, "a"), ASTFactory.integer(0))); |
| 2171 } | 2676 } |
| 2677 |
| 2172 void test_visitPostfixExpression() { | 2678 void test_visitPostfixExpression() { |
| 2173 assertSource("a++", ASTFactory.postfixExpression(ASTFactory.identifier3("a")
, TokenType.PLUS_PLUS)); | 2679 assertSource("a++", ASTFactory.postfixExpression(ASTFactory.identifier3("a")
, TokenType.PLUS_PLUS)); |
| 2174 } | 2680 } |
| 2681 |
| 2175 void test_visitPrefixedIdentifier() { | 2682 void test_visitPrefixedIdentifier() { |
| 2176 assertSource("a.b", ASTFactory.identifier5("a", "b")); | 2683 assertSource("a.b", ASTFactory.identifier5("a", "b")); |
| 2177 } | 2684 } |
| 2685 |
| 2178 void test_visitPrefixExpression() { | 2686 void test_visitPrefixExpression() { |
| 2179 assertSource("-a", ASTFactory.prefixExpression(TokenType.MINUS, ASTFactory.i
dentifier3("a"))); | 2687 assertSource("-a", ASTFactory.prefixExpression(TokenType.MINUS, ASTFactory.i
dentifier3("a"))); |
| 2180 } | 2688 } |
| 2689 |
| 2181 void test_visitPropertyAccess() { | 2690 void test_visitPropertyAccess() { |
| 2182 assertSource("a.b", ASTFactory.propertyAccess2(ASTFactory.identifier3("a"),
"b")); | 2691 assertSource("a.b", ASTFactory.propertyAccess2(ASTFactory.identifier3("a"),
"b")); |
| 2183 } | 2692 } |
| 2693 |
| 2184 void test_visitRedirectingConstructorInvocation_named() { | 2694 void test_visitRedirectingConstructorInvocation_named() { |
| 2185 assertSource("this.c()", ASTFactory.redirectingConstructorInvocation2("c", [
])); | 2695 assertSource("this.c()", ASTFactory.redirectingConstructorInvocation2("c", [
])); |
| 2186 } | 2696 } |
| 2697 |
| 2187 void test_visitRedirectingConstructorInvocation_unnamed() { | 2698 void test_visitRedirectingConstructorInvocation_unnamed() { |
| 2188 assertSource("this()", ASTFactory.redirectingConstructorInvocation([])); | 2699 assertSource("this()", ASTFactory.redirectingConstructorInvocation([])); |
| 2189 } | 2700 } |
| 2701 |
| 2190 void test_visitRethrowExpression() { | 2702 void test_visitRethrowExpression() { |
| 2191 assertSource("rethrow", ASTFactory.rethrowExpression()); | 2703 assertSource("rethrow", ASTFactory.rethrowExpression()); |
| 2192 } | 2704 } |
| 2705 |
| 2193 void test_visitReturnStatement_expression() { | 2706 void test_visitReturnStatement_expression() { |
| 2194 assertSource("return a;", ASTFactory.returnStatement2(ASTFactory.identifier3
("a"))); | 2707 assertSource("return a;", ASTFactory.returnStatement2(ASTFactory.identifier3
("a"))); |
| 2195 } | 2708 } |
| 2709 |
| 2196 void test_visitReturnStatement_noExpression() { | 2710 void test_visitReturnStatement_noExpression() { |
| 2197 assertSource("return;", ASTFactory.returnStatement()); | 2711 assertSource("return;", ASTFactory.returnStatement()); |
| 2198 } | 2712 } |
| 2713 |
| 2199 void test_visitScriptTag() { | 2714 void test_visitScriptTag() { |
| 2200 String scriptTag = "!#/bin/dart.exe"; | 2715 String scriptTag = "!#/bin/dart.exe"; |
| 2201 assertSource(scriptTag, ASTFactory.scriptTag(scriptTag)); | 2716 assertSource(scriptTag, ASTFactory.scriptTag(scriptTag)); |
| 2202 } | 2717 } |
| 2718 |
| 2203 void test_visitSimpleFormalParameter_keyword() { | 2719 void test_visitSimpleFormalParameter_keyword() { |
| 2204 assertSource("var a", ASTFactory.simpleFormalParameter(Keyword.VAR, "a")); | 2720 assertSource("var a", ASTFactory.simpleFormalParameter(Keyword.VAR, "a")); |
| 2205 } | 2721 } |
| 2722 |
| 2206 void test_visitSimpleFormalParameter_keyword_type() { | 2723 void test_visitSimpleFormalParameter_keyword_type() { |
| 2207 assertSource("final A a", ASTFactory.simpleFormalParameter2(Keyword.FINAL, A
STFactory.typeName4("A", []), "a")); | 2724 assertSource("final A a", ASTFactory.simpleFormalParameter2(Keyword.FINAL, A
STFactory.typeName4("A", []), "a")); |
| 2208 } | 2725 } |
| 2726 |
| 2209 void test_visitSimpleFormalParameter_type() { | 2727 void test_visitSimpleFormalParameter_type() { |
| 2210 assertSource("A a", ASTFactory.simpleFormalParameter4(ASTFactory.typeName4("
A", []), "a")); | 2728 assertSource("A a", ASTFactory.simpleFormalParameter4(ASTFactory.typeName4("
A", []), "a")); |
| 2211 } | 2729 } |
| 2730 |
| 2212 void test_visitSimpleIdentifier() { | 2731 void test_visitSimpleIdentifier() { |
| 2213 assertSource("a", ASTFactory.identifier3("a")); | 2732 assertSource("a", ASTFactory.identifier3("a")); |
| 2214 } | 2733 } |
| 2734 |
| 2215 void test_visitSimpleStringLiteral() { | 2735 void test_visitSimpleStringLiteral() { |
| 2216 assertSource("'a'", ASTFactory.string2("a")); | 2736 assertSource("'a'", ASTFactory.string2("a")); |
| 2217 } | 2737 } |
| 2738 |
| 2218 void test_visitStringInterpolation() { | 2739 void test_visitStringInterpolation() { |
| 2219 assertSource("'a\${e}b'", ASTFactory.string([ | 2740 assertSource("'a\${e}b'", ASTFactory.string([ |
| 2220 ASTFactory.interpolationString("'a", "a"), | 2741 ASTFactory.interpolationString("'a", "a"), |
| 2221 ASTFactory.interpolationExpression(ASTFactory.identifier3("e")), | 2742 ASTFactory.interpolationExpression(ASTFactory.identifier3("e")), |
| 2222 ASTFactory.interpolationString("b'", "b")])); | 2743 ASTFactory.interpolationString("b'", "b")])); |
| 2223 } | 2744 } |
| 2745 |
| 2224 void test_visitSuperConstructorInvocation() { | 2746 void test_visitSuperConstructorInvocation() { |
| 2225 assertSource("super()", ASTFactory.superConstructorInvocation([])); | 2747 assertSource("super()", ASTFactory.superConstructorInvocation([])); |
| 2226 } | 2748 } |
| 2749 |
| 2227 void test_visitSuperConstructorInvocation_named() { | 2750 void test_visitSuperConstructorInvocation_named() { |
| 2228 assertSource("super.c()", ASTFactory.superConstructorInvocation2("c", [])); | 2751 assertSource("super.c()", ASTFactory.superConstructorInvocation2("c", [])); |
| 2229 } | 2752 } |
| 2753 |
| 2230 void test_visitSuperExpression() { | 2754 void test_visitSuperExpression() { |
| 2231 assertSource("super", ASTFactory.superExpression()); | 2755 assertSource("super", ASTFactory.superExpression()); |
| 2232 } | 2756 } |
| 2757 |
| 2233 void test_visitSwitchCase_multipleLabels() { | 2758 void test_visitSwitchCase_multipleLabels() { |
| 2234 assertSource("l1: l2: case a: {}", ASTFactory.switchCase2(ASTFactory.list([A
STFactory.label2("l1"), ASTFactory.label2("l2")]), ASTFactory.identifier3("a"),
[ASTFactory.block([])])); | 2759 assertSource("l1: l2: case a: {}", ASTFactory.switchCase2(ASTFactory.list([A
STFactory.label2("l1"), ASTFactory.label2("l2")]), ASTFactory.identifier3("a"),
[ASTFactory.block([])])); |
| 2235 } | 2760 } |
| 2761 |
| 2236 void test_visitSwitchCase_multipleStatements() { | 2762 void test_visitSwitchCase_multipleStatements() { |
| 2237 assertSource("case a: {} {}", ASTFactory.switchCase(ASTFactory.identifier3("
a"), [ASTFactory.block([]), ASTFactory.block([])])); | 2763 assertSource("case a: {} {}", ASTFactory.switchCase(ASTFactory.identifier3("
a"), [ASTFactory.block([]), ASTFactory.block([])])); |
| 2238 } | 2764 } |
| 2765 |
| 2239 void test_visitSwitchCase_noLabels() { | 2766 void test_visitSwitchCase_noLabels() { |
| 2240 assertSource("case a: {}", ASTFactory.switchCase(ASTFactory.identifier3("a")
, [ASTFactory.block([])])); | 2767 assertSource("case a: {}", ASTFactory.switchCase(ASTFactory.identifier3("a")
, [ASTFactory.block([])])); |
| 2241 } | 2768 } |
| 2769 |
| 2242 void test_visitSwitchCase_singleLabel() { | 2770 void test_visitSwitchCase_singleLabel() { |
| 2243 assertSource("l1: case a: {}", ASTFactory.switchCase2(ASTFactory.list([ASTFa
ctory.label2("l1")]), ASTFactory.identifier3("a"), [ASTFactory.block([])])); | 2771 assertSource("l1: case a: {}", ASTFactory.switchCase2(ASTFactory.list([ASTFa
ctory.label2("l1")]), ASTFactory.identifier3("a"), [ASTFactory.block([])])); |
| 2244 } | 2772 } |
| 2773 |
| 2245 void test_visitSwitchDefault_multipleLabels() { | 2774 void test_visitSwitchDefault_multipleLabels() { |
| 2246 assertSource("l1: l2: default: {}", ASTFactory.switchDefault(ASTFactory.list
([ASTFactory.label2("l1"), ASTFactory.label2("l2")]), [ASTFactory.block([])])); | 2775 assertSource("l1: l2: default: {}", ASTFactory.switchDefault(ASTFactory.list
([ASTFactory.label2("l1"), ASTFactory.label2("l2")]), [ASTFactory.block([])])); |
| 2247 } | 2776 } |
| 2777 |
| 2248 void test_visitSwitchDefault_multipleStatements() { | 2778 void test_visitSwitchDefault_multipleStatements() { |
| 2249 assertSource("default: {} {}", ASTFactory.switchDefault2([ASTFactory.block([
]), ASTFactory.block([])])); | 2779 assertSource("default: {} {}", ASTFactory.switchDefault2([ASTFactory.block([
]), ASTFactory.block([])])); |
| 2250 } | 2780 } |
| 2781 |
| 2251 void test_visitSwitchDefault_noLabels() { | 2782 void test_visitSwitchDefault_noLabels() { |
| 2252 assertSource("default: {}", ASTFactory.switchDefault2([ASTFactory.block([])]
)); | 2783 assertSource("default: {}", ASTFactory.switchDefault2([ASTFactory.block([])]
)); |
| 2253 } | 2784 } |
| 2785 |
| 2254 void test_visitSwitchDefault_singleLabel() { | 2786 void test_visitSwitchDefault_singleLabel() { |
| 2255 assertSource("l1: default: {}", ASTFactory.switchDefault(ASTFactory.list([AS
TFactory.label2("l1")]), [ASTFactory.block([])])); | 2787 assertSource("l1: default: {}", ASTFactory.switchDefault(ASTFactory.list([AS
TFactory.label2("l1")]), [ASTFactory.block([])])); |
| 2256 } | 2788 } |
| 2789 |
| 2257 void test_visitSwitchStatement() { | 2790 void test_visitSwitchStatement() { |
| 2258 assertSource("switch (a) {case 'b': {} default: {}}", ASTFactory.switchState
ment(ASTFactory.identifier3("a"), [ | 2791 assertSource("switch (a) {case 'b': {} default: {}}", ASTFactory.switchState
ment(ASTFactory.identifier3("a"), [ |
| 2259 ASTFactory.switchCase(ASTFactory.string2("b"), [ASTFactory.block([])]), | 2792 ASTFactory.switchCase(ASTFactory.string2("b"), [ASTFactory.block([])]), |
| 2260 ASTFactory.switchDefault2([ASTFactory.block([])])])); | 2793 ASTFactory.switchDefault2([ASTFactory.block([])])])); |
| 2261 } | 2794 } |
| 2795 |
| 2262 void test_visitSymbolLiteral_multiple() { | 2796 void test_visitSymbolLiteral_multiple() { |
| 2263 assertSource("#a.b.c", ASTFactory.symbolLiteral(["a", "b", "c"])); | 2797 assertSource("#a.b.c", ASTFactory.symbolLiteral(["a", "b", "c"])); |
| 2264 } | 2798 } |
| 2799 |
| 2265 void test_visitSymbolLiteral_single() { | 2800 void test_visitSymbolLiteral_single() { |
| 2266 assertSource("#a", ASTFactory.symbolLiteral(["a"])); | 2801 assertSource("#a", ASTFactory.symbolLiteral(["a"])); |
| 2267 } | 2802 } |
| 2803 |
| 2268 void test_visitThisExpression() { | 2804 void test_visitThisExpression() { |
| 2269 assertSource("this", ASTFactory.thisExpression()); | 2805 assertSource("this", ASTFactory.thisExpression()); |
| 2270 } | 2806 } |
| 2807 |
| 2271 void test_visitThrowStatement() { | 2808 void test_visitThrowStatement() { |
| 2272 assertSource("throw e", ASTFactory.throwExpression2(ASTFactory.identifier3("
e"))); | 2809 assertSource("throw e", ASTFactory.throwExpression2(ASTFactory.identifier3("
e"))); |
| 2273 } | 2810 } |
| 2811 |
| 2274 void test_visitTopLevelVariableDeclaration_multiple() { | 2812 void test_visitTopLevelVariableDeclaration_multiple() { |
| 2275 assertSource("var a;", ASTFactory.topLevelVariableDeclaration2(Keyword.VAR,
[ASTFactory.variableDeclaration("a")])); | 2813 assertSource("var a;", ASTFactory.topLevelVariableDeclaration2(Keyword.VAR,
[ASTFactory.variableDeclaration("a")])); |
| 2276 } | 2814 } |
| 2815 |
| 2277 void test_visitTopLevelVariableDeclaration_single() { | 2816 void test_visitTopLevelVariableDeclaration_single() { |
| 2278 assertSource("var a, b;", ASTFactory.topLevelVariableDeclaration2(Keyword.VA
R, [ | 2817 assertSource("var a, b;", ASTFactory.topLevelVariableDeclaration2(Keyword.VA
R, [ |
| 2279 ASTFactory.variableDeclaration("a"), | 2818 ASTFactory.variableDeclaration("a"), |
| 2280 ASTFactory.variableDeclaration("b")])); | 2819 ASTFactory.variableDeclaration("b")])); |
| 2281 } | 2820 } |
| 2821 |
| 2282 void test_visitTryStatement_catch() { | 2822 void test_visitTryStatement_catch() { |
| 2283 assertSource("try {} on E {}", ASTFactory.tryStatement2(ASTFactory.block([])
, [ASTFactory.catchClause3(ASTFactory.typeName4("E", []), [])])); | 2823 assertSource("try {} on E {}", ASTFactory.tryStatement2(ASTFactory.block([])
, [ASTFactory.catchClause3(ASTFactory.typeName4("E", []), [])])); |
| 2284 } | 2824 } |
| 2825 |
| 2285 void test_visitTryStatement_catches() { | 2826 void test_visitTryStatement_catches() { |
| 2286 assertSource("try {} on E {} on F {}", ASTFactory.tryStatement2(ASTFactory.b
lock([]), [ | 2827 assertSource("try {} on E {} on F {}", ASTFactory.tryStatement2(ASTFactory.b
lock([]), [ |
| 2287 ASTFactory.catchClause3(ASTFactory.typeName4("E", []), []), | 2828 ASTFactory.catchClause3(ASTFactory.typeName4("E", []), []), |
| 2288 ASTFactory.catchClause3(ASTFactory.typeName4("F", []), [])])); | 2829 ASTFactory.catchClause3(ASTFactory.typeName4("F", []), [])])); |
| 2289 } | 2830 } |
| 2831 |
| 2290 void test_visitTryStatement_catchFinally() { | 2832 void test_visitTryStatement_catchFinally() { |
| 2291 assertSource("try {} on E {} finally {}", ASTFactory.tryStatement3(ASTFactor
y.block([]), ASTFactory.list([ASTFactory.catchClause3(ASTFactory.typeName4("E",
[]), [])]), ASTFactory.block([]))); | 2833 assertSource("try {} on E {} finally {}", ASTFactory.tryStatement3(ASTFactor
y.block([]), ASTFactory.list([ASTFactory.catchClause3(ASTFactory.typeName4("E",
[]), [])]), ASTFactory.block([]))); |
| 2292 } | 2834 } |
| 2835 |
| 2293 void test_visitTryStatement_finally() { | 2836 void test_visitTryStatement_finally() { |
| 2294 assertSource("try {} finally {}", ASTFactory.tryStatement(ASTFactory.block([
]), ASTFactory.block([]))); | 2837 assertSource("try {} finally {}", ASTFactory.tryStatement(ASTFactory.block([
]), ASTFactory.block([]))); |
| 2295 } | 2838 } |
| 2839 |
| 2296 void test_visitTypeAlias_generic() { | 2840 void test_visitTypeAlias_generic() { |
| 2297 assertSource("typedef A F<B>();", ASTFactory.typeAlias(ASTFactory.typeName4(
"A", []), "F", ASTFactory.typeParameterList(["B"]), ASTFactory.formalParameterLi
st([]))); | 2841 assertSource("typedef A F<B>();", ASTFactory.typeAlias(ASTFactory.typeName4(
"A", []), "F", ASTFactory.typeParameterList(["B"]), ASTFactory.formalParameterLi
st([]))); |
| 2298 } | 2842 } |
| 2843 |
| 2299 void test_visitTypeAlias_nonGeneric() { | 2844 void test_visitTypeAlias_nonGeneric() { |
| 2300 assertSource("typedef A F();", ASTFactory.typeAlias(ASTFactory.typeName4("A"
, []), "F", null, ASTFactory.formalParameterList([]))); | 2845 assertSource("typedef A F();", ASTFactory.typeAlias(ASTFactory.typeName4("A"
, []), "F", null, ASTFactory.formalParameterList([]))); |
| 2301 } | 2846 } |
| 2847 |
| 2302 void test_visitTypeArgumentList_multiple() { | 2848 void test_visitTypeArgumentList_multiple() { |
| 2303 assertSource("<E, F>", ASTFactory.typeArgumentList([ | 2849 assertSource("<E, F>", ASTFactory.typeArgumentList([ |
| 2304 ASTFactory.typeName4("E", []), | 2850 ASTFactory.typeName4("E", []), |
| 2305 ASTFactory.typeName4("F", [])])); | 2851 ASTFactory.typeName4("F", [])])); |
| 2306 } | 2852 } |
| 2853 |
| 2307 void test_visitTypeArgumentList_single() { | 2854 void test_visitTypeArgumentList_single() { |
| 2308 assertSource("<E>", ASTFactory.typeArgumentList([ASTFactory.typeName4("E", [
])])); | 2855 assertSource("<E>", ASTFactory.typeArgumentList([ASTFactory.typeName4("E", [
])])); |
| 2309 } | 2856 } |
| 2857 |
| 2310 void test_visitTypeName_multipleArgs() { | 2858 void test_visitTypeName_multipleArgs() { |
| 2311 assertSource("C<D, E>", ASTFactory.typeName4("C", [ | 2859 assertSource("C<D, E>", ASTFactory.typeName4("C", [ |
| 2312 ASTFactory.typeName4("D", []), | 2860 ASTFactory.typeName4("D", []), |
| 2313 ASTFactory.typeName4("E", [])])); | 2861 ASTFactory.typeName4("E", [])])); |
| 2314 } | 2862 } |
| 2863 |
| 2315 void test_visitTypeName_nestedArg() { | 2864 void test_visitTypeName_nestedArg() { |
| 2316 assertSource("C<D<E>>", ASTFactory.typeName4("C", [ASTFactory.typeName4("D",
[ASTFactory.typeName4("E", [])])])); | 2865 assertSource("C<D<E>>", ASTFactory.typeName4("C", [ASTFactory.typeName4("D",
[ASTFactory.typeName4("E", [])])])); |
| 2317 } | 2866 } |
| 2867 |
| 2318 void test_visitTypeName_noArgs() { | 2868 void test_visitTypeName_noArgs() { |
| 2319 assertSource("C", ASTFactory.typeName4("C", [])); | 2869 assertSource("C", ASTFactory.typeName4("C", [])); |
| 2320 } | 2870 } |
| 2871 |
| 2321 void test_visitTypeName_singleArg() { | 2872 void test_visitTypeName_singleArg() { |
| 2322 assertSource("C<D>", ASTFactory.typeName4("C", [ASTFactory.typeName4("D", []
)])); | 2873 assertSource("C<D>", ASTFactory.typeName4("C", [ASTFactory.typeName4("D", []
)])); |
| 2323 } | 2874 } |
| 2875 |
| 2324 void test_visitTypeParameter_withExtends() { | 2876 void test_visitTypeParameter_withExtends() { |
| 2325 assertSource("E extends C", ASTFactory.typeParameter2("E", ASTFactory.typeNa
me4("C", []))); | 2877 assertSource("E extends C", ASTFactory.typeParameter2("E", ASTFactory.typeNa
me4("C", []))); |
| 2326 } | 2878 } |
| 2879 |
| 2327 void test_visitTypeParameter_withoutExtends() { | 2880 void test_visitTypeParameter_withoutExtends() { |
| 2328 assertSource("E", ASTFactory.typeParameter("E")); | 2881 assertSource("E", ASTFactory.typeParameter("E")); |
| 2329 } | 2882 } |
| 2883 |
| 2330 void test_visitTypeParameterList_multiple() { | 2884 void test_visitTypeParameterList_multiple() { |
| 2331 assertSource("<E, F>", ASTFactory.typeParameterList(["E", "F"])); | 2885 assertSource("<E, F>", ASTFactory.typeParameterList(["E", "F"])); |
| 2332 } | 2886 } |
| 2887 |
| 2333 void test_visitTypeParameterList_single() { | 2888 void test_visitTypeParameterList_single() { |
| 2334 assertSource("<E>", ASTFactory.typeParameterList(["E"])); | 2889 assertSource("<E>", ASTFactory.typeParameterList(["E"])); |
| 2335 } | 2890 } |
| 2891 |
| 2336 void test_visitVariableDeclaration_initialized() { | 2892 void test_visitVariableDeclaration_initialized() { |
| 2337 assertSource("a = b", ASTFactory.variableDeclaration2("a", ASTFactory.identi
fier3("b"))); | 2893 assertSource("a = b", ASTFactory.variableDeclaration2("a", ASTFactory.identi
fier3("b"))); |
| 2338 } | 2894 } |
| 2895 |
| 2339 void test_visitVariableDeclaration_uninitialized() { | 2896 void test_visitVariableDeclaration_uninitialized() { |
| 2340 assertSource("a", ASTFactory.variableDeclaration("a")); | 2897 assertSource("a", ASTFactory.variableDeclaration("a")); |
| 2341 } | 2898 } |
| 2899 |
| 2342 void test_visitVariableDeclarationList_const_type() { | 2900 void test_visitVariableDeclarationList_const_type() { |
| 2343 assertSource("const C a, b", ASTFactory.variableDeclarationList(Keyword.CONS
T, ASTFactory.typeName4("C", []), [ | 2901 assertSource("const C a, b", ASTFactory.variableDeclarationList(Keyword.CONS
T, ASTFactory.typeName4("C", []), [ |
| 2344 ASTFactory.variableDeclaration("a"), | 2902 ASTFactory.variableDeclaration("a"), |
| 2345 ASTFactory.variableDeclaration("b")])); | 2903 ASTFactory.variableDeclaration("b")])); |
| 2346 } | 2904 } |
| 2905 |
| 2347 void test_visitVariableDeclarationList_final_noType() { | 2906 void test_visitVariableDeclarationList_final_noType() { |
| 2348 assertSource("final a, b", ASTFactory.variableDeclarationList2(Keyword.FINAL
, [ | 2907 assertSource("final a, b", ASTFactory.variableDeclarationList2(Keyword.FINAL
, [ |
| 2349 ASTFactory.variableDeclaration("a"), | 2908 ASTFactory.variableDeclaration("a"), |
| 2350 ASTFactory.variableDeclaration("b")])); | 2909 ASTFactory.variableDeclaration("b")])); |
| 2351 } | 2910 } |
| 2911 |
| 2352 void test_visitVariableDeclarationList_type() { | 2912 void test_visitVariableDeclarationList_type() { |
| 2353 assertSource("C a, b", ASTFactory.variableDeclarationList(null, ASTFactory.t
ypeName4("C", []), [ | 2913 assertSource("C a, b", ASTFactory.variableDeclarationList(null, ASTFactory.t
ypeName4("C", []), [ |
| 2354 ASTFactory.variableDeclaration("a"), | 2914 ASTFactory.variableDeclaration("a"), |
| 2355 ASTFactory.variableDeclaration("b")])); | 2915 ASTFactory.variableDeclaration("b")])); |
| 2356 } | 2916 } |
| 2917 |
| 2357 void test_visitVariableDeclarationList_var() { | 2918 void test_visitVariableDeclarationList_var() { |
| 2358 assertSource("var a, b", ASTFactory.variableDeclarationList2(Keyword.VAR, [ | 2919 assertSource("var a, b", ASTFactory.variableDeclarationList2(Keyword.VAR, [ |
| 2359 ASTFactory.variableDeclaration("a"), | 2920 ASTFactory.variableDeclaration("a"), |
| 2360 ASTFactory.variableDeclaration("b")])); | 2921 ASTFactory.variableDeclaration("b")])); |
| 2361 } | 2922 } |
| 2923 |
| 2362 void test_visitVariableDeclarationStatement() { | 2924 void test_visitVariableDeclarationStatement() { |
| 2363 assertSource("C c;", ASTFactory.variableDeclarationStatement(null, ASTFactor
y.typeName4("C", []), [ASTFactory.variableDeclaration("c")])); | 2925 assertSource("C c;", ASTFactory.variableDeclarationStatement(null, ASTFactor
y.typeName4("C", []), [ASTFactory.variableDeclaration("c")])); |
| 2364 } | 2926 } |
| 2927 |
| 2365 void test_visitWhileStatement() { | 2928 void test_visitWhileStatement() { |
| 2366 assertSource("while (c) {}", ASTFactory.whileStatement(ASTFactory.identifier
3("c"), ASTFactory.block([]))); | 2929 assertSource("while (c) {}", ASTFactory.whileStatement(ASTFactory.identifier
3("c"), ASTFactory.block([]))); |
| 2367 } | 2930 } |
| 2931 |
| 2368 void test_visitWithClause_multiple() { | 2932 void test_visitWithClause_multiple() { |
| 2369 assertSource("with A, B, C", ASTFactory.withClause([ | 2933 assertSource("with A, B, C", ASTFactory.withClause([ |
| 2370 ASTFactory.typeName4("A", []), | 2934 ASTFactory.typeName4("A", []), |
| 2371 ASTFactory.typeName4("B", []), | 2935 ASTFactory.typeName4("B", []), |
| 2372 ASTFactory.typeName4("C", [])])); | 2936 ASTFactory.typeName4("C", [])])); |
| 2373 } | 2937 } |
| 2938 |
| 2374 void test_visitWithClause_single() { | 2939 void test_visitWithClause_single() { |
| 2375 assertSource("with A", ASTFactory.withClause([ASTFactory.typeName4("A", [])]
)); | 2940 assertSource("with A", ASTFactory.withClause([ASTFactory.typeName4("A", [])]
)); |
| 2376 } | 2941 } |
| 2377 | 2942 |
| 2378 /** | 2943 /** |
| 2379 * Assert that a `ToSourceVisitor` will produce the expected source when visit
ing the given | 2944 * Assert that a `ToSourceVisitor` will produce the expected source when visit
ing the given |
| 2380 * node. | 2945 * node. |
| 2381 * | 2946 * |
| 2382 * @param expectedSource the source string that the visitor is expected to pro
duce | 2947 * @param expectedSource the source string that the visitor is expected to pro
duce |
| 2383 * @param node the AST node being visited to produce the actual source | 2948 * @param node the AST node being visited to produce the actual source |
| 2384 * @throws AFE if the visitor does not produce the expected source for the giv
en node | 2949 * @throws AFE if the visitor does not produce the expected source for the giv
en node |
| 2385 */ | 2950 */ |
| 2386 void assertSource(String expectedSource, ASTNode node) { | 2951 void assertSource(String expectedSource, ASTNode node) { |
| 2387 PrintStringWriter writer = new PrintStringWriter(); | 2952 PrintStringWriter writer = new PrintStringWriter(); |
| 2388 node.accept(new ToSourceVisitor(writer)); | 2953 node.accept(new ToSourceVisitor(writer)); |
| 2389 JUnitTestCase.assertEquals(expectedSource, writer.toString()); | 2954 JUnitTestCase.assertEquals(expectedSource, writer.toString()); |
| 2390 } | 2955 } |
| 2956 |
| 2391 static dartSuite() { | 2957 static dartSuite() { |
| 2392 _ut.group('ToSourceVisitorTest', () { | 2958 _ut.group('ToSourceVisitorTest', () { |
| 2393 _ut.test('test_visitAdjacentStrings', () { | 2959 _ut.test('test_visitAdjacentStrings', () { |
| 2394 final __test = new ToSourceVisitorTest(); | 2960 final __test = new ToSourceVisitorTest(); |
| 2395 runJUnitTest(__test, __test.test_visitAdjacentStrings); | 2961 runJUnitTest(__test, __test.test_visitAdjacentStrings); |
| 2396 }); | 2962 }); |
| 2397 _ut.test('test_visitAnnotation_constant', () { | 2963 _ut.test('test_visitAnnotation_constant', () { |
| 2398 final __test = new ToSourceVisitorTest(); | 2964 final __test = new ToSourceVisitorTest(); |
| 2399 runJUnitTest(__test, __test.test_visitAnnotation_constant); | 2965 runJUnitTest(__test, __test.test_visitAnnotation_constant); |
| 2400 }); | 2966 }); |
| (...skipping 973 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3374 final __test = new ToSourceVisitorTest(); | 3940 final __test = new ToSourceVisitorTest(); |
| 3375 runJUnitTest(__test, __test.test_visitWithClause_multiple); | 3941 runJUnitTest(__test, __test.test_visitWithClause_multiple); |
| 3376 }); | 3942 }); |
| 3377 _ut.test('test_visitWithClause_single', () { | 3943 _ut.test('test_visitWithClause_single', () { |
| 3378 final __test = new ToSourceVisitorTest(); | 3944 final __test = new ToSourceVisitorTest(); |
| 3379 runJUnitTest(__test, __test.test_visitWithClause_single); | 3945 runJUnitTest(__test, __test.test_visitWithClause_single); |
| 3380 }); | 3946 }); |
| 3381 }); | 3947 }); |
| 3382 } | 3948 } |
| 3383 } | 3949 } |
| 3950 |
| 3384 main() { | 3951 main() { |
| 3385 ConstantEvaluatorTest.dartSuite(); | 3952 ConstantEvaluatorTest.dartSuite(); |
| 3386 NodeLocatorTest.dartSuite(); | 3953 NodeLocatorTest.dartSuite(); |
| 3387 ToSourceVisitorTest.dartSuite(); | 3954 ToSourceVisitorTest.dartSuite(); |
| 3388 BreadthFirstVisitorTest.dartSuite(); | 3955 BreadthFirstVisitorTest.dartSuite(); |
| 3389 IndexExpressionTest.dartSuite(); | 3956 IndexExpressionTest.dartSuite(); |
| 3390 NodeListTest.dartSuite(); | 3957 NodeListTest.dartSuite(); |
| 3391 SimpleIdentifierTest.dartSuite(); | 3958 SimpleIdentifierTest.dartSuite(); |
| 3392 VariableDeclarationTest.dartSuite(); | 3959 VariableDeclarationTest.dartSuite(); |
| 3393 } | 3960 } |
| OLD | NEW |