Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(140)

Side by Side Diff: sdk/lib/html/templates/html/dart2js/indexed_db_dart2js.darttemplate

Issue 11419300: Dartifying dart:html type names. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 8 years ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
(Empty)
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
3 // BSD-style license that can be found in the LICENSE file.
4
5 // DO NOT EDIT
6 // Auto-generated dart:svg library.
7
8 library indexed_db;
9
10 import 'dart:html';
11 import 'dart:html_common';
12
13 $!GENERATED_DART_FILES
14
15 class _KeyRangeFactoryProvider {
16
17 static KeyRange createKeyRange_only(/*Key*/ value) =>
18 _only(_class(), _translateKey(value));
19
20 static KeyRange createKeyRange_lowerBound(
21 /*Key*/ bound, [bool open = false]) =>
22 _lowerBound(_class(), _translateKey(bound), open);
23
24 static KeyRange createKeyRange_upperBound(
25 /*Key*/ bound, [bool open = false]) =>
26 _upperBound(_class(), _translateKey(bound), open);
27
28 static KeyRange createKeyRange_bound(/*Key*/ lower, /*Key*/ upper,
29 [bool lowerOpen = false, bool upperOpen = false]) =>
30 _bound(_class(), _translateKey(lower), _translateKey(upper),
31 lowerOpen, upperOpen);
32
33 static var _cachedClass;
34
35 static _class() {
36 if (_cachedClass != null) return _cachedClass;
37 return _cachedClass = _uncachedClass();
38 }
39
40 static _uncachedClass() =>
41 JS('var',
42 '''window.webkitIDBKeyRange || window.mozIDBKeyRange ||
43 window.msIDBKeyRange || window.IDBKeyRange''');
44
45 static _translateKey(idbkey) => idbkey; // TODO: fixme.
46
47 static KeyRange _only(cls, value) =>
48 JS('KeyRange', '#.only(#)', cls, value);
49
50 static KeyRange _lowerBound(cls, bound, open) =>
51 JS('KeyRange', '#.lowerBound(#, #)', cls, bound, open);
52
53 static KeyRange _upperBound(cls, bound, open) =>
54 JS('KeyRange', '#.upperBound(#, #)', cls, bound, open);
55
56 static KeyRange _bound(cls, lower, upper, lowerOpen, upperOpen) =>
57 JS('KeyRange', '#.bound(#, #, #, #)',
58 cls, lower, upper, lowerOpen, upperOpen);
59 }
60
61
62 /**
63 * Converts a native IDBKey into a Dart object.
64 *
65 * May return the original input. May mutate the original input (but will be
66 * idempotent if mutation occurs). It is assumed that this conversion happens
67 * on native IDBKeys on all paths that return IDBKeys from native DOM calls.
68 *
69 * If necessary, JavaScript Dates are converted into Dart Dates.
70 */
71 _convertNativeToDart_IDBKey(nativeKey) {
72 containsDate(object) {
73 if (isJavaScriptDate(object)) return true;
74 if (object is List) {
75 for (int i = 0; i < object.length; i++) {
76 if (containsDate(object[i])) return true;
77 }
78 }
79 return false; // number, string.
80 }
81 if (containsDate(nativeKey)) {
82 throw new UnimplementedError('Key containing Date');
83 }
84 // TODO: Cache conversion somewhere?
85 return nativeKey;
86 }
87
88 /**
89 * Converts a Dart object into a valid IDBKey.
90 *
91 * May return the original input. Does not mutate input.
92 *
93 * If necessary, [dartKey] may be copied to ensure all lists are converted into
94 * JavaScript Arrays and Dart Dates into JavaScript Dates.
95 */
96 _convertDartToNative_IDBKey(dartKey) {
97 // TODO: Implement.
98 return dartKey;
99 }
100
101
102
103 /// May modify original. If so, action is idempotent.
104 _convertNativeToDart_IDBAny(object) {
105 return convertNativeToDart_AcceptStructuredClone(object, mustCopy: false);
106 }
107
108
109 const String _idbKey = '=List|=Object|num|String'; // TODO(sra): Add Date.
110 const _annotation_Creates_IDBKey = const Creates(_idbKey);
111 const _annotation_Returns_IDBKey = const Returns(_idbKey);
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698