| OLD | NEW |
| 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 11 matching lines...) Expand all Loading... |
| 22 # interface and member name, and by IDL return or field type name. Both are | 22 # interface and member name, and by IDL return or field type name. Both are |
| 23 # used to assemble the annotations: | 23 # used to assemble the annotations: |
| 24 # | 24 # |
| 25 # INTERFACE.MEMBER: annotations for member. | 25 # INTERFACE.MEMBER: annotations for member. |
| 26 # +TYPE: add annotations only if there are member annotations. | 26 # +TYPE: add annotations only if there are member annotations. |
| 27 # -TYPE: add annotations only if there are no member annotations. | 27 # -TYPE: add annotations only if there are no member annotations. |
| 28 # TYPE: add regardless of member annotations. | 28 # TYPE: add regardless of member annotations. |
| 29 | 29 |
| 30 _dart2js_annotations = monitored.Dict('dartmetadata._dart2js_annotations', { | 30 _dart2js_annotations = monitored.Dict('dartmetadata._dart2js_annotations', { |
| 31 | 31 |
| 32 'AnimationEffectTiming.duration': [ |
| 33 "@Creates('Null')", |
| 34 "@Returns('num|String')", |
| 35 ], |
| 36 |
| 32 'ArrayBufferView': [ | 37 'ArrayBufferView': [ |
| 33 "@Creates('TypedData')", | 38 "@Creates('TypedData')", |
| 34 "@Returns('TypedData|Null')", | 39 "@Returns('TypedData|Null')", |
| 35 ], | 40 ], |
| 36 | 41 |
| 37 'CanvasRenderingContext2D.createImageData': [ | 42 'CanvasRenderingContext2D.createImageData': [ |
| 38 "@Creates('ImageData|=Object')", | 43 "@Creates('ImageData|=Object')", |
| 39 ], | 44 ], |
| 40 | 45 |
| 41 'CanvasRenderingContext2D.getImageData': [ | 46 'CanvasRenderingContext2D.getImageData': [ |
| 42 "@Creates('ImageData|=Object')", | 47 "@Creates('ImageData|=Object')", |
| 43 ], | 48 ], |
| 44 | 49 |
| 45 'CanvasRenderingContext2D.webkitGetImageDataHD': [ | 50 'CanvasRenderingContext2D.webkitGetImageDataHD': [ |
| 46 "@Creates('ImageData|=Object')", | 51 "@Creates('ImageData|=Object')", |
| 47 ], | 52 ], |
| 48 | 53 |
| 49 'CanvasRenderingContext2D.fillStyle': [ | 54 'CanvasRenderingContext2D.fillStyle': [ |
| 50 "@Creates('String|CanvasGradient|CanvasPattern')", | 55 "@Creates('String|CanvasGradient|CanvasPattern')", |
| 51 "@Returns('String|CanvasGradient|CanvasPattern')", | 56 "@Returns('String|CanvasGradient|CanvasPattern')", |
| 52 ], | 57 ], |
| 53 | 58 |
| 54 'CanvasRenderingContext2D.strokeStyle': [ | 59 'CanvasRenderingContext2D.strokeStyle': [ |
| 55 "@Creates('String|CanvasGradient|CanvasPattern')", | 60 "@Creates('String|CanvasGradient|CanvasPattern')", |
| 56 "@Returns('String|CanvasGradient|CanvasPattern')", | 61 "@Returns('String|CanvasGradient|CanvasPattern')", |
| 57 ], | 62 ], |
| 58 | 63 |
| 64 'CryptoKey.algorithm': [ |
| 65 "@Creates('Null')", |
| 66 ], |
| 67 |
| 59 'CustomEvent._detail': [ | 68 'CustomEvent._detail': [ |
| 60 "@Creates('Null')", | 69 "@Creates('Null')", |
| 61 ], | 70 ], |
| 62 | 71 |
| 63 # Normally Window is never null, but starting from a <template> element in | 72 # Normally Window is never null, but starting from a <template> element in |
| 64 # JavaScript, this will be null: | 73 # JavaScript, this will be null: |
| 65 # template.content.ownerDocument.defaultView | 74 # template.content.ownerDocument.defaultView |
| 66 'Document.window': [ | 75 'Document.window': [ |
| 67 "@Creates('Window|=Object|Null')", | 76 "@Creates('Window|=Object|Null')", |
| 68 "@Returns('Window|=Object|Null')", | 77 "@Returns('Window|=Object|Null')", |
| (...skipping 214 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 283 | 292 |
| 284 'RTCStatsReport.timestamp': [ | 293 'RTCStatsReport.timestamp': [ |
| 285 "@Creates('Null')", # JS date object. | 294 "@Creates('Null')", # JS date object. |
| 286 ], | 295 ], |
| 287 | 296 |
| 288 'SerializedScriptValue': [ | 297 'SerializedScriptValue': [ |
| 289 "@annotation_Creates_SerializedScriptValue", | 298 "@annotation_Creates_SerializedScriptValue", |
| 290 "@annotation_Returns_SerializedScriptValue", | 299 "@annotation_Returns_SerializedScriptValue", |
| 291 ], | 300 ], |
| 292 | 301 |
| 302 'ServiceWorkerMessageEvent.data': [ |
| 303 "@annotation_Creates_SerializedScriptValue", |
| 304 "@annotation_Returns_SerializedScriptValue", |
| 305 ], |
| 306 |
| 307 'ServiceWorkerMessageEvent.source': [ |
| 308 "@Creates('Null')", |
| 309 "@Returns('ServiceWorker|MessagePort')", |
| 310 ], |
| 311 |
| 293 'ShadowRoot.getElementsByClassName': [ | 312 'ShadowRoot.getElementsByClassName': [ |
| 294 "@Creates('NodeList|HtmlCollection')", | 313 "@Creates('NodeList|HtmlCollection')", |
| 295 "@Returns('NodeList|HtmlCollection')", | 314 "@Returns('NodeList|HtmlCollection')", |
| 296 ], | 315 ], |
| 297 | 316 |
| 298 'ShadowRoot.getElementsByName': [ | 317 'ShadowRoot.getElementsByName': [ |
| 299 "@Creates('NodeList|HtmlCollection')", | 318 "@Creates('NodeList|HtmlCollection')", |
| 300 "@Returns('NodeList|HtmlCollection')", | 319 "@Returns('NodeList|HtmlCollection')", |
| 301 ], | 320 ], |
| 302 | 321 |
| 303 'ShadowRoot.getElementsByTagName': [ | 322 'ShadowRoot.getElementsByTagName': [ |
| 304 "@Creates('NodeList|HtmlCollection')", | 323 "@Creates('NodeList|HtmlCollection')", |
| 305 "@Returns('NodeList|HtmlCollection')", | 324 "@Returns('NodeList|HtmlCollection')", |
| 306 ], | 325 ], |
| 307 | 326 |
| 308 'SQLResultSetRowList.item': ["@Creates('=Object')"], | 327 'SQLResultSetRowList.item': ["@Creates('=Object')"], |
| 309 | 328 |
| 310 # Touch targets are Elements in a Document, or the Document. | 329 # Touch targets are Elements in a Document, or the Document. |
| 311 'Touch.target': [ | 330 'Touch.target': [ |
| 312 "@Creates('Element|Document')", | 331 "@Creates('Element|Document')", |
| 313 "@Returns('Element|Document')", | 332 "@Returns('Element|Document')", |
| 314 ], | 333 ], |
| 315 | 334 |
| 316 'TrackEvent.track': [ | 335 'TrackEvent.track': [ |
| 317 "@Creates('Null')", | 336 "@Creates('Null')", |
| 318 ], | 337 ], |
| 319 | 338 |
| 339 'VTTCue.line': [ |
| 340 "@Returns('num|String')", |
| 341 ], |
| 342 |
| 343 'VTTCue.position': [ |
| 344 "@Returns('num|String')", |
| 345 ], |
| 346 |
| 320 'WebGLRenderingContext.getBufferParameter': [ | 347 'WebGLRenderingContext.getBufferParameter': [ |
| 321 "@Creates('int|Null')", | 348 "@Creates('int|Null')", |
| 322 "@Returns('int|Null')", | 349 "@Returns('int|Null')", |
| 323 ], | 350 ], |
| 324 | 351 |
| 325 'WebGLRenderingContext.getFramebufferAttachmentParameter': [ | 352 'WebGLRenderingContext.getFramebufferAttachmentParameter': [ |
| 326 "@Creates('int|Renderbuffer|Texture|Null')", | 353 "@Creates('int|Renderbuffer|Texture|Null')", |
| 327 "@Returns('int|Renderbuffer|Texture|Null')", | 354 "@Returns('int|Renderbuffer|Texture|Null')", |
| 328 ], | 355 ], |
| 329 | 356 |
| (...skipping 525 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 855 pass | 882 pass |
| 856 else: | 883 else: |
| 857 _logger.warn('Unknown support_level - %s:%s' % (interface_id, member_id)) | 884 _logger.warn('Unknown support_level - %s:%s' % (interface_id, member_id)) |
| 858 | 885 |
| 859 return annotations | 886 return annotations |
| 860 | 887 |
| 861 def Flush(self): | 888 def Flush(self): |
| 862 json_file = open(self._api_status_path, 'w+') | 889 json_file = open(self._api_status_path, 'w+') |
| 863 json.dump(self._types, json_file, indent=2, separators=(',', ': '), sort_key
s=True) | 890 json.dump(self._types, json_file, indent=2, separators=(',', ': '), sort_key
s=True) |
| 864 json_file.close() | 891 json_file.close() |
| OLD | NEW |