| 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 part of js_backend; | 5 part of js_backend; |
| 6 | 6 |
| 7 class ConstantEmitter { | 7 class ConstantEmitter { |
| 8 ConstantReferenceEmitter _referenceEmitter; | 8 ConstantReferenceEmitter _referenceEmitter; |
| 9 ConstantInitializerEmitter _initializerEmitter; | 9 ConstantInitializerEmitter _initializerEmitter; |
| 10 | 10 |
| (...skipping 75 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 86 } else if (value == -double.INFINITY) { | 86 } else if (value == -double.INFINITY) { |
| 87 return new jsAst.LiteralNumber("(-1/0)"); | 87 return new jsAst.LiteralNumber("(-1/0)"); |
| 88 } else { | 88 } else { |
| 89 return new jsAst.LiteralNumber("$value"); | 89 return new jsAst.LiteralNumber("$value"); |
| 90 } | 90 } |
| 91 } | 91 } |
| 92 | 92 |
| 93 jsAst.Expression visitTrue(TrueConstant constant) { | 93 jsAst.Expression visitTrue(TrueConstant constant) { |
| 94 if (compiler.enableMinification) { | 94 if (compiler.enableMinification) { |
| 95 // Use !0 for true. | 95 // Use !0 for true. |
| 96 return js["!0"]; | 96 return js("!0"); |
| 97 } else { | 97 } else { |
| 98 return new jsAst.LiteralBool(true); | 98 return new jsAst.LiteralBool(true); |
| 99 } | 99 } |
| 100 } | 100 } |
| 101 | 101 |
| 102 jsAst.Expression visitFalse(FalseConstant constant) { | 102 jsAst.Expression visitFalse(FalseConstant constant) { |
| 103 if (compiler.enableMinification) { | 103 if (compiler.enableMinification) { |
| 104 // Use !1 for false. | 104 // Use !1 for false. |
| 105 return js["!1"]; | 105 return js("!1"); |
| 106 } else { | 106 } else { |
| 107 return new jsAst.LiteralBool(false); | 107 return new jsAst.LiteralBool(false); |
| 108 } | 108 } |
| 109 } | 109 } |
| 110 | 110 |
| 111 /** | 111 /** |
| 112 * Write the contents of the quoted string to a [CodeBuffer] in | 112 * Write the contents of the quoted string to a [CodeBuffer] in |
| 113 * a form that is valid as JavaScript string literal content. | 113 * a form that is valid as JavaScript string literal content. |
| 114 * The string is assumed quoted by double quote characters. | 114 * The string is assumed quoted by double quote characters. |
| 115 */ | 115 */ |
| (...skipping 194 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 310 } | 310 } |
| 311 | 311 |
| 312 List<jsAst.Expression> _array(List<Constant> values) { | 312 List<jsAst.Expression> _array(List<Constant> values) { |
| 313 List<jsAst.Expression> valueList = <jsAst.Expression>[]; | 313 List<jsAst.Expression> valueList = <jsAst.Expression>[]; |
| 314 for (int i = 0; i < values.length; i++) { | 314 for (int i = 0; i < values.length; i++) { |
| 315 valueList.add(_reference(values[i])); | 315 valueList.add(_reference(values[i])); |
| 316 } | 316 } |
| 317 return valueList; | 317 return valueList; |
| 318 } | 318 } |
| 319 } | 319 } |
| OLD | NEW |