Chromium Code Reviews| 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 re | 10 import re |
| (...skipping 714 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 725 'unsigned long': PrimitiveIDLTypeInfo('unsigned long', dart_type='int', | 725 'unsigned long': PrimitiveIDLTypeInfo('unsigned long', dart_type='int', |
| 726 native_type='unsigned', | 726 native_type='unsigned', |
| 727 webcore_getter_name='getUnsignedIntegralAttribute', | 727 webcore_getter_name='getUnsignedIntegralAttribute', |
| 728 webcore_setter_name='setUnsignedIntegralAttribute'), | 728 webcore_setter_name='setUnsignedIntegralAttribute'), |
| 729 'long long': PrimitiveIDLTypeInfo('long long', dart_type='int'), | 729 'long long': PrimitiveIDLTypeInfo('long long', dart_type='int'), |
| 730 'unsigned long long': PrimitiveIDLTypeInfo('unsigned long long', dart_type=' int'), | 730 'unsigned long long': PrimitiveIDLTypeInfo('unsigned long long', dart_type=' int'), |
| 731 'float': PrimitiveIDLTypeInfo('float', dart_type='num', native_type='double' ), | 731 'float': PrimitiveIDLTypeInfo('float', dart_type='num', native_type='double' ), |
| 732 'double': PrimitiveIDLTypeInfo('double', dart_type='num'), | 732 'double': PrimitiveIDLTypeInfo('double', dart_type='num'), |
| 733 | 733 |
| 734 'any': PrimitiveIDLTypeInfo('any', dart_type='Object'), | 734 'any': PrimitiveIDLTypeInfo('any', dart_type='Object'), |
| 735 'any[]': PrimitiveIDLTypeInfo('any[]', dart_type='List'), | |
| 736 'Array': PrimitiveIDLTypeInfo('Array', dart_type='List'), | 735 'Array': PrimitiveIDLTypeInfo('Array', dart_type='List'), |
| 737 'custom': PrimitiveIDLTypeInfo('custom', dart_type='Dynamic'), | 736 'custom': PrimitiveIDLTypeInfo('custom', dart_type='Dynamic'), |
| 738 'Date': PrimitiveIDLTypeInfo('Date', dart_type='Date', native_type='double') , | 737 'Date': PrimitiveIDLTypeInfo('Date', dart_type='Date', native_type='double') , |
| 739 'DOMObject': PrimitiveIDLTypeInfo('DOMObject', dart_type='Object', native_ty pe='ScriptValue'), | 738 'DOMObject': PrimitiveIDLTypeInfo('DOMObject', dart_type='Object', native_ty pe='ScriptValue'), |
| 740 'DOMString': PrimitiveIDLTypeInfo('DOMString', dart_type='String', native_ty pe='String'), | 739 'DOMString': PrimitiveIDLTypeInfo('DOMString', dart_type='String', native_ty pe='String'), |
| 741 # TODO(vsm): This won't actually work until we convert the Map to | 740 # TODO(vsm): This won't actually work until we convert the Map to |
| 742 # a native JS Map for JS DOM. | 741 # a native JS Map for JS DOM. |
| 743 'Dictionary': PrimitiveIDLTypeInfo('Dictionary', dart_type='Map'), | 742 'Dictionary': PrimitiveIDLTypeInfo('Dictionary', dart_type='Map'), |
| 744 # TODO(sra): Flags is really a dictionary: {create:bool, exclusive:bool} | 743 # TODO(sra): Flags is really a dictionary: {create:bool, exclusive:bool} |
| 745 # http://dev.w3.org/2009/dap/file-system/file-dir-sys.html#the-flags-interfa ce | 744 # http://dev.w3.org/2009/dap/file-system/file-dir-sys.html#the-flags-interfa ce |
| 746 'Flags': PrimitiveIDLTypeInfo('Flags', dart_type='Object'), | 745 'Flags': PrimitiveIDLTypeInfo('Flags', dart_type='Object'), |
| 747 'DOMTimeStamp': PrimitiveIDLTypeInfo('DOMTimeStamp', dart_type='int', native _type='unsigned long long'), | 746 'DOMTimeStamp': PrimitiveIDLTypeInfo('DOMTimeStamp', dart_type='int', native _type='unsigned long long'), |
| 748 'object': PrimitiveIDLTypeInfo('object', dart_type='Object', native_type='Sc riptValue'), | 747 'object': PrimitiveIDLTypeInfo('object', dart_type='Object', native_type='Sc riptValue'), |
| 749 'PositionOptions': PrimitiveIDLTypeInfo('PositionOptions', dart_type='Object '), | 748 'PositionOptions': PrimitiveIDLTypeInfo('PositionOptions', dart_type='Object '), |
| 750 # TODO(sra): Come up with some meaningful name so that where this appears in | 749 # TODO(sra): Come up with some meaningful name so that where this appears in |
| 751 # the documentation, the user is made aware that only a limited subset of | 750 # the documentation, the user is made aware that only a limited subset of |
| 752 # serializable types are actually permitted. | 751 # serializable types are actually permitted. |
| 753 'SerializedScriptValue': PrimitiveIDLTypeInfo('SerializedScriptValue', dart_ type='Dynamic'), | 752 'SerializedScriptValue': PrimitiveIDLTypeInfo('SerializedScriptValue', dart_ type='Dynamic'), |
| 754 # TODO(sra): Flags is really a dictionary: {create:bool, exclusive:bool} | 753 # TODO(sra): Flags is really a dictionary: {create:bool, exclusive:bool} |
| 755 # http://dev.w3.org/2009/dap/file-system/file-dir-sys.html#the-flags-interfa ce | 754 # http://dev.w3.org/2009/dap/file-system/file-dir-sys.html#the-flags-interfa ce |
| 756 'WebKitFlags': PrimitiveIDLTypeInfo('WebKitFlags', dart_type='Object'), | 755 'WebKitFlags': PrimitiveIDLTypeInfo('WebKitFlags', dart_type='Object'), |
| 757 | 756 |
| 758 'sequence': PrimitiveIDLTypeInfo('sequence', dart_type='List'), | 757 'sequence': PrimitiveIDLTypeInfo('sequence', dart_type='List'), |
| 759 'void': PrimitiveIDLTypeInfo('void', dart_type='void'), | 758 'void': PrimitiveIDLTypeInfo('void', dart_type='void'), |
| 760 | 759 |
| 761 'CSSRule': IDLTypeInfo('CSSRule', conversion_includes=['CSSImportRule']), | 760 'CSSRule': IDLTypeInfo('CSSRule', conversion_includes=['CSSImportRule']), |
| 762 'DOMException': IDLTypeInfo('DOMException', native_type='DOMCoreException'), | 761 'DOMException': IDLTypeInfo('DOMException', native_type='DOMCoreException'), |
| 762 'DOMString[]': IDLTypeInfo('DOMStringList', dart_type='List<String>', custom _to_native=True), | |
|
podivilov
2012/06/20 15:08:39
Is there any difference between DOMString[] and DO
Anton Muhin
2012/06/20 15:13:54
For now I just followed v8 bindings which apparent
podivilov
2012/06/20 15:54:46
If they are the same things, we should just fix th
sra1
2012/06/20 16:33:26
I think that they are not the same.
On Chrome the
Anton Muhin
2012/06/20 18:45:47
Sorry, I indeed missed that they create a fresh ar
| |
| 763 'DOMStringList': IDLTypeInfo('DOMStringList', dart_type='List<String>', cust om_to_native=True), | 763 'DOMStringList': IDLTypeInfo('DOMStringList', dart_type='List<String>', cust om_to_native=True), |
| 764 'DOMStringMap': IDLTypeInfo('DOMStringMap', dart_type='Map<String, String>') , | 764 'DOMStringMap': IDLTypeInfo('DOMStringMap', dart_type='Map<String, String>') , |
| 765 'DOMWindow': IDLTypeInfo('DOMWindow', custom_to_dart=True), | 765 'DOMWindow': IDLTypeInfo('DOMWindow', custom_to_dart=True), |
| 766 'Element': IDLTypeInfo('Element', custom_to_dart=True), | 766 'Element': IDLTypeInfo('Element', custom_to_dart=True), |
| 767 'EventListener': IDLTypeInfo('EventListener', custom_to_native=True), | 767 'EventListener': IDLTypeInfo('EventListener', custom_to_native=True), |
| 768 'EventTarget': IDLTypeInfo('EventTarget', custom_to_native=True), | 768 'EventTarget': IDLTypeInfo('EventTarget', custom_to_native=True), |
| 769 'HTMLElement': IDLTypeInfo('HTMLElement', custom_to_dart=True), | 769 'HTMLElement': IDLTypeInfo('HTMLElement', custom_to_dart=True), |
| 770 'IDBAny': IDLTypeInfo('IDBAny', dart_type='Dynamic', custom_to_native=True), | 770 'IDBAny': IDLTypeInfo('IDBAny', dart_type='Dynamic', custom_to_native=True), |
| 771 'IDBKey': IDLTypeInfo('IDBKey', dart_type='Dynamic', custom_to_native=True), | 771 'IDBKey': IDLTypeInfo('IDBKey', dart_type='Dynamic', custom_to_native=True), |
| 772 'StyleSheet': IDLTypeInfo('StyleSheet', conversion_includes=['CSSStyleSheet' ]), | 772 'StyleSheet': IDLTypeInfo('StyleSheet', conversion_includes=['CSSStyleSheet' ]), |
| (...skipping 18 matching lines...) Expand all Loading... | |
| 791 _svg_supplemental_includes = [ | 791 _svg_supplemental_includes = [ |
| 792 '"SVGAnimatedPropertyTearOff.h"', | 792 '"SVGAnimatedPropertyTearOff.h"', |
| 793 '"SVGAnimatedListPropertyTearOff.h"', | 793 '"SVGAnimatedListPropertyTearOff.h"', |
| 794 '"SVGStaticListPropertyTearOff.h"', | 794 '"SVGStaticListPropertyTearOff.h"', |
| 795 '"SVGAnimatedListPropertyTearOff.h"', | 795 '"SVGAnimatedListPropertyTearOff.h"', |
| 796 '"SVGTransformListPropertyTearOff.h"', | 796 '"SVGTransformListPropertyTearOff.h"', |
| 797 '"SVGPathSegListPropertyTearOff.h"', | 797 '"SVGPathSegListPropertyTearOff.h"', |
| 798 ] | 798 ] |
| 799 | 799 |
| 800 def GetIDLTypeInfo(idl_type_name): | 800 def GetIDLTypeInfo(idl_type_name): |
| 801 type_info = _idl_type_registry.get(idl_type_name) | |
| 802 if type_info is not None: | |
| 803 return type_info | |
| 804 | |
| 801 match = re.match(r'sequence<(\w+)>$', idl_type_name) | 805 match = re.match(r'sequence<(\w+)>$', idl_type_name) |
| 802 if match: | 806 if match: |
| 803 return SequenceIDLTypeInfo(idl_type_name, GetIDLTypeInfo(match.group(1))) | 807 return SequenceIDLTypeInfo(idl_type_name, GetIDLTypeInfo(match.group(1))) |
| 804 return _idl_type_registry.get(idl_type_name, IDLTypeInfo(idl_type_name)) | 808 |
| 809 match = re.match(r'(\w+)\[\]$', idl_type_name) | |
| 810 if match: | |
| 811 return SequenceIDLTypeInfo(idl_type_name, GetIDLTypeInfo(match.group(1))) | |
| 812 | |
| 813 return IDLTypeInfo(idl_type_name) | |
| OLD | NEW |