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 analyzer.test.generated.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/dart/ast/ast.dart'; | 9 import 'package:analyzer/dart/ast/ast.dart'; |
10 import 'package:analyzer/dart/ast/token.dart'; | 10 import 'package:analyzer/dart/ast/token.dart'; |
11 import 'package:analyzer/dart/ast/visitor.dart'; | 11 import 'package:analyzer/dart/ast/visitor.dart'; |
12 import 'package:analyzer/src/dart/ast/token.dart'; | 12 import 'package:analyzer/src/dart/ast/token.dart'; |
13 import 'package:analyzer/src/dart/ast/utilities.dart'; | 13 import 'package:analyzer/src/dart/ast/utilities.dart'; |
14 import 'package:analyzer/src/dart/scanner/reader.dart'; | 14 import 'package:analyzer/src/dart/scanner/reader.dart'; |
15 import 'package:analyzer/src/dart/scanner/scanner.dart'; | 15 import 'package:analyzer/src/dart/scanner/scanner.dart'; |
16 import 'package:analyzer/src/generated/java_engine.dart'; | 16 import 'package:analyzer/src/generated/java_engine.dart'; |
17 import 'package:analyzer/src/generated/parser.dart'; | 17 import 'package:analyzer/src/generated/parser.dart'; |
18 import 'package:analyzer/src/generated/source.dart'; | 18 import 'package:analyzer/src/generated/source.dart'; |
19 import 'package:analyzer/src/generated/testing/ast_factory.dart'; | 19 import 'package:analyzer/src/generated/testing/ast_test_factory.dart'; |
20 import 'package:analyzer/src/generated/testing/token_factory.dart'; | 20 import 'package:analyzer/src/generated/testing/token_factory.dart'; |
21 import 'package:analyzer/src/generated/utilities_collection.dart'; | 21 import 'package:analyzer/src/generated/utilities_collection.dart'; |
22 import 'package:test/test.dart'; | 22 import 'package:test/test.dart'; |
23 import 'package:test_reflective_loader/test_reflective_loader.dart'; | 23 import 'package:test_reflective_loader/test_reflective_loader.dart'; |
24 | 24 |
25 import 'test_support.dart'; | 25 import 'test_support.dart'; |
26 | 26 |
27 main() { | 27 main() { |
28 defineReflectiveSuite(() { | 28 defineReflectiveSuite(() { |
29 defineReflectiveTests(AstClonerTest); | 29 defineReflectiveTests(AstClonerTest); |
(...skipping 2914 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2944 } | 2944 } |
2945 | 2945 |
2946 @reflectiveTest | 2946 @reflectiveTest |
2947 class NodeReplacerTest extends EngineTestCase { | 2947 class NodeReplacerTest extends EngineTestCase { |
2948 /** | 2948 /** |
2949 * An empty list of tokens. | 2949 * An empty list of tokens. |
2950 */ | 2950 */ |
2951 static const List<Token> EMPTY_TOKEN_LIST = const <Token>[]; | 2951 static const List<Token> EMPTY_TOKEN_LIST = const <Token>[]; |
2952 | 2952 |
2953 void test_adjacentStrings() { | 2953 void test_adjacentStrings() { |
2954 AdjacentStrings node = AstFactory | 2954 AdjacentStrings node = AstTestFactory.adjacentStrings( |
2955 .adjacentStrings([AstFactory.string2("a"), AstFactory.string2("b")]); | 2955 [AstTestFactory.string2("a"), AstTestFactory.string2("b")]); |
2956 _assertReplace( | 2956 _assertReplace( |
2957 node, new ListGetter_NodeReplacerTest_test_adjacentStrings_2(0)); | 2957 node, new ListGetter_NodeReplacerTest_test_adjacentStrings_2(0)); |
2958 _assertReplace( | 2958 _assertReplace( |
2959 node, new ListGetter_NodeReplacerTest_test_adjacentStrings(1)); | 2959 node, new ListGetter_NodeReplacerTest_test_adjacentStrings(1)); |
2960 } | 2960 } |
2961 | 2961 |
2962 void test_annotation() { | 2962 void test_annotation() { |
2963 Annotation node = AstFactory.annotation2( | 2963 Annotation node = AstTestFactory.annotation2( |
2964 AstFactory.identifier3("C"), | 2964 AstTestFactory.identifier3("C"), |
2965 AstFactory.identifier3("c"), | 2965 AstTestFactory.identifier3("c"), |
2966 AstFactory.argumentList([AstFactory.integer(0)])); | 2966 AstTestFactory.argumentList([AstTestFactory.integer(0)])); |
2967 _assertReplace(node, new Getter_NodeReplacerTest_test_annotation()); | 2967 _assertReplace(node, new Getter_NodeReplacerTest_test_annotation()); |
2968 _assertReplace(node, new Getter_NodeReplacerTest_test_annotation_3()); | 2968 _assertReplace(node, new Getter_NodeReplacerTest_test_annotation_3()); |
2969 _assertReplace(node, new Getter_NodeReplacerTest_test_annotation_2()); | 2969 _assertReplace(node, new Getter_NodeReplacerTest_test_annotation_2()); |
2970 } | 2970 } |
2971 | 2971 |
2972 void test_argumentList() { | 2972 void test_argumentList() { |
2973 ArgumentList node = AstFactory.argumentList([AstFactory.integer(0)]); | 2973 ArgumentList node = |
| 2974 AstTestFactory.argumentList([AstTestFactory.integer(0)]); |
2974 _assertReplace(node, new ListGetter_NodeReplacerTest_test_argumentList(0)); | 2975 _assertReplace(node, new ListGetter_NodeReplacerTest_test_argumentList(0)); |
2975 } | 2976 } |
2976 | 2977 |
2977 void test_asExpression() { | 2978 void test_asExpression() { |
2978 AsExpression node = AstFactory.asExpression( | 2979 AsExpression node = AstTestFactory.asExpression( |
2979 AstFactory.integer(0), | 2980 AstTestFactory.integer(0), |
2980 AstFactory.typeName3( | 2981 AstTestFactory.typeName3( |
2981 AstFactory.identifier3("a"), [AstFactory.typeName4("C")])); | 2982 AstTestFactory.identifier3("a"), [AstTestFactory.typeName4("C")])); |
2982 _assertReplace(node, new Getter_NodeReplacerTest_test_asExpression_2()); | 2983 _assertReplace(node, new Getter_NodeReplacerTest_test_asExpression_2()); |
2983 _assertReplace(node, new Getter_NodeReplacerTest_test_asExpression()); | 2984 _assertReplace(node, new Getter_NodeReplacerTest_test_asExpression()); |
2984 } | 2985 } |
2985 | 2986 |
2986 void test_assertStatement() { | 2987 void test_assertStatement() { |
2987 AssertStatement node = AstFactory.assertStatement( | 2988 AssertStatement node = AstTestFactory.assertStatement( |
2988 AstFactory.booleanLiteral(true), AstFactory.string2('foo')); | 2989 AstTestFactory.booleanLiteral(true), AstTestFactory.string2('foo')); |
2989 _assertReplace(node, new Getter_NodeReplacerTest_test_assertStatement()); | 2990 _assertReplace(node, new Getter_NodeReplacerTest_test_assertStatement()); |
2990 _assertReplace(node, new Getter_NodeReplacerTest_test_assertStatement_2()); | 2991 _assertReplace(node, new Getter_NodeReplacerTest_test_assertStatement_2()); |
2991 } | 2992 } |
2992 | 2993 |
2993 void test_assignmentExpression() { | 2994 void test_assignmentExpression() { |
2994 AssignmentExpression node = AstFactory.assignmentExpression( | 2995 AssignmentExpression node = AstTestFactory.assignmentExpression( |
2995 AstFactory.identifier3("l"), TokenType.EQ, AstFactory.identifier3("r")); | 2996 AstTestFactory.identifier3("l"), |
| 2997 TokenType.EQ, |
| 2998 AstTestFactory.identifier3("r")); |
2996 _assertReplace( | 2999 _assertReplace( |
2997 node, new Getter_NodeReplacerTest_test_assignmentExpression_2()); | 3000 node, new Getter_NodeReplacerTest_test_assignmentExpression_2()); |
2998 _assertReplace( | 3001 _assertReplace( |
2999 node, new Getter_NodeReplacerTest_test_assignmentExpression()); | 3002 node, new Getter_NodeReplacerTest_test_assignmentExpression()); |
3000 } | 3003 } |
3001 | 3004 |
3002 void test_awaitExpression() { | 3005 void test_awaitExpression() { |
3003 var node = AstFactory.awaitExpression(AstFactory.identifier3("A")); | 3006 var node = AstTestFactory.awaitExpression(AstTestFactory.identifier3("A")); |
3004 _assertReplace(node, new Getter_NodeReplacerTest_test_awaitExpression()); | 3007 _assertReplace(node, new Getter_NodeReplacerTest_test_awaitExpression()); |
3005 } | 3008 } |
3006 | 3009 |
3007 void test_binaryExpression() { | 3010 void test_binaryExpression() { |
3008 BinaryExpression node = AstFactory.binaryExpression( | 3011 BinaryExpression node = AstTestFactory.binaryExpression( |
3009 AstFactory.identifier3("l"), | 3012 AstTestFactory.identifier3("l"), |
3010 TokenType.PLUS, | 3013 TokenType.PLUS, |
3011 AstFactory.identifier3("r")); | 3014 AstTestFactory.identifier3("r")); |
3012 _assertReplace(node, new Getter_NodeReplacerTest_test_binaryExpression()); | 3015 _assertReplace(node, new Getter_NodeReplacerTest_test_binaryExpression()); |
3013 _assertReplace(node, new Getter_NodeReplacerTest_test_binaryExpression_2()); | 3016 _assertReplace(node, new Getter_NodeReplacerTest_test_binaryExpression_2()); |
3014 } | 3017 } |
3015 | 3018 |
3016 void test_block() { | 3019 void test_block() { |
3017 Block node = AstFactory.block([AstFactory.emptyStatement()]); | 3020 Block node = AstTestFactory.block([AstTestFactory.emptyStatement()]); |
3018 _assertReplace(node, new ListGetter_NodeReplacerTest_test_block(0)); | 3021 _assertReplace(node, new ListGetter_NodeReplacerTest_test_block(0)); |
3019 } | 3022 } |
3020 | 3023 |
3021 void test_blockFunctionBody() { | 3024 void test_blockFunctionBody() { |
3022 BlockFunctionBody node = AstFactory.blockFunctionBody(AstFactory.block()); | 3025 BlockFunctionBody node = |
| 3026 AstTestFactory.blockFunctionBody(AstTestFactory.block()); |
3023 _assertReplace(node, new Getter_NodeReplacerTest_test_blockFunctionBody()); | 3027 _assertReplace(node, new Getter_NodeReplacerTest_test_blockFunctionBody()); |
3024 } | 3028 } |
3025 | 3029 |
3026 void test_breakStatement() { | 3030 void test_breakStatement() { |
3027 BreakStatement node = AstFactory.breakStatement2("l"); | 3031 BreakStatement node = AstTestFactory.breakStatement2("l"); |
3028 _assertReplace(node, new Getter_NodeReplacerTest_test_breakStatement()); | 3032 _assertReplace(node, new Getter_NodeReplacerTest_test_breakStatement()); |
3029 } | 3033 } |
3030 | 3034 |
3031 void test_cascadeExpression() { | 3035 void test_cascadeExpression() { |
3032 CascadeExpression node = AstFactory.cascadeExpression(AstFactory.integer(0), | 3036 CascadeExpression node = AstTestFactory.cascadeExpression( |
3033 [AstFactory.propertyAccess(null, AstFactory.identifier3("b"))]); | 3037 AstTestFactory.integer(0), |
| 3038 [AstTestFactory.propertyAccess(null, AstTestFactory.identifier3("b"))]); |
3034 _assertReplace(node, new Getter_NodeReplacerTest_test_cascadeExpression()); | 3039 _assertReplace(node, new Getter_NodeReplacerTest_test_cascadeExpression()); |
3035 _assertReplace( | 3040 _assertReplace( |
3036 node, new ListGetter_NodeReplacerTest_test_cascadeExpression(0)); | 3041 node, new ListGetter_NodeReplacerTest_test_cascadeExpression(0)); |
3037 } | 3042 } |
3038 | 3043 |
3039 void test_catchClause() { | 3044 void test_catchClause() { |
3040 CatchClause node = AstFactory.catchClause5( | 3045 CatchClause node = AstTestFactory.catchClause5( |
3041 AstFactory.typeName4("E"), "e", "s", [AstFactory.emptyStatement()]); | 3046 AstTestFactory.typeName4("E"), |
| 3047 "e", |
| 3048 "s", |
| 3049 [AstTestFactory.emptyStatement()]); |
3042 _assertReplace(node, new Getter_NodeReplacerTest_test_catchClause_3()); | 3050 _assertReplace(node, new Getter_NodeReplacerTest_test_catchClause_3()); |
3043 _assertReplace(node, new Getter_NodeReplacerTest_test_catchClause_2()); | 3051 _assertReplace(node, new Getter_NodeReplacerTest_test_catchClause_2()); |
3044 _assertReplace(node, new Getter_NodeReplacerTest_test_catchClause()); | 3052 _assertReplace(node, new Getter_NodeReplacerTest_test_catchClause()); |
3045 } | 3053 } |
3046 | 3054 |
3047 void test_classDeclaration() { | 3055 void test_classDeclaration() { |
3048 ClassDeclaration node = AstFactory.classDeclaration( | 3056 ClassDeclaration node = AstTestFactory.classDeclaration( |
3049 null, | 3057 null, |
3050 "A", | 3058 "A", |
3051 AstFactory.typeParameterList(["E"]), | 3059 AstTestFactory.typeParameterList(["E"]), |
3052 AstFactory.extendsClause(AstFactory.typeName4("B")), | 3060 AstTestFactory.extendsClause(AstTestFactory.typeName4("B")), |
3053 AstFactory.withClause([AstFactory.typeName4("C")]), | 3061 AstTestFactory.withClause([AstTestFactory.typeName4("C")]), |
3054 AstFactory.implementsClause([AstFactory.typeName4("D")]), [ | 3062 AstTestFactory.implementsClause([AstTestFactory.typeName4("D")]), [ |
3055 AstFactory | 3063 AstTestFactory.fieldDeclaration2( |
3056 .fieldDeclaration2(false, null, [AstFactory.variableDeclaration("f")]) | 3064 false, null, [AstTestFactory.variableDeclaration("f")]) |
3057 ]); | 3065 ]); |
3058 node.documentationComment = | 3066 node.documentationComment = |
3059 Comment.createEndOfLineComment(EMPTY_TOKEN_LIST); | 3067 Comment.createEndOfLineComment(EMPTY_TOKEN_LIST); |
3060 node.metadata.add(AstFactory.annotation(AstFactory.identifier3("a"))); | 3068 node.metadata |
3061 node.nativeClause = AstFactory.nativeClause(""); | 3069 .add(AstTestFactory.annotation(AstTestFactory.identifier3("a"))); |
| 3070 node.nativeClause = AstTestFactory.nativeClause(""); |
3062 _assertReplace(node, new Getter_NodeReplacerTest_test_classDeclaration_6()); | 3071 _assertReplace(node, new Getter_NodeReplacerTest_test_classDeclaration_6()); |
3063 _assertReplace(node, new Getter_NodeReplacerTest_test_classDeclaration_5()); | 3072 _assertReplace(node, new Getter_NodeReplacerTest_test_classDeclaration_5()); |
3064 _assertReplace(node, new Getter_NodeReplacerTest_test_classDeclaration_4()); | 3073 _assertReplace(node, new Getter_NodeReplacerTest_test_classDeclaration_4()); |
3065 _assertReplace(node, new Getter_NodeReplacerTest_test_classDeclaration_2()); | 3074 _assertReplace(node, new Getter_NodeReplacerTest_test_classDeclaration_2()); |
3066 _assertReplace(node, new Getter_NodeReplacerTest_test_classDeclaration()); | 3075 _assertReplace(node, new Getter_NodeReplacerTest_test_classDeclaration()); |
3067 _assertReplace(node, new Getter_NodeReplacerTest_test_classDeclaration_3()); | 3076 _assertReplace(node, new Getter_NodeReplacerTest_test_classDeclaration_3()); |
3068 _assertReplace( | 3077 _assertReplace( |
3069 node, new ListGetter_NodeReplacerTest_test_classDeclaration(0)); | 3078 node, new ListGetter_NodeReplacerTest_test_classDeclaration(0)); |
3070 _testAnnotatedNode(node); | 3079 _testAnnotatedNode(node); |
3071 } | 3080 } |
3072 | 3081 |
3073 void test_classTypeAlias() { | 3082 void test_classTypeAlias() { |
3074 ClassTypeAlias node = AstFactory.classTypeAlias( | 3083 ClassTypeAlias node = AstTestFactory.classTypeAlias( |
3075 "A", | 3084 "A", |
3076 AstFactory.typeParameterList(["E"]), | 3085 AstTestFactory.typeParameterList(["E"]), |
3077 null, | 3086 null, |
3078 AstFactory.typeName4("B"), | 3087 AstTestFactory.typeName4("B"), |
3079 AstFactory.withClause([AstFactory.typeName4("C")]), | 3088 AstTestFactory.withClause([AstTestFactory.typeName4("C")]), |
3080 AstFactory.implementsClause([AstFactory.typeName4("D")])); | 3089 AstTestFactory.implementsClause([AstTestFactory.typeName4("D")])); |
3081 node.documentationComment = | 3090 node.documentationComment = |
3082 Comment.createEndOfLineComment(EMPTY_TOKEN_LIST); | 3091 Comment.createEndOfLineComment(EMPTY_TOKEN_LIST); |
3083 node.metadata.add(AstFactory.annotation(AstFactory.identifier3("a"))); | 3092 node.metadata |
| 3093 .add(AstTestFactory.annotation(AstTestFactory.identifier3("a"))); |
3084 _assertReplace(node, new Getter_NodeReplacerTest_test_classTypeAlias_4()); | 3094 _assertReplace(node, new Getter_NodeReplacerTest_test_classTypeAlias_4()); |
3085 _assertReplace(node, new Getter_NodeReplacerTest_test_classTypeAlias_5()); | 3095 _assertReplace(node, new Getter_NodeReplacerTest_test_classTypeAlias_5()); |
3086 _assertReplace(node, new Getter_NodeReplacerTest_test_classTypeAlias()); | 3096 _assertReplace(node, new Getter_NodeReplacerTest_test_classTypeAlias()); |
3087 _assertReplace(node, new Getter_NodeReplacerTest_test_classTypeAlias_3()); | 3097 _assertReplace(node, new Getter_NodeReplacerTest_test_classTypeAlias_3()); |
3088 _assertReplace(node, new Getter_NodeReplacerTest_test_classTypeAlias_2()); | 3098 _assertReplace(node, new Getter_NodeReplacerTest_test_classTypeAlias_2()); |
3089 _testAnnotatedNode(node); | 3099 _testAnnotatedNode(node); |
3090 } | 3100 } |
3091 | 3101 |
3092 void test_comment() { | 3102 void test_comment() { |
3093 Comment node = Comment.createEndOfLineComment(EMPTY_TOKEN_LIST); | 3103 Comment node = Comment.createEndOfLineComment(EMPTY_TOKEN_LIST); |
3094 node.references | 3104 node.references |
3095 .add(new CommentReference(null, AstFactory.identifier3("x"))); | 3105 .add(new CommentReference(null, AstTestFactory.identifier3("x"))); |
3096 _assertReplace(node, new ListGetter_NodeReplacerTest_test_comment(0)); | 3106 _assertReplace(node, new ListGetter_NodeReplacerTest_test_comment(0)); |
3097 } | 3107 } |
3098 | 3108 |
3099 void test_commentReference() { | 3109 void test_commentReference() { |
3100 CommentReference node = | 3110 CommentReference node = |
3101 new CommentReference(null, AstFactory.identifier3("x")); | 3111 new CommentReference(null, AstTestFactory.identifier3("x")); |
3102 _assertReplace(node, new Getter_NodeReplacerTest_test_commentReference()); | 3112 _assertReplace(node, new Getter_NodeReplacerTest_test_commentReference()); |
3103 } | 3113 } |
3104 | 3114 |
3105 void test_compilationUnit() { | 3115 void test_compilationUnit() { |
3106 CompilationUnit node = AstFactory.compilationUnit8("", [ | 3116 CompilationUnit node = AstTestFactory.compilationUnit8("", [ |
3107 AstFactory.libraryDirective2("lib") | 3117 AstTestFactory.libraryDirective2("lib") |
3108 ], [ | 3118 ], [ |
3109 AstFactory.topLevelVariableDeclaration2( | 3119 AstTestFactory.topLevelVariableDeclaration2( |
3110 null, [AstFactory.variableDeclaration("X")]) | 3120 null, [AstTestFactory.variableDeclaration("X")]) |
3111 ]); | 3121 ]); |
3112 _assertReplace(node, new Getter_NodeReplacerTest_test_compilationUnit()); | 3122 _assertReplace(node, new Getter_NodeReplacerTest_test_compilationUnit()); |
3113 _assertReplace( | 3123 _assertReplace( |
3114 node, new ListGetter_NodeReplacerTest_test_compilationUnit(0)); | 3124 node, new ListGetter_NodeReplacerTest_test_compilationUnit(0)); |
3115 _assertReplace( | 3125 _assertReplace( |
3116 node, new ListGetter_NodeReplacerTest_test_compilationUnit_2(0)); | 3126 node, new ListGetter_NodeReplacerTest_test_compilationUnit_2(0)); |
3117 } | 3127 } |
3118 | 3128 |
3119 void test_conditionalExpression() { | 3129 void test_conditionalExpression() { |
3120 ConditionalExpression node = AstFactory.conditionalExpression( | 3130 ConditionalExpression node = AstTestFactory.conditionalExpression( |
3121 AstFactory.booleanLiteral(true), | 3131 AstTestFactory.booleanLiteral(true), |
3122 AstFactory.integer(0), | 3132 AstTestFactory.integer(0), |
3123 AstFactory.integer(1)); | 3133 AstTestFactory.integer(1)); |
3124 _assertReplace( | 3134 _assertReplace( |
3125 node, new Getter_NodeReplacerTest_test_conditionalExpression_3()); | 3135 node, new Getter_NodeReplacerTest_test_conditionalExpression_3()); |
3126 _assertReplace( | 3136 _assertReplace( |
3127 node, new Getter_NodeReplacerTest_test_conditionalExpression_2()); | 3137 node, new Getter_NodeReplacerTest_test_conditionalExpression_2()); |
3128 _assertReplace( | 3138 _assertReplace( |
3129 node, new Getter_NodeReplacerTest_test_conditionalExpression()); | 3139 node, new Getter_NodeReplacerTest_test_conditionalExpression()); |
3130 } | 3140 } |
3131 | 3141 |
3132 void test_constructorDeclaration() { | 3142 void test_constructorDeclaration() { |
3133 ConstructorDeclaration node = AstFactory.constructorDeclaration2( | 3143 ConstructorDeclaration node = AstTestFactory.constructorDeclaration2( |
3134 null, | 3144 null, |
3135 null, | 3145 null, |
3136 AstFactory.identifier3("C"), | 3146 AstTestFactory.identifier3("C"), |
3137 "d", | 3147 "d", |
3138 AstFactory.formalParameterList(), | 3148 AstTestFactory.formalParameterList(), |
3139 [ | 3149 [ |
3140 AstFactory.constructorFieldInitializer( | 3150 AstTestFactory.constructorFieldInitializer( |
3141 false, "x", AstFactory.integer(0)) | 3151 false, "x", AstTestFactory.integer(0)) |
3142 ], | 3152 ], |
3143 AstFactory.emptyFunctionBody()); | 3153 AstTestFactory.emptyFunctionBody()); |
3144 node.documentationComment = | 3154 node.documentationComment = |
3145 Comment.createEndOfLineComment(EMPTY_TOKEN_LIST); | 3155 Comment.createEndOfLineComment(EMPTY_TOKEN_LIST); |
3146 node.metadata.add(AstFactory.annotation(AstFactory.identifier3("a"))); | 3156 node.metadata |
| 3157 .add(AstTestFactory.annotation(AstTestFactory.identifier3("a"))); |
3147 node.redirectedConstructor = | 3158 node.redirectedConstructor = |
3148 AstFactory.constructorName(AstFactory.typeName4("B"), "a"); | 3159 AstTestFactory.constructorName(AstTestFactory.typeName4("B"), "a"); |
3149 _assertReplace( | 3160 _assertReplace( |
3150 node, new Getter_NodeReplacerTest_test_constructorDeclaration_3()); | 3161 node, new Getter_NodeReplacerTest_test_constructorDeclaration_3()); |
3151 _assertReplace( | 3162 _assertReplace( |
3152 node, new Getter_NodeReplacerTest_test_constructorDeclaration_2()); | 3163 node, new Getter_NodeReplacerTest_test_constructorDeclaration_2()); |
3153 _assertReplace( | 3164 _assertReplace( |
3154 node, new Getter_NodeReplacerTest_test_constructorDeclaration_4()); | 3165 node, new Getter_NodeReplacerTest_test_constructorDeclaration_4()); |
3155 _assertReplace( | 3166 _assertReplace( |
3156 node, new Getter_NodeReplacerTest_test_constructorDeclaration()); | 3167 node, new Getter_NodeReplacerTest_test_constructorDeclaration()); |
3157 _assertReplace( | 3168 _assertReplace( |
3158 node, new Getter_NodeReplacerTest_test_constructorDeclaration_5()); | 3169 node, new Getter_NodeReplacerTest_test_constructorDeclaration_5()); |
3159 _assertReplace( | 3170 _assertReplace( |
3160 node, new ListGetter_NodeReplacerTest_test_constructorDeclaration(0)); | 3171 node, new ListGetter_NodeReplacerTest_test_constructorDeclaration(0)); |
3161 _testAnnotatedNode(node); | 3172 _testAnnotatedNode(node); |
3162 } | 3173 } |
3163 | 3174 |
3164 void test_constructorFieldInitializer() { | 3175 void test_constructorFieldInitializer() { |
3165 ConstructorFieldInitializer node = AstFactory.constructorFieldInitializer( | 3176 ConstructorFieldInitializer node = AstTestFactory |
3166 false, "f", AstFactory.integer(0)); | 3177 .constructorFieldInitializer(false, "f", AstTestFactory.integer(0)); |
3167 _assertReplace( | 3178 _assertReplace( |
3168 node, new Getter_NodeReplacerTest_test_constructorFieldInitializer()); | 3179 node, new Getter_NodeReplacerTest_test_constructorFieldInitializer()); |
3169 _assertReplace( | 3180 _assertReplace( |
3170 node, new Getter_NodeReplacerTest_test_constructorFieldInitializer_2()); | 3181 node, new Getter_NodeReplacerTest_test_constructorFieldInitializer_2()); |
3171 } | 3182 } |
3172 | 3183 |
3173 void test_constructorName() { | 3184 void test_constructorName() { |
3174 ConstructorName node = | 3185 ConstructorName node = |
3175 AstFactory.constructorName(AstFactory.typeName4("C"), "n"); | 3186 AstTestFactory.constructorName(AstTestFactory.typeName4("C"), "n"); |
3176 _assertReplace(node, new Getter_NodeReplacerTest_test_constructorName()); | 3187 _assertReplace(node, new Getter_NodeReplacerTest_test_constructorName()); |
3177 _assertReplace(node, new Getter_NodeReplacerTest_test_constructorName_2()); | 3188 _assertReplace(node, new Getter_NodeReplacerTest_test_constructorName_2()); |
3178 } | 3189 } |
3179 | 3190 |
3180 void test_continueStatement() { | 3191 void test_continueStatement() { |
3181 ContinueStatement node = AstFactory.continueStatement("l"); | 3192 ContinueStatement node = AstTestFactory.continueStatement("l"); |
3182 _assertReplace(node, new Getter_NodeReplacerTest_test_continueStatement()); | 3193 _assertReplace(node, new Getter_NodeReplacerTest_test_continueStatement()); |
3183 } | 3194 } |
3184 | 3195 |
3185 void test_declaredIdentifier() { | 3196 void test_declaredIdentifier() { |
3186 DeclaredIdentifier node = | 3197 DeclaredIdentifier node = |
3187 AstFactory.declaredIdentifier4(AstFactory.typeName4("C"), "i"); | 3198 AstTestFactory.declaredIdentifier4(AstTestFactory.typeName4("C"), "i"); |
3188 node.documentationComment = | 3199 node.documentationComment = |
3189 Comment.createEndOfLineComment(EMPTY_TOKEN_LIST); | 3200 Comment.createEndOfLineComment(EMPTY_TOKEN_LIST); |
3190 node.metadata.add(AstFactory.annotation(AstFactory.identifier3("a"))); | 3201 node.metadata |
| 3202 .add(AstTestFactory.annotation(AstTestFactory.identifier3("a"))); |
3191 _assertReplace(node, new Getter_NodeReplacerTest_test_declaredIdentifier()); | 3203 _assertReplace(node, new Getter_NodeReplacerTest_test_declaredIdentifier()); |
3192 _assertReplace( | 3204 _assertReplace( |
3193 node, new Getter_NodeReplacerTest_test_declaredIdentifier_2()); | 3205 node, new Getter_NodeReplacerTest_test_declaredIdentifier_2()); |
3194 _testAnnotatedNode(node); | 3206 _testAnnotatedNode(node); |
3195 } | 3207 } |
3196 | 3208 |
3197 void test_defaultFormalParameter() { | 3209 void test_defaultFormalParameter() { |
3198 DefaultFormalParameter node = AstFactory.positionalFormalParameter( | 3210 DefaultFormalParameter node = AstTestFactory.positionalFormalParameter( |
3199 AstFactory.simpleFormalParameter3("p"), AstFactory.integer(0)); | 3211 AstTestFactory.simpleFormalParameter3("p"), AstTestFactory.integer(0)); |
3200 _assertReplace( | 3212 _assertReplace( |
3201 node, new Getter_NodeReplacerTest_test_defaultFormalParameter()); | 3213 node, new Getter_NodeReplacerTest_test_defaultFormalParameter()); |
3202 _assertReplace( | 3214 _assertReplace( |
3203 node, new Getter_NodeReplacerTest_test_defaultFormalParameter_2()); | 3215 node, new Getter_NodeReplacerTest_test_defaultFormalParameter_2()); |
3204 } | 3216 } |
3205 | 3217 |
3206 void test_doStatement() { | 3218 void test_doStatement() { |
3207 DoStatement node = AstFactory.doStatement( | 3219 DoStatement node = AstTestFactory.doStatement( |
3208 AstFactory.block(), AstFactory.booleanLiteral(true)); | 3220 AstTestFactory.block(), AstTestFactory.booleanLiteral(true)); |
3209 _assertReplace(node, new Getter_NodeReplacerTest_test_doStatement_2()); | 3221 _assertReplace(node, new Getter_NodeReplacerTest_test_doStatement_2()); |
3210 _assertReplace(node, new Getter_NodeReplacerTest_test_doStatement()); | 3222 _assertReplace(node, new Getter_NodeReplacerTest_test_doStatement()); |
3211 } | 3223 } |
3212 | 3224 |
3213 void test_enumConstantDeclaration() { | 3225 void test_enumConstantDeclaration() { |
3214 EnumConstantDeclaration node = new EnumConstantDeclaration( | 3226 EnumConstantDeclaration node = new EnumConstantDeclaration( |
3215 Comment.createEndOfLineComment(EMPTY_TOKEN_LIST), | 3227 Comment.createEndOfLineComment(EMPTY_TOKEN_LIST), |
3216 [AstFactory.annotation(AstFactory.identifier3("a"))], | 3228 [AstTestFactory.annotation(AstTestFactory.identifier3("a"))], |
3217 AstFactory.identifier3("C")); | 3229 AstTestFactory.identifier3("C")); |
3218 _assertReplace( | 3230 _assertReplace( |
3219 node, new Getter_NodeReplacerTest_test_enumConstantDeclaration()); | 3231 node, new Getter_NodeReplacerTest_test_enumConstantDeclaration()); |
3220 _testAnnotatedNode(node); | 3232 _testAnnotatedNode(node); |
3221 } | 3233 } |
3222 | 3234 |
3223 void test_enumDeclaration() { | 3235 void test_enumDeclaration() { |
3224 EnumDeclaration node = AstFactory.enumDeclaration2("E", ["ONE", "TWO"]); | 3236 EnumDeclaration node = AstTestFactory.enumDeclaration2("E", ["ONE", "TWO"]); |
3225 node.documentationComment = | 3237 node.documentationComment = |
3226 Comment.createEndOfLineComment(EMPTY_TOKEN_LIST); | 3238 Comment.createEndOfLineComment(EMPTY_TOKEN_LIST); |
3227 node.metadata.add(AstFactory.annotation(AstFactory.identifier3("a"))); | 3239 node.metadata |
| 3240 .add(AstTestFactory.annotation(AstTestFactory.identifier3("a"))); |
3228 _assertReplace(node, new Getter_NodeReplacerTest_test_enumDeclaration()); | 3241 _assertReplace(node, new Getter_NodeReplacerTest_test_enumDeclaration()); |
3229 _testAnnotatedNode(node); | 3242 _testAnnotatedNode(node); |
3230 } | 3243 } |
3231 | 3244 |
3232 void test_exportDirective() { | 3245 void test_exportDirective() { |
3233 ExportDirective node = AstFactory.exportDirective2("", [ | 3246 ExportDirective node = AstTestFactory.exportDirective2("", [ |
3234 AstFactory.hideCombinator2(["C"]) | 3247 AstTestFactory.hideCombinator2(["C"]) |
3235 ]); | 3248 ]); |
3236 node.documentationComment = | 3249 node.documentationComment = |
3237 Comment.createEndOfLineComment(EMPTY_TOKEN_LIST); | 3250 Comment.createEndOfLineComment(EMPTY_TOKEN_LIST); |
3238 node.metadata.add(AstFactory.annotation(AstFactory.identifier3("a"))); | 3251 node.metadata |
| 3252 .add(AstTestFactory.annotation(AstTestFactory.identifier3("a"))); |
3239 _testNamespaceDirective(node); | 3253 _testNamespaceDirective(node); |
3240 } | 3254 } |
3241 | 3255 |
3242 void test_expressionFunctionBody() { | 3256 void test_expressionFunctionBody() { |
3243 ExpressionFunctionBody node = | 3257 ExpressionFunctionBody node = |
3244 AstFactory.expressionFunctionBody(AstFactory.integer(0)); | 3258 AstTestFactory.expressionFunctionBody(AstTestFactory.integer(0)); |
3245 _assertReplace( | 3259 _assertReplace( |
3246 node, new Getter_NodeReplacerTest_test_expressionFunctionBody()); | 3260 node, new Getter_NodeReplacerTest_test_expressionFunctionBody()); |
3247 } | 3261 } |
3248 | 3262 |
3249 void test_expressionStatement() { | 3263 void test_expressionStatement() { |
3250 ExpressionStatement node = | 3264 ExpressionStatement node = |
3251 AstFactory.expressionStatement(AstFactory.integer(0)); | 3265 AstTestFactory.expressionStatement(AstTestFactory.integer(0)); |
3252 _assertReplace( | 3266 _assertReplace( |
3253 node, new Getter_NodeReplacerTest_test_expressionStatement()); | 3267 node, new Getter_NodeReplacerTest_test_expressionStatement()); |
3254 } | 3268 } |
3255 | 3269 |
3256 void test_extendsClause() { | 3270 void test_extendsClause() { |
3257 ExtendsClause node = AstFactory.extendsClause(AstFactory.typeName4("S")); | 3271 ExtendsClause node = |
| 3272 AstTestFactory.extendsClause(AstTestFactory.typeName4("S")); |
3258 _assertReplace(node, new Getter_NodeReplacerTest_test_extendsClause()); | 3273 _assertReplace(node, new Getter_NodeReplacerTest_test_extendsClause()); |
3259 } | 3274 } |
3260 | 3275 |
3261 void test_fieldDeclaration() { | 3276 void test_fieldDeclaration() { |
3262 FieldDeclaration node = AstFactory.fieldDeclaration(false, null, | 3277 FieldDeclaration node = AstTestFactory.fieldDeclaration( |
3263 AstFactory.typeName4("C"), [AstFactory.variableDeclaration("c")]); | 3278 false, |
| 3279 null, |
| 3280 AstTestFactory.typeName4("C"), |
| 3281 [AstTestFactory.variableDeclaration("c")]); |
3264 node.documentationComment = | 3282 node.documentationComment = |
3265 Comment.createEndOfLineComment(EMPTY_TOKEN_LIST); | 3283 Comment.createEndOfLineComment(EMPTY_TOKEN_LIST); |
3266 node.metadata.add(AstFactory.annotation(AstFactory.identifier3("a"))); | 3284 node.metadata |
| 3285 .add(AstTestFactory.annotation(AstTestFactory.identifier3("a"))); |
3267 _assertReplace(node, new Getter_NodeReplacerTest_test_fieldDeclaration()); | 3286 _assertReplace(node, new Getter_NodeReplacerTest_test_fieldDeclaration()); |
3268 _testAnnotatedNode(node); | 3287 _testAnnotatedNode(node); |
3269 } | 3288 } |
3270 | 3289 |
3271 void test_fieldFormalParameter() { | 3290 void test_fieldFormalParameter() { |
3272 FieldFormalParameter node = AstFactory.fieldFormalParameter( | 3291 FieldFormalParameter node = AstTestFactory.fieldFormalParameter( |
3273 null, AstFactory.typeName4("C"), "f", AstFactory.formalParameterList()); | 3292 null, |
| 3293 AstTestFactory.typeName4("C"), |
| 3294 "f", |
| 3295 AstTestFactory.formalParameterList()); |
3274 node.documentationComment = | 3296 node.documentationComment = |
3275 Comment.createEndOfLineComment(EMPTY_TOKEN_LIST); | 3297 Comment.createEndOfLineComment(EMPTY_TOKEN_LIST); |
3276 node.metadata = [AstFactory.annotation(AstFactory.identifier3("a"))]; | 3298 node.metadata = [ |
| 3299 AstTestFactory.annotation(AstTestFactory.identifier3("a")) |
| 3300 ]; |
3277 _assertReplace( | 3301 _assertReplace( |
3278 node, new Getter_NodeReplacerTest_test_fieldFormalParameter_2()); | 3302 node, new Getter_NodeReplacerTest_test_fieldFormalParameter_2()); |
3279 _assertReplace( | 3303 _assertReplace( |
3280 node, new Getter_NodeReplacerTest_test_fieldFormalParameter()); | 3304 node, new Getter_NodeReplacerTest_test_fieldFormalParameter()); |
3281 _testNormalFormalParameter(node); | 3305 _testNormalFormalParameter(node); |
3282 } | 3306 } |
3283 | 3307 |
3284 void test_forEachStatement_withIdentifier() { | 3308 void test_forEachStatement_withIdentifier() { |
3285 ForEachStatement node = AstFactory.forEachStatement2( | 3309 ForEachStatement node = AstTestFactory.forEachStatement2( |
3286 AstFactory.identifier3("i"), | 3310 AstTestFactory.identifier3("i"), |
3287 AstFactory.identifier3("l"), | 3311 AstTestFactory.identifier3("l"), |
3288 AstFactory.block()); | 3312 AstTestFactory.block()); |
3289 _assertReplace(node, | 3313 _assertReplace(node, |
3290 new Getter_NodeReplacerTest_test_forEachStatement_withIdentifier_2()); | 3314 new Getter_NodeReplacerTest_test_forEachStatement_withIdentifier_2()); |
3291 _assertReplace(node, | 3315 _assertReplace(node, |
3292 new Getter_NodeReplacerTest_test_forEachStatement_withIdentifier_3()); | 3316 new Getter_NodeReplacerTest_test_forEachStatement_withIdentifier_3()); |
3293 _assertReplace(node, | 3317 _assertReplace(node, |
3294 new Getter_NodeReplacerTest_test_forEachStatement_withIdentifier()); | 3318 new Getter_NodeReplacerTest_test_forEachStatement_withIdentifier()); |
3295 } | 3319 } |
3296 | 3320 |
3297 void test_forEachStatement_withLoopVariable() { | 3321 void test_forEachStatement_withLoopVariable() { |
3298 ForEachStatement node = AstFactory.forEachStatement( | 3322 ForEachStatement node = AstTestFactory.forEachStatement( |
3299 AstFactory.declaredIdentifier3("e"), | 3323 AstTestFactory.declaredIdentifier3("e"), |
3300 AstFactory.identifier3("l"), | 3324 AstTestFactory.identifier3("l"), |
3301 AstFactory.block()); | 3325 AstTestFactory.block()); |
3302 _assertReplace(node, | 3326 _assertReplace(node, |
3303 new Getter_NodeReplacerTest_test_forEachStatement_withLoopVariable_2()); | 3327 new Getter_NodeReplacerTest_test_forEachStatement_withLoopVariable_2()); |
3304 _assertReplace(node, | 3328 _assertReplace(node, |
3305 new Getter_NodeReplacerTest_test_forEachStatement_withLoopVariable()); | 3329 new Getter_NodeReplacerTest_test_forEachStatement_withLoopVariable()); |
3306 _assertReplace(node, | 3330 _assertReplace(node, |
3307 new Getter_NodeReplacerTest_test_forEachStatement_withLoopVariable_3()); | 3331 new Getter_NodeReplacerTest_test_forEachStatement_withLoopVariable_3()); |
3308 } | 3332 } |
3309 | 3333 |
3310 void test_formalParameterList() { | 3334 void test_formalParameterList() { |
3311 FormalParameterList node = AstFactory | 3335 FormalParameterList node = AstTestFactory |
3312 .formalParameterList([AstFactory.simpleFormalParameter3("p")]); | 3336 .formalParameterList([AstTestFactory.simpleFormalParameter3("p")]); |
3313 _assertReplace( | 3337 _assertReplace( |
3314 node, new ListGetter_NodeReplacerTest_test_formalParameterList(0)); | 3338 node, new ListGetter_NodeReplacerTest_test_formalParameterList(0)); |
3315 } | 3339 } |
3316 | 3340 |
3317 void test_forStatement_withInitialization() { | 3341 void test_forStatement_withInitialization() { |
3318 ForStatement node = AstFactory.forStatement( | 3342 ForStatement node = AstTestFactory.forStatement( |
3319 AstFactory.identifier3("a"), | 3343 AstTestFactory.identifier3("a"), |
3320 AstFactory.booleanLiteral(true), | 3344 AstTestFactory.booleanLiteral(true), |
3321 [AstFactory.integer(0)], | 3345 [AstTestFactory.integer(0)], |
3322 AstFactory.block()); | 3346 AstTestFactory.block()); |
3323 _assertReplace(node, | 3347 _assertReplace(node, |
3324 new Getter_NodeReplacerTest_test_forStatement_withInitialization_3()); | 3348 new Getter_NodeReplacerTest_test_forStatement_withInitialization_3()); |
3325 _assertReplace(node, | 3349 _assertReplace(node, |
3326 new Getter_NodeReplacerTest_test_forStatement_withInitialization_2()); | 3350 new Getter_NodeReplacerTest_test_forStatement_withInitialization_2()); |
3327 _assertReplace(node, | 3351 _assertReplace(node, |
3328 new Getter_NodeReplacerTest_test_forStatement_withInitialization()); | 3352 new Getter_NodeReplacerTest_test_forStatement_withInitialization()); |
3329 _assertReplace( | 3353 _assertReplace( |
3330 node, | 3354 node, |
3331 new ListGetter_NodeReplacerTest_test_forStatement_withInitialization( | 3355 new ListGetter_NodeReplacerTest_test_forStatement_withInitialization( |
3332 0)); | 3356 0)); |
3333 } | 3357 } |
3334 | 3358 |
3335 void test_forStatement_withVariables() { | 3359 void test_forStatement_withVariables() { |
3336 ForStatement node = AstFactory.forStatement2( | 3360 ForStatement node = AstTestFactory.forStatement2( |
3337 AstFactory.variableDeclarationList2( | 3361 AstTestFactory.variableDeclarationList2( |
3338 null, [AstFactory.variableDeclaration("i")]), | 3362 null, [AstTestFactory.variableDeclaration("i")]), |
3339 AstFactory.booleanLiteral(true), | 3363 AstTestFactory.booleanLiteral(true), |
3340 [AstFactory.integer(0)], | 3364 [AstTestFactory.integer(0)], |
3341 AstFactory.block()); | 3365 AstTestFactory.block()); |
3342 _assertReplace( | 3366 _assertReplace( |
3343 node, new Getter_NodeReplacerTest_test_forStatement_withVariables_2()); | 3367 node, new Getter_NodeReplacerTest_test_forStatement_withVariables_2()); |
3344 _assertReplace( | 3368 _assertReplace( |
3345 node, new Getter_NodeReplacerTest_test_forStatement_withVariables_3()); | 3369 node, new Getter_NodeReplacerTest_test_forStatement_withVariables_3()); |
3346 _assertReplace( | 3370 _assertReplace( |
3347 node, new Getter_NodeReplacerTest_test_forStatement_withVariables()); | 3371 node, new Getter_NodeReplacerTest_test_forStatement_withVariables()); |
3348 _assertReplace(node, | 3372 _assertReplace(node, |
3349 new ListGetter_NodeReplacerTest_test_forStatement_withVariables(0)); | 3373 new ListGetter_NodeReplacerTest_test_forStatement_withVariables(0)); |
3350 } | 3374 } |
3351 | 3375 |
3352 void test_functionDeclaration() { | 3376 void test_functionDeclaration() { |
3353 FunctionDeclaration node = AstFactory.functionDeclaration( | 3377 FunctionDeclaration node = AstTestFactory.functionDeclaration( |
3354 AstFactory.typeName4("R"), | 3378 AstTestFactory.typeName4("R"), |
3355 null, | 3379 null, |
3356 "f", | 3380 "f", |
3357 AstFactory.functionExpression2(AstFactory.formalParameterList(), | 3381 AstTestFactory.functionExpression2(AstTestFactory.formalParameterList(), |
3358 AstFactory.blockFunctionBody(AstFactory.block()))); | 3382 AstTestFactory.blockFunctionBody(AstTestFactory.block()))); |
3359 node.documentationComment = | 3383 node.documentationComment = |
3360 Comment.createEndOfLineComment(EMPTY_TOKEN_LIST); | 3384 Comment.createEndOfLineComment(EMPTY_TOKEN_LIST); |
3361 node.metadata.add(AstFactory.annotation(AstFactory.identifier3("a"))); | 3385 node.metadata |
| 3386 .add(AstTestFactory.annotation(AstTestFactory.identifier3("a"))); |
3362 _assertReplace( | 3387 _assertReplace( |
3363 node, new Getter_NodeReplacerTest_test_functionDeclaration()); | 3388 node, new Getter_NodeReplacerTest_test_functionDeclaration()); |
3364 _assertReplace( | 3389 _assertReplace( |
3365 node, new Getter_NodeReplacerTest_test_functionDeclaration_3()); | 3390 node, new Getter_NodeReplacerTest_test_functionDeclaration_3()); |
3366 _assertReplace( | 3391 _assertReplace( |
3367 node, new Getter_NodeReplacerTest_test_functionDeclaration_2()); | 3392 node, new Getter_NodeReplacerTest_test_functionDeclaration_2()); |
3368 _testAnnotatedNode(node); | 3393 _testAnnotatedNode(node); |
3369 } | 3394 } |
3370 | 3395 |
3371 void test_functionDeclarationStatement() { | 3396 void test_functionDeclarationStatement() { |
3372 FunctionDeclarationStatement node = AstFactory.functionDeclarationStatement( | 3397 FunctionDeclarationStatement node = |
3373 AstFactory.typeName4("R"), | 3398 AstTestFactory.functionDeclarationStatement( |
3374 null, | 3399 AstTestFactory.typeName4("R"), |
3375 "f", | 3400 null, |
3376 AstFactory.functionExpression2(AstFactory.formalParameterList(), | 3401 "f", |
3377 AstFactory.blockFunctionBody(AstFactory.block()))); | 3402 AstTestFactory.functionExpression2( |
| 3403 AstTestFactory.formalParameterList(), |
| 3404 AstTestFactory.blockFunctionBody(AstTestFactory.block()))); |
3378 _assertReplace( | 3405 _assertReplace( |
3379 node, new Getter_NodeReplacerTest_test_functionDeclarationStatement()); | 3406 node, new Getter_NodeReplacerTest_test_functionDeclarationStatement()); |
3380 } | 3407 } |
3381 | 3408 |
3382 void test_functionExpression() { | 3409 void test_functionExpression() { |
3383 FunctionExpression node = AstFactory.functionExpression2( | 3410 FunctionExpression node = AstTestFactory.functionExpression2( |
3384 AstFactory.formalParameterList(), | 3411 AstTestFactory.formalParameterList(), |
3385 AstFactory.blockFunctionBody(AstFactory.block())); | 3412 AstTestFactory.blockFunctionBody(AstTestFactory.block())); |
3386 _assertReplace(node, new Getter_NodeReplacerTest_test_functionExpression()); | 3413 _assertReplace(node, new Getter_NodeReplacerTest_test_functionExpression()); |
3387 _assertReplace( | 3414 _assertReplace( |
3388 node, new Getter_NodeReplacerTest_test_functionExpression_2()); | 3415 node, new Getter_NodeReplacerTest_test_functionExpression_2()); |
3389 } | 3416 } |
3390 | 3417 |
3391 void test_functionExpressionInvocation() { | 3418 void test_functionExpressionInvocation() { |
3392 FunctionExpressionInvocation node = AstFactory.functionExpressionInvocation( | 3419 FunctionExpressionInvocation node = AstTestFactory |
3393 AstFactory.identifier3("f"), [AstFactory.integer(0)]); | 3420 .functionExpressionInvocation( |
| 3421 AstTestFactory.identifier3("f"), [AstTestFactory.integer(0)]); |
3394 _assertReplace( | 3422 _assertReplace( |
3395 node, new Getter_NodeReplacerTest_test_functionExpressionInvocation()); | 3423 node, new Getter_NodeReplacerTest_test_functionExpressionInvocation()); |
3396 _assertReplace(node, | 3424 _assertReplace(node, |
3397 new Getter_NodeReplacerTest_test_functionExpressionInvocation_2()); | 3425 new Getter_NodeReplacerTest_test_functionExpressionInvocation_2()); |
3398 } | 3426 } |
3399 | 3427 |
3400 void test_functionTypeAlias() { | 3428 void test_functionTypeAlias() { |
3401 FunctionTypeAlias node = AstFactory.typeAlias( | 3429 FunctionTypeAlias node = AstTestFactory.typeAlias( |
3402 AstFactory.typeName4("R"), | 3430 AstTestFactory.typeName4("R"), |
3403 "F", | 3431 "F", |
3404 AstFactory.typeParameterList(["E"]), | 3432 AstTestFactory.typeParameterList(["E"]), |
3405 AstFactory.formalParameterList()); | 3433 AstTestFactory.formalParameterList()); |
3406 node.documentationComment = | 3434 node.documentationComment = |
3407 Comment.createEndOfLineComment(EMPTY_TOKEN_LIST); | 3435 Comment.createEndOfLineComment(EMPTY_TOKEN_LIST); |
3408 node.metadata.add(AstFactory.annotation(AstFactory.identifier3("a"))); | 3436 node.metadata |
| 3437 .add(AstTestFactory.annotation(AstTestFactory.identifier3("a"))); |
3409 _assertReplace( | 3438 _assertReplace( |
3410 node, new Getter_NodeReplacerTest_test_functionTypeAlias_3()); | 3439 node, new Getter_NodeReplacerTest_test_functionTypeAlias_3()); |
3411 _assertReplace( | 3440 _assertReplace( |
3412 node, new Getter_NodeReplacerTest_test_functionTypeAlias_4()); | 3441 node, new Getter_NodeReplacerTest_test_functionTypeAlias_4()); |
3413 _assertReplace(node, new Getter_NodeReplacerTest_test_functionTypeAlias()); | 3442 _assertReplace(node, new Getter_NodeReplacerTest_test_functionTypeAlias()); |
3414 _assertReplace( | 3443 _assertReplace( |
3415 node, new Getter_NodeReplacerTest_test_functionTypeAlias_2()); | 3444 node, new Getter_NodeReplacerTest_test_functionTypeAlias_2()); |
3416 _testAnnotatedNode(node); | 3445 _testAnnotatedNode(node); |
3417 } | 3446 } |
3418 | 3447 |
3419 void test_functionTypedFormalParameter() { | 3448 void test_functionTypedFormalParameter() { |
3420 FunctionTypedFormalParameter node = AstFactory.functionTypedFormalParameter( | 3449 FunctionTypedFormalParameter node = AstTestFactory |
3421 AstFactory.typeName4("R"), | 3450 .functionTypedFormalParameter(AstTestFactory.typeName4("R"), "f", |
3422 "f", | 3451 [AstTestFactory.simpleFormalParameter3("p")]); |
3423 [AstFactory.simpleFormalParameter3("p")]); | |
3424 node.documentationComment = | 3452 node.documentationComment = |
3425 Comment.createEndOfLineComment(EMPTY_TOKEN_LIST); | 3453 Comment.createEndOfLineComment(EMPTY_TOKEN_LIST); |
3426 node.metadata = [AstFactory.annotation(AstFactory.identifier3("a"))]; | 3454 node.metadata = [ |
| 3455 AstTestFactory.annotation(AstTestFactory.identifier3("a")) |
| 3456 ]; |
3427 _assertReplace( | 3457 _assertReplace( |
3428 node, new Getter_NodeReplacerTest_test_functionTypedFormalParameter()); | 3458 node, new Getter_NodeReplacerTest_test_functionTypedFormalParameter()); |
3429 _assertReplace(node, | 3459 _assertReplace(node, |
3430 new Getter_NodeReplacerTest_test_functionTypedFormalParameter_2()); | 3460 new Getter_NodeReplacerTest_test_functionTypedFormalParameter_2()); |
3431 _testNormalFormalParameter(node); | 3461 _testNormalFormalParameter(node); |
3432 } | 3462 } |
3433 | 3463 |
3434 void test_hideCombinator() { | 3464 void test_hideCombinator() { |
3435 HideCombinator node = AstFactory.hideCombinator2(["A", "B"]); | 3465 HideCombinator node = AstTestFactory.hideCombinator2(["A", "B"]); |
3436 _assertReplace( | 3466 _assertReplace( |
3437 node, new ListGetter_NodeReplacerTest_test_hideCombinator(0)); | 3467 node, new ListGetter_NodeReplacerTest_test_hideCombinator(0)); |
3438 } | 3468 } |
3439 | 3469 |
3440 void test_ifStatement() { | 3470 void test_ifStatement() { |
3441 IfStatement node = AstFactory.ifStatement2(AstFactory.booleanLiteral(true), | 3471 IfStatement node = AstTestFactory.ifStatement2( |
3442 AstFactory.block(), AstFactory.block()); | 3472 AstTestFactory.booleanLiteral(true), |
| 3473 AstTestFactory.block(), |
| 3474 AstTestFactory.block()); |
3443 _assertReplace(node, new Getter_NodeReplacerTest_test_ifStatement()); | 3475 _assertReplace(node, new Getter_NodeReplacerTest_test_ifStatement()); |
3444 _assertReplace(node, new Getter_NodeReplacerTest_test_ifStatement_3()); | 3476 _assertReplace(node, new Getter_NodeReplacerTest_test_ifStatement_3()); |
3445 _assertReplace(node, new Getter_NodeReplacerTest_test_ifStatement_2()); | 3477 _assertReplace(node, new Getter_NodeReplacerTest_test_ifStatement_2()); |
3446 } | 3478 } |
3447 | 3479 |
3448 void test_implementsClause() { | 3480 void test_implementsClause() { |
3449 ImplementsClause node = AstFactory.implementsClause( | 3481 ImplementsClause node = AstTestFactory.implementsClause( |
3450 [AstFactory.typeName4("I"), AstFactory.typeName4("J")]); | 3482 [AstTestFactory.typeName4("I"), AstTestFactory.typeName4("J")]); |
3451 _assertReplace( | 3483 _assertReplace( |
3452 node, new ListGetter_NodeReplacerTest_test_implementsClause(0)); | 3484 node, new ListGetter_NodeReplacerTest_test_implementsClause(0)); |
3453 } | 3485 } |
3454 | 3486 |
3455 void test_importDirective() { | 3487 void test_importDirective() { |
3456 ImportDirective node = AstFactory.importDirective3("", "p", [ | 3488 ImportDirective node = AstTestFactory.importDirective3("", "p", [ |
3457 AstFactory.showCombinator2(["A"]), | 3489 AstTestFactory.showCombinator2(["A"]), |
3458 AstFactory.hideCombinator2(["B"]) | 3490 AstTestFactory.hideCombinator2(["B"]) |
3459 ]); | 3491 ]); |
3460 node.documentationComment = | 3492 node.documentationComment = |
3461 Comment.createEndOfLineComment(EMPTY_TOKEN_LIST); | 3493 Comment.createEndOfLineComment(EMPTY_TOKEN_LIST); |
3462 node.metadata.add(AstFactory.annotation(AstFactory.identifier3("a"))); | 3494 node.metadata |
| 3495 .add(AstTestFactory.annotation(AstTestFactory.identifier3("a"))); |
3463 _assertReplace(node, new Getter_NodeReplacerTest_test_importDirective()); | 3496 _assertReplace(node, new Getter_NodeReplacerTest_test_importDirective()); |
3464 _testNamespaceDirective(node); | 3497 _testNamespaceDirective(node); |
3465 } | 3498 } |
3466 | 3499 |
3467 void test_indexExpression() { | 3500 void test_indexExpression() { |
3468 IndexExpression node = AstFactory.indexExpression( | 3501 IndexExpression node = AstTestFactory.indexExpression( |
3469 AstFactory.identifier3("a"), AstFactory.identifier3("i")); | 3502 AstTestFactory.identifier3("a"), AstTestFactory.identifier3("i")); |
3470 _assertReplace(node, new Getter_NodeReplacerTest_test_indexExpression()); | 3503 _assertReplace(node, new Getter_NodeReplacerTest_test_indexExpression()); |
3471 _assertReplace(node, new Getter_NodeReplacerTest_test_indexExpression_2()); | 3504 _assertReplace(node, new Getter_NodeReplacerTest_test_indexExpression_2()); |
3472 } | 3505 } |
3473 | 3506 |
3474 void test_instanceCreationExpression() { | 3507 void test_instanceCreationExpression() { |
3475 InstanceCreationExpression node = AstFactory.instanceCreationExpression3( | 3508 InstanceCreationExpression node = AstTestFactory |
3476 null, AstFactory.typeName4("C"), "c", [AstFactory.integer(2)]); | 3509 .instanceCreationExpression3(null, AstTestFactory.typeName4("C"), "c", |
| 3510 [AstTestFactory.integer(2)]); |
3477 _assertReplace( | 3511 _assertReplace( |
3478 node, new Getter_NodeReplacerTest_test_instanceCreationExpression_2()); | 3512 node, new Getter_NodeReplacerTest_test_instanceCreationExpression_2()); |
3479 _assertReplace( | 3513 _assertReplace( |
3480 node, new Getter_NodeReplacerTest_test_instanceCreationExpression()); | 3514 node, new Getter_NodeReplacerTest_test_instanceCreationExpression()); |
3481 } | 3515 } |
3482 | 3516 |
3483 void test_interpolationExpression() { | 3517 void test_interpolationExpression() { |
3484 InterpolationExpression node = AstFactory.interpolationExpression2("x"); | 3518 InterpolationExpression node = AstTestFactory.interpolationExpression2("x"); |
3485 _assertReplace( | 3519 _assertReplace( |
3486 node, new Getter_NodeReplacerTest_test_interpolationExpression()); | 3520 node, new Getter_NodeReplacerTest_test_interpolationExpression()); |
3487 } | 3521 } |
3488 | 3522 |
3489 void test_isExpression() { | 3523 void test_isExpression() { |
3490 IsExpression node = AstFactory.isExpression( | 3524 IsExpression node = AstTestFactory.isExpression( |
3491 AstFactory.identifier3("v"), false, AstFactory.typeName4("T")); | 3525 AstTestFactory.identifier3("v"), false, AstTestFactory.typeName4("T")); |
3492 _assertReplace(node, new Getter_NodeReplacerTest_test_isExpression()); | 3526 _assertReplace(node, new Getter_NodeReplacerTest_test_isExpression()); |
3493 _assertReplace(node, new Getter_NodeReplacerTest_test_isExpression_2()); | 3527 _assertReplace(node, new Getter_NodeReplacerTest_test_isExpression_2()); |
3494 } | 3528 } |
3495 | 3529 |
3496 void test_label() { | 3530 void test_label() { |
3497 Label node = AstFactory.label2("l"); | 3531 Label node = AstTestFactory.label2("l"); |
3498 _assertReplace(node, new Getter_NodeReplacerTest_test_label()); | 3532 _assertReplace(node, new Getter_NodeReplacerTest_test_label()); |
3499 } | 3533 } |
3500 | 3534 |
3501 void test_labeledStatement() { | 3535 void test_labeledStatement() { |
3502 LabeledStatement node = AstFactory | 3536 LabeledStatement node = AstTestFactory |
3503 .labeledStatement([AstFactory.label2("l")], AstFactory.block()); | 3537 .labeledStatement([AstTestFactory.label2("l")], AstTestFactory.block()); |
3504 _assertReplace( | 3538 _assertReplace( |
3505 node, new ListGetter_NodeReplacerTest_test_labeledStatement(0)); | 3539 node, new ListGetter_NodeReplacerTest_test_labeledStatement(0)); |
3506 _assertReplace(node, new Getter_NodeReplacerTest_test_labeledStatement()); | 3540 _assertReplace(node, new Getter_NodeReplacerTest_test_labeledStatement()); |
3507 } | 3541 } |
3508 | 3542 |
3509 void test_libraryDirective() { | 3543 void test_libraryDirective() { |
3510 LibraryDirective node = AstFactory.libraryDirective2("lib"); | 3544 LibraryDirective node = AstTestFactory.libraryDirective2("lib"); |
3511 node.documentationComment = | 3545 node.documentationComment = |
3512 Comment.createEndOfLineComment(EMPTY_TOKEN_LIST); | 3546 Comment.createEndOfLineComment(EMPTY_TOKEN_LIST); |
3513 node.metadata.add(AstFactory.annotation(AstFactory.identifier3("a"))); | 3547 node.metadata |
| 3548 .add(AstTestFactory.annotation(AstTestFactory.identifier3("a"))); |
3514 _assertReplace(node, new Getter_NodeReplacerTest_test_libraryDirective()); | 3549 _assertReplace(node, new Getter_NodeReplacerTest_test_libraryDirective()); |
3515 _testAnnotatedNode(node); | 3550 _testAnnotatedNode(node); |
3516 } | 3551 } |
3517 | 3552 |
3518 void test_libraryIdentifier() { | 3553 void test_libraryIdentifier() { |
3519 LibraryIdentifier node = AstFactory.libraryIdentifier2(["lib"]); | 3554 LibraryIdentifier node = AstTestFactory.libraryIdentifier2(["lib"]); |
3520 _assertReplace( | 3555 _assertReplace( |
3521 node, new ListGetter_NodeReplacerTest_test_libraryIdentifier(0)); | 3556 node, new ListGetter_NodeReplacerTest_test_libraryIdentifier(0)); |
3522 } | 3557 } |
3523 | 3558 |
3524 void test_listLiteral() { | 3559 void test_listLiteral() { |
3525 ListLiteral node = AstFactory.listLiteral2( | 3560 ListLiteral node = AstTestFactory.listLiteral2( |
3526 null, | 3561 null, |
3527 AstFactory.typeArgumentList([AstFactory.typeName4("E")]), | 3562 AstTestFactory.typeArgumentList([AstTestFactory.typeName4("E")]), |
3528 [AstFactory.identifier3("e")]); | 3563 [AstTestFactory.identifier3("e")]); |
3529 _assertReplace(node, new ListGetter_NodeReplacerTest_test_listLiteral(0)); | 3564 _assertReplace(node, new ListGetter_NodeReplacerTest_test_listLiteral(0)); |
3530 _testTypedLiteral(node); | 3565 _testTypedLiteral(node); |
3531 } | 3566 } |
3532 | 3567 |
3533 void test_mapLiteral() { | 3568 void test_mapLiteral() { |
3534 MapLiteral node = AstFactory.mapLiteral( | 3569 MapLiteral node = AstTestFactory.mapLiteral( |
3535 null, | 3570 null, |
3536 AstFactory.typeArgumentList([AstFactory.typeName4("E")]), | 3571 AstTestFactory.typeArgumentList([AstTestFactory.typeName4("E")]), |
3537 [AstFactory.mapLiteralEntry("k", AstFactory.identifier3("v"))]); | 3572 [AstTestFactory.mapLiteralEntry("k", AstTestFactory.identifier3("v"))]); |
3538 _assertReplace(node, new ListGetter_NodeReplacerTest_test_mapLiteral(0)); | 3573 _assertReplace(node, new ListGetter_NodeReplacerTest_test_mapLiteral(0)); |
3539 _testTypedLiteral(node); | 3574 _testTypedLiteral(node); |
3540 } | 3575 } |
3541 | 3576 |
3542 void test_mapLiteralEntry() { | 3577 void test_mapLiteralEntry() { |
3543 MapLiteralEntry node = | 3578 MapLiteralEntry node = |
3544 AstFactory.mapLiteralEntry("k", AstFactory.identifier3("v")); | 3579 AstTestFactory.mapLiteralEntry("k", AstTestFactory.identifier3("v")); |
3545 _assertReplace(node, new Getter_NodeReplacerTest_test_mapLiteralEntry_2()); | 3580 _assertReplace(node, new Getter_NodeReplacerTest_test_mapLiteralEntry_2()); |
3546 _assertReplace(node, new Getter_NodeReplacerTest_test_mapLiteralEntry()); | 3581 _assertReplace(node, new Getter_NodeReplacerTest_test_mapLiteralEntry()); |
3547 } | 3582 } |
3548 | 3583 |
3549 void test_methodDeclaration() { | 3584 void test_methodDeclaration() { |
3550 MethodDeclaration node = AstFactory.methodDeclaration2( | 3585 MethodDeclaration node = AstTestFactory.methodDeclaration2( |
3551 null, | 3586 null, |
3552 AstFactory.typeName4("A"), | 3587 AstTestFactory.typeName4("A"), |
3553 null, | 3588 null, |
3554 null, | 3589 null, |
3555 AstFactory.identifier3("m"), | 3590 AstTestFactory.identifier3("m"), |
3556 AstFactory.formalParameterList(), | 3591 AstTestFactory.formalParameterList(), |
3557 AstFactory.blockFunctionBody(AstFactory.block())); | 3592 AstTestFactory.blockFunctionBody(AstTestFactory.block())); |
3558 node.documentationComment = | 3593 node.documentationComment = |
3559 Comment.createEndOfLineComment(EMPTY_TOKEN_LIST); | 3594 Comment.createEndOfLineComment(EMPTY_TOKEN_LIST); |
3560 node.metadata.add(AstFactory.annotation(AstFactory.identifier3("a"))); | 3595 node.metadata |
| 3596 .add(AstTestFactory.annotation(AstTestFactory.identifier3("a"))); |
3561 _assertReplace(node, new Getter_NodeReplacerTest_test_methodDeclaration()); | 3597 _assertReplace(node, new Getter_NodeReplacerTest_test_methodDeclaration()); |
3562 _assertReplace( | 3598 _assertReplace( |
3563 node, new Getter_NodeReplacerTest_test_methodDeclaration_3()); | 3599 node, new Getter_NodeReplacerTest_test_methodDeclaration_3()); |
3564 _assertReplace( | 3600 _assertReplace( |
3565 node, new Getter_NodeReplacerTest_test_methodDeclaration_4()); | 3601 node, new Getter_NodeReplacerTest_test_methodDeclaration_4()); |
3566 _assertReplace( | 3602 _assertReplace( |
3567 node, new Getter_NodeReplacerTest_test_methodDeclaration_2()); | 3603 node, new Getter_NodeReplacerTest_test_methodDeclaration_2()); |
3568 _testAnnotatedNode(node); | 3604 _testAnnotatedNode(node); |
3569 } | 3605 } |
3570 | 3606 |
3571 void test_methodInvocation() { | 3607 void test_methodInvocation() { |
3572 MethodInvocation node = AstFactory.methodInvocation( | 3608 MethodInvocation node = AstTestFactory.methodInvocation( |
3573 AstFactory.identifier3("t"), "m", [AstFactory.integer(0)]); | 3609 AstTestFactory.identifier3("t"), "m", [AstTestFactory.integer(0)]); |
3574 _assertReplace(node, new Getter_NodeReplacerTest_test_methodInvocation_2()); | 3610 _assertReplace(node, new Getter_NodeReplacerTest_test_methodInvocation_2()); |
3575 _assertReplace(node, new Getter_NodeReplacerTest_test_methodInvocation_3()); | 3611 _assertReplace(node, new Getter_NodeReplacerTest_test_methodInvocation_3()); |
3576 _assertReplace(node, new Getter_NodeReplacerTest_test_methodInvocation()); | 3612 _assertReplace(node, new Getter_NodeReplacerTest_test_methodInvocation()); |
3577 } | 3613 } |
3578 | 3614 |
3579 void test_namedExpression() { | 3615 void test_namedExpression() { |
3580 NamedExpression node = | 3616 NamedExpression node = |
3581 AstFactory.namedExpression2("l", AstFactory.identifier3("v")); | 3617 AstTestFactory.namedExpression2("l", AstTestFactory.identifier3("v")); |
3582 _assertReplace(node, new Getter_NodeReplacerTest_test_namedExpression()); | 3618 _assertReplace(node, new Getter_NodeReplacerTest_test_namedExpression()); |
3583 _assertReplace(node, new Getter_NodeReplacerTest_test_namedExpression_2()); | 3619 _assertReplace(node, new Getter_NodeReplacerTest_test_namedExpression_2()); |
3584 } | 3620 } |
3585 | 3621 |
3586 void test_nativeClause() { | 3622 void test_nativeClause() { |
3587 NativeClause node = AstFactory.nativeClause(""); | 3623 NativeClause node = AstTestFactory.nativeClause(""); |
3588 _assertReplace(node, new Getter_NodeReplacerTest_test_nativeClause()); | 3624 _assertReplace(node, new Getter_NodeReplacerTest_test_nativeClause()); |
3589 } | 3625 } |
3590 | 3626 |
3591 void test_nativeFunctionBody() { | 3627 void test_nativeFunctionBody() { |
3592 NativeFunctionBody node = AstFactory.nativeFunctionBody("m"); | 3628 NativeFunctionBody node = AstTestFactory.nativeFunctionBody("m"); |
3593 _assertReplace(node, new Getter_NodeReplacerTest_test_nativeFunctionBody()); | 3629 _assertReplace(node, new Getter_NodeReplacerTest_test_nativeFunctionBody()); |
3594 } | 3630 } |
3595 | 3631 |
3596 void test_parenthesizedExpression() { | 3632 void test_parenthesizedExpression() { |
3597 ParenthesizedExpression node = | 3633 ParenthesizedExpression node = |
3598 AstFactory.parenthesizedExpression(AstFactory.integer(0)); | 3634 AstTestFactory.parenthesizedExpression(AstTestFactory.integer(0)); |
3599 _assertReplace( | 3635 _assertReplace( |
3600 node, new Getter_NodeReplacerTest_test_parenthesizedExpression()); | 3636 node, new Getter_NodeReplacerTest_test_parenthesizedExpression()); |
3601 } | 3637 } |
3602 | 3638 |
3603 void test_partDirective() { | 3639 void test_partDirective() { |
3604 PartDirective node = AstFactory.partDirective2(""); | 3640 PartDirective node = AstTestFactory.partDirective2(""); |
3605 node.documentationComment = | 3641 node.documentationComment = |
3606 Comment.createEndOfLineComment(EMPTY_TOKEN_LIST); | 3642 Comment.createEndOfLineComment(EMPTY_TOKEN_LIST); |
3607 node.metadata.add(AstFactory.annotation(AstFactory.identifier3("a"))); | 3643 node.metadata |
| 3644 .add(AstTestFactory.annotation(AstTestFactory.identifier3("a"))); |
3608 _testUriBasedDirective(node); | 3645 _testUriBasedDirective(node); |
3609 } | 3646 } |
3610 | 3647 |
3611 void test_partOfDirective() { | 3648 void test_partOfDirective() { |
3612 PartOfDirective node = | 3649 PartOfDirective node = AstTestFactory |
3613 AstFactory.partOfDirective(AstFactory.libraryIdentifier2(["lib"])); | 3650 .partOfDirective(AstTestFactory.libraryIdentifier2(["lib"])); |
3614 node.documentationComment = | 3651 node.documentationComment = |
3615 Comment.createEndOfLineComment(EMPTY_TOKEN_LIST); | 3652 Comment.createEndOfLineComment(EMPTY_TOKEN_LIST); |
3616 node.metadata.add(AstFactory.annotation(AstFactory.identifier3("a"))); | 3653 node.metadata |
| 3654 .add(AstTestFactory.annotation(AstTestFactory.identifier3("a"))); |
3617 _assertReplace(node, new Getter_NodeReplacerTest_test_partOfDirective()); | 3655 _assertReplace(node, new Getter_NodeReplacerTest_test_partOfDirective()); |
3618 _testAnnotatedNode(node); | 3656 _testAnnotatedNode(node); |
3619 } | 3657 } |
3620 | 3658 |
3621 void test_postfixExpression() { | 3659 void test_postfixExpression() { |
3622 PostfixExpression node = AstFactory.postfixExpression( | 3660 PostfixExpression node = AstTestFactory.postfixExpression( |
3623 AstFactory.identifier3("x"), TokenType.MINUS_MINUS); | 3661 AstTestFactory.identifier3("x"), TokenType.MINUS_MINUS); |
3624 _assertReplace(node, new Getter_NodeReplacerTest_test_postfixExpression()); | 3662 _assertReplace(node, new Getter_NodeReplacerTest_test_postfixExpression()); |
3625 } | 3663 } |
3626 | 3664 |
3627 void test_prefixedIdentifier() { | 3665 void test_prefixedIdentifier() { |
3628 PrefixedIdentifier node = AstFactory.identifier5("a", "b"); | 3666 PrefixedIdentifier node = AstTestFactory.identifier5("a", "b"); |
3629 _assertReplace( | 3667 _assertReplace( |
3630 node, new Getter_NodeReplacerTest_test_prefixedIdentifier_2()); | 3668 node, new Getter_NodeReplacerTest_test_prefixedIdentifier_2()); |
3631 _assertReplace(node, new Getter_NodeReplacerTest_test_prefixedIdentifier()); | 3669 _assertReplace(node, new Getter_NodeReplacerTest_test_prefixedIdentifier()); |
3632 } | 3670 } |
3633 | 3671 |
3634 void test_prefixExpression() { | 3672 void test_prefixExpression() { |
3635 PrefixExpression node = AstFactory.prefixExpression( | 3673 PrefixExpression node = AstTestFactory.prefixExpression( |
3636 TokenType.PLUS_PLUS, AstFactory.identifier3("y")); | 3674 TokenType.PLUS_PLUS, AstTestFactory.identifier3("y")); |
3637 _assertReplace(node, new Getter_NodeReplacerTest_test_prefixExpression()); | 3675 _assertReplace(node, new Getter_NodeReplacerTest_test_prefixExpression()); |
3638 } | 3676 } |
3639 | 3677 |
3640 void test_propertyAccess() { | 3678 void test_propertyAccess() { |
3641 PropertyAccess node = | 3679 PropertyAccess node = |
3642 AstFactory.propertyAccess2(AstFactory.identifier3("x"), "y"); | 3680 AstTestFactory.propertyAccess2(AstTestFactory.identifier3("x"), "y"); |
3643 _assertReplace(node, new Getter_NodeReplacerTest_test_propertyAccess()); | 3681 _assertReplace(node, new Getter_NodeReplacerTest_test_propertyAccess()); |
3644 _assertReplace(node, new Getter_NodeReplacerTest_test_propertyAccess_2()); | 3682 _assertReplace(node, new Getter_NodeReplacerTest_test_propertyAccess_2()); |
3645 } | 3683 } |
3646 | 3684 |
3647 void test_redirectingConstructorInvocation() { | 3685 void test_redirectingConstructorInvocation() { |
3648 RedirectingConstructorInvocation node = AstFactory | 3686 RedirectingConstructorInvocation node = AstTestFactory |
3649 .redirectingConstructorInvocation2("c", [AstFactory.integer(0)]); | 3687 .redirectingConstructorInvocation2("c", [AstTestFactory.integer(0)]); |
3650 _assertReplace(node, | 3688 _assertReplace(node, |
3651 new Getter_NodeReplacerTest_test_redirectingConstructorInvocation()); | 3689 new Getter_NodeReplacerTest_test_redirectingConstructorInvocation()); |
3652 _assertReplace(node, | 3690 _assertReplace(node, |
3653 new Getter_NodeReplacerTest_test_redirectingConstructorInvocation_2()); | 3691 new Getter_NodeReplacerTest_test_redirectingConstructorInvocation_2()); |
3654 } | 3692 } |
3655 | 3693 |
3656 void test_returnStatement() { | 3694 void test_returnStatement() { |
3657 ReturnStatement node = AstFactory.returnStatement2(AstFactory.integer(0)); | 3695 ReturnStatement node = |
| 3696 AstTestFactory.returnStatement2(AstTestFactory.integer(0)); |
3658 _assertReplace(node, new Getter_NodeReplacerTest_test_returnStatement()); | 3697 _assertReplace(node, new Getter_NodeReplacerTest_test_returnStatement()); |
3659 } | 3698 } |
3660 | 3699 |
3661 void test_showCombinator() { | 3700 void test_showCombinator() { |
3662 ShowCombinator node = AstFactory.showCombinator2(["X", "Y"]); | 3701 ShowCombinator node = AstTestFactory.showCombinator2(["X", "Y"]); |
3663 _assertReplace( | 3702 _assertReplace( |
3664 node, new ListGetter_NodeReplacerTest_test_showCombinator(0)); | 3703 node, new ListGetter_NodeReplacerTest_test_showCombinator(0)); |
3665 } | 3704 } |
3666 | 3705 |
3667 void test_simpleFormalParameter() { | 3706 void test_simpleFormalParameter() { |
3668 SimpleFormalParameter node = | 3707 SimpleFormalParameter node = AstTestFactory.simpleFormalParameter4( |
3669 AstFactory.simpleFormalParameter4(AstFactory.typeName4("T"), "p"); | 3708 AstTestFactory.typeName4("T"), "p"); |
3670 node.documentationComment = | 3709 node.documentationComment = |
3671 Comment.createEndOfLineComment(EMPTY_TOKEN_LIST); | 3710 Comment.createEndOfLineComment(EMPTY_TOKEN_LIST); |
3672 node.metadata = [AstFactory.annotation(AstFactory.identifier3("a"))]; | 3711 node.metadata = [ |
| 3712 AstTestFactory.annotation(AstTestFactory.identifier3("a")) |
| 3713 ]; |
3673 _assertReplace( | 3714 _assertReplace( |
3674 node, new Getter_NodeReplacerTest_test_simpleFormalParameter()); | 3715 node, new Getter_NodeReplacerTest_test_simpleFormalParameter()); |
3675 _testNormalFormalParameter(node); | 3716 _testNormalFormalParameter(node); |
3676 } | 3717 } |
3677 | 3718 |
3678 void test_stringInterpolation() { | 3719 void test_stringInterpolation() { |
3679 StringInterpolation node = | 3720 StringInterpolation node = |
3680 AstFactory.string([AstFactory.interpolationExpression2("a")]); | 3721 AstTestFactory.string([AstTestFactory.interpolationExpression2("a")]); |
3681 _assertReplace( | 3722 _assertReplace( |
3682 node, new ListGetter_NodeReplacerTest_test_stringInterpolation(0)); | 3723 node, new ListGetter_NodeReplacerTest_test_stringInterpolation(0)); |
3683 } | 3724 } |
3684 | 3725 |
3685 void test_superConstructorInvocation() { | 3726 void test_superConstructorInvocation() { |
3686 SuperConstructorInvocation node = | 3727 SuperConstructorInvocation node = AstTestFactory |
3687 AstFactory.superConstructorInvocation2("s", [AstFactory.integer(1)]); | 3728 .superConstructorInvocation2("s", [AstTestFactory.integer(1)]); |
3688 _assertReplace( | 3729 _assertReplace( |
3689 node, new Getter_NodeReplacerTest_test_superConstructorInvocation()); | 3730 node, new Getter_NodeReplacerTest_test_superConstructorInvocation()); |
3690 _assertReplace( | 3731 _assertReplace( |
3691 node, new Getter_NodeReplacerTest_test_superConstructorInvocation_2()); | 3732 node, new Getter_NodeReplacerTest_test_superConstructorInvocation_2()); |
3692 } | 3733 } |
3693 | 3734 |
3694 void test_switchCase() { | 3735 void test_switchCase() { |
3695 SwitchCase node = AstFactory.switchCase2( | 3736 SwitchCase node = AstTestFactory.switchCase2([AstTestFactory.label2("l")], |
3696 [AstFactory.label2("l")], AstFactory.integer(0), [AstFactory.block()]); | 3737 AstTestFactory.integer(0), [AstTestFactory.block()]); |
3697 _assertReplace(node, new Getter_NodeReplacerTest_test_switchCase()); | 3738 _assertReplace(node, new Getter_NodeReplacerTest_test_switchCase()); |
3698 _testSwitchMember(node); | 3739 _testSwitchMember(node); |
3699 } | 3740 } |
3700 | 3741 |
3701 void test_switchDefault() { | 3742 void test_switchDefault() { |
3702 SwitchDefault node = AstFactory | 3743 SwitchDefault node = AstTestFactory |
3703 .switchDefault([AstFactory.label2("l")], [AstFactory.block()]); | 3744 .switchDefault([AstTestFactory.label2("l")], [AstTestFactory.block()]); |
3704 _testSwitchMember(node); | 3745 _testSwitchMember(node); |
3705 } | 3746 } |
3706 | 3747 |
3707 void test_switchStatement() { | 3748 void test_switchStatement() { |
3708 SwitchStatement node = | 3749 SwitchStatement node = |
3709 AstFactory.switchStatement(AstFactory.identifier3("x"), [ | 3750 AstTestFactory.switchStatement(AstTestFactory.identifier3("x"), [ |
3710 AstFactory.switchCase2([AstFactory.label2("l")], AstFactory.integer(0), | 3751 AstTestFactory.switchCase2([AstTestFactory.label2("l")], |
3711 [AstFactory.block()]), | 3752 AstTestFactory.integer(0), [AstTestFactory.block()]), |
3712 AstFactory.switchDefault([AstFactory.label2("l")], [AstFactory.block()]) | 3753 AstTestFactory |
| 3754 .switchDefault([AstTestFactory.label2("l")], [AstTestFactory.block()]) |
3713 ]); | 3755 ]); |
3714 _assertReplace(node, new Getter_NodeReplacerTest_test_switchStatement()); | 3756 _assertReplace(node, new Getter_NodeReplacerTest_test_switchStatement()); |
3715 _assertReplace( | 3757 _assertReplace( |
3716 node, new ListGetter_NodeReplacerTest_test_switchStatement(0)); | 3758 node, new ListGetter_NodeReplacerTest_test_switchStatement(0)); |
3717 } | 3759 } |
3718 | 3760 |
3719 void test_throwExpression() { | 3761 void test_throwExpression() { |
3720 ThrowExpression node = | 3762 ThrowExpression node = |
3721 AstFactory.throwExpression2(AstFactory.identifier3("e")); | 3763 AstTestFactory.throwExpression2(AstTestFactory.identifier3("e")); |
3722 _assertReplace(node, new Getter_NodeReplacerTest_test_throwExpression()); | 3764 _assertReplace(node, new Getter_NodeReplacerTest_test_throwExpression()); |
3723 } | 3765 } |
3724 | 3766 |
3725 void test_topLevelVariableDeclaration() { | 3767 void test_topLevelVariableDeclaration() { |
3726 TopLevelVariableDeclaration node = AstFactory.topLevelVariableDeclaration( | 3768 TopLevelVariableDeclaration node = AstTestFactory |
3727 null, AstFactory.typeName4("T"), [AstFactory.variableDeclaration("t")]); | 3769 .topLevelVariableDeclaration(null, AstTestFactory.typeName4("T"), |
| 3770 [AstTestFactory.variableDeclaration("t")]); |
3728 node.documentationComment = | 3771 node.documentationComment = |
3729 Comment.createEndOfLineComment(EMPTY_TOKEN_LIST); | 3772 Comment.createEndOfLineComment(EMPTY_TOKEN_LIST); |
3730 node.metadata.add(AstFactory.annotation(AstFactory.identifier3("a"))); | 3773 node.metadata |
| 3774 .add(AstTestFactory.annotation(AstTestFactory.identifier3("a"))); |
3731 _assertReplace( | 3775 _assertReplace( |
3732 node, new Getter_NodeReplacerTest_test_topLevelVariableDeclaration()); | 3776 node, new Getter_NodeReplacerTest_test_topLevelVariableDeclaration()); |
3733 _testAnnotatedNode(node); | 3777 _testAnnotatedNode(node); |
3734 } | 3778 } |
3735 | 3779 |
3736 void test_tryStatement() { | 3780 void test_tryStatement() { |
3737 TryStatement node = AstFactory.tryStatement3( | 3781 TryStatement node = AstTestFactory.tryStatement3( |
3738 AstFactory.block(), | 3782 AstTestFactory.block(), |
3739 [ | 3783 [ |
3740 AstFactory.catchClause("e", [AstFactory.block()]) | 3784 AstTestFactory.catchClause("e", [AstTestFactory.block()]) |
3741 ], | 3785 ], |
3742 AstFactory.block()); | 3786 AstTestFactory.block()); |
3743 _assertReplace(node, new Getter_NodeReplacerTest_test_tryStatement_2()); | 3787 _assertReplace(node, new Getter_NodeReplacerTest_test_tryStatement_2()); |
3744 _assertReplace(node, new Getter_NodeReplacerTest_test_tryStatement()); | 3788 _assertReplace(node, new Getter_NodeReplacerTest_test_tryStatement()); |
3745 _assertReplace(node, new ListGetter_NodeReplacerTest_test_tryStatement(0)); | 3789 _assertReplace(node, new ListGetter_NodeReplacerTest_test_tryStatement(0)); |
3746 } | 3790 } |
3747 | 3791 |
3748 void test_typeArgumentList() { | 3792 void test_typeArgumentList() { |
3749 TypeArgumentList node = | 3793 TypeArgumentList node = |
3750 AstFactory.typeArgumentList([AstFactory.typeName4("A")]); | 3794 AstTestFactory.typeArgumentList([AstTestFactory.typeName4("A")]); |
3751 _assertReplace( | 3795 _assertReplace( |
3752 node, new ListGetter_NodeReplacerTest_test_typeArgumentList(0)); | 3796 node, new ListGetter_NodeReplacerTest_test_typeArgumentList(0)); |
3753 } | 3797 } |
3754 | 3798 |
3755 void test_typeName() { | 3799 void test_typeName() { |
3756 TypeName node = AstFactory | 3800 TypeName node = AstTestFactory.typeName4( |
3757 .typeName4("T", [AstFactory.typeName4("E"), AstFactory.typeName4("F")]); | 3801 "T", [AstTestFactory.typeName4("E"), AstTestFactory.typeName4("F")]); |
3758 _assertReplace(node, new Getter_NodeReplacerTest_test_typeName_2()); | 3802 _assertReplace(node, new Getter_NodeReplacerTest_test_typeName_2()); |
3759 _assertReplace(node, new Getter_NodeReplacerTest_test_typeName()); | 3803 _assertReplace(node, new Getter_NodeReplacerTest_test_typeName()); |
3760 } | 3804 } |
3761 | 3805 |
3762 void test_typeParameter() { | 3806 void test_typeParameter() { |
3763 TypeParameter node = | 3807 TypeParameter node = |
3764 AstFactory.typeParameter2("E", AstFactory.typeName4("B")); | 3808 AstTestFactory.typeParameter2("E", AstTestFactory.typeName4("B")); |
3765 _assertReplace(node, new Getter_NodeReplacerTest_test_typeParameter_2()); | 3809 _assertReplace(node, new Getter_NodeReplacerTest_test_typeParameter_2()); |
3766 _assertReplace(node, new Getter_NodeReplacerTest_test_typeParameter()); | 3810 _assertReplace(node, new Getter_NodeReplacerTest_test_typeParameter()); |
3767 } | 3811 } |
3768 | 3812 |
3769 void test_typeParameterList() { | 3813 void test_typeParameterList() { |
3770 TypeParameterList node = AstFactory.typeParameterList(["A", "B"]); | 3814 TypeParameterList node = AstTestFactory.typeParameterList(["A", "B"]); |
3771 _assertReplace( | 3815 _assertReplace( |
3772 node, new ListGetter_NodeReplacerTest_test_typeParameterList(0)); | 3816 node, new ListGetter_NodeReplacerTest_test_typeParameterList(0)); |
3773 } | 3817 } |
3774 | 3818 |
3775 void test_variableDeclaration() { | 3819 void test_variableDeclaration() { |
3776 VariableDeclaration node = | 3820 VariableDeclaration node = |
3777 AstFactory.variableDeclaration2("a", AstFactory.nullLiteral()); | 3821 AstTestFactory.variableDeclaration2("a", AstTestFactory.nullLiteral()); |
3778 node.documentationComment = | 3822 node.documentationComment = |
3779 Comment.createEndOfLineComment(EMPTY_TOKEN_LIST); | 3823 Comment.createEndOfLineComment(EMPTY_TOKEN_LIST); |
3780 node.metadata.add(AstFactory.annotation(AstFactory.identifier3("a"))); | 3824 node.metadata |
| 3825 .add(AstTestFactory.annotation(AstTestFactory.identifier3("a"))); |
3781 _assertReplace( | 3826 _assertReplace( |
3782 node, new Getter_NodeReplacerTest_test_variableDeclaration()); | 3827 node, new Getter_NodeReplacerTest_test_variableDeclaration()); |
3783 _assertReplace( | 3828 _assertReplace( |
3784 node, new Getter_NodeReplacerTest_test_variableDeclaration_2()); | 3829 node, new Getter_NodeReplacerTest_test_variableDeclaration_2()); |
3785 _testAnnotatedNode(node); | 3830 _testAnnotatedNode(node); |
3786 } | 3831 } |
3787 | 3832 |
3788 void test_variableDeclarationList() { | 3833 void test_variableDeclarationList() { |
3789 VariableDeclarationList node = AstFactory.variableDeclarationList( | 3834 VariableDeclarationList node = AstTestFactory.variableDeclarationList( |
3790 null, AstFactory.typeName4("T"), [AstFactory.variableDeclaration("a")]); | 3835 null, |
| 3836 AstTestFactory.typeName4("T"), |
| 3837 [AstTestFactory.variableDeclaration("a")]); |
3791 node.documentationComment = | 3838 node.documentationComment = |
3792 Comment.createEndOfLineComment(EMPTY_TOKEN_LIST); | 3839 Comment.createEndOfLineComment(EMPTY_TOKEN_LIST); |
3793 node.metadata.add(AstFactory.annotation(AstFactory.identifier3("a"))); | 3840 node.metadata |
| 3841 .add(AstTestFactory.annotation(AstTestFactory.identifier3("a"))); |
3794 _assertReplace( | 3842 _assertReplace( |
3795 node, new Getter_NodeReplacerTest_test_variableDeclarationList()); | 3843 node, new Getter_NodeReplacerTest_test_variableDeclarationList()); |
3796 _assertReplace( | 3844 _assertReplace( |
3797 node, new ListGetter_NodeReplacerTest_test_variableDeclarationList(0)); | 3845 node, new ListGetter_NodeReplacerTest_test_variableDeclarationList(0)); |
3798 _testAnnotatedNode(node); | 3846 _testAnnotatedNode(node); |
3799 } | 3847 } |
3800 | 3848 |
3801 void test_variableDeclarationStatement() { | 3849 void test_variableDeclarationStatement() { |
3802 VariableDeclarationStatement node = AstFactory.variableDeclarationStatement( | 3850 VariableDeclarationStatement node = AstTestFactory |
3803 null, AstFactory.typeName4("T"), [AstFactory.variableDeclaration("a")]); | 3851 .variableDeclarationStatement(null, AstTestFactory.typeName4("T"), |
| 3852 [AstTestFactory.variableDeclaration("a")]); |
3804 _assertReplace( | 3853 _assertReplace( |
3805 node, new Getter_NodeReplacerTest_test_variableDeclarationStatement()); | 3854 node, new Getter_NodeReplacerTest_test_variableDeclarationStatement()); |
3806 } | 3855 } |
3807 | 3856 |
3808 void test_whileStatement() { | 3857 void test_whileStatement() { |
3809 WhileStatement node = AstFactory.whileStatement( | 3858 WhileStatement node = AstTestFactory.whileStatement( |
3810 AstFactory.booleanLiteral(true), AstFactory.block()); | 3859 AstTestFactory.booleanLiteral(true), AstTestFactory.block()); |
3811 _assertReplace(node, new Getter_NodeReplacerTest_test_whileStatement()); | 3860 _assertReplace(node, new Getter_NodeReplacerTest_test_whileStatement()); |
3812 _assertReplace(node, new Getter_NodeReplacerTest_test_whileStatement_2()); | 3861 _assertReplace(node, new Getter_NodeReplacerTest_test_whileStatement_2()); |
3813 } | 3862 } |
3814 | 3863 |
3815 void test_withClause() { | 3864 void test_withClause() { |
3816 WithClause node = AstFactory.withClause([AstFactory.typeName4("M")]); | 3865 WithClause node = |
| 3866 AstTestFactory.withClause([AstTestFactory.typeName4("M")]); |
3817 _assertReplace(node, new ListGetter_NodeReplacerTest_test_withClause(0)); | 3867 _assertReplace(node, new ListGetter_NodeReplacerTest_test_withClause(0)); |
3818 } | 3868 } |
3819 | 3869 |
3820 void test_yieldStatement() { | 3870 void test_yieldStatement() { |
3821 var node = AstFactory.yieldStatement(AstFactory.identifier3("A")); | 3871 var node = AstTestFactory.yieldStatement(AstTestFactory.identifier3("A")); |
3822 _assertReplace(node, new Getter_NodeReplacerTest_test_yieldStatement()); | 3872 _assertReplace(node, new Getter_NodeReplacerTest_test_yieldStatement()); |
3823 } | 3873 } |
3824 | 3874 |
3825 void _assertReplace(AstNode parent, NodeReplacerTest_Getter getter) { | 3875 void _assertReplace(AstNode parent, NodeReplacerTest_Getter getter) { |
3826 AstNode child = getter.get(parent); | 3876 AstNode child = getter.get(parent); |
3827 if (child != null) { | 3877 if (child != null) { |
3828 AstNode clone = child.accept(new AstCloner()); | 3878 AstNode clone = child.accept(new AstCloner()); |
3829 NodeReplacer.replace(child, clone); | 3879 NodeReplacer.replace(child, clone); |
3830 expect(getter.get(parent), clone); | 3880 expect(getter.get(parent), clone); |
3831 expect(clone.parent, parent); | 3881 expect(clone.parent, parent); |
(...skipping 524 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
4356 tokenMap.put(key, value); | 4406 tokenMap.put(key, value); |
4357 expect(tokenMap.get(key), same(value)); | 4407 expect(tokenMap.get(key), same(value)); |
4358 } | 4408 } |
4359 } | 4409 } |
4360 | 4410 |
4361 class _ExceptionThrowingVisitor extends SimpleAstVisitor { | 4411 class _ExceptionThrowingVisitor extends SimpleAstVisitor { |
4362 visitNullLiteral(NullLiteral node) { | 4412 visitNullLiteral(NullLiteral node) { |
4363 throw new ArgumentError(''); | 4413 throw new ArgumentError(''); |
4364 } | 4414 } |
4365 } | 4415 } |
OLD | NEW |