Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(54)

Side by Side Diff: pkg/analyzer/test/generated/utilities_test.dart

Issue 2539243002: Transition analyzer and analysis_server to new astFactory; remove old AST factory methods. (Closed)
Patch Set: Update CHANGELOG Created 4 years ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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/standard_ast_factory.dart';
10 import 'package:analyzer/dart/ast/token.dart'; 11 import 'package:analyzer/dart/ast/token.dart';
11 import 'package:analyzer/dart/ast/visitor.dart'; 12 import 'package:analyzer/dart/ast/visitor.dart';
12 import 'package:analyzer/src/dart/ast/token.dart'; 13 import 'package:analyzer/src/dart/ast/token.dart';
13 import 'package:analyzer/src/dart/ast/utilities.dart'; 14 import 'package:analyzer/src/dart/ast/utilities.dart';
14 import 'package:analyzer/src/dart/scanner/reader.dart'; 15 import 'package:analyzer/src/dart/scanner/reader.dart';
15 import 'package:analyzer/src/dart/scanner/scanner.dart'; 16 import 'package:analyzer/src/dart/scanner/scanner.dart';
16 import 'package:analyzer/src/generated/java_engine.dart'; 17 import 'package:analyzer/src/generated/java_engine.dart';
17 import 'package:analyzer/src/generated/parser.dart'; 18 import 'package:analyzer/src/generated/parser.dart';
18 import 'package:analyzer/src/generated/source.dart'; 19 import 'package:analyzer/src/generated/source.dart';
19 import 'package:analyzer/src/generated/testing/ast_test_factory.dart'; 20 import 'package:analyzer/src/generated/testing/ast_test_factory.dart';
(...skipping 1579 matching lines...) Expand 10 before | Expand all | Expand 10 after
1599 @reflectiveTest 1600 @reflectiveTest
1600 class ExceptionHandlingDelegatingAstVisitorTest extends EngineTestCase { 1601 class ExceptionHandlingDelegatingAstVisitorTest extends EngineTestCase {
1601 void test_handlerIsCalled() { 1602 void test_handlerIsCalled() {
1602 AstVisitor exceptionThrowingVisitor = new _ExceptionThrowingVisitor(); 1603 AstVisitor exceptionThrowingVisitor = new _ExceptionThrowingVisitor();
1603 bool handlerInvoked = false; 1604 bool handlerInvoked = false;
1604 AstVisitor visitor = new ExceptionHandlingDelegatingAstVisitor( 1605 AstVisitor visitor = new ExceptionHandlingDelegatingAstVisitor(
1605 [exceptionThrowingVisitor], (AstNode node, AstVisitor visitor, 1606 [exceptionThrowingVisitor], (AstNode node, AstVisitor visitor,
1606 dynamic exception, StackTrace stackTrace) { 1607 dynamic exception, StackTrace stackTrace) {
1607 handlerInvoked = true; 1608 handlerInvoked = true;
1608 }); 1609 });
1609 new NullLiteral(null).accept(visitor); 1610 astFactory.nullLiteral(null).accept(visitor);
1610 expect(handlerInvoked, isTrue); 1611 expect(handlerInvoked, isTrue);
1611 } 1612 }
1612 } 1613 }
1613 1614
1614 class Getter_NodeReplacerTest_test_annotation 1615 class Getter_NodeReplacerTest_test_annotation
1615 implements NodeReplacerTest_Getter<Annotation, ArgumentList> { 1616 implements NodeReplacerTest_Getter<Annotation, ArgumentList> {
1616 @override 1617 @override
1617 ArgumentList get(Annotation node) => node.arguments; 1618 ArgumentList get(Annotation node) => node.arguments;
1618 } 1619 }
1619 1620
(...skipping 1436 matching lines...) Expand 10 before | Expand all | Expand 10 after
3056 ClassDeclaration node = AstTestFactory.classDeclaration( 3057 ClassDeclaration node = AstTestFactory.classDeclaration(
3057 null, 3058 null,
3058 "A", 3059 "A",
3059 AstTestFactory.typeParameterList(["E"]), 3060 AstTestFactory.typeParameterList(["E"]),
3060 AstTestFactory.extendsClause(AstTestFactory.typeName4("B")), 3061 AstTestFactory.extendsClause(AstTestFactory.typeName4("B")),
3061 AstTestFactory.withClause([AstTestFactory.typeName4("C")]), 3062 AstTestFactory.withClause([AstTestFactory.typeName4("C")]),
3062 AstTestFactory.implementsClause([AstTestFactory.typeName4("D")]), [ 3063 AstTestFactory.implementsClause([AstTestFactory.typeName4("D")]), [
3063 AstTestFactory.fieldDeclaration2( 3064 AstTestFactory.fieldDeclaration2(
3064 false, null, [AstTestFactory.variableDeclaration("f")]) 3065 false, null, [AstTestFactory.variableDeclaration("f")])
3065 ]); 3066 ]);
3066 node.documentationComment = 3067 node.documentationComment = astFactory.endOfLineComment(EMPTY_TOKEN_LIST);
3067 Comment.createEndOfLineComment(EMPTY_TOKEN_LIST);
3068 node.metadata 3068 node.metadata
3069 .add(AstTestFactory.annotation(AstTestFactory.identifier3("a"))); 3069 .add(AstTestFactory.annotation(AstTestFactory.identifier3("a")));
3070 node.nativeClause = AstTestFactory.nativeClause(""); 3070 node.nativeClause = AstTestFactory.nativeClause("");
3071 _assertReplace(node, new Getter_NodeReplacerTest_test_classDeclaration_6()); 3071 _assertReplace(node, new Getter_NodeReplacerTest_test_classDeclaration_6());
3072 _assertReplace(node, new Getter_NodeReplacerTest_test_classDeclaration_5()); 3072 _assertReplace(node, new Getter_NodeReplacerTest_test_classDeclaration_5());
3073 _assertReplace(node, new Getter_NodeReplacerTest_test_classDeclaration_4()); 3073 _assertReplace(node, new Getter_NodeReplacerTest_test_classDeclaration_4());
3074 _assertReplace(node, new Getter_NodeReplacerTest_test_classDeclaration_2()); 3074 _assertReplace(node, new Getter_NodeReplacerTest_test_classDeclaration_2());
3075 _assertReplace(node, new Getter_NodeReplacerTest_test_classDeclaration()); 3075 _assertReplace(node, new Getter_NodeReplacerTest_test_classDeclaration());
3076 _assertReplace(node, new Getter_NodeReplacerTest_test_classDeclaration_3()); 3076 _assertReplace(node, new Getter_NodeReplacerTest_test_classDeclaration_3());
3077 _assertReplace( 3077 _assertReplace(
3078 node, new ListGetter_NodeReplacerTest_test_classDeclaration(0)); 3078 node, new ListGetter_NodeReplacerTest_test_classDeclaration(0));
3079 _testAnnotatedNode(node); 3079 _testAnnotatedNode(node);
3080 } 3080 }
3081 3081
3082 void test_classTypeAlias() { 3082 void test_classTypeAlias() {
3083 ClassTypeAlias node = AstTestFactory.classTypeAlias( 3083 ClassTypeAlias node = AstTestFactory.classTypeAlias(
3084 "A", 3084 "A",
3085 AstTestFactory.typeParameterList(["E"]), 3085 AstTestFactory.typeParameterList(["E"]),
3086 null, 3086 null,
3087 AstTestFactory.typeName4("B"), 3087 AstTestFactory.typeName4("B"),
3088 AstTestFactory.withClause([AstTestFactory.typeName4("C")]), 3088 AstTestFactory.withClause([AstTestFactory.typeName4("C")]),
3089 AstTestFactory.implementsClause([AstTestFactory.typeName4("D")])); 3089 AstTestFactory.implementsClause([AstTestFactory.typeName4("D")]));
3090 node.documentationComment = 3090 node.documentationComment = astFactory.endOfLineComment(EMPTY_TOKEN_LIST);
3091 Comment.createEndOfLineComment(EMPTY_TOKEN_LIST);
3092 node.metadata 3091 node.metadata
3093 .add(AstTestFactory.annotation(AstTestFactory.identifier3("a"))); 3092 .add(AstTestFactory.annotation(AstTestFactory.identifier3("a")));
3094 _assertReplace(node, new Getter_NodeReplacerTest_test_classTypeAlias_4()); 3093 _assertReplace(node, new Getter_NodeReplacerTest_test_classTypeAlias_4());
3095 _assertReplace(node, new Getter_NodeReplacerTest_test_classTypeAlias_5()); 3094 _assertReplace(node, new Getter_NodeReplacerTest_test_classTypeAlias_5());
3096 _assertReplace(node, new Getter_NodeReplacerTest_test_classTypeAlias()); 3095 _assertReplace(node, new Getter_NodeReplacerTest_test_classTypeAlias());
3097 _assertReplace(node, new Getter_NodeReplacerTest_test_classTypeAlias_3()); 3096 _assertReplace(node, new Getter_NodeReplacerTest_test_classTypeAlias_3());
3098 _assertReplace(node, new Getter_NodeReplacerTest_test_classTypeAlias_2()); 3097 _assertReplace(node, new Getter_NodeReplacerTest_test_classTypeAlias_2());
3099 _testAnnotatedNode(node); 3098 _testAnnotatedNode(node);
3100 } 3099 }
3101 3100
3102 void test_comment() { 3101 void test_comment() {
3103 Comment node = Comment.createEndOfLineComment(EMPTY_TOKEN_LIST); 3102 Comment node = astFactory.endOfLineComment(EMPTY_TOKEN_LIST);
3104 node.references 3103 node.references.add(
3105 .add(new CommentReference(null, AstTestFactory.identifier3("x"))); 3104 astFactory.commentReference(null, AstTestFactory.identifier3("x")));
3106 _assertReplace(node, new ListGetter_NodeReplacerTest_test_comment(0)); 3105 _assertReplace(node, new ListGetter_NodeReplacerTest_test_comment(0));
3107 } 3106 }
3108 3107
3109 void test_commentReference() { 3108 void test_commentReference() {
3110 CommentReference node = 3109 CommentReference node =
3111 new CommentReference(null, AstTestFactory.identifier3("x")); 3110 astFactory.commentReference(null, AstTestFactory.identifier3("x"));
3112 _assertReplace(node, new Getter_NodeReplacerTest_test_commentReference()); 3111 _assertReplace(node, new Getter_NodeReplacerTest_test_commentReference());
3113 } 3112 }
3114 3113
3115 void test_compilationUnit() { 3114 void test_compilationUnit() {
3116 CompilationUnit node = AstTestFactory.compilationUnit8("", [ 3115 CompilationUnit node = AstTestFactory.compilationUnit8("", [
3117 AstTestFactory.libraryDirective2("lib") 3116 AstTestFactory.libraryDirective2("lib")
3118 ], [ 3117 ], [
3119 AstTestFactory.topLevelVariableDeclaration2( 3118 AstTestFactory.topLevelVariableDeclaration2(
3120 null, [AstTestFactory.variableDeclaration("X")]) 3119 null, [AstTestFactory.variableDeclaration("X")])
3121 ]); 3120 ]);
(...skipping 22 matching lines...) Expand all
3144 null, 3143 null,
3145 null, 3144 null,
3146 AstTestFactory.identifier3("C"), 3145 AstTestFactory.identifier3("C"),
3147 "d", 3146 "d",
3148 AstTestFactory.formalParameterList(), 3147 AstTestFactory.formalParameterList(),
3149 [ 3148 [
3150 AstTestFactory.constructorFieldInitializer( 3149 AstTestFactory.constructorFieldInitializer(
3151 false, "x", AstTestFactory.integer(0)) 3150 false, "x", AstTestFactory.integer(0))
3152 ], 3151 ],
3153 AstTestFactory.emptyFunctionBody()); 3152 AstTestFactory.emptyFunctionBody());
3154 node.documentationComment = 3153 node.documentationComment = astFactory.endOfLineComment(EMPTY_TOKEN_LIST);
3155 Comment.createEndOfLineComment(EMPTY_TOKEN_LIST);
3156 node.metadata 3154 node.metadata
3157 .add(AstTestFactory.annotation(AstTestFactory.identifier3("a"))); 3155 .add(AstTestFactory.annotation(AstTestFactory.identifier3("a")));
3158 node.redirectedConstructor = 3156 node.redirectedConstructor =
3159 AstTestFactory.constructorName(AstTestFactory.typeName4("B"), "a"); 3157 AstTestFactory.constructorName(AstTestFactory.typeName4("B"), "a");
3160 _assertReplace( 3158 _assertReplace(
3161 node, new Getter_NodeReplacerTest_test_constructorDeclaration_3()); 3159 node, new Getter_NodeReplacerTest_test_constructorDeclaration_3());
3162 _assertReplace( 3160 _assertReplace(
3163 node, new Getter_NodeReplacerTest_test_constructorDeclaration_2()); 3161 node, new Getter_NodeReplacerTest_test_constructorDeclaration_2());
3164 _assertReplace( 3162 _assertReplace(
3165 node, new Getter_NodeReplacerTest_test_constructorDeclaration_4()); 3163 node, new Getter_NodeReplacerTest_test_constructorDeclaration_4());
(...skipping 23 matching lines...) Expand all
3189 } 3187 }
3190 3188
3191 void test_continueStatement() { 3189 void test_continueStatement() {
3192 ContinueStatement node = AstTestFactory.continueStatement("l"); 3190 ContinueStatement node = AstTestFactory.continueStatement("l");
3193 _assertReplace(node, new Getter_NodeReplacerTest_test_continueStatement()); 3191 _assertReplace(node, new Getter_NodeReplacerTest_test_continueStatement());
3194 } 3192 }
3195 3193
3196 void test_declaredIdentifier() { 3194 void test_declaredIdentifier() {
3197 DeclaredIdentifier node = 3195 DeclaredIdentifier node =
3198 AstTestFactory.declaredIdentifier4(AstTestFactory.typeName4("C"), "i"); 3196 AstTestFactory.declaredIdentifier4(AstTestFactory.typeName4("C"), "i");
3199 node.documentationComment = 3197 node.documentationComment = astFactory.endOfLineComment(EMPTY_TOKEN_LIST);
3200 Comment.createEndOfLineComment(EMPTY_TOKEN_LIST);
3201 node.metadata 3198 node.metadata
3202 .add(AstTestFactory.annotation(AstTestFactory.identifier3("a"))); 3199 .add(AstTestFactory.annotation(AstTestFactory.identifier3("a")));
3203 _assertReplace(node, new Getter_NodeReplacerTest_test_declaredIdentifier()); 3200 _assertReplace(node, new Getter_NodeReplacerTest_test_declaredIdentifier());
3204 _assertReplace( 3201 _assertReplace(
3205 node, new Getter_NodeReplacerTest_test_declaredIdentifier_2()); 3202 node, new Getter_NodeReplacerTest_test_declaredIdentifier_2());
3206 _testAnnotatedNode(node); 3203 _testAnnotatedNode(node);
3207 } 3204 }
3208 3205
3209 void test_defaultFormalParameter() { 3206 void test_defaultFormalParameter() {
3210 DefaultFormalParameter node = AstTestFactory.positionalFormalParameter( 3207 DefaultFormalParameter node = AstTestFactory.positionalFormalParameter(
3211 AstTestFactory.simpleFormalParameter3("p"), AstTestFactory.integer(0)); 3208 AstTestFactory.simpleFormalParameter3("p"), AstTestFactory.integer(0));
3212 _assertReplace( 3209 _assertReplace(
3213 node, new Getter_NodeReplacerTest_test_defaultFormalParameter()); 3210 node, new Getter_NodeReplacerTest_test_defaultFormalParameter());
3214 _assertReplace( 3211 _assertReplace(
3215 node, new Getter_NodeReplacerTest_test_defaultFormalParameter_2()); 3212 node, new Getter_NodeReplacerTest_test_defaultFormalParameter_2());
3216 } 3213 }
3217 3214
3218 void test_doStatement() { 3215 void test_doStatement() {
3219 DoStatement node = AstTestFactory.doStatement( 3216 DoStatement node = AstTestFactory.doStatement(
3220 AstTestFactory.block(), AstTestFactory.booleanLiteral(true)); 3217 AstTestFactory.block(), AstTestFactory.booleanLiteral(true));
3221 _assertReplace(node, new Getter_NodeReplacerTest_test_doStatement_2()); 3218 _assertReplace(node, new Getter_NodeReplacerTest_test_doStatement_2());
3222 _assertReplace(node, new Getter_NodeReplacerTest_test_doStatement()); 3219 _assertReplace(node, new Getter_NodeReplacerTest_test_doStatement());
3223 } 3220 }
3224 3221
3225 void test_enumConstantDeclaration() { 3222 void test_enumConstantDeclaration() {
3226 EnumConstantDeclaration node = new EnumConstantDeclaration( 3223 EnumConstantDeclaration node = astFactory.enumConstantDeclaration(
3227 Comment.createEndOfLineComment(EMPTY_TOKEN_LIST), 3224 astFactory.endOfLineComment(EMPTY_TOKEN_LIST),
3228 [AstTestFactory.annotation(AstTestFactory.identifier3("a"))], 3225 [AstTestFactory.annotation(AstTestFactory.identifier3("a"))],
3229 AstTestFactory.identifier3("C")); 3226 AstTestFactory.identifier3("C"));
3230 _assertReplace( 3227 _assertReplace(
3231 node, new Getter_NodeReplacerTest_test_enumConstantDeclaration()); 3228 node, new Getter_NodeReplacerTest_test_enumConstantDeclaration());
3232 _testAnnotatedNode(node); 3229 _testAnnotatedNode(node);
3233 } 3230 }
3234 3231
3235 void test_enumDeclaration() { 3232 void test_enumDeclaration() {
3236 EnumDeclaration node = AstTestFactory.enumDeclaration2("E", ["ONE", "TWO"]); 3233 EnumDeclaration node = AstTestFactory.enumDeclaration2("E", ["ONE", "TWO"]);
3237 node.documentationComment = 3234 node.documentationComment = astFactory.endOfLineComment(EMPTY_TOKEN_LIST);
3238 Comment.createEndOfLineComment(EMPTY_TOKEN_LIST);
3239 node.metadata 3235 node.metadata
3240 .add(AstTestFactory.annotation(AstTestFactory.identifier3("a"))); 3236 .add(AstTestFactory.annotation(AstTestFactory.identifier3("a")));
3241 _assertReplace(node, new Getter_NodeReplacerTest_test_enumDeclaration()); 3237 _assertReplace(node, new Getter_NodeReplacerTest_test_enumDeclaration());
3242 _testAnnotatedNode(node); 3238 _testAnnotatedNode(node);
3243 } 3239 }
3244 3240
3245 void test_exportDirective() { 3241 void test_exportDirective() {
3246 ExportDirective node = AstTestFactory.exportDirective2("", [ 3242 ExportDirective node = AstTestFactory.exportDirective2("", [
3247 AstTestFactory.hideCombinator2(["C"]) 3243 AstTestFactory.hideCombinator2(["C"])
3248 ]); 3244 ]);
3249 node.documentationComment = 3245 node.documentationComment = astFactory.endOfLineComment(EMPTY_TOKEN_LIST);
3250 Comment.createEndOfLineComment(EMPTY_TOKEN_LIST);
3251 node.metadata 3246 node.metadata
3252 .add(AstTestFactory.annotation(AstTestFactory.identifier3("a"))); 3247 .add(AstTestFactory.annotation(AstTestFactory.identifier3("a")));
3253 _testNamespaceDirective(node); 3248 _testNamespaceDirective(node);
3254 } 3249 }
3255 3250
3256 void test_expressionFunctionBody() { 3251 void test_expressionFunctionBody() {
3257 ExpressionFunctionBody node = 3252 ExpressionFunctionBody node =
3258 AstTestFactory.expressionFunctionBody(AstTestFactory.integer(0)); 3253 AstTestFactory.expressionFunctionBody(AstTestFactory.integer(0));
3259 _assertReplace( 3254 _assertReplace(
3260 node, new Getter_NodeReplacerTest_test_expressionFunctionBody()); 3255 node, new Getter_NodeReplacerTest_test_expressionFunctionBody());
(...skipping 11 matching lines...) Expand all
3272 AstTestFactory.extendsClause(AstTestFactory.typeName4("S")); 3267 AstTestFactory.extendsClause(AstTestFactory.typeName4("S"));
3273 _assertReplace(node, new Getter_NodeReplacerTest_test_extendsClause()); 3268 _assertReplace(node, new Getter_NodeReplacerTest_test_extendsClause());
3274 } 3269 }
3275 3270
3276 void test_fieldDeclaration() { 3271 void test_fieldDeclaration() {
3277 FieldDeclaration node = AstTestFactory.fieldDeclaration( 3272 FieldDeclaration node = AstTestFactory.fieldDeclaration(
3278 false, 3273 false,
3279 null, 3274 null,
3280 AstTestFactory.typeName4("C"), 3275 AstTestFactory.typeName4("C"),
3281 [AstTestFactory.variableDeclaration("c")]); 3276 [AstTestFactory.variableDeclaration("c")]);
3282 node.documentationComment = 3277 node.documentationComment = astFactory.endOfLineComment(EMPTY_TOKEN_LIST);
3283 Comment.createEndOfLineComment(EMPTY_TOKEN_LIST);
3284 node.metadata 3278 node.metadata
3285 .add(AstTestFactory.annotation(AstTestFactory.identifier3("a"))); 3279 .add(AstTestFactory.annotation(AstTestFactory.identifier3("a")));
3286 _assertReplace(node, new Getter_NodeReplacerTest_test_fieldDeclaration()); 3280 _assertReplace(node, new Getter_NodeReplacerTest_test_fieldDeclaration());
3287 _testAnnotatedNode(node); 3281 _testAnnotatedNode(node);
3288 } 3282 }
3289 3283
3290 void test_fieldFormalParameter() { 3284 void test_fieldFormalParameter() {
3291 FieldFormalParameter node = AstTestFactory.fieldFormalParameter( 3285 FieldFormalParameter node = AstTestFactory.fieldFormalParameter(
3292 null, 3286 null,
3293 AstTestFactory.typeName4("C"), 3287 AstTestFactory.typeName4("C"),
3294 "f", 3288 "f",
3295 AstTestFactory.formalParameterList()); 3289 AstTestFactory.formalParameterList());
3296 node.documentationComment = 3290 node.documentationComment = astFactory.endOfLineComment(EMPTY_TOKEN_LIST);
3297 Comment.createEndOfLineComment(EMPTY_TOKEN_LIST);
3298 node.metadata = [ 3291 node.metadata = [
3299 AstTestFactory.annotation(AstTestFactory.identifier3("a")) 3292 AstTestFactory.annotation(AstTestFactory.identifier3("a"))
3300 ]; 3293 ];
3301 _assertReplace( 3294 _assertReplace(
3302 node, new Getter_NodeReplacerTest_test_fieldFormalParameter_2()); 3295 node, new Getter_NodeReplacerTest_test_fieldFormalParameter_2());
3303 _assertReplace( 3296 _assertReplace(
3304 node, new Getter_NodeReplacerTest_test_fieldFormalParameter()); 3297 node, new Getter_NodeReplacerTest_test_fieldFormalParameter());
3305 _testNormalFormalParameter(node); 3298 _testNormalFormalParameter(node);
3306 } 3299 }
3307 3300
(...skipping 65 matching lines...) Expand 10 before | Expand all | Expand 10 after
3373 new ListGetter_NodeReplacerTest_test_forStatement_withVariables(0)); 3366 new ListGetter_NodeReplacerTest_test_forStatement_withVariables(0));
3374 } 3367 }
3375 3368
3376 void test_functionDeclaration() { 3369 void test_functionDeclaration() {
3377 FunctionDeclaration node = AstTestFactory.functionDeclaration( 3370 FunctionDeclaration node = AstTestFactory.functionDeclaration(
3378 AstTestFactory.typeName4("R"), 3371 AstTestFactory.typeName4("R"),
3379 null, 3372 null,
3380 "f", 3373 "f",
3381 AstTestFactory.functionExpression2(AstTestFactory.formalParameterList(), 3374 AstTestFactory.functionExpression2(AstTestFactory.formalParameterList(),
3382 AstTestFactory.blockFunctionBody(AstTestFactory.block()))); 3375 AstTestFactory.blockFunctionBody(AstTestFactory.block())));
3383 node.documentationComment = 3376 node.documentationComment = astFactory.endOfLineComment(EMPTY_TOKEN_LIST);
3384 Comment.createEndOfLineComment(EMPTY_TOKEN_LIST);
3385 node.metadata 3377 node.metadata
3386 .add(AstTestFactory.annotation(AstTestFactory.identifier3("a"))); 3378 .add(AstTestFactory.annotation(AstTestFactory.identifier3("a")));
3387 _assertReplace( 3379 _assertReplace(
3388 node, new Getter_NodeReplacerTest_test_functionDeclaration()); 3380 node, new Getter_NodeReplacerTest_test_functionDeclaration());
3389 _assertReplace( 3381 _assertReplace(
3390 node, new Getter_NodeReplacerTest_test_functionDeclaration_3()); 3382 node, new Getter_NodeReplacerTest_test_functionDeclaration_3());
3391 _assertReplace( 3383 _assertReplace(
3392 node, new Getter_NodeReplacerTest_test_functionDeclaration_2()); 3384 node, new Getter_NodeReplacerTest_test_functionDeclaration_2());
3393 _testAnnotatedNode(node); 3385 _testAnnotatedNode(node);
3394 } 3386 }
(...skipping 29 matching lines...) Expand all
3424 _assertReplace(node, 3416 _assertReplace(node,
3425 new Getter_NodeReplacerTest_test_functionExpressionInvocation_2()); 3417 new Getter_NodeReplacerTest_test_functionExpressionInvocation_2());
3426 } 3418 }
3427 3419
3428 void test_functionTypeAlias() { 3420 void test_functionTypeAlias() {
3429 FunctionTypeAlias node = AstTestFactory.typeAlias( 3421 FunctionTypeAlias node = AstTestFactory.typeAlias(
3430 AstTestFactory.typeName4("R"), 3422 AstTestFactory.typeName4("R"),
3431 "F", 3423 "F",
3432 AstTestFactory.typeParameterList(["E"]), 3424 AstTestFactory.typeParameterList(["E"]),
3433 AstTestFactory.formalParameterList()); 3425 AstTestFactory.formalParameterList());
3434 node.documentationComment = 3426 node.documentationComment = astFactory.endOfLineComment(EMPTY_TOKEN_LIST);
3435 Comment.createEndOfLineComment(EMPTY_TOKEN_LIST);
3436 node.metadata 3427 node.metadata
3437 .add(AstTestFactory.annotation(AstTestFactory.identifier3("a"))); 3428 .add(AstTestFactory.annotation(AstTestFactory.identifier3("a")));
3438 _assertReplace( 3429 _assertReplace(
3439 node, new Getter_NodeReplacerTest_test_functionTypeAlias_3()); 3430 node, new Getter_NodeReplacerTest_test_functionTypeAlias_3());
3440 _assertReplace( 3431 _assertReplace(
3441 node, new Getter_NodeReplacerTest_test_functionTypeAlias_4()); 3432 node, new Getter_NodeReplacerTest_test_functionTypeAlias_4());
3442 _assertReplace(node, new Getter_NodeReplacerTest_test_functionTypeAlias()); 3433 _assertReplace(node, new Getter_NodeReplacerTest_test_functionTypeAlias());
3443 _assertReplace( 3434 _assertReplace(
3444 node, new Getter_NodeReplacerTest_test_functionTypeAlias_2()); 3435 node, new Getter_NodeReplacerTest_test_functionTypeAlias_2());
3445 _testAnnotatedNode(node); 3436 _testAnnotatedNode(node);
3446 } 3437 }
3447 3438
3448 void test_functionTypedFormalParameter() { 3439 void test_functionTypedFormalParameter() {
3449 FunctionTypedFormalParameter node = AstTestFactory 3440 FunctionTypedFormalParameter node = AstTestFactory
3450 .functionTypedFormalParameter(AstTestFactory.typeName4("R"), "f", 3441 .functionTypedFormalParameter(AstTestFactory.typeName4("R"), "f",
3451 [AstTestFactory.simpleFormalParameter3("p")]); 3442 [AstTestFactory.simpleFormalParameter3("p")]);
3452 node.documentationComment = 3443 node.documentationComment = astFactory.endOfLineComment(EMPTY_TOKEN_LIST);
3453 Comment.createEndOfLineComment(EMPTY_TOKEN_LIST);
3454 node.metadata = [ 3444 node.metadata = [
3455 AstTestFactory.annotation(AstTestFactory.identifier3("a")) 3445 AstTestFactory.annotation(AstTestFactory.identifier3("a"))
3456 ]; 3446 ];
3457 _assertReplace( 3447 _assertReplace(
3458 node, new Getter_NodeReplacerTest_test_functionTypedFormalParameter()); 3448 node, new Getter_NodeReplacerTest_test_functionTypedFormalParameter());
3459 _assertReplace(node, 3449 _assertReplace(node,
3460 new Getter_NodeReplacerTest_test_functionTypedFormalParameter_2()); 3450 new Getter_NodeReplacerTest_test_functionTypedFormalParameter_2());
3461 _testNormalFormalParameter(node); 3451 _testNormalFormalParameter(node);
3462 } 3452 }
3463 3453
(...skipping 18 matching lines...) Expand all
3482 [AstTestFactory.typeName4("I"), AstTestFactory.typeName4("J")]); 3472 [AstTestFactory.typeName4("I"), AstTestFactory.typeName4("J")]);
3483 _assertReplace( 3473 _assertReplace(
3484 node, new ListGetter_NodeReplacerTest_test_implementsClause(0)); 3474 node, new ListGetter_NodeReplacerTest_test_implementsClause(0));
3485 } 3475 }
3486 3476
3487 void test_importDirective() { 3477 void test_importDirective() {
3488 ImportDirective node = AstTestFactory.importDirective3("", "p", [ 3478 ImportDirective node = AstTestFactory.importDirective3("", "p", [
3489 AstTestFactory.showCombinator2(["A"]), 3479 AstTestFactory.showCombinator2(["A"]),
3490 AstTestFactory.hideCombinator2(["B"]) 3480 AstTestFactory.hideCombinator2(["B"])
3491 ]); 3481 ]);
3492 node.documentationComment = 3482 node.documentationComment = astFactory.endOfLineComment(EMPTY_TOKEN_LIST);
3493 Comment.createEndOfLineComment(EMPTY_TOKEN_LIST);
3494 node.metadata 3483 node.metadata
3495 .add(AstTestFactory.annotation(AstTestFactory.identifier3("a"))); 3484 .add(AstTestFactory.annotation(AstTestFactory.identifier3("a")));
3496 _assertReplace(node, new Getter_NodeReplacerTest_test_importDirective()); 3485 _assertReplace(node, new Getter_NodeReplacerTest_test_importDirective());
3497 _testNamespaceDirective(node); 3486 _testNamespaceDirective(node);
3498 } 3487 }
3499 3488
3500 void test_indexExpression() { 3489 void test_indexExpression() {
3501 IndexExpression node = AstTestFactory.indexExpression( 3490 IndexExpression node = AstTestFactory.indexExpression(
3502 AstTestFactory.identifier3("a"), AstTestFactory.identifier3("i")); 3491 AstTestFactory.identifier3("a"), AstTestFactory.identifier3("i"));
3503 _assertReplace(node, new Getter_NodeReplacerTest_test_indexExpression()); 3492 _assertReplace(node, new Getter_NodeReplacerTest_test_indexExpression());
(...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after
3535 void test_labeledStatement() { 3524 void test_labeledStatement() {
3536 LabeledStatement node = AstTestFactory 3525 LabeledStatement node = AstTestFactory
3537 .labeledStatement([AstTestFactory.label2("l")], AstTestFactory.block()); 3526 .labeledStatement([AstTestFactory.label2("l")], AstTestFactory.block());
3538 _assertReplace( 3527 _assertReplace(
3539 node, new ListGetter_NodeReplacerTest_test_labeledStatement(0)); 3528 node, new ListGetter_NodeReplacerTest_test_labeledStatement(0));
3540 _assertReplace(node, new Getter_NodeReplacerTest_test_labeledStatement()); 3529 _assertReplace(node, new Getter_NodeReplacerTest_test_labeledStatement());
3541 } 3530 }
3542 3531
3543 void test_libraryDirective() { 3532 void test_libraryDirective() {
3544 LibraryDirective node = AstTestFactory.libraryDirective2("lib"); 3533 LibraryDirective node = AstTestFactory.libraryDirective2("lib");
3545 node.documentationComment = 3534 node.documentationComment = astFactory.endOfLineComment(EMPTY_TOKEN_LIST);
3546 Comment.createEndOfLineComment(EMPTY_TOKEN_LIST);
3547 node.metadata 3535 node.metadata
3548 .add(AstTestFactory.annotation(AstTestFactory.identifier3("a"))); 3536 .add(AstTestFactory.annotation(AstTestFactory.identifier3("a")));
3549 _assertReplace(node, new Getter_NodeReplacerTest_test_libraryDirective()); 3537 _assertReplace(node, new Getter_NodeReplacerTest_test_libraryDirective());
3550 _testAnnotatedNode(node); 3538 _testAnnotatedNode(node);
3551 } 3539 }
3552 3540
3553 void test_libraryIdentifier() { 3541 void test_libraryIdentifier() {
3554 LibraryIdentifier node = AstTestFactory.libraryIdentifier2(["lib"]); 3542 LibraryIdentifier node = AstTestFactory.libraryIdentifier2(["lib"]);
3555 _assertReplace( 3543 _assertReplace(
3556 node, new ListGetter_NodeReplacerTest_test_libraryIdentifier(0)); 3544 node, new ListGetter_NodeReplacerTest_test_libraryIdentifier(0));
(...skipping 26 matching lines...) Expand all
3583 3571
3584 void test_methodDeclaration() { 3572 void test_methodDeclaration() {
3585 MethodDeclaration node = AstTestFactory.methodDeclaration2( 3573 MethodDeclaration node = AstTestFactory.methodDeclaration2(
3586 null, 3574 null,
3587 AstTestFactory.typeName4("A"), 3575 AstTestFactory.typeName4("A"),
3588 null, 3576 null,
3589 null, 3577 null,
3590 AstTestFactory.identifier3("m"), 3578 AstTestFactory.identifier3("m"),
3591 AstTestFactory.formalParameterList(), 3579 AstTestFactory.formalParameterList(),
3592 AstTestFactory.blockFunctionBody(AstTestFactory.block())); 3580 AstTestFactory.blockFunctionBody(AstTestFactory.block()));
3593 node.documentationComment = 3581 node.documentationComment = astFactory.endOfLineComment(EMPTY_TOKEN_LIST);
3594 Comment.createEndOfLineComment(EMPTY_TOKEN_LIST);
3595 node.metadata 3582 node.metadata
3596 .add(AstTestFactory.annotation(AstTestFactory.identifier3("a"))); 3583 .add(AstTestFactory.annotation(AstTestFactory.identifier3("a")));
3597 _assertReplace(node, new Getter_NodeReplacerTest_test_methodDeclaration()); 3584 _assertReplace(node, new Getter_NodeReplacerTest_test_methodDeclaration());
3598 _assertReplace( 3585 _assertReplace(
3599 node, new Getter_NodeReplacerTest_test_methodDeclaration_3()); 3586 node, new Getter_NodeReplacerTest_test_methodDeclaration_3());
3600 _assertReplace( 3587 _assertReplace(
3601 node, new Getter_NodeReplacerTest_test_methodDeclaration_4()); 3588 node, new Getter_NodeReplacerTest_test_methodDeclaration_4());
3602 _assertReplace( 3589 _assertReplace(
3603 node, new Getter_NodeReplacerTest_test_methodDeclaration_2()); 3590 node, new Getter_NodeReplacerTest_test_methodDeclaration_2());
3604 _testAnnotatedNode(node); 3591 _testAnnotatedNode(node);
(...skipping 26 matching lines...) Expand all
3631 3618
3632 void test_parenthesizedExpression() { 3619 void test_parenthesizedExpression() {
3633 ParenthesizedExpression node = 3620 ParenthesizedExpression node =
3634 AstTestFactory.parenthesizedExpression(AstTestFactory.integer(0)); 3621 AstTestFactory.parenthesizedExpression(AstTestFactory.integer(0));
3635 _assertReplace( 3622 _assertReplace(
3636 node, new Getter_NodeReplacerTest_test_parenthesizedExpression()); 3623 node, new Getter_NodeReplacerTest_test_parenthesizedExpression());
3637 } 3624 }
3638 3625
3639 void test_partDirective() { 3626 void test_partDirective() {
3640 PartDirective node = AstTestFactory.partDirective2(""); 3627 PartDirective node = AstTestFactory.partDirective2("");
3641 node.documentationComment = 3628 node.documentationComment = astFactory.endOfLineComment(EMPTY_TOKEN_LIST);
3642 Comment.createEndOfLineComment(EMPTY_TOKEN_LIST);
3643 node.metadata 3629 node.metadata
3644 .add(AstTestFactory.annotation(AstTestFactory.identifier3("a"))); 3630 .add(AstTestFactory.annotation(AstTestFactory.identifier3("a")));
3645 _testUriBasedDirective(node); 3631 _testUriBasedDirective(node);
3646 } 3632 }
3647 3633
3648 void test_partOfDirective() { 3634 void test_partOfDirective() {
3649 PartOfDirective node = AstTestFactory 3635 PartOfDirective node = AstTestFactory
3650 .partOfDirective(AstTestFactory.libraryIdentifier2(["lib"])); 3636 .partOfDirective(AstTestFactory.libraryIdentifier2(["lib"]));
3651 node.documentationComment = 3637 node.documentationComment = astFactory.endOfLineComment(EMPTY_TOKEN_LIST);
3652 Comment.createEndOfLineComment(EMPTY_TOKEN_LIST);
3653 node.metadata 3638 node.metadata
3654 .add(AstTestFactory.annotation(AstTestFactory.identifier3("a"))); 3639 .add(AstTestFactory.annotation(AstTestFactory.identifier3("a")));
3655 _assertReplace(node, new Getter_NodeReplacerTest_test_partOfDirective()); 3640 _assertReplace(node, new Getter_NodeReplacerTest_test_partOfDirective());
3656 _testAnnotatedNode(node); 3641 _testAnnotatedNode(node);
3657 } 3642 }
3658 3643
3659 void test_postfixExpression() { 3644 void test_postfixExpression() {
3660 PostfixExpression node = AstTestFactory.postfixExpression( 3645 PostfixExpression node = AstTestFactory.postfixExpression(
3661 AstTestFactory.identifier3("x"), TokenType.MINUS_MINUS); 3646 AstTestFactory.identifier3("x"), TokenType.MINUS_MINUS);
3662 _assertReplace(node, new Getter_NodeReplacerTest_test_postfixExpression()); 3647 _assertReplace(node, new Getter_NodeReplacerTest_test_postfixExpression());
(...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after
3699 3684
3700 void test_showCombinator() { 3685 void test_showCombinator() {
3701 ShowCombinator node = AstTestFactory.showCombinator2(["X", "Y"]); 3686 ShowCombinator node = AstTestFactory.showCombinator2(["X", "Y"]);
3702 _assertReplace( 3687 _assertReplace(
3703 node, new ListGetter_NodeReplacerTest_test_showCombinator(0)); 3688 node, new ListGetter_NodeReplacerTest_test_showCombinator(0));
3704 } 3689 }
3705 3690
3706 void test_simpleFormalParameter() { 3691 void test_simpleFormalParameter() {
3707 SimpleFormalParameter node = AstTestFactory.simpleFormalParameter4( 3692 SimpleFormalParameter node = AstTestFactory.simpleFormalParameter4(
3708 AstTestFactory.typeName4("T"), "p"); 3693 AstTestFactory.typeName4("T"), "p");
3709 node.documentationComment = 3694 node.documentationComment = astFactory.endOfLineComment(EMPTY_TOKEN_LIST);
3710 Comment.createEndOfLineComment(EMPTY_TOKEN_LIST);
3711 node.metadata = [ 3695 node.metadata = [
3712 AstTestFactory.annotation(AstTestFactory.identifier3("a")) 3696 AstTestFactory.annotation(AstTestFactory.identifier3("a"))
3713 ]; 3697 ];
3714 _assertReplace( 3698 _assertReplace(
3715 node, new Getter_NodeReplacerTest_test_simpleFormalParameter()); 3699 node, new Getter_NodeReplacerTest_test_simpleFormalParameter());
3716 _testNormalFormalParameter(node); 3700 _testNormalFormalParameter(node);
3717 } 3701 }
3718 3702
3719 void test_stringInterpolation() { 3703 void test_stringInterpolation() {
3720 StringInterpolation node = 3704 StringInterpolation node =
(...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after
3761 void test_throwExpression() { 3745 void test_throwExpression() {
3762 ThrowExpression node = 3746 ThrowExpression node =
3763 AstTestFactory.throwExpression2(AstTestFactory.identifier3("e")); 3747 AstTestFactory.throwExpression2(AstTestFactory.identifier3("e"));
3764 _assertReplace(node, new Getter_NodeReplacerTest_test_throwExpression()); 3748 _assertReplace(node, new Getter_NodeReplacerTest_test_throwExpression());
3765 } 3749 }
3766 3750
3767 void test_topLevelVariableDeclaration() { 3751 void test_topLevelVariableDeclaration() {
3768 TopLevelVariableDeclaration node = AstTestFactory 3752 TopLevelVariableDeclaration node = AstTestFactory
3769 .topLevelVariableDeclaration(null, AstTestFactory.typeName4("T"), 3753 .topLevelVariableDeclaration(null, AstTestFactory.typeName4("T"),
3770 [AstTestFactory.variableDeclaration("t")]); 3754 [AstTestFactory.variableDeclaration("t")]);
3771 node.documentationComment = 3755 node.documentationComment = astFactory.endOfLineComment(EMPTY_TOKEN_LIST);
3772 Comment.createEndOfLineComment(EMPTY_TOKEN_LIST);
3773 node.metadata 3756 node.metadata
3774 .add(AstTestFactory.annotation(AstTestFactory.identifier3("a"))); 3757 .add(AstTestFactory.annotation(AstTestFactory.identifier3("a")));
3775 _assertReplace( 3758 _assertReplace(
3776 node, new Getter_NodeReplacerTest_test_topLevelVariableDeclaration()); 3759 node, new Getter_NodeReplacerTest_test_topLevelVariableDeclaration());
3777 _testAnnotatedNode(node); 3760 _testAnnotatedNode(node);
3778 } 3761 }
3779 3762
3780 void test_tryStatement() { 3763 void test_tryStatement() {
3781 TryStatement node = AstTestFactory.tryStatement3( 3764 TryStatement node = AstTestFactory.tryStatement3(
3782 AstTestFactory.block(), 3765 AstTestFactory.block(),
(...skipping 29 matching lines...) Expand all
3812 3795
3813 void test_typeParameterList() { 3796 void test_typeParameterList() {
3814 TypeParameterList node = AstTestFactory.typeParameterList(["A", "B"]); 3797 TypeParameterList node = AstTestFactory.typeParameterList(["A", "B"]);
3815 _assertReplace( 3798 _assertReplace(
3816 node, new ListGetter_NodeReplacerTest_test_typeParameterList(0)); 3799 node, new ListGetter_NodeReplacerTest_test_typeParameterList(0));
3817 } 3800 }
3818 3801
3819 void test_variableDeclaration() { 3802 void test_variableDeclaration() {
3820 VariableDeclaration node = 3803 VariableDeclaration node =
3821 AstTestFactory.variableDeclaration2("a", AstTestFactory.nullLiteral()); 3804 AstTestFactory.variableDeclaration2("a", AstTestFactory.nullLiteral());
3822 node.documentationComment = 3805 node.documentationComment = astFactory.endOfLineComment(EMPTY_TOKEN_LIST);
3823 Comment.createEndOfLineComment(EMPTY_TOKEN_LIST);
3824 node.metadata 3806 node.metadata
3825 .add(AstTestFactory.annotation(AstTestFactory.identifier3("a"))); 3807 .add(AstTestFactory.annotation(AstTestFactory.identifier3("a")));
3826 _assertReplace( 3808 _assertReplace(
3827 node, new Getter_NodeReplacerTest_test_variableDeclaration()); 3809 node, new Getter_NodeReplacerTest_test_variableDeclaration());
3828 _assertReplace( 3810 _assertReplace(
3829 node, new Getter_NodeReplacerTest_test_variableDeclaration_2()); 3811 node, new Getter_NodeReplacerTest_test_variableDeclaration_2());
3830 _testAnnotatedNode(node); 3812 _testAnnotatedNode(node);
3831 } 3813 }
3832 3814
3833 void test_variableDeclarationList() { 3815 void test_variableDeclarationList() {
3834 VariableDeclarationList node = AstTestFactory.variableDeclarationList( 3816 VariableDeclarationList node = AstTestFactory.variableDeclarationList(
3835 null, 3817 null,
3836 AstTestFactory.typeName4("T"), 3818 AstTestFactory.typeName4("T"),
3837 [AstTestFactory.variableDeclaration("a")]); 3819 [AstTestFactory.variableDeclaration("a")]);
3838 node.documentationComment = 3820 node.documentationComment = astFactory.endOfLineComment(EMPTY_TOKEN_LIST);
3839 Comment.createEndOfLineComment(EMPTY_TOKEN_LIST);
3840 node.metadata 3821 node.metadata
3841 .add(AstTestFactory.annotation(AstTestFactory.identifier3("a"))); 3822 .add(AstTestFactory.annotation(AstTestFactory.identifier3("a")));
3842 _assertReplace( 3823 _assertReplace(
3843 node, new Getter_NodeReplacerTest_test_variableDeclarationList()); 3824 node, new Getter_NodeReplacerTest_test_variableDeclarationList());
3844 _assertReplace( 3825 _assertReplace(
3845 node, new ListGetter_NodeReplacerTest_test_variableDeclarationList(0)); 3826 node, new ListGetter_NodeReplacerTest_test_variableDeclarationList(0));
3846 _testAnnotatedNode(node); 3827 _testAnnotatedNode(node);
3847 } 3828 }
3848 3829
3849 void test_variableDeclarationStatement() { 3830 void test_variableDeclarationStatement() {
(...skipping 556 matching lines...) Expand 10 before | Expand all | Expand 10 after
4406 tokenMap.put(key, value); 4387 tokenMap.put(key, value);
4407 expect(tokenMap.get(key), same(value)); 4388 expect(tokenMap.get(key), same(value));
4408 } 4389 }
4409 } 4390 }
4410 4391
4411 class _ExceptionThrowingVisitor extends SimpleAstVisitor { 4392 class _ExceptionThrowingVisitor extends SimpleAstVisitor {
4412 visitNullLiteral(NullLiteral node) { 4393 visitNullLiteral(NullLiteral node) {
4413 throw new ArgumentError(''); 4394 throw new ArgumentError('');
4414 } 4395 }
4415 } 4396 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698