| 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 749 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 760 // TODO(floitsch): this should be a List<String> type. | 760 // TODO(floitsch): this should be a List<String> type. |
| 761 Type keysType = null; | 761 Type keysType = null; |
| 762 ListConstant keysList = new ListConstant(keysType, keys); | 762 ListConstant keysList = new ListConstant(keysType, keys); |
| 763 compiler.constantHandler.registerCompileTimeConstant(keysList); | 763 compiler.constantHandler.registerCompileTimeConstant(keysList); |
| 764 SourceString className = hasProtoKey | 764 SourceString className = hasProtoKey |
| 765 ? MapConstant.DART_PROTO_CLASS | 765 ? MapConstant.DART_PROTO_CLASS |
| 766 : MapConstant.DART_CLASS; | 766 : MapConstant.DART_CLASS; |
| 767 ClassElement classElement = compiler.jsHelperLibrary.find(className); | 767 ClassElement classElement = compiler.jsHelperLibrary.find(className); |
| 768 classElement.ensureResolved(compiler); | 768 classElement.ensureResolved(compiler); |
| 769 // TODO(floitsch): copy over the generic type. | 769 // TODO(floitsch): copy over the generic type. |
| 770 Type type = new SimpleType(classElement.name, classElement); | 770 Type type = new InterfaceType(classElement.name, classElement); |
| 771 compiler.registerInstantiatedClass(classElement); | 771 compiler.registerInstantiatedClass(classElement); |
| 772 Constant constant = new MapConstant(type, keysList, values, protoValue); | 772 Constant constant = new MapConstant(type, keysList, values, protoValue); |
| 773 compiler.constantHandler.registerCompileTimeConstant(constant); | 773 compiler.constantHandler.registerCompileTimeConstant(constant); |
| 774 return constant; | 774 return constant; |
| 775 } | 775 } |
| 776 | 776 |
| 777 Constant visitLiteralNull(LiteralNull node) { | 777 Constant visitLiteralNull(LiteralNull node) { |
| 778 return new NullConstant(); | 778 return new NullConstant(); |
| 779 } | 779 } |
| 780 | 780 |
| (...skipping 356 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1137 Constant fieldValue = fieldValues[field]; | 1137 Constant fieldValue = fieldValues[field]; |
| 1138 if (fieldValue === null) { | 1138 if (fieldValue === null) { |
| 1139 // Use the default value. | 1139 // Use the default value. |
| 1140 fieldValue = compiler.compileVariable(field); | 1140 fieldValue = compiler.compileVariable(field); |
| 1141 } | 1141 } |
| 1142 jsNewArguments.add(fieldValue); | 1142 jsNewArguments.add(fieldValue); |
| 1143 }); | 1143 }); |
| 1144 return jsNewArguments; | 1144 return jsNewArguments; |
| 1145 } | 1145 } |
| 1146 } | 1146 } |
| OLD | NEW |