| OLD | NEW |
| 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 338 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 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)); | 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)); |
| 350 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)); |
| 351 /** | 351 /** |
| 352 * 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 |
| 353 * resolved to the type of the given element. | 353 * resolved to the type of the given element. |
| 354 * <p> | 354 * <p> |
| 355 * <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. |
| 356 * @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 |
| 357 * @return the type name that was created | 357 * @return the type name that was created |
| 358 */ | 358 */ |
| 359 static TypeName typeName(ClassElement element55, List<TypeName> arguments) { | 359 static TypeName typeName(ClassElement element61, List<TypeName> arguments) { |
| 360 SimpleIdentifier name22 = identifier2(element55.name); | 360 SimpleIdentifier name22 = identifier2(element61.name); |
| 361 name22.element = element55; | 361 name22.element = element61; |
| 362 TypeName typeName = typeName2(name22, arguments); | 362 TypeName typeName = typeName2(name22, arguments); |
| 363 typeName.type = element55.type; | 363 typeName.type = element61.type; |
| 364 return typeName; | 364 return typeName; |
| 365 } | 365 } |
| 366 static TypeName typeName2(Identifier name, List<TypeName> arguments) { | 366 static TypeName typeName2(Identifier name, List<TypeName> arguments) { |
| 367 if (arguments.length == 0) { | 367 if (arguments.length == 0) { |
| 368 return new TypeName.full(name, null); | 368 return new TypeName.full(name, null); |
| 369 } | 369 } |
| 370 return new TypeName.full(name, typeArgumentList(arguments)); | 370 return new TypeName.full(name, typeArgumentList(arguments)); |
| 371 } | 371 } |
| 372 static TypeName typeName3(String name, List<TypeName> arguments) { | 372 static TypeName typeName3(String name, List<TypeName> arguments) { |
| 373 if (arguments.length == 0) { | 373 if (arguments.length == 0) { |
| 374 return new TypeName.full(identifier2(name), null); | 374 return new TypeName.full(identifier2(name), null); |
| 375 } | 375 } |
| 376 return new TypeName.full(identifier2(name), typeArgumentList(arguments)); | 376 return new TypeName.full(identifier2(name), typeArgumentList(arguments)); |
| 377 } | 377 } |
| 378 static TypeParameter typeParameter(String name) => new TypeParameter.full(null
, null, identifier2(name), null, null); | 378 static TypeParameter typeParameter(String name) => new TypeParameter.full(null
, null, identifier2(name), null, null); |
| 379 static TypeParameter typeParameter2(String name, TypeName bound) => new TypePa
rameter.full(null, null, identifier2(name), TokenFactory.token(Keyword.EXTENDS),
bound); | 379 static TypeParameter typeParameter2(String name, TypeName bound) => new TypePa
rameter.full(null, null, identifier2(name), TokenFactory.token(Keyword.EXTENDS),
bound); |
| 380 static TypeParameterList typeParameterList(List<String> typeNames) { | 380 static TypeParameterList typeParameterList(List<String> typeNames) { |
| 381 List<TypeParameter> typeParameters = new List<TypeParameter>(); | 381 List<TypeParameter> typeParameters = new List<TypeParameter>(); |
| 382 for (String typeName in typeNames) { | 382 for (String typeName in typeNames) { |
| 383 typeParameters.add(typeParameter(typeName)); | 383 typeParameters.add(typeParameter(typeName)); |
| 384 } | 384 } |
| 385 return new TypeParameterList.full(TokenFactory.token3(TokenType.LT), typePar
ameters, TokenFactory.token3(TokenType.GT)); | 385 return new TypeParameterList.full(TokenFactory.token3(TokenType.LT), typePar
ameters, TokenFactory.token3(TokenType.GT)); |
| 386 } | 386 } |
| 387 static VariableDeclaration variableDeclaration(String name) => new VariableDec
laration.full(null, null, identifier2(name), null, null); | 387 static VariableDeclaration variableDeclaration(String name) => new VariableDec
laration.full(null, null, identifier2(name), null, null); |
| 388 static VariableDeclaration variableDeclaration2(String name, Expression initia
lizer) => new VariableDeclaration.full(null, null, identifier2(name), TokenFacto
ry.token3(TokenType.EQ), initializer); | 388 static VariableDeclaration variableDeclaration2(String name, Expression initia
lizer) => new VariableDeclaration.full(null, null, identifier2(name), TokenFacto
ry.token3(TokenType.EQ), initializer); |
| 389 static VariableDeclarationList variableDeclarationList(Keyword keyword, TypeNa
me type, List<VariableDeclaration> variables) => new VariableDeclarationList.ful
l(keyword == null ? null : TokenFactory.token(keyword), type, list(variables)); | 389 static VariableDeclarationList variableDeclarationList(Keyword keyword, TypeNa
me type, List<VariableDeclaration> variables) => new VariableDeclarationList.ful
l(null, null, keyword == null ? null : TokenFactory.token(keyword), type, list(v
ariables)); |
| 390 static VariableDeclarationList variableDeclarationList2(Keyword keyword, List<
VariableDeclaration> variables) => variableDeclarationList(keyword, null, variab
les); | 390 static VariableDeclarationList variableDeclarationList2(Keyword keyword, List<
VariableDeclaration> variables) => variableDeclarationList(keyword, null, variab
les); |
| 391 static VariableDeclarationStatement variableDeclarationStatement(Keyword keywo
rd, TypeName type, List<VariableDeclaration> variables) => new VariableDeclarati
onStatement.full(variableDeclarationList(keyword, type, variables), TokenFactory
.token3(TokenType.SEMICOLON)); | 391 static VariableDeclarationStatement variableDeclarationStatement(Keyword keywo
rd, TypeName type, List<VariableDeclaration> variables) => new VariableDeclarati
onStatement.full(variableDeclarationList(keyword, type, variables), TokenFactory
.token3(TokenType.SEMICOLON)); |
| 392 static VariableDeclarationStatement variableDeclarationStatement2(Keyword keyw
ord, List<VariableDeclaration> variables) => variableDeclarationStatement(keywor
d, null, variables); | 392 static VariableDeclarationStatement variableDeclarationStatement2(Keyword keyw
ord, List<VariableDeclaration> variables) => variableDeclarationStatement(keywor
d, null, variables); |
| 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); | 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); |
| 394 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)); |
| 395 /** | 395 /** |
| 396 * Prevent the creation of instances of this class. | 396 * Prevent the creation of instances of this class. |
| 397 */ | 397 */ |
| 398 ASTFactory() { | 398 ASTFactory() { |
| 399 } | 399 } |
| (...skipping 135 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 535 } | 535 } |
| 536 return identifier; | 536 return identifier; |
| 537 } | 537 } |
| 538 /** | 538 /** |
| 539 * Return the top-most node in the AST structure containing the given identifi
er. | 539 * Return the top-most node in the AST structure containing the given identifi
er. |
| 540 * @param identifier the identifier in the AST structure being traversed | 540 * @param identifier the identifier in the AST structure being traversed |
| 541 * @return the root of the AST structure containing the identifier | 541 * @return the root of the AST structure containing the identifier |
| 542 */ | 542 */ |
| 543 ASTNode topMostNode(SimpleIdentifier identifier) { | 543 ASTNode topMostNode(SimpleIdentifier identifier) { |
| 544 ASTNode child = identifier; | 544 ASTNode child = identifier; |
| 545 ASTNode parent18 = identifier.parent; | 545 ASTNode parent20 = identifier.parent; |
| 546 while (parent18 != null) { | 546 while (parent20 != null) { |
| 547 child = parent18; | 547 child = parent20; |
| 548 parent18 = parent18.parent; | 548 parent20 = parent20.parent; |
| 549 } | 549 } |
| 550 return child; | 550 return child; |
| 551 } | 551 } |
| 552 static dartSuite() { | 552 static dartSuite() { |
| 553 _ut.group('SimpleIdentifierTest', () { | 553 _ut.group('SimpleIdentifierTest', () { |
| 554 _ut.test('test_inDeclarationContext_argumentDefinition', () { | 554 _ut.test('test_inDeclarationContext_argumentDefinition', () { |
| 555 final __test = new SimpleIdentifierTest(); | 555 final __test = new SimpleIdentifierTest(); |
| 556 runJUnitTest(__test, __test.test_inDeclarationContext_argumentDefinition
); | 556 runJUnitTest(__test, __test.test_inDeclarationContext_argumentDefinition
); |
| 557 }); | 557 }); |
| 558 _ut.test('test_inDeclarationContext_catch_exception', () { | 558 _ut.test('test_inDeclarationContext_catch_exception', () { |
| (...skipping 2261 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2820 }); | 2820 }); |
| 2821 } | 2821 } |
| 2822 } | 2822 } |
| 2823 main() { | 2823 main() { |
| 2824 ConstantEvaluatorTest.dartSuite(); | 2824 ConstantEvaluatorTest.dartSuite(); |
| 2825 NodeLocatorTest.dartSuite(); | 2825 NodeLocatorTest.dartSuite(); |
| 2826 ToSourceVisitorTest.dartSuite(); | 2826 ToSourceVisitorTest.dartSuite(); |
| 2827 IndexExpressionTest.dartSuite(); | 2827 IndexExpressionTest.dartSuite(); |
| 2828 SimpleIdentifierTest.dartSuite(); | 2828 SimpleIdentifierTest.dartSuite(); |
| 2829 } | 2829 } |
| OLD | NEW |