| 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 61 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 72 | 72 |
| 73 class NumConstant extends PrimitiveConstant { | 73 class NumConstant extends PrimitiveConstant { |
| 74 abstract num get value(); | 74 abstract num get value(); |
| 75 const NumConstant(); | 75 const NumConstant(); |
| 76 bool isNum() => true; | 76 bool isNum() => true; |
| 77 } | 77 } |
| 78 | 78 |
| 79 class IntConstant extends NumConstant { | 79 class IntConstant extends NumConstant { |
| 80 final int value; | 80 final int value; |
| 81 factory IntConstant(int value) { | 81 factory IntConstant(int value) { |
| 82 switch(value) { | 82 switch (value) { |
| 83 case 0: return const IntConstant._internal(0); | 83 case 0: return const IntConstant._internal(0); |
| 84 case 1: return const IntConstant._internal(1); | 84 case 1: return const IntConstant._internal(1); |
| 85 case 2: return const IntConstant._internal(2); | 85 case 2: return const IntConstant._internal(2); |
| 86 case 3: return const IntConstant._internal(3); | 86 case 3: return const IntConstant._internal(3); |
| 87 case 4: return const IntConstant._internal(4); | 87 case 4: return const IntConstant._internal(4); |
| 88 case 5: return const IntConstant._internal(5); | 88 case 5: return const IntConstant._internal(5); |
| 89 case 6: return const IntConstant._internal(6); | 89 case 6: return const IntConstant._internal(6); |
| 90 case 7: return const IntConstant._internal(7); | 90 case 7: return const IntConstant._internal(7); |
| 91 case 8: return const IntConstant._internal(8); | 91 case 8: return const IntConstant._internal(8); |
| 92 case 9: return const IntConstant._internal(9); | 92 case 9: return const IntConstant._internal(9); |
| (...skipping 577 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 670 // TODO(lrn): Consider whether all codes above 0x7f really need to | 670 // TODO(lrn): Consider whether all codes above 0x7f really need to |
| 671 // be escaped. We build a Dart string here, so it should be a literal | 671 // be escaped. We build a Dart string here, so it should be a literal |
| 672 // stage that converts it to, e.g., UTF-8 for a JS interpreter. | 672 // stage that converts it to, e.g., UTF-8 for a JS interpreter. |
| 673 if (code < 0x20) { | 673 if (code < 0x20) { |
| 674 buffer.add(@'\x'); | 674 buffer.add(@'\x'); |
| 675 if (code < 0x10) buffer.add('0'); | 675 if (code < 0x10) buffer.add('0'); |
| 676 buffer.add(code.toRadixString(16)); | 676 buffer.add(code.toRadixString(16)); |
| 677 } else if (code >= 0x80) { | 677 } else if (code >= 0x80) { |
| 678 if (code < 0x100) { | 678 if (code < 0x100) { |
| 679 buffer.add(@'\x'); | 679 buffer.add(@'\x'); |
| 680 buffer.add(code.toRadixString(16)); | |
| 681 } else { | 680 } else { |
| 682 buffer.add(@'\u'); | 681 buffer.add(@'\u'); |
| 683 if (code < 0x1000) { | 682 if (code < 0x1000) { |
| 684 buffer.add('0'); | 683 buffer.add('0'); |
| 685 } | 684 } |
| 686 buffer.add(code.toRadixString(16)); | |
| 687 } | 685 } |
| 686 buffer.add(code.toRadixString(16)); |
| 688 } else { | 687 } else { |
| 689 buffer.add(new String.fromCharCodes(<int>[code])); | 688 buffer.addCharCode(code); |
| 690 } | 689 } |
| 691 } | 690 } |
| 692 } | 691 } |
| 693 } | 692 } |
| 694 | 693 |
| 695 String getJsConstructor(ClassElement element) { | 694 String getJsConstructor(ClassElement element) { |
| 696 return compiler.namer.isolatePropertyAccess(element); | 695 return compiler.namer.isolatePropertyAccess(element); |
| 697 } | 696 } |
| 698 } | 697 } |
| 699 | 698 |
| (...skipping 447 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1147 Constant fieldValue = fieldValues[field]; | 1146 Constant fieldValue = fieldValues[field]; |
| 1148 if (fieldValue === null) { | 1147 if (fieldValue === null) { |
| 1149 // Use the default value. | 1148 // Use the default value. |
| 1150 fieldValue = compiler.compileVariable(field); | 1149 fieldValue = compiler.compileVariable(field); |
| 1151 } | 1150 } |
| 1152 jsNewArguments.add(fieldValue); | 1151 jsNewArguments.add(fieldValue); |
| 1153 }); | 1152 }); |
| 1154 return jsNewArguments; | 1153 return jsNewArguments; |
| 1155 } | 1154 } |
| 1156 } | 1155 } |
| OLD | NEW |