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

Side by Side Diff: tools/dom/scripts/dartmetadata.py

Issue 16638013: Adding annotations for native types of type Object or dynamic. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 7 years, 6 months 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
« no previous file with comments | « tests/html/event_customevent_test.dart ('k') | tools/dom/scripts/htmldartgenerator.py » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 #!/usr/bin/python 1 #!/usr/bin/python
2 # Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file 2 # Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file
3 # for details. All rights reserved. Use of this source code is governed by a 3 # for details. All rights reserved. Use of this source code is governed by a
4 # BSD-style license that can be found in the LICENSE file. 4 # BSD-style license that can be found in the LICENSE file.
5 5
6 """This module provides shared functionality to provide Dart metadata for 6 """This module provides shared functionality to provide Dart metadata for
7 DOM APIs. 7 DOM APIs.
8 """ 8 """
9 9
10 import copy 10 import copy
(...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after
49 'CanvasRenderingContext2D.fillStyle': [ 49 'CanvasRenderingContext2D.fillStyle': [
50 "@Creates('String|CanvasGradient|CanvasPattern')", 50 "@Creates('String|CanvasGradient|CanvasPattern')",
51 "@Returns('String|CanvasGradient|CanvasPattern')", 51 "@Returns('String|CanvasGradient|CanvasPattern')",
52 ], 52 ],
53 53
54 'CanvasRenderingContext2D.strokeStyle': [ 54 'CanvasRenderingContext2D.strokeStyle': [
55 "@Creates('String|CanvasGradient|CanvasPattern')", 55 "@Creates('String|CanvasGradient|CanvasPattern')",
56 "@Returns('String|CanvasGradient|CanvasPattern')", 56 "@Returns('String|CanvasGradient|CanvasPattern')",
57 ], 57 ],
58 58
59 'CustomEvent.detail': [
60 "@Creates('Null')",
61 ],
62
59 # Normally DOMWindow is nevernull, but starting from a <template> element in 63 # Normally DOMWindow is nevernull, but starting from a <template> element in
60 # JavaScript, this will be null: 64 # JavaScript, this will be null:
61 # template.content.ownerDocument.defaultView 65 # template.content.ownerDocument.defaultView
62 'Document.window': [ 66 'Document.window': [
63 "@Creates('Window|=Object|Null')", 67 "@Creates('Window|=Object|Null')",
64 "@Returns('Window|=Object|Null')", 68 "@Returns('Window|=Object|Null')",
65 ], 69 ],
66 70
67 # Methods returning Window can return a local window, or a cross-frame 71 # Methods returning Window can return a local window, or a cross-frame
68 # window (=Object) that needs wrapping. 72 # window (=Object) that needs wrapping.
69 'DOMWindow': [ 73 'DOMWindow': [
70 "@Creates('Window|=Object')", 74 "@Creates('Window|=Object')",
71 "@Returns('Window|=Object')", 75 "@Returns('Window|=Object')",
72 ], 76 ],
73 77
74 'DOMWindow.openDatabase': [ 78 'DOMWindow.openDatabase': [
75 "@Creates('SqlDatabase')", 79 "@Creates('SqlDatabase')",
76 ], 80 ],
77 81
82 'DOMWindow.showModalDialog': [
83 "@Creates('Null')",
84 ],
85
78 # To be in callback with the browser-created Event, we had to have called 86 # To be in callback with the browser-created Event, we had to have called
79 # addEventListener on the target, so we avoid 87 # addEventListener on the target, so we avoid
80 'Event.currentTarget': [ 88 'Event.currentTarget': [
81 "@Creates('Null')", 89 "@Creates('Null')",
82 "@Returns('EventTarget|=Object')", 90 "@Returns('EventTarget|=Object')",
83 ], 91 ],
84 92
85 # Only nodes in the DOM bubble and have target !== currentTarget. 93 # Only nodes in the DOM bubble and have target !== currentTarget.
86 'Event.target': [ 94 'Event.target': [
87 "@Creates('Node')", 95 "@Creates('Node')",
88 "@Returns('EventTarget|=Object')", 96 "@Returns('EventTarget|=Object')",
89 ], 97 ],
90 98
91 'MouseEvent.relatedTarget': [ 99 'File.lastModifiedDate': [
92 "@Creates('Node')", 100 "@Creates('Null')", # JS date object.
93 "@Returns('EventTarget|=Object')",
94 ],
95
96 # Touch targets are Elements in a Document, or the Document.
97 'Touch.target': [
98 "@Creates('Element|Document')",
99 "@Returns('Element|Document')",
100 ], 101 ],
101 102
102 'FileReader.result': ["@Creates('String|ByteBuffer|Null')"], 103 'FileReader.result': ["@Creates('String|ByteBuffer|Null')"],
103 104
105 'FocusEvent.relatedTarget': [
106 "@Creates('Null')",
107 ],
108
109 'HTMLInputElement.valueAsDate': [
110 "@Creates('Null')", # JS date object.
111 ],
112
104 # Rather than have the result of an IDBRequest as a union over all possible 113 # Rather than have the result of an IDBRequest as a union over all possible
105 # results, we mark the result as instantiating any classes, and mark 114 # results, we mark the result as instantiating any classes, and mark
106 # each operation with the classes that it could cause to be asynchronously 115 # each operation with the classes that it could cause to be asynchronously
107 # instantiated. 116 # instantiated.
108 'IDBRequest.result': ["@Creates('Null')"], 117 'IDBRequest.result': ["@Creates('Null')"],
109 118
110 # The source is usually a participant in the operation that generated the 119 # The source is usually a participant in the operation that generated the
111 # IDBRequest. 120 # IDBRequest.
112 'IDBRequest.source': ["@Creates('Null')"], 121 'IDBRequest.source': ["@Creates('Null')"],
113 122
(...skipping 17 matching lines...) Expand all
131 'IDBCursorWithValue.value': [ 140 'IDBCursorWithValue.value': [
132 '@annotation_Creates_SerializedScriptValue', 141 '@annotation_Creates_SerializedScriptValue',
133 '@annotation_Returns_SerializedScriptValue', 142 '@annotation_Returns_SerializedScriptValue',
134 ], 143 ],
135 144
136 'IDBCursor.key': [ 145 'IDBCursor.key': [
137 "@_annotation_Creates_IDBKey", 146 "@_annotation_Creates_IDBKey",
138 "@_annotation_Returns_IDBKey", 147 "@_annotation_Returns_IDBKey",
139 ], 148 ],
140 149
150 'IDBCursor.primaryKey': [
151 "@_annotation_Creates_IDBKey",
152 "@_annotation_Returns_IDBKey",
153 ],
154
155 'IDBCursor.source': [
156 "@Creates('Null')",
157 "@Returns('ObjectStore|Index|Null')",
158 ],
159
160 'IDBDatabase.version': [
161 "@Creates('int|String|Null')",
162 "@Returns('int|String|Null')",
163 ],
164
165 'IDBIndex.keyPath': [
166 "@annotation_Creates_SerializedScriptValue",
167 ],
168
169 'IDBKeyRange.lower': [
170 "@annotation_Creates_SerializedScriptValue",
171 ],
172
173 'IDBKeyRange.upper': [
174 "@annotation_Creates_SerializedScriptValue",
175 ],
176
177 'IDBObjectStore.keyPath': [
178 "@annotation_Creates_SerializedScriptValue",
179 ],
180
181 '+IDBOpenDBRequest': [
182 "@Returns('Request')",
183 "@Creates('Request')",
184 ],
185
141 '+IDBRequest': [ 186 '+IDBRequest': [
142 "@Returns('Request')", 187 "@Returns('Request')",
143 "@Creates('Request')", 188 "@Creates('Request')",
144 ], 189 ],
145 190
146 '+IDBOpenDBRequest': [ 191 'IDBVersionChangeEvent.newVersion': [
147 "@Returns('Request')", 192 "@Creates('int|String|Null')",
148 "@Creates('Request')", 193 "@Returns('int|String|Null')",
194 ],
195
196 'IDBVersionChangeEvent.oldVersion': [
197 "@Creates('int|String|Null')",
198 "@Returns('int|String|Null')",
149 ], 199 ],
150 200
151 'MessageEvent.ports': ["@Creates('=List')"], 201 'MessageEvent.ports': ["@Creates('=List')"],
152 202
153 'MessageEvent.data': [ 203 'MessageEvent.data': [
154 "@annotation_Creates_SerializedScriptValue", 204 "@annotation_Creates_SerializedScriptValue",
155 "@annotation_Returns_SerializedScriptValue", 205 "@annotation_Returns_SerializedScriptValue",
156 ], 206 ],
207
208 'Metadata.modificationTime': [
209 "@Creates('Null')", # JS date object.
210 ],
211
212 'MouseEvent.relatedTarget': [
213 "@Creates('Node')",
214 "@Returns('EventTarget|=Object')",
215 ],
216
157 'PopStateEvent.state': [ 217 'PopStateEvent.state': [
158 "@annotation_Creates_SerializedScriptValue", 218 "@annotation_Creates_SerializedScriptValue",
159 "@annotation_Returns_SerializedScriptValue", 219 "@annotation_Returns_SerializedScriptValue",
160 ], 220 ],
221
222 'RTCStatsReport.timestamp': [
223 "@Creates('Null')", # JS date object.
224 ],
225
161 'SerializedScriptValue': [ 226 'SerializedScriptValue': [
162 "@annotation_Creates_SerializedScriptValue", 227 "@annotation_Creates_SerializedScriptValue",
163 "@annotation_Returns_SerializedScriptValue", 228 "@annotation_Returns_SerializedScriptValue",
164 ], 229 ],
165 230
166 'SQLResultSetRowList.item': ["@Creates('=Object')"], 231 'SQLResultSetRowList.item': ["@Creates('=Object')"],
167 232
233 # Touch targets are Elements in a Document, or the Document.
234 'Touch.target': [
235 "@Creates('Element|Document')",
236 "@Returns('Element|Document')",
237 ],
238
239 'TrackEvent.track': [
240 "@Creates('Null')",
241 ],
242
243 'WebGLRenderingContext.getBufferParameter': [
244 "@Creates('int|Null')",
245 "@Returns('int|Null')",
246 ],
247
248 'WebGLRenderingContext.getFramebufferAttachmentParameter': [
249 "@Creates('int|RenderBuffer|Texture|Null')",
250 "@Returns('int|RenderBuffer|Texture|Null')",
251 ],
252
253 'WebGLRenderingContext.getProgramParameter': [
254 "@Creates('int|bool|Null')",
255 "@Returns('int|bool|Null')",
256 ],
257
258 'WebGLRenderingContext.getRenderbufferParameter': [
259 "@Creates('int|Null')",
260 "@Returns('int|Null')",
261 ],
262
263 'WebGLRenderingContext.getShaderParameter': [
264 "@Creates('int|Null')",
265 "@Returns('int|Null')",
266 ],
267
268 'WebGLRenderingContext.getTexParameter': [
269 "@Creates('int|Null')",
270 "@Returns('int|Null')",
271 ],
272
273 'WebGLRenderingContext.getUniform': [
274 "@Creates('Null|num|String|bool|=List|Float32List|Int32List|Uint32List')",
275 "@Returns('Null|num|String|bool|=List|Float32List|Int32List|Uint32List')",
276 ],
277
278 'WebGLRenderingContext.getVertexAttrib': [
279 "@Creates('Null|num|bool|Float32List|Buffer')",
280 "@Returns('Null|num|bool|Float32List|Buffer')",
281 ],
282
168 'WebGLRenderingContext.getParameter': [ 283 'WebGLRenderingContext.getParameter': [
169 # Taken from http://www.khronos.org/registry/webgl/specs/latest/ 284 # Taken from http://www.khronos.org/registry/webgl/specs/latest/
170 # Section 5.14.3 Setting and getting state 285 # Section 5.14.3 Setting and getting state
171 "@Creates('Null|num|String|bool|=List|Float32List|Int32List|Uint32List" 286 "@Creates('Null|num|String|bool|=List|Float32List|Int32List|Uint32List"
172 "|Framebuffer|Renderbuffer|Texture')", 287 "|Framebuffer|Renderbuffer|Texture')",
173 "@Returns('Null|num|String|bool|=List|Float32List|Int32List|Uint32List" 288 "@Returns('Null|num|String|bool|=List|Float32List|Int32List|Uint32List"
174 "|Framebuffer|Renderbuffer|Texture')", 289 "|Framebuffer|Renderbuffer|Texture')",
175 ], 290 ],
176 291
177 'XMLHttpRequest.response': [ 292 'XMLHttpRequest.response': [
(...skipping 454 matching lines...) Expand 10 before | Expand all | Expand 10 after
632 pass 747 pass
633 else: 748 else:
634 _logger.warn('Unknown support_level - %s:%s' % (interface_id, member_id)) 749 _logger.warn('Unknown support_level - %s:%s' % (interface_id, member_id))
635 750
636 return annotations 751 return annotations
637 752
638 def Flush(self): 753 def Flush(self):
639 json_file = open(self._api_status_path, 'w+') 754 json_file = open(self._api_status_path, 'w+')
640 json.dump(self._types, json_file, indent=2, separators=(',', ': '), sort_key s=True) 755 json.dump(self._types, json_file, indent=2, separators=(',', ': '), sort_key s=True)
641 json_file.close() 756 json_file.close()
OLDNEW
« no previous file with comments | « tests/html/event_customevent_test.dart ('k') | tools/dom/scripts/htmldartgenerator.py » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698