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

Side by Side Diff: pkg/front_end/lib/src/fasta/kernel/ast_factory.dart

Issue 2769723004: Introduce a shadow hierarchy and factory class for use by fasta's BodyBuilder. (Closed)
Patch Set: Created 3 years, 9 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
OLDNEW
(Empty)
1 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.
2
3 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.
4 import '../builder/shadow_ast.dart' as builder;
5 import 'shadow_ast.dart';
6
7 /// Concrete implementation of [builder.AstFactory] for building a kernel AST.
8 class AstFactory implements builder.AstFactory {
ahe 2017/03/24 12:00:40 KernelAstFactory?
Paul Berry 2017/03/24 14:55:24 Done.
9 @override
10 Block block(List<builder.Statement> statements, int charOffset) {
11 return new Block(statements)..fileOffset = charOffset;
12 }
13
14 @override
15 IntLiteral intLiteral(value, int charOffset) {
16 return new IntLiteral(value)..fileOffset = charOffset;
17 }
18
19 @override
20 ListLiteral listLiteral(List<builder.Expression> expressions,
21 DartType typeArgument, bool isConst, int charOffset) {
22 return new ListLiteral(expressions,
23 typeArgument: typeArgument, isConst: isConst)..fileOffset = charOffset;
24 }
25
26 @override
27 NullLiteral nullLiteral(int charOffset) {
28 return new NullLiteral()..fileOffset = charOffset;
29 }
30
31 @override
32 ReturnStatement returnStatement(
33 builder.Expression expression, int charOffset) {
34 return new ReturnStatement(expression)..fileOffset = charOffset;
35 }
36
37 @override
38 VariableDeclaration variableDeclaration(String name,
39 {DartType type,
40 builder.Expression initializer,
41 int charOffset,
42 bool isFinal: false,
43 bool isConst: false}) {
44 return new VariableDeclaration(name,
45 type: type,
46 initializer: initializer,
47 isFinal: isFinal,
48 isConst: isConst)..fileEqualsOffset = charOffset;
49 }
50 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698