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

Side by Side Diff: pkg/analyzer-experimental/test/generated/ast_test.dart

Issue 12671003: Push new analyzer-experimental with Resolver and ResolverTest. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 7 years, 9 months 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 | Annotate | Revision Log
OLDNEW
1 // This code was auto-generated, is not intended to be edited, and is subject to 1 // This code was auto-generated, is not intended to be edited, and is subject to
2 // significant change. Please see the README file for more information. 2 // significant change. Please see the README file for more information.
3 3
4 library engine.ast_test; 4 library engine.ast_test;
5 5
6 import 'dart:collection'; 6 import 'dart:collection';
7 import 'package:analyzer-experimental/src/generated/java_core.dart'; 7 import 'package:analyzer-experimental/src/generated/java_core.dart';
8 import 'package:analyzer-experimental/src/generated/java_engine.dart'; 8 import 'package:analyzer-experimental/src/generated/java_engine.dart';
9 import 'package:analyzer-experimental/src/generated/java_junit.dart'; 9 import 'package:analyzer-experimental/src/generated/java_junit.dart';
10 import 'package:analyzer-experimental/src/generated/source.dart'; 10 import 'package:analyzer-experimental/src/generated/source.dart';
(...skipping 200 matching lines...) Expand 10 before | Expand all | Expand 10 after
211 static CompilationUnit compilationUnit6(String scriptTag, List<CompilationUnit Member> declarations) => compilationUnit8(scriptTag, null, list(declarations)); 211 static CompilationUnit compilationUnit6(String scriptTag, List<CompilationUnit Member> declarations) => compilationUnit8(scriptTag, null, list(declarations));
212 static CompilationUnit compilationUnit7(String scriptTag, List<Directive> dire ctives) => compilationUnit8(scriptTag, list(directives), null); 212 static CompilationUnit compilationUnit7(String scriptTag, List<Directive> dire ctives) => compilationUnit8(scriptTag, list(directives), null);
213 static CompilationUnit compilationUnit8(String scriptTag4, List<Directive> dir ectives, List<CompilationUnitMember> declarations) => new CompilationUnit.full(T okenFactory.token3(TokenType.EOF), scriptTag4 == null ? null : scriptTag(scriptT ag4), directives == null ? new List<Directive>() : directives, declarations == n ull ? new List<CompilationUnitMember>() : declarations, TokenFactory.token3(Toke nType.EOF)); 213 static CompilationUnit compilationUnit8(String scriptTag4, List<Directive> dir ectives, List<CompilationUnitMember> declarations) => new CompilationUnit.full(T okenFactory.token3(TokenType.EOF), scriptTag4 == null ? null : scriptTag(scriptT ag4), directives == null ? new List<Directive>() : directives, declarations == n ull ? new List<CompilationUnitMember>() : declarations, TokenFactory.token3(Toke nType.EOF));
214 static ConditionalExpression conditionalExpression(Expression condition, Expre ssion thenExpression, Expression elseExpression) => new ConditionalExpression.fu ll(condition, TokenFactory.token3(TokenType.QUESTION), thenExpression, TokenFact ory.token3(TokenType.COLON), elseExpression); 214 static ConditionalExpression conditionalExpression(Expression condition, Expre ssion thenExpression, Expression elseExpression) => new ConditionalExpression.fu ll(condition, TokenFactory.token3(TokenType.QUESTION), thenExpression, TokenFact ory.token3(TokenType.COLON), elseExpression);
215 static ConstructorDeclaration constructorDeclaration(Identifier returnType, St ring name, FormalParameterList parameters, List<ConstructorInitializer> initiali zers) => new ConstructorDeclaration.full(null, null, TokenFactory.token(Keyword. EXTERNAL), null, null, returnType, name == null ? null : TokenFactory.token3(Tok enType.PERIOD), name == null ? null : identifier2(name), parameters, initializer s == null || initializers.isEmpty ? null : TokenFactory.token3(TokenType.PERIOD) , initializers == null ? new List<ConstructorInitializer>() : initializers, null , emptyFunctionBody()); 215 static ConstructorDeclaration constructorDeclaration(Identifier returnType, St ring name, FormalParameterList parameters, List<ConstructorInitializer> initiali zers) => new ConstructorDeclaration.full(null, null, TokenFactory.token(Keyword. EXTERNAL), null, null, returnType, name == null ? null : TokenFactory.token3(Tok enType.PERIOD), name == null ? null : identifier2(name), parameters, initializer s == null || initializers.isEmpty ? null : TokenFactory.token3(TokenType.PERIOD) , initializers == null ? new List<ConstructorInitializer>() : initializers, null , emptyFunctionBody());
216 static ConstructorDeclaration constructorDeclaration2(Keyword constKeyword, Ke yword factoryKeyword, Identifier returnType, String name, FormalParameterList pa rameters, List<ConstructorInitializer> initializers, FunctionBody body) => new C onstructorDeclaration.full(null, null, null, constKeyword == null ? null : Token Factory.token(constKeyword), factoryKeyword == null ? null : TokenFactory.token( factoryKeyword), returnType, name == null ? null : TokenFactory.token3(TokenType .PERIOD), name == null ? null : identifier2(name), parameters, initializers == n ull || initializers.isEmpty ? null : TokenFactory.token3(TokenType.PERIOD), init ializers == null ? new List<ConstructorInitializer>() : initializers, null, body ); 216 static ConstructorDeclaration constructorDeclaration2(Keyword constKeyword, Ke yword factoryKeyword, Identifier returnType, String name, FormalParameterList pa rameters, List<ConstructorInitializer> initializers, FunctionBody body) => new C onstructorDeclaration.full(null, null, null, constKeyword == null ? null : Token Factory.token(constKeyword), factoryKeyword == null ? null : TokenFactory.token( factoryKeyword), returnType, name == null ? null : TokenFactory.token3(TokenType .PERIOD), name == null ? null : identifier2(name), parameters, initializers == n ull || initializers.isEmpty ? null : TokenFactory.token3(TokenType.PERIOD), init ializers == null ? new List<ConstructorInitializer>() : initializers, null, body );
217 static ConstructorFieldInitializer constructorFieldInitializer(bool prefixedWi thThis, String fieldName, Expression expression) => new ConstructorFieldInitiali zer.full(prefixedWithThis ? TokenFactory.token(Keyword.THIS) : null, prefixedWit hThis ? TokenFactory.token3(TokenType.PERIOD) : null, identifier2(fieldName), To kenFactory.token3(TokenType.EQ), expression); 217 static ConstructorFieldInitializer constructorFieldInitializer(bool prefixedWi thThis, String fieldName, Expression expression) => new ConstructorFieldInitiali zer.full(prefixedWithThis ? TokenFactory.token(Keyword.THIS) : null, prefixedWit hThis ? TokenFactory.token3(TokenType.PERIOD) : null, identifier2(fieldName), To kenFactory.token3(TokenType.EQ), expression);
218 static ConstructorName constructorName(TypeName type, String name) => new Cons tructorName.full(type, name == null ? null : TokenFactory.token3(TokenType.PERIO D), name == null ? null : identifier2(name)); 218 static ConstructorName constructorName(TypeName type, String name) => new Cons tructorName.full(type, name == null ? null : TokenFactory.token3(TokenType.PERIO D), name == null ? null : identifier2(name));
219 static ContinueStatement continueStatement() => new ContinueStatement.full(Tok enFactory.token(Keyword.CONTINUE), null, TokenFactory.token3(TokenType.SEMICOLON )); 219 static ContinueStatement continueStatement() => new ContinueStatement.full(Tok enFactory.token(Keyword.CONTINUE), null, TokenFactory.token3(TokenType.SEMICOLON ));
220 static ContinueStatement continueStatement2(String label) => new ContinueState ment.full(TokenFactory.token(Keyword.CONTINUE), identifier2(label), TokenFactory .token3(TokenType.SEMICOLON)); 220 static ContinueStatement continueStatement2(String label) => new ContinueState ment.full(TokenFactory.token(Keyword.CONTINUE), identifier2(label), TokenFactory .token3(TokenType.SEMICOLON));
221 static DeclaredIdentifier declaredIdentifier(Keyword keyword, String identifie r) => declaredIdentifier2(keyword, null, identifier);
222 static DeclaredIdentifier declaredIdentifier2(Keyword keyword, TypeName type, String identifier) => new DeclaredIdentifier.full(null, null, keyword == null ? null : TokenFactory.token(keyword), type, identifier2(identifier));
223 static DeclaredIdentifier declaredIdentifier3(String identifier) => declaredId entifier2(null, null, identifier);
224 static DeclaredIdentifier declaredIdentifier4(TypeName type, String identifier ) => declaredIdentifier2(null, type, identifier);
221 static DoStatement doStatement(Statement body, Expression condition) => new Do Statement.full(TokenFactory.token(Keyword.DO), body, TokenFactory.token(Keyword. WHILE), TokenFactory.token3(TokenType.OPEN_PAREN), condition, TokenFactory.token 3(TokenType.CLOSE_PAREN), TokenFactory.token3(TokenType.SEMICOLON)); 225 static DoStatement doStatement(Statement body, Expression condition) => new Do Statement.full(TokenFactory.token(Keyword.DO), body, TokenFactory.token(Keyword. WHILE), TokenFactory.token3(TokenType.OPEN_PAREN), condition, TokenFactory.token 3(TokenType.CLOSE_PAREN), TokenFactory.token3(TokenType.SEMICOLON));
222 static DoubleLiteral doubleLiteral(double value) => new DoubleLiteral.full(Tok enFactory.token2(value.toString()), value); 226 static DoubleLiteral doubleLiteral(double value) => new DoubleLiteral.full(Tok enFactory.token2(value.toString()), value);
223 static EmptyFunctionBody emptyFunctionBody() => new EmptyFunctionBody.full(Tok enFactory.token3(TokenType.SEMICOLON)); 227 static EmptyFunctionBody emptyFunctionBody() => new EmptyFunctionBody.full(Tok enFactory.token3(TokenType.SEMICOLON));
224 static EmptyStatement emptyStatement() => new EmptyStatement.full(TokenFactory .token3(TokenType.SEMICOLON)); 228 static EmptyStatement emptyStatement() => new EmptyStatement.full(TokenFactory .token3(TokenType.SEMICOLON));
225 static ExportDirective exportDirective(List<Annotation> metadata, String uri, List<Combinator> combinators) => new ExportDirective.full(null, metadata, TokenF actory.token(Keyword.EXPORT), string2(uri), list(combinators), TokenFactory.toke n3(TokenType.SEMICOLON)); 229 static ExportDirective exportDirective(List<Annotation> metadata, String uri, List<Combinator> combinators) => new ExportDirective.full(null, metadata, TokenF actory.token(Keyword.EXPORT), string2(uri), list(combinators), TokenFactory.toke n3(TokenType.SEMICOLON));
226 static ExportDirective exportDirective2(String uri, List<Combinator> combinato rs) => exportDirective(new List<Annotation>(), uri, combinators); 230 static ExportDirective exportDirective2(String uri, List<Combinator> combinato rs) => exportDirective(new List<Annotation>(), uri, combinators);
227 static ExpressionFunctionBody expressionFunctionBody(Expression expression) => new ExpressionFunctionBody.full(TokenFactory.token3(TokenType.FUNCTION), expres sion, TokenFactory.token3(TokenType.SEMICOLON)); 231 static ExpressionFunctionBody expressionFunctionBody(Expression expression) => new ExpressionFunctionBody.full(TokenFactory.token3(TokenType.FUNCTION), expres sion, TokenFactory.token3(TokenType.SEMICOLON));
228 static ExpressionStatement expressionStatement(Expression expression) => new E xpressionStatement.full(expression, TokenFactory.token3(TokenType.SEMICOLON)); 232 static ExpressionStatement expressionStatement(Expression expression) => new E xpressionStatement.full(expression, TokenFactory.token3(TokenType.SEMICOLON));
229 static ExtendsClause extendsClause(TypeName type) => new ExtendsClause.full(To kenFactory.token(Keyword.EXTENDS), type); 233 static ExtendsClause extendsClause(TypeName type) => new ExtendsClause.full(To kenFactory.token(Keyword.EXTENDS), type);
230 static FieldDeclaration fieldDeclaration(bool isStatic, Keyword keyword, TypeN ame type, List<VariableDeclaration> variables) => new FieldDeclaration.full(null , null, isStatic ? TokenFactory.token(Keyword.STATIC) : null, variableDeclaratio nList(keyword, type, variables), TokenFactory.token3(TokenType.SEMICOLON)); 234 static FieldDeclaration fieldDeclaration(bool isStatic, Keyword keyword, TypeN ame type, List<VariableDeclaration> variables) => new FieldDeclaration.full(null , null, isStatic ? TokenFactory.token(Keyword.STATIC) : null, variableDeclaratio nList(keyword, type, variables), TokenFactory.token3(TokenType.SEMICOLON));
231 static FieldDeclaration fieldDeclaration2(bool isStatic, Keyword keyword, List <VariableDeclaration> variables) => fieldDeclaration(isStatic, keyword, null, va riables); 235 static FieldDeclaration fieldDeclaration2(bool isStatic, Keyword keyword, List <VariableDeclaration> variables) => fieldDeclaration(isStatic, keyword, null, va riables);
232 static FieldFormalParameter fieldFormalParameter(Keyword keyword, TypeName typ e, String identifier) => new FieldFormalParameter.full(null, null, keyword == nu ll ? null : TokenFactory.token(keyword), type, TokenFactory.token(Keyword.THIS), TokenFactory.token3(TokenType.PERIOD), identifier2(identifier)); 236 static FieldFormalParameter fieldFormalParameter(Keyword keyword, TypeName typ e, String identifier) => new FieldFormalParameter.full(null, null, keyword == nu ll ? null : TokenFactory.token(keyword), type, TokenFactory.token(Keyword.THIS), TokenFactory.token3(TokenType.PERIOD), identifier2(identifier));
233 static ForEachStatement forEachStatement(SimpleFormalParameter loopParameter, Expression iterator, Statement body) => new ForEachStatement.full(TokenFactory.t oken(Keyword.FOR), TokenFactory.token3(TokenType.OPEN_PAREN), loopParameter, Tok enFactory.token(Keyword.IN), iterator, TokenFactory.token3(TokenType.CLOSE_PAREN ), body); 237 static ForEachStatement forEachStatement(DeclaredIdentifier loopVariable, Expr ession iterator, Statement body) => new ForEachStatement.full(TokenFactory.token (Keyword.FOR), TokenFactory.token3(TokenType.OPEN_PAREN), loopVariable, TokenFac tory.token(Keyword.IN), iterator, TokenFactory.token3(TokenType.CLOSE_PAREN), bo dy);
234 static FormalParameterList formalParameterList(List<FormalParameter> parameter s) => new FormalParameterList.full(TokenFactory.token3(TokenType.OPEN_PAREN), li st(parameters), null, null, TokenFactory.token3(TokenType.CLOSE_PAREN)); 238 static FormalParameterList formalParameterList(List<FormalParameter> parameter s) => new FormalParameterList.full(TokenFactory.token3(TokenType.OPEN_PAREN), li st(parameters), null, null, TokenFactory.token3(TokenType.CLOSE_PAREN));
235 static ForStatement forStatement(Expression initialization, Expression conditi on, List<Expression> updaters, Statement body) => new ForStatement.full(TokenFac tory.token(Keyword.FOR), TokenFactory.token3(TokenType.OPEN_PAREN), null, initia lization, TokenFactory.token3(TokenType.SEMICOLON), condition, TokenFactory.toke n3(TokenType.SEMICOLON), updaters, TokenFactory.token3(TokenType.CLOSE_PAREN), b ody); 239 static ForStatement forStatement(Expression initialization, Expression conditi on, List<Expression> updaters, Statement body) => new ForStatement.full(TokenFac tory.token(Keyword.FOR), TokenFactory.token3(TokenType.OPEN_PAREN), null, initia lization, TokenFactory.token3(TokenType.SEMICOLON), condition, TokenFactory.toke n3(TokenType.SEMICOLON), updaters, TokenFactory.token3(TokenType.CLOSE_PAREN), b ody);
236 static ForStatement forStatement2(VariableDeclarationList variableList, Expres sion condition, List<Expression> updaters, Statement body) => new ForStatement.f ull(TokenFactory.token(Keyword.FOR), TokenFactory.token3(TokenType.OPEN_PAREN), variableList, null, TokenFactory.token3(TokenType.SEMICOLON), condition, TokenFa ctory.token3(TokenType.SEMICOLON), updaters, TokenFactory.token3(TokenType.CLOSE _PAREN), body); 240 static ForStatement forStatement2(VariableDeclarationList variableList, Expres sion condition, List<Expression> updaters, Statement body) => new ForStatement.f ull(TokenFactory.token(Keyword.FOR), TokenFactory.token3(TokenType.OPEN_PAREN), variableList, null, TokenFactory.token3(TokenType.SEMICOLON), condition, TokenFa ctory.token3(TokenType.SEMICOLON), updaters, TokenFactory.token3(TokenType.CLOSE _PAREN), body);
237 static FunctionDeclaration functionDeclaration(TypeName type, Keyword keyword, String name, FunctionExpression functionExpression) => new FunctionDeclaration. full(null, null, null, type, keyword == null ? null : TokenFactory.token(keyword ), identifier2(name), functionExpression); 241 static FunctionDeclaration functionDeclaration(TypeName type, Keyword keyword, String name, FunctionExpression functionExpression) => new FunctionDeclaration. full(null, null, null, type, keyword == null ? null : TokenFactory.token(keyword ), identifier2(name), functionExpression);
238 static FunctionDeclarationStatement functionDeclarationStatement(TypeName type , Keyword keyword, String name, FunctionExpression functionExpression) => new Fu nctionDeclarationStatement.full(functionDeclaration(type, keyword, name, functio nExpression)); 242 static FunctionDeclarationStatement functionDeclarationStatement(TypeName type , Keyword keyword, String name, FunctionExpression functionExpression) => new Fu nctionDeclarationStatement.full(functionDeclaration(type, keyword, name, functio nExpression));
239 static FunctionExpression functionExpression() => new FunctionExpression.full( formalParameterList([]), blockFunctionBody([])); 243 static FunctionExpression functionExpression() => new FunctionExpression.full( formalParameterList([]), blockFunctionBody([]));
240 static FunctionExpression functionExpression2(FormalParameterList parameters, FunctionBody body) => new FunctionExpression.full(parameters, body); 244 static FunctionExpression functionExpression2(FormalParameterList parameters, FunctionBody body) => new FunctionExpression.full(parameters, body);
241 static FunctionExpressionInvocation functionExpressionInvocation(Expression fu nction, List<Expression> arguments) => new FunctionExpressionInvocation.full(fun ction, argumentList(arguments)); 245 static FunctionExpressionInvocation functionExpressionInvocation(Expression fu nction, List<Expression> arguments) => new FunctionExpressionInvocation.full(fun ction, argumentList(arguments));
242 static FunctionTypedFormalParameter functionTypedFormalParameter(TypeName retu rnType, String identifier, List<FormalParameter> parameters) => new FunctionType dFormalParameter.full(null, null, returnType, identifier2(identifier), formalPar ameterList(parameters)); 246 static FunctionTypedFormalParameter functionTypedFormalParameter(TypeName retu rnType, String identifier, List<FormalParameter> parameters) => new FunctionType dFormalParameter.full(null, null, returnType, identifier2(identifier), formalPar ameterList(parameters));
243 static HideCombinator hideCombinator(List<SimpleIdentifier> identifiers) => ne w HideCombinator.full(TokenFactory.token2("hide"), list(identifiers)); 247 static HideCombinator hideCombinator(List<SimpleIdentifier> identifiers) => ne w HideCombinator.full(TokenFactory.token2("hide"), list(identifiers));
(...skipping 101 matching lines...) Expand 10 before | Expand all | Expand 10 after
345 static FunctionTypeAlias typeAlias(TypeName returnType, String name, TypeParam eterList typeParameters, FormalParameterList parameters) => new FunctionTypeAlia s.full(null, null, TokenFactory.token(Keyword.TYPEDEF), returnType, identifier2( name), typeParameters, parameters, TokenFactory.token3(TokenType.SEMICOLON)); 349 static FunctionTypeAlias typeAlias(TypeName returnType, String name, TypeParam eterList typeParameters, FormalParameterList parameters) => new FunctionTypeAlia s.full(null, null, TokenFactory.token(Keyword.TYPEDEF), returnType, identifier2( name), typeParameters, parameters, TokenFactory.token3(TokenType.SEMICOLON));
346 static TypeArgumentList typeArgumentList(List<TypeName> typeNames) => new Type ArgumentList.full(TokenFactory.token3(TokenType.LT), list(typeNames), TokenFacto ry.token3(TokenType.GT)); 350 static TypeArgumentList typeArgumentList(List<TypeName> typeNames) => new Type ArgumentList.full(TokenFactory.token3(TokenType.LT), list(typeNames), TokenFacto ry.token3(TokenType.GT));
347 /** 351 /**
348 * Create a type name whose name has been resolved to the given element and wh ose type has been 352 * Create a type name whose name has been resolved to the given element and wh ose type has been
349 * resolved to the type of the given element. 353 * resolved to the type of the given element.
350 * <p> 354 * <p>
351 * <b>Note:</b> This method does not correctly handle class elements that have type parameters. 355 * <b>Note:</b> This method does not correctly handle class elements that have type parameters.
352 * @param element the element defining the type represented by the type name 356 * @param element the element defining the type represented by the type name
353 * @return the type name that was created 357 * @return the type name that was created
354 */ 358 */
355 static TypeName typeName(ClassElement element50, List<TypeName> arguments) { 359 static TypeName typeName(ClassElement element52, List<TypeName> arguments) {
356 SimpleIdentifier name20 = identifier2(element50.name); 360 SimpleIdentifier name21 = identifier2(element52.name);
357 name20.element = element50; 361 name21.element = element52;
358 TypeName typeName = typeName2(name20, arguments); 362 TypeName typeName = typeName2(name21, arguments);
359 typeName.type = element50.type; 363 typeName.type = element52.type;
360 return typeName; 364 return typeName;
361 } 365 }
362 static TypeName typeName2(Identifier name, List<TypeName> arguments) { 366 static TypeName typeName2(Identifier name, List<TypeName> arguments) {
363 if (arguments.length == 0) { 367 if (arguments.length == 0) {
364 return new TypeName.full(name, null); 368 return new TypeName.full(name, null);
365 } 369 }
366 return new TypeName.full(name, typeArgumentList(arguments)); 370 return new TypeName.full(name, typeArgumentList(arguments));
367 } 371 }
368 static TypeName typeName3(String name, List<TypeName> arguments) { 372 static TypeName typeName3(String name, List<TypeName> arguments) {
369 if (arguments.length == 0) { 373 if (arguments.length == 0) {
(...skipping 19 matching lines...) Expand all
389 static WhileStatement whileStatement(Expression condition, Statement body) => new WhileStatement.full(TokenFactory.token(Keyword.WHILE), TokenFactory.token3(T okenType.OPEN_PAREN), condition, TokenFactory.token3(TokenType.CLOSE_PAREN), bod y); 393 static WhileStatement whileStatement(Expression condition, Statement body) => new WhileStatement.full(TokenFactory.token(Keyword.WHILE), TokenFactory.token3(T okenType.OPEN_PAREN), condition, TokenFactory.token3(TokenType.CLOSE_PAREN), bod y);
390 static WithClause withClause(List<TypeName> types) => new WithClause.full(Toke nFactory.token(Keyword.WITH), list(types)); 394 static WithClause withClause(List<TypeName> types) => new WithClause.full(Toke nFactory.token(Keyword.WITH), list(types));
391 /** 395 /**
392 * Prevent the creation of instances of this class. 396 * Prevent the creation of instances of this class.
393 */ 397 */
394 ASTFactory() { 398 ASTFactory() {
395 } 399 }
396 } 400 }
397 class SimpleIdentifierTest extends ParserTestCase { 401 class SimpleIdentifierTest extends ParserTestCase {
398 void test_inDeclarationContext_argumentDefinition() { 402 void test_inDeclarationContext_argumentDefinition() {
399 SimpleIdentifier identifier14 = ASTFactory.argumentDefinitionTest("p").ident ifier; 403 SimpleIdentifier identifier15 = ASTFactory.argumentDefinitionTest("p").ident ifier;
400 JUnitTestCase.assertFalse(identifier14.inDeclarationContext()); 404 JUnitTestCase.assertFalse(identifier15.inDeclarationContext());
401 } 405 }
402 void test_inDeclarationContext_catch_exception() { 406 void test_inDeclarationContext_catch_exception() {
403 SimpleIdentifier identifier = ASTFactory.catchClause("e", []).exceptionParam eter; 407 SimpleIdentifier identifier = ASTFactory.catchClause("e", []).exceptionParam eter;
404 JUnitTestCase.assertTrue(identifier.inDeclarationContext()); 408 JUnitTestCase.assertTrue(identifier.inDeclarationContext());
405 } 409 }
406 void test_inDeclarationContext_catch_stack() { 410 void test_inDeclarationContext_catch_stack() {
407 SimpleIdentifier identifier = ASTFactory.catchClause2("e", "s", []).stackTra ceParameter; 411 SimpleIdentifier identifier = ASTFactory.catchClause2("e", "s", []).stackTra ceParameter;
408 JUnitTestCase.assertTrue(identifier.inDeclarationContext()); 412 JUnitTestCase.assertTrue(identifier.inDeclarationContext());
409 } 413 }
410 void test_inDeclarationContext_classDeclaration() { 414 void test_inDeclarationContext_classDeclaration() {
(...skipping 25 matching lines...) Expand all
436 SimpleIdentifier identifier = label2.label; 440 SimpleIdentifier identifier = label2.label;
437 ASTFactory.labeledStatement(ASTFactory.list([label2]), ASTFactory.emptyState ment()); 441 ASTFactory.labeledStatement(ASTFactory.list([label2]), ASTFactory.emptyState ment());
438 JUnitTestCase.assertTrue(identifier.inDeclarationContext()); 442 JUnitTestCase.assertTrue(identifier.inDeclarationContext());
439 } 443 }
440 void test_inDeclarationContext_methodDeclaration() { 444 void test_inDeclarationContext_methodDeclaration() {
441 SimpleIdentifier identifier = ASTFactory.identifier2("m"); 445 SimpleIdentifier identifier = ASTFactory.identifier2("m");
442 ASTFactory.methodDeclaration2(null, null, null, null, identifier, null, null ); 446 ASTFactory.methodDeclaration2(null, null, null, null, identifier, null, null );
443 JUnitTestCase.assertTrue(identifier.inDeclarationContext()); 447 JUnitTestCase.assertTrue(identifier.inDeclarationContext());
444 } 448 }
445 void test_inDeclarationContext_normalFormalParameter() { 449 void test_inDeclarationContext_normalFormalParameter() {
446 SimpleIdentifier identifier15 = ASTFactory.simpleFormalParameter3("p").ident ifier; 450 SimpleIdentifier identifier16 = ASTFactory.simpleFormalParameter3("p").ident ifier;
447 JUnitTestCase.assertTrue(identifier15.inDeclarationContext()); 451 JUnitTestCase.assertTrue(identifier16.inDeclarationContext());
448 } 452 }
449 void test_inDeclarationContext_typeParameter_bound() { 453 void test_inDeclarationContext_typeParameter_bound() {
450 TypeName bound = ASTFactory.typeName3("A", []); 454 TypeName bound = ASTFactory.typeName3("A", []);
451 SimpleIdentifier identifier = bound.name as SimpleIdentifier; 455 SimpleIdentifier identifier = bound.name as SimpleIdentifier;
452 ASTFactory.typeParameter2("E", bound); 456 ASTFactory.typeParameter2("E", bound);
453 JUnitTestCase.assertFalse(identifier.inDeclarationContext()); 457 JUnitTestCase.assertFalse(identifier.inDeclarationContext());
454 } 458 }
455 void test_inDeclarationContext_typeParameter_name() { 459 void test_inDeclarationContext_typeParameter_name() {
456 SimpleIdentifier identifier = ASTFactory.typeParameter("E").name; 460 SimpleIdentifier identifier = ASTFactory.typeParameter("E").name;
457 JUnitTestCase.assertTrue(identifier.inDeclarationContext()); 461 JUnitTestCase.assertTrue(identifier.inDeclarationContext());
(...skipping 167 matching lines...) Expand 10 before | Expand all | Expand 10 after
625 static final AssignmentKind POSTFIX_INC = new AssignmentKind('POSTFIX_INC', 3) ; 629 static final AssignmentKind POSTFIX_INC = new AssignmentKind('POSTFIX_INC', 3) ;
626 static final AssignmentKind PREFIX_DEC = new AssignmentKind('PREFIX_DEC', 4); 630 static final AssignmentKind PREFIX_DEC = new AssignmentKind('PREFIX_DEC', 4);
627 static final AssignmentKind PREFIX_INC = new AssignmentKind('PREFIX_INC', 5); 631 static final AssignmentKind PREFIX_INC = new AssignmentKind('PREFIX_INC', 5);
628 static final AssignmentKind PREFIX_NOT = new AssignmentKind('PREFIX_NOT', 6); 632 static final AssignmentKind PREFIX_NOT = new AssignmentKind('PREFIX_NOT', 6);
629 static final AssignmentKind SIMPLE_LEFT = new AssignmentKind('SIMPLE_LEFT', 7) ; 633 static final AssignmentKind SIMPLE_LEFT = new AssignmentKind('SIMPLE_LEFT', 7) ;
630 static final AssignmentKind SIMPLE_RIGHT = new AssignmentKind('SIMPLE_RIGHT', 8); 634 static final AssignmentKind SIMPLE_RIGHT = new AssignmentKind('SIMPLE_RIGHT', 8);
631 static final AssignmentKind NONE = new AssignmentKind('NONE', 9); 635 static final AssignmentKind NONE = new AssignmentKind('NONE', 9);
632 static final List<AssignmentKind> values = [BINARY, COMPOUND_LEFT, COMPOUND_RI GHT, POSTFIX_INC, PREFIX_DEC, PREFIX_INC, PREFIX_NOT, SIMPLE_LEFT, SIMPLE_RIGHT, NONE]; 636 static final List<AssignmentKind> values = [BINARY, COMPOUND_LEFT, COMPOUND_RI GHT, POSTFIX_INC, PREFIX_DEC, PREFIX_INC, PREFIX_NOT, SIMPLE_LEFT, SIMPLE_RIGHT, NONE];
633 final String __name; 637 final String __name;
634 final int __ordinal; 638 final int __ordinal;
639 int get ordinal => __ordinal;
635 AssignmentKind(this.__name, this.__ordinal) { 640 AssignmentKind(this.__name, this.__ordinal) {
636 } 641 }
637 String toString() => __name; 642 String toString() => __name;
638 } 643 }
639 class WrapperKind { 644 class WrapperKind {
640 static final WrapperKind PREFIXED_LEFT = new WrapperKind('PREFIXED_LEFT', 0); 645 static final WrapperKind PREFIXED_LEFT = new WrapperKind('PREFIXED_LEFT', 0);
641 static final WrapperKind PREFIXED_RIGHT = new WrapperKind('PREFIXED_RIGHT', 1) ; 646 static final WrapperKind PREFIXED_RIGHT = new WrapperKind('PREFIXED_RIGHT', 1) ;
642 static final WrapperKind PROPERTY_LEFT = new WrapperKind('PROPERTY_LEFT', 2); 647 static final WrapperKind PROPERTY_LEFT = new WrapperKind('PROPERTY_LEFT', 2);
643 static final WrapperKind PROPERTY_RIGHT = new WrapperKind('PROPERTY_RIGHT', 3) ; 648 static final WrapperKind PROPERTY_RIGHT = new WrapperKind('PROPERTY_RIGHT', 3) ;
644 static final WrapperKind NONE = new WrapperKind('NONE', 4); 649 static final WrapperKind NONE = new WrapperKind('NONE', 4);
645 static final List<WrapperKind> values = [PREFIXED_LEFT, PREFIXED_RIGHT, PROPER TY_LEFT, PROPERTY_RIGHT, NONE]; 650 static final List<WrapperKind> values = [PREFIXED_LEFT, PREFIXED_RIGHT, PROPER TY_LEFT, PROPERTY_RIGHT, NONE];
646 final String __name; 651 final String __name;
647 final int __ordinal; 652 final int __ordinal;
653 int get ordinal => __ordinal;
648 WrapperKind(this.__name, this.__ordinal) { 654 WrapperKind(this.__name, this.__ordinal) {
649 } 655 }
650 String toString() => __name; 656 String toString() => __name;
651 } 657 }
652 class ConstantEvaluatorTest extends ParserTestCase { 658 class ConstantEvaluatorTest extends ParserTestCase {
653 void fail_constructor() { 659 void fail_constructor() {
654 Object value = getConstantValue("?"); 660 Object value = getConstantValue("?");
655 JUnitTestCase.assertEquals(null, value); 661 JUnitTestCase.assertEquals(null, value);
656 } 662 }
657 void fail_identifier_class() { 663 void fail_identifier_class() {
(...skipping 241 matching lines...) Expand 10 before | Expand all | Expand 10 after
899 void test_unary_negated_double() { 905 void test_unary_negated_double() {
900 Object value = getConstantValue("-42.3"); 906 Object value = getConstantValue("-42.3");
901 EngineTestCase.assertInstanceOf(double, value); 907 EngineTestCase.assertInstanceOf(double, value);
902 JUnitTestCase.assertEquals(-42.3, ((value as double))); 908 JUnitTestCase.assertEquals(-42.3, ((value as double)));
903 } 909 }
904 void test_unary_negated_integer() { 910 void test_unary_negated_integer() {
905 Object value = getConstantValue("-42"); 911 Object value = getConstantValue("-42");
906 EngineTestCase.assertInstanceOf(int, value); 912 EngineTestCase.assertInstanceOf(int, value);
907 JUnitTestCase.assertEquals(-42, ((value as int))); 913 JUnitTestCase.assertEquals(-42, ((value as int)));
908 } 914 }
909 Object getConstantValue(String source) => ParserTestCase.parseExpression(sourc e, []).accept(new ConstantEvaluator()); 915 Object getConstantValue(String source) => ParserTestCase.parseExpression(sourc e, []).accept(new ConstantEvaluator(null));
910 static dartSuite() { 916 static dartSuite() {
911 _ut.group('ConstantEvaluatorTest', () { 917 _ut.group('ConstantEvaluatorTest', () {
912 _ut.test('test_binary_bitAnd', () { 918 _ut.test('test_binary_bitAnd', () {
913 final __test = new ConstantEvaluatorTest(); 919 final __test = new ConstantEvaluatorTest();
914 runJUnitTest(__test, __test.test_binary_bitAnd); 920 runJUnitTest(__test, __test.test_binary_bitAnd);
915 }); 921 });
916 _ut.test('test_binary_bitOr', () { 922 _ut.test('test_binary_bitOr', () {
917 final __test = new ConstantEvaluatorTest(); 923 final __test = new ConstantEvaluatorTest();
918 runJUnitTest(__test, __test.test_binary_bitOr); 924 runJUnitTest(__test, __test.test_binary_bitOr);
919 }); 925 });
(...skipping 453 matching lines...) Expand 10 before | Expand all | Expand 10 after
1373 void test_visitFieldFormalParameter_keyword() { 1379 void test_visitFieldFormalParameter_keyword() {
1374 assertSource("var this.a", ASTFactory.fieldFormalParameter(Keyword.VAR, null , "a")); 1380 assertSource("var this.a", ASTFactory.fieldFormalParameter(Keyword.VAR, null , "a"));
1375 } 1381 }
1376 void test_visitFieldFormalParameter_keywordAndType() { 1382 void test_visitFieldFormalParameter_keywordAndType() {
1377 assertSource("final A this.a", ASTFactory.fieldFormalParameter(Keyword.FINAL , ASTFactory.typeName3("A", []), "a")); 1383 assertSource("final A this.a", ASTFactory.fieldFormalParameter(Keyword.FINAL , ASTFactory.typeName3("A", []), "a"));
1378 } 1384 }
1379 void test_visitFieldFormalParameter_type() { 1385 void test_visitFieldFormalParameter_type() {
1380 assertSource("A this.a", ASTFactory.fieldFormalParameter(null, ASTFactory.ty peName3("A", []), "a")); 1386 assertSource("A this.a", ASTFactory.fieldFormalParameter(null, ASTFactory.ty peName3("A", []), "a"));
1381 } 1387 }
1382 void test_visitForEachStatement() { 1388 void test_visitForEachStatement() {
1383 assertSource("for (a in b) {}", ASTFactory.forEachStatement(ASTFactory.simpl eFormalParameter3("a"), ASTFactory.identifier2("b"), ASTFactory.block([]))); 1389 assertSource("for (a in b) {}", ASTFactory.forEachStatement(ASTFactory.decla redIdentifier3("a"), ASTFactory.identifier2("b"), ASTFactory.block([])));
1384 } 1390 }
1385 void test_visitFormalParameterList_empty() { 1391 void test_visitFormalParameterList_empty() {
1386 assertSource("()", ASTFactory.formalParameterList([])); 1392 assertSource("()", ASTFactory.formalParameterList([]));
1387 } 1393 }
1388 void test_visitFormalParameterList_n() { 1394 void test_visitFormalParameterList_n() {
1389 assertSource("({a : 0})", ASTFactory.formalParameterList([ASTFactory.namedFo rmalParameter(ASTFactory.simpleFormalParameter3("a"), ASTFactory.integer(0))])); 1395 assertSource("({a : 0})", ASTFactory.formalParameterList([ASTFactory.namedFo rmalParameter(ASTFactory.simpleFormalParameter3("a"), ASTFactory.integer(0))]));
1390 } 1396 }
1391 void test_visitFormalParameterList_nn() { 1397 void test_visitFormalParameterList_nn() {
1392 assertSource("({a : 0, b : 1})", ASTFactory.formalParameterList([ASTFactory. namedFormalParameter(ASTFactory.simpleFormalParameter3("a"), ASTFactory.integer( 0)), ASTFactory.namedFormalParameter(ASTFactory.simpleFormalParameter3("b"), AST Factory.integer(1))])); 1398 assertSource("({a : 0, b : 1})", ASTFactory.formalParameterList([ASTFactory. namedFormalParameter(ASTFactory.simpleFormalParameter3("a"), ASTFactory.integer( 0)), ASTFactory.namedFormalParameter(ASTFactory.simpleFormalParameter3("b"), AST Factory.integer(1))]));
1393 } 1399 }
(...skipping 1420 matching lines...) Expand 10 before | Expand all | Expand 10 after
2814 }); 2820 });
2815 } 2821 }
2816 } 2822 }
2817 main() { 2823 main() {
2818 ConstantEvaluatorTest.dartSuite(); 2824 ConstantEvaluatorTest.dartSuite();
2819 NodeLocatorTest.dartSuite(); 2825 NodeLocatorTest.dartSuite();
2820 ToSourceVisitorTest.dartSuite(); 2826 ToSourceVisitorTest.dartSuite();
2821 IndexExpressionTest.dartSuite(); 2827 IndexExpressionTest.dartSuite();
2822 SimpleIdentifierTest.dartSuite(); 2828 SimpleIdentifierTest.dartSuite();
2823 } 2829 }
OLDNEW
« no previous file with comments | « pkg/analyzer-experimental/pubspec.yaml ('k') | pkg/analyzer-experimental/test/generated/element_test.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698