| 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('js_helper'); | 5 #library('js_helper'); |
| 6 | 6 |
| 7 #import('coreimpl.dart'); | 7 #import('coreimpl.dart'); |
| 8 | 8 |
| 9 #source('date_helper.dart'); | 9 #source('date_helper.dart'); |
| 10 #source('regexp_helper.dart'); | 10 #source('regexp_helper.dart'); |
| (...skipping 227 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 238 if (isJsArray(a)) { | 238 if (isJsArray(a)) { |
| 239 if (!(index is int)) { | 239 if (!(index is int)) { |
| 240 throw new IllegalArgumentException(index); | 240 throw new IllegalArgumentException(index); |
| 241 } | 241 } |
| 242 if (index < 0 || index >= a.length) { | 242 if (index < 0 || index >= a.length) { |
| 243 throw new IndexOutOfRangeException(index); | 243 throw new IndexOutOfRangeException(index); |
| 244 } | 244 } |
| 245 return JS("Object", @"$0[$1] = $2", a, index, value); | 245 return JS("Object", @"$0[$1] = $2", a, index, value); |
| 246 } | 246 } |
| 247 checkNull(a); | 247 checkNull(a); |
| 248 return UNINTERCEPTED(a[index] = value); | 248 UNINTERCEPTED(a[index] = value); |
| 249 return value; |
| 249 } | 250 } |
| 250 | 251 |
| 251 builtin$add$1(var receiver, var value) { | 252 builtin$add$1(var receiver, var value) { |
| 252 checkNull(receiver); | 253 checkNull(receiver); |
| 253 if (isJsArray(receiver)) { | 254 if (isJsArray(receiver)) { |
| 254 JS("Object", @"$0.push($1)", receiver, value); | 255 JS("Object", @"$0.push($1)", receiver, value); |
| 255 return; | 256 return; |
| 256 } | 257 } |
| 257 return UNINTERCEPTED(receiver.add(value)); | 258 return UNINTERCEPTED(receiver.add(value)); |
| 258 } | 259 } |
| (...skipping 28 matching lines...) Expand all Loading... |
| 287 builtin$set$length(receiver, newLength) { | 288 builtin$set$length(receiver, newLength) { |
| 288 checkNull(receiver); | 289 checkNull(receiver); |
| 289 if (isJsArray(receiver)) { | 290 if (isJsArray(receiver)) { |
| 290 checkNull(newLength); // TODO(ahe): This is not specified but co19 tests it. | 291 checkNull(newLength); // TODO(ahe): This is not specified but co19 tests it. |
| 291 if (newLength is !int) throw new IllegalArgumentException(newLength); | 292 if (newLength is !int) throw new IllegalArgumentException(newLength); |
| 292 if (newLength < 0) throw new IndexOutOfRangeException(newLength); | 293 if (newLength < 0) throw new IndexOutOfRangeException(newLength); |
| 293 JS('void', @"$0.length = $1", receiver, newLength); | 294 JS('void', @"$0.length = $1", receiver, newLength); |
| 294 } else { | 295 } else { |
| 295 UNINTERCEPTED(receiver.length = newLength); | 296 UNINTERCEPTED(receiver.length = newLength); |
| 296 } | 297 } |
| 298 return newLength; |
| 297 } | 299 } |
| 298 | 300 |
| 299 builtin$toString$0(var value) { | 301 builtin$toString$0(var value) { |
| 300 if (JS("bool", @"typeof $0 == 'object'", value)) { | 302 if (JS("bool", @"typeof $0 == 'object'", value)) { |
| 301 if (isJsArray(value)) { | 303 if (isJsArray(value)) { |
| 302 return "Instance of 'List'"; | 304 return "Instance of 'List'"; |
| 303 } | 305 } |
| 304 return UNINTERCEPTED(value.toString()); | 306 return UNINTERCEPTED(value.toString()); |
| 305 } | 307 } |
| 306 if (JS("bool", @"$0 === 0 && (1 / $0) < 0", value)) { | 308 if (JS("bool", @"$0 === 0 && (1 / $0) < 0", value)) { |
| (...skipping 277 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 584 checkNull(receiver); | 586 checkNull(receiver); |
| 585 if (!isJsArray(receiver)) { | 587 if (!isJsArray(receiver)) { |
| 586 return UNINTERCEPTED(receiver.getRange(start, length)); | 588 return UNINTERCEPTED(receiver.getRange(start, length)); |
| 587 } | 589 } |
| 588 if (0 === length) return []; | 590 if (0 === length) return []; |
| 589 checkNull(start); // TODO(ahe): This is not specified but co19 tests it. | 591 checkNull(start); // TODO(ahe): This is not specified but co19 tests it. |
| 590 checkNull(length); // TODO(ahe): This is not specified but co19 tests it. | 592 checkNull(length); // TODO(ahe): This is not specified but co19 tests it. |
| 591 if (start is !int) throw new IllegalArgumentException(start); | 593 if (start is !int) throw new IllegalArgumentException(start); |
| 592 if (length is !int) throw new IllegalArgumentException(length); | 594 if (length is !int) throw new IllegalArgumentException(length); |
| 593 if (start < 0) throw new IndexOutOfRangeException(start); | 595 if (start < 0) throw new IndexOutOfRangeException(start); |
| 596 if (length < 0) throw new IllegalArgumentException(length); |
| 594 var end = start + length; | 597 var end = start + length; |
| 595 if (end > receiver.length) { | 598 if (end > receiver.length) { |
| 596 throw new IndexOutOfRangeException(length); | 599 throw new IndexOutOfRangeException(length); |
| 597 } | 600 } |
| 598 if (length < 0) throw new IllegalArgumentException(length); | 601 if (length < 0) throw new IllegalArgumentException(length); |
| 599 return JS("Object", @"$0.slice($1, $2)", receiver, start, end); | 602 return JS("Object", @"$0.slice($1, $2)", receiver, start, end); |
| 600 } | 603 } |
| 601 | 604 |
| 602 builtin$indexOf$1(receiver, element) { | 605 builtin$indexOf$1(receiver, element) { |
| 603 checkNull(receiver); | 606 checkNull(receiver); |
| (...skipping 547 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1151 throw 'String.hashCode is not implemented'; | 1154 throw 'String.hashCode is not implemented'; |
| 1152 } | 1155 } |
| 1153 if (isJsArray(receiver)) { | 1156 if (isJsArray(receiver)) { |
| 1154 throw 'List.hashCode is not implemented'; | 1157 throw 'List.hashCode is not implemented'; |
| 1155 } | 1158 } |
| 1156 return UNINTERCEPTED(receiver.hashCode()); | 1159 return UNINTERCEPTED(receiver.hashCode()); |
| 1157 } | 1160 } |
| 1158 | 1161 |
| 1159 // TODO(ahe): Dynamic may be overridden. | 1162 // TODO(ahe): Dynamic may be overridden. |
| 1160 builtin$get$dynamic(receiver) => receiver; | 1163 builtin$get$dynamic(receiver) => receiver; |
| OLD | NEW |