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 #library('dart:_interceptors'); | 5 #library('dart:_interceptors'); |
6 | 6 |
7 #import('dart:collection'); | 7 #import('dart:collection'); |
8 | 8 |
9 add$1(var receiver, var value) { | 9 add$1(var receiver, var value) { |
10 if (isJsArray(receiver)) { | 10 if (isJsArray(receiver)) { |
(...skipping 48 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
59 if (newLength < 0) throw new RangeError.value(newLength); | 59 if (newLength < 0) throw new RangeError.value(newLength); |
60 checkGrowable(receiver, 'set length'); | 60 checkGrowable(receiver, 'set length'); |
61 JS('void', r'#.length = #', receiver, newLength); | 61 JS('void', r'#.length = #', receiver, newLength); |
62 } else { | 62 } else { |
63 UNINTERCEPTED(receiver.length = newLength); | 63 UNINTERCEPTED(receiver.length = newLength); |
64 } | 64 } |
65 return newLength; | 65 return newLength; |
66 } | 66 } |
67 | 67 |
68 toString(var value) { | 68 toString(var value) { |
69 if (JS('bool', r'typeof # == "object" && # !== null', value, value)) { | 69 if (JS('bool', r'typeof # == "object" && # != null', value, value)) { |
70 if (isJsArray(value)) { | 70 if (isJsArray(value)) { |
71 return Collections.collectionToString(value); | 71 return Collections.collectionToString(value); |
72 } else { | 72 } else { |
73 return UNINTERCEPTED(value.toString()); | 73 return UNINTERCEPTED(value.toString()); |
74 } | 74 } |
75 } | 75 } |
76 if (JS('bool', r'# === 0 && (1 / #) < 0', value, value)) { | 76 if (JS('bool', r'# === 0 && (1 / #) < 0', value, value)) { |
77 return '-0.0'; | 77 return '-0.0'; |
78 } | 78 } |
79 if (value == null) return 'null'; | 79 if (value == null) return 'null'; |
(...skipping 600 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
680 } else if (isJsArray(receiver)) { | 680 } else if (isJsArray(receiver)) { |
681 return getOrCreateCachedRuntimeType('List'); | 681 return getOrCreateCachedRuntimeType('List'); |
682 } else { | 682 } else { |
683 return UNINTERCEPTED(receiver.runtimeType); | 683 return UNINTERCEPTED(receiver.runtimeType); |
684 } | 684 } |
685 } | 685 } |
686 | 686 |
687 // TODO(lrn): These getters should be generated automatically for all | 687 // TODO(lrn): These getters should be generated automatically for all |
688 // intercepted methods. | 688 // intercepted methods. |
689 get$toString(receiver) => () => toString(receiver); | 689 get$toString(receiver) => () => toString(receiver); |
OLD | NEW |