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:_js_helper'); | 5 #library('dart:_js_helper'); |
6 | 6 |
7 #import('dart:coreimpl'); | 7 #import('dart:coreimpl'); |
8 | 8 |
9 #source('constant_map.dart'); | 9 #source('constant_map.dart'); |
10 #source('native_helper.dart'); | 10 #source('native_helper.dart'); |
(...skipping 305 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
316 } | 316 } |
317 checkMutable(a, 'indexed set'); | 317 checkMutable(a, 'indexed set'); |
318 JS('Object', r'#[#] = #', a, index, value); | 318 JS('Object', r'#[#] = #', a, index, value); |
319 return; | 319 return; |
320 } | 320 } |
321 UNINTERCEPTED(a[index] = value); | 321 UNINTERCEPTED(a[index] = value); |
322 } | 322 } |
323 | 323 |
324 checkMutable(list, reason) { | 324 checkMutable(list, reason) { |
325 if (JS('bool', r'!!(#.immutable$list)', list)) { | 325 if (JS('bool', r'!!(#.immutable$list)', list)) { |
326 throw new UnsupportedOperationException(reason); | 326 throw new UnsupportedError(reason); |
327 } | 327 } |
328 } | 328 } |
329 | 329 |
330 checkGrowable(list, reason) { | 330 checkGrowable(list, reason) { |
331 if (JS('bool', r'!!(#.fixed$length)', list)) { | 331 if (JS('bool', r'!!(#.fixed$length)', list)) { |
332 throw new UnsupportedOperationException(reason); | 332 throw new UnsupportedError(reason); |
333 } | 333 } |
334 } | 334 } |
335 | 335 |
336 String S(value) { | 336 String S(value) { |
337 var res = value.toString(); | 337 var res = value.toString(); |
338 if (res is !String) throw new ArgumentError(value); | 338 if (res is !String) throw new ArgumentError(value); |
339 return res; | 339 return res; |
340 } | 340 } |
341 | 341 |
342 class ListIterator<T> implements Iterator<T> { | 342 class ListIterator<T> implements Iterator<T> { |
(...skipping 698 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1041 } | 1041 } |
1042 | 1042 |
1043 /** | 1043 /** |
1044 * Represents the type of Null. The compiler treats this specially. | 1044 * Represents the type of Null. The compiler treats this specially. |
1045 * TODO(lrn): Null should be defined in core. It's a class, like int. | 1045 * TODO(lrn): Null should be defined in core. It's a class, like int. |
1046 * It just happens to act differently in assignability tests and, | 1046 * It just happens to act differently in assignability tests and, |
1047 * like int, can't be extended or implemented. | 1047 * like int, can't be extended or implemented. |
1048 */ | 1048 */ |
1049 class Null { | 1049 class Null { |
1050 factory Null() { | 1050 factory Null() { |
1051 throw new UnsupportedOperationException('new Null()'); | 1051 throw new UnsupportedError('new Null()'); |
1052 } | 1052 } |
1053 } | 1053 } |
1054 | 1054 |
1055 setRuntimeTypeInfo(target, typeInfo) { | 1055 setRuntimeTypeInfo(target, typeInfo) { |
1056 // We have to check for null because factories may return null. | 1056 // We have to check for null because factories may return null. |
1057 if (target != null) JS('var', r'#.builtin$typeInfo = #', target, typeInfo); | 1057 if (target != null) JS('var', r'#.builtin$typeInfo = #', target, typeInfo); |
1058 } | 1058 } |
1059 | 1059 |
1060 getRuntimeTypeInfo(target) { | 1060 getRuntimeTypeInfo(target) { |
1061 if (target == null) return null; | 1061 if (target == null) return null; |
(...skipping 339 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1401 JS('void', r'#.runtimeTypeCache[#] = #', JS_CURRENT_ISOLATE(), key, | 1401 JS('void', r'#.runtimeTypeCache[#] = #', JS_CURRENT_ISOLATE(), key, |
1402 runtimeType); | 1402 runtimeType); |
1403 } | 1403 } |
1404 return runtimeType; | 1404 return runtimeType; |
1405 } | 1405 } |
1406 | 1406 |
1407 String getRuntimeTypeString(var object) { | 1407 String getRuntimeTypeString(var object) { |
1408 var typeInfo = JS('Object', r'#.builtin$typeInfo', object); | 1408 var typeInfo = JS('Object', r'#.builtin$typeInfo', object); |
1409 return JS('String', r'#.runtimeType', typeInfo); | 1409 return JS('String', r'#.runtimeType', typeInfo); |
1410 } | 1410 } |
OLD | NEW |