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

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

Issue 2853113002: Infer types of double literals. (Closed)
Patch Set: Add expectations for compile/outline pipelines. Created 3 years, 7 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:front_end/src/fasta/kernel/utils.dart'; 5 import 'package:front_end/src/fasta/kernel/utils.dart';
6 import 'package:front_end/src/fasta/scanner/token.dart' show Token; 6 import 'package:front_end/src/fasta/scanner/token.dart' show Token;
7 import 'package:front_end/src/fasta/type_inference/type_promotion.dart'; 7 import 'package:front_end/src/fasta/type_inference/type_promotion.dart';
8 import 'package:kernel/ast.dart'; 8 import 'package:kernel/ast.dart';
9 9
10 import '../builder/ast_factory.dart'; 10 import '../builder/ast_factory.dart';
11 import 'kernel_shadow_ast.dart'; 11 import 'kernel_shadow_ast.dart';
12 12
13 /// Concrete implementation of [builder.AstFactory] for building a kernel AST. 13 /// Concrete implementation of [builder.AstFactory] for building a kernel AST.
14 class KernelAstFactory implements AstFactory<VariableDeclaration> { 14 class KernelAstFactory implements AstFactory<VariableDeclaration> {
15 @override 15 @override
16 KernelBlock block(List<Statement> statements, Token beginToken) { 16 KernelBlock block(List<Statement> statements, Token beginToken) {
17 return new KernelBlock(statements)..fileOffset = offsetForToken(beginToken); 17 return new KernelBlock(statements)..fileOffset = offsetForToken(beginToken);
18 } 18 }
19 19
20 @override 20 @override
21 KernelDoubleLiteral doubleLiteral(double value, Token token) {
22 return new KernelDoubleLiteral(value)..fileOffset = offsetForToken(token);
23 }
24
25 @override
21 ExpressionStatement expressionStatement(Expression expression) { 26 ExpressionStatement expressionStatement(Expression expression) {
22 return new KernelExpressionStatement(expression); 27 return new KernelExpressionStatement(expression);
23 } 28 }
24 29
25 @override 30 @override
26 FunctionExpression functionExpression(FunctionNode function, Token token) { 31 FunctionExpression functionExpression(FunctionNode function, Token token) {
27 return new KernelFunctionExpression(function) 32 return new KernelFunctionExpression(function)
28 ..fileOffset = offsetForToken(token); 33 ..fileOffset = offsetForToken(token);
29 } 34 }
30 35
31 @override 36 @override
32 Statement ifStatement( 37 Statement ifStatement(
33 Expression condition, Statement thenPart, Statement elsePart) { 38 Expression condition, Statement thenPart, Statement elsePart) {
34 return new KernelIfStatement(condition, thenPart, elsePart); 39 return new KernelIfStatement(condition, thenPart, elsePart);
35 } 40 }
36 41
37 @override 42 @override
38 KernelIntLiteral intLiteral(value, Token token) { 43 KernelIntLiteral intLiteral(int value, Token token) {
39 return new KernelIntLiteral(value)..fileOffset = offsetForToken(token); 44 return new KernelIntLiteral(value)..fileOffset = offsetForToken(token);
40 } 45 }
41 46
42 @override 47 @override
43 Expression isExpression( 48 Expression isExpression(
44 Expression expression, DartType type, Token token, bool isInverted) { 49 Expression expression, DartType type, Token token, bool isInverted) {
45 if (isInverted) { 50 if (isInverted) {
46 return new KernelIsNotExpression(expression, type, offsetForToken(token)); 51 return new KernelIsNotExpression(expression, type, offsetForToken(token));
47 } else { 52 } else {
48 return new KernelIsExpression(expression, type) 53 return new KernelIsExpression(expression, type)
(...skipping 45 matching lines...) Expand 10 before | Expand all | Expand 10 after
94 @override 99 @override
95 VariableGet variableGet( 100 VariableGet variableGet(
96 VariableDeclaration variable, 101 VariableDeclaration variable,
97 TypePromotionFact<VariableDeclaration> fact, 102 TypePromotionFact<VariableDeclaration> fact,
98 TypePromotionScope scope, 103 TypePromotionScope scope,
99 Token token) { 104 Token token) {
100 return new KernelVariableGet(variable, fact, scope) 105 return new KernelVariableGet(variable, fact, scope)
101 ..fileOffset = offsetForToken(token); 106 ..fileOffset = offsetForToken(token);
102 } 107 }
103 } 108 }
OLDNEW
« 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