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

Side by Side Diff: sdk/lib/_internal/compiler/implementation/compile_time_constants.dart

Issue 11308257: - Parse the return type of JS during resolution to know what can be instantiated there. (Closed) Base URL: http://dart.googlecode.com/svn/branches/bleeding_edge/dart/
Patch Set: Created 8 years 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 | Annotate | Revision Log
OLDNEW
1 // Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file 1 // Copyright (c) 2012, 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 part of dart2js; 5 part of dart2js;
6 6
7 /** 7 /**
8 * The [ConstantHandler] keeps track of compile-time constants, 8 * The [ConstantHandler] keeps track of compile-time constants,
9 * initializations of global and static fields, and default values of 9 * initializations of global and static fields, and default values of
10 * optional parameters. 10 * optional parameters.
(...skipping 255 matching lines...) Expand 10 before | Expand all | Expand 10 after
266 isEvaluatingConstant = oldIsEvaluatingConstant; 266 isEvaluatingConstant = oldIsEvaluatingConstant;
267 assert(result != null); 267 assert(result != null);
268 return result; 268 return result;
269 } 269 }
270 270
271 Constant visitNode(Node node) { 271 Constant visitNode(Node node) {
272 return signalNotCompileTimeConstant(node); 272 return signalNotCompileTimeConstant(node);
273 } 273 }
274 274
275 Constant visitLiteralBool(LiteralBool node) { 275 Constant visitLiteralBool(LiteralBool node) {
276 registerInstantiatedClass(compiler.boolClass);
276 return constantSystem.createBool(node.value); 277 return constantSystem.createBool(node.value);
277 } 278 }
278 279
279 Constant visitLiteralDouble(LiteralDouble node) { 280 Constant visitLiteralDouble(LiteralDouble node) {
281 registerInstantiatedClass(compiler.doubleClass);
280 return constantSystem.createDouble(node.value); 282 return constantSystem.createDouble(node.value);
281 } 283 }
282 284
283 Constant visitLiteralInt(LiteralInt node) { 285 Constant visitLiteralInt(LiteralInt node) {
286 registerInstantiatedClass(compiler.intClass);
284 return constantSystem.createInt(node.value); 287 return constantSystem.createInt(node.value);
285 } 288 }
286 289
287 Constant visitLiteralList(LiteralList node) { 290 Constant visitLiteralList(LiteralList node) {
288 if (!node.isConst()) { 291 if (!node.isConst()) {
289 return signalNotCompileTimeConstant(node); 292 return signalNotCompileTimeConstant(node);
290 } 293 }
291 List<Constant> arguments = <Constant>[]; 294 List<Constant> arguments = <Constant>[];
292 for (Link<Node> link = node.elements.nodes; 295 for (Link<Node> link = node.elements.nodes;
293 !link.isEmpty; 296 !link.isEmpty;
(...skipping 552 matching lines...) Expand 10 before | Expand all | Expand 10 after
846 // Use the default value. 849 // Use the default value.
847 fieldValue = compiler.compileConstant(field); 850 fieldValue = compiler.compileConstant(field);
848 } 851 }
849 jsNewArguments.add(fieldValue); 852 jsNewArguments.add(fieldValue);
850 }, 853 },
851 includeBackendMembers: true, 854 includeBackendMembers: true,
852 includeSuperMembers: true); 855 includeSuperMembers: true);
853 return jsNewArguments; 856 return jsNewArguments;
854 } 857 }
855 } 858 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698