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

Unified Diff: pkg/front_end/lib/src/fasta/builder/ast_factory.dart

Issue 2861523003: Add KernelXyzExpression stubs and factory methods. (Closed)
Patch Set: Created 3 years, 8 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
« no previous file with comments | « no previous file | pkg/front_end/lib/src/fasta/kernel/body_builder.dart » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: pkg/front_end/lib/src/fasta/builder/ast_factory.dart
diff --git a/pkg/front_end/lib/src/fasta/builder/ast_factory.dart b/pkg/front_end/lib/src/fasta/builder/ast_factory.dart
index 09faabcc0c8e8cb4ef80a1c2e0eb00fef5da7479..f4ca9614af7509fecc30ffe1b85f97b85044578a 100644
--- a/pkg/front_end/lib/src/fasta/builder/ast_factory.dart
+++ b/pkg/front_end/lib/src/fasta/builder/ast_factory.dart
@@ -35,12 +35,34 @@ import 'package:kernel/ast.dart';
/// shadow-ify [DartType], since analyzer ASTs need to be able to record the
/// exact tokens that were used to specify a type.
abstract class AstFactory<V> {
+ /// Creates an `as` expression.
+ AsExpression asExpression(Expression operand, Token operator, DartType type);
+
+ /// Creates an `await` expression.
+ AwaitExpression awaitExpression(Token keyword, Expression operand);
+
/// Creates a statement block.
Block block(List<Statement> statements, Token beginToken);
/// Creates a boolean literal.
BoolLiteral boolLiteral(bool value, Token token);
+ /// Creates a constructor invocation.
+ ConstructorInvocation constructorInvocation(
+ Constructor target, Arguments arguments,
+ {bool isConst: false});
+
+ /// Creates a direct method invocation.
+ DirectMethodInvocation directMethodInvocation(
+ Expression receiver, Procedure target, Arguments arguments);
+
+ /// Creates a direct property get.
+ DirectPropertyGet directPropertyGet(Expression receiver, Member target);
+
+ /// Creates a direct property get.
+ DirectPropertySet directPropertySet(
+ Expression receiver, Member target, Expression value);
+
/// Creates a double literal.
DoubleLiteral doubleLiteral(double value, Token token);
@@ -68,15 +90,38 @@ abstract class AstFactory<V> {
ListLiteral listLiteral(List<Expression> expressions, DartType typeArgument,
bool isConst, Token token);
+ /// Creates a logical expression in for of `x && y` or `x || y`.
+ LogicalExpression logicalExpression(
+ Expression left, String operator, Expression right);
+
+ /// Creates a map literal expression.
+ ///
+ /// If the map literal did not have an explicitly declared type argument,
+ /// [keyType] and [valueType] should be `null`.
+ MapLiteral mapLiteral(
+ Token beginToken, Token constKeyword, List<MapEntry> entries,
+ {DartType keyType: const DynamicType(),
+ DartType valueType: const DynamicType()});
+
+ /// Create an expression of form `!x`.
+ Not not(Token token, Expression operand);
+
/// Creates a null literal expression.
NullLiteral nullLiteral(Token token);
+ /// Create a `rethrow` expression.
+ Rethrow rethrowExpression(Token keyword);
+
/// Creates a return statement.
Statement returnStatement(Expression expression, Token token);
/// Creates a read of a static variable.
StaticGet staticGet(Member readTarget, Token token);
+ /// Creates a static invocation.
+ StaticInvocation staticInvocation(Procedure target, Arguments arguments,
+ {bool isConst: false});
+
/// Creates a string concatenation.
StringConcatenation stringConcatenation(
List<Expression> expressions, Token token);
@@ -84,6 +129,26 @@ abstract class AstFactory<V> {
/// Creates a string literal.
StringLiteral stringLiteral(String value, Token token);
+ /// Creates a super method invocation.
+ SuperMethodInvocation superMethodInvocation(
+ Token beginToken, Name name, Arguments arguments,
+ [Procedure interfaceTarget]);
+
+ /// Create an expression of form `super.field`.
+ SuperPropertyGet superPropertyGet(Name name, [Member interfaceTarget]);
+
+ /// Create an expression of form `#foo.bar`.
+ SymbolLiteral symbolLiteral(Token hashToken, String value);
+
+ /// Create an expression of form `this`.
+ ThisExpression thisExpression(Token keyword);
+
+ /// Create a `throw` expression.
+ Throw throwExpression(Token keyword, Expression expression);
+
+ /// Create a type literal expression.
+ TypeLiteral typeLiteral(DartType type);
+
/// Creates a variable declaration statement declaring one variable.
///
/// TODO(paulberry): analyzer makes a distinction between a single variable
@@ -102,6 +167,6 @@ abstract class AstFactory<V> {
bool isConst: false});
/// Creates a read of a local variable.
- variableGet(VariableDeclaration variable, TypePromotionFact<V> fact,
- TypePromotionScope scope, Token token);
+ VariableGet variableGet(VariableDeclaration variable,
+ TypePromotionFact<V> fact, TypePromotionScope scope, Token token);
}
« no previous file with comments | « no previous file | pkg/front_end/lib/src/fasta/kernel/body_builder.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698