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

Side by Side Diff: pkg/analyzer_experimental/test/generated/ast_test.dart

Issue 17249003: New analyzer_experimental snapshot. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 7 years, 6 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 library engine.ast_test; 3 library engine.ast_test;
4 import 'dart:collection'; 4 import 'dart:collection';
5 import 'package:analyzer_experimental/src/generated/java_core.dart'; 5 import 'package:analyzer_experimental/src/generated/java_core.dart';
6 import 'package:analyzer_experimental/src/generated/java_engine.dart'; 6 import 'package:analyzer_experimental/src/generated/java_engine.dart';
7 import 'package:analyzer_experimental/src/generated/java_junit.dart'; 7 import 'package:analyzer_experimental/src/generated/java_junit.dart';
8 import 'package:analyzer_experimental/src/generated/source.dart'; 8 import 'package:analyzer_experimental/src/generated/source.dart';
9 import 'package:analyzer_experimental/src/generated/error.dart'; 9 import 'package:analyzer_experimental/src/generated/error.dart';
10 import 'package:analyzer_experimental/src/generated/scanner.dart'; 10 import 'package:analyzer_experimental/src/generated/scanner.dart';
(...skipping 194 matching lines...) Expand 10 before | Expand all | Expand 10 after
205 runJUnitTest(__test, __test.test_getDocumentationComment_onGrandParent); 205 runJUnitTest(__test, __test.test_getDocumentationComment_onGrandParent);
206 }); 206 });
207 _ut.test('test_getDocumentationComment_onNode', () { 207 _ut.test('test_getDocumentationComment_onNode', () {
208 final __test = new VariableDeclarationTest(); 208 final __test = new VariableDeclarationTest();
209 runJUnitTest(__test, __test.test_getDocumentationComment_onNode); 209 runJUnitTest(__test, __test.test_getDocumentationComment_onNode);
210 }); 210 });
211 }); 211 });
212 } 212 }
213 } 213 }
214 /** 214 /**
215 * The class {@code ASTFactory} defines utility methods that can be used to crea te AST nodes. The 215 * The class `ASTFactory` defines utility methods that can be used to create AST nodes. The
216 * nodes that are created are complete in the sense that all of the tokens that would have been 216 * nodes that are created are complete in the sense that all of the tokens that would have been
217 * associated with the nodes by a parser are also created, but the token stream is not constructed. 217 * associated with the nodes by a parser are also created, but the token stream is not constructed.
218 * None of the nodes are resolved. 218 * None of the nodes are resolved.
219 * <p> 219 *
220 * The general pattern is for the name of the factory method to be the same as t he name of the class 220 * The general pattern is for the name of the factory method to be the same as t he name of the class
221 * of AST node being created. There are two notable exceptions. The first is for methods creating 221 * of AST node being created. There are two notable exceptions. The first is for methods creating
222 * nodes that are part of a cascade expression. These methods are all prefixed w ith 'cascaded'. The 222 * nodes that are part of a cascade expression. These methods are all prefixed w ith 'cascaded'. The
223 * second is places where a shorter name seemed unambiguous and easier to read, such as using 223 * second is places where a shorter name seemed unambiguous and easier to read, such as using
224 * 'identifier' rather than 'prefixedIdentifier', or 'integer' rather than 'inte gerLiteral'. 224 * 'identifier' rather than 'prefixedIdentifier', or 'integer' rather than 'inte gerLiteral'.
225 */ 225 */
226 class ASTFactory { 226 class ASTFactory {
227 static AdjacentStrings adjacentStrings(List<StringLiteral> strings) => new Adj acentStrings.full(list(strings)); 227 static AdjacentStrings adjacentStrings(List<StringLiteral> strings) => new Adj acentStrings.full(list(strings));
228 static Annotation annotation(Identifier name) => new Annotation.full(TokenFact ory.token3(TokenType.AT), name, null, null, null); 228 static Annotation annotation(Identifier name) => new Annotation.full(TokenFact ory.token3(TokenType.AT), name, null, null, null);
229 static Annotation annotation2(Identifier name, SimpleIdentifier constructorNam e, ArgumentList arguments) => new Annotation.full(TokenFactory.token3(TokenType. AT), name, TokenFactory.token3(TokenType.PERIOD), constructorName, arguments); 229 static Annotation annotation2(Identifier name, SimpleIdentifier constructorNam e, ArgumentList arguments) => new Annotation.full(TokenFactory.token3(TokenType. AT), name, TokenFactory.token3(TokenType.PERIOD), constructorName, arguments);
(...skipping 165 matching lines...) Expand 10 before | Expand all | Expand 10 after
395 static TopLevelVariableDeclaration topLevelVariableDeclaration2(Keyword keywor d, List<VariableDeclaration> variables) => new TopLevelVariableDeclaration.full( null, null, variableDeclarationList(keyword, null, variables), TokenFactory.toke n3(TokenType.SEMICOLON)); 395 static TopLevelVariableDeclaration topLevelVariableDeclaration2(Keyword keywor d, List<VariableDeclaration> variables) => new TopLevelVariableDeclaration.full( null, null, variableDeclarationList(keyword, null, variables), TokenFactory.toke n3(TokenType.SEMICOLON));
396 static TryStatement tryStatement(Block body, Block finallyClause) => tryStatem ent3(body, new List<CatchClause>(), finallyClause); 396 static TryStatement tryStatement(Block body, Block finallyClause) => tryStatem ent3(body, new List<CatchClause>(), finallyClause);
397 static TryStatement tryStatement2(Block body, List<CatchClause> catchClauses) => tryStatement3(body, list(catchClauses), null); 397 static TryStatement tryStatement2(Block body, List<CatchClause> catchClauses) => tryStatement3(body, list(catchClauses), null);
398 static TryStatement tryStatement3(Block body, List<CatchClause> catchClauses, Block finallyClause) => new TryStatement.full(TokenFactory.token(Keyword.TRY), b ody, catchClauses, finallyClause == null ? null : TokenFactory.token(Keyword.FIN ALLY), finallyClause); 398 static TryStatement tryStatement3(Block body, List<CatchClause> catchClauses, Block finallyClause) => new TryStatement.full(TokenFactory.token(Keyword.TRY), b ody, catchClauses, finallyClause == null ? null : TokenFactory.token(Keyword.FIN ALLY), finallyClause);
399 static FunctionTypeAlias typeAlias(TypeName returnType, String name, TypeParam eterList typeParameters, FormalParameterList parameters) => new FunctionTypeAlia s.full(null, null, TokenFactory.token(Keyword.TYPEDEF), returnType, identifier3( name), typeParameters, parameters, TokenFactory.token3(TokenType.SEMICOLON)); 399 static FunctionTypeAlias typeAlias(TypeName returnType, String name, TypeParam eterList typeParameters, FormalParameterList parameters) => new FunctionTypeAlia s.full(null, null, TokenFactory.token(Keyword.TYPEDEF), returnType, identifier3( name), typeParameters, parameters, TokenFactory.token3(TokenType.SEMICOLON));
400 static TypeArgumentList typeArgumentList(List<TypeName> typeNames) => new Type ArgumentList.full(TokenFactory.token3(TokenType.LT), list(typeNames), TokenFacto ry.token3(TokenType.GT)); 400 static TypeArgumentList typeArgumentList(List<TypeName> typeNames) => new Type ArgumentList.full(TokenFactory.token3(TokenType.LT), list(typeNames), TokenFacto ry.token3(TokenType.GT));
401 401
402 /** 402 /**
403 * Create a type name whose name has been resolved to the given element and wh ose type has been 403 * Create a type name whose name has been resolved to the given element and wh ose type has been
404 * resolved to the type of the given element. 404 * resolved to the type of the given element.
405 * <p> 405 *
406 * <b>Note:</b> This method does not correctly handle class elements that have type parameters. 406 * <b>Note:</b> This method does not correctly handle class elements that have type parameters.
407 * @param element the element defining the type represented by the type name 407 * @param element the element defining the type represented by the type name
408 * @return the type name that was created 408 * @return the type name that was created
409 */ 409 */
410 static TypeName typeName(ClassElement element2, List<TypeName> arguments) { 410 static TypeName typeName(ClassElement element2, List<TypeName> arguments) {
411 SimpleIdentifier name = identifier3(element2.name); 411 SimpleIdentifier name = identifier3(element2.name);
412 name.element = element2; 412 name.element = element2;
413 TypeName typeName = typeName3(name, arguments); 413 TypeName typeName = typeName3(name, arguments);
414 typeName.type = element2.type; 414 typeName.type = element2.type;
415 return typeName; 415 return typeName;
(...skipping 1527 matching lines...) Expand 10 before | Expand all | Expand 10 after
1943 assertSource("while (c) {}", ASTFactory.whileStatement(ASTFactory.identifier 3("c"), ASTFactory.block([]))); 1943 assertSource("while (c) {}", ASTFactory.whileStatement(ASTFactory.identifier 3("c"), ASTFactory.block([])));
1944 } 1944 }
1945 void test_visitWithClause_multiple() { 1945 void test_visitWithClause_multiple() {
1946 assertSource("with A, B, C", ASTFactory.withClause([ASTFactory.typeName4("A" , []), ASTFactory.typeName4("B", []), ASTFactory.typeName4("C", [])])); 1946 assertSource("with A, B, C", ASTFactory.withClause([ASTFactory.typeName4("A" , []), ASTFactory.typeName4("B", []), ASTFactory.typeName4("C", [])]));
1947 } 1947 }
1948 void test_visitWithClause_single() { 1948 void test_visitWithClause_single() {
1949 assertSource("with A", ASTFactory.withClause([ASTFactory.typeName4("A", [])] )); 1949 assertSource("with A", ASTFactory.withClause([ASTFactory.typeName4("A", [])] ));
1950 } 1950 }
1951 1951
1952 /** 1952 /**
1953 * Assert that a {@code ToSourceVisitor} will produce the expected source when visiting the given 1953 * Assert that a `ToSourceVisitor` will produce the expected source when visit ing the given
1954 * node. 1954 * node.
1955 * @param expectedSource the source string that the visitor is expected to pro duce 1955 * @param expectedSource the source string that the visitor is expected to pro duce
1956 * @param node the AST node being visited to produce the actual source 1956 * @param node the AST node being visited to produce the actual source
1957 * @throws AFE if the visitor does not produce the expected source for the giv en node 1957 * @throws AFE if the visitor does not produce the expected source for the giv en node
1958 */ 1958 */
1959 void assertSource(String expectedSource, ASTNode node) { 1959 void assertSource(String expectedSource, ASTNode node) {
1960 PrintStringWriter writer = new PrintStringWriter(); 1960 PrintStringWriter writer = new PrintStringWriter();
1961 node.accept(new ToSourceVisitor(writer)); 1961 node.accept(new ToSourceVisitor(writer));
1962 JUnitTestCase.assertEquals(expectedSource, writer.toString()); 1962 JUnitTestCase.assertEquals(expectedSource, writer.toString());
1963 } 1963 }
(...skipping 972 matching lines...) Expand 10 before | Expand all | Expand 10 after
2936 } 2936 }
2937 main() { 2937 main() {
2938 ConstantEvaluatorTest.dartSuite(); 2938 ConstantEvaluatorTest.dartSuite();
2939 NodeLocatorTest.dartSuite(); 2939 NodeLocatorTest.dartSuite();
2940 ToSourceVisitorTest.dartSuite(); 2940 ToSourceVisitorTest.dartSuite();
2941 BreadthFirstVisitorTest.dartSuite(); 2941 BreadthFirstVisitorTest.dartSuite();
2942 IndexExpressionTest.dartSuite(); 2942 IndexExpressionTest.dartSuite();
2943 SimpleIdentifierTest.dartSuite(); 2943 SimpleIdentifierTest.dartSuite();
2944 VariableDeclarationTest.dartSuite(); 2944 VariableDeclarationTest.dartSuite();
2945 } 2945 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698