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

Side by Side Diff: pkg/compiler/lib/src/inferrer/builder.dart

Issue 3009693002: Handle int/double literals in inference (Closed)
Patch Set: Updated cf. comments Created 3 years, 3 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
« no previous file with comments | « no previous file | pkg/compiler/lib/src/inferrer/builder_kernel.dart » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2013, the Dart project authors. Please see the AUTHORS file 1 // Copyright (c) 2013, 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 library simple_types_inferrer; 5 library simple_types_inferrer;
6 6
7 import '../closure.dart' show ClosureRepresentationInfo; 7 import '../closure.dart' show ClosureRepresentationInfo;
8 import '../common.dart'; 8 import '../common.dart';
9 import '../common/names.dart' show Identifiers, Selectors; 9 import '../common/names.dart' show Identifiers, Selectors;
10 import '../compiler.dart' show Compiler; 10 import '../compiler.dart' show Compiler;
(...skipping 201 matching lines...) Expand 10 before | Expand all | Expand 10 after
212 TypeInformation visitStringJuxtaposition(ast.StringJuxtaposition node) { 212 TypeInformation visitStringJuxtaposition(ast.StringJuxtaposition node) {
213 node.visitChildren(this); 213 node.visitChildren(this);
214 return types.stringType; 214 return types.stringType;
215 } 215 }
216 216
217 TypeInformation visitLiteralBool(ast.LiteralBool node) { 217 TypeInformation visitLiteralBool(ast.LiteralBool node) {
218 return types.boolLiteralType(node.value); 218 return types.boolLiteralType(node.value);
219 } 219 }
220 220
221 TypeInformation visitLiteralDouble(ast.LiteralDouble node) { 221 TypeInformation visitLiteralDouble(ast.LiteralDouble node) {
222 ConstantSystem constantSystem = compiler.backend.constantSystem; 222 ConstantSystem constantSystem = closedWorld.constantSystem;
223 // The JavaScript backend may turn this literal into an integer at 223 // The JavaScript backend may turn this literal into an integer at
224 // runtime. 224 // runtime.
225 return types.getConcreteTypeFor( 225 return types.getConcreteTypeFor(
226 computeTypeMask(closedWorld, constantSystem.createDouble(node.value))); 226 computeTypeMask(closedWorld, constantSystem.createDouble(node.value)));
227 } 227 }
228 228
229 TypeInformation visitLiteralInt(ast.LiteralInt node) { 229 TypeInformation visitLiteralInt(ast.LiteralInt node) {
230 ConstantSystem constantSystem = compiler.backend.constantSystem; 230 ConstantSystem constantSystem = closedWorld.constantSystem;
231 // The JavaScript backend may turn this literal into a double at 231 // The JavaScript backend may turn this literal into a double at
232 // runtime. 232 // runtime.
233 return types.getConcreteTypeFor( 233 return types.getConcreteTypeFor(
234 computeTypeMask(closedWorld, constantSystem.createInt(node.value))); 234 computeTypeMask(closedWorld, constantSystem.createInt(node.value)));
235 } 235 }
236 236
237 TypeInformation visitLiteralNull(ast.LiteralNull node) { 237 TypeInformation visitLiteralNull(ast.LiteralNull node) {
238 return types.nullType; 238 return types.nullType;
239 } 239 }
240 240
(...skipping 2752 matching lines...) Expand 10 before | Expand all | Expand 10 after
2993 node, 2993 node,
2994 iteratorSelector, 2994 iteratorSelector,
2995 iteratorMask, 2995 iteratorMask,
2996 expressionType, 2996 expressionType,
2997 new ArgumentsTypes.empty()); 2997 new ArgumentsTypes.empty());
2998 2998
2999 return handleForInLoop(node, iteratorType, currentSelector, currentMask, 2999 return handleForInLoop(node, iteratorType, currentSelector, currentMask,
3000 moveNextSelector, moveNextMask); 3000 moveNextSelector, moveNextMask);
3001 } 3001 }
3002 } 3002 }
OLDNEW
« no previous file with comments | « no previous file | pkg/compiler/lib/src/inferrer/builder_kernel.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698