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

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

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

Powered by Google App Engine
This is Rietveld 408576698