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 for systems to generate | 6 """This module provides shared functionality for systems to generate |
7 Dart APIs from the IDL database.""" | 7 Dart APIs from the IDL database.""" |
8 | 8 |
9 import copy | 9 import copy |
10 import json | 10 import json |
(...skipping 577 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
588 # IDBAny is problematic. Some uses are just a union of other IDB types, | 588 # IDBAny is problematic. Some uses are just a union of other IDB types, |
589 # which need no conversion.. Others include data values which require | 589 # which need no conversion.. Others include data values which require |
590 # serialized script value processing. | 590 # serialized script value processing. |
591 '* get IDBCursorWithValue.value': | 591 '* get IDBCursorWithValue.value': |
592 Conversion('_convertNativeToDart_IDBAny', 'dynamic', 'dynamic'), | 592 Conversion('_convertNativeToDart_IDBAny', 'dynamic', 'dynamic'), |
593 | 593 |
594 # This is problematic. The result property of IDBRequest is used for | 594 # This is problematic. The result property of IDBRequest is used for |
595 # all requests. Read requests like IDBDataStore.getObject need | 595 # all requests. Read requests like IDBDataStore.getObject need |
596 # conversion, but other requests like opening a database return | 596 # conversion, but other requests like opening a database return |
597 # something that does not need conversion. | 597 # something that does not need conversion. |
598 'IDBAny get IDBRequest.result': | 598 '* get IDBRequest.result': |
599 Conversion('_convertNativeToDart_IDBAny', 'dynamic', 'dynamic'), | 599 Conversion('_convertNativeToDart_IDBAny', 'dynamic', 'dynamic'), |
600 | 600 |
601 # "source: On getting, returns the IDBObjectStore or IDBIndex that the | 601 # "source: On getting, returns the IDBObjectStore or IDBIndex that the |
602 # cursor is iterating. ...". So we should not try to convert it. | 602 # cursor is iterating. ...". So we should not try to convert it. |
603 'IDBAny get IDBCursor.source': None, | 603 '* get IDBCursor.source': None, |
604 | 604 |
605 # Should be either a DOMString, an Array of DOMStrings or null. | 605 # Should be either a DOMString, an Array of DOMStrings or null. |
606 'IDBAny get IDBObjectStore.keyPath': None, | 606 '* get IDBObjectStore.keyPath': None, |
607 | 607 |
608 '* get XMLHttpRequest.response': | 608 '* get XMLHttpRequest.response': |
609 Conversion('_convertNativeToDart_XHR_Response', | 609 Conversion('_convertNativeToDart_XHR_Response', |
610 'dynamic', 'dynamic'), | 610 'dynamic', 'dynamic'), |
611 }, dart2jsOnly=True) | 611 }, dart2jsOnly=True) |
612 | 612 |
613 def FindConversion(idl_type, direction, interface, member): | 613 def FindConversion(idl_type, direction, interface, member): |
614 table = dart2js_conversions | 614 table = dart2js_conversions |
615 return (table.get('%s %s %s.%s' % (idl_type, direction, interface, member)) or | 615 return (table.get('%s %s %s.%s' % (idl_type, direction, interface, member)) or |
616 table.get('* %s %s.%s' % (direction, interface, member)) or | 616 table.get('* %s %s.%s' % (direction, interface, member)) or |
(...skipping 652 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1269 if type_data.clazz == 'BasicTypedList': | 1269 if type_data.clazz == 'BasicTypedList': |
1270 if type_name == 'ArrayBuffer': | 1270 if type_name == 'ArrayBuffer': |
1271 dart_interface_name = 'ByteBuffer' | 1271 dart_interface_name = 'ByteBuffer' |
1272 else: | 1272 else: |
1273 dart_interface_name = self._renamer.RenameInterfaceId(type_name) | 1273 dart_interface_name = self._renamer.RenameInterfaceId(type_name) |
1274 return BasicTypedListIDLTypeInfo( | 1274 return BasicTypedListIDLTypeInfo( |
1275 type_name, type_data, dart_interface_name, self) | 1275 type_name, type_data, dart_interface_name, self) |
1276 | 1276 |
1277 class_name = '%sIDLTypeInfo' % type_data.clazz | 1277 class_name = '%sIDLTypeInfo' % type_data.clazz |
1278 return globals()[class_name](type_name, type_data) | 1278 return globals()[class_name](type_name, type_data) |
OLD | NEW |