OLD | NEW |
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 287 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
298 List<Constant> keys = <Constant>[]; | 298 List<Constant> keys = <Constant>[]; |
299 Map<Constant, Constant> map = new Map<Constant, Constant>(); | 299 Map<Constant, Constant> map = new Map<Constant, Constant>(); |
300 for (Link<Node> link = node.entries.nodes; | 300 for (Link<Node> link = node.entries.nodes; |
301 !link.isEmpty; | 301 !link.isEmpty; |
302 link = link.tail) { | 302 link = link.tail) { |
303 LiteralMapEntry entry = link.head; | 303 LiteralMapEntry entry = link.head; |
304 Constant key = evaluateConstant(entry.key); | 304 Constant key = evaluateConstant(entry.key); |
305 if (!map.containsKey(key)) { | 305 if (!map.containsKey(key)) { |
306 keys.add(key); | 306 keys.add(key); |
307 } else { | 307 } else { |
308 compiler.reportWarningCode(entry.key, MessageKind.EQUAL_MAP_ENTRY_KEY); | 308 compiler.reportWarning(entry.key, MessageKind.EQUAL_MAP_ENTRY_KEY); |
309 } | 309 } |
310 map[key] = evaluateConstant(entry.value); | 310 map[key] = evaluateConstant(entry.value); |
311 } | 311 } |
312 | 312 |
313 bool onlyStringKeys = true; | 313 bool onlyStringKeys = true; |
314 Constant protoValue = null; | 314 Constant protoValue = null; |
315 for (var key in keys) { | 315 for (var key in keys) { |
316 if (key.isString()) { | 316 if (key.isString()) { |
317 if (key.value == MapConstant.PROTO_PROPERTY) { | 317 if (key.value == MapConstant.PROTO_PROPERTY) { |
318 protoValue = map[key]; | 318 protoValue = map[key]; |
(...skipping 634 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
953 if (fieldValue == null) { | 953 if (fieldValue == null) { |
954 // Use the default value. | 954 // Use the default value. |
955 fieldValue = handler.compileConstant(field); | 955 fieldValue = handler.compileConstant(field); |
956 } | 956 } |
957 jsNewArguments.add(fieldValue); | 957 jsNewArguments.add(fieldValue); |
958 }, | 958 }, |
959 includeSuperAndInjectedMembers: true); | 959 includeSuperAndInjectedMembers: true); |
960 return jsNewArguments; | 960 return jsNewArguments; |
961 } | 961 } |
962 } | 962 } |
OLD | NEW |