| 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 777 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 788 return new StringConstant(new DartString.concat(left.value, right.value)); | 788 return new StringConstant(new DartString.concat(left.value, right.value)); |
| 789 } | 789 } |
| 790 | 790 |
| 791 Constant visitStringInterpolation(StringInterpolation node) { | 791 Constant visitStringInterpolation(StringInterpolation node) { |
| 792 StringConstant initialString = evaluate(node.string); | 792 StringConstant initialString = evaluate(node.string); |
| 793 DartString accumulator = initialString.value; | 793 DartString accumulator = initialString.value; |
| 794 for (StringInterpolationPart part in node.parts) { | 794 for (StringInterpolationPart part in node.parts) { |
| 795 Constant expression = evaluate(part.expression); | 795 Constant expression = evaluate(part.expression); |
| 796 DartString expressionString; | 796 DartString expressionString; |
| 797 if (expression.isNum() || expression.isBool()) { | 797 if (expression.isNum() || expression.isBool()) { |
| 798 Object value = expression.value; | 798 PrimitiveConstant primitive = expression; |
| 799 expressionString = new DartString.literal(value.toString()); | 799 expressionString = new DartString.literal(primitive.value.toString()); |
| 800 } else if (expression.isString()) { | 800 } else if (expression.isString()) { |
| 801 expressionString = expression.value; | 801 PrimitiveConstant primitive = expression; |
| 802 expressionString = primitive.value; |
| 802 } else { | 803 } else { |
| 803 error(part.expression); | 804 error(part.expression); |
| 804 } | 805 } |
| 805 accumulator = new DartString.concat(accumulator, expressionString); | 806 accumulator = new DartString.concat(accumulator, expressionString); |
| 806 StringConstant partString = evaluate(part.string); | 807 StringConstant partString = evaluate(part.string); |
| 807 accumulator = new DartString.concat(accumulator, partString.value); | 808 accumulator = new DartString.concat(accumulator, partString.value); |
| 808 }; | 809 }; |
| 809 return new StringConstant(accumulator); | 810 return new StringConstant(accumulator); |
| 810 } | 811 } |
| 811 | 812 |
| (...skipping 313 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1125 Constant fieldValue = fieldValues[field]; | 1126 Constant fieldValue = fieldValues[field]; |
| 1126 if (fieldValue === null) { | 1127 if (fieldValue === null) { |
| 1127 // Use the default value. | 1128 // Use the default value. |
| 1128 fieldValue = compiler.compileVariable(field); | 1129 fieldValue = compiler.compileVariable(field); |
| 1129 } | 1130 } |
| 1130 jsNewArguments.add(fieldValue); | 1131 jsNewArguments.add(fieldValue); |
| 1131 }); | 1132 }); |
| 1132 return jsNewArguments; | 1133 return jsNewArguments; |
| 1133 } | 1134 } |
| 1134 } | 1135 } |
| OLD | NEW |