| 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 899 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 910 DartType keysType = null; | 910 DartType keysType = null; |
| 911 ListConstant keysList = new ListConstant(keysType, keys); | 911 ListConstant keysList = new ListConstant(keysType, keys); |
| 912 compiler.constantHandler.registerCompileTimeConstant(keysList); | 912 compiler.constantHandler.registerCompileTimeConstant(keysList); |
| 913 SourceString className = hasProtoKey | 913 SourceString className = hasProtoKey |
| 914 ? MapConstant.DART_PROTO_CLASS | 914 ? MapConstant.DART_PROTO_CLASS |
| 915 : MapConstant.DART_CLASS; | 915 : MapConstant.DART_CLASS; |
| 916 ClassElement classElement = compiler.jsHelperLibrary.find(className); | 916 ClassElement classElement = compiler.jsHelperLibrary.find(className); |
| 917 classElement.ensureResolved(compiler); | 917 classElement.ensureResolved(compiler); |
| 918 // TODO(floitsch): copy over the generic type. | 918 // TODO(floitsch): copy over the generic type. |
| 919 DartType type = new InterfaceType(classElement); | 919 DartType type = new InterfaceType(classElement); |
| 920 compiler.registerInstantiatedClass(classElement); | 920 compiler.enqueuer.codegen.registerInstantiatedClass(classElement); |
| 921 Constant constant = new MapConstant(type, keysList, values, protoValue); | 921 Constant constant = new MapConstant(type, keysList, values, protoValue); |
| 922 compiler.constantHandler.registerCompileTimeConstant(constant); | 922 compiler.constantHandler.registerCompileTimeConstant(constant); |
| 923 return constant; | 923 return constant; |
| 924 } | 924 } |
| 925 | 925 |
| 926 Constant visitLiteralNull(LiteralNull node) { | 926 Constant visitLiteralNull(LiteralNull node) { |
| 927 return new NullConstant(); | 927 return new NullConstant(); |
| 928 } | 928 } |
| 929 | 929 |
| 930 Constant visitLiteralString(LiteralString node) { | 930 Constant visitLiteralString(LiteralString node) { |
| (...skipping 210 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1141 } | 1141 } |
| 1142 | 1142 |
| 1143 Selector selector = elements.getSelector(send); | 1143 Selector selector = elements.getSelector(send); |
| 1144 List<Constant> arguments = | 1144 List<Constant> arguments = |
| 1145 evaluateArgumentsToConstructor(selector, send.arguments, constructor); | 1145 evaluateArgumentsToConstructor(selector, send.arguments, constructor); |
| 1146 ConstructorEvaluator evaluator = | 1146 ConstructorEvaluator evaluator = |
| 1147 new ConstructorEvaluator(constructor, compiler); | 1147 new ConstructorEvaluator(constructor, compiler); |
| 1148 evaluator.evaluateConstructorFieldValues(arguments); | 1148 evaluator.evaluateConstructorFieldValues(arguments); |
| 1149 List<Constant> jsNewArguments = evaluator.buildJsNewArguments(classElement); | 1149 List<Constant> jsNewArguments = evaluator.buildJsNewArguments(classElement); |
| 1150 | 1150 |
| 1151 compiler.registerInstantiatedClass(classElement); | 1151 compiler.enqueuer.codegen.registerInstantiatedClass(classElement); |
| 1152 // TODO(floitsch): take generic types into account. | 1152 // TODO(floitsch): take generic types into account. |
| 1153 DartType type = classElement.computeType(compiler); | 1153 DartType type = classElement.computeType(compiler); |
| 1154 Constant constant = new ConstructedConstant(type, jsNewArguments); | 1154 Constant constant = new ConstructedConstant(type, jsNewArguments); |
| 1155 compiler.constantHandler.registerCompileTimeConstant(constant); | 1155 compiler.constantHandler.registerCompileTimeConstant(constant); |
| 1156 return constant; | 1156 return constant; |
| 1157 } | 1157 } |
| 1158 | 1158 |
| 1159 Constant visitParenthesizedExpression(ParenthesizedExpression node) { | 1159 Constant visitParenthesizedExpression(ParenthesizedExpression node) { |
| 1160 return node.expression.accept(this); | 1160 return node.expression.accept(this); |
| 1161 } | 1161 } |
| (...skipping 166 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1328 Constant fieldValue = fieldValues[field]; | 1328 Constant fieldValue = fieldValues[field]; |
| 1329 if (fieldValue === null) { | 1329 if (fieldValue === null) { |
| 1330 // Use the default value. | 1330 // Use the default value. |
| 1331 fieldValue = compiler.compileConstant(field); | 1331 fieldValue = compiler.compileConstant(field); |
| 1332 } | 1332 } |
| 1333 jsNewArguments.add(fieldValue); | 1333 jsNewArguments.add(fieldValue); |
| 1334 }); | 1334 }); |
| 1335 return jsNewArguments; | 1335 return jsNewArguments; |
| 1336 } | 1336 } |
| 1337 } | 1337 } |
| OLD | NEW |