| OLD | NEW |
| 1 // Copyright (c) 2014, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2014, the Dart project authors. Please see the AUTHORS file |
| 2 // for details. All rights reserved. Use of this source code is governed by a | 2 // for details. All rights reserved. Use of this source code is governed by a |
| 3 // BSD-style license that can be found in the LICENSE file. | 3 // BSD-style license that can be found in the LICENSE file. |
| 4 | 4 |
| 5 library engine.utilities_test; | 5 library analyzer.test.generated.utilities_test; |
| 6 | 6 |
| 7 import 'dart:collection'; | 7 import 'dart:collection'; |
| 8 | 8 |
| 9 import 'package:analyzer/src/generated/ast.dart'; | 9 import 'package:analyzer/dart/ast/ast.dart'; |
| 10 import 'package:analyzer/src/generated/java_core.dart'; | 10 import 'package:analyzer/dart/ast/token.dart'; |
| 11 import 'package:analyzer/src/dart/ast/token.dart'; |
| 12 import 'package:analyzer/src/dart/ast/utilities.dart'; |
| 13 import 'package:analyzer/src/dart/scanner/reader.dart'; |
| 14 import 'package:analyzer/src/dart/scanner/scanner.dart'; |
| 11 import 'package:analyzer/src/generated/java_engine.dart'; | 15 import 'package:analyzer/src/generated/java_engine.dart'; |
| 12 import 'package:analyzer/src/generated/scanner.dart'; | 16 import 'package:analyzer/src/generated/parser.dart'; |
| 13 import 'package:analyzer/src/generated/source.dart'; | 17 import 'package:analyzer/src/generated/source.dart'; |
| 14 import 'package:analyzer/src/generated/testing/ast_factory.dart'; | 18 import 'package:analyzer/src/generated/testing/ast_factory.dart'; |
| 15 import 'package:analyzer/src/generated/testing/token_factory.dart'; | 19 import 'package:analyzer/src/generated/testing/token_factory.dart'; |
| 16 import 'package:analyzer/src/generated/utilities_collection.dart'; | 20 import 'package:analyzer/src/generated/utilities_collection.dart'; |
| 21 import 'package:test_reflective_loader/test_reflective_loader.dart'; |
| 17 import 'package:unittest/unittest.dart'; | 22 import 'package:unittest/unittest.dart'; |
| 18 | 23 |
| 19 import '../reflective_tests.dart'; | |
| 20 import '../utils.dart'; | 24 import '../utils.dart'; |
| 21 import 'test_support.dart'; | 25 import 'test_support.dart'; |
| 22 | 26 |
| 23 main() { | 27 main() { |
| 24 initializeTestEnvironment(); | 28 initializeTestEnvironment(); |
| 25 runReflectiveTests(AstClonerTest); | 29 defineReflectiveTests(AstClonerTest); |
| 26 runReflectiveTests(NodeReplacerTest); | 30 defineReflectiveTests(NodeReplacerTest); |
| 27 runReflectiveTests(LineInfoTest); | 31 defineReflectiveTests(LineInfoTest); |
| 28 runReflectiveTests(SourceRangeTest); | 32 defineReflectiveTests(SourceRangeTest); |
| 29 runReflectiveTests(BooleanArrayTest); | 33 defineReflectiveTests(BooleanArrayTest); |
| 30 runReflectiveTests(DirectedGraphTest); | 34 defineReflectiveTests(DirectedGraphTest); |
| 31 runReflectiveTests(ListUtilitiesTest); | 35 defineReflectiveTests(MultipleMapIteratorTest); |
| 32 runReflectiveTests(MultipleMapIteratorTest); | 36 defineReflectiveTests(SingleMapIteratorTest); |
| 33 runReflectiveTests(SingleMapIteratorTest); | 37 defineReflectiveTests(TokenMapTest); |
| 34 runReflectiveTests(TokenMapTest); | 38 defineReflectiveTests(StringUtilitiesTest); |
| 35 runReflectiveTests(StringUtilitiesTest); | |
| 36 } | 39 } |
| 37 | 40 |
| 38 class AstCloneComparator extends AstComparator { | 41 class AstCloneComparator extends AstComparator { |
| 39 final bool expectTokensCopied; | 42 final bool expectTokensCopied; |
| 40 | 43 |
| 41 AstCloneComparator(this.expectTokensCopied); | 44 AstCloneComparator(this.expectTokensCopied); |
| 42 | 45 |
| 43 @override | 46 @override |
| 44 bool isEqualNodes(AstNode first, AstNode second) { | 47 bool isEqualNodes(AstNode first, AstNode second) { |
| 45 if (first != null && identical(first, second)) { | 48 if (first != null && identical(first, second)) { |
| 46 fail('Failed to copy node: $first (${first.offset})'); | 49 fail('Failed to copy node: $first (${first.offset})'); |
| 47 return false; | 50 return false; |
| 48 } | 51 } |
| 49 return super.isEqualNodes(first, second); | 52 return super.isEqualNodes(first, second); |
| 50 } | 53 } |
| 51 | 54 |
| 52 @override | 55 @override |
| 53 bool isEqualTokens(Token first, Token second) { | 56 bool isEqualTokens(Token first, Token second) { |
| 54 if (expectTokensCopied && first != null && identical(first, second)) { | 57 if (expectTokensCopied && first != null && identical(first, second)) { |
| 55 fail('Failed to copy token: ${first.lexeme} (${first.offset})'); | 58 fail('Failed to copy token: ${first.lexeme} (${first.offset})'); |
| 56 return false; | 59 return false; |
| 57 } | 60 } |
| 61 if (first is TokenWithComment) { |
| 62 CommentToken comment = first.precedingComments; |
| 63 if (comment.parent != first) { |
| 64 fail('Failed to link the comment "$comment" with the token "$first".'); |
| 65 } |
| 66 } |
| 58 return super.isEqualTokens(first, second); | 67 return super.isEqualTokens(first, second); |
| 59 } | 68 } |
| 60 } | 69 } |
| 61 | 70 |
| 62 @reflectiveTest | 71 @reflectiveTest |
| 63 class AstClonerTest extends EngineTestCase { | 72 class AstClonerTest extends EngineTestCase { |
| 64 void test_visitAdjacentStrings() { | 73 void test_visitAdjacentStrings() { |
| 65 _assertClone(AstFactory | 74 _assertCloneExpression("'a' 'b'"); |
| 66 .adjacentStrings([AstFactory.string2("a"), AstFactory.string2("b")])); | |
| 67 } | 75 } |
| 68 | 76 |
| 69 void test_visitAnnotation_constant() { | 77 void test_visitAnnotation_constant() { |
| 70 _assertClone(AstFactory.annotation(AstFactory.identifier3("A"))); | 78 _assertCloneUnitMember('@A main() {}'); |
| 71 } | 79 } |
| 72 | 80 |
| 73 void test_visitAnnotation_constructor() { | 81 void test_visitAnnotation_constructor() { |
| 74 _assertClone(AstFactory.annotation2(AstFactory.identifier3("A"), | 82 _assertCloneUnitMember('@A.c() main() {}'); |
| 75 AstFactory.identifier3("c"), AstFactory.argumentList())); | 83 } |
| 84 |
| 85 void test_visitAnnotation_withComment() { |
| 86 CompilationUnitMember clazz = |
| 87 _parseUnitMember('/** comment */ @deprecated class A {}'); |
| 88 Annotation annotation = clazz.metadata.single; |
| 89 _assertClone(annotation); |
| 76 } | 90 } |
| 77 | 91 |
| 78 void test_visitArgumentList() { | 92 void test_visitArgumentList() { |
| 79 _assertClone(AstFactory.argumentList( | 93 _assertCloneExpression('m(a, b)'); |
| 80 [AstFactory.identifier3("a"), AstFactory.identifier3("b")])); | |
| 81 } | 94 } |
| 82 | 95 |
| 83 void test_visitAsExpression() { | 96 void test_visitAsExpression() { |
| 84 _assertClone(AstFactory.asExpression( | 97 _assertCloneExpression('e as T'); |
| 85 AstFactory.identifier3("e"), AstFactory.typeName4("T"))); | |
| 86 } | 98 } |
| 87 | 99 |
| 88 void test_visitAssertStatement() { | 100 void test_visitAssertStatement() { |
| 89 _assertClone(AstFactory.assertStatement(AstFactory.identifier3("a"))); | 101 _assertCloneStatement('assert(a);'); |
| 90 } | 102 } |
| 91 | 103 |
| 92 void test_visitAssignmentExpression() { | 104 void test_visitAssignmentExpression() { |
| 93 _assertClone(AstFactory.assignmentExpression(AstFactory.identifier3("a"), | 105 _assertCloneStatement('a = b;'); |
| 94 TokenType.EQ, AstFactory.identifier3("b"))); | |
| 95 } | 106 } |
| 96 | 107 |
| 97 void test_visitAwaitExpression() { | 108 void test_visitAwaitExpression() { |
| 98 _assertClone(AstFactory.awaitExpression(AstFactory.identifier3("a"))); | 109 _assertCloneStatement('await a;'); |
| 99 } | 110 } |
| 100 | 111 |
| 101 void test_visitBinaryExpression() { | 112 void test_visitBinaryExpression() { |
| 102 _assertClone(AstFactory.binaryExpression(AstFactory.identifier3("a"), | 113 _assertCloneExpression('a + b'); |
| 103 TokenType.PLUS, AstFactory.identifier3("b"))); | |
| 104 } | 114 } |
| 105 | 115 |
| 106 void test_visitBlock_empty() { | 116 void test_visitBlock_empty() { |
| 107 _assertClone(AstFactory.block()); | 117 _assertCloneStatement('{}'); |
| 108 } | 118 } |
| 109 | 119 |
| 110 void test_visitBlock_nonEmpty() { | 120 void test_visitBlock_nonEmpty() { |
| 111 _assertClone(AstFactory | 121 _assertCloneStatement('{ print(1); print(2); }'); |
| 112 .block([AstFactory.breakStatement(), AstFactory.breakStatement()])); | |
| 113 } | 122 } |
| 114 | 123 |
| 115 void test_visitBlockFunctionBody() { | 124 void test_visitBlockFunctionBody() { |
| 116 _assertClone(AstFactory.blockFunctionBody2()); | 125 _assertCloneUnitMember('main() {}'); |
| 117 } | 126 } |
| 118 | 127 |
| 119 void test_visitBooleanLiteral_false() { | 128 void test_visitBooleanLiteral_false() { |
| 120 _assertClone(AstFactory.booleanLiteral(false)); | 129 _assertCloneExpression('false'); |
| 121 } | 130 } |
| 122 | 131 |
| 123 void test_visitBooleanLiteral_true() { | 132 void test_visitBooleanLiteral_true() { |
| 124 _assertClone(AstFactory.booleanLiteral(true)); | 133 _assertCloneExpression('true'); |
| 125 } | 134 } |
| 126 | 135 |
| 127 void test_visitBreakStatement_label() { | 136 void test_visitBreakStatement_label() { |
| 128 _assertClone(AstFactory.breakStatement2("l")); | 137 _assertCloneStatement('l: while(true) { break l; }'); |
| 129 } | 138 } |
| 130 | 139 |
| 131 void test_visitBreakStatement_noLabel() { | 140 void test_visitBreakStatement_noLabel() { |
| 132 _assertClone(AstFactory.breakStatement()); | 141 _assertCloneStatement('while(true) { break; }'); |
| 133 } | 142 } |
| 134 | 143 |
| 135 void test_visitCascadeExpression_field() { | 144 void test_visitCascadeExpression_field() { |
| 136 _assertClone(AstFactory.cascadeExpression(AstFactory.identifier3("a"), [ | 145 _assertCloneExpression('a..b..c'); |
| 137 AstFactory.cascadedPropertyAccess("b"), | |
| 138 AstFactory.cascadedPropertyAccess("c") | |
| 139 ])); | |
| 140 } | 146 } |
| 141 | 147 |
| 142 void test_visitCascadeExpression_index() { | 148 void test_visitCascadeExpression_index() { |
| 143 _assertClone(AstFactory.cascadeExpression(AstFactory.identifier3("a"), [ | 149 _assertCloneExpression('a..[0]..[1]'); |
| 144 AstFactory.cascadedIndexExpression(AstFactory.integer(0)), | |
| 145 AstFactory.cascadedIndexExpression(AstFactory.integer(1)) | |
| 146 ])); | |
| 147 } | 150 } |
| 148 | 151 |
| 149 void test_visitCascadeExpression_method() { | 152 void test_visitCascadeExpression_method() { |
| 150 _assertClone(AstFactory.cascadeExpression(AstFactory.identifier3("a"), [ | 153 _assertCloneExpression('a..b()..c()'); |
| 151 AstFactory.cascadedMethodInvocation("b"), | |
| 152 AstFactory.cascadedMethodInvocation("c") | |
| 153 ])); | |
| 154 } | 154 } |
| 155 | 155 |
| 156 void test_visitCatchClause_catch_noStack() { | 156 void test_visitCatchClause_catch_noStack() { |
| 157 _assertClone(AstFactory.catchClause("e")); | 157 _assertCloneStatement('try {} catch (e) {}'); |
| 158 } | 158 } |
| 159 | 159 |
| 160 void test_visitCatchClause_catch_stack() { | 160 void test_visitCatchClause_catch_stack() { |
| 161 _assertClone(AstFactory.catchClause2("e", "s")); | 161 _assertCloneStatement('try {} catch (e, s) {}'); |
| 162 } | 162 } |
| 163 | 163 |
| 164 void test_visitCatchClause_on() { | 164 void test_visitCatchClause_on() { |
| 165 _assertClone(AstFactory.catchClause3(AstFactory.typeName4("E"))); | 165 _assertCloneStatement('try {} on E {}'); |
| 166 } | 166 } |
| 167 | 167 |
| 168 void test_visitCatchClause_on_catch() { | 168 void test_visitCatchClause_on_catch() { |
| 169 _assertClone(AstFactory.catchClause4(AstFactory.typeName4("E"), "e")); | 169 _assertCloneStatement('try {} on E catch (e) {}'); |
| 170 } | 170 } |
| 171 | 171 |
| 172 void test_visitClassDeclaration_abstract() { | 172 void test_visitClassDeclaration_abstract() { |
| 173 _assertClone(AstFactory.classDeclaration( | 173 _assertCloneUnitMember('abstract class C {}'); |
| 174 Keyword.ABSTRACT, "C", null, null, null, null)); | |
| 175 } | 174 } |
| 176 | 175 |
| 177 void test_visitClassDeclaration_empty() { | 176 void test_visitClassDeclaration_empty() { |
| 178 _assertClone( | 177 _assertCloneUnitMember('class C {}'); |
| 179 AstFactory.classDeclaration(null, "C", null, null, null, null)); | |
| 180 } | 178 } |
| 181 | 179 |
| 182 void test_visitClassDeclaration_extends() { | 180 void test_visitClassDeclaration_extends() { |
| 183 _assertClone(AstFactory.classDeclaration(null, "C", null, | 181 _assertCloneUnitMember('class C extends A {}'); |
| 184 AstFactory.extendsClause(AstFactory.typeName4("A")), null, null)); | |
| 185 } | 182 } |
| 186 | 183 |
| 187 void test_visitClassDeclaration_extends_implements() { | 184 void test_visitClassDeclaration_extends_implements() { |
| 188 _assertClone(AstFactory.classDeclaration( | 185 _assertCloneUnitMember('class C extends A implements B {}'); |
| 189 null, | |
| 190 "C", | |
| 191 null, | |
| 192 AstFactory.extendsClause(AstFactory.typeName4("A")), | |
| 193 null, | |
| 194 AstFactory.implementsClause([AstFactory.typeName4("B")]))); | |
| 195 } | 186 } |
| 196 | 187 |
| 197 void test_visitClassDeclaration_extends_with() { | 188 void test_visitClassDeclaration_extends_with() { |
| 198 _assertClone(AstFactory.classDeclaration( | 189 _assertCloneUnitMember('class C extends A with M {}'); |
| 199 null, | |
| 200 "C", | |
| 201 null, | |
| 202 AstFactory.extendsClause(AstFactory.typeName4("A")), | |
| 203 AstFactory.withClause([AstFactory.typeName4("M")]), | |
| 204 null)); | |
| 205 } | 190 } |
| 206 | 191 |
| 207 void test_visitClassDeclaration_extends_with_implements() { | 192 void test_visitClassDeclaration_extends_with_implements() { |
| 208 _assertClone(AstFactory.classDeclaration( | 193 _assertCloneUnitMember('class C extends A with M implements B {}'); |
| 209 null, | |
| 210 "C", | |
| 211 null, | |
| 212 AstFactory.extendsClause(AstFactory.typeName4("A")), | |
| 213 AstFactory.withClause([AstFactory.typeName4("M")]), | |
| 214 AstFactory.implementsClause([AstFactory.typeName4("B")]))); | |
| 215 } | 194 } |
| 216 | 195 |
| 217 void test_visitClassDeclaration_implements() { | 196 void test_visitClassDeclaration_implements() { |
| 218 _assertClone(AstFactory.classDeclaration(null, "C", null, null, null, | 197 _assertCloneUnitMember('class C implements B {}'); |
| 219 AstFactory.implementsClause([AstFactory.typeName4("B")]))); | |
| 220 } | 198 } |
| 221 | 199 |
| 222 void test_visitClassDeclaration_multipleMember() { | 200 void test_visitClassDeclaration_multipleMember() { |
| 223 _assertClone( | 201 _assertCloneUnitMember('class C { var a; var b; }'); |
| 224 AstFactory.classDeclaration(null, "C", null, null, null, null, [ | |
| 225 AstFactory.fieldDeclaration2( | |
| 226 false, Keyword.VAR, [AstFactory.variableDeclaration("a")]), | |
| 227 AstFactory.fieldDeclaration2( | |
| 228 false, Keyword.VAR, [AstFactory.variableDeclaration("b")]) | |
| 229 ])); | |
| 230 } | 202 } |
| 231 | 203 |
| 232 void test_visitClassDeclaration_parameters() { | 204 void test_visitClassDeclaration_parameters() { |
| 233 _assertClone(AstFactory.classDeclaration( | 205 _assertCloneUnitMember('class C<E> {}'); |
| 234 null, "C", AstFactory.typeParameterList(["E"]), null, null, null)); | |
| 235 } | 206 } |
| 236 | 207 |
| 237 void test_visitClassDeclaration_parameters_extends() { | 208 void test_visitClassDeclaration_parameters_extends() { |
| 238 _assertClone(AstFactory.classDeclaration( | 209 _assertCloneUnitMember('class C<E> extends A {}'); |
| 239 null, | |
| 240 "C", | |
| 241 AstFactory.typeParameterList(["E"]), | |
| 242 AstFactory.extendsClause(AstFactory.typeName4("A")), | |
| 243 null, | |
| 244 null)); | |
| 245 } | 210 } |
| 246 | 211 |
| 247 void test_visitClassDeclaration_parameters_extends_implements() { | 212 void test_visitClassDeclaration_parameters_extends_implements() { |
| 248 _assertClone(AstFactory.classDeclaration( | 213 _assertCloneUnitMember('class C<E> extends A implements B {}'); |
| 249 null, | |
| 250 "C", | |
| 251 AstFactory.typeParameterList(["E"]), | |
| 252 AstFactory.extendsClause(AstFactory.typeName4("A")), | |
| 253 null, | |
| 254 AstFactory.implementsClause([AstFactory.typeName4("B")]))); | |
| 255 } | 214 } |
| 256 | 215 |
| 257 void test_visitClassDeclaration_parameters_extends_with() { | 216 void test_visitClassDeclaration_parameters_extends_with() { |
| 258 _assertClone(AstFactory.classDeclaration( | 217 _assertCloneUnitMember('class C<E> extends A with M {}'); |
| 259 null, | |
| 260 "C", | |
| 261 AstFactory.typeParameterList(["E"]), | |
| 262 AstFactory.extendsClause(AstFactory.typeName4("A")), | |
| 263 AstFactory.withClause([AstFactory.typeName4("M")]), | |
| 264 null)); | |
| 265 } | 218 } |
| 266 | 219 |
| 267 void test_visitClassDeclaration_parameters_extends_with_implements() { | 220 void test_visitClassDeclaration_parameters_extends_with_implements() { |
| 268 _assertClone(AstFactory.classDeclaration( | 221 _assertCloneUnitMember('class C<E> extends A with M implements B {}'); |
| 269 null, | |
| 270 "C", | |
| 271 AstFactory.typeParameterList(["E"]), | |
| 272 AstFactory.extendsClause(AstFactory.typeName4("A")), | |
| 273 AstFactory.withClause([AstFactory.typeName4("M")]), | |
| 274 AstFactory.implementsClause([AstFactory.typeName4("B")]))); | |
| 275 } | 222 } |
| 276 | 223 |
| 277 void test_visitClassDeclaration_parameters_implements() { | 224 void test_visitClassDeclaration_parameters_implements() { |
| 278 _assertClone(AstFactory.classDeclaration( | 225 _assertCloneUnitMember('class C<E> implements B {}'); |
| 279 null, | |
| 280 "C", | |
| 281 AstFactory.typeParameterList(["E"]), | |
| 282 null, | |
| 283 null, | |
| 284 AstFactory.implementsClause([AstFactory.typeName4("B")]))); | |
| 285 } | 226 } |
| 286 | 227 |
| 287 void test_visitClassDeclaration_singleMember() { | 228 void test_visitClassDeclaration_singleMember() { |
| 288 _assertClone( | 229 _assertCloneUnitMember('class C { var a; }'); |
| 289 AstFactory.classDeclaration(null, "C", null, null, null, null, [ | |
| 290 AstFactory.fieldDeclaration2( | |
| 291 false, Keyword.VAR, [AstFactory.variableDeclaration("a")]) | |
| 292 ])); | |
| 293 } | 230 } |
| 294 | 231 |
| 295 void test_visitClassDeclaration_withMetadata() { | 232 void test_visitClassDeclaration_withMetadata() { |
| 296 ClassDeclaration declaration = | 233 _assertCloneUnitMember('@deprecated class C {}'); |
| 297 AstFactory.classDeclaration(null, "C", null, null, null, null); | |
| 298 declaration.metadata | |
| 299 .add(AstFactory.annotation(AstFactory.identifier3("deprecated"))); | |
| 300 _assertClone(declaration); | |
| 301 } | 234 } |
| 302 | 235 |
| 303 void test_visitClassTypeAlias_abstract() { | 236 void test_visitClassTypeAlias_abstract() { |
| 304 _assertClone(AstFactory.classTypeAlias( | 237 _assertCloneUnitMember('abstract class C = S with M1;'); |
| 305 "C", | |
| 306 null, | |
| 307 Keyword.ABSTRACT, | |
| 308 AstFactory.typeName4("S"), | |
| 309 AstFactory.withClause([AstFactory.typeName4("M1")]), | |
| 310 null)); | |
| 311 } | 238 } |
| 312 | 239 |
| 313 void test_visitClassTypeAlias_abstract_implements() { | 240 void test_visitClassTypeAlias_abstract_implements() { |
| 314 _assertClone(AstFactory.classTypeAlias( | 241 _assertCloneUnitMember('abstract class C = S with M1 implements I;'); |
| 315 "C", | |
| 316 null, | |
| 317 Keyword.ABSTRACT, | |
| 318 AstFactory.typeName4("S"), | |
| 319 AstFactory.withClause([AstFactory.typeName4("M1")]), | |
| 320 AstFactory.implementsClause([AstFactory.typeName4("I")]))); | |
| 321 } | 242 } |
| 322 | 243 |
| 323 void test_visitClassTypeAlias_generic() { | 244 void test_visitClassTypeAlias_generic() { |
| 324 _assertClone(AstFactory.classTypeAlias( | 245 _assertCloneUnitMember('class C<E> = S<E> with M1<E>;'); |
| 325 "C", | |
| 326 AstFactory.typeParameterList(["E"]), | |
| 327 null, | |
| 328 AstFactory.typeName4("S", [AstFactory.typeName4("E")]), | |
| 329 AstFactory.withClause([ | |
| 330 AstFactory.typeName4("M1", [AstFactory.typeName4("E")]) | |
| 331 ]), | |
| 332 null)); | |
| 333 } | 246 } |
| 334 | 247 |
| 335 void test_visitClassTypeAlias_implements() { | 248 void test_visitClassTypeAlias_implements() { |
| 336 _assertClone(AstFactory.classTypeAlias( | 249 _assertCloneUnitMember('class C = S with M1 implements I;'); |
| 337 "C", | |
| 338 null, | |
| 339 null, | |
| 340 AstFactory.typeName4("S"), | |
| 341 AstFactory.withClause([AstFactory.typeName4("M1")]), | |
| 342 AstFactory.implementsClause([AstFactory.typeName4("I")]))); | |
| 343 } | 250 } |
| 344 | 251 |
| 345 void test_visitClassTypeAlias_minimal() { | 252 void test_visitClassTypeAlias_minimal() { |
| 346 _assertClone(AstFactory.classTypeAlias( | 253 _assertCloneUnitMember('class C = S with M1;'); |
| 347 "C", | |
| 348 null, | |
| 349 null, | |
| 350 AstFactory.typeName4("S"), | |
| 351 AstFactory.withClause([AstFactory.typeName4("M1")]), | |
| 352 null)); | |
| 353 } | 254 } |
| 354 | 255 |
| 355 void test_visitClassTypeAlias_parameters_abstract() { | 256 void test_visitClassTypeAlias_parameters_abstract() { |
| 356 _assertClone(AstFactory.classTypeAlias( | 257 _assertCloneUnitMember('abstract class C = S<E> with M1;'); |
| 357 "C", | |
| 358 AstFactory.typeParameterList(["E"]), | |
| 359 Keyword.ABSTRACT, | |
| 360 AstFactory.typeName4("S"), | |
| 361 AstFactory.withClause([AstFactory.typeName4("M1")]), | |
| 362 null)); | |
| 363 } | 258 } |
| 364 | 259 |
| 365 void test_visitClassTypeAlias_parameters_abstract_implements() { | 260 void test_visitClassTypeAlias_parameters_abstract_implements() { |
| 366 _assertClone(AstFactory.classTypeAlias( | 261 _assertCloneUnitMember('abstract class C = S<E> with M1 implements I;'); |
| 367 "C", | |
| 368 AstFactory.typeParameterList(["E"]), | |
| 369 Keyword.ABSTRACT, | |
| 370 AstFactory.typeName4("S"), | |
| 371 AstFactory.withClause([AstFactory.typeName4("M1")]), | |
| 372 AstFactory.implementsClause([AstFactory.typeName4("I")]))); | |
| 373 } | 262 } |
| 374 | 263 |
| 375 void test_visitClassTypeAlias_parameters_implements() { | 264 void test_visitClassTypeAlias_parameters_implements() { |
| 376 _assertClone(AstFactory.classTypeAlias( | 265 _assertCloneUnitMember('class C = S<E> with M1 implements I;'); |
| 377 "C", | |
| 378 AstFactory.typeParameterList(["E"]), | |
| 379 null, | |
| 380 AstFactory.typeName4("S"), | |
| 381 AstFactory.withClause([AstFactory.typeName4("M1")]), | |
| 382 AstFactory.implementsClause([AstFactory.typeName4("I")]))); | |
| 383 } | 266 } |
| 384 | 267 |
| 385 void test_visitClassTypeAlias_withMetadata() { | 268 void test_visitClassTypeAlias_withMetadata() { |
| 386 ClassTypeAlias declaration = AstFactory.classTypeAlias( | 269 _assertCloneUnitMember('@deprecated class C = S with M;'); |
| 387 "C", | |
| 388 null, | |
| 389 null, | |
| 390 AstFactory.typeName4("S"), | |
| 391 AstFactory.withClause([AstFactory.typeName4("M1")]), | |
| 392 null); | |
| 393 declaration.metadata | |
| 394 .add(AstFactory.annotation(AstFactory.identifier3("deprecated"))); | |
| 395 _assertClone(declaration); | |
| 396 } | 270 } |
| 397 | 271 |
| 398 void test_visitComment() { | 272 void test_visitComment() { |
| 399 _assertClone(Comment.createBlockComment( | 273 _assertCloneUnitMember('main() { print(1); /* comment */ print(2); }'); |
| 400 <Token>[TokenFactory.tokenFromString("/* comment */")])); | 274 } |
| 275 |
| 276 void test_visitComment_beginToken() { |
| 277 _assertCloneUnitMember('/** comment */ main() {}'); |
| 401 } | 278 } |
| 402 | 279 |
| 403 void test_visitCommentReference() { | 280 void test_visitCommentReference() { |
| 404 _assertClone(new CommentReference(null, AstFactory.identifier3("a"))); | 281 _assertCloneUnitMember('/** ref [a]. */ main(a) {}'); |
| 405 } | 282 } |
| 406 | 283 |
| 407 void test_visitCompilationUnit_declaration() { | 284 void test_visitCompilationUnit_declaration() { |
| 408 _assertClone(AstFactory.compilationUnit2([ | 285 _assertCloneUnitMember('var a;'); |
| 409 AstFactory.topLevelVariableDeclaration2( | |
| 410 Keyword.VAR, [AstFactory.variableDeclaration("a")]) | |
| 411 ])); | |
| 412 } | 286 } |
| 413 | 287 |
| 414 void test_visitCompilationUnit_directive() { | 288 void test_visitCompilationUnit_directive() { |
| 415 _assertClone( | 289 _assertCloneUnit('library l;'); |
| 416 AstFactory.compilationUnit3([AstFactory.libraryDirective2("l")])); | |
| 417 } | 290 } |
| 418 | 291 |
| 419 void test_visitCompilationUnit_directive_declaration() { | 292 void test_visitCompilationUnit_directive_declaration() { |
| 420 _assertClone(AstFactory.compilationUnit4([ | 293 _assertCloneUnit('library l; var a;'); |
| 421 AstFactory.libraryDirective2("l") | 294 } |
| 422 ], [ | 295 |
| 423 AstFactory.topLevelVariableDeclaration2( | 296 void test_visitCompilationUnit_directive_withComment() { |
| 424 Keyword.VAR, [AstFactory.variableDeclaration("a")]) | 297 _assertCloneUnit(r''' |
| 425 ])); | 298 /// aaa |
| 299 /// bbb |
| 300 library l;'''); |
| 426 } | 301 } |
| 427 | 302 |
| 428 void test_visitCompilationUnit_empty() { | 303 void test_visitCompilationUnit_empty() { |
| 429 _assertClone(AstFactory.compilationUnit()); | 304 _assertCloneUnit(''); |
| 430 } | 305 } |
| 431 | 306 |
| 432 void test_visitCompilationUnit_script() { | 307 void test_visitCompilationUnit_script() { |
| 433 _assertClone(AstFactory.compilationUnit5("!#/bin/dartvm")); | 308 _assertCloneUnit('#!/bin/dartvm'); |
| 434 } | 309 } |
| 435 | 310 |
| 436 void test_visitCompilationUnit_script_declaration() { | 311 void test_visitCompilationUnit_script_declaration() { |
| 437 _assertClone(AstFactory.compilationUnit6("!#/bin/dartvm", [ | 312 _assertCloneUnit('#!/bin/dartvm \n var a;'); |
| 438 AstFactory.topLevelVariableDeclaration2( | |
| 439 Keyword.VAR, [AstFactory.variableDeclaration("a")]) | |
| 440 ])); | |
| 441 } | 313 } |
| 442 | 314 |
| 443 void test_visitCompilationUnit_script_directive() { | 315 void test_visitCompilationUnit_script_directive() { |
| 444 _assertClone(AstFactory.compilationUnit7( | 316 _assertCloneUnit('#!/bin/dartvm \n library l;'); |
| 445 "!#/bin/dartvm", [AstFactory.libraryDirective2("l")])); | |
| 446 } | 317 } |
| 447 | 318 |
| 448 void test_visitCompilationUnit_script_directives_declarations() { | 319 void test_visitCompilationUnit_script_directives_declarations() { |
| 449 _assertClone(AstFactory.compilationUnit8("!#/bin/dartvm", [ | 320 _assertCloneUnit('#!/bin/dartvm \n library l; var a;'); |
| 450 AstFactory.libraryDirective2("l") | |
| 451 ], [ | |
| 452 AstFactory.topLevelVariableDeclaration2( | |
| 453 Keyword.VAR, [AstFactory.variableDeclaration("a")]) | |
| 454 ])); | |
| 455 } | 321 } |
| 456 | 322 |
| 457 void test_visitConditionalExpression() { | 323 void test_visitConditionalExpression() { |
| 458 _assertClone(AstFactory.conditionalExpression(AstFactory.identifier3("a"), | 324 _assertCloneExpression('a ? b : c'); |
| 459 AstFactory.identifier3("b"), AstFactory.identifier3("c"))); | |
| 460 } | 325 } |
| 461 | 326 |
| 462 void test_visitConstructorDeclaration_const() { | 327 void test_visitConstructorDeclaration_const() { |
| 463 _assertClone(AstFactory.constructorDeclaration2( | 328 _assertCloneUnitMember('class C { const C(); }'); |
| 464 Keyword.CONST, | |
| 465 null, | |
| 466 AstFactory.identifier3("C"), | |
| 467 null, | |
| 468 AstFactory.formalParameterList(), | |
| 469 null, | |
| 470 AstFactory.blockFunctionBody2())); | |
| 471 } | 329 } |
| 472 | 330 |
| 473 void test_visitConstructorDeclaration_external() { | 331 void test_visitConstructorDeclaration_external() { |
| 474 _assertClone(AstFactory.constructorDeclaration(AstFactory.identifier3("C"), | 332 _assertCloneUnitMember('class C { external C(); }'); |
| 475 null, AstFactory.formalParameterList(), null)); | |
| 476 } | 333 } |
| 477 | 334 |
| 478 void test_visitConstructorDeclaration_minimal() { | 335 void test_visitConstructorDeclaration_minimal() { |
| 479 _assertClone(AstFactory.constructorDeclaration2( | 336 _assertCloneUnitMember('class C { C() {} }'); |
| 480 null, | |
| 481 null, | |
| 482 AstFactory.identifier3("C"), | |
| 483 null, | |
| 484 AstFactory.formalParameterList(), | |
| 485 null, | |
| 486 AstFactory.blockFunctionBody2())); | |
| 487 } | 337 } |
| 488 | 338 |
| 489 void test_visitConstructorDeclaration_multipleInitializers() { | 339 void test_visitConstructorDeclaration_multipleInitializers() { |
| 490 _assertClone(AstFactory.constructorDeclaration2( | 340 _assertCloneUnitMember('class C { C() : a = b, c = d {} }'); |
| 491 null, | |
| 492 null, | |
| 493 AstFactory.identifier3("C"), | |
| 494 null, | |
| 495 AstFactory.formalParameterList(), | |
| 496 [ | |
| 497 AstFactory.constructorFieldInitializer( | |
| 498 false, "a", AstFactory.identifier3("b")), | |
| 499 AstFactory.constructorFieldInitializer( | |
| 500 false, "c", AstFactory.identifier3("d")) | |
| 501 ], | |
| 502 AstFactory.blockFunctionBody2())); | |
| 503 } | 341 } |
| 504 | 342 |
| 505 void test_visitConstructorDeclaration_multipleParameters() { | 343 void test_visitConstructorDeclaration_multipleParameters() { |
| 506 _assertClone(AstFactory.constructorDeclaration2( | 344 _assertCloneUnitMember('class C { C(var a, var b) {} }'); |
| 507 null, | |
| 508 null, | |
| 509 AstFactory.identifier3("C"), | |
| 510 null, | |
| 511 AstFactory.formalParameterList([ | |
| 512 AstFactory.simpleFormalParameter(Keyword.VAR, "a"), | |
| 513 AstFactory.simpleFormalParameter(Keyword.VAR, "b") | |
| 514 ]), | |
| 515 null, | |
| 516 AstFactory.blockFunctionBody2())); | |
| 517 } | 345 } |
| 518 | 346 |
| 519 void test_visitConstructorDeclaration_named() { | 347 void test_visitConstructorDeclaration_named() { |
| 520 _assertClone(AstFactory.constructorDeclaration2( | 348 _assertCloneUnitMember('class C { C.m() {} }'); |
| 521 null, | |
| 522 null, | |
| 523 AstFactory.identifier3("C"), | |
| 524 "m", | |
| 525 AstFactory.formalParameterList(), | |
| 526 null, | |
| 527 AstFactory.blockFunctionBody2())); | |
| 528 } | 349 } |
| 529 | 350 |
| 530 void test_visitConstructorDeclaration_singleInitializer() { | 351 void test_visitConstructorDeclaration_singleInitializer() { |
| 531 _assertClone(AstFactory.constructorDeclaration2( | 352 _assertCloneUnitMember('class C { C() : a = b {} }'); |
| 532 null, | |
| 533 null, | |
| 534 AstFactory.identifier3("C"), | |
| 535 null, | |
| 536 AstFactory.formalParameterList(), | |
| 537 [ | |
| 538 AstFactory.constructorFieldInitializer( | |
| 539 false, "a", AstFactory.identifier3("b")) | |
| 540 ], | |
| 541 AstFactory.blockFunctionBody2())); | |
| 542 } | 353 } |
| 543 | 354 |
| 544 void test_visitConstructorDeclaration_withMetadata() { | 355 void test_visitConstructorDeclaration_withMetadata() { |
| 545 ConstructorDeclaration declaration = AstFactory.constructorDeclaration2( | 356 _assertCloneUnitMember('class C { @deprecated C() {} }'); |
| 546 null, | |
| 547 null, | |
| 548 AstFactory.identifier3("C"), | |
| 549 null, | |
| 550 AstFactory.formalParameterList(), | |
| 551 null, | |
| 552 AstFactory.blockFunctionBody2()); | |
| 553 declaration.metadata | |
| 554 .add(AstFactory.annotation(AstFactory.identifier3("deprecated"))); | |
| 555 _assertClone(declaration); | |
| 556 } | 357 } |
| 557 | 358 |
| 558 void test_visitConstructorFieldInitializer_withoutThis() { | 359 void test_visitConstructorFieldInitializer_withoutThis() { |
| 559 _assertClone(AstFactory.constructorFieldInitializer( | 360 _assertCloneUnitMember('class C { C() : a = b {} }'); |
| 560 false, "a", AstFactory.identifier3("b"))); | |
| 561 } | 361 } |
| 562 | 362 |
| 563 void test_visitConstructorFieldInitializer_withThis() { | 363 void test_visitConstructorFieldInitializer_withThis() { |
| 564 _assertClone(AstFactory.constructorFieldInitializer( | 364 _assertCloneUnitMember('class C { C() : this.a = b {} }'); |
| 565 true, "a", AstFactory.identifier3("b"))); | |
| 566 } | 365 } |
| 567 | 366 |
| 568 void test_visitConstructorName_named_prefix() { | 367 void test_visitConstructorName_named_prefix() { |
| 569 _assertClone( | 368 _assertCloneExpression('new p.C.n()'); |
| 570 AstFactory.constructorName(AstFactory.typeName4("p.C.n"), null)); | |
| 571 } | 369 } |
| 572 | 370 |
| 573 void test_visitConstructorName_unnamed_noPrefix() { | 371 void test_visitConstructorName_unnamed_noPrefix() { |
| 574 _assertClone(AstFactory.constructorName(AstFactory.typeName4("C"), null)); | 372 _assertCloneExpression('new C()'); |
| 575 } | 373 } |
| 576 | 374 |
| 577 void test_visitConstructorName_unnamed_prefix() { | 375 void test_visitConstructorName_unnamed_prefix() { |
| 578 _assertClone(AstFactory.constructorName( | 376 _assertCloneExpression('new p.C()'); |
| 579 AstFactory.typeName3(AstFactory.identifier5("p", "C")), null)); | |
| 580 } | 377 } |
| 581 | 378 |
| 582 void test_visitContinueStatement_label() { | 379 void test_visitContinueStatement_label() { |
| 583 _assertClone(AstFactory.continueStatement("l")); | 380 _assertCloneStatement('l: while (true) { continue l; }'); |
| 584 } | 381 } |
| 585 | 382 |
| 586 void test_visitContinueStatement_noLabel() { | 383 void test_visitContinueStatement_noLabel() { |
| 587 _assertClone(AstFactory.continueStatement()); | 384 _assertCloneStatement('while (true) { continue; }'); |
| 588 } | 385 } |
| 589 | 386 |
| 590 void test_visitDefaultFormalParameter_named_noValue() { | 387 void test_visitDefaultFormalParameter_named_noValue() { |
| 591 _assertClone(AstFactory.namedFormalParameter( | 388 _assertCloneUnitMember('main({p}) {}'); |
| 592 AstFactory.simpleFormalParameter3("p"), null)); | |
| 593 } | 389 } |
| 594 | 390 |
| 595 void test_visitDefaultFormalParameter_named_value() { | 391 void test_visitDefaultFormalParameter_named_value() { |
| 596 _assertClone(AstFactory.namedFormalParameter( | 392 _assertCloneUnitMember('main({p : 0}) {}'); |
| 597 AstFactory.simpleFormalParameter3("p"), AstFactory.integer(0))); | |
| 598 } | 393 } |
| 599 | 394 |
| 600 void test_visitDefaultFormalParameter_positional_noValue() { | 395 void test_visitDefaultFormalParameter_positional_noValue() { |
| 601 _assertClone(AstFactory.positionalFormalParameter( | 396 _assertCloneUnitMember('main([p]) {}'); |
| 602 AstFactory.simpleFormalParameter3("p"), null)); | |
| 603 } | 397 } |
| 604 | 398 |
| 605 void test_visitDefaultFormalParameter_positional_value() { | 399 void test_visitDefaultFormalParameter_positional_value() { |
| 606 _assertClone(AstFactory.positionalFormalParameter( | 400 _assertCloneUnitMember('main([p = 0]) {}'); |
| 607 AstFactory.simpleFormalParameter3("p"), AstFactory.integer(0))); | |
| 608 } | 401 } |
| 609 | 402 |
| 610 void test_visitDoStatement() { | 403 void test_visitDoStatement() { |
| 611 _assertClone(AstFactory.doStatement( | 404 _assertCloneStatement('do {} while (c);'); |
| 612 AstFactory.block(), AstFactory.identifier3("c"))); | |
| 613 } | 405 } |
| 614 | 406 |
| 615 void test_visitDoubleLiteral() { | 407 void test_visitDoubleLiteral() { |
| 616 _assertClone(AstFactory.doubleLiteral(4.2)); | 408 _assertCloneExpression('4.2'); |
| 617 } | 409 } |
| 618 | 410 |
| 619 void test_visitEmptyFunctionBody() { | 411 void test_visitEmptyFunctionBody() { |
| 620 _assertClone(AstFactory.emptyFunctionBody()); | 412 _assertCloneUnitMember('main() {}'); |
| 621 } | 413 } |
| 622 | 414 |
| 623 void test_visitEmptyStatement() { | 415 void test_visitEmptyStatement() { |
| 624 _assertClone(AstFactory.emptyStatement()); | 416 _assertCloneUnitMember('main() { ; }'); |
| 625 } | 417 } |
| 626 | 418 |
| 627 void test_visitExportDirective_combinator() { | 419 void test_visitExportDirective_combinator() { |
| 628 _assertClone(AstFactory.exportDirective2("a.dart", [ | 420 _assertCloneUnit('export "a.dart" show A;'); |
| 629 AstFactory.showCombinator([AstFactory.identifier3("A")]) | |
| 630 ])); | |
| 631 } | 421 } |
| 632 | 422 |
| 633 void test_visitExportDirective_combinators() { | 423 void test_visitExportDirective_combinators() { |
| 634 _assertClone(AstFactory.exportDirective2("a.dart", [ | 424 _assertCloneUnit('export "a.dart" show A hide B;'); |
| 635 AstFactory.showCombinator([AstFactory.identifier3("A")]), | |
| 636 AstFactory.hideCombinator([AstFactory.identifier3("B")]) | |
| 637 ])); | |
| 638 } | 425 } |
| 639 | 426 |
| 640 void test_visitExportDirective_minimal() { | 427 void test_visitExportDirective_minimal() { |
| 641 _assertClone(AstFactory.exportDirective2("a.dart")); | 428 _assertCloneUnit('export "a.dart";'); |
| 642 } | 429 } |
| 643 | 430 |
| 644 void test_visitExportDirective_withMetadata() { | 431 void test_visitExportDirective_withMetadata() { |
| 645 ExportDirective directive = AstFactory.exportDirective2("a.dart"); | 432 _assertCloneUnit('@deprecated export "a.dart";'); |
| 646 directive.metadata | |
| 647 .add(AstFactory.annotation(AstFactory.identifier3("deprecated"))); | |
| 648 _assertClone(directive); | |
| 649 } | 433 } |
| 650 | 434 |
| 651 void test_visitExpressionFunctionBody() { | 435 void test_visitExpressionFunctionBody() { |
| 652 _assertClone( | 436 _assertCloneUnitMember('main() => a;'); |
| 653 AstFactory.expressionFunctionBody(AstFactory.identifier3("a"))); | |
| 654 } | 437 } |
| 655 | 438 |
| 656 void test_visitExpressionStatement() { | 439 void test_visitExpressionStatement() { |
| 657 _assertClone(AstFactory.expressionStatement(AstFactory.identifier3("a"))); | 440 _assertCloneStatement('a;'); |
| 658 } | 441 } |
| 659 | 442 |
| 660 void test_visitExtendsClause() { | 443 void test_visitExtendsClause() { |
| 661 _assertClone(AstFactory.extendsClause(AstFactory.typeName4("C"))); | 444 _assertCloneUnitMember('class A extends B {}'); |
| 662 } | 445 } |
| 663 | 446 |
| 664 void test_visitFieldDeclaration_instance() { | 447 void test_visitFieldDeclaration_instance() { |
| 665 _assertClone(AstFactory.fieldDeclaration2( | 448 _assertCloneUnitMember('class C { var a; }'); |
| 666 false, Keyword.VAR, [AstFactory.variableDeclaration("a")])); | |
| 667 } | 449 } |
| 668 | 450 |
| 669 void test_visitFieldDeclaration_static() { | 451 void test_visitFieldDeclaration_static() { |
| 670 _assertClone(AstFactory.fieldDeclaration2( | 452 _assertCloneUnitMember('class C { static var a; }'); |
| 671 true, Keyword.VAR, [AstFactory.variableDeclaration("a")])); | |
| 672 } | 453 } |
| 673 | 454 |
| 674 void test_visitFieldDeclaration_withMetadata() { | 455 void test_visitFieldDeclaration_withMetadata() { |
| 675 FieldDeclaration declaration = AstFactory.fieldDeclaration2( | 456 _assertCloneUnitMember('class C { @deprecated var a; }'); |
| 676 false, Keyword.VAR, [AstFactory.variableDeclaration("a")]); | |
| 677 declaration.metadata | |
| 678 .add(AstFactory.annotation(AstFactory.identifier3("deprecated"))); | |
| 679 _assertClone(declaration); | |
| 680 } | 457 } |
| 681 | 458 |
| 682 void test_visitFieldFormalParameter_functionTyped() { | 459 void test_visitFieldFormalParameter_functionTyped() { |
| 683 _assertClone(AstFactory.fieldFormalParameter( | 460 _assertCloneUnitMember('class C { C(A this.a(b)); }'); |
| 684 null, | |
| 685 AstFactory.typeName4("A"), | |
| 686 "a", | |
| 687 AstFactory | |
| 688 .formalParameterList([AstFactory.simpleFormalParameter3("b")]))); | |
| 689 } | 461 } |
| 690 | 462 |
| 691 void test_visitFieldFormalParameter_keyword() { | 463 void test_visitFieldFormalParameter_keyword() { |
| 692 _assertClone(AstFactory.fieldFormalParameter(Keyword.VAR, null, "a")); | 464 _assertCloneUnitMember('class C { C(var this.a); }'); |
| 693 } | 465 } |
| 694 | 466 |
| 695 void test_visitFieldFormalParameter_keywordAndType() { | 467 void test_visitFieldFormalParameter_keywordAndType() { |
| 696 _assertClone(AstFactory.fieldFormalParameter( | 468 _assertCloneUnitMember('class C { C(final A this.a); }'); |
| 697 Keyword.FINAL, AstFactory.typeName4("A"), "a")); | |
| 698 } | 469 } |
| 699 | 470 |
| 700 void test_visitFieldFormalParameter_type() { | 471 void test_visitFieldFormalParameter_type() { |
| 701 _assertClone( | 472 _assertCloneUnitMember('class C { C(A this.a); }'); |
| 702 AstFactory.fieldFormalParameter(null, AstFactory.typeName4("A"), "a")); | |
| 703 } | 473 } |
| 704 | 474 |
| 705 void test_visitForEachStatement_declared() { | 475 void test_visitForEachStatement_declared() { |
| 706 _assertClone(AstFactory.forEachStatement( | 476 _assertCloneStatement('for (var a in b) {}'); |
| 707 AstFactory.declaredIdentifier3("a"), | |
| 708 AstFactory.identifier3("b"), | |
| 709 AstFactory.block())); | |
| 710 } | 477 } |
| 711 | 478 |
| 712 void test_visitForEachStatement_variable() { | 479 void test_visitForEachStatement_variable() { |
| 713 _assertClone(new ForEachStatement.withReference( | 480 _assertCloneStatement('for (a in b) {}'); |
| 714 null, | |
| 715 TokenFactory.tokenFromKeyword(Keyword.FOR), | |
| 716 TokenFactory.tokenFromType(TokenType.OPEN_PAREN), | |
| 717 AstFactory.identifier3("a"), | |
| 718 TokenFactory.tokenFromKeyword(Keyword.IN), | |
| 719 AstFactory.identifier3("b"), | |
| 720 TokenFactory.tokenFromType(TokenType.CLOSE_PAREN), | |
| 721 AstFactory.block())); | |
| 722 } | 481 } |
| 723 | 482 |
| 724 void test_visitForEachStatement_variable_await() { | 483 void test_visitForEachStatement_variable_await() { |
| 725 _assertClone(new ForEachStatement.withReference( | 484 _assertCloneUnitMember('main(s) async { await for (a in s) {} }'); |
| 726 TokenFactory.tokenFromString("await"), | |
| 727 TokenFactory.tokenFromKeyword(Keyword.FOR), | |
| 728 TokenFactory.tokenFromType(TokenType.OPEN_PAREN), | |
| 729 AstFactory.identifier3("a"), | |
| 730 TokenFactory.tokenFromKeyword(Keyword.IN), | |
| 731 AstFactory.identifier3("b"), | |
| 732 TokenFactory.tokenFromType(TokenType.CLOSE_PAREN), | |
| 733 AstFactory.block())); | |
| 734 } | 485 } |
| 735 | 486 |
| 736 void test_visitFormalParameterList_empty() { | 487 void test_visitFormalParameterList_empty() { |
| 737 _assertClone(AstFactory.formalParameterList()); | 488 _assertCloneUnitMember('main() {}'); |
| 738 } | 489 } |
| 739 | 490 |
| 740 void test_visitFormalParameterList_n() { | 491 void test_visitFormalParameterList_n() { |
| 741 _assertClone(AstFactory.formalParameterList([ | 492 _assertCloneUnitMember('main({a: 0}) {}'); |
| 742 AstFactory.namedFormalParameter( | |
| 743 AstFactory.simpleFormalParameter3("a"), AstFactory.integer(0)) | |
| 744 ])); | |
| 745 } | 493 } |
| 746 | 494 |
| 747 void test_visitFormalParameterList_nn() { | 495 void test_visitFormalParameterList_nn() { |
| 748 _assertClone(AstFactory.formalParameterList([ | 496 _assertCloneUnitMember('main({a: 0, b: 1}) {}'); |
| 749 AstFactory.namedFormalParameter( | |
| 750 AstFactory.simpleFormalParameter3("a"), AstFactory.integer(0)), | |
| 751 AstFactory.namedFormalParameter( | |
| 752 AstFactory.simpleFormalParameter3("b"), AstFactory.integer(1)) | |
| 753 ])); | |
| 754 } | 497 } |
| 755 | 498 |
| 756 void test_visitFormalParameterList_p() { | 499 void test_visitFormalParameterList_p() { |
| 757 _assertClone(AstFactory.formalParameterList([ | 500 _assertCloneUnitMember('main([a = 0]) {}'); |
| 758 AstFactory.positionalFormalParameter( | |
| 759 AstFactory.simpleFormalParameter3("a"), AstFactory.integer(0)) | |
| 760 ])); | |
| 761 } | 501 } |
| 762 | 502 |
| 763 void test_visitFormalParameterList_pp() { | 503 void test_visitFormalParameterList_pp() { |
| 764 _assertClone(AstFactory.formalParameterList([ | 504 _assertCloneUnitMember('main([a = 0, b = 1]) {}'); |
| 765 AstFactory.positionalFormalParameter( | |
| 766 AstFactory.simpleFormalParameter3("a"), AstFactory.integer(0)), | |
| 767 AstFactory.positionalFormalParameter( | |
| 768 AstFactory.simpleFormalParameter3("b"), AstFactory.integer(1)) | |
| 769 ])); | |
| 770 } | 505 } |
| 771 | 506 |
| 772 void test_visitFormalParameterList_r() { | 507 void test_visitFormalParameterList_r() { |
| 773 _assertClone(AstFactory | 508 _assertCloneUnitMember('main(a) {}'); |
| 774 .formalParameterList([AstFactory.simpleFormalParameter3("a")])); | |
| 775 } | 509 } |
| 776 | 510 |
| 777 void test_visitFormalParameterList_rn() { | 511 void test_visitFormalParameterList_rn() { |
| 778 _assertClone(AstFactory.formalParameterList([ | 512 _assertCloneUnitMember('main(a, {b: 1}) {}'); |
| 779 AstFactory.simpleFormalParameter3("a"), | |
| 780 AstFactory.namedFormalParameter( | |
| 781 AstFactory.simpleFormalParameter3("b"), AstFactory.integer(1)) | |
| 782 ])); | |
| 783 } | 513 } |
| 784 | 514 |
| 785 void test_visitFormalParameterList_rnn() { | 515 void test_visitFormalParameterList_rnn() { |
| 786 _assertClone(AstFactory.formalParameterList([ | 516 _assertCloneUnitMember('main(a, {b: 1, c: 2}) {}'); |
| 787 AstFactory.simpleFormalParameter3("a"), | |
| 788 AstFactory.namedFormalParameter( | |
| 789 AstFactory.simpleFormalParameter3("b"), AstFactory.integer(1)), | |
| 790 AstFactory.namedFormalParameter( | |
| 791 AstFactory.simpleFormalParameter3("c"), AstFactory.integer(2)) | |
| 792 ])); | |
| 793 } | 517 } |
| 794 | 518 |
| 795 void test_visitFormalParameterList_rp() { | 519 void test_visitFormalParameterList_rp() { |
| 796 _assertClone(AstFactory.formalParameterList([ | 520 _assertCloneUnitMember('main(a, [b = 1]) {}'); |
| 797 AstFactory.simpleFormalParameter3("a"), | |
| 798 AstFactory.positionalFormalParameter( | |
| 799 AstFactory.simpleFormalParameter3("b"), AstFactory.integer(1)) | |
| 800 ])); | |
| 801 } | 521 } |
| 802 | 522 |
| 803 void test_visitFormalParameterList_rpp() { | 523 void test_visitFormalParameterList_rpp() { |
| 804 _assertClone(AstFactory.formalParameterList([ | 524 _assertCloneUnitMember('main(a, [b = 1, c = 2]) {}'); |
| 805 AstFactory.simpleFormalParameter3("a"), | |
| 806 AstFactory.positionalFormalParameter( | |
| 807 AstFactory.simpleFormalParameter3("b"), AstFactory.integer(1)), | |
| 808 AstFactory.positionalFormalParameter( | |
| 809 AstFactory.simpleFormalParameter3("c"), AstFactory.integer(2)) | |
| 810 ])); | |
| 811 } | 525 } |
| 812 | 526 |
| 813 void test_visitFormalParameterList_rr() { | 527 void test_visitFormalParameterList_rr() { |
| 814 _assertClone(AstFactory.formalParameterList([ | 528 _assertCloneUnitMember('main(a, b) {}'); |
| 815 AstFactory.simpleFormalParameter3("a"), | |
| 816 AstFactory.simpleFormalParameter3("b") | |
| 817 ])); | |
| 818 } | 529 } |
| 819 | 530 |
| 820 void test_visitFormalParameterList_rrn() { | 531 void test_visitFormalParameterList_rrn() { |
| 821 _assertClone(AstFactory.formalParameterList([ | 532 _assertCloneUnitMember('main(a, b, {c: 3}) {}'); |
| 822 AstFactory.simpleFormalParameter3("a"), | |
| 823 AstFactory.simpleFormalParameter3("b"), | |
| 824 AstFactory.namedFormalParameter( | |
| 825 AstFactory.simpleFormalParameter3("c"), AstFactory.integer(3)) | |
| 826 ])); | |
| 827 } | 533 } |
| 828 | 534 |
| 829 void test_visitFormalParameterList_rrnn() { | 535 void test_visitFormalParameterList_rrnn() { |
| 830 _assertClone(AstFactory.formalParameterList([ | 536 _assertCloneUnitMember('main(a, b, {c: 3, d: 4}) {}'); |
| 831 AstFactory.simpleFormalParameter3("a"), | |
| 832 AstFactory.simpleFormalParameter3("b"), | |
| 833 AstFactory.namedFormalParameter( | |
| 834 AstFactory.simpleFormalParameter3("c"), AstFactory.integer(3)), | |
| 835 AstFactory.namedFormalParameter( | |
| 836 AstFactory.simpleFormalParameter3("d"), AstFactory.integer(4)) | |
| 837 ])); | |
| 838 } | 537 } |
| 839 | 538 |
| 840 void test_visitFormalParameterList_rrp() { | 539 void test_visitFormalParameterList_rrp() { |
| 841 _assertClone(AstFactory.formalParameterList([ | 540 _assertCloneUnitMember('main(a, b, [c = 3]) {}'); |
| 842 AstFactory.simpleFormalParameter3("a"), | |
| 843 AstFactory.simpleFormalParameter3("b"), | |
| 844 AstFactory.positionalFormalParameter( | |
| 845 AstFactory.simpleFormalParameter3("c"), AstFactory.integer(3)) | |
| 846 ])); | |
| 847 } | 541 } |
| 848 | 542 |
| 849 void test_visitFormalParameterList_rrpp() { | 543 void test_visitFormalParameterList_rrpp() { |
| 850 _assertClone(AstFactory.formalParameterList([ | 544 _assertCloneUnitMember('main(a, b, [c = 3, d = 4]) {}'); |
| 851 AstFactory.simpleFormalParameter3("a"), | |
| 852 AstFactory.simpleFormalParameter3("b"), | |
| 853 AstFactory.positionalFormalParameter( | |
| 854 AstFactory.simpleFormalParameter3("c"), AstFactory.integer(3)), | |
| 855 AstFactory.positionalFormalParameter( | |
| 856 AstFactory.simpleFormalParameter3("d"), AstFactory.integer(4)) | |
| 857 ])); | |
| 858 } | 545 } |
| 859 | 546 |
| 860 void test_visitForStatement_c() { | 547 void test_visitForStatement_c() { |
| 861 _assertClone(AstFactory.forStatement( | 548 _assertCloneStatement('for (; c;) {}'); |
| 862 null, AstFactory.identifier3("c"), null, AstFactory.block())); | |
| 863 } | 549 } |
| 864 | 550 |
| 865 void test_visitForStatement_cu() { | 551 void test_visitForStatement_cu() { |
| 866 _assertClone(AstFactory.forStatement(null, AstFactory.identifier3("c"), | 552 _assertCloneStatement('for (; c; u) {}'); |
| 867 [AstFactory.identifier3("u")], AstFactory.block())); | |
| 868 } | 553 } |
| 869 | 554 |
| 870 void test_visitForStatement_e() { | 555 void test_visitForStatement_e() { |
| 871 _assertClone(AstFactory.forStatement( | 556 _assertCloneStatement('for (e; ;) {}'); |
| 872 AstFactory.identifier3("e"), null, null, AstFactory.block())); | |
| 873 } | 557 } |
| 874 | 558 |
| 875 void test_visitForStatement_ec() { | 559 void test_visitForStatement_ec() { |
| 876 _assertClone(AstFactory.forStatement(AstFactory.identifier3("e"), | 560 _assertCloneStatement('for (e; c;) {}'); |
| 877 AstFactory.identifier3("c"), null, AstFactory.block())); | |
| 878 } | 561 } |
| 879 | 562 |
| 880 void test_visitForStatement_ecu() { | 563 void test_visitForStatement_ecu() { |
| 881 _assertClone(AstFactory.forStatement( | 564 _assertCloneStatement('for (e; c; u) {}'); |
| 882 AstFactory.identifier3("e"), | |
| 883 AstFactory.identifier3("c"), | |
| 884 [AstFactory.identifier3("u")], | |
| 885 AstFactory.block())); | |
| 886 } | 565 } |
| 887 | 566 |
| 888 void test_visitForStatement_eu() { | 567 void test_visitForStatement_eu() { |
| 889 _assertClone(AstFactory.forStatement(AstFactory.identifier3("e"), null, | 568 _assertCloneStatement('for (e; ; u) {}'); |
| 890 [AstFactory.identifier3("u")], AstFactory.block())); | |
| 891 } | 569 } |
| 892 | 570 |
| 893 void test_visitForStatement_i() { | 571 void test_visitForStatement_i() { |
| 894 _assertClone(AstFactory.forStatement2( | 572 _assertCloneStatement('for (var i; ;) {}'); |
| 895 AstFactory.variableDeclarationList2( | |
| 896 Keyword.VAR, [AstFactory.variableDeclaration("i")]), | |
| 897 null, | |
| 898 null, | |
| 899 AstFactory.block())); | |
| 900 } | 573 } |
| 901 | 574 |
| 902 void test_visitForStatement_ic() { | 575 void test_visitForStatement_ic() { |
| 903 _assertClone(AstFactory.forStatement2( | 576 _assertCloneStatement('for (var i; c;) {}'); |
| 904 AstFactory.variableDeclarationList2( | |
| 905 Keyword.VAR, [AstFactory.variableDeclaration("i")]), | |
| 906 AstFactory.identifier3("c"), | |
| 907 null, | |
| 908 AstFactory.block())); | |
| 909 } | 577 } |
| 910 | 578 |
| 911 void test_visitForStatement_icu() { | 579 void test_visitForStatement_icu() { |
| 912 _assertClone(AstFactory.forStatement2( | 580 _assertCloneStatement('for (var i; c; u) {}'); |
| 913 AstFactory.variableDeclarationList2( | |
| 914 Keyword.VAR, [AstFactory.variableDeclaration("i")]), | |
| 915 AstFactory.identifier3("c"), | |
| 916 [AstFactory.identifier3("u")], | |
| 917 AstFactory.block())); | |
| 918 } | 581 } |
| 919 | 582 |
| 920 void test_visitForStatement_iu() { | 583 void test_visitForStatement_iu() { |
| 921 _assertClone(AstFactory.forStatement2( | 584 _assertCloneStatement('for (var i; ; u) {}'); |
| 922 AstFactory.variableDeclarationList2( | |
| 923 Keyword.VAR, [AstFactory.variableDeclaration("i")]), | |
| 924 null, | |
| 925 [AstFactory.identifier3("u")], | |
| 926 AstFactory.block())); | |
| 927 } | 585 } |
| 928 | 586 |
| 929 void test_visitForStatement_u() { | 587 void test_visitForStatement_u() { |
| 930 _assertClone(AstFactory.forStatement( | 588 _assertCloneStatement('for (; ; u) {}'); |
| 931 null, null, [AstFactory.identifier3("u")], AstFactory.block())); | |
| 932 } | 589 } |
| 933 | 590 |
| 934 void test_visitFunctionDeclaration_getter() { | 591 void test_visitFunctionDeclaration_getter() { |
| 935 _assertClone(AstFactory.functionDeclaration( | 592 _assertCloneUnitMember('get f {}'); |
| 936 null, Keyword.GET, "f", AstFactory.functionExpression())); | |
| 937 } | 593 } |
| 938 | 594 |
| 939 void test_visitFunctionDeclaration_normal() { | 595 void test_visitFunctionDeclaration_normal() { |
| 940 _assertClone(AstFactory.functionDeclaration( | 596 _assertCloneUnitMember('f() {}'); |
| 941 null, null, "f", AstFactory.functionExpression())); | |
| 942 } | 597 } |
| 943 | 598 |
| 944 void test_visitFunctionDeclaration_setter() { | 599 void test_visitFunctionDeclaration_setter() { |
| 945 _assertClone(AstFactory.functionDeclaration( | 600 _assertCloneUnitMember('set f(x) {}'); |
| 946 null, Keyword.SET, "f", AstFactory.functionExpression())); | |
| 947 } | 601 } |
| 948 | 602 |
| 949 void test_visitFunctionDeclaration_withMetadata() { | 603 void test_visitFunctionDeclaration_withMetadata() { |
| 950 FunctionDeclaration declaration = AstFactory.functionDeclaration( | 604 _assertCloneUnitMember('@deprecated f() {}'); |
| 951 null, null, "f", AstFactory.functionExpression()); | |
| 952 declaration.metadata | |
| 953 .add(AstFactory.annotation(AstFactory.identifier3("deprecated"))); | |
| 954 _assertClone(declaration); | |
| 955 } | 605 } |
| 956 | 606 |
| 957 void test_visitFunctionDeclarationStatement() { | 607 void test_visitFunctionDeclarationStatement() { |
| 958 _assertClone(AstFactory.functionDeclarationStatement( | 608 _assertCloneStatement('f() {}'); |
| 959 null, null, "f", AstFactory.functionExpression())); | |
| 960 } | |
| 961 | |
| 962 void test_visitFunctionExpression() { | |
| 963 _assertClone(AstFactory.functionExpression()); | |
| 964 } | 609 } |
| 965 | 610 |
| 966 void test_visitFunctionExpressionInvocation() { | 611 void test_visitFunctionExpressionInvocation() { |
| 967 _assertClone( | 612 _assertCloneStatement('{ () {}(); }'); |
| 968 AstFactory.functionExpressionInvocation(AstFactory.identifier3("f"))); | |
| 969 } | 613 } |
| 970 | 614 |
| 971 void test_visitFunctionTypeAlias_generic() { | 615 void test_visitFunctionTypeAlias_generic() { |
| 972 _assertClone(AstFactory.typeAlias(AstFactory.typeName4("A"), "F", | 616 _assertCloneUnitMember('typedef A F<B>();'); |
| 973 AstFactory.typeParameterList(["B"]), AstFactory.formalParameterList())); | |
| 974 } | 617 } |
| 975 | 618 |
| 976 void test_visitFunctionTypeAlias_nonGeneric() { | 619 void test_visitFunctionTypeAlias_nonGeneric() { |
| 977 _assertClone(AstFactory.typeAlias(AstFactory.typeName4("A"), "F", null, | 620 _assertCloneUnitMember('typedef A F();'); |
| 978 AstFactory.formalParameterList())); | |
| 979 } | 621 } |
| 980 | 622 |
| 981 void test_visitFunctionTypeAlias_withMetadata() { | 623 void test_visitFunctionTypeAlias_withMetadata() { |
| 982 FunctionTypeAlias declaration = AstFactory.typeAlias( | 624 _assertCloneUnitMember('@deprecated typedef A F();'); |
| 983 AstFactory.typeName4("A"), "F", null, AstFactory.formalParameterList()); | |
| 984 declaration.metadata | |
| 985 .add(AstFactory.annotation(AstFactory.identifier3("deprecated"))); | |
| 986 _assertClone(declaration); | |
| 987 } | 625 } |
| 988 | 626 |
| 989 void test_visitFunctionTypedFormalParameter_noType() { | 627 void test_visitFunctionTypedFormalParameter_noType() { |
| 990 _assertClone(AstFactory.functionTypedFormalParameter(null, "f")); | 628 _assertCloneUnitMember('main( f() ) {}'); |
| 991 } | 629 } |
| 992 | 630 |
| 993 void test_visitFunctionTypedFormalParameter_type() { | 631 void test_visitFunctionTypedFormalParameter_type() { |
| 994 _assertClone(AstFactory.functionTypedFormalParameter( | 632 _assertCloneUnitMember('main( T f() ) {}'); |
| 995 AstFactory.typeName4("T"), "f")); | |
| 996 } | 633 } |
| 997 | 634 |
| 998 void test_visitIfStatement_withElse() { | 635 void test_visitIfStatement_withElse() { |
| 999 _assertClone(AstFactory.ifStatement2( | 636 _assertCloneStatement('if (c) {} else {}'); |
| 1000 AstFactory.identifier3("c"), AstFactory.block(), AstFactory.block())); | |
| 1001 } | 637 } |
| 1002 | 638 |
| 1003 void test_visitIfStatement_withoutElse() { | 639 void test_visitIfStatement_withoutElse() { |
| 1004 _assertClone(AstFactory.ifStatement( | 640 _assertCloneStatement('if (c) {}'); |
| 1005 AstFactory.identifier3("c"), AstFactory.block())); | |
| 1006 } | 641 } |
| 1007 | 642 |
| 1008 void test_visitImplementsClause_multiple() { | 643 void test_visitImplementsClause_multiple() { |
| 1009 _assertClone(AstFactory.implementsClause( | 644 _assertCloneUnitMember('class A implements B, C {}'); |
| 1010 [AstFactory.typeName4("A"), AstFactory.typeName4("B")])); | |
| 1011 } | 645 } |
| 1012 | 646 |
| 1013 void test_visitImplementsClause_single() { | 647 void test_visitImplementsClause_single() { |
| 1014 _assertClone(AstFactory.implementsClause([AstFactory.typeName4("A")])); | 648 _assertCloneUnitMember('class A implements B {}'); |
| 1015 } | 649 } |
| 1016 | 650 |
| 1017 void test_visitImportDirective_combinator() { | 651 void test_visitImportDirective_combinator() { |
| 1018 _assertClone(AstFactory.importDirective3("a.dart", null, [ | 652 _assertCloneUnit('import "a.dart" show A;'); |
| 1019 AstFactory.showCombinator([AstFactory.identifier3("A")]) | |
| 1020 ])); | |
| 1021 } | 653 } |
| 1022 | 654 |
| 1023 void test_visitImportDirective_combinators() { | 655 void test_visitImportDirective_combinators() { |
| 1024 _assertClone(AstFactory.importDirective3("a.dart", null, [ | 656 _assertCloneUnit('import "a.dart" show A hide B;'); |
| 1025 AstFactory.showCombinator([AstFactory.identifier3("A")]), | |
| 1026 AstFactory.hideCombinator([AstFactory.identifier3("B")]) | |
| 1027 ])); | |
| 1028 } | 657 } |
| 1029 | 658 |
| 1030 void test_visitImportDirective_minimal() { | 659 void test_visitImportDirective_minimal() { |
| 1031 _assertClone(AstFactory.importDirective3("a.dart", null)); | 660 _assertCloneUnit('import "a.dart";'); |
| 1032 } | 661 } |
| 1033 | 662 |
| 1034 void test_visitImportDirective_prefix() { | 663 void test_visitImportDirective_prefix() { |
| 1035 _assertClone(AstFactory.importDirective3("a.dart", "p")); | 664 _assertCloneUnit('import "a.dart" as p;'); |
| 1036 } | 665 } |
| 1037 | 666 |
| 1038 void test_visitImportDirective_prefix_combinator() { | 667 void test_visitImportDirective_prefix_combinator() { |
| 1039 _assertClone(AstFactory.importDirective3("a.dart", "p", [ | 668 _assertCloneUnit('import "a.dart" as p show A;'); |
| 1040 AstFactory.showCombinator([AstFactory.identifier3("A")]) | |
| 1041 ])); | |
| 1042 } | 669 } |
| 1043 | 670 |
| 1044 void test_visitImportDirective_prefix_combinators() { | 671 void test_visitImportDirective_prefix_combinators() { |
| 1045 _assertClone(AstFactory.importDirective3("a.dart", "p", [ | 672 _assertCloneUnit('import "a.dart" as p show A hide B;'); |
| 1046 AstFactory.showCombinator([AstFactory.identifier3("A")]), | |
| 1047 AstFactory.hideCombinator([AstFactory.identifier3("B")]) | |
| 1048 ])); | |
| 1049 } | 673 } |
| 1050 | 674 |
| 1051 void test_visitImportDirective_withMetadata() { | 675 void test_visitImportDirective_withMetadata() { |
| 1052 ImportDirective directive = AstFactory.importDirective3("a.dart", null); | 676 _assertCloneUnit('@deprecated import "a.dart";'); |
| 1053 directive.metadata | |
| 1054 .add(AstFactory.annotation(AstFactory.identifier3("deprecated"))); | |
| 1055 _assertClone(directive); | |
| 1056 } | 677 } |
| 1057 | 678 |
| 1058 void test_visitImportHideCombinator_multiple() { | 679 void test_visitImportHideCombinator_multiple() { |
| 1059 _assertClone(AstFactory.hideCombinator( | 680 _assertCloneUnit('import "a.dart" hide a, b;'); |
| 1060 [AstFactory.identifier3("a"), AstFactory.identifier3("b")])); | |
| 1061 } | 681 } |
| 1062 | 682 |
| 1063 void test_visitImportHideCombinator_single() { | 683 void test_visitImportHideCombinator_single() { |
| 1064 _assertClone(AstFactory.hideCombinator([AstFactory.identifier3("a")])); | 684 _assertCloneUnit('import "a.dart" hide a;'); |
| 1065 } | 685 } |
| 1066 | 686 |
| 1067 void test_visitImportShowCombinator_multiple() { | 687 void test_visitImportShowCombinator_multiple() { |
| 1068 _assertClone(AstFactory.showCombinator( | 688 _assertCloneUnit('import "a.dart" show a, b;'); |
| 1069 [AstFactory.identifier3("a"), AstFactory.identifier3("b")])); | |
| 1070 } | 689 } |
| 1071 | 690 |
| 1072 void test_visitImportShowCombinator_single() { | 691 void test_visitImportShowCombinator_single() { |
| 1073 _assertClone(AstFactory.showCombinator([AstFactory.identifier3("a")])); | 692 _assertCloneUnit('import "a.dart" show a;'); |
| 1074 } | 693 } |
| 1075 | 694 |
| 1076 void test_visitIndexExpression() { | 695 void test_visitIndexExpression() { |
| 1077 _assertClone(AstFactory.indexExpression( | 696 _assertCloneExpression('a[i]'); |
| 1078 AstFactory.identifier3("a"), AstFactory.identifier3("i"))); | |
| 1079 } | 697 } |
| 1080 | 698 |
| 1081 void test_visitInstanceCreationExpression_const() { | 699 void test_visitInstanceCreationExpression_const() { |
| 1082 _assertClone(AstFactory.instanceCreationExpression2( | 700 _assertCloneExpression('const C()'); |
| 1083 Keyword.CONST, AstFactory.typeName4("C"))); | |
| 1084 } | 701 } |
| 1085 | 702 |
| 1086 void test_visitInstanceCreationExpression_named() { | 703 void test_visitInstanceCreationExpression_named() { |
| 1087 _assertClone(AstFactory.instanceCreationExpression3( | 704 _assertCloneExpression('new C.c()'); |
| 1088 Keyword.NEW, AstFactory.typeName4("C"), "c")); | |
| 1089 } | 705 } |
| 1090 | 706 |
| 1091 void test_visitInstanceCreationExpression_unnamed() { | 707 void test_visitInstanceCreationExpression_unnamed() { |
| 1092 _assertClone(AstFactory.instanceCreationExpression2( | 708 _assertCloneExpression('new C()'); |
| 1093 Keyword.NEW, AstFactory.typeName4("C"))); | |
| 1094 } | 709 } |
| 1095 | 710 |
| 1096 void test_visitIntegerLiteral() { | 711 void test_visitIntegerLiteral() { |
| 1097 _assertClone(AstFactory.integer(42)); | 712 _assertCloneExpression('42'); |
| 1098 } | 713 } |
| 1099 | 714 |
| 1100 void test_visitInterpolationExpression_expression() { | 715 void test_visitInterpolationExpression_expression() { |
| 1101 _assertClone( | 716 _assertCloneExpression(r'"${c}"'); |
| 1102 AstFactory.interpolationExpression(AstFactory.identifier3("a"))); | |
| 1103 } | 717 } |
| 1104 | 718 |
| 1105 void test_visitInterpolationExpression_identifier() { | 719 void test_visitInterpolationExpression_identifier() { |
| 1106 _assertClone(AstFactory.interpolationExpression2("a")); | 720 _assertCloneExpression(r'"$c"'); |
| 1107 } | |
| 1108 | |
| 1109 void test_visitInterpolationString() { | |
| 1110 _assertClone(AstFactory.interpolationString("'x", "x")); | |
| 1111 } | 721 } |
| 1112 | 722 |
| 1113 void test_visitIsExpression_negated() { | 723 void test_visitIsExpression_negated() { |
| 1114 _assertClone(AstFactory.isExpression( | 724 _assertCloneExpression('a is! C'); |
| 1115 AstFactory.identifier3("a"), true, AstFactory.typeName4("C"))); | |
| 1116 } | 725 } |
| 1117 | 726 |
| 1118 void test_visitIsExpression_normal() { | 727 void test_visitIsExpression_normal() { |
| 1119 _assertClone(AstFactory.isExpression( | 728 _assertCloneExpression('a is C'); |
| 1120 AstFactory.identifier3("a"), false, AstFactory.typeName4("C"))); | |
| 1121 } | 729 } |
| 1122 | 730 |
| 1123 void test_visitLabel() { | 731 void test_visitLabel() { |
| 1124 _assertClone(AstFactory.label2("a")); | 732 _assertCloneStatement('a: return;'); |
| 1125 } | 733 } |
| 1126 | 734 |
| 1127 void test_visitLabeledStatement_multiple() { | 735 void test_visitLabeledStatement_multiple() { |
| 1128 _assertClone(AstFactory.labeledStatement( | 736 _assertCloneStatement('a: b: return;'); |
| 1129 [AstFactory.label2("a"), AstFactory.label2("b")], | |
| 1130 AstFactory.returnStatement())); | |
| 1131 } | 737 } |
| 1132 | 738 |
| 1133 void test_visitLabeledStatement_single() { | 739 void test_visitLabeledStatement_single() { |
| 1134 _assertClone(AstFactory.labeledStatement( | 740 _assertCloneStatement('a: return;'); |
| 1135 [AstFactory.label2("a")], AstFactory.returnStatement())); | |
| 1136 } | 741 } |
| 1137 | 742 |
| 1138 void test_visitLibraryDirective() { | 743 void test_visitLibraryDirective() { |
| 1139 _assertClone(AstFactory.libraryDirective2("l")); | 744 _assertCloneUnit('library l;'); |
| 1140 } | 745 } |
| 1141 | 746 |
| 1142 void test_visitLibraryDirective_withMetadata() { | 747 void test_visitLibraryDirective_withMetadata() { |
| 1143 LibraryDirective directive = AstFactory.libraryDirective2("l"); | 748 _assertCloneUnit('@deprecated library l;'); |
| 1144 directive.metadata | |
| 1145 .add(AstFactory.annotation(AstFactory.identifier3("deprecated"))); | |
| 1146 _assertClone(directive); | |
| 1147 } | 749 } |
| 1148 | 750 |
| 1149 void test_visitLibraryIdentifier_multiple() { | 751 void test_visitLibraryIdentifier_multiple() { |
| 1150 _assertClone(AstFactory.libraryIdentifier([ | 752 _assertCloneUnit('library a.b.c;'); |
| 1151 AstFactory.identifier3("a"), | |
| 1152 AstFactory.identifier3("b"), | |
| 1153 AstFactory.identifier3("c") | |
| 1154 ])); | |
| 1155 } | 753 } |
| 1156 | 754 |
| 1157 void test_visitLibraryIdentifier_single() { | 755 void test_visitLibraryIdentifier_single() { |
| 1158 _assertClone(AstFactory.libraryIdentifier([AstFactory.identifier3("a")])); | 756 _assertCloneUnit('library a;'); |
| 1159 } | 757 } |
| 1160 | 758 |
| 1161 void test_visitListLiteral_const() { | 759 void test_visitListLiteral_const() { |
| 1162 _assertClone(AstFactory.listLiteral2(Keyword.CONST, null)); | 760 _assertCloneExpression('const []'); |
| 1163 } | 761 } |
| 1164 | 762 |
| 1165 void test_visitListLiteral_empty() { | 763 void test_visitListLiteral_empty() { |
| 1166 _assertClone(AstFactory.listLiteral()); | 764 _assertCloneExpression('[]'); |
| 1167 } | 765 } |
| 1168 | 766 |
| 1169 void test_visitListLiteral_nonEmpty() { | 767 void test_visitListLiteral_nonEmpty() { |
| 1170 _assertClone(AstFactory.listLiteral([ | 768 _assertCloneExpression('[a, b, c]'); |
| 1171 AstFactory.identifier3("a"), | |
| 1172 AstFactory.identifier3("b"), | |
| 1173 AstFactory.identifier3("c") | |
| 1174 ])); | |
| 1175 } | 769 } |
| 1176 | 770 |
| 1177 void test_visitMapLiteral_const() { | 771 void test_visitMapLiteral_const() { |
| 1178 _assertClone(AstFactory.mapLiteral(Keyword.CONST, null)); | 772 _assertCloneExpression('const {}'); |
| 1179 } | 773 } |
| 1180 | 774 |
| 1181 void test_visitMapLiteral_empty() { | 775 void test_visitMapLiteral_empty() { |
| 1182 _assertClone(AstFactory.mapLiteral2()); | 776 _assertCloneExpression('{}'); |
| 1183 } | 777 } |
| 1184 | 778 |
| 1185 void test_visitMapLiteral_nonEmpty() { | 779 void test_visitMapLiteral_nonEmpty() { |
| 1186 _assertClone(AstFactory.mapLiteral2([ | 780 _assertCloneExpression('{a: a, b: b, c: c}'); |
| 1187 AstFactory.mapLiteralEntry("a", AstFactory.identifier3("a")), | |
| 1188 AstFactory.mapLiteralEntry("b", AstFactory.identifier3("b")), | |
| 1189 AstFactory.mapLiteralEntry("c", AstFactory.identifier3("c")) | |
| 1190 ])); | |
| 1191 } | |
| 1192 | |
| 1193 void test_visitMapLiteralEntry() { | |
| 1194 _assertClone(AstFactory.mapLiteralEntry("a", AstFactory.identifier3("b"))); | |
| 1195 } | 781 } |
| 1196 | 782 |
| 1197 void test_visitMethodDeclaration_external() { | 783 void test_visitMethodDeclaration_external() { |
| 1198 _assertClone(AstFactory.methodDeclaration(null, null, null, null, | 784 _assertCloneUnitMember('class C { external m(); }'); |
| 1199 AstFactory.identifier3("m"), AstFactory.formalParameterList())); | |
| 1200 } | 785 } |
| 1201 | 786 |
| 1202 void test_visitMethodDeclaration_external_returnType() { | 787 void test_visitMethodDeclaration_external_returnType() { |
| 1203 _assertClone(AstFactory.methodDeclaration( | 788 _assertCloneUnitMember('class C { T m(); }'); |
| 1204 null, | |
| 1205 AstFactory.typeName4("T"), | |
| 1206 null, | |
| 1207 null, | |
| 1208 AstFactory.identifier3("m"), | |
| 1209 AstFactory.formalParameterList())); | |
| 1210 } | 789 } |
| 1211 | 790 |
| 1212 void test_visitMethodDeclaration_getter() { | 791 void test_visitMethodDeclaration_getter() { |
| 1213 _assertClone(AstFactory.methodDeclaration2(null, null, Keyword.GET, null, | 792 _assertCloneUnitMember('class C { get m {} }'); |
| 1214 AstFactory.identifier3("m"), null, AstFactory.blockFunctionBody2())); | |
| 1215 } | 793 } |
| 1216 | 794 |
| 1217 void test_visitMethodDeclaration_getter_returnType() { | 795 void test_visitMethodDeclaration_getter_returnType() { |
| 1218 _assertClone(AstFactory.methodDeclaration2( | 796 _assertCloneUnitMember('class C { T get m {} }'); |
| 1219 null, | |
| 1220 AstFactory.typeName4("T"), | |
| 1221 Keyword.GET, | |
| 1222 null, | |
| 1223 AstFactory.identifier3("m"), | |
| 1224 null, | |
| 1225 AstFactory.blockFunctionBody2())); | |
| 1226 } | |
| 1227 | |
| 1228 void test_visitMethodDeclaration_getter_seturnType() { | |
| 1229 _assertClone(AstFactory.methodDeclaration2( | |
| 1230 null, | |
| 1231 AstFactory.typeName4("T"), | |
| 1232 Keyword.SET, | |
| 1233 null, | |
| 1234 AstFactory.identifier3("m"), | |
| 1235 AstFactory.formalParameterList( | |
| 1236 [AstFactory.simpleFormalParameter(Keyword.VAR, "v")]), | |
| 1237 AstFactory.blockFunctionBody2())); | |
| 1238 } | 797 } |
| 1239 | 798 |
| 1240 void test_visitMethodDeclaration_minimal() { | 799 void test_visitMethodDeclaration_minimal() { |
| 1241 _assertClone(AstFactory.methodDeclaration2( | 800 _assertCloneUnitMember('class C { m() {} }'); |
| 1242 null, | |
| 1243 null, | |
| 1244 null, | |
| 1245 null, | |
| 1246 AstFactory.identifier3("m"), | |
| 1247 AstFactory.formalParameterList(), | |
| 1248 AstFactory.blockFunctionBody2())); | |
| 1249 } | 801 } |
| 1250 | 802 |
| 1251 void test_visitMethodDeclaration_multipleParameters() { | 803 void test_visitMethodDeclaration_multipleParameters() { |
| 1252 _assertClone(AstFactory.methodDeclaration2( | 804 _assertCloneUnitMember('class C { m(var a, var b) {} }'); |
| 1253 null, | |
| 1254 null, | |
| 1255 null, | |
| 1256 null, | |
| 1257 AstFactory.identifier3("m"), | |
| 1258 AstFactory.formalParameterList([ | |
| 1259 AstFactory.simpleFormalParameter(Keyword.VAR, "a"), | |
| 1260 AstFactory.simpleFormalParameter(Keyword.VAR, "b") | |
| 1261 ]), | |
| 1262 AstFactory.blockFunctionBody2())); | |
| 1263 } | 805 } |
| 1264 | 806 |
| 1265 void test_visitMethodDeclaration_operator() { | 807 void test_visitMethodDeclaration_operator() { |
| 1266 _assertClone(AstFactory.methodDeclaration2( | 808 _assertCloneUnitMember('class C { operator+() {} }'); |
| 1267 null, | |
| 1268 null, | |
| 1269 null, | |
| 1270 Keyword.OPERATOR, | |
| 1271 AstFactory.identifier3("+"), | |
| 1272 AstFactory.formalParameterList(), | |
| 1273 AstFactory.blockFunctionBody2())); | |
| 1274 } | 809 } |
| 1275 | 810 |
| 1276 void test_visitMethodDeclaration_operator_returnType() { | 811 void test_visitMethodDeclaration_operator_returnType() { |
| 1277 _assertClone(AstFactory.methodDeclaration2( | 812 _assertCloneUnitMember('class C { T operator+() {} }'); |
| 1278 null, | |
| 1279 AstFactory.typeName4("T"), | |
| 1280 null, | |
| 1281 Keyword.OPERATOR, | |
| 1282 AstFactory.identifier3("+"), | |
| 1283 AstFactory.formalParameterList(), | |
| 1284 AstFactory.blockFunctionBody2())); | |
| 1285 } | 813 } |
| 1286 | 814 |
| 1287 void test_visitMethodDeclaration_returnType() { | 815 void test_visitMethodDeclaration_returnType() { |
| 1288 _assertClone(AstFactory.methodDeclaration2( | 816 _assertCloneUnitMember('class C { T m() {} }'); |
| 1289 null, | |
| 1290 AstFactory.typeName4("T"), | |
| 1291 null, | |
| 1292 null, | |
| 1293 AstFactory.identifier3("m"), | |
| 1294 AstFactory.formalParameterList(), | |
| 1295 AstFactory.blockFunctionBody2())); | |
| 1296 } | 817 } |
| 1297 | 818 |
| 1298 void test_visitMethodDeclaration_setter() { | 819 void test_visitMethodDeclaration_setter() { |
| 1299 _assertClone(AstFactory.methodDeclaration2( | 820 _assertCloneUnitMember('class C { set m(var v) {} }'); |
| 1300 null, | 821 } |
| 1301 null, | 822 |
| 1302 Keyword.SET, | 823 void test_visitMethodDeclaration_setter_returnType() { |
| 1303 null, | 824 _assertCloneUnitMember('class C { T set m(v) {} }'); |
| 1304 AstFactory.identifier3("m"), | |
| 1305 AstFactory.formalParameterList( | |
| 1306 [AstFactory.simpleFormalParameter(Keyword.VAR, "v")]), | |
| 1307 AstFactory.blockFunctionBody2())); | |
| 1308 } | 825 } |
| 1309 | 826 |
| 1310 void test_visitMethodDeclaration_static() { | 827 void test_visitMethodDeclaration_static() { |
| 1311 _assertClone(AstFactory.methodDeclaration2( | 828 _assertCloneUnitMember('class C { static m() {} }'); |
| 1312 Keyword.STATIC, | |
| 1313 null, | |
| 1314 null, | |
| 1315 null, | |
| 1316 AstFactory.identifier3("m"), | |
| 1317 AstFactory.formalParameterList(), | |
| 1318 AstFactory.blockFunctionBody2())); | |
| 1319 } | 829 } |
| 1320 | 830 |
| 1321 void test_visitMethodDeclaration_static_returnType() { | 831 void test_visitMethodDeclaration_static_returnType() { |
| 1322 _assertClone(AstFactory.methodDeclaration2( | 832 _assertCloneUnitMember('class C { static T m() {} }'); |
| 1323 Keyword.STATIC, | |
| 1324 AstFactory.typeName4("T"), | |
| 1325 null, | |
| 1326 null, | |
| 1327 AstFactory.identifier3("m"), | |
| 1328 AstFactory.formalParameterList(), | |
| 1329 AstFactory.blockFunctionBody2())); | |
| 1330 } | 833 } |
| 1331 | 834 |
| 1332 void test_visitMethodDeclaration_withMetadata() { | 835 void test_visitMethodDeclaration_withMetadata() { |
| 1333 MethodDeclaration declaration = AstFactory.methodDeclaration2( | 836 _assertCloneUnitMember('class C { @deprecated m() {} }'); |
| 1334 null, | |
| 1335 null, | |
| 1336 null, | |
| 1337 null, | |
| 1338 AstFactory.identifier3("m"), | |
| 1339 AstFactory.formalParameterList(), | |
| 1340 AstFactory.blockFunctionBody2()); | |
| 1341 declaration.metadata | |
| 1342 .add(AstFactory.annotation(AstFactory.identifier3("deprecated"))); | |
| 1343 _assertClone(declaration); | |
| 1344 } | 837 } |
| 1345 | 838 |
| 1346 void test_visitMethodInvocation_noTarget() { | 839 void test_visitMethodInvocation_noTarget() { |
| 1347 _assertClone(AstFactory.methodInvocation2("m")); | 840 _assertCloneExpression('m()'); |
| 1348 } | 841 } |
| 1349 | 842 |
| 1350 void test_visitMethodInvocation_target() { | 843 void test_visitMethodInvocation_target() { |
| 1351 _assertClone(AstFactory.methodInvocation(AstFactory.identifier3("t"), "m")); | 844 _assertCloneExpression('t.m()'); |
| 1352 } | 845 } |
| 1353 | 846 |
| 1354 void test_visitNamedExpression() { | 847 void test_visitNamedExpression() { |
| 1355 _assertClone(AstFactory.namedExpression2("a", AstFactory.identifier3("b"))); | 848 _assertCloneExpression('m(a: b)'); |
| 1356 } | |
| 1357 | |
| 1358 void test_visitNamedFormalParameter() { | |
| 1359 _assertClone(AstFactory.namedFormalParameter( | |
| 1360 AstFactory.simpleFormalParameter(Keyword.VAR, "a"), | |
| 1361 AstFactory.integer(0))); | |
| 1362 } | 849 } |
| 1363 | 850 |
| 1364 void test_visitNativeClause() { | 851 void test_visitNativeClause() { |
| 1365 _assertClone(AstFactory.nativeClause("code")); | 852 _assertCloneUnitMember('f() native "code";'); |
| 1366 } | 853 } |
| 1367 | 854 |
| 1368 void test_visitNativeFunctionBody() { | 855 void test_visitNativeFunctionBody() { |
| 1369 _assertClone(AstFactory.nativeFunctionBody("str")); | 856 _assertCloneUnitMember('f() native "str";'); |
| 1370 } | 857 } |
| 1371 | 858 |
| 1372 void test_visitNullLiteral() { | 859 void test_visitNullLiteral() { |
| 1373 _assertClone(AstFactory.nullLiteral()); | 860 _assertCloneExpression('null'); |
| 1374 } | 861 } |
| 1375 | 862 |
| 1376 void test_visitParenthesizedExpression() { | 863 void test_visitParenthesizedExpression() { |
| 1377 _assertClone( | 864 _assertCloneExpression('(a)'); |
| 1378 AstFactory.parenthesizedExpression(AstFactory.identifier3("a"))); | |
| 1379 } | 865 } |
| 1380 | 866 |
| 1381 void test_visitPartDirective() { | 867 void test_visitPartDirective() { |
| 1382 _assertClone(AstFactory.partDirective2("a.dart")); | 868 _assertCloneUnit('part "a.dart";'); |
| 1383 } | 869 } |
| 1384 | 870 |
| 1385 void test_visitPartDirective_withMetadata() { | 871 void test_visitPartDirective_withMetadata() { |
| 1386 PartDirective directive = AstFactory.partDirective2("a.dart"); | 872 _assertCloneUnit('@deprecated part "a.dart";'); |
| 1387 directive.metadata | |
| 1388 .add(AstFactory.annotation(AstFactory.identifier3("deprecated"))); | |
| 1389 _assertClone(directive); | |
| 1390 } | 873 } |
| 1391 | 874 |
| 1392 void test_visitPartOfDirective() { | 875 void test_visitPartOfDirective() { |
| 1393 _assertClone( | 876 _assertCloneUnit('part of l;'); |
| 1394 AstFactory.partOfDirective(AstFactory.libraryIdentifier2(["l"]))); | |
| 1395 } | 877 } |
| 1396 | 878 |
| 1397 void test_visitPartOfDirective_withMetadata() { | 879 void test_visitPartOfDirective_withMetadata() { |
| 1398 PartOfDirective directive = | 880 _assertCloneUnit('@deprecated part of l;'); |
| 1399 AstFactory.partOfDirective(AstFactory.libraryIdentifier2(["l"])); | |
| 1400 directive.metadata | |
| 1401 .add(AstFactory.annotation(AstFactory.identifier3("deprecated"))); | |
| 1402 _assertClone(directive); | |
| 1403 } | 881 } |
| 1404 | 882 |
| 1405 void test_visitPositionalFormalParameter() { | 883 void test_visitPositionalFormalParameter() { |
| 1406 _assertClone(AstFactory.positionalFormalParameter( | 884 _assertCloneUnitMember('main([var p = 0]) {}'); |
| 1407 AstFactory.simpleFormalParameter(Keyword.VAR, "a"), | |
| 1408 AstFactory.integer(0))); | |
| 1409 } | 885 } |
| 1410 | 886 |
| 1411 void test_visitPostfixExpression() { | 887 void test_visitPostfixExpression() { |
| 1412 _assertClone(AstFactory.postfixExpression( | 888 _assertCloneExpression('a++'); |
| 1413 AstFactory.identifier3("a"), TokenType.PLUS_PLUS)); | |
| 1414 } | 889 } |
| 1415 | 890 |
| 1416 void test_visitPrefixedIdentifier() { | 891 void test_visitPrefixedIdentifier() { |
| 1417 _assertClone(AstFactory.identifier5("a", "b")); | 892 _assertCloneExpression('a.b'); |
| 1418 } | 893 } |
| 1419 | 894 |
| 1420 void test_visitPrefixExpression() { | 895 void test_visitPrefixExpression() { |
| 1421 _assertClone(AstFactory.prefixExpression( | 896 _assertCloneExpression('-a'); |
| 1422 TokenType.MINUS, AstFactory.identifier3("a"))); | |
| 1423 } | 897 } |
| 1424 | 898 |
| 1425 void test_visitPropertyAccess() { | 899 void test_visitPropertyAccess() { |
| 1426 _assertClone(AstFactory.propertyAccess2(AstFactory.identifier3("a"), "b")); | 900 _assertCloneExpression('a.b.c'); |
| 1427 } | 901 } |
| 1428 | 902 |
| 1429 void test_visitRedirectingConstructorInvocation_named() { | 903 void test_visitRedirectingConstructorInvocation_named() { |
| 1430 _assertClone(AstFactory.redirectingConstructorInvocation2("c")); | 904 _assertCloneUnitMember('class A { factory A() = B.b; }'); |
| 1431 } | 905 } |
| 1432 | 906 |
| 1433 void test_visitRedirectingConstructorInvocation_unnamed() { | 907 void test_visitRedirectingConstructorInvocation_unnamed() { |
| 1434 _assertClone(AstFactory.redirectingConstructorInvocation()); | 908 _assertCloneUnitMember('class A { factory A() = B; }'); |
| 1435 } | 909 } |
| 1436 | 910 |
| 1437 void test_visitRethrowExpression() { | 911 void test_visitRethrowExpression() { |
| 1438 _assertClone(AstFactory.rethrowExpression()); | 912 _assertCloneExpression('rethrow'); |
| 1439 } | 913 } |
| 1440 | 914 |
| 1441 void test_visitReturnStatement_expression() { | 915 void test_visitReturnStatement_expression() { |
| 1442 _assertClone(AstFactory.returnStatement2(AstFactory.identifier3("a"))); | 916 _assertCloneStatement('return a;'); |
| 1443 } | 917 } |
| 1444 | 918 |
| 1445 void test_visitReturnStatement_noExpression() { | 919 void test_visitReturnStatement_noExpression() { |
| 1446 _assertClone(AstFactory.returnStatement()); | 920 _assertCloneStatement('return;'); |
| 1447 } | 921 } |
| 1448 | 922 |
| 1449 void test_visitScriptTag() { | 923 void test_visitScriptTag() { |
| 1450 String scriptTag = "!#/bin/dart.exe"; | 924 _assertCloneUnit('#!/bin/dart.exe'); |
| 1451 _assertClone(AstFactory.scriptTag(scriptTag)); | |
| 1452 } | 925 } |
| 1453 | 926 |
| 1454 void test_visitSimpleFormalParameter_keyword() { | 927 void test_visitSimpleFormalParameter_keyword() { |
| 1455 _assertClone(AstFactory.simpleFormalParameter(Keyword.VAR, "a")); | 928 _assertCloneUnitMember('main(var a) {}'); |
| 1456 } | 929 } |
| 1457 | 930 |
| 1458 void test_visitSimpleFormalParameter_keyword_type() { | 931 void test_visitSimpleFormalParameter_keyword_type() { |
| 1459 _assertClone(AstFactory.simpleFormalParameter2( | 932 _assertCloneUnitMember('main(final A a) {}'); |
| 1460 Keyword.FINAL, AstFactory.typeName4("A"), "a")); | |
| 1461 } | 933 } |
| 1462 | 934 |
| 1463 void test_visitSimpleFormalParameter_type() { | 935 void test_visitSimpleFormalParameter_type() { |
| 1464 _assertClone( | 936 _assertCloneUnitMember('main(A a) {}'); |
| 1465 AstFactory.simpleFormalParameter4(AstFactory.typeName4("A"), "a")); | |
| 1466 } | 937 } |
| 1467 | 938 |
| 1468 void test_visitSimpleIdentifier() { | 939 void test_visitSimpleIdentifier() { |
| 1469 _assertClone(AstFactory.identifier3("a")); | 940 _assertCloneExpression('a'); |
| 1470 } | 941 } |
| 1471 | 942 |
| 1472 void test_visitSimpleStringLiteral() { | 943 void test_visitSimpleStringLiteral() { |
| 1473 _assertClone(AstFactory.string2("a")); | 944 _assertCloneExpression("'a'"); |
| 1474 } | 945 } |
| 1475 | 946 |
| 1476 void test_visitStringInterpolation() { | 947 void test_visitStringInterpolation() { |
| 1477 _assertClone(AstFactory.string([ | 948 _assertCloneExpression(r"'a${e}b'"); |
| 1478 AstFactory.interpolationString("'a", "a"), | |
| 1479 AstFactory.interpolationExpression(AstFactory.identifier3("e")), | |
| 1480 AstFactory.interpolationString("b'", "b") | |
| 1481 ])); | |
| 1482 } | 949 } |
| 1483 | 950 |
| 1484 void test_visitSuperConstructorInvocation() { | 951 void test_visitSuperConstructorInvocation() { |
| 1485 _assertClone(AstFactory.superConstructorInvocation()); | 952 _assertCloneUnitMember('class C { C() : super(); }'); |
| 1486 } | 953 } |
| 1487 | 954 |
| 1488 void test_visitSuperConstructorInvocation_named() { | 955 void test_visitSuperConstructorInvocation_named() { |
| 1489 _assertClone(AstFactory.superConstructorInvocation2("c")); | 956 _assertCloneUnitMember('class C { C() : super.c(); }'); |
| 1490 } | 957 } |
| 1491 | 958 |
| 1492 void test_visitSuperExpression() { | 959 void test_visitSuperExpression() { |
| 1493 _assertClone(AstFactory.superExpression()); | 960 _assertCloneUnitMember('class C { m() { super.m(); } }'); |
| 1494 } | 961 } |
| 1495 | 962 |
| 1496 void test_visitSwitchCase_multipleLabels() { | 963 void test_visitSwitchCase_multipleLabels() { |
| 1497 _assertClone(AstFactory.switchCase2( | 964 _assertCloneStatement('switch (v) {l1: l2: case a: {} }'); |
| 1498 [AstFactory.label2("l1"), AstFactory.label2("l2")], | |
| 1499 AstFactory.identifier3("a"), | |
| 1500 [AstFactory.block()])); | |
| 1501 } | 965 } |
| 1502 | 966 |
| 1503 void test_visitSwitchCase_multipleStatements() { | 967 void test_visitSwitchCase_multipleStatements() { |
| 1504 _assertClone(AstFactory.switchCase( | 968 _assertCloneStatement('switch (v) { case a: {} {} }'); |
| 1505 AstFactory.identifier3("a"), [AstFactory.block(), AstFactory.block()])); | |
| 1506 } | 969 } |
| 1507 | 970 |
| 1508 void test_visitSwitchCase_noLabels() { | 971 void test_visitSwitchCase_noLabels() { |
| 1509 _assertClone(AstFactory.switchCase( | 972 _assertCloneStatement('switch (v) { case a: {} }'); |
| 1510 AstFactory.identifier3("a"), [AstFactory.block()])); | |
| 1511 } | 973 } |
| 1512 | 974 |
| 1513 void test_visitSwitchCase_singleLabel() { | 975 void test_visitSwitchCase_singleLabel() { |
| 1514 _assertClone(AstFactory.switchCase2([AstFactory.label2("l1")], | 976 _assertCloneStatement('switch (v) { l1: case a: {} }'); |
| 1515 AstFactory.identifier3("a"), [AstFactory.block()])); | |
| 1516 } | 977 } |
| 1517 | 978 |
| 1518 void test_visitSwitchDefault_multipleLabels() { | 979 void test_visitSwitchDefault_multipleLabels() { |
| 1519 _assertClone(AstFactory.switchDefault( | 980 _assertCloneStatement('switch (v) { l1: l2: default: {} }'); |
| 1520 [AstFactory.label2("l1"), AstFactory.label2("l2")], | |
| 1521 [AstFactory.block()])); | |
| 1522 } | 981 } |
| 1523 | 982 |
| 1524 void test_visitSwitchDefault_multipleStatements() { | 983 void test_visitSwitchDefault_multipleStatements() { |
| 1525 _assertClone( | 984 _assertCloneStatement('switch (v) { default: {} {} }'); |
| 1526 AstFactory.switchDefault2([AstFactory.block(), AstFactory.block()])); | |
| 1527 } | 985 } |
| 1528 | 986 |
| 1529 void test_visitSwitchDefault_noLabels() { | 987 void test_visitSwitchDefault_noLabels() { |
| 1530 _assertClone(AstFactory.switchDefault2([AstFactory.block()])); | 988 _assertCloneStatement('switch (v) { default: {} }'); |
| 1531 } | 989 } |
| 1532 | 990 |
| 1533 void test_visitSwitchDefault_singleLabel() { | 991 void test_visitSwitchDefault_singleLabel() { |
| 1534 _assertClone(AstFactory.switchDefault( | 992 _assertCloneStatement('switch (v) { l1: default: {} }'); |
| 1535 [AstFactory.label2("l1")], [AstFactory.block()])); | |
| 1536 } | 993 } |
| 1537 | 994 |
| 1538 void test_visitSwitchStatement() { | 995 void test_visitSwitchStatement() { |
| 1539 _assertClone(AstFactory.switchStatement(AstFactory.identifier3("a"), [ | 996 _assertCloneStatement('switch (a) { case b: {} default: {} }'); |
| 1540 AstFactory.switchCase(AstFactory.string2("b"), [AstFactory.block()]), | |
| 1541 AstFactory.switchDefault2([AstFactory.block()]) | |
| 1542 ])); | |
| 1543 } | 997 } |
| 1544 | 998 |
| 1545 void test_visitSymbolLiteral_multiple() { | 999 void test_visitSymbolLiteral_multiple() { |
| 1546 _assertClone(AstFactory.symbolLiteral(["a", "b", "c"])); | 1000 _assertCloneExpression('#a.b.c'); |
| 1547 } | 1001 } |
| 1548 | 1002 |
| 1549 void test_visitSymbolLiteral_single() { | 1003 void test_visitSymbolLiteral_single() { |
| 1550 _assertClone(AstFactory.symbolLiteral(["a"])); | 1004 _assertCloneExpression('#a'); |
| 1551 } | 1005 } |
| 1552 | 1006 |
| 1553 void test_visitThisExpression() { | 1007 void test_visitThisExpression() { |
| 1554 _assertClone(AstFactory.thisExpression()); | 1008 _assertCloneExpression('this'); |
| 1555 } | 1009 } |
| 1556 | 1010 |
| 1557 void test_visitThrowStatement() { | 1011 void test_visitThrowStatement() { |
| 1558 _assertClone(AstFactory.throwExpression2(AstFactory.identifier3("e"))); | 1012 _assertCloneStatement('throw e;'); |
| 1559 } | 1013 } |
| 1560 | 1014 |
| 1561 void test_visitTopLevelVariableDeclaration_multiple() { | 1015 void test_visitTopLevelVariableDeclaration_multiple() { |
| 1562 _assertClone(AstFactory.topLevelVariableDeclaration2( | 1016 _assertCloneUnitMember('var a;'); |
| 1563 Keyword.VAR, [AstFactory.variableDeclaration("a")])); | |
| 1564 } | 1017 } |
| 1565 | 1018 |
| 1566 void test_visitTopLevelVariableDeclaration_single() { | 1019 void test_visitTopLevelVariableDeclaration_single() { |
| 1567 _assertClone(AstFactory.topLevelVariableDeclaration2(Keyword.VAR, [ | 1020 _assertCloneUnitMember('var a, b;'); |
| 1568 AstFactory.variableDeclaration("a"), | |
| 1569 AstFactory.variableDeclaration("b") | |
| 1570 ])); | |
| 1571 } | 1021 } |
| 1572 | 1022 |
| 1573 void test_visitTryStatement_catch() { | 1023 void test_visitTryStatement_catch() { |
| 1574 _assertClone(AstFactory.tryStatement2(AstFactory.block(), | 1024 _assertCloneStatement('try {} on E {}'); |
| 1575 [AstFactory.catchClause3(AstFactory.typeName4("E"))])); | |
| 1576 } | 1025 } |
| 1577 | 1026 |
| 1578 void test_visitTryStatement_catches() { | 1027 void test_visitTryStatement_catches() { |
| 1579 _assertClone(AstFactory.tryStatement2(AstFactory.block(), [ | 1028 _assertCloneStatement('try {} on E {} on F {}'); |
| 1580 AstFactory.catchClause3(AstFactory.typeName4("E")), | |
| 1581 AstFactory.catchClause3(AstFactory.typeName4("F")) | |
| 1582 ])); | |
| 1583 } | 1029 } |
| 1584 | 1030 |
| 1585 void test_visitTryStatement_catchFinally() { | 1031 void test_visitTryStatement_catchFinally() { |
| 1586 _assertClone(AstFactory.tryStatement3( | 1032 _assertCloneStatement('try {} on E {} finally {}'); |
| 1587 AstFactory.block(), | |
| 1588 [AstFactory.catchClause3(AstFactory.typeName4("E"))], | |
| 1589 AstFactory.block())); | |
| 1590 } | 1033 } |
| 1591 | 1034 |
| 1592 void test_visitTryStatement_finally() { | 1035 void test_visitTryStatement_finally() { |
| 1593 _assertClone( | 1036 _assertCloneStatement('try {} finally {}'); |
| 1594 AstFactory.tryStatement(AstFactory.block(), AstFactory.block())); | |
| 1595 } | |
| 1596 | |
| 1597 void test_visitTypeArgumentList_multiple() { | |
| 1598 _assertClone(AstFactory.typeArgumentList( | |
| 1599 [AstFactory.typeName4("E"), AstFactory.typeName4("F")])); | |
| 1600 } | |
| 1601 | |
| 1602 void test_visitTypeArgumentList_single() { | |
| 1603 _assertClone(AstFactory.typeArgumentList([AstFactory.typeName4("E")])); | |
| 1604 } | 1037 } |
| 1605 | 1038 |
| 1606 void test_visitTypeName_multipleArgs() { | 1039 void test_visitTypeName_multipleArgs() { |
| 1607 _assertClone(AstFactory.typeName4( | 1040 _assertCloneExpression('new C<D, E>()'); |
| 1608 "C", [AstFactory.typeName4("D"), AstFactory.typeName4("E")])); | |
| 1609 } | 1041 } |
| 1610 | 1042 |
| 1611 void test_visitTypeName_nestedArg() { | 1043 void test_visitTypeName_nestedArg() { |
| 1612 _assertClone(AstFactory.typeName4("C", [ | 1044 _assertCloneExpression('new C<D<E>>()'); |
| 1613 AstFactory.typeName4("D", [AstFactory.typeName4("E")]) | |
| 1614 ])); | |
| 1615 } | 1045 } |
| 1616 | 1046 |
| 1617 void test_visitTypeName_noArgs() { | 1047 void test_visitTypeName_noArgs() { |
| 1618 _assertClone(AstFactory.typeName4("C")); | 1048 _assertCloneExpression('new C()'); |
| 1619 } | 1049 } |
| 1620 | 1050 |
| 1621 void test_visitTypeName_singleArg() { | 1051 void test_visitTypeName_singleArg() { |
| 1622 _assertClone(AstFactory.typeName4("C", [AstFactory.typeName4("D")])); | 1052 _assertCloneExpression('new C<D>()'); |
| 1623 } | 1053 } |
| 1624 | 1054 |
| 1625 void test_visitTypeParameter_withExtends() { | 1055 void test_visitTypeParameter_withExtends() { |
| 1626 _assertClone(AstFactory.typeParameter2("E", AstFactory.typeName4("C"))); | 1056 _assertCloneUnitMember('class A<E extends C> {}'); |
| 1627 } | 1057 } |
| 1628 | 1058 |
| 1629 void test_visitTypeParameter_withMetadata() { | 1059 void test_visitTypeParameter_withMetadata() { |
| 1630 TypeParameter parameter = AstFactory.typeParameter("E"); | 1060 _assertCloneUnitMember('class A<@deprecated E> {}'); |
| 1631 parameter.metadata | |
| 1632 .add(AstFactory.annotation(AstFactory.identifier3("deprecated"))); | |
| 1633 _assertClone(parameter); | |
| 1634 } | 1061 } |
| 1635 | 1062 |
| 1636 void test_visitTypeParameter_withoutExtends() { | 1063 void test_visitTypeParameter_withoutExtends() { |
| 1637 _assertClone(AstFactory.typeParameter("E")); | 1064 _assertCloneUnitMember('class A<E> {}'); |
| 1638 } | 1065 } |
| 1639 | 1066 |
| 1640 void test_visitTypeParameterList_multiple() { | 1067 void test_visitTypeParameterList_multiple() { |
| 1641 _assertClone(AstFactory.typeParameterList(["E", "F"])); | 1068 _assertCloneUnitMember('class A<E, F> {}'); |
| 1642 } | 1069 } |
| 1643 | 1070 |
| 1644 void test_visitTypeParameterList_single() { | 1071 void test_visitTypeParameterList_single() { |
| 1645 _assertClone(AstFactory.typeParameterList(["E"])); | 1072 _assertCloneUnitMember('class A<E> {}'); |
| 1646 } | 1073 } |
| 1647 | 1074 |
| 1648 void test_visitVariableDeclaration_initialized() { | 1075 void test_visitVariableDeclaration_initialized() { |
| 1649 _assertClone( | 1076 _assertCloneStatement('var a = b;'); |
| 1650 AstFactory.variableDeclaration2("a", AstFactory.identifier3("b"))); | |
| 1651 } | 1077 } |
| 1652 | 1078 |
| 1653 void test_visitVariableDeclaration_uninitialized() { | 1079 void test_visitVariableDeclaration_uninitialized() { |
| 1654 _assertClone(AstFactory.variableDeclaration("a")); | 1080 _assertCloneStatement('var a;'); |
| 1655 } | 1081 } |
| 1656 | 1082 |
| 1657 void test_visitVariableDeclarationList_const_type() { | 1083 void test_visitVariableDeclarationList_const_type() { |
| 1658 _assertClone(AstFactory.variableDeclarationList( | 1084 _assertCloneStatement('const C a, b;'); |
| 1659 Keyword.CONST, AstFactory.typeName4("C"), [ | |
| 1660 AstFactory.variableDeclaration("a"), | |
| 1661 AstFactory.variableDeclaration("b") | |
| 1662 ])); | |
| 1663 } | 1085 } |
| 1664 | 1086 |
| 1665 void test_visitVariableDeclarationList_final_noType() { | 1087 void test_visitVariableDeclarationList_final_noType() { |
| 1666 _assertClone(AstFactory.variableDeclarationList2(Keyword.FINAL, [ | 1088 _assertCloneStatement('final a, b;'); |
| 1667 AstFactory.variableDeclaration("a"), | |
| 1668 AstFactory.variableDeclaration("b") | |
| 1669 ])); | |
| 1670 } | 1089 } |
| 1671 | 1090 |
| 1672 void test_visitVariableDeclarationList_final_withMetadata() { | 1091 void test_visitVariableDeclarationList_final_withMetadata() { |
| 1673 VariableDeclarationList declarationList = AstFactory | 1092 _assertCloneStatement('@deprecated final a, b;'); |
| 1674 .variableDeclarationList2(Keyword.FINAL, [ | |
| 1675 AstFactory.variableDeclaration("a"), | |
| 1676 AstFactory.variableDeclaration("b") | |
| 1677 ]); | |
| 1678 declarationList.metadata | |
| 1679 .add(AstFactory.annotation(AstFactory.identifier3("deprecated"))); | |
| 1680 _assertClone(declarationList); | |
| 1681 } | 1093 } |
| 1682 | 1094 |
| 1683 void test_visitVariableDeclarationList_type() { | 1095 void test_visitVariableDeclarationList_type() { |
| 1684 _assertClone(AstFactory.variableDeclarationList( | 1096 _assertCloneStatement('C a, b;'); |
| 1685 null, AstFactory.typeName4("C"), [ | |
| 1686 AstFactory.variableDeclaration("a"), | |
| 1687 AstFactory.variableDeclaration("b") | |
| 1688 ])); | |
| 1689 } | 1097 } |
| 1690 | 1098 |
| 1691 void test_visitVariableDeclarationList_var() { | 1099 void test_visitVariableDeclarationList_var() { |
| 1692 _assertClone(AstFactory.variableDeclarationList2(Keyword.VAR, [ | 1100 _assertCloneStatement('var a, b;'); |
| 1693 AstFactory.variableDeclaration("a"), | |
| 1694 AstFactory.variableDeclaration("b") | |
| 1695 ])); | |
| 1696 } | 1101 } |
| 1697 | 1102 |
| 1698 void test_visitVariableDeclarationStatement() { | 1103 void test_visitVariableDeclarationStatement() { |
| 1699 _assertClone(AstFactory.variableDeclarationStatement(null, | 1104 _assertCloneStatement('C c;'); |
| 1700 AstFactory.typeName4("C"), [AstFactory.variableDeclaration("c")])); | |
| 1701 } | 1105 } |
| 1702 | 1106 |
| 1703 void test_visitWhileStatement() { | 1107 void test_visitWhileStatement() { |
| 1704 _assertClone(AstFactory.whileStatement( | 1108 _assertCloneStatement('while (c) {}'); |
| 1705 AstFactory.identifier3("c"), AstFactory.block())); | |
| 1706 } | 1109 } |
| 1707 | 1110 |
| 1708 void test_visitWithClause_multiple() { | 1111 void test_visitWithClause_multiple() { |
| 1709 _assertClone(AstFactory.withClause([ | 1112 _assertCloneUnitMember('class X extends Y with A, B, C {}'); |
| 1710 AstFactory.typeName4("A"), | |
| 1711 AstFactory.typeName4("B"), | |
| 1712 AstFactory.typeName4("C") | |
| 1713 ])); | |
| 1714 } | 1113 } |
| 1715 | 1114 |
| 1716 void test_visitWithClause_single() { | 1115 void test_visitWithClause_single() { |
| 1717 _assertClone(AstFactory.withClause([AstFactory.typeName4("A")])); | 1116 _assertCloneUnitMember('class X extends Y with A {}'); |
| 1718 } | 1117 } |
| 1719 | 1118 |
| 1720 void test_visitYieldStatement() { | 1119 void test_visitYieldStatement() { |
| 1721 _assertClone(AstFactory.yieldStatement(AstFactory.identifier3("A"))); | 1120 _assertCloneUnitMember('main() async* { yield 42; }'); |
| 1722 } | 1121 } |
| 1723 | 1122 |
| 1724 /** | 1123 /** |
| 1725 * Assert that an `AstCloner` will produce the expected AST structure when | 1124 * Assert that an `AstCloner` will produce the expected AST structure when |
| 1726 * visiting the given [node]. | 1125 * visiting the given [node]. |
| 1727 * | 1126 * |
| 1728 * @param node the AST node being visited to produce the cloned structure | 1127 * @param node the AST node being visited to produce the cloned structure |
| 1729 * @throws AFE if the visitor does not produce the expected source for the giv
en node | 1128 * @throws AFE if the visitor does not produce the expected source for the giv
en node |
| 1730 */ | 1129 */ |
| 1731 void _assertClone(AstNode node) { | 1130 void _assertClone(AstNode node) { |
| 1732 AstNode clone = node.accept(new AstCloner()); | 1131 { |
| 1733 AstCloneComparator comparitor = new AstCloneComparator(false); | 1132 AstNode clone = node.accept(new AstCloner()); |
| 1734 if (!comparitor.isEqualNodes(node, clone)) { | 1133 AstCloneComparator comparator = new AstCloneComparator(false); |
| 1735 fail("Failed to clone ${node.runtimeType.toString()}"); | 1134 if (!comparator.isEqualNodes(node, clone)) { |
| 1135 fail("Failed to clone ${node.runtimeType.toString()}"); |
| 1136 } |
| 1137 _assertEqualTokens(clone, node); |
| 1736 } | 1138 } |
| 1139 { |
| 1140 AstNode clone = node.accept(new AstCloner(true)); |
| 1141 AstCloneComparator comparator = new AstCloneComparator(true); |
| 1142 if (!comparator.isEqualNodes(node, clone)) { |
| 1143 fail("Failed to clone ${node.runtimeType.toString()}"); |
| 1144 } |
| 1145 _assertEqualTokens(clone, node); |
| 1146 } |
| 1147 } |
| 1737 | 1148 |
| 1738 clone = node.accept(new AstCloner(true)); | 1149 void _assertCloneExpression(String code) { |
| 1739 comparitor = new AstCloneComparator(true); | 1150 AstNode node = _parseExpression(code); |
| 1740 if (!comparitor.isEqualNodes(node, clone)) { | 1151 _assertClone(node); |
| 1741 fail("Failed to clone ${node.runtimeType.toString()}"); | 1152 } |
| 1153 |
| 1154 void _assertCloneStatement(String code) { |
| 1155 AstNode node = _parseStatement(code); |
| 1156 _assertClone(node); |
| 1157 } |
| 1158 |
| 1159 void _assertCloneUnit(String code) { |
| 1160 AstNode node = _parseUnit(code); |
| 1161 _assertClone(node); |
| 1162 } |
| 1163 |
| 1164 void _assertCloneUnitMember(String code) { |
| 1165 AstNode node = _parseUnitMember(code); |
| 1166 _assertClone(node); |
| 1167 } |
| 1168 |
| 1169 Expression _parseExpression(String code) { |
| 1170 CompilationUnit unit = _parseUnit('var v = $code;'); |
| 1171 TopLevelVariableDeclaration decl = unit.declarations.single; |
| 1172 return decl.variables.variables.single.initializer; |
| 1173 } |
| 1174 |
| 1175 Statement _parseStatement(String code) { |
| 1176 CompilationUnit unit = _parseUnit('main() { $code }'); |
| 1177 FunctionDeclaration main = unit.declarations.single; |
| 1178 BlockFunctionBody body = main.functionExpression.body; |
| 1179 return body.block.statements.single; |
| 1180 } |
| 1181 |
| 1182 CompilationUnit _parseUnit(String code) { |
| 1183 GatheringErrorListener listener = new GatheringErrorListener(); |
| 1184 CharSequenceReader reader = new CharSequenceReader(code); |
| 1185 Scanner scanner = new Scanner(null, reader, listener); |
| 1186 Token token = scanner.tokenize(); |
| 1187 Parser parser = new Parser(null, listener); |
| 1188 CompilationUnit unit = parser.parseCompilationUnit(token); |
| 1189 expect(unit, isNotNull); |
| 1190 listener.assertNoErrors(); |
| 1191 return unit; |
| 1192 } |
| 1193 |
| 1194 CompilationUnitMember _parseUnitMember(String code) { |
| 1195 CompilationUnit unit = _parseUnit(code); |
| 1196 return unit.declarations.single; |
| 1197 } |
| 1198 |
| 1199 static void _assertEqualToken(Token clone, Token original) { |
| 1200 expect(clone.type, original.type); |
| 1201 expect(clone.offset, original.offset); |
| 1202 expect(clone.length, original.length); |
| 1203 expect(clone.lexeme, original.lexeme); |
| 1204 } |
| 1205 |
| 1206 static void _assertEqualTokens(AstNode cloneNode, AstNode originalNode) { |
| 1207 Token clone = cloneNode.beginToken; |
| 1208 Token original = originalNode.beginToken; |
| 1209 if (original is! CommentToken) { |
| 1210 _assertHasPrevious(original); |
| 1211 _assertHasPrevious(clone); |
| 1212 } |
| 1213 Token stopOriginalToken = originalNode.endToken.next; |
| 1214 Token skipCloneComment = null; |
| 1215 Token skipOriginalComment = null; |
| 1216 while (original != stopOriginalToken) { |
| 1217 expect(clone, isNotNull); |
| 1218 _assertEqualToken(clone, original); |
| 1219 // comments |
| 1220 { |
| 1221 Token cloneComment = clone.precedingComments; |
| 1222 Token originalComment = original.precedingComments; |
| 1223 if (cloneComment != skipCloneComment && |
| 1224 originalComment != skipOriginalComment) { |
| 1225 while (true) { |
| 1226 if (originalComment == null) { |
| 1227 expect(cloneComment, isNull); |
| 1228 break; |
| 1229 } |
| 1230 expect(cloneComment, isNotNull); |
| 1231 _assertEqualToken(cloneComment, originalComment); |
| 1232 cloneComment = cloneComment.next; |
| 1233 originalComment = originalComment.next; |
| 1234 } |
| 1235 } |
| 1236 } |
| 1237 // next tokens |
| 1238 if (original is CommentToken) { |
| 1239 expect(clone, new isInstanceOf<CommentToken>()); |
| 1240 skipOriginalComment = original; |
| 1241 skipCloneComment = clone; |
| 1242 original = (original as CommentToken).parent; |
| 1243 clone = (clone as CommentToken).parent; |
| 1244 } else { |
| 1245 clone = clone.next; |
| 1246 original = original.next; |
| 1247 } |
| 1248 } |
| 1249 } |
| 1250 |
| 1251 /** |
| 1252 * Assert that the [token] has `previous` set, and if it `EOF`, then it |
| 1253 * points itself. |
| 1254 */ |
| 1255 static void _assertHasPrevious(Token token) { |
| 1256 expect(token, isNotNull); |
| 1257 if (token.type == TokenType.EOF) { |
| 1258 return; |
| 1259 } |
| 1260 while (token != null) { |
| 1261 Token previous = token.previous; |
| 1262 expect(previous, isNotNull); |
| 1263 if (token.type == TokenType.EOF) { |
| 1264 expect(previous, same(token)); |
| 1265 break; |
| 1266 } |
| 1267 token = previous; |
| 1742 } | 1268 } |
| 1743 } | 1269 } |
| 1744 } | 1270 } |
| 1745 | 1271 |
| 1746 @reflectiveTest | 1272 @reflectiveTest |
| 1747 class BooleanArrayTest { | 1273 class BooleanArrayTest { |
| 1748 void test_get_negative() { | 1274 void test_get_negative() { |
| 1749 try { | 1275 try { |
| 1750 BooleanArray.get(0, -1); | 1276 BooleanArray.get(0, -1); |
| 1751 fail("Expected "); | 1277 fail("Expected "); |
| (...skipping 169 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1921 DirectedGraph<DirectedGraphTest_Node> graph = | 1447 DirectedGraph<DirectedGraphTest_Node> graph = |
| 1922 new DirectedGraph<DirectedGraphTest_Node>(); | 1448 new DirectedGraph<DirectedGraphTest_Node>(); |
| 1923 List<DirectedGraphTest_Node> cycle = graph.findCycleContaining(node); | 1449 List<DirectedGraphTest_Node> cycle = graph.findCycleContaining(node); |
| 1924 expect(cycle, hasLength(1)); | 1450 expect(cycle, hasLength(1)); |
| 1925 expect(cycle[0], node); | 1451 expect(cycle[0], node); |
| 1926 } | 1452 } |
| 1927 | 1453 |
| 1928 void test_findCycleContaining_null() { | 1454 void test_findCycleContaining_null() { |
| 1929 DirectedGraph<DirectedGraphTest_Node> graph = | 1455 DirectedGraph<DirectedGraphTest_Node> graph = |
| 1930 new DirectedGraph<DirectedGraphTest_Node>(); | 1456 new DirectedGraph<DirectedGraphTest_Node>(); |
| 1931 try { | 1457 expect(() => graph.findCycleContaining(null), throwsArgumentError); |
| 1932 graph.findCycleContaining(null); | |
| 1933 fail("Expected IllegalArgumentException"); | |
| 1934 } on IllegalArgumentException { | |
| 1935 // Expected | |
| 1936 } | |
| 1937 } | 1458 } |
| 1938 | 1459 |
| 1939 void test_findCycleContaining_singleton() { | 1460 void test_findCycleContaining_singleton() { |
| 1940 DirectedGraphTest_Node node1 = new DirectedGraphTest_Node(); | 1461 DirectedGraphTest_Node node1 = new DirectedGraphTest_Node(); |
| 1941 DirectedGraphTest_Node node2 = new DirectedGraphTest_Node(); | 1462 DirectedGraphTest_Node node2 = new DirectedGraphTest_Node(); |
| 1942 DirectedGraphTest_Node node3 = new DirectedGraphTest_Node(); | 1463 DirectedGraphTest_Node node3 = new DirectedGraphTest_Node(); |
| 1943 DirectedGraph<DirectedGraphTest_Node> graph = | 1464 DirectedGraph<DirectedGraphTest_Node> graph = |
| 1944 new DirectedGraph<DirectedGraphTest_Node>(); | 1465 new DirectedGraph<DirectedGraphTest_Node>(); |
| 1945 graph.addEdge(node1, node2); | 1466 graph.addEdge(node1, node2); |
| 1946 graph.addEdge(node2, node3); | 1467 graph.addEdge(node2, node3); |
| (...skipping 120 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2067 expect(topologicalSort[1], unorderedEquals([node1, node2])); | 1588 expect(topologicalSort[1], unorderedEquals([node1, node2])); |
| 2068 } | 1589 } |
| 2069 } | 1590 } |
| 2070 | 1591 |
| 2071 /** | 1592 /** |
| 2072 * Instances of the class `Node` represent simple nodes used for testing purpose
s. | 1593 * Instances of the class `Node` represent simple nodes used for testing purpose
s. |
| 2073 */ | 1594 */ |
| 2074 class DirectedGraphTest_Node {} | 1595 class DirectedGraphTest_Node {} |
| 2075 | 1596 |
| 2076 class Getter_NodeReplacerTest_test_annotation | 1597 class Getter_NodeReplacerTest_test_annotation |
| 2077 implements NodeReplacerTest_Getter { | 1598 implements NodeReplacerTest_Getter<Annotation, ArgumentList> { |
| 2078 @override | 1599 @override |
| 2079 ArgumentList get(Annotation node) => node.arguments; | 1600 ArgumentList get(Annotation node) => node.arguments; |
| 2080 } | 1601 } |
| 2081 | 1602 |
| 2082 class Getter_NodeReplacerTest_test_annotation_2 | 1603 class Getter_NodeReplacerTest_test_annotation_2 |
| 2083 implements NodeReplacerTest_Getter { | 1604 implements NodeReplacerTest_Getter<Annotation, Identifier> { |
| 2084 @override | 1605 @override |
| 2085 Identifier get(Annotation node) => node.name; | 1606 Identifier get(Annotation node) => node.name; |
| 2086 } | 1607 } |
| 2087 | 1608 |
| 2088 class Getter_NodeReplacerTest_test_annotation_3 | 1609 class Getter_NodeReplacerTest_test_annotation_3 |
| 2089 implements NodeReplacerTest_Getter { | 1610 implements NodeReplacerTest_Getter<Annotation, SimpleIdentifier> { |
| 2090 @override | 1611 @override |
| 2091 SimpleIdentifier get(Annotation node) => node.constructorName; | 1612 SimpleIdentifier get(Annotation node) => node.constructorName; |
| 2092 } | 1613 } |
| 2093 | 1614 |
| 2094 class Getter_NodeReplacerTest_test_asExpression | 1615 class Getter_NodeReplacerTest_test_asExpression |
| 2095 implements NodeReplacerTest_Getter { | 1616 implements NodeReplacerTest_Getter<AsExpression, TypeName> { |
| 2096 @override | 1617 @override |
| 2097 TypeName get(AsExpression node) => node.type; | 1618 TypeName get(AsExpression node) => node.type; |
| 2098 } | 1619 } |
| 2099 | 1620 |
| 2100 class Getter_NodeReplacerTest_test_asExpression_2 | 1621 class Getter_NodeReplacerTest_test_asExpression_2 |
| 2101 implements NodeReplacerTest_Getter { | 1622 implements NodeReplacerTest_Getter<AsExpression, Expression> { |
| 2102 @override | 1623 @override |
| 2103 Expression get(AsExpression node) => node.expression; | 1624 Expression get(AsExpression node) => node.expression; |
| 2104 } | 1625 } |
| 2105 | 1626 |
| 2106 class Getter_NodeReplacerTest_test_assertStatement | 1627 class Getter_NodeReplacerTest_test_assertStatement |
| 2107 implements NodeReplacerTest_Getter { | 1628 implements NodeReplacerTest_Getter<AssertStatement, Expression> { |
| 2108 @override | 1629 @override |
| 2109 Expression get(AssertStatement node) => node.condition; | 1630 Expression get(AssertStatement node) => node.condition; |
| 2110 } | 1631 } |
| 2111 | 1632 |
| 1633 class Getter_NodeReplacerTest_test_assertStatement_2 |
| 1634 implements NodeReplacerTest_Getter<AssertStatement, Expression> { |
| 1635 @override |
| 1636 Expression get(AssertStatement node) => node.message; |
| 1637 } |
| 1638 |
| 2112 class Getter_NodeReplacerTest_test_assignmentExpression | 1639 class Getter_NodeReplacerTest_test_assignmentExpression |
| 2113 implements NodeReplacerTest_Getter { | 1640 implements NodeReplacerTest_Getter<AssignmentExpression, Expression> { |
| 2114 @override | 1641 @override |
| 2115 Expression get(AssignmentExpression node) => node.rightHandSide; | 1642 Expression get(AssignmentExpression node) => node.rightHandSide; |
| 2116 } | 1643 } |
| 2117 | 1644 |
| 2118 class Getter_NodeReplacerTest_test_assignmentExpression_2 | 1645 class Getter_NodeReplacerTest_test_assignmentExpression_2 |
| 2119 implements NodeReplacerTest_Getter { | 1646 implements NodeReplacerTest_Getter<AssignmentExpression, Expression> { |
| 2120 @override | 1647 @override |
| 2121 Expression get(AssignmentExpression node) => node.leftHandSide; | 1648 Expression get(AssignmentExpression node) => node.leftHandSide; |
| 2122 } | 1649 } |
| 2123 | 1650 |
| 2124 class Getter_NodeReplacerTest_test_awaitExpression | 1651 class Getter_NodeReplacerTest_test_awaitExpression |
| 2125 implements NodeReplacerTest_Getter { | 1652 implements NodeReplacerTest_Getter<AwaitExpression, Expression> { |
| 2126 @override | 1653 @override |
| 2127 Expression get(AwaitExpression node) => node.expression; | 1654 Expression get(AwaitExpression node) => node.expression; |
| 2128 } | 1655 } |
| 2129 | 1656 |
| 2130 class Getter_NodeReplacerTest_test_binaryExpression | 1657 class Getter_NodeReplacerTest_test_binaryExpression |
| 2131 implements NodeReplacerTest_Getter { | 1658 implements NodeReplacerTest_Getter<BinaryExpression, Expression> { |
| 2132 @override | 1659 @override |
| 2133 Expression get(BinaryExpression node) => node.leftOperand; | 1660 Expression get(BinaryExpression node) => node.leftOperand; |
| 2134 } | 1661 } |
| 2135 | 1662 |
| 2136 class Getter_NodeReplacerTest_test_binaryExpression_2 | 1663 class Getter_NodeReplacerTest_test_binaryExpression_2 |
| 2137 implements NodeReplacerTest_Getter { | 1664 implements NodeReplacerTest_Getter<BinaryExpression, Expression> { |
| 2138 @override | 1665 @override |
| 2139 Expression get(BinaryExpression node) => node.rightOperand; | 1666 Expression get(BinaryExpression node) => node.rightOperand; |
| 2140 } | 1667 } |
| 2141 | 1668 |
| 2142 class Getter_NodeReplacerTest_test_blockFunctionBody | 1669 class Getter_NodeReplacerTest_test_blockFunctionBody |
| 2143 implements NodeReplacerTest_Getter { | 1670 implements NodeReplacerTest_Getter<BlockFunctionBody, Block> { |
| 2144 @override | 1671 @override |
| 2145 Block get(BlockFunctionBody node) => node.block; | 1672 Block get(BlockFunctionBody node) => node.block; |
| 2146 } | 1673 } |
| 2147 | 1674 |
| 2148 class Getter_NodeReplacerTest_test_breakStatement | 1675 class Getter_NodeReplacerTest_test_breakStatement |
| 2149 implements NodeReplacerTest_Getter { | 1676 implements NodeReplacerTest_Getter<BreakStatement, SimpleIdentifier> { |
| 2150 @override | 1677 @override |
| 2151 SimpleIdentifier get(BreakStatement node) => node.label; | 1678 SimpleIdentifier get(BreakStatement node) => node.label; |
| 2152 } | 1679 } |
| 2153 | 1680 |
| 2154 class Getter_NodeReplacerTest_test_cascadeExpression | 1681 class Getter_NodeReplacerTest_test_cascadeExpression |
| 2155 implements NodeReplacerTest_Getter { | 1682 implements NodeReplacerTest_Getter<CascadeExpression, Expression> { |
| 2156 @override | 1683 @override |
| 2157 Expression get(CascadeExpression node) => node.target; | 1684 Expression get(CascadeExpression node) => node.target; |
| 2158 } | 1685 } |
| 2159 | 1686 |
| 2160 class Getter_NodeReplacerTest_test_catchClause | 1687 class Getter_NodeReplacerTest_test_catchClause |
| 2161 implements NodeReplacerTest_Getter { | 1688 implements NodeReplacerTest_Getter<CatchClause, SimpleIdentifier> { |
| 2162 @override | 1689 @override |
| 2163 SimpleIdentifier get(CatchClause node) => node.stackTraceParameter; | 1690 SimpleIdentifier get(CatchClause node) => node.stackTraceParameter; |
| 2164 } | 1691 } |
| 2165 | 1692 |
| 2166 class Getter_NodeReplacerTest_test_catchClause_2 | 1693 class Getter_NodeReplacerTest_test_catchClause_2 |
| 2167 implements NodeReplacerTest_Getter { | 1694 implements NodeReplacerTest_Getter<CatchClause, SimpleIdentifier> { |
| 2168 @override | 1695 @override |
| 2169 SimpleIdentifier get(CatchClause node) => node.exceptionParameter; | 1696 SimpleIdentifier get(CatchClause node) => node.exceptionParameter; |
| 2170 } | 1697 } |
| 2171 | 1698 |
| 2172 class Getter_NodeReplacerTest_test_catchClause_3 | 1699 class Getter_NodeReplacerTest_test_catchClause_3 |
| 2173 implements NodeReplacerTest_Getter { | 1700 implements NodeReplacerTest_Getter<CatchClause, TypeName> { |
| 2174 @override | 1701 @override |
| 2175 TypeName get(CatchClause node) => node.exceptionType; | 1702 TypeName get(CatchClause node) => node.exceptionType; |
| 2176 } | 1703 } |
| 2177 | 1704 |
| 2178 class Getter_NodeReplacerTest_test_classDeclaration | 1705 class Getter_NodeReplacerTest_test_classDeclaration |
| 2179 implements NodeReplacerTest_Getter { | 1706 implements NodeReplacerTest_Getter<ClassDeclaration, ImplementsClause> { |
| 2180 @override | 1707 @override |
| 2181 ImplementsClause get(ClassDeclaration node) => node.implementsClause; | 1708 ImplementsClause get(ClassDeclaration node) => node.implementsClause; |
| 2182 } | 1709 } |
| 2183 | 1710 |
| 2184 class Getter_NodeReplacerTest_test_classDeclaration_2 | 1711 class Getter_NodeReplacerTest_test_classDeclaration_2 |
| 2185 implements NodeReplacerTest_Getter { | 1712 implements NodeReplacerTest_Getter<ClassDeclaration, WithClause> { |
| 2186 @override | 1713 @override |
| 2187 WithClause get(ClassDeclaration node) => node.withClause; | 1714 WithClause get(ClassDeclaration node) => node.withClause; |
| 2188 } | 1715 } |
| 2189 | 1716 |
| 2190 class Getter_NodeReplacerTest_test_classDeclaration_3 | 1717 class Getter_NodeReplacerTest_test_classDeclaration_3 |
| 2191 implements NodeReplacerTest_Getter { | 1718 implements NodeReplacerTest_Getter<ClassDeclaration, NativeClause> { |
| 2192 @override | 1719 @override |
| 2193 NativeClause get(ClassDeclaration node) => node.nativeClause; | 1720 NativeClause get(ClassDeclaration node) => node.nativeClause; |
| 2194 } | 1721 } |
| 2195 | 1722 |
| 2196 class Getter_NodeReplacerTest_test_classDeclaration_4 | 1723 class Getter_NodeReplacerTest_test_classDeclaration_4 |
| 2197 implements NodeReplacerTest_Getter { | 1724 implements NodeReplacerTest_Getter<ClassDeclaration, ExtendsClause> { |
| 2198 @override | 1725 @override |
| 2199 ExtendsClause get(ClassDeclaration node) => node.extendsClause; | 1726 ExtendsClause get(ClassDeclaration node) => node.extendsClause; |
| 2200 } | 1727 } |
| 2201 | 1728 |
| 2202 class Getter_NodeReplacerTest_test_classDeclaration_5 | 1729 class Getter_NodeReplacerTest_test_classDeclaration_5 |
| 2203 implements NodeReplacerTest_Getter { | 1730 implements NodeReplacerTest_Getter<ClassDeclaration, TypeParameterList> { |
| 2204 @override | 1731 @override |
| 2205 TypeParameterList get(ClassDeclaration node) => node.typeParameters; | 1732 TypeParameterList get(ClassDeclaration node) => node.typeParameters; |
| 2206 } | 1733 } |
| 2207 | 1734 |
| 2208 class Getter_NodeReplacerTest_test_classDeclaration_6 | 1735 class Getter_NodeReplacerTest_test_classDeclaration_6 |
| 2209 implements NodeReplacerTest_Getter { | 1736 implements NodeReplacerTest_Getter<ClassDeclaration, SimpleIdentifier> { |
| 2210 @override | 1737 @override |
| 2211 SimpleIdentifier get(ClassDeclaration node) => node.name; | 1738 SimpleIdentifier get(ClassDeclaration node) => node.name; |
| 2212 } | 1739 } |
| 2213 | 1740 |
| 2214 class Getter_NodeReplacerTest_test_classTypeAlias | 1741 class Getter_NodeReplacerTest_test_classTypeAlias |
| 2215 implements NodeReplacerTest_Getter { | 1742 implements NodeReplacerTest_Getter<ClassTypeAlias, TypeName> { |
| 2216 @override | 1743 @override |
| 2217 TypeName get(ClassTypeAlias node) => node.superclass; | 1744 TypeName get(ClassTypeAlias node) => node.superclass; |
| 2218 } | 1745 } |
| 2219 | 1746 |
| 2220 class Getter_NodeReplacerTest_test_classTypeAlias_2 | 1747 class Getter_NodeReplacerTest_test_classTypeAlias_2 |
| 2221 implements NodeReplacerTest_Getter { | 1748 implements NodeReplacerTest_Getter<ClassTypeAlias, ImplementsClause> { |
| 2222 @override | 1749 @override |
| 2223 ImplementsClause get(ClassTypeAlias node) => node.implementsClause; | 1750 ImplementsClause get(ClassTypeAlias node) => node.implementsClause; |
| 2224 } | 1751 } |
| 2225 | 1752 |
| 2226 class Getter_NodeReplacerTest_test_classTypeAlias_3 | 1753 class Getter_NodeReplacerTest_test_classTypeAlias_3 |
| 2227 implements NodeReplacerTest_Getter { | 1754 implements NodeReplacerTest_Getter<ClassTypeAlias, WithClause> { |
| 2228 @override | 1755 @override |
| 2229 WithClause get(ClassTypeAlias node) => node.withClause; | 1756 WithClause get(ClassTypeAlias node) => node.withClause; |
| 2230 } | 1757 } |
| 2231 | 1758 |
| 2232 class Getter_NodeReplacerTest_test_classTypeAlias_4 | 1759 class Getter_NodeReplacerTest_test_classTypeAlias_4 |
| 2233 implements NodeReplacerTest_Getter { | 1760 implements NodeReplacerTest_Getter<ClassTypeAlias, SimpleIdentifier> { |
| 2234 @override | 1761 @override |
| 2235 SimpleIdentifier get(ClassTypeAlias node) => node.name; | 1762 SimpleIdentifier get(ClassTypeAlias node) => node.name; |
| 2236 } | 1763 } |
| 2237 | 1764 |
| 2238 class Getter_NodeReplacerTest_test_classTypeAlias_5 | 1765 class Getter_NodeReplacerTest_test_classTypeAlias_5 |
| 2239 implements NodeReplacerTest_Getter { | 1766 implements NodeReplacerTest_Getter<ClassTypeAlias, TypeParameterList> { |
| 2240 @override | 1767 @override |
| 2241 TypeParameterList get(ClassTypeAlias node) => node.typeParameters; | 1768 TypeParameterList get(ClassTypeAlias node) => node.typeParameters; |
| 2242 } | 1769 } |
| 2243 | 1770 |
| 2244 class Getter_NodeReplacerTest_test_commentReference | 1771 class Getter_NodeReplacerTest_test_commentReference |
| 2245 implements NodeReplacerTest_Getter { | 1772 implements NodeReplacerTest_Getter<CommentReference, Identifier> { |
| 2246 @override | 1773 @override |
| 2247 Identifier get(CommentReference node) => node.identifier; | 1774 Identifier get(CommentReference node) => node.identifier; |
| 2248 } | 1775 } |
| 2249 | 1776 |
| 2250 class Getter_NodeReplacerTest_test_compilationUnit | 1777 class Getter_NodeReplacerTest_test_compilationUnit |
| 2251 implements NodeReplacerTest_Getter { | 1778 implements NodeReplacerTest_Getter<CompilationUnit, ScriptTag> { |
| 2252 @override | 1779 @override |
| 2253 ScriptTag get(CompilationUnit node) => node.scriptTag; | 1780 ScriptTag get(CompilationUnit node) => node.scriptTag; |
| 2254 } | 1781 } |
| 2255 | 1782 |
| 2256 class Getter_NodeReplacerTest_test_conditionalExpression | 1783 class Getter_NodeReplacerTest_test_conditionalExpression |
| 2257 implements NodeReplacerTest_Getter { | 1784 implements NodeReplacerTest_Getter<ConditionalExpression, Expression> { |
| 2258 @override | 1785 @override |
| 2259 Expression get(ConditionalExpression node) => node.elseExpression; | 1786 Expression get(ConditionalExpression node) => node.elseExpression; |
| 2260 } | 1787 } |
| 2261 | 1788 |
| 2262 class Getter_NodeReplacerTest_test_conditionalExpression_2 | 1789 class Getter_NodeReplacerTest_test_conditionalExpression_2 |
| 2263 implements NodeReplacerTest_Getter { | 1790 implements NodeReplacerTest_Getter<ConditionalExpression, Expression> { |
| 2264 @override | 1791 @override |
| 2265 Expression get(ConditionalExpression node) => node.thenExpression; | 1792 Expression get(ConditionalExpression node) => node.thenExpression; |
| 2266 } | 1793 } |
| 2267 | 1794 |
| 2268 class Getter_NodeReplacerTest_test_conditionalExpression_3 | 1795 class Getter_NodeReplacerTest_test_conditionalExpression_3 |
| 2269 implements NodeReplacerTest_Getter { | 1796 implements NodeReplacerTest_Getter<ConditionalExpression, Expression> { |
| 2270 @override | 1797 @override |
| 2271 Expression get(ConditionalExpression node) => node.condition; | 1798 Expression get(ConditionalExpression node) => node.condition; |
| 2272 } | 1799 } |
| 2273 | 1800 |
| 2274 class Getter_NodeReplacerTest_test_constructorDeclaration | 1801 class Getter_NodeReplacerTest_test_constructorDeclaration |
| 2275 implements NodeReplacerTest_Getter { | 1802 implements |
| 1803 NodeReplacerTest_Getter<ConstructorDeclaration, ConstructorName> { |
| 2276 @override | 1804 @override |
| 2277 ConstructorName get(ConstructorDeclaration node) => | 1805 ConstructorName get(ConstructorDeclaration node) => |
| 2278 node.redirectedConstructor; | 1806 node.redirectedConstructor; |
| 2279 } | 1807 } |
| 2280 | 1808 |
| 2281 class Getter_NodeReplacerTest_test_constructorDeclaration_2 | 1809 class Getter_NodeReplacerTest_test_constructorDeclaration_2 |
| 2282 implements NodeReplacerTest_Getter { | 1810 implements |
| 1811 NodeReplacerTest_Getter<ConstructorDeclaration, SimpleIdentifier> { |
| 2283 @override | 1812 @override |
| 2284 SimpleIdentifier get(ConstructorDeclaration node) => node.name; | 1813 SimpleIdentifier get(ConstructorDeclaration node) => node.name; |
| 2285 } | 1814 } |
| 2286 | 1815 |
| 2287 class Getter_NodeReplacerTest_test_constructorDeclaration_3 | 1816 class Getter_NodeReplacerTest_test_constructorDeclaration_3 |
| 2288 implements NodeReplacerTest_Getter { | 1817 implements NodeReplacerTest_Getter<ConstructorDeclaration, Identifier> { |
| 2289 @override | 1818 @override |
| 2290 Identifier get(ConstructorDeclaration node) => node.returnType; | 1819 Identifier get(ConstructorDeclaration node) => node.returnType; |
| 2291 } | 1820 } |
| 2292 | 1821 |
| 2293 class Getter_NodeReplacerTest_test_constructorDeclaration_4 | 1822 class Getter_NodeReplacerTest_test_constructorDeclaration_4 |
| 2294 implements NodeReplacerTest_Getter { | 1823 implements |
| 1824 NodeReplacerTest_Getter<ConstructorDeclaration, FormalParameterList> { |
| 2295 @override | 1825 @override |
| 2296 FormalParameterList get(ConstructorDeclaration node) => node.parameters; | 1826 FormalParameterList get(ConstructorDeclaration node) => node.parameters; |
| 2297 } | 1827 } |
| 2298 | 1828 |
| 2299 class Getter_NodeReplacerTest_test_constructorDeclaration_5 | 1829 class Getter_NodeReplacerTest_test_constructorDeclaration_5 |
| 2300 implements NodeReplacerTest_Getter { | 1830 implements NodeReplacerTest_Getter<ConstructorDeclaration, FunctionBody> { |
| 2301 @override | 1831 @override |
| 2302 FunctionBody get(ConstructorDeclaration node) => node.body; | 1832 FunctionBody get(ConstructorDeclaration node) => node.body; |
| 2303 } | 1833 } |
| 2304 | 1834 |
| 2305 class Getter_NodeReplacerTest_test_constructorFieldInitializer | 1835 class Getter_NodeReplacerTest_test_constructorFieldInitializer |
| 2306 implements NodeReplacerTest_Getter { | 1836 implements |
| 1837 NodeReplacerTest_Getter<ConstructorFieldInitializer, SimpleIdentifier> { |
| 2307 @override | 1838 @override |
| 2308 SimpleIdentifier get(ConstructorFieldInitializer node) => node.fieldName; | 1839 SimpleIdentifier get(ConstructorFieldInitializer node) => node.fieldName; |
| 2309 } | 1840 } |
| 2310 | 1841 |
| 2311 class Getter_NodeReplacerTest_test_constructorFieldInitializer_2 | 1842 class Getter_NodeReplacerTest_test_constructorFieldInitializer_2 |
| 2312 implements NodeReplacerTest_Getter { | 1843 implements |
| 1844 NodeReplacerTest_Getter<ConstructorFieldInitializer, Expression> { |
| 2313 @override | 1845 @override |
| 2314 Expression get(ConstructorFieldInitializer node) => node.expression; | 1846 Expression get(ConstructorFieldInitializer node) => node.expression; |
| 2315 } | 1847 } |
| 2316 | 1848 |
| 2317 class Getter_NodeReplacerTest_test_constructorName | 1849 class Getter_NodeReplacerTest_test_constructorName |
| 2318 implements NodeReplacerTest_Getter { | 1850 implements NodeReplacerTest_Getter<ConstructorName, TypeName> { |
| 2319 @override | 1851 @override |
| 2320 TypeName get(ConstructorName node) => node.type; | 1852 TypeName get(ConstructorName node) => node.type; |
| 2321 } | 1853 } |
| 2322 | 1854 |
| 2323 class Getter_NodeReplacerTest_test_constructorName_2 | 1855 class Getter_NodeReplacerTest_test_constructorName_2 |
| 2324 implements NodeReplacerTest_Getter { | 1856 implements NodeReplacerTest_Getter<ConstructorName, SimpleIdentifier> { |
| 2325 @override | 1857 @override |
| 2326 SimpleIdentifier get(ConstructorName node) => node.name; | 1858 SimpleIdentifier get(ConstructorName node) => node.name; |
| 2327 } | 1859 } |
| 2328 | 1860 |
| 2329 class Getter_NodeReplacerTest_test_continueStatement | 1861 class Getter_NodeReplacerTest_test_continueStatement |
| 2330 implements NodeReplacerTest_Getter { | 1862 implements NodeReplacerTest_Getter<ContinueStatement, SimpleIdentifier> { |
| 2331 @override | 1863 @override |
| 2332 SimpleIdentifier get(ContinueStatement node) => node.label; | 1864 SimpleIdentifier get(ContinueStatement node) => node.label; |
| 2333 } | 1865 } |
| 2334 | 1866 |
| 2335 class Getter_NodeReplacerTest_test_declaredIdentifier | 1867 class Getter_NodeReplacerTest_test_declaredIdentifier |
| 2336 implements NodeReplacerTest_Getter { | 1868 implements NodeReplacerTest_Getter<DeclaredIdentifier, TypeName> { |
| 2337 @override | 1869 @override |
| 2338 TypeName get(DeclaredIdentifier node) => node.type; | 1870 TypeName get(DeclaredIdentifier node) => node.type; |
| 2339 } | 1871 } |
| 2340 | 1872 |
| 2341 class Getter_NodeReplacerTest_test_declaredIdentifier_2 | 1873 class Getter_NodeReplacerTest_test_declaredIdentifier_2 |
| 2342 implements NodeReplacerTest_Getter { | 1874 implements NodeReplacerTest_Getter<DeclaredIdentifier, SimpleIdentifier> { |
| 2343 @override | 1875 @override |
| 2344 SimpleIdentifier get(DeclaredIdentifier node) => node.identifier; | 1876 SimpleIdentifier get(DeclaredIdentifier node) => node.identifier; |
| 2345 } | 1877 } |
| 2346 | 1878 |
| 2347 class Getter_NodeReplacerTest_test_defaultFormalParameter | 1879 class Getter_NodeReplacerTest_test_defaultFormalParameter |
| 2348 implements NodeReplacerTest_Getter { | 1880 implements |
| 1881 NodeReplacerTest_Getter<DefaultFormalParameter, NormalFormalParameter> { |
| 2349 @override | 1882 @override |
| 2350 NormalFormalParameter get(DefaultFormalParameter node) => node.parameter; | 1883 NormalFormalParameter get(DefaultFormalParameter node) => node.parameter; |
| 2351 } | 1884 } |
| 2352 | 1885 |
| 2353 class Getter_NodeReplacerTest_test_defaultFormalParameter_2 | 1886 class Getter_NodeReplacerTest_test_defaultFormalParameter_2 |
| 2354 implements NodeReplacerTest_Getter { | 1887 implements NodeReplacerTest_Getter<DefaultFormalParameter, Expression> { |
| 2355 @override | 1888 @override |
| 2356 Expression get(DefaultFormalParameter node) => node.defaultValue; | 1889 Expression get(DefaultFormalParameter node) => node.defaultValue; |
| 2357 } | 1890 } |
| 2358 | 1891 |
| 2359 class Getter_NodeReplacerTest_test_doStatement | 1892 class Getter_NodeReplacerTest_test_doStatement |
| 2360 implements NodeReplacerTest_Getter { | 1893 implements NodeReplacerTest_Getter<DoStatement, Expression> { |
| 2361 @override | 1894 @override |
| 2362 Expression get(DoStatement node) => node.condition; | 1895 Expression get(DoStatement node) => node.condition; |
| 2363 } | 1896 } |
| 2364 | 1897 |
| 2365 class Getter_NodeReplacerTest_test_doStatement_2 | 1898 class Getter_NodeReplacerTest_test_doStatement_2 |
| 2366 implements NodeReplacerTest_Getter { | 1899 implements NodeReplacerTest_Getter<DoStatement, Statement> { |
| 2367 @override | 1900 @override |
| 2368 Statement get(DoStatement node) => node.body; | 1901 Statement get(DoStatement node) => node.body; |
| 2369 } | 1902 } |
| 2370 | 1903 |
| 2371 class Getter_NodeReplacerTest_test_enumConstantDeclaration | 1904 class Getter_NodeReplacerTest_test_enumConstantDeclaration |
| 2372 implements NodeReplacerTest_Getter { | 1905 implements |
| 1906 NodeReplacerTest_Getter<EnumConstantDeclaration, SimpleIdentifier> { |
| 2373 @override | 1907 @override |
| 2374 SimpleIdentifier get(EnumConstantDeclaration node) => node.name; | 1908 SimpleIdentifier get(EnumConstantDeclaration node) => node.name; |
| 2375 } | 1909 } |
| 2376 | 1910 |
| 2377 class Getter_NodeReplacerTest_test_enumDeclaration | 1911 class Getter_NodeReplacerTest_test_enumDeclaration |
| 2378 implements NodeReplacerTest_Getter { | 1912 implements NodeReplacerTest_Getter<EnumDeclaration, SimpleIdentifier> { |
| 2379 @override | 1913 @override |
| 2380 SimpleIdentifier get(EnumDeclaration node) => node.name; | 1914 SimpleIdentifier get(EnumDeclaration node) => node.name; |
| 2381 } | 1915 } |
| 2382 | 1916 |
| 2383 class Getter_NodeReplacerTest_test_expressionFunctionBody | 1917 class Getter_NodeReplacerTest_test_expressionFunctionBody |
| 2384 implements NodeReplacerTest_Getter { | 1918 implements NodeReplacerTest_Getter<ExpressionFunctionBody, Expression> { |
| 2385 @override | 1919 @override |
| 2386 Expression get(ExpressionFunctionBody node) => node.expression; | 1920 Expression get(ExpressionFunctionBody node) => node.expression; |
| 2387 } | 1921 } |
| 2388 | 1922 |
| 2389 class Getter_NodeReplacerTest_test_expressionStatement | 1923 class Getter_NodeReplacerTest_test_expressionStatement |
| 2390 implements NodeReplacerTest_Getter { | 1924 implements NodeReplacerTest_Getter<ExpressionStatement, Expression> { |
| 2391 @override | 1925 @override |
| 2392 Expression get(ExpressionStatement node) => node.expression; | 1926 Expression get(ExpressionStatement node) => node.expression; |
| 2393 } | 1927 } |
| 2394 | 1928 |
| 2395 class Getter_NodeReplacerTest_test_extendsClause | 1929 class Getter_NodeReplacerTest_test_extendsClause |
| 2396 implements NodeReplacerTest_Getter { | 1930 implements NodeReplacerTest_Getter<ExtendsClause, TypeName> { |
| 2397 @override | 1931 @override |
| 2398 TypeName get(ExtendsClause node) => node.superclass; | 1932 TypeName get(ExtendsClause node) => node.superclass; |
| 2399 } | 1933 } |
| 2400 | 1934 |
| 2401 class Getter_NodeReplacerTest_test_fieldDeclaration | 1935 class Getter_NodeReplacerTest_test_fieldDeclaration |
| 2402 implements NodeReplacerTest_Getter { | 1936 implements |
| 1937 NodeReplacerTest_Getter<FieldDeclaration, VariableDeclarationList> { |
| 2403 @override | 1938 @override |
| 2404 VariableDeclarationList get(FieldDeclaration node) => node.fields; | 1939 VariableDeclarationList get(FieldDeclaration node) => node.fields; |
| 2405 } | 1940 } |
| 2406 | 1941 |
| 2407 class Getter_NodeReplacerTest_test_fieldFormalParameter | 1942 class Getter_NodeReplacerTest_test_fieldFormalParameter |
| 2408 implements NodeReplacerTest_Getter { | 1943 implements |
| 1944 NodeReplacerTest_Getter<FieldFormalParameter, FormalParameterList> { |
| 2409 @override | 1945 @override |
| 2410 FormalParameterList get(FieldFormalParameter node) => node.parameters; | 1946 FormalParameterList get(FieldFormalParameter node) => node.parameters; |
| 2411 } | 1947 } |
| 2412 | 1948 |
| 2413 class Getter_NodeReplacerTest_test_fieldFormalParameter_2 | 1949 class Getter_NodeReplacerTest_test_fieldFormalParameter_2 |
| 2414 implements NodeReplacerTest_Getter { | 1950 implements NodeReplacerTest_Getter<FieldFormalParameter, TypeName> { |
| 2415 @override | 1951 @override |
| 2416 TypeName get(FieldFormalParameter node) => node.type; | 1952 TypeName get(FieldFormalParameter node) => node.type; |
| 2417 } | 1953 } |
| 2418 | 1954 |
| 2419 class Getter_NodeReplacerTest_test_forEachStatement_withIdentifier | 1955 class Getter_NodeReplacerTest_test_forEachStatement_withIdentifier |
| 2420 implements NodeReplacerTest_Getter { | 1956 implements NodeReplacerTest_Getter<ForEachStatement, Statement> { |
| 2421 @override | 1957 @override |
| 2422 Statement get(ForEachStatement node) => node.body; | 1958 Statement get(ForEachStatement node) => node.body; |
| 2423 } | 1959 } |
| 2424 | 1960 |
| 2425 class Getter_NodeReplacerTest_test_forEachStatement_withIdentifier_2 | 1961 class Getter_NodeReplacerTest_test_forEachStatement_withIdentifier_2 |
| 2426 implements NodeReplacerTest_Getter { | 1962 implements NodeReplacerTest_Getter<ForEachStatement, SimpleIdentifier> { |
| 2427 @override | 1963 @override |
| 2428 SimpleIdentifier get(ForEachStatement node) => node.identifier; | 1964 SimpleIdentifier get(ForEachStatement node) => node.identifier; |
| 2429 } | 1965 } |
| 2430 | 1966 |
| 2431 class Getter_NodeReplacerTest_test_forEachStatement_withIdentifier_3 | 1967 class Getter_NodeReplacerTest_test_forEachStatement_withIdentifier_3 |
| 2432 implements NodeReplacerTest_Getter { | 1968 implements NodeReplacerTest_Getter<ForEachStatement, Expression> { |
| 2433 @override | 1969 @override |
| 2434 Expression get(ForEachStatement node) => node.iterable; | 1970 Expression get(ForEachStatement node) => node.iterable; |
| 2435 } | 1971 } |
| 2436 | 1972 |
| 2437 class Getter_NodeReplacerTest_test_forEachStatement_withLoopVariable | 1973 class Getter_NodeReplacerTest_test_forEachStatement_withLoopVariable |
| 2438 implements NodeReplacerTest_Getter { | 1974 implements NodeReplacerTest_Getter<ForEachStatement, Expression> { |
| 2439 @override | 1975 @override |
| 2440 Expression get(ForEachStatement node) => node.iterable; | 1976 Expression get(ForEachStatement node) => node.iterable; |
| 2441 } | 1977 } |
| 2442 | 1978 |
| 2443 class Getter_NodeReplacerTest_test_forEachStatement_withLoopVariable_2 | 1979 class Getter_NodeReplacerTest_test_forEachStatement_withLoopVariable_2 |
| 2444 implements NodeReplacerTest_Getter { | 1980 implements NodeReplacerTest_Getter<ForEachStatement, DeclaredIdentifier> { |
| 2445 @override | 1981 @override |
| 2446 DeclaredIdentifier get(ForEachStatement node) => node.loopVariable; | 1982 DeclaredIdentifier get(ForEachStatement node) => node.loopVariable; |
| 2447 } | 1983 } |
| 2448 | 1984 |
| 2449 class Getter_NodeReplacerTest_test_forEachStatement_withLoopVariable_3 | 1985 class Getter_NodeReplacerTest_test_forEachStatement_withLoopVariable_3 |
| 2450 implements NodeReplacerTest_Getter { | 1986 implements NodeReplacerTest_Getter<ForEachStatement, Statement> { |
| 2451 @override | 1987 @override |
| 2452 Statement get(ForEachStatement node) => node.body; | 1988 Statement get(ForEachStatement node) => node.body; |
| 2453 } | 1989 } |
| 2454 | 1990 |
| 2455 class Getter_NodeReplacerTest_test_forStatement_withInitialization | 1991 class Getter_NodeReplacerTest_test_forStatement_withInitialization |
| 2456 implements NodeReplacerTest_Getter { | 1992 implements NodeReplacerTest_Getter<ForStatement, Statement> { |
| 2457 @override | 1993 @override |
| 2458 Statement get(ForStatement node) => node.body; | 1994 Statement get(ForStatement node) => node.body; |
| 2459 } | 1995 } |
| 2460 | 1996 |
| 2461 class Getter_NodeReplacerTest_test_forStatement_withInitialization_2 | 1997 class Getter_NodeReplacerTest_test_forStatement_withInitialization_2 |
| 2462 implements NodeReplacerTest_Getter { | 1998 implements NodeReplacerTest_Getter<ForStatement, Expression> { |
| 2463 @override | 1999 @override |
| 2464 Expression get(ForStatement node) => node.condition; | 2000 Expression get(ForStatement node) => node.condition; |
| 2465 } | 2001 } |
| 2466 | 2002 |
| 2467 class Getter_NodeReplacerTest_test_forStatement_withInitialization_3 | 2003 class Getter_NodeReplacerTest_test_forStatement_withInitialization_3 |
| 2468 implements NodeReplacerTest_Getter { | 2004 implements NodeReplacerTest_Getter<ForStatement, Expression> { |
| 2469 @override | 2005 @override |
| 2470 Expression get(ForStatement node) => node.initialization; | 2006 Expression get(ForStatement node) => node.initialization; |
| 2471 } | 2007 } |
| 2472 | 2008 |
| 2473 class Getter_NodeReplacerTest_test_forStatement_withVariables | 2009 class Getter_NodeReplacerTest_test_forStatement_withVariables |
| 2474 implements NodeReplacerTest_Getter { | 2010 implements NodeReplacerTest_Getter<ForStatement, Statement> { |
| 2475 @override | 2011 @override |
| 2476 Statement get(ForStatement node) => node.body; | 2012 Statement get(ForStatement node) => node.body; |
| 2477 } | 2013 } |
| 2478 | 2014 |
| 2479 class Getter_NodeReplacerTest_test_forStatement_withVariables_2 | 2015 class Getter_NodeReplacerTest_test_forStatement_withVariables_2 |
| 2480 implements NodeReplacerTest_Getter { | 2016 implements NodeReplacerTest_Getter<ForStatement, VariableDeclarationList> { |
| 2481 @override | 2017 @override |
| 2482 VariableDeclarationList get(ForStatement node) => node.variables; | 2018 VariableDeclarationList get(ForStatement node) => node.variables; |
| 2483 } | 2019 } |
| 2484 | 2020 |
| 2485 class Getter_NodeReplacerTest_test_forStatement_withVariables_3 | 2021 class Getter_NodeReplacerTest_test_forStatement_withVariables_3 |
| 2486 implements NodeReplacerTest_Getter { | 2022 implements NodeReplacerTest_Getter<ForStatement, Expression> { |
| 2487 @override | 2023 @override |
| 2488 Expression get(ForStatement node) => node.condition; | 2024 Expression get(ForStatement node) => node.condition; |
| 2489 } | 2025 } |
| 2490 | 2026 |
| 2491 class Getter_NodeReplacerTest_test_functionDeclaration | 2027 class Getter_NodeReplacerTest_test_functionDeclaration |
| 2492 implements NodeReplacerTest_Getter { | 2028 implements NodeReplacerTest_Getter<FunctionDeclaration, TypeName> { |
| 2493 @override | 2029 @override |
| 2494 TypeName get(FunctionDeclaration node) => node.returnType; | 2030 TypeName get(FunctionDeclaration node) => node.returnType; |
| 2495 } | 2031 } |
| 2496 | 2032 |
| 2497 class Getter_NodeReplacerTest_test_functionDeclaration_2 | 2033 class Getter_NodeReplacerTest_test_functionDeclaration_2 |
| 2498 implements NodeReplacerTest_Getter { | 2034 implements |
| 2035 NodeReplacerTest_Getter<FunctionDeclaration, FunctionExpression> { |
| 2499 @override | 2036 @override |
| 2500 FunctionExpression get(FunctionDeclaration node) => node.functionExpression; | 2037 FunctionExpression get(FunctionDeclaration node) => node.functionExpression; |
| 2501 } | 2038 } |
| 2502 | 2039 |
| 2503 class Getter_NodeReplacerTest_test_functionDeclaration_3 | 2040 class Getter_NodeReplacerTest_test_functionDeclaration_3 |
| 2504 implements NodeReplacerTest_Getter { | 2041 implements NodeReplacerTest_Getter<FunctionDeclaration, SimpleIdentifier> { |
| 2505 @override | 2042 @override |
| 2506 SimpleIdentifier get(FunctionDeclaration node) => node.name; | 2043 SimpleIdentifier get(FunctionDeclaration node) => node.name; |
| 2507 } | 2044 } |
| 2508 | 2045 |
| 2509 class Getter_NodeReplacerTest_test_functionDeclarationStatement | 2046 class Getter_NodeReplacerTest_test_functionDeclarationStatement |
| 2510 implements NodeReplacerTest_Getter { | 2047 implements |
| 2048 NodeReplacerTest_Getter<FunctionDeclarationStatement, |
| 2049 FunctionDeclaration> { |
| 2511 @override | 2050 @override |
| 2512 FunctionDeclaration get(FunctionDeclarationStatement node) => | 2051 FunctionDeclaration get(FunctionDeclarationStatement node) => |
| 2513 node.functionDeclaration; | 2052 node.functionDeclaration; |
| 2514 } | 2053 } |
| 2515 | 2054 |
| 2516 class Getter_NodeReplacerTest_test_functionExpression | 2055 class Getter_NodeReplacerTest_test_functionExpression |
| 2517 implements NodeReplacerTest_Getter { | 2056 implements |
| 2057 NodeReplacerTest_Getter<FunctionExpression, FormalParameterList> { |
| 2518 @override | 2058 @override |
| 2519 FormalParameterList get(FunctionExpression node) => node.parameters; | 2059 FormalParameterList get(FunctionExpression node) => node.parameters; |
| 2520 } | 2060 } |
| 2521 | 2061 |
| 2522 class Getter_NodeReplacerTest_test_functionExpression_2 | 2062 class Getter_NodeReplacerTest_test_functionExpression_2 |
| 2523 implements NodeReplacerTest_Getter { | 2063 implements NodeReplacerTest_Getter<FunctionExpression, FunctionBody> { |
| 2524 @override | 2064 @override |
| 2525 FunctionBody get(FunctionExpression node) => node.body; | 2065 FunctionBody get(FunctionExpression node) => node.body; |
| 2526 } | 2066 } |
| 2527 | 2067 |
| 2528 class Getter_NodeReplacerTest_test_functionExpressionInvocation | 2068 class Getter_NodeReplacerTest_test_functionExpressionInvocation |
| 2529 implements NodeReplacerTest_Getter { | 2069 implements |
| 2070 NodeReplacerTest_Getter<FunctionExpressionInvocation, Expression> { |
| 2530 @override | 2071 @override |
| 2531 Expression get(FunctionExpressionInvocation node) => node.function; | 2072 Expression get(FunctionExpressionInvocation node) => node.function; |
| 2532 } | 2073 } |
| 2533 | 2074 |
| 2534 class Getter_NodeReplacerTest_test_functionExpressionInvocation_2 | 2075 class Getter_NodeReplacerTest_test_functionExpressionInvocation_2 |
| 2535 implements NodeReplacerTest_Getter { | 2076 implements |
| 2077 NodeReplacerTest_Getter<FunctionExpressionInvocation, ArgumentList> { |
| 2536 @override | 2078 @override |
| 2537 ArgumentList get(FunctionExpressionInvocation node) => node.argumentList; | 2079 ArgumentList get(FunctionExpressionInvocation node) => node.argumentList; |
| 2538 } | 2080 } |
| 2539 | 2081 |
| 2540 class Getter_NodeReplacerTest_test_functionTypeAlias | 2082 class Getter_NodeReplacerTest_test_functionTypeAlias |
| 2541 implements NodeReplacerTest_Getter { | 2083 implements NodeReplacerTest_Getter<FunctionTypeAlias, TypeParameterList> { |
| 2542 @override | 2084 @override |
| 2543 TypeParameterList get(FunctionTypeAlias node) => node.typeParameters; | 2085 TypeParameterList get(FunctionTypeAlias node) => node.typeParameters; |
| 2544 } | 2086 } |
| 2545 | 2087 |
| 2546 class Getter_NodeReplacerTest_test_functionTypeAlias_2 | 2088 class Getter_NodeReplacerTest_test_functionTypeAlias_2 |
| 2547 implements NodeReplacerTest_Getter { | 2089 implements NodeReplacerTest_Getter<FunctionTypeAlias, FormalParameterList> { |
| 2548 @override | 2090 @override |
| 2549 FormalParameterList get(FunctionTypeAlias node) => node.parameters; | 2091 FormalParameterList get(FunctionTypeAlias node) => node.parameters; |
| 2550 } | 2092 } |
| 2551 | 2093 |
| 2552 class Getter_NodeReplacerTest_test_functionTypeAlias_3 | 2094 class Getter_NodeReplacerTest_test_functionTypeAlias_3 |
| 2553 implements NodeReplacerTest_Getter { | 2095 implements NodeReplacerTest_Getter<FunctionTypeAlias, TypeName> { |
| 2554 @override | 2096 @override |
| 2555 TypeName get(FunctionTypeAlias node) => node.returnType; | 2097 TypeName get(FunctionTypeAlias node) => node.returnType; |
| 2556 } | 2098 } |
| 2557 | 2099 |
| 2558 class Getter_NodeReplacerTest_test_functionTypeAlias_4 | 2100 class Getter_NodeReplacerTest_test_functionTypeAlias_4 |
| 2559 implements NodeReplacerTest_Getter { | 2101 implements NodeReplacerTest_Getter<FunctionTypeAlias, SimpleIdentifier> { |
| 2560 @override | 2102 @override |
| 2561 SimpleIdentifier get(FunctionTypeAlias node) => node.name; | 2103 SimpleIdentifier get(FunctionTypeAlias node) => node.name; |
| 2562 } | 2104 } |
| 2563 | 2105 |
| 2564 class Getter_NodeReplacerTest_test_functionTypedFormalParameter | 2106 class Getter_NodeReplacerTest_test_functionTypedFormalParameter |
| 2565 implements NodeReplacerTest_Getter { | 2107 implements NodeReplacerTest_Getter<FunctionTypedFormalParameter, TypeName> { |
| 2566 @override | 2108 @override |
| 2567 TypeName get(FunctionTypedFormalParameter node) => node.returnType; | 2109 TypeName get(FunctionTypedFormalParameter node) => node.returnType; |
| 2568 } | 2110 } |
| 2569 | 2111 |
| 2570 class Getter_NodeReplacerTest_test_functionTypedFormalParameter_2 | 2112 class Getter_NodeReplacerTest_test_functionTypedFormalParameter_2 |
| 2571 implements NodeReplacerTest_Getter { | 2113 implements |
| 2114 NodeReplacerTest_Getter<FunctionTypedFormalParameter, |
| 2115 FormalParameterList> { |
| 2572 @override | 2116 @override |
| 2573 FormalParameterList get(FunctionTypedFormalParameter node) => node.parameters; | 2117 FormalParameterList get(FunctionTypedFormalParameter node) => node.parameters; |
| 2574 } | 2118 } |
| 2575 | 2119 |
| 2576 class Getter_NodeReplacerTest_test_ifStatement | 2120 class Getter_NodeReplacerTest_test_ifStatement |
| 2577 implements NodeReplacerTest_Getter { | 2121 implements NodeReplacerTest_Getter<IfStatement, Expression> { |
| 2578 @override | 2122 @override |
| 2579 Expression get(IfStatement node) => node.condition; | 2123 Expression get(IfStatement node) => node.condition; |
| 2580 } | 2124 } |
| 2581 | 2125 |
| 2582 class Getter_NodeReplacerTest_test_ifStatement_2 | 2126 class Getter_NodeReplacerTest_test_ifStatement_2 |
| 2583 implements NodeReplacerTest_Getter { | 2127 implements NodeReplacerTest_Getter<IfStatement, Statement> { |
| 2584 @override | 2128 @override |
| 2585 Statement get(IfStatement node) => node.elseStatement; | 2129 Statement get(IfStatement node) => node.elseStatement; |
| 2586 } | 2130 } |
| 2587 | 2131 |
| 2588 class Getter_NodeReplacerTest_test_ifStatement_3 | 2132 class Getter_NodeReplacerTest_test_ifStatement_3 |
| 2589 implements NodeReplacerTest_Getter { | 2133 implements NodeReplacerTest_Getter<IfStatement, Statement> { |
| 2590 @override | 2134 @override |
| 2591 Statement get(IfStatement node) => node.thenStatement; | 2135 Statement get(IfStatement node) => node.thenStatement; |
| 2592 } | 2136 } |
| 2593 | 2137 |
| 2594 class Getter_NodeReplacerTest_test_importDirective | 2138 class Getter_NodeReplacerTest_test_importDirective |
| 2595 implements NodeReplacerTest_Getter { | 2139 implements NodeReplacerTest_Getter<ImportDirective, SimpleIdentifier> { |
| 2596 @override | 2140 @override |
| 2597 SimpleIdentifier get(ImportDirective node) => node.prefix; | 2141 SimpleIdentifier get(ImportDirective node) => node.prefix; |
| 2598 } | 2142 } |
| 2599 | 2143 |
| 2600 class Getter_NodeReplacerTest_test_indexExpression | 2144 class Getter_NodeReplacerTest_test_indexExpression |
| 2601 implements NodeReplacerTest_Getter { | 2145 implements NodeReplacerTest_Getter<IndexExpression, Expression> { |
| 2602 @override | 2146 @override |
| 2603 Expression get(IndexExpression node) => node.target; | 2147 Expression get(IndexExpression node) => node.target; |
| 2604 } | 2148 } |
| 2605 | 2149 |
| 2606 class Getter_NodeReplacerTest_test_indexExpression_2 | 2150 class Getter_NodeReplacerTest_test_indexExpression_2 |
| 2607 implements NodeReplacerTest_Getter { | 2151 implements NodeReplacerTest_Getter<IndexExpression, Expression> { |
| 2608 @override | 2152 @override |
| 2609 Expression get(IndexExpression node) => node.index; | 2153 Expression get(IndexExpression node) => node.index; |
| 2610 } | 2154 } |
| 2611 | 2155 |
| 2612 class Getter_NodeReplacerTest_test_instanceCreationExpression | 2156 class Getter_NodeReplacerTest_test_instanceCreationExpression |
| 2613 implements NodeReplacerTest_Getter { | 2157 implements |
| 2158 NodeReplacerTest_Getter<InstanceCreationExpression, ArgumentList> { |
| 2614 @override | 2159 @override |
| 2615 ArgumentList get(InstanceCreationExpression node) => node.argumentList; | 2160 ArgumentList get(InstanceCreationExpression node) => node.argumentList; |
| 2616 } | 2161 } |
| 2617 | 2162 |
| 2618 class Getter_NodeReplacerTest_test_instanceCreationExpression_2 | 2163 class Getter_NodeReplacerTest_test_instanceCreationExpression_2 |
| 2619 implements NodeReplacerTest_Getter { | 2164 implements |
| 2165 NodeReplacerTest_Getter<InstanceCreationExpression, ConstructorName> { |
| 2620 @override | 2166 @override |
| 2621 ConstructorName get(InstanceCreationExpression node) => node.constructorName; | 2167 ConstructorName get(InstanceCreationExpression node) => node.constructorName; |
| 2622 } | 2168 } |
| 2623 | 2169 |
| 2624 class Getter_NodeReplacerTest_test_interpolationExpression | 2170 class Getter_NodeReplacerTest_test_interpolationExpression |
| 2625 implements NodeReplacerTest_Getter { | 2171 implements NodeReplacerTest_Getter<InterpolationExpression, Expression> { |
| 2626 @override | 2172 @override |
| 2627 Expression get(InterpolationExpression node) => node.expression; | 2173 Expression get(InterpolationExpression node) => node.expression; |
| 2628 } | 2174 } |
| 2629 | 2175 |
| 2630 class Getter_NodeReplacerTest_test_isExpression | 2176 class Getter_NodeReplacerTest_test_isExpression |
| 2631 implements NodeReplacerTest_Getter { | 2177 implements NodeReplacerTest_Getter<IsExpression, Expression> { |
| 2632 @override | 2178 @override |
| 2633 Expression get(IsExpression node) => node.expression; | 2179 Expression get(IsExpression node) => node.expression; |
| 2634 } | 2180 } |
| 2635 | 2181 |
| 2636 class Getter_NodeReplacerTest_test_isExpression_2 | 2182 class Getter_NodeReplacerTest_test_isExpression_2 |
| 2637 implements NodeReplacerTest_Getter { | 2183 implements NodeReplacerTest_Getter<IsExpression, TypeName> { |
| 2638 @override | 2184 @override |
| 2639 TypeName get(IsExpression node) => node.type; | 2185 TypeName get(IsExpression node) => node.type; |
| 2640 } | 2186 } |
| 2641 | 2187 |
| 2642 class Getter_NodeReplacerTest_test_label implements NodeReplacerTest_Getter { | 2188 class Getter_NodeReplacerTest_test_label |
| 2189 implements NodeReplacerTest_Getter<Label, SimpleIdentifier> { |
| 2643 @override | 2190 @override |
| 2644 SimpleIdentifier get(Label node) => node.label; | 2191 SimpleIdentifier get(Label node) => node.label; |
| 2645 } | 2192 } |
| 2646 | 2193 |
| 2647 class Getter_NodeReplacerTest_test_labeledStatement | 2194 class Getter_NodeReplacerTest_test_labeledStatement |
| 2648 implements NodeReplacerTest_Getter { | 2195 implements NodeReplacerTest_Getter<LabeledStatement, Statement> { |
| 2649 @override | 2196 @override |
| 2650 Statement get(LabeledStatement node) => node.statement; | 2197 Statement get(LabeledStatement node) => node.statement; |
| 2651 } | 2198 } |
| 2652 | 2199 |
| 2653 class Getter_NodeReplacerTest_test_libraryDirective | 2200 class Getter_NodeReplacerTest_test_libraryDirective |
| 2654 implements NodeReplacerTest_Getter { | 2201 implements NodeReplacerTest_Getter<LibraryDirective, LibraryIdentifier> { |
| 2655 @override | 2202 @override |
| 2656 LibraryIdentifier get(LibraryDirective node) => node.name; | 2203 LibraryIdentifier get(LibraryDirective node) => node.name; |
| 2657 } | 2204 } |
| 2658 | 2205 |
| 2659 class Getter_NodeReplacerTest_test_mapLiteralEntry | 2206 class Getter_NodeReplacerTest_test_mapLiteralEntry |
| 2660 implements NodeReplacerTest_Getter { | 2207 implements NodeReplacerTest_Getter<MapLiteralEntry, Expression> { |
| 2661 @override | 2208 @override |
| 2662 Expression get(MapLiteralEntry node) => node.value; | 2209 Expression get(MapLiteralEntry node) => node.value; |
| 2663 } | 2210 } |
| 2664 | 2211 |
| 2665 class Getter_NodeReplacerTest_test_mapLiteralEntry_2 | 2212 class Getter_NodeReplacerTest_test_mapLiteralEntry_2 |
| 2666 implements NodeReplacerTest_Getter { | 2213 implements NodeReplacerTest_Getter<MapLiteralEntry, Expression> { |
| 2667 @override | 2214 @override |
| 2668 Expression get(MapLiteralEntry node) => node.key; | 2215 Expression get(MapLiteralEntry node) => node.key; |
| 2669 } | 2216 } |
| 2670 | 2217 |
| 2671 class Getter_NodeReplacerTest_test_methodDeclaration | 2218 class Getter_NodeReplacerTest_test_methodDeclaration |
| 2672 implements NodeReplacerTest_Getter { | 2219 implements NodeReplacerTest_Getter<MethodDeclaration, TypeName> { |
| 2673 @override | 2220 @override |
| 2674 TypeName get(MethodDeclaration node) => node.returnType; | 2221 TypeName get(MethodDeclaration node) => node.returnType; |
| 2675 } | 2222 } |
| 2676 | 2223 |
| 2677 class Getter_NodeReplacerTest_test_methodDeclaration_2 | 2224 class Getter_NodeReplacerTest_test_methodDeclaration_2 |
| 2678 implements NodeReplacerTest_Getter { | 2225 implements NodeReplacerTest_Getter<MethodDeclaration, FunctionBody> { |
| 2679 @override | 2226 @override |
| 2680 FunctionBody get(MethodDeclaration node) => node.body; | 2227 FunctionBody get(MethodDeclaration node) => node.body; |
| 2681 } | 2228 } |
| 2682 | 2229 |
| 2683 class Getter_NodeReplacerTest_test_methodDeclaration_3 | 2230 class Getter_NodeReplacerTest_test_methodDeclaration_3 |
| 2684 implements NodeReplacerTest_Getter { | 2231 implements NodeReplacerTest_Getter<MethodDeclaration, SimpleIdentifier> { |
| 2685 @override | 2232 @override |
| 2686 SimpleIdentifier get(MethodDeclaration node) => node.name; | 2233 SimpleIdentifier get(MethodDeclaration node) => node.name; |
| 2687 } | 2234 } |
| 2688 | 2235 |
| 2689 class Getter_NodeReplacerTest_test_methodDeclaration_4 | 2236 class Getter_NodeReplacerTest_test_methodDeclaration_4 |
| 2690 implements NodeReplacerTest_Getter { | 2237 implements NodeReplacerTest_Getter<MethodDeclaration, FormalParameterList> { |
| 2691 @override | 2238 @override |
| 2692 FormalParameterList get(MethodDeclaration node) => node.parameters; | 2239 FormalParameterList get(MethodDeclaration node) => node.parameters; |
| 2693 } | 2240 } |
| 2694 | 2241 |
| 2695 class Getter_NodeReplacerTest_test_methodInvocation | 2242 class Getter_NodeReplacerTest_test_methodInvocation |
| 2696 implements NodeReplacerTest_Getter { | 2243 implements NodeReplacerTest_Getter<MethodInvocation, ArgumentList> { |
| 2697 @override | 2244 @override |
| 2698 ArgumentList get(MethodInvocation node) => node.argumentList; | 2245 ArgumentList get(MethodInvocation node) => node.argumentList; |
| 2699 } | 2246 } |
| 2700 | 2247 |
| 2701 class Getter_NodeReplacerTest_test_methodInvocation_2 | 2248 class Getter_NodeReplacerTest_test_methodInvocation_2 |
| 2702 implements NodeReplacerTest_Getter { | 2249 implements NodeReplacerTest_Getter<MethodInvocation, Expression> { |
| 2703 @override | 2250 @override |
| 2704 Expression get(MethodInvocation node) => node.target; | 2251 Expression get(MethodInvocation node) => node.target; |
| 2705 } | 2252 } |
| 2706 | 2253 |
| 2707 class Getter_NodeReplacerTest_test_methodInvocation_3 | 2254 class Getter_NodeReplacerTest_test_methodInvocation_3 |
| 2708 implements NodeReplacerTest_Getter { | 2255 implements NodeReplacerTest_Getter<MethodInvocation, SimpleIdentifier> { |
| 2709 @override | 2256 @override |
| 2710 SimpleIdentifier get(MethodInvocation node) => node.methodName; | 2257 SimpleIdentifier get(MethodInvocation node) => node.methodName; |
| 2711 } | 2258 } |
| 2712 | 2259 |
| 2713 class Getter_NodeReplacerTest_test_namedExpression | 2260 class Getter_NodeReplacerTest_test_namedExpression |
| 2714 implements NodeReplacerTest_Getter { | 2261 implements NodeReplacerTest_Getter<NamedExpression, Label> { |
| 2715 @override | 2262 @override |
| 2716 Label get(NamedExpression node) => node.name; | 2263 Label get(NamedExpression node) => node.name; |
| 2717 } | 2264 } |
| 2718 | 2265 |
| 2719 class Getter_NodeReplacerTest_test_namedExpression_2 | 2266 class Getter_NodeReplacerTest_test_namedExpression_2 |
| 2720 implements NodeReplacerTest_Getter { | 2267 implements NodeReplacerTest_Getter<NamedExpression, Expression> { |
| 2721 @override | 2268 @override |
| 2722 Expression get(NamedExpression node) => node.expression; | 2269 Expression get(NamedExpression node) => node.expression; |
| 2723 } | 2270 } |
| 2724 | 2271 |
| 2725 class Getter_NodeReplacerTest_test_nativeClause | 2272 class Getter_NodeReplacerTest_test_nativeClause |
| 2726 implements NodeReplacerTest_Getter { | 2273 implements NodeReplacerTest_Getter<NativeClause, StringLiteral> { |
| 2727 @override | 2274 @override |
| 2728 StringLiteral get(NativeClause node) => node.name; | 2275 StringLiteral get(NativeClause node) => node.name; |
| 2729 } | 2276 } |
| 2730 | 2277 |
| 2731 class Getter_NodeReplacerTest_test_nativeFunctionBody | 2278 class Getter_NodeReplacerTest_test_nativeFunctionBody |
| 2732 implements NodeReplacerTest_Getter { | 2279 implements NodeReplacerTest_Getter<NativeFunctionBody, StringLiteral> { |
| 2733 @override | 2280 @override |
| 2734 StringLiteral get(NativeFunctionBody node) => node.stringLiteral; | 2281 StringLiteral get(NativeFunctionBody node) => node.stringLiteral; |
| 2735 } | 2282 } |
| 2736 | 2283 |
| 2737 class Getter_NodeReplacerTest_test_parenthesizedExpression | 2284 class Getter_NodeReplacerTest_test_parenthesizedExpression |
| 2738 implements NodeReplacerTest_Getter { | 2285 implements NodeReplacerTest_Getter<ParenthesizedExpression, Expression> { |
| 2739 @override | 2286 @override |
| 2740 Expression get(ParenthesizedExpression node) => node.expression; | 2287 Expression get(ParenthesizedExpression node) => node.expression; |
| 2741 } | 2288 } |
| 2742 | 2289 |
| 2743 class Getter_NodeReplacerTest_test_partOfDirective | 2290 class Getter_NodeReplacerTest_test_partOfDirective |
| 2744 implements NodeReplacerTest_Getter { | 2291 implements NodeReplacerTest_Getter<PartOfDirective, LibraryIdentifier> { |
| 2745 @override | 2292 @override |
| 2746 LibraryIdentifier get(PartOfDirective node) => node.libraryName; | 2293 LibraryIdentifier get(PartOfDirective node) => node.libraryName; |
| 2747 } | 2294 } |
| 2748 | 2295 |
| 2749 class Getter_NodeReplacerTest_test_postfixExpression | 2296 class Getter_NodeReplacerTest_test_postfixExpression |
| 2750 implements NodeReplacerTest_Getter { | 2297 implements NodeReplacerTest_Getter<PostfixExpression, Expression> { |
| 2751 @override | 2298 @override |
| 2752 Expression get(PostfixExpression node) => node.operand; | 2299 Expression get(PostfixExpression node) => node.operand; |
| 2753 } | 2300 } |
| 2754 | 2301 |
| 2755 class Getter_NodeReplacerTest_test_prefixedIdentifier | 2302 class Getter_NodeReplacerTest_test_prefixedIdentifier |
| 2756 implements NodeReplacerTest_Getter { | 2303 implements NodeReplacerTest_Getter<PrefixedIdentifier, SimpleIdentifier> { |
| 2757 @override | 2304 @override |
| 2758 SimpleIdentifier get(PrefixedIdentifier node) => node.identifier; | 2305 SimpleIdentifier get(PrefixedIdentifier node) => node.identifier; |
| 2759 } | 2306 } |
| 2760 | 2307 |
| 2761 class Getter_NodeReplacerTest_test_prefixedIdentifier_2 | 2308 class Getter_NodeReplacerTest_test_prefixedIdentifier_2 |
| 2762 implements NodeReplacerTest_Getter { | 2309 implements NodeReplacerTest_Getter<PrefixedIdentifier, SimpleIdentifier> { |
| 2763 @override | 2310 @override |
| 2764 SimpleIdentifier get(PrefixedIdentifier node) => node.prefix; | 2311 SimpleIdentifier get(PrefixedIdentifier node) => node.prefix; |
| 2765 } | 2312 } |
| 2766 | 2313 |
| 2767 class Getter_NodeReplacerTest_test_prefixExpression | 2314 class Getter_NodeReplacerTest_test_prefixExpression |
| 2768 implements NodeReplacerTest_Getter { | 2315 implements NodeReplacerTest_Getter<PrefixExpression, Expression> { |
| 2769 @override | 2316 @override |
| 2770 Expression get(PrefixExpression node) => node.operand; | 2317 Expression get(PrefixExpression node) => node.operand; |
| 2771 } | 2318 } |
| 2772 | 2319 |
| 2773 class Getter_NodeReplacerTest_test_propertyAccess | 2320 class Getter_NodeReplacerTest_test_propertyAccess |
| 2774 implements NodeReplacerTest_Getter { | 2321 implements NodeReplacerTest_Getter<PropertyAccess, Expression> { |
| 2775 @override | 2322 @override |
| 2776 Expression get(PropertyAccess node) => node.target; | 2323 Expression get(PropertyAccess node) => node.target; |
| 2777 } | 2324 } |
| 2778 | 2325 |
| 2779 class Getter_NodeReplacerTest_test_propertyAccess_2 | 2326 class Getter_NodeReplacerTest_test_propertyAccess_2 |
| 2780 implements NodeReplacerTest_Getter { | 2327 implements NodeReplacerTest_Getter<PropertyAccess, SimpleIdentifier> { |
| 2781 @override | 2328 @override |
| 2782 SimpleIdentifier get(PropertyAccess node) => node.propertyName; | 2329 SimpleIdentifier get(PropertyAccess node) => node.propertyName; |
| 2783 } | 2330 } |
| 2784 | 2331 |
| 2785 class Getter_NodeReplacerTest_test_redirectingConstructorInvocation | 2332 class Getter_NodeReplacerTest_test_redirectingConstructorInvocation |
| 2786 implements NodeReplacerTest_Getter { | 2333 implements |
| 2334 NodeReplacerTest_Getter<RedirectingConstructorInvocation, |
| 2335 SimpleIdentifier> { |
| 2787 @override | 2336 @override |
| 2788 SimpleIdentifier get(RedirectingConstructorInvocation node) => | 2337 SimpleIdentifier get(RedirectingConstructorInvocation node) => |
| 2789 node.constructorName; | 2338 node.constructorName; |
| 2790 } | 2339 } |
| 2791 | 2340 |
| 2792 class Getter_NodeReplacerTest_test_redirectingConstructorInvocation_2 | 2341 class Getter_NodeReplacerTest_test_redirectingConstructorInvocation_2 |
| 2793 implements NodeReplacerTest_Getter { | 2342 implements |
| 2343 NodeReplacerTest_Getter<RedirectingConstructorInvocation, |
| 2344 ArgumentList> { |
| 2794 @override | 2345 @override |
| 2795 ArgumentList get(RedirectingConstructorInvocation node) => node.argumentList; | 2346 ArgumentList get(RedirectingConstructorInvocation node) => node.argumentList; |
| 2796 } | 2347 } |
| 2797 | 2348 |
| 2798 class Getter_NodeReplacerTest_test_returnStatement | 2349 class Getter_NodeReplacerTest_test_returnStatement |
| 2799 implements NodeReplacerTest_Getter { | 2350 implements NodeReplacerTest_Getter<ReturnStatement, Expression> { |
| 2800 @override | 2351 @override |
| 2801 Expression get(ReturnStatement node) => node.expression; | 2352 Expression get(ReturnStatement node) => node.expression; |
| 2802 } | 2353 } |
| 2803 | 2354 |
| 2804 class Getter_NodeReplacerTest_test_simpleFormalParameter | 2355 class Getter_NodeReplacerTest_test_simpleFormalParameter |
| 2805 implements NodeReplacerTest_Getter { | 2356 implements NodeReplacerTest_Getter<SimpleFormalParameter, TypeName> { |
| 2806 @override | 2357 @override |
| 2807 TypeName get(SimpleFormalParameter node) => node.type; | 2358 TypeName get(SimpleFormalParameter node) => node.type; |
| 2808 } | 2359 } |
| 2809 | 2360 |
| 2810 class Getter_NodeReplacerTest_test_superConstructorInvocation | 2361 class Getter_NodeReplacerTest_test_superConstructorInvocation |
| 2811 implements NodeReplacerTest_Getter { | 2362 implements |
| 2363 NodeReplacerTest_Getter<SuperConstructorInvocation, SimpleIdentifier> { |
| 2812 @override | 2364 @override |
| 2813 SimpleIdentifier get(SuperConstructorInvocation node) => node.constructorName; | 2365 SimpleIdentifier get(SuperConstructorInvocation node) => node.constructorName; |
| 2814 } | 2366 } |
| 2815 | 2367 |
| 2816 class Getter_NodeReplacerTest_test_superConstructorInvocation_2 | 2368 class Getter_NodeReplacerTest_test_superConstructorInvocation_2 |
| 2817 implements NodeReplacerTest_Getter { | 2369 implements |
| 2370 NodeReplacerTest_Getter<SuperConstructorInvocation, ArgumentList> { |
| 2818 @override | 2371 @override |
| 2819 ArgumentList get(SuperConstructorInvocation node) => node.argumentList; | 2372 ArgumentList get(SuperConstructorInvocation node) => node.argumentList; |
| 2820 } | 2373 } |
| 2821 | 2374 |
| 2822 class Getter_NodeReplacerTest_test_switchCase | 2375 class Getter_NodeReplacerTest_test_switchCase |
| 2823 implements NodeReplacerTest_Getter { | 2376 implements NodeReplacerTest_Getter<SwitchCase, Expression> { |
| 2824 @override | 2377 @override |
| 2825 Expression get(SwitchCase node) => node.expression; | 2378 Expression get(SwitchCase node) => node.expression; |
| 2826 } | 2379 } |
| 2827 | 2380 |
| 2828 class Getter_NodeReplacerTest_test_switchStatement | 2381 class Getter_NodeReplacerTest_test_switchStatement |
| 2829 implements NodeReplacerTest_Getter { | 2382 implements NodeReplacerTest_Getter<SwitchStatement, Expression> { |
| 2830 @override | 2383 @override |
| 2831 Expression get(SwitchStatement node) => node.expression; | 2384 Expression get(SwitchStatement node) => node.expression; |
| 2832 } | 2385 } |
| 2833 | 2386 |
| 2834 class Getter_NodeReplacerTest_test_throwExpression | 2387 class Getter_NodeReplacerTest_test_throwExpression |
| 2835 implements NodeReplacerTest_Getter { | 2388 implements NodeReplacerTest_Getter<ThrowExpression, Expression> { |
| 2836 @override | 2389 @override |
| 2837 Expression get(ThrowExpression node) => node.expression; | 2390 Expression get(ThrowExpression node) => node.expression; |
| 2838 } | 2391 } |
| 2839 | 2392 |
| 2840 class Getter_NodeReplacerTest_test_topLevelVariableDeclaration | 2393 class Getter_NodeReplacerTest_test_topLevelVariableDeclaration |
| 2841 implements NodeReplacerTest_Getter { | 2394 implements |
| 2395 NodeReplacerTest_Getter<TopLevelVariableDeclaration, |
| 2396 VariableDeclarationList> { |
| 2842 @override | 2397 @override |
| 2843 VariableDeclarationList get(TopLevelVariableDeclaration node) => | 2398 VariableDeclarationList get(TopLevelVariableDeclaration node) => |
| 2844 node.variables; | 2399 node.variables; |
| 2845 } | 2400 } |
| 2846 | 2401 |
| 2847 class Getter_NodeReplacerTest_test_tryStatement | 2402 class Getter_NodeReplacerTest_test_tryStatement |
| 2848 implements NodeReplacerTest_Getter { | 2403 implements NodeReplacerTest_Getter<TryStatement, Block> { |
| 2849 @override | 2404 @override |
| 2850 Block get(TryStatement node) => node.finallyBlock; | 2405 Block get(TryStatement node) => node.finallyBlock; |
| 2851 } | 2406 } |
| 2852 | 2407 |
| 2853 class Getter_NodeReplacerTest_test_tryStatement_2 | 2408 class Getter_NodeReplacerTest_test_tryStatement_2 |
| 2854 implements NodeReplacerTest_Getter { | 2409 implements NodeReplacerTest_Getter<TryStatement, Block> { |
| 2855 @override | 2410 @override |
| 2856 Block get(TryStatement node) => node.body; | 2411 Block get(TryStatement node) => node.body; |
| 2857 } | 2412 } |
| 2858 | 2413 |
| 2859 class Getter_NodeReplacerTest_test_typeName implements NodeReplacerTest_Getter { | 2414 class Getter_NodeReplacerTest_test_typeName |
| 2415 implements NodeReplacerTest_Getter<TypeName, TypeArgumentList> { |
| 2860 @override | 2416 @override |
| 2861 TypeArgumentList get(TypeName node) => node.typeArguments; | 2417 TypeArgumentList get(TypeName node) => node.typeArguments; |
| 2862 } | 2418 } |
| 2863 | 2419 |
| 2864 class Getter_NodeReplacerTest_test_typeName_2 | 2420 class Getter_NodeReplacerTest_test_typeName_2 |
| 2865 implements NodeReplacerTest_Getter { | 2421 implements NodeReplacerTest_Getter<TypeName, Identifier> { |
| 2866 @override | 2422 @override |
| 2867 Identifier get(TypeName node) => node.name; | 2423 Identifier get(TypeName node) => node.name; |
| 2868 } | 2424 } |
| 2869 | 2425 |
| 2870 class Getter_NodeReplacerTest_test_typeParameter | 2426 class Getter_NodeReplacerTest_test_typeParameter |
| 2871 implements NodeReplacerTest_Getter { | 2427 implements NodeReplacerTest_Getter<TypeParameter, TypeName> { |
| 2872 @override | 2428 @override |
| 2873 TypeName get(TypeParameter node) => node.bound; | 2429 TypeName get(TypeParameter node) => node.bound; |
| 2874 } | 2430 } |
| 2875 | 2431 |
| 2876 class Getter_NodeReplacerTest_test_typeParameter_2 | 2432 class Getter_NodeReplacerTest_test_typeParameter_2 |
| 2877 implements NodeReplacerTest_Getter { | 2433 implements NodeReplacerTest_Getter<TypeParameter, SimpleIdentifier> { |
| 2878 @override | 2434 @override |
| 2879 SimpleIdentifier get(TypeParameter node) => node.name; | 2435 SimpleIdentifier get(TypeParameter node) => node.name; |
| 2880 } | 2436 } |
| 2881 | 2437 |
| 2882 class Getter_NodeReplacerTest_test_variableDeclaration | 2438 class Getter_NodeReplacerTest_test_variableDeclaration |
| 2883 implements NodeReplacerTest_Getter { | 2439 implements NodeReplacerTest_Getter<VariableDeclaration, SimpleIdentifier> { |
| 2884 @override | 2440 @override |
| 2885 SimpleIdentifier get(VariableDeclaration node) => node.name; | 2441 SimpleIdentifier get(VariableDeclaration node) => node.name; |
| 2886 } | 2442 } |
| 2887 | 2443 |
| 2888 class Getter_NodeReplacerTest_test_variableDeclaration_2 | 2444 class Getter_NodeReplacerTest_test_variableDeclaration_2 |
| 2889 implements NodeReplacerTest_Getter { | 2445 implements NodeReplacerTest_Getter<VariableDeclaration, Expression> { |
| 2890 @override | 2446 @override |
| 2891 Expression get(VariableDeclaration node) => node.initializer; | 2447 Expression get(VariableDeclaration node) => node.initializer; |
| 2892 } | 2448 } |
| 2893 | 2449 |
| 2894 class Getter_NodeReplacerTest_test_variableDeclarationList | 2450 class Getter_NodeReplacerTest_test_variableDeclarationList |
| 2895 implements NodeReplacerTest_Getter { | 2451 implements NodeReplacerTest_Getter<VariableDeclarationList, TypeName> { |
| 2896 @override | 2452 @override |
| 2897 TypeName get(VariableDeclarationList node) => node.type; | 2453 TypeName get(VariableDeclarationList node) => node.type; |
| 2898 } | 2454 } |
| 2899 | 2455 |
| 2900 class Getter_NodeReplacerTest_test_variableDeclarationStatement | 2456 class Getter_NodeReplacerTest_test_variableDeclarationStatement |
| 2901 implements NodeReplacerTest_Getter { | 2457 implements |
| 2458 NodeReplacerTest_Getter<VariableDeclarationStatement, |
| 2459 VariableDeclarationList> { |
| 2902 @override | 2460 @override |
| 2903 VariableDeclarationList get(VariableDeclarationStatement node) => | 2461 VariableDeclarationList get(VariableDeclarationStatement node) => |
| 2904 node.variables; | 2462 node.variables; |
| 2905 } | 2463 } |
| 2906 | 2464 |
| 2907 class Getter_NodeReplacerTest_test_whileStatement | 2465 class Getter_NodeReplacerTest_test_whileStatement |
| 2908 implements NodeReplacerTest_Getter { | 2466 implements NodeReplacerTest_Getter<WhileStatement, Expression> { |
| 2909 @override | 2467 @override |
| 2910 Expression get(WhileStatement node) => node.condition; | 2468 Expression get(WhileStatement node) => node.condition; |
| 2911 } | 2469 } |
| 2912 | 2470 |
| 2913 class Getter_NodeReplacerTest_test_whileStatement_2 | 2471 class Getter_NodeReplacerTest_test_whileStatement_2 |
| 2914 implements NodeReplacerTest_Getter { | 2472 implements NodeReplacerTest_Getter<WhileStatement, Statement> { |
| 2915 @override | 2473 @override |
| 2916 Statement get(WhileStatement node) => node.body; | 2474 Statement get(WhileStatement node) => node.body; |
| 2917 } | 2475 } |
| 2918 | 2476 |
| 2919 class Getter_NodeReplacerTest_test_yieldStatement | 2477 class Getter_NodeReplacerTest_test_yieldStatement |
| 2920 implements NodeReplacerTest_Getter { | 2478 implements NodeReplacerTest_Getter<YieldStatement, Expression> { |
| 2921 @override | 2479 @override |
| 2922 Expression get(YieldStatement node) => node.expression; | 2480 Expression get(YieldStatement node) => node.expression; |
| 2923 } | 2481 } |
| 2924 | 2482 |
| 2925 class Getter_NodeReplacerTest_testAnnotatedNode | 2483 class Getter_NodeReplacerTest_testAnnotatedNode |
| 2926 implements NodeReplacerTest_Getter { | 2484 implements NodeReplacerTest_Getter<AnnotatedNode, Comment> { |
| 2927 @override | 2485 @override |
| 2928 Comment get(AnnotatedNode node) => node.documentationComment; | 2486 Comment get(AnnotatedNode node) => node.documentationComment; |
| 2929 } | 2487 } |
| 2930 | 2488 |
| 2931 class Getter_NodeReplacerTest_testNormalFormalParameter | 2489 class Getter_NodeReplacerTest_testNormalFormalParameter |
| 2932 implements NodeReplacerTest_Getter { | 2490 implements |
| 2491 NodeReplacerTest_Getter<NormalFormalParameter, SimpleIdentifier> { |
| 2933 @override | 2492 @override |
| 2934 SimpleIdentifier get(NormalFormalParameter node) => node.identifier; | 2493 SimpleIdentifier get(NormalFormalParameter node) => node.identifier; |
| 2935 } | 2494 } |
| 2936 | 2495 |
| 2937 class Getter_NodeReplacerTest_testNormalFormalParameter_2 | 2496 class Getter_NodeReplacerTest_testNormalFormalParameter_2 |
| 2938 implements NodeReplacerTest_Getter { | 2497 implements NodeReplacerTest_Getter<NormalFormalParameter, Comment> { |
| 2939 @override | 2498 @override |
| 2940 Comment get(NormalFormalParameter node) => node.documentationComment; | 2499 Comment get(NormalFormalParameter node) => node.documentationComment; |
| 2941 } | 2500 } |
| 2942 | 2501 |
| 2943 class Getter_NodeReplacerTest_testTypedLiteral | 2502 class Getter_NodeReplacerTest_testTypedLiteral |
| 2944 implements NodeReplacerTest_Getter { | 2503 implements NodeReplacerTest_Getter<TypedLiteral, TypeArgumentList> { |
| 2945 @override | 2504 @override |
| 2946 TypeArgumentList get(TypedLiteral node) => node.typeArguments; | 2505 TypeArgumentList get(TypedLiteral node) => node.typeArguments; |
| 2947 } | 2506 } |
| 2948 | 2507 |
| 2949 class Getter_NodeReplacerTest_testUriBasedDirective | 2508 class Getter_NodeReplacerTest_testUriBasedDirective |
| 2950 implements NodeReplacerTest_Getter { | 2509 implements NodeReplacerTest_Getter<UriBasedDirective, StringLiteral> { |
| 2951 @override | 2510 @override |
| 2952 StringLiteral get(UriBasedDirective node) => node.uri; | 2511 StringLiteral get(UriBasedDirective node) => node.uri; |
| 2953 } | 2512 } |
| 2954 | 2513 |
| 2955 @reflectiveTest | 2514 @reflectiveTest |
| 2956 class LineInfoTest { | 2515 class LineInfoTest { |
| 2957 void test_creation() { | 2516 void test_creation() { |
| 2958 expect(new LineInfo(<int>[0]), isNotNull); | 2517 expect(new LineInfo(<int>[0]), isNotNull); |
| 2959 } | 2518 } |
| 2960 | 2519 |
| 2961 void test_creation_empty() { | 2520 void test_creation_empty() { |
| 2962 try { | 2521 expect(() { |
| 2963 new LineInfo(<int>[]); | 2522 new LineInfo(<int>[]); |
| 2964 fail("Expected IllegalArgumentException"); | 2523 }, throwsArgumentError); |
| 2965 } on IllegalArgumentException { | |
| 2966 // Expected | |
| 2967 } | |
| 2968 } | 2524 } |
| 2969 | 2525 |
| 2970 void test_creation_null() { | 2526 void test_creation_null() { |
| 2971 try { | 2527 expect(() { |
| 2972 new LineInfo(null); | 2528 new LineInfo(null); |
| 2973 fail("Expected IllegalArgumentException"); | 2529 }, throwsArgumentError); |
| 2974 } on IllegalArgumentException { | |
| 2975 // Expected | |
| 2976 } | |
| 2977 } | 2530 } |
| 2978 | 2531 |
| 2979 void test_firstLine() { | 2532 void test_firstLine() { |
| 2980 LineInfo info = new LineInfo(<int>[0, 12, 34]); | 2533 LineInfo info = new LineInfo(<int>[0, 12, 34]); |
| 2981 LineInfo_Location location = info.getLocation(4); | 2534 LineInfo_Location location = info.getLocation(4); |
| 2982 expect(location.lineNumber, 1); | 2535 expect(location.lineNumber, 1); |
| 2983 expect(location.columnNumber, 5); | 2536 expect(location.columnNumber, 5); |
| 2984 } | 2537 } |
| 2985 | 2538 |
| 2986 void test_lastLine() { | 2539 void test_lastLine() { |
| (...skipping 275 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3262 | 2815 |
| 3263 class ListGetter_NodeReplacerTest_testSwitchMember_2 | 2816 class ListGetter_NodeReplacerTest_testSwitchMember_2 |
| 3264 extends NodeReplacerTest_ListGetter<SwitchMember, Statement> { | 2817 extends NodeReplacerTest_ListGetter<SwitchMember, Statement> { |
| 3265 ListGetter_NodeReplacerTest_testSwitchMember_2(int arg0) : super(arg0); | 2818 ListGetter_NodeReplacerTest_testSwitchMember_2(int arg0) : super(arg0); |
| 3266 | 2819 |
| 3267 @override | 2820 @override |
| 3268 NodeList<Statement> getList(SwitchMember node) => node.statements; | 2821 NodeList<Statement> getList(SwitchMember node) => node.statements; |
| 3269 } | 2822 } |
| 3270 | 2823 |
| 3271 @reflectiveTest | 2824 @reflectiveTest |
| 3272 class ListUtilitiesTest { | |
| 3273 void test_addAll_emptyToEmpty() { | |
| 3274 List<String> list = new List<String>(); | |
| 3275 List<String> elements = <String>[]; | |
| 3276 ListUtilities.addAll(list, elements); | |
| 3277 expect(list.length, 0); | |
| 3278 } | |
| 3279 | |
| 3280 void test_addAll_emptyToNonEmpty() { | |
| 3281 List<String> list = new List<String>(); | |
| 3282 list.add("a"); | |
| 3283 List<String> elements = <String>[]; | |
| 3284 ListUtilities.addAll(list, elements); | |
| 3285 expect(list.length, 1); | |
| 3286 } | |
| 3287 | |
| 3288 void test_addAll_nonEmptyToEmpty() { | |
| 3289 List<String> list = new List<String>(); | |
| 3290 List<String> elements = ["b", "c"]; | |
| 3291 ListUtilities.addAll(list, elements); | |
| 3292 expect(list.length, 2); | |
| 3293 } | |
| 3294 | |
| 3295 void test_addAll_nonEmptyToNonEmpty() { | |
| 3296 List<String> list = new List<String>(); | |
| 3297 list.add("a"); | |
| 3298 List<String> elements = ["b", "c"]; | |
| 3299 ListUtilities.addAll(list, elements); | |
| 3300 expect(list.length, 3); | |
| 3301 } | |
| 3302 } | |
| 3303 | |
| 3304 @reflectiveTest | |
| 3305 class MultipleMapIteratorTest extends EngineTestCase { | 2825 class MultipleMapIteratorTest extends EngineTestCase { |
| 3306 void test_multipleMaps_firstEmpty() { | 2826 void test_multipleMaps_firstEmpty() { |
| 3307 Map<String, String> map1 = new HashMap<String, String>(); | 2827 Map<String, String> map1 = new HashMap<String, String>(); |
| 3308 Map<String, String> map2 = new HashMap<String, String>(); | 2828 Map<String, String> map2 = new HashMap<String, String>(); |
| 3309 map2["k2"] = "v2"; | 2829 map2["k2"] = "v2"; |
| 3310 Map<String, String> map3 = new HashMap<String, String>(); | 2830 Map<String, String> map3 = new HashMap<String, String>(); |
| 3311 map3["k3"] = "v3"; | 2831 map3["k3"] = "v3"; |
| 3312 MultipleMapIterator<String, String> iterator = | 2832 MultipleMapIterator<String, String> iterator = |
| 3313 _iterator([map1, map2, map3]); | 2833 _iterator([map1, map2, map3]); |
| 3314 expect(iterator.moveNext(), isTrue); | 2834 expect(iterator.moveNext(), isTrue); |
| (...skipping 45 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3360 void test_noMap() { | 2880 void test_noMap() { |
| 3361 MultipleMapIterator<String, String> iterator = _iterator([]); | 2881 MultipleMapIterator<String, String> iterator = _iterator([]); |
| 3362 expect(iterator.moveNext(), isFalse); | 2882 expect(iterator.moveNext(), isFalse); |
| 3363 expect(iterator.moveNext(), isFalse); | 2883 expect(iterator.moveNext(), isFalse); |
| 3364 } | 2884 } |
| 3365 | 2885 |
| 3366 void test_singleMap_empty() { | 2886 void test_singleMap_empty() { |
| 3367 Map<String, String> map = new HashMap<String, String>(); | 2887 Map<String, String> map = new HashMap<String, String>(); |
| 3368 MultipleMapIterator<String, String> iterator = _iterator(<Map>[map]); | 2888 MultipleMapIterator<String, String> iterator = _iterator(<Map>[map]); |
| 3369 expect(iterator.moveNext(), isFalse); | 2889 expect(iterator.moveNext(), isFalse); |
| 3370 try { | 2890 expect(() => iterator.key, throwsStateError); |
| 3371 iterator.key; | 2891 expect(() => iterator.value, throwsStateError); |
| 3372 fail("Expected NoSuchElementException"); | 2892 expect(() { |
| 3373 } on NoSuchElementException { | 2893 iterator.value = 'x'; |
| 3374 // Expected | 2894 }, throwsStateError); |
| 3375 } | |
| 3376 try { | |
| 3377 iterator.value; | |
| 3378 fail("Expected NoSuchElementException"); | |
| 3379 } on NoSuchElementException { | |
| 3380 // Expected | |
| 3381 } | |
| 3382 try { | |
| 3383 iterator.value = "x"; | |
| 3384 fail("Expected NoSuchElementException"); | |
| 3385 } on NoSuchElementException { | |
| 3386 // Expected | |
| 3387 } | |
| 3388 } | 2895 } |
| 3389 | 2896 |
| 3390 void test_singleMap_multiple() { | 2897 void test_singleMap_multiple() { |
| 3391 Map<String, String> map = new HashMap<String, String>(); | 2898 Map<String, String> map = new HashMap<String, String>(); |
| 3392 map["k1"] = "v1"; | 2899 map["k1"] = "v1"; |
| 3393 map["k2"] = "v2"; | 2900 map["k2"] = "v2"; |
| 3394 map["k3"] = "v3"; | 2901 map["k3"] = "v3"; |
| 3395 MultipleMapIterator<String, String> iterator = _iterator([map]); | 2902 MultipleMapIterator<String, String> iterator = _iterator([map]); |
| 3396 expect(iterator.moveNext(), isTrue); | 2903 expect(iterator.moveNext(), isTrue); |
| 3397 expect(iterator.moveNext(), isTrue); | 2904 expect(iterator.moveNext(), isTrue); |
| (...skipping 55 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3453 void test_asExpression() { | 2960 void test_asExpression() { |
| 3454 AsExpression node = AstFactory.asExpression( | 2961 AsExpression node = AstFactory.asExpression( |
| 3455 AstFactory.integer(0), | 2962 AstFactory.integer(0), |
| 3456 AstFactory.typeName3( | 2963 AstFactory.typeName3( |
| 3457 AstFactory.identifier3("a"), [AstFactory.typeName4("C")])); | 2964 AstFactory.identifier3("a"), [AstFactory.typeName4("C")])); |
| 3458 _assertReplace(node, new Getter_NodeReplacerTest_test_asExpression_2()); | 2965 _assertReplace(node, new Getter_NodeReplacerTest_test_asExpression_2()); |
| 3459 _assertReplace(node, new Getter_NodeReplacerTest_test_asExpression()); | 2966 _assertReplace(node, new Getter_NodeReplacerTest_test_asExpression()); |
| 3460 } | 2967 } |
| 3461 | 2968 |
| 3462 void test_assertStatement() { | 2969 void test_assertStatement() { |
| 3463 AssertStatement node = | 2970 AssertStatement node = AstFactory.assertStatement( |
| 3464 AstFactory.assertStatement(AstFactory.booleanLiteral(true)); | 2971 AstFactory.booleanLiteral(true), AstFactory.string2('foo')); |
| 3465 _assertReplace(node, new Getter_NodeReplacerTest_test_assertStatement()); | 2972 _assertReplace(node, new Getter_NodeReplacerTest_test_assertStatement()); |
| 2973 _assertReplace(node, new Getter_NodeReplacerTest_test_assertStatement_2()); |
| 3466 } | 2974 } |
| 3467 | 2975 |
| 3468 void test_assignmentExpression() { | 2976 void test_assignmentExpression() { |
| 3469 AssignmentExpression node = AstFactory.assignmentExpression( | 2977 AssignmentExpression node = AstFactory.assignmentExpression( |
| 3470 AstFactory.identifier3("l"), TokenType.EQ, AstFactory.identifier3("r")); | 2978 AstFactory.identifier3("l"), TokenType.EQ, AstFactory.identifier3("r")); |
| 3471 _assertReplace( | 2979 _assertReplace( |
| 3472 node, new Getter_NodeReplacerTest_test_assignmentExpression_2()); | 2980 node, new Getter_NodeReplacerTest_test_assignmentExpression_2()); |
| 3473 _assertReplace( | 2981 _assertReplace( |
| 3474 node, new Getter_NodeReplacerTest_test_assignmentExpression()); | 2982 node, new Getter_NodeReplacerTest_test_assignmentExpression()); |
| 3475 } | 2983 } |
| (...skipping 44 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3520 } | 3028 } |
| 3521 | 3029 |
| 3522 void test_classDeclaration() { | 3030 void test_classDeclaration() { |
| 3523 ClassDeclaration node = AstFactory.classDeclaration( | 3031 ClassDeclaration node = AstFactory.classDeclaration( |
| 3524 null, | 3032 null, |
| 3525 "A", | 3033 "A", |
| 3526 AstFactory.typeParameterList(["E"]), | 3034 AstFactory.typeParameterList(["E"]), |
| 3527 AstFactory.extendsClause(AstFactory.typeName4("B")), | 3035 AstFactory.extendsClause(AstFactory.typeName4("B")), |
| 3528 AstFactory.withClause([AstFactory.typeName4("C")]), | 3036 AstFactory.withClause([AstFactory.typeName4("C")]), |
| 3529 AstFactory.implementsClause([AstFactory.typeName4("D")]), [ | 3037 AstFactory.implementsClause([AstFactory.typeName4("D")]), [ |
| 3530 AstFactory.fieldDeclaration2( | 3038 AstFactory |
| 3531 false, null, [AstFactory.variableDeclaration("f")]) | 3039 .fieldDeclaration2(false, null, [AstFactory.variableDeclaration("f")]) |
| 3532 ]); | 3040 ]); |
| 3533 node.documentationComment = | 3041 node.documentationComment = |
| 3534 Comment.createEndOfLineComment(EMPTY_TOKEN_LIST); | 3042 Comment.createEndOfLineComment(EMPTY_TOKEN_LIST); |
| 3535 node.metadata.add(AstFactory.annotation(AstFactory.identifier3("a"))); | 3043 node.metadata.add(AstFactory.annotation(AstFactory.identifier3("a"))); |
| 3536 node.nativeClause = AstFactory.nativeClause(""); | 3044 node.nativeClause = AstFactory.nativeClause(""); |
| 3537 _assertReplace(node, new Getter_NodeReplacerTest_test_classDeclaration_6()); | 3045 _assertReplace(node, new Getter_NodeReplacerTest_test_classDeclaration_6()); |
| 3538 _assertReplace(node, new Getter_NodeReplacerTest_test_classDeclaration_5()); | 3046 _assertReplace(node, new Getter_NodeReplacerTest_test_classDeclaration_5()); |
| 3539 _assertReplace(node, new Getter_NodeReplacerTest_test_classDeclaration_4()); | 3047 _assertReplace(node, new Getter_NodeReplacerTest_test_classDeclaration_4()); |
| 3540 _assertReplace(node, new Getter_NodeReplacerTest_test_classDeclaration_2()); | 3048 _assertReplace(node, new Getter_NodeReplacerTest_test_classDeclaration_2()); |
| 3541 _assertReplace(node, new Getter_NodeReplacerTest_test_classDeclaration()); | 3049 _assertReplace(node, new Getter_NodeReplacerTest_test_classDeclaration()); |
| (...skipping 425 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3967 _assertReplace(node, new Getter_NodeReplacerTest_test_isExpression()); | 3475 _assertReplace(node, new Getter_NodeReplacerTest_test_isExpression()); |
| 3968 _assertReplace(node, new Getter_NodeReplacerTest_test_isExpression_2()); | 3476 _assertReplace(node, new Getter_NodeReplacerTest_test_isExpression_2()); |
| 3969 } | 3477 } |
| 3970 | 3478 |
| 3971 void test_label() { | 3479 void test_label() { |
| 3972 Label node = AstFactory.label2("l"); | 3480 Label node = AstFactory.label2("l"); |
| 3973 _assertReplace(node, new Getter_NodeReplacerTest_test_label()); | 3481 _assertReplace(node, new Getter_NodeReplacerTest_test_label()); |
| 3974 } | 3482 } |
| 3975 | 3483 |
| 3976 void test_labeledStatement() { | 3484 void test_labeledStatement() { |
| 3977 LabeledStatement node = AstFactory.labeledStatement( | 3485 LabeledStatement node = AstFactory |
| 3978 [AstFactory.label2("l")], AstFactory.block()); | 3486 .labeledStatement([AstFactory.label2("l")], AstFactory.block()); |
| 3979 _assertReplace( | 3487 _assertReplace( |
| 3980 node, new ListGetter_NodeReplacerTest_test_labeledStatement(0)); | 3488 node, new ListGetter_NodeReplacerTest_test_labeledStatement(0)); |
| 3981 _assertReplace(node, new Getter_NodeReplacerTest_test_labeledStatement()); | 3489 _assertReplace(node, new Getter_NodeReplacerTest_test_labeledStatement()); |
| 3982 } | 3490 } |
| 3983 | 3491 |
| 3984 void test_libraryDirective() { | 3492 void test_libraryDirective() { |
| 3985 LibraryDirective node = AstFactory.libraryDirective2("lib"); | 3493 LibraryDirective node = AstFactory.libraryDirective2("lib"); |
| 3986 node.documentationComment = | 3494 node.documentationComment = |
| 3987 Comment.createEndOfLineComment(EMPTY_TOKEN_LIST); | 3495 Comment.createEndOfLineComment(EMPTY_TOKEN_LIST); |
| 3988 node.metadata.add(AstFactory.annotation(AstFactory.identifier3("a"))); | 3496 node.metadata.add(AstFactory.annotation(AstFactory.identifier3("a"))); |
| (...skipping 178 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 4167 } | 3675 } |
| 4168 | 3676 |
| 4169 void test_switchCase() { | 3677 void test_switchCase() { |
| 4170 SwitchCase node = AstFactory.switchCase2( | 3678 SwitchCase node = AstFactory.switchCase2( |
| 4171 [AstFactory.label2("l")], AstFactory.integer(0), [AstFactory.block()]); | 3679 [AstFactory.label2("l")], AstFactory.integer(0), [AstFactory.block()]); |
| 4172 _assertReplace(node, new Getter_NodeReplacerTest_test_switchCase()); | 3680 _assertReplace(node, new Getter_NodeReplacerTest_test_switchCase()); |
| 4173 _testSwitchMember(node); | 3681 _testSwitchMember(node); |
| 4174 } | 3682 } |
| 4175 | 3683 |
| 4176 void test_switchDefault() { | 3684 void test_switchDefault() { |
| 4177 SwitchDefault node = AstFactory.switchDefault( | 3685 SwitchDefault node = AstFactory |
| 4178 [AstFactory.label2("l")], [AstFactory.block()]); | 3686 .switchDefault([AstFactory.label2("l")], [AstFactory.block()]); |
| 4179 _testSwitchMember(node); | 3687 _testSwitchMember(node); |
| 4180 } | 3688 } |
| 4181 | 3689 |
| 4182 void test_switchStatement() { | 3690 void test_switchStatement() { |
| 4183 SwitchStatement node = | 3691 SwitchStatement node = |
| 4184 AstFactory.switchStatement(AstFactory.identifier3("x"), [ | 3692 AstFactory.switchStatement(AstFactory.identifier3("x"), [ |
| 4185 AstFactory.switchCase2([AstFactory.label2("l")], AstFactory.integer(0), | 3693 AstFactory.switchCase2([AstFactory.label2("l")], AstFactory.integer(0), |
| 4186 [AstFactory.block()]), | 3694 [AstFactory.block()]), |
| 4187 AstFactory.switchDefault([AstFactory.label2("l")], [AstFactory.block()]) | 3695 AstFactory.switchDefault([AstFactory.label2("l")], [AstFactory.block()]) |
| 4188 ]); | 3696 ]); |
| (...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 4221 } | 3729 } |
| 4222 | 3730 |
| 4223 void test_typeArgumentList() { | 3731 void test_typeArgumentList() { |
| 4224 TypeArgumentList node = | 3732 TypeArgumentList node = |
| 4225 AstFactory.typeArgumentList([AstFactory.typeName4("A")]); | 3733 AstFactory.typeArgumentList([AstFactory.typeName4("A")]); |
| 4226 _assertReplace( | 3734 _assertReplace( |
| 4227 node, new ListGetter_NodeReplacerTest_test_typeArgumentList(0)); | 3735 node, new ListGetter_NodeReplacerTest_test_typeArgumentList(0)); |
| 4228 } | 3736 } |
| 4229 | 3737 |
| 4230 void test_typeName() { | 3738 void test_typeName() { |
| 4231 TypeName node = AstFactory.typeName4( | 3739 TypeName node = AstFactory |
| 4232 "T", [AstFactory.typeName4("E"), AstFactory.typeName4("F")]); | 3740 .typeName4("T", [AstFactory.typeName4("E"), AstFactory.typeName4("F")]); |
| 4233 _assertReplace(node, new Getter_NodeReplacerTest_test_typeName_2()); | 3741 _assertReplace(node, new Getter_NodeReplacerTest_test_typeName_2()); |
| 4234 _assertReplace(node, new Getter_NodeReplacerTest_test_typeName()); | 3742 _assertReplace(node, new Getter_NodeReplacerTest_test_typeName()); |
| 4235 } | 3743 } |
| 4236 | 3744 |
| 4237 void test_typeParameter() { | 3745 void test_typeParameter() { |
| 4238 TypeParameter node = | 3746 TypeParameter node = |
| 4239 AstFactory.typeParameter2("E", AstFactory.typeName4("B")); | 3747 AstFactory.typeParameter2("E", AstFactory.typeName4("B")); |
| 4240 _assertReplace(node, new Getter_NodeReplacerTest_test_typeParameter_2()); | 3748 _assertReplace(node, new Getter_NodeReplacerTest_test_typeParameter_2()); |
| 4241 _assertReplace(node, new Getter_NodeReplacerTest_test_typeParameter()); | 3749 _assertReplace(node, new Getter_NodeReplacerTest_test_typeParameter()); |
| 4242 } | 3750 } |
| (...skipping 13 matching lines...) Expand all Loading... |
| 4256 _assertReplace( | 3764 _assertReplace( |
| 4257 node, new Getter_NodeReplacerTest_test_variableDeclaration()); | 3765 node, new Getter_NodeReplacerTest_test_variableDeclaration()); |
| 4258 _assertReplace( | 3766 _assertReplace( |
| 4259 node, new Getter_NodeReplacerTest_test_variableDeclaration_2()); | 3767 node, new Getter_NodeReplacerTest_test_variableDeclaration_2()); |
| 4260 _testAnnotatedNode(node); | 3768 _testAnnotatedNode(node); |
| 4261 } | 3769 } |
| 4262 | 3770 |
| 4263 void test_variableDeclarationList() { | 3771 void test_variableDeclarationList() { |
| 4264 VariableDeclarationList node = AstFactory.variableDeclarationList( | 3772 VariableDeclarationList node = AstFactory.variableDeclarationList( |
| 4265 null, AstFactory.typeName4("T"), [AstFactory.variableDeclaration("a")]); | 3773 null, AstFactory.typeName4("T"), [AstFactory.variableDeclaration("a")]); |
| 3774 node.documentationComment = |
| 3775 Comment.createEndOfLineComment(EMPTY_TOKEN_LIST); |
| 3776 node.metadata.add(AstFactory.annotation(AstFactory.identifier3("a"))); |
| 4266 _assertReplace( | 3777 _assertReplace( |
| 4267 node, new Getter_NodeReplacerTest_test_variableDeclarationList()); | 3778 node, new Getter_NodeReplacerTest_test_variableDeclarationList()); |
| 4268 _assertReplace( | 3779 _assertReplace( |
| 4269 node, new ListGetter_NodeReplacerTest_test_variableDeclarationList(0)); | 3780 node, new ListGetter_NodeReplacerTest_test_variableDeclarationList(0)); |
| 3781 _testAnnotatedNode(node); |
| 4270 } | 3782 } |
| 4271 | 3783 |
| 4272 void test_variableDeclarationStatement() { | 3784 void test_variableDeclarationStatement() { |
| 4273 VariableDeclarationStatement node = AstFactory.variableDeclarationStatement( | 3785 VariableDeclarationStatement node = AstFactory.variableDeclarationStatement( |
| 4274 null, AstFactory.typeName4("T"), [AstFactory.variableDeclaration("a")]); | 3786 null, AstFactory.typeName4("T"), [AstFactory.variableDeclaration("a")]); |
| 4275 _assertReplace( | 3787 _assertReplace( |
| 4276 node, new Getter_NodeReplacerTest_test_variableDeclarationStatement()); | 3788 node, new Getter_NodeReplacerTest_test_variableDeclarationStatement()); |
| 4277 } | 3789 } |
| 4278 | 3790 |
| 4279 void test_whileStatement() { | 3791 void test_whileStatement() { |
| (...skipping 80 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 4360 NodeList<C> getList(P parent); | 3872 NodeList<C> getList(P parent); |
| 4361 } | 3873 } |
| 4362 | 3874 |
| 4363 @reflectiveTest | 3875 @reflectiveTest |
| 4364 class SingleMapIteratorTest extends EngineTestCase { | 3876 class SingleMapIteratorTest extends EngineTestCase { |
| 4365 void test_empty() { | 3877 void test_empty() { |
| 4366 Map<String, String> map = new HashMap<String, String>(); | 3878 Map<String, String> map = new HashMap<String, String>(); |
| 4367 SingleMapIterator<String, String> iterator = | 3879 SingleMapIterator<String, String> iterator = |
| 4368 new SingleMapIterator<String, String>(map); | 3880 new SingleMapIterator<String, String>(map); |
| 4369 expect(iterator.moveNext(), isFalse); | 3881 expect(iterator.moveNext(), isFalse); |
| 4370 try { | 3882 expect(() => iterator.key, throwsStateError); |
| 4371 iterator.key; | 3883 expect(() => iterator.value, throwsStateError); |
| 4372 fail("Expected NoSuchElementException"); | 3884 expect(() { |
| 4373 } on NoSuchElementException { | 3885 iterator.value = 'x'; |
| 4374 // Expected | 3886 }, throwsStateError); |
| 4375 } | |
| 4376 try { | |
| 4377 iterator.value; | |
| 4378 fail("Expected NoSuchElementException"); | |
| 4379 } on NoSuchElementException { | |
| 4380 // Expected | |
| 4381 } | |
| 4382 try { | |
| 4383 iterator.value = "x"; | |
| 4384 fail("Expected NoSuchElementException"); | |
| 4385 } on NoSuchElementException { | |
| 4386 // Expected | |
| 4387 } | |
| 4388 expect(iterator.moveNext(), isFalse); | 3887 expect(iterator.moveNext(), isFalse); |
| 4389 } | 3888 } |
| 4390 | 3889 |
| 4391 void test_multiple() { | 3890 void test_multiple() { |
| 4392 Map<String, String> map = new HashMap<String, String>(); | 3891 Map<String, String> map = new HashMap<String, String>(); |
| 4393 map["k1"] = "v1"; | 3892 map["k1"] = "v1"; |
| 4394 map["k2"] = "v2"; | 3893 map["k2"] = "v2"; |
| 4395 map["k3"] = "v3"; | 3894 map["k3"] = "v3"; |
| 4396 SingleMapIterator<String, String> iterator = | 3895 SingleMapIterator<String, String> iterator = |
| 4397 new SingleMapIterator<String, String>(map); | 3896 new SingleMapIterator<String, String>(map); |
| (...skipping 161 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 4559 } | 4058 } |
| 4560 | 4059 |
| 4561 void test_toString() { | 4060 void test_toString() { |
| 4562 SourceRange r = new SourceRange(10, 1); | 4061 SourceRange r = new SourceRange(10, 1); |
| 4563 expect(r.toString(), "[offset=10, length=1]"); | 4062 expect(r.toString(), "[offset=10, length=1]"); |
| 4564 } | 4063 } |
| 4565 } | 4064 } |
| 4566 | 4065 |
| 4567 @reflectiveTest | 4066 @reflectiveTest |
| 4568 class StringUtilitiesTest { | 4067 class StringUtilitiesTest { |
| 4068 void test_computeLineStarts_n() { |
| 4069 List<int> starts = StringUtilities.computeLineStarts('a\nbb\nccc'); |
| 4070 expect(starts, <int>[0, 2, 5]); |
| 4071 } |
| 4072 |
| 4073 void test_computeLineStarts_r() { |
| 4074 List<int> starts = StringUtilities.computeLineStarts('a\rbb\rccc'); |
| 4075 expect(starts, <int>[0, 2, 5]); |
| 4076 } |
| 4077 |
| 4078 void test_computeLineStarts_rn() { |
| 4079 List<int> starts = StringUtilities.computeLineStarts('a\r\nbb\r\nccc'); |
| 4080 expect(starts, <int>[0, 3, 7]); |
| 4081 } |
| 4082 |
| 4569 void test_EMPTY() { | 4083 void test_EMPTY() { |
| 4570 expect(StringUtilities.EMPTY, ""); | 4084 expect(StringUtilities.EMPTY, ""); |
| 4571 expect(StringUtilities.EMPTY.isEmpty, isTrue); | 4085 expect(StringUtilities.EMPTY.isEmpty, isTrue); |
| 4572 } | 4086 } |
| 4573 | 4087 |
| 4574 void test_EMPTY_ARRAY() { | 4088 void test_EMPTY_ARRAY() { |
| 4575 expect(StringUtilities.EMPTY_ARRAY.length, 0); | 4089 expect(StringUtilities.EMPTY_ARRAY.length, 0); |
| 4576 } | 4090 } |
| 4577 | 4091 |
| 4578 void test_endsWith3() { | 4092 void test_endsWith3() { |
| (...skipping 76 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 4655 expect(StringUtilities.isTagName("0"), isFalse); | 4169 expect(StringUtilities.isTagName("0"), isFalse); |
| 4656 expect(StringUtilities.isTagName("0a"), isFalse); | 4170 expect(StringUtilities.isTagName("0a"), isFalse); |
| 4657 expect(StringUtilities.isTagName("a b"), isFalse); | 4171 expect(StringUtilities.isTagName("a b"), isFalse); |
| 4658 expect(StringUtilities.isTagName("a0"), isTrue); | 4172 expect(StringUtilities.isTagName("a0"), isTrue); |
| 4659 expect(StringUtilities.isTagName("a"), isTrue); | 4173 expect(StringUtilities.isTagName("a"), isTrue); |
| 4660 expect(StringUtilities.isTagName("ab"), isTrue); | 4174 expect(StringUtilities.isTagName("ab"), isTrue); |
| 4661 expect(StringUtilities.isTagName("a-b"), isTrue); | 4175 expect(StringUtilities.isTagName("a-b"), isTrue); |
| 4662 } | 4176 } |
| 4663 | 4177 |
| 4664 void test_printListOfQuotedNames_empty() { | 4178 void test_printListOfQuotedNames_empty() { |
| 4665 try { | 4179 expect(() { |
| 4666 StringUtilities.printListOfQuotedNames(new List<String>(0)); | 4180 StringUtilities.printListOfQuotedNames(new List<String>(0)); |
| 4667 fail("Expected IllegalArgumentException"); | 4181 }, throwsArgumentError); |
| 4668 } on IllegalArgumentException { | |
| 4669 // Expected | |
| 4670 } | |
| 4671 } | 4182 } |
| 4672 | 4183 |
| 4673 void test_printListOfQuotedNames_five() { | 4184 void test_printListOfQuotedNames_five() { |
| 4674 expect( | 4185 expect( |
| 4675 StringUtilities | 4186 StringUtilities |
| 4676 .printListOfQuotedNames(<String>["a", "b", "c", "d", "e"]), | 4187 .printListOfQuotedNames(<String>["a", "b", "c", "d", "e"]), |
| 4677 "'a', 'b', 'c', 'd' and 'e'"); | 4188 "'a', 'b', 'c', 'd' and 'e'"); |
| 4678 } | 4189 } |
| 4679 | 4190 |
| 4680 void test_printListOfQuotedNames_null() { | 4191 void test_printListOfQuotedNames_null() { |
| 4681 try { | 4192 expect(() { |
| 4682 StringUtilities.printListOfQuotedNames(null); | 4193 StringUtilities.printListOfQuotedNames(null); |
| 4683 fail("Expected IllegalArgumentException"); | 4194 }, throwsArgumentError); |
| 4684 } on IllegalArgumentException { | |
| 4685 // Expected | |
| 4686 } | |
| 4687 } | 4195 } |
| 4688 | 4196 |
| 4689 void test_printListOfQuotedNames_one() { | 4197 void test_printListOfQuotedNames_one() { |
| 4690 try { | 4198 expect(() { |
| 4691 StringUtilities.printListOfQuotedNames(<String>["a"]); | 4199 StringUtilities.printListOfQuotedNames(<String>["a"]); |
| 4692 fail("Expected IllegalArgumentException"); | 4200 }, throwsArgumentError); |
| 4693 } on IllegalArgumentException { | |
| 4694 // Expected | |
| 4695 } | |
| 4696 } | 4201 } |
| 4697 | 4202 |
| 4698 void test_printListOfQuotedNames_three() { | 4203 void test_printListOfQuotedNames_three() { |
| 4699 expect(StringUtilities.printListOfQuotedNames(<String>["a", "b", "c"]), | 4204 expect(StringUtilities.printListOfQuotedNames(<String>["a", "b", "c"]), |
| 4700 "'a', 'b' and 'c'"); | 4205 "'a', 'b' and 'c'"); |
| 4701 } | 4206 } |
| 4702 | 4207 |
| 4703 void test_printListOfQuotedNames_two() { | 4208 void test_printListOfQuotedNames_two() { |
| 4704 expect(StringUtilities.printListOfQuotedNames(<String>["a", "b"]), | 4209 expect(StringUtilities.printListOfQuotedNames(<String>["a", "b"]), |
| 4705 "'a' and 'b'"); | 4210 "'a' and 'b'"); |
| (...skipping 122 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 4828 } | 4333 } |
| 4829 | 4334 |
| 4830 void test_get_added() { | 4335 void test_get_added() { |
| 4831 TokenMap tokenMap = new TokenMap(); | 4336 TokenMap tokenMap = new TokenMap(); |
| 4832 Token key = TokenFactory.tokenFromType(TokenType.AT); | 4337 Token key = TokenFactory.tokenFromType(TokenType.AT); |
| 4833 Token value = TokenFactory.tokenFromType(TokenType.AT); | 4338 Token value = TokenFactory.tokenFromType(TokenType.AT); |
| 4834 tokenMap.put(key, value); | 4339 tokenMap.put(key, value); |
| 4835 expect(tokenMap.get(key), same(value)); | 4340 expect(tokenMap.get(key), same(value)); |
| 4836 } | 4341 } |
| 4837 } | 4342 } |
| OLD | NEW |