| 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 class Constant implements Hashable { | 5 class Constant implements Hashable { |
| 6 const Constant(); | 6 const Constant(); |
| 7 | 7 |
| 8 bool isNull() => false; | 8 bool isNull() => false; |
| 9 bool isBool() => false; | 9 bool isBool() => false; |
| 10 bool isTrue() => false; | 10 bool isTrue() => false; |
| (...skipping 721 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 732 | 732 |
| 733 Constant visitLiteralMap(LiteralMap node) { | 733 Constant visitLiteralMap(LiteralMap node) { |
| 734 if (!node.isConst()) error(node); | 734 if (!node.isConst()) error(node); |
| 735 List<StringConstant> keys = <StringConstant>[]; | 735 List<StringConstant> keys = <StringConstant>[]; |
| 736 Map<StringConstant, Constant> map = new Map<StringConstant, Constant>(); | 736 Map<StringConstant, Constant> map = new Map<StringConstant, Constant>(); |
| 737 for (Link<Node> link = node.entries.nodes; | 737 for (Link<Node> link = node.entries.nodes; |
| 738 !link.isEmpty(); | 738 !link.isEmpty(); |
| 739 link = link.tail) { | 739 link = link.tail) { |
| 740 LiteralMapEntry entry = link.head; | 740 LiteralMapEntry entry = link.head; |
| 741 Constant key = evaluate(entry.key); | 741 Constant key = evaluate(entry.key); |
| 742 if (!key.isString() || entry.key.asLiteralString() === null) { | 742 if (!key.isString() || entry.key.asStringNode() === null) { |
| 743 MessageKind kind = MessageKind.KEY_NOT_A_STRING_LITERAL; | 743 MessageKind kind = MessageKind.KEY_NOT_A_STRING_LITERAL; |
| 744 compiler.reportError(entry.key, new ResolutionError(kind, const [])); | 744 compiler.reportError(entry.key, new ResolutionError(kind, const [])); |
| 745 } | 745 } |
| 746 StringConstant keyConstant = key; | 746 StringConstant keyConstant = key; |
| 747 if (!map.containsKey(key)) keys.add(key); | 747 if (!map.containsKey(key)) keys.add(key); |
| 748 map[key] = evaluate(entry.value); | 748 map[key] = evaluate(entry.value); |
| 749 } | 749 } |
| 750 List<Constant> values = <Constant>[]; | 750 List<Constant> values = <Constant>[]; |
| 751 Constant protoValue = null; | 751 Constant protoValue = null; |
| 752 for (StringConstant key in keys) { | 752 for (StringConstant key in keys) { |
| (...skipping 372 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1125 Constant fieldValue = fieldValues[field]; | 1125 Constant fieldValue = fieldValues[field]; |
| 1126 if (fieldValue === null) { | 1126 if (fieldValue === null) { |
| 1127 // Use the default value. | 1127 // Use the default value. |
| 1128 fieldValue = compiler.compileVariable(field); | 1128 fieldValue = compiler.compileVariable(field); |
| 1129 } | 1129 } |
| 1130 jsNewArguments.add(fieldValue); | 1130 jsNewArguments.add(fieldValue); |
| 1131 }); | 1131 }); |
| 1132 return jsNewArguments; | 1132 return jsNewArguments; |
| 1133 } | 1133 } |
| 1134 } | 1134 } |
| OLD | NEW |