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

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

Issue 2768533002: Fasta type inference prototype #2
Patch Set: Rework atop 415c868589d02e98eb839f48150f4203d5cecdb0 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
1 // Copyright (c) 2017, the Dart project authors. Please see the AUTHORS file 1 // Copyright (c) 2017, the Dart project authors. Please see the AUTHORS file
2 // for details. All rights reserved. Use of this source code is governed by a 2 // for details. All rights reserved. Use of this source code is governed by a
3 // BSD-style license that can be found in the LICENSE file. 3 // BSD-style license that can be found in the LICENSE file.
4 4
5 import 'package:kernel/ast.dart' show DartType; 5 import 'package:kernel/ast.dart' show DartType;
6 6
7 import '../builder/ast_factory.dart' as builder; 7 import '../builder/ast_factory.dart' as builder;
8 import '../builder/shadow_ast.dart' as builder; 8 import '../builder/shadow_ast.dart' as builder;
9 import 'kernel_shadow_ast.dart'; 9 import 'kernel_shadow_ast.dart';
10 10
11 /// Concrete implementation of [builder.AstFactory] for building a kernel AST. 11 /// Concrete implementation of [builder.AstFactory] for building a kernel AST.
12 class KernelAstFactory implements builder.AstFactory { 12 class KernelAstFactory implements builder.AstFactory {
13 @override 13 @override
14 KernelBlock block(List<builder.ShadowStatement> statements, int charOffset) { 14 KernelBlock block(List<builder.ShadowStatement> statements, int charOffset) {
15 return new KernelBlock(statements)..fileOffset = charOffset; 15 return new KernelBlock(statements)..fileOffset = charOffset;
16 } 16 }
17 17
18 @override 18 @override
19 List<KernelExpression> expressionList(int length) =>
20 new List<KernelExpression>.filled(length, null, growable: true);
21
22 @override
19 KernelIntLiteral intLiteral(value, int charOffset) { 23 KernelIntLiteral intLiteral(value, int charOffset) {
20 return new KernelIntLiteral(value)..fileOffset = charOffset; 24 return new KernelIntLiteral(value)..fileOffset = charOffset;
21 } 25 }
22 26
23 @override 27 @override
24 KernelListLiteral listLiteral(List<builder.ShadowExpression> expressions, 28 KernelListLiteral listLiteral(List<builder.ShadowExpression> expressions,
25 DartType typeArgument, bool isConst, int charOffset) { 29 DartType typeArgument, bool isConst, int charOffset) {
26 return new KernelListLiteral(expressions, 30 return new KernelListLiteral(expressions,
27 typeArgument: typeArgument, isConst: isConst)..fileOffset = charOffset; 31 typeArgument: typeArgument, isConst: isConst)..fileOffset = charOffset;
28 } 32 }
(...skipping 16 matching lines...) Expand all
45 int charOffset, 49 int charOffset,
46 bool isFinal: false, 50 bool isFinal: false,
47 bool isConst: false}) { 51 bool isConst: false}) {
48 return new KernelVariableDeclaration(name, 52 return new KernelVariableDeclaration(name,
49 type: type, 53 type: type,
50 initializer: initializer, 54 initializer: initializer,
51 isFinal: isFinal, 55 isFinal: isFinal,
52 isConst: isConst)..fileEqualsOffset = charOffset; 56 isConst: isConst)..fileEqualsOffset = charOffset;
53 } 57 }
54 } 58 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698