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

Unified Diff: pkg/front_end/lib/src/fasta/kernel/kernel_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
Index: pkg/front_end/lib/src/fasta/kernel/kernel_ast_factory.dart
diff --git a/pkg/front_end/lib/src/fasta/kernel/kernel_ast_factory.dart b/pkg/front_end/lib/src/fasta/kernel/kernel_ast_factory.dart
index 579afea6856d8d4afe147e6b0c288de655af7566..9b5a4dcf5175eecf9cd791d41c261e357e07c42e 100644
--- a/pkg/front_end/lib/src/fasta/kernel/kernel_ast_factory.dart
+++ b/pkg/front_end/lib/src/fasta/kernel/kernel_ast_factory.dart
@@ -13,6 +13,18 @@ import 'kernel_shadow_ast.dart';
/// Concrete implementation of [builder.AstFactory] for building a kernel AST.
class KernelAstFactory implements AstFactory<VariableDeclaration> {
@override
+ AsExpression asExpression(Expression operand, Token operator, DartType type) {
+ return new KernelAsExpression(operand, type)
+ ..fileOffset = offsetForToken(operator);
+ }
+
+ @override
+ AwaitExpression awaitExpression(Token keyword, Expression operand) {
+ return new KernelAwaitExpression(operand)
+ ..fileOffset = offsetForToken(keyword);
+ }
+
+ @override
KernelBlock block(List<Statement> statements, Token beginToken) {
return new KernelBlock(statements)..fileOffset = offsetForToken(beginToken);
}
@@ -23,6 +35,30 @@ class KernelAstFactory implements AstFactory<VariableDeclaration> {
}
@override
+ ConstructorInvocation constructorInvocation(
+ Constructor target, Arguments arguments,
+ {bool isConst: false}) {
+ return new KernelConstructorInvocation(target, arguments, isConst: isConst);
+ }
+
+ @override
+ DirectMethodInvocation directMethodInvocation(
+ Expression receiver, Procedure target, Arguments arguments) {
+ return new KernelDirectMethodInvocation(receiver, target, arguments);
+ }
+
+ @override
+ DirectPropertyGet directPropertyGet(Expression receiver, Member target) {
+ return new KernelDirectPropertyGet(receiver, target);
+ }
+
+ @override
+ DirectPropertySet directPropertySet(
+ Expression receiver, Member target, Expression value) {
+ return new KernelDirectPropertySet(receiver, target, value);
+ }
+
+ @override
KernelDoubleLiteral doubleLiteral(double value, Token token) {
return new KernelDoubleLiteral(value)..fileOffset = offsetForToken(token);
}
@@ -69,11 +105,37 @@ class KernelAstFactory implements AstFactory<VariableDeclaration> {
}
@override
+ LogicalExpression logicalExpression(
+ Expression left, String operator, Expression right) {
+ return new KernelLogicalExpression(left, operator, right);
+ }
+
+ @override
+ MapLiteral mapLiteral(
+ Token beginToken, Token constKeyword, List<MapEntry> entries,
+ {DartType keyType: const DynamicType(),
+ DartType valueType: const DynamicType()}) {
+ return new KernelMapLiteral(entries,
+ keyType: keyType, valueType: valueType, isConst: constKeyword != null)
+ ..fileOffset = constKeyword?.charOffset ?? beginToken.charOffset;
+ }
+
+ @override
+ Not not(Token token, Expression operand) {
+ return new KernelNot(operand)..fileOffset = offsetForToken(token);
+ }
+
+ @override
KernelNullLiteral nullLiteral(Token token) {
return new KernelNullLiteral()..fileOffset = offsetForToken(token);
}
@override
+ Rethrow rethrowExpression(Token keyword) {
+ return new KernelRethrow()..fileOffset = offsetForToken(keyword);
+ }
+
+ @override
KernelReturnStatement returnStatement(Expression expression, Token token) {
return new KernelReturnStatement(expression)
..fileOffset = offsetForToken(token);
@@ -85,6 +147,12 @@ class KernelAstFactory implements AstFactory<VariableDeclaration> {
}
@override
+ StaticInvocation staticInvocation(Procedure target, Arguments arguments,
+ {bool isConst: false}) {
+ return new KernelStaticInvocation(target, arguments, isConst: isConst);
+ }
+
+ @override
StringConcatenation stringConcatenation(
List<Expression> expressions, Token token) {
return new KernelStringConcatenation(expressions)
@@ -97,6 +165,39 @@ class KernelAstFactory implements AstFactory<VariableDeclaration> {
}
@override
+ SuperMethodInvocation superMethodInvocation(
+ Token beginToken, Name name, Arguments arguments,
+ [Procedure interfaceTarget]) {
+ return new KernelSuperMethodInvocation(name, arguments, interfaceTarget);
+ }
+
+ @override
+ SuperPropertyGet superPropertyGet(Name name, [Member interfaceTarget]) {
+ return new KernelSuperPropertyGet(name, interfaceTarget);
+ }
+
+ @override
+ SymbolLiteral symbolLiteral(Token hashToken, String value) {
+ return new KernelSymbolLiteral(value)
+ ..fileOffset = offsetForToken(hashToken);
+ }
+
+ @override
+ ThisExpression thisExpression(Token keyword) {
+ return new KernelThisExpression()..fileOffset = offsetForToken(keyword);
+ }
+
+ @override
+ Throw throwExpression(Token keyword, Expression expression) {
+ return new KernelThrow(expression)..fileOffset = offsetForToken(keyword);
+ }
+
+ @override
+ TypeLiteral typeLiteral(DartType type) {
+ return new KernelTypeLiteral(type);
+ }
+
+ @override
VariableDeclaration variableDeclaration(
String name, Token token, int functionNestingLevel,
{DartType type,
« no previous file with comments | « pkg/front_end/lib/src/fasta/kernel/body_builder.dart ('k') | pkg/front_end/lib/src/fasta/kernel/kernel_shadow_ast.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698