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:coreimpl'); | 7 #import('dart:coreimpl'); |
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 127 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
138 } else { | 138 } else { |
139 return UNINTERCEPTED(a.compareTo(b)); | 139 return UNINTERCEPTED(a.compareTo(b)); |
140 } | 140 } |
141 } | 141 } |
142 | 142 |
143 addAll(receiver, collection) { | 143 addAll(receiver, collection) { |
144 if (!isJsArray(receiver)) return UNINTERCEPTED(receiver.addAll(collection)); | 144 if (!isJsArray(receiver)) return UNINTERCEPTED(receiver.addAll(collection)); |
145 | 145 |
146 // TODO(ahe): Use for-in when it is implemented correctly. | 146 // TODO(ahe): Use for-in when it is implemented correctly. |
147 var iterator = collection.iterator(); | 147 var iterator = collection.iterator(); |
148 while (iterator.hasNext()) { | 148 while (iterator.hasNext) { |
149 receiver.add(iterator.next()); | 149 receiver.add(iterator.next()); |
150 } | 150 } |
151 } | 151 } |
152 | 152 |
153 addLast(receiver, value) { | 153 addLast(receiver, value) { |
154 if (!isJsArray(receiver)) return UNINTERCEPTED(receiver.addLast(value)); | 154 if (!isJsArray(receiver)) return UNINTERCEPTED(receiver.addLast(value)); |
155 | 155 |
156 checkGrowable(receiver, 'addLast'); | 156 checkGrowable(receiver, 'addLast'); |
157 JS('Object', r'#.push(#)', receiver, value); | 157 JS('Object', r'#.push(#)', receiver, value); |
158 } | 158 } |
(...skipping 521 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 |