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

Unified Diff: packages/analyzer/lib/src/generated/testing/ast_test_factory.dart

Issue 2990843002: Removed fixed dependencies (Closed)
Patch Set: Created 3 years, 5 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 side-by-side diff with in-line comments
Download patch
Index: packages/analyzer/lib/src/generated/testing/ast_test_factory.dart
diff --git a/packages/analyzer/lib/src/generated/testing/ast_factory.dart b/packages/analyzer/lib/src/generated/testing/ast_test_factory.dart
similarity index 96%
copy from packages/analyzer/lib/src/generated/testing/ast_factory.dart
copy to packages/analyzer/lib/src/generated/testing/ast_test_factory.dart
index bb758b3533f72dcd7bf850f6430e114dc7ad8e7e..8d4c5499cc73381cd21a4a76a1bfb598f5c81eb7 100644
--- a/packages/analyzer/lib/src/generated/testing/ast_factory.dart
+++ b/packages/analyzer/lib/src/generated/testing/ast_test_factory.dart
@@ -2,16 +2,17 @@
// for details. All rights reserved. Use of this source code is governed by a
// BSD-style license that can be found in the LICENSE file.
-library engine.testing.ast_factory;
+library analyzer.src.generated.testing.ast_test_factory;
-import 'package:analyzer/src/generated/ast.dart';
-import 'package:analyzer/src/generated/element.dart';
-import 'package:analyzer/src/generated/scanner.dart';
+import 'package:analyzer/dart/ast/ast.dart';
+import 'package:analyzer/dart/ast/token.dart';
+import 'package:analyzer/dart/element/element.dart';
+import 'package:analyzer/src/dart/ast/ast.dart';
import 'package:analyzer/src/generated/testing/token_factory.dart';
import 'package:analyzer/src/generated/utilities_dart.dart';
/**
- * The class `AstFactory` defines utility methods that can be used to create AST nodes. The
+ * The class `AstTestFactory` defines utility methods that can be used to create AST nodes. The
* nodes that are created are complete in the sense that all of the tokens that would have been
* associated with the nodes by a parser are also created, but the token stream is not constructed.
* None of the nodes are resolved.
@@ -22,7 +23,7 @@ import 'package:analyzer/src/generated/utilities_dart.dart';
* second is places where a shorter name seemed unambiguous and easier to read, such as using
* 'identifier' rather than 'prefixedIdentifier', or 'integer' rather than 'integerLiteral'.
*/
-class AstFactory {
+class AstTestFactory {
static AdjacentStrings adjacentStrings(List<StringLiteral> strings) =>
new AdjacentStrings(strings);
@@ -34,7 +35,9 @@ class AstFactory {
new Annotation(
TokenFactory.tokenFromType(TokenType.AT),
name,
- TokenFactory.tokenFromType(TokenType.PERIOD),
+ constructorName == null
+ ? null
+ : TokenFactory.tokenFromType(TokenType.PERIOD),
constructorName,
arguments);
@@ -46,11 +49,14 @@ class AstFactory {
new AsExpression(
expression, TokenFactory.tokenFromKeyword(Keyword.AS), type);
- static AssertStatement assertStatement(Expression condition) =>
+ static AssertStatement assertStatement(Expression condition,
+ [Expression message]) =>
new AssertStatement(
TokenFactory.tokenFromKeyword(Keyword.ASSERT),
TokenFactory.tokenFromType(TokenType.OPEN_PAREN),
condition,
+ message == null ? null : TokenFactory.tokenFromType(TokenType.COMMA),
+ message,
TokenFactory.tokenFromType(TokenType.CLOSE_PAREN),
TokenFactory.tokenFromType(TokenType.SEMICOLON));
@@ -263,7 +269,7 @@ class AstFactory {
List<CompilationUnitMember> declarations) =>
new CompilationUnit(
TokenFactory.tokenFromType(TokenType.EOF),
- scriptTag == null ? null : AstFactory.scriptTag(scriptTag),
+ scriptTag == null ? null : AstTestFactory.scriptTag(scriptTag),
directives == null ? new List<Directive>() : directives,
declarations == null
? new List<CompilationUnitMember>()
@@ -431,6 +437,7 @@ class AstFactory {
metadata,
TokenFactory.tokenFromKeyword(Keyword.EXPORT),
string2(uri),
+ null,
combinators,
TokenFactory.tokenFromType(TokenType.SEMICOLON));
@@ -657,6 +664,7 @@ class AstFactory {
metadata,
TokenFactory.tokenFromKeyword(Keyword.IMPORT),
string2(uri),
+ null,
!isDeferred ? null : TokenFactory.tokenFromKeyword(Keyword.DEFERRED),
prefix == null ? null : TokenFactory.tokenFromKeyword(Keyword.AS),
prefix == null ? null : identifier3(prefix),
@@ -734,7 +742,7 @@ class AstFactory {
static Label label(SimpleIdentifier label) =>
new Label(label, TokenFactory.tokenFromType(TokenType.COLON));
- static Label label2(String label) => AstFactory.label(identifier3(label));
+ static Label label2(String label) => AstTestFactory.label(identifier3(label));
static LabeledStatement labeledStatement(
List<Label> labels, Statement statement) =>
@@ -794,6 +802,10 @@ class AstFactory {
new MapLiteralEntry(
string2(key), TokenFactory.tokenFromType(TokenType.COLON), value);
+ static MapLiteralEntry mapLiteralEntry2(Expression key, Expression value) =>
+ new MapLiteralEntry(
+ key, TokenFactory.tokenFromType(TokenType.COLON), value);
+
static MethodDeclaration methodDeclaration(
Keyword modifier,
TypeName returnType,
@@ -857,6 +869,28 @@ class AstFactory {
parameters,
body);
+ static MethodDeclaration methodDeclaration4(
+ {bool external: false,
+ Keyword modifier,
+ TypeName returnType,
+ Keyword property,
+ bool operator: false,
+ String name,
+ FormalParameterList parameters,
+ FunctionBody body}) =>
+ new MethodDeclaration(
+ null,
+ null,
+ external ? TokenFactory.tokenFromKeyword(Keyword.EXTERNAL) : null,
+ modifier == null ? null : TokenFactory.tokenFromKeyword(modifier),
+ returnType,
+ property == null ? null : TokenFactory.tokenFromKeyword(property),
+ operator ? TokenFactory.tokenFromKeyword(Keyword.OPERATOR) : null,
+ identifier3(name),
+ null,
+ parameters,
+ body);
+
static MethodInvocation methodInvocation(Expression target, String methodName,
[List<Expression> arguments,
TokenType operator = TokenType.PERIOD]) =>

Powered by Google App Engine
This is Rietveld 408576698