Index: sdk/lib/html/templates/html/dart2js/indexed_db_dart2js.darttemplate |
diff --git a/sdk/lib/html/templates/html/dart2js/indexed_db_dart2js.darttemplate b/sdk/lib/html/templates/html/dart2js/indexed_db_dart2js.darttemplate |
new file mode 100644 |
index 0000000000000000000000000000000000000000..d55f7c7fdd752e039ed0bcbf86dc79ac76ffd5c7 |
--- /dev/null |
+++ b/sdk/lib/html/templates/html/dart2js/indexed_db_dart2js.darttemplate |
@@ -0,0 +1,111 @@ |
+// Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file |
+// for details. All rights reserved. Use of this source code is governed by a |
+// BSD-style license that can be found in the LICENSE file. |
+ |
+// DO NOT EDIT |
+// Auto-generated dart:svg library. |
+ |
+library indexed_db; |
+ |
+import 'dart:html'; |
+import 'dart:html_common'; |
+ |
+$!GENERATED_DART_FILES |
+ |
+class _KeyRangeFactoryProvider { |
+ |
+ static KeyRange createKeyRange_only(/*Key*/ value) => |
+ _only(_class(), _translateKey(value)); |
+ |
+ static KeyRange createKeyRange_lowerBound( |
+ /*Key*/ bound, [bool open = false]) => |
+ _lowerBound(_class(), _translateKey(bound), open); |
+ |
+ static KeyRange createKeyRange_upperBound( |
+ /*Key*/ bound, [bool open = false]) => |
+ _upperBound(_class(), _translateKey(bound), open); |
+ |
+ static KeyRange createKeyRange_bound(/*Key*/ lower, /*Key*/ upper, |
+ [bool lowerOpen = false, bool upperOpen = false]) => |
+ _bound(_class(), _translateKey(lower), _translateKey(upper), |
+ lowerOpen, upperOpen); |
+ |
+ static var _cachedClass; |
+ |
+ static _class() { |
+ if (_cachedClass != null) return _cachedClass; |
+ return _cachedClass = _uncachedClass(); |
+ } |
+ |
+ static _uncachedClass() => |
+ JS('var', |
+ '''window.webkitIDBKeyRange || window.mozIDBKeyRange || |
+ window.msIDBKeyRange || window.IDBKeyRange'''); |
+ |
+ static _translateKey(idbkey) => idbkey; // TODO: fixme. |
+ |
+ static KeyRange _only(cls, value) => |
+ JS('KeyRange', '#.only(#)', cls, value); |
+ |
+ static KeyRange _lowerBound(cls, bound, open) => |
+ JS('KeyRange', '#.lowerBound(#, #)', cls, bound, open); |
+ |
+ static KeyRange _upperBound(cls, bound, open) => |
+ JS('KeyRange', '#.upperBound(#, #)', cls, bound, open); |
+ |
+ static KeyRange _bound(cls, lower, upper, lowerOpen, upperOpen) => |
+ JS('KeyRange', '#.bound(#, #, #, #)', |
+ cls, lower, upper, lowerOpen, upperOpen); |
+} |
+ |
+ |
+/** |
+ * Converts a native IDBKey into a Dart object. |
+ * |
+ * May return the original input. May mutate the original input (but will be |
+ * idempotent if mutation occurs). It is assumed that this conversion happens |
+ * on native IDBKeys on all paths that return IDBKeys from native DOM calls. |
+ * |
+ * If necessary, JavaScript Dates are converted into Dart Dates. |
+ */ |
+_convertNativeToDart_IDBKey(nativeKey) { |
+ containsDate(object) { |
+ if (isJavaScriptDate(object)) return true; |
+ if (object is List) { |
+ for (int i = 0; i < object.length; i++) { |
+ if (containsDate(object[i])) return true; |
+ } |
+ } |
+ return false; // number, string. |
+ } |
+ if (containsDate(nativeKey)) { |
+ throw new UnimplementedError('Key containing Date'); |
+ } |
+ // TODO: Cache conversion somewhere? |
+ return nativeKey; |
+} |
+ |
+/** |
+ * Converts a Dart object into a valid IDBKey. |
+ * |
+ * May return the original input. Does not mutate input. |
+ * |
+ * If necessary, [dartKey] may be copied to ensure all lists are converted into |
+ * JavaScript Arrays and Dart Dates into JavaScript Dates. |
+ */ |
+_convertDartToNative_IDBKey(dartKey) { |
+ // TODO: Implement. |
+ return dartKey; |
+} |
+ |
+ |
+ |
+/// May modify original. If so, action is idempotent. |
+_convertNativeToDart_IDBAny(object) { |
+ return convertNativeToDart_AcceptStructuredClone(object, mustCopy: false); |
+} |
+ |
+ |
+const String _idbKey = '=List|=Object|num|String'; // TODO(sra): Add Date. |
+const _annotation_Creates_IDBKey = const Creates(_idbKey); |
+const _annotation_Returns_IDBKey = const Returns(_idbKey); |