Index: pkg/front_end/lib/src/fasta/kernel/ast_factory.dart |
diff --git a/pkg/front_end/lib/src/fasta/kernel/ast_factory.dart b/pkg/front_end/lib/src/fasta/kernel/ast_factory.dart |
new file mode 100644 |
index 0000000000000000000000000000000000000000..676466958fb65c82b70cad833d2245812fa157ad |
--- /dev/null |
+++ b/pkg/front_end/lib/src/fasta/kernel/ast_factory.dart |
@@ -0,0 +1,50 @@ |
+import 'package:kernel/ast.dart' show DartType; |
ahe
2017/03/24 12:00:40
Missing copyright.
Paul Berry
2017/03/24 14:55:23
Done.
|
+ |
+import '../builder/ast_factory.dart' as builder; |
ahe
2017/03/24 12:00:40
Could you rename this file to kernel_ast_factory.d
Paul Berry
2017/03/24 14:55:24
Done.
|
+import '../builder/shadow_ast.dart' as builder; |
+import 'shadow_ast.dart'; |
+ |
+/// Concrete implementation of [builder.AstFactory] for building a kernel AST. |
+class AstFactory implements builder.AstFactory { |
ahe
2017/03/24 12:00:40
KernelAstFactory?
Paul Berry
2017/03/24 14:55:24
Done.
|
+ @override |
+ Block block(List<builder.Statement> statements, int charOffset) { |
+ return new Block(statements)..fileOffset = charOffset; |
+ } |
+ |
+ @override |
+ IntLiteral intLiteral(value, int charOffset) { |
+ return new IntLiteral(value)..fileOffset = charOffset; |
+ } |
+ |
+ @override |
+ ListLiteral listLiteral(List<builder.Expression> expressions, |
+ DartType typeArgument, bool isConst, int charOffset) { |
+ return new ListLiteral(expressions, |
+ typeArgument: typeArgument, isConst: isConst)..fileOffset = charOffset; |
+ } |
+ |
+ @override |
+ NullLiteral nullLiteral(int charOffset) { |
+ return new NullLiteral()..fileOffset = charOffset; |
+ } |
+ |
+ @override |
+ ReturnStatement returnStatement( |
+ builder.Expression expression, int charOffset) { |
+ return new ReturnStatement(expression)..fileOffset = charOffset; |
+ } |
+ |
+ @override |
+ VariableDeclaration variableDeclaration(String name, |
+ {DartType type, |
+ builder.Expression initializer, |
+ int charOffset, |
+ bool isFinal: false, |
+ bool isConst: false}) { |
+ return new VariableDeclaration(name, |
+ type: type, |
+ initializer: initializer, |
+ isFinal: isFinal, |
+ isConst: isConst)..fileEqualsOffset = charOffset; |
+ } |
+} |