| 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 | 5 |
| 6 // Conversions for IDBKey. | 6 // Conversions for IDBKey. |
| 7 // | 7 // |
| 8 // Per http://www.w3.org/TR/IndexedDB/#key-construct | 8 // Per http://www.w3.org/TR/IndexedDB/#key-construct |
| 9 // | 9 // |
| 10 // "A value is said to be a valid key if it is one of the following types: Array | 10 // "A value is said to be a valid key if it is one of the following types: Array |
| (...skipping 374 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 385 return JS('', '{data: #, height: #, width: #}', | 385 return JS('', '{data: #, height: #, width: #}', |
| 386 imageData.data, imageData.height, imageData.width); | 386 imageData.data, imageData.height, imageData.width); |
| 387 } | 387 } |
| 388 return imageData; | 388 return imageData; |
| 389 } | 389 } |
| 390 | 390 |
| 391 | 391 |
| 392 bool isJavaScriptDate(value) => JS('bool', '# instanceof Date', value); | 392 bool isJavaScriptDate(value) => JS('bool', '# instanceof Date', value); |
| 393 bool isJavaScriptRegExp(value) => JS('bool', '# instanceof RegExp', value); | 393 bool isJavaScriptRegExp(value) => JS('bool', '# instanceof RegExp', value); |
| 394 bool isJavaScriptArray(value) => JS('bool', '# instanceof Array', value); | 394 bool isJavaScriptArray(value) => JS('bool', '# instanceof Array', value); |
| 395 bool isJavaScriptSimpleObject(value) => | 395 bool isJavaScriptSimpleObject(value) { |
| 396 JS('bool', 'Object.getPrototypeOf(#) === Object.prototype', value); | 396 var proto = JS('', 'Object.getPrototypeOf(#)', value); |
| 397 return JS('bool', '# === Object.prototype', proto) || |
| 398 JS('bool', '# === null', proto); |
| 399 } |
| 397 bool isImmutableJavaScriptArray(value) => | 400 bool isImmutableJavaScriptArray(value) => |
| 398 JS('bool', r'!!(#.immutable$list)', value); | 401 JS('bool', r'!!(#.immutable$list)', value); |
| 399 | 402 |
| 400 | 403 |
| 401 | 404 |
| 402 const String _serializedScriptValue = | 405 const String _serializedScriptValue = |
| 403 'num|String|bool|' | 406 'num|String|bool|' |
| 404 'JSExtendableArray|=Object|' | 407 'JSExtendableArray|=Object|' |
| 405 'Blob|File|NativeByteBuffer|NativeTypedData' | 408 'Blob|File|NativeByteBuffer|NativeTypedData' |
| 406 // TODO(sra): Add Date, RegExp. | 409 // TODO(sra): Add Date, RegExp. |
| 407 ; | 410 ; |
| 408 const annotation_Creates_SerializedScriptValue = | 411 const annotation_Creates_SerializedScriptValue = |
| 409 const Creates(_serializedScriptValue); | 412 const Creates(_serializedScriptValue); |
| 410 const annotation_Returns_SerializedScriptValue = | 413 const annotation_Returns_SerializedScriptValue = |
| 411 const Returns(_serializedScriptValue); | 414 const Returns(_serializedScriptValue); |
| OLD | NEW |