| 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 692 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 703 arguments.add(evaluate(link.head)); | 703 arguments.add(evaluate(link.head)); |
| 704 } | 704 } |
| 705 // TODO(floitsch): get type from somewhere. | 705 // TODO(floitsch): get type from somewhere. |
| 706 Type type = null; | 706 Type type = null; |
| 707 Constant constant = new ListConstant(type, arguments); | 707 Constant constant = new ListConstant(type, arguments); |
| 708 compiler.constantHandler.registerCompileTimeConstant(constant); | 708 compiler.constantHandler.registerCompileTimeConstant(constant); |
| 709 return constant; | 709 return constant; |
| 710 } | 710 } |
| 711 | 711 |
| 712 Constant visitLiteralMap(LiteralMap node) { | 712 Constant visitLiteralMap(LiteralMap node) { |
| 713 // TODO(floitsch): check for isConst, once the parser adds it into the node. | 713 if (!node.isConst()) error(node); |
| 714 // if (!node.isConst()) error(node); | |
| 715 List<StringConstant> keys = <StringConstant>[]; | 714 List<StringConstant> keys = <StringConstant>[]; |
| 716 List<Constant> values = <Constant>[]; | 715 List<Constant> values = <Constant>[]; |
| 717 bool hasProtoKey = false; | 716 bool hasProtoKey = false; |
| 718 for (Link<Node> link = node.entries.nodes; | 717 for (Link<Node> link = node.entries.nodes; |
| 719 !link.isEmpty(); | 718 !link.isEmpty(); |
| 720 link = link.tail) { | 719 link = link.tail) { |
| 721 LiteralMapEntry entry = link.head; | 720 LiteralMapEntry entry = link.head; |
| 722 Constant key = evaluate(entry.key); | 721 Constant key = evaluate(entry.key); |
| 723 if (!key.isString() || entry.key.asLiteralString() === null) { | 722 if (!key.isString() || entry.key.asLiteralString() === null) { |
| 724 MessageKind kind = MessageKind.KEY_NOT_A_STRING_LITERAL; | 723 MessageKind kind = MessageKind.KEY_NOT_A_STRING_LITERAL; |
| (...skipping 381 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1106 fieldValue = compiler.compileVariable(member); | 1105 fieldValue = compiler.compileVariable(member); |
| 1107 } | 1106 } |
| 1108 jsNewArguments.add(fieldValue); | 1107 jsNewArguments.add(fieldValue); |
| 1109 } | 1108 } |
| 1110 } | 1109 } |
| 1111 classElement = classElement.superclass; | 1110 classElement = classElement.superclass; |
| 1112 } | 1111 } |
| 1113 return jsNewArguments; | 1112 return jsNewArguments; |
| 1114 } | 1113 } |
| 1115 } | 1114 } |
| OLD | NEW |